#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, unsigned long long *, ...);
int main(int argc, char **argv) {
  unsigned long long T, U, V, D, R, A;
  scanf("%llu", &T);
  while (T--) {
    scanf("%llu %llu", &U, &V);
    D = U + V;
    R = 1 + ((D * (D + 1)) >> 1);
    A = R + U;
    printf("%llu\n", A);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     11c0 <main+0xa0>
lea    0xe98(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    $0x1,%rcx
imul   %rcx,%rax
shr    $0x1,%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rsi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    1148 <main+0x28>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed3(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subq   $0x1,(%rsp)
jb     11a3 <main+0x83>
lea    0xeb6(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xeaf(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,1),%rdx
add    $0x1,%rdx
add    %rax,%rcx
imul   %rdx,%rcx
shr    %rcx
lea    (%rax,%rcx,1),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
subq   $0x1,(%rsp)
jae    1160 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [10 x i8] c"%llu %llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
br label %13
13: ; preds = %17, %2
%14 = load i64, i64* %6
%15 = add i64 %14, -1
store i64 %15, i64* %6
%16 = icmp ne i64 %14, 0
br i1 %16, label %17, label %33
17: ; preds = %13
%18 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %7, i64* %8)
%19 = load i64, i64* %7
%20 = load i64, i64* %8
%21 = add i64 %19, %20
store i64 %21, i64* %9
%22 = load i64, i64* %9
%23 = load i64, i64* %9
%24 = add i64 %23, 1
%25 = mul i64 %22, %24
%26 = lshr i64 %25, 1
%27 = add i64 1, %26
store i64 %27, i64* %10
%28 = load i64, i64* %10
%29 = load i64, i64* %7
%30 = add i64 %28, %29
store i64 %30, i64* %11
%31 = load i64, i64* %11
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %31)
br label %13
33: ; preds = %13
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [10 x i8] c"%llu %llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %3 to i8*
%7 = bitcast i64* %4 to i8*
%8 = bitcast i64* %5 to i8*
%9 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%10 = load i64, i64* %3
%11 = add i64 %10, -1
store i64 %11, i64* %3
%12 = icmp eq i64 %10, 0
br i1 %12, label %27, label %13
13: ; preds = %2, %13
%14 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64* %4, i64* %5)
%15 = load i64, i64* %4
%16 = load i64, i64* %5
%17 = add i64 %16, %15
%18 = add i64 %17, 1
%19 = mul i64 %18, %17
%20 = lshr i64 %19, 1
%21 = add i64 %15, 1
%22 = add i64 %21, %20
%23 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %22)
%24 = load i64, i64* %3
%25 = add i64 %24, -1
store i64 %25, i64* %3
%26 = icmp eq i64 %24, 0
br i1 %26, label %27, label %13
27: ; preds = %13, %2
ret i32 0
}