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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

const float m500[] = {
  35.5f, 37.5f, 40.0f, 43.0f, 50.0f, 55.0f, 70.0f, (float)(1<<30)
};
const float m1k[] = {
  71.0f, 77.0f, 83.0f, 89.0f, 105.f, 116.f, 148.0f, (float)(1<<30)
};
const string rank[] = {
  "AAA", "AA", "A", "B", "C", "D", "E", "NA"
};

int main() {
  const int sz = 8;
  float l, r;
  while (cin >> l >> r) {
    int ll = upper_bound(m500, m500 + sz, l) - m500;
    int rl = upper_bound(m1k, m1k + sz, l) - m1k;
    cout << rank[max(rl,ll)] << endl;
    //cout << ll << "," << rl << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

double chk500[8]={
  35.5, 37.5, 40, 43, 50, 55, 70, 1e10
};
double chk1000[8]={
  71, 77, 83, 89, 105, 116, 148, 1e10
};
const char *rank[8]={
  "AAA","AA","A","B","C","D","E","NA"
};

int main(){
  double a,b;
  while(~scanf("%lf%lf",&a,&b)){
    REP(i,8){
      if(a < chk500[i] && b < chk1000[i]){
        puts(rank[i]);
        break;
      }
    }
  }
  return 0;
}

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

int main()
{

	double time5, time10;

	cin >> time5 >> time10;

	if( time5 < 35.5 && time10 < 71.0 ) cout << "AAA";
	else if( time5 < 37.5 && time10 < 67.0 ) cout << "AA";
	else if( time5 < 40.0 && time10 < 83.0 ) cout << "A";
	else if( time5 < 43.0 && time10 < 89.0 ) cout << "B";
	else if( time5 < 50.0 && time10 < 105.0 ) cout << "C";
	else if( time5 < 55.0 && time10 < 116.0 ) cout << "D";
	else if( time5 < 70.0 && time10 < 148.0 ) cout << "E";
	else cout << "NA";

	cout << endl;

	return 0;

}

C++: #include<iostream>
using namespace std;
int main(void){
  double f,t;
  while(cin >> f >> t){
    if(f < 35.5 && t < 71.0) cout << "AAA" << endl;
    else if(f < 37.5 && t < 77.0) cout << "AA" << endl;
    else if(f < 40.0 && t < 83.0) cout << "A" << endl;
    else if(f < 43.0 && t < 89.0) cout << "B" << endl;
    else if(f < 50.0 && t < 105.0) cout << "C" << endl;
    else if(f < 55.0 && t < 116.0) cout << "D" << endl;
    else if(f < 70.0 && t < 148.0) cout << "E" << endl;
    else cout << "NA" << endl;
  }
}

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

int main(){

  double a,b;

  while(scanf("%lf",&a) != EOF){
    
    scanf("%lf",&b);

    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++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;

string grade[8] = { "NA", "E", "D", "C", "B", "A", "AA", "AAA" };
double t500[8] = { 70, 55, 50, 43, 40, 37.5, 35.5, 0 };
double t1000[8] = { 148, 116, 105, 89, 83, 77, 71, 0 };

bool AOJ0123()
{
	double t1, t2;
	if (!(cin >> t1 >> t2)) return false;
	
	REP(i, 8) {
		if (t1 >= t500[i] || t2 >= t1000[i]) {
			cout << grade[i] << endl;
			return true;
		}
	}

	return true;
}

int main()
{

	while (AOJ0123()) {

	}

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
	double a,b;
	

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

	while(~scanf("%lf %lf",&a,&b)){
		int c=7,d=7;
		for(int i=0;i<sizeof(table1)/sizeof(double);i++){
			if(a < table1[i]) { c = i; break; }
		}

		for(int i=0;i<sizeof(table2)/sizeof(double);i++){
			if(b < table2[i]) { d = i; break; }
		}

		cout << rank[max(c,d)] << endl;

	}
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    double t5,t10;
	string ans;
	while(cin){
		cin>>t5>>t10;
		if(t5<35.50&&t10<71.00){
			ans="AAA";
		}else if(t5<37.50&&t10<67.00){
			ans="AA";
		}else if(t5<40.00&&t10<83.00){
			ans="A";
		}else if(t5<43.00&&t10<89.00){
			ans="B";
		}else if(t5<50.00&&t10<105.00){
			ans="C";
		}else if(t5<55.00&&t10<116.00){
			ans="D";
		}else if(t5<70.00&&t10<148.00){
			ans="E";
		}else{
			ans="NA";
		}
		cout<<ans<<endl;
	}
    return 0;
}

C++: #include <cstdio>

int main(){
	double a,b;
	while(scanf("%lf%lf", &a, &b) != EOF){
		if(a < 35.50 && b < 71.00) 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");
	}
}

C++: #include <iostream>
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 < 50.00 && b < 105.00)
			cout << "C" << endl;
		else if(a < 55.00 && b < 116.00)
			cout << "D" << endl;
		else if(a < 70.00 && b < 148.00)
			cout << "E" << endl;
		else
			cout << "NA" << endl;
	}

	return 0;
}