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>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	double t1,t2;
	while (cin>>t1>>t2) {
		if (t1 < 35.50 && t2 < 71.00) {
			cout << "AAA" << endl;
		}
		else if (t1 < 37.50 && t2 < 77.00) {
			cout << "AA" << endl;
		}
		else if (t1 < 40.00 && t2 < 83.00) {
			cout << "A" << endl;
		}
		else if (t1 < 43.00 && t2 < 89.00) {
			cout << "B" << endl;
		}
		else if (t1 < 50.00 && t2 < 105.00) {
			cout << "C" << endl;
		}
		else if (t1 < 55.00 && t2 < 116.00) {
			cout << "D" << endl;
		}
		else if (t1 < 70.00 && t2 < 148.00) {
			cout << "E" << endl;
		}
		else  {
			cout << "NA" << endl;
		}
	}

return 0;
}

C++: #include <cstdio>

double a,b;

int main(){
	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 < 70 && b < 148){
			printf("E\n");
		}
		else{
			printf("NA\n");
		}
	}
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	double 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(void)
{
	float a,b;
	while(scanf("%f %f",&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<110.0 && b<148.0){
			printf("E\n");
			}
	else{
			printf("NA\n");
			}
			}
		return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

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

int main(){
	while (cin >> a >> b){
		for (int i = 0; i < 7; i++){
			if (a < table[0][i] && b < table[1][i]){
				cout << s[i] << endl;
				break;
			}
			if (i == 6)cout << "NA\n";
		}
	}
}

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

int main(){
  int i,j;
  double n500,n1000;
  while(cin >> n500 >> n1000){
    if(n500 < 35.50 && n1000 < 60*1+11.0) cout << "AAA" << endl;
    else if(n500 < 37.50 && n1000 < 60*1+17.0) cout << "AA" << endl;
    else if(n500 < 40.0 && n1000 < 60*1+23.0) cout << "A" << endl;
    else if(n500 < 43.0 && n1000 < 60*1+23.0) cout << "B" << endl;
    else if(n500 < 50.0 && n1000 < 60*1+29.0) cout << "C" << endl;
    else if(n500 < 55.0 && n1000 < 60*1+56.0) cout << "D" << endl;
    else if(n500 < 70.0 && n1000 < 60*2+28.0) cout << "E" << endl;
    else  cout << "NA" << endl;

  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	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<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;

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])break;
		}
		for(rr = 0;rr<7;rr++){
			if(n<time1000[r])break;
		}

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


	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a,b;
  while(cin>>a>>b){
    if(35.5>a && 60+11>b){
      cout<<"AAA"<<endl;
    }else if(37.5>a && 60+17>b){
      cout<<"AA"<<endl;
    }else if(40>a && 60+23>b){
      cout<<"A"<<endl;
    }else if(43>a && 60+29>b){
      cout<<"B"<<endl;
    }else if(50>a && 60+45>b){
      cout<<"C"<<endl;
    }else if(55>a && 60+56>b){
      cout<<"D"<<endl;
    }else if(70>a && 120+28>b){
      cout<<"E"<<endl;
    }else{
      cout<<"NA"<<endl;
    }
  }
}

C++: #include<stdio.h>
int main()
{
    float hideo, ruio;
    scanf("%f %f", &hideo, &ruio);
    if (hideo < 35.5 && ruio < 71.0) {
        printf("AAA\n");
    }
    else if (hideo < 37.50 && ruio < 77.0) {
        printf("AA\n");
    }
    else if (hideo < 40.0 && ruio < 83.0) {
        printf("A\n");
    }
    else if (hideo < 43.00 && ruio < 89.0) {
        printf("B\n");
    }
    else if (hideo < 50.0 && ruio < 105.0) {
        printf("C\n");
    }
    else if (hideo < 55.0 && ruio < 116.0) {
        printf("D\n");
    }
    else if (hideo < 70.0 && ruio < 148.0) {
        printf("E\n");
    }
    else {
        printf("NA\n");
    }
    return 0;
}