Language: C++

// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (ll  i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
	}
	return ans;
}

vector<int> v;
void dfs(int n, ll S) {
	if (S > 0) {
		for (int i = n - 1; i >= 0; i--) {
			if (i <= S) {
				v.pb(i);
				dfs(i, S - i);
				break;
			}
		}
	}
}
ll sum[10000000];
int main() {
	int N; cin >> N;
	
	sum[0] = 0;
	FOR(i,1, 10000000) {
		sum[i] = sum[i-1] + i;
	}
	int n = 0;
	REP(i, N+1) {
		if (sum[i] >= N) {
			v.pb(i);
			n = i;
			break;
		}
	}
	dfs(n, N - v[0]);
	VSORT(v);
	for (auto x : v) {
		p(x);
	}
}


#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (ll  i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
	}
	return ans;
}

vector<int> v;
void dfs(int n, ll S) {
	if (S > 0) {
		for (int i = n - 1; i >= 0; i--) {
			if (i <= S) {
				v.pb(i);
				dfs(i - 1, S - i);
				break;
			}
		}
	}
}
ll sum[10000000];
int main() {
	int N; cin >> N;
	
	sum[0] = 0;
	FOR(i,1, 10000000) {
		sum[i] = sum[i-1] + i;
	}
	int n = 0;
	REP(i, N+1) {
		if (sum[i] >= N) {
			v.pb(i);
			n = i;
			break;
		}
	}
	dfs(n, N - v[0]);
	VSORT(v);
	for (auto x : v) {
		p(x);
	}
}



Compiler output:
a.cc:229:5: error: redefinition of 'int dy [4]'
  229 | int dy[4] = { 0,0,1,-1 };
      |     ^~
a.cc:51:5: note: 'int dy [4]' previously defined here
   51 | int dy[4] = { 0,0,1,-1 };
      |     ^~
a.cc:230:5: error: redefinition of 'int dx [4]'
  230 | int dx[4] = { 1,-1,0,0 };
      |     ^~
a.cc:52:5: note: 'int dx [4]' previously defined here
   52 | int dx[4] = { 1,-1,0,0 };
      |     ^~
a.cc:231:5: error: redefinition of 'int dxx [8]'
  231 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
      |     ^~~
a.cc:53:5: note: 'int dxx [8]' previously defined here
   53 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
      |     ^~~
a.cc:232:5: error: redefinition of 'int dyy [8]'
  232 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
      |     ^~~
a.cc:54:5: note: 'int dyy [8]' previously defined here
   54 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
      |     ^~~
a.cc:237:4: error: redefinition of 'long long int gcd(long long int, long long int)'
  237 | ll gcd(ll x, ll y) {
      |    ^~~
a.cc:59:4: note: 'long long int gcd(long long int, long long int)' previously defined here
   59 | ll gcd(ll x, ll y) {
      |    ^~~
a.cc:242:4: error: redefinition of 'long long int lcm(long long int, long long int)'
  242 | ll lcm(ll x, ll y) {
      |    ^~~
a.cc:64:4: note: 'long long int lcm(long long int, long long int)' previously defined here
   64 | ll lcm(ll x, ll y) {
      |    ^~~
a.cc:246:4: error: redefinition of 'long long int myPow(long long int, long long int, long long int)'
  246 | ll myPow(ll x, ll n, ll m) {
      |    ^~~~~
a.cc:68:4: note: 'long long int myPow(long long int, long long int, long long int)' previously defined here
   68 | ll myPow(ll x, ll n, ll m) {
      |    ^~~~~
a.cc:255:4: error: redefinition of 'long long int pow2(long long int, long long int)'
  255 | ll pow2(ll a, ll n) {//aのn乗を計算します。
      |    ^~~~
a.cc:77:4: note: 'long long int pow2(long long int, long long int)' previously defined here
   77 | ll pow2(ll a, ll n) {//aのn乗を計算します。
      |    ^~~~
a.cc:267:11: error: redefinition of 'long long int nCr(int, int)'
  267 | long long nCr(int n, int r) {
      |           ^~~
a.cc:89:11: note: 'long long int nCr(int, int)' previously defined here
   89 | long long nCr(int n, int r) {
      |           ^~~
a.cc:280:11: error: redefinition of 'const int MAX'
  280 | const int MAX = 510000;
      |           ^~~
a.cc:102:11: note: 'const int MAX' previously defined here
  102 | const int MAX = 510000;
      |           ^~~
a.cc:281:11: error: redefinition of 'const int MOD'
  281 | const int MOD = 1000000007;
      |           ^~~
a.cc:103:11: note: 'const int MOD' previously defined here
  103 | const int MOD = 1000000007;
      |           ^~~
a.cc:283:11: error: redefinition of 'long long int fac [510000]'
  283 | long long fac[MAX], finv[MAX], inv[MAX];
      |           ^~~
a.cc:105:11: note: 'long long int fac [510000]' previously declared here
  105 | long long fac[MAX], finv[MAX], inv[MAX];
      |           ^~~
a.cc:283:21: error: redefinition of 'long long int finv [510000]'
  283 | long long fac[MAX], finv[MAX], inv[MAX];
      |                     ^~~~
a.cc:105:21: note: 'long long int finv [510000]' previously declared here
  105 | long long fac[MAX], finv[MAX], inv[MAX];
      |                     ^~~~
a.cc:283:32: error: redefinition of 'long long int inv [510000]'
  283 | long long fac[MAX], finv[MAX], inv[MAX];
      |                                ^~~
a.cc:105:32: note: 'long long int inv [510000]' previously declared here
  105 | long long fac[MAX], finv[MAX], inv[MAX];
      |                                ^~~
a.cc:286:6: error: redefinition of 'void COMinit()'
  286 | void COMinit() {
      |      ^~~~~~~
a.cc:108:6: note: 'void COMinit()' previously defined here
  108 | void COMinit() {
      |      ^~~~~~~
a.cc:298:11: error: redefinition of 'long long int COM(int, int)'
  298 | long long COM(int n, int k) {
      |           ^~~
a.cc:120:11: note: 'long long int COM(int, int)' previously defined here
  120 | long long COM(int n, int k) {
      |           ^~~
a.cc:304:6: error: redefinition of 'bool arr [100000100]'
  304 | bool arr[100000100];
      |      ^~~
a.cc:126:6: note: 'bool arr [100000100]' previously declared here
  126 | bool arr[100000100];
      |      ^~~
a.cc:305:11: error: redefinition of 'std::vector<long long int> sosuu'
  305 | vector<ll>sosuu;
      |           ^~~~~
a.cc:127:11: note: 'std::vector<long long int> sosuu' previously declared here
  127 | vector<ll>sosuu;
      |           ^~~~~
a.cc:306:6: error: redefinition of 'void Eratosthenes()'
  306 | void Eratosthenes() {
      |      ^~~~~~~~~~~~
a.cc:128:6: note: 'void Eratosthenes()' previously defined here
  128 | void Eratosthenes() {
      |      ^~~~~~~~~~~~
a.cc:331:4: error: redefinition of 'long long int stoL(std::string)'
  331 | ll stoL(string s) {
      |    ^~~~
a.cc:153:4: note: 'long long int stoL(std::string)' previously defined here
  153 | ll stoL(string s) {
      |    ^~~~
a.cc:340:13: error: redefinition of 'std::vector<int> v'
  340 | vector<int> v;
      |             ^
a.cc:162:13: note: 'std::vector<int> v' previously declared here
  162 | vector<int> v;
      |             ^
a.cc:341:6: error: redefinition of 'void dfs(int, long long int)'
  341 | void dfs(int n, ll S) {
      |      ^~~
a.cc:163:6: note: 'void dfs(int, long long int)' previously defined here
  163 | void dfs(int n, ll S) {
      |      ^~~
a.cc:352:4: error: redefinition of 'long long int sum [10000000]'
  352 | ll sum[10000000];
      |    ^~~
a.cc:174:4: note: 'long long int sum [10000000]' previously declared here
  174 | ll sum[10000000];
      |    ^~~
a.cc:353:5: error: redefinition of 'int main()'
  353 | int main() {
      |     ^~~~
a.cc:175:5: note: 'int main()' previously defined here
  175 | int main() {
      |     ^~~~