Go: package main

import "fmt"

func main() {
	var n int

	fmt.Scanf("%d", &n)

	var a, b, c int
	for i := 0; i < n; i++ {
		var isTriangle bool
		fmt.Scanf("%d %d %d", &a, &b, &c)

		if a*a == b*b+c*c || b*b == a*a+c*c || c*c == b*b+a*a {
			isTriangle = true
		}

		if isTriangle == true {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: /*
    AOJ Volume0 0003

        Is it a Right Triangle?

        Write a program which judges wheather given length of three side form a right triangle.
        Print "YES" if the given sides (integers) form a right triangle, "NO" if not so.
        
        Input
            Input consists of several data sets. In the first line, the number of data set, N is given.
            Then, N lines follow, each line corresponds to a data set.
             A data set consists of three integers separated by a single space.

        Constraints
            1 ≤ length of the side ≤ 1,000
            N ≤ 1,000

        Output
            For each data set, print "YES" or "NO".

        Sample Input
            3
            4 3 5
            4 3 6
            8 8 8

        Output for the Sample Input
            YES
            NO
            NO
*/

#include <iostream>


bool is_right_triangle(int edge1, int edge2, int edge3)
{
    int edge[3] = { edge1, edge2, edge3 };
    int longest = 0;
    int other1 = 1, other2 = 2;

    for(int i=1; i<3; ++i)
    {
        if(edge[i] > edge[longest])
        {
            longest = i;
            if(longest == 1){ other1 = 0; other2 = 2; }
            if(longest == 2){ other1 = 0; other2 = 1; }
        }
    }

    int aa = edge[other1] * edge[other1];
    int bb = edge[other2] * edge[other2];
    int cc = edge[longest] * edge[longest];

    return aa + bb == cc;
}


int main(void)
{
    int N;
    std::cin >> N;

    for(int i=0; i<N; i++)
    {
        int e, f, g;
        std::cin >> e >> f >> g;

        bool ans = is_right_triangle(e,f,g);
        std::cout << (ans ? "YES" : "NO") << std::endl;
    }

    return 0;
}

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

int main(void)
{
  int n;
  int a, b, c;
  int i;
  int temp;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> a >> b >> c;
    if(a < b){
      temp = a;
      a = b; 
      b = temp;
    }
    if(a < c){
      temp = a;
      a = c;
      c = temp;
    }
    
    if(a*a == b*b + c*c){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }

  return 0;
}

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

int main(){
	int a,b,c,d,i;
	cin>>i;
	for(int n=0;n<i;n++;){
 		cin>>a>>b>>c;
  		if(a<b){d=a,a=b,b=a;}
   		else if(a<c){d=a,a=c,c=d;}
   		if(a*a==b*b+c*c){cout<<"Yes"<<endl;}
   		else {cout<<"No"<<endl;}
   	}   
	return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int long long i=0;i<n;i++)
using namespace std;
char t[7];
int main(){
    int n;
    cin>>n;
    while(n>0){
    vector<int> v(3);
    rep(i,3){
        int x;
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end(),greater<int>());
    if(v[0]==sqrt(v[1]*v[1]+v[2]*v[2])){
        cout<<"YES"<<endl;
    }else{
        cout<<"N0"<<endl;
    }
        n--;
    }
    
    return 0;
}

C++: #include <stdio.h>

#define YES 1
#define NO 0

int tri_judge(int x, int y, int z);
int pow2(int x);

int main(void)
{
    int dataset;
    scanf("%d", &dataset);

    int side1, side2, side3;
    while (dataset--){
        scanf("%d %d %d", &side1, &side2, &side3);
        int yn = tri_judge(side1, side2, side3);
        if (yn == YES){
            printf("YES\n");
        } else {
            printf("NO\n");
        }

    }

    return 0;
}

int tri_judge(int x, int y, int z)
{
    int yn;

    if (pow2(x) == pow2(y) + pow2(z)){
        yn = YES;
    } else if (pow2(y) == pow2(z) + pow2(x)){
        yn = YES;
    } else if (pow2(z) == pow2(x) + pow2(y)){
        yn = YES;
    } else {
        yn = NO;
    }

    return yn;
}

int pow2(int x)
{
    return x * x;
}

C++: #include<iostream>

int main(){
	int a,b,c,i,n;

	std::cin>>n;

	for(i=0;i<n;i++){
		std::cin>>a>>b>>c;
		if(a*a==b*b+b*b){
			std::cout<<"YES"<<std::endl;
			}
		else if(b*b==a*a+c*c){
			std::cout<<"YES"<<std::endl;
			}
		else if(c*c==a*a+b*b){
			std::cout<<"YES"<<std::endl;
			}
		else std::cout<<"NO"<<std::endl;
		}

	return 0;
	}

C++: #include <iostream>

using namespace std;

int main(){
    int t, n[3];
    cin >> t;
    while(t--){
        cin >> n[0] >> n[1] >> n[2];
        sort( n, n+2);
        for(int i=0;i<3;i++) n[i]*=n[i];
        if(n[2]-n[0]-n[1]) cout << "NO" <<endl;
        else cout << "YES" <<endl;
    }
    return 0;
}

C++: /* AOJ0003 */
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
  int n;
  cin >> n;
  while(n--){
    int a, b, c;
    cin >> a >> b >> c;
    if(a < b) swap(a, b);
    if(a < c) swap(a, c);
    cout << (a * a == b * b + c * c ? "YES" : "NO" ) << endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main()
{
	int x,N,L1,L2,L3,max,a1,a2;
	scanf("%d",&N);
	for(x=0; x<N; x++)
	{
		max=1;
		scanf("%d %d %d",&L1,&L2,&L3);
		if(L1<L2)
			max=2;
		if(L2<L3)
			max=3;
		if(max==1)
		{
			a1=L1*L1;
			a2=L2*L2+L3*L3;
			if(a1==a2)
				printf("YES\n");
			else
				printf("NO\n");
		}
		if(max==2)
		{
			a1=L2*L2;
			a2=L1*L1+L3*L3;
			if(a1==a2)
				printf("YES\n");
			else
				printf("NO\n");
		}
		if(max==3)
		{
			a1=L3*L3;
			a2=L1*L1+L2*L2;
			if(a1==a2)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
	return 0;
}

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

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

    int n,a,b,c;
    bool f;
    std::cin >> n;
    while (std::cin >> a >> b >> c) {
        f = false;
        if (c*c == a*a+b*b) {
            f = true;
        } else if (a*a == b*b+c*c) {
            f = true;
        } else if (b*b == c*c+a*a) {
            f = true;
        } else {
            std::cout << "NO" << std::endl;
        }
        if (f) {
            std::cout << "YES" << std::endl;
        }
    }
    return EXIT_SUCCESS;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    int n;
    cin >> n;

    rep(i, n)
    {
        vector<int> v(3);

        rep(i, 3) cin >> v[i];

        sort(ALL(v));

        if (v[2] * v[2] == v[1] * v[1] + v[0] * v[0])
        {
            OP("YES")
        }
        else
        {
            OP("NO")
        }
    }

    return 0;
}

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


#ifndef DEBUG 
#define fprintf (void)
#endif 

int main(void){
	
	long int rec,i,j,t;
	int count=0;
	long int n[3]={0,0,0};
	
	scanf("%ld",&t);
	
	for(i=0;i<t;i++){
		for(j=0;j<3;j++){
			scanf("%ld",&rec);
			if(rec==0){
				count=1;
			}
			if(rec>n[0]){
				n[2]=n[1];
				n[1]=n[0];	
				n[0]=rec;
			}else if(rec>n[1]){
				n[2]=n[1];
				n[1]=rec;
			}else if(rec>n[2]){
				n[2]=rec;
			}
		}
		if(count==1){
			fprintf(stdout,"invalid");
			printf("NO\n");
		}else if(n[0]*n[0]==n[1]*n[1]+n[2]*n[2]){
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int  a, j, b, cnt, i, n, A = 0, B = 0, c;
	while (scanf("%d %d %d", &a, &b, &c) != EOF) {
		if (a == b && a == c) {
			printf("YES\n");
		}
		else {
			printf("NO\n");
		}
	}
}