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 <vector>
#include <algorithm>
#include <cstdio>
using namespace std;

int main(){
	int a=0,b=0,c=0;
	int e[3];
	while(scanf("%d%d%d", &e[0], &e[1], &e[2]) != EOF){
		sort(e, e+3);
		if(e[2] >= e[1]+e[0]) continue;
		if(e[2]*e[2] == e[0]*e[0] +e[1]*e[1]) a++;
		if(e[2]*e[2] < e[0]*e[0] +e[1]*e[1]) b++;
		if(e[2]*e[2] > e[0]*e[0] +e[1]*e[1]) c++;
	}
	printf("%d %d %d %d\n", a+b+c, a, b, c);
	return 0;
}

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

#define SIDE side[0] + side[1] - side[2]

using namespace std;

int main()
{
	int side[3];
	int count[4] = {0};
	
	while (1){
		for (int i = 0; i < 3; i++){
			cin >> side[i];
		}
		sort(side, side + 3);
		if (0 >= SIDE){
			break;
		}
		
		for (int i = 0; i < 3; i++){
			side[i] *= side[i];
		}
		if (SIDE == 0){
			count[1]++;
		}
		else if (0 < SIDE){
			count[2]++;
		}
		else if (0 > SIDE){
			count[3]++;
		}
		count[0]++;
	}
	
	for (int i = 0; i < 3; i++){
		cout << count[i] << ' ';
	}
	cout << count[3] << endl;
}

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

int main(){
	int a[3];
	int x=0,y=0,z=0;
	while(true){
		scanf("%d%d%d",&a[0],&a[1],&a[2]);
		sort(a,a+3);
		if(a[0]+a[1] <= a[2]){
			break;
		}
		int tmp = a[0]*a[0]+a[1]*a[1];
		int tmp2 = a[2]*a[2];
		if(tmp == tmp2){
			x++;
		}
		else if(tmp < tmp2){
			z++;
		}
		else{
			y++;
		}
	}
	printf("%d %d %d %d\n",x+y+z,x,y,z);
	return 0;
}

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

using namespace std;
int a[3], total, les, righ, more;
int main(){
    while(cin){
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if(a[2] >= a[0] + a[1] || a[2] <= a[1] - a[0]){
	    cout << total << " " << righ << " " << more << " " << les << endl;
	    return 0;
	}
	int p = a[2] * a[2];
	int q = a[1] * a[1] + a[0] * a[0];
	if(p > q)les++;
	if(p == q)righ++;
	if(p < q)more++;
	total++;
    }
}

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

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

int main(){
  int x = 0, y = 0, z = 0;
  int a, b, c;

  while(cin >> a >> b >> c){
    if(a + b <= c || a + c <= b || b + c <= a){
      break;
    }

    a *= a;
    b *= b;
    c *= c;

    if(a + b == c || a + c == b || b + c == a){
      x++;
    }
    else if(abs(a - b) < c && c < a + b ||
            abs(a - c) < b && b < a + c ||
            abs(b - c) < a && a < b + c){
      y++;
    }
    else{
      z++;
    }
  }

  cout << x + y + z << " " << x << " " << y << " " << z << endl;
}

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

using namespace std;
int main()
{
    int a[3];
    int cnt=0;
    int cnt1=0;
    int cnt2=0;
    int cnt3=0;
    while(1){
        cin >> a[0] >> a[1] >> a[2];
        sort(a,a+3);
        int min=a[0];
        int max1=a[2];
        int max2=a[1];
        if(abs(max2-max1)>=min||min>=max1+max2){
            break;
        }
        cnt++;
        if(min*min+max2*max2-max1*max1==0){
            cnt1++;
        }else if(min*min+max2*max2-max1*max1>0){
            cnt2++;
        }else{
            cnt3++;
        }
        
    }

    cout << cnt << " " << cnt1 << " " << cnt2 << " " << cnt3 << endl;
    return 0;
}

C++: #include <bits/stdc++.h>

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

int r = 0,x = 0,y = 0,z = 0;
vector<int> q(3); 
int main() {
    while(cin >> q[0] >> q[1] >> q[2]){
    sort(q.begin(),q.end());

    if(q[0]+q[1]<=q[2]){
        cout << r << " " << x  << " " << y << " " << z << endl;
        return 0;
    }
    r++;
    if(q[0]*q[0]+q[1]*q[1]==q[2]*q[2]) x++;
    if(q[0]*q[0]+q[1]*q[1] >q[2]*q[2]) y++;
    if(q[0]*q[0]+q[1]*q[1] <q[2]*q[2]) z++;
    }
    return 0;
}

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

using namespace std;

double sideToCos(vector<int> &side)
{
	double a2, b2, c2, cos;
	a2 = side[0] * side[0];
	b2 = side[1] * side[1];
	c2 = side[2] * side[2];
	cos = (c2 - a2 - b2) / -(2 * side[0] * side[1]);
	return cos;
}

int main() {
	vector<int> side(3);
	int count = 0, right = 0, acute = 0, obtuse = 0;
	double cos;

	while (1)
	{
		cin >> side[0] >> side[1] >> side[2];
		sort(side.begin(), side.end());
		if (side[0] + side[1] <= side[2])
		{
			break;
		}
		else
		{
			count++;
			cos = sideToCos(side);
			if (cos > 0) acute++;
			else if (cos < 0) obtuse++;
			else right++;
		}
	}
	cout << count << ' ' << right << ' ' << acute << ' ' << obtuse << endl;
	return 0;
}

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])x++;
			else 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++;
		}
		cout << t << ' ' << x << ' ' << y << ' ' << z << endl;
	}
	cout << t << ' ' << x << ' ' << y << ' ' << z << endl;
}

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

int main() {
    int sides[3], sum[4] = {0, 0, 0, 0};
    bool isOver = false;
    while(scanf("%d %d %d", &sides[0], &sides[1], &sides[2]) != EOF) {
        sort(sides, sides+3);
        if (sides[0] + sides[1] <= sides[2] ||
            sides[0] + sides[2] <= sides[1] ||
            sides[1] + sides[2] <= sides[0] || isOver)  { isOver = true; continue; };
        sum[0]++;
        sides[0]*= sides[0]; sides[1]*=sides[1]; sides[2]*=sides[2];
        if (sides[0] + sides[1] == sides[2]) sum[1]++;
        else if (sides[0]+sides[1] > sides[2]) sum[2]++;
        else if (sides[0]+sides[1] < sides[2]) sum[3]++;
    }
    printf("%d %d %d %d\n", sum[0], sum[1], sum[2], sum[3]);
    return 0;
}