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):
def main():
    N = int(input())
    ls = [0]
    ans = []

    for i in range(1,N+1):
        ls.append(ls[-1]+i)
        ans.append(i)
        if N<=ls[-1]:
            break
                
    for i in range(len(ans)):
        if ans[i]==(ls[-1]-N):
            pass
        else:
            print(ans[i])

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
x,cs = 1,1
while n>=cs:
  x +=1
  cs += x
[print(i) for i in range(1,x+1) if i != cs-n]

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

x=1
sum=0
while sum<=n:
 sum=x*(x+1)//2
 x+=1
for i in range(1,x):
 if i!=sum-n:
  print(i)

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

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

fuyou = tmp - N

for i in range(1,p+1):
	if i == fuyou:
		continue
	print(i)

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

def solve(n):
	if (1+n)*n//2 >= N:
		return 1
	else:
		return 0

def Binary_search(s,l):
	if s == l:
		return s
	if s+1 == l:
		if solve(s):
			return s
		else:
			return l

	c = s + (l-s)//2

	if solve(c):
		return Binary_search(s,c)
	else:
		return Binary_search(c,l)

maximum = Binary_search(1,N)
fuyou = ((1+maximum) * maximum // 2) - N
for i in range(1,maximum+1):
	if i == fuyou:
		continue
	print(i)

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

s = 0

i = 1
while s <= N:
    s += i
    i += 1

l = list(range(1, i))
del l[l.index(s-N)]
print(*l)

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

m = 1
l = 0
while l < n:
    l += m
    m += 1

ans = list(range(1, m))

if l != n:
    ans.remove(l - n)
print(*ans, sep="\n")

Solution (Python):
from itertools import accumulate
import bisect

n = int(input())
ls = []
res = 0
for i in range(1, n+1):
    if res > n:
        break
    res += i
    ls.append(res)
while n:
    ind = bisect.bisect_left(ls, n)
    print(ind + 1)
    n -= ind + 1

Solution (Python):
n = int(input())
p = [0]*(n+1)
flag = 0
if n==1:
    print(1)
    exit()
for i in range(1,n+1):
    p[i] = i + p[i-1]
    if p[i] > n:
        flag = i
        break
r = p[flag] -n
for i in range(1,flag+1):
    if i!=r:
        print(i)
    else:
        continue

Solution (Python):
import math
import bisect
import collections
import itertools
import heapq
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return math.gcd 
def lcm(a,b):return (a*b) // math.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def comb(l, n): return itertools.combinations(l, n) 
def 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)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
total = 0
index = 0
for i in range(1, N+1):
    total += i
    if total >= N:
        index = i
        break
diff = total-N
for i in range(1, index+1):
    if diff == i: continue
    print(i)

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

l = 0
r = N
s = (r * (r + 1)) // 2
while r - l > 1:
    m = (r + l) // 2
    x = (m * (m + 1)) // 2
    if x >= N:
        r = m
        s = x
    else:
        l = m

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

Solution (Python):

n = int(input())

i = int((2*n)**(1/2))

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

j = (i+1)*i//2-n

for k in range(1,i+1):
    if k!= j:
        print(k)

Solution (Python):
N = int(input())
A = []
while N>0:
    if N==1:
        A.append(1)
        break
    if N==2:
        A.append(2)
        break
    high = N
    low = 0
    while True:
        mid = (high+low)//2
        if N<=((mid-1)*mid)//2:
            high = mid
        elif N>(mid*(mid+1))//2:
            low = mid
        else:
            break
    A.append(mid)
    N -= mid
for i in range(len(A)):
    print(A[i])

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

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

for j in range(1,k+1):
  if j!=c:
    print(j)

Solution (Python):
n=int(input())
s=0
for i in range(n):
  s+=i+1
  if s>=n:
    k=i+1
    break
if s==n:
  for i in range(k):
    print(i+1)
else:
  if n==2:
    print(2)
  else:
    for i in range(k):
      if s-i-1!=n:
        print(i+1)

Solution (Python):
import bisect

N = int(input())
if N in [1,2]:
  print(N)
  exit()

acms = [0]
for i in range(1,N+1):
  acms.append(acms[i-1]+i)

ans = []
while 1:  
  ans1 = bisect.bisect_left(acms,N)
  if N-ans1<ans1:
    ans.append(ans1)
    ans.append(N-ans1)
    break
  else:
    ans.append(ans1)
    N = N-ans1
    
[print(val) for val in sorted(ans)]

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























def isHigh(x):
  if N<=((x+1)*x)//2:
    return True
  return False
hi=N
lo=0
while abs(hi-lo)>1:
  mid=abs(hi+lo)//2
  if isHigh(mid):
    hi=mid
  else:
    lo=mid
X=hi
sumX=(X+1)*X//2
diff=sumX-N
for i in range(1,X+1):
  if i!=diff:
    print(i)

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

Solution (Python):
def bisect(lst, target, l, r):
    cent = (l + r) // 2

    if r - l == 1:
        return r

    if lst[cent] == target:
        return cent
    elif lst[cent] > target:
        return bisect(lst, target, l, cent)
    else:
        return bisect(lst, target, cent, r) 

N = int(input())
sm = []
buf = 0
for i in range(N + 1):
    sm.append(i + buf)
    buf += i

mx = bisect(sm, N, 0, N)

sub = sm[mx] - N

for i in range(1, mx + 1):
    if i != sub:
        print(i)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int):
    c = 0
    i = 1
    ans = []
    while c <= N:
        c += i
        ans.append(i)
        i += 1
    
    t = c-N

    if c == N:
        print(ans)

    else:
        for i in ans:
            if i != t:
                print(i)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    solve(N)

if __name__ == '__main__':
    main()

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


def main():
    N = int(input())
    ans = set()
    for i in range(1, N+1):
        ans.add(i)
        if sum(ans) >= N:
            break
    m = sum(ans) - N
    if m in ans:
        ans.remove(m)
    for i in ans:
        print(i)


if __name__ == '__main__':
    main()

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


def main():
    N = int(input())
    import math
    while N > 0:
        n = (-1 + math.sqrt(1 + 8*N)) / 2
        n = int(-(-n//1))
        print(n)
        N -= n


if __name__ == '__main__':
    main()

Solution (Python):
def examA():
    H, W = LI()
    S = [LSI() for _ in range(H)]
    Alpha = [chr(ord('A') + i) for i in range(26)]
    for i in range(H):
        for j in range(W):
            if S[i][j]=="snuke":
                ans = str(Alpha[j]) + str(i+1)
    print(ans)
    return

def examB():
    N = I()
    ans = []
    cur = int((N*2-1)**0.5)+1
    ansC = (cur+1)*cur//2
    neg = ansC-N
    if neg>cur:
        cur -=1
        ansC = (cur + 1) * cur // 2
        neg = ansC - N
    for i in range(1,cur+1):
        if i!=neg:
            ans.append(i)
    for v in ans:
        print(v)

    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examB()

Solution (Python):
n = int(input())
ans = set()
limit_num = float('inf')
total = 0
for i in range(1, n + 1):
    total += i
    if total >= n:
        limit_num = i
        break
remove_num = total - n
for i in range(1, limit_num + 1):
    if i != remove_num:
        ans.add(i)
print(*ans, sep='\n')

Solution (Python):
n = int(input())
ans = set()
num = float('inf')
total = 0
for i in range(1, n + 1):
    total += i
    if total >= n:
        num = i
        break
remove_num = total - n
for i in range(1, num + 1):
    if i != remove_num:
        ans.add(i)
print(*ans, sep='\n')

Solution (Python):
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  
rs = lambda: stdin.readline().rstrip()  

N = ri()
x = int((2*N) ** .5)
if x * (x+1) < 2 * N:
    x += 1
diff = x * (x+1) * .5 - N
for i in range(x, 0, -1):
    if i <= diff:
        diff -= i
    else:
        print(i)

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

while N:
    if N <= k:
        print(N)
        break
    N -= k
    print(k)
    k -= 1

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

Solution (Python):
N = int(input())
tmp = 0
right = 1
for i in range(1, N+1):
    tmp += i
    if tmp >= N:
        right = i
        break
forbidden = tmp - N
for i in range(1, right+1):
    if i == forbidden:
        continue
    print(i)

Solution (Python):
n = int(input())
m = 0
l = 0
while l < n:
    m += 1
    l = (1 + m) * m // 2
ans = list(range(1, m + 1))
if l != n:
    ans.remove(l - n)
print(*ans, sep="\n")

Solution (Python):
def biserch(ok,ng):
    while abs(ok-ng) > 1:
        mid = (ok+ng) // 2
        if judge(mid):
            ok = mid
        else:
            ng = mid
    return ok

def judge(x):
    if x * (x + 1) // 2 >= N:
        return True
    else:
        return False

N = int(input())
K = biserch(10 ** 7, 0)
d = K * (K + 1) // 2 - N
for i in range(1, K + 1):
    if i == d:
        continue
    print(i)

Solution (Python):
def solve(n):
    score = 0
    for p in range(1, n+1):
        score += p
        if score >= n:
            break
    x = score - n
    res = list(range(1,x)) + list(range(x+1,p+1))
    return "\n".join(map(str, res))

n = int(input())
print(solve(n))

Solution (Python):
N = int(input())
s = 0
i = 0
while s<N:
    i += 1
    s += i
for j in range(1,i+1):
    if j==s-N:
        continue
    print(j)

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

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

ans.discard(s - n)
for i in ans:
    print(i)

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

ret = []

for i in range(10000) :
    if i * (i + 1) // 2 >= N :
        break
        
for j in range(i, 0, -1) :
    if j <= N :
        ret.append(j)
        N -= j
        
for r in ret[::-1] :
    print(r)

Solution (Python):
from itertools import accumulate
import bisect
n = int(input())
l = list(range(1,int((2*n)**0.5)+2))
l = list(accumulate(l))
a = []
while n:
  i = bisect.bisect_left(l,n)
  a.append(i+1)
  n-=i+1
print(*a,sep='\n')

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


def calc(n):
    mx = 1
    while True:
        if n <= mx * (mx + 1) // 2:
            break
        mx += 1
    return mx


ans = []
while n > 0:
    x = calc(n)
    ans.append(x)
    n -= x

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

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

if N < 3:
    print(N)
    exit()

for i in range(1, N + 1):
    tmp = (i * (i - 1)) //  2
    if tmp >= N:
        ans = i - 1
        break

anslst = [i for i in range(ans, 0, -1)]
tmp = N - anslst[0]
print(anslst[0])
for i in anslst[1:]:
    if tmp - i < 0:
        continue
    if tmp == 0:
        break
    print(i)
    tmp -= i

Solution (Python):
n=int(input())
b=True
now=1
score=0
ans=[]
while b:
  if n-score>now:
    score+=now
    ans.append(now)
    now+=1
  else:
    ans.append(now)
    score+=now
    key=score-n
    b=False
for i in ans:
  if i!=key:
    print(i)

Solution (Python):
def main():
    N = int(input())
    i = 1
    sm = 1
    while sm < N:
        i += 1 
        sm += i

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

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N = int(input())
    i = 1
    sm = 1
    while sm < N:
        i += 1 
        sm += i

    a = [i]
    n = N - i
    i -= 1
    while n != 0:
        if n - i >= 0:
            n = n - i
            a.append(i)
        i -= 1
    
    for i in a:
        print(i)

if __name__ == "__main__":
    main()

Solution (Python):
from itertools import accumulate
from math import sqrt, ceil
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(ceil(sqrt(2 * N)) + 1)))

r = bisect_left(n, N)
answer = list(map(str, range(1, r + 1)))

if n[r] != N:
    d = n[r] - N
    answer.remove(str(d))

print('\n'.join(answer))

Solution (Python):
from itertools import accumulate
from math import sqrt, ceil
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(ceil(sqrt(2 * N)) + 1)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)

Solution (Python):
from itertools import accumulate
from math import sqrt
from bisect import bisect_left

N = int(input())
n = list(accumulate(range(int(sqrt(2 * N)) + 2)))

r = bisect_left(n, N)

if n[r] == N:
    print('\n'.join(map(str, range(1, r + 1))))
    exit()

d = n[r] - N
for i in range(1, r + 1):
    if i != d:
        print(i)

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

i = 1
q = []

while True:
    q.append(i)
    a = i * (i+1) // 2
    if N <= a:
        break
    i += 1

b = a % N
for j in range(len(q)):
    if q[j] != b:
        print(q[j])

Solution (Python):

N = int(input())

ans = []
n = 0
for i in range(1, N+1):
    n += i
    ans.append(i)

    if n >= N:
        break



m = n - N
if m > 0:
    ans.pop(m-1)


for a in ans:
    print(a)

Solution (Python):
N=int(input())
S=[1]
for i in range(1,N):
  S.append(S[i-1]+i+1)
p=0
j=0
if N==1:
  print(1)
else:
  while N>=S[j]:
    j += 1
  p=S[j]-N
  for i in range(1,j+2):
    if i!=p:
      print(i)

Solution (Python):
import math
a,n=[],int(input())
b=n
while n>1:
    a.append(math.floor((2*n)**0.5+1/2))
    n-=a[-1]
for i in range(len(a)):
    print(a[i])
if sum(a)!=b:
    print(1)

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

m=math.floor(math.sqrt(2*n))
if m*(m+1)//2<n:
  m+=1
needless=(m+1)*m//2-n
ans=sorted(set(range(1,m+1)) - set([needless]))
print(*ans,sep='\n')

Solution (Python):
import sys
from math import floor, sqrt

def main():
    n = int(sys.stdin.readline().rstrip())
    m = floor(sqrt(2 * n))
    if m * (m + 1) // 2 < n:
        m += 1

    needless = (m + 1) * m // 2 - n

    res = sorted(set(range(1, m + 1)) - set([needless]))
    print(*res, sep='\n')

if __name__ == '__main__':
    main()

Solution (Python):
import sys
from math import floor, sqrt

def main():
    n = int(sys.stdin.readline().rstrip())
    m = floor(sqrt(2 * n))
    if m * (m + 1) // 2 < n:
        m += 1
    M = m + 1

    needless = M * (M - 1) // 2 - n

    res = sorted(set(range(1, m + 1)) - set([needless]))
    print(*res, sep='\n')

if __name__ == '__main__':
    main()

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

Solution (Python):
N=int(input())
for m in range(1,5*10**3):
    if m*(m+1)//2>=N:
        break

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

Solution (Python):
N=int(input())
for m in range(1,10**9):
    if m*(m+1)//2>=N:
        break

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

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

Solution (Python):
import itertools as it

import bisect

N=int(input())

lists = list(it.accumulate(range(1,N+1)))

output=[]
while N!=0:
    index = bisect.bisect_left(lists,N)+1
    N-=index
    output.append(index)

for i in output:
    print(i)

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

l = 0
r = 10**7+1
while(l<r-1):
  m = (l+r)//2
  if m*(m+1)//2 <= N:
    l = m
  else:
    r = m

if N == l*(l+1)//2:
  ans = list(range(1,l+1))
else:
  ans = list(range(2,r+1))
  for i in range((r-1)*(r+2)//2-N):
    ans[i] -= 1
for a in ans:
  print(a)

Solution (Python):


n = int(input())
cur = 0
target = 0
for i in range(1, n + 1):
    if i + cur >= n:
        target = i
        break
    cur += i

remove_num = sum([i for i in range(1, target + 1)]) - n
for i in range(1, target + 1):
    if i != remove_num:
        print(i)

Solution (Python):







n = int(input())
ans = []
cur = 0

while cur != n:
    tmp = 0
    for i in range(1, n + 1 - cur):
        if i + tmp >= n - cur:
            tmp = i
            break
        tmp += i
    ans.append(tmp)
    cur += tmp
    

for a in ans:
    print(a)

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

for i in range(1,N+1):
    if(N<=(i*(i+1)//2)):
        print(i)
        if(N==1 or N==2):
            exit()
        M=N-i
        j=i-1
        while(M>0):
            if(M>=j):
                M-=j
                print(j)
            j-=1
        exit()

Solution (Python):
n = int(input())
s = 0
for i in range(1, 50000):
    s += i
    if s >= n:
        ex = s - n
        for j in range(1, i + 1):
            if j != ex:
                print(j)
        break

Solution (Python):

from bisect import bisect_left, bisect_right

N=input()
L=[]
for i in range(1,N+1):
    if i==1:
        L.append(i)
    else:
        L.append(L[-1]+i)

max_n=bisect_left(L,N)+1

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

Solution (Python):
N = int(input())
K = 1
while (K * (K + 1) // 2) < N:
    K += 1
ans = []
for k in range(1, K + 1)[:: -1]:
    if N >= k:
        ans.append(k)
        N -= k
print(*ans, sep='\n')

Solution (Python):
n = int(input())
ans = 0
t = 1
while ans < n:
    ans += t
    t += 1
a_list = list(range(1, t))
a_list = list(set(a_list) - set([ans - n]))
for aa in a_list:
    print(aa)

Solution (Python):
N=int(input())
lst=set()
num=0
for i in range(1,N+1):
    lst.add(i)
    num+=i
    if num>=N:
        if num==N:
            break
        else:
            lst.remove(num-N)
            break
for s in lst:
    print(s)

Solution (Python):
n = int(input())
s = int((-1 + (1+8*n)**(1/2) ) /2)
if s*(s+1)/2 == n:
    ans = [i  for i in range(1,s+1)]
elif s*(s+1)/2 < n:
    tmpans = [i for i in range(1,s+2)]
    
    
    del tmpans[sum(tmpans) - n - 1]
    ans = tmpans
else:
    tpmans = [i for i in range(1,s+1)]
    
    
    del tmpans[sum(tmpans) - n - 1]
    ans = tmpans
    
for i in ans:
    print(i)

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

N = int(input())
cs = 0
x = 0
for i in range(1, N + 1):
  x = i
  cs += x
  if cs >= N:
    break
for i in range(1, x + 1):
  if i == cs - N:
    continue
  print(i)

Solution (Python):

N = int(input())

now = 0
s = 0

while s < N:
    now += 1
    s += now

for i in range(now):

    i += 1
    if i != s-N:
        print (i)

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

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

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

Solution (Python):
N = int(input())
k = 0
while k * (k+1) // 2 < N:
  k += 1
while N > 0:
  print(min(k, N))
  N -= min(k, N)
  k -= 1

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

Solution (Python):
n=int(input())
use=0
for i in range(10000):
    if i*(i+1)>=2*n:
        use=i
        break
      
lists=[ i for i in range(1,use+1)]
distance=sum(lists)-n
while distance>0:
    for j in lists:
        if distance==j:
            lists.remove(j)
            distance-=j
for some in lists:
  print(some)

Solution (Python):
n = int(input())
total = 0
ng_number = -1
end_number = -1
for i in range(1, n + 1):
    total += i
    if total == n:
        end_number = i
        break
    elif total > n:
        ng_number = total - n
        end_number = i
        break
for i in range(1, n+1):
    if end_number < i:
        break
    if not ng_number == i:
        print(i)

Solution (Python):
n=int(input())
A=[]
cnt=0
add=0
for i in range(4472):
    cnt +=i+1
    A.append((cnt,i+1))
for i in range(len(A)-1):
    if A[i][0]<=n<=A[i+1][0]:
        add=(A[i+1][1],A[i+1][0]-n)
        break
for i in range(add[0]):
    if i+1==add[1]:continue
    print(i+1)

Solution (Python):





mod=10**9+7
def factorial(x): 
    n=1
    for i in range(x):
        n=(n*(i+1))%mod
    return n

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))
def div(x): 
    div=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            div.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
      div.append(x)
    return div
def div2(x): 
    div2=[]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            div2.append(check)
            x/=check
        check+=1
    if x != 1:
      div2.append(x)
    return div2

def main():
    
    
    
    
    
    
    
    
    
    
    n=int(input())
    m=0
    while n>(m*(m+1))//2:
        m+=1
    for i in range(m):
        i+=1
        if not i == (m*(m+1))//2 - n:
            print(i)

main()

Solution (Python):
n=int(input())
k=1
i=1

while k<=n:
    i+=1
    k+=i
for j in range(1,i+1):
    if j==k-n:
        continue
    else:
        print(j)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
cnt = 0
accumlation = 0
for i in range(1, N+1):
    accumlation += i
    cnt += 1
    if accumlation > N:
        break
for j in range(1, cnt+1):
    if j != (accumlation - N):
        print(j)

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

s = 0
a = 1
while s < n:
    s += a
    a += 1

for ai in (a for a in range(1, a) if a != s - n):
    print(ai)

Solution (Python):
n=int(input())
A=[]
cnt=0
add=0
for i in range(4472):
    cnt +=i+1
    A.append((cnt,i+1))
for i in range(len(A)-1):
    if A[i][0]<=n<=A[i+1][0]:
        add=(A[i+1][1],A[i+1][0]-n)
        break

for i in range(add[0]):
    if i+1==add[1]:
        continue
    print(i+1)

Solution (Python):
'''
CODE FESTIVAL 2016 Final
B - Exactly N points
'''

if __name__ == "__main__":
    N = int(input())
    ans = list()
    res = N
    tmp = 1
    while True:
        if res <= 0:
            if res == 0:
                break
            else:
                ans.pop(ans.index(abs(res)))
                break
        ans.append(tmp)
        res -= tmp
        tmp += 1

    for a in ans:
        print(a)

Solution (Python):
import sys
sys.setrecursionlimit(10000)

def nat_sum(n):
  if n==0:
    pass
  else:
    k = 0
    for i in range(n):
      if i*(i+1)//2 < n <= (i+1)*(i+2)//2:
        k = i+1
        break
    print(k)
    nat_sum(n-k)
    
n = int(input())
nat_sum(n)

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


if n==1:
    print(1)
    exit()
    
if n==2:
    print(2)
    exit()
    
for i in range(n):
    if i+i**2>=2*n:
        check=i

        break

total=(1+check)*check//2
out=total-n

for i in range(1,check+1):
    if i!=out:
        print(i)

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

Solution (Python):
N = int(input())
for i in range(10**4):
  if i * (i + 1) > 2 * N:
    a = i
    s = (a * (a + 1)) // 2
    break

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

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







about_k = int((-1+math.sqrt(1+8*N))//2)
k = about_k

for i in range(about_k-10,(about_k+10)+1):
 if((i-1)*i < 2*N <= i*(i+1)): 
  
  k = i
  break

ans = []
sum_p = N
for i in range(k):
  tmp = k-i 
  if(sum_p-tmp >= 0):
   sum_p -= tmp
   ans.append(tmp)
  if(sum_p == 0): break
    
for i in range(len(ans)):
  print(ans[i])

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

Solution (Python):
n=int(input())
c=0
for i in range(1,n+1):
	c+=i
	if c>=n:
		f=c>n
		d=n-c+i*f
		j=i+1-f
		break
for i in range(1,j):
	print(i+(j-i<=d))

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

m = int((n*2) ** 0.5)
if m*(m-1) >= n*2:
    m -= 1
elif m*(m+1) < n*2:
    m += 1

for i in range(m, 0, -1):
    if n-i >= 0:
        print(i)
        n -= i
    if n == 0:
        break

Solution (Python):

n = int(input())

i = 0
s = 0

while True:
    s += i
    if s > n:
        key = s - i
        key2 = n - key
        key3 = i - 1
        break
    else:
        i += 1



ans = []
j = 1
for i in range(key3):
    if i >= key3-key2:
        ans.append(j+1)
    else:
        ans.append(j)
    j += 1


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

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

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

for i in range(10000):
    if i * (i + 1) / 2 == N:
        for i in range(1, i + 1):
            print(i)
        break
    elif i * (i + 1) / 2 > N:
        remove = i * (i + 1) / 2 - N
        for i in range(1, i + 1):
            if i != remove:
                print(i)
        break

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
cnt = 0
i = 1
while True:
    cnt += i
    if cnt >= n:
        break
    i += 1
for j in range(1,i+1):
    if j == cnt-n:
        continue
    print(j)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
cnt = 0
i = 1
if n == 1:
    print(1)
    quit()
elif n == 2:
    print(2)
    quit()
while True:
    cnt += i
    if cnt >= n:
        break
    i += 1
res = []
while n > 0:
    res.append(i)
    n -= i
    i -= 1
    if n > i:
        continue
    res.append(n)
    break
for i in range(len(res))[::-1]:
    print(res[i])

Solution (Python):
def resolve():
    n = int(input())
    ans = []
    i = 1
    while i * (i + 1) // 2 < n:
        ans.append(i)
        i += 1
    ans.append(i)
    d = i * (i + 1) // 2 - n
    
    if d != 0:
        ans.remove(d)
    print("\n".join([str(i) for i in ans]))


if __name__ == "__main__":
    resolve()

Solution (Python):
n=int(input())
ans=0
l=[]
for i in range(1,n+1):
    ans+=i
    if ans>=n:
        l.append(i)
        break
    else:
        l.append(i)
s=sum(l)
if n==s:
    
    for k in range(i):
        print(l[k])
else:
    for j in range(i):
        
        if s-l[j]==n:
            l=l[:j]+l[j+1:]
            for k in range(i-1):
                print(l[k])
            break

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

ans_sum = 0
max_num = 1
while True:
    if ans_sum + max_num >= n:
        break
    ans_sum += max_num
    max_num += 1

for i in range(1, max_num + 1)[::-1]:
    if i <= n:
        n = n - i
        print(i)

Solution (Python):
N=int(input())
M=[]
s=0

for i in range(5000):
  s+=i+1
  M.append(i+1)
  if s>=N:
    break
    
M=M[::-1]
for i in range(len(M)):
  if s-M[i]>N:
    M[i]=0
    s-=M[i]
  elif s-M[i]==N:
    M[i]=0
    break

for i in M:
  if i:
    print(i)

Solution (Python):
N = int(input())
for n in range(1, N+1):
  if n*(n+1)//2 >= N:
    break
d = n*(n+1)//2-N
s = set(range(1, n+1))
s.discard(d)
for i in s:
  print(i)

Solution (Python):
import math
N = int(input())
M = (math.ceil((math.sqrt(1+8*N)-1)/2))
for m in range(0,M):
  if M-m <= N:
    print(M-m)
    N -= M-m
  else:
    if N!=0:
      print(N)
    break

Solution (Python):
import math
N=int(input())
M=int(math.sqrt(N*2-0.25)+0.5)
left = M*(M-1) // 2
sum_=0
for i in range(1,M-(N-left)):
    print(i)
    sum_ += i
for i in range(M-(N-left),M):
    print(i+1)
    sum_ += i+1

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

sum=0
for i in range(1,N+1):
    sum+=i
    if sum==N:
        for i in range(1,i+1):
            print(i)
        exit()
    elif sum>N:
        for j in range(1,i+1):
            if not j==(i*(i+1)//2)-N:
                print(j)
        exit()

Solution (Python):
N=int(input())
n=int((2*N-1/4)**.5+.5)
for i in range(1,n+1):
 if n*(n+1)//2-N-i:print(i)

Solution (Python):
def f(N):
    if N==0: return set()
    for n in range(N+1):
        S = (n+1)*n//2
        if S>=N:break
    return set(range(1,n+1)) - f(S-N)   

ans = f(int(input()))
for o in ans:
    print(o)