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 <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define chmax(a,b) (a<(b)?(a=b,1):0)
#define chmin(a,b) (a>(b)?(a=b,1):0)
#define valid(y,x,h,w) (0<=y&&y<h&&0<=x&&x<w)
const int INF = 1<<29;
const double EPS = 1e-8;
const double PI = acos(-1);
typedef pair<int,int> pii;
typedef long long ll;

typedef complex<double> P;
P pIN() { double x,y; cin >> x >> y; return P(x,y); }
namespace std {
  bool operator < (const P& a, const P& b) {
    // if (abs(a-b)<EPS) return 0;
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
  L() { resize(2); }
};
ostream &operator<<(ostream &os, const L &a) {
  os << a[0] << " -> " << a[1];
  return os;
}
typedef vector<P> G;

bool isTriangle(const G &t) {
  if (t.size() != 3) return 0;
  if (abs(cross(t[1]-t[0], t[2]-t[0])) < EPS) return 0; // line or dot
  return 1;
}
int typeByLength(const G &t) {
  double a = norm(t[0]-t[1]);
  double b = norm(t[1]-t[2]);
  double c = norm(t[2]-t[0]);
  if (abs(a-b) < EPS && abs(b-c) < EPS) return 0; // Equilateral
  if (abs(a-b) < EPS || abs(b-c) < EPS || abs(c-a) < EPS) return 1; // Isosceles
  return 2;                     // Scalene
}
int typeByAngle(const G &t) {
  REP(i,3) {
    double tmp = dot(t[(i+1)%3]-t[i], t[(i+2)%3]-t[i]);
    if (abs(tmp) < EPS) return i+1; // Right
    if (tmp < 0) return -i-1;        // Oblique
  }
  return 0;                     // Acute
}
bool isTriangle(double a, double b, double c) {
  return abs(a-b)+EPS < c && c < a+b-EPS;
}
G triangleFromLength(double a, double b, double c) {
  G t(3);
  t[0] = P(0,0);
  t[1] = P(a,0);
  double x = (a*a+b*b-c*c)/(2*a);
  t[2] = P(x,sqrt(b*b-x*x));
  return t;
}
int main() {
  int a,b,c;
  int A=0,B=0,C=0,D=0;
  while(cin >> a >> b >> c) {
    if (!isTriangle(a,b,c)) break;
    G t = triangleFromLength(a,b,c);
    A++;
    int type = typeByAngle(t);
    if (type == 0) C++;
    else if (type > 0) B++;
    else D++;
  }
  printf("%d %d %d %d\n",A,B,C,D);
}

C++: #include <iostream>
#include <cstdio>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int x,y,z;
	int a,b,c;
	int ans1=0,ans2=0,ans3=0;
	while(cin>>x>>y>>z){
		a=max(max(x,y),z);
		b=min(min(x,y),z);
		c=x+y+z-a-b;
		// cout<<a<<" "<<b<<" "<<c<<endl;
		if(a>=b+c){
			cout<<ans1+ans2+ans3<<" "<<ans1<<" "<<ans2<<" "<<ans3<<endl;
			return 0;
		}
		else{
			if(a*a==b*b+c*c){
				ans1++;
			}
			else if(a*a<b*b+c*c){
				ans2++;
			}
			else{
				ans3++;
			}
		}
	}
}

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

bool exist(int a,int b,int c){
    bool flag=false;
    if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true;
    return flag;
}
int type_check(int a,int b,int c){
    if(a*a+b*b==c*c)return 0;
    else if(c*c<b*b+a*a)return 1;
    else if(c*c>a*a+b*b)return 2;
    else return 3;
}

int main(){
    int c1=0,c2=0,c3=0,c4=0;
    int t_side[3];
    while(true){
        cin >> t_side[0]>>t_side[1]>>t_side[2];
        sort(t_side, t_side + 3, greater<int>());
        if(!exist(t_side[0],t_side[1],t_side[2]))break;
        switch(type_check(t_side[0],t_side[1],t_side[2])){
            case 0: c1++; break;
            case 1: c2++; break;
            case 2: c3++; break;
        }
        c4++;
    }
    cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl;
    return 0;
}

C++: #include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int a[3],t=0,c=0,e=0,d=0;
    for (int i=0;i<1000;i++){
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        if (a[2]>=a[0]+a[1])break;
        else if(a[2]*a[2]==a[0]*a[0]+a[1]*a[1]){
            t+=1;
            c+=1;
        }
        else if(a[2]*a[2]>a[0]*a[0]+a[1]*a[1]){
            t+=1;
            d+=1;
        }
        else if(a[2]*a[2]<a[0]*a[0]+a[1]*a[1]){
            t+=1;
            e+=1;
        }
    }
    cout<<t<<" "<<c<<" "<<e<<" "<<d<<endl;
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a[3],i,j,ans[4]={0};
	while(cin >> a[0] >> a[1] >> a[2]){
		for(i=0;i<3;i++){
			for(j=i+1;j<3;j++){
				if(a[i]>a[j])swap(a[i],a[j]);
			}
		}
		if(a[0]+a[1]>a[2]){
			ans[0]++;
			if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])ans[1]++;
			if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2])ans[2]++;
			if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2])ans[3]++;
		}
	}
	for(i=0;i<3;i++){
		cout << a[i] << endl;
	}
	for(i=0;i<3;i++){
		cout << ans[i] << " ";
	}
	cout << ans[3] << endl;
return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
 
using namespace std;
 
int main()
{
	int tris = 0;
	int right_tris = 0;
	int acute_tris = 0;
	int obtuse_tris = 0;
	for( int i = 0; i < 100; i ++)
	{
		int a, b, c;
		cin >> a >> b >> c;

		if( a + b > c && b + c > a && c + a > b )
		{
			tris ++;

			int d = b * b + c * c;
			int aa = a * a;

			if( d == aa )
			{
				right_tris ++;
			}
			else if ( d > aa )
			{
				acute_tris ++;
			}
			else
			{
				obtuse_tris ++;
			}
		}
	}

	cout << tris << " " << right_tris << " " << acute_tris << " " << obtuse_tris << endl;

	return 0;
}