Problem:
 Score : 600 points    Problem Statement We have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller.   Determine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N , and increase each of the other elements by 1 .   It can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.  You are given an integer K . Find an integer sequence a_i such that the number of times we will perform the above operation is exactly K . It can be shown that there is always such a sequence under the constraints on input and output in this problem.      Constraints  0 ≤ K ≤ 50 \times 10^{16}         Input Input is given from Standard Input in the following format:  K       Output Print a solution in the following format:  N  a_1  a_2 ... a_N   Here, 2 ≤ N ≤ 50 and 0 ≤ a_i ≤ 10^{16} + 1000 must hold.        Sample Input 1 0      Sample Output 1 4
3 3 3 3       Sample Input 2 1      Sample Output 2 3
1 0 3       Sample Input 3 2      Sample Output 3 2
2 2  The operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].       Sample Input 4 3      Sample Output 4 7
27 0 0 0 0 0 0       Sample Input 5 1234567894848      Sample Output 5 10
1000 193 256 777 0 1 1192 1234567891011 48 425

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def k(a):
    print('----------------')
    c = 0
    n = len(a)
    while max(a) >= n:
        a[a.index(max(a))] -= n + 1
        for i in range(n):
            a[i] += 1
        c += 1
        
    return c


@mt
def slv(K):
    n = 50
    m = K % n
    l = K // 50

    a = [n + l] * n

    
    for i in range(n):
        if i < m:
            a[i] += n - m
        else:
            a[i] -= m + 1

    print(n)
    print(' '.join(map(str, a)))
    


def main():
    K = read_int()
    slv(K)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

K = int(input())


if K == 0:
	N = 2
	aa = [1,1]
elif K == 1:
	N = 2
	aa = [0,2]
elif K < 50:
	N = K
	aa = [K]*N
else:
	N = 50
	aa = [49-K]*N
	kk = K % 50
	KK = K //50
	for i in range(N):
		aa[i] += 51*KK
	for i in range(kk):
		aa[i] += 51

print(N)
print (' '.join(map(str,aa)))

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

N = 50

ans = [i for i in range(N)]
x,y = divmod(K,N)

ans = list(map(lambda a:a+x,ans))

for i in range(y):
    ans[i] += N + 1
    ans = list(map(lambda a:a-1,ans))

print(N)
print(*ans)

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

N = 50

x, y = divmod(K, N)

rs = [x + N - 1 - y] * (N - y) + [x + N - y + N] * y

print(N)
print(*rs)

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

N = 50

x, y = divmod(K, N)

rs = [x + N - 1] * N
for i in range(y):
    rs[i] += (N - y + 1)
for i in range(y, N):
    rs[i] -= y

print(N)
print(*rs)

Solution (Python):
K = int(input())
N = 50
L = list(range(N))
q,r = divmod(K,N)
for i in range(N):
    L[i] += N * q + (N if r > i else 0)
    L[i] -= (N-1) * q + (r-1 if r > i else r)
print(N)
print(*L)

Solution (Python):
K = int(input())
print(50)
L = list(range(50))
for i in range(50): L[i] += K//50
for i in range(K%50): L[-i-1] += 1
print(" ".join(map(str, L)))

Solution (Python):
k = int(input())
x = 49+k//50-k%50
print(50)
for i in range(k%50): print(x+51,end=" ")
for i in range(50-k%50): print(x,end=" ")

Solution (Python):
def d_decrease(K):
    
    
    
    
    
    N = 50  
    q, r = K // N, K % N  
    seq = list(map(lambda x: x + q, range(N)))
    for i in range(r):
        seq[i] += N
        for j in range(N):
            if i != j:
                seq[j] -= 1
    ans = '{}\n{}'.format(N, ' '.join(map(str, seq)))
    return ans

K = int(input())
print(d_decrease(K))

Solution (Python):
import numpy

K = int(input())
N = 50

ans = numpy.array([49]*50)
ans += K // N
for i in range(K % N):
    ans -= 1
    ans[i] += 50


ans = list(map(str, ans))
print(N)
print(" ".join(ans))

Solution (Python):
def d_decrease(K):
    
    
    
    
    
    N = 50  
    q, r = K // N, K % N  
    seq = list(map(lambda x: x + q, range(N)))
    for i in range(r):
        seq[i] += N
        for j in range(N):
            if i != j:
                seq[j] -= 1
    ans = '{}\n'.format(N) + ' '.join(map(str, seq))
    return ans

K = int(input())
print(d_decrease(K))

Solution (Python):
K = int(input())
N = 50
a = [i+K//N for i in range(N)]
for i in range(K%N):
    for j in range(N):
        if i%N==j:
            a[j]+=N
        else:
            a[j]-=1
print(N)
print(str(a)[1:][:-1].replace(", ", " "))

Solution (Python):
K=input()
N=50
a=range(N)
a=map(lambda x:x+(K/N),a)
m=K%N

for i in range(m):
	a[i]+=N
	for j in range(N):
		if i!=j:
			a[j]-=1
print N

for i in a:
	print i,

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

print(50)
d, m = divmod(k, 50)

initial = [i for i in range(50)]


def undo_one(xs):
    m = 10**16+1001
    mi = None
    for i, x in enumerate(xs):
        if x < m:
            m = x
            mi = i
    xs[mi] += 51
    for i in range(50):
        xs[i] -= 1

def undo_k(xs, k):
    return list(map(lambda x: x+k, xs))

xs = undo_k(initial, d)
for i in range(m):
    undo_one(xs)

print(" ".join(map(str, xs)))

Solution (Python):
K = int(input())
print(50)

div = K // 50
margin = K % 50


for i in range(margin):
	print(str(49+51*(div+1)-K) + " ",end="") 

for i in range(margin,50):
	print(str(49+51*div-K) + " ",end="")

print()

Solution (Python):
import sys
K = int(input())
if K == 0:
    print('2')
    print('0 0')
    sys.exit(0)
elif K == 1:
    print('2')
    print('2 0')
    sys.exit(0)
N = min((50, K))
nK = K // N
remain = K % N
a = []
for i in range(N):
    a.append(N-1+nK)
    if i + 1 <= remain:
        a[-1] += N - (remain - 1)
    else:
        a[-1] += -remain
print(N)
print(' '.join(map(str, a)))

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

shou = k//50
amari = k%50

a = str(49-k+shou*51)
b = str(100-k+shou*51)

n = []

for i in range(amari):
    n.append(b)

for i in range(50-amari):
    n.append(a)

print('50')
nstr = ' '.join(n)
print(nstr)

Solution (Python):
K = int(input())
N = 50
A = [i for i in range(N)]

q = K // N
r = K % N

A = [a+q for a in A]
for i in range(r):
  A[i] += N
  for j in range(N):
    if i != j:
      A[j] -= 1

print(N)
for i in range(N):
  if i != 0:
    print(" ", end="")
  print(A[i], end="")
print("")

Solution (Python):
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    K = int(input())
    a = [i + (K // 50) for i in range(50)]
    for i in range(K % 50):
        for j in range(50):
            a[j] += 50 if i == j else -1
    print(50)
    print(*a)


if __name__ == '__main__':
    main()

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

N = 50
mod = K % N
a = (K // N) + N - 1 - mod

print(N)
print((str(a + N + 1) + ' ') * mod + (str(a) + ' ') * (N - mod))

Solution (Python):
K = int(input())
a = [i + (K // 50) for i in range(50)]
for i in range(K % 50):
    a[49 - i] += 1
print(50)
for i in range(50):
    print(a[i], end=" ")
print()

Solution (Python):
base = [i+1 for i in range(50)]

k = int(input())
if(k < 50):
    ans = list(map(lambda x: x if x > 50 - k else 0, base))
else:
    baseup = k // 50 - 1
    partup = k % 50
    ans = list(map(lambda x: x + baseup + (x>50-partup), base))

print(50)
print(" ".join(map(str, ans)))

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

anser=[i+1 for i in range(50)]
kk=k%50
anser[50-1-kk]=0
for i in range(50):
    anser[i]+=k//50
    
print (50)
print(" ".join(list(map(str,anser))))

Solution (Python):
K=int(input())
a=[]
if K==0:
    print("2")
    print("1 1")

elif K==1:
    print("3")
    print("1 1 3")

elif K>1 and K<=50:
    N=K
    print(K)
    for _ in range(N):
        a.append(str(N))
    print(" ".join(a))
else:
    N=50
    print("50")
    p=K%N
    for _ in range(p):
        a.append(str(N-1+(K//N)+N-p+1))
    for _ in range(p,N):
        a.append(str(N-1+(K//N)-p))
    print(" ".join(a))

Solution (Python):
def Q4(K):
    N = 50
    lst = list(range(N))
    q, r = K // N, K % N
    lst = list(map(lambda x: x + q, lst))
    for i in range(r):
        lst[i] += N
        for j in range(N):
            if i != j:
                lst[j] -= 1
    print(N)
    for i in lst:
        print(i, end=' ')

K=int(input())
Q4(K)

Solution (Python):
K = int(input())
a = [i + (K // 50) for i in range(50)]
for i in range(K % 50):
    a[49 - i] += 1
print(50)
for i in range(50):
    print(a[i], end=" ")
print()

Solution (Python):
import numpy as np
N = 50
K = int(input())

skip_div = K // N
skip_mod = K % N

a = np.array(range(skip_div, skip_div + N))

for i in range(skip_mod):
	max_index = np.argmin(a)
	add = np.ones(N, dtype = np.int) * -1
	add[max_index] = N
	a += add

print(len(a.tolist()))
print(' '.join(map(str, a.tolist())))

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

ans = list(range(N))

for i in range(len(ans)):
    ans[i] += K//N

for i in range(K % N):
    for j in range(len(ans)):
        if j == i:
            ans[j] += N
        else:
            ans[j] -= 1
    
print(N)
print(*ans)

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

res = range(51)

k = K/50
mod = K%50

for i in res:
    res[i] = i+k

res.pop(-1-mod)


print 50
for i in range(len(res)):print res[i],

Solution (Python):
s = int(input())
mul = s//50
ama = s%50
if ama != 0:
    mul += 1
    ama = 50 - ama
print("50")
ans = 49 + mul
for i in range(50):
    if i < ama:
        print(ans + ama- 1 - 50, end=" ")
    else:
        print(ans + ama, end=" ")
print()

Solution (Python):
n=input()
print '50\n'+' '.join(map(lambda i:str(n/50-n%50+49+51*(i<n%50)),range(50)))

Solution (Python):
def get(i):
	if i < m:
		return str(d + 100 - m)
	return str(d + 49 - m)

n = int(raw_input())
d = n / 50
m = n % 50

print 50
print ' '.join(map(get, range(50)))

Solution (Python):
import numpy as np

K = int(input())

print(50)

n = K // 50
m = K % 50

a = np.array(range(50)) + n

for i in range(m):
    a -= 1
    a[i] += 51

print(' '.join(map(str, a)))

Solution (Python):


 
K = int(input())
if K >= 50:
  N = 50
  a = K % N
  if a == 0:
    n = [K // N + 49] * N
  else:
    n = [K // N + (49 - a)] * N
    for i in range(a):
      n[i] = n[i] + N
elif K == 0:
  N = 2
  n = ["1", "1"]
else:
  N = K + 1
  n = [0] * N
  n[0] = K**2 + K*2
n = ' '.join(list(map(str, n)))
print(N)
print(n)

Solution (Python):
import sys




def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    k = read_int()
    n = 50
    q, r = divmod(k, n)
    a = [q + (n - 1)] * n
    for i in range(r):
        a[i] += n - r + 1
    for i in range(r, n):
        a[i] -= r
    print(n)
    print(*a)


main()

Solution (Python):


if __name__ == "__main__":

    k = int(input())
    n = 50

    x, y = k//n, k%n

    ans = [i + x for i in range(n)]

    for i in range(n):
        if i <= y-1:
            ans[i] += n-y+1
        else:
            ans[i] -= y

    print(n)
    print(' '.join(map(str, ans)))

Solution (Python):
K=int(input())
N=50
a = list(range(N))
m = K // N
b = K % N
a=list(map(lambda x: x + m, a))
for i in range(b):
    a[i] += N
    for j in range(N):
        if j != i:
            a[j] -= 1
print(N)
print(' '.join(map(str,a)))

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

div = int(K / 50)
mod = K % 50

a = range(49, -1, -1)
for i in range(50):
    if i < mod:
        a[i] += (1 + div)
    else:
        a[i] += div

print(50)
print(' '.join(map(str, a)))

Solution (Python):
k = int(input())
if k in [0, 1]:
    print(["4\n3 3 3 3", "3\n1 0 3"][k])
    __import__("sys").exit()
n = 50
coef = k // n

if k <= 50: coef, n = 1, k
a = list(reversed(range(coef, coef + n)))
for i in range(k - coef * n):
    a[i] += 1
print(n)
print(*a)

Solution (Python):



import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)

def solve_small(K):
    if K == 0:
        return [0, 1]
    elif K == 1:
        return [0, 2]

    return [i for i in range(1, K+1)]

def solve(K):
    N = 50
    q = K // N
    r = K %  N

    A = [q+i for i in range(N)]
    for i in range(r):
        for j in range(N):
            if j == i:
                A[j] += N
            else:
                A[j] -= 1

    return A

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

    if K < 50:
        A = solve_small(K)
    else:
        A = solve(K)

    print(len(A))
    print(" ".join(map(str, A)))

if __name__ == "__main__": main()

Solution (Python):
K = int(input())
def solve():
    n = min(50, max(2, K//(10**16) + 1))
    q = K//n
    r = K%n
    return [q-r + n-1] * (n-r) + [q-r + 2*n-1] * r

ans = solve()
print(len(ans))
print(' '.join(map(str,ans)))

Solution (Python):
def decrease(A,N):
    t = 0
    while(1):
        if max(A) <= N -1: break
        else:
            for i in range(N): A[i] = A[i] + 1
            i = A.index(max(A))
            A[i] = A[i] - N - 1
            t += 1
    return t


if __name__ == '__main__':
    K = int(input())
    p,q = K // 50, K % 50
    A = [i for i in range(50)]
    N = 50
    A = [a + p for a in A]
    for i in range(q):
        A = [a - 1 for a in A]
        A[i] += N + 1

    print(len(A))
    A = [str(a) for a in A]
    print(" ".join(A))

Solution (Python):


K = int(input())
N = 50
q = K // N
r = K % N

a = [49 + q] * N

for i in range(N):
    if i < r:
        a[i] += N - r + 1
    else:
        a[i] -= r

print(N)
for i in range(N):
    print(a[i], end=' ')

Solution (Python):

















































K=int(input())
print(50)
L=K//50+49
amari=K%50
ansstr=''

for idx in range(0,50,1):
    if idx < amari:
        ansstr+=str(L+50-(amari-1))+' '
    else:
        ansstr+=str(L-amari)+' '

print(ansstr[0:len(ansstr)-1])

Solution (Python):
def main():
    k = int(input())
    for n in range(50, 1, -1):
        clear = k // n + 1
        additional = n - k % n
        a = clear + n - 1
        if(a >= 0 and a <= 10**16 + 1000):
            lst = [a] * n
            for i in range(additional):
                m = max(lst)
                forbidden = -1
                for i, item in enumerate(lst):
                    if(item == m):
                        forbidden = i
                        lst[i] -= n
                        break
                for i in range(len(lst)):
                    if(i != forbidden):
                        lst[i] += 1
            print(n)
            print(' '.join([str(item) for item in lst]))
            return 0
main()

Solution (Python):

 
def main():
	k = int(input())
	n = 50
	div = k // n
	res = k % n
 
	temp = [i for i in range(n)]
	temp = [temp[i] + (i >= (50 - res)) + div for i in range(n)]
 
	out = [str(x) for x in temp]
	print(n)
	print(" ".join(out))
 
	
 
def calc(temp):
	i = 0
	while len([x for x in temp if x >= len(temp)]) > 0:
		temp = query(temp)
		
		i += 1
	return i
 
def query(temp):
	temp.sort()
	temp = [x + 1 for x in temp]
	temp[-1] = temp[-1] - 1 - len(temp)
	return temp
 
if __name__ == '__main__':
	main()

Solution (Python):
K = long(raw_input())

base = K / 50
ext = K % 50

print 50
numbers = []
for i in xrange(0, 51):
  if i != 50 - ext:
    numbers.append(base + i)
print " ".join(map(str, numbers))

Solution (Python):

def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def main():
    K = get_ln_int_inputs()[0]

    N = 50
    n = K // N
    initNum = N + n - 1
    remK = K % N

    l = []

    fn = initNum + 1 + (N - remK)
    for _ in range(remK):
        l.append(fn)

    ln = initNum - remK
    for _ in range(remK, N):
        l.append(ln)

    print(N)
    print(" ".join(map(str, l)))


main()

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

a = [49 for i in range(50)]

for i in range(50):
    a[i] += K//50
    
for i in range(50):
    mod = K % 50

    if mod >= i+1:
        a[i] = a[i] + 50 - (mod)
    else:
        a[i] = a[i] - (mod)

print(50)
print(*a)

Solution (Python):
k = int(input())
if k == 0:
    print("2\n1 1")
    exit(0)
if k == 1:
    print("2\n2 0")
    exit(0)
n = min(50,k)
a = [i for i in range(n)]
c = k // n

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

for i in range(k % n):
    a[i] += n
    for j in range(n):
        if i != j:
            a[j] -= 1
print(n)
for i in a:
    if i in range(10**16 + 1001):
        print(i, end=' ')
    else:
        exit(1)
print()