/* -*- coding: utf-8 -*- * * 2358.cc: No.2358 xy+yz+zx=N - yukicoder */ #include #include #include #include using namespace std; /* constant */ /* typedef */ typedef vector vi; typedef set svi; /* global variables */ /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); svi as; for (int x = 0; x * x * 3 <= n; x++) { int m = n + x * x; for (int p = max(1, x); p * p <= m; p++) if (m % p == 0) { int q = m / p; int y = p - x, z = q - x; if (x <= y && y <= z) { as.insert({x, y, z}); as.insert({x, z, y}); as.insert({y, x, z}); as.insert({y, z, x}); as.insert({z, x, y}); as.insert({z, y, x}); } } } printf("%d\n", (int)as.size()); for (auto &v: as) printf("%d %d %d\n", v[0], v[1], v[2]); return 0; }