Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	badge := []string{"AAA", "AA", "A", "B", "C", "D", "E"}
	badgeLen := len(badge)
	short := []float64{35.5, 37.5, 40, 43, 50, 55, 70}
	long := []float64{71, 77, 83, 89, 105, 116, 148}

	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		time := strings.Split(stdin.Text(), " ")

		sT, _ := strconv.ParseFloat(time[0], 64)
		lT, _ := strconv.ParseFloat(time[1], 64)

		sR, lR, t := 0, 0, 0.0
		for _, t = range short {
			if sT < t {
				break
			}
			sR++
		}
		for _, t = range long {
			if lT < t {
				break
			}
			lR++
		}
		rank := ""
		if sR >= badgeLen || lR >= badgeLen {
			rank = "NA"
		} else if sR >= lR {
			rank = badge[sR]
		} else {
			rank = badge[lR]
		}
		fmt.Println(rank)
	}
}

C++: #include <iostream>

// AAA=0, AA=1, A=2, B=3, C=4, D=5, E=6, NA=7
int getClass500(float t)
{
	if (t < 35.50) return 0;
	else if (t < 37.50) return 1;
	else if (t < 40.00) return 2;
	else if (t < 43.00) return 3;
	else if (t < 50.00) return 4;
	else if (t < 55.00) return 5;
	else if (t < 70.00) return 6;
	else return 7;
}

int getClass1000(float t)
{
	if (t < 71.00) return 0;
	else if (t < 77.00) return 1;
	else if (t < 83.00) return 2;
	else if (t < 89.00) return 3;
	else if (t < 105.00) return 4;
	else if (t < 116.00) return 5;
	else if (t < 148.00) return 6;
	else return 7;
}

int main()
{
	float t1, t2;
	while (std::cin >> t1 >> t2) {
		int c1 = getClass500(t1);
		int c2 = getClass1000(t2);
		int c = std::max(c1, c2);
		switch (c) {
		case 0:
			std::cout << "AAA" << std::endl; break;
		case 1:
			std::cout << "AA" << std::endl; break;
		case 2:
			std::cout << "A" << std::endl; break;
		case 3:
			std::cout << "B" << std::endl; break;
		case 4:
			std::cout << "C" << std::endl; break;
		case 5:
			std::cout << "D" << std::endl; break;
		case 6:
			std::cout << "E" << std::endl; break;
		case 7:
			std::cout << "NA" << std::endl; break;
		}
	}
	return 0;
}

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;
    }
}