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
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import deque
def main():

    n = int(input())
    ans = deque()
    num = 1
    while n:
        if n - num not in ans:
            ans.append(num)
            n -= num
        num += 1

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import deque
def main():

    n = int(input())
    ans = deque()
    num = 1
    while n >= num:
        if n - num not in ans:
            ans.append(num)
            n -= num
        num += 1

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines

def main():
    def bunkai(p):
        sa = 0
        sa_max = p // 2
        if p&1:
            p += 1
            sa_max -= 1
            while sa <= sa_max:
                p1, p2 = p // 2 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        else:
            sa_max -= 2
            while sa <= sa_max:
                p1, p2 = p // 2 + 1 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        return False

    n = int(input())
    ans = [n]
    while True:
        bunkai_r = bunkai(max(ans))
        if bunkai_r:
            ans.sort()
            ans = ans[:-1]
            ans.extend(bunkai_r)
        else:
            break
    ans.sort()
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines

def main():
    def bunkai(p):
        sa = 0
        sa_max = p // 2
        if p&1:
            p += 1
            sa_max -= 1
            while sa <= sa_max:
                p1, p2 = p // 2 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        else:
            sa_max -= 2
            while sa <= sa_max:
                p1, p2 = p // 2 + 1 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        return False

    n = int(input())
    ans = [n]
    while True:
        bunkai_r = bunkai(max(ans))
        if bunkai_r:
            ans.sort()
            ans = ans[:-1]
            ans.extend(bunkai_r)
        else:
            break
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    def bunkai(p):
        sa = 0
        sa_max = p // 2
        if p&1:
            p += 1
            while sa < sa_max:
                p1, p2 = p // 2 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        else:
            while sa < sa_max - 1:
                p1, p2 = p // 2 + 1 + sa, p // 2 - 1 - sa
                if p1 not in ans and p2 not in ans:
                    return (p1, p2)
                sa += 1
        return False

    n = int(input())
    ans = [n]
    while True:
        bunkai_r = bunkai(max(ans))
        if bunkai_r:
            ans.sort()
            ans = ans[:-1]
            ans.extend(bunkai_r)
        else:
            break
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
i=n//2+1
while n!=0:
  if n>=i:
    n-=i
    print(i)
  i-=1

Submission status: Wrong Answer

Solution code:
n = int(input())

num_sum = 0
max_num = 1
for i in range(n):
    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)

Submission status: Wrong Answer

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

for a in ans:
  print(a)

Submission status: Wrong Answer

Solution code:
#97 B - Exactly N points
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(1,A[-1]):
    if tgt < A[-1]:
        ans.append(tgt)
        break
    tgt -= i
    ans.append(i)

for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

W = [0]*(N+1)
W[1] = 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

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

print(n-(i-1)*i//2)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

for j in range(1,i):
    print(j)
    
print(n-(i-1)*i//2)

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(int(n**0.5)+10):
    tmp = n
    now = i*(i+1)//2
    tmp -= now
    if tmp < i:
        break

for j in range(1,i):
    print(j)
    
print(n-(i-1)*i//2)

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    print(1)
else:
    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:
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

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

Submission status: Wrong Answer

Solution code:
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

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
        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 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
                i += 1

Submission status: Wrong Answer

Solution code:
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

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
        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
      """
    n -= m
    m -= 1
    print(m)
    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
                i += 1

Submission status: Wrong Answer

Solution code:
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

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
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
        else:
            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
        """
        n-=m
        m-=1
        print(m)
        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
                    i+=1
                else:
                    i+=1

Submission status: Wrong Answer

Solution code:
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

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
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
    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
        """
        n-=m
        m-=1
        print(m)
        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

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

Solution code:
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

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

Submission status: Wrong Answer

Solution code:
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)]
    for answer in answers:
        if answer == sa:
            continue
        print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())


def sums(num):
    return int((1 + num) / 2 * num)

count = N
boolian = True

while boolian == True:
    for i in range(2,count+1):
        j = sums(i)
        if j > count:
            print(i)
            count -= i 
            if count == 1:
                print(1)
                boolian = False
                break
            break
        if count == 1:
            print(count)
            boolian = False
            break
        if j == count and count > 3:
            for k in range(1,i+1):
                boolian = False
                break

Submission status: Wrong Answer

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

if n == 1:
    print(1)
    exit()
lis = [0]*n
lis[0] = 1
lis[1] = 3

a = 0
for i in range(2,n-1):
    lis[i] = lis[i-1] + (i+1)
    if lis[i] >= n:
        a = i+1
        break

ans = []
while n>1:
    ans.append(a)
    n -= a
    a -= 1

if sum(ans) != tmp:
    ans.append(1)

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

Submission status: Wrong Answer

Solution code:
n=int(input())
def solve(m):
    big=m[0]
    ok=0
    for i in range(big-1,-1,-1):
        if i not in m and big-i not in m:
            m.pop(0)
            m.append(i)
            m.append(big-i)
            ok+=1
            break
    if ok>0:
        m.sort(reverse=True)
        return solve(m)
    else:
        return(m)
ans=solve([n])
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
  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')

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
  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')

Submission status: Wrong Answer

Solution code:
N=int(input())
number=int((N*2)**0.5)
if number*(number+1)//2==N:
    answers=[n for n in range(1,N+1)]
    for answer in answers:
        print(answer)
else:
    sa=abs(number*(number+1)//2-number-(number-1))
    number-=2
    answers=[n for n in range(1,number+1)]
    nokori=N-sa
    if nokori%2==0:
        answers.append(nokori // 2 - 1)
        answers.append(nokori // 2 + 1)
    else:
        answers.append(nokori//2)
        answers.append(nokori//2+1)
    for answer in answers:
        print(answer)

Submission status: Wrong Answer

Solution code:
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 = k()
half = n//2 +1
a = n-half

if n == 1:
    print(1)
    sys.exit()
if n == 2:
    print(2)
    sys.exit()

print(a)
print(half)

Submission status: Wrong Answer

Solution code:
N = int(input())
K = format(N,'b')
L = len(K)
for i in range(L):
  if K[-(i+1)] == "1":
    print(2**(i))

Submission status: Wrong Answer

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

n = int(readline())

if n <= 2:
    print(n)

elif even(n):
    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())

print(n//2+1)

Submission status: Wrong Answer

Solution code:
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
ans=list(range(1,num+1))
for i in range(num-num3,num):
    ans[i]+=1
for i in ans:
    print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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())

ans = []

def dfs(m):
    if m == 1:
        ans.append(1)
        return 0
    elif m == 3:
        ans.append(2)
        ans.append(1)
        return 0
    elif m == 4:
        ans.append(3)
        ans.append(1)
        return 0
    elif m == 5:
        ans.append(3)
        ans.append(2)
        return 0
    else:
        ans. append((m+1)//2)
        dfs(m//2)

n = INT()
dfs(n)
for x in ans:
    print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 0
s = 0
for i in range(1,n+1):
    if s >= n:
        break
    s += i
    ans += 1
ans -= 1
a = n
for i in range(ans):
    if a >= ans+1-i:
        print(ans+1-i)
        a -= ans+1-i
    elif a == 0:
        break
    else:
        print(a)
        break
if n == 1:
    print(1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-30 16:55:09 +0900
# LastModified: 2020-07-30 18:15:00 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n = int(input())
    if n == 1:
        print(1)
        return
    if n % 2 == 0:
        print(n//2-1)
        print(n//2+1)
    else:
        print(n//2)
        print(n//2+1)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_b

n = int(input())

i = 1
while i * (i + 1) // 2 <= n:
    i += 1
ans = []
while n > 0 and i > 0:
    if n >= i:
        n -= i
        ans.append(i)
    i -= 1
for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/cf16-final/tasks/codefestival_2016_final_b

n = int(input())

i = 1
while i * (i + 1) // 2 <= n:
    i += 1
ans = []
while n:
    if n >= i:
        n -= i
        ans.append(i)
    i -= 1
for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

ans = 0

if N == 1:
    print(1)
    sys.exit()

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

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

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

ans = []

if N == 1:
    print(1)
    sys.exit()

for i in range(1, N):
    n = N - i
    if n != 0 and n <= i:
        continue
    N = n
    ans.append(i)
    if n == 0:
        break

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

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())

ans = []

if N == 1:
    print(1)
    sys.exit()

for i in range(1, N):
    n = N - i
    if n > 0 and n <= i:
        continue
    N = n
    ans.append(i)
    if n == 0:
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = []

for i in range(1, N):
    n = N - i
    if n > 0 and n <= i:
        continue
    N = n
    ans.append(i)
    if n == 0:
        break

if N == 1:
    print(1)
else:
    print(*ans, sep='\n')

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-(n//2+1))
else:
    print(n//2,)
    print(n-(n//2))

Submission status: Wrong Answer

Solution code:
N=int(input())
a=1
b=0
for i in range(N):
    if (i+1)*i/2>=N:
        a=i
        b=(i+1)*i/2-N

        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())

# 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...
# 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, ...

# 開始位置を用意
A = [0] * (n + 1)
A[1] = 1
for i in range(1, n):
    A[i + 1] = A[i] + i

from bisect import bisect_left
idx = bisect_left(A, n)

for i in range(1, idx):
    if i == idx - 1 - (n - A[idx - 1] + 1): continue
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
now = 0
ans = []
for i in range(1, n):
    now += i
    ans.append(i)
    if now >= n:
        break

amari = now - n

for i in ans:
    if i == amari:
        continue
    else:
        print(i)

Submission status: Wrong Answer

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

#temp_n=int(math.sqrt(2*n)//1)-1
temp_n=int((-1+math.sqrt(1+8*n))//2)
#print(n,temp_n)

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

#print(n,temp_n)
ans=[]
while(n>0):
#    print(n,temp_n,ans)
    if(n>=temp_n):
        n-=temp_n
        ans.append(temp_n)
        temp_n-=1
    else:
        temp_n=n
        ans.append(temp_n)
        n-=temp_n
ans.sort()

for ai in ans:
    print(ai)

Submission status: Wrong Answer

Solution code:
MN = 10 ** 7
N = int(input())

rets = []

nowmax = MN

def dfs(v, now):
    global rets, nowmax
    stack = list(range(1, min(nowmax, v)))
    
    while stack:
        ind = stack.pop()
        
        if sum(now) + ind == N:
            
            if ind > nowmax:
                continue

            rets = now + [ind]
            nowmax = max(rets)

            break
        
        if sum(now) + ind >= N:
            continue
        
        dfs(ind, now + [ind])


if N == 1:
    print(1)
else:
    dfs(N, [])
    for i in rets:
        print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
for i in range(int(n**0.6)+1, 1, -1):
    if n >= i:
        n -= i
        print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
cnt = 0
for i in range(1, int(n**(2/3))):
    if n > cnt:
        ans.append(i)
        cnt += i
    else:
        if cnt - n in ans:
            ans.remove(cnt - n)
            break
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = []
cnt = 0
for i in range(1, n+1):
    if n > cnt:
        ans.append(i)
        cnt += i
    else:
        if cnt - n in ans:
            ans.remove(cnt - n)
            break
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

i = 0
while True:
    if i*(i+1)//2 >= n:
        break
    i += 1

while True:
    print(i)
    n -= i
    i -= 1
    if n - i <= 0:
        print(n)
        break

Submission status: Wrong Answer

Solution code:
import sys


def sum_(i):
    return i * (i + 1) // 2


if __name__ == "__main__":
    N = int(input())
    sum_score = 0
    if N == 1:
        print(1)
        sys.exit(0)
    for i in range(1, N + 1):
        if sum_(i) <= N:
            sum_score = sum_(i)
        else:
            break
    for x in list(range(1, i - 1)) + [(N - sum_score) + (i - 1)]:
        print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())

from collections import OrderedDict

if N == 2:
    print(2)
    exit(0)
# ans = OrderedDict()
ans = set()
cur = N
i = 1

while cur != 0:
    tmp = cur - i
    if tmp in ans:
        pass
    else:
        ans.add(i)
        cur = tmp
    i+= 1

for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

from collections import OrderedDict

ans = OrderedDict()
cur = N
i = 1

while cur != 0:
    tmp = cur - i
    if tmp in ans.keys():
        pass
    else:
        ans[i] = True
        cur = tmp
    i+= 1

for a in ans:
    print(a)

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
reject=0
A=[]
for i in range(1,N+1):
    ans+=i
    if ans>N:
        reject=ans-N
        for j in range(1,i+1):
            if j!=reject:
                print(j)
        break

Submission status: Wrong Answer

Solution code:
N=int(input())
ans=0
for i in range(1,N+1):
    if ans+i==N:
        print(i)
        break
    if N-(ans+i)>=i+1:
        print(i)
        ans+=i
    else:
        continue

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [0] * n

for i in range(1, n):
    l[i] = l[i-1] + i
    if l[i] > n:
        break

if n == 1:
    print(1)
    exit()
elif n == 2:
    print(2)
    exit()
elif n == 3:
    print(2)
    print(1)
    exit()
elif n == 4:
    print(3)
    print(1)
    exit()

if n in l:
    i = 1
    while n > 0:
        print(i)
        n -= i
        i += 1
elif n % 2 == 0:
    print(n // 2)
    print(1)
    print(n // 2 - 1)
else:
    print(n // 2 + 1)
    print(n - (n // 2 + 1))

Submission status: Wrong Answer

Solution code:
n = int(input())

if n == 1:
    print(1)
    exit()
elif n == 2:
    print(2)
    exit()
elif n == 3:
    print(2)
    print(1)
    exit()
elif n == 4:
    print(3)
    print(1)
    exit()

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

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
L = []
while 1:
    a = N // 2 + 1
    L.append(a)
    N -= a
    if N <= 0:
        break
L.reverse()
print(*L, sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())

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