Go: ///
// File:  0582.go
// Author: ymiyamoto
//
// Created on Wed Feb 28 22:51:48 2018
//
package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	steep = iota
	orth
	obtuse
)

func max(a, b, c int) (int, int, int) {
	if a < b {
		if b < c {
			return c, a, b
		} else {
			return b, c, a
		}
	} else {
		if a < c {
			return c, a, b
		} else {
			return a, b, c
		}
	}
}

func triangle(a, b, c int) int {
	if a*a == b*b+c*c {
		return orth
	} else if b*b+c*c-a*a > 0 {
		return steep
	} else {
		return obtuse
	}
}

func main() {
	s := bufio.NewScanner(os.Stdin)

	var num, st, or, ob int
	for s.Scan() {
		var a, b, c int
		fmt.Sscan(s.Text(), &a, &b, &c)

		m, n1, n2 := max(a, b, c)
		if m < n1+n2 {
			switch triangle(m, n1, n2) {
			case steep:
				st++
			case orth:
				or++
			case obtuse:
				ob++
			}
			num++
		} else {
			break
		}
	}
	fmt.Println(num, or, st, ob)
}

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

using namespace std;

int main()
{
  int n[3]; 
  int a = 0, b = 0, c = 0;
  while(true)
  {
    cin >> n[0] >> n[1] >> n[2];
    sort(n, n + 3);
    if(n[0] + n[1] <= n[2])
    {
      printf("%d %d %d %d\n", a + b + c, a, b, c);
      return 0;
    }
    double d = pow(n[0], 2) + pow(n[1], 2), v = pow(n[2], 2);
    
    if(d == v)
      a++;
    else if(d > v)
      b++;
    else if(d < v)
      c++;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
	vector<int> vec(4, 0);
	int b, a, c;
	while(cin >> a >> b >> c)
	{
		vector<int> v;
		v.push_back(a);
		v.push_back(b);
		v.push_back(c);
		sort(v.begin(), v.end());
		int a1 = v[2] * v[2];
		int b1 = v[1] * v[1];
		int c1 = v[0] * v[0];
		if(!(abs(b - c) < a && a < b + c))
		{
			for(int i = 0; i < 4; i++)
			{
				if(i == 3)
					cout << vec[i] << endl;
				else
					cout << vec[i] << " ";
			}
			return 0;
		}
		vec[0]++;
		if(a1 == b1 + c1)
			vec[1]++;
		else if(a1 < b1 + c1)
			vec[2]++;
		else
			vec[3]++;
	}
}

C++: #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
const int INF=1e9;
int main(){
      int a[3],cnt[4];
      memset(cnt,0,sizeof(cnt));
      while(cin>>a[0]>>a[1]>>a[2]){
            sort(a,a+3);
            if(a[0]+a[1]<=a[2]){
                  REP(i,4)printf("%d%c",cnt[i],i==3?'\n':' ');
                  break;
            }
            cnt[0]++;
            if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])cnt[1]++;
            else if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2])cnt[2]++;
            else cnt[3]++;
      }
}

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

bool exist(int a,int b,int c){
    bool flag=false;
    if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true;
    return flag;
}
int type_check(int a,int b,int c){
    if(a*a+b*b==c*c)return 0;
    else if(c*c<b*b+a*a)return 1;
    else if(c*c>a*a+b*b)return 2;
    else return 3;
}

int main(){
    //1:直角 2:鋭角 3: 鈍角 4:三角形
    int c1=0,c2=0,c3=0,c4=0;
    int t_side[3];
    while(true){
        cin >> t_side[0]>>t_side[1]>>t_side[2];
        sort(t_side, t_side + 3, greater<int>());
        if(!exist(t_side[0],t_side[1],t_side[2]))break;
        switch(type_check(t_side[0],t_side[1],t_side[2])){
            case 0: c1++; break;
            case 1: c2++; break;
            case 2: c3++; break;
        }
        c4++;
    }
    cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl;
    return 0;
}

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

int process(int *data){
  int x,y;
  sort(data,data+3);
  x = (data[0]*data[0])+(data[1]*data[1]);
  y = (data[2]*data[2]);
  if(data[0]+data[1] <= data[2]){
    return -1;
  }else if(x == y){
    return 1;
  }else if(x > y){
    return 2;
  }else{
    return 3;
  }
}

int main(){
  int tyokkaku,eikaku,donkaku;
  int data[3];
  tyokkaku = eikaku = donkaku = 0;
  cin >> data[0] >> data[1] >> data[2];
  while(process(data) != -1){
    if(process(data) == 1){
      tyokkaku++;
    }else if(process(data) == 2){
      eikaku++;
    }else{
      donkaku++;
    }
    cin >> data[0] >> data[1] >> data[2];
  }

  cout << tyokkaku+eikaku+donkaku << ' '<< tyokkaku << ' '<< eikaku << ' ' << donkaku << endl;

  return 0;

}

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

using namespace std;

int main() {
	int a[3];
	int b, c, d;
	b = c = d = 0;
	while (cin >> a[0] >> a[1] >> a[2]) {
		for (int i = 2; i >= 0; i--) {
			for (int j = 0; j < i; j++) {
				if (a[j] > a[j+1]) {
					swap(a[j], a[j+1]);
				}
			}
		}
		if (a[0] + a[1] <= a[2]) {
			cout << b+c+d << ' ' << b << ' ' << c << ' ' << d << endl;
			while (cin >> a[0] >> a[1] >> a[2]) {
			}
			break;
		}
		if (a[0]*a[0] + a[1]*a[1] == a[2]*a[2]) {
			b++;
		} else if (a[0]*a[0] + a[1]*a[1] > a[2]*a[2]) {
			c++;
		}  else {
			d++;
		}
	}
	return 0;
}

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

int main(){
    
    int a,b,c;
    int s,ch,e,d;
    s = ch = e = d = 0;
    int tmp,hantei;
    while(1){
        cin >> a >> b >> c;
        if(a>b){
            if(a>c){
                tmp=a;
                a=c;
                c=tmp;
            }
        }else{
            if(b>c){
                tmp=b;
                b=c;
                c=tmp;
            }
        }
        if(c>=a+b) break;
        s++;
        hantei=c*c-a*a-b*b;
        if(hantei>0){
            d++;
        }else if(hantei<0){
            e++;
        }else{
            ch++;
        }
    }
    
    cout << s << " " << ch << " " << e << " " << d << endl;
    
    return 0;
}

C++: #include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

int main(){

	int x,y,z,s,a=0,b=0,c=0;
	for(;;){
	cin >> x >> y >> z;

	if(abs(x-z)<y && y<x+z){
	vector<int>t(3);
	t[0]=x; t[1]=y; t[2]=z;
	sort(t.begin(),t.end());

	if(t[0]*t[0]+t[1]*t[1]>t[2]*t[2])  b++;
	if(t[0]*t[0]+t[1]*t[1]==t[2]*t[2]) a++;
	if(t[0]*t[0]+t[1]*t[1]<t[2]*t[2])  c++;

	}
	else{

		s=a+b+c;
		cout << s << " " << a << " " << b << " " << c << endl;
		break;
	}
	}

	return 0;
}

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

void sort( int* a )
{
    for( int i = 0; i < 2; i++ )
        for( int j = i + 1; j < 3; j++ )
            if( a[i] > a[j] )
            {
                int temp = a[i];
                a[i] = a[j];
                a[j] = temp;
            }
}

int main()
{
    int t[3];
    int t1 = 0, t2 = 0, t3 = 0, t4 = 0;

    while( cin >> t[0] >> t[1] >> t[2] )
    {
        sort( t );

        if( t[0] + t[1] > t[2] )                                            //三角形の存在条件
        {
            t1++;
            if( t[0] * t[0] + t[1] * t[1] == t[2] * t[2] )                  //直角三角形
                t2++;
            else if( t[0] * t[0] + t[1] * t[1] > t[2] * t[2] )              //鋭角三角形
                t3++;
            else                                                            //鈍角三角形
                t4++;
        }
        else
        {
            cout << t1 << " " << t2 << " " << t3 << " " << t4 << endl;
            break;
        }
    }
    return 0;
}