Go: package main

import (
	"fmt"
)

func main() {
	for {
		var d, w, h, n int
		// var p1, p2, p3 float64
		var p1, p2, p3 int
		fmt.Scanf("%d %d %d", &d, &w, &h)

		if d == 0 && w == 0 && h == 0 {
			return
		} else {
			// p1 = math.Hypot(float64(d), float64(w))
			// p2 = math.Hypot(float64(w), float64(h))
			// p3 = math.Hypot(float64(d), float64(h))
			p1 = (d * d) + (w * w)
			p2 = (w * w) + (h * h)
			p3 = (d * d) + (h * h)
		}

		// fmt.Println("len:", p1, p2, p3)

		fmt.Scanf("%d", &n)
		for i := 0; i < n; i++ {
			var r int
			fmt.Scanf("%d", &r)

			if p1 < (r*2)*(r*2) || p2 < (r*2)*(r*2) || p3 < (r*2)*(r*2) {
				fmt.Println("OK")
			} else {
				fmt.Println("NA")
			}
		}
	}
}

C++: #include<stdio.h>
#include<math.h>

int main(){
  while(1){
    int d, w, h;
    scanf("%d %d %d", &d, &w, &h);
    if(d==0 && w==0 && h==0)
      break;
    int n;
    scanf("%d", &n);
    
    int max = (int)fmax((double)d, fmax((double)w, (double)h));
    double a = sqrt(d*d+w*w+h*h-max*max) / 2;

    int i;
    for(i=0;i<5;i++){
      int b;
      scanf("%d", &b);
      //printf("a:%lf b:%d", a, b);
      if((double)b <= a)
	printf("NA\n");
      else
	printf("OK\n");
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

bool isenable (double r0, double r ){

//	cout << "r0: " << r0 << " r: " << r << endl;
	
	if (r0 > 0. && r0 < r ){
		return true;
	} // end if

	return false;
}

bool estimate (double a, double b, double r )
{
//	cout << "a: " << a << " b: " << b << " r: " << r << endl;

	if (a/2. > 0. && a/2. < r && b/2. > 0. && b/2. < r ){
		if (isenable ( (a/2.)*(a/2.) + (b/2.)*(b/2. ), r*r ) ){
			return true;
		} // end if
	} // end if

	return false;
}
 
int main()
{
//	cut here before submit 
//	freopen("testcase.carrycheese", "r", stdin);
	string str = "";
	vector <double> s(3, 0.0 );
	int i;

	while (getline (cin, str ) ){
		stringstream sss(str);
	
		for (i = 0; i < 3; ++i){
			sss >> s[i];
		} // end for
		if (s[0] == 0. && s[1] == 0. && s[2] == 0. ) {
			break;
		} // end if

		sort (s.begin(), s.end() );

		int n;		
		getline (cin, str );
		stringstream ssn(str);
		ssn >> n;

		for (i = 0; i < n; ++i ){
			double r = 0.0;
			getline (cin, str );
			stringstream ssr(str);
			ssr >> r;

			if (estimate (s[0], s[1], r ) ){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			} // end if
		} // end for
	} // end loop

//	cout << res << endl;	
		
	return 0;
}

C++: #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 30;

int main(void){
	int a[3];
	while(1){
		rep(i,3)
			cin >> a[i];
		if(!(a[0]|a[1]|a[2]))
			break;
		sort(a,a+3);
		int n;
		cin >> n;
		rep(i,n){
			int tmp;
			cin >> tmp;
			int r2=(2*tmp)*(2*tmp);
			int d2=a[0]*a[0]+a[1]*a[1];
			if(d2<r2)
				cout <<"OK" << endl;
			else
				cout <<"NA" << endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>
int main(){
int a,temp,n;
while(1){
scanf("%d",&a);
if(a==0)return 0;
for(int i=0;i<2;i++){
scanf("%d",&temp);
if(temp<a)a=temp;
}
for(int i=0;i<temp;i++){
scanf("%d",&n);
if(n>=a)printf("OK\n");
else printf("NA\n");
}

}
}

C++: #include <stdio.h>
#include <stdlib.h>

void judge(int x, int y, int z, int r);

int main(void)
{
    int cheese_x, cheese_y, cheese_z;
    scanf("%d", &cheese_x);
    scanf("%d", &cheese_y);
    scanf("%d", &cheese_z);
    int n;
    int cnt;
    scanf("%d", &n);
    for(cnt = 0; cnt < n; cnt++){
        int hole_size;
        scanf("%d", &hole_size);
        judge(cheese_x, cheese_y, cheese_z, hole_size);
    }
    return 0;
}

void judge(int x, int y, int z, int r)
{
    int t = r * r;
    int d_1, d_2, d_3;
    d_1 = (x / 2) * (x / 2) + (y / 2) * (y / 2);
    d_2 = (y / 2) * (y / 2) + (z / 2) * (z / 2);
    d_3 = (z / 2) * (z / 2) + (x / 2) * (x / 2);
    if(d_1 > t || d_2 > t || d_3 > t){
        printf("OK\n");
    } else {
        printf("NA\n");
    }
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
  int x,y,z;
  while(true){
  cin>>x>>y>>z;
  if(!x&&!y&&!z)
    break;
  double l = sqrt(x*x+y*y+z*z-max(x,max(y,z))*max(x,max(y,z)));
  int n,r;
  for(cin>>n;n>0;n--){
    cin>>r;
    if(l<2*r)
      cout<<"OK"<<endl;
    else
      cout<<"NA"<<endl;
  }
  }
  return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14

int main(){
	double en;
	double i,y,k;
	int n;
	while(cin >> i >> y >> k , i * y * k){
		double min = sqrt (i * i + y * y);
		if(min > sqrt (k * k + y * y) ) min = sqrt (k * k + y * y);
		if(min > sqrt (i * i + k * k) ) min = sqrt (i * i + k * k);
		cin>>n;
		for(int i = 0 ; i < n ; i++){
			double m;
			cin>>m;
			//cout<<1.0*2*m<<" "<<min<<endl;
			 if(1.0*min<1.0*m*2)cout << "OK" << endl;
			 else cout << "NO" << endl; 
		}
		
	}

}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

int main(void){
	long int a[3],n;
	long int d;
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	d = a[0]*a[0]+a[1]*a[1];
	cin >> n;
	REP(i,n){
		long int r;
		cin >> r;
		if (4*r*r>d)
			cout << "OK" << endl;
		else
			cout << "NA" << endl;
	}

	cin >> d >> d >> d;


	return 0;
}

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

int main()
{
	long long a,b,c,sum;
	long long aa,bb;
	long long n;
	while(1){
		cin>>a>>b>>c;
		if(a==0&&b==0&&c==0)break;
		if(a<b){aa=a;if(b<c){bb=b;}else{bb=c;}}else{aa=b;if(a<c){bb=a;}else{bb=c;}}

		cin>>n;
		for (int i = 0; i < n; ++i) {
			cin>>sum;
			if(sqrt(aa*aa+bb*bb)<sum*2){cout<<"OK"<<endl;}
			else{cout<<"NA"<<endl;}
		}
	}
	return 0;
}

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

using namespace std;

int main() {
  for (;;) {
    int s[3];
    for (int i = 0; i < 3; i++)
      cin >> s[i];
    if (!s[0] && !s[1] && !s[2]) return 0;
    sort(s, s+3);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      int r;
      cin >> r;
      if (s[0]*s[0] + s[1]*s[1] < 4*r*r)
        cout << "OK" << endl;
      else
        cout << "NA" << endl;
    }
  }
}