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 <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;
    }
}

C++: #include <stdio.h>

int main(void){
	double a, b;
	while(scanf("%lf%lf",&a,&b)){
	if(a < 35.5 && b < 71)
		printf("AAA\n");
	else if(a < 37.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 < 70 && b < 148)
		printf("E\n");
	else
		printf("NA\n");
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		if(a>35.5 && b>71){
			printf("AAA\n");
		}
		else if(a>37.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<iomanip>
#include<algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;

double x,y;

int main(){
	while(cin>>x>>y){
		if(x<35.5&&y<71) cout<<"AAA"<<endl;
		else{
			if(x<37.5&&y<77) cout<<"AA"<<endl;
			else{
				if(x<40&&y<83) cout<<"A"<<endl;
				else{
					if(x<43&&y<89) cout<<"B"<<endl;
					else{
						if(x<50&&y<105) cout<<"C"<<endl;
						else{
							if(x<55&&y<116) cout<<"D"<<endl;
							else{
								if(x<70&&y<148) cout<<"E"<<endl;
								else cout<<"NA"<<endl;
							}
						}
					}
				}
			}
		}
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	double t1,t2;
	while(cin>>t1>>t2){
		const double T1[]={70.00,55.00,50.00,43.00,40.00,37.50,35.50,0};
		const double T2[]={148.00,116.00,105.00,89.00,83.00,77.00,71.00,0};
		const string N[]={"NA","E","D","C","B","A","AA","AAA"};
		for(int i=0;i<8;++i){
			if(T1[i]<=t1||T2[i]<=t2){
				cout<<N[i]<<endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )
#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = (c).begin(); it != (c).end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define PB( n ) push_back( ( n ) )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define fst first
#define snd second

const double p500[] = { 70, 55, 50, 43, 40, 37.5, 35.5 };
const double p1000[] = { 148, 116, 105, 89, 83, 77, 71 };
const string rank[] = {	"NA", "E", "D", "C", "B", "A",	"AA", "AAA" };

int main()
{
	double t500, t1000;

	while ( cin >> t500 >> t1000 )
	{
		int rank1 = 0, rank2 = 0;

		REP( i, 0, 7 )
		{
			if ( t500 < p500[i] )
			{
				rank1++;
			}

			if ( t1000 < p1000[i] )
			{
				rank2++;
			}
		}

		cout << rank[ min( rank1, rank2 ) ] << endl;
	}
	
	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
#include <complex>
#include <sstream>
#include <stack>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef complex<double> Point;

int main()
{
	const char* names[] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	double m500[] = {35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0};
	double m1000[] = {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0};
	
	double a, b;
	while(scanf("%lf%lf", &a, &b) != EOF){
		puts(names[max(distance(m500, upper_bound(m500, m500+7, a)), distance(m1000, upper_bound(m1000, m1000+7, b)))]);
	}
	
	return 0;
}

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

int main()
{
	double t1, t2;
	while (1)
	{
		cin >> t1 >> t2;
		if (cin.eof()) break;

		if (t1<35.5 && t2<71){
			cout << "AAA" << endl;
		}
		else if (t1<37.5 && t2<77){
			cout << "AA" << endl;
		}
		else if (t1<40 && t2<83){
			cout << "A" << endl;
		}
		else if (t1<43 && t2<89){
			cout << "B" << endl;
		}
		else if (t1<50 && t2<105){
			cout << "C" << endl;
		}
		else if (t1<55 && t2<116){
			cout << "D" << endl;
		}
		else if (t1<70 && t2<148){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}