Source Code
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main()
{
	ll x;	cin >> x;
	
	ll y = 1;
	vector <ll> ans;
	while (x > 0) {
		if (y <= x)
			ans.push_back(y);
		else {
			ans.back() += x;
			x = y = 0;
		}
		x -= y;
		y++;
	}
	
	cout << ans.size() << '\n';
	for (ll x : ans)
		cout << x << ' ';
	cout << '\n';

	return 0;
}
Copy
Want More! Bsher
GNU G++17
170 ms
22.3 MB
Accepted