//! (c) WhiZTiM __ionogu(<_at_)>acm.org
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
struct Triples {
Triples() = default;
Triples(unsigned aa, unsigned bb, unsigned cc): a(aa), b(bb), c(cc) {}
unsigned a=0; unsigned b=0; unsigned c=0;
};
using vTriples = vector<Triples>;
Triples triples(size_t lower, size_t max, size_t num){
Triples ans;
for(size_t x=lower; x<max; x++)
for(size_t y=x; y<max; y++)
for(size_t z=y; z<max; z++)
if((x*x + y*y == z*z) and x + y + z == num)
return Triples(x, y, z);
return ans;
}
int main() {
auto t = triples(1, 1000, 1000);
cout << t.a << ", " << t.b << ", " << t.c << '\n';
cout << "Product: " << t.a * t.b * t.c << '\n';
return 0;
}
Ly8hIChjKSBXaGlaVGlNIF9faW9ub2d1KDxfYXRfKT5hY20ub3JnCiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBUcmlwbGVzIHsgCglUcmlwbGVzKCkgPSBkZWZhdWx0OwoJVHJpcGxlcyh1bnNpZ25lZCBhYSwgdW5zaWduZWQgYmIsIHVuc2lnbmVkIGNjKTogYShhYSksIGIoYmIpLCBjKGNjKSB7fQoJdW5zaWduZWQgYT0wOyB1bnNpZ25lZCBiPTA7IHVuc2lnbmVkIGM9MDsKfTsKdXNpbmcgdlRyaXBsZXMgPSB2ZWN0b3I8VHJpcGxlcz47CgpUcmlwbGVzIHRyaXBsZXMoc2l6ZV90IGxvd2VyLCBzaXplX3QgbWF4LCBzaXplX3QgbnVtKXsKCVRyaXBsZXMgYW5zOwoJZm9yKHNpemVfdCB4PWxvd2VyOyB4PG1heDsgeCsrKQoJCWZvcihzaXplX3QgeT14OyB5PG1heDsgeSsrKQoJCQlmb3Ioc2l6ZV90IHo9eTsgejxtYXg7IHorKykKCQkJCWlmKCh4KnggKyB5KnkgPT0geip6KSBhbmQ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