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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

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

int main(){
	double a,b;
	

	double table1[] = {35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	double table2[] = {71.0,77.0,83.0,89.0,105.0,116.0,148.0};
	string rank[] = {"AAA","AA","A","B","C","D","E","NA"};

	while(~scanf("%lf %lf",&a,&b)){
		int c=7,d=7;
		for(int i=0;i<sizeof(table1)/sizeof(double);i++){
			if(a < table1[i]) { c = i; break; }
		}

		for(int i=0;i<sizeof(table2)/sizeof(double);i++){
			if(b < table2[i]) { d = i; break; }
		}

		cout << rank[max(c,d)] << endl;

	}
}

C++: /*****include*****/
#include <iostream>

/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
	/*****変数置き場*****/
	double time_50,time_100;
	int level_50;
	int level_100;
	int level;
	/*****処理部*****/
	while(1){
		cin >> time_50 >> time_100;
		if(cin.eof())	break;
		if(time_50 < 35.5)
			level_50 = 7;
		else if(time_50 < 37.5)
			level_50 = 6;
		else if(time_50 < 40)
			level_50 = 5;
		else if(time_50 < 43)
			level_50 = 4;
		else if(time_50 < 50)
			level_50 = 3;
		else if(time_50 < 55)
			level_50 = 2;
		else if(time_50 < 70)
			level_50 = 1;
		else
			level_50 = 0;
		
		if(time_100 < 71)
			level_100 = 7;
		else if(time_100 < 77)
			level_100 = 6;
		else if(time_100 < 83)
			level_100 = 5;
		else if(time_100 < 89)
			level_100 = 4;
		else if(time_100 < 105)
			level_100 = 3;
		else if(time_100 < 116)
			level_100 = 2;
		else if(time_100 < 148)
			level_100 = 1;
		else
			level_100 = 0;
		
		if(level_100 > level_50)
			level = level_50;
		else
			level = level_100;
		
		switch(level){
		case 0:
			cout << "NA" << endl;
			break;
		case 1:
			cout << "E" << endl;
			break;
		case 2:
			cout << "D" << endl;
			break;
		case 3:
			cout << "C" << endl;
			break;
		case 4:
			cout << "B" << endl;
			break;
		case 5:
			cout << "A" << endl;
			break;
		case 6:
			cout << "AA" << endl;
			break;
		case 7:
			cout << "AAA" << endl;
			break;
		}
	}
	/*****処理終了後*****/
	return 0;
}

C++: #include <stdio.h>

int main(void){
	double a, b;
	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<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	double t1[7] = {35.5,37.5,40,43,50,55,70}, t2[7] = {71,77,83,89,105,116,148};
	double R1,R2;
	while(cin>>R1>>R2){
		int c1=7,c2=7;
		for(int i=6;i>=0;i--){
			if(R1<t1[i]) c1 = i;
			if(R2<t2[i]) c2 = i;
		}
		int c = max(c1,c2);
		if(c==0) puts("AAA");
		else if(c==1) puts("AA");
		else if(c==2) puts("A");
		else if(c==3) puts("B");
		else if(c==4) puts("C");
		else if(c==5) puts("D");
		else if(c==6) puts("E");
		else puts("NA");
	}
}

C++: /*
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;

struct IND{string str,int page;};
int main()
{

struct IND N1[101]={};
string R;
int x,i=0;
while(scanf("%s %d",&R,&x)!=EOF){
N1[i].str=R;N1[i].page=x;i++;
}
for(int j=0;j<i;j++)
{
	for(int k=i;k>=j;k--)
	{
	*/
#include<stdio.h>
#include<iostream>
using namespace std;
void TR(double x,double y,int K,int H)
{

double t;
t=x*100;
if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

t=y*100;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;
cout<<t;
}



int main(){
int K=0,H=0;
double x,y;
while(scanf("%lf %lf",&x,&y)!=EOF)
{K=0,H=0;

//TR(x,y,K,H);cout<<H<<K;
double t=0;
double X;
t=x*100;//t=(int)X;

if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

t=y*100;//t=(int)X;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;


if(H<K)H=K;

switch(K){
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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

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

int main(){
	double a,b;
	

	double table1[] = {35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	double table2[] = {71.0,77.0,83.0,89.0,105.0,116.0,148.0};
	string rank[] = {"AAA","AA","A","B","C","D","E","NA"};

	while(~scanf("%lf %lf",&a,&b)){
		int c=7,d=7;
		for(int i=0;i<sizeof(table1)/sizeof(double);i++){
			if(a < table1[i]) { c = i; break; }
		}

		for(int i=0;i<sizeof(table2)/sizeof(double);i++){
			if(b < table2[i]) { d = i; break; }
		}

		cout << rank[max(c,d)] << endl;

	}
}

C++: #include<iostream>
using namespace std;
int main(){
  double time500,time1000;
  while( cin >> time500 >> time1000){
  if(time500<35.5&&time1000<71.0) cout << "AAA" << endl;
  else if(time500<37.5&&time1000<77.0) cout << "AA" << endl;
  else if(time500<40.0&&time1000<83.0) cout << 'A' << endl;
  else if(time500<43.0&&time1000<89.0) cout << 'B' << endl;
  else if(time500<50.0&&time1000<105.0) cout << 'C' << endl;
  else if(time500<55.0&&time1000<116.0) cout << 'D' << endl;
  else if(time500<70.0&&time1000<148.0) cout << 'E' << endl;
  else cout << "NA" << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <algorithm>
#include <strstream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;

int main(){
	float a,b;
	cin>>a>>b;

	if( a<35.5 && b<71 )puts("AAA");
	else if( a<37.5 && b<77 )puts("AA");
	else if( a<40 && b<83 )puts("A");
	else if( a<43 && b<89 )puts("B");
	else if( a<50 && b<105 )puts("C");
	else if( a<55 && b<116)puts("D");
	else if( a<70 && b<148)puts("E");
	else puts("NA");

	return 0;
}