Contest Documentation

Languages and Standard Libraries

Sample Code

C

#include <stdio.h>

int main(void) {
	// Read from stdin and parse the line
	int a, b;
	scanf("%d %d", &a, &b);
	
	// Write to stdout
	printf("%d", a + b);
	
	return 0;
}

C++

#include <iostream>

using namespace std;

int main() {
	// Read from stdin and parse line
	int a, b;
	cin >> a >> b;

	// Write to stdout
	cout << a + b << endl;

	return 0;
}

Java

import java.io.*;
import java.util.*;

// If the class is public, its name should match the filename (e.g. "Program" in "Program.java")
class Program {
	public static void main(String[] args) throws Exception {
		// Read from stdin
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = in.readLine();

		// Parse the line
		String[] lineParts = line.split(" ");
		int a = Integer.parseInt(lineParts[0]);
		int b = Integer.parseInt(lineParts[1]);

		// Write to stdout
		System.out.println(a + b);
	}
}

Python 2

# Read from stdin
line = raw_input()

# Parse the line
line_parts = line.split(" ")
a = int(line_parts[0])
b = int(line_parts[1])

# Print to stdout
print a + b

Python 3

# Read from stdin
line = input()

# Parse the line
line_parts = line.split(" ")
a = int(line_parts[0])
b = int(line_parts[1])

# Print to stdout
print(a + b)