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>

int main(){

	double a, b;
	while (std::cin >> a >> b){

		if (a < 35.5&&b < 71.0){
			std::cout << "AAA" << std::endl;
		}
		else if (a < 37.5&&b < 77.0){
			std::cout << "AA" << std::endl;
		}
		else if (a < 40.0&&b < 83.0){
			std::cout << "A" << std::endl;
		}
		else if (a < 43.0&&b < 89.0){
			std::cout << "B" << std::endl;
		}
		else if (a < 50.0&&b < 105.0){
			std::cout << "C" << std::endl;
		}
		else if (a < 55.0&&b < 116.0){
			std::cout << "D" << std::endl;
		}
		else if (a < 70.0&&b < 148.0){
			std::cout << "E" << std::endl;
		}
		else std::cout << "NA" << std::endl;
	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	double a,b;

		while(scanf("%lf %lf",&a,&b)!=EOF) {
			if(35.50>a && 71.00>b){
				printf("AAA\n");
			}
			else if (37.50>a && 77.00>b){
				printf("AA\n");
			}
			else if (40.00>a && 83.00>b){
				printf("A\n");
			}
			else if (43.00>a && 89.00>b){
				printf("B\n");
			}
			else if(50.00>a && 105.00>b){
				printf("C\n");
			}
			else if(55.00>a && 116.00>b){
				printf("D\n");
			}
			else if(70.00>a && 148.00>b){
				printf("E\n");
			}
			else{
				printf("NA\n");
			}
		}
		return 0;
}

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

男子   500M  1000M
AAA級  35秒50  1分11秒00
AA級   37秒50  1分17秒00
A級  40秒00  1分23秒00
B級  43秒00  1分29秒00
C級  50秒00  1分45秒00
D級  55秒00  1分56秒00
E級 1分10秒00 2分28秒00

*/

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

C++: #include<bits/stdc++.h>
#define EPS 1e-9
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

C++: #include <iostream>
using namespace std;
int main(){
  double t1,t2;
  string ch;
  while( cin >> t1 >> t2){

    if(t1 < 35.5 && t2 < 71){
      ch = "AAA";
    }else if(t1 < 37.5 && t2 < 77){
      ch = "AA";
    } else if(t1 < 40 && t2 < 83){
      ch = "A";
    }else if(t1 < 43 && t2 < 89){
      ch = "B";
    }else if(t1 < 50 && t2 < 105){
      ch = "C";
    }else if(t1 < 55 && t2 < 116){
      ch = "D";
    }else if(t1 < 70 && t2 < 148){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}

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

struct IND{string str,int page;};
int main()
{

struct IND N1[101]={};
string R;
int x,i=0;
while(scanf("%s %d",&R,&x)!=EOF){
N1[i].str=R;N1[i].page=x;i++;
}
for(int j=0;j<i;j++)
{
	for(int k=i;k>=j;k--)
	{
	*/
#include<stdio.h>
#include<iostream>
using namespace std;
void TR(double x,double y,int K,int H)
{
int t=0;
double X;
X=x*100;t=(int)X;
if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

X=y*100;t=(int)X;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;
cout<<t;
}



int main(){
int K=0,H=0;
double x,y;
while(scanf("%lf %lf",&x,&y)!=EOF)
{K=0,H=0;

//TR(x,y,K,H);cout<<H<<K;
int t=0;
double X;
X=x*100;t=(int)X;

if(t<3550)K=0;
else if(t<3550)K=0;
else if(t<3750)K=1;
else if(t<4000)K=2;
else if(t<4300)K=3;
else if(t<5000)K=4;
else if(t<5500)K=5;
else if(t<7000)K=6;
else if(t>=7000)K=7;

X=y*100;t=(int)X;
if(t<3550)K=0;
else if(t<7100)H=0;
else if(t<7700)H=1;
else if(t<8300)H=2;
else if(t<8900)H=3;
else if(t<10500)H=4;
else if(t<11600)H=5;
else if(t<14800)H=6;
else if(t>=14800)H=7;


if(H<K)H=K;

switch(K){
case 0:
cout<<"AAA"<<endl;break;
case 1:
cout<<"AA"<<endl;break;
case 2:
cout<<"A"<<endl;break;
case 3:
cout<<"B"<<endl;break;
case 4:
cout<<"C"<<endl;break;
case 5:
cout<<"D"<<endl;break;
case 6:
cout<<"E"<<endl;break;
case 7:
cout<<"NA"<<endl;break;

}
}
return 0;
}

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

int main() {
  double r1, r2;
  double k1[] = {35.5, 37.5, 40., 43., 50., 55., 70.};
  double k2[] = {71., 77., 83., 89., 105., 116., 148.};
  const char *label[] = {"AAA", "AA", "A", "B", "C", "D", "E", "NA"};
  double *p1, *p2;
  
  while (cin >> r1 >> r2) {
    p1 = upper_bound(k1, k1+7, r1);
    p2 = upper_bound(k2, k2+7, r2);
    cout << label[max(p1-k1, p2-k2)] << endl;
  }

  return 0;
}

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

int main(){
    double time[2];

    while(cin >> time[0] >> time[1]){
        if(time[0] < 35.5 && time[1] < 71.0) cout << "AAA" << endl;
        else if(time[0] < 37.5 && time[1] < 77.0) cout << "AA" << endl;
        else if(time[0] < 40.0 && time[1] < 83.0) cout << "A" << endl;
        else if(time[0] < 43.0 && time[1] < 89.0) cout << "B" << endl;
        else if(time[0] < 50.0 && time[1] < 105.0) cout << "C" << endl;
        else if(time[0] < 55.0 && time[1] < 116.0) cout << "D" << endl;
        else if(time[0] < 70.0 && time[1] < 148.0) cout << "E" << endl;
        else cout << "NA" << endl;
    }
    return 0;
}