Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
typedef vector<vector<ll> > matrix;
const int mod = 1e9+7;
ll gcd(ll a,ll b){
	if(b==0)return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){ans = ans*base;ans = ans%mod;}
        base *= base;base%=mod;pow/=2;}return ans;
}
ll inv(ll x){return expo(x,mod-2);}

double pi = 3.141592653589793238462643;
double error = 0.0000001;
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/* -------Template ends here-------- */

const int M = 100001;


int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);


    ll o_lo = 0 , o_hi = 1e16 + 1000;

    ll to;
    sll(to);

    ll large = 1e16;

    while(o_lo <= o_hi){
        ll o_mid = (o_lo + o_hi)/2;

        vector<ll> vec(50 , 0);
        vector<ll> hh(50 , 0);
        for(int i = 0 ; i < 20 ; i++){
            vec[i] = o_mid;
            hh[i] = o_mid;
        }



    ll ans = 0;

    int n = hh.size();
    while(1){
        sort(vec.begin() , vec.end());
        ll term = vec[n - 1];

        if(term < n) break;
        ll lo = 0 , hi = large;
        ll here = 0;

        while(lo <= hi){
            ll mid = (lo + hi)/2;
            ll mak = term - mid*(n);
            if(mak >= n){
                lo = mid + 1;
            }
            else{
                here = mid;
                hi = mid - 1;
            }
        }
       // if(steps > 20) break;
        vec[n - 1] -= (here*n);

        for(int i = 0 ; i < n - 1 ; i++){
            vec[i] += (here);
        }

        ans += here;
    }


    if(ans == to){
        cout<<hh.size()<<endl;
        for(int i = 0 ; i < hh.size() ; i++){
            cout<<hh[i]<<" ";
        }
        return 0;
    }
    else if(ans > to){
        o_hi = o_mid - 1;
    }
    else{
        o_lo = o_mid + 1;
    }

    }















}












#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
typedef vector<vector<ll> > matrix;
const int mod = 1e9+7;
ll gcd(ll a,ll b){
	if(b==0)return a;return gcd(b,a%b);
}
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){ans = ans*base;ans = ans%mod;}
        base *= base;base%=mod;pow/=2;}return ans;
}
ll inv(ll x){return expo(x,mod-2);}

double pi = 3.141592653589793238462643;
double error = 0.0000001;
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
/* -------Template ends here-------- */

const int M = 100001;


int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);


    ll o_lo = 0 , o_hi = 1e16 + 1000;

    ll to;
    sll(to);

    ll large = 1e16;

    while(o_lo <= o_hi){
        ll o_mid = (o_lo + o_hi)/2;

        vector<ll> vec(50 , 0);
        vector<ll> hh(50 , 0);
        for(int i = 0 ; i < 10 ; i++){
            vec[i] = o_mid;
            hh[i] = o_mid;
        }


        for(int i = 10 ; i < 20 ; i++){
            vec[i] = o_mid/2;
            hh[i] = o_mid/2;
        }

        for(int i = 20 ; i < 30 ; i++){
            vec[i] = o_mid/3;
            hh[i] = o_mid/3;
        }

        for(int i = 30 ; i < 40 ; i++){
            vec[i] = o_mid/4;
            hh[i] = o_mid/4;
        }

        for(int i = 40 ; i < 50 ; i++){
            vec[i] = o_mid/5;
            hh[i] = o_mid/5;
        }

    ll ans = 0;

    int n = hh.size();
    while(1){
        sort(vec.begin() , vec.end());
        ll term = vec[n - 1];

        if(term < n) break;
        ll lo = 0 , hi = large;
        ll here = 0;

        while(lo <= hi){
            ll mid = (lo + hi)/2;
            ll mak = term - mid*(n);
            if(mak >= n){
                lo = mid + 1;
            }
            else{
                here = mid;
                hi = mid - 1;
            }
        }
       // if(steps > 20) break;
        vec[n - 1] -= (here*n);

        for(int i = 0 ; i < n - 1 ; i++){
            vec[i] += (here);
        }

        ans += here;
    }


    if(ans == to){
        cout<<hh.size()<<endl;
        for(int i = 0 ; i < hh.size() ; i++){
            cout<<hh[i]<<" ";
        }
        return 0;
    }
    else if(ans > to){
        o_hi = o_mid - 1;
    }
    else{
        o_lo = o_mid + 1;
    }

    }















}














Compiler output:
a.cc:138:11: error: redefinition of 'const int mod'
  138 | const int mod = 1e9+7;
      |           ^~~
a.cc:9:11: note: 'const int mod' previously defined here
    9 | const int mod = 1e9+7;
      |           ^~~
a.cc:139:4: error: redefinition of 'long long int gcd(long long int, long long int)'
  139 | ll gcd(ll a,ll b){
      |    ^~~
a.cc:10:4: note: 'long long int gcd(long long int, long long int)' previously defined here
   10 | ll gcd(ll a,ll b){
      |    ^~~
a.cc:142:4: error: redefinition of 'long long int expo(long long int, long long int)'
  142 | ll expo(ll base,ll pow){
      |    ^~~~
a.cc:13:4: note: 'long long int expo(long long int, long long int)' previously defined here
   13 | ll expo(ll base,ll pow){
      |    ^~~~
a.cc:148:4: error: redefinition of 'long long int inv(long long int)'
  148 | ll inv(ll x){return expo(x,mod-2);}
      |    ^~~
a.cc:19:4: note: 'long long int inv(long long int)' previously defined here
   19 | ll inv(ll x){return expo(x,mod-2);}
      |    ^~~
a.cc:150:8: error: redefinition of 'double pi'
  150 | double pi = 3.141592653589793238462643;
      |        ^~
a.cc:21:8: note: 'double pi' previously defined here
   21 | double pi = 3.141592653589793238462643;
      |        ^~
a.cc:151:8: error: redefinition of 'double error'
  151 | double error = 0.0000001;
      |        ^~~~~
a.cc:22:8: note: 'double error' previously defined here
   22 | double error = 0.0000001;
      |        ^~~~~
a.cc:152:5: error: redefinition of 'int dx [8]'
  152 | int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
      |     ^~
a.cc:23:5: note: 'int dx [8]' previously defined here
   23 | int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
      |     ^~
a.cc:153:5: error: redefinition of 'int dy [8]'
  153 | int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
      |     ^~
a.cc:24:5: note: 'int dy [8]' previously defined here
   24 | int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};
      |     ^~
a.cc:156:11: error: redefinition of 'const int M'
  156 | const int M = 100001;
      |           ^
a.cc:27:11: note: 'const int M' previously defined here
   27 | const int M = 100001;
      |           ^
a.cc:159:5: error: redefinition of 'int main()'
  159 | int main(){
      |     ^~~~
a.cc:30:5: note: 'int main()' previously defined here
   30 | int main(){
      |     ^~~~