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

#define  fast        ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define  endl        '\n'
#define  loop(i,n)     for(int i=0; i<n; ++i)
#define  trav(a,b)   for(auto &a:b)
#define  brec(n)     fixed<<setprecision(n)
#define  YES         cout << "YES"<<endl;
#define  NO          cout << "NO" << endl;
#define TC            int t; cin >> t; while(t--)
#define asort(a,n)            sort(a,a+n)
#define dsort(a,n)            sort(a,a+n,greater<>())
#define vasort(v)           sort(v.begin(), v.end());
#define vdsort(v)           sort(v.begin(), v.end(),greater<>());

const int N = 2e8+5;

typedef long long ll;

int  arr[N], arr2[N];

using namespace std;

int main()
{
  fast

  // TC
   {
       ll n;
       cin >> n;
       ll sum=0;
       ll i=0;
       while (sum<n)
       {
           ++i;
           sum+=i;

       }


       if (sum == n)
       {
           cout << i<< endl;
       }
       else
        cout << i-1 << endl;

       ll def = sum - n;

       for (ll j=1 ; j<=i ; ++j)
       {
           if (j == def) continue;

           cout << j<<" ";

       }



   }

    return 0;
}
Copy
Want More! amin_2020
GNU G++17
185 ms
10.5 MB
Accepted