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>
#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;
	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<stdio.h>
int main()
{
	double a,b;
	while(scanf("%lf%lf",&a,&b)!=EOF){
		if(a<35.5&&b<71.0){
			printf("AAA\n");
		}else if(a<37.5&&b<77.0){
			printf("AA\n");
		}else if(a<40.0&&b<83.0){
			printf("A\n");
		}else if(a<43.0&&b<89.0){
			printf("B\n");
		}else if(a<50.0&&b<105.0){
			printf("C\n");
		}else if(a<55.0&&b<116.0){
			printf("D\n");
		}else if(a<70.0&&b<148.0){
			printf("E\n");
		}else{
			printf("NA\n");
		}
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }


int light[] = {35.5, 37.5, 40, 43, 50, 55, 70};
int heavy[] = {71, 77, 83, 89, 105, 116, 148};
string cls[] = {"AAA", "AA", "A", "B", "C", "D", "E"};


string comp(double a, double b)
{
	rep(i, 7)
		if(a < light[i] && b < heavy[i])
			return cls[i];
	
	return "NA";
}

int main()
{
    double a, b;
	while(cin >> a >> b)
		cout << comp(a, b) << endl;
}

C++: #include<bits/stdc++.h>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define ll long long int
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int>pii;
typedef pair<ll,ll>pll;
typedef pair<double,double>pdd;
using namespace std;
#define MAX  999999
int main(){
	double tiya,rize;
	while(cin>>tiya>>rize){
		 if(tiya<35.5&&rize<71)
			cout<<"AAA"<<endl;
		else if(tiya<37.5&&rize<77)
			cout<<"AA"<<endl;
		else if(tiya<40&&rize<83)
			cout<<"A"<<endl;
		else if(tiya<43.0&&rize<89)
			cout<<"B"<<endl;
		else if(tiya<50&&rize<105)
			cout<<"C"<<endl;
		else if(tiya<55&&rize<116)
			cout<<"D"<<endl;
		else if(tiya<70&&rize<148)
			cout<<"E"<<endl;
		else cout<<"NA"<<endl;
	}
}

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 };

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>
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(t2 < 77 && ch == "AA"){
      ch = "AA";
    } else if(t2 < 83 && ch == "A"){
      ch = "A";
    }else if(t2 < 89 && ch == "B"){
      ch = "B";
    }else if(t2 < 105 && ch == "C"){
      ch = "C";
    }else if(t2 < 116 && ch == "D"){
      ch = "D";
    }else if(t2 < 148 && ch == "E"){
      ch = "E";
    }else ch = "NA";
    cout << ch << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float t,t1;
	scanf("%f %f",&t,&t1);
	if(t<35.50 && t1<71.00){
		printf("AAA");
	}
	else if(t<37.50 && t1<77.00){
		printf("AA");
	}
	else if(t<40.00 && t1<83.00){
		printf("A");
	}
	else if(t<43.00 && t1<89.00){
		printf("B");
	}
	else if(t<50.00 && t1<105.00){
		printf("C");
	}
	else if(t<55.00 && t1<116.00){
		printf("D");
	}
	else if(t<70.00 && t1<148.00){
		printf("E");
	}
	else{
		printf("NA");
	}
	return 0;
}

C++: #include <stdio.h>
int main(){
  int t1,t2;
  
  scanf("%d %d",&t1,&t2);

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

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

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;
}