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<cstdio>
using namespace std;

int main(){

  int a[5] = {};
  int d,e,f,g;
  bool c = true;

  d = e = f = g = 0;

  while(cin >> a[0] >> a[1] >> a[2]){
    sort(a,a+3);
    if(a[2] < a[0] + a[1] && c == true){
      d++;

      if(a[2]*a[2] == a[1]*a[1]+a[0]*a[0]) e++;
      else if(a[2]*a[2] < a[1]*a[1]+a[0]*a[0]) f++;
      else g++;
    }

    else if(c == true){
      printf("%d %d %d %d\n",d,e,f,g);
      c = false;
    }
 
  }
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int a,b,c,d;
int x,y,z;
int main(void){
  bool f = false;
  while(cin >> x >> y >> z){
    if(x < y) swap(x,y);
    if(x < z) swap(x,z);
    if(f || x >= y+z){
      f = true;
      continue;
    }
    a++;
    if(x*x < y*y+z*z) b++;
    else if(x*x == y*y+z*z) c++;
    else d++;
  }
  printf("%d %d %d %d\n",a,c,b,d);
}

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

int main(int argc, char const *argv[])
{
	int v[3], ans1=0, ans2=0, ans3=0, ans4=0;
	while (1)
	{
		cin >> v[0] >> v[1] >> v[2];
		sort(v, v+3);
		if(v[2] >= v[0] + v[1]) break;
		++ans1;
		if(v[2]*v[2] == v[0]*v[0] + v[1]*v[1])  ++ans2;
		else if(v[2]*v[2] < v[0]*v[0] + v[1]*v[1])  ++ans3;
		else ++ans4;
	}
	cout << ans1 << " " << ans2 << " " << ans3 << " " << ans4 << endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <functional>
#include <ostream>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

std::ostream& operator << (std::ostream& os, const std::vector<int>& v) {
  for (int i = 0; i < int(v.size()); ++i) {
    os << v[i];
    if (i != int(v.size()) - 1) cout << " ";
  }
  return os;
}

int main() {
  std::vector<int> tri(4, 0), edge(3);

  while (cin >> edge[0] >> edge[1] >> edge[2]) {
    std::sort(edge.begin(), edge.end(), std::greater<int>());

    int largest = edge[0] * edge[0], others = edge[1] * edge[1] + edge[2] * edge[2];

    if (edge[0] >= edge[1] + edge[2]) {
      break;
    }
    else if (largest == others) {
      tri[1]++;
    }
    else if (largest < others) {
      tri[2]++;
    }
    else if (largest > others) {
      tri[3]++;
    }

    tri[0]++;
  }

  cout << tri << endl;

  return 0;
}

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

using namespace std;

int main() {
  int i;

  int a[3], b[3] = { };
  while(cin >> a[0] >> a[1] >> a[2]) {
    sort(a, a + 3);
    if(a[0] + a[1] <= a[2]) break;
    ++b[min(max(-1, a[0] * a[0] + a[1] * a[1] - a[2] * a[2]), 1) + 1];
  }
  while(cin >> a[0] >> a[0] >> a[0]) ;

  cout << b[0] + b[1] + b[2] << ' ' << b[1] << ' ' << b[2] << ' ' << b[0] <<
    endl;
  return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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 len[3];  
  int tri[4] = {};

  while(cin >> len[0] >> len[1] >> len[2]) {
    sort(len, len+3);
    int a = len[0], b = len[1], c = len[2];
    
    if(c >= a + b) break;
    tri[0]++;
    if(c*c == a*a + b*b) tri[1]++;
    else if(c*c < a*a + b*b) tri[2]++;
    else tri[3]++;
  }
  
  REP(i, 3) cout << tri[i] << ' ';
  cout << tri[3] << endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	vi t(3);
	vvi l;
	while(1){
		rep(i,0,3) cin>>t[i];
		sort(all(t));
		l.push_back(t);
		if(cin.eof()) break;
	}
	int d[4]={};
	rep(i,0,l.size()){
		int a=l[i][0],b=l[i][1],c=l[i][2];
		if(a+b<=c) break;
		d[0]++;
		if(a*a+b*b==c*c) d[1]++;
		else if(a*a+b*b>c*c) d[2]++;
		else d[3]++;
	}
	cout<<d[0]<<" "<<d[1]<<" "<<d[2]<<" "<<d[3]<<endl;
}

C++: #include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
int main()
{
  int A,B,C,d[3],count=0,donkaku=0,tyokkaku=0,eikaku=0;
  while(1){
    cin >> A >> B >> C;
    if(((A + B) > C) && ((A + C) > B) && ((B + C) > A)){
      d[0] = A;
      d[1] = B;
      d[2] = C;
      sort(d,d+3);
      if((d[0]*d[0] + d[1]*d[1]) < d[2]*d[2])
        donkaku++;
      else if((d[0]*d[0] + d[1]*d[1]) == (d[2]*d[2]))
        tyokkaku++;
      else
        eikaku++;
      count++;
    }else{
      cout << count << " " << tyokkaku << " " << eikaku << " " << donkaku << endl;
      break;
    }
  }
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

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

int main(){
  int hen[3];
  int cnt=0;
  int d=0;
  int e=0;
  
  while(1)
    {
      for(int i=0;i < 3;i++)
	{
	  cin >> hen[i];
	}
      sort(hen,hen+3);

      int judge = pow(hen[0],2) + pow(hen[1],2);
      int most = pow(hen[2],2);
      
      if(hen[0]+hen[1] > hen[2] && hen[1]+hen[2] > hen[0] && hen[2]+hen[0] > hen[1])
	{
	  if(judge < most)
	    {
	      d++;
	    }
	  else if(judge > most)
	    {
	      e++;
	    }
	  else if(judge == most)
	    {
	      cnt++;
	    }
	}
      else
	{
	  break;
	}
    }
  cout << cnt+e+d << " " << cnt << " " << e << " " << d << endl;
  return 0;
}