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

int Solve(int a,int b,int c){

  if(c*c < a*a+b*b )return 1;
  if(c*c == a*a+b*b)return 0;
  else return 2;

}

int main(){

  int sum[]={0,0,0};
  vector< int > a(3);

  while(cin>>a[0]>>a[1]>>a[2]){
    sort(a.begin(),a.end());

    if(a[0]+a[1] > a[2]){
      sum[ Solve(a[0],a[1],a[2]) ] ++;
    }
    else{
      break;
    }

  }

  cout << sum[0]+sum[1]+sum[2] << ' ' << sum[0] << ' ' << sum[1] << ' ' << sum[2] << endl;

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int N=3;

int main() {
  std::ios::sync_with_stdio(false);
  cout.tie(0); cin.tie(0);
  int Triangle=0,RightangledTriangle=0,AcuteangleTriangle=0,ObtuseTriangle=0;
  int threeSides[N];
  bool flag=true;
  while (flag) {
    cin>>threeSides[0]>>threeSides[1]>>threeSides[2];
    sort(threeSides,threeSides+N);
    if (threeSides[1]+threeSides[2]>threeSides[0]&&threeSides[0]+threeSides[2]>threeSides[1]&&threeSides[0]+threeSides[1]>threeSides[2]) {
      Triangle++;
      if (pow(threeSides[2],2)==pow(threeSides[0],2)+pow(threeSides[1],2)) {
	RightangledTriangle++;
      }
      else if (pow(threeSides[2],2)<pow(threeSides[0],2)+pow(threeSides[1],2)) {
	AcuteangleTriangle++;
      }
      else {
	ObtuseTriangle++;
      }
    }
    else flag=false;
  }
  cout<<Triangle<<" "<<RightangledTriangle<<" "<<AcuteangleTriangle<<" "<<ObtuseTriangle<<endl;
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1);

int main(){
  int n[3], max = 0;
  int cnt[3] = {0}, ans = 0;
  while(1){
    //n[0]: 直角三角形, n[1]: 鋭角三角形, n[2], 鈍角三角形
    cin >> n[0] >> n[1] >> n[2];
    if(n[0] < n[1] + n[2] && n[1] < n[0] + n[2] && n[2] < n[0] + n[1]){
      sort(n, n + 3);
      int sum = n[0] * n[0] + n[1] * n[1] - n[2] * n[2];
      if(sum > 0){
        cnt[1]++;
        ans++;
      }else if(sum == 0){
        cnt[0]++;
        ans++;
      }else{
        cnt[2]++;
        ans++;
      }
    }else{
      cout << ans << " " << endl;
      for(int i = 0; i < 2; i++){
        cout << cnt[i] << " " << endl;
      }
      cout << cnt[2] << endl;
      break;
    }
  }

}

C++: #include <iostream>

using namespace std;

int main()
{
	int a[100], b[100], c[100],d,e,f,n;
	n = 0;
	d = 0;
	e = 0;
	f = 0;
	while (n <= 100)
	{
		cin >> a[n] >> b[n] >> c[n];
		if (a[n] + b[n] <= c[n] || a[n] + c[n] <= b[n] || b[n] + c[n] <= a[n])
			break;
		else
		{
			n++;
			if (a[n] * a[n] + b[n] * b[n] == c[n] * c[n] || a[n] * a[n] + c[n] * c[n] == b[n] * b[n] || b[n] * b[n] + c[n] * c[n] == a[n] * a[n])
			{
				d++;
			}
			if (a[n] * a[n] + b[n] * b[n] > c[n] * c[n] || a[n] * a[n] + c[n] * c[n] > b[n] * b[n] || b[n] * b[n] + c[n] * c[n] > a[n] * a[n])
			{
				e++;
			}
			else f++;
		}
	}
	cout << n<<" "<<d<<" "<<e<<" "<<f<<endl;
	return 0;
}

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;

template<class T>
struct Triangle {
  T a,b,c;
  Triangle(T a, T b, T c) : a(a),b(b),c(c) {}
  double area() {
    double s = (a+b+c)*0.5;
    return sqrt(s*(s-a)*(s-b)*(s-c));
  }
  bool isTriangle() {
    return abs(a-b) < c && c < a+b;
  }
  // G getG() {
  //   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 typeByAngle() {
    if (a*a>b*b+c*c ||
        b*b>c*c+a*a ||
        c*c>a*a+b*b) return -1; // Oblique
    if (a*a==b*b+c*c ||
        b*b==c*c+a*a ||
        c*c==a*a+b*b) return 1; // Right
    return 0;                   // Acute
  }  
};

int main() {
  int a,b,c;
  int A=0,B=0,C=0,D=0;
  while(cin >> a >> b >> c) {
    Triangle<ll> tri(a,b,c);
    if (!tri.isTriangle()) break;
    A++;
    int type = tri.typeByAngle();
    if (type == 0) C++;
    else if (type > 0) B++;
    else D++;
  }
  printf("%d %d %d %d\n",A,B,C,D);
}

C++: #include <iostream>

using namespace std;

int main() {
  int count_total = 0; // 合計
  int count_1 = 0; // 直角三角形
  int count_2 = 0; // 鋭角
  int count_3 = 0; // 鈍角
  while(1) {
    int long_side = 0;
    int short_side1 = 0;
    int short_side2 = 0;
    int a, b, c = 0;
    cin >> a >> b >> c;
    if (!(abs(b-c) < a && a < b + c)) {
      cout << count_total << " " << count_1 << " " << count_2 << " " << count_3 << endl;
      return 0;
    }
    count_total++;
    int max_side = a;
    if (b > a && b > c) {
      // bが一番長い
      long_side = b;
      short_side1 = a;
      short_side2 = c;
    }
    if (c > a && c > b) {
      // cが一番長い
      long_side = c;
      short_side1 = a;
      short_side2 = b;
    } else {
      // aが一番長い
      long_side = a;
      short_side1 = b;
      short_side2 = c;
    }
    int d1 = long_side * long_side;
    int d2 = short_side1 * short_side1 + short_side2 * short_side2;
    // 鈍角
    if (d1 > d2) {
      count_3++;
    } else if (d1 == d2) {
      // 直角
      count_1++;
    } else {
      // 鋭角
      count_2++;
    }
  }

}

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 continue;
    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]);
}