Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func main() {
	scanner.Split(bufio.ScanWords)

	nQueries := nextInt()
	for i := 0; i < nQueries; i++ {
		lengths := []int{nextInt(), nextInt(), nextInt()}
		sort.Slice(lengths, func(i, j int) bool { return lengths[i] > lengths[j] })
		if math.Pow(float64(lengths[0]), 2) == math.Pow(float64(lengths[1]), 2)+math.Pow(float64(lengths[2]), 2) {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

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

using namespace std;

int main()
{
    int N, a[3];
    cin >> N;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[j];
        }
        sort(a, a + 3);
        cout << (a[0]*a[0] + a[1]*a[1] == a[2]*a[2] ? "YES" : "NO") << endl;
    }
    return 0;
}

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

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

C++: #include <stdio.h>

void 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);
        judge(side1, side2, side3);
    }

    return 0;
}

void judge(int x, int y, int z)
{
    enum {YES, NO} 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;
    }

    if (yn == YES){
        printf("YES\n");
    } else {
        printf("NO\n");
    }
}

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

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

#define N 1000

struct{int a[3];} d[N];

int main(){
    int i,j,L;
    int longest,small;
    scanf("%d",&j);
    for(i=0; i<j&&i<N; scanf("%d %d %d",&d[i].a[0],&d[i].a[1],&d[i].a[2]),i++);
    L=i;
    for(i=0;i<L;i++){        
        longest=0;
        for(j=0;j<3;j++)
            if(longest<d[i].a[j])
                longest=d[i].a[j];
        for(j=0;j<3;j++)
            if(d[i].a[j]!=longest)
                small+=pow(d[i].a[j],2);
        if(small==pow(longest,2))
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

C++: #include <stdio.h> #include <algorithm> using namespace std; int main(){ int i, n,j,cnt = 0; scanf("%d",&n);int tri[3]; for (i = 0; i < n; i++){ for (j = 0; j < 3; j++){ scanf("%d",&tri[i]); } sort(tri,tri+3); if (tri[0]*tri[0] + tri[1]*tri[1] = tri[2]*tri[2]) cnt++; } printf("%d\n",cnt); return 0; }

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

int main (){
    int  N;
    int a, b, c;
    a <= 1000, b <=1000, c <=1000, N <=1000;
    cin >> N;
    for (int i=0; i < N; i++){
        cin >> a >> b >> c;

        if (a*a == b*b + c*c || b*b == c*c + a*a || c*c == a*a + b*b) {
            cout << "YES" << endl;
        }
        else {
            cout << "NO" << endl;
        }
    }return 0;
}

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


int main(){

	int size;
	cin >> size;

	struct triangle{
		int elm[3];

		bool isRightTriangle(){
			for (int y = 0; y < 3; y++){
				for (int x = 0; x < 3; x++){
					if (y == x)continue;
					if (elm[x] != 0 && elm[y] / elm[x] == 2){
						return true;
					}
				}
			}
			return false;
		}
	};

	triangle *ary = new triangle[3];

	for (int i = 0; i < size; i++){
		cin >> ary[i].elm[0] >> ary[i].elm[1] >> ary[i].elm[2];
	}

	for (int i = 0; i < size; i++){
		cout << (ary[i].isRightTriangle() ? "YES" : "NO") << endl;
	}

	delete[] ary;

	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int dsnum,length[3],i;
	
	scanf("%d",&dsnum);
	
	while(dsnum>0)
	{
		scanf("%d%d%d",&length[0],&length[1],&length[2]);
		
		for(i=0;i<3;i++)
		{
			if(length[i]*length[i]+length[(i+1)%3]*length[(i+1)%3]==length[(i+2)%3]*length[(i+2)%3])
			{
				printf("YES");
				break;
			}
			if(i==2) printf("NO");
		}
		dsnum--;
	}
	return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define ll long long
using namespace std;


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  rep(i, n) {
    int a, b, c;
    cin >> a >> b >> c;
    if ((a * a + b * b == c * c) || (a * a + c * c == b * b) || (b * b + c * c == a * a)) {
      cout << "YES" << "\n";
    } else {
      cout << "NO" << "\n";
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
	{
		int a, b, c;
		bool _bool = false;
		while (cin >> a >> b >> c)
		{
			_bool = false;
			if ( a * a ==( b* b + c * c) || b*b == a*a + b*b || c*c == a* a + b* b)
			{
				_bool = true;
			}
			if (_bool)
			{
				cout << "YES" << endl;
			}
			else
			{
				cout << "NO" << endl;
			}
		}
		return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
int main() {

		int N,A,B;
		cin >> N;
		vi a(N);
		vi b(N);
		vi c(N);
		for (int i = 0; i < N; i++) {
			cin >> a[i] >> b[i] >> c[i];
			A = min(a[i], b[i]);
			B = max(a[i], b[i]);
			if(B>c[i]){
				if (pow(B, 2) == pow(A, 2) + pow(c[i], 2)) {
					cout << "YES" << endl;
				}
				else {
					cout << "NO" << endl;
				}
		}
			else {
				if (pow(c[i], 2) == pow(B, 2) + pow(A, 2)) {
					cout << "YES" << endl;
				}
				else {
					cout << "NO" << endl;
				}
			}

	}

}

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

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

C++: int main(){
    
    int a[3];
    int N;
    int i,j,k,tmp;
    
    cin>>N;
    for(k=0;k<N;k++){
        cin>>a[0]>>a[1]>>a[2];
        for(i=0;i<2;i++){
            for(j=i+1;j<3;j++){
                if(a[j]>a[i]){
                    tmp=a[i];
                    a[i]=a[j];
                    a[j]=tmp;
                }
            }
            
            
        }
        
        if(pow(a[0],2)==pow(a[1],2)+pow(a[2],2)){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    
    }

}

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

void swap( int *a, int *b )
{
	int t = *a;
	*a = *b;
	*b = t;
	
	return;
}

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

 	return 0;
}