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

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define LL long long
#define LD long double
#define pb push_back
#define F first
#define S second


const double PI=3.1415926535897932384626433;
const int KL=1e6;
const LL MOD=1e9+7;


using namespace std;
/*
typedef complex<double> point;
#define x real()
#define y imag()
*/

LL q,x,y,z,n,m,a[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <LL> vec;
set <LL> s;
map <LL,LL> mp;


int main()
{
    scl(x);
    LL i=1;
    while(x>0){
        if(x>=i){
            x-=i;
            vec.pb(i);
            i++;
        }
        else {
            y=vec.back();
            vec.pop_back();
            vec.pb(y+x);
            break;
        }
    }
    for(auto v:vec){
        printf("%lld ",v);
    }printf("\n");

    return 0;
}
Copy
Want More! Vectors_Master
GNU G++17
1 ms
360 KB
Wrong Answer