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 = 1
exclude = 0
while n*(n+1)//2 < N:
  n += 1
exclude = n*(n+1)//2-N
for num in range(n+1):
  if num == exclude or num == 0:
    continue
  else:
    print(num)

Solution (Python):
N = int(input())
K = 0
k = 0
while K < N:
  k += 1
  K += k
while N > 0:
  if N >= k:
    print(k)
    N -= k
  k -= 1

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

num_sum = 0
max_num = 1
for i in range(n+1):
    num_sum += i
    if num_sum >= n:
        max_num = i
        break

for i in range(1, max_num+1):
    if i != num_sum - n:
        print(i)

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

sums=0
A=[]
i=1
while sums<N:
    sums+=i
    A.append(i)
    i+=1

cnt=sum(A)-N
for i in A:
    if i!=cnt:
        print(i)

Solution (Python):





N = int(input())

i = 0
isum = 0

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

t = isum - N

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

Solution (Python):
import sys

N=int(input())
temp=0
ans=[]
for i in range(1,N+1):
  temp+=i
  if temp==N:
    for j in range(1,i+1):
      print(j)
    else:
      sys.exit()
  elif temp>N:
    for j in range(1,i+1):
      if j==temp-N:
        continue
      print(j)
    else:
      sys.exit()

Solution (Python):

N = int(input())

A = []
num = 1
cnt = 0
for _ in range(N):
    A.append(num)
    cnt += 1
    if num == cnt:
        cnt = 0
        num += 1

ans = [A[-1]]
tgt = N - A[-1]

for i in range(A[-1]-1,0,-1):
    tgt -= i
    if tgt == 0:
        ans.append(i)
        break
    if tgt < 0:
        tgt += i
        continue
    ans.append(i)

for a in ans:
    print(a)

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

W = 0

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

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

i = 1
num = 0
while True:
    num += i
    if num >= N:
        break
    i += 1

del_num = num - N
min_num = i
for i in range(1, min_num+1):
    if i != del_num:
        print(i)

Solution (Python):
def main():
    N = int(input())
    n = 1
    
    while n * (n + 1) // 2 < N:
        n += 1
    
    d = n * (n + 1) // 2 - N
    solve = [1] * (n + 1)  
    for i in range(n, 0, -1):
        if i <= d:
            d -= i
            solve[i] = 0
        if d == 0:
            break
    for i in range(1, n + 1):
        if solve[i] == 1:
            print(i)


if __name__ == '__main__':
    main()

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

aa =[]
i = 0
score = 0

while score < n:
  i += 1
  score += i
  aa.append(i)
  
if score == n:
  for k in range(len(aa)):
    print(aa[k])
    
else:
  aa.remove(score - n)
  for k in range(len(aa)):
    print(aa[k])

Solution (Python):
n = int(input())
score = 0
i = 0
ans_list = []

while score <= n:
    i += 1
    score += i
    ans_list.append(i)

ans_list.remove(score - n)
for k in range(len(ans_list)):
    print(ans_list[k])

Solution (Python):
n = int(input())
score = 0
i = 0
ans_list = []

while score < n:
    i += 1
    score += i
    ans_list.append(i)

if score == n:
    for k in range(len(ans_list)):
        print(ans_list[k])
else:
    ans_list.remove(score - n)
    for k in range(len(ans_list)):
        print(ans_list[k])

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

for i in range(1,n+1):
    now = i*(i+1)//2
    if n-now <= 0:
        break

ans = []
for j in range(i,0,-1):
    if n < j:
        if n != 0:
            ans.append(n)
        break
    ans.append(j)
    n -= j
    
for r in ans:
    print(r)

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

def f(n):
    return ((1 + n) * n) // 2
 
s = 0
for x in range(1, n+1):
    if f(x) > n:
        s = f(x)
        break

dif = s - n

for ans in range(1, x+1):
    if ans != dif:
        print(ans)

Solution (Python):
n=int(input())
i=1
res=0
ans=[]
while res<n:
  res+=i
  ans.append(i)
  i+=1
if res-n!=0:
  ans.remove(res-n)
for p in ans:
  print(p)

Solution (Python):
n = int(input())
point = 0
ans = []
for i in range(1, n+1):
    point += i
    ans.append(str(i))
    if point >= n:
        if str(point - n) in ans:
            ans.remove(str(point - n))
        print('\n'.join(ans))
        break

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

s = 0
for i in range(1,10**5):
  s += i
  if s >= n:
    t = i
    break

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

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    ok = n
    ng = 0

    while ok-ng > 1:
        middle = (ok+ng)//2
        max_score = (middle)*(middle+1)//2
        if max_score >= n:
            ok = middle
        else:
            ng = middle
    
    ans_lst = []
    num = ok

    while n != 0:
        if n > num:
            ans_lst.append(num)
            n -= num
            num -= 1
        else:
            ans_lst.append(n)
            n -= n

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

    

main()

Solution (Python):
import math

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

s = int(max_num * (1 + max_num) / 2)

d = s - n

for i in range(max_num):
    if i+1 != d:
        print(i+1)

Solution (Python):
import math

n = int(input())


def ts(x):
    return x * (x + 1)


m = n
for i in range(math.ceil(math.sqrt(2 * n) - 2), math.floor(math.sqrt(2 * n)) + 1, 1):
    if ts(i) < 2 * n <= ts(i + 1):
        m = i + 1
        break



if m % 2 == 0:
    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1
else:
    """
  check=[]
  if a!=0:
      check.append(a)
  i = 1
  c = 0
  while c!=b and i<(m+1)//2:
      if i!=a and m+1-i!=a:
          check.append(i)
          check.append(m+1-i)
          c+=1
      i+=1
  if c==b:
      for i in check:
          print(i)
  else:

      n-=(m+1)//2
      a = n % (m + 1)
      b = n // (m + 1)
      if m % 2 == 0:
          if a != 0:
              print(a)
          i = 1
          c = 0
          while c != b:
              if i != a and m + 1 - i != a:
                  print(i)
                  print(m + 1 - i)
                  c += 1
      """
    print(m)
    n -= m
    m -= 1

    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1

Solution (Python):
import math

n = int(input())


def ts(x):
    return x * (x + 1)


m = n
for i in range(math.ceil(math.sqrt(2 * n) - 2), math.floor(math.sqrt(2 * n)) + 1, 1):
    if ts(i) < 2 * n <= ts(i + 1):
        m = i + 1
        break



if m % 2 == 0:
    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1
else:
    """
  check=[]
  if a!=0:
      check.append(a)
  i = 1
  c = 0
  while c!=b and i<(m+1)//2:
      if i!=a and m+1-i!=a:
          check.append(i)
          check.append(m+1-i)
          c+=1
      i+=1
  if c==b:
      for i in check:
          print(i)
  else:

      n-=(m+1)//2
      a = n % (m + 1)
      b = n // (m + 1)
      if m % 2 == 0:
          if a != 0:
              print(a)
          i = 1
          c = 0
          while c != b:
              if i != a and m + 1 - i != a:
                  print(i)
                  print(m + 1 - i)
                  c += 1
      """
    print(m)
    n -= m
    m -= 1

    a = n % (m + 1)
    b = n // (m + 1)
    if a != 0:
        print(a)
    i = 1
    c = 0
    while c != b:
        if i != a and m + 1 - i != a:
            print(i)
            print(m + 1 - i)
            c += 1
        i += 1

Solution (Python):
import math
N = int(input())
number = math.ceil((N * 2) ** 0.5)
if number * (number + 1) // 2 == N:
    answers = [n for n in range(1, number + 1)]
    for answer in answers:
        print(answer)
else:
    whole=number*(number+1)//2
    sa=whole-N
    answers = [n for n in range(1, number + 1)]
    bad=[]
    for n in range(N):
        if sa>answers[-n-1]:
            sa-=answers[-n-1]
            bad.append(answers[-n-1])
        elif sa==answers[-n-1]:
            sa-=answers[-n-1]
            bad.append(answers[-n-1])
            break
    for ans in answers:
        if ans in bad:
            continue
        print(ans)

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

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

Solution (Python):
N = int(input())
def floor(x):
  if x == int(x):
    return x
  else:
    return int(x)+1
m = floor(((1+8*N)**0.5 - 1 ) /2)
S = ((m+1)*m) // 2
skip = S - N
for i in range(int(m)):
  if i+1 == skip:
    continue
  print(i+1)

Solution (Python):
n = int(input())
x = 0
i = 0
while n > x:
    i += 1
    x = (i * (i + 1)) // 2

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

Solution (Python):
import sys, math
from functools import lru_cache
from collections import defaultdict
from decimal import Decimal
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    k = 1
    while k*(k+1)//2 < N:
        k += 1
    if k*(k+1)//2 > N:
        k -= 1

    r = N-(k*(k+1)//2)

    for i in range(k, 0, -1):
        if i > k-r:
            print(i+1)
        else:
            print(i)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

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

Solution (Python):
n = int(input())
now = 0
for i in range(1,n+2):
    now += i
    if now >= n:
        x = now-n
        for j in range(1,i+1):
            if j != x:
                print(j)
        exit()

Solution (Python):


def main():
    n = int(input())

    for i in range(10**4):
        if n <= i * (i + 1) / 2:
            tmp = i
            break
    tmpsum = tmp * (tmp + 1) / 2
    if n == tmpsum:
        for i in range(1, tmp + 1):
            print(i)
    else:
        for i in range(1, tmp + 1):
            if i == tmpsum - n:
                continue
            print(i)


if __name__ == "__main__":
    main()

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

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

ng=0
ok=N+1

while abs(ng-ok)>1:
    mid=(ok+ng)//2

    if is_ok(mid):
        ok=mid
    else:
        ng=mid

diff=ok*(ok+1)//2-N

for i in range(1,ok+1):
    if i!=diff:
        print(i)

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

k = 1
i = 1
while k < n:
    i += 1
    k += i

while n > i:
    print(i)
    n -= i
    i -= 1
print(n)

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

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

    idx = 0
    for i in range(1, 5000):
        if i*(i+1)//2 <= N:
            idx = i

    delta = N - idx * (idx + 1) // 2

    r = m = 0
    if delta % idx == 0 and delta != 0:
        r = 1
    else:
        r, m = divmod(delta, idx)

    prob = [r + (i + 1) for i in range(idx)]

    for i in range(1, m + 1):
        prob[idx - i] += 1

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
def is_ok(m, n):
    return m*(m+1)//2>=n
def meguru_bisect(ng, ok, n):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid, n):
            ok = mid
        else:
            ng = mid
    return ok
def f(n):
    if n>0:
        m = meguru_bisect(0,10**7, n)
        print(m)
        f(n-m)
N = int(input())
f(N)

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

lst = []
i = 1
sm = 0
while sm < N:
  lst.append(i)
  sm += i
  i += 1
  
if sm == N:
  for l in lst:
    print(l)
else:
  a = sm - N
  lst.remove(a)
  for l in lst:
    print(l)

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

Solution (Python):
import math
from itertools import  accumulate
n = int(input())
tmp = n

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

d = sum - n
if d in ans:
    ans.remove(d)

for i in sorted(ans):
    print(i)

Solution (Python):
import math
from math import gcd,pi
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    l = [1]
    ans = []
    for i in range(2,10**4):
        l.append(l[i-2]+i)
    while True:
        if n == 0:
            break
        for i,k in enumerate(l):
            if n <= k:
                if i == 0:
                    a = k
                else:
                    a = k - l[i-1]
                ans.append(a)
                n -= a
                break
    for i in ans:
        print(i)

if __name__=="__main__":
    main()

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

Solution (Python):
n = int(input())
b = 1
e = 100000
score = 0
while True:
    mid = (e + b) // 2
    score = (mid * (mid + 1)) // 2
    if score >= n:
        e = mid
    else:
        b = mid
    if abs(e - b) <= 1:
        break
    
if b * (b + 1) // 2 >= n:
    ans = b
else:
    ans = e

rest = ((ans * (ans + 1)) // 2) - n
for num in range(1, ans + 1):
    if rest == num:
        continue
    print(num)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


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

    def isOK(mid):
        if N <= (mid * (mid + 1)) // 2:
            return True
        else:
            return False

    ok = 10 ** 7
    ng = 0

    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    while N > 0:
        if N >= ok:
            print(ok)
            N -= ok
            ok -= 1
        else:
            ok -= 1


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
val, a = 0, 1

while val <= n:
    val += a
    a += 1
b = val-n
for i in range(1, a):
    if i != b:
        print(i)

Solution (Python):
n=int(input())
t=1
while n>t:
    n-=t
    t+=1
rem=t-n
las=t
for i in range(1,las+1):
    if i!=rem:
        print(i)

Solution (Python):
n=int(input())
for i in range(n+1):
  if i*(i+1)//2>=n:break
ans=[]
for j in range(i,0,-1):
  if j<=n:
    n-=j
    ans+=[j]
print(*ans,sep='\n')

Solution (Python):
n = int(input())
total = 0
ans = []
for i in range(1, n+1):
    ans.append(i)
    total += i
    if total > n:
        break
ng = total - n
print(*[i for i in ans if i != ng], sep='\n')

Solution (Python):
n = int(input())
total = 0
ans = []
for i in range(1, n+1):
    ans.append(i)
    total += i
    if total > n:
        break
ng = total - n
print(*[i for i in ans if i != ng], sep='\n')

Solution (Python):
n = int(input())
a = []
b = 0
i = 1
while b < n:
    a.append(i)
    b += i
    i += 1
b -= n
for i in a:
    if i != b:
        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
ans = []
n = int(input())
for i in range(n+1):
  s = i*(i+1)//2
  if s >= n:
    k = i
    break
sabun = s - n
for i in range(k,0,-1):
  
  if sabun >= i:
    sabun -= i
  else:
    ans.append(i)
print(*reversed(ans),sep = "\n")

Solution (Python):
from itertools import accumulate
import bisect
n=int(input())
l=list(accumulate(range(4473)))
while True:
    i=bisect.bisect_left(l,n)
    if i<1:break
    print(i)
    n-=i

Solution (Python):
from itertools import accumulate
n=int(input())
l=list(accumulate(range(4473)))

while True:
    for i,x in enumerate(l):
        if n==x:
            for y in range(1,i+1):
                print(y)
            exit()
        elif n<x:
            print(i)
            n-=i
            break

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

ans = []
cnt = 0

for i in range(1, n+1):
    if cnt + i == n:
        ans.append(i)
        break
    elif cnt + i < n:
        cnt += i
        ans.append(i)
    else:
        dif = n - cnt
        ans[-dif] += dif
        break

for a in ans:
    print(a)

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

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())
a=[1]
b=2
s=1
def pr(x):
  for i in range(len(x)):
    print(x[i])
while s<=n:
  a.append(b)
  s+=b
  b+=1
if s==n:
  pr(a)
else:
  c=s-n
  a.remove(c)
  pr(a)

Solution (Python):
import sys




import math







stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    n = int(stdin.readline().rstrip())
    
    
    
    
    
    
    p = math.ceil(n/2)
    for i in range(n):
        num = (p*(p+1))/2
        if num <= n:
            break
        else:
            p -= 1
    if num == n:
        for i in range(p):
            print(i+1)
        exit()
    else:
        p += 1
        num = (p*(p+1))/2
        dif = num-n
        for i in range(p):
            if i+1 == dif:
                pass
            else:
                print(i +1)








if __name__ == '__main__':
    solve()

Solution (Python):



import sys
sys.setrecursionlimit(10**9)


INF = 10**9


def solve(n):
  s = 0
  l = []
  for i in range(n):
    s += i+1
    l += [i+1]
    if s > n:
      l.remove(s-n)
      return l
    elif s == n:
      return l

  return -1



def main():
  N = int(input())
  
  
  print(*solve(N),sep="\n")
  return

if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
for i in range(n):
    if (i + 1) * (i + 2) // 2 >= n:
        m = i + 1
        d = (i + 1) * (i + 2) // 2 - n
        break
for i in range(m):
    if i + 1 == d:
        continue
    else:
        print(i + 1)

Solution (Python):
n=int(input())
ans=[]
sm=0
for i in range(1,n+1):
    sm+=i
    ans.append(i)
    if sm==n:
        break
    if sm>n:
        p=sm-n
        ans.pop(p-1)
        break

for i in ans:
    print(i)

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

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

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

Solution (Python):
n=int(input())
tmp=0
for i in range(1,10000000):
    tmp+=i
    if tmp>n:
        a=i-1
        tmp-=i
        break
    elif tmp==n:
        for j in range(i):
            print(j+1)
        exit()
x=n-tmp
y=a-x

ans=[]
for i in range(1,a+1):
    if i<=y:
        ans.append(i)
    else:
        ans.append(i+1)

[print(i) for i in ans]

Solution (Python):
N=int(input())
l=0
r=0
for i in range(1,N+1):
  s=i*(i+1)//2
  if s>=N:
    l=i
    r=s-N
    break
ans=list(range(1,l+1))
if r!=0:
  ans.remove(r)
print(*ans,sep='\n')

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

if N in (1, 2):
    print(N)
    exit()

for i in range(2, 10 ** 4):
    x = i * (i + 1) / 2
    if x - (i - 1) <= N <= x:
        a = i
        break

ans = [i for i in range(1, a + 1)]
b = a*(a+1)/2 - N

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

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

t=int(2*n**0.5)
ans = {i for i in range(1,t+1)}

sum=t*(t+1)//2


for i in range(t,0,-1):
    if sum-i >n:
        ans.remove(i)
        sum -= i
    elif sum-i == n:
        ans.remove(i)
        break

for i in ans:
    print(i)

Solution (Python):
import math
N = int(input())
saidai = math.sqrt(2*N)
saidai = math.floor(saidai)
if saidai*saidai+saidai == 2*N:
    for i in range(1, saidai+1):
        print(i)
elif saidai*saidai+saidai < 2*N:
    saidai = saidai+1
    huyou = saidai*saidai+saidai-2*N
    if huyou % 2 == 0:
        huyou //= 2
        for i in range(1, saidai+1):
            if i == huyou:
                continue
            print(i)
    else:
        huyou = huyou//2+1
        for i in range(2, saidai+1):
            if i == huyou:
                continue
            print(i)
else:
    for i in range(saidai, 0, -1):
        if i*i+i < 2*N:
            newsaidai = i+1
            break
    saidai = newsaidai
    huyou = saidai*saidai+saidai-2*N
    if huyou % 2 == 0:
        huyou //= 2
        for i in range(1, saidai+1):
            if i == huyou:
                continue
            print(i)
    else:
        huyou = huyou//2+1
        for i in range(2, saidai+1):
            if i == huyou:
                continue
            print(i)

Solution (Python):
def solve():
  cnt = 0
  N = int(input())
  ans = []
  for i in range(1,N+2):
    cnt += i
    ans.append(i)
    if cnt>N:
      ans.remove(cnt-N)
    if cnt>=N:
      break
  return ans
print(*solve(),sep='\n')

Solution (Python):
N = int(input())
k = 1
while (k*(k+1))//2<N:
    k += 1
if N==(k*(k+1))//2:
    for i in range(1,k+1):
        print(i)
else:
    ind = -1
    for j in range(1,k):
        tot = 0
        for i in range(1,k+1):
            if i!=j:
                tot += i
        if tot==N:
            ind = j
            break
    for i in range(1,k+1):
        if i!=ind:
            print(i)

Solution (Python):
n = int(input())
 
_sum = 0
_tmp = 0
while _sum <= n:
    _tmp += 1
    _sum += _tmp
    if _sum >= n:
        break
 
ans = []
while n:
    if n - _tmp < 0:
        _tmp -= 1
    else:
        ans.append(_tmp)
        n -= _tmp
        _tmp -= 1
 
for i in ans:
    print(i)

Solution (Python):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def check(k, n):
    a = k * (k + 1) // 2
    if n <= a:
        return True
    else:
        return False


def main():
    n = ni()

    
    l = 1; r = n
    while l + 1 < r:
        k = (l + r) // 2
        if check(k, n):
            r = k
        else:
            l = k
    
    no = r * (r + 1) // 2 - n
    for i in range(1, r+1):
        if i == no:
            continue
        print(i)

if __name__ == "__main__":
    main()

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

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

for i in range(10**5):
    if i*(i+1)//2>=N:
        m = i
        break

a = m*(m+1)//2-N
ans = []

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

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

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

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

_sum = 0
_tmp = 0
while _sum <= n:
    _tmp += 1
    _sum += _tmp
    if _sum >= n:
        break

ans = []
while n:
    if n - _tmp < 0:
        _tmp -= 1
    else:
        ans.append(_tmp)
        n -= _tmp
        _tmp -= 1

for i in ans:
    print(i)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())

res = 0
ret = 0
for i in range(1,n+1):
    res += i
    if res >= n:
        ret = i
        break

ans = []
while n:
    if n-ret < 0:
        ret -= 1
    else:
        ans.append(ret)
        n -= ret
        ret -= 1

for i in ans:
    print(i)

Solution (Python):
N = int(input())
cnt = [False] * 10001
now = 0
idx = 0
for i in range(1, 10001):
    if now >= N:
        break
    now += i
    cnt[i] = True

if now != N:
    for i in range(10000, 0, -1):
        if now == N:
            break
        elif cnt[i] and now - i >= N:
            cnt[i] = False
            now -= i

for i in range(10001):
    if cnt[i]:
        print(i)

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

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

y = x-N

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

Solution (Python):
import math
n=int(input())
num=int(math.sqrt(n*2))
num2=(num*(num+1))//2
num3=n-num2
if num3>num:
    num+=1
    num3-=num
if num3<0:
    num-=1
    num3+=num+1
ans=list(range(1,num+1))
for i in range(num3):
    ans[-i-1]+=1
for i in ans:
    print(i)

Solution (Python):
import math
N = int(input())
while N>=1:
    max = math.ceil((-1+(1+8*N)**0.5)/2)
    print(max)
    N -= max

Solution (Python):
N=int(input())
S=0
i=0
while S<N:
    i+=1
    S+=i

T=set()
for a in range(i,0,-1):
    if N>=a:
        T.add(a)
        N-=a

print("\n".join(map(str,T)))

Solution (Python):
N = int(input())
num,a = 0,0
l = []
for i in range(N):
    num += 1
    a += num
    l += num,
    if a >= N:
        minus = a - N
        break

for i in l:
    if i != minus:
        print(i)

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

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

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())

n = INT()
ans = []

reg = 0
i = 1
while reg <= n:
    ans.append(i)
    reg += i
    i += 1
if reg - n > 0:
    ans.remove(reg-n)
for x in ans:
    print(x)