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++: #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;
}

C++: #include <cstdio>
int main() {
	float fm, tm;
	while (scanf("%f%f",&fm,&tm)!=EOF) {
		if (fm<35.5&&tm<71.0) printf("AAA\n");
		else if (fm<37.5&&tm<77.0) printf("AA\n");
		else if (fm<40.0&&tm<83.0) printf("A\n");
		else if (fm<43.0&&tm<89.0) printf("B\n");
		else if (fm<50.0&&tm<105.0) printf("C\n");
		else if (fm<55.0&&tm<116.0) printf("D\n");
		else if (fm<70.0&&tm<148.0) printf("E\n");
		else printf("NA\n");
	}
}

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

int x(double a) {
  if(a<35.5) return 7;
  if(a<37.5) return 6;
  if(a<40) return 5;
  if(a<43) return 4;
  if(a<50) return 3;
  if(a<55) return 2;
  if(a<70) return 1;
  return 0;
}

int y(double a) {
  if(a<71) return 7;
  if(a<77) return 6;
  if(a<83) return 5;
  if(a<89) return 4;
  if(a<105) return 3;
  if(a<116) return 2;
  if(a<148) return 1;
  return 0;
}

int main() {
  double a,b;
  while(cin >> a >> b) {
    int s=x(a),t=y(b);
    int z=min(s,t);
    if(z==7) cout << "AAA" << endl;
    if(z==6) cout << "AA" << endl;
    if(z==5) cout << "A" << endl;
    if(z==4) cout << "B" << endl;
    if(z==3) cout << "C" << endl;
    if(z==2) cout << "D" << endl;
    if(z==1) cout << "E" << endl;
    if(z==0) cout << "NA" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  double a,b,aa,bb;
  while(cin>>a>>b){
    if(a<35.50)aa=0;
    else if(a<37.50)aa=1;
    else if(a<40.00)aa=2;
    else if(a<43.00)aa=3;
    else if(a<50.00)aa=4;
    else if(a<55.00)aa=5;
    else if(a<70.00)aa=6;
    else aa=7;
    if(b<71.00)bb==0;
    else if(b<77.00)bb=1;
    else if(b<83.00)bb=2;
    else if(b<89.00)bb=3;
    else if(b<105.00)bb=4;
    else if(b<116.00)bb=5;
    else if(b<148.00)bb=6;
    else bb=7;
    int res=max(aa,bb);
    cout<<ans[res]<<endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	double a,b;
	while(cin>>a>>b){
		if(a<35.5&&71.0>b){
			cout<<"AAA"<<endl;
		}
		else if(a<37.5&&77.0>b){
			cout<<"AA"<<endl;
		}
		else if(a<40.0&&83.0>b){
			cout<<"A"<<endl;
		}
		else if(a<43.0&&89.0>b){
			cout<<"B"<<endl;
		}
		else if(a<50.0&&105.0>b){
			cout<<"C"<<endl;
		}
		else if(a<55.0&&116.0>b){
			cout<<"D"<<endl;
		}
		else if(a<70.0&&148.0>b){
			cout<<"E"<<endl;
		}
		else
			cout<<"NA"<<endl;
	}

	return 0;
}