Language: C++

#include <cmath>
#include <map>
#include <queue>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
const ll MOD=ll(1e9+7);
 
//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)
 
ll P_POW(ll i, ll n) {
  if(n==0) return 1;
 
  n--;
  ll rep = i;
 
  while(n) {
    rep = rep * i;
    n--;
  }
  return rep;
} 
 
unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}
 
ll solve(ll n) {
    if (n % 2 == 1) return 0;
 
    ll res = 0;
    n /= 2;
    int c = 1;
 
    while ((ll) n/((ll)pow(5,c))) {
      res += n/P_POW(5,c);
      c++;
    }
    return res;
}
 
void f(int rest, string s) {
  char abc[] = "abc";
  if(rest == 0) {
    cout << s << endl;
  } else {
    for(int i=0; i < 3; i++) {
      f(rest - 1, s+abc[i]);
    }
  }
} 
 
int main() {
  ll n;
  cin >> n;
  // vector<vector<ll>> a(n ,vector<ll>{2,0});
  // vector
  // vector<ll> s(n,0);
  // vector<vector<ll>> v;
  // map<ll,ll> m;
  // priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
  // vector<pair<ll, ll>> epv(n, {0, 0});
  
  /* iterator
  for(auto&& m: em) {
    epv.push_back({ m.second, m.first });
  }
  */
 
  vector<ll> v(10000010, 0);
 
  REP(i, 10000000) {
    if(i == 0) {
      v[i] = 1;
    } else {
      v[i] = v[i-1] + (i+1);
    }
  }
 
  ll total = n;
  ll max = n;
  vector<ll> s;
 
  while(total != 0) {
    REP(i, v.size()) {
      if(v[i] >= total) {
        max = (i+1);
        total -= max;
        s.push_back(max);
        break;
      }
    }
  }
 
  sort(s.begin(), s.end());
 
  REP(i, s.size()) {
    cout << s[i] << endl;
  }
 
}
 

Compiler output:
a.cc: In function 'unsigned int binarySearch(ll, ll, ll)':
a.cc:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
   46 | }
      | ^
a.cc: At global scope:
a.cc:62:18: error: 'string' has not been declared
   62 | void f(int rest, string s) {
      |                  ^~~~~~
a.cc: In function 'void f(int, int)':
a.cc:65:5: error: 'cout' was not declared in this scope
   65 |     cout << s << endl;
      |     ^~~~
a.cc:4:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <queue>
  +++ |+#include <iostream>
    4 | 
a.cc:65:18: error: 'endl' was not declared in this scope
   65 |     cout << s << endl;
      |                  ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include <queue>
  +++ |+#include <ostream>
    4 | 
a.cc: In function 'int main()':
a.cc:75:3: error: 'cin' was not declared in this scope
   75 |   cin >> n;
      |   ^~~
a.cc:75:3: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:115:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
  115 |   sort(s.begin(), s.end());
      |   ^~~~
      |   sqrt
a.cc:118:5: error: 'cout' was not declared in this scope
  118 |     cout << s[i] << endl;
      |     ^~~~
a.cc:118:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:118:21: error: 'endl' was not declared in this scope
  118 |     cout << s[i] << endl;
      |                     ^~~~
a.cc:118:21: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'