#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 /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int N, A, T, i, score;
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%d %d", &A, &T);
    score = A + T;
    if (score >= 90) {
      printf("A+\n");
    } else if (score >= 80) {
      printf("A\n");
    } else if (score >= 70) {
      printf("B\n");
    } else if (score >= 60) {
      printf("C\n");
    } else if (score == 0) {
      printf("G\n");
    } else {
      printf("F\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122d <main+0x10d>
lea    0xea5(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x5a,-0x18(%rbp)
jl     118e <main+0x6e>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    121a <main+0xfa>
cmpl   $0x50,-0x18(%rbp)
jl     11a9 <main+0x89>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
cmpl   $0x46,-0x18(%rbp)
jl     11c4 <main+0xa4>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
jmp    1210 <main+0xf0>
cmpl   $0x3c,-0x18(%rbp)
jl     11df <main+0xbf>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0xeb>
cmpl   $0x0,-0x18(%rbp)
jne    11fa <main+0xda>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0xeb>
jmp    1210 <main+0xf0>
jmp    1215 <main+0xf5>
jmp    121a <main+0xfa>
jmp    121f <main+0xff>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d2 <main+0xb2>
lea    0xead(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xeac(%rip),%rbx
lea    0xea3(%rip),%r13
xor    %ebp,%ebp
jmp    117e <main+0x5e>
nop
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    11d2 <main+0xb2>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
add    0x14(%rsp),%eax
mov    %rbx,%rdi
cmp    $0x59,%eax
jg     1170 <main+0x50>
mov    %r13,%rdi
cmp    $0x4f,%eax
jg     1170 <main+0x50>
lea    0xe5f(%rip),%rdi
cmp    $0x45,%eax
jg     1170 <main+0x50>
lea    0xe51(%rip),%rdi
cmp    $0x3b,%eax
jg     1170 <main+0x50>
lea    0xe43(%rip),%rdi
test   %eax,%eax
je     1170 <main+0x50>
lea    0xe36(%rip),%rdi
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"A+\0A\00"
@.str.3 = [3 x i8] c"A\0A\00"
@.str.4 = [3 x i8] c"B\0A\00"
@.str.5 = [3 x i8] c"C\0A\00"
@.str.6 = [3 x i8] c"G\0A\00"
@.str.7 = [3 x i8] c"F\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %8
8: ; preds = %48, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %51
12: ; preds = %8
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp sge i32 %17, 90
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %47
21: ; preds = %12
%22 = load i32, i32* %6
%23 = icmp sge i32 %22, 80
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %46
26: ; preds = %21
%27 = load i32, i32* %6
%28 = icmp sge i32 %27, 70
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %45
31: ; preds = %26
%32 = load i32, i32* %6
%33 = icmp sge i32 %32, 60
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %44
36: ; preds = %31
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %43
41: ; preds = %36
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43, %34
br label %45
45: ; preds = %44, %29
br label %46
46: ; preds = %45, %24
br label %47
47: ; preds = %46, %19
br label %48
48: ; preds = %47
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %8
51: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
@str = [2 x i8] c"F\00"
@str.8 = [2 x i8] c"G\00"
@str.9 = [2 x i8] c"C\00"
@str.10 = [2 x i8] c"B\00"
@str.11 = [2 x i8] c"A\00"
@str.12 = [3 x i8] c"A+\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 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %32
10: ; preds = %0, %26
%11 = phi i32 [ %29, %26 ], [ 0, %0 ]
%12 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, %13
%16 = icmp sgt i32 %15, 89
br i1 %16, label %26, label %17
17: ; preds = %10
%18 = icmp sgt i32 %15, 79
br i1 %18, label %26, label %19
19: ; preds = %17
%20 = icmp sgt i32 %15, 69
br i1 %20, label %26, label %21
21: ; preds = %19
%22 = icmp sgt i32 %15, 59
br i1 %22, label %26, label %23
23: ; preds = %21
%24 = icmp eq i32 %15, 0
%25 = select i1 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0)
br label %26
26: ; preds = %23, %21, %19, %17, %10
%27 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.12, i64 0, i64 0), %10 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.11, i64 0, i64 0), %17 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0), %19 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0), %21 ], [ %25, %23 ]
%28 = call i32 @puts(i8* dereferenceable(1) %27)
%29 = add nuw nsw i32 %11, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
br i1 %31, label %10, label %32
32: ; preds = %26, %0
ret i32 0
}