Problem:
 Score : 300 points    Problem Statement The problem set at CODE FESTIVAL 20XX Finals consists of N problems.  The score allocated to the i -th (1≦i≦N) problem is i points.  Takahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.  As problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.  Determine the set of problems that should be solved.      Constraints  1≦N≦10^7       Partial Score  200 points will be awarded for passing the test set satisfying 1≦N≦1000 .  Additional 100 points will be awarded for passing the test set without additional constraints.         Input The input is given from Standard Input in the following format:  N       Output Among the sets of problems with the total score of N , find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.  If there exists more than one such set, any of them will be accepted.        Sample Input 1 4      Sample Output 1 1
3  Solving only the 4 -th problem will also result in the total score of 4 points, but solving the 1 -st and 3 -rd problems will lower the highest score of a solved problem.       Sample Input 2 7      Sample Output 2 1
2
4  The set \{3,4\} will also be accepted.       Sample Input 3 1      Sample Output 3 1

Solution (Python):
n = int(input())
x = [0]
for i in range(1,4500): x.append(x[-1]+i)
from bisect import bisect_left
while n!=0:
	print(bisect_left(x,n))
	n -= bisect_left(x,n)

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

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

Solution (Python):

N = int(input())

sum = 0
m = 0
for i in range(1, 10**5 + 1):
    sum += i
    if sum >= N:
        m = i
        break

sum = N
for i in range(1, m + 1)[::-1]:
    if sum - i >= 0:
        sum -= i
        print(i)

Solution (Python):
n=int(input())
a=5000000
delt=5000000
while not ((a+1)*a//2<n and (a+2)*(a+1)//2>=n):
  delt=max(delt//2,1)
  if (a+2)*(a+1)//2<n:
    a+=delt
  else:
    a-=delt
a=a+1
joker=a*(a+1)//2-n

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

Solution (Python):
from math import ceil, sqrt

N = int(input())

k = ceil(0.5 * (-1 + sqrt(1 + 8 * N)))

ans = set()
for i in range(1, k + 1)[::-1]:
    if i <= N:
        N -= i
        ans.add(i)

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

Solution (Python):

N = int(input())
ans = 0
before = 1
factor = 0
for tmp in range(1,N+1):
    ans += tmp
    factor = tmp
    if before < N and N <= ans:
        break
    before = ans
difference = ans - N
if difference != 0:
    for tmp in range(1,factor+1):
        if difference != tmp:
            print(tmp)
        else:
            pass
else:
    for tmp in range(1,factor+1):
        print(tmp)

Solution (Python):
import sys


def calc(n):
    i = 1
    sm = 0
    st = set()
    if n <= 2:
        st.add(n)
        return st
    while sm < n:
        st.add(i)
        sm += i
        i += 1
    st = st - calc(sm - n)
    return st


sys.setrecursionlimit(10000000)
n = int(input())

c = calc(n)

for cc in c:
    print(cc)

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

sum = 0

if N <= 2:
    print(N)
else:

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

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

Solution (Python):
a = int(raw_input())

_sum = 0
i = 1
while _sum <= a:
    _sum += i
    i += 1
odd = _sum - a
for b in range(i - 1):
    if b + 1 == odd:
        continue
    print b + 1

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

Solution (Python):
import sys

N = long(raw_input())

def bin_search(l, r):
	if (r - l) <= 1: return r
	m = (l + r) / 2
	if (((m + 1) * m) / 2) > N:
		return bin_search(l, m)
	else:
		return bin_search(m, r)

x = bin_search(1, 10**7)
d = (x * (x + 1)) / 2 - N
for y in range(1, x+1, 1):
	if y == d: continue
	print str(y)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    s = int(math.sqrt(n))
    while (s+1)*s/2 < n:
        s += 1
    sa = (s+1)*s/2 - n
    for i in range(1,s+1):
        if i == sa:
            continue
        print(i)


f()

Solution (Python):
from math import ceil
N = int(input())
ans = int(ceil((-1 + (1 + 4 * 2 * N) ** 0.5) / 2))
for i in reversed(range(1, ans+1)):
    if i <= N:
        print(i)
        N -= i
assert(not N)

Solution (Python):
import math
n = int(input())
nn = (int(math.sqrt(n)) + 1) * 2
s = [i * (i + 1) // 2 for i in range(nn)]

for i in range(nn):
    if n <= s[i]:
        mx = i
        break

for i in range(mx, 0, -1):
    f = True

    if (s[mx] - i) == n:
        f = False

    if f:
        print(i)
    else:
        pass

Solution (Python):
import math
n = int(input())
nn = (int(math.sqrt(n)) + 2) * 2
s = [i * (i + 1) // 2 for i in range(nn)]

for i in range(nn):
    if n <= s[i]:
        mx = i
        break

for i in range(mx, 0, -1):
    f = True

    if (s[mx] - i) == n:
        f = False

    if f:
        print(i)
    else:
        pass

Solution (Python):
import bisect



mod=1000000007

pi=3.141592653589
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
def niten(a,b): return abs(a-b) if a>=0 and b>=0 else  a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b))
def fib(n): return [(seq.append(seq[i-2] + seq[i-1]), seq[i-2])[1] for seq in [[0, 1]] for i in range(2, n)]
def gcd(a,b): return a if b==0 else gcd(b,a%b)
def lcm(a,b): return a*b/gcd(a,b)
def eucl(x1,y1,x2,y2): return ((x1-x2)**2+(y1-y2)**2)**0.5
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1.e-10 else 0
def pscl(num,l=[1]):
    for i in range(num):
        l = map(lambda x,y:x+y,[0]+l,l+[0])
    return l

l=[]
for i in range(1,5001):
    if i%2==0:
        l.append((1+i)*(i/2))
    else:
        l.append((1+i)*(i/2)+(i+1)/2)
n=int(raw_input())




chk=bisect.bisect_right(l,n)
tmp=l[chk]
for i in range(1,chk+2):
    if i!=tmp-n:
        print i

Solution (Python):
N=int(input())
x=int((-1+(1+8*N)**0.5)/2)


if x*(x+1)/2==N:

    for i in range(x):
        print(i+1)
    exit()
else:
    print(x+1)
    N -= (x+1)

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

Solution (Python):


import bisect


M = 4472


def generate_triangle_numbers(max_idx=M):
    assert max_idx >= 0
    for i in range(max_idx + 1):
        yield i * (i + 1) // 2


def decompose(n):
    tris = list(generate_triangle_numbers())
    
    i = bisect.bisect_left(tris, n)
    t = tris[i]
    if t == n:
        return list(range(1, i + 1))
    else:
        for j in range(1, i):
            if t - j == n:
                return list(range(1, j)) + list(range(j + 1, i + 1))


def main():
    xs = decompose(int(input()))
    print(*xs, sep="\n")


if __name__ == '__main__':
    main()

Solution (Python):
import math
import sys

N = int(input())

m = int(math.sqrt(N))
while m*(m+1) < 2*N:
	m += 1
	
list = [m]
sum = m
for n0 in range(m-1):
	n = m-1 -n0
	if sum == N:
		for num in list:
			print(num)
		sys.exit()
	elif sum + n == N:
		list.append(n)
		for num in list:
			print(num)
		sys.exit()
	elif sum + n < N:
		list.append(n)
		sum += n
if m == 1:
	print(1)

Solution (Python):
a = int(input().strip())
import sys
sys.setrecursionlimit(1000000)
tmp = []
res = []
ind = 1

def bar(foo,hoge):
    if(foo == 0):
        return
    if foo == 1:
        res.append(1)
        return
    elif foo == 2:
        res.append(2)
        return
    for i in reversed(range(hoge)):
        if (tmp[i] <= foo):
            res.append(i + 1)
            bar(foo - (i + 1) , i)
            return
        
        
    
for i in range(10000000):
    ind = ind + i
    tmp.append(ind)
    if ind >= a :
        bar(a, i + 1 )
        break
for i in res:
    print(i)

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

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

while n > 0:
    if i <= n:
        print i
        n -= i
    i -= 1

Solution (Python):
import sys


f = input()

N = int(f)


out = []
sum = 0
for i in range(0, N+1):
    sum = sum + i
    out.append(i)
    if sum > N:
        r = sum - N
        out.remove(r)
        break
    
out.remove(0)

for n in out:
    print(n)

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

n = int(next(sys.stdin).strip())
l = list()
while n > 0:
    i = ceil((sqrt(8 * n + 1) - 1) / 2)
    l.append(i)
    n -= i

for i in reversed(l):
    print(i)

Solution (Python):
import sys
import math

N = int(sys.stdin.readlines()[0].strip())

r = N
while r >= 2:
    ans = int(math.ceil((-1 + math.sqrt(1 + 8*r))/2))
    print ans
    r -= ans

if r != 0:
    print 1

Solution (Python):
N = input()
i = 1
while i*(i+1)/2 < N:
    i += 1

print i

N -= i
j = i-1
while N > 0:
    if N - j >= 0:
        print j
        N -= j
    j -= 1

Solution (Python):
def solve():
    n = int(input())
    if n == 1:
        print(1)
        return
    elif n == 2:
        print(2)
        return
    ans = []
    anssum = 0
    for i in range(1, n):
        ans.append(str(i))
        anssum += i
        if anssum >= n:
            if anssum == n:
                print("\n".join(ans))
            else:
                ans.remove(str(anssum - n))
                print("\n".join(ans))
            return
    print("\n".join(ans))

if __name__=="__main__":
    solve()

Solution (Python):
import math
N = int(raw_input())
M = int(math.ceil(-0.5 + math.sqrt(1+8*N) / 2))

while N > 0:
    if N >= M:
        print M
        N -= M
        M -= 1
    else:
        print N
        break

Solution (Python):
n=int(raw_input())
r=n+1
l=1
while r-l>1:
    m=(r+l)/2
    if m*(m+1)/2>n:
        r=m
    else:
        l=m
if l*(l+1)/2==n:
    for i in xrange(1,l+1):
        print(i)
else:
    for i in xrange(1,l+2):
        if (l+1)*(l+2)/2-i==n:
            idx=i
            break
    for i in xrange(1,l+2):
        if i==idx:continue
        print(i)

Solution (Python):

import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N = int(raw_input())

s = 0
ans = []
for i in xrange(1, N + 1):
	ans.append(i)
	s += i
	if s >= N:
		k = s - N
		break

for i in ans:
	if i == k: continue
	print i

Solution (Python):



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