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 <cstdio>
int main() {
	float fm, tm;
	while (scanf("%f%f",&fm,&tm)!=EOF) {
		if (fm<35.5&&tm<71.0) printf("AAA\n");
		else if (fm<37.5&&tm<77.0) printf("AA\n");
		else if (fm<40.0&&tm<83.0) printf("A\n");
		else if (fm<43.0&&tm<89.0) printf("B\n");
		else if (fm<50.0&&tm<105.0) printf("C\n");
		else if (fm<55.0&&tm<116.0) printf("D\n");
		else if (fm<70.0&&tm<148.0) printf("E\n");
		else printf("NA\n");
	}
}

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

int x(double a) {
  if(a<35.5) return 7;
  if(a<37.5) return 6;
  if(a<40) return 5;
  if(a<43) return 4;
  if(a<50) return 3;
  if(a<55) return 2;
  if(a<70) return 1;
  return 0;
}

int y(double a) {
  if(a<71) return 7;
  if(a<77) return 6;
  if(a<83) return 5;
  if(a<89) return 4;
  if(a<105) return 3;
  if(a<116) return 2;
  if(a<148) return 1;
  return 0;
}

int main() {
  double a,b;
  while(cin >> a >> b) {
    int s=x(a),t=y(b);
    int z=min(s,t);
    if(z==7) cout << "AAA" << endl;
    if(z==6) cout << "AA" << endl;
    if(z==5) cout << "A" << endl;
    if(z==4) cout << "B" << endl;
    if(z==3) cout << "C" << endl;
    if(z==2) cout << "D" << endl;
    if(z==1) cout << "E" << endl;
    if(z==0) cout << "NA" << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main(){
  string ans[8]={"AAA","AA","A","B","C","D","E","NA"};
  double a,b,aa,bb;
  while(cin>>a>>b){
    if(a<35.50)aa=0;
    else if(a<37.50)aa=1;
    else if(a<40.00)aa=2;
    else if(a<43.00)aa=3;
    else if(a<50.00)aa=4;
    else if(a<55.00)aa=5;
    else if(a<70.00)aa=6;
    else aa=7;
    if(b<71.00)bb==0;
    else if(b<77.00)bb=1;
    else if(b<83.00)bb=2;
    else if(b<89.00)bb=3;
    else if(b<105.00)bb=4;
    else if(b<116.00)bb=5;
    else if(b<148.00)bb=6;
    else bb=7;
    int res=max(aa,bb);
    cout<<ans[res]<<endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	double a,b;
	while(cin>>a>>b){
		if(a<35.5&&71.0>b){
			cout<<"AAA"<<endl;
		}
		else if(a<37.5&&77.0>b){
			cout<<"AA"<<endl;
		}
		else if(a<40.0&&83.0>b){
			cout<<"A"<<endl;
		}
		else if(a<43.0&&89.0>b){
			cout<<"B"<<endl;
		}
		else if(a<50.0&&105.0>b){
			cout<<"C"<<endl;
		}
		else if(a<55.0&&116.0>b){
			cout<<"D"<<endl;
		}
		else if(a<70.0&&148.0>b){
			cout<<"E"<<endl;
		}
		else
			cout<<"NA"<<endl;
	}

	return 0;
}

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

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

int main()
{
    double x, y;
    while (scanf("%lf %lf", &x, &y) != EOF) {
        if (x < 35.50 && y < 71) printf("AAA\n");
        else if (x < 37.50 && 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 <cstdio>

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

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

int main(void){
	const char *classes[] = {"AAA","AA","A","B","C","D","E"};
	const double class500M[] = {35.5,37.5,40,43,50,55,70};
	const double class1000M[] = {71,77,83,89,105,116,148};

	while( true ){
		bool bNA = true;
		double c500, c1000;
		
		cin >> c500 >> c1000;
		
		if(cin.eof()) break;

		for(int i = 0; i < sizeof(class500M)/sizeof(*class500M); ++i){
			if( c500 < class500M[i] && c1000 < class1000M[i] ){
				cout << classes[i] << '\n';
				bNA = false;
				break;
			}
		}
		if( bNA )
			cout << "NA\n";
	}
	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(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) && b < c(1,11)) res = "AAA";
    cout << res << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;

int main() {
	char c[7][4]={"AAA","AA","A","B","C","D","E"};
	double n1,n2,t1[7]={35.5,37.5,40,43,50,55,70},t2[7]={71,77,83,89,105,116,148};
	int i;
	while(cin >> n1 >> n2) {
		for (i=0;i<7;i++) if (n1<t1[i] && n2<t2[i]) break;
		if (i==7) cout << "NA" << endl; else cout << c[i] << endl;
	}
	return 0;
}

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