Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	m500 := []float64{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, 1000.0}
	m1000 := []float64{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, 1000.0}
	classes := []string{"AAA", "AA", "A", "B", "C", "D", "E", "NA"}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), " ")
		t500, _ := strconv.ParseFloat(input[0], 64)
		t1000, _ := strconv.ParseFloat(input[1], 64)
		for i := 0; i < len(m500); i++ {
			if t500 < m500[i] && t1000 < m1000[i] {
				fmt.Println(classes[i])
				break
			}
		}
	}
}

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; i++){
        if(m < dx[type][i]){
            ret = i;
            break;
        }
    }
    return ret;
}

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 <iostream>

using namespace std;

int main() {

	double ms, ml;

	while(cin >> ms >> ml) {
		if(ms<35.50)
			ms=0;
		else if(ms<37.50)
			ms=1;
		else if(ms<40.00)
			ms=2;
		else if(ms<43.00)
			ms=3;
		else if(ms<50.00)
			ms=4;
		else if(ms<55.00)
			ms=5;
		else if(ms<70.00)
			ms=6;
		else
			ms=7;
		if(ml<71.00)
			ml=0;
		else if(ml<77.00)
			ml=1;
		else if(ml<83.00)
			ml=2;
		else if(ml<89.00)
			ml=3;
		else if(ml<105.00)
			ml=4;
		else if(ml<116.00)
			ml=5;
		else if(ml<148.00)
			ml=6;
		else
			ml=7;

		if(ms<ml)
			ms=ml;

		switch((int)ms) {
			case 0:
				cout << "AAA" << endl;
				break;
			case 1:
				cout << "AA" << endl;
				break;
			case 2:
				cout << "A" << endl;
				break;
			case 3:
				cout << "B" << endl;
				break;
			case 4:
				cout << "C" << endl;
				break;
			case 5:
				cout << "D" << endl;
				break;
			case 6:
				cout << "E" << endl;
				break;
			case 7:
				cout << "NA" << endl;
				break;
		}

	}
	
	return 0;

}

C++: #include <iostream>
using namespace std;

int main()
{

	double time5, time10;

	while( cin >> time5 >> time10 ) {

		if( time5 < 35.5 && time10 < 71.0 ) cout << "AAA";
		else if( time5 < 37.5 && time10 < 67.0 ) cout << "AA";
		else if( time5 < 40.0 && time10 < 83.0 ) cout << "A";
		else if( time5 < 43.0 && time10 < 89.0 ) cout << "B";
		else if( time5 < 50.0 && time10 < 105.0 ) cout << "C";
		else if( time5 < 55.0 && time10 < 116.0 ) cout << "D";
		else if( time5 < 70.0 && time10 < 148.0 ) cout << "E";
		else cout << "NA";

		cout << endl;

	}

	return 0;

}

C++: #include<stdio.h>

int main(void){
	float time5,time10;

	while(scanf("%f %f",&time5,&time10)!=EOF){
		if(time5<35.0 && time10>71.0)printf("AAA\n");
		
		else if(time5<37.5 && time10<77.0)printf("AA\n");
		
		else if(time5<40.0 && time10<83.0)printf("A\n");
		
		else if(time5<43.0 && time10<89.0)printf("B\n");
		
		else if(time5<50.0 && time10<105.0)printf("C\n");
		
		else if(time5<55.0 && time10<116.0)printf("D\n");
		
		else if(time5<70.0 && time10<148.0)printf("E\n");
		
		else printf("NA\n");
		
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

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

    return 0;
}

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

using namespace std;

int main(void){
	double s, l;
	int s_r, l_r;
	int res;
	
	
	while(cin >> s >> l){
		if(s < 35.5){
			s_r = 0;
		}else if(s < 37.5){
			s_r = 1;
		}else if(s < 40){
			s_r = 2;
		}else if(s < 43){
			s_r = 3;
		}else if(s < 50){
			s_r = 4;
		}else if(s < 55){
			s_r = 5;
		}else if(s < 70){
			s_r = 6;
		}else{
			s_r = 7;
		}
		if(l < 71){
			l_r = 0;
		}else if(s < 77){
			l_r = 1;
		}else if(s < 83){
			l_r = 2;
		}else if(s < 89){
			l_r = 3;
		}else if(s < 105){
			l_r = 4;
		}else if(s < 116){
			l_r = 5;
		}else if(s < 148){
			l_r = 6;
		}else{
			l_r = 7;
		}
		
		res = max(s_r, l_r);
		
		switch(res){
			case 0:
				cout << "AAA" << endl;
				break;
			case 1:
				cout << "AA" << endl;
				break;
			case 2:
				cout << "A" << endl;
				break;
			case 3:
				cout << "B" << endl;
				break;
			case 4:
				cout << "C" << endl;
				break;
			case 5:
				cout << "D" << endl;
				break;
			case 6:
				cout << "E" << endl;
				break;
			case 7:
				cout << "NA" << endl;
				break;
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

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

C++: #include <cstdio>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  for(float s, g;scanf(" %f %f", &s, &g) != EOF;) {
    string out;
    if(s < 35.50 && g < 71.00) out = "AAA";
    else if(s < 37.0 && g < 77.00) out = "AA";
    else if(s < 40.0 && g < 83.00) out = "A";
    else if(s < 43.0 && g < 89.00) out = "B";
    else if(s < 50.0 && g < 105.00) out = "C";
    else if(s < 55.0 && g < 116.00) out = "D";
    else if(s < 70.0 && g < 148.00) out = "E";
    else out = "NA";
    printf("%s\n", out.c_str());
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
  double st, lt;
  while(cin >> st >> lt) {
    if(st < 35.50 && lt < 71.00) cout << "AAA" << endl;
    else if(st < 37.50 && lt < 77.00) cout << "AA" << endl;
    else if(st < 40.00 && lt < 83.00) cout << "A" << endl;
    else if(st < 43.00 && lt < 89.00) cout << "B" << endl;
    else if(st < 50.00 && lt < 105.00) cout << "C" << endl;
    else if(st < 55.00 && lt < 116.00) cout << "D" << endl;
    else if(st < 70.00 && lt < 148.00) cout << "E" << endl;
    else cout << "NA" << endl;
  }
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<set>
#include<queue>

using namespace std;

typedef pair<int,int> PII;
typedef long long ll;

const double EPS = 1e-9;
int main(){

	string rank[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double time500[8] = {35.50,37.50,40.00,43.00,50.00,55.00,70.00,0};
	double time1000[8] = {71.00,77.00,83.00,89.00,105.00,116.00,148.00,0};

	double n,m;
	while(cin>>n>>m){
		
		int r,rr;
		for(r=0;r<7;r++){
			if(n-time500[r]+EPS < 0)break;
		}
		for(rr = 0;rr<7;rr++){
			if(n-time1000[r]+EPS < 0)break;
		}

		cout<<rank[max(r,rr)]<<endl;

	}

	return 0;
}