Problem:
 Score : 300 points    Problem Statement The problem set at CODE FESTIVAL 20XX Finals consists of N problems.  The score allocated to the i -th (1≦i≦N) problem is i points.  Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.  As problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.  Determine the set of problems that should be solved.      Constraints  1≦N≦10^7       Partial Score  200 points will be awarded for passing the test set satisfying 1≦N≦1000 .  Additional 100 points will be awarded for passing the test set without additional constraints.         Input The input is given from Standard Input in the following format:  N       Output Among the sets of problems with the total score of N , find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.  If there exists more than one such set, any of them will be accepted.        Sample Input 1 4      Sample Output 1 1
3  Solving only the 4 -th problem will also result in the total score of 4 points, but solving the 1 -st and 3 -rd problems will lower the highest score of a solved problem.       Sample Input 2 7      Sample Output 2 1
2
4  The set \{3,4\} will also be accepted.       Sample Input 3 1      Sample Output 3 1

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

ans = []

def dfs(m):
    if m == 1:
        ans.append(1)
        return 0
    elif m == 2:
        ans.append(2)
        return 0
    else:
        k = ceil(sqrt(1+8*m))//2
        ans.append(k)
        dfs(m-k)

n = INT()
dfs(n)
for x in ans:
    print(x)

Solution (Python):
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

ans = []

def dfs(m):
    if m == 1:
        ans.append(1)
        return 0
    elif m == 2:
        ans.append(2)
        return 0
    elif m == 3:
        ans.append(2)
        ans.append(1)
        return 0
    elif m == 4:
        ans.append(3)
        ans.append(1)
        return 0
    elif m == 5:
        ans.append(3)
        ans.append(2)
        return 0
    else:
        k = ceil(sqrt(1+8*m))//2
        ans.append(k)
        dfs(m-k)

n = INT()
dfs(n)
for x in ans:
    print(x)

Solution (Python):

from math import ceil

n = int(input())
a = ceil(((1 + 8 * n)**0.5 - 1) / 2)
for i in range(a):
    if a * (a + 1) // 2 - n - 1 != i:
        print(i + 1)

Solution (Python):
N = int(input())
cnt = 0
now = 0
while True:
    now +=1
    cnt += now
    if cnt >=N:
        break
for i in range(1,now+1):
    if i == cnt-N:
        continue
    else:
        print(i)

Solution (Python):






import math





N = int(input())





x = int(-(-math.sqrt(N*2)//1))
y = x*(x+1)//2
diff = y - N
while diff > x:
    diff -= x
    x -= 1
for i in range(1,x+1):
    if i != diff:
        print(i)

Solution (Python):
import math
N = int(input())
n = int(math.ceil((-1 + math.sqrt(1 + 8 * N)) / 2))
d = n * (n + 1) // 2 - N
for i in range(1, n + 1):
    if i != d:
        print(i)

Solution (Python):
n = int(input())
ans = 0
s = 0
for i in range(1,n+1):
    if i*(i+1)//2 >= n:
        break
k = i*(i+1)//2 - n
for j in range(1,i+1):
    if j == k:
        pass
    else:
        print(j)

Solution (Python):


n = int(input())
i = 1
ans = []
while i * (i + 1) // 2 <= n:
    ans.append(i)
    i += 1
else:
    ans.append(i)
s = i * (i + 1) // 2
diff = s - n

if diff > 0:
    ans.remove(diff)
print(*ans, sep='\n')

Solution (Python):
N = int(input())

ans = 0

for i in range(1, N+1):
    ans += i
    if ans >= N:
        break

for j in range(1, i+1):
    if ans - N == j:
        continue
    print(j)

Solution (Python):
n=int(input())

ans=[]
num=0

i=1
while num<n:
  num+=i
  ans.append(i)
  i+=1
else:
  sa=num-n

if sa!=0:
  ans.remove(sa)

for i in ans:
  print(i)

Solution (Python):
N = int(input())

now = 0
sum = 0
ans = []
while sum < N:
  now += 1
  ans.append(now)
  sum += now

rem = sum-N
if rem != 0:
  ans.remove(rem)
print(*ans,sep="\n")

Solution (Python):
N=int(input())
for i in range(1000000):
  if (i*(i+1))//2>=N:
    a=i
    break
pointer=a
while N>0:
  if N>=pointer:
    print(pointer)
    N-=pointer
    pointer-=1
  else:
    print(N)
    N=0

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
cnt = 0
s = set()
for i in range(1, N+1):
    cnt += i
    s.add(i)
    if cnt>=N:
        break
if N!=cnt:
    s.remove(cnt-N)

for i in s:
    print(i)

Solution (Python):
N = int(input())
A = []
while N>0:
    k = 0
    cnt = 0
    while cnt<N:
        k += 1
        cnt += k
    A.append(k)
    N -= k
for a in A:
    print(a)

Solution (Python):
n = int(input())
cnt = 0
for i in range(1,n+1):
    if i*(1+i)//2 >= n:
        cnt = i
        break
for i in range(cnt, 0, -1):
    if i <= n:
        print(i)
        n -= i

Solution (Python):
N = int(input())

A = []
S = 0
for i in range(1, N + 1):
    if S >= N:
        break
    S += i
    A.append(i)

x = sum(A) - N
for a in A:
    if x == a:
        continue
    print(a)

Solution (Python):
N = int(input())
st = set()
s = 0
n = 1
while s < N:
    st.add(n)
    s += n
    n += 1
if s > N:
    st.remove(s-N)
print(*st, sep='\n')

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    k = 0

    while k * (k + 1) // 2 < n:
        k += 1

    x = k * (k + 1) // 2
    d = x - n

    for i in range(1, k + 1):
        if i == d:
            continue
        print(i)


if __name__ == '__main__':
    main()

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
from math import sqrt, pi
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





N = getN()

total = 0
cnt = 0

while total < N:
    cnt += 1
    total += cnt

for i in range(1, cnt + 1):
    if i != total - N:
        print(i)

Solution (Python):
def resolve():
    '''
    code here
    '''
    N = int(input())

    delta = 0
    if N > 1:
        for i in range(1, N+1):
            if (i-1)*i < 2*N < i*(i+1):
                delta = i*(i+1)//2 - N
                res_list = list(range(1, i+1))
                break
            elif 2*N == i*(i+1):
                res_list = range(1, i+1)
    else:
        res_list = [1]

    if delta > 0:
        while delta > res_list[-1]:
            delta -= res_list[-1]
            del res_list[-1]

        res_list.remove(delta)    
    

    for item in res_list:
        print(item)



if __name__ == "__main__":
    resolve()

Solution (Python):
N=int(input())
a=0
b=0
for i in range(1,N+1):
    if (i+1)*i/2>=N:
        a=i
        b=(i+1)*i/2-N

        break

for i in range(1,a+1):
    if i!=b:
        print(i)

Solution (Python):
N = int(input())
li = [i for i in range(1, N + 1)]
acc = 0
index = 0
for i in range(N):
    acc += li[i]
    if acc >= N:
        index = i
        break
garbage = acc - N
for i in range(index + 1):
    if li[i] != garbage:
        print(li[i])

Solution (Python):
from bisect import bisect_left

N = int(input())

cum = [0]
now = 1

while cum[-1] <= N:
    cum.append(now + cum[-1])
    now += 1



idx = bisect_left(cum, N)


ans = []
tmp = 0
i = idx
while i > 0:
    
    tmp += i
    ans.append(i)
    if tmp == N:
        print(*ans)
        exit()
    elif tmp > N:
        tmp -= i
        i -= 1
        ans.pop()
    else:
        i -= 1

Solution (Python):
N = int(input())

k = 1
while k * (k + 1) // 2 < N:
    k += 1

ans = list(range(1, k+1))
v = k * (k + 1) // 2 - N
if v > 0:
    ans.remove(v)

for i in ans:
    print(i)

Solution (Python):
def main():
    n = int(input())
    k = int((2 * n) ** 0.5) - 1
    while k * (k + 1) // 2 < n:
        k += 1
    s = k * (k + 1) // 2 - n
    [print(i) for i in range(1, k + 1) if i != s]

if __name__ == '__main__':
    main()

Solution (Python):
import sys
N = int(input())
l = []

def main(n):
  global l
  i = 1
  while True:
    tmp = i*(i+1)//2
    if tmp >= n:
      l.append(i)
      if n-i == 0:
        return l
      else:
        return main(n-i)
    i += 1
    
sys.setrecursionlimit(10000)
li = main(N)
for n in li:
  print(n)

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil



import string

from bisect import bisect_left
MOD = int(1e9)+7
INF = float('inf')


def solve():
    
    n = int(input())
    for i in range(1, n+1):
        x = i * (i - 1) // 2
        if x + i >= n:
            while n:
                y = min(n, i)
                n -= y
                print(y)
                i = y - 1
            return

t = 1

for case in range(1,t+1):
    ans = solve()


"""

azyxwvutsrqponmlkjihgfedcb

"""

Solution (Python):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    if N==1:
        print(1)
        exit()
    temp=0
    ans=[]
    for i in range(1,N+5):
        temp+=i
        ans.append(i)
        if temp>N:
            ans.remove(temp-N)
            break
        elif temp==N:
            break
    for i in range(len(ans)):
        print(ans[i])
        

main()

Solution (Python):
n = int(input())

s = 0
i = 0 
ans = []


while s < n:
  i += 1
  s += i
  ans.append(i)
  
delete = s - n 
if delete != 0: ans.remove(delete) 
  
for t in ans: print(t)

Solution (Python):
N,t = int(input()),1

while t*(t+1) < N*2:
	t += 1
for i in range(1,t+1):
	if t*(t+1)//2-i != N:
		print(i)

Solution (Python):
N = int(input())
t = 1

while t*(t+1) < N*2:
	t += 1
x = t*(t+1)//2-N

for i in range(t):
	if t-i <= x:
		x -= t-i
	else:
		print(t-i)

Solution (Python):
n = int(input())
m = 0
i = 1
while True:
    m += i
    if m >= n:
        break
    i += 1
for j in range(1, i + 1):
    if not j == m - n:
        print(j)

Solution (Python):
class BisectSearch:
    def __init__(self, f, l=0, r=10**9):
        self.f = f
        self.l = l
        self.r = r
    def __call__(self, dist):
        f = self.f
        l = self.l
        r = self.r
        if dist <= f(l):
            return l
        if f(r) <= dist:
            return r
        while r-l > 1:
            n = (r+l) // 2
            if f(n) <= dist:
                l = n
            else:
                r = n
        return l

n = int(input())
def f(n):
    return (n+1)*n // 2
m = BisectSearch(f, l=1, r=10**7)(n)
m += f(m) != n
A = set(range(1, m+1))
A.discard(f(m) - n)
print(*A, sep='\n')

Solution (Python):
class BisectSearch:
    def __init__(self, f, l=0, r=10**9):
        self.f = f
        self.l = l
        self.r = r
    def __call__(self, dist):
        f = self.f
        l = self.l
        r = self.r
        if dist <= f(l):
            return l
        if f(r) <= dist:
            return r
        while r-l > 1:
            n = (r+l) // 2
            if f(n) <= dist:
                l = n
            else:
                r = n
        return l

n = int(input())
def f(n):
    return (n+1)*n // 2
m = BisectSearch(f, l=1, r=10**7)(n)
m += f(m) != n
A = set()
for i in range(m, 0, -1):
  if n - i >= 0:
    A.add(i)
    n -= i
print(*A, sep='\n')

Solution (Python):
N = int(input())

ans = []
sum = 0
for i in range(1,N+1):
  sum += i
  ans += [i]
  if sum > N:
    ans.remove(sum-N)
    break
for i in ans:
  print(i)

Solution (Python):
n=int(input())
ans = []
c = 1
while True:
    c+=1
    res=(1+c)*c/2
    if res>=n:
        diff=res-n
        for i in range(1,c+1):
            if i==diff:
                continue
            print(i)
        break

Solution (Python):
import sys
N = int(input())
if N == 1:
    print(1)
    sys.exit()


def re(x):
    return x*(x+1)//2


l, r = 0, N+1
exact = -1
while abs(l - r) > 1:
    mid = (l + r) // 2
    if re(mid) > N:
        r = mid
    elif re(mid) == N:
        exact = mid
        break
    else:
        l = mid


if exact != -1:
    for i in range(1, exact + 1):
        print(i)


else:
    temp = re(r) - N
    for i in range(1, r+1):
        if i != temp:
            print(i)

Solution (Python):
from sys import *
from itertools import *
n=int(input())
l=[i for i in range(1,10**4)]
t=list(accumulate(l))
for i in range(len(t)):
    if t[i]==n:
        ans=l[0:i+1]
        for i in ans:
            print(i)
        exit()
    if t[i]>n:
        m=t[i]-n
        ans=l[0:i+1]
        ans.remove(m)
        for i in ans:
            print(i)
        exit()

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n = ir()
if int(math.sqrt(1+8*n))**2 == 1+8*n:
    for num in [i+1 for i in range(int(-1+math.sqrt(1+8*n))//2)]:
        print(num)
else:
    k = int((-1+math.sqrt(1+8*n))/2)
    tmp = k*(k+1)//2
    jud = n-tmp
    rem = k-jud+1
    ans = []
    for i in range(1,k+2):
        if i != rem:
            ans.append(i)
    for num in ans:
        print(num)

Solution (Python):
n=int(input())
temp=0
i=1
ans=[]
while True:
  temp=temp+i
  ans.append(i)
  if temp>=n:
    break
  i=i+1
t=temp-n
for i in range(len(ans)):
  if ans[i]!=t:
    print(ans[i])

Solution (Python):
n = int(input())




A = [0] * (n + 1)
A[1] = 1 
for i in range(1, n):
    A[i + 1] = A[i] + i

from bisect import bisect_left

idx = bisect_left(A, n)

if n == A[idx]:
    for i in range(1, idx + 1):
        if i == idx - 1: continue
        print(i)
else:
    for i in range(1, idx):
        if i == idx - 1 - (n - A[idx - 1] + 1): continue
        print(i)

Solution (Python):
n = int(input())
cnt = 1
while cnt*(cnt+1)//2 < n:
    cnt+=1
if cnt*(cnt+1)//2 == n:
    for i in range(cnt):
        print(i+1)
else:
    bad = -1
    total = cnt*(cnt+1)//2
    for i in range(1, cnt+1):
        if total-i == n:
            bad = i
            break
    for i in range(1, cnt+1):
        if i == bad:
            continue
        print(i)

Solution (Python):
import math
n = int(input())

li = [False] * (n + 1)

s = 0
for i in range(1, n+1):
    s += i
    li[i] = True

    if s == n:
        break
    if n - s < i + 1:
        li[i+1-(n-s)] = False
        s -= i+1-(n-s)


for j in range(1, i+1):
    if li[j]:
        print(j)

Solution (Python):
n = int(input())
if n == 1 or n == 2:
    print(n)
    exit()

now = 0
ans = []
for i in range(1, n):
    now += i
    ans.append(i)
    if now >= n:
        break

amari = now - n

for i in ans:
    if i == amari:
        continue
    else:
        print(i)

Solution (Python):
n = int(input())

ans = []
check = 0

for i in range(1,n+1):
    check += i
    ans.append(i)
    if check >= n:
        break

if check - n != 0:
    del ans[check - n - 1]
    
for i in ans:
    print(i)

Solution (Python):
import math
n=int(input())


temp_n=int((-1+math.sqrt(1+8*n))//2)


while(temp_n*(temp_n+1) < 2*n):
    temp_n+=1


ans=[]
while(n>0):

    if(n>=temp_n):
        n-=temp_n
        ans.append(temp_n)
        temp_n-=1
    else:
        temp_n=n
        ans.append(temp_n)
        n-=temp_n
ans.sort()

for ai in ans:
    print(ai)

Solution (Python):
N = int(input())
ans = [0]
rui = 0
for i in range(1,N+1):
    ans.append(i)
    rui += i
    if rui >= N:
        break
for i in range(1,len(ans)):
    if i == (rui-N):
        continue
    print(ans[i])

Solution (Python):
def f(x):
    return x * (x + 1) // 2


if __name__ == "__main__":
    N = int(input())
    for i in range(0, N + 1):
        if f(i) >= N:
            x, sum_ = i, f(i)
            break

    r = sum_ - N
    for i in range(1, x + 1):
        if i != r:
            print(i)

Solution (Python):
n=int(input())

ans=[]
s=0
for i in range(1,n+1):
    s+=i
    ans.append(i)
    if s>=n:
        break

if s==n:
    for a in ans:
        print(a)
else:
    ans.remove((s-n))
    for a in ans:
        print(a)

Solution (Python):
n = int(input())
ans = set([0])
for i in range(1, n+1):
    ans.add(i)
    n -= i
    if n<=0:
        break

ans = list(ans)
ans.remove(0)
if n!=0:
    ans.remove(-n)

for a in ans:
    print(a)

Solution (Python):
n = int(input())
ans = []
cnt = 0
for i in range(1, int(n**0.7)+3):
    if n > cnt:
        ans.append(i)
        cnt += i
    else:
        if cnt - n in ans:
            ans.remove(cnt - n)
        break
for i in ans:
    print(i)

Solution (Python):
n = int(input())

i = 0
while True:
    if i*(i+1)//2 >= n:
        break
    i += 1

while True:
    print(i)
    n -= i
    i -= 1
    if n == 0:
        break
    if n - i <= 0:
        print(n)
        break

Solution (Python):
N = int(input())

checkpoint = 0
summation = 0

for i in range(1, N+1):
    checkpoint = i
    summation = summation + checkpoint
    if summation >= N:
        break

unn = summation - N
for a in range(1, checkpoint+1):
    if a != unn:
        print(a)

Solution (Python):
N = int(input())
Ans = []
s = 0
for i in range(1, N+1):
    Ans.append(i)
    s += i
    if s >= N:
        break

if s != N:
    Ans.remove(s-N)
for a in Ans:
    print(a)

Solution (Python):
N = int(input())

def search_ans(max,min):
    if max - min <= 4:
        for i in range(min,max+1):
            if (1+i)*i/2 >= N: 
                return i
                
    else:
        mid = int((max+min)//2)

        if (1+mid)*mid/2 < N:
            min = mid
        else:
            max = mid
            
        return search_ans(max,min)
    
ans_max = search_ans(N,1) 

for i in range(ans_max,0,-1):
    if N - i >= 0:
        print(i)
        N -= i

Solution (Python):
N = int(input())

import math

ans = []

def calc(N):
  ans_q = math.ceil((2*N+1/4)**(1/2)-1/2)
  ans.append(ans_q)
  return N-ans_q

while N != 0:
  N = calc(N)

[print(x) for x in sorted(ans)]

Solution (Python):
import math

N = int(input())

K = math.ceil((-1 + math.sqrt(1 + 8 * N))/2)

L = int((1 + K) * K //2 - N)

while K:
  if K != L:
    print(K)
  K -= 1

Solution (Python):
N=int(input())
ans=0
reject=0
A=[]
for i in range(1,N+1):
    ans+=i
    if ans>=N:
        reject=ans-N
        for j in range(1,i+1):
            if j!=reject:
                print(j)
        break

Solution (Python):
n=int(input())

i=1
sum=1
ans=[1]
while sum<n:
  i+=1
  sum+=i
  ans.append(i)

sa=sum-n
if sa!=0:
  ans.remove(sa)

for i in ans:
  print(i)

Solution (Python):
from math import sqrt

def readinput():
    n=int(input())
    return n

def main(n):
    k=int((-1+sqrt(1+8*n))/2)
    while(k*(k+1)//2<n):
        k+=1
    dif=k*(k+1)//2 - n
    for i in range(1,dif):
        print(i)
    for i in range(dif+1,k+1):
        print(i)

if __name__=='__main__':
    n=readinput()
    main(n)

Solution (Python):
n = int(input())

i = 1
l = [1]
while n >= (i+1)*i//2:
    i += 1
    l.append(i)

l.remove((i+1)*i//2-n)

for j in l:
    print(j)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
Y = 0
su = 0
i = 1
while su < N:
    su += i
    i += 1
    Y = i
i = 0
sa = su - N
for i in range(1, Y):
    if i == sa:
        continue
    print(i)

Solution (Python):


import math



from collections import deque
from collections import Counter




n=int(input())
m=math.ceil(pow(2*n+1/4,0.5)-1/2)
s=m*(m+1)//2
for i in range(1,m+1):
  if i!=s-n:
    print(i)

Solution (Python):
N = int(input())

s = 0
i = 0
ans = []
while s < N:
  i += 1
  s += i
  ans.append(i)
dele = s - N
if dele != 0:
  ans.remove(dele)

for t in ans:
  print(t)

Solution (Python):
n = int(input())
cnt = 0
for i in range(1, n+1):
    if i * (1+i) // 2 >= n:
        cnt = i
        break
for i in range(cnt, 0, -1):
    if i <= n:
        print(i)
        n -= i

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
for i in range(10**7):
    if i*(i+1)>=2*n:
        m=i
        c=i*(i+1)//2-n
        break
for i in range(1,m+1):
    if i!=c:
        print(i)

Solution (Python):
import sys
from collections import defaultdict, deque
import math


from bisect import bisect_left, bisect_right





input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)

def solve():
    n = getN()
    for i in range(1, 10000):
        if i * (i + 1) / 2 >= n:
            mx = i
            break
    
    ans = []
    for i in ([i for i in range(1, mx+1)[::-1]]):
        if n >= i:
            ans.append(i)
            n -= i


    if n != 0:
        sys.exit(1)

    for an in ans:
        print(an)


def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    
    solve()

Solution (Python):
n=int(input())
s=set()
current=1
cusum=0
while cusum<n:
  cusum+=current
  s.add(current)
  current+=1
if cusum-n in s:
  s.remove(cusum-n)
for i in s:
  print(i)

Solution (Python):
n = int(input())
sum_i = 0  
i = 0
while sum_i < n:
    i += 1
    sum_i += i
for ans in range(1, i+1):
    if ans == sum_i - n:
        continue
    print(ans)

Solution (Python):
n = int(input())

cnt = 0
for i in range(1, n + 1):
    cnt += i
    if cnt >= n:
        ans, exc = i, cnt - n
        break

for j in range(1, ans + 1):
    if exc != j:
        print(j)

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())

cnt=1
while cnt*(cnt+1)//2<n:
    cnt+=1



while n:
    if n>=cnt:
        n-=cnt
        print(cnt)
        cnt-=1
    else:
        print(n)
        n=0

Solution (Python):


N = int(input())





su = 0
for i in range(N + 1):
    su += i
    if su >= N:
        break

ans = list(range(1, i + 1))
if su - N != 0:
    ans.remove(su - N)
print(*ans, sep='\n')

Solution (Python):
def main():
    n = int(input())
    max, dif = 0, 0
    for i in range(1, 10000):
        s = i * (i + 1) // 2
        if s >= n:
            max = i
            dif = s - n
            break
    [print(i) for i in range(1, max + 1) if i != dif]

if __name__ == '__main__':
    main()

Solution (Python):
import math

n = int(input())
end = math.ceil((-1 + (1 + 8 * n)**(0.5)) / 2)
ans = [j for j in range(1,end+1)]
sum_to_end = ( end ** 2 + end ) // 2

if sum_to_end != n:
    ans.remove(sum_to_end - n)

print(*ans, sep = "\n")

Solution (Python):
import math

n = int(input())
end = math.ceil((-1 + (1 + 8 * n)**(0.5)) / 2)

ans = [j for j in range(1, end+1)]

sum_to_end = ( end ** 2 + end ) // 2

if sum_to_end != n:
    ans.remove(sum_to_end - n)

print('\n'.join(map(str, ans)))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


N = INT()

K = ceil((-1+sqrt(1+8*N))/2)
tmp = K*(K+1)//2 - N

for i in range(K, 0, -1):
	if tmp < i:
		print(i)
	else:
		tmp -= i

Solution (Python):
import sys
readline = sys.stdin.readline

N = int(readline())

p = 0
ans = set()
for i in range(1,N + 1):
  p += i
  ans.add(i)
  if p >= N:
    break
    
if p == N:
  for a in ans:
    print(a)
  exit(0)
ans.remove(p - N)
for a in ans:
  print(a)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
i = 1
s = 1
ss = set([1])
while s<n:
    i += 1
    s += i
    ss.add(i)
    
if s>n:
    ss.remove(s-n)
write("\n".join(map(str, ss)))

Solution (Python):
n=int(input())
a=[1]
while sum(a) < n:
  a.append(a[-1]+1)
if sum(a) != n:
  b=sum(a)-n
  a[b-1:b]=[]
print(*a,sep="\n")

Solution (Python):
n = int(input())
"""
全探索→200点
"""
cnt = 1
while True:
	t = cnt*(cnt-1)//2
	if n < t:
		break
	cnt += 1
s = cnt*(cnt-1)//2-n
for i in range(1, cnt):
	if i != s:
		print(i)

Solution (Python):
N = int(input())
l = [int(x) for x in range(1,N+1)]

total_num,max_num = 0,0

if N <= 2:
  print(N)
  exit()

for i in range(1,N):
  total_num += i
  if total_num >= N:
    max_num = i
    break

if total_num == N:
  for i in range(max_num):
    print(i+1)
else:
  ng_num = total_num - N
  for j in range(max_num):
    if j+1 != ng_num:
      print(j+1)

Solution (Python):
n=int(input())

ans=[1]
i=1
s=1
while True:
    if s>=n:
        break
    i+=1
    s+=i
    ans.append(i)

dif = s-n
if dif==0:
    for i in range(len(ans)):
        print(ans[i])
    exit(0)

for i in range(len(ans)):
    if ans[i]==dif:
        continue
    print(ans[i])

Solution (Python):
n=int(input())

import bisect

ans=[1]
i=1
s=1
while True:
    if s>=n:
        break
    i+=1
    s+=i
    ans.append(i)

dif = s-n
if dif==0:
    for i in range(len(ans)):
        print(ans[i])
    exit(0)
    
index = bisect.bisect_left(ans,dif)

for i in range(len(ans)):
    if i==index:
        continue
    print(ans[i])