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<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
#include <algorithm>
#include <strstream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;

int main(){
	float a,b;
	cin>>a>>b;

	if( a<35.5 && b<71 )puts("AAA");
	else if( a<37.5 && b<77 )puts("AA");
	else if( a<40 && b<83 )puts("A");
	else if( a<43 && b<89 )puts("B");
	else if( a<50 && b<105 )puts("C");
	else if( a<55 && b<116)puts("D");
	else if( a<70 && b<148)puts("E");
	else puts("NA");

	return 0;
}

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

int main(){
  int i,j;
  double n500,n1000;
  while(cin >> n500 >> n1000){
    if(n500 < 35.50 && n1000 < 60*1+11.0) cout << "AAA" << endl;
    else if(n500 < 37.50 && n1000 < 60*1+17.0) cout << "AA" << endl;
    else if(n500 < 40.0 && n1000 < 60*1+23.0) cout << "A" << endl;
    else if(n500 < 43.0 && n1000 < 60*1+29.0) cout << "B" << endl;
    else if(n500 < 50.0 && n1000 < 60*1+45.0) cout << "C" << endl;
    else if(n500 < 55.0 && n1000 < 60*1+56.0) cout << "D" << endl;
    else if(n500 < 70.0 && n1000 < 60*2+28.0) cout << "E" << endl;
    else  cout << "NA" << endl;

  }
  return 0;
}

C++: //Name: Speed Skating Badge Test
//Level: 1
//Category: やるだけ
//Note: 

/**
 * 問題文の通りに処理する。
 *
 * オーダーは O(R)。
 * ただしRはランクの数。
 */
#include <iostream>

using namespace std;

bool solve() {
    double A, B;
    if(!(cin >> A >> B)) return false;

    string judge = "NA";
    if(A < 35.5 && B < 71.0) judge = "AAA";
    else if(A < 37.5 && B < 77.0) judge = "AA";
    else if(A < 40.0 && B < 83.0) judge = "A";
    else if(A < 43.0 && B < 89.0) judge = "B";
    else if(A < 50.0 && B < 105.0) judge = "C";
    else if(A < 55.0 && B < 116.0) judge = "D";
    else if(A < 70.0 && B < 148.0) judge = "E";
    cout << judge << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    while(solve()) ;
    return 0;
}

C++: #include <cstdio>
char* r[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };
double a[] = { 35.5, 37.5, 40, 43, 50, 55, 70 };
double b[] = { 71, 77, 83, 89, 105, 116, 148 };
double x, y;
int main()
{
    while (scanf("%lf%lf", &x, &y) != EOF) {
        int i;
        for (i = 0; i < 7; ++i)
            if (x < a[i] && y < b[i]) { puts(r[i]); break; }
        if (i == 7) puts(r[i]);
    }
    return 0;
}

C++: #include <cstdio>

using namespace std;

int main(void) {
    double a, b;
    while (scanf("%lf %lf", &a, &b) != EOF) {
        int x, y;
        x = (int)(a * 100);
        y = (int)(b * 100);
        if (x < 3550 && y < 6100) {
            puts("AAA");
        } else if (x < 3750 && y < 7700) {
            puts("AA");
        } else if (x < 4000 && y < 8300) {
            puts("A");
        } else if (x < 4300 && y < 8900) {
            puts("B");
        } else if (x < 5000 && y < 10500) {
            puts("C");
        } else if (x < 5500 && y < 11600) {
            puts("D");
        } else if (x < 7000 && y < 14800) {
            puts("E");
        } else {
            puts("NA");
        }
    }
    return 0;
}

C++: #include <iostream>

using namespace std;
typedef pair<int, int> P;

char str[8][16] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
void solve()
{
	double a, b;
	while(cin >> a >> b)
	{
		P p;
		if(a < 35.5)
		{
			p.first = 0;
		}
		else if(a < 37.5)
		{
			p.first = 1;
		}
		else if(a < 40.0)
		{
			p.first = 2;
		}
		else if(a < 43.0)
		{
			p.first = 3;
		}
		else if(a < 50.0)
		{
			p.first = 4;
		}
		else if(a < 55.0)
		{
			p.first = 5;
		}
		else if(a < 70.0)
		{
			p.first = 6;
		}
		else
		{
			p.first = 7;
		}

		if(b < 71.0)
		{
			p.second = 0;
		}
		else if(b < 77.0)
		{
			p.second = 1;
		}
		else if(b < 83.0)
		{
			p.second = 2;
		}
		else if(b < 89.0)
		{
			p.second = 3;
		}
		else if(b < 105.0)
		{
			p.second = 4;
		}
		else if(b < 116.0)
		{
			p.second = 5;
		}
		else if(b < 148.0)
		{
			p.second = 6;
		}
		else
		{
			p.second = 7;
		}
		cout << str[max(p.first, p.second)] << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

int main(){
	double a, b;
	
	while(1){
	cin >> a >> b;
	    if(a<35.50 && b< 71.00) cout << "AAA";
        else if(a<37.50 && b< 77.00) cout << "AA";
        else if(a<40.00 && b< 83.00) cout << "A";
        else if(a<43.00 && b< 89.00) cout << "B";
        else if(a<50.00 && b<105.00) cout << "C";
        else if(a<55.00 && b<116.00) cout << "D";
        else if(a<70.00 && b<148.00) cout << "E";
        else                         cout << "NA";
        cout << endl;
	}
	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][8]={
    {70,55,50,43,40,37.5,35.5,-1},
    {148,116,105,89,83,77,71,-1}
  };
  string s[8]={"NA","E","D","C","B","A","AA","AAA"};
  while(cin>>a>>b){
    int i;
    rep(i,8)if(a>=h[0][i]||b>=h[1][i])break;
      cout<<s[i]<<endl;
  }
}

C++: #include<iostream>
using namespace std;
string str[8]={"AAA","AA","A","B","C","D","E","NA"};
double t[8]={35.5 , 37.5 , 40.0 , 43.0, 50.0, 55.0, 70.0,9999999.9999999};
double u[8]={71.0 , 77.0 , 83.0 , 89.0,105.0,116.0,148.0,9999999.9999999};
double a,b;
int main(){
  while(cin>>a>>b){
    for(int i=0;i<8;i++){
      if(a<t[i]&&b<u[i]){cout<<str[i]<<endl;break;}
    }
  }
}

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

#define rep_(v, f, l) for (int v = (f); v < (l); ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int main()
{
    double fh, om;
    while (~scanf("%lf %lf", &fh, &om)){
        if (fh < 35.5 && om < 71.0){
            puts("AAA");
        }
        else if (fh < 37.5 && om < 77.0){
            puts("AA");
        }
        else if (fh < 40.0 && om < 83.0){
            puts("A");
        }
        else if (fh < 43.0 && om < 89.0){
            puts("B");
        }
        else if (fh < 50.0 && om < 105.0){
            puts("C");
        }
        else if (fh < 55.0 && om < 116.0){
            puts("D");
        }
        else if (fh < 70.0 && om < 148.0){
            puts("E");
        }
        else {
            puts("NA");
        }
    }
    return (0);
}