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>

#define rep_(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)
#define rrep_(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rrep_(v, 0, n - 1)
#define rlep(v, n) rrep_(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define eachv(v, i) rep(i, v.size())
#define reachv(v, i) rrep(i, v.size())
#define debug(x) std::cerr << #x << " = " << x << "\n";

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

bool is_triangle(int a, int b, int c){
    return (a < b + c && b < a + c && c < a + b);
}
bool is_right(int a, int b, int c){
    return a * a + b * b == c * c;
}
int get_type(int a, int b, int c){
    if (is_right(a, b, c) || is_right(b, c, a) || is_right(a, c, b)){
        return 1;
    }
    if (is_triangle(a * a, b * b, c * c)){
        return 2;
    }
    return 3;
}
int main()
{
    int bucket[4] = {};
    int a, b, c;
    while (~scanf("%d %d %d", &a, &b, &c)){
        if (is_triangle(a, b, c)){
            bucket[0]++;
            bucket[get_type(a, b, c)]++;
        }
        else break;
    }
    show_a(bucket, 4);
    return (0);
}

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

bool exist(int a,int b,int c){
    bool flag=false;
    if(a>0&&b>0&&c>0&&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==c*c+b*b)return 0;
    else if(a*a<b*b+c*c)return 1;
    else if(a*a>c*c+b*b)return 2;
    else return 3;
}
void max_sort(int t[]){
    for(int i=0;i<3;i++){
        if (t[0]<t[i]){
            int tmp=t[0];
            t[0]=t[i];
            t[i]=tmp;
        }
    }
}

int main(){
    int c1=0,c2=0,c3=0,c4=0;
    int t_side[3];
    while(true){
        cin >> t_side[0]>>t_side[1]>>t_side[2];
        max_sort(t_side);
        if(!exist(t_side[0],t_side[1],t_side[2]))break;
        switch(type_check(t_side[0],t_side[1],t_side[2])){
            case 0: c1++; break;
            case 1: c2++; break;
            case 2: c3++; break;
        }
        c4++;
    }
    cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl;
    return 0;
}

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

int main(){
  int tri[4] = {};
  int l[3];
  
  while(cin >> l[0] >> l[1] >> l[2]){
    sort(l, l+3);
    if(l[0] + l[1] <= l[2]) break;
    
    tri[0]++;
    if(l[2]*l[2] == l[0]*l[0]+l[1]*l[1]) tri[1]++;
    if(l[2]*l[2] < l[0]*l[0]+l[1]*l[1]) tri[2]++;
    if(l[2]*l[2] > l[0]*l[0]+l[1]*l[1]) tri[3]++;
  }
  
  for(int i = 0 ; i < 4 ; i++){
    cout << tri[i];
    if(i == 3) cout << endl;
    else cout << " ";
  }
  return 0;
}

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

typedef unsigned int U4;
#define TRUE 1
#define FALSE 0

#define ACUTE_TRIANGLE 0
#define RIGHT_TRIANGLE 1
#define OBTUSE_TRIANGLE 2

U4 TrinagleNum = 0;
U4 AcuteTriangleNum = 0;
U4 RightTriangleNum = 0;
U4 ObtuseTriangleNum = 0;

U4 U4_TriangleCheck(U4,U4,U4);
U4 U4_TypeCheck(U4,U4,U4);
void V_LengthSort(U4*,U4*,U4*);
int main(void){

U4 a;
U4 b;
U4 c;

  while(1){
    cin >> a >> b >> c;
    if(U4_TriangleCheck(a,b,c) == TRUE){
      TrinagleNum++;
      if(U4_TypeCheck(a,b,c) == ACUTE_TRIANGLE){
        AcuteTriangleNum++;
      }else if(U4_TypeCheck(a,b,c) == OBTUSE_TRIANGLE){
        ObtuseTriangleNum++;
      }else{
        RightTriangleNum++;
      }
    }else{
      break;
    }
  }

  cout << TrinagleNum << " " << RightTriangleNum << " " << AcuteTriangleNum << " " << ObtuseTriangleNum << endl;
}

U4 U4_TriangleCheck(U4 a,U4 b,U4 c){
  if((a + b > c) && (b + c > a) && (c + a > b)){
    return TRUE;
  }else{
    return FALSE;
  }
}

U4 U4_TypeCheck(U4 a,U4 b,U4 c){
  U4 LongLength;
  U4 MiddleLength;
  U4 ShortLength;
  U4 LongLengthSquare;
  U4 MiddleLengthSquare;
  U4 ShortLengthSquare;

  LongLength   = a;
  MiddleLength = b;
  ShortLength  = c;

  V_LengthSort(&LongLength,&MiddleLength,&ShortLength);

  LongLengthSquare   = LongLength * LongLength;
  MiddleLengthSquare = MiddleLength * MiddleLength;
  ShortLengthSquare  = ShortLength * ShortLength;

  if(MiddleLengthSquare + ShortLengthSquare > LongLengthSquare){
    return OBTUSE_TRIANGLE;
  }else if(MiddleLengthSquare + ShortLengthSquare < LongLengthSquare){
    return ACUTE_TRIANGLE;
  }else{
    return RIGHT_TRIANGLE;
  }
}

void V_LengthSort(U4* Long,U4 *Middle,U4 *Short){
  U4 buff;

  if((*Long >= *Middle) && (*Long >= *Short)){
    // Do Nothing
  }else if(*Middle >= *Short){
    buff = *Long;
    *Long = *Middle;
    *Middle = buff;
  }else{
    buff = *Long;
    *Long = *Short;
    *Short = buff;
  }
}

C++: ans = [0 for i in range(4)]
while True:
  sides = sorted([int(inp) for inp in input().split()])
  if sides[2] >= sides[1] + sides[0]:
    print(ans[0], ans[1], ans[2], ans[3])
    break
  if sides[2]**2 > sides[1]**2 + sides[0]**2:
    ans[3]+=1
  elif sides[2]**2 == sides[1]**2 + sides[0]**2:
    ans[1]+=1
  else:
    ans[2]+=1
  ans[0]+=1

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

constexpr inline int square(int x) {
	return x * x;
}

int main() {
	int edge[3];
	int triangle = 0;
	int right	 = 0;
	int acute	 = 0;
	int obtuse	 = 0;

	while(scanf("%d %d %d", edge, edge + 1, edge + 2) == 3) {
		sort(edge, edge + 3);

		if(edge[0] + edge[1] <= edge[2]) {
			printf("%d %d %d %d\n", triangle, right, acute, obtuse);
			continue;
		}

		++triangle;
		const int a = square(edge[0]) + square(edge[1]);
		const int b = square(edge[2]);

		if(a == b) ++right;
		else if(a > b) ++acute;
		else ++obtuse;
	}

	return EXIT_SUCCESS;
}

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


bool sankaku(int a, int b, int c) {
    int max_ = a;
    if (max_ < b) {
        max_ = b;
    }
    if (max_ < c) {
        max_ = c;
    }
    if (a + b + c - max_ > max_) {
        return true;
    }
    else {
        return false;
    }
}


int nani_sankaku(int a, int b, int c) {
    int hen[3] = {a, b, c};
    sort(hen, hen + 3);
    double ab = pow(hen[0], 2) + pow(hen[1], 2);
    double c_ = pow(hen[2], 2);
    if (ab > c_) {
        return 2;
    }
    if (ab == c_) {
        return 1;
    }
    if (ab < c_) {
        return 3;
    }

}


int main() {
    int ANS[4] = {0, 0, 0, 0};
    while (true) {
        int a;
        int b;
        int c;
        cin >> a >> b >> c;

        if (sankaku(a, b, c)) {
            ANS[nani_sankaku(a, b, c)]++;
            ANS[0]++;
        }
        else {
            cout << ANS[0] << ' ' << ANS[1] << ' ';
            cout << ANS[2] << ' ' << ANS[3] << '\n';
            return 0;
        }
    }
}