Source Code
#include<bits/stdc++.h>
#define all(s) s.begin(), s.end()
#define sz(s) (int) s.size()
using namespace std;
void DeathRoad(){
    long long x; cin >> x;
    long long t = 1;
    vector<long long > ans;
    while (1)
    {
        if(x - t > t)
            {
                x -= t;
                ans.push_back(t++);
            }
        else{
            ans.push_back(x);
            break;
        }
        /* code */
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i] << ' ';
    }
    
}
int main() {
    ios_base::sync_with_stdio(0);
    
    int T = 1;
    //cin >> T;
    while (T--)
        DeathRoad();
    return 0;
}
/***
        We're here for death, so let's go to it together!
***/
 
Copy
Want More! MhmudAbdGhafar
GNU G++17
100 ms
22.3 MB
Accepted