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<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1e9 + 7;
const long long INF = 1LL << 60;

int main() 
{
    int a,b,c;
    int x=0,y=0,z=0,w=0;
    while(cin >> a >> b >> c){
        int l = max({a,b,c});
        int s = min({a,b,c});
        int m = a+b+c-l-s;
        if(s+m>l){
            x++;
            if(s*s+m*m==l*l) y++;
            if(s*s+m*m>l*l) z++;
            if(s*s+m*m<l*l) w++;
        }else{
            break;
        }
    }
    cout << x << ' ' << y << ' ' << z << ' ' << w << endl;
}

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

int main(){
	int length[3];
	int w = 0, x = 0, y = 0, z = 0;

	while(cin >> length[0] >> length[1] >> length[2]){
		sort(length, length+3);

		if(length[2] < length[0] + length[1]){
			w++;
			if(pow(length[2], 2) == pow(length[0], 2) + pow(length[1], 2)) y++;
			else if(pow(length[2], 2) < pow(length[0], 2) + pow(length[1], 2)) z++;
			else x++;
		}
		else {
			cout << w << ' ' << y << ' ' << z << ' ' << x << endl;
			break;
		}
	}

}

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

using namespace std;

int judge_triangle(int a, int b, int c)
{
  return b * b + c * c - a * a;
}

int main()
{
  int a, b, c;
  int num_of_triangle = 0;
  int num_of_acute = 0;
  int num_of_right = 0;
  int num_of_obtuse = 0;

  while (1) {
    cin >> a >> b >> c;
    int max_side = max({a, b, c});
    if (a + b + c - max_side <= max_side) break;
    num_of_triangle++;
    
    int judge;
    if (max_side == a) {
      judge = judge_triangle(a, b, c);
    } else if (max_side == b) {
      judge = judge_triangle(b, c, a);
    } else {
      judge = judge_triangle(c, a, b);
    }

    if (judge > 0) num_of_acute++;
    else if (judge < 0) num_of_obtuse++;
    else num_of_right++;
  }
  cout << num_of_triangle << " " << num_of_right << " " <<
      num_of_acute << " " << num_of_obtuse << endl;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a[3];
	int t = 0, x = 0, y = 0, z = 0;
	bool b = true;
	while (cin >> a[0] >> a[1] >> a[2]){
		if (!b)continue;
		sort(a, a + 3);
		if (a[0] + a[1] <= a[2]){
			b = false;
			continue;
		}else{
			t++;
			if		(a[0] * a[0] + a[1] * a[1] == a[2] * a[2])y++;
			else if (a[0] * a[0] + a[1] * a[1] <= a[2] * a[2])z++;
			else if (a[0] * a[0] + a[1] * a[1] >= a[2] * a[2])x++;
		}
		cout << t << ' ' << x << ' ' << y << ' ' << z << endl;
	}
	cout << t << ' ' << x << ' ' << y << ' ' << z << endl;
}

C++: #include <iostream>
#include <cstdlib>
#include <algorithm>
using namespace std;
enum TriangleType {
  ACUTE  = 0,
  RIGHT  = 1,
  OBTUSE = 2,
};
int main() {
   int tri[ 3 ];
   int tri_num[ 4 ] = { 0 };
   bool has_error = false;
   while( cin >> tri[ 0 ] ) {
     cin >> tri[ 1 ] >> tri[ 2 ];
     if( !has_error ) {
       sort( tri, tri + 3 );
       int absq = tri[ 0 ] * tri[ 0 ] + tri[ 1 ] * tri[ 1 ];
       int csq = tri[ 2 ] * tri[ 2 ];
       if( tri[ 0 ] + tri[ 1 ] <= tri[ 2 ] ) {
         has_error = true;
       } else if( absq > csq ) {
         tri_num[ ACUTE ]++;
       } else if( absq == csq ) {
         tri_num[ RIGHT ]++;
       } else {
         tri_num[ OBTUSE ]++;
       }
     }
   }
  
   cout
     << tri_num[ ACUTE ] + tri_num[ RIGHT ] + tri_num[ OBTUSE ] << ' '
     << tri_num[ RIGHT  ] << ' '
     << tri_num[ ACUTE  ] << ' '
     << tri_num[ OBTUSE ] << endl;

  return EXIT_SUCCESS;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int a, b, c;
  int ans[4] = {};
  while(cin>>a>>b>>c){
    if(!(c > b - a)) break;
    if(!(c > a - b)) break;
    if(!(c < a + b)) break;
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    int D = a * a + b * b  - c * c;
    ans[0]++;
    if(D > 0) ans[1]++;
    if(D == 0) ans[2]++;
    if(D < 0) ans[3]++;
  }
  printf("%d %d %d %d\n", ans[0], ans[2], ans[1], ans[3]);
  return 0;
}

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

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

int a, b, c, s, x, y;
int d = 0, e = 0, t = 0;

int main() {

	while (1) {
		cin >> a >> b >> c;
		x = a ^ 2 + b ^ 2;
		y = c ^ 2;

		if (x < y)
			e++;
		if (x == y)
			t++;
		if (x > y)
			d++;
		if (a + b < c)
			break;
	}

	s = d + e + t;
	cout << s << " " << e << " " << t << " " << d << endl;

	return 0;

}

C++: #include <iostream>

using namespace std;

int main()
{
	int res[4]={};
	for(int a,b,c;cin>>a>>b>>c;){
		if(a>b) swap(a,b);
		if(b>c) swap(b,c);
		if(a>b) swap(a,b);
		
		if(a+b<=c) break;
		res[0]++;
		if(a*a+b*b==c*c) res[1]++;
		if(a*a+b*b>c*c)  res[2]++;
		if(a*a+b*b<c*c)  res[3]++;
	}
	for(int i=0;i<4;i++)
		cout<<res[i]<<(i<3?' ':'\n');
	
	return 0;
}