Problem:


Score : 500 points

Problem Statement

Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(123) = 1 + 2 + 3 = 6.

We will call an integer n a Snuke number when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.

Given an integer K, list the K smallest Snuke numbers.

Constraints

1 \leq K

The K-th smallest Snuke number is not greater than 10^{15}.

Input

Input is given from Standard Input in the following format:

K

Output

Print K lines. The i-th line should contain the i-th smallest Snuke number.

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19



Sample input:
10


Sample output:
1
2
3
4
5
6
7
8
9
19

Submission status: Runtime Error

Solution code:
L=[1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 199, 299, 399, 499, 599, 699, 799, 899, 999, 1099, 1199, 1299, 1399, 1499, 1599, 1699, 1799, 1899, 1999, 2999, 3999, 4999, 5999, 6999, 7999, 8999, 9999, 10999, 11999, 12999, 13999, 14999, 15999, 16999, 17999, 18999, 19999, 20999, 21999, 22999, 23999, 24999, 25999, 26999, 27999, 28999, 29999, 39999, 49999, 59999, 69999, 79999, 89999, 99999, 109999, 119999, 129999, 139999, 149999, 159999, 169999, 179999, 189999, 199999, 209999, 219999, 229999, 239999, 249999, 259999, 269999, 279999, 289999, 299999, 309999, 319999, 329999, 339999, 349999, 359999, 369999, 379999, 389999, 399999, 499999, 599999, 699999, 799999, 899999, 999999, 1099999, 1199999, 1299999, 1399999, 1499999, 1599999, 1699999, 1799999, 1899999, 1999999, 2099999, 2199999, 2299999, 2399999, 2499999, 2599999, 2699999, 2799999, 2899999, 2999999, 3099999, 3199999, 3299999, 3399999, 3499999, 3599999, 3699999, 3799999, 3899999, 3999999, 4099999, 4199999, 4299999, 4399999, 4499999, 4599999, 4699999, 4799999, 4899999, 4999999, 5999999, 6999999, 7999999, 8999999, 9999999, 10999999, 11999999, 12999999, 13999999, 14999999, 15999999, 16999999, 17999999, 18999999, 19999999, 20999999, 21999999, 22999999, 23999999, 24999999, 25999999, 26999999, 27999999, 28999999, 29999999, 30999999, 31999999, 32999999, 33999999, 34999999, 35999999, 36999999, 37999999, 38999999, 39999999, 40999999, 41999999, 42999999, 43999999, 44999999, 45999999, 46999999, 47999999, 48999999, 49999999, 50999999, 51999999, 52999999, 53999999, 54999999, 55999999, 56999999, 57999999, 58999999, 59999999, 69999999, 79999999, 89999999, 99999999, 109999999, 119999999, 129999999, 139999999, 149999999, 159999999, 169999999, 179999999, 189999999, 199999999, 209999999, 219999999, 229999999, 239999999, 249999999, 259999999, 269999999, 279999999, 289999999, 299999999, 309999999, 319999999, 329999999, 339999999, 349999999, 359999999, 369999999, 379999999, 389999999, 399999999, 409999999, 419999999, 429999999, 439999999, 449999999, 459999999, 469999999, 479999999, 489999999, 499999999, 509999999, 519999999, 529999999, 539999999, 549999999, 559999999, 569999999, 579999999, 589999999, 599999999, 609999999, 619999999, 629999999, 639999999, 649999999, 659999999, 669999999, 679999999, 689999999, 699999999, 799999999, 899999999, 999999999, 1099999999, 1199999999, 1299999999, 1399999999, 1499999999, 1599999999, 1699999999, 1799999999, 1899999999, 1999999999, 2099999999, 2199999999, 2299999999, 2399999999, 2499999999, 2599999999, 2699999999, 2799999999, 2899999999, 2999999999, 3099999999, 3199999999, 3299999999, 3399999999, 3499999999, 3599999999, 3699999999, 3799999999, 3899999999, 3999999999, 4099999999, 4199999999, 4299999999, 4399999999, 4499999999, 4599999999, 4699999999, 4799999999, 4899999999, 4999999999, 5099999999, 5199999999, 5299999999, 5399999999, 5499999999, 5599999999, 5699999999, 5799999999, 5899999999, 5999999999, 6099999999, 6199999999, 6299999999, 6399999999, 6499999999, 6599999999, 6699999999, 6799999999, 6899999999, 6999999999, 7099999999, 7199999999, 7299999999, 7399999999, 7499999999, 7599999999, 7699999999, 7799999999, 7899999999, 7999999999, 8999999999, 9999999999, 10999999999, 11999999999, 12999999999, 13999999999, 14999999999, 15999999999, 16999999999, 17999999999, 18999999999, 19999999999, 20999999999, 21999999999, 22999999999, 23999999999, 24999999999, 25999999999, 26999999999, 27999999999, 28999999999, 29999999999, 30999999999, 31999999999, 32999999999, 33999999999, 34999999999, 35999999999, 36999999999, 37999999999, 38999999999, 39999999999, 40999999999, 41999999999, 42999999999, 43999999999, 44999999999, 45999999999, 46999999999, 47999999999, 48999999999, 49999999999, 50999999999, 51999999999, 52999999999, 53999999999, 54999999999, 55999999999, 56999999999, 57999999999, 58999999999, 59999999999, 60999999999, 61999999999, 62999999999, 63999999999, 64999999999, 65999999999, 66999999999, 67999999999, 68999999999, 69999999999, 70999999999, 71999999999, 72999999999, 73999999999, 74999999999, 75999999999, 76999999999, 77999999999, 78999999999, 79999999999, 80999999999, 81999999999, 82999999999, 83999999999, 84999999999, 85999999999, 86999999999, 87999999999, 88999999999, 89999999999, 99999999999, 109999999999, 119999999999, 129999999999, 139999999999, 149999999999, 159999999999, 169999999999, 179999999999, 189999999999, 199999999999, 209999999999, 219999999999, 229999999999, 239999999999, 249999999999, 259999999999, 269999999999, 279999999999, 289999999999, 299999999999, 309999999999, 319999999999, 329999999999, 339999999999, 349999999999, 359999999999, 369999999999, 379999999999, 389999999999, 399999999999, 409999999999, 419999999999, 429999999999, 439999999999, 449999999999, 459999999999, 469999999999, 479999999999, 489999999999, 499999999999, 509999999999, 519999999999, 529999999999, 539999999999, 549999999999, 559999999999, 569999999999, 579999999999, 589999999999, 599999999999, 609999999999, 619999999999, 629999999999, 639999999999, 649999999999, 659999999999, 669999999999, 679999999999, 689999999999, 699999999999, 709999999999, 719999999999, 729999999999, 739999999999, 749999999999, 759999999999, 769999999999, 779999999999, 789999999999, 799999999999, 809999999999, 819999999999, 829999999999, 839999999999, 849999999999, 859999999999, 869999999999, 879999999999, 889999999999, 899999999999, 909999999999, 919999999999, 929999999999, 939999999999, 949999999999, 959999999999, 969999999999, 979999999999, 989999999999, 999999999999, 1099999999999, 1199999999999, 1299999999999, 1399999999999, 1499999999999, 1599999999999, 1699999999999, 1799999999999, 1899999999999, 1999999999999, 2099999999999, 2199999999999, 2299999999999, 2399999999999, 2499999999999, 2599999999999, 2699999999999, 2799999999999, 2899999999999, 2999999999999, 3099999999999, 3199999999999, 3299999999999, 3399999999999, 3499999999999, 3599999999999, 3699999999999, 3799999999999, 3899999999999, 3999999999999, 4099999999999, 4199999999999, 4299999999999, 4399999999999, 4499999999999, 4599999999999, 4699999999999, 4799999999999, 4899999999999, 4999999999999, 5099999999999, 5199999999999, 5299999999999, 5399999999999, 5499999999999, 5599999999999, 5699999999999, 5799999999999, 5899999999999, 5999999999999, 6099999999999, 6199999999999, 6299999999999, 6399999999999, 6499999999999, 6599999999999, 6699999999999, 6799999999999, 6899999999999, 6999999999999, 7099999999999, 7199999999999, 7299999999999, 7399999999999, 7499999999999, 7599999999999, 7699999999999, 7799999999999, 7899999999999, 7999999999999, 8099999999999, 8199999999999, 8299999999999, 8399999999999, 8499999999999, 8599999999999, 8699999999999, 8799999999999, 8899999999999, 8999999999999, 9099999999999, 9199999999999, 9299999999999, 9399999999999, 9499999999999, 9599999999999, 9699999999999, 9799999999999, 9899999999999, 9999999999999, 10999999999999, 11999999999999, 12999999999999, 13999999999999, 14999999999999, 15999999999999, 16999999999999, 17999999999999, 18999999999999, 19999999999999, 20999999999999, 21999999999999, 22999999999999, 23999999999999, 24999999999999, 25999999999999, 26999999999999, 27999999999999, 28999999999999, 29999999999999, 30999999999999, 31999999999999, 32999999999999, 33999999999999, 34999999999999, 35999999999999, 36999999999999, 37999999999999, 38999999999999, 39999999999999, 40999999999999, 41999999999999, 42999999999999, 43999999999999, 44999999999999, 45999999999999, 46999999999999, 47999999999999, 48999999999999, 49999999999999, 50999999999999, 51999999999999, 52999999999999, 53999999999999, 54999999999999, 55999999999999, 56999999999999, 57999999999999, 58999999999999, 59999999999999, 60999999999999, 61999999999999, 62999999999999, 63999999999999, 64999999999999, 65999999999999, 66999999999999, 67999999999999, 68999999999999, 69999999999999, 70999999999999, 71999999999999, 72999999999999, 73999999999999, 74999999999999, 75999999999999, 76999999999999, 77999999999999, 78999999999999, 79999999999999, 80999999999999, 81999999999999, 82999999999999, 83999999999999, 84999999999999, 85999999999999, 86999999999999, 87999999999999, 88999999999999, 89999999999999, 90999999999999, 91999999999999, 92999999999999, 93999999999999, 94999999999999, 95999999999999, 96999999999999, 97999999999999, 98999999999999, 99999999999999, 100999999999999, 101999999999999, 102999999999999, 103999999999999, 104999999999999, 105999999999999, 106999999999999, 107999999999999, 108999999999999, 109999999999999, 119999999999999, 129999999999999, 139999999999999, 149999999999999, 159999999999999, 169999999999999, 179999999999999, 189999999999999, 199999999999999, 209999999999999, 219999999999999, 229999999999999, 239999999999999, 249999999999999, 259999999999999, 269999999999999, 279999999999999, 289999999999999, 299999999999999, 309999999999999, 319999999999999, 329999999999999, 339999999999999, 349999999999999, 359999999999999, 369999999999999, 379999999999999, 389999999999999, 399999999999999, 409999999999999, 419999999999999, 429999999999999, 439999999999999, 449999999999999, 459999999999999, 469999999999999, 479999999999999, 489999999999999, 499999999999999, 509999999999999, 519999999999999, 529999999999999, 539999999999999, 549999999999999, 559999999999999, 569999999999999, 579999999999999, 589999999999999, 599999999999999, 609999999999999, 619999999999999, 629999999999999, 639999999999999, 649999999999999, 659999999999999, 669999999999999, 679999999999999, 689999999999999, 699999999999999, 709999999999999, 719999999999999, 729999999999999, 739999999999999, 749999999999999, 759999999999999, 769999999999999, 779999999999999, 789999999999999, 799999999999999, 809999999999999, 819999999999999, 829999999999999, 839999999999999, 849999999999999, 859999999999999, 869999999999999, 879999999999999, 889999999999999, 899999999999999, 909999999999999, 919999999999999, 929999999999999, 939999999999999, 949999999999999, 959999999999999, 969999999999999, 979999999999999, 989999999999999]
K=int(input())
for i in range(K):
    print(L[i])

Submission status: Runtime Error

Solution code:
import random

def f(n,l):
    if len(l)>n:
        return 0
    s=""
    for i in l:
        s+=str(9-i)
    for i in range(n-len(l)):
        s+="9"
    return int(s)

def f2(i):
    j=i+0
    s=0
    while i>0:
        s+=i%10
        i//=10
    return j/s

def f3(l):
    ret=[list(l)]
    for i in range(1000):
        random.shuffle(l)
        if l not in ret:
            ret.append(list(l))
    return ret

l=[[[1]], [], [], [], [], [], [], []]
for i in range(7):
    for temp in l[i]:
        if temp+[1] not in l[i+1]:
            for k in f3(temp+[1]):
                l[i+1].append(k)
        for j in range(len(temp)):
            temp2=list(temp)
            temp2[j]+=1
            if temp2 not in l[i+1]:
                for k in f3(temp2):
                    l[i+1].append(k)
cand=[[] for i in range(14)]
for i in range(8):
    for j in l[i]:
        for k in range(1,15):
            ret=f(k,j)
            if ret>0 :
                cand[len(str(ret))-1].append(ret)
                cand[len(str(ret))-1].sort()
                cand[len(str(ret))-1].reverse()
cand.reverse()
x=f2(10**15-1)
res=[]
for i in range(14):
    res.append(10**(15-i)-1)
    for j in cand[i]:
        if x>f2(9+j*10):
            x=f2(9+j*10)
            res.append(9+j*10)
res.reverse()
res=[1,2,3,4,5,6,7,8,9]+res

k=int(input())
for i in range(k):
    print(res[i])

Submission status: Runtime Error

Solution code:
def f(n,l):
    if len(l)>n:
        return 0
    s=""
    for i in l:
        s+=str(9-i)
    for i in range(n-len(l)):
        s+="9"
    return int(s)

def f2(i):
    j=i+0
    s=0
    while i>0:
        s+=i%10
        i//=10
    return j/s

l=[[[1]], [], [], [], [], [], [], []]
for i in range(7):
    for temp in l[i]:
        if sorted(temp+[1]) not in l[i+1]:
            l[i+1].append(sorted(temp+[1]))
        for j in range(len(temp)):
            temp2=list(temp)
            temp2[j]+=1
            temp2.sort()
            if temp2 not in l[i+1]:
                l[i+1].append(temp2)
for i in range(8):
    for j in l[i]:
        j.reverse()
cand=[[] for i in range(14)]
for i in range(8):
    for j in l[i]:
        for k in range(1,15):
            ret=f(k,j)
            if ret>0 :
                cand[len(str(ret))-1].append(ret)
                cand[len(str(ret))-1].sort()
                cand[len(str(ret))-1].reverse()
cand.reverse()
x=f2(10**15-1)
res=[]
for i in range(14):
    res.append(10**(15-i)-1)
    for j in cand[i]:
        if x>f2(9+j*10):
            x=f2(9+j*10)
            res.append(9+j*10)
res.reverse()
res=[1,2,3,4,5,6,7,8,9]+res

k=int(input())
for i in range(k):
    print(res[i])

Submission status: Runtime Error

Solution code:
k = int(input())
n=1
i=19+10*(k-9)
if k =< 9:
    for cnt in range(1,k+1):
        print(cnt)
else:
    for cnt in range(1,10):
        print(cnt)
    for cnt in range(19,i,10):
        print(cnt)

Submission status: Runtime Error

Solution code:
k = input()
n=1
i=19+10*(k-9)
if k =< 9:
    for cnt in range(1,k+1):
        print(cnt)
else:
    for cnt in range(1,10):
        print(cnt)
    for cnt in range(19,i,10):
        print(cnt)

Submission status: Runtime Error

Solution code:
k = input()
n=1
if k =< 9:
    for cnt in range(1,k+1):
        print(cnt)
else:
    for cnt in range(1,10):
        print(cnt)
    for cnt in range(19,19+10*(k-9),10):
        print(cnt)

Submission status: Runtime Error

Solution code:



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99

#for i in range(1,1115):
#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
while tmp < 10**15:
    tmp = tmp+ 10**(len(str((tmp+1)//5))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))


r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])
if len(r_list) < K:
    raise
for i in reversed(r_list[-K:]):
    print(i)

Submission status: Runtime Error

Solution code:



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99

#for i in range(1,1115):
#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
while tmp < 10**15:
    tmp = tmp+ 10**(len(str((tmp+1)//2))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))


r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])
if len(r_list) < K:
    raise
for i in reversed(r_list[-K:]):
    print(i)

Submission status: Runtime Error

Solution code:



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99

#for i in range(1,1115):
#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
for i in range(K*18):
    tmp = tmp+ 10**(len(str(tmp+1))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))
r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])
if len(r_list) < K:
    raise
for i in reversed(r_list[-K:]):
    print(i)

Submission status: Runtime Error

Solution code:



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99

#for i in range(1,1115):
#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
for i in range(K*10):
    tmp = tmp+ 10**(len(str(tmp+1))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))
r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])
if len(r_list) < K:
    raise
for i in reversed(r_list[-K:]):
    print(i)

Submission status: Runtime Error

Solution code:



def n_snuke(n):
    return n /sum(map(int,str(n)))


# (100o+10x+y)/(o+x+y) > (100o+99)/(o+9+9)
#  100o*18+(10x+y)(o+18) > 100o(x+y) +99(o+x+y)


#
#1 - 10 , 19,29,39,49,59,69,79,89,99

#for i in range(1,1115):
#    print(i,n_snuke(i))


K = int(input())
tmp =0

tmp_list = []
for i in range(K*3):
    tmp = tmp+ 30**(len(str(tmp+1))-1)
    tmp_list.append(tmp)
    #print(tmp,n_snuke(tmp))
r_list = [tmp_list[-1]]
for i in reversed(range(len(tmp_list)-1)):
    if n_snuke(r_list[-1]) >= n_snuke(tmp_list[i]):
        r_list.append(tmp_list[i])
if len(r_list) < K:
    raise
for i in reversed(r_list[-K:]):
    print(i)

Submission status: Runtime Error

Solution code:
from fractions import Fraction
from collections import Counter

K = input()
A = range(1, 10) + range(19, 100, 10)
N = K - len(A)
diff = 100
target = 19
count = 0

while N > 0:
    N -= 1
    A.append(A[i]+diff)
    count += 1
    if count == target:
        diff *= 10
        target += 9
        count = 0

for i in xrange(K):
    print A[i]

Submission status: Runtime Error

Solution code:
K = int(input())
sunuke = [1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000, 1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000, 10000000000, 20000000000, 30000000000, 40000000000, 50000000000, 60000000000, 70000000000, 80000000000, 90000000000, 100000000000, 200000000000, 300000000000, 400000000000, 500000000000, 600000000000, 700000000000, 800000000000, 900000000000, 1000000000000, 2000000000000, 3000000000000, 4000000000000, 5000000000000, 6000000000000, 7000000000000, 8000000000000, 9000000000000, 10000000000000, 20000000000000, 30000000000000, 40000000000000, 50000000000000, 60000000000000, 70000000000000, 80000000000000, 90000000000000, 100000000000000, 200000000000000, 300000000000000, 400000000000000, 500000000000000, 600000000000000, 700000000000000, 800000000000000, 900000000000000]
for i in range(K):
    print(sunuke[i])

Submission status: Runtime Error

Solution code:
K = int(input())
sunuke = [1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 20000, 30000, 40000, 50000, 60000, 70000, 80000, 90000, 100000, 200000, 300000, 400000, 500000, 600000, 700000, 800000, 900000, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 10000000, 20000000, 30000000, 40000000, 50000000, 60000000, 70000000, 80000000, 90000000, 100000000, 200000000, 300000000, 400000000, 500000000, 600000000, 700000000, 800000000, 900000000, 1000000000, 2000000000, 3000000000, 4000000000, 5000000000, 6000000000, 7000000000, 8000000000, 9000000000, 10000000000, 20000000000, 30000000000, 40000000000, 50000000000, 60000000000, 70000000000, 80000000000, 90000000000, 100000000000, 200000000000, 300000000000, 400000000000, 500000000000, 600000000000, 700000000000, 800000000000, 900000000000, 1000000000000, 2000000000000, 3000000000000, 4000000000000, 5000000000000, 6000000000000, 7000000000000, 8000000000000, 9000000000000, 10000000000000, 20000000000000, 30000000000000, 40000000000000, 50000000000000, 60000000000000, 70000000000000, 80000000000000, 90000000000000, 100000000000000, 200000000000000, 300000000000000, 400000000000000, 500000000000000, 600000000000000, 700000000000000, 800000000000000, 900000000000000]
for i in range(K)
    print(sunuke[i])

Submission status: Runtime Error

Solution code:
def sunuke_sum(arg):
    sum_digit = 0
    for char in arg:
        sum_digit += int(char)
    return sum_digit


input_num = int(input())

sunuke_list = []
min_sunuke_div = 10 ** 15
for d in reversed(range(1, 14)):
    for n in reversed(range(10, 100)):
        i = n * (10 ** d) + (10 ** d - 1)
        sunuke_div = i / sunuke_sum(str(i))
        if min_sunuke_div >= sunuke_div:
            sunuke_list.append(i)
            min_sunuke_div = sunuke_div

for i in reversed(range(1, 101)):
    sunuke_div = i / sunuke_sum(str(i))
    if min_sunuke_div >= sunuke_div:
        sunuke_list.append(i)
        min_sunuke_div = sunuke_div

sunuke_list.reverse()

for i in range(0, input_num):
    print(sunuke_list[i])

Submission status: Runtime Error

Solution code:
def sunuke_sum(arg: str) -> int:
    sum_digit = 0
    for char in arg:
        sum_digit += int(char)
    return sum_digit


input_num = int(input())

sunuke_list = []
min_sunuke_div = 10 ** 15
for d in reversed(range(1, 14)):
    for n in reversed(range(10, 100)):
        i = n * (10 ** d) + (10 ** d - 1)
        sunuke_div = i / sunuke_sum(str(i))
        if min_sunuke_div >= sunuke_div:
            sunuke_list.append(i)
            min_sunuke_div = sunuke_div

for i in reversed(range(1, 101)):
    sunuke_div = i / sunuke_sum(str(i))
    if min_sunuke_div >= sunuke_div:
        sunuke_list.append(i)
        min_sunuke_div = sunuke_div

sunuke_list.reverse()

for i in range(0, input_num):
    print(sunuke_list[i])

Submission status: Runtime Error

Solution code:
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
k=i1()


x=list(range(1,10))

y=[]
z=[]
for i in range(1,15):
 for j in range(1,10):
  y.append((10**i*(j+1)-1)/(j+i*9))
  z.append(10**i*(j+1)-1)
for i in range(len(z)-1):
  s=z[i]+1
  x.append(z[i])
  while s/sum(list(map(int, list(str(s)))))<=y[i+1]:
        x.append(s)
        s+=1

for i in range(k):
  print(x[i])

Submission status: Runtime Error

Solution code:
k = int(input())
s = 0
a = []
for i in range(1,k+1):
    if i % 9:
        ans = str(i%9) + "9" * (i//9)
    else:
        ans = "9" * (i//9)
    if (i+1) % 9:
        next_ans = str((i+1)%9) + "9" * ((i+1)//9)
    else:
        next_ans = "9" * ((i+1)//9)
    if (int(ans) / i) <= (int(next_ans) / (i // 9 * 9)):
        print(ans)
    s += 1
    if s == k:
        quit()
    if i < 10:
        continue
    if i % 9:
        ans = str(i%9 + 1) + "8" + "9" * (i//9 - 1)
    else:
        ans = "1" + "8" + "9" * (i//9 - 1)
    if (int(ans) / i) <= (int(next_ans) / (i+1)):
        print(ans)
        s += 1
    if s == k:
        quit()

Submission status: Runtime Error

Solution code:

def su(n):
    ans = 0
    while n != 0:
        ans += n % 10
        n = n // 10
    return ans

def sunuke(n):
    s = su(n)
    if s == 0:
        return 0
    return n/s

def hantei(n1,n2):
    if sunuke(n1) <= sunuke(n2):
        return 1
    else:
        return 0

def insert(k):
    ans = [1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99]
    while len(ans) < k:
        p = 3
        q = 0
        while (p-q-3) >= 0:
            n1 = int('1' + '0'*(p-2-q) + '9'*(q+1))
            n2 = int('1' + '0'*(p-3-q) +'1'+ '9'*(q+1))
            while hantei(n1,n2) == 1:
                ans_temp = [num for num in range(n1, n1+1+int(9*pow(10,q+1)),int(pow(10,q+1)))]
                for a in ans_temp:
                    ans.append(a)
                n1 += int(pow(10,p-1))
                n2 += int(pow(10,p-1))
            if (p-3-q) == 0:
                n0 = int('1'+'9'*(p-1))
                ans_temp = [num for num in range(n0, int(pow(10, p), int(pow(10, p-1))))]
                for a in ans_temp:
                    ans.append(a)
            else:
                q += 1
        p += 1
    return ans
k = int(input())
ans = insert(k)
i = 0
while i < k:
    print(ans[i])
    i += 1

Submission status: Runtime Error

Solution code:
def su(n):
    ans = 0
    while n != 0:
        ans += n % 10
        n = n // 10
    return ans

def sunuke(n):
    s = su(n)
    if s == 0:
        return 0
    return n/s

def hantei(n1,n2):
    if sunuke(n1) <= sunuke(n2):
        return 1
    else:
        return 0

def insert(k):
    ans = [1,2,3,4,5,6,7,8,9,19,29,39,49,59,69,79,89,99]
    while len(ans) < k:
        p = 3
        q = 0
        while (p-q-3) >= 0:
            n1 = int('1' + '0'*(p-2-q) + '9'*(q+1))
            n2 = int('1' + '0'*(p-3-q) +'1'+ '9'*(q+1))
            while hantei(n1,n2) == 1:
                ans_temp = [num for num in range(n1, n1+1+int(9*pow(10,q+1)),int(pow(10,q+1)))]
                for a in ans_temp:
                    ans.append(a)
                n1 += int(pow(10,p-1))
                n2 += int(pow(10,p-1))
            if (p-3-q) == 0:
                n0 = int('1'+'9'*(p-1))
                ans_temp = [num for num in range(n0, int(pow(10, p), int(pow(10, p-1))))]
                for a in ans_temp:
                    ans.append(a)
            else:
                q += 1
        p += 1
    return ans
k = int(input())
ans = insert(k)
i = 0
while i < k:
    print(ans(i))
    i += 1

Submission status: Runtime Error

Solution code:
def main():
    maxi = 0
    k = int(input())
    for i in range(1, 10):
        k -= 1
        print(i)
        if not k:
            return
    for i in range(1000000000000000):
        for j in range(1, 10 * i):
            tmp = int(str(j) + str('9' * i))
            if maxi < tmp:
                maxi = tmp
            else:
                continue
            k -= 1
            print(tmp)
            if not k:
                return
        maxi = [int(i) for i in str(maxi)]
        index = 0
        for j in range(len(maxi)):
            if maxi[j] != 9:
                index = j
        maxi = int("".join(map(str, maxi)))

        for i in range(1, int(9 * index) * 10 + 1):
            tmp = str(i) + "" * len(str(maxi))
            if tmp > maxi:
                maxi = tmp
                print(maxi)
        # while maxi[0] < 9:
        #     index = 0
        #     for j in range(len(maxi)):
        #         if maxi[j] != 9:
        #             index = j
        #     maxi[index] += 1
        #     k -= 1
        #
        #     print("".join(map(str, maxi)))
        #     if not k:
        #         return
        # maxi = int("".join(map(str, maxi)))
        # for j in range(i, 10):
        #     if i <= 1:
        #         break
        #     tmp = int(str(j) + str('9' * (2 * i - 1)))
        #     if maxi < tmp:
        #         maxi = tmp
        #     else:
        #         continue
        #     k -= 1
        #     print(tmp)


main()

Submission status: Runtime Error

Solution code:
k = int(input())
kosuu = [9,9,10]
for i in range(2,11):
	kosuu.append((10-i)+10*i)
kosuu.append(100)
kosuu.append(200)

ans = []
counter = 0
i = 0
while counter < k:
	if i == 0:
		for e in range(1,kosuu[i]):
			ans.append(e)
		counter += 8
		i += 1
	elif i <= 10:
		first = (i-1)*(10**i)+(10**i)-1
		print(i,first)
		for e in range(kosuu[i]):
			ans.append(first+e*10**i)
		counter += kosuu[i]
		i += 1
	elif i == 11:
		first = 199999999999
		for e in range(kosuu[i]):
			ans.append(first+e*10**i)
		counter += kosuu[i]
		i += 1
	elif i == 12:
		first = 10999999999999
		for e in range(kosuu[i]):
			ans.append(first+e*10**i)
		counter += kosuu[i]
		i += 1
	print(ans)
for s in range(k):
	print(ans[s])

Submission status: Runtime Error

Solution code:
K = int(input())
c = [9, 9, 19, 28, 37, 46, 55, 64, 73, 82, 91]
inc = 1
idx = 0
res = 0
for i in range(1, K+1):
	res += inc
	c[idx] -= 1
	if c[idx] == 0:
		idx += 1
		inc *= 10		
	print(res)

Submission status: Runtime Error

Solution code:
K = int(input())
c = [9, 9, 19, 28, 37, 46, 55, 64, 73, 82, 91]]
inc = 1
idx = 0
res = 0
for i in range(1, K+1):
	res += inc
	c[idx] -= 1
	if c[idx] == 0:
		idx += 1
		inc *= 10		
	print(res)

Submission status: Runtime Error

Solution code:
ans_array.append(1899999999)
ans_array.append(2899999999)
ans_array.append(3899999999)
ans_array.append(4899999999)
ans_array.append(5899999999)
ans_array.append(6899999999)
ans_array.append(7899999999)
ans_array.append(8899999999)
ans_array.append(9899999999)

ans_array.append(18999999999)
ans_array.append(28999999999)
ans_array.append(38999999999)
ans_array.append(48999999999)
ans_array.append(58999999999)
ans_array.append(68999999999)
ans_array.append(78999999999)
ans_array.append(88999999999)
ans_array.append(98999999999)

Submission status: Runtime Error

Solution code:
def dig(n):
    n = str(n)
    d = 0
    for i in range(len(n)):
        d += int(n[i])
    return d

def snk(n):
    return n/dig(n)
d = {}

for i in range(1,10):
    d[i] = i
    d[i+9] = 10*i+9
    d[i+18] = 100*i+99

l = []
for i in range(len(d)):
    l.append(d[i+1])

for j in range(3,15):
    q = 10**(j-1)-1
    for i in range(10,100):
        if snk(i*10**(j-1)+q) <= snk(i//10*10**j+10*q+9):
            l.append(i*10**(j-1)+q)

K = int(input())
for i in range(K):
    print(l[i])

Submission status: Runtime Error

Solution code:

K = int(input())
aaa = 1
ans_array = []

def sunuke(n):
    re = 0
    tmp = n
    while n:
        re += n % 10
        n = n//10
    re = tmp/re
    print(re)

def print_sunuke():
    global aaa
    num = aaa % 10
    if num == 0:
        aaa += 1
        print_sunuke()
        return
    nine = aaa // 10
    ans = str(num) + "9" * nine
    aaa += 1
    ans_array.append(int(ans))




for i in range(500):

    print_sunuke()

ans_array.append(1899)

ans_array.sort()

for i in range(K):
    print(ans_array[i])

Submission status: Runtime Error

Solution code:

K = int(input())
aaa = 1
ans_array = []

def sunuke(n):
    re = 0
    tmp = n
    while n:
        re += n % 10
        n = n//10
    re = tmp/re
    print(re)

def print_sunuke():
    global aaa
    num = aaa % 10
    if num == 0:
        aaa += 1
        print_sunuke()
        return
    nine = aaa // 10
    ans = str(num) + "9" * nine
    aaa += 1
    ans_array.append(int(ans))




for i in range(200):

    print_sunuke()

ans_array.append(1899)

ans_array.sort()

for i in range(K):
    print(ans_array[i])

Submission status: Runtime Error

Solution code:

K = int(input())
aaa = 1
ans_array = []

def sunuke(n):
    re = 0
    tmp = n
    while n:
        re += n % 10
        n = n//10
    re = tmp/re
    print(re)

def print_sunuke():
    global aaa
    num = aaa % 10
    if num == 0:
        aaa += 1
        print_sunuke()
        return
    nine = aaa // 10
    ans = str(num) + "9" * nine
    aaa += 1
    ans_array.append(int(ans))




for i in range(130):

    print_sunuke()

ans_array.append(1899)

ans_array.sort()

for i in range(K):
    print(ans_array[i])