#K8486. Task Durations

    ID: 36513 Type: Default 1000ms 256MiB

Task Durations

Task Durations

You are given a total duration \(D\) (an integer). Your task is to divide \(D\) into a sequence of distinct positive integers, which represent the durations of individual tasks. The approach is to choose the smallest distinct positive integers \(1, 2, 3, \ldots, n\) until their sum would exceed \(D\). Let \(S = 1 + 2 + \ldots + n\) be the sum obtained in this way. If \(S < D\), then the remaining time \(D - S\) is added to the last task.

For example, if \(D = 6\), the tasks are [1, 2, 3] because \(1+2+3=6\). If \(D = 10\), the tasks are [1, 2, 3, 4] since \(1+2+3+4=10\). If \(D = 9\), the tasks become [1, 2, 6] as 1+2+3 is 6 and the remaining \(9-6=3\) is added to 3 to give 6.

inputFormat

The input consists of a single integer \(D\) (\(1 \leq D \leq 10^9\)) representing the total duration.

outputFormat

Output the sequence of distinct task durations in increasing order, separated by a single space. The sum of these durations must equal \(D\), and if there is any remaining duration after summing consecutive integers \(1, 2, 3, \ldots\), add it to the last task.

## sample
1
1