/** A Pythagorean triplet is a set of three natural numbers, a  b  c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc. */

#include "0.hpp"

int main()
{
  const uu _max = 1000;
  uu _min = (int)((sqrt(2) - 1) * _max);
  
  uu root;
  uu i;
  for(i = _min; i <= _max; i++) {
    uu sqr = (i + _max) * (i + _max) - 2 * _max * _max;
    root = (int)(sqrt((double)sqr) + _eps);
    if(sqr == root * root) break;
  }
  cout << i << endl << (_max + root - i) / 2 << endl;
  cout << abs(_max - i - root) / 2 << endl;
  
  return 0;
}