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;
#define ll long long

int main()
{
    int sum=0,x=0,y=0,z=0,l[3];

    while(1){
        cin>>l[0]>>l[1]>>l[2];
        sort(l,l+3);

        if(l[2]>l[0]+l[1])break;
        
        sum++;

        int a = l[2]*l[2];
        int b = l[0]*l[0] + l[1]*l[1];

        if(a>b)z++;
        if(a==b)y++;
        if(a<b)x++;

    }

    cout<<sum<<" "<<y<<" "<<x<<" "<<z<<endl;

    return 0;
}

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

int main(){
  int a[3];
  int cnt[4] = {0, 0, 0, 0};
  while (true) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    if (a[0] + a[1] > a[2]) {
      cnt[0] ++;
      if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cnt[1] ++;
      if (a[0] * a[0] + a[1] * a[1]  > a[2] * a[2]) cnt[2] ++;
      if (a[0] * a[0] + a[1] * a[1]  < a[2] * a[2]) cnt[3] ++;
    } else {
      break;
    }
  }

  cout << cnt[0];
  cout << " " << cnt[1];
  cout << " " << cnt[2];
  cout << " " << cnt[3];
  cout << endl;
}

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

int triangle(int a, int b, int c){
  int max;
  if(a<b) max = b;
  else max = a;
  if(max<c) max = c;
  if(max >= a + b + c - max) return 0;
  int sqsum = a*a + b*b + c*c, sqmax = max*max;
  if(sqmax == sqsum - sqmax){
    return 1;
  }else if(sqmax < sqsum - sqmax){
    return 2;
  }
  return 3;
}

int main(){
  int tri[3]={};
  while(1){
    int a, b, c, ans;
    cin>>a>>b>>c;
    ans = triangle(a, b, c);
    if(!ans) break;
    tri[ans-1]++;
  }
  cout<<tri[0]+tri[1]+tri[2]<<" "<<tri[0]<<" "<<tri[1]<<" "<<tri[2]<<endl;
  return 0;
}

C++: #include <stdio.h>
#include <algorithm>

using namespace std;

int main(void)
{
	int node[5];
	int i, j, a = 0, b = 0, c = 0, d = 0, ch = 0;
	
	while (scanf("%d %d %d", &node[0], &node[1], &node[2]) != EOF){
		
		sort(node, node + 3);
		
		if (node[0] + node[1] <= node[2]){
			ch = 1;
		}
		if (ch == 0){
			a++;
		
			if (node[0] * node[0] + node[1] * node[1] == node[2] * node[2]){
				b++;
			}
			else if (node[0] * node[0] + node[1] * node[1] > node[2] * node[2]){
				c++;
			}
			else if (node[0] * node[0] + node[1] * node[1] < node[2] * node[2]){
				d++;
			}
		}
	}
	
	printf("%d %d %d %d\n", a, b, c, d);
	
	return (0);
}

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

int main(){

  int a,b,c,tri=0,ei=0,ty=0,don=0,maxnum;

  while(1){

    cin >> a >> b >> c;

    maxnum = max(a,max(b,c));

    if(maxnum == b){
      b = a;
      a = maxnum;
    }
    else if(maxnum == c){
      c = a;
      a = maxnum;
    }

    if(a < (b + c) ){
      tri++;
      if(a*a > b*b + c*c){
        don++;
      }
      else if(a*a == b*b + c*c){
        ty++;
      }
      else{
        ei++;
      }
    }
    else{
      cout << tri << " " << ty << " " << ei << " " << don << endl;
      break;
    }
  }

  return 0;
}

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

using ll = long long;
using namespace std;

int main() {
    int a[3];
    int x = 0, y = 0, z = 0;
    while (true){
        for (int &i : a) cin >> i;
        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]) x++;
        else if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2]) z++;
        else y++;
    }
    printf("%d %d %d %d\n",x+y+z, x, y, z);
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
  int count_total = 0; // 合計
  int count_1 = 0; // 直角三角形
  int count_2 = 0; // 鋭角
  int count_3 = 0; // 鈍角
  while(true) {
    int long_side = 0;
    int short_side1 = 0;
    int short_side2 = 0;
    int a, b, c = 0;
    cin >> a >> b >> c;
    if (!(abs(b-c) < a && a < b + c)) {
      cout << "-----" << endl;
      cout << count_total << " " << count_1 << " " << count_2 << " " << count_3 << endl;
      return 0;
    }
    count_total++;
    int max_side = a;
    if (b > a && b > c) {
      // bが一番長い
      long_side = b;
      short_side1 = a;
      short_side2 = c;
    } else if (c > a && c > b) {
      // cが一番長い
      long_side = c;
      short_side1 = a;
      short_side2 = b;
    } else {
      // aが一番長い
      long_side = a;
      short_side1 = b;
      short_side2 = c;
    }
    int d1 = long_side * long_side;
    int d2 = short_side1 * short_side1 + short_side2 * short_side2;
    // 鈍角
    if (d1 > d2) {
      count_3++;
    } else if (d1 == d2) {
      // 直角
      count_1++;
    } else {
      // 鋭角
      count_2++;
    }
  }

}

C++: #include<cstdio>
int a,b,c;
int re[4]={-1};
void st(int* p,int* q){
int r;
if(*p<*q){
r=*p;*p=*q;*q=r;
}
return;
}
int main(void){
while(1){
re[0]++;
scanf("%d%d%d",&a,&b,&c);
st(&a,&b);st(&a,&c);st(&b,&c);
if(a>=b+c)break;
if(a*a>b*b+c*c)re[3]++;
else if(a*a<b*b+c*c)re[2]++;
else re[1]++;
}
printf("%d",re[0]);
for(a=1;a<4;a++){
printf(" %d",re[a]);
}
printf("\n");
return 0;
}

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

inline int sq(const int x) { return x * x; };

int main() {
    vector<int> s(3, 0);
    while(true) {
        vector<int> in(3);
        for(int i = 0; i < 3; i++) cin >> in[i];
        sort(in.begin(), in.end());
        if(in[0] + in[1] <= in[2]) break;
        int left = sq(in[2]);
        int right = sq(in[0]) + sq(in[1]);
        if(left == right) s[1]++;
        else if(left < right) s[0]++;
        else s[2]++;
    }
    cout << accumulate(s.begin(), s.end(), 0) << ' ' << s[1] << ' ' << s[0] << ' ' << s[2] << endl;
}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<int> ret(4, 0);

    for(;;){
        vector<int> a(3);
        for(int i=0; i<3; ++i)
            cin >> a[i];
        sort(a.begin(), a.end());

        if(a[0] + a[1] <= a[2])
            break;
        ++ ret[0];

        int b = a[0] * a[0] + a[1] * a[1];
        int c = a[2] * a[2];
        if(b < c)
            ++ ret[3];
        else if(b > c)
            ++ ret[2];
        else
            ++ ret[1];
    }

    for(int i=0; i<3; ++i)
        cout << ret[i] << ' ';
    cout << ret[3] << endl;

    return 0;
}

C++: #include<stdio.h>
 
int main(){
	int a[3], b, i, j, e = 0, f = 0, g = 0, h = 0;
	while(scanf("%d %d %d", &a[0], &a[1], &a[2]) != EOF){
		for(i = 0; i < 2; i++){
			for(j = i + 1; j < 3; j++){
				if(a[i] < a[j]){
					b = a[i];
					a[i] = a[j];
					a[j] = b;
				}
			}
		}
		if(a[0] >= a[1] + a[2]) continue;
		else e++;
		if(a[0] * a[0] > a[1] * a[1] + a[2] * a[2]) f++;
		else if(a[0] * a[0] == a[1] * a[1] + a[2] * a[2]) g++;
		else h++;
	}
	printf("%d %d %d %d\n", e, g, h, f);
	return 0;
}