Source Code
from math import sqrt, floor
x = int(input())

best = floor((-1 + sqrt(1+(8*x)))/2)
x -= int(best*(best-1)/2)

print(best + (x != 0) - 1)

for i in range(1, best):
    s = str(i)
    if i != best-1:
        s += " "
    print(s, end="", flush=False)


if x != 0:
    print(f" {x}", flush=True)
else:
    print(flush=True)
Copy
Want More! yamen
Python 3
1068 ms
9.8 MB
Time Limit Exceeded