Source Code
def magic(x):
    result = []
    c = 1
    while x > 0:
        if x - c >= c + 1:
            result.append(c)
            x -= c
            c += 1
        else:
            result.append(x)
            break
    return result
x=int(input())
a = magic(x)
print(len(a))
print(" ".join(map(str,a)))
Copy
Want More! azoz1111111
Python 3
1075 ms
37.7 MB
Time Limit Exceeded