Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	m500 := []float64{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, 1000.0}
	m1000 := []float64{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, 1000.0}
	classes := []string{"AAA", "AA", "A", "B", "C", "D", "E", "NA"}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), " ")
		t500, _ := strconv.ParseFloat(input[0], 64)
		t1000, _ := strconv.ParseFloat(input[1], 64)
		for i := 0; i < len(m500); i++ {
			if t500 < m500[i] && t1000 < m1000[i] {
				fmt.Println(classes[i])
				break
			}
		}
	}
}

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

C++: #include <iostream>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)

int main() {
	double t1[] = {35.5, 37.5, 40, 43, 50, 55, 70};
	double t2[] = {71, 77, 83, 89, 105, 116, 148};
	string s[] = {"AAA", "AA", "A", "B", "C", "D", "E"};
	double a, b;
	while(cin >> a >> b) {
		bool f = 1;
		rep(i,7) {
			if(t1[i] > a && t2[i] > b) {
				cout << s[i] << endl;
				f = 0;
				break;
			}
		}
		if(f) cout << "NA" << endl;
	}
	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main()
{
	double fh, om;
	while (scanf("%lf %lf", &fh, &om)) {
		if (fh < 35.5 && om < 71.0) {
			puts("AAA");
		}
		else if (fh < 37.5 && om < 77.0) {
			puts("AA");
		}
		else if (fh < 40.0 && om < 83.0) {
			puts("A");
		}
		else if (fh < 43.0 && om < 89.0) {
			puts("B");
		}
		else if (fh < 50.0 && om < 105.0) {
			puts("C");
		}
		else if (fh < 55.0 && om < 116.0) {
			puts("D");
		}
		else if (fh < 70.0 && om < 148.0) {
			puts("E");
		}
		else {
			puts("NA");
		}
	}
	return 0;
}