Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	m500 := []float64{35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0, 1000.0}
	m1000 := []float64{71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0, 1000.0}
	classes := []string{"AAA", "AA", "A", "B", "C", "D", "E", "NA"}
	for scanner.Scan() {
		input := strings.Split(scanner.Text(), " ")
		t500, _ := strconv.ParseFloat(input[0], 64)
		t1000, _ := strconv.ParseFloat(input[1], 64)
		for i := 0; i < len(m500); i++ {
			if t500 < m500[i] && t1000 < m1000[i] {
				fmt.Println(classes[i])
				break
			}
		}
	}
}

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

int main()
{
    double a,b;
    while(cin >> a >> b){
        int tmp1,tmp2;
        if(a < 35.5)
            tmp1 = 1;
        else if(a < 37.5)
            tmp1 = 2;
        else if(a < 40)
            tmp1 = 3;
        else if(a < 43)
            tmp1 = 4;
        else if(a < 50)
            tmp1 = 5;
        else if(a < 55)
            tmp1 = 6;
        else if(a < 70)
            tmp1 = 7;
        else
            tmp1 = 100;
        
        if(b < 71)
            tmp2 = 1;
        else if(a < 77)
            tmp2 = 2;
        else if(a < 83)
            tmp2 = 3;
        else if(a < 89)
            tmp2 = 4;
        else if(a < 105)
            tmp2 = 5;
        else if(a < 116)
            tmp2 = 6;
        else if(a < 148)
            tmp2 = 7;
        else
            tmp2 = 100;
        
        switch(max(tmp1,tmp2)){
            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 100:
             cout << "NA" <<endl;
             break;
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	double t1,t2;
	while(true){
		cin >> t1 >> t2;
		if(t1 < 35.5 && t2 < 71.0){
			cout << "AAA" << endl;
		}
		else if(t1 < 37.5 && t2 < 77.0){
			cout << "AA" << endl;
		}
		else if(t1 < 40.0 && t2 < 83.0){
			cout << "A" << endl;
		}
		else if(t1 < 43.0 && t2 < 89.0){
			cout << "B" << endl;
		}
		else if(t1 < 50.0 && t2 < 105.0){
			cout << "C" << endl;
		}
		else if(t1 < 55.0 && t2 < 116.0){
			cout << "D" << endl;
		}
		else if(t1 < 70.0 && t2 < 148.0){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}

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 <iostream>
using namespace std;
int main()
{
	double a = 0;
	double b = 0;
	while (cin >> a, cin >> 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;
		}
	}
	return 0;
}

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

int main(){
	double at,bt;
	while(cin >> at >> bt){
		if(at < 35.50 && bt < 71.00) cout << "AAA" << endl;
		else if(at < 37.50 && bt < 77.00) cout << "AA" << endl;
		else if(at < 40.00 && bt < 83.00) cout << "A" << endl;
		else if(at < 43.00 && bt < 89.00) cout << "B" << endl;
		else if(at < 50.00 && bt < 105.00) cout << "C" << endl;
		else if(at < 55.00 && bt < 116.00) cout << "D" << endl;
		else if(at < 70.00 && bt < 148.00) cout << "E" << endl;
		else cout << "NA" << endl;

	}

	return 0;
}

C++: #include <cstdio>
#define buf 1000
using namespace std;

void Search(double n,double m);

int main(void){
  double n,m;
  char str[buf];

  for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
      sscanf(str,"%lf %lf",&n,&m);
      Search(n,m);
  }
  return 0;
}

void Search(double n,double m){

  if(n<35.50 && m<71.00)          printf("AAA\n");
  else if(n<35.50 && m<71.00)     printf("AAA\n");
  else if(n<37.50 && m<77.00)     printf("AA\n");
  else if(n<40.00 && m<83.00)     printf("A\n");
  else if(n<43.00 && m<89.00)     printf("B\n");
  else if(n<50.00 && m<105.00)    printf("C\n");
  else if(n<55.00 && m<116.00)    printf("D\n");
  else if(n<70.00 && m<148.00)    printf("E\n");
  else if(n>=70.00 || m>=148.00)  printf("NA\n");
}

C++: #include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
#include<map>
#include<vector>
#define int long long
using namespace std;
int test[51];
signed main() {
    double n, a; int b = 0, c = 0;;
    while (cin >> n >> a) {
        if (n < 35.5) { b = 7; }
        else if (n < 37.5) { b = 6; }
        else if (n < 40) { b = 5; }
        else if (n < 43) { b = 4; }
        else if (n < 50) { b = 3; }
        else if (n < 55) { b = 2; }
        else if (n < 70) { b = 1; }
        else { cout << "NA" << endl; continue; }
        if (a < 71) { c = 7; }
        else if (a < 77) { c = 6; }
        else if (a < 83) { c = 5; }
        else if (a < 89) { c = 4; }
        else if (a < 105) { c = 3; }
        else if (a < 116) { c = 2; }
        else if (a < 148) { c = 1; }
        else { cout << "NA" << endl; continue; }
        if (min(b, c) == 7) { cout << "AAA" << endl; }
        if (min(b, c) == 6) { cout << "AA" << endl; }
        if (min(b, c) == 5) { cout << "A" << endl; }
        if (min(b, c) == 4) { cout << "B" << endl; }
        if (min(b, c) == 3) { cout << "C" << endl; }
        if (min(b, c) == 2) { cout << "D" << endl; }
        if (min(b, c) == 1) { cout << "E" << endl; }
    }
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	double a,b;
	while(cin >> a >> b)
	{
		if(a<35.50&&b<71.00)
		{
			cout << "AAA" << endl;
			continue;
		}
		if(a<37.50&&b<77.00)
		{
			cout << "AA" << endl;
			continue;
		}
		if(a<40.00&&b<83.00)
		{
			cout << "A" << endl;
			continue;
		}
		if(a<43.00&&b<89.00)
		{
			cout << "B" << endl;
			continue;
		}
		if(a<50.00&&b<105.00)
		{
			cout << "C" << endl;
			continue;
		}
		if(a<55.00&&b<116.00)
		{
			cout << "D" << endl;
			continue;
		}
		if(a<70.00&&b<148.00)
		{
			cout << "E" << endl;
			continue;
		}
		cout << "NA" << endl;
	}
	return 0;
}