Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	badge := []string{"AAA", "AA", "A", "B", "C", "D", "E"}
	badgeLen := len(badge)
	short := []float64{35.5, 37.5, 40, 43, 50, 55, 70}
	long := []float64{71, 77, 83, 89, 105, 116, 148}

	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		time := strings.Split(stdin.Text(), " ")

		sT, _ := strconv.ParseFloat(time[0], 64)
		lT, _ := strconv.ParseFloat(time[1], 64)

		sR, lR, t := 0, 0, 0.0
		for _, t = range short {
			if sT < t {
				break
			}
			sR++
		}
		for _, t = range long {
			if lT < t {
				break
			}
			lR++
		}
		rank := ""
		if sR >= badgeLen || lR >= badgeLen {
			rank = "NA"
		} else if sR >= lR {
			rank = badge[sR]
		} else {
			rank = badge[lR]
		}
		fmt.Println(rank)
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	double a,b;
	while(cin>>a>>b){
		if(a<35.5&&71.0<b){
			cout<<"AAA"<<endl;
		}
		else if(a<37.5&&77.0>b){
			cout<<"AA"<<endl;
		}
		else if(a<40.0&&83.0>b){
			cout<<"A"<<endl;
		}
		else if(a<43.0&&89.0>b){
			cout<<"B"<<endl;
		}
		else if(a<50.0&&105.0>b){
			cout<<"C"<<endl;
		}
		else if(a<55.0&&116.0>b){
			cout<<"D"<<endl;
		}
		else if(a<70.0&&148.0>b){
			cout<<"E"<<endl;
		}
		else
			cout<<"NA"<<endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int calc500(double record){
	if(record < 35.50){
		return 7;
	}else if(record < 37.50){
		return 6;
	}else if(record < 40.0){
		return 5;
	}else if(record < 43.0){
		return 4;
	}else if(record < 50.0){
		return 3;
	}else if(record < 55.0){
		return 2;
	}else if(record < 70.0){
		return 1;
	}else{
		return 0;
	}
}

int calc1000(double record){
	if(record < 71.0){
		return 7;
	}else if(record < 77.0){
		return 6;
	}else if(record < 83.0){
		return 5;
	}else if(record < 89.0){
		return 4;
	}else if(record < 105.0){
		return 3;
	}else if(record < 116.0){
		return 2;
	}else if(record < 148.0){
		return 1;
	}else{
		return 0;
	}
}

int main(){

	double t_500,t_1000;
	int rank500,rank1000,rank;

	while(scanf("%lf %lf",&t_500,&t_1000)!=EOF){
		rank500 = calc500(t_500);
		rank1000 = calc1000(t_1000);
		rank = min(rank500,rank1000);

		switch(rank){
		case 7:
			printf("AAA\n");
			break;
		case 6:
			printf("AA\n");
			break;
		case 5:
			printf("A\n");
			break;
		case 4:
			printf("B\n");
			break;
		case 3:
			printf("C\n");
			break;
		case 2:
			printf("D\n");
			break;
		case 1:
			printf("E\n");
			break;
		case 0:
			printf("NA\n");
			break;
		}
	}

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%f %f",&a,&b)!=EOF){
		if(a<35.5 && b<71){
			printf("AAA\n");
		}
		else if(a<=7.5 && b<77){
			printf("AA\n");
		}
		else if(a<40 && b<83){
			printf("A\n");
		}
		else if(a<43 && b<89){
			printf("B\n");
		}
		else if(a<50 && b<105){
			printf("C\n");
		}
		else if(a<55 && b<116){
			printf("D\n");
		}
		else if(a>60 && b>148){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	//	scanf("%d %d",&a,&b);
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define MAX_CLASS 8

int check(double m, int type);

int main(){
    double m500, m1000;
    string cls[MAX_CLASS] = {"AAA", "AA", "A", "B", "C", "D", "D", "NA"};
    while(cin >>m500 >>m1000){
        cout <<cls[max(check(m500, 0), check(m1000, 1))] <<endl;
    }
    return 0;
}

int check(double m, int type){
    double dx[2][MAX_CLASS] = {{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0}, {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0}};
    int ret = 7;
    for(int i = 0; i < MAX_CLASS - 1; i++){
        if(m < dx[type][i]){
            ret = i;
            break;
        }
    }
    return ret;
}

C++: #include <iostream>

using namespace std;

int main()
{
    double f, s;
    
    while (cin >> f >> s) {
        if (f < 35 && s < 71)
            cout << "AAA";
        else if (f < 37 && s < 77)
            cout << "AA";
        else if (f < 40 && s < 83)
            cout << "A";
        else if (f < 43 && s < 89)
            cout << "B";
        else if (f < 50 && s < 105)
            cout << "C";
        else if (f < 55 && s < 116)
            cout << "D";
        else if (f < 70 && s < 148)
            cout << "E";
        else
            cout << "NA";
        
        cout << endl;
    }

    return 0;
}

C++: #include <stdio.h>

int main()
{
	double t1, t2;
	double t[7][2] = {{35.5, 71.0}, {37.5, 77.0}, {40.0, 83.0}, {43.0, 89.0},
                      {50.0, 105.0}, {55.0, 116.0}, {70.0, 148.0}};
	int i1, k = -1;
	char kyu[8][5] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
					// ??\?????\?????\??¨???????£???????
	scanf("%lf %lf", &t1, &t2);
					// ????¬¢????????????	for (i1 = 0; i1 < 7 && k < 0; i1++) {
		if (t1 < t[i1][0] && t2 < t[i1][1])
			k = i1;
	}

	if (k < 0)
		k = 7;

	printf("%s\n", kyu[k]);

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%f %f",&a,&b)!=EOF){
		if(a<35.5 && b<71){
			printf("AAA\n");
		}
		else if(a<=7.5 && b<77){
			printf("AA\n");
		}
		else if(a<40 && b<83){
			printf("A\n");
		}
		else if(a<43 && b<89){
			printf("B\n");
		}
		else if(a<50 && b<105){
			printf("C\n");
		}
		else if(a<55 && b<116){
			printf("D\n");
		}
		else if(a<60 && b<148){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	//	scanf("%d %d",&a,&b);
	}
	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

int main() {
	double t1, t2;
	while (cin >> t1 >> t2) {
		int a1, a2;
		if (t1 < 35.5)a1 = 1;
		else if (t1 < 37.5)a1 = 2;
		else if (t1 < 40.0)a1 = 3;
		else if (t1 < 43.0)a1 = 4;
		else if (t1 < 50.0)a1 = 5;
		else if (t1 < 55.0)a1 = 6;
		else if (t1 < 70.0)a1 = 7;
		else a1 = 8;

		if (t2 < 71)a2 = 1;
		else if (t2 < 77)a2 = 2;
		else if (t2 < 83)a2 = 3;
		else if (t2 < 89)a2 = 4;
		else if (t2 < 105)a2 = 5;
		else if (t2 < 116)a2 = 6;
		else if (t2 < 148)a2 = 7;
		else a2 = 8;
		string ans[9] = { " ","AAA","AA","A","B","C","D","E","NA" };
		cout << ans[max(a1, a2)] << endl;
	}
}

C++: int main(void)
{
	float a,b;
	while(scanf("%f %f",&a,&b)!=EOF){
	if(a<35.5 && b<71.0){
			printf("AAA\n");
			}
	else if(a<37.5 && b<77.0){
			printf("AA\n");
			}
	else if(a<40.0 && b<83.0){
			printf("A\n");
			}
	else if(a<43.0 && b<89.0){
			printf("B\n");
			}
	else if(a<50.0 && b<105.0){
			printf("c\n");
			}
	else if(a<55.0 && b<116.0){
			printf("D\n");
			}
	else if(a<70.0 && b<148.0){
			printf("E\n");
			}
		else{
			printf("NA\n");
			}
		}
	return 0;
	}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    double time500[] = {35.5, 37.5, 40, 43, 50, 55, 70};
    double time1000[] = {71, 77, 83, 89, 105, 116, 148};
    string rank[] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

    for(;;){
        double a, b;
        if(!(cin >> a >> b))
            return 0;

        int i = upper_bound(time500, time500 + 7, a) - time500;
        int j = upper_bound(time1000, time1000 + 7, b) - time1000;
        cout << rank[max(i, j)] << endl;
    }
}