#include using namespace std; #define rep(i,n) for (int i = 0; i < (int)(n); ++i) #define rrep(i,n) for (int i = (int)(n-1); i >= 0; --i) #define Rep(i,a,b) for (int i = a; i < b; ++i) #define rRep(i,a,b) for (int i = a; i > b; --i) #define fore(i,a) for(auto &i:a) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define Unique(v) v.erase(unique(v.begin(), v.end()), v.end()); #define Bit(x,i) (((x)>>(i))&1) using ll = long long; using vi = vector; using vll = vector; using vvi = vector; using vvll = vector; using vb = vector; using vs = vector; using pii = pair; using pll = pair; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N; // x <= y <= z for(ll x = 0; x*x <= N; ++x) { for(ll y = x; y*y <= N; ++y) { if(x*y > N) break; if(x+y == 0) continue; if((N - x*y) % (x+y) == 0) { ll z = (N - x*y) / (x+y); if(z < y) break; vll tmp = {x, y, z}; do { ans.push_back(tmp); } while(next_permutation(all(tmp))); } } } cout << ans.size() << endl; fore(a, ans) { cout << a[0] << ' ' << a[1] << ' ' << a[2] << endl; } }