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 f, s;
    
    while (cin >> f >> s) {
        if (f < 35 && s < 71)
            cout << "AAA";
        else if (f < 37.5 && s < 77.0)
            cout << "AA";
        else if (f < 40.5 && s < 83.0)
            cout << "A";
        else if (f < 43.0 && s < 89.0)
            cout << "B";
        else if (f < 50.0 && s < 105.0)
            cout << "C";
        else if (f < 55.0 && s < 116.0)
            cout << "D";
        else if (f < 70.0 && s < 148.0)
            cout << "E";
        else
            cout << "NA";
        
        cout << endl;
    }

    return 0;
}

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

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

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	string s[8]={"AAA","AA","A","B","C","D","E","NA"};
	double h[8][2]={
	  {35.5,71.0},
	  {37.5,77.0},
	  {40.0,83.0},
	  {43.0,89.0},
	  {50.0,105.0},
	  {55.0,116.0},
	  {70.0,148.0},
	  {1e9,1e9},
	};
	double a,b;
	while(cin>>a>>b){
		rep(i,8)if(h[i][0]>a&&h[i][1]>b){
			cout<<s[i]<<endl;
			break;
		}
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

string s[] = { "AAA","AA","A","B","C","D","E" };
double t1[] = { 35.5,37.5,40,43,50,55,70 };
double t2[] = { 71,77,83,89,105,116,148 };

signed main() {
	for (double a, b; cin >> a >> b;) {
		rep(i, 0, 8) {
			if (t1[i] > a&&t2[i] > b) {
				cout << s[i] << endl;
				break;
			}
			if (i == 7) {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y)) 
#define NUMRNK 7

int main(void){  
  double t500, t1k;
  double lim500[] = {70, 55, 50, 43, 40, 37.5, 35.5};
  double lim1k[] = {148, 116, 105, 89, 83, 77, 71};
  string rnkName[] = {"E", "D", "C", "B", "A", "AA", "AAA"};
  int rnk, rnk500, rnk1k;
  
  while (cin >> t500 >> t1k){
    rnk = rnk500 = rnk1k = -1;
    for (int i=0; i<NUMRNK; i++){
      if (t500<lim500[i]) rnk500 = i;
      if (t1k<lim1k[i]) rnk1k = i;
    }
    rnk = MIN(rnk500, rnk1k);
    if (rnk < 0) cout << "NA" << endl;
    else cout << rnkName[rnk] << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    double a, b;
    while (cin >> a >> b) {
        string s;
        if (a < 35.5 && b < 60 + 11) {
            s = "AAA";
        } else if (a < 37.5 && b < 60 + 17) {
            s = "AA";
        } else if (a < 40 && b < 60 + 23) {
            s = "A";
        } else if (a < 43 && b < 60 + 29) {
            s = "B";
        } else if (a < 50 && b < 60 + 45) {
            s = "C";
        } else if (a < 55 && b < 60 + 56) {
            s = "D";
        } else if (a < 60 + 10 && b < 60 * 2 + 28) {
            s = "E";
        } else {
            s = "NA";
        }
        cout << s << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
	double m,k;
	while(cin>>m>>k){
		if(m<35.5&&k<71.0)
			cout<<"AAA"<<endl;
		else if(m<37.5&&k<77.0)
			cout<<"AA"<<endl;
		else if(m<40.0&&k<83.0)
			cout<<"A"<<endl;
		else if(m<43.0&&k<89.0)
			cout<<"B"<<endl;
		else if(m<50.0&&k<105.0)
			cout<<"C"<<endl;
		else if(m<55.0&&k<116.0)
			cout<<"D"<<endl;
		else if(m<70.002&&k<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.00&&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()
{
  float f,g;
  while(cin >> f >> g){
    if (f < 35.5 && g < 71.0) cout << "AAA" << endl;
    else if(f < 37.5 && g < 77.0) cout << "AA" << endl;
    else if(f < 40.0 && g < 83.0) cout << "A" << endl;
    else if(f < 43.0 && g < 89.0) cout << "B" << endl;
    else if(f < 50.0 && g < 105.0) cout << "C" << endl;
    else if(f < 55.0 && g < 116.0) cout << "D" << endl;
    else if(f < 70.0 && g < 148.0) cout << "E" << endl;
    else cout << "NA" << endl;
  }
  return 0;
}