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<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(){
	stringstream buf;
	int a,b,c,n;
	scanf("%d %d %d %d",&a,&b,&c,&n);
	vector<int> args;
	args.push_back(a);
	args.push_back(b);
	args.push_back(c);
	sort(args.begin(),args.end());
	double d = sqrt(args[0]*args[0]+args[1]*args[1]);
	for(int x=0;x<n;++x){
		int r;
		scanf("%d",&r);
		double l = sqrt(2)*r;
		if(d<2*r){
			buf<<"OK\n";
		}else{
			buf<<"NA\n";
		}
	}
	scanf("%d %d %d",&a,&b,&c);
	cout<<buf.str();
	return 0;
}

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

using namespace std;
int main()
{
	int n;
	double  a,x,y,z,r,i,j,rad;
	
	for(;;)
	{
		cin >> x >> y >> z;
		if(x==0 && y==0 && z==0)
			break;
		cin >> n;
		x/=2;
		y/=2;
		z/=2;
		if(x>y)
		{
			a=x;
			x=y;
			y=a;
		}
		if(x>z)
		{
			a=x;
			x=z;
			z=a;
		}
		if(y>z)
		{
			a=y;
			y=z;
			z=a;
		}
		if(x<y)
		{
			a=x;
			x=y;
			y=a;
		}
		for(i=0;i<n;i++)
		{
			cin >> r;
			if(sqrt(x*x+y*y)<r)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}
}

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

int main()
{
  int m[3];
  int n;

  while (cin >> m[0] >> m[1] >> m[2], m[0] || m[1] || m[2]){
    sort(m, m + 3);
    int S = m[0] * m[0] + m[1] * m[1];
    int n, num;
    cin >> n;
    while (n--){
      cin >> num;
      double size = num * num * M_PI;
      cout << (S < size ? "OK" : "NA") << endl;
    }
  }
  return (0);
}

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


using namespace std;

int main()
{
	int t[3];
	while (scanf("%d %d %d", t, t+1, t+2), t[0] | t[1] | t[2])
	{
		sort(t, t+3);
		double len = sqrt((double)t[0]*t[0]+t[1]*t[1]);
		int n;
		scanf("%d", &n);
		for (int i = 0; i < n; ++i)
		{
			int r;
			scanf("%d", &r);
			if (len < 2.0 * r)
				printf("OK\n");
			else
				printf("NA\n");
		}
	}

	return 0;
}

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

#define PI 3.14159265359
#define R  1.41421356237

using namespace std;

int main(){
	int x,y,h;
	int m,n,t,c=0;
	int r[10000];

	cin >> x >> y >> h >> n;
	
	//detect most small surface
	m = x*y;
	if(m>x*h)m = x*h;
	if(m>y*h)m = y*h;

	for(int i=0;i<n;i++){
		cin >> t;

		if(t==0){
			if(++c==3){
				break;
			}
		}

		if(m<2*t*t){
			if((t*R>x&&t*R>y)||(t*R>x&&t*R>h)||(t*R>h&&t*R>y)){
				r[i] = 1;
			}else{
				r[i] = 0;
			}
		}else{
			r[i] = 0;
		}
	}


	for(int i=0;i<n;i++){
		if(r[i]==0){
			cout << "NA" << endl;
		}else{
			cout << "OK" << 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];
        }
    }
    cout << "obst:" << obst;
    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>
using namespace std;
int main(){
	int d,w,h,r,n,rd;
	while(cin>>d>>w>>h){
		if(d==0&&w==0&&h==0)break;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>r;
		rd=r*2;
		if(d<rd&&w<rd&&h<rd){
			cout<<"OK"<<endl;
			continue;
		}
		else cout<<"NA"<<endl;
	}
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
    int x,y,z;
    while(1){
      cin>>x>>y>>z;
      if(x==0&&y==0&&z==0) return 0;
      int n;
      cin>>n;
      int a[10000];
      for(int i=0;i<n;i++){
        cin>>a[i];
      }
      double b[3];
      b[0]=sqrt(x*x+y*y);
      b[1]=sqrt(z*z+y*y);
      b[2]=sqrt(x*x+z*z);
      sort(b,b+3);
      double min=b[0];
      for(int i=0;i<n;i++){
          if((double)a[i]>(0.5*min)) cout<<"OK"<<endl;
          else cout<<"NA"<<endl;
      }
    }       
}

C++: #include <stdio.h>

int main(void)
{
	int w, l, h;
	int n;
	int i;
	int x;
	
	while (1){
		scanf("%d %d %d", &w, &l, &h);
		if (w == 0 && l == 0 && h == 0)break;
		
		if (w > h){
			w += h;
			h = w - h;
			w -= h;
		}
		if (l > h){
			l += h;
			h = h -l;
			l -= h;
		}
		if (w > l){
			w += l;
			l = w - l;
			w -= l;
		}
		scanf ("%d", &n);
		
		for (i = 0; i < n; i++){
			scanf("%d", &x);
			
			if (w * l <= x * x / 2 * 3.141592 && w <= x && l <= x * 2){
				printf("OK\n");
			}else {
				printf("NA\n");
			}
		}
	}
	
	return (0);
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
 
int main(){
 
    double d,w,h,r,min,dw,wh,hd;
    int n;
 
    while(true){
        scanf("%lf %lf %lf",&d,&w,&h);
        if(d == 0.0 && w == 0.0 && h == 0.0)break;
 
        scanf("%d",&n);
 
        for(int i=0; i < n; i++){
            scanf("%lf",&r);
            dw = (sqrt(d*d+w*w))/2.0;
            wh = (sqrt(w*w+h*h))/2.0;
            hd = (sqrt(d*d+h*h))/2.0;
            min = min(dw,min(wh,hd));
            if(r > min){
                printf("OK\n");
            }else{
                printf("NA\n");
            }
        }
    }
    return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<algorithm>
//#define M(a,b) a<b?a:b
int main(){
	int a,b,c,n,r;
	for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
		for(scanf("%d",&n);n--;){
			scanf("%d",&r);
			puts(
				(2.*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
				"OK":"NA"
			);
		}
	}
}

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

int main(){
	int n, x, y, z, r;
	while( cin >> z >> x >> y, x||y||z ){
		cin >> n;
		int i=0;
		for( i=0; i<n; i++ ){
			cin >> r;
			int l = min( x*x+y*y, y*y+z*z );
			l = min( l, z*z+x*x );
			cout << ((4*r*r>l)?"OK":"NA") << endl;
		}
	}
	return 0;
}

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

int main(void)
{
	int a[3], n, b;
	while (scanf("%d %d %d", &a[0], &a[1], &a[2]), a[0]){
		sort(a, a + 3);
		int r = a[0]*a[0] + a[1]*a[1];
		cin >> n;
		for (int i = 0; i < n; i++){
			cin >> b;
			if (r < (b*2)*(b*2)) cout << "OK" << endl;
			else cout << "NA" << endl;
		}
	}
	
	return 0;
}

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

using namespace std;

int main () {
	int d, w, h, n, r;
	while(true) {
		cin >> d >> w >> h;
		if (!d && !w && !h) break;

		int diagonal = min({
			d * d + w * w,
			d * d + h * h,
			h * h + w * w
		});

		cin >> n;
		while (n--) {
			cin >> r;
			cout << ((r * r * 4 > diagonal) ? "OK" : "NA") << endl;
		}
	}
	return 0;
}