#include using namespace std; using ll=long long; using pll=pair; using tll=tuple; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for (ll i=0;i<(ll)(n);i++) #define all(v) v.begin(),v.end() template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> n; ll q=sqrtl(n)+100; set> ans; for(ll y=1;y<=q;y++){ for(ll z=0;z<=n/y;z++){ if(y+z==0) continue; if((n-y*z)%(y+z)!=0) continue; ll x=(n-y*z)/(y+z); if(x<0) continue; vector v={x,y,z}; sort(all(v)); do{ ans.insert(v); }while(next_permutation(all(v))); } } cout << (ll)ans.size() << '\n'; for(auto &v:ans){ rep(i,v.size()){ cout << v[i]; if(i!=(ll)v.size()-1) cout << ' '; } cout << '\n'; } }