#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 *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int n, x, y, soma;
  scanf("%d", &n);
  while (n-- > 0) {
    scanf("%d %d\n", &x, &y);
    soma = 0;
    if (x % 2 == 0) {
      x++;
    }
    while (y-- > 0) {
      soma += x;
      x += 2;
    }
    printf("%d\n", soma);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    11d3 <main+0xb3>
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <main+0x74>
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
jle    11bf <main+0x9f>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <main+0x74>
mov    -0x14(%rbp),%esi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
jmp    1141 <main+0x21>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11d8 <main+0xb8>
lea    0xeab(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x14(%rsp),%r12
lea    0xe9d(%rip),%rbx
jmp    11aa <main+0x8a>
nopl   0x0(%rax,%rax,1)
lea    0x2(%rax),%esi
imul   %edx,%esi
lea    -0x2(%rcx),%edi
imul   %edx,%edi
and    $0xfffffffe,%edi
add    %eax,%esi
add    %edi,%esi
lea    (%rax,%rcx,2),%eax
mov    %eax,0x10(%rsp)
mov    $0xffffffff,%edx
mov    %edx,0x14(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
test   %eax,%eax
jle    11d8 <main+0xb8>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
test   $0x1,%al
jne    11c9 <main+0xa9>
add    $0x1,%eax
mov    %eax,0x10(%rsp)
mov    0x14(%rsp),%ecx
lea    -0x1(%rcx),%edx
test   %ecx,%ecx
jg     1170 <main+0x50>
xor    %esi,%esi
jmp    118f <main+0x6f>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %40
11: ; preds = %0, %33
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %2
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = add nuw nsw i32 %13, 1
store i32 %17, i32* %2
br label %18
18: ; preds = %16, %11
%19 = phi i32 [ %17, %16 ], [ %13, %11 ]
%20 = load i32, i32* %3
%21 = add i32 %20, -1
%22 = icmp sgt i32 %20, 0
br i1 %22, label %23, label %33
23: ; preds = %18
%24 = add i32 %19, 2
%25 = mul i32 %21, %24
%26 = add nsw i32 %20, -2
%27 = mul i32 %21, %26
%28 = and i32 %27, -2
%29 = shl nuw i32 %20, 1
%30 = add i32 %19, %25
%31 = add i32 %30, %28
%32 = add i32 %19, %29
store i32 %32, i32* %2
br label %33
33: ; preds = %23, %18
%34 = phi i32 [ -1, %23 ], [ %21, %18 ]
%35 = phi i32 [ %31, %23 ], [ 0, %18 ]
store i32 %34, i32* %3
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp sgt i32 %37, 0
br i1 %39, label %11, label %40
40: ; preds = %33, %0
ret i32 0
}