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 <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int N, K;

bool cmp(const pii &a, const pii &b){
    if(a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;

vi dist;
int d[110][110];

bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
    dist = vector<int>(n, INF);
    dist[s] = 0; // 開始点の距離は0
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int u = 0; u < n; u++) {
                if (dist[v] != INF && dist[u] > dist[v] + d[v][u]) {
                    dist[u] = dist[v] + d[v][u];
                    if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
    return false;
}

int main() {
    //cout << fixed << setprecision(15);

    double a, b;
    while(cin >> a >> b){
        a *= 100;
        b *= 100;
        if(a<3500 && b < 7100){
            cout << "AAA" << endl;
        }else if(a < 3700 && b < 7700){
            cout << "AA" << endl;
        }else if(a < 4000 && b < 8300) {
            cout << "A" << endl;
        }else if(a < 4300 && b < 8900) {
            cout << "B" << endl;
        }else if(a < 5000 && b < 10500) {
            cout << "C" << endl;
        }else if(a < 5500 && b < 11600) {
            cout << "D" << endl;
        }else if(a < 7000 && b > 14800) {
            cout << "E" << endl;
        }else cout << "NA" << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>

using namespace std;


double a, b;


int main()
{
	while (cin >> a >> b)
	{
		if (a<35.5 && b<71.0)
		{
			cout << "AAA" << endl;
		} else if (a<37.5 && b<77.0) {
			cout << "AA" << endl;
		} else if (a<40.0 && b<83.0) {
			cout << "A" << endl;
		} else if (a<43.0 && b<89.0) {
			cout << "B" << endl;
		} else if (a<50.0 && b<105.0) {
			cout << "C" << endl;
		} else if (a<55.0 && b<116.0) {
			cout << "D" << endl;
		} else if (a<70.0 && b<148.0) {
			cout << "E" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
	
	return 0;
}

C++: #include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	double a,b;

	while (cin >> a >> b) {
		if (a < 35.5 && b < 71.0 ) {
			cout << "AAA" << endl;
		} else if (a < 37.5 && b < 77.0) {
			cout << "AA" << endl;
		} else if (a < 40.0 && b < 83.0) {
			cout << "A" << endl;
		} else if (a < 43.0 && b < 89.0) {
			cout << "B" << endl;
		} else if (a < 50.0 && b < 105.0) {
			cout << "C" << endl;
		} else if (a < 55.0 && b < 116.0) {
			cout << "D" << endl;
		} else if (a < 70.0 && b < 148.0) {
			cout << "E" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
	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<95.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++: #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;
}