Sum of Two

Easy · rating 800 · math, implementation

Read two space-separated integers a and b on a single line. Print their sum.

Constraints: -109 ≤ a, b ≤ 109

Editorial

Sum of Two is the simplest warm-up: read two integers and print their sum. The one gotcha is range — two values near 10⁹ sum past 32-bit limits, so use a 64-bit integer type (Python and JavaScript widen automatically).

a, b = map(int, input().split())
print(a + b)

Complexity

Time: O(1). Space: O(1).

Open Sum of Two in Code Arena →