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



Sample input:
4


Sample output:
1
3

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict, deque
import math

# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

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

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

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


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

    for an in ans:
        print(an)


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


if __name__ == "__main__":
    # main()
    solve()

Submission status: Wrong Answer

Solution code:
n = int(input())

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

for i in range(1,c+1):
    if i == f:
        pass
    else:
        print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
sum_i = 0
for i in range(n):
    i += 1
    # 足しても大丈夫なとき
    if n - (sum_i + i) >= i:
        sum_i += i
        print(i)
    else:
        print(n - sum_i)
        break

Submission status: Wrong Answer

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

total_num,max_num = 0,0

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

    for i in range(len(l)):
        if s-l[i] == N:
            l.pop(i)
            break

    for i in l:
        print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in range(len(l)):
    if s-l[i] == N:
        l.pop(i)
        break

for i in l:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(1, N+1):
    # print("i", i, "N", N)
    if N-i == 0 or N-i > i:
        print(i)
        N -= i
    else:
        continue

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 20:20:11 2020

@author: NEC-PCuser
"""


N = int(input())

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

value = (i - 1) * i // 2
print(value)

index = len(li) - 1
for i in range(value, N):
    li[index] += 1
    index -= 1

for i in li:
    print(i)

Submission status: Wrong Answer

Solution code:
n,ans = int(input()),0
for i in range(n):
    if ans+i<=n:
        ans+=i
    else:
        break
if ans==n:
    for j in range(i-1):
        print(j+1)
else:
    for j in range(i-2):
        print(j+1)
    print(n-ans+i-1)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
print(math.ceil((1+math.sqrt(1+8*N+0.000001))/2))

Submission status: Wrong Answer

Solution code:
n = int(input())
m = 1
for i in range(1, n):
    if i * (i + 1) // 2 >= n:
        m = i
        break
l = list(range(1, m + 1))
if m * (m + 1) // 2 > n:
    l.remove(m * (m + 1) // 2 - n)
print(*l, sep="\n")

Submission status: Wrong Answer

Solution code:
N = int(input())
left = 0
right = 4000
while right - left > 1:
    mid = (left + right) // 2
    if mid * (mid + 1) // 2 < N:
        left = mid
    else:
        right = mid
ans = {i for i in range(1, right + 1)}
ans -= {right * (right - 1) // 2 - N + right}
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
N = int(input())
left = 0
right = 3200
while right - left > 1:
    mid = (left + right) // 2
    if mid * (mid + 1) // 2 < N:
        left = mid
    else:
        right = mid
ans = {i for i in range(1, right + 1)}
ans -= {right * (right - 1) // 2 - N + right}
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
N = int(input())
left = 0
right = 3162
while right - left > 1:
    mid = (left + right) // 2
    if mid * (mid + 1) // 2 < N:
        left = mid
    else:
        right = mid
ans = {i for i in range(1, right + 1)}
ans -= {right * (right - 1) // 2 - N + right}
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n = int(input())
cnt = defaultdict(int)
i = 1
while n != 0:
    if cnt[n - i] == 0:
        print(i)
        cnt[i] += 1
        n -= i
    
    i += 1

Submission status: Wrong Answer

Solution code:
n=int(input())

if n==1:
  print(1)
else:
  if n%2==0:
    print(n//2+1,n//2-1)
  else:
    print(n//2+1,n//2)

Submission status: Wrong Answer

Solution code:
n = int(input())

# ex) 7
# 1: 7
# 2: 6 1
# 3: 5 2
# 4: 4 3

# ex) 8
# 1: 8
# 2: 7 1
# 3: 6 2
# 4: 5 3
# 5: 4 4 <- NGなので 4 + 3 + 1

# x
# 配点が一番大きいパターン: x
# 二番目: x-1, 1
# 三番目: x-2, 2
# ...
# x//2+1番目: x//2, odd -> x//2 + 1
#                   even -> x//2 - 1, 1

if n == 1:
    print(1)
elif n == 2:
    print(2)
elif n == 4:
    print("1\n3")
else:
    if n % 2 == 0:
        print(n//2, n//2 - 1, 1, sep="\n")
    else:
        print(n//2 + 1, n//2, sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())
if n<3:
    print(n)
else:
    if n%2==1:
        print(n//2)
        print(n//2+1)
    else:
        print(n//2-1)
        print(n//2+1)

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    
    s = sum([i for i in range(1, N+1)])
    for i in reversed(range(1, N+1)):
        if s - i <= N:
            return i
        s -= i
        
print(solve())

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
if n == 1:
    ans.append(1)
elif n == 2:
    ans.append(2)
else:
    c = n // 2 + 1
    ans.append(c)
    ans.append(n-c)

print("\n".join(list(map(str, ans))))

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
while n != 0:
    c = n // 2 + 1
    ans.append(c)
    n -= c

print("\n".join(list(map(str, ans))))

Submission status: Wrong Answer

Solution code:
n = int(input())

cnt = 0
pbm = 0
for i in range(1, 10**6):
    cnt += i
    if cnt > n:
        pbm = i
        break

ans = []

for i in range(pbm, 0, -1):
    if i <= n:
        ans.append(i)
        n -= i

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
if n%2==0:
  a = int(n//2)
  print(a-1)
  print(a+1)
else:
  a = int(n//2)
  if a!=0:
    print(a)
  print(a+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
def main(n):
    if n == 1:
        return 1,0
    
    if n == 3:
        return 2,0
    m = n //2 
    for i in range(1,m+1):
        if i * (i + 1) <= 2*n < (i+1)*(i+2):
           right  = i + 1
           break
       
    diff = right * (right+1) //2 - n
       
    return right+1,diff


right,diff = main(n)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
def main(n):
    if n == 1:
        return 1,0
    m = n //2 
    for i in range(1,m+1):
        if i * (i + 1) <= 2*n <= (i+1)*(i+2):
           right  = i + 1
           break
       
    diff = right * (right+1) //2 - n
       
    return right+1,diff


right,diff = main(n)

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

Submission status: Wrong Answer

Solution code:
n = int(input())
k = 1
while True:
  if k*(k+1)//2 >= n:
    ans = k
    break
  k += 1
if n == ans*(ans+1)//2:
  i = 1
  while i <= ans:
    print(i)
    i += 1
else:
  i = 1
  l = []
  cnt = 0
  while i < ans:
    if cnt <= (ans-1)*(ans+2)//2 - n:
      print(i)
      cnt += 1
    else:
      print(i+1)
    i += 1

Submission status: Wrong Answer

Solution code:
n = int(input())
k = 1
while True:
  if k*(k+1)//2 >= n:
    ans = k
    break
  k += 1
if n == k*(k+1)//2:
  i = 1
  while i <= ans:
    print(i)
    i += 1
else:
  i = 1
  l = []
  cnt = 0
  while i < ans:
    if cnt <= (ans-1)*(ans+2)//2 - n:
      print(i)
      cnt += 1
    else:
      print(i+1)
    i += 1

Submission status: Wrong Answer

Solution code:
n = int(input())
k = 1
while True:
  if k*(k+1)//2 >= n:
    ans = k
    break
  k += 1
cnt = 0
l = []
i = ans-1
while i > 0:
  if cnt <= n - ans*(ans-1)//2:
    l.append(i+1)
    cnt += 1
  else:
    l.append(i)
  i -= 1
while len(l) > 0:
  j = l.pop()
  print(j)

Submission status: Wrong Answer

Solution code:
n = int(input())
k = 1
while True:
  if k*(k+1)//2 >= n:
    ans = k
    break
  k += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

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


# ===CODE===
def main():
    n = ni()
    d = []
    tmp = 0
    for i in range(10 ** 7):
        tmp += i
        d.append(tmp)
        if tmp > 10 ** 7 + 1000:
            break

    l = bisect.bisect_right(d, n)
    ans = []
    tmp_n = n
    for i in range(l, 0, -1):
        if tmp_n >= i:
            ans.append(i)
            tmp_n -= i

    for a in ans:
        print(a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

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


# ===CODE===
def main():
    n = ni()
    d = []
    tmp = 0
    for i in range(10 ** 7):
        tmp += i
        d.append(tmp)
        if tmp > 10 ** 7 + 1:
            break

    l = bisect.bisect_right(d, n)
    ans = []
    tmp_n=n
    for i in range(l, 0, -1):
        if tmp_n>=i:
            ans.append(i)
            tmp_n-=i

    for a in ans:
        print(a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

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


# ===CODE===
def main():
    n = ni()
    ans =(n+1)//2
    
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
import itertools
import math

N = int(input())
if N == 1 or N == 2:
    print(N)
    sys.exit()
ans = 0
temp = []
if N > 1000:
    x = int(math.sqrt(2*N))
else:
    x = N
for i in range(1, x):
    ans += i
    temp.append(i)
    if ans >= N:
        f = ans-N
        # print("f=", f)
        for k in range(len(temp)):
            if temp[-1] <= f:
                f = f-temp[-1]
                temp.pop()
                continue
            print(temp[-1])
            temp.pop()
            # print(ans, i)

Submission status: Wrong Answer

Solution code:
n=int(input())
num=[i*(i+1)//2 for i in range(4500)]
ans=""
while n>0:
    for i in range(4500):
        if num[i]==n:
            ans+=str(i)
            n-=i
            break
        elif i>1 and num[i]>n and num[i-1]:
            ans+=str(i)
            n-=i
            break
for i in range(len(ans)):
    print(ans[len(ans)-1-i])

Submission status: Wrong Answer

Solution code:
N=int(input())

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

ans=[]
Top=i-1
while N:
    if N-Top>=0:
        N-=Top
        ans.append(Top)
    Top-=1

for j in ans:
    print(j)

Submission status: Wrong Answer

Solution code:
import math
import sys

n = int(sys.stdin.readline().rstrip())

if n == 1:
    print(1)
elif n == 2:
    print(2)
elif n % 2 == 1:
    print(n // 2)
    print(n // 2 + 1)
else:
    print(n // 2 - 1)
    print(n // 2 + 1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import math

def main():
    N = int(input())
    T = math.ceil((2*N)**0.5)
    rem = T*(T+1)//2 - N
    for i in range(T):
        if i+1 != rem:
            print(i+1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
bott = 0
rem = -1
for i in range(10000):
    bott = i*(i+1)//2
    bott2 = (i+1)*(i+2)//2
    if(bott<=n and n<bott2):
        rem = n-bott
        bott = i
        break
ans = []
for i in range(bott):
    ans.append(i+1)

ans[-1] += rem

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

Submission status: Wrong Answer

Solution code:
N = int(input())
i = 0
total = 0
while True:
    total += i
    if total >= N:
        tmp = i
        break
    i += 1

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

Submission status: Wrong Answer

Solution code:
n=int(input())
if n==1:
    print(1)
    exit()
from itertools import accumulate
a=[0]*(4500)
for i in range(1,4500):
    a[i-1]=i

ac=list(accumulate(a))

for i in range(n+1):
    if ac[i]+a[i+1]>=n:
        maxi=a[i+1]
        break

a=[i for i in range(1,maxi)]

ans=[maxi]
n-=maxi

def solve(n):
    if n==1:
        ans.append(1)
        return 0
    a=[0]*4500
    for i in range(1,4500):
        a[i-1]=i
    
    ac=list(accumulate(a))
    
    for i in range(n+1):
        if ac[i]+a[i+1]>=n:
            maxi=a[i+1]
            break
    ans.append(maxi)
    n-=maxi
    print(maxi,n)
    return n

while n>0:
    n=solve(n)

for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
from itertools import accumulate
a=[0]*(n+1)
for i in range(n+1):
    a[i]=i

ac=list(accumulate(a))

for i in range(n+1):
    if ac[i]+a[i+1]>=n:
        print(a[i+1])
        exit()

Submission status: Wrong Answer

Solution code:
n=int(input())
i=1
count=0
ans=[]
if n==1:
    print(1)
    exit()

while count<n:
    count+=i
    ans.append(i)
    i+=1
    
#print(ans,count)
a=ans.pop(count-n-1)
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
n = round((N // 2) ** 0.5)
for i in range(1, n+1):
    print(i)
print(N - n*(n+1)// 2)

Submission status: Wrong Answer

Solution code:
N = int(input())

targ = N
while targ > 1:
    l = 0
    if targ == N:
        r = targ - 1
    else:
        r = targ
    #
    while l < r:
        m = l + (r - l) // 2
        # print("#", targ, (l, r), m * (m - 1) // 2, targ - m)
        if m * (m - 1) // 2 >= targ - m:
            r = m
        else:
            l = m + 1
    #
    print(l)
    targ -= l

if targ > 0: print(targ)

Submission status: Wrong Answer

Solution code:
# 2020/04/25
# CODE FESTIVAL 2016 Final - B

# Input
n = int(input())

# Calc
wk_val = 0

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

wk_ans = 0
anslist = list()
while(x > 0):
    if wk_ans + x <= n:
        wk_ans = wk_ans + x
        anslist.append(x)

    if wk_ans == n:
        break
    
    x = x - 1

# Output
for i in range(len(anslist)):
    print(anslist[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

m  =  n // 2 +1
if n-m > 0: print(n-m)
print(m)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

    tot=0
    while True:
        if tot<n:
            print(i)
            tot+=i
            if i!=n-tot:
                i=n-tot
            else:
                i=n-tot-1
        else:
            break



resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

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

    tot=0
    while True:
        if tot<n:
            print(i)
            tot+=i
            i=n-i
        else:
            break



resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

    ans=0
    i=1
    while ans<=n:
        ans+=i
        i+=1
    i-=1
    tot=0
    while True:
        if tot<n:
            print(i)
            tot+=i
            i=n-i
        else:
            break



resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())
print((N+2)//2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
tmp = 0
i = 1
while tmp < n:
    ans.append(i)
    tmp += i
    i += 1
print('\n'.join(map(str, ans)))

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


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

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

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

    main(N)


resolve()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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





resolve()

Submission status: Wrong Answer

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

n = int(input())
now = n
for i in range(1,n+1):
  if now == i:
    print(i);break
  elif now - i <= i:continue
  else:
    now -= i
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
tmp = 0
li = []
for i in range(n):
    if i*(i+1)/2 >= n:
        tmp = i
        break
new_li = [x for x in range(1,tmp+1)]
#print(new_li)
if sum(new_li) - n > 0:
    new_li.remove(sum(new_li) - n)
if n == 1:
    print(1)
else:
    for n in new_li:
        print(n)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=[]
if N==1:
    print(1)
    exit()
if N==4:
    print(1)
    print(3)
    exit()
count=0
for i in range(1,N+1):
    count+=i
    ans.append(i)
    if count>=N:
        break
if count==N:
    for i in range(len(ans)):
        print(ans[i])
    exit()
ans=[]
if N%2==0:
    ans.append(1)
    ans.append(N//2-1)
    ans.append(N//2)
else:
    ans.append(N//2)
    ans.append(N//2+1)
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
A = []

while(n != 0):
    if n % 2 == 0:
        A.append(n//2 + 1)
        n = n - (n // 2 + 1)
    else:
        A.append((n + 1) // 2)
        n = n - (n + 1) // 2
A = sorted(A)
for i in A:
    print(i)

Submission status: Wrong Answer

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

sub = 1
while n != 0:
    new = n - sub
    if new not in s:
        print(sub)
        s.add(sub)
        n = new
    sub += 1

Submission status: Wrong Answer

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

if N == 1:
    print(1)

else:
    for i in range(N):
        if N - su(i) <= i:
            j = i-1
            k = N-su(i-1)
            break

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

Submission status: Wrong Answer

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

if N == 1:
    print(1)
for i in range(N):
    if N - su(i) <= i:
        print(N-su(i-1))
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

wa = 0

if n == 1:
	print(1)
else:
	for i in range(1, n):
		if 2 * i >= n - wa:
			print(n - wa)
			break
		else:
			wa += i
			print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
if (n==1):
    print(1)
    exit()
if (n%2==0) :
    print(n//2-1)
    print(n//2+1)
else :
    print(n//2)
    print(n//2+1)

Submission status: Wrong Answer

Solution code:
N=int(input())
ldp=[[[False,[]] for j in range(N+1)] for i in range(N)]
ldp[0][0][0]=True
ldp[0][1][0]=True
ldp[0][1][1].append(0)
if N==1:
    print(1)
for i in range(N-1):
    for j in range(N+1):
        #if N<i+2:
        if j<i+2:
            ldp[i+1][j][0]=ldp[i][j][0]
            ldp[i+1][j][1]=ldp[i][j][1]
        else:
            #ldp[i+1][j]=(ldp[i][j] or ldp[i][N-(i+2)])
            if ldp[i][j][0]==True:
                ldp[i+1][j][0]=True
                ldp[i+1][j][1]=ldp[i][j][1]
            #elif ldp[i][N-(i+2)][0]==True:
            elif ldp[i][j-(i+2)][0]==True:
                ldp[i+1][j][0]=True
                #ldp[i+1][j][1]=ldp[i][N-(i+2)][1]+[i+1]
                ldp[i+1][j][1]=ldp[i][j-(i+2)][1]+[i+1]
            else:
                ldp[i+1][j][0]=False
    if ldp[i+1][N][0]==True:
        for k in ldp[i+1][N][1]:
            print(k+1)
        break
for i in range(N):
    print(ldp[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
ldp=[[[False,[]] for j in range(N+1)] for i in range(N)]
ldp[0][0][0]=True
ldp[0][1][0]=True
ldp[0][1][1].append(0)
if N==1:
    print(1)
for i in range(N-1):
    for j in range(N+1):
        #if N<i+2:
        if j<i+2:
            ldp[i+1][j][0]=ldp[i][j][0]
            ldp[i+1][j][1]=ldp[i][j][1]
        else:
            #ldp[i+1][j]=(ldp[i][j] or ldp[i][N-(i+2)])
            if ldp[i][j][0]==True:
                ldp[i+1][j][0]=True
                ldp[i+1][j][1]=ldp[i][j][1]
            #elif ldp[i][N-(i+2)][0]==True:
            elif ldp[i][j-(i+2)][0]==True:
                ldp[i+1][j][0]=True
                #ldp[i+1][j][1]=ldp[i][N-(i+2)][1]+[i+1]
                ldp[i+1][j][1]=ldp[i][j-(i+2)][1]+[i+1]
            else:
                ldp[i+1][j][0]=False
    if ldp[i][N][0]==True:
        for k in ldp[i][N][1]:
            print(k+1)
        break
#for i in range(N):
#    print(ldp[i])

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1 or n == 2:
    print(n)
else:
    a = [i+1 for i in range(n)]

    for i in range(len(a) ** 2):
        g = []
        for j in range(len(a)):
            if ((i >> j) & 1):
                g.append(a[j])

        if sum(g) == n:
            print(*g)
            break

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1 or n == 2:
    print(n)
else:
    a = []
    m = 0
    for i in range(1, n):
        if m > n: break
        a.append(i)
        m += i


    for i in range(len(a) ** 2):
        g = []
        for j in range(len(a)):
            if ((i >> j) & 1):
                g.append(a[j])
        if sum(g) == n:
            print(*g)
            break

Submission status: Wrong Answer

Solution code:
n = int(input())

a = [i+1 for i in range(n)]

for i in range(n ** 2):
    g = []
    for j in range(n):
        if ((i >> j) & 1):
            g.append(a[j])
    if sum(g) == n:
        print(*g)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    if N == 1 or N == 2:
        return print(N)
    ans = set()

    for i in range(1, N+1):
        N -= i
        if N in ans or N <= 2:
            N += i
            ans.add(N)
            break
        ans.add(i)
    print(*ans, sep="\n")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    if N == 1:
        return print(1)

    if N & 1:
        print(N//2, N//2 + 1, sep='\n')
    else:
        print(N//2-1, N//2+1, sep="\n")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
a=1
cnt=1
while cnt<=N:
  a+=1
  cnt+=a
A=[]
S=N
for i in range(a):
  if S==3:
    A.append(2)
    A.append(1)
    break
  if S>=(a-i):
    A.append(a-i)
    S-=(a-i)
for i in (A[::-1]):
  print(i)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    ls = [0]
    ans = []
    if N==1:
        print(1)
    elif N==2:
        print(1)
        print(2)
    else:
        for i in range(1,N):
            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()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    ls = [0]
    ans = []
    if N==1:
        print(1)
    else:
        for i in range(1,N):
            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()

Submission status: Wrong Answer

Solution code:
N = int(input())

if N==1:
    print(1)
    quit()
if N % 2 == 0:
    print(N//2-1, N//2+1)

else:
    print(N//2, N//2+1)

Submission status: Wrong Answer

Solution code:
INF = int(1e9)
n = int(input())
c = [0]*(n+1)
c[n] = 1
flag = False
for i in reversed(range(1,n+1)):
    if c[i]==0:
        continue
    m = i//2
    if i%2==0:
        if c[m-1]==0 and c[m+1]==0:
            c[m-1] = 1
            c[m+1] = 1
            c[i] = 0
        else:
            j = 1
            while m-1-j>0 and m+1+j<i:
                if c[m-1-j]==0 and c[m+1+j]==0:
                    c[m-1-j] = 1
                    c[m+1+j] = 1
                    c[i] = 0
                    break
                else:
                    j+=1
                    if m+1+j==i:
                        flag = True
        
        if flag:
            break
    else:
        if c[m]==0 and c[m+1]==0:
            c[m] = 1
            c[m+1] = 1
            c[i] = 0
        else:
            j = 1
            while m-j>0 and m+1+j<i:
                if c[m-j]==0 and c[m+1+j]==0:
                    c[m-j] = 1
                    c[m+1+j] = 1
                    c[i] = 0
                    break
                else:
                    j+=1
                    if m+1+j==i or m-j==0:
                        flag = True
        
        if flag:
            break
for i in range(1,n+1):
    if c[i]==1:
        print(i)

Submission status: Wrong Answer

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

for i in range(1,N):
  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)

Submission status: Wrong Answer

Solution code:
import bisect

N = int(input())
if N in [1,2]:
  print(1)
  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)]