Source Code
#include <bits/stdc++.h>
using namespace std;

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define endl '\n'
#define sz(v) (int)(v).size()
#define inF freopen("input.txt", "r", stdin);
#define outF freopen("output.txt", "w", stdout);

int main(){
    fast
    ll t = 1;
  //  cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll sum = 0, i = 1;
        vector<ll> v;
        for(i = 1; sum < n; i++)
            sum += i, v.push_back(i);
        cout << --i << '\n';
        for(auto it : v)
            cout << it << ' ';
    }
    return 0;
}
Copy
Want More! Mohammad
GNU G++17
75 ms
19.3 MB
Wrong Answer