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>

using namespace std;
/** Problem0107 : Carry a Cheese **/
int main()
{
	int x, y, z, r, n;
	
	while (1) {
		cin >> x >> y >> z;
		if (x == 0 && y == 0 && z==0)
			break;
	
		cin >> n;
		for (int i=0; i<n; i++) {
			cin >> r;
			if (2*r*2*r > x*x+y*y || 4*r*r > x*x+z*z || 4*r*r > y*y+z*z)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}

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

double minDiagonal(int a, int b, int c) {
    if (a >= b && a >= c) {
        return sqrt(b * b + c * c);
    } else if (b >= a && b >= c) {
        return sqrt(a * a + c * c);
    } else {
        return sqrt(a * a + b * b);
    }
}

int main() {
    while (true) {
        int a, b, c;
        cin >> a >> b >> c;
        if (a == 0 && b == 0 && c == 0) {
            break;
        }
        double diagonal = minDiagonal(a, b, c);
        int n;
        cin >> n;
        for (int i = 0; i < n; i++) {
            int radius;
            cin >> radius;
            if (diagonal < radius * 2) {
                cout << "OK" << endl;
            } else {
                cout << "NA" << endl;
            }
        }
    }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, c, n;
	float tmp;
	
	while(1){
		cin >> a >> b >> c;
		if(a == 0){
			break;
		}
		cin >> n;
		for(int i = 0; i < n; i++){
			cin >> tmp;
			tmp = tmp*tmp*3.1415/2.0;
			if(tmp > a*b || tmp > b*c || tmp > c*a){
				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;
        }
        scanf("%d",&temp);
        for(int i=0;i<temp;i++){
            scanf("%d",&n);
            if(n>=a)printf("OK\n");
            else printf("NA\n");
        }
        
    }
}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  long ver,hor,height;
  while(1){
    cin>>ver>>hor>>height;
    if(!ver && !hor && !height)break;
    int n;
    int dis[3];
    dis[0]=sqrt(ver*ver+hor*hor);
    dis[1]=sqrt(hor*hor+height*height);
    dis[2]=sqrt(height*height+ver*ver);
    cin>>n;
    rep(i,n){
      int r;
      cin>>r;
      int cnt=0;
      rep(i,3){
	if(2*r>dis[i])cnt++;
      }
      if(cnt==0)cout<<"NA"<<endl;
      else cout<<"OK"<<endl;
    }
  }
  return 0;
}

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

using namespace std;

int main(){
	while(true){
		vector<int> size(3);
		cin >> size[0] >> size[1] >> size[2];
		if(size[0] == 0 && size[1] == 0 && size[2] == 0){ break; }
		sort(size.begin(), size.end());
		int n;
		cin >> n;
		while(n--){
			int r;
			cin >> r;
			if(4 * r * r > size[0] * size[0] + size[1] * size[1]){
				cout << "OK" << endl;
			}else{
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	double r[3];
	while (cin >> r[0] >> r[1] >> r[2]){
		if (r[0] == 0 && r[1] == 0 && r[2] == 0){break;}
		sort(r, r + 3);
		double n = sqrt(r[0] * r[0] / 4 + r[1] * r[1] / 4);
		int num; cin >> num;
		for (int i = 0; i < num; i++){
			double a; cin >> a;
			if (a >= n)
				cout << "OK";
			else cout << "NA";
			cout << endl;
		}
	}
	return 0;
}

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<string>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	while(1) {
		int a, b, c;
		cin >> a >> b >> c;
		vector<int>s{ a,b,c };
		if (!a && !b && !c)break;
		sort(s[0],s[1]);
		int d;
		cin >> d;
		for (int e = 0; e < d; e++) {
			int f;
			cin >> f;
			if (f*2>s[1])cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
  int size[3];
  while(~scanf("%d %d %d", &size[0], &size[1], &size[2]) && size[0] && size[1] && size[2]){
      sort(size, size + 3);
      double can = sqrt(size[0] * size[0] + size[1] * size[1]);
      int n;
      scanf("%d", &n);
      while(n--){
        int r;
        scanf("%d", &r);
        printf("%s\n", can < r * 2 ? "OK" : "NA");
      }
  }
  return 0;
}

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

class Cheese{
public:
	int x;
	int y;
	int z;
	double gr[3];

	double CalcGr(int x, int y){
		return sqrt((double)(x*x + y*y)) / 2;
	}

	Cheese(){
//		scanf("%d %d %d", &x, &y, &z);
		std::cin >> x >> y >> z;
		gr[0] = CalcGr(x, z);
		gr[1] = CalcGr(x, y);
		gr[2] = CalcGr(y, z);
	}
};

int main(){
	Cheese c;
	
	int n;
//	scanf("%d", &n);
	std::cin >> n;

	double r;
	for (int i = 0; i < n; i++){
//		scanf("%d", &r);
		std::cin >> r;
		if (c.gr[0] < r || c.gr[1] < r || c.gr[2] < r){
			printf("OK\n");
		}
		else{
			printf("NA\n");
		}
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;

double lng(int a, int b){
    double res = sqrt(a*a+b*b);
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    double d,w,h;
    int n;
    while(cin >> d >> w >> h){
        if(!d && !w && !h) break;
        cin >> n;
        double l1 = lng(d,w);
        double l2 = lng(w,h);
        double l3 = lng(h,d);
        double l = min( min(l1,l2), l3 );
        rep(i,n){
            double r;
            cin >> r;
            cout << (2.0*r > l ? "OK" : "NA") << endl;
        }
    }
      
    return 0;
}

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

double h[10000];

int main(){
	int x;
	int y;
	int z;
	int n;
	double xy;
	double yz;
	double zx;
	while ( true ){
		cin >> x >> y >> z;
		if ( !x && !y && !z ){
			break;
		}
		cin >> n;
		for (int  i = 0; i < n; ++i){
			cin >> h[i];
		}
		xy = sqrt( x*x + y*y );
		yz = sqrt( y*y + z*z );
		zx = sqrt( z*z + x*x );
		for (int i = 0; i < n; ++i){
			bool flag = false;
			if( xy < h[i]*2 || yz < h[i]*2 || zx < h[i]*2 ){
				flag = true;
			}
			if ( flag ){
				cout << "OK" << endl;
			} else {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}