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 <cstdio>

int main(void)
{
    double g, h;
    while (scanf("%lf %lf", &g, &h) != EOF){
        if ((g < 35.5) && (h < (60 * 1) + 11)){
            printf("AAA\n");
        }
        else if ((g < 37.5) && (h < (60 * 1) + 17)){
            printf("AA\n");
        }
        else if ((g < 40) && (h < (60 * 1) + 23)){
            printf("A\n");
        }
        else if ((g < 43) && (h < (60 * 1) + 29)){
            printf("B\n");
        }
        else if ((g < 50) && (h < (60 * 1) + 45)){
            printf("C\n");
        }
        else if ((g < 55) && (h < (60 * 1) + 56)){
            printf("D\n");
        }
        else if ((g < 70) && (h < (60 * 2) + 28)){
            printf("E\n");
        }
        else {
            printf("NA\n");
        }
    }
    
    return (0);
}

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

int main(){
  string bg[8]={"AAA","AA","A","B","C","D","E","NA"};
  double m500[7]={35.5,37.5,40.0,43.0,50.0,55.0,70.0};
  double m1000[7]={71.0,77.0,83.0,89.0,105.0,116.0,148.0};
  double a,b;
  while(cin >> a && cin >> b){
    int ans=7;
    for(int i=0;i<7;i++){
      if(a < m500[i] && b < m1000[i]){
	ans = i;
	break;
      }
    }
    cout << bg[ans] << endl;
  }
}

C++: #include<bits/stdc++.h>
#define EPS 1e-9
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main() {
	double t1, t2;
	while (cin >> t1 >> t2) {
		if (t1 < 35.5&&t2 < 71.)puts("AAA");
		else if (t1 < 37.5&&t2 < 77.)puts("AA");
		else if (t1 < 40.&&t2 < 83.)puts("A");
		else if (t1 < 43.&&t2 < 89.)puts("B");
		else if (t1 < 50.&&t2 < 105.)puts("C");
		else if (t1 < 55.&&t2 < 116.)puts("D");
		else if (t1 < 70.&&t2 < 148.)puts("E");
		else puts("NA");
	}
}

C++: #include<cstdio>
#include<string>
main(){
	using namespace std;
	int i,j;
	string lv[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double lvd5[7] = {35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	int lvd1[7] = {71,77,83,89,105,116,148};
	double ind1,ind2;
	while(~scanf("%lf %lf",&ind1,&ind2)){
		i = j = 0;
		while(i<7){
			if(ind1 < lvd5[i])
				break;
			i++;
		}
		while(j<7){
			if(ind2 < lvd1[j])
				break;
			j++;
		}
		printf("%s\n", i <= j ? lv[j].c_str() : lv[i].c_str());
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double t,ti;

	while(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 <vector>
#include <iostream>
#include <string>
static const std::vector<double> half{ 0, 35.50, 37.50, 40, 43, 50,55, 70 };
static const std::vector<double> kilo{ 0, 71, 77, 83, 89, 105, 116, 148 };
static const std::vector<std::string> grade{ "AAA", "AA", "A", "B", "C", "D", "E", "NA" };

int bin_half(const double &time, const int &left = 0, const int &right = 7) {
	if (left == right) {
		return left;
	}
	else {
		auto mid = ((left + right + 1) >> 1);
		if (half.at(mid) > time) {
			return bin_half(time, left, mid - 1);
		}
		else {
			return bin_half(time, mid, right);
		}
	}
}
int bin_kilo(const double &time, const int &left = 0, const int &right = 7) {
	if (left == right) {
		return left;
	}
	else {
		auto mid = ((left + right + 1) >> 1);
		if (kilo.at(mid) > time) {
			return bin_kilo(time, left, mid - 1);
		}
		else {
			return bin_kilo(time, mid, right);
		}
	}
}
std::string cul_grade(const double &half_t, const double &kilo_t) {
	auto h{ bin_half(half_t) }, k{ bin_kilo(kilo_t) };
	if (h < k) {
		return grade.at(k);
	}
	else {
		return grade.at(h);
	}
}
int main() {
	double h, k;
	while (std::cin >> h >> k) {
		std::cout << cul_grade(h, k) << '\n';
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main(){
    
    double a,b;
    while(cin >> a >> b)
    {
    	if(a<35.5 && b<71)cout<<"AAA"<<endl; 	
    	else if(a<37.5 && b<77)cout<<"AA"<<endl; 	
    	else if( a<40 && b<83 )cout<<"A"<<endl; 	
    	else if( a<43 && b<89 )cout<<"B"<<endl; 	
    	else if( a<50 && b<105 )cout<<"C"<<endl; 	
    	else if( a<55 && b<116 )cout<<"D"<<endl; 
    	else if( a<70 && b<148 )cout<<"E"<<endl; 		
    	else cout<<"NA"<<endl; 	
    }
    return 0;
}

C++: #include <iostream>

using namespace std;
/** problem0123 : Speed Skating Badge Test **/
int main()
{
	double rank500[8] = {35.5, 37.5, 40, 43, 50, 55, 70};
	double rank1000[8] = {71, 77, 83, 89, 105, 116, 148};
	string rank[8] = {"AAA", "AA", "A", "B", "C", "D", "E"};
	double a, b;
	
	while (cin >> a >> b) {
		string ra="NA";
		for (int i=0; i<8; i++) {
			if (a < rank500[i] && b < rank1000[i]) {
				ra = rank[i];
				break;
			}
		}
		cout << ra << endl;
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

const string Level[8] = { "AAA","AA", "A", "B", "C", "D", "E","NA" };
const double Time1[8] = { 35.50 , 37.50 , 40.00 , 43.00, 50.00, 55.00, 70.00,DBL_MAX };
const double Time2[8] = { 71.00 , 77.00 , 83.00 , 89.00,105.00,116.00,148.00,DBL_MAX };

int solve(double t1, double t2) {

	

	return 0;
}

int main() {
	double t1,t2;

	while (cin >> t1 >> t2) {
		for (int i = 0; i < 8; i++) {
			if (t1 < Time1[i] && t2 < Time2[i]) {
				cout << Level[i] << endl;
				break;
			}
		}
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
using ll = long long;
using pii = pair<int, int>;

using P = pair<double, double>;
map<string, P> mp;

void init() {
  mp["AAA"] = {35.5, 71.0};
  mp["AA"] = {37.5, 77.0};
  mp["A"] = {40.0, 83.0};
  mp["B"] = {43.0, 89.0};
  mp["C"] = {50.0, 105.0};
  mp["D"] = {55.0, 116.0};
  mp["E"] = {70.0, 148.0};
}

bool operator < (const P& a, const P& b) {
  return (a.first - b.first < -1e-10) && (a.second - b.second < -1e-10);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  init();
  vector<string> s = {"AAA", "AA", "A", "B", "C", "D", "E"};
  P a;
  while (cin >> a.first >> a.second) {
    string ans = "NA";
    for (int i = 0; i < 7; i++) {
      if (a < mp[s[i]]) {
        ans = s[i];
        break;
      }
    }
    cout << ans << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<set>
#include<queue>

using namespace std;

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

const double EPS = 1e-9;
int main(){

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

	double n,m;
	while(cin>>n>>m){
		
		int r,rr;
		for(r=0;r<7;r++){
			if(n-time500[r] < -EPS)break;
		}
		for(rr = 0;rr<7;rr++){
			if(n-time1000[rr] < -EPS)break;
		}

		cout<<rank[max(r,rr)]<<endl;

	}

	return 0;
}