Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	badge := []string{"AAA", "AA", "A", "B", "C", "D", "E"}
	badgeLen := len(badge)
	short := []float64{35.5, 37.5, 40, 43, 50, 55, 70}
	long := []float64{71, 77, 83, 89, 105, 116, 148}

	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		time := strings.Split(stdin.Text(), " ")

		sT, _ := strconv.ParseFloat(time[0], 64)
		lT, _ := strconv.ParseFloat(time[1], 64)

		sR, lR, t := 0, 0, 0.0
		for _, t = range short {
			if sT < t {
				break
			}
			sR++
		}
		for _, t = range long {
			if lT < t {
				break
			}
			lR++
		}
		rank := ""
		if sR >= badgeLen || lR >= badgeLen {
			rank = "NA"
		} else if sR >= lR {
			rank = badge[sR]
		} else {
			rank = badge[lR]
		}
		fmt.Println(rank)
	}
}

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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 100000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	double a, b;
  string result;
  while(cin >> a >> b) {
    if(a < (double)35.50 && b < (double)71.00) result = "AAA";
    else if(a < (double)37.50 && b < (double)77.00) result = "AA";
    else if(a < (double)40.00 && b < (double)83.00) result = "A";
    else if(a < (double)43.00 && b < (double)89.00) result = "B";
    else if(a < (double)50.00 && b < (double)105.00) result = "C";
    else if(a < (double)55.00 && b < (double)116.00) result = "D";
    else if(a < (double)70.00 && b < (double)148.00) result = "E";
    else result = "NA";
    cout << result << endl;
  }
	return 0;
}

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

int main(){
	double fif,one;
	while(cin >> fif >> one){
		puts(	fif<35.5&&one<71.0 ? "AAA":
				fif<37.5&&one<77.0 ? "AA":
				fif<40.0&&one<83.0 ? "A":
				fif<43.0&&one<89.0 ? "B":
				fif<50.0&&one<105.0 ? "C":
				fif<55.0&&one<116.0 ? "D":
				fif<70.0&&one<148.0 ? "E":
				"NA"
		);
	}
}

C++: #include<iostream>
using namespace std;
 
int main(){
	 
  	double a, b;
  	
  	while(cin >> a >> b) {
 	
  	if(a <35.50 && b < 71.00)
	cout <<"AAA\n";
	
	else if(a < 37.50 && b < 77.00)
	cout <<"AA\n";
	
    else if(a < 40.00 && b < 83.00)
	cout <<"A\n";
	
    else if(a < 43.00 && b < 89.00)
	cout <<"B\n";
	
    else if(a < 50.00 && b < 105.00)
	cout <<"C\n";
	
    else if(a < 55.00 && b < 116.00)
	cout <<"D\n";
	
    else if(a < 70.00 && b < 148.00)
	cout <<"E\n";
	
    else 
	cout << "NA\n";
  }
  	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  double R5,R10;

  while(cin >> R5 >> R10){
    if(R5 < 35.50 && R10 < 77.00){
      cout << "AAA" << endl;
    }
    else if(R5 < 37.50 && R10 < 77.00){
      cout << "AA" << endl;
    }
    else if(R5 < 40.00 && R10 < 83.00){
      cout << "A" << endl;
    }
    else if(R5 < 43.00 && R10 < 89.00){
      cout << "B" << endl;
    }
    else if(R5 < 50.00 && R10 < 105.00){
      cout << "C" << endl;
    }
    else if(R5 < 55.00 && R10 < 116.00){
      cout << "D" << endl; 
    }
    else if(R5 < 70.00 && R10 < 148.00){
      cout << "E" << endl;
    }
    else{
      cout << "NA" << endl;
    }

  }
  return 0;
}

C++: #include<cstdio>
#include<string>
main(){
	using namespace std;
	string lv[8] = {"AAA","AA","A","B","C","D","E","NA"};
	double ind1,ind2,lvd5[7] = {35.5,37.5,40.0,43.0,50.0,55.0,70.0};
	int i,j,lvd1[7] = {71,77,83,89,105,116,148};
	while(~scanf("%lf %lf",&ind1,&ind2)){
		i = j = 0;
		while(++i<7)
		  if(ind1 < lvd5[i])
		    break;
		while(++j<7)
		  if(ind2 < lvd1[j])
		    break;
		printf("%s\n", i <= j ? lv[j].c_str() : lv[i].c_str());
	}
	return 0;
}

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

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

C++: #include <iostream>
using namespace std;
int main(){
	while(true){
		double m500,m1000;
		cin >> m500 >> m1000;
		if(m500 < 35.5 && m1000 < 71){
			cout << "AAA" << endl;
		}
		else if(m500 < 37.5 && m1000 < 77){
			cout << "AA" << endl;
		}
		else if(m500 < 40 && m1000 < 83){
			cout << "A" << endl;
		}
		else if(m500 < 43 && m1000 < 89){
			cout << "B" << endl;
		}
		else if(m500 < 50 && m1000 < 105){
			cout << "C" << endl;
		}
		else if(m500 < 55 && m1000 < 116){
			cout << "D" << endl;
		}
		else if(m500 < 70 && m1000 < 148){
			cout << "E" << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int rf,rt;
  double f,t;
  for(;;){
    f=-1.0;
    t=-1.0;
    cin>>f>>t;
    if(f==-1&&t==-1)
      break;
    if(f<35.5)
      rf=0;
    else if(f<37.5)
      rf=1;
    else if(f<40)
      rf=2;
    else if(f<43)
      rf=3;
    else if(f<50)
      rf=4;
    else if(f<55)
      rf=5;
    else if(f<70)
      rf=6;
    else
      rf=7;
    if(t<71)
      rt=0;
    else if(t<77)
      rt=1;
    else if(t<83)
      rt=2;
    else if(t<89)
      rt=3;
    else if(t<105)
      rt=4;
    else if(t<116)
      rt=5;
    else if(t<148)
      rt=6;
    else
      rt=7;
    switch(rf>rt?rf:rt){
    case 0:
      cout<<"AAA"<<endl;
      break;
    case 1:
      cout<<"AA"<<endl;
      break;
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      cout<<(char)('A'+(rf>rt?rf:rt)-2)<<endl;
      break;
    default:
      cout<<"NA"<<endl;
      break;
    }
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

	double a,b;
	while(cin>>a>>b){
	if(a<35.5&&b<71){
	    cout<<"AAA"<<endl;

	}
	else if(a<37.5&&b<77){
	    cout<<"AA"<<endl;

	}
	else if(a<40&&b<83){
	    cout<<"A"<<endl;

	}
    else if(a<=43&&b<=89){
	    cout<<"B"<<endl;

	}
	else if(a<=50&&b<=105){
	    cout<<"C"<<endl;

	}
	else if(a<=55&&b<=116){
	    cout<<"D"<<endl;

	}
	else if(a<=70&&b<=148){
	    cout<<"E"<<endl;

	}
	else cout<<"NA"<<endl;

	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int chk500[8]={
  35, 37, 40, 43, 50, 55, 70, INT_MAX
};
int chk1000[8]={
  71, 77, 83, 89, 105, 116, 148, INT_MAX
};
const char *rank[8]={
  "AAA","AA","A","B","C","D","E","NA"
};

int main(){
  double a,b;
  while(~scanf("%lf%lf",&a,&b)){
    REP(i,8){
      if(i==7 || a < (double)chk500[i] && b < (double)chk1000[i]){
        puts(rank[i]);
        break;
      }
    }
  }
  return 0;
}

C++: #include<stdio.h>
int main(void)
{
	float a,b;
	printf("500Mtime=");
	printf("1000Mtime=");
	scanf("%d %b",&a,&b);
	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<110.0 && b<148.0){
			printf("E\n");
			}
	else{
		printf("NA\n");
		}
		return 0;
		}