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(){
  double time500,time1000;
  while( cin >> time500 >> time1000){
  if(time500<35.5&&time1000<71.0) cout << "AAA" << endl;
  else if(time500<37.5&&time1000<77.0) cout << "AA" << endl;
  else if(time500<40.0&&time1000<83.0) cout << 'A' << endl;
  else if(time500<43.0&&time1000<89.0) cout << 'B' << endl;
  else if(time500<50.0&&time1000<105.0) cout << 'C' << endl;
  else if(time500<55.0&&time1000<116.0) cout << 'D' << endl;
  else if(time500<70.0&&time1000<28.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(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<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>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

using namespace std;



template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};

int hoge1(double a)
{
	if (35.50 > a)return 7;
	if (37.50 > a)return 6;
	if (40.00 > a)return 5;
	if (43.00 > a)return 4;
	if (50.00 > a)return 3;
	if (55.00 > a)return 2;
	if (70.00 > a)return 1;
	return 0;
}

int hoge2(double a)
{
	if (71.00 > a)return 7;
	if (77.00 > a)return 6;
	if (83.00 > a)return 5;
	if (89.00 > a)return 4;
	if (105.00 > a)return 3;
	if (116.00 > a)return 2;
	if (148.00 > a)return 1;
}

int main()
{
	double a, b;
	string ans[8] = {"NA", "E", "D", "C", "B", "A", "AA", "AAA"};
	while (cin >> a >> b)
	{
		cout << ans[min(hoge1(a), hoge2(b))] << endl;
	}
}

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

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

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

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
#define MAX_CLASS 8

int check(double m, int type);

int main(){
    double m500, m1000;
    string cls[MAX_CLASS] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
    while(cin >>m500 >>m1000){
        cout <<cls[max(check(m500, 0), check(m1000, 1))] <<endl;
    }
    return 0;
}

int check(double m, int type){
    double dx[2][MAX_CLASS - 1] = {{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0}, {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0}};
    int ret = 7;
    for(int i = 0; i < MAX_CLASS - 1; i++){
        if(m < dx[type][i]){
            ret = i;
            break;
        }
    }
    return ret;
}

C++: #include <cstdio>
#include <string>
#include <iostream>

using namespace std;

int main()
{
    double t1,t2;
    while( scanf( "%lf %lf\n", &t1, &t2 ) != EOF )
    {
        const double bound_1[100] = {35.5,37.5,40,43,50,55,70};
        const double bound_2[100] = {71,77,83,89,105,116,148};
        const string c[100] = {"AAA","AA","A","B","C","D","E"};
        int i = 0, num;
        while( 1 )
        {
            if( t1 < bound_1[i] && t2 < bound_2[i] ){
                cout << c[i] << endl;
                break;
            }
            if( i > 7 )
            {
                printf( "NA\n");
                break;
            }
            i++;
        }
        /* for( int i = 0; i < 7; i++ )
        {
            if( t1 > bound_1[i] )
            {
                num1 = i;
            }
            if( t2 > bound_2[i] )
            {
                num2 = i;
            }
        } */
       
    }
    return 0;
}