#include #include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N, x, y, z_l, z_r, z_c; cin >> N; vector> ans; for (x = 0; x <= N; ++x) for (y = 0; y <= N && x * y <= N; ++y) for (z_l = 0, z_r = N; z_l <= z_r; ) { z_c = (z_l + z_r) / 2; if (x * y + z_c * static_cast(x + y) < N) z_l = z_c + 1; else if (x * y + z_c * static_cast(x + y) != N) z_r = z_c - 1; else ans.emplace_back(x, y, z_c), z_r = -1; } cout << ans.size() << '\n'; for (x = 0; x != ans.size(); ++x) cout << get<0>(ans[x]) << ' ' << get<1>(ans[x]) << ' ' << get<2>(ans[x]) << '\n'; return 0; }