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++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
while(true){
	double t500, t1000;
	cin >> t500;
if(cin.eof())  break;
	cin >> t1000;

	if(t500<35.5&&t1000<71.0){
		cout << "AAA" << '\n';
	}
	else if(t500<37.5&&t1000<77.0){
		cout << "AA" << '\n';
	}
	else if(t500<40.0&&t1000<83.0){
		cout << "A" << '\n';
	}
	else if(t500<43.0&&t1000<89.0){
		cout << "B" << '\n';
	}
	else if(t500<50.0&&t1000<105.0){
		cout << "C" << '\n';
	}
	else if(t500<55.0&&t1000<116.0){
		cout << "D" << '\n';
	}
	else if(t500<70.0&&t1000<148.0){
		cout << "E" << '\n';
	}
	else{
		cout << "NA" << '\n';
	}
}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;

		while(scanf("%f %f",&a,&b)!=EOF) {
			if(35.50>a && 71.00>b){
				printf("AAA\n");
			}
			else if (37.50>a && 77.00>b){
				printf("AA\n");
			}
			else if (40.00>a && 83.00>b){
				printf("A\n");
			}
			else if (43.00>a && 89.00>b){
				printf("B\n");
			}
			else if(50.00>a && 105.00>b){
				printf("C\n");
			}
			else if(55.00>a && 116.00>b){
				printf("D\n");
			}
			else if(70.00>a && 148.00>b){
				printf("E\n");
			}
			else{
				printf("NA\n");
			}
		}
		return 0;
}

C++: #include <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> VI;
typedef pair<int,int> PII;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define PB push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;

int main(){
    string hoge[]={"NA","E","D","C","B","A","AA","AAA"};
    double a,b;
    while(cin>>a>>b){
        int s=-1,x=-1;
        
        if(a<70.0)s=0;
        if(a<55.0)s=1;
        if(a<50.0)s=2;
        if(a<43.0)s=3;
        if(a<40.0)s=4;
        if(a<37.5)s=5;
        if(a<35.5)s=6;
        
        if(b<148.0)x=0;
        if(b<116.0)x=1;
        if(b<105.0)x=2;
        if(b<89.0)x=3;
        if(b<83.0)x=4;
        if(b<77.0)x=5;
        if(b<71.0)x=6;

        cout<<hoge[min(s,x)+1]<<endl;
    }

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


int main(){
	double t1, t2;

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

C++: #include <iostream>

using namespace std;

int result500=0,result1000=0;

void time500m(double time){
    if(time < 35.50){
        result500=0;
    }
    else if(time >= 35.50 && time < 37.50 ){
        result500=1;
    }
    else if(time >= 37.50 && time < 40 ){
        result500=2;
    }
    else if(time >= 40 && time < 43 ){
        result500=3;
    }
    else if(time >= 43 && time < 50 ){
        result500=4;
    }
    else if(time >= 50 && time < 55 ){
        result500=5;
    }
    else if(time >= 55 && time < 70 ){
        result500=6;
    }
    else if(time >= 70 ){
        result500=7;
    }
}

void time1000m(double time){
    if(time < 71){
        result1000=0;
    }
    else if(time >= 71 && time < 77 ){
        result1000=1;
    }
    else if(time >= 77 && time < 83 ){
        result1000=2;
    }
    else if(time >= 83 && time < 89 ){
        result1000=3;
    }
    else if(time >= 89 && time < 105 ){
        result1000=4;
    }
    else if(time >= 105 && time < 116 ){
        result1000=5;
    }
    else if(time >= 116 && time < 148 ){
        result1000=6;
    }
    else if(time >= 148){
        result1000=7;
    }
}

int main() {

    int result;
    double time500,time1000;

    while(1){
        cin >> time500 >> time1000;

        time500m(time500);
        time1000m(time1000);

        if(result500>result1000){
            result=result500;
        }
        else{
            result=result1000;
        }

        switch(result){
        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;
        case 7 : cout << "NA" << endl; break;
        }
        
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double t,ti;

	cin >> t >> ti;

	if(t <= 35.50 && ti <= 71.00)
	{
		cout << "AAA" << endl;
	}
	else if(t <= 37.50 && ti <= 77.00)
	{
		cout << "AA" << endl;
	}
	else if(t <= 40.00 && ti <= 83.00)
	{
		cout << "A" << endl;
	}
	else if(t <= 43.00 && ti <= 89.00)
	{
		cout << "B" << endl;
	}
	else if(t <= 50.00 && ti <= 105.00)
	{
		cout << "C" << endl;
	}
	else if(t <= 55.00 && ti <= 116.00)
	{
		cout << "D" << endl;
	}
	else if(t <= 70 && ti <= 148.00)
	{
		cout << "E" << endl;
	}

	else
		cout << "NA" << endl;

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	
	scanf("%f %f",&a,&b);
	if(a<35.5 && b<71.0){
		printf("AAA\n");
	}
	else if(a<37.5 && b<77.0){
		printf("AA\n");
	}
	else if(a<40.0 && b<83.0){
		printf("A\n");
	}
	else if(a<43.0 && b<89.0){
		printf("B\n");
	}
	else if(a<50.0 && b<105.0){
		printf("C\n");
	}
	else if(a<55.0 && b<116.0){
		printf("D\n");
	}
	else if(a<70.0 && b<148.0){
		printf("E\n");
	}
	else{
		printf("NA\n");
	}
	return 0;
}

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

double border[7][2] =
{
    {35.50, 71.00},
    {37.50, 77.00},
    {40.00, 83.00},
    {43.00, 89.00},
    {50.00, 105.00},
    {55.00, 116.00},
    {70.00, 148.00}
};
string name[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

int main(){
    double a, b;
    int i;
    while( cin >> a >> b ){
        for(i = 0; i < 7; i++){
            if( a < border[i][0] && b < border[i][1] ){
                break;
            }
        }
        cout << name[i] << 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;
	}
}