#include using namespace std; #define ALL(a) a.begin(), a.end() void solve() { int n; cin >> n; int nn = n / 3; vector> ans; int x = 0, xx = 0; while (xx <= nn) { const int k = n + xx; int yy = x << 1, yyy = yy * yy; while (yyy <= k) { if (yy == 0 || k % yy > 0) { yyy += (yy++ << 1) | 1; continue; } vector per = {x, yy - x, k / yy - x}; do { ans.push_back({per[0], per[1], per[2]}); } while (next_permutation(ALL(per))); yyy += (yy++ << 1) | 1; } xx += (x++ << 1) | 1; } cout << ans.size() << '\n'; for (auto &[x, y, z] : ans) cout << x << ' ' << y << ' ' << z << '\n'; cout << "^_^" << '\n'; return; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(13); solve(); return 0; }