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>

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(l < 77){
			l_r = 1;
		}else if(l < 83){
			l_r = 2;
		}else if(l < 89){
			l_r = 3;
		}else if(l < 105){
			l_r = 4;
		}else if(l < 116){
			l_r = 5;
		}else if(l < 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<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&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<stdio.h>
 
int main(){
     
    double s,m;
     
    while( scanf("%lf",&s) != EOF ){
        scanf("%lf",&m);
         
        while(1){
            if(s<35.50 && m<71.00){
                printf("AAA\n");
                break;
            }
            else if(s<37.50 && m<77.00){
                printf("AA\n");
                break;
            }
            else if(s<40.00 && m<83.00){
                printf("A\n");
                break;
            }
            else if(s<43.00 && m<89.00){
                printf("B\n");
                break;
            }
            else if(s<50.00 && m<105.00){
                printf("C\n");
                break;
            }
            else if(s<55.00 && m<116.00){
                printf("D\n");
                break;
            }
            else if(s<70.00 && m<148.00){
                printf("E\n");
                break;
            }
            else if(s>=70.00 || m>=148.00){
                printf("NA\n");
                break;
            }
        }
    }
     
return 0;
}

C++: #include<iostream>
using namespace std;
string s[8]={"AAA","AA","A","B","C","D","E","NA"};
double a[8]={35.5 , 37.5 , 40.0 , 43.0, 50.0, 55.0, 70.0,9999999.9999999};
double b[8]={71.0 , 77.0 , 83.0 , 89.0,105.0,116.0,148.0,9999999.9999999};
double q,w;
int main(){
  while(cin>>q>>w){
    for(int i=0;i<8;i++){
      if(q<a[i]&&w<b[i]){
	cout<<s[i]<<endl;
	break;
}}}}

C++: #include<iostream>

using namespace std;

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

	
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double EPS = 1e-10;

// a < b;
bool LE(const double a, const double b) {
	return (a < b + EPS);
}

int main() {
	string name[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	double m500[8] = {35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 1 * 60 + 10, 100000000};
	double m1000[8] = {1 * 60 + 11, 1 * 60 + 17, 1 * 60 + 23, 1 * 60 + 29, 1 * 60 + 45, 1 * 60 + 56, 2 * 60 + 28, 100000000};
#if 0
	for(int i = 0; i < 7; i++) {
		cout << name[i] + ":" << m500[i] << ":" << m1000[i] << endl;
	}
#endif
	
	for(double a, b; cin >> a >> b;) {
		int i = 0;
		while(LE(m500[i], a) || LE(m1000[i], b)) i++;
		cout << name[i] << endl;
	}
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main()
{
	double fh, om;
	while (cin>>fh>>om) {
		if (fh < 35.5 && om < 71.0) {
			puts("AAA");
		}
		else if (fh < 37.5 && om < 77.0) {
			puts("AA");
		}
		else if (fh < 40.0 && om < 83.0) {
			puts("A");
		}
		else if (fh < 43.0 && om < 89.0) {
			puts("B");
		}
		else if (fh < 50.0 && om < 105.0) {
			puts("C");
		}
		else if (fh < 55.0 && om < 116.0) {
			puts("D");
		}
		else if (fh < 70.0 && om < 148.0) {
			puts("E");
		}
		else {
			puts("NA");
		}
	}
	return 0;
}

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

char rank[8][4] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
double aa[7] = {35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0};
double bb[7] = {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0};

int main()
{
    double a,b;
    while(cin >> a >> b){
        for(int i=0;i<8;i++){
            if(i==7){
                cout << rank[i] << endl;
                break;
            }
            if(a < aa[i] && b < bb[i]){
                cout << rank[i] << endl;
                break;
            }
        }
    }
    return 0;
}

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

int main(){
while(1){
double a,b;
cin>>a;
if (cin.fail()) break;
cin>>b;
if(a<35.5&&b<71){cout<<"AAA"<<endl;}
else if(a<37.5&&b<77){cout<<"AA"<<endl;}
else if(a<40&&b<83){cout<<"A"<<endl;}
else if(a<43&&b<89){cout<<"B"<<endl;}
else if(a<50&&b<105){cout<<"C"<<endl;}
else if(a<55&&b<116){cout<<"D"<<endl;}
else if(a<70&&b<148){cout<<"E"<<endl;}
else{cout<<"NA"<<endl;}

}
}