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<iostream>
using namespace std;

void out_grade(double M_500_time,double M_1000_time){
  if(M_500_time<35.50&&M_1000_time<71.0)cout<<"AAA"<<endl;
  else if(M_500_time<37.50&&M_1000_time<77.00)cout<<"AA"<<endl;
  else if(M_500_time<40.00&&M_1000_time<83.00)cout<<"A"<<endl;
  else if(M_500_time<43.00&&M_1000_time<89.00)cout<<"B"<<endl;
  else if(M_500_time<50.00&&M_1000_time<105.00)cout<<"C"<<endl;
  else if(M_500_time<55.00&&M_1000_time<116.00)cout<<"D"<<endl;
  else if(M_500_time<70.00&&M_1000_time<148.00)cout<<"E"<<endl;
  else cout<<"NA"<<endl;
}

int main(){
  double M_500_time,M_1000_time;
  while(cin>>M_500_time>>M_1000_time){
    out_grade(M_500_time,M_1000_time);
  }
}

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