Contents

Sample Programs

Here are sample programs for Task #1. Some of them are bit more verbose than it is necessary - but perhaps it will make more sense for people unacquainted with languages.


Python

Python is very laconic and easy-to-start thanks to its duck-typing. Its tutorial is really nice and comprehensible:

[a, b] = input().split(' ')
c = int(a) + int(b)
print(c)

However it allows to create effective (but bit more complicated constructions) - for example the same solution could be expressed as:

print(sum([int(x) for x in input().split(' ')]))

Java

Java is bit verbose, but sturdy thanks to its strong typing and with rich library and convenient packaging and extensive documentation.

import java.util.*;

public class Solution {
    public static void main(String... args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = a + b;
        System.out.println(c);
    }
}

C

C is older but wonderful and influential language. It allows (and requires) manual memory management and by this gives ability to create most efficient programs. Now it is not as important, but language is still widely used.

#include <stdio.h>

int main(void) {
    int a, b, c;
    scanf("%d %d", &a, &b);
    c = a + b;
    printf("%d\n", c);
    return 0;
}