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

static const int TOTAL = 0;
static const int RIGHT = 1;
static const int ACUTE = 2;
static const int OBTUSE = 3;

bool isTriangle(int *ary) {	return ary[0] < ary[1] + ary[2]; }

void sort(int *ary, int n) {
	for (int i = n - 1; i > 0; i--) {
		for (int j = 0; j < i; j++) {
			if (ary[j] < ary[j + 1]) {
				swap(ary[j], ary[j + 1]);
			}
		}
	}
}

void judgeAndSet(int *ary,int *count) {
	int d = ary[1] * ary[1] + ary[2] * ary[2] - ary[0] * ary[0];
	if (d == 0) count[RIGHT]++;
	else if (d > 0) count[ACUTE]++;
	else count[OBTUSE]++;
	count[TOTAL]++;
}


int main() {
	int ary[3];
	int count[4] = { 0,0,0,0 };
	int num = 0;
	while (true) {
		cin >> ary[0] >> ary[1] >> ary[2];
		sort(ary, 3);
		if (!isTriangle(ary)) break;
		judgeAndSet(ary, count);
	}

	for (int i = 0; i < 4; i++) {
		if (i) cout << " ";
		cout << count[i];
	}
	cout << endl;
	
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define first F
#define second S

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  vi l(3);
  vi n(4,0);
  while(scanf("%d %d %d",&l[0],&l[1],&l[2])!=EOF){
    sort(all(l));
    if(l[0]+l[1]>l[2])n[0]++;
    else break;
    int hypo=l[0]*l[0]+l[1]*l[1];
    if(hypo==l[2]*l[2])n[1]++;
    else if(hypo>l[2]*l[2])n[2]++;
    else if(hypo<l[2]*l[2])n[3]++;
  }
  printf("%d %d %d %d\n",n[0],n[1],n[2],n[3]);
}

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

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

int main() {
	vector<int> vec(3);
	int tri; int rig = 0; int acu = 0; int obt = 0;
	while (cin >> vec[0] >> vec[1] >> vec[2]) {
		sort(vec.begin(), vec.end());
		if (vec[0] + vec[1] > vec[2]) {
			for (int i = 0; i < 3; i++) vec[i] = pow(vec[i], 2);
			if (vec[0] + vec[1] == vec[2]) rig++;
			else if (vec[0] + vec[1] > vec[2]) acu++;
			else if (vec[0] + vec[1] < vec[2]) obt++;
		}
		else break;
	}
	tri = rig + acu + obt;
	cout << tri << " " << rig << " " << acu << " " << obt << endl;
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#define S(x) x*x
using namespace std;
int a,b,c,d;
bool flag=true;
int main(void){
  int x[3];
  while(cin>>x[0]>>x[1]>>x[2]){
    sort(x,x+3);
    if(x[0]+x[1]<=x[2])flag=false;
    if(flag){
      a++;
      if(S(x[0])+S(x[1])==S(x[2]))b++;
      if(S(x[0])+S(x[1])>S(x[2]))c++;
      if(S(x[0])+S(x[1])<S(x[2]))d++;
    }
  }
  printf("%d %d %d %d\n",a,b,c,d);
  return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int X[3];
int ans,ans1,ans2,ans3;
int C;
int main()
{
	while(true){
		for(int i=0;i<3;i++)scanf("%d",&X[i]);
		sort(X,X+3);
		if(X[0]+X[1]<=X[2])break;
		ans++;
		C=X[0]*X[0]+X[1]*X[1]-X[2]*X[2];
		if(C>0)ans1++;
		else if(C==0)ans2++;
		else ans3++;
	}
	printf("%d %d %d %d\n",ans,ans2,ans1,ans3);
	return 0;
}

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

int main() {
    int a, b, c;
    int tri=0, sharp=0, obtuse=0, right=0;
    while(cin>>a>>b>>c) {
        int temp = max({a, b, c});
        if(temp==b) {
            swap(a, b);
        } else if(temp==c) {
            swap(a, c);
        }
        if(a>=b+c) break;
        tri++;
        int d = b*b+c*c-a*a;
        if(d==0) right++;
        else if(d>0) sharp++;
        else obtuse++;
    }
    cout << tri << ' ' << right << ' ' << sharp << ' ' << obtuse << '\n';

    return 0;
}

C++: #include<cstdio>
int a,b,c;
int re[4]={-1};
void st(int* p,int* q){
int r;
if(*p<*q){
r=*p;*p=*q;*q=r;
}
return;
}
int main(void){
while(1){
re[0]++;
scanf("%d%d%d",&a,&b,&c);
st(&a,&b);st(&a,&c);st(&b,&c);
if(a>=b+c)break;
if(a*a>b*b+c*c)re[3]++;
else if(a*a<b*b+c*c)re[2]++;
else re[1]++;
}
for(a=0;a<4;a++){
printf("%d ",re[a]);
}
printf("\n");
return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    int choku,ei,don,no;
    choku = 0;
    ei = 0;
    don = 0;
    no = 0;
    while(true){
	int a,b,c;
	cin >> a >> b >> c;
	if(cin.eof()) break;
	if(a > c) swap(a,c);
	if(b > c) swap(b,c);
	if(a+b <= c) break;
	else{
	    a = a * a;
	    b = b * b;
	    c = c * c;
	    if(a + b == c) choku++;
	    else if(a + b < c) don++;
	    else if(a + b > c) ei++;
	}
    }
    printf("%d %d %d %d\n",choku+don+ei,choku,ei,don);
    return 0;
}

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

using namespace std;

int a[3];
int cnt[4];

int main(void){

	while(~scanf("%d%d%d",&a[0],&a[1],&a[2])){
		sort(a,a+3,greater<int>());
		if(a[1]+a[2]>a[0]){
			cnt[0]++;
			if(a[1]*a[1]+a[2]*a[2]==a[0]*a[0])cnt[1]++;
			else if(a[1]*a[1]+a[2]*a[2]>a[0]*a[0])cnt[2]++;
			else cnt[3]++;
		}else break;
	}
	printf("%d %d %d %d\n",cnt[0],cnt[1],cnt[2],cnt[3]);
	return 0;
}

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

using std::begin;
using std::end;

std::tuple<int, int, int> sort(int a, int b, int c) {
  int xs[] = {a, b, c};
  std::sort(begin(xs), end(xs));
  return std::make_tuple(xs[0], xs[1], xs[2]);
}

int main(int, char**) {
  int a, b, c;
  int cnt{0}, ei{0}, cho{0}, don{0};

  while(std::cin >> a >> b >> c) {
    auto t = sort(a, b, c);
    {
      int a, b, c;
      std::tie(a, b, c) = t;
      if(a + b == c) break;
      ++cnt;
      int m2 = a * a + b * b;
      if(m2 == c * c) ++cho;
      else if(m2 > c * c) ++ei;
      else ++don;
    }
  }

  std::cout << cnt << ' ' << cho << ' ' << ei << ' ' << don << std::endl;
}