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 <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int t = 0;
	int e = 0;
	int d = 0;
	for (int i = 0; ; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		int tmp = 0;
		if (a > b) {
			tmp = a;
			a = b; b = tmp;
		}
		if (b > c) {
			tmp = b;
			b = c; c = tmp;
		}
		if (a > b) {
			tmp = a;
			a = b; b = tmp;
		}
		if (a + b <= c) {
			cout << i << " " << t << " " << e << " " << d << endl;
			break;
		}
		if (a * a + b * b > c * c) e++;
		if (a * a + b * b == c * c) t++;
		if (a * a + b * b < c * c) d++;
	}
	return 0;
}

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

int main(){
  vector<int> a(3);
  int cnt[4] = {0, 0, 0, 0};
  while (cin >> a[0] >> a[1] >> a[2]) {
    if (a[0] + a[1] > a[2] && a[0] + a[2] > a[1] && a[1] + a[2] > a[0]) {
      cnt[0] ++;
      sort(a.begin(), a.end());
      if (a[0] * a[0] + a[1] * a[1]  > a[2] * a[2]) cnt[1] ++;
      if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cnt[2] ++;
      if (a[0] * a[0] + a[1] * a[1]  < a[2] * a[2]) cnt[3] ++;
    }
  }

  cout << cnt[0];
  cout << " " << cnt[1];
  cout << " " << cnt[2];
  cout << " " << cnt[3];
  cout << endl;
}

C++: #include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int a, b, c;
  int sum = 0;
  int Atriangle = 0, Rtriangle = 0, Otriangle = 0;
  while(true){
      cin >> a >> b >> c;
      if(a+b > c && b+c > a && c+a > b ){
        sum++;
        vector<int> abc = {a,b,c};
        sort(abc.begin(),abc.end());
        abc.at(0) = abc.at(0)*abc.at(0);
        abc.at(1) = abc.at(1)*abc.at(1);
        abc.at(2) = abc.at(2)*abc.at(2);
        if(abc.at(0)+abc.at(1) > abc.at(2)) Atriangle++;
        else if(abc.at(0)+abc.at(1) == abc.at(2)) Rtriangle++;
        else Otriangle++;
      }
      else{
        cout << sum << " " << Rtriangle << " " << Atriangle 
        << " " << Otriangle << endl;
        break;
      }
  }
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int a[3], p, q, r;
int main() {
	while (true) {
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		if (a[0] + a[1] <= a[2]) { cout << p + q + r << ' ' << p << ' ' << q << ' ' << r << ' ' << endl; break; }
		if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) { p++; }
		if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2]) { q++; }
		if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2]) { r++; }
	}
}

C++: #include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

//conversion
//------------------------------------------
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(); }

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#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())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

//
//bool is_chokaku(int a, int b, int c) {
//	return (a*a + b * b == c * c);
//}
int num_t = 0;
int num_ei = 0;
int num_don = 0;
int num_cyokaku = 0;

//最大角の大きさで三角形を決める
// 0　鋭角　1 鈍角　２　直角
double yogen(int c, int b, int a) {

	return double(b * b + c * c - a * a) / double(2 * b*c);
}

void tri(int a, int b, int c) {
	double yo = yogen(a, b, c);

	if (abs(yo) < EPS) {
		num_cyokaku++;
	}
	else if (yo < 0) {
		num_don++;
	}
	else if (yo > 0) {
		num_ei++;
	}
}
int main() {

	vector<int> a(3);
	while (true)
	{
		cin >> a[0] >> a[1] >> a[2];
		sort(ALL(a), less<int>());
		if (a[2] < a[0] + a[1]) {
			num_t++;
			tri(a[0], a[1], a[2]);
		}
		else {
			cout << num_t << " " << num_cyokaku << " " << num_ei << " " << num_don << endl;
			break;
		}
	}


}

C++: #include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

bool check(int a, int b, int c){
		return max(a, max(b, c)) < (a + b + c) - max(a, max(b, c));
}

int main(int argc, char const* argv[])
{
	int a, b, c;
	int tyo = 0, don = 0, ei = 0;
	while(true){
			cin >> a >> b >> c;
			if(check(a, b, c)){
					int emax = max(a, max(b, c));
					int emin = min(a, min(b, c));
					int emid = a + b + c - emax - emin;
					if(emax * emax == emin * emin + emid * emid)tyo++;
					else if(emax * emax > emin * emin + emid * emid)don++;
					else if(emax * emax < emin * emin + emid * emid)ei++;
			}else{
					cout << tyo + don + ei << " " << tyo << " " << ei << " " << don << endl;
					return 0;
			}
	}
	return 0;
}

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",a,c,b,d);
}