#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include #define int long long using namespace std; using ll = long long; void solve(); template void println(Args... args) { apply([](auto &&... args) { ((cout << args << ' '), ...); }, tuple(args...)); cout << '\n'; } int32_t main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int t = 1; // cin >> t; for (int tc = 0; tc < t; ++tc) { solve(); } return 0; } void solve() { int n; cin >> n; vector> res; for (int x = 0; 3 * x * x <= n; ++x) { for (int y = x + !x; x * y <= n && y <= n; ++y){ if ((n - x * y) % (x + y)) continue; int z = (n - x * y) / (x + y); if (z < y) continue; array ans{(int32_t)x, (int32_t)y, (int32_t)z}; do{ res.push_back(ans); } while (next_permutation(ans.begin(), ans.end())); } } cout << res.size() << '\n'; for (auto [x, y, z] : res) { cout << x << ' ' << y << ' ' << z << '\n'; } cout << endl; }