Go: package main

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

func main() {
	badge := []string{"AAA", "AA", "A", "B", "C", "D", "E"}
	badgeLen := len(badge)
	short := []float64{35.5, 37.5, 40, 43, 50, 55, 70}
	long := []float64{71, 77, 83, 89, 105, 116, 148}

	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		time := strings.Split(stdin.Text(), " ")

		sT, _ := strconv.ParseFloat(time[0], 64)
		lT, _ := strconv.ParseFloat(time[1], 64)

		sR, lR, t := 0, 0, 0.0
		for _, t = range short {
			if sT < t {
				break
			}
			sR++
		}
		for _, t = range long {
			if lT < t {
				break
			}
			lR++
		}
		rank := ""
		if sR >= badgeLen || lR >= badgeLen {
			rank = "NA"
		} else if sR >= lR {
			rank = badge[sR]
		} else {
			rank = badge[lR]
		}
		fmt.Println(rank)
	}
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (int)(count); i++)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 100000 ;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

using namespace std;

int main()
{
	double a,b;
	while(~scanf("%lf %lf",&a,&b)){
		static double t5[] = {35.5,37.5,40,43,50,55,70};
		static double t10[] = {71,77,83,89,105,116,148};
		static string s[] = {"AAA","AA","A","B","C","D","E","NA"};
		int t5_r = upper_bound(t5,t5+7,a) - t5;
		int t10_r = upper_bound(t10,t10+7,b) - t10;

		int mx = max(t5_r,t10_r);
		cout << s[mx] << endl;
	}

	return 0;
}

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