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 t1,t2;
  string ch;
  while( cin >> t1 ){
    if(t1 < 35.5){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";

    cin >> t2;

    if(t2 < 71.0 && ch == "AAA"){
      ch = "AAA";
    }else if(t1 < 37.5){
      ch = "AA";
    } else if(t1 < 40){
      ch = "A";
    }else if(t1 < 43){
      ch = "B";
    }else if(t1 < 50){
      ch = "C";
    }else if(t1 < 55){
      ch = "D";
    }else if(t1 < 70){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}

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

int h[] = {35, 37, 40, 43, 50, 55, 70};
int f[] = {71, 77, 83, 89, 105, 116, 148};
string s[] = {"AAA", "AA", "A", "B", "C", "D", "E"};

int main()
{
  double a, b;
  while(cin >> a >> b)
  {
    for(int i = 0; i < 7; i++)
    {
      if(a < h[i] && b < f[i])
      {
        cout << s[i] << endl;
        goto next;
      }
    }
    cout << "NA\n";
  next:;
  }
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int N, K;

bool cmp(const pii &a, const pii &b){
    if(a.first == b.first) return a.second < b.second;
    return a.first < b.first;
}

struct Edge {
    int to, cost;
    Edge(int to, int cost): to(to), cost(cost) {}
};

typedef vector<vector<Edge>> AdjList;
AdjList graph;

const int INF = 100000000;

vi dist;
int d[110][110];

bool bellman_ford(int n, int s) { // nは頂点数、sは開始頂点
    dist = vector<int>(n, INF);
    dist[s] = 0; // 開始点の距離は0
    for (int i = 0; i < n; i++) {
        for (int v = 0; v < n; v++) {
            for (int u = 0; u < n; u++) {
                if (dist[v] != INF && dist[u] > dist[v] + d[v][u]) {
                    dist[u] = dist[v] + d[v][u];
                    if (i == n - 1) return true; // n回目にも更新があるなら負の閉路が存在
                }
            }
        }
    }
    return false;
}

int main() {
    //cout << fixed << setprecision(15);

    double a, b;
    while(cin >> a >> b){
        a *= 100;
        b *= 100;
        if(a<3550 && b < 7100){
            cout << "AAA" << endl;
        }else if(a < 3750 && b < 7700){
            cout << "AA" << endl;
        }else if(a < 4000 && b < 8300) {
            cout << "A" << endl;
        }else if(a < 4300 && b < 8900) {
            cout << "B" << endl;
        }else if(a < 5000 && b < 10500) {
            cout << "C" << endl;
        }else if(a < 5500 && b < 11600) {
            cout << "D" << endl;
        }else if(a < 7000 && b < 14800) {
            cout << "E" << endl;
        }else cout << "NA" << endl;
    }
    return 0;
}

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

int main()
{
    double ft,st;
    while(cin>>ft>>st)
    {
        int fr=0,sr=0;
        if(ft<70.00)fr++;
        if(ft<55.00)fr++;
        if(ft<50.00)fr++;
        if(ft<43.00)fr++;
        if(ft<40.00)fr++;
        if(ft<37.50)fr++;
        if(ft<35.50)fr++;
        if(sr<148.00)sr++;
        if(sr<116.00)sr++;
        if(sr<105.00)sr++;
        if(sr<89.00)sr++;
        if(sr<83.00)sr++;
        if(sr<77.00)sr++;
        if(sr<71.00)sr++;
        int r;
        r=min(fr,sr);
        if(r==0)cout<<"NA"<<endl;
        if(r==1)cout<<'E'<<endl;
        if(r==2)cout<<'D'<<endl;
        if(r==3)cout<<'C'<<endl;
        if(r==4)cout<<'B'<<endl;
        if(r==5)cout<<'A'<<endl;
        if(r==6)cout<<'AA'<<endl;
        if(r==7)cout<<'AAA'<<endl;
    }
    return 0;
}

C++: #include<stdio.h>
#include<iostream>
using namespace std;
void TR(double x,double y,int K,int H)
{
int t;
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;
}


}
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);
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 <stdio.h>

int main(void) {

  double five,ten;


  while(scanf("%lf %lf",&five,&ten)!=EOF) {

    if(five<35.50 && ten<71.00) printf("AAA\n");

    else if(five<37.50 && ten<77.00) printf("AA\n");

    else if(five<40.00 && ten<83.00) printf("A\n");

    else if(five<43.00 && ten<89.00) printf("B\n");

    else if(five<50.00 && ten<105.00) printf("C\n");

    else if(five<55.00 && ten<116.00) printf("D\n");

    else if(five<70.00 && ten<148.00) printf("E\n");

    else printf("NA\n");

  }

  return 0;

}