Source Code
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ll long long
int main() {
    IOS
    ll n;cin>>n;
    vector<int>v;
    ll i=1;
    while(n>=i){
        v.push_back(i);
        n-=i++;
    }
    cout<<v.size()<<"\n";
    for(auto x:v)cout<<x<<" ";
}
Copy
Want More! HusseinSaad
GNU G++17
93 ms
14.0 MB
Wrong Answer