A Plus B

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 5.0s
Memory limit: 256M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Tudor is sitting in math class, on his laptop. Clearly, he is not paying attention in this situation. However, he gets called on by his math teacher to do some problems. Since his math teacher did not expect much from Tudor, he only needs to do some simple addition problems. However, simple for you and I may not be simple for Tudor, so please help him!

Input Specification

The first line will contain an integer N (1 \le N \le 100\,000), the number of addition problems Tudor needs to do. The next N lines will each contain two space-separated integers whose absolute value is less than 1\,000\,000\,000, the two integers Tudor needs to add.

Output Specification

Output N lines of one integer each, the solutions to the addition problems in order.

Sample Input

1 1
-1 0

Sample Output


Example Solutions

The judge is strict in expecting the output to match exactly. Do not prompt for input.

Python 2

N = int(raw_input())

for _ in xrange(N):
    a, b = map(int, raw_input().split())
    print a + b

Python 3

N = int(input())

for _ in range(N):
    a, b = map(int, input().split())
    print(a + b)


import java.util.*;

public class APlusB {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int N = in.nextInt();
        for (int i = 0; i < N; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(a + b);


#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;

    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;


#include <stdio.h>

int main() {
    int N;
    scanf("%d\n", &N);

    for (int i = 0; i < N; i++) {
        int a, b;
        scanf("%d %d\n", &a, &b);
        printf("%d\n", a + b);


var N, a, b : int

get N

for i: 1..N
   get a, b
   put a + b
end for


import scala.io.StdIn

object aplusb extends App {
  for (_ <- 1 to StdIn.readInt()) {
    val Array(a, b) = StdIn.readLine().split(" ")
    println(a.toInt + b.toInt)


#[macro_use] extern crate dmoj;

fn main() {
    let n = scan!(usize);

    for _ in 0..n {
        println!("{}", scan!(i64) + scan!(i64));


  • -4
    python6645  commented on Dec. 2, 2020, 2:26 p.m. edited

    There is a problem that plagiarised the question you are looking at:


    There is another problem that copied this problem's texture:


  • -8
    CoolNoobyBooby  commented on Sept. 21, 2018, 10:08 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

    • 4
      AlanL  commented on Sept. 23, 2018, 10:01 a.m.

      I mean like, does it really matter? If anyone figures out a bunch of 5 pointers or above, the 3 points won't be worth much.

  • 0
    damody  commented on March 6, 2018, 4:43 a.m.

    Ruster see this page https://github.com/DMOJ/dmoj-rust

  • 6
    damody  commented on March 6, 2018, 4:42 a.m.


    #[macro_use] extern crate dmoj;
    use std::io;
    fn main() {
        let n = scan!(u32);
        for i in 0..n {
            let (a,b) = scan!(i32, i32);
            println!("{}", a+b);