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

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

int main(){
  int a[3];

  int t,l,v,g;
  t = l = v = g = 0;
  while(cin >> a[0] >> a[1] >> a[2]){
    sort(a,a+3);
    if(a[0]+a[1]<=a[2])cout << t << " " << v << " " << l << " " << g << endl;
    else{
      t++;
      int s = a[0]*a[0]+a[1]*a[1]-a[2]*a[2];
      if(s<0)g++;
      else if(s==0)v++;
      else l++;
    }
  }
}

C++: #include<cstdio>

int partition(int A[], int p, int r){
    int x = A[r];
    int i = p-1;
    for(int j=p; j<r; j++){
        if(A[j]<= x){
            i++;
            int temp = A[i];
            A[i] = A[j];
            A[j] = temp;
        }
    }
    int temp = A[r];
    A[r] = A[i+1];
    A[i+1] = temp;
    return i+1;
}

void quickSort(int A[], int p, int r){
    if(p<r){
        int q = partition(A, p, r);
        quickSort(A, p, q-1);
        quickSort(A, q+1, r);
    }
}

int main(){
    int l[3];
    int cnt[4] ={0};

    while(1){
        for(int i=0; i<3; i++) scanf("%d", &l[i]);
        quickSort(l, 0, 2);
        double a = (double)l[0], b=(double)l[1], c=(double)l[2];

        if(!(a+b>c && b+c>a && c+a>b)) break;
        
        cnt[0]++;
        double cosine = (b*b+a*a-c*c)/(2*b*c);
        if(cosine == 0) cnt[1]++;
        else if(cosine >0) cnt[2]++;
        else cnt[3]++;
    }

    for(int i=0; i<4; i++){
        if(i) printf(" ");
        printf("%d", cnt[i]);
    }
    printf("\n");

    return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int a, b, c;
  int ans[4] = {};
  while(cin>>a>>b>>c){
    if(!(c > b - a)) continue;
    if(!(c > a - b)) continue;
    if(!(c < a + b)) continue;
    if(a > b) swap(a, b);
    if(b > c) swap(b, c);
    int D = a * a + b * b  - c * c;
    ans[0]++;
    if(D > 0) ans[1]++;
    if(D == 0) ans[2]++;
    if(D < 0) ans[3]++;
  }
  printf("%d %d %d %d\n", ans[0], ans[2], ans[1], ans[3]);
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main() {
	int s=0, t=0, e=0, d=0;
	while (true) {
		int a[3];
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		if (a[0] + a[1] <= a[2]) break;
		long long b = a[0] * a[0] + a[1] * a[1];
		long long c = a[2] * a[2];
		s++;
		if (b == c) t++;
		else if (b < c) d++;
		else e++;
	}
	cout << s << " " << t << " " << e << " " << d << endl;
}

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 == 0 )
		{
			cout << tris << " " << right_tris << " " << acute_tris << " " << obtuse_tris << endl;
			return 0;
		}

		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 ++;
				continue;
			}
			else if ( d > aa )
			{
				acute_tris ++;
				continue;
			}
			else
			{
				obtuse_tris ++;
				continue;
			}
			d = c * c + a * a;
			aa = b * b;

			if( d == aa )
			{
				right_tris ++;
				continue;
			}
			else if ( d > aa )
			{
				acute_tris ++;
				continue;
			}
			else
			{
				obtuse_tris ++;
				continue;
			}
			d = a * a + b * b;
			aa = c * c;

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

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int p[3]={},a=0,b=0,c=0,d=0;
  while(cin >> p[0] >> p[1] >> p[2]) {
      sort(p,p+3);
      if(p[0]+p[1]<=p[2]) {
          cout << a << " " << b << " " << c << " " << d << endl;
          return 0;
      }
      a++;
      if(p[0]*p[0]+p[1]*p[1]==p[2]*p[2]) {
          b++;
      }
      else if(p[0]*p[0]+p[1]*p[1]>p[2]*p[2]) {
          c++;
      }
      else if(p[0]*p[0]+p[1]*p[1]<p[2]*p[2]) {
          d++;
      }
  }
}

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

int main() {
    int a, b, c;
    int tri=0, sharp=0, obtuse=0, right=0;
    while(cin>>a>>b>>c) {
        int temp = max({a, b, c});
        if(temp==b) {
            swap(a, b);
        } else if(temp==c) {
            swap(a, c);
        }
        if(a>=b+c) break;
        tri++;
        int d = b*b+c*c-a*a;
        if(d==0) right++;
        else if(d>0) sharp++;
        else obtuse++;
    }
    cout << tri << ' ' << right << ' ' << sharp << ' ' << obtuse << '\n';

    return 0;
}