Source Code
#include <iostream>
#include <math.h>

using namespace std;

int main(){
    long x;
    cin >> x;
    long n = floor((-1 + sqrt(1+(8*x)))/2);
    x -= n*(n-1)/2;
    cout << n + (x != 0) - 1 << "\n";
    for (int i=1; i < n; i++){
        cout << i << ((i < (n-1))? " ":"");
    }
    if (x != 0)
        cout << " " << x << "\n";
    return 0;
}
Copy
Want More! yamen
GNU G++17
203 ms
11.3 MB
Accepted