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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

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

int main(){
	double a, b;
	while(cin >> a >> b){
		if(a < 35.50 && b < 71.0){
			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.0){
			cout << "D" << endl;
		}else if(a < 70.0 && b < 148.0){
			cout << "E" << endl;
		}else {
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>

int main(){
	double x, y;
	
	while( scanf(" %lf %lf", &x, &y) != EOF ){
		if(x<35.5 && y<71) printf("AAA\n");
		else if(x<37.5 && y<77) printf("AA\n");
		else if(x<40 && y<83) printf("A\n");
		else if(x<43 && y<89) printf("B\n");
		else if(x<50 && y<105) printf("C\n");
		else if(x<55 && y<116) printf("D\n");
		else if(x<70 && y<148) printf("E\n");
		else printf("NA\n");
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  double a, b;
  double A[]={35.50,37.50,40.00,43.00,50.00,55.00};
  double B[]={71,77,83,89,105,116,148};
  string C[]={"AAA","AA","A","B","C","D","E","NA"};
  while(cin >> a >> b) {
    int i;
    for(i=0; i<7; i++) {
      if(a<A[i] && b<B[i]) { break; }
    }
    cout << C[i] << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main( void )
{
	double a, b;
	while ( cin >> a >> b )
	{
		double check_a[] = {
			35.5,
			37.5,
			40.0,
			43.0,
			50.0,
			55.0,
			70.0
		};

		double check_b[] = {
			71.0,
			77.0,
			83.0,
			89.0,
			105.0,
			116.0,
			148.0
		};

		int i;
		for ( i = 0; i < 7; i++ )
		{
			if ( a < check_a[i] && b < check_b[i] )
				break;
		}

		string rank[] = {
			"AAA",
			"AA",
			"A",
			"B",
			"C",
			"D",
			"E",
			"NA"
		};

		cout << rank[i] << endl;

	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){

	double a,b;

	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 <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(double a, double b, double 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) && b < c(1,11)) res = "AAA";
    cout << res << endl;
  }
  
  return 0;
}

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

double time500[7] = { 35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0 };
double time1000[7] = { 71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0 };
string acd[7] = { "AAA", "AA", "A", "B", "C", "D", "E" };
int main() {
      int a,b;
      double time5,time1;
      while(cin>>time5>>time1) {
        for(int i=0; i<7; ++i) {
          if(time5 < time500[i] && time1 < time1000[i]) {
            cout<<acd[i]<<endl;
            goto NEXT;
          }
        }
        cout<<"NA"<<endl;
      NEXT:
        ;
      }
}

C++: #include<stdio.h>
int main(void)
{
	double a,b;

		while(scanf("%lf %lf",&a,&b)!=EOF) {
			if(35.50>a && 71.00>b){
				printf("AAA\n");
			}
			else if (37.50>a && 77.00>b){
				printf("AA\n");
			}
			else if (40.00>a && 83.00>b){
				printf("A\n");
			}
			else if (43.00>a && 89.00>b){
				printf("B\n");
			}
			else if(50.00>a && 95.00>b){
				printf("C\n");
			}
			else if(55.00>a && 122.00>b){
				printf("D\n");
			}
			else if(70.00>a && 148.00>b){
				printf("E\n");
			}
			else{
				printf("NA\n");
			}
		}
		return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  double n,m;
  while(cin >> n >> m){
  int cnt1=0,cnt2=0;
  if(n>=35.50){
    cnt1++;
  }
  if(n>=37.50){
    cnt1++;
  }
  if(n>=40.00){
    cnt1++;
  }
  if(n>=43.00){
    cnt1++;
  }
  if(n>=50.00){
    cnt1++;
  }
  if(n>=55.00){
    cnt1++;
  }
  if(n>=70.00){
    cnt1++;
  }
  if(m>=71.00){
    cnt2++;
  }
  if(m>=77.00){
    cnt2++;
  }
  if(m>=83.00){
    cnt2++;
  }
  if(m>=89.00){
    cnt2++;
  }
  if(m>=105.00){
    cnt2++;
  }
  if(m>=116.00){
    cnt2++;
  }
  if(m>=148.00){
    cnt2++;
  }
  cout << ans[max(cnt1,cnt2)] << endl;
  }
  return 0;
}

C++: #include<stdio.h>

int main(){
	double a,b;
	while(~scanf("%lf%lf",&a,&b)){
		if(a<35.50&&b<71.00)printf("AAA\n");
		else if(a<37.50&&b<77.00)printf("AA\n");
		else if(a<40.00&&b<83.00)printf("A\n");
		else if(a<43.00&&b<89.00)printf("B\n");
		else if(a<50.00&&b<105.00)printf("C\n");
		else if(a<55.00&&b<116.00)printf("D\n");
		else if(a<70.00&&b<148.00)printf("E\n");
		else printf("NA\n");
	}
}