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++: #include <iostream>
using namespace std;

int main()
{
	int iCount, ia, ib, ic;
	int *iTrueFlag;

	cin >> iCount;

	iTrueFlag = new int[iCount];

	for( int i=0;i<iCount;i++ ){
		cin >> ia >> ib >> ic;

		if( (ia * ia) + (ib * ib) == ( ic * ic ) )
			iTrueFlag[i] = 1;
		else
			iTrueFlag[i] = 0;
	}

	for( int i=0;i<iCount;i++ ){
		if( iTrueFlag[i] == 1 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}

	return 0;
}

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

bool solve(int x,int y,int z) ;

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

	bool ans = false ;

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

		if( a > b )
		{
			if( a > c )		// 最大値はa
			{
				ans = solve(a,b,c) ;
			}
			else if( a < c )	// 最大値はc
			{
				ans = solve(c,a,b) ;
			}
		}
		else if( a < b )
		{
			if( b > c )		// 最大値はb
			{
				ans = solve(b,a,c) ;
			}
			else if( b < c )	// 最大値はc
			{
				ans = solve(c,a,b) ;
			}
		}

		if( ans == true ){ cout << "YES\n" ; }
		else{ cout << "NO\n" ; }
	}
	return 0 ;
}

bool solve(int x,int y, int z)
{
	if( x*x == (y*y + z*z) )
	{
		return true ;
	}
	else
	{
		return false ;
	}
}

C++: #include <iostream>
int main(){

	int n;
	int sd[3];
	int max,m=-1;
	bool isRect=false;
	bool isTri=true;

	cin>>n;

	for(int i=0;i<n;++i){
		cin>>sd[0]>>sd[1]>>sd[2];
		//長辺の判定
		max=0;
		for(int i=0;i<3;++i){
			if(sd[i]==0){isTri=false;}
			if(sd[i]>max){m=i;max=sd[i]}
		}

		//直角三角形の判定
		if(isTri){
			switch(m){
			case 0:
				if(sd[0]*sd[0] == (sd[1]*sd[1] + sd[2]*sd[2])){isRect=true;}else{isRect=false;}
				break;
			case 1:
				if(sd[1]*sd[1] == (sd[0]*sd[0] + sd[2]*sd[2])){isRect=true;}else{isRect=false;}
				break;
			case 2:
				if(sd[2]*sd[2] == (sd[1]*sd[1] + sd[0]*sd[0])){isRect=true;}else{isRect=false;}
				break;
			}
		}

		if(isRect){cout<<"YES\n";}else{cout<<"NO\n";}

	}
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int       stoi( const std::string& str, size_t *pos = 0, int base = 10 )
{
    return std::strtol(str.c_str(), pos, base);
}
struct triangle
{
    triangle() { leg1 = leg2 = leg3 = 0; }
    bool isHyp()
    {
        if (leg1*leg1 + leg2*leg2 == leg3*leg3 || leg2*leg2 + leg3*leg3 == leg1*leg1 || leg3*leg3 + leg1*leg1 == leg2*leg2)
            return true;
        return false;
    }
    int leg1;
    int leg2;
    int leg3;
};
int main()
{
    int j;
    cin >> j;
    triangle* triData = new triangle[j];
    bool* results = new bool[j];
    string s;
    for (int i = 0; i < j; i++)
    {
        getline(cin, s, ' ');
        triData[i].leg1 = stoi(s);
        s.clear();
        getline(cin, s, ' ');
        triData[i].leg2 = stoi(s);
        s.clear();
        getline(cin, s);
        triData[i].leg3 = stoi(s);
        results[i] = triData[i].isHyp();
    }
    for (int i = 0; i < j; i++)
    {
        cout << (results[i] ? "YES" : "NO") << endl;
    }
    
    
    
    delete [] results;
    delete [] triData;
}

C++: #include <iostream>
using namespace std ;
 
bool solve(int x,int y, int z)
{
    if( (x * x) == (y * y + z * z) )
    {
        return true ;
    }
 
    return false ;
}
 
int main()
{
    int N ;
    cin >> N ;
 
    bool ans = false ;
 
    for( int i = 0 ; i < N ; i ++ )
    {
        int a,b,c ;
        cin >> a >> b >> c ;
 
        if( a >= b )
        {
            if( a >= c )      // 最大値はa
            {
                ans = solve(a,b,c) ;
            }
            else if( a < c ) // 最大値はc
            {
                ans = solve(c,a,b) ;
            }
        }
        else if( a < b )
        {
            if( b >= c )      // 最大値はb
            {
                ans = solve(b,a,c) ;
            }
            else if( b < c ) // 最大値はc
            {
                ans = solve(c,a,b) ;
            }
        }
 
        if( ans ){ cout << "YES" << endl ; }
        else{ cout << "NO" << endl ; }
    }
    return 0 ;
}

C++: #include <iostream>

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*a==b*b+c*c)
			cout << "YES" << endl;
		else if(b*b==c*c+a*a)
			cout << "YES" << endl;
		else if(c*c==a*a+b*b)
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <array>
#include <algorithm>
#include <functional>

using namespace std;


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

	vector<bool> result(n);

	array<int, 3> triangle;
	for(int i = 0; i < n; i++){
		cin >> triangle[0] >> triangle[1] >> triangle[2];

		sort(begin(triangle), end(triangle), less<int>());

		const auto square = bind(pow<int, int>, placeholders::_1, 2);
		result[i] = 
			square(triangle[0]) == square(triangle[1]) + square(triangle[2]);
	}

	for(const bool& b : result){
		cout << (b ? "YES" : "NO");
	}

	return 0;
}

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

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

	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,a[3];

int main(){
    cin>>N;
    rep(i,N){
        rep(j,3){
            cin>>a[i];
        }
        sort(a,a+3);
        if(pow(2,a[0])+pow(2,a[1])==pow(2,a[2])){
            out("Yes");
        }
        else{
            out("No");
        }
    }
}

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

int main(){
        int n,a,b,c;
        std::cin >> n;
        for(int i=0;i<n;i++){
                std::cin >> a >> b >> c;
                std::multiset<int> st;
                st.insert(a);
                st.insert(b);
                st.insert(c);
                std::multiset<int>::iterator itr=st.begin();
                a = *itr; a = a*a;itr++;
                b = *itr; b = b*b;itr++;
                c = *itr; c = c*c;itr++;
                if(a+b == c) std::cout << "YES" << std::endl;
                else std::cout << "NO" << std::endl;
        }
        return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  vector<int> ar;
  int n;
  int d;
  cin >> n;
  for(int i=0;i<n;i++){
    for(int j=0;j<3;j++){
      cin >> d;
      ar.push_back( d );
    }
    sort( ar.begin() , ar.end() , greater<int>() );
    int a = ar[0] * ar[0];
    int b = ar[1] * ar[1];
    int c = ar[2] * ar[2];
    if(a == (b + c)){
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }
    ar.clear();
  }
}

C++: 
#include<iostream>
using namespace std;
int main(){
  int a,b,c,n,tmp;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a>>b>>c;
    if(a<b){
      tmp=a;
      a=b;
      b=tmp;
    }
    if(a<c){
      tmp=a;
      a=c;
      c=tmp;
    }
    if(a*a==b*b+c*c){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}