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 <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

int calc500(double record){
	if(record < 35.50){
		return 7;
	}else if(record < 37.50){
		return 6;
	}else if(record < 40.0){
		return 5;
	}else if(record < 43.0){
		return 4;
	}else if(record < 50.0){
		return 3;
	}else if(record < 55.0){
		return 2;
	}else if(record < 70.0){
		return 1;
	}else{
		return 0;
	}
}

int calc1000(double record){
	if(record < 71.0){
		return 7;
	}else if(record < 77.0){
		return 6;
	}else if(record < 83.0){
		return 5;
	}else if(record < 89.0){
		return 4;
	}else if(record < 105.0){
		return 3;
	}else if(record < 116.0){
		return 2;
	}else if(record < 148.0){
		return 1;
	}else{
		return 0;
	}
}

int main(){

	double t_500,t_1000;
	int rank500,rank1000,rank;

	while(scanf("%lf %lf",&t_500,&t_1000)!=EOF){
		rank500 = calc500(t_500);
		rank1000 = calc1000(t_1000);
		rank = min(rank500,rank1000);

		switch(rank){
		case 7:
			printf("AAA\n");
			break;
		case 6:
			printf("AA\n");
			break;
		case 5:
			printf("A\n");
			break;
		case 4:
			printf("B\n");
			break;
		case 3:
			printf("C\n");
			break;
		case 2:
			printf("D\n");
			break;
		case 1:
			printf("E\n");
			break;
		case 0:
			printf("NA\n");
			break;
		}
	}

    return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	scanf("%f %f",&a,&b);
	if(a<35.5 && b<71.0)
		printf("AAA\n");
	else if(a<37.50 && b<77.00)
		printf("AA\n");
	else if(a<40.00 && b<83.00)
		printf("A\n");
	else if(a<43.00 && b<89.00)
		printf("B\n");
	else if(a<50.00 && b<105.00)
		printf("C\n");
	else if(a<55.00 && b<116.00)
		printf("D\n");
	else if(a<70.00 && b<148.00)
		printf("E\n");
	else
		printf("NA\n");
	return 0;
}

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

double h[] = {35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0};
double f[] = {71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0};
string s[] = {"AAA", "AA", "A", "B", "C", "D", "E"};

int main()
{
  double a, b;
  while(cin >> a >> b)
  {
    for(int i = 0; i < 7; i++)
    {
      if(a < h[i] && b < f[i])
      {
        cout << s[i] << endl;
        goto next;
      }
    }
    cout << "NA\n";
  next:;
  }
}

C++: #include <iostream>
#include <string>

using namespace std;
string result[8] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};

void solve()
{
	double time1, time2;
	while(cin >> time1 >> time2)
	{
		int result1 = 0;
		int result2 = 0;
		if(time1 < 35.5)
		{
			result1 = 0;
		}
		else if(time1 < 37.5)
		{
			result1 = 1;
		}
		else if(time1 < 40.0)
		{
			result1 = 2;
		}
		else if(time1 < 43.0)
		{
			result1 = 3;
		}
		else if(time1 < 50.0)
		{
			result1 = 4;
		}
		else if(time1 < 55.0)
		{
			result1 = 5;
		}
		else if(time1 < 70.0)
		{
			result1 = 6;
		}
		else if(time1 >= 70.0)
		{
			result1 = 7;
		}

		if(time2 < 71.0)
		{
			result2 = 0;
		}
		else if(time2 < 77.0)
		{
			result2 = 1;
		}
		else if(time2 < 83.0)
		{
			result2 = 2;
		}
		else if(time2 < 89.0)
		{
			result2 = 3;
		}
		else if(time2 < 105.0)
		{
			result2 = 4;
		}
		else if(time2 < 116.0)
		{
			result2 = 5;
		}
		else if(time2 < 148.0)
		{
			result2 = 6;
		}
		else if(time2 >= 148.0)
		{
			result2 = 7;
		}
		if(result1 >= result2)
		{
			cout << result[result1] << endl;
		}
		else
		{
			cout << result[result2] << endl;
		}
	}
}

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

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    double a, b;
    while (cin >> a >> b) {
        if (a < 35.50 && b < 71.00) cout << "AAA" << endl;
        else if (a < 37.50 && b < 77.00) cout << "AA" << endl;
        else if (a < 40.00 && b < 83.00) cout << "A" << endl;
        else if (a < 43.00 && b < 89.00) cout << "B" << endl;
        else if (a < 53.00 && b < 105.00) cout << "C" << endl;
        else if (a < 55.00 && b < 116.00) cout << "D" << endl;
        else if (a < 60.00 && b < 148.00) cout << "D" << endl;
        else cout << "NA" << endl;
    }

    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout<<fixed<<setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	double t1, t2;
	while (cin >> t1 >> t2) {
		cout << (
			t1 < 35.50 && t2 < 71.00 ? "AAA" :
			t1 < 37.50 && t2 < 77.00 ? "AA" :
			t1 < 40.00 && t2 < 83.00 ? "A" :
			t1 < 43.00 && t2 < 89.00 ? "B" :
			t1 < 50.00 && t2 < 105.00 ? "C" :
			t1 < 55.00 && t2 < 116.00 ? "D" :
			t1 < 70.00 && t2 < 148.00 ? "E" : "NA"
			) << endl;
	}
}

C++: #include<iostream>
using namespace std;
int main() {
	double a, b;
	int ans[111], an,aa,bb;
	an = 0;
	while (cin >> a >> b) {
		an = an + 1;
		if (a <35.5 ) {
			aa = 1;
			goto h;
		}
		if (a < 37.5) {
			aa = 2;
			goto h;
		}
		if (a < 40) {
			aa = 3;
			goto h;
		}
		if (a < 43) {
			aa = 4;
			goto h;
		}
		if (a < 50) {
			aa = 5;
			goto h;
		}
		if (a < 55) {
			aa =6 ;
			goto h;
		}
		if (a <70 ) {
			aa = 7;
			goto h;
		}
		aa = 8;
	h:;
		if (b < 71) {
			bb= 1;
			goto m;
		}
		if (b < 77) {
			bb = 2;
			goto m;
		}
		if (b < 83) {
			bb = 3;
			goto m;
		}
		if (b < 89) {
			bb =4 ;
			goto m;
		}
		if (b < 105) {
			bb = 5;
			goto m;
		}
		if (b < 116) {
			bb = 6;
			goto m;
		}
		if (b < 148) {
			bb = 7;
			goto m;
		}
		bb = 8;
	m:;
		if (aa < bb) {
			ans[an] = bb;
		}
		else {
			ans[an] = aa;
		}
	}
	for (int i = 1; i <= an; i++) {
		if (ans[i] == 1) {
			cout << "AAA"<< endl;
		}
		if (ans[i] == 2) {
			cout<<"AA" <<endl;
		}
		if (ans[i] == 3) {
			cout<<"A" <<endl;
		}
		if (ans[i] == 4) {
			cout<< "B"<<endl;
		}
		if (ans[i] == 5) {
			cout<< "C"<<endl;
		}
		if (ans[i] == 6) {
			cout<<"D"<<endl;
		}
		if (ans[i] == 7) {
			cout << "E" << endl;
		}
		if (ans[i] == 8) {
			cout << "NA" << endl;
		}




	}

}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb(in,tmp) in.push_back(tmp)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  double a,b;
  double h[2][8]={
    {70,55,50,43,40,37,35,-1},
    {148,116,105,89,83,77,71,-1}
  };
  string s[8]={"NA",'E','D','C','B','A',"AA","AAA"};
  while(cin>>a>>b){
    int i;
    rep(i,8)if(a>=h[0][i]||b>=h[1][i])break;
      cout<<s[i]<<endl;
  }
}