Source Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N = 10e5;
int x = 1;
void DGS()
{
  int n; cin>>n;
  vector<int> v;
  ll sub = 2 , sum = 1;
  v.push_back(1);
  while(n != sum){
    v.push_back(sub);
    // cout<<sum<<' ';
    sum+=sub;
    sub++ ;
  }
  cout<<v.size()<<'\n';
  for(int i=0;i<v.size();i++){
    cout<<v[i]<<' ';
  }
}

int main()
{
	ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
	ll n=1;
	// cin>>n;
	while(n--) {DGS(); cout<<'\n';}
}
Copy
Want More! Zain_burayya
GNU G++17
609 ms
262.1 MB
Memory Limit Exceeded