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

int main(void){
	string s[] = {"AAA","AA","A","B","C","D","E","NA"};
	double f[] = {35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0};
	double o[] = {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0};
	double a,b;

	while(cin>>a>>b){
		int lf,lo;
		for(lf=0;a>=f[lf] && lf<7;lf++);
		for(lo=0;b>=o[lo] && lo<7;lo++);

		int level = max(lf,lo);
		cout<<s[level]<<endl;
	}

	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
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;
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    double t500,t1000;
    while (cin>>t500>>t1000) {
        if (t500<35.50&&t1000<71.00) {
            cout<<"AAA"<<endl;
        } else if (t500<37.50&&t1000<77.00) {
            cout<<"AA"<<endl;
        } else if (t500<40.00&&t1000<83.00) {
            cout<<"A"<<endl;
        } else if (t500<43.00&&t1000<89.00) {
            cout<<"B"<<endl;
        } else if (t500<50.00&&t1000<105.00) {
            cout<<"C"<<endl;
        } else if (t500<55.00&&t1000<116.00) {
            cout<<"D"<<endl;
        } else if (t500<70.00&&t1000<148.00) {
            cout<<"E"<<endl;
        } else {
            cout<<"NA"<<endl;
        }
    }
}

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.50, 37.50, 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>

using namespace std;

int main(void){
	double a,b;
	while(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<148.0)cout << "E" << endl;
		else cout << "NA" << endl;
	}
	return 0;
}

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

int main(){

	int n;
	double five, ten;
	map<int, string> mp;
	double cls[7][2] = {{70.0, 148.0},
											{55.0, 116.0},
											{50.0, 105.0},
											{43.0, 89.0},
											{40.0, 83.0},
											{37.5, 77.0},
											{35.5, 71.0}};
	mp.insert(make_pair(0, "NA"));
	mp.insert(make_pair(1, "E"));
	mp.insert(make_pair(2, "D"));
	mp.insert(make_pair(3, "C"));
	mp.insert(make_pair(4, "B"));
	mp.insert(map<int, string>::value_type(5, "A"));
	mp.insert(pair<int, string>(6, "AA"));
	mp.insert(make_pair(7, "AAA"));
	
	while(cin >> five >> ten){
		n = 0;
		for(int i=0; i<7; i++){
			if(five < cls[i][0] && ten < cls[i][1]){
				 n++;
			}
			else{
				cout << mp[n] << endl;
				break;
			}
		}
	}

	return 0;

}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
int main() {
	string st;
	while (getline(cin, st)) {
		ld a = stod(st.substr(0, st.find(" ")));
		ld b = stod(st.substr(st.find(" ")));
		a += 0.001;
		b += 0.001;
		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;
	}
	return 0;
}

C++: #include<iostream>

using namespace std ;

int main()

{
	float m5_limites[] = { 35.5 ,37.5 ,40.0 ,43.0 ,50.0 ,55.0 ,70.0 } ;
	float m1_limites[] = { 71.0 ,77.0 ,83.0 ,89.0 ,105.0 ,116.0 ,148.0 } ;
	string lank[] = { "AAA" ,"AA" ,"A" ,"B" ,"C" ,"D" ,"E" ,"NA" } ;

	float m5 ,m1 ;

	while( cin >> m5 >> m1 )
	{
		int i = 0 ;
		while( i < 7 && !( m5 < m5_limites[ i ] && m1 < m1_limites[ i ] ) )
			i++ ;
		cout << lank[ i ] << endl ;
	}

	return 0 ;
}

C++: #include <cstdio>

using namespace std;

int main(void) {
    double a, b;
    while (scanf("%lf %lf", &a, &b) != EOF) {
        int x, y;
        x = (int)(a * 100);
        y = (int)(b * 100);
        if (x < 3550 && y < 7100) {
            puts("AAA");
        } else if (x < 3750 && y < 7700) {
            puts("AA");
        } else if (x < 4000 && y < 8300) {
            puts("A");
        } else if (x < 4300 && y < 8900) {
            puts("B");
        } else if (x < 5000 && y < 10500) {
            puts("C");
        } else if (x < 5500 && y < 11600) {
            puts("D");
        } else if (x < 7000 && y < 14800) {
            puts("E");
        } else {
            puts("NA");
        }
    }
    return 0;
}

C++: // 2011/01/17 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	while(!cin.eof()){
		string str;
		getline(cin, str);
		if(str.empty())
			continue;

		istringstream ist(str);
		double tim500, tim1000;
		ist >> tim500 >> tim1000;

		if(tim500<35.50 && tim1000<71.00)
			cout << "AAA" << endl;
		else if(tim500<37.50 && tim1000<77.00)
			cout << "AA" << endl;
		else if(tim500<40.00 && tim1000<83.00)
			cout << "A" << endl;
		else if(tim500<43.00 && tim1000<89.00)
			cout << "B" << endl;
		else if(tim500<50.00 && tim1000<105.00)
			cout << "C" << endl;
		else if(tim500<55.00 && tim1000<116.00)
			cout << "D" << endl;
		else if(tim500<70.00 && tim1000<148.00)
			cout << "E" << endl;
		else
			cout << "NA" << endl;
	}

	return 0;
}

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

void out_grade(double M_500_time,double M_1000_time){
  if(M_500_time<35.50&&M_1000_time<71.0)cout<<"AAA"<<endl;
  else if(M_500_time<37.50&&M_1000_time<77.00)cout<<"AA"<<endl;
  else if(M_500_time<40.00&&M_1000_time<83.00)cout<<"A"<<endl;
  else if(M_500_time<43.00&&M_1000_time<89.00)cout<<"B"<<endl;
  else if(M_500_time<50.00&&M_1000_time<105.00)cout<<"C"<<endl;
  else if(M_500_time<55.00&&M_1000_time<116.00)cout<<"D"<<endl;
  else if(M_500_time<70.00&&M_1000_time<148.00)cout<<"E"<<endl;
  else cout<<"NA"<<endl;
}

int main(){
  double M_500_time,M_1000_time;
  while(cin>>M_500_time>>M_1000_time){
    out_grade(M_500_time,M_1000_time);
  }
}