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>
#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<stdio.h>
#include<iostream>
using namespace std;
void TR(double x,double y,int K,int H)
{
int t;
double X;
X=x*100;t=(int)X;
if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

X=y*100;t=(int)X;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;
}


}
int main(){
int K=0,H=0;
double x,y;
while(scanf("%lf %lf",&x,&y)!=EOF)
{K=0,H=0;

TR(x,y,K,H);
if(H<K)H=K;

switch(K){
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) {

  double five,ten;


  while(scanf("%lf %lf",&five,&ten)!=EOF) {

    if(five<35.50 && ten<71.00) printf("AAA\n");

    else if(five<37.50 && ten<77.00) printf("AA\n");

    else if(five<40.00 && ten<83.00) printf("A\n");

    else if(five<43.00 && ten<89.00) printf("B\n");

    else if(five<50.00 && ten<105.00) printf("C\n");

    else if(five<55.00 && ten<116.00) printf("D\n");

    else if(five<70.00 && ten<148.00) printf("E\n");

    else printf("NA\n");

  }

  return 0;

}

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