/*
Failure is not a reason for you to stop trying
it is actually a reminder that you should
KEEP GOING
*/
#include <bits/stdc++.h>
#define ll long long
#define SaveTime ios_base::sync_with_stdio(false), cin.tie(0);
using namespace std;
int main() {
ll x; cin >> x;
ll n = 1;
vector<int> v;
while (x) {
if (n >= x) {
v.push_back(x);
break;
}
v.push_back(n);
x-= n;
n++;
}
if (v.size() == 1) {
cout << 1 << endl << v[0];
return 0;
}
if (v.back() <= v[n-2]) {
v[n-2]+= v.back();
v.pop_back();
}
cout << v.size() << '\n';
for (int i : v) {
cout << i << ' ';
}
}
Copy