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<stdio.h>
#include<algorithm>
int p[3];
using namespace std;
int main(){
	int a=0,b=0,c=0,d=0;
	while(~scanf("%d%d%d",p,p+1,p+2)){
		std::sort(p,p+3);
		if(p[0]+p[1]<=p[2]){
			printf("%d %d %d %d\n",a,b,c,d);
			return 0;
		}
		a++;
		if(p[0]*p[0]+p[1]*p[1]==p[2]*p[2])b++;
		if(p[0]*p[0]+p[1]*p[1]>p[2]*p[2])c++;
		if(p[0]*p[0]+p[1]*p[1]<p[2]*p[2])d++;
	}
}

C++: // ------------------------------------
// Date:2018/ 2/20
// Problem:AOJ 0582 TriangleTypes 0582.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto&& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define POW(n) (n)*(n)

int main()
{
  int acute,right,obtuse;
  acute = right = obtuse = 0;
  vector<int> length(3,0);
  while(scanf("%d %d %d",&length[0],&length[1],&length[2]) != EOF) {
    sort(ALL(length));
    if (length[2] >= length[0] + length[1]) break;
    else if (POW(length[2]) < POW(length[0]) + POW(length[1])) ++acute;
    else if (POW(length[2]) == POW(length[0]) + POW(length[1])) ++right;
    else ++obtuse;
  }
  printf("%d %d %d %d\n", acute+right+obtuse, right, acute, obtuse);
  return 0;
}

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

int main() {
  int o0 = 0, o1 = 0, o2 = 0, o3 = 0; // 全三角形, 鋭角, 直角, 鈍角のカウンタ
  while (true) {
    int a, b, c;
    cin >> a >> b >> c;
    // aを最長とする
    if (a < b) {
      int temp = b;
      b = a;
      a = temp;
    }
    if (a < c) {
      int temp = c;
      c = a;
      a = temp;
    }
    if (fabs(b - c) < a && a < b + c) {
      o0++;
      // 余弦定理から判定
      if (a * a > b * b + c * c) {
	o3++;
      } else if (a * a < b * b + c * c) {
	o1++;
      } else {
	o2++;
      }
    } else {
      // 終了
      break;
    }
  }
  cout << o0 << " " << o2 << " " << o1 << " " << o3 << endl;
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
signed main(){
int a[3];
int k[3]{};
while(1){
    scanf("%d%d%d",&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])k[0]++;
    else if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2])k[1]++;
    else k[2]++;
    }
    printf("%d %d %d %d\n",k[0]+k[1]+k[2],k[1],k[2],k[0]);
}

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

	cout << tris << " " << right_tris << " " << acute_tris << " " << obtuse_tris << endl;

	return 0;
}

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

bool exist(int a,int b,int c){
    bool flag=false;
    if(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++: #import <iostream>
#import <algorithm>
using namespace std;

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

C++: #include <cstdio>
#include <cstdlib>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

int cnt[3];
int as[3];

int main()
{
  while( true )
  {
    int a, b, c;
    scanf( "%d%d%d", &a, &b, &c );

    as[0] = a, as[1] = b, as[2] = c;

    std::sort( as, as+3 );

    if( abs(a-b) < c && c < a+b )
    {
      int py = as[2]*as[2]-as[0]*as[0]-as[1]*as[1];

      if( py == 0 )
        ++cnt[0];
      else if( py < 0 )
        ++cnt[1];
      else
        ++cnt[2];
    }
    else
    {
      printf( "%d %d %d %d\n", cnt[0]+cnt[1]+cnt[2], cnt[0], cnt[1], cnt[2] );

      return 0;
    }
  }
  
  return 0;
}

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

int main() {
  int a, b, c, x, count , p, q, r;
  count = p = q = r = 0;
  
  while(1){
    cin >> a >> b >> c;
    if (a < b) {
      x = a;
      a = b;
      b = x;
    }
    if (b < c) {
      x = b;
      b = c;
      c = x;
    }
    if (a < b) {
      x = a;
      a = b;
      b = x;
    }
    
    if (b + c > a){
      if (b*b + c*c == a*a) {
        p++;
      } else if (b*b + c*c > a*a) {
        q++;
      } else {
        r++;
      }
      count++;
    } else {
      break;
    }
  }
  cout << count << " " << p << " " << q << " " << r << endl;
  
  return 0;
  
}

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

int san = 0;
int a[3];
int inu = 0;
int saru = 0;
int kiji = 0;

int main(){
	while (true){
		for (int i = 0; i < 3; i++){
			cin >> a[i];
		}
		sort(a, a + 3);
		if (a[3] * a[3] < a[2] * a[2] + a[1] * a[1] && a[3] < a[1] + a[2]){
			san = san + 1;
			saru = saru + 1;
		}if (a[3] * a[3] == a[2] * a[2] + a[1] * a[1] && a[3] < a[1] + a[2]){
			san = san + 1;
			inu = inu + 1;
		}if (a[3] * a[3] > a[2] * a[2] + a[1] * a[1] && a[3] < a[1] + a[2]){
			san = san + 1;
			kiji = kiji + 1;
		}if (a[3] >= a[1] + a[2]){
			break;
		}
	}
	cout << san << " " << inu << " " << saru << " " << kiji << endl;
}

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

using namespace std;

int main(){
    int e[3];
    int cnt1=0,cnt2=0,cnt3=0,cnt4=0;
    while(cin>>e[0]>>e[1]>>e[2]){
        sort(e,e+3);
        int a=e[0],b=e[1],m=e[2];
        if(m<a+b){
            ++cnt1;
            if(m*m<a*a+b*b) ++cnt3;
            else if(m*m==a*a+b*b) ++cnt2;
            else ++cnt4;
        }
        else break;
    }
    cout<<cnt1<<" "<<cnt2<<" "<<cnt3<<" "<<cnt4<<endl;
    return 0;
}