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<bits/stdc++.h>
using namespace std;

int Solve(int a,int b,int c){

  if(c*c < a*a+b*b )return 1;
  if(c*c == a*a+b*b)return 0;
  else return 2;

}

int main(){

  int sum[]={0,0,0};
  vector< int > a(3);

  while(cin>>a[0]>>a[1]>>a[2]){
    sort(a.begin(),a.end());

    if(a[0]+a[1] > a[2]){
      sum[ Solve(a[0],a[1],a[2]) ] ++;
    }
    else{
      break;
    }

  }

  cout << sum[0]+sum[1]+sum[2] << ' ' << sum[0] << ' ' << sum[1] << ' ' << sum[2] << endl;

  return 0;
}

C++: /**
 * File    : JOI_2005_triangle_types.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-3-8 21:20:52
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int cnt[3] = {0, 0, 0};

int main()
{
  int a[3];
  while (cin >> a[0] >> a[1] >> a[2])
  {
    sort(a, a + 3);
    if (a[0] + a[1] <= a[2])
    {
      cout << cnt[0] + cnt[1] + cnt[2] << " "
           << cnt[1] << " " << cnt[0] << " " << cnt[2] << endl;
      return 0;
    }
    int s = a[0] * a[0] + a[1] * a[1];
    int t = a[2] * a[2];
    if (s < t)
    {
      cnt[2]++;
    }
    else if (s == t)
    {
      cnt[1]++;
    }
    else
    {
      cnt[0]++;
    }
  }
}

C++: #include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define abs(a) a > 0 ? a : -a
 
int main(void) {
  int a, b, c, ta = 0, tb = 0, tc = 0;
  while(scanf("%d%d%d", &a, &b, &c) != EOF) {
    int t;
    if(a < b) t = a, a = b, b = t;
    if(a < c) t = a, a = c, c = t;
    if(b < c) t = c, c = b, b = t;
    if(a >= b + c) break;
    double d;
    double at = (double)a, bt = (double)b, ct = (double)c;
    d = (bt * bt + ct * ct - at * at) / (2 * bt * ct);
    if(d < 0) {
      ta++;
    } else if(d > 0) {
      tb++;
    } else {
      tc++;
    }
  }
  printf("%d %d %d %d\n", ta + tb + tc, tc, tb, ta);
  return 0;
}

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

int solve(int a,int b,int c){
  if(b*b+a*a==c*c) return 1;
  else if(b*b+a*a>c*c) return 2;
  else if(b*b+a*a<c*c) return 3;
  return 0;
}

int main(){
  int a[3];
  int ans,ans1,ans2,ans3;
  bool flag=0;
  
  ans=ans1=ans2=ans3=0;
 
  while(cin>>a[0]>>a[1]>>a[2]){
    sort(a,a+3);
    // cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    if((a[0]+a[1])>a[2]&&(a[1]+a[2])>a[0]&&(a[0]+a[2])>a[1]&&flag==0){
      ans++;
      if(solve(a[0],a[1],a[2])==1) ans1++;
      else if(solve(a[0],a[1],a[2])==2) ans2++;
      else if(solve(a[0],a[1],a[2])==3) ans3++;
    }else flag=1 ;
  }
  cout<<ans<<" "<<ans1<<" "<<ans2<<" "<<ans3<<endl;
  return 0;
}

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

int main() {
    int x, y, z;
    int count = 0;
    int a = 0, b = 0, c = 0;
    while (cin >> x >> y >> z) {
        int l = max(x, max(y, z));
        if (l >= (x + y + z - l)) break;
        vector<int> v = {x, y, z};
        sort(v.begin(), v.end());
        int rhs = v[0] * v[0] + v[1] * v[1];
        int lhs = v[2] * v[2];
        if (lhs == rhs) {
            a++;
        } else if (lhs < rhs) {
            b++;
        } else {
            c++;
        }
        count++;
    }
    cout << count << " " << a << " " << b << " " << c << endl;

    return 0;
}

C++: #include<cstdio>
#include<algorithm>
using namespace std;
bool fin = false;
int cnt1,cnt2,cnt3;//鋭角 直角 鈍角
int num[3];
void solve(){
  sort(num,num+3);
  if(fin || num[0] + num[1] <= num[2]){
    fin = true;
    return;
  }
  if(num[0] * num[0] + num[1] * num[1] < num[2] * num[2])
    cnt3++;
  else if(num[0] * num[0] + num[1] * num[1] == num[2] * num[2])
    cnt2++;
  else
    cnt1++;
}
int main(){
  cnt1 = cnt2 = cnt3 = 0;
  while(scanf("%d",&num[0]) != EOF){
    scanf("%d %d",&num[1],&num[2]);
    solve();
  }
  printf("%d %d %d %d\n",cnt1+cnt2+cnt3,cnt2,cnt1,cnt3);
}

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

int main() {
  vector<int> cnt(3,0);
  while(true) {
    vector<int> v(3);
    cin >> v[0] >> v[1] >> v[2];
    sort(v.begin(),v.end());
    if(v[2] >= v[0]+v[1])
       break;
    if(v[2]*v[2] > v[0]*v[0] + v[1]*v[1])
      cnt[2]++;
    if(v[2]*v[2] == v[0]*v[0] + v[1]*v[1])
      cnt[1]++;
    else
      cnt[0]++;
  }
  cout << cnt[0] + cnt[1] + cnt[2] << cnt[0] << " " << cnt[1] << " " << cnt[2] << endl;
}

C++: #include<iostream>
using namespace std;
int main(){
	int i,x,y ,z,a,b,c,ch=0,ei=0,d=0;

	for(i=0;i<100;i++)
	{
		cin>>x>>y>>z;

		if(x>=y && y>=z) 
		{
			a=x;
			b=y;
			c=z;
		}
		else if(y>=x  && x>=z)
		{
			a=y;
			b=x;
			c=z;
		}
		if (z>=x && x>=y)
		{
			a=z;
			b=y;
			c=x;
		}
		if(b+c<=a)
		{
			break;
		}               
		if (a*a<b*b+c*c)
		{
			ei+=1;
		}
		else if (a*a>b*b+c*c)
		{
			ch+=1;
		}
		else
		{
			d+=1;
		}
	}

	cout<<ch+d+ei<<" "<<ch<<" "<<ei<<" "<<d<<endl;
	return 0;
}

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

int main() {
    int x,y,z;
    int san,don,cho,ei;
    for(int i=0;;i++){
        cin >> x >> y >> z;
        int a = max(max(x,y),z),b,c;
        if(a == x) b=y,c=z;
        else if(a == y) b=z,c=x;
        else if(a == z) b=x,c=y;

        if(a >= b+c) break;

        else if(a*a > b*b + c*c){
            san++;
            don++;
        }
        else if(a*a == b*b + c*c){
            san++;
            cho++;
        }
        else if(a*a < b*b + c*c){
            san++;
            ei++;
        }
    }

    cout << san << ' ' << cho << ' ' << ei << ' ' << don << endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int s(int a){
    return a*a;
}
int main(){
    int a[3],b[4]={0};
    while(cin>>a[0]>>a[1]>>a[2]){
        sort(a,a+3);
        if(a[0]+a[1]<=a[2]){
            cout<<b[0]<<" "<<b[1]<<" "<<b[2]<<" "<<b[3]<<endl;
            break;
        }
        if(s(a[2])>s(a[0])+s(a[1]))
            b[3]++;
        else if(s(a[2])==s(a[0])+s(a[1]))
            b[1]++;
        else
            b[2]++;
        b[0]++;
    }
}