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

int main()
{
    double ft,st;
    while(cin>>ft>>st)
    {
        int fr=0,sr=0;
        if(ft<70.00)fr++;
        if(ft<55.00)fr++;
        if(ft<50.00)fr++;
        if(ft<43.00)fr++;
        if(ft<40.00)fr++;
        if(ft<37.50)fr++;
        if(ft<35.50)fr++;
        if(sr<148.00)sr++;
        if(sr<116.00)sr++;
        if(sr<105.00)sr++;
        if(sr<89.00)sr++;
        if(sr<83.00)sr++;
        if(sr<77.00)sr++;
        if(sr<71.00)sr++;
        int r;
        r=min(fr,sr);
        if(r==0)cout<<"NA"<<endl;
        if(r==1)cout<<"E"<<endl;
        if(r==2)cout<<"D"<<endl;
        if(r==3)cout<<"C"<<endl;
        if(r==4)cout<<"B"<<endl;
        if(r==5)cout<<"A"<<endl;
        if(r==6)cout<<"AA"<<endl;
        if(r==7)cout<<"AAA"<<endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
   // Your code here!
   double a, b;
   
   while(cin>>a>>b){
       if(a<35.50 && b<71.00){
           cout<<"AAA"<<endl;
       }
       else if(a<37.50 && b<77.00){
           cout<<"AA"<<endl;
       }
       else if(a<40.00 && b<83.00){
           cout<<"A"<<endl;
       }
       else if(a<43.00 && b<89.00){
           cout<<"B"<<endl;
       }
       else if(a<50.00 && b<105.00){
           cout<<"C"<<endl;
       }
       else if(a<55.00 && b<116.00){
           cout<<"D"<<endl;
       }
       else if(a<70.00 && b<148.00){
           cout<<"E"<<endl;
       }
       else  cout<<"NA"<<endl;
   }
   return 0;

}

C++: #include<iostream>
using namespace std;
 
int main(){
	 
  	double a, b;
  	
  	cin >> a >> b;
  	
  	if(a <35.50 && b < 71.00)
	cout <<"AAA\n";
    else if(a < 37.50 && b < 77.00)
    
	cout <<"AA\n";
	
    else if(a < 40.00 && b < 83.00)
	cout <<"A\n";
	
    else if(a < 43.00 && b < 89.00)
	cout <<"B\n";
	
    else if(a < 50.00 && b < 105.00)
	cout <<"C\n";
	
    else if(a < 55.00 && b < 116.00)
	cout <<"D\n";
	
    else if(a < 70.00 && b < 148.00)
	cout <<"E\n";
	
    else 
	cout << "NA\n";
  		
  	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

  double ina, inb;

  while(cin >> ina >>inb){

    if(ina < 35.5 && inb < 71) cout << "AAA" << endl;
    else if(ina < 37.5 && inb < 77) cout << "AA" << endl;
    else if(ina < 40 && inb < 83) cout << "A" << endl;
    else if(ina < 43 && inb < 89) cout << "B" << endl;
    else if(ina < 50 && inb < 105) cout << "C" << endl;
    else if(ina < 55 && inb < 116) cout << "D" << endl;
    else if(ina < 70 && inb < 148) cout << "E" << endl;
    else  cout << "NA" << endl;

  }
  return 0;

}

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

using namespace std;

int main()
{
    double t1,t2;
    while( scanf( "%lf %lf\n", &t1, &t2 ) != EOF )
    {
        printf( "%lf %lf\n", t1, t2  );
        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;
}

C++: #include <iostream>

using namespace std;

int main() {

	int ms, ml;

	while(cin >> ms >> ml) {
		if(ms<35.50)
			ms=0;
		else if(ms<37.50)
			ms=1;
		else if(ms<40.00)
			ms=2;
		else if(ms<43.00)
			ms=3;
		else if(ms<50.00)
			ms=4;
		else if(ms<55.00)
			ms=5;
		else if(ms<70.00)
			ms=6;
		else
			ms=7;
		if(ml<71.00)
			ml=0;
		else if(ml<77.00)
			ml=1;
		else if(ml<83.00)
			ml=2;
		else if(ml<89.00)
			ml=3;
		else if(ml<105.00)
			ml=4;
		else if(ml<116.00)
			ml=5;
		else if(ml<148.00)
			ml=6;
		else
			ml=7;

		if(ms<ml)
			ms=ml;

		switch(ms) {
			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 ms, ml;
	double s[7]={35.50, 37.50, 40.00, 43.00, 50.00, 55.00, 70.00};
	double l[7]={71.00, 77.00, 83.00, 89.00, 105.00, 116.00, 148.00};
	char r[7][4]={"AAA", "AA", "A", "B", "C", "D", "NA"};

	while(cin >> ms >> ml) {
		int ss=6, ll=6;
		for(int i=6; i>=0; i--) {
			if(ms<s[i]) {
				ss=i;
			}
		}
		for(int i=6; i>=0; i--) {
			if(ml<l[i]) {
				ll=i;
			}
		}

		if(ss<ll) {
			ss=ll;
		}

		cout << r[ss] << endl;
	}
	
	return 0;

}

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

double afive[7] = {35.5, 37.5, 40, 43, 50, 55, 70};
double athou[7] = {71, 77, 83, 89, 105, 116, 148};
string grade[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

int main() {
    vector<double> five(7), thou(7);
    for (int i = 0; i < 7; ++i) {
        five[i] = afive[i];
        thou[i] = athou[i];
    }
    
    double a, b;
    while (cin >> a >> b) {
        int da = upper_bound(five.begin(), five.end(), a) - five.begin();
        int db = upper_bound(thou.begin(), thou.end(), b) - thou.begin();
        int res = max(da, db);
        cout << grade[res] << endl;
    }
}

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

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

typedef long long ll;

using namespace std;


int main()
{
	char* rank[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };
	double fif[] = { 35.5, 37.5, 40, 43, 50, 55, 70, 1e10 };
	double th[] = { 71, 77, 83, 89, 105, 116, 148, 1e10 };
	double a, b;
	while (scanf("%lf %lf", &a, &b) != EOF)
	{
		int i;
		for (i = 0; a >= fif[i] || b >= th[i]; ++i)
			;
		puts(rank[i]);
	}

	return 0;
}