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>
typedef long long LL;
using namespace std;

int main(){
  vector<int> a(3);
  int cnt[4] = {0, 0, 0, 0};
  while (cin >> a[0] >> a[1] >> [2]) {
    if (a[0] + a[1] > a[2] && a[0] + a[2] > a[1] && a[1] + a[2] > a[0]) {
      cnt[0] ++;
      sort(a.begin(), a.end());
      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] ++;
    }
  }

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

C++: #include<cstdio>
int main(void){
    
    int a=0,b=0,c=0;
    int change=0;
    int right=0,obtuse=0,acute=0;
    int value=0,check=0,count=0;
    int flag=true;
    while(flag){
        count++;
        scanf("%d%d%d",&a,&b,&c);
        if(c<a){
            change=a;
            a=c;
            c=a;
        }
        if(c<b){
            change=b;
            b=c;
            c=b;
        }
        check=a+b-c;
        value=a*a+(b*b-c*c);
        if(check<=0){
            break;
        }
        if(value==0){
            right++;
        }
        else if(value<0){
            obtuse++;
        }
        else{
            acute++;
        }
    }
    printf("%d %d %d %d",count,right,acute,obtuse);
    return 0;
}

C++: #include <cstdio>
#include <cctype>
#include <utility>
#include <array>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	array<int, 3> l{};
	for (int a, b, c, n = 0; scan(a, b, c);) {
		if (a > b) swap(a, b);
		if (b > c) swap(b, c);
		double r = (a * a + b * b - c * c) / 2.0 / a / b;
		if (r > -1) {
			n++;
			if (r == 0)
				l[0]++;
			else if (r > 0)
				l[1]++;
			else
				l[2]++;
		} else {
			out(n);
			for (int x: l)
				out(' ' ,x);
			outl();
			break;
		}
	}
}

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

struct Triangle{
	int sides[3];
};

bool checkTriangle(const Triangle& t){
	for(int i=0;i<3;i++){
		if(t.sides[i] + t.sides[(i+1)%3] <= t.sides[(i+2)%3])return false;
	}
	return true;
}

bool checkRightTriangle(Triangle& t){
	std::sort(t.sides, t.sides+3);
	return (t.sides[0] * t.sides[0] + t.sides[1] * t.sides[1] == t.sides[2] * t.sides[2]);
}

bool checkObtuseTriangle(Triangle& t){
	double cos = 1.0 * (t.sides[0] * t.sides[0] + t.sides[1] * t.sides[1] - t.sides[2] * t.sides[2]) / (2 * t.sides[0] * t.sides[1]);
	return (cos < 0);
}

bool checkAcuteTriangle(Triangle& t){
	double cos = 1.0 * (t.sides[0] * t.sides[0] + t.sides[1] * t.sides[1] - t.sides[2] * t.sides[2]) / (2 * t.sides[0] * t.sides[1]);
	return (cos > 0);
}

int main(){
	int a, b, c, tn = 0, rtn = 0, otn = 0, atn = 0;
	bool ignored = false;
	while(std::cin >> a >> b >> c, !std::cin.eof()){
		if(ignored)continue;
		Triangle t = {{a, b, c}};
		if(checkTriangle(t)){
			tn++;
			if(checkRightTriangle(t))rtn++;
			if(checkObtuseTriangle(t))otn++;
			if(checkAcuteTriangle(t))atn++;
		}
		else ignored = true;
	}

	printf("%d %d %d %d\n", tn, rtn, atn, otn);
}

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

int a, b, c;
int n[4];

int main(){
	while(true){
		scanf("%d %d %d", &a, &b, &c);
		if(a > b) swap(a, b);
		if(b > c) swap(b, c);
		if(a + b <= c) break;
		++n[0];
		if(a*a + b*b < c*c) ++n[3];
		else if(a*a + b*b == c*c) ++n[1];
		else ++n[2];
	}
	printf("%d %d %d %d\n", n[0], n[1], n[2], n[3]);
}

C++: #include<cstdio>
int main(void){
    
    int a=0,b=0,c=0;
    int change=0;
    int right=0,obtuse=0,acute=0;
    int value=0,check=0,count=0;
    int flag=true;
    while(flag){
        count++;
        scanf("%d%d%d",&a,&b,&c);
        if(c<a){
            change=a;
            a=c;
            c=a;
        }
        if(c<b){
            change=b;
            a=b;
            b=a;
        }
        check=a+b-c;
        value=a*a+(b*b-c*c);
        if(check<=0){
            break;
        }
        if(value==0){
            right++;
        }
        else if(value<0){
            obtuse++;
        }
        else{
            acute++;
        }
    }
    printf("%d %d %d %d",count,right,acute,obtuse);
    return 0;
}

C++: #include<cstdio>
int main(void){
    
    int a=0,b=0,c=0;
    int change=0;
    int right=0,obtuse=0,acute=0;
    int value=0,check=0,count=0;
    int flag=true;
    while(flag){
        count++;
        scanf("%d%d%d",&a,&b,&c);
        if(c<a){
            change=a;
            a=c;
            c=change;
        }
        if(c<b){
            change=b;
            b=c;
            c=change;
        }
        check=a+b-c;
        value=a*a+b*b-c*c;
        if(check<=0){
            break;
        }
        
        if(value==0){
            right++;
        }
        if(value<0){
            obtuse++;
        }
        if(value>0){
            acute++;
        }
    }
    printf("%d %d %d %d\n",count,right,acute,obtuse);
    return 0;
}