Read T pairs of integers from fast input and print each sum on its own line.
Easy1ImplementationMathArrayNo attempts yetTime limit1sMemory limit512 MBBefore you work through loop problems in bulk, check how your program reads input and writes output. A slow method can time out once there are many lines to read or print.
In C++, if you use cin and cout, apply both cin.tie(NULL) and sync_with_stdio(false), and print the newline character \n instead of endl. Once you do that, stop mixing in the C style calls scanf, printf, puts, getchar, and putchar.
In Java, you can use BufferedReader and BufferedWriter instead of Scanner and System.out.println. Call BufferedWriter.flush once at the very end.
In Python, you can use sys.stdin.readline instead of input. It keeps the newline at the end of the line, so add .rstrip() when you store the string.
The input stream and the output stream are separate, so you do not have to read every test case before printing anything. Reading one case and printing its answer right away is fine.
Each test case gives two integers A and B. Print A+B for every test case.
The first line contains the number of test cases T. T is at most 106. Each of the next T lines contains two integers A and B, with 1≤A≤1000 and 1≤B≤1000.
For each test case, print A+B on its own line, in the order the cases are given.