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<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	int a[3];
	while(a[0]=in(),a[1]=in(),a[2]=in()){
		int n=in();
		int i;
		sort(a,a+3);
		for(i=0;i<n;i++){
			int sz=in();
			if(a[0]*a[0]+a[1]*a[1]<4*sz*sz)cout<<"OK"<<endl;
			else cout<<"NA"<<endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int a, b, c;
	while (cin >> a >> b >> c, a || b || c) {
		int n; cin >> n;
		vector<double>R(n);
		rep(i, 0, n)cin >> R[i];
		int m = max(a, max(b, c));
		double x, y;
		if (m == a) {
			x = b; y = c;
		}
		else if (m == b) {
			x = a; y = c;
		}
		else {
			x = a; y = b;
		}

		double z = sqrt(x*x + y*y) / 2.0;

		rep(i, 0, n) {
			if (z < R[i])cout << "OK" << endl;
			else cout << "NA" << endl;
		}

	}
	return 0;
}

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	long long int a,s,d,f,g[100000],h,i,j,z,x,c,q[4];
	while(1){
			scanf("%lld %lld %lld",&a,&s,&d);
			if(a==0&&s==0&&d==0)	break;
		scanf("%lld",&f);
		for(i=0;i<f;i++)	scanf("%lld",&g[i]);
		q[0]=a*a+s*s;
		q[1]=a*a+d*d;
		q[2]=s*s+d*d;
		for(i=0;i<f;i++){
			j=(g[i]*2)*(g[i]*2);
			if(j<q[0]&&j<q[1]&&j<q[1])	printf("NA\n");
			else	printf("OK\n");
		}
	}
	return 0;
}

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

int main(){
  int i,j,n,a[3],flag,r;
  int na[3];
  while(1){
    cin >> a[0] >> a[1] >> a[2];
    if(a[0] == 0 && a[1] == 0 && a[2] == 0) break;
    cin >> n;

    for(i=0;i<2;i++) na[i] = a[i] * a[i] + a[i+1] * a[i+1];
    na[2] = a[2]*a[2] + a[0] * a[0];

    for(i=0;i<n;i++){
      cin >> r;
      flag = 0;
      for(j=0;j<3;j++){
	if(r*r*4 > na[j]){
	  flag = 1;
	  break;
	}
      }

      if(flag == 1) cout << "OK" << endl;
      else cout << "NA" << endl;
    }


  }
  return 0;
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
	/*(^(^(^(^(^o^)^)^)^)^) &#9602;&#9605;&#9607;&#9608;&#9619;&#9618;&#9617;('ω')&#9617;&#9618;&#9619;&#9608;&#9607;&#9605;&#9602; */
	double a,b,c,d,e;
	while(1){
	scanf("%lf%lf%lf",&a,&b,&c);
	if(a==0 && b==0 && c==0) break;
if(a<b){
	int w=a;
	a=b;
	b=w;
}
if(a<c){
	int w=a;
	a=c;
	c=w;
}
if(b<c){
	int w=b;
	b=c;
	c=w;
}
double u=sqrt(b*b+c*c);
int i,n;
scanf("%d",&n);
for(i=0;i<n;i++){
int se;
scanf("%d",&se);
if(se*2>u) printf("OK\n");
else printf("NA\n");
}
}
	return 0;
}

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

//0107
int main(){
	int n, x, y, z, r, x2, y2, z2;
	while(cin >> x >> y >> z, x+y+z){
		x2=x*x;
		y2=y*y;
		z2=z*z;

		cin >> n;
		while(n--){
			cin >> r;
			cout << ((4*r*r > min(x2+y2, min(y2+z2, z2+x2))) ? "OK" : "NA");
			cout << endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  double a[3];
  while(cin>>a[0]>>a[1]>>a[2],a[2]){
    int n;
    sort(a,a+3);
    double m=sqrt(a[1]*a[1]+a[0]*a[0]);
    cin>>n;
    while(n--){
      double p;
      cin>>p;
      if(p*2>m)cout<<"OK"<<endl;
      else cout<<"NA"<<endl;
    }
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    while(true){
        int d,w,h,n,r[10000],a=0,b=0;
        float c=0;
        cin>>d>>w>>h;
        if(d+w+h==0)break;
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>r[i];
        }
        a=d;
        if(a>w){
            swap(a,w);
        }
        b=w;
        if(w>h){
            b=h;
        }
        c=a*a+b*b;
        c=sqrt(c);
        for(int i=0;i<n;i++){
            if(2*r[i]>c)cout<<"OK"<<endl;
            else{
                cout<<"NA"<<endl;
            }
        }
    }
}

C++: //============================================================================
// Name        : aoj0107.cpp
// Author      : afterCmidday
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cmath>
#include <string>
using namespace std;


// f(x) = x
// x ^ 2 + y ^ 2 = r ^ 2
// x ^ 2 + x ^ 2 = r ^ 2
// x ^ 2 = r ^ 2 / 2
// x = r / root(2)

// case height <= r * root(2) && width <= r * root(2)

int main() {
	int height, width, depth, n, r;
	while(true){
		cin >> height >> width >> depth;
		if(height == 0 && width == 0 && depth == 0){
			break;
		}
		cin >> n;
		for(int i = 0;i < n;i++){
			cin >> r;
			string ans = "NA";
			if(width <= r * sqrt(2) && height <= r * sqrt(2) || width <= r * sqrt(2) && depth <= r * sqrt(2) || height <= r * sqrt(2) && depth <= r * sqrt(2)){
				ans = "OK";
			}
			cout << ans << endl;
		}
	}
	return 0;
}

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

int main(){
  std::vector<int> size;
  int x, n, r;
  
  std::cin >> size[0];
  std::cin >> size[1];
  std::cin >> size[2];
  std::sort(size.begin(), size.end());
  
  while(size[0]==0 && size[1]==0 && size[2]==0){
    std::cin >> n;
    for(int i=0; i<n; i++){
      std::cin >> r;
      if(r>size[1]){
        std::cout << "OK" << std::endl;
      }else{
        std::cout << "NA" << std::endl;
      }
    }
    std::cin >> size[0];
    std::cin >> size[1];
    std::cin >> size[2];
    std::sort(size.begin(), size.end());
  }
  
  return 0;
}

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

int main(void){
        int d,w,h;
        int size;
        int n,r;
        while(1) {
                cin>>d>>w>>h;
                if(d==0 and w==0 and h==0) return 0;
                cin>>n;
                size=min(d*d+w*w,min(d*d+h*h,w*w+h*h));
                for(int i=0;i<n;i++){
                    cin>>r;
                    if(size<4*r*r){//size**0.5<2*r;
                        cout<<"OK"<<endl;
                    }
                    else{
                        cout<<"NA"<<endl;
                    }
                }
        }

}