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>
#include <string>
using namespace std;

int main() {
  for(double s, g;cin >> s >> g;) {
    string out;
    if(s < 35.50 && g < 71.00) out = "AAA";
    else if(s < 37.0 && g < 77.00) out = "AA";
    else if(s < 40.0 && g < 83.00) out = "A";
    else if(s < 43.0 && g < 89.00) out = "B";
    else if(s < 50.0 && g < 105.00) out = "C";
    else if(s < 55.0 && g < 116.00) out = "D";
    else if(s < 70.0 && g < 148.00) out = "E";
    else out = "NA";
    cout << out << endl;
  }
  return 0;
}

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

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


int main(){
	double tl500[]= {70,  55, 50, 43, 40, 37.5,  35.5};
	double tl1000[]={148,116,105, 89, 83, 77, 71};
	char *rank[]=    {"E","D","C","B","A","AA","AAA"};
	
	double a,b;
	while(cin>>a>>b){
		char *ans="NA";
		for(int i=0;i<7;i++){
			if(a<tl500[i]&&b<tl1000[i])ans=rank[i];
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

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&&b<77)
			z="AA";
		if(a<35&&b<71)
			z="AAA";
		cout<<z<<endl;
	}
    return 0;
}

C++: #include<stdio.h>
int main(main)
{
	double a,b;
	while(scanf("%lf %lf",&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 <cstdio>
#include <stack>

using namespace std;

int main(){
	
	double a, b;
	
	cin >> a;
	
	while(true){
		if(cin.eof()){
			break;
		}
		cin >> 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");
		}
		
		cin >> a;
	}
	
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

	double a,b;

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

}

C++: #include <stdio.h>

int main(void){
	double a, b;
	while(scanf("%lf%lf",&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 < 70 && b < 148)
		printf("E\n");
	else
		printf("NA\n");
	}
	return 0;
}

C++: #include<cstdio>
#include<string>
main(){
	using namespace std;
	string lv[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double ind1,ind2,lvd5[7] = {35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	int i,j,lvd1[7] = {71,77,83,89,105,116,148};
	while(~scanf("%lf %lf",&ind1,&ind2)){
		i = j = 0;
		while(i++<7)
		  if(ind1 < lvd5[i])
		    break;
		while(j++<7)
		  if(ind2 < lvd1[j])
		    break;
		printf("%s\n", i <= j ? lv[j].c_str() : lv[i].c_str());
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

const float m500[] = {
  35.5f, 37.5f, 40.0f, 43.0f, 50.0f, 55.0f, 70.0f, (float)(1<<30)
};
const float m1k[] = {
  71.0f, 77.0f, 83.0f, 89.0f, 105.f, 116.f, 148.0f, (float)(1<<30)
};
const string rank[] = {
  "AAA", "AA", "A", "B", "C", "D", "E", "NA"
};

int main() {
  const int sz = 8;
  float l, r;
  while (cin >> l >> r) {
    int ll = upper_bound(m500, m500 + sz, l) - m500;
    int rl = upper_bound(m1k, m1k + sz, l) - m1k;
    cout << rank[max(rl,ll)] << endl;
    //cout << ll << "," << rl << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

double chk500[8]={
  35.5, 37.5, 40, 43, 50, 55, 70, 1e10
};
double chk1000[8]={
  71, 77, 83, 89, 105, 116, 148, 1e10
};
const char *rank[8]={
  "AAA","AA","A","B","C","D","E","NA"
};

int main(){
  double a,b;
  while(~scanf("%lf%lf",&a,&b)){
    REP(i,8){
      if(a < chk500[i] && b < chk1000[i]){
        puts(rank[i]);
        break;
      }
    }
  }
  return 0;
}

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

int main()
{

	double time5, time10;

	cin >> time5 >> time10;

	if( time5 < 35.5 && time10 < 71.0 ) cout << "AAA";
	else if( time5 < 37.5 && time10 < 67.0 ) cout << "AA";
	else if( time5 < 40.0 && time10 < 83.0 ) cout << "A";
	else if( time5 < 43.0 && time10 < 89.0 ) cout << "B";
	else if( time5 < 50.0 && time10 < 105.0 ) cout << "C";
	else if( time5 < 55.0 && time10 < 116.0 ) cout << "D";
	else if( time5 < 70.0 && time10 < 148.0 ) cout << "E";
	else cout << "NA";

	cout << endl;

	return 0;

}