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>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

using namespace std;



template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};

int hoge1(double a)
{
	if (35.50 > a)return 7;
	if (37.50 > a)return 6;
	if (40.00 > a)return 5;
	if (43.00 > a)return 4;
	if (50.00 > a)return 3;
	if (55.00 > a)return 2;
	if (70.00 > a)return 1;
	return 0;
}

int hoge2(double a)
{
	if (71.00 > a)return 7;
	if (77.00 > a)return 6;
	if (83.00 > a)return 5;
	if (89.00 > a)return 4;
	if (105.00 > a)return 3;
	if (116.00 > a)return 2;
	if (148.00 > a)return 1;
	return 0;
}

int main()
{
	double a, b;
	string ans[8] = {"NA", "E", "D", "C", "B", "A", "AA", "AAA"};
	while (cin >> a >> b)
	{
		cout << ans[min(hoge1(a), hoge2(b))] << endl;
	}
}

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

double shortRegTime[] = {
	35.0, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, DBL_MAX,
};
double longRegTime[] = {
	71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, DBL_MAX,
};

char* rank[] = {
	"AAA", "AA", "A", "B", "C", "D", "E", "NA",
};

int main()
{
	double time1, time2;
	while( cin >> time1 >> time2 ){
		for( int i = 0; i < 8; ++i ){
			if( time1 < shortRegTime[ i ] && time2 < longRegTime[ i ] ){
				cout << rank[ i ] << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	while(true){
		float m500,m1000;
		cin >> m500 >> m1000;
		if(m500 < 35.5 && m1000 < 71){
			cout << "AAA" << endl;
		}
		else if(m500 < 37.5 && m1000 < 77){
			cout << "AA" << endl;
		}
		else if(m500 < 40 && m1000 < 83){
			cout << "A" << endl;
		}
		else if(m500 < 43 && m1000 < 89){
			cout << "B" << endl;
		}
		else if(m500 < 50 && m1000 < 105){
			cout << "C" << endl;
		}
		else if(m500 < 55 && m1000 < 116){
			cout << "D" << endl;
		}
		else if(m500 < 70 && m1000 < 148){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    double t1, t2;
    int r1, r2;
    string rank[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };
    while (cin >> t1 >> t2) {
        if (t1 <= 360.0) {
            r1 = 7;
        }
        if (t1 < 70.0) {
            r1 = 6;
        }
        if (t1 < 55.0) {
            r1 = 5;
        }
        if (t1 < 50.0) {
            r1 = 4;
        }
        if (t1 < 43.0) {
            r1 = 3;
        }
        if (t1 < 40.0) {
            r1 = 2;
        }
        if (t1 < 37.50) {
            r1 = 1;
        }
        if (t1 < 35.50) {
            r1 = 0;
        }
        
        if (t2 <= 360.0) {
            r2 = 7;
        }
        if (t2 < 148.0) {
            r2 = 6;
        }
        if (t2 < 116.0) {
            r2 = 5;
        }
        if (t2 < 105.0) {
            r2 = 4;
        }
        if (t2 < 89.0) {
            r2 = 3;
        }
        if (t2 < 83.0) {
            r2 = 2;
        }
        if (t2 < 77.0) {
            r2 = 1;
        }
        if (t2 < 71.0) {
            r2 = 0;
        }
        cout << rank[max(r1, r2)] << endl;
    }

    return 0;
}

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
double a,b;
while(cin >> a >> b){
string ans="NA";
if(a<70.0&&b<148.0)ans="E";
if(a<55.0&&b<116.0)ans="D";
if(a<50.0&&b<105.0)ans="C";
if(a<43.0&&b<89.0)ans="B";
if(a<40.0&&b<83.0)ans="A";
if(a<37.5&&b<77.0)ans="AA";
if(a<35.5&&b<71.0)ans="AAA";
cout << ans << "\n";
}
return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
 
int cnt_500(double f)
{
    if (f < 35.5) return 1;
    else if (f < 37.5) return 2;
    else if (f < 40) return 3;
    else if (f < 43) return 4;
    else if (f < 50) return 5;
    else if (f < 55) return 6;
    else if (f < 70) return 7; 
    return 8;
}
 
int cnt_1000(double t)
{
    if (t < 71) return 1;
    else if (t < 77) return 2;
    else if (t < 83) return 3;
    else if (t < 89) return 4;
    else if (t < 105) return 5;
    else if (t < 116) return 6;
    else if (t < 148) return 7;  
    return 8;
}
 
int main()
{
    double f, t;
    while (cin >> f >> t) {
        int grade = max(cnt_500(f), cnt_1000(t));
        switch (grade) { 
            case 1:
                cout << "AAA" << endl;
                break;
            case 2:
                cout << "AA" << endl;
                break;
            case 3:
                cout << 'A' << endl;
                break;
            case 4:
                cout << 'B' << endl;
                break;
            case 5:
                cout << 'C' << endl;
                break;
            case 6:
                cout << 'D' << endl;
                break;
            case 7:
                cout << 'E' << endl;
                break;
            case 8:
                cout << "NA" << endl;
                break;
        } 
    }
    return 0;
}