#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> N; set> st; // x<=y<=z for(ll z=0;z<=N;z++){ for(ll y=0;y*z<=N && y<=N;y++){ if(y+z==0) continue; ll r = N-(y*z); if(r>=0){ if(r%(y+z)==0 && r/(y+z)<=y){ ll x = r/(y+z); st.insert({x,y,z}); } } else break; } } set> ans; for(auto s:st){ vector v(3); rep(i,3) v[i]=i; do{ vector a = {s[v[0]],s[v[1]],s[v[2]]}; ans.insert(a); }while(next_permutation(v.begin(), v.end())); } int T = sz(ans); cout << T << '\n'; for(auto a:ans){ cout << a[0] << ' ' << a[1] << ' ' << a[2] << '\n'; } return 0; };