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 <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int ans, ans1, ans2, ans3;
int a, b, c;

int main(){
	bool f = 1;
	while (cin >> a >> b >> c){
		if (f == 0)continue;
		if (a > b)swap(a, b);
		if (b > c)swap(b, c);
		if (a + b > c&&b + c > a&&c + a > b){
			ans++;
			if (a*a + b*b == c*c){
				ans1++;
			}
			else if (a*a + b*b > c*c){
				ans2++;
			}
			else ans3++;
		}
		else f = 0;
	}
	cout << ans << " " << ans1 << " " << ans2 << " " << ans3 << endl;
}

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

C++: #include <stdio.h>
#include <iostream.h>

const MAX = 10000;
int a[MAX];

BOOL IsRightAngle(int a, int b, int c){
    if(a*a == b*b + c*c) return TRUE;
    if(b*b == a*a + c*c) return TRUE;
    if(c*c == a*a + b*b) return TRUE;
    return FALSE;
}

BOOL IsOBTUSE(int a, int b, int c){
    if(a*a > b*b + c*c) return TRUE;
    if(b*b > a*a + c*c) return TRUE;
    if(c*c > b*b + a*a) return TRUE;
    return FALSE;
}

BOOL IsTriangle(int a, int b, int c){
    if(a+b > c) return TRUE;
    if(a+c > b) return TRUE;
    if(c+b > a) return TRUE;
    return FALSE;
}

void main(){
    for(int i = 0; i<MAX; i++){
        scanf( "%d" ,&a[i]):
    }
    int j = 0;]
    int tri = 0;
    int right = 0;
    int obtuse = 0;
    int acute = 0;
    for(;;){
        if( !IsTriangle(a[j],a[j+1],a[j+2]) ){
            break;
        }
        if( IsOBTUSE(a[j],a[j+1],a[j+2]) ){
            obtuse++;
            tri++;
        }
        else if(IsRightAngle(a[j],a[j+1],a[j+2]) ){
            right++;
            tri++;
        }
        else{
            acute++;
            tri++;
        }
        j += 3;
    }
    printf("%d %d %d %d\n",tri,right,acute,obtuse);
}

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

#define INPUT_FROM_FILE (0)
#if INPUT_FROM_FILE
#include <fstream>
#endif

bool is_triangle(const std::vector<int> &v){
	return (v[0] + v[1] > v[2]);
}


int main(int argc, char **argv){
#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
#endif

	std::vector<int> vec(3);
	int num_triangles = 0;
	int num_acute_angle_triangles = 0;
	int num_right_angle_triangles = 0;
	int num_obtuse_angle_triagles = 0;

	for(;;){
#if INPUT_FROM_FILE
		ifs >> vec[0] >> vec[1] >> vec[2];
#else
		std::cin >> vec[0] >> vec[1] >> vec[2];
#endif
		std::sort(vec.begin(), vec.end());

		if(!is_triangle(vec)){
			break;
		}
		num_triangles++;

		int vec02 = vec[0] * vec[0];
		int vec12 = vec[1] * vec[1];
		int vec22 = vec[2] * vec[2];
		int sum = vec02 + vec12;

		if(sum < vec22){
			num_obtuse_angle_triagles++;
		}
		else if(sum == vec22){
			num_right_angle_triangles++;
		}
		else{
			num_acute_angle_triangles++;
		}
	}

	std::cout << num_triangles << " " << num_right_angle_triangles << " " << num_acute_angle_triangles << " " << num_obtuse_angle_triagles << std::endl;
	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main() {
	int a[3];
	int x = 0, y = 0, z = 0;
	while (1) {
		rep(i, 3)cin >> a[i];
		sort(a, a + 3);
		if (a[0] + a[1] <= a[2])break;
		if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2])x++;
		else if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2])y++;
		else z++;
	}
	cout << x + y + z << ' ' << x << ' ' << y << ' ' << z << endl;
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	vector<int>nums(4);
	while (1) {
		vector<int>vs(3);
		cin >> vs[0] >> vs[1] >> vs[2];
		sort(vs.begin(), vs.end());
		if (vs[0] + vs[1] <= vs[2]) {
			break;
		}
		else {
			int l = vs[0] * vs[0] + vs[1] * vs[1];
			int r = vs[2] * vs[2];
			if (l < r) {
				nums[3]++;
			}
			else if (l == r) {
				nums[2]++;
			}
			else {
				nums[1]++;
			}
			nums[0]++;
		}

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

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int k[5], sha = 0, ninety = 0, more = 0;
	bool triangle = true;
	while (triangle) {
		cin >> k[0] >> k[1] >> k[2];
		sort(k, k + 3);
		if (k[0] + k[1] <= k[2]) {
			cout << sha + ninety + more << " " << ninety << " " << sha << " " << more;
			triangle = false;
		}
		else {
			if (k[2] * k[2] == k[0] * k[0] + k[1] * k[1]) ninety++;
			else if (k[2] * k[2] < k[0] * k[0] + k[1] + k[1]) sha++;
			else more++;
		}
	}
	cout << endl;
}

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

using namespace std;

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

int main() {
  int r[3] = {};
  while (true) {
    int a[3];
    rep (i, 3) cin >> a[i];
    sort(a, a + 3);
    if (a[0] + a[1] <= a[2]) break;
    if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) ++r[0];
    if (a[0] * a[0] + a[1] * a[1] >  a[2] * a[2]) ++r[1];
    if (a[0] * a[0] + a[1] * a[1] <  a[2] * a[2]) ++r[2];
  }
  cout << r[0] + r[1] + r[2];
  rep (i, 3) cout << " " << r[i];
  cout << endl;
  return 0;
}