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>
#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};
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 <iostream>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<int(b); i++)
#define rep(i,b) loop(i,0,b)

const double fiv_t[] = {
    35.5,
    37.5,
    40,
    43,
    50,
    55,
    70
};

const double th_t[] = {
    71,
    77,
    83,
    89,
    105,
    116,
    148
};

const string ss[] = {
    "AAA",
    "AA",
    "A",
    "B",
    "C",
    "D",
    "E"
};

const int inf = 1<<30;

int main(){
    double a, b;
    while(cin>>a>>b){
        int fiv = inf;
        int th = inf;
        rep(i,7)if(a<fiv_t[i]){
            fiv = i;
            break;
        }
        rep(i,7)if(b<th_t[i]){
            th =i;
            break;
        }
        int ans = max(th,fiv);
        if(ans == inf){
            cout <<"NA"<<endl;
        } else {
            cout <<ss[ans]<<endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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

int main() {
  double a,b;
  while(cin>>a>>b) {
    REP(i,8) {
      if (i==7 || a<hoge[i]&&b<hage[i]) {
        cout << s[i] << endl;
        break;
      }
    }
  }
}

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

int main()
{
	double t, u;
	string s;

	while (cin >> t >> u) {
		if (t < 35.5 && u < 71)
			s = "AAA";
		else if (t < 37.5 && u < 77)
			s = "AA";
		else if (t < 40 && u < 83)
			s = "A";
		else if (t < 43 && u < 89)
			s = "B";
		else if (t < 50 && u < 105)
			s = "C";
		else if (t < 55 && u < 116)
			s = "D";
		else if (t < 70 && u < 148)
			s = "E";
		else
			s = "NA";

		cout << s << endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(main)
{
	double a,b;
	while(scanf("%lf %lf",&a,&b)!=EOF){
		if(a<35.5 && b<71){
			printf("AAA\n");
		}
		else if(a<37.5 && b<77){
			printf("AA\n");
		}
		else if(a<40 && b<83){
			printf("A\n");
		}
		else if(a<43 && b<89){
			printf("B\n");
		}
		else if(a<50 && b<105){
			printf("C\n");
		}
		else if(a<55 && b<116){
			printf("D\n");
		}
		else if(a<60 && b<148){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	//	scanf("%d %d",&a,&b);
	}
	return 0;
}

C++: #include<stdio.h>
int main(void){
  int t1,t2;
  scanf("%d %d",&t1,&t2);
  if(t1<35.5&&t2<71){
    printf("AAA\n");
  }else if(t1<37.5&&t2<77){
    printf("AA\n");
  }else if(t1<40&&t2<83){
    printf("A\n");
  }else if(t1<43&&t2<89){
    printf("B\n");
  }else if(t1<50&&t2<105){
    printf("C\n");
  }else if(t1<55&&t2<116){
    printf("D\n");
  }else if(t1<70&&t2<148){
    printf("E\n");
  }else{
    printf("NA\n");
  }
}

C++: #include<iostream>
using namespace std;
int main() {
	double a, b;
	while (cin >> a >> b){
		if (a < 35 && b < 61)cout << "AAA";
		else if (a < 37 && b < 67)cout << "AA";
		else if (a < 40 && b < 73)cout << "A";
		else if (a < 43 && b < 79)cout << "B";
		else if (a < 50 && b < 105)cout << "C";
		else if (a < 55 && b < 116)cout << "D";
		else if (a < 70 && b < 148)cout << "E";
		else cout << "NA";
		cout << endl;
	}
}

C++: #include <iostream>

using namespace std;

void solve()
{
	double time[2];
	string str[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
	int a = 0;
	int b = 0;
	while(cin >> time[0] >> time[1])
	{
		if(time[0] < 35.50)
		{
			a = 0;
		}
		else if(time[0] < 37.50)
		{
			a = 1;
		}
		else if(time[0] < 40.00)
		{
			a = 2;
		}
		else if(time[0] < 43.00)
		{
			a = 3;
		}
		else if(time[0] < 50.00)
		{
			a = 4;
		}
		else if(time[0] < 55.00)
		{
			a = 5;
		}
		else if(time[0] < 70.00)
		{
			a = 6;
		}
		else
		{
			a = 7;
		}

		if(time[1] < 71.00)
		{
			b = 0;
		}
		else if(time[1] < 77.00)
		{
			b = 1;
		}
		else if(time[1] < 83.00)
		{
			b = 2;
		}
		else if(time[1] < 89.00)
		{
			b = 3;
		}
		else if(time[1] < 105.00)
		{
			b = 4;
		}
		else if(time[1] < 116.00)
		{
			b = 5;
		}
		else if(time[1] < 148.00)
		{
			b = 6;
		}
		else
		{
			b = 7;
		}

		if(a >= b)
		{
			cout << str[a].data() << endl;
		}
		else
		{
			cout << str[b].data() << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>
int main(){
  int t1,t2;
  scanf("%d %d",&t1,&t2);

  if(t1<=35.5&&t2<=71){
    printf("AAA\n");   
  }else if(t1<=37.5&&t2<=77){
    printf("AA\n");
  }else if(t1<=40&&t2<=83){
    printf("A\n");
  }else if(t1<=43&&t2<=89){
    printf("B\n");
  }else if(t1<=50&&t2<=105){
    printf("C\n");
  }else if(t1<=55&&t2<=116){
    printf("D\n");
  }else if(t1<=70&&t2<=148){
    printf("E\n");
  }else{
    printf("NA\n");   
  }
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#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 each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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