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: Wrong Answer

Solution code:
from fractions import Fraction
L = []
for i in range(1, 100):
    for j in range(1, 9*i+1):
        if (j-1)//9 >= i-1:
            temp = str(9-(-j%9)) + "9"*(i-1)
        else:
            temp = "1"
            t = j-1
            for rest in range(i-1, 0, -1):
                if t <= 9*(rest-1):
                    temp += "0"
                else:
                    temp += str(t-9*(rest-1))
                    t = 9*(rest-1)
        L.append((int(temp), j))
L.sort(reverse=True)
A = []
m = float("inf")
for l, k in L:
    if Fraction(l, k) <= m:
        A.append(l)
        m = Fraction(l, k)
k = int(input())
for i in range(k):
    print(A.pop())

Submission status: Wrong Answer

Solution code:
def sum_of_num(num_10):
    if num_10 < 10:
        return num_10
    str_num = str(num_10)
    str_num = list(str_num)
    s_ = ''.join(str_num[:len(str_num)//2])
    _s = ''.join(str_num[len(str_num)//2:])
    return sum_of_num(int(s_)) + sum_of_num(int(_s))



K = int(input())
cnt = 0
ans = 0
for i in range(15):
    for j in range(9):
        ans += 10 ** i
        print(ans)
        cnt += 1
        if cnt == K:
            break
    else:
        continue
    break

Submission status: Wrong Answer

Solution code:
K = int(input())

for i in range(1, K + 1):
    X = i
    N = ""
    while X:
        num = min(9, X)
        X -= num
        N += str(num)
    print(N[::-1])

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


k = int(input())
# k = 10**6
def sub(i):
    return i/sum(int(c) for c in str(i))
# h = []
# for i in range(1, k+1):
#     s = sub(i)
#     while h and h[-1][1]>s:
#         h.pop()
#     h.append((i,s))
# h
ans = []
for i in range(1,17):
    if i in (1,2,3):
        nums = list(range(1, 10))
    else:
        nums = list(range(1, 9+10*(i-3)))
    l = [int(str(v)+"9"*(i-len(str(v)))) for v in nums]
    l = sorted(list(set(l)))
#     print(set(l) & set(ans))
    ans.extend(l)
    if len(ans)>k:
        break
write("\n".join(map(str, ans[:k])))

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


k = int(input())
# k = 10**6
def sub(i):
    return i/sum(int(c) for c in str(i))
# h = []
# for i in range(1, k+1):
#     s = sub(i)
#     while h and h[-1][1]>s:
#         h.pop()
#     h.append((i,s))
# h
ans = []
for i in range(1,17):
    if i in (1,2,3):
        nums = list(range(1, 10))
    else:
        nums = list(range(9+10*(i-3)))
    l = [int(str(v)+"9"*(i-len(str(v)))) for v in nums]
    l = sorted(list(set(l)))
    ans.extend(l)
    if len(ans)>k:
        break
write("\n".join(map(str, ans[:k])))

Submission status: Wrong Answer

Solution code:
# snuke numbers
K = int(input())
# S(x) == Mとなる　ｘが存在するならば x=1y9999...99のパターんのみ


def optimize(M):
    if 1 <= M <= 9:
        return M
    Left = M-1
    ans = 1
    u, v = divmod(M-1, 9)
    if v == 0:
        return int(str(ans)+"9"*u)
    else:
        if ans+v > 9:
            return int(str(ans)+str(v)+"9"*u)
        else:
            return int(str(v+ans)+"9"*u)


Answer = []
Possible_answer = [(i, optimize(i), optimize(i)/i) for i in range(1, 1001)]
Possible_answer.sort(key=lambda x: x[-1])
for i in range(1000):
    index, number = Possible_answer[i][0], Possible_answer[i][1]
    should_be_added = True
    for j in range(i):
        if Possible_answer[j][1] > number:
            should_be_added = False
            break
    if should_be_added:
        Answer.append(number)
Answer.sort()
for x in Answer[:K]:
    print(x)

Submission status: Wrong Answer

Solution code:
# snuke numbers
K = int(input())
# S(x) == Mとなる　ｘが存在するならば x=1y9999...99のパターんのみ


def optimize(M):
    if 1 <= M <= 9:
        return M
    Left = M-1
    ans = "1"
    u, v = divmod(M-1, 9)
    if v == 0:
        return int(ans+"9"*u)
    else:
        return int(ans+str(v)+"9"*u)


Answer = []
Possible_answer = [(i, optimize(i), optimize(i)/i) for i in range(1, 1001)]
Possible_answer.sort(key=lambda x: x[-1])
for i in range(1000):
    index, number = Possible_answer[i][0], Possible_answer[i][1]
    should_be_added = True
    for j in range(i):
        if Possible_answer[j][1] > number:
            should_be_added = False
            break
    if should_be_added:
        Answer.append(number)
Answer.sort()
for x in Answer[:K]:
    print(x)

Submission status: Wrong Answer

Solution code:
def F(x):
    return x / sum(int(c) for c in str(x))

"""
for i in range(1, 100000): 
    if i > 10 and i % 10 != 9: continue
    if all(F(i) <= F(j) for j in range(i, 1 + int("9" * len(str(i))))):
        print(i)  
"""
K = int(input())

S = set()
for i in range(9): 
    S.add(i+1)

digits = 2
while len(S) < K:

    i = min(range(digits), key=lambda i: F(int("1"+"0"*(digits-i-1)+"9"*i)))

    # print(digits, i)
    S.add(int("9" * digits))
    for x in range(i, digits):
        for y in range(9): 
            if x + 1 == digits:
                S.add(int(str(y) + "9" * x))
            else:
                S.add(int("1" + "0" * (digits-x-2) + str(y) + "9" * x))
    digits += 1
S = sorted(S)
for i in range(K): print(S[i])

Submission status: Wrong Answer

Solution code:
"""
def F(x):
    return x / sum(int(c) for c in str(x))

for i in range(1, 12000): 
    if all(F(i) <= F(j) for j in range(i, 12000)):
        print(i, F(i))
"""
K = int(input())

S = set()
for i in range(9): 
    S.add(i+1)
    S.add((i+1)*10+9)

c = 2
while len(S) < K:
    for i in range(1, 19): 
        S.add(int(str(i) + "9" * c))
    c += 1
S = sorted(S)
for i in range(K): print(S[i])

Submission status: Wrong Answer

Solution code:
k=int(input())
ans=[0]*10
if k<10:
  for i in range(1,k):print(i)
if k>=10:
  for i in range(1,10):
    ans[i]=i
    print(i)
  k-=9
  i=1
  while k>0:
    ans[i]=ans[i]*10+9
    print(ans[i])
    i+=1
    if i==10:
      i=1
    k-=1

Submission status: Wrong Answer

Solution code:
k=int(input())
if k<10:
  for i in range(1,k):print(i)
if k>=10:
  for i in range(1,10):print(i)
  k-=9
  i=1
  while k>0:
    print(i*10+9)
    i+=1
    k-=1

Submission status: Wrong Answer

Solution code:

import math

def input_num():
	ls = input().strip().split(" ")
	return [int(e) for e in ls]

k, = input_num()
if k < 10:
	for i in range(k):
		print(i+1)
else:
	for i in range(9):
		print(i+1)
	for i in range(k-9):
		print(19+i*10)

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 150):
    for j in range(1, 17):
        if str(i)[-1] == '9':
            continue
        snuke.append(int(str(i)+str(10**j-1)))
snuke.sort()
ans = []
m = (10**17-1)/(9*17)
for s in snuke[::-1]:
    t = sum(map(int, list(str(s))))
    if m>=s/t:
        ans.append(s)
        m = s/t
ans = list(reversed(ans))
print(*ans[:k])

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 150):
    for j in range(1, 16):
        if str(i)[-1] == '9':
            continue
        snuke.append(int(str(i)+str(10**j-1)))
snuke.sort()
ans = []
m = 10**16-1/(9*16)
for s in snuke[::-1]:
    t = sum(map(int, list(str(s))))
    if m>=s/t:
        ans.append(s)
        m = s/t
ans = list(reversed(ans))
print(*ans[:k])

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 150):
    for j in range(1, 16):
        snuke.append(int(str(i)+str(10**j-1)))
snuke.sort()
ans = []
m = 10**16-1/(9*16)
for s in snuke[::-1]:
    t = sum(map(int, list(str(s))))
    if m>=s/t:
        ans.append(s)
        m = s/t
ans = list(reversed(ans))
print(*ans[:k])

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(2, 20):
    for j in range(11, 10*(i-2)+1):
        snuke.append(j*10**(i-2)-1)
    for j in range(max(2, i-1), 11):
        snuke.append(10**(i-1)*j-1)
print(*snuke[:k], sep = '\n')

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(2, 18):
    for j in range(11, 10*(i-2)+1):
        snuke.append(j*10**(i-2)-1)
    for j in range(max(2, i-1), 11):
        snuke.append(10**(i-1)*j-1)
print(*snuke[:k])

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(2, 17):
    for j in range(11, 10*(i-2)+1):
        snuke.append(j*10**(i-2)-1)
    for j in range(max(2, i-1), 11):
        snuke.append(10**(i-1)*j-1)
print(*snuke[:k])

Submission status: Wrong Answer

Solution code:
k = int(input())
snuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(1, 17):
    for j in range(2, 11):
        snuke.append(10**i*j-1)
print(*snuke[:k])

Submission status: Wrong Answer

Solution code:
K = int(input())
ans = [10**15]
c = 10**15-1
s = 10**15

for i in range(11,0,-1):
    c = 10**i - 1
    for j in range(999,99,-1):
        C = j * (10**i) + c
        S = C/sum(list(map(int, str(C))))
        if S <= s:
            ans.append(C)
            s = S
for i in range(1,10):
    ans += [i,i*10+9,i*100+99]
ans.sort()    
if K > len(ans):
    K = len(ans)
for i in range(K):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
k = int(input())
f = 1
for _ in range(k//9):
  for i in range(1, 10):
    print(10**(f-1)*(i+1)-1)
  f += 1
for i in range(1, k%9+1):
  print(10**(f-1)*(i+1)-1)

Submission status: Wrong Answer

Solution code:
K = int(input())
S = "1"
for i in range(K):
  print(S)
  if len(str(S)) <= 3:
    if int(S[0]) != 9:
      n = int(S[0]) + 1
      S = str(n) + S[1:]
    else:
      S = "1" + S[:]
  else:
    m = len(str(S))
    n = int(S[:2]) + 1
    S = str(n) + (m - 2) * "9"

Submission status: Wrong Answer

Solution code:
K = int(input())
S = "1"
for i in range(K):
  print(S)
  if len(str(S)) <= 3:
    if int(S[0]) != 9:
      n = int(S[0]) + 1
      S = str(n) + S[1:]
    else:
      S = "1" + S[:]
  else:
    m = len(str(S))
    n = int(S[:2]) + 1
    S = str(n) + (m - 2) * "9"
print(2099/21, 2199/22, 2999/29)

Submission status: Wrong Answer

Solution code:
K = int(input())
A = []
for i in range(1, K+1):
  S = 0
  d = 1
  j = i
  while i != 0:
    if i < 9:
      S += d * i
      i -= i
    else:
      S += d * 9
      i -= 9
    d *= 10
  A.append(S/j)
  print(S)

Submission status: Wrong Answer

Solution code:
K = int(input())
S = "1"
for i in range(K):
  print(S)
  if len(str(S)) <= 2:
    if int(S[0]) != 9:
      n = int(S[0]) + 1
      S = str(n) + S[1:]
    else:
      S = "1" + S[:]
  else:
    m = len(str(S))
    n = int(S[:2]) + 1
    S = str(n) + (m - 2) * "9"

Submission status: Wrong Answer

Solution code:
K = int(input())
S = "1"
for i in range(K):
  print(S)
  if len(str(S)) <= 2:
    if int(S[0]) != 9:
      n = int(S[0]) + 1
      S = str(n) + S[1:]
    else:
      S = "1" + S[:]
  else:
    m = len(str(S))
    n = int(S[:m-2]) + 1
    S = str(n) + "99"

Submission status: Wrong Answer

Solution code:
K = int(input())
S = "1"
for i in range(K):
  print(S)
  if int(S[0]) != 9:
    n = int(S[0]) + 1
    S = str(n) + S[1:]
  else:
    S = "1" + S[:]

Submission status: Wrong Answer

Solution code:
K = int(input())

cnt = 0
for i in range(1, 9):
    print(i)
    cnt += 1
    if cnt == K:
        exit()

t = 1
while True:
    for i in range(1, 10):
        x = i * 10**t
        if t:
            x -= 1
        print(x)
        cnt += 1
        if cnt == K:
            exit()
    t += 1

Submission status: Wrong Answer

Solution code:
from collections import deque
import math

def dig(K):
    k = str(K)
    ans = 0

    for i in k:
        ans += int(i)
    return ans

K = int(input())
m = 0
ans = []

q = deque([[1,1],[2,1]])
now = 1
i = 3

while True:

        i += now   
        
        num = i / dig(i)

        while q[-1][1] > num:
            q.pop()

        q.append([i , num])

        if len(q) > 2 * K:
            break

        if math.log10(q[-1][0] - q[-2][0]) == math.log10(q[-1][0] - q[-2][0]) // 1:
            now = 10 ** (int(math.log10(q[-1][0] - q[-2][0])))

for i in range(K):
    print (q[i][0])

Submission status: Wrong Answer

Solution code:
K = int(input())
m = 0
ans = []

for i in range(18):

    i += 1
    if i == 1:
        ans.append(1)
    elif i <= 9:
        ans.append(i)

    elif i <= 18:
        ans.append(ans[-1] + 10)

    else:
        ans.append(ans[-1] + 10 ** ((i - 19) // 9 + 2 ) )

for i in range(10 ** 3):

    if ans[-1] > 10**15:
        break

    for j in range(19 + 9 * i):
        ans.append(ans[-1] + 10 ** (i + 2))


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

Submission status: Wrong Answer

Solution code:
k=int(input())
for i in range(1,k+1):
  a=i//9
  b=i%9
  print((b+1)*(10**a)-1)

Submission status: Wrong Answer

Solution code:
K = int(input())
ans = list(range(1,10))
k = 9
base = 10
while k <= K:
    for i in range(1,10):
        ans.append(base * i + base-1)
        k += 1
    base *= 10


'''
for i in range(1,K):
    S = str(i)
    d = 0
    for s in S[::-1]:
        d += int(s)
    print(i,i/d)
    '''

for a in ans[:K]:
    print(a)

Submission status: Wrong Answer

Solution code:
k = int(input())
for i in range(1,k+1):
  if i<10:
    print(i)
  elif i%10==9:
    print(i)

Submission status: Wrong Answer

Solution code:
k = int(input())
for i in range(k):
  if i<10:
    print(i)
  elif i%10==9:
    print(i)

Submission status: Wrong Answer

Solution code:
K = int(input())
def solve(K):
    if K< 10:
        for i in range(1, K+1):
            print(i)
    else:
        for i in range(1, 10):
            print(i)
        for i in range(K-9):
            print(9+10*(i+1))
solve(K)

Submission status: Wrong Answer

Solution code:
import math

def snuke(x):
    y=0
    xx=x
    while x!=0:
        y+=x%10
        x=x//10
    return xx/y

a=1
k=int(input())
kaisu=0
incre=1
        
while kaisu<=k:
    before=a
    print(a)
    b=snuke(a)
    if (a+1)%(10*incre)!=0:
        a+=incre
    else:
        a+=1
        b=a
        snukes=[]
        for j in range(int(math.log10(a+1))):
            b+=9*(10**j)
            snukes.append(b)
        #print(snukes)
        snukes2=[]
        for sks in snukes:
            snukes2.append(snuke(sks))
        if len(snukes2)==1:
            a=snukes[0]
        else:
            answer=[]
            for sn2 in range(len(snukes2)-1):
                if snukes2[sn2]<=snukes2[sn2+1]:
                    answer.append(snukes[sn2])
            #print(answer)
            answer.append(snukes[-1])
            a=answer[0]
            incre=a-before
    kaisu+=1

Submission status: Wrong Answer

Solution code:
def main():    
    k = int(input())
    x = ""
    n = 1
    c = 0
    while True:
        snk = str(n)+x
        print(snk)
        c += 1
        if c == k:
            break
        n += 1
        if n == 10:
            n = 1
            x += "9"
        
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
def sunuke(n):
    m = sum([int(i) for i in list(str(n))])
    s = n/m
    return(s)

o = [1,2,3,4,5,6,7,8,9,19]
if n <= 10:
    for i in range(n):
        print(o[i])
else:
    while len(o) < n:
        n1 = [int(i) for i in list(str(o[-1]))]
        if n1[0] < 9:
            n1[0] = n1[0]+1
            n2 = n1
        else:
            n1[0] = 9
            n2 = [1]
            for i in n1:
                n2.append(i)
        n3 = int("".join(list(map(str, n2))))
        o.append(n3)

    for i in range(n):
        print(o[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
def sunuke(n):
    m = sum([int(i) for i in list(str(n))])
    s = n/m
    return(s)

o = [1,2,3,4,5,6,7,8,9,19]
for i in o:
    print(i)
while len(o) < n:
    n1 = [int(i) for i in list(str(o[-1]))]
    if n1[0] < 9:
        n1[0] = n1[0]+1
        n2 = n1
    else:
        n1[0] = 9
        n2 = [1]
        for i in n1:
            n2.append(i)
    n3 = int("".join(list(map(str, n2))))
    o.append(n3)
    print(n3)

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(1,min(10,n)):
	print(i)
n-=9
num=19
def dsum(i):
	ret=0
	while i:
		ret+=i%10
		i/=10
	return ret
while n:
	if num*dsum(num+10) < (num+10)*dsum(num):
		print(num)
		n=n-1
	num=num+10

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(1,min(10,n)):
	print(i)
n-=9
num=19
def dsum(i):
	ret=0
	while i:
		ret+=i%10
		i/=10
	return ret
while n:
	if num*dsum(num+10) < (num+10)*dsum(num):
		print(num)
	n,num=n-1,num+10

Submission status: Wrong Answer

Solution code:
n=int(input())
for i in range(1,min(10,n)):
	print(i)
n-=9
num=9
while n:
	num+=10
	print(num)
	n-=1

Submission status: Wrong Answer

Solution code:
K = int(input())
snuke = ""
i = 0
while True:
  snuke = str(i % 9 + 1) + "9" * (i // 9)
  if i >= K:
    break
  print(snuke)
  i += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
snuke = ""
i = 1
while True:
  snuke = str(i % 10) + "9" * (i // 10)
  if snuke[0] == "0":
    i += 1
    continue
  if int(snuke) >= K:
    break
  print(snuke)
  i += 1

Submission status: Wrong Answer

Solution code:
k=int(input())
for i in range(min(9,k)):print(i+1)
a=19
for i in range(k-9):
  print(a)
  if a%9==0:a=2*a+1
  else:a+=10**(len(str(a))-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def S(i):
    s = 0
    j = i
    while j:
        s += j%10
        j //= 10
    return i / s
K = int(input())
x, r = K // 9, K % 9
for i in range(1, min(10, K+1)):
    print(i)
for i in range(1, x):
    for j in range(1, 10):
        print(str(j)+'9'*i)
if K > 9:
    for i in range(1, r+1):
        print(str(i)+'9'*x)

Submission status: Wrong Answer

Solution code:
K=int(input())
x=0
y=0
for i in range(K):
    x+=1
    if x==10:
        x=1
        y+=1
    print(str(x)+'9'*y)

Submission status: Wrong Answer

Solution code:
k=int(input())
ans=[2,3,4,5,6,7,8,9,]
for i in range(1,1000):
    for j in range(1,10):
        ans.append(10**i*j)
for ii in range(k):
    print(ans[ii]-1)

Submission status: Wrong Answer

Solution code:
K = int(input())

cnt = 0
num = 0
for i in range(K):
    ans = str(i % 9 + 1) + "9" * num
    print(ans)
    cnt += 1
    if cnt % 9 == 0:
        num += 1

Submission status: Wrong Answer

Solution code:
pl=[1,2,3,4,5,6,7,8]
for i in range(1,20):
    for j in range(1000):
        z = j*(10**i)+(10**i-1)
        if z not in pl:
            pl.append(z)
pl.sort()
ql=[]
for v in pl:
    p = v
    s = 0
    for j in range(1000):
        s+=p%10
        p//=10
        if (p==0):
            break
    ql.append(v/s)



gl=[]
sm=100000000000
for i in range(len(pl)-1,-1,-1):
    if ql[i]<=sm:
        gl.append(pl[i])
    sm = min(ql[i],sm)
gl.reverse()

[ print(it) for it in gl[:int(input())] ]

Submission status: Wrong Answer

Solution code:
pl=[]
for i in range(1,20):
    for j in range(1000):
        z = j*(10**i)+(10**i-1)
        if z not in pl :
          pl.append(z)
pl.sort()
ql=[]
for v in pl:
    p = v
    s = 0
    for j in range(1000):
        s+=p%10
        p//=10
        if (p==0):
            break
    ql.append(v/s)

gl=[]
sm=100000000000
for i in range(len(pl)-1,-1,-1):
    if ql[i]<=sm:
        gl.append(pl[i])
    sm = min(ql[i],sm)
gl.extend([8,7,6,5,4,3,2,1])
gl.reverse()

for v in gl[:int(input())]:
  print (v)

Submission status: Wrong Answer

Solution code:
pl=[]
for i in range(1,20):
    for j in range(1000):
        z = j*(10**i)+(10**i-1)
        pl.append(z)
pl.sort()
ql=[]
for v in pl:
    p = v
    s = 0
    for j in range(1000):
        s+=p%10
        p//=10
        if (p==0):
            break
    ql.append(v/s)

gl=[]
sm=100000000000
for i in range(len(pl)-1,-1,-1):
    if ql[i]<sm:
        gl.append(pl[i])
    sm = min(ql[i],sm)
gl.extend([8,7,6,5,4,3,2,1])
gl.reverse()

for v in gl[:int(input())]:
  print (v)

Submission status: Wrong Answer

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

def f(x):
    a=str(x)
    num=0
    for s in a:
        num+=int(s)
    return x/num
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]
L=set(L)
for i in range(4,16):
    for j in range(10,1000):
        s=str(j)+'9'*(i-2)
        L.add(int(s))
L=list(L)
print(len(L))
L.sort()
for j in range(len(L)):
    flag=True
    for k in range(j+1,len(L)):
        if L[k]/L[j]>20:
            break
        if f(L[j])>f(L[k]):
            flag=False
            break
    if flag:
        print(L[j])
        K=K-1
    if K==0:
        sys.exit()

Submission status: Wrong Answer

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

def f(x):
    a=str(x)
    num=0
    for s in a:
        num+=int(s)
    return x/num
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]
L=set(L)
for i in range(4,16):
    for j in range(10,100):
        s=str(j)+'9'*(i-2)
        L.add(int(s))
L=list(L)
L.sort()
for j in range(len(L)):
    flag=True
    for k in range(j+1,len(L)):
        if L[k]/L[j]>20:
            break
        if f(L[j])>f(L[k]):
            flag=False
            break
    if flag:
        print(L[j])
        K=K-1
    if K==0:
        sys.exit()

Submission status: Wrong Answer

Solution code:
k = int(input())
r = 0  # 桁数
snuke_list = []

def snuke(num):
    s = 0
    for i in str(num):
        s += int(i)
    return num/s

def snuke_check(num):
    n = str(num)
    keta = len(n)    # numの桁数
    min_snuke = int(n[0] + '9'*(keta-1))
    if snuke(num) <= snuke(min_snuke):
        return True
    else:
        return False

count = 0
while count < 2*k:
    for t in range(1, 150):
        num = int(str(t) + '9' * r)
        if snuke_check(num) is True:
            if num not in snuke_list:
                snuke_list.append(num)
                count += 1
        if count >= 2*k:
            break
    r += 1
snuke_list.sort()
check = []
for n in snuke_list:
    check.append(snuke(n))
for i in range(len(check)):
    if check[i] <= min(check[i:]):
        pass
    else:
        snuke_list[i] = -1

for i in range(k):
    if snuke_list[i] > 0:
        print(snuke_list[i])

Submission status: Wrong Answer

Solution code:
k = int(input())
r = 0  # 桁数
snuke_list = []

def snuke(num):
    s = 0
    for i in str(num):
        s += int(i)
    return num/s

def snuke_check(num):
    n = str(num)
    keta = len(n)    # numの桁数
    min_snuke = int(n[0] + '9'*(keta-1))
    if snuke(num) <= snuke(min_snuke):
        return True
    else:
        return False

count = 0
while count < k:
    for t in range(1, 150):
        num = int(str(t) + '9' * r)
        if snuke_check(num) is True:
            snuke_list.append(num)
            count += 1
        if count >= k:
            break
    r += 1

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

Submission status: Wrong Answer

Solution code:
k = int(input())
t = 1  # 最上位桁の値
r = 0  # 桁数

for i in range(k):
    num = int(str(t) + '9' * r)
    if t == 9:
        r += 1
        t = 0
    t += 1
    print(num)

Submission status: Wrong Answer

Solution code:
k = int(input())

def snuke(num):
    s = 0
    for i in str(num):
        s += int(i)
    return num/s

def snuke_check(num):
    n = str(num)
    keta = len(n)    # numの桁数
    min_snuke = int(n[0] + '9'*(keta-1))
    if snuke(num) <= snuke(min_snuke):
        return True
    else:
        return False

count = 0
numbers = 1
while count < k:
    if snuke_check(numbers) is True:
        print(numbers)
        count += 1
    numbers += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

def sunuke(num):
    s = 0
    for n in str(num):
        s += int(n)
    return num/s

sk = sunuke(k)
number = 1
count = 0
while count < k:
    if number > k:
        if sunuke(number) >= sk:
            print(number)
            count += 1
    elif number < k:
        if sunuke(number) <= sk:
            print(number)
            count += 1
    number += 1

Submission status: Wrong Answer

Solution code:
K=int(input())

arr=[1,2,3,4,5,6,7,8,9]
sn = 9
for i in range(1,K+1):
    if i < 10:
        print(arr[i-1])
    else:
        sn += 10
        while str(sn).find('0') > 0: sn += 10
        print(sn)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
K = int(input())
d = collections.deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])
while K > 0:
    d.append(d[0] +'9')
    print(d.popleft())
    K -= 1

Submission status: Wrong Answer

Solution code:

import sys
stdin = sys.stdin

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


k = ni()

m = k // 9
n = k % 9

for i in range(m):
  for j in range(1,10):
    print(str(j)+'9'*i)
    
for l in range(1,n+1):
  print(str(l)+'9'*(m))

Submission status: Wrong Answer

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

def check(n):
    org = n
    total = 0
    while n > 0:
        total += n % 10
        n //= 10
    return org / total

count = 0

def solve(K: int):
    #count = 0

    def p(n):
        global count
        if count >= K:
            sys.exit(0)
        #print(n, check(n))
        print(n)
        count += 1

    for i in range(1, 10):
        p(i)
    for i in range(1, 10):
        tmp = i * 10 + 9
        p(tmp)
    for i in range(1, 13):
        for j in range(1, 10):
            if j < i:
                for k in range(1, 11):
                    tmp = (j * 10 + k) * (10 ** i) - 1
                    p(tmp)
            else:
                tmp = (j * 10 + 10) * (10 ** i) - 1
                p(tmp)
    for j in range(1, 10):
        if j < 2:
            for k in range(1, 101):
                tmp = (j * 100 + k) * (10 ** 12) - 1
                p(tmp)
        else:
            tmp = (j * 100 + 100) * (10 ** 12) - 1
            p(tmp)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


def solve(K: int):
    count = 0
    for i in range(30):
        for j in range(1, 10):
            if count >= K:
                return
            tmp = (j + 1) * (10 ** i) - 1
            print(tmp)
            count += 1
    #print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
A = []
p = 10**18
for i in range(18,1,-1):
  l = max(0,10**(i-2) - 1)
  m = 10**(i-2)
  for j in range(99,9,-1):
    c = l+m*j
    s = c/sum(map(int,str(c)))
    if s <= p:
      A.append(c)
      p = s

for i in range(9,0,-1):A.append(i)
A = A[::-1]
X = int(input())
for i in range(X):print(A[i])

Submission status: Wrong Answer

Solution code:
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]

K = int(input())

ans = 19
now = 10
for i in range(1, K+1):
    if i <= 9:
        print(i)
    elif i == 10:
        print(ans)
    else:
        if str(ans)[0] != "9":
            ans += now
        else:
            now *= 10
            ans = now * 2 - 1
        print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# Luis Yoichi Morales January 2019



K=int(raw_input())
 
s=0
tmp=1
ans=0
A=[]
bfr=0
def func(a):
    sa=str(a)
    tmp=sum(int(s) for s in sa)
    print a, "mm", tmp, ". "
    return float(a)/tmp
 
while(ans<K):
    tmp2=tmp+10**s
    tmp3=tmp+2*10**s
    if func(tmp2) > func(tmp3):
        s+=1
    else:
        print(tmp)
        tmp = tmp2
        bfr=func(tmp)
        ans+=1

Submission status: Wrong Answer

Solution code:
K = int(input())

res = []
for d in range(16):
    n = 10**d
    b = 1
    c = 1
    while b <= n:
        res.append((n, c))
        n += b
        c += 1
        while (n // b) % 10 == 9:
            b *= 10
    res.append((n, c))
res.reverse()
ans = []
p = 10**18; q = 1
for n, c in res:
    if n*q <= p*c:
        ans.append(n)
        p = n; q = c
ans.reverse()
print(*ans[:K], sep='\n')

Submission status: Wrong Answer

Solution code:
k=int(input())
a,b=divmod(k,9)

for i in range(a):
    for j in range(9):
        print((10**i)*(j+2)-1)

for j in range(b):
    print((10**a)*(j+2)-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
lisofi = []
for i in range(1, n):
    print(i)
    lisofi.append(i)
print(n + max(lisofi))

Submission status: Wrong Answer

Solution code:
import sys


def solve(N: int):
    x = 1
    for _ in range(0, 15):
        for j in range(2, 11):
            print(j * x - 1)
            N -= 1
            if not N:
                return
        x *= 10


N = int(sys.stdin.readline())
solve(N)

Submission status: Wrong Answer

Solution code:
def digit_sum(num):
    ds = 0
    while num > 0:
        ds += num % 10
        num //= 10
    return ds


K = int(input())
candidates = []
digit_sums = []
for i in range(15):
    base = 10**i
    for j in range(1, 150):
        candidate = (j + 1) * base - 1
        candidates.append(candidate)
        digit_sums.append(digit_sum(candidate))

snuke_nums = []
smaller_as_snuke = lambda n, m, ds_n, ds_m: True if n * ds_m <= m * ds_n else 0
for i, candidate in enumerate(candidates):
    ds_cand = digit_sums[i]
    for j in range(i, len(candidates)):
        other_num = candidates[j]
        ds_other = digit_sums[j]
        if not smaller_as_snuke(candidate, other_num, ds_cand, ds_other):
            break
    else:
        snuke_nums.append(candidate)

for snuke_num in snuke_nums[:K]:
    print(snuke_num)

Submission status: Wrong Answer

Solution code:
k = int(input())

i = 0
ans = '1'

a = []

while k>i:
    i+=1
    a.append(int(ans))
    if ans[0]=='9':
        ans = '1'+ans
    elif len(ans)>1:
        ans = str(int(ans[0])+1)+ans[1:]
    else:
        ans = str(int(ans[0]) + 1)

b=[]

for i in range(len(a)):
    sn =0
    for j in range(len(str(a[i]))):
        sn += int(str(a[i])[j])
    b.append(a[i]/sn)

for i in range(len(b)):
    if b[i] == min(b[i:]):
        print(a[i])

Submission status: Wrong Answer

Solution code:
k = int(input())

i = 0
ans = '1'

while k>i:
    i+=1
    print(ans)
    if ans[0]=='9':
        ans = '1'+ans
    elif len(ans)>1:
        ans = str(int(ans[0])+1)+ans[1:]
    else:
        ans = str(int(ans[0]) + 1)