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(void)
{
	float a,s;
	scanf("%f %f",&a,&s);
	if(a<35.50&&s<71.00){
		printf("AAA\n");
	}
	else if(a<37.50&&s<77.00){
		printf("AA\n");
	}
	else if(a<40.00&&s<83.00){
		printf("A\n");
	}
	else if(a<43.00&&s<89.00){
		printf("B\n");
	}
	else if(a<50.00&&s<105.00){
		printf("C\n");
	}
	else if(a<55.00&&s<116.00){
		printf("D\n");
	}
	else if(a<70.00&&s<148.00){
		printf("E\n");
	}
	else{
		printf("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(double a, double b) {
  return a*60+b;
}

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<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    float t1,t2;
    while(cin>>t1>>t2){
        if(t1<35.50&&t2<71.00)cout<<"AAA"<<endl;
        else if(t1<37.50&&t2<77.00)cout<<"AA"<<endl;
        else if(t1<40.00&&t2<83.00)cout<<"A"<<endl;
        else if(t1<43.00&&t2<89.00)cout<<"B"<<endl;
        else if(t1<50.00&&t2<105.00)cout<<"C"<<endl;
        else if(t1<55.00&&t2<116.00)cout<<"D"<<endl;
        else if(t1<70.00&&t2<148.00)cout<<"E"<<endl;
        else cout<<"NA"<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include<iomanip>
#include<algorithm>
#define shosu(x) fixed<<setprecision(x)
using namespace std;

double x,y;

int main(){
	while(cin>>x>>y){
		if(x<35&&y<71) cout<<"AAA"<<endl;
		else{
			if(x<37&&y<77) cout<<"AA"<<endl;
			else{
				if(x<40&&y<83) cout<<"A"<<endl;
				else{
					if(x<43&&y<89) cout<<"B"<<endl;
					else{
						if(x<50&&y<105) cout<<"C"<<endl;
						else{
							if(x<55&&y<116) cout<<"D"<<endl;
							else{
								if(x<70&&y<148) cout<<"E"<<endl;
								else cout<<"NA"<<endl;
							}
						}
					}
				}
			}
		}
	}
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main () {
	double t1,t2;
	
	while(scanf("%lf %lf",&t1,&t2)!=EOF){
		if(t1<35.50&&t2<71.0)
		printf("AAA\n");
		else if(t1<37.50&&t2<77.0)
		printf("AA\n");
		else if(t1<40.0&&t2<83.0)
		printf("A\n");
		else if(t1<43.0&&t2<89.0)
		printf("B\n");
		else if(t1<50.0&&t2<105.0)
		printf("C\n");
		else if(t1<55.0&&t2<116.0)
		printf("D\n");
		else if(t1<70.0&&t2<148.0)
		printf("E\n");
		else
		printf("NA\n");
	}
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int	i,j,flg;
	double m5,m10;
	double m5t[7]={35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	double m10t[7]={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>
using namespace std;

int main() {
    double t1, t2;
    while (cin >> t1 >> t2) {
        string output;
        if (t1 < 35.5 && t2 < 71) {
            output = "AAA";
        } else if (t1 < 37.5 && t2 < 77) {
            output = "AA";
        } else if (t1 < 40 && t2 < 83) {
            output = "A";
        } else if (t1 < 43 && t2 < 89) {
            output = "B";
        } else if (t1 < 50 && t2 < 105) {
            output = "C";
        } else if (t1 < 55 && t2 < 116) {
            output = "D";
        } else if (t1 < 70 && t2 < 148) {
            output = "E";
        } else {
            output = "NA";
        }
        cout << output << endl;
    }
}

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

}