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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    long long x;
    cin >> x;
    long long sum = 0;
    vector<long long>res;
    for(int i=1;i<=10000000;i++)
    {
        if(x-(sum+i)>i)
        {
            sum += i;
            res.push_back(i);
        }
        else
        {
            res.push_back(x-sum);
            break;
        }
    }
    cout << res.size() << '\n';
    for(long long it:res)
        cout<<it<<' ';
    return 0;
}
Copy
Want More! Mohamedmaher
GNU G++17
157 ms
22.5 MB
Accepted