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 <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


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




int main(){
	double d,e;
	while(cin>>d>>e){
		rep(i,8){
			if(d<f[i]&&e<t[i]){
				cout<<s[i]<<endl;
				break;
			}
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};

//////////////////////////////////////////////////////////////

double c(int a, int b, int c = 0) {
  return a*60+b+c/60.0;
}

int main() {
  
  double a, b;
  while(cin >> a >> b) {
    string res = "NA";
    if(a < c(1,10) && b < c(2,28)) res = "E";
    if(a < c(0,55) && b < c(1,56)) res = "D";
    if(a < c(0,50) && b < c(1,45)) res = "C";
    if(a < c(0,43) && b < c(1,29)) res = "B";
    if(a < c(0,40) && b < c(1,23)) res = "A";
    if(a < c(0,37) && b < c(1,17)) res = "AA";
    if(a < c(0,35) + 50/60.0 && b < c(1,11)) res = "AAA";
    cout << res << endl;
  }
  
  return 0;
}

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

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 (i == 7) {
				cout << "NA" << endl;
				break;
			}
			if (t1[i] > a&&t2[i] > b) {
				cout << s[i] << endl;
				break;
			}
		}
	}
	return 0;
}

C++: #include <stdio.h>
int main()
{
	float n500,n1000;
	while(scanf("%f %f",&n500,&n1000)!=EOF){
		if(n500<35.5&&n1000<71)
			printf("AAA\n");
		else if(n500<37.5&&n1000<77)
			printf("AA\n");
		else if(n500<40&&n1000<83)
			printf("A\n");
		else if(n500<43&&n1000<89)
			printf("B\n");
		else if(n500<50&&n1000<105)
			printf("C\n");
		else if(n500<55&&n1000<116)
			printf("D\n");
		else if(n500<70&&n1000<148)
			printf("E\n");
		else
			printf("NA\n");
	}
}

C++: #include<stdio.h>

#define P(c)		( putchar(c) )
#define PP(c, d, e)	( P(c), P(d), P(e) )

int main(void)
{
	int    i  = 0, j  = 63;
	double m5 = 0, m1 = 0;

	double date5[7] = {35.5, 37.5, 40, 43, 50, 55, 70};
	double date1[7] = {71, 77, 83, 89, 105, 116, 148};
	int    c[7]     = {65, 64, 63, 63, 63, 63, 63};

	scanf("%lf %lf", &m5, &m1);

	for(i = 0; i < 7; i++)
	{
		if(m5 < date5[i] && m1 < date1[i])
		{
			do
			{
				P( c[i] + i );
			}
			while(c[i] - j++ > 0);

			P('\n');

			return 0;
		}
	}

	PP('N', 'A', '\n');

	return 0;
}

C++: #include <cstdio>

using namespace std;

int main(void) {
    double a, b;
    while (scanf("%lf %lf", &a, &b) != EOF) {
        int x, y;
        x = (int)(a * 100);
        y = (int)(b * 100);
        if (a < 35.5 && b < 61.0) {
            puts("AAA");
        } else if (x < 3750 && y < 7700) {
            puts("AA");
        } else if (x < 4000 && y < 8300) {
            puts("A");
        } else if (x < 4300 && y < 8900) {
            puts("B");
        } else if (x < 5000 && y < 10500) {
            puts("C");
        } else if (x < 5500 && y < 11600) {
            puts("D");
        } else if (x < 7000 && y < 14800) {
            puts("E");
        } else {
            puts("NA");
        }
    }
    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";
		else if(a<37.50 && b< 77.00) cout << "AA";
		else if(a<40.00 && b< 83.00) cout << "A";
		else if(a<43.00 && b< 89.00) cout << "B";
		else if(a<50.00 && b<105.00) cout << "C";
		else if(a<55.00 && b<116.00) cout << "D";
		else if(a<70.00 && b<148.00) cout << "E";
		else						 cout << "NA";
		cout << endl;
	}
}

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