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++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int edges[4];

  int total_triangles = 0;

  int right_angle_num = 0;
  int acute_angle_num = 0;
  int obtuse_angle_num = 0;

  while(~scanf("%d %d %d",edges+0,edges+1,edges+2)){
    sort(edges,edges+3);
    if(edges[2] >= edges[0] + edges[1]){
      printf("%d %d %d %d\n",
             total_triangles,
             right_angle_num,
             acute_angle_num,
             obtuse_angle_num);
      break;
    }

    if(edges[2] * edges[2] == edges[0] * edges[0] + edges[1] * edges[1]){
      right_angle_num++;
    }
    else if(edges[2] * edges[2] < edges[0] * edges[0] + edges[1] * edges[1]){
      acute_angle_num++;
    }
    else if(edges[2] * edges[2] > edges[0] * edges[0] + edges[1] * edges[1]){
      obtuse_angle_num++;
    }
    
    total_triangles++;
  }
}

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;
      return 0;
    }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 <bits/stdc++.h>
#define sqr(x) ((x) * (x))
using namespace std;
int a[3], p, q, r;
int main() {
	ios::sync_with_stdio(false);
	while(cin >> a[0] >> a[1] >> a[2]) {
		sort(a, a + 3);
		if(a[0] + a[1] <= a[2]) break;
		if(sqr(a[0]) + sqr(a[1]) == sqr(a[2])) p++;
		else if(sqr(a[0]) + sqr(a[1]) < sqr(a[2])) q++;
		else r++;
	}
	cout << p + q + r << ' ' << p << ' ' << q << ' ' << r << endl;
	return 0;
}

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

    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<iostream>
using namespace std;
int main(){
	int a,b,c,san=0,tyo=0,don=0,ei=0;
	while(1){
    cin>>a>>b>>c;
	if(a<b)swap(a,b);
	if(a<c)swap(a,c);
	if(a<c+b&&b<a+c&&c<a+b)san=san+1;
	else break;
	if(a*a==b*b+c*c)tyo=tyo+1;
	if(a*a>b*b+c*c)don=don+1;
	if(a*a<b*b+c*c)ei=ei+1;
	}
	cout<<san<<" "<<tyo<<" "<<ei<<" "<<don<<endl;
	return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int main() {
    int x,y,z,a,b,c,powa,powb,powc;
    int sankaku = 0;
    int eikaku = 0;
    int chokkaku = 0;
    int donkaku = 0;
    while(true){
        cin >> x >> y >> z;
        
        a = x;
        b = y;
        c = z;

        if(a < y){
            a = y;
            b = x;
            c = z;
        }
        if(a < z){
            a = z;
            b = y;
            c = x;
        }

        if(a >= b + c){
            break;
        } else {
            sankaku++;
            powa = a*a;
            powb = b*b;
            powc = c*c;
       
            if(powa < powb + powc){
                eikaku++;
            } else if(powa > powb + powc) {
                donkaku++;
            } else {
                chokkaku++;
            }
        }
        
    }

    cout << sankaku << " " << chokkaku << " " << eikaku << " " << donkaku << endl;
    return 0;

}

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

using namespace std;

void solve()
{
	vector<int> edge(3);
	int triangle = 0;
	int right_triangle = 0;
	int acute_triangle = 0;
	int obtuse_triangle = 0;
	while(cin >> edge[0] >> edge[1] >> edge[2])
	{
		if(edge[0] + edge[1] > edge[2] && edge[1] + edge[2] > edge[0] && edge[2] + edge[0] > edge[1])
		{
			++triangle;
		}
		else
		{
			break;
		}
		sort(edge.begin(), edge.end());
		double cos_theta = (double)(edge[0] * edge[0] + edge[1] * edge[1] - edge[2] * edge[2]) / (2 * edge[0] * edge[1]);
		if( edge[0] * edge[0] + edge[1] * edge[1] == edge[2] * edge[2] ||
			edge[1] * edge[1] + edge[2] * edge[2] == edge[0] * edge[0] ||
			edge[2] * edge[2] + edge[0] * edge[0] == edge[1] * edge[1])
		{
			++right_triangle;
		}
		else if(cos_theta < 0)
		{
			++obtuse_triangle;
		}
		else
		{
			++acute_triangle;
		}
	}
	cout << triangle << " " << right_triangle << " " << acute_triangle << " " << obtuse_triangle << endl;
}

int main()
{
	solve();
	return(0);
}

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