Source Code
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long x;
    vector<int>v;
	cin>>x;
	for(int i=1;i<=x;i++)
	{
	    v.push_back(i);
	    sum+=i;
	    if(sum==x)
	     break;
	}
	if(x)v[v.size() - 1]+=x;
	cout<<v.size()<<endl;
	for(auto i : v)cout<<i<<" ";
	puts("");
}
Copy
Want More! moathhamudah
GNU G++17
0 ms
0 KB
Compilation Error