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

using namespace std;

typedef long long ll;

int main() {
    ll n;
    cin >> n;

    vector<ll> answer;
    for (ll i = 1; n - i > i; i++) {
        answer.push_back(i);
        n -= i;
    }

    if (n > 0) {
        answer.push_back(n);
    }

    cout << answer.size() << endl;
    for (ll x : answer) {
        printf("%lld ", x);
    }
    puts("");
}
Copy
Want More! Baraa_Armoush
GNU G++17
168 ms
22.3 MB
Accepted