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(main)
{
	int a,b;
	while(scanf("%d %d",&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");
		}
	}
	return 0;
}

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

int main()
{
    double x, y;
    while (scanf("%lf %lf", &x, &y) != EOF) {
        if (x < 35.50 && y < 71) printf("AAA\n");
        else if (x < 37.50 && y < 77) printf("AA\n");
        else if (x < 40 && y < 83) printf("A\n");
        else if (x < 43 && y < 89) printf("B\n");
        else if (x < 50 && y < 105) printf("C\n");
        else if (x < 55 && y < 116) printf("D\n");
        else if (x < 70 && y < 148) printf("E\n");
        else printf("NA\n");
    }
    return 0;
}

C++: #include <cstdio>

int main()
{
  double t5, t10;
  while (~scanf("%lf %lf", &t5, &t10)) {
    if (t5 < 35.50 && t10 < 71.00)
      puts("AAA");
    else if (t5 < 37.50 && t10 < 77.00)
      puts("AA");
    else if (t5 < 40.00 && t10 < 83.00)
      puts("A");
    else if (t5 < 43.00 && t10 < 89.00)
      puts("B");
    else if (t5 < 50.00 && t10 < 105.00)
      puts("C");
    else if (t5 < 55.00 && t10 < 116.00)
      puts("D");
    else if (t5 < 70.00 && t10 < 148.00)
      puts("E");
    else
      puts("NA");
  }
  return 0;
}

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

int main(void){
	const char *classes[] = {"AAA","AA","A","B","C","D","E"};
	const double class500M[] = {35.5,37.5,40,43,50,55,70};
	const double class1000M[] = {71,77,83,89,105,116,148};

	while( true ){
		bool bNA = true;
		double c500, c1000;
		
		cin >> c500 >> c1000;
		
		if(cin.eof()) break;

		for(int i = 0; i < sizeof(class500M)/sizeof(*class500M); ++i){
			if( c500 < class500M[i] && c1000 < class1000M[i] ){
				cout << classes[i] << '\n';
				bNA = false;
				break;
			}
		}
		if( bNA )
			cout << "NA\n";
	}
	return 0;
}

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

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

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

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};

//////////////////////////////////////////////////////////////

double c(int a, int b, int c = 0) {
  return a*60+b+c/60.0;
}

int main() {
  
  double a, b;
  while(cin >> a >> b) {
    string res = "NA";
    if(a < c(1,10) && b < c(2,28)) res = "E";
    if(a < c(0,55) && b < c(1,56)) res = "D";
    if(a < c(0,50) && b < c(1,45)) res = "C";
    if(a < c(0,43) && b < c(1,29)) res = "B";
    if(a < c(0,40) && b < c(1,23)) res = "A";
    if(a < c(0,37) && b < c(1,17)) res = "AA";
    if(a < c(0,35,50) && b < c(1,11)) res = "AAA";
    cout << res << endl;
  }
  
  return 0;
}

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

int main() {
	char c[7][4]={"AAA","AA","A","B","C","D","E"};
	double n1,n2,t1[7]={35.5,37.5,40,43,50,55,70},t2[7]={71,77,83,89,105,116,148};
	int i;
	while(cin >> n1 >> n2) {
		for (i=0;i<7;i++) if (n1<t1[i] && n2<t2[i]) break;
		if (i==7) cout << "NA" << endl; else cout << c[i] << endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(main)
{
	int a,b;
	while(scanf("%d %d",&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<vector>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
int main(){
    string G[8]={
        "AAA",
        "AA",
        "A",
        "B",
        "C",
        "D",
        "E",
        "NA",
    };
    double a,b;
    while(cin>>a>>b){
        int p=(int)(a*1000),q=(int)(b*1000);
        int gp,gq;
        if(p<35500)gp=0;
        else if(p<37500)gp=1;
        else if(p<40000)gp=2;
        else if(p<43000)gp=3;
        else if(p<50000)gp=4;
        else if(p<55000)gp=5;
        else if(p<70000)gp=6;
        else gp=7;

        if(q<71000)gq=0;
        else if(q<77000)gq=1;
        else if(q<83000)gq=2;
        else if(q<89000)gq=3;
        else if(q<105000)gq=4;
        else if(q<116000)gq=5;
        else if(q<148000)gq=6;
        else gq=7;
        int g=max(gp,gq);
        cout<<G[g]<<endl;
    }

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double t1,t2;
  double gm[7],sm[7];
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  gm[0]=35.5;gm[1]=37.5;gm[2]=40.0;gm[3]=43.0;gm[4]=50.0;gm[5]=55.0;gm[6]=70.0;
  sm[0]=71.0;sm[1]=77.0;sm[2]=83.0;sm[3]=89.0;sm[4]=105.0;sm[5]=116.0;sm[6]=148.0;
  while(cin>>t1>>t2){
    int i;
    for(i=0;i<7;i++){
      if(gm[i]>t1&&sm[i]>t2)
	break;
    }
    cout<<ans[i]<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  double a, b;
  double A[]={35.50,37.50,40.00,43.00,50.00,55.00,70.00};
  double B[]={71,77,83,89,105,116,148};
  string C[]={"AAA","AA","A","B","C","D","E","NA"};
  while(cin >> a >> b) {
    int i;
    for(i=0; i<7; i++) {
      if(a<A[i] && b<B[i]) { break; }
    }
    cout << C[i] << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<set>
#include<queue>

using namespace std;

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

const double EPS = 1e-9;
int main(){

	string rank[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double time500[8] = {35.50,37.50,40.00,43.00,50.00,55.00,70.00,0};
	double time1000[8] = {71.00,77.00,83.00,89.00,105.00,116.00,148.00,0};

	double n,m;
	while(cin>>n>>m){
		
		int r,rr;
		for(r=0;r<7;r++){
			if(n-time500[r] < -EPS)break;
		}
		for(rr = 0;rr<7;rr++){
			if(m-time1000[rr] < -EPS)break;
		}

		cout<<rank[max(r,rr)]<<endl;

	}

	return 0;
}