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

using namespace std;

int main(int argc, char const *argv[]) {
    int edge[3];
    int tri[3]={0};//0:right, 1:acute, 2:obtuse
    int total=0;

    while(1){
        for(int i=0;i<3;i++)
            cin >> edge[i];
        sort(edge,edge+3);
        if(edge[2] < edge[0] + edge[1]){
            total++;
            if(pow(edge[2],2) == pow(edge[0],2) + pow(edge[1],2)){
                tri[0]++;
            }else if(pow(edge[2],2) < pow(edge[0],2) + pow(edge[1],2)){
                tri[1]++;
            }else{
                tri[2]++;
            }
        }else{
            break;
        }
    }
    printf("%d %d %d %d\n",total,tri[0],tri[1],tri[2]);
    return 0;
}

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

int main(){
	int in[3]={};
	int ary[4]={};
	while(true){
		for(int i=0;i<3;i++) cin>>in[i];
		sort(in,in+3);
		if(in[0]+in[1]<=in[2]) break;
		else if(in[0]*in[0]+in[1]*in[1]<in[2]*in[2]) ary[3]++;
		else if(in[0]*in[0]+in[1]*in[1]==in[2]*in[2]) ary[1]++;
		else ary[2]++;
		ary[0]++;
	}
	cout<<ary[0]<<" "<<ary[1]<<" "<<ary[2]<<" "<<ary[3]<<endl;
	return 0;
}

C++: #include<iostream>
#include<algorithm>
 
using namespace std;
 
int main() {
    int ans[3] = {};
    while (1) {
        int a[3];
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        if(a[0]+a[1]<=a[2]) break;
        if(a[0]*a[0]+a[1]*a[1]==a[2]*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]++;
    }
    cout<<ans[0]+ans[1]+ans[2];
    for(int i=0; i<3; i++) cout<<" "<<ans[i];
    cout<<endl;
}

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

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <list>
#include <stack>

using namespace std;

/* constant */

const int INF = 1 << 30;
const int mod = 1000000007;

/* typedef */

typedef long long ll;

/* global variables */
vector<int> v(4, 0);

/* function */
bool judge(int x, int y, int z);

/* main */
int main() {

    while (1) {
        int a, b, c; cin >> a >> b >> c;
        if (a < b) swap(a, b);
        if (b < c) swap(b, c);
        if (a < b) swap(a, b);

        if (!judge(a, b, c)) {
            cout << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' << v[3] << '\n';
            return 0;
        }
    }

}

bool judge(int x, int y, int z) {

    bool triangle = true;

    if (x >= y + z or y >= x + z or z >= x + y) {
        triangle = false;
    }
    else {
        v[0]++;
        int A = y * y + z * z - x * x;
        if (A == 0) {
            v[1]++;
        }
        else if (A > 0) {
            v[2]++;
        }
        else {
            v[3]++;
        }
    }

    return triangle;
}

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 1;
    else if(a*a<b*b+c*c)return 0;
    else if(a*a>b*b+c*c)return 2;
    else return 3;
}

int main(){
    int a,b,c,c1=0,c2=0,c3=0,c4=0;
    while(true){
        cin >> a>>b>>c;
        if(!exist(a,b,c))break;
        switch(type_check(a,b,c)){
            case 0: c1++; break;
            case 1: c2++; break;
            case 2: c3++; break;
        }
        c4++;
    }
    cout <<c4<<" "<<c2<<" "<<c1<<" "<<c3<<" " <<endl;
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a[3],type[4];
    for(int i=0;i<4;i++)type[i]=0;
    while(true){
        bool f=false;
        for(int i=0;i<3;i++)cin>>a[i];
        for(int i=0;i<3;i++){
            if(a[i]>=a[(i+1)%3]+a[(i+2)%3])f=true;
        }
        if(f)break;
        type[0]++;
        sort(a,a+3);
        if(a[2]*a[2]>a[1]*a[1]+a[0]*a[0])type[3]++;
        else if(a[2]*a[2]==a[1]*a[1]+a[0]*a[0])type[1]++;
        else type[2]++;

    }
    while(cin>>a[0]);
    for(int i=0;i<4;i++){
        if(i==0)cout<<type[0];
        else cout<<" "<<type[i];
    }
    cout<<endl;
    return 0;
}
/*3 4 5
2 1 2
6 3 4
1 1 1
1 2 3*/

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

int main() {
    int all = 0, right_angle = 0, acute = 0, obtuse = 0;
    while (true) {
        int a, b, c; cin >> a >> b >> c;

        if ( !(a + b > c && b + c > a && c + a > b) ) {
            cout << all         << " "
                 << right_angle << " "
                 << acute       << " "
                 << obtuse      << endl;
            break;
        }

        all++;
        if (pow(a,2) + pow(b,2) == pow(c,2) ||
            pow(b,2) + pow(c,2) == pow(a,2) ||
            pow(c,2) + pow(a,2) == pow(b,2)) right_angle++;
        else if (pow(a,2) + pow(b,2) > pow(c,2) &&
                 pow(b,2) + pow(c,2) > pow(a,2) &&
                 pow(c,2) + pow(a,2) > pow(b,2)) acute++;
        else obtuse++;
    }
}

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

int main() {
    int x,y,z;
    int san,don,cho,ei;
    for(int i=0;;i++){
        cin >> x >> y >> z;
        int a = max(max(x,y),z),b,c;
        if(a == x) b=y,c=z;
        else if(a == y) b=z,c=x;
        else if(a == z) b=x,c=y;

        if(a >= b+c) break;

        else if(a*a > b*b + c*c){
            san++;
            don++;
        }
        else if(a*a == b*b + c*c){
            san++;
            cho++;
        }
        else if(a*a < b*b + c*c){
            san++;
            ei++;
        }
    }

    cout << san << ' ' << cho << ' ' << ei << ' ' << don << endl;
}