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<algorithm>
using namespace std;
int main(){
  int a[3];
  int num_c = 0, num_e = 0, num_d = 0;
  for(;;){
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if(a[0] + a[1] <= a[2]){
      cout << num_c + num_e + num_d << " " << num_c << " " << num_e << " " << num_d << endl;
      break;
    }else{
      if(a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) num_c++;
      else if(a[0] * a[0] + a[1] * a[1] > a[2] * a[2]) num_e++;
      else num_d++;
    }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){

  int a,b,c,tra=0,ei=0,ty=0,don=0,maxnum;

  while(1){

    cin >> a >> b >> c;
     
    maxnum = max(a,max(b,c));

    if(maxnum == b){
      b = a;
      a = maxnum;
    }
    else if(maxnum == c){
      c = a;
      a = maxnum;
    }

    if(a < (b + c) ){
      tra++;
      if(a*a > b*b + c*c){
        don++;
      }
      else if(a*a == b*b + c*c){
        ty++;
      }
      else{
        ei++;
      }
    }
    else{
      cout << tra << " " << ei << " " << ty << " " << don << endl;
      break;
    }
  }

  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<cmath>
#include<algorithm>

using namespace std;

int main(void){

  int a,b,c,res[4]={};

  while(cin >> a >> b >> c){
    
    if(a+b<=c || a+c<=b || b+c<=a){
      for(int i=0;i<4;i++){
	cout << res[i];
	if(i<3)cout <<" "; 
      }
      cout <<endl;
      break;
    }

    res[0]++;
    if(a*a+b*b==c*c || a*a+c*c==b*b || b*b+c*c==a*a)res[1]++;

    if(a*a+b*b>c*c && a*a+c*c>b*b && b*b+c*c>a*a)res[2]++;
    else if(a*a+b*b<c*c || a*a+c*c<b*b || b*b+c*c<a*a)res[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;
}

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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MOD 1000000007

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

void sort(int *a, int *b, int *c){
  int tmp;
  if(*a == max(*a, max(*b, *c))){
    if(*b < *c) tmp = *b, *b = *c, *c = tmp;
  }else if(*b == max(*b, *c)){
    tmp = *a, *a = *b, *b = tmp;
    if(*b < *c) tmp = *b, *b = *c, *c = tmp;
  }else{
    tmp = *a, *a = *c, *c = tmp;
    if(*b < *c) tmp = *b, *b = *c, *c = tmp;
  }
}

int judge(int a, int b, int c){ // 1:直角三角形 2:鋭角三角形 3:鈍角三角形
  if(SQ(a) == SQ(b) + SQ(c)) return 1;
  if(SQ(a) < SQ(b) + SQ(c)) return 2;
  if(SQ(a) > SQ(b) + SQ(c)) return 3;
  return 0;
}

int main(){
  int A, B, C;
  ll res[4];
  memset(res, 0, sizeof(res));
  while(cin >> A >> B >> C){
    sort(&A, &B, &C);
    cout << A << " " << B << " " << C << endl;
    if(A >= B + C) break;
    res[0]++;
    res[judge(A, B, C)]++;
  }

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

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>


using namespace std;
typedef long long ll;

#define mod 1000000007
#define INF 2000000000
#define LLINF 4000000000000000000
#define SIZE 100

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