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<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%f %f",&a,&b)!=EOF){
	if(a<35.5){
		if(b<71.0){
			printf("AAA\n");
		}
	}
	else if(a<37.5){
		if(b<77.0){
			printf("AA\n");
		}
	}
	else if(a<40.0){
		if(b<83.0){
			printf("A\n");
		}
	}
	else if(a<43.0){
		if(b<89.0){
			printf("B\n");
		}
	}
	else if(a<50.0){
		if(b<105.0){
			printf("C\n");
		}
	}
	else if(a<55.0){
		if(b<116.0){
			printf("D\n");
		}
	}
	else if(a<70.0){
		if(b<148.0){
			printf("E\n");
		}
	}
	else{
			printf("NA\n");
	}
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	double a,s;
	scanf("%lf %lf",&a,&s);
	if(a<35.50&&s<71.00){
		printf("AAA");
	}
	else if(a<37.50&&s<77.00){
		printf("AA");
	}
	else if(a<40.00&&s<83.00){
		printf("A");
	}
	else if(a<43.00&&s<89.00){
		printf("B");
	}
	else if(a<50.00&&s<105.00){
		printf("C");
	}
	else if(a<55.00&&s<116.00){
		printf("D");
	}
	else if(a<70.00&&s<148.00){
		printf("E");
	}
	else{
		printf("NA");
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

int main() {
	string str[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double st[2][8] = {
		{35.0, 37.0, 40.0, 43.0, 50.0, 55.0, 70.0, INF},
		{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, INF}
	};
	
	double t[2];
	while (cin >> t[0] >> t[1]) {
		int ans[2];
		REP(i, 2) REP(j, 8) {
			if (st[i][j] > t[i]) {
				ans[i] = j;
				break;
			}
		}
		cout << str[max(ans[0], ans[1])] << endl;
		
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


int f[8]={35,37,40,43,50,55,70,IMAX};
int t[8]={71,77,83,89,105,116,148,IMAX};
string s[8]={"AAA","AA","A","B","C","D","E","NA"};




int main(){
	double d,e;
	while(cin>>d>>e){
		rep(i,8){
			if(d<f[i]&&e<t[i]){
				cout<<s[i]<<endl;
				break;
			}
		}
	}
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


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




int main(){
	double d,e;
	while(cin>>d>>e){
		rep(i,8){
			if(i==7||(d<f[i]&&e<t[i])){
				cout<<s[i]<<endl;
				break;
			}
		}
	}
}

C++: #include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
using namespace std;
int main(){
	
	double a,b;
	
	while(cin>>a>>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;
	}
	
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  double a,b;
  double h[2][8]={
    {70,55,50,43,40,37.5,35.5,-1},
    {148,116,105,89,83,77,71,-1}
  };
  string s[8]={"NA","E","D","C","B","A","AA","AAA"};
  while(cin>>a>>b){
    int i;
    rep(i,8)if(a>=h[0][i]||b>=h[1][i])break;
      cout<<s[i]<<endl;
  }
}

C++: #include<iostream>
using namespace std;
int main(){
	float q,p,c=0;
	while(c!=2){
		cin >> q >> p;
		if(35.50>=q&&71.00>=p)cout << "AAA";
		else if(37.50>=q&&77.00>=p)cout << "AA";
		else if(40.00>=q&&83.00>=p)cout << 'A';
		else if(43.00>=q&&89.00>=p)cout << 'B';
		else if(50.00>=q&&105.00>=p)cout << 'C';
		else if(55.00>=q&&116.00>=p)cout <<'D';
		else if(70.00>=q&&148.00>=p)cout <<'E';
		else {
			cout << "NA";
		}
		c++;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
	double set[2][8] = { {0,35.5,37.5,40,43,50,55,70},
						  {0,71,77,83,89,105,116,148} };
	double time[2];
	while(cin>>time[0]>>time[1]){
		int class_m[2]={7,7};
		int classs;
		for(int i=0;i<2;i++){
			for(int j=0;j<7;j++){
				if(set[i][j]<=time[i]&time[i]<set[i][j+1]){
					class_m[i] = j;
					break;
				}
			}
			
		}
		classs = max(class_m[0],class_m[1]);
		switch(classs){
			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;
			default:
			cout << "NA" << endl;
			break;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	double a,b;
	while(cin>>a>>b){
		string z="NA";
		if(a<70&&b<148)
			z="E";
		if(a<55&&b<116)
			z="D";
		if(a<50&&b<105)
			z="C";
		if(a<43&&b<89)
			z="B";
		if(a<40&&b<83)
			z="A";
		if(a<37.5&&b<77)
			z="AA";
		if(a<35.5&&b<71)
			z="AAA";
		cout<<z<<endl;
	}
    return 0;
}

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

int main(void){
	double x,y;

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

	return 0;
}