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 <bits/stdc++.h>
using namespace std;

bool istriangle(int a, int b, int c){
    int cnt=0;

    if(a<b+c)cnt+=1;
    if(b<a+c)cnt+=1;
    if(c<a+b)cnt+=1;

    if(cnt==3)return true;
    else return false;
}

int whichtriangle(int a, int b, int c){
    int longest, sub1, sub2;
    if(a>b){
        longest=a;
        sub1=b;
    }
    else {
        longest=b;
        sub1=a;
    }
    if(c>longest){
        sub2=longest;
        longest=c;
    }
    else {
        sub2=c;
    }

    if(longest*longest==sub1*sub1+sub2*sub2)return 1;
    else if(longest*longest>sub1*sub1+sub2*sub2)return 3;
    else return 2;

}

int main(){

    int a, b, c;
    int t=0;
    int types[4]={0, 0, 0, 0};

    while (1){
        cin >> a >> b >> c;
        if(istriangle(a, b, c) == 0)break;

        types[whichtriangle(a, b, c)]+=1;
        t+=1;

    }

    cout << t;
    for(int i=1;i<4;i++){
        cout << " " << types[i];
    }

    cout << endl;

}

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

int main(){
  double a,b,c;
  int cnt[4];
  fill(cnt,cnt+4,0);
  while(cin >> a >> b >> c){
    double array[3];
    int sum = a + b + c;
    int Max = max(a,max(b,c));
    int remain = sum - Max;

    if(Max >= remain){
      continue;
    }

    array[0] = a;
    array[1] = b;
    array[2] = c;
    sort(array,array+3);

    double Max_angle = 0;
    do{
      double tmp = (array[0]*array[0]+array[2]*array[2]-array[1]*array[1])/
	(2*array[0]*array[2]);

      Max_angle = max(Max_angle,acos(tmp));
    }while(next_permutation(array,array+3));

    cnt[0]++;

    if(Max_angle > M_PI / 2.0) cnt[3]++;
    else if(Max_angle < M_PI / 2.0) cnt[2]++;
    else cnt[1]++;

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

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

int ans[4] = {0};
int a, b, c;
vector<int> v;

int main() {
  while(1) {
    cin >> a >> b >> c;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);
    sort(v.begin(), v.end());
    if(v[0] + v[1] <= v[2]) break;
    ++ans[0];
    a = v[0] * v[0] + v[1] * v[1];
    b = v[2] * v[2];
    if(a == b)
      ++ans[1];
    else if(a > b)
      ++ans[2];
    else
      ++ans[3];
    v.erase(v.begin(), v.end());
  }
  cout << ans[0] << " " << ans[1] << " " << ans[2] << " "
       << ans[3] << endl;
  return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector <int>a(3);
	a[0] = a[1] = a[2] = 0;
	int choku = 0, ei = 0, don = 0;
	while (cin >> a[0] >> a[1] >> a[2]) {
		Sort(a);
		if (a[0] + a[1] <= a[2])
		{
			continue;
		}
		int a2[3];
		rep(i, 3) {
			a2[i] = a[i] * a[i];
		}
		if (a2[0] + a2[1] == a2[2]) 
		{ 
			choku++;
		}
		else if (a2[0] + a2[1] > a2[2]) 
		{ 
			ei++;
		}
		else 
		{
			don++;
		}
	}
	cout << choku + ei + don << " " << choku << " " << ei << " " << don << endl;
	return 0;
}

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

int main()
{
  double a, b, c;
  int chokaku = 0, eikaku = 0, donkaku = 0;
  
  while(1){
    scanf("%lf %lf %lf", &a, &b, &c);
    if ( a + b > c && a + c > b && b + c > a ) {
      if ( a*a + b*b == c*c || a*a + c*c == b*b || b*b + c*c == a*a) {
	chokaku++;
      } else if ( asin(a/b) < M_PI / 2. && asin(a/c) < M_PI / 2. && asin(b/c) < M_PI / 2) {
	eikaku++;
      } else {
	donkaku++;
      }
    } else {
      break;
    }
  }
  
  printf("%d %d %d %d\n", eikaku+donkaku+chokaku, chokaku, donkaku, eikaku);
  
  return (0);
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,b,c,l=0,m=0,n=0,o=0;
    while(1){
         cin>>a>>b>>c;
         if(a+b>c&&b+c>a&&a+c>b){
           l+=1;
           if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a){
             m+=1;
           }
           int j=0;
           if(j<a){
           j+=a;
           }
           if(j<b){
           j+=b;
           }
           if(j<c){
           j+=c;
           }
           if(j==a){
             if(a*a<b*b+c*c){
               n+=1;
             }
             if(a*a>b*b+c*c){
               o+=1;
             }
           }
           else if(j==b){
             if(b*b<a*a+c*c){
               n+=1;
             }
             if(b*b>a*a+c*c){
               o+=1;
             }
           }
           else {
                  if(c*c<b*b+a*a){
                    n+=1;
                  }
                  if(c*c>b*b+a*a){
                    o+=1;
                  }
           }
         }
         else{break;}
     }
     cout<<l<<" "<<m<<" "<<n<<" "<<o<<endl;
     return 0;
}

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

using namespace std;

namespace prob0582 {
	enum TriangleType { DoesNotExist = 0, RightAngle, Accute, Obtuse };

	TriangleType checkTriangleType(array<int, 3> edges)
	{
		int longest = 0;
		int longest2sq = 0;
		int sum = 0;
		int sumsq = 0;

		for (int i = 0; i < 3; ++i) {
			if (edges[i] > longest) longest = edges[i];
			sum += edges[i];
			sumsq += edges[i] * edges[i];
		}
		longest2sq = 2 * longest * longest;

		if (sum <= 2 * longest) return DoesNotExist;
		if (sumsq > longest2sq) return Accute;
		if (sumsq == longest2sq) return RightAngle;
		return Obtuse;
	}

	void solve(istream &sin, ostream &sout)
	{
		int total = 0;
		int eachType[]{ 0,0,0,0 };

		array<int, 3> edges;
		TriangleType type;

		do
		{
			sin >> edges[0] >> edges[1] >> edges[2];
			++total;
			type = checkTriangleType(edges);
			eachType[static_cast<int>(type)]++;
		} while (type != DoesNotExist);
		--total;

		sout << total;
		for (int i = 0; i < 3; ++i) sout << " " << eachType[i + 1];
		sout << endl;
	}
}

int main()
{
	prob0582::solve(cin, cout);
}