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 <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
using namespace std;
int main(){
	
	int l,w,h;
	int n;
	int r;
	while(cin>>l>>w>>h,l!=0&&w!=0&&h!=0){
		cin>>n;
		for(int i=0;i<n;i++){
			cin>>r;
			if(l<2*r&&w<2*r&&h<2*r)
				cout<<"OK"<<endl;
			else
				cout<<"NA"<<endl;
		}
	}
}

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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef long long ll;
typedef unsigned long long ull;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); i++ )
#define UREP( i, m, n ) for ( unsigned int i = (unsigned int)( m ); i < (unsigned int)( n ); i++ )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define RALL( c ) (c).rbegin(), (c).rend()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

bool check( VI ls, int r )
{
	REP( i, 0, 3 )
	{
		REP( j, i + 1, 3 )
		{
			if ( sqrt( pow( ls[i], 2 ) + pow( ls[j], 2 ) ) < 2 * r )
			{
				return true;
			}
		}
	}

	return false;
}

int main()
{
	while ( true )
	{
		VI ls( 3 );
		
		bool notlast = false;

		REP( i, 0, 3 )
		{
			cin >> ls[i];
			notlast |= ls[i] != 0;
		}

		if ( !notlast )
		{
			break;
		}

		int n;
		cin >> n;

		REP( i, 0, n )
		{
			int r;
			cin >> r;

			if ( check( ls, r ) )
			{
				cout << "OK" << endl;
			}
			else
			{
				cout << "NA" << endl;
			}
		}
	}

	return 0;
}

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

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

using namespace std;

int main() {
    int n;
    vector<int> s(3);

    while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
        sort(s.begin(), s.end());

        // REP(i, 3) cout << s[i] << " ";
        // cout << endl;

        double size = sqrt(s[0] * s[0] + s[1] * s[1]);

        // cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;

        REP(i, n) {
            double r;
            cin >> r;
            // cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
            if ( r * 2 <= size )
                cout << "NA";
            else
                cout << "OK";
            cout << endl;

        }

    }

    return 0;
}

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


int main(){
    int i;
    
    int size[3];
    cin >> size[0] >> size[1] >> size[2];
    int NumOfHole;
    cin >> NumOfHole;
    int *radius;
    radius = new int[NumOfHole];
    for(i=0;i<NumOfHole;i++){
        cin >> radius[i];
    }
    int check[3];
    cin >> check[0] >> check[1] >> check[2];
    if(check[0]!=0 || check[1]!=0 || check[2]!=0){
        cout << "Misloading\n";
        return 0;
    }
    
    int max;
    int vmax=0;
    for(i=0;i<3;i++){
        if(vmax < size[i]){
            vmax=size[i];
            max=i;
        }
    }
    int obst=0;
    for(i=0;i<3;i++){
        if(i!=max){
            obst += size[i]*size[i];
        }
    }
    for(i=0;i<NumOfHole;i++){
        if(obst < 4*radius[i]*radius[i]){
            cout << "OK\n";
        }else{
            cout << "NA\n";
        }
    }
    
    return 0;
}

C++: #include<iostream>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	vector<int> args(3);
	while(cin>>args[0]>>args[1]>>args[2], args[0]||args[1]||args[2]){
		sort(args.begin(),args.end());
		int n;
		cin>>n;
		//double d  = args[0]*args[0] + args[1]*args[1];
		//cout<<args[0]<<":"<<args[1]<<endl;
		for(int x=0;x<n;++x){
			int r;
			cin>>r;
			double l = sqrt(2)*r;
			if(l>args[0] && l>args[1]){
				cout<<"OK"<<endl;
			}else{
				cout<<"NA"<<endl;
			}
		}
	}
	return 0;
}

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

int main(){
	int x,y,z;
	while(1){
		cin >> x >> y >> z;
		if(x+y+z==0) break;
		int a = max(max(x,y),z);
		int b = min(min(x,y),z);
		int c = x+y+z-a-b;
		int l = b*b+c*c;
		int n;
		cin >> n;
		int s;
		for(int i=0;i<n;i++){
			cin >> s;
			if(s*s*4>l) cout << "OK" << endl;
			else        cout << "NA" << endl;
		}
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
	int p,a,b,c,i,n,x;
	while(1)
	{
	scanf("%d %d %d",&a,&b,&c);
	if(a==0)return 0;
	if(a<c){
		p=a;
		a=c;
		c=a;
	}
	if(a<b){
		p=a;
		a=b;
		b=a;
	}
	double r=sqrt(b*b+c*c);
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&x);
		if(r<(double)x*2)printf("OK\n");
		else printf("NG\n");
	}
	}
}

C++: #include <iostream>
int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}

C++: #include<iostream>
using namespace std;
int main(){
  int n,tate,yoko,high,hole,large;
  while(1){
    cin >> tate >> yoko >> high;
    if(tate==0 && yoko==0 && high==0){
      break;
    }
    cin >> n;
    if(tate>=yoko && tate>=high){
      large=tate;
    }
    else if(yoko>=tate && yoko>=high){
      large=yoko;
    }
    else if(high>=tate && high>=yoko){
      large=high;
    }
    for(int i=0;i<n;i++){
      cin >> hole;
      hole=hole*2;
      if(hole>large){
	cout << "OK" << endl;
      }
      else{
	cout << "NA" << endl;
      }
    }
  }
  return (0);
}