#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const ll INF=1LL<<60; typedef pair P; typedef pair PP; const ll MOD=1e9+7; int main(){ ll N; cin>>N; typedef tuple TP; vector ans; for(ll x=0;3*x*x<=N;x++){ for(ll y=x;y*y+2*x*y<=N;y++){ ll c=N-x*y; if(c<0) continue; if((x+y)==0) continue; if(c%(x+y)==0){ ll z=c/(x+y); if(y>z) continue; //x<=y<=z vector vec={x,y,z}; if(x!=y && y!=z && z!=x ){ do{ ans.emplace_back(vec[0],vec[1],vec[2]); }while(next_permutation(vec.begin(),vec.end())); } else if(x==y && y!=z){ ans.emplace_back(x,y,z); ans.emplace_back(x,z,y); ans.emplace_back(z,x,y); }else if(x!=y && y==z){ ans.emplace_back(x,y,z); ans.emplace_back(z,x,y); ans.emplace_back(z,y,x); }else{ //x==y==z ans.emplace_back(x,y,z); } } } } cout<