Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
int findmax(int n){
  vi sum(20000);
  rep(i,20000) sum[i]=i;
  rep(i,19999) sum[i+1]+=sum[i];
  rep(i,20000){
    if(sum[i]>=n) return i;
  }
}

signed main(){
  int n;
  cin>>n;
  vi ans;

  while(n>0){
    int k=findmax(n);
    ans.push_back(k);
    n-=k;    
  }
  rep(i,ans.size()) cout<<ans[i]<<endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/
int findmax(int n){
  vi sum(20000);
  rep(i,20000) sum[i]=i;
  rep(i,19999) sum[i+1]+=sum[i];
  rep(i,20000){
    if(sum[i]>=n) return i;
  }
}

signed main(){
  int n;
  cin>>n;
  vi ans;

  while(n>0){
    int k=findmax(n);
    ans.push_back(k);
    n-=k;    
  }
  rep(i,ans.size()) cout<<ans[i]<<endl;
  return 0;
}


Compiler output:
a.cc:50:5: error: redefinition of 'long long int gcd(long long int, long long int)'
   50 | int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
      |     ^~~
a.cc:10:5: note: 'long long int gcd(long long int, long long int)' previously defined here
   10 | int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
      |     ^~~
a.cc:53:5: error: redefinition of 'long long int dx []'
   53 | int dx[]={0,1,0,-1,1,-1,-1,1};
      |     ^~
a.cc:13:5: note: 'long long int dx [8]' previously defined here
   13 | int dx[]={0,1,0,-1,1,-1,-1,1};
      |     ^~
a.cc:54:5: error: redefinition of 'long long int dy []'
   54 | int dy[]={1,0,-1,0,1,1,-1,-1};
      |     ^~
a.cc:14:5: note: 'long long int dy [8]' previously defined here
   14 | int dy[]={1,0,-1,0,1,1,-1,-1};
      |     ^~
a.cc:55:11: error: redefinition of 'const long long int MOD'
   55 | const int MOD = 1e9+7;
      |           ^~~
a.cc:15:11: note: 'const long long int MOD' previously defined here
   15 | const int MOD = 1e9+7;
      |           ^~~
a.cc:56:11: error: redefinition of 'const long long int INF'
   56 | const int INF = 1e18+10;
      |           ^~~
a.cc:16:11: note: 'const long long int INF' previously defined here
   16 | const int INF = 1e18+10;
      |           ^~~
a.cc:59:5: error: redefinition of 'long long int findmax(long long int)'
   59 | int findmax(int n){
      |     ^~~~~~~
a.cc:19:5: note: 'long long int findmax(long long int)' previously defined here
   19 | int findmax(int n){
      |     ^~~~~~~
a.cc:68:8: error: redefinition of 'int main()'
   68 | signed main(){
      |        ^~~~
a.cc:28:8: note: 'int main()' previously defined here
   28 | signed main(){
      |        ^~~~
a.cc: In function 'long long int findmax(long long int)':
a.cc:26:1: warning: control reaches end of non-void function [-Wreturn-type]
   26 | }
      | ^
a.cc: In function 'long long int findmax(long long int)':
a.cc:66:1: warning: control reaches end of non-void function [-Wreturn-type]
   66 | }
      | ^