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>
int main()
{
	double t1,t2;
	while(scanf("%lf%lf",&t1,&t2)>0)
	{
		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");
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	double a,b;

		while(scanf("%lf %lf",&a,&b)!=EOF) {
			if(35.50>a && 71.00>b){
				printf("AAA\n");
			}
			else if (37.50>a && 77.00>b){
				printf("AA\n");
			}
			else if (40.00>a && 83.00>b){
				printf("A\n");
			}
			else if (43.00>a && 89.00>b){
				printf("B\n");
			}
			else if(50.00>a && 95.00>b){
				printf("C\n");
			}
			else if(55.00>a && 116.00>b){
				printf("D\n");
			}
			else if(70.00>a && 148.00>b){
				printf("E\n");
			}
			else{
				printf("NA\n");
			}
		}
		return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	scanf("%d %b",&a,&b);
	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<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%d %b",&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<stdio.h>
int main(void)
{
	float a,b;
	while(scanf("%f %f",&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<string>
using namespace std;

int main(){

  double n,m;

  while(cin >> n >> m){

    bool d = false;
    string c = "";

    if(n < 70 && m < 148) c = "E", d = true;
    if(n < 55 && m < 60+56) c = "D", d = true;
    if(n < 50 && m < 60+45) c = "C", d = true;
    if(n < 43 && m < 60+29) c = "B", d = true;
    if(n < 40 && m < 60+23) c = "A", d = true;
    if(n < 37.50 && m < 60+17) c = "AA", d = true;
    if(n < 35.50 && m < 60+11) c = "AAA", d = true;

    if(d) cout << c << endl;
    if(!d) cout << "NA" << endl;

  }

}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

long double a[]={35.5,37.5,40.0,43.0,50.0,55.0,70.0,100000000.0};
long double b[]={71.0,77.0,83.0,89.0,105.0,116.0,148.0,100000000.0};
string c[]={"AAA","AA","A","B","C","D","E","NA"};
int main(){
	long double x,y;
	while(cin>>x>>y){
		int t=0;
		rep(i,8){
			if(x<a[i]){
				t=i;
				break;
			}
		}
		rep(i,8){
			if(y<b[i]){
				t=max(t,i);
				break;
			}
		}
		cout<<c[t]<<endl;
	}
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int	i,j,flg;
	double m5,m10;
	double m5t[8]={35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	double m10t[8]={71.0,77.0,83.0,89.0,105.0,116.0,148.0};
	char ran[8][8]={"AAA","AA","A","B","C","D","E"};
	while(scanf("%lf %lf",&m5,&m10)!=EOF){
		flg=0;
		for(i=0;i<=7;i++){
			if(m5<m5t[i] && m10<m10t[i]){
				printf("%s\n",ran[i]);
				flg=1;
				break;
			}
		}
		if(flg==0) printf("NA\n");
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	string s[8]={"AAA","AA","A","B","C","D","E","NA"};
	double h[8][2]={
	  {35.0,71.0},
	  {37.0,77.0},
	  {40.0,83.0},
	  {43.0,89.0},
	  {50.0,105.0},
	  {55.0,116.0},
	  {70.0,148.0},
	  {1e9,1e9},
	};
	double a,b;
	while(cin>>a>>b){
		rep(i,8)if(h[i][0]>a&&h[i][1]>b){
			cout<<s[i]<<endl;
			break;
		}
	}
}

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

int main(void)
{
  double time1, time2;
  string result;
  while (cin >> time1 >> time2)
  {
    if (time1 < 35.50 and time2 < 71.00)
    {
      result = "AAA";
    }
    else if (time1 < 37.50 and time2 < 77.00)
    {
      result = "AA";
    }
    else if (time1 < 40.00 and time2 < 83.00)
    {
      result = "A";
    }
    else if (time1 < 43.00 and time2 < 89.00)
    {
      result = "B";
    }
    else if (time1 < 50.00 and time2 < 105.00)
    {
      result = "C";
    }
    else if (time1 < 55.00 and time2 < 116.00)
    {
      result = "D";
    }
    else if (time1 < 70.00 and time2 < 148.00)
    {
      result = "E";
    }
    else
    {
      result = "NA";
    }
    cout << result << endl;
  }
  return 0;
}