#include using namespace std; // #include // using namespace atcoder; // using mint = modint998244353; using ll = unsigned long long; #define fix(x) fixed << setprecision(x) #define rep(i, n) for(int i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> n; vector> ans; for(ll i=1;i*i<=n*2;++i){ if(n*2%i==0){ ll m = n*2/i; if((m-i+1)%2==0){ ll k = (m-i+1)/2; ans.emplace_back(1,k-1,k+i-1); } } } for(int t=2;t<=39;++t){ vector tot(1,0); for(ll i=1;;++i){ ll x = 1; rep(_,t){ if(x>n/i){ x = 0; break; } x *= i; } if(x==0) break; tot.emplace_back(x); tot[i] += tot[i-1]; } unordered_map mp; rep(i,(int)tot.size()){ if(mp.count(tot[i]-n)){ ans.emplace_back(t, mp[tot[i]-n], i); } mp[tot[i]] = i; } } cout << ans.size() << '\n'; for(auto [t,p,q]:ans) cout << t << " " << p+1 << " " << q << '\n'; return 0; }