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):
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict 
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal as D  
  
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
from fractions import Fraction as F  






n=int(input())
A=[i*(i+1)//2 for i in range(4500)]

def qq(score,ANS):
    if score==0:return ANS
    if score==1: return ANS+[1]
    maxmon= bileft(A,score)
    return qq(score-maxmon, ANS+[maxmon])
ANS=qq(n,[])
for i in ANS:
    print(i)

Solution (Python):
N = int(input())
sum = 0
diff = 0
last = 0
for i in range(1, N+1):
    sum += i
    if sum >= N:
        diff = sum - N
        last = i
        break
for i in range(1, last+1):
    if i == diff:
        continue
    print(i)

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

total = []
for i in range(1,n+1):
  
  if sum(total)>=n:
    break
  total.append(i)
  
if sum(total)-n<total[-1]:
  if sum(total)-n in total:
    del total[sum(total)-n-1]
      
for i in total:
  print(i)

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

for i in range(1, n + 1):
    if (i + 1) * i // 2 >= n:
        ans = []
        for j in range(i, 0, -1):
            if n - j >= 0:
                n -= j
                ans.append(j)

        print(*ans[::-1], sep="\n")
        exit()

Solution (Python):
import math
import sys
N=int(input())
c=int(math.sqrt(2*N))
for i in range(c-1,N+1):
  a=i*(i+1)//2
  if a>N:
    L=list(range(1,i+1))
    L.pop(a-N-1)
    for j in range(len(L)):
      print(L[j])
    sys.exit()
  elif a==N:
    L=list(range(1,i+1))
    for i in range(len(L)):
      print(L[i])
    sys.exit()

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

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

Solution (Python):
def answer(n):
    _except = 0
    stack = 0
    arr = []
    i = 0
    while(True):
        if stack == n:
            break
        if stack > n:
            _except = stack - n
            break
        i += 1
        arr.append(i)
        stack += i
    for a in arr:
        if a == _except:
            continue
        print(a)

n = int(input())
answer(n)

Solution (Python):
N=int(input())
for i in range(1,N+1):
   if (1+i)*(i/2) >= N:
      break
S=i
for i in reversed(range(1,S+1)):
   if N >=i:
      N-=i
      print(i)
   if N == 0:
      exit()

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

Solution (Python):
N = int(input())
vec = []

k = 0
sum = 0
while(k**2 + k < 2*N):
  k += 1
  sum += k
  vec.append(k)
if(sum - N):
  vec.remove(sum - N)


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

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


num = 0
for i in range(4500):
  num += (i + 1)
  if num >= n:
    break
print(*(j + 1 for j in range(i + 1) if j + 1 != num - n), sep='\n')

Solution (Python):
N=int(input())
tmp=0
b=0
for i in range(1,N+10):
    n=(i+1)*i//2
    if(n>=N):
        tmp=n-N
        b=i
        break
for i in range(1,b+1):
    if(i==tmp):
        continue
    print(i)

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

s = 0
for i in range(1, N+1):
    s += i
    if s >= N:
        c = s - N
        for l in range(1, i+1):
            if c != l:
                print(l)
        break

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

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


def intsum(n):
    return (n * n + n) // 2


tmp = 0
for i in range(n):
    if intsum(i + 1) >= n:
        tmp = i + 1
        break
for i in range(tmp):
    if i + 1 == intsum(tmp) - n:
        continue
    print(i + 1)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,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 operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]







n=ii()

if n==1:
    print(1)
    exit()

ans=0
i=0
p=0
while ans<n:
    i+=1
    ans+=i
if ans>n:
    p=ans-n

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

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def divisor(n):
        res = []
        i = 1
        for i in range(1, int(n ** 0.5) + 1):
            if n % i == 0:
                res.append(i)
                if i != n // i:
                    res.append(n // i)
        return res

    @staticmethod
    def round_up(a, b):
        return -(-a // b)

    @staticmethod
    def is_prime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.q = l
        heapq.heapify(self.q)
        return

    def push(self, n):
        heapq.heappush(self.q, n)
        return

    def pop(self):
        return heapq.heappop(self.q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    
    N = Scanner.int()
    ok = N + 1
    ng = 0
    while abs(ok - ng) > 1:
        m = (ok + ng) // 2
        if m * (m + 1) // 2 >= N:
            ok = m
        else:
            ng = m
    for i in reversed(range(1, ok + 1)):
        if N >= i:
            print(i)
            N -= i


if __name__ == "__main__":
    main()

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

while n > 0:
    half = int(n**0.5)
    while half * (half+1) // 2 < n:
        half += 1
    print(half)
    n -= half

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

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


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

Solution (Python):
n=int(input())
def bs(n):
    l,r=0,10**9
    while l+1!=r:
        if n>(((l+r)//2)**2+(l+r)//2)/2:
            l=(l+r)//2
        else:
            r=(l+r)//2
    return r
a=(bs(n)**2+bs(n))//2-n
for i in range(bs(n)):
    if i+1==a:
        continue
    print(i+1)

Solution (Python):
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

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


N = int(sys.stdin.buffer.readline())

i = 0
s = 0
while s <= N:
    i += 1
    s += i
ans = set(range(1, i + 1))
ans.remove(s - N)
print(*ans, sep='\n')

Solution (Python):
N = int(input())
Ans = []
n = N
for i in range(1, 10000000):
    if n >= i:
        n -= i
        Ans.append(i)
    else:
        break
for i in range(1, n+1):
    Ans[-i] += 1
print("\n".join(map(str, Ans)))

Solution (Python):
def main():
    N = int(input())
    n = 1
    while n * (n + 1) // 2 < N:
        n += 1

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

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque




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

    now_ind = 1
    while 1:
        if (now_ind + 1) * now_ind >= num * 2:
            break
        now_ind += 1
    hiku = ((now_ind + 1) * now_ind) // 2 - num

    for i in range(now_ind):
        if i + 1 == hiku:
            continue
        print(i + 1)







if __name__ == '__main__':
    main()

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

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

a = 0
n = 1
for n in range(1, N+1):
    a += n
    if a >= N:
        break
b = a - N
for i in range(1, n+1):
    if i != b:
        print(i)

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    n = ii()
    s = 0
    anslist = []
    for i in range(1,10000000):
        s+=i
        if s > n:
            s-=i
            break
        anslist.append(i)

    
    dif = n - s

    ans = list(reversed(anslist))
    for i in range(dif):
        ans[i] += 1

    for i in ans:
        print(i)

main()

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

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

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    ans = 0
    for i in range(101):
        if i%3 and i%5:
            ans += i
    print(ans)
    return


def B():
    a,b,n = LI()
    x = input()
    for i in x:
        if i == "S":
            a = max(0,a-1)
        elif i == "C":
            b = max(0,b-1)
        else:
            if a >= b:
                a = max(0,a-1)
            else:
                b = max(0,b-1)
    print(a)
    print(b)
    return


def C():
    n = I()
    d = LI()
    m = I()
    t = LI()
    dic = defaultdict(lambda : 0)
    for i in d:
        dic[i] += 1
    for i in t:
        if not dic[i]:
            print("NO")
            return
        dic[i] -= 1
    print("YES")
    return


def D():
    n,m = LI()
    v = []
    f = [defaultdict(list) for i in range(2001)]
    for i in range(m):
        a,b,l = LI()
        v.append((a,b,l))
        v.append((b,a,l))
        f[l][a].append(b)
        f[l][b].append(a)
    ans = 0
    for a,b,l in v:
        rest = 2540-l
        for c in f[rest][b]:
            if a < c:
                ans += 1
    print(ans)
    return


def E():
    def sum(n):
        return n*(n+1)//2
    n = I()
    l = 0
    r = n+1
    while r-l > 1:
        m = (l+r)//2
        if sum(m) < n:
            l = m
        else:
            r = m
    ans = list(range(1,r+1))
    s = sum(r)
    for i in ans:
        if i != s-n:
            print(i)
    return


def F():

    return


def G():

    return


def H():

    return


def I_():

    return


if __name__ == "__main__":
    E()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
se = set()

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

se.discard(x-N)
print(*se, sep='\n')

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

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

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

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

Solution (Python):
n=int(input())
cnt=0
for j in range(n+1):
	if cnt<n:
		cnt+=j+1
	else:
		break

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

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

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

while n>0:
    if b<=n:
        print(b,end=' ')
        n-=b
    b-=1

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

import math

if  math.floor(math.sqrt(2*n+0.25)-0.5)==math.sqrt(2*n+0.25)-0.5:
    for i in range(math.floor(math.sqrt(2*n+0.25)-0.5)):
        print(i+1)
elif n!=4:
    while n>0:
        x = math.floor(math.sqrt(2*n+0.25)-0.5)
        print(x+1)
        n -= x+1
else:
  print(3)
  print(1)

Solution (Python):
import math

N = int(input())

while N > 0:
    X = math.ceil((-1+(1+8*N)**(0.5))/2)
    print(X)
    N -= X

Solution (Python):
N = int(input())
ans = []
S = 0
i = 1
while S < N:
    ans += [i]
    S += i
    i += 1
diff = S - N
print(*[a for a in ans if a != diff], sep='\n')

Solution (Python):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

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

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

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


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

Solution (Python):
import bisect
l,i,x=[],0,0
while i<10**7:
    i+=x
    x+=1
    l.append(i)
n=int(input())
x=bisect.bisect_left(l,n)
y=l[x]-n
for i in range(1,x+1):
    if i!=y:print(i)

Solution (Python):
n=int(input())
ans=0
ex=0
for i in range(1,10000):
  tmp=i*(i+1)//2
  if tmp>=n:
    ans=i
    ex=tmp-n
    break
for i in range(1,ans+1):
  if i!=ex:
    print(i)

Solution (Python):
N=int(input())
d=0
maxk=0
for k in range(N+1): 
	d_temp = N - (k*(k+1))//2
	if d_temp < 0:
		break
	else:
		maxk = k
		d = d_temp
if d==0:
	for i in range(maxk):
		print(i+1)
else:
	to_print = [i+1 for i in range(maxk)]
	del to_print[-d]
	to_print.append(maxk+1)
	for x in to_print:
		print(x)

Solution (Python):
import bisect

n = int(input())
a = [i*(i+1)//2 for i in range(1,5000)]
number = bisect.bisect(a,n)
diff = n - a[number-1]
plus = number - diff
for i in range(number):
  if i < plus:
    print(i+1)
  else:
    print(i+2)

Solution (Python):
N = int(input())
n = N
now = 0
count = 0
while n > 0:
  n -= count
  now += count
  count += 1
ignore = now - N
for i in range(1, count):
  if i == ignore:
    continue
  print(i)

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

sum = 0
i = 0
while sum < n:
  i += 1
  sum += i

r = sum - n
for j in range(1, i+1):
  if j == r:
    continue
  print(j)

Solution (Python):
n = int(input())
k = int((n*2)**.5)
while k*(k+1)//2 < n:
  k += 1
l = list(range(1,k+1))
if k*(k+1)//2-n:
  l.remove(k*(k+1)//2-n)
for i in l:
  print(i)

Solution (Python):
n = int(input())
m = 0
while True:
    if m*(m+1) >= 2*n:
        break
    else:
        m += 1

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

for i in range(1,m+1):
    if i != l:
        print(i)

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

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

count = 0
for i in range(1, N+1):
    count += i
    if count >= N:
        lim = i
        break
        
for i in range(1, lim+1):
    if count - N == i:
        pass
    else:
        print(i)

Solution (Python):
import math
n=int(input())
x=math.ceil(math.sqrt(n*2))
if n==2:
    print(2)
    exit()
for i in range(x+1,0,-1):
    y=sum(range(i))
    if y<=n:
        s=list(range(1,i))
        t=n%y
        break
s=s[::-1]
for r in range(t):
    s[r]+=1
for h in s[::-1]:
    print(h)

Solution (Python):
n=int(input())
x=1
res=[x]
while(x*(x+1)//2<n):
    x+=1
    res.append(x)
if x*(x+1)//2!=n:
    del res[x*(x+1)//2-n-1]
for t in res:
    print(t)

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

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

Solution (Python):
def solve(N):
    d = 10 ** 7
    index = d // 2
    while True:
        k1 = index * (index - 1) // 2
        k2 = index * (index + 1) // 2
        if k1 < N <= k2:
            break
        elif k1 <= N:
            index = (index + d) // 2
        else:
            d = index
            index = index // 2

    d = k2 - N
    return "\n".join([str(i) for i in range(1, index + 1) if i != d])


if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Solution (Python):
def solve(N):
    d = 10 ** 7
    index = d // 2
    while True:
        k1 = index * (index - 1) // 2
        k2 = index * (index + 1) // 2
        if k1 < N <= k2:
            break
        elif k1 <= N:
            index = (index + d) // 2
        else:
            d = index
            index = index // 2

    d = k2 - N
    return "\n".join([str(i) for i in range(1, index + 1) if i != d])


if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Solution (Python):
def solve(N):
    d = 10 ** 7
    index = d // 2
    while True:
        k1 = index * (index - 1) // 2
        k2 = index * (index + 1) // 2
        if k1 <= N < k2:
            break
        elif k1 < N:
            index = (index + d) // 2
        else:
            d = index
            index = index // 2

    d = k2 - N
    return "\n".join([str(i) for i in range(1, index + 1) if i != d])


if __name__ == "__main__":
    N = int(input())
    print(solve(N))

Solution (Python):
n=int(input())
p=int(n**0.5)
t=0
for i in range(10**5):
    if i*(i+1)//2>n:
        t=i
        l=t*(t+1)//2-n
        break
for i in range(1,t+1):
    if i!=l:
        print(i)

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

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

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

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

Solution (Python):
def sigma(N):
    return N*(N+1)//2


def find_max(N):
    for i in range(N):
        if sigma(i) > N:
            return i
    return N


def solve(N):
    Y = find_max(N)
    rem = sigma(Y)-N
    for i in range(1, Y+1):
        if i != rem:
            print(i)


N = int(input())
solve(N)

Solution (Python):
n = int(input())
if n == 1:
    print(1)
    exit()
s = 0
cnt = 1
while True:
    s += cnt
    if s < n <= s+cnt+1:
        use = cnt+1
        sub = use*(use+1)//2 - n
        for i in range(use):
            if i+1 == sub:
                continue
            print(i+1)
        exit()
    else:
        cnt += 1

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

if N == 1:
  print(1)
  exit(0)
  

for i in range(10001):
  if N <= i * (i+1) // 2:
    break

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

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

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

Solution (Python):
n = int(input())
ans = []
for i in range(10**7):
  ans.append(i+1)
  su = (i+1)*(i+2)//2
  if su > n:
   ans.remove(su-n)
   break
  elif su == n:
    break
for i in ans:
 print(i)

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

for i in range(1,10**6):
    if i*(i+1)/2>=N:
        break
P=i*(i+1)/2-N

for j in range(1,i+1):
    if j==P:
        pass
    else:
        print(j)

Solution (Python):
import sys
import bisect

sys.setrecursionlimit(10**9)

N = int(input())

L = [0]
l = 0
for i in range(1,10**6) :
    l += i
    L.append(l+1)
ans = []
while N > 0 :
    tmp = bisect.bisect(L,N)
    
    ans.append(tmp)
    N -= tmp
    
print(*ans,sep="\n")

Solution (Python):
N = int(input())
m = s = 1
while s < N:
    m += 1
    s += m

ans = [m]
rem = N-m
if rem:
    for n in range(m-1,0,-1):
        if n <= rem:
            ans.append(n)
            rem -= n
            if rem==0: break

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from bisect import bisect_left
from itertools import accumulate

n = ni()
oneton = [i for i in range(10**4)]
acc = list(accumulate(oneton))

maxp = bisect_left(acc, n)
for p in range(1,maxp+1):
    if p == acc[maxp] - n:
        continue
    print(p)

Solution (Python):
import sys
N=int(input())
num=0
L=[]
for i in range(1,N+1):
    num+=i
    L.append(i)
    if num>=N:
        break
if num!=N:
    a=num-N
    L.remove(a)
print('\n'.join(map(str,L)))

Solution (Python):

n = int(input())

for k in range(1,n+1):
    s = k*(k+1)//2
    if s==n:
        res = set(range(1,k+1))
        break
    if s>=n and (s-n)<=k:
        res = set(range(1,k+1))
        res.remove(s-n)
        break

for r in res:
    print(r)

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

n = 1
while True:
	if n * (n + 1) / 2 >= N:
		break
	else:
		n += 1
n = n - 1
if N == int(n * (n + 1) / 2):
	for i in range(1, n + 1):
		print(i)

else:
	s = int(N - n * (n + 1) / 2)
	for i in range(1,n - s + 1):
		print(i)
	for i in range(n - s + 1, n + 1):
		print(i + 1)

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

Solution (Python):
N = int(input())
j = int(-(-((8*N-1)**0.5-1)//2))
print('\n'.join([str(i) for i in range(1,j+1) if not i == j*(j+1)//2-N]))

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

sum, ulim = 1, 1
while sum < N:
    ulim += 1
    sum += ulim
Ans = [int(i) for i in range(1, ulim + 1)]
diff = sum - N
if diff > 0:
    Ans.remove(diff)
for a in Ans:
    print(a)

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

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

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

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

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

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

Solution (Python):
N = int(input())
s = 0
x = 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:
        print(i)

Solution (Python):



def main():
    from math import ceil
    from math import sqrt

    n = int(input())
    point_min = ceil((-1 + sqrt(1 + 8 * n)) / 2)
    diff = point_min * (point_min + 1) // 2 - n

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


if __name__ == '__main__':
    main()

Solution (Python):
def b_exactly_n_points(N):
    tmp = 0
    k = 1
    while tmp < N:
        tmp += k
        k += 1
    ans = list(range(1, k))
    if tmp - N > 0:
        ans.remove(tmp - N)
    ans = '\n'.join(map(str, ans))
    return ans

N = int(input())
print(b_exactly_n_points(N))

Solution (Python):
from bisect import bisect_left
import sys
sys.setrecursionlimit(10 ** 7)

n = int(input())
triangle = []
i = 1
while True:
	triangle.append(i * (i + 1) // 2)
	if triangle[-1] > n:
		break
	i += 1

ans = []

def search(i):
	global ans
	if i == 0:
		return ans
	else:
		ind = bisect_left(triangle, i)
		if i == triangle[ind]:
			ans += list(range(1, ind + 2))
			return ans
		else:
			ans.append(ind + 1)
			return search(i - (ind + 1))

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

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = inp()

tmp = 0
i = 1
while tmp < N:
	tmp += i
	i += 1

x = tmp-N
for i in range(1,i):
	if i == x:
		continue
	print(i)

Solution (Python):
from bisect import bisect_right

sum_list = []
nm = 1
sm = 1
while sm <= 10**8:
    sum_list.append(sm)
    nm += 1
    sm += nm
    
n = int(input())

k = bisect_right(sum_list, n)

ans_set = set([i for i in range(1,k+2)])
ans_set.remove(sum_list[k] - n)
ans = list(ans_set)

for a in ans:
    print(a)

Solution (Python):
'''
Pythonの知っておくと良い細かい処理速度の違い8個
https://www.kumilog.net/entry/python-speed-comp
'''


import sys
input = sys.stdin.readline

n = int(input())

csum = [0]
i = 1
b = 0
while b < n:
    b += i
    csum.append(b)
    i += 1

while n > 0:
    for i in range(n + 1):
        if csum[i] >= n:
            print(i)
            n -= i
            break

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

ans = 0
i = 1

while n > ans:
	ans += i
	i += 1

sums = sum(range(i))
diff = sums - n

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

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

l, r = -1, N
while r - l > 1:
    m = (l + r) // 2
    S = m*(1 + m) // 2

    if S >= N:
        r = m
    else:
        l = m

X = r * (1 + r) // 2 - N
if X == 0:
    print(*list(range(1, r+1)), sep="\n")
else:
    print(*list(range(1, X)) + list(range(X+1, r+1)), sep="\n")

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

N = getN()
for i in range(10**4):
    if i*(i+1)/2 >= N:
        M = i
        upper =int(M*(M+1)/2)
        break
tar = []
diff = upper-N
for i in range(M):
    j = i+1
    if j != diff:
        
        print(j)
"""
print(sum(tar),M,upper,diff)
if 1628 in tar:
    print("TRue")
"""

Solution (Python):
from math import sqrt, floor
N = int(input())
t = 0
p = 0
for k in range(floor(sqrt(2*N))-2,floor(sqrt(2*N))+2):
    if ((k-1)*k)/2 <= N < (k*(k+1))/2:
        t = k
        p = (k*(k+1))//2 - N
        break

for k in range(1,t+1):
    if k!=p:
        print(k)

Solution (Python):
n = int(input())
anses = []
ans = 0
if n == 1:
    print(1)
    exit()
elif n == 2:
    print(2)
    exit()

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

if ans > n:
    anses.remove(ans-n)

for i in anses:
    print(i)

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

    s, cnt = 0, 0
    while s < n:
        cnt += 1
        s += cnt

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

        if n == 0:
            break


if __name__ == '__main__':
    main()

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

i=1
max_i=0
now_N=0
while(True):
    now_N+=i
    if N<=now_N:
        max_i = i
        break
    i+=1
    
output=[]
    
for i in range(1,max_i+1)[::-1]:
    if N-i>=0:
        N -= i
        output.append(str(i))
    if N==0:
        break
        
print("\n".join(output[::-1]))

Solution (Python):
import math
N=int(input())
upperA = int(math.sqrt(2*N))
ceilA = 0
for i in range(upperA,-1,-1):
  if (i*(i+1) <= 2*N) and (2*N < (i+1)*(i+2)):
    ceilA = i+1
    break
nums = [x for x in range(1,ceilA+1)]
nums.remove(sum(nums)-N)
for num in nums:
  print(num)

Solution (Python):
N=int(input())
K=0
L=[0 for i in range(N)]
if N==1:
	print(1)
	exit()
for i in range(1,N+1):
	K+=i
	L[i-1]=1
	if K>=N:
		break
L[K-N-1]=0
for i in range(N):
	if L[i]==1:
		print(i+1)

Solution (Python):
n = int(input())
a = 0
for i in range(n+1):
    if i*(i+1)//2 >= n:
        a = i
        break

b=[]
c = a*(a+1)//2
for i in range(1,a+1):
    b.append(i)


if c > n:
    b.pop(c-n-1)

for i in b:
    print(i)