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 <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
double table5[7]={35.50,37.50,40.0,43.0,50.0,55.0,70};
double table1[7]={71.0,77.0,83.0,89.0,105.0,116.0,148.0};
string score[7]={"AAA","AA","A","B","C","D","E"};
int main(){
	double a,b;
	while(cin>>a>>b){
		int t5 = 100;
		int t1 = 100;
		for(int i =0;i < 7;i++){
			if(a<table5[i]){
				t5 = i;
				break;
			}
		}
		for(int j =0;j < 7;j++){
			if(b<table1[j]){
				t1 =j;
				break;
			}
		}
		int ans = max(t1,t5);
		if(ans==100){
			cout <<"NA"<<endl;
		}else{
			cout <<score[ans]<<endl;
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    double A,B;
    while(cin>>A>>B){
        if(A<35.5&&B<71.0)puts("AAA");
        else if(A<37.5&&B<77.0)puts("AA");
        else if(A<40.0&&B<83.0)puts("A");
        else if(A<43.0&&B<89.0)puts("B");
        else if(A<50.0&&B<105.0)puts("C");
        else if(A<55.0&&B<116.0)puts("D");
        else if(A<70.0&&B<148.0)puts("E");
        else puts("NA");
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <algorithm>
#include <strstream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;

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

C++: #include<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&a,&b)!=EOF){
		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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }


int light[] = {35.5, 37.5, 40, 43, 50, 55, 70};
int heavy[] = {71, 77, 83, 89, 105, 116, 148};
string cls[] = {"AAA", "AA", "A", "B", "C", "D", "E"};


string comp(double a, double b)
{
	rep(i, 7)
		if(a < light[i] && b < heavy[i])
			return cls[i];
	
	return "NA";
}

int main()
{
    double a, b;
	while(cin >> a >> b)
		cout << comp(a, b) << endl;
}

C++: #include<bits/stdc++.h>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define ll long long int
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int>pii;
typedef pair<ll,ll>pll;
typedef pair<double,double>pdd;
using namespace std;
#define MAX  999999
int main(){
	double tiya,rize;
	while(cin>>tiya>>rize){
		 if(tiya<35.5&&rize<71)
			cout<<"AAA"<<endl;
		else if(tiya<37.5&&rize<77)
			cout<<"AA"<<endl;
		else if(tiya<40&&rize<83)
			cout<<"A"<<endl;
		else if(tiya<43.0&&rize<89)
			cout<<"B"<<endl;
		else if(tiya<50&&rize<105)
			cout<<"C"<<endl;
		else if(tiya<55&&rize<116)
			cout<<"D"<<endl;
		else if(tiya<70&&rize<148)
			cout<<"E"<<endl;
		else cout<<"NA"<<endl;
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

string s[] = { "AAA","AA","A","B","C","D","E" };
double t1[] = { 35.5,37.5,40,43,50,55,70 };
double t2[] = { 71,77,83,89,105,116 };

signed main() {
	for (double a, b; cin >> a >> b;) {
		rep(i, 0, 8) {
			if (t1[i] > a&&t2[i] > b) {
				cout << s[i] << endl;
				break;
			}
			if (i == 7) {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  double t1,t2;
  string ch;
  while( cin >> t1 ){
    if(t1 < 35.5){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";

    cin >> t2;

    if(t2 < 71.0 && ch == "AAA"){
      ch = "AAA";
    }else if(t2 < 77 && ch == "AA"){
      ch = "AA";
    } else if(t2 < 83 && ch == "A"){
      ch = "A";
    }else if(t2 < 89 && ch == "B"){
      ch = "B";
    }else if(t2 < 105 && ch == "C"){
      ch = "C";
    }else if(t2 < 116 && ch == "D"){
      ch = "D";
    }else if(t2 < 148 && ch == "E"){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}