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):
N = int(input())
n = 0
a = n ** 2 + n - 2 * N

while a < 0:
    n += 1
    a = n ** 2 + n - 2 * N

score = 0
ans = []
for i in reversed(range(1, n + 1)):
    if score + i <= N:
        score += i
        ans.append(i)
    if score == N:
        break

for i in ans:
    print(i)

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

sum = 0
num_list = []
for i in range(1, 10**7):
    sum += i
    num_list.append(i)
    if sum > n:
        break

for i in num_list:
    if i == (sum - n):
        continue
    else:
        print(i)

Solution (Python):
n = int(input())
a = []
cnt = 0
k = 1
while cnt < n:
    cnt += k
    a.append(cnt)
    k += 1
diff = a[-1] - n
for i in range(1, len(a)+1):
    if i == diff:
        pass
    else:
        print(i)

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

Solution (Python):
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):
    return map(type,input().split())


def resolve():
    x=int(input())
    i=0;temp=0 
    while (1):
        i+=1
        temp+=i
        if temp > x:
            z=-x+temp
            
            for i in range(i):
                if i+1!=z:print(i+1)
            break
        if temp==x:
            for i in range(i):print(i+1)
            break

resolve()

Solution (Python):
n=int(input())
flag=0
k=1
while n>k*(k+1)//2:
    k+=1
ans=[]
while n!=0:
    if n-k>=0:
        n-=k
        ans.append(k)
    k-=1
ans.sort()
for x in ans:
    print(x)

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

sum=0
a=[]
i=1
while sum<=N:
  sum+=i
  a.append(i)
  i=i+1
if sum>N:
  a.remove(sum-N)

print(*a)

Solution (Python):
n=int(input())
ans=[1]
i=2

while n>sum(ans):
  ans.append(i)
  i+=1
if n!=sum(ans):
  ans.remove(sum(ans)-n)
[print(i) for i in ans]

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



def resolve():
    N=int(input())
    ans=0
    for i in range(1,N*2):
        ans+=i
        if ans >= N:
            stop=i+1
            j=ans-N
            break
    for k in range(1,stop):
        if k!=j:print(k)
        

resolve()

Solution (Python):
n = int(input())
cnts = []
i = 0
while i*(i+1)//2 <= n:
    i += 1
    cnts.append(i)

rm = sum(cnts) - n
for i in cnts:
    if i == rm:continue
    print(i)

Solution (Python):
n = int(input())
k = int((2*n)**.5)
for i in range(k, k*(k+1)+1):
    if 2*n >= i*(i+1):
        continue
    k = i
    break


def sigma(a, b):
    if a == b:
        return a
    elif b < a:
        return 0
    else:
        return (a+b)*(b-a+1)//2

excess = sigma(1, k)-n
for i in range(1, k+1):
    if i == excess:
        continue
    print(i)

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

Solution (Python):
import math
n=int(input())
k=(2*n+0.25)**0.5-0.5
k=math.ceil(k)
no=k*(k+1)/2-n
for i in range(1,k+1):
    if i==no:
        continue
    print(i)

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


Sn = 1
n = 1
while Sn < N:
    n += 1
    Sn += n
    if Sn == N:
        break

res = []
for i in range(n, 0, -1):
    if N - i >= 0:
        res.append(i)
        N -= i

for ans in res[::-1]:
    print(ans)

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

for g in range(1, i+1):
    if g != ng:
        print(g)

Solution (Python):
n = int(input())
ans = []
tmp = n
for i in range(min(n, 5000), 0, -1):
    if tmp > i * (i - 1) // 2:
        ans.append(i)
        tmp -= i
ans.sort()
print('\n'.join(map(str, ans)))

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

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

if ans > N:
    s.remove(ans - N)

for n in s:
    print(n)

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

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

lv = list(range(1, i + 1))
elem = sum(lv) - N

for k in lv:
    if k != elem:
        print(k)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())

    def main(N):
        i = 1
        ans = 0

        while True:
            ans += i
            if ans >= N:
                print(i)
                if N - i != 0:
                    if N-i<i:
                        print(N - i)
                        return True
                    else:
                        main(N-i)
                        return True
                else:
                    return True
            else:
                i += 1

    main(N)


resolve()

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

for k in range(0, 10 ** 7):
    if k * (k + 1) // 2 < N <= (k + 1) * (k + 2) // 2:
        break
remove = (k + 1) * (k + 2) // 2 - N
for i in range(1, k + 2):
    if i != remove:
        print(i)

Solution (Python):
n = int(input())
def ok(x):
    return x*(x+1)//2 >= n
for x in range(1,n+1):
    
    if ok(x):
        ans = []
        v = x*(x+1)//2 - n
        
        for i in range(1,x+1):
            if i == v:continue
            
            ans.append(i)
        break
            
        
        
        
    else:continue
print(*ans)

Solution (Python):
import sys


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    sum = 0
    for i in range(1, N + 2):
        if sum < N:
            sum += i
        else:
            S = i
            break
    a = sum - N
    for j in range(1, S):
        if j == a:
            continue
        else:
            print(j)


if __name__ == "__main__":
    main()

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


start=int((2*N+1)**0.5)

for i in range(3):
    i += start
    if i*(i+1) >= 2*N:
        ret = i
        delete=i*(i+1)/2 - N
        break

for k in range(1,ret+1):
    if k != delete:
        print(k)

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


start=int((2*N+1)**0.5)

for i in range(3):
    i += start
    if i*(i+1) >= 2*N:
        ret = i
        delete=i*(i+1)/2 - N
        break

for k in range(1,ret+1):
    if k != delete:
        print(k)

Solution (Python):
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007



def dd(v):
	if v == 1:
		return 1
	ng=1
	ok=v
	while ok - ng>1:
		m=(ok+ng)//2
		if (m*(m+1))//2 >= v:
			
			ok=m
		else:
			
			ng=m
	return ok

def main():
	n = int(input())
	
	v=n
	while v > 0:
		r = dd(v)
		print(r)
		v -= r
	
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

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

diff = s - N
if diff != 0:
    ans.remove(diff)
for a in ans:
    print(a)

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

for i in range(1,N+1):
    if i*(i+1) < 2*N:
        continue
    else:
        for j in range(1,i+1):
            if j == i*(i+1)//2 - N:
                continue
            print(j)
        break

Solution (Python):
n = int(input())
k = int((n * 2) ** 0.5)
while True:
  p = (k+1) * k // 2
  if p >= n: break
  k += 1
diff = abs(n - p)
for i in range(1, k+1):
  if i != diff: print(i)

Solution (Python):
import sys
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt
INF = 1 << 60
sys.setrecursionlimit(10 ** 6)

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 factorization(n):
    arr = []
    temp = n
    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


n = int(input())
a = []
total = 0
for i in range(1, n + 1):
    if total >= n:
        break
    total += i
    a.append(i)
for i in a:
    if i != total - n:
        print(i)

Solution (Python):

import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
now = n
for i in range(1,n+1):
  if now == i:
    key = -1
    top = i
    break
  elif now - i < 0:
    key = i - now
    top = i
    break
  else:
    now -= i
for i in range(1,top+1):
  if i != key:print(i)

Solution (Python):
n = int(input())
tmp = 0
li = []
for i in range(n):
    if i*(i+1)/2 >= n:
        tmp = i
        break
new_li = [x for x in range(1,tmp+1)]

if sum(new_li) - n > 0:
    new_li.remove(sum(new_li) - n)
if n == 1:
    print(1)
elif n == 2:
    print(2)
else:
    for n in new_li:
        print(n)

Solution (Python):
import math

N = int(input())

x = math.ceil((math.sqrt(8 * N + 1) - 1) / 2)
S = x * (x + 1) // 2
ex = S - N
for i in range(1, x + 1):
    if i != ex:
        print(i)

Solution (Python):
from math import sqrt
n=int(input())
d=min(-(-int(sqrt(8*n+1))//2),n)
l=list(range(1,d+1))
remain=(d*(d+1))//2-n

while remain>=l[-1]:
    remain-=l[-1]
    l.pop()
print(*list(set(l)-set([remain])),sep="\n")

Solution (Python):



N = int(input())
for i in range(1, N+1):
    if i*(i+1)//2 >= N:
        k = i
        break


S = k*(k+1)//2
sub = S-N
for i in range(1, k+1):
    if i == sub:
        continue
    print(i)
1

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

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
m = 10**7
a = 1
i = 1

while a <= m:
    if a >= n:
        break
    i+=1
    a+=i

ans = [j for j in range(1,i+1) if j != a-n]

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

Solution (Python):
n = int(input())
m = 0
d = 0
for i in range(10**4):
  if i*(i+1)//2 >= n:
    m = i
    d = i*(i+1)//2 - n
    break
for i in range(1,m+1):
  if i != d:
    print(i)

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

for i in range(1,N+1):
    if i*(i+1) >= 2*N:
        n = i
        break

for j in range(1,n+1):
    if j == ((i*(i+1)//2)-N):
        continue
    print(j)

Solution (Python):
N=int(input())
cnt=0
max=10**6
but=0
id=0
for i in range(1,max,1):
    cnt=cnt+i
    if cnt>=N:
        buf=cnt-N
        break
id=i
seq=[i+1 for i in range(id)]
for i in range(len(seq)):
    if seq[i]!=buf:
        print(seq[i])

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

total = 0
x = 0
for i in range(1, N+1):
    total += i
    x = i
    if total >= N:
        break

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

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

max_min = 0
cumsum = 0
while cumsum <= 10 ** 7:
    max_min += 1
    cumsum += max_min
    if N <= cumsum:
        break

ans = [i + 1 for i in range(max_min)]
rm_value = cumsum - N
if rm_value != 0:
    ans.remove(rm_value)

for i in ans:
    print(i)

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

n = int(input())
cnt = 0
ans = []
for i in range(1, n + 1):
    cnt += i
    ans.append(i)
    if cnt >= n:
        if cnt > n:
            ans.remove(cnt - n)
        for j in range(len(ans)):
            print(ans[j])
        exit()

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

A = []

t = 0
i = 1
while(t <= n):
    t += i
    A.append(i)
    i += 1
for i in A:
    if t - n == i:
        continue
    else:
        print(i)

Solution (Python):
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
from bisect import bisect_left
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n = int(input())
    cumsum = list()
    for i in range(n):

        if i == 0:
            cumsum.append(1)
            continue
        
        else:
            cumsum.append(cumsum[i-1]+i+1)

        if cumsum[i] > n:
            break
    
    ban = cumsum[-1]-n
    for i in range(1, len(cumsum)+1):
        if i != ban:
            print(i)

    return

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
ans=[]
count=[]
n=0
for i in range(1,N+1):
    n+=i
    count.append(n)
num=0
for i in range(N):
    if count[i]>N:
        num=i
        break
if N==1:
    print(1)
    exit()
sa=count[num]-N

for i in range(1,num+2):
    if sa==i:
        continue
    ans.append(i)
for i in range(len(ans)):
    print(ans[i])

Solution (Python):
N = int(input())
s = 2
while s * (s - 1) / 2 < N:
  s += 1
for i in range(s -1 ):
  if N >= (s - i -1):
    print(s - i-1)
    N -= s - i -1

Solution (Python):
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

N = int(input())
n = int((2*N)**0.5)
while n*(n+1) < 2*N:
    n += 1
for i in range(n, 0, -1):
    if N >= i:
        print(i)
        N -= i

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    for i in range(n+1):
        if n <= i * (i + 1) // 2:
            tmp = []
            for i in range(i, 0, -1):
                if n >= i:
                    n -= i
                    tmp.append(str(i))
            tmp.sort()
            print("\n".join(tmp))
            return
    return



if __name__ == '__main__':
    solve()

Solution (Python):
n = int(input())
now = 1
num = 1
for i in range(1, n+1):
    now = int(i*(i+1)/2)
    if now >= n:
        num = i
        break
diff = now - n

for i in range(1,num+1):
    if i == diff:
        pass
    else:
        print(i)

Solution (Python):
N = int(input())
i = 1
while 1:
    if i * (i-1) // 2 < N and N <= i * (i+1) // 2:
        max_ans = i
        break
    else:
        i += 1
not_use = max_ans * (max_ans+1) // 2 - N
for i in range(1, max_ans+1, 1):
    if i != not_use:
        print(i)

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

def main():
    N = int(input())
    
    k = math.ceil(((1+8*N)**(1/2)-1)/2)
    
    ans = [i+1 for i in range(k)]
    
    if N != (k*(k+1))//2:
        ans.remove((k*(k+1))//2-N)
        
    print(*ans,sep="\n")
    
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    max_score = int(input())
    answer = []
    i = 1
    while i * i + i - 2 * max_score < 0:
        i += 1
    if i * i + i - 2 * max_score == 0:
        answer = [j for j in range(1, i + 1)]
    else:
        while max_score >= 0:
            answer.append(i)
            max_score -= i
            i -= 1
        answer.pop(-1)
        if i + max_score + 1 > 0:
            answer.append(i + max_score + 1)
    for a in answer:
        print(a)


if __name__ == '__main__':
    main()

Solution (Python):
def solve():
    N = int(input())
    ans = []

    left = 0
    right = N + 1
    while right - left > 1:
        mid = (left + right) // 2
        success, elems = calcElements(mid, N)
        if success:
            ans = elems
            right = mid
        else:
            left = mid
    print(*ans,sep='\n')

def calcElements(max_value, N):
    sm = 0
    elems = []
    for k in range(max_value, 0, -1):
        if sm + k <= N:
            sm += k
            elems.append(k)
            if sm == N:
                return (True, elems)
    
    return (False, elems)

if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
Z = 0
ans = []
for i in range(1,N+1):
    ans.append(i)
    Z += i
    if Z >= N:
        Y = Z - N
        if Y != 0:
            ans.remove(Y)
        break
for i in ans:
    print(i)

Solution (Python):
from collections import deque
n = int(input())
s = lambda i: i * (i+1) // 2
ans = deque()
for i in range(1, 10**7):
    ans.append(i)
    if s(i) >= n:
        ans = list(ans)
        if s(i) > n:
            ans.pop(s(i) - n - 1)
        break
print(*ans, sep="\n")

Solution (Python):
def accsum(n):
  return (n*(n+1))//2
N = int(input())
l = 0
r = 10**7
while N > 0:
  m = (l+r)//2
  if accsum(m-1) < N <= accsum(m):
    print(m)
    l = 0
    r = 10**7
    N -= m
  elif N <= accsum(m-1):
    r = m
  else:
    l = m

Solution (Python):
num = 0
counter = 1
N = int(input())
while num < N:
    num += counter
    counter += 1
diff = num - N
for i in range(1, counter):
    if i != diff:
        print(i)

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

sub = 1
cumsub = 0
while cumsub <= n:
    s.add(sub)

    cumsub += sub
    sub += 1

dif = cumsub - n
if dif > 0:
    s.remove(dif)

for i in s:
    print(i)

Solution (Python):
n=int(input())
ans=int(0)
check=int(0)
A=[]
for i in range(1,n*100):
    ans+=i
    A.append(i)
    if ans>=n:
        break

check=ans-n
for i in range(len(A)):
    if i==check-1:
        continue
    else:
        print(A[i])

Solution (Python):
N = int(input())
def sup(N):
    indexa = 1
    sum = 0
    while True:
        sum += indexa
        if sum >= N:
            return indexa
        indexa +=1
ans = []
while True:
    k = sup(N)
    ans.append(k)
    N -=k
    if N == 0:
        break
ans.reverse()
n = len(ans)
for i in range(n):
    print(ans[i])

Solution (Python):
N = int(input())
def sup(N):
    indexa = 1
    sum = 0
    while True:
        sum += indexa
        if sum >= N:
            return indexa
        indexa +=1
ans = []
while True:
    k = sup(N)
    ans.append(k)
    N -=k
    if N == 0:
        break
ans.reverse()
n = len(ans)
for i in range(n):
    print(ans[i])

Solution (Python):

n = int(input())
import math
max_ = math.ceil(-1/2+(1/4+2*n)**(1/2))
while True:
    if n >= max_:
        print(max_)
        n -= max_
    max_ -= 1
    if max_ == 0:
        break

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

dp = []
score = 0
for i in range(N):
  score += i+1
  if N <= score:
    for j in range(i+1):
      if j+1 != score - N:
        print(j+1)
    break

Solution (Python):
n = int(input())
cand_judge = lambda x: (1 + x) * x / 2
cand_i = 0

for i in range(10 ** 5):
    if cand_judge(i) >= n:
        cand_i = i
        break

ans = list(range(1, cand_i + 1))
for i in ans:
    if i != abs(n - cand_judge(cand_i)):
        print(i)

Solution (Python):
N=int(input())
r=int((2*N+.25)**0.5 + 0.5)
l=r*(r+1)//2-N
[print(i) for i in list(range(1,r+1)) if i!=l]

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

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
r=int((2*N+.25)**0.5 - 0.5)+1
for i in range(1,r+1):
  if i!=r*(r+1)//2-N:
    print(i)

Solution (Python):
N = int(input())
l,r=1,N
while r-l>1:
  m=(l+r)//2
  s=m*(m+1)//2
  if s>=N:
    r=m
  else:
    l=m
for i in range(1,r+1):
  if i!=r*(r+1)//2-N:
    print(i)

Solution (Python):
N = int(input())
def su(n):
    s = 0
    for i in range(1,n+1):
        s += i
    return s

if N == 1:
    print(1)

elif N == 2:
    print(2)
    
elif N == 3:
    print(2)
    print(1)

elif N == 4:
    print(3)
    print(1)
    
else:
    for i in range(N):
        if su(i) >= N:
            M = i
            break
    print(M)

    now = N-M
    
    for i in range(1,M-1):
        if now - (M-i) >=(M-i):
            now -= M-i
            print(M-i)

        else:
            print(M-i)
            if now-(M-i) != 0: 
                print(now-(M-i))
            break

Solution (Python):
N = int(input())
if N == 1 or N == 2:
    print(N)
else:
    for i in range(N+1):
        if i*(i+1)//2 > N:
            num = i-1
            break
    ans = []
    for i in range(num):
        ans.append(i+1)
    if num*(num+1)//2 != N:
        cnt = N-num*(num+1)//2
        ans.remove(num+1-cnt)
        ans.append(num+1)
    for x in ans:
        print(x)

Solution (Python):
n = int(input())
res = []
su = 0
for i in range(1, n+1):
    
    res.append(i)
    if su + i > n:
        break
    su += i
sa = sum(res) - n
if sa == 0:
    print("\n".join(map(str, res)))
else:
    del res[res.index(sa)]
    print("\n".join(map(str, res)))

Solution (Python):


N=int(input())

ans=[]



for i in range(4473):
    if i*(i+1)/2>=N:
        for j in range(i)[::-1]:
            if N-j-1>=0:
                N-=j+1
                ans.append(j+1)
        for item in ans[::-1]:
            print(item)
        exit()

Solution (Python):
n=int(input())
p=0
t=0
for i in range(1,n+1):
  p+=i
  if p>=n:
    t=i
    break
l=range(1,t+1)
if p==n:
  for i in l:
    print(i)
else:
  for i in l:
    if i==p-n:
      continue
    print(i)

Solution (Python):
n=int(input())
i=0
while i*(i+1)//2<n:
  i+=1
no=i*(i+1)//2-n
for j in range(1,i+1):
  if j!=no:
    print(j)

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

d = []
for i in range(1, n+1):
  d.append(i)
  sumd = sum(d)
  if sumd == n:
    break
  if sumd > n:
    v = sumd - n
    d.remove(v)
    break
  
for dv in d:
  print(dv)

Solution (Python):
n=int(input())
count=0
ans=[]
for i in range(1,n+1):
    count+=i
    ans.append(i)
    if count==n:
        break
    elif count>n:
        x=count-n
        del ans[x-1]
        break

for i in range(len(ans)):
    print(ans[i])

Solution (Python):
N=int(input())
for i in range(1,N+1):
    M=i*(i+1)//2
    if M>=N:
        for j in range(1,i+1):
            if j!=M-N:
                print(j)
        break

Solution (Python):
N=int(input())
sum=0
for i in range(N):
    sum+=i+1
    if sum>=N:
        break
for j in range(1,i+2):
    if j!=sum-N:
        print(j)

Solution (Python):

N=int(input())
s=0
A=[]
for i in range(1,N+1):
    s+=i
    A.append(i)
    if s>=N:
        l=i
        break
d=s-N


for a in A:
    if a!=d:
        print(a)

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

a = []
m = 0
for i in range(n):
    if m >= n: break
    a.append(i+1)
    m += i+1
    
if m == n:
    print(*a)
else:
    a.remove(m-n)
    print(*a)

Solution (Python):

n=int(input())

if n==1:
    print(1)
    exit()
t=0
acc=[]
for i in range(1,n+1):
    t+=i
    acc.append(t)
max_v=-1
for i in range(len(acc)-1):
    if acc[i]<n<=acc[i+1]:
        max_v=i+2
        break
ans=[]
ans.append(max_v)
cur=max_v
vv=acc[i+1]
vv-=cur
s=max_v

while vv and s<n:
    cur-=1
    if vv>cur and s+cur<=n:
        vv-=cur
        ans.append(cur)
        s+=cur
    elif vv<cur:
        continue
    elif vv==cur:
        vv-=cur
        ans.append(cur)
        s+=cur
for a in ans:
    print(a)

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

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

a = tmp - N

for j in range(1, i + 1):
    if j == a:
        continue
    print (j)

Solution (Python):

N = int(input())
if N == 1:
    print(1)
    exit()
ans = 0
for i in range(1, N+1):
    ans += i
    if ans >= N:
        end = i
        break
res = ans - N
for i in range(1, end+1):
    if i != res:
        print(i)

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

for i in range(1,n+1):
    s += i
    if s >= n:
        x = i
        break

for i in range(1,x+1):
    if i == s-n:
        continue
    print(i)

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

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

M = 0
for i in range(1, N + 1):
    if i * (i + 1) // 2 >= N:
        M = i
        break

ans = []
for i in reversed(range(1, M + 1)):
    if i <= N:
        ans.append(i)
        N -= i

for i in ans:
    print(i)

Solution (Python):
import math
N=int(input())
p=math.sqrt(N*2-0.25)-0.5
q=int(p)+1
M=q*(q+1)//2
L=M-N
for i in range(1,q+1):
    if i != L:
        print(i)

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

def getk(num):
    return int((1+math.sqrt(8*num-7))/2)

while(True):
    k = getk(n)
    print(k)
    n-=k
    if k == 1 or n<=0:
        break

Solution (Python):
n = int(input())
now = 1
L = []
while now*(now-1)//2 < n:
  L.append(now)
  now += 1
c = sum(L)
if c > n:
  L.remove(c-n)
print(*L, sep="\n")

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
point = 0
for i in range(1,n+1):
    point += i
    if point >= n:
        sa = point-n
        for k in [j for j in range(1,i+1) if j != sa]:print(k)
        break

Solution (Python):
n=int(input())
a=0
i=1
while a<n:
    a+=i
    i+=1
tmp=a-n
for j in range(1,i):
    if j!=tmp:
        print(j)

Solution (Python):
def main():
    N = int(input())
    ans = []
    ans_sum = 0
    for i in range(1, N+1):
        ans_sum += i
        ans.append(i)
        if N <= ans_sum:
            dis = ans_sum - N
            for a in ans:
                if a != dis:
                    print(a)
            return


if __name__ == '__main__':
    main()

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    ans = set()
    for i in range(1,N+1):
        if i<=N:
            ans.add(i)
            N -= i
        elif N:
            ans.add(i)
            ans.remove(i-N)
            break
    print(*ans,sep="\n")

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
lst = []

tmp = 0
x = 1
while tmp<= n:
    tmp += x
    lst.append(x)
    x += 1
if tmp==n:
    pass
else:
    dif = tmp - n
    lst.remove(dif)
for l in lst:
    print(l)

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

t =1 
rps = 0
while a > rps:
    rps+=t
    t+=1
d = rps - a
for i in range(1,t):
    if i!=d:
        print(i)

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

s = 0
j = -1
for i in range(1, N + 1):
    s += i
    j = i
    if s > N:
        break

for i in range(1, N + 1):
    if i != s - N:
        print(i)
    if i == j:
        break

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

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

for x in ans:
    print(x)

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

Solution (Python):
N=int(input())
a=1
cnt=1
while cnt<=N:
  a+=1
  cnt+=a
for i in range(a):
  if i+1!=cnt-N:
    print(i+1)

Solution (Python):

if __name__ == '__main__':
    N = int(input())
    for i in range(1, N+1):
        sumn = i *(i+1)//2
        if(N <= sumn):
            for j in range(1, i+1):
                if j == sumn-N:
                    continue
                print(j)
            exit()

Solution (Python):
n = int(input())
a = 0
while a * (a+1) // 2 < n:
    a += 1
b = a * (a+1) // 2 - n
for i in range(1, a+1):
    if i != b:
        print(i)