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 <algorithm>
//v7KÉª¯çêé
const int RANKC = 7,NA = 7;
double R_500[RANKC] = {35.5,37.5,40,43,50,55,70},
  R_1000[RANKC] = {71,77,83,89,105,116,148};

//tÍÔBmÍ0©1(»ê¼ê500,1000m)
int rcheck(double t,int m){
  double *rlist;
  (m)?rlist=R_1000:rlist=R_500;
  for(int i=0;i<RANKC;i++){
    if(t<*(rlist+i))return i;
  }
  return NA;
}

std::string res[] = {"AAA","AA","A","B","C","D","E","NA"};
int main(){
  double t_500,t_1000;
  while(std::cin>>t_500>>t_1000){
    if(std::cin.eof())break;
    //êÔá¢NðèÉüêéB
    int rank = std::max(rcheck(t_500,0),rcheck(t_1000,1));
    std::cout<<res[rank]<<std::endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
	double t,ti;

	cin >> t >> ti;

	if(t < 35.50 && ti < 71.00)
	{
		cout << "AAA" << endl;
	}
	else if(t < 37.50 && ti < 77.00)
	{
		cout << "AA" << endl;
	}
	else if(t < 40.00 && ti < 83.00)
	{
		cout << "A" << endl;
	}
	else if(t < 43.00 && ti < 89.00)
	{
		cout << "B" << endl;
	}
	else if(t < 50.00 && ti < 105.00)
	{
		cout << "C" << endl;
	}
	else if(t < 55.00 && ti < 116.00)
	{
		cout << "D" << endl;
	}
	else if(t < 70 && ti < 148.00)
	{
		cout << "E" << endl;
	}

	else
		cout << "NA" << endl;

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

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

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][7]={
    {70,55,50,43,40,37,35},
    {148,116,105,89,83,77,71}
  };
  string s[7]={"E","D","C","B","A","AA","AAA"};
  while(cin>>a>>b){
    int i;
    loop(i,6,-1)if(a<h[0][i]&&b<h[1][i])break;
    if(i+1)cout<<s[i]<<endl;
    else cout<<"NA"<<endl;
  }
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


int f[8]={36,38,40,43,50,55,70,IMAX};
int t[8]={71,77,83,89,105,116,148,IMAX};
string s[8]={"AAA","AA","A","B","C","D","E","NA"};




int main(){
	double d,e;
	while(cin>>d>>e){
		rep(i,8){
			if(d<f[i]&&e<t[i]){
				cout<<s[i]<<endl;
				break;
			}
		}
	}
}

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

int main(){
  double s,l;
  int sc,lc,g;

  while(cin >> s >> l){
    if(s<35.5)sc = 0;
    else if(s<37.5)sc = 1;
    else if(s<40.0)sc = 2;
    else if(s<43.0)sc = 3;
    else if(s<50.0)sc = 4;
    else if(s<55.0)sc = 5;
    else if(s<70.0)sc = 6;
    else sc = 7;

    if(l<71.0)lc = 0;
    else if(l<77.0)lc = 1;
    else if(l<83.0)lc = 2;
    else if(l<89.0)lc = 3;
    else if(l<105.0)lc = 4;
    else if(l<116.0)lc = 5;
    else if(l<148.0)lc = 6;
    else lc = 7;

    if(lc<sc)g=sc;
    else g=lc;

    if(g == 0)cout << "AAA" << endl;
    else if(g == 1)cout << "AA" << endl;
    else if(g == 2)cout << "A" << endl;
    else if(g == 3)cout << "B" << endl;
    else if(g == 4)cout << "C" << endl;
    else if(g == 5)cout << "D" << endl;
    else if(g == 6)cout << "E" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<cmath>
#include<set>
#include<stack>

using namespace std;

int main()
{
    float a[7]={35.50,37.50,40,43,50,55,70};
    float b[7]={71,77,83,89,105,116,148};
    string c[7]={"AAA","AA","A","B","C","D","E"};
    float x,y;
    while(cin>>x>>y) {
        for(int i=0;i<7;i++){
            if(a[i]<=x)continue;
            for(int j=0;j<7;j++){
                if(b[j]>y){
                    cout<<c[max(i,j)]<<endl;
                    goto ne;
                }
            }
        }
        cout<<"NA"<<endl;
    ne:;
    }
//    freopen("/Users/shitian/Desktop/gcj/gcj/B-large-practice.in", "r", stdin);
//    freopen("/Users/shitian/Desktop/gcj/gcj/out.txt", "w", stdout);
//    int tcase;
//    cin>>tcase;
//    for(int tca=1;tca<=tcase;tca++){
//        cout<<"Case #"<<tca<<": ";
//
//    }
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define REP(i,a,n) for(ll i=n;i>a;i--)
int main(void){
    double t_1,t_2;
    ll num1,num2;
    double judge_500[7]={35.50,37.50,40.00,43.00,50.00,55.00,70.00};
    double judge_1000[7]={71.00,77.00,83.00,89.00,105.00,116.00,148.00};
    string rank[8]={"AAA","AA","A","B","C","D","E","NA"};
    rep(j,0,100){
        t_1 = -1;
        t_2 = -1;
        num1=-1;
        num2=-1;
        cin>>t_1>>t_2;
        rep(i,0,7){
            if(t_1<judge_500[i]){
                num1=i;
                break;
            }
        }
        rep(i,0,7){
            if(t_2<judge_1000[i]){
                num2=i;
                break;
            }
        }
        if(num1==-1)num1=7;
        if(num2==-1)num2=7;
        
        if(t_1 == -1 && t_2 == -1) break;
        cout<<rank[max(num1,num2)]<<endl;
        
    }
    
}