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:
k = int(input())

for i in range(0, 15):
    x = 10 ** i
    for j in range(1, 10):
        print(x * (j + 1) - 1)
        k-=1
        if k == 0:
                break

Submission status: Wrong Answer

Solution code:
K = int(input())

res = 0
for i in range(K):
  if res < 9:
    res += 1
    print(res)
  elif res < 90:
    res += 10
    print(res)
  elif res < 900:
    res += 100
    print(res)
  elif res < 9000:
    res += 1000
    print(res)
  elif res < 90000:
    res += 10000
    print(res)

Submission status: Wrong Answer

Solution code:
k = int(input())

if k < 10:
    for x in range(1, k+1):
        print(x)
else:
    for x in range(1, 10):
        print(x)
    for x in range(1, k - 9 + 1):
        print(x * 10 + 9)

Submission status: Wrong Answer

Solution code:
K = int(input())
ans = []
i = 0
digit = 1
while K > 0:
    ans.append((i + 2) * pow(10, digit - 1) - 1)
    i += 1
    if i == 9:
        digit += 1
        i = 0
    K -= 1


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

Submission status: Wrong Answer

Solution code:
def f(n):
    s=str(n)
    return sum([int(s[i]) for i in range(len(s))])

sunuke=[]
for i in range(16):
    for j in range(1,100):
        sunuke.append(j*(10**i)-1)
sunuke=list(set(sunuke))
sunuke.sort()
sunuke.pop(0)
L=len(sunuke)
tmp1,tmp2=sunuke[L-1],f(sunuke[L-1])
ans=[sunuke[L-1]]
for i in range(len(sunuke)-2,-1,-1):
    x=sunuke[i]
    if x*tmp2<=tmp1*f(x):
        ans.append(x)
        tmp1,tmp2=x,f(x)

ans.sort()

    

for i in range(int(input())):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
def f(n):
    s=str(n)
    return sum([int(s[i]) for i in range(len(s))])

sunuke=[]
for i in range(100):
    for j in range(2,11):
        sunuke.append(j*(10**i)-1)
L=len(sunuke)
tmp1,tmp2=sunuke[L-1],f(sunuke[L-1])
ans=[sunuke[L-1]]
for i in range(len(sunuke)-2,-1,-1):
    x=sunuke[i]
    if x*tmp2<=tmp1*f(x):
        ans.append(x)
        tmp1,tmp2=x,f(x)

ans.sort()

    

for i in range(int(input())):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
def f(n):
    s=str(n)
    return sum([int(s[i]) for i in range(len(s))])

sunuke=[]
for i in range(100):
    for j in range(2,11):
        sunuke.append(j*(10**i)-1)
L=len(sunuke)
tmp=sunuke[L-1]/f(sunuke[L-1])
ans=[sunuke[L-1]]
for i in range(len(sunuke)-2,-1,-1):
    x=sunuke[i]/f(sunuke[i])
    if x<=tmp:
        ans.append(sunuke[i])
        tmp=x
ans=ans[::-1]

    

for i in range(int(input())):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
sunuke=[]
for i in range(100):
    for j in range(2,11):
        sunuke.append(j*(10**i)-1)

for i in range(int(input())):
    print(sunuke[i])

Submission status: Wrong Answer

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

for i in range(20):
    for j in range(2,11):
        print(j*10**i+-1)
        k-=1
        if k==0: sys.exit()

Submission status: Wrong Answer

Solution code:
# 「自分よりうしろの配列のうちで自分より小さい値が存在しない」である。
# 試してみたら9までの最高値は9/9=1.0、次の10は1/(1+0)=1.0になる。1.0に近くなるのは19の19/10=0.9
# とおもったらなんかちがうっぽい 19の次は199でその次は299?
k = int(input())
if k < 10:
    for i in range(1, 10):
        print(i)
    exit()
for i in range(1, 10):
    print(i)
print(19)
k -= 10
m = "99"
c = 0
while k > 0:
    c += 1
    print(str(c) + m)
    k -= 1

Submission status: Wrong Answer

Solution code:
# 「自分よりうしろの配列のうちで自分より小さい値が存在しない」である。
# 試してみたら9までの最高値は9/9=1.0、次の10は1/(1+0)=1.0になる。1.0に近くなるのは19の19/10=0.9
k = int(input())
if k < 10:
    for i in range(1, 10):
        print(i)
    exit()
# とりあえず1~9を出力してあとは下1桁が9
for i in range(1, 10):
    print(i)
k -= 9
m = 19
while k > 0:
    print(m)
    m += 10
    k -= 1

Submission status: Wrong Answer

Solution code:
def Snuke(num):
  n = list(str(num))
  l = [int(s) for s in n]
  return sum(int(i) for i in l)

K = int(input())
n = 1

for _ in range(K):
  while True:
    if n/Snuke(n) <= (n+1)/Snuke(n+1):
      print(n)
      n += 1
      break
    n += 1

Submission status: Wrong Answer

Solution code:
K = int(input())

output_num = 1
while K > 0:
  print(output_num)
  output_num += 10**(len(str(output_num+1))-1)
  K -= 1

Submission status: Wrong Answer

Solution code:
K = int(input())

output_num = 1
while K > 0:
  if output_num < 9:
    print(output_num)
    output_num += 1
  else:
    print(output_num)
    output_num += 10
  K -= 1

Submission status: Wrong Answer

Solution code:

import bisect
n=100000

L=[]
for i in range(1,n):
    I=str(i)
    Num=0
    for j in range(len(I)):
        Num+=int(I[j])
    L.append([i/Num,i])
L.sort()
#print(L[:50])

sunu=[]
cnt=0
for i in range(len(L)):
    if L[i][1]>cnt:
        sunu.append(L[i][1])
        cnt=L[i][1]
#print(sunu[:50])

ans=["10","11","12","13","14","15","16","17","18","19","29","39","49","59","69","79","89","99"]
A=27
#print(sunu[27])

IN=int(input())
for N in range(1,IN+1):
    if N<=27:
        print(sunu[N-1])
    else:
        N-=28
        Nine="99"+"9"*(N//18)
        print(ans[N%18]+Nine)
    #print(sunu[N+27])

Submission status: Wrong Answer

Solution code:
SN=[]
for i in range(16):
  for j in range(1, 10):
    SN.append((j+1)*(10**i)-1)

for sn in SN[:int(input())]:
  print(sn)

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def S(n):
    cnt = 0
    for c in str(n):
        cnt += int(c)
    return cnt

def calc_i_to_change(cand):
    '''
    299999
      ^   
    543210
    012345
    return 3
    '''
    l = sum(cand)
    n = int(''.join([str(x) for x in cand]))

    for i in range(len(cand))[::-1]:
        power = len(cand) - i
        k = 10 ** power
        if n - k * l <= 0:
            return len(cand) - 1 - power
    return -1

def main():
    # test = []
    # for i in range(1, 3000000):
    #     test.append((i, i/S(i)))
    #     # print('n: ', i, ' n/s(n): ', i/S(i))
    # test = sorted(test, key=lambda x:x[1])
    # cur_min = 0
    # for t in test:
    #     n, res = t
    #     if n < cur_min:
    #         continue
    #     cur_min = n
    #     print(t)
    K = I()
    num = 0
    n_digit = 1
    cand = [1]
    ans = []

    while K > 0:
        # import pdb
        # pdb.set_trace()

        i_to_change = calc_i_to_change(cand)
        if i_to_change <= 0:
            ans.append(''.join([str(x) for x in cand]))
            K -= 1
        while 0 < i_to_change < n_digit and K > 0:
            for k in range(10):
                cand[i_to_change] = k
                ans.append(''.join([str(x) for x in cand]))
                K -= 1
            i_to_change -= 1
        
        # else:
        #     ans.append(''.join([str(x) for x in cand]))
        #     K -= 1

        if cand[0] < 9:
            cand[0] += 1
        else:
            n_digit += 1
            cand = [1] + [9] * (n_digit - 1)
    for a in ans:
        print(a)
main()

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def S(n):
    cnt = 0
    for c in str(n):
        cnt += int(c)
    return cnt

def calc_i_to_change(cand):
    '''
    299999
      ^   
    543210
    012345
    return 3
    '''
    l = sum(cand)
    n = int(''.join([str(x) for x in cand]))

    for i in range(len(cand))[::-1]:
        power = len(cand) - i
        k = 10 ** power
        if n - k * l <= 0:
            return len(cand) - 1 - power
    return -1

def main():
    # test = []
    # for i in range(1, 3000000):
    #     test.append((i, i/S(i)))
    #     # print('n: ', i, ' n/s(n): ', i/S(i))
    # test = sorted(test, key=lambda x:x[1])
    # cur_min = 0
    # for t in test:
    #     n, res = t
    #     if n < cur_min:
    #         continue
    #     cur_min = n
    #     print(t)
    K = I()
    num = 0
    n_digit = 1
    cand = [1]
    ans = []

    while K > 0:
        # import pdb
        # pdb.set_trace()

        i_to_change = calc_i_to_change(cand)
        if i_to_change <= 0:
            ans.append(''.join([str(x) for x in cand]))
            K -= 1
        while 0 < i_to_change < n_digit and K > 0:
            for k in range(10):
                cand[i_to_change] = k
                ans.append(''.join([str(x) for x in cand]))
                K -= 1
            i_to_change -= 1
        
        # else:
        #     ans.append(''.join([str(x) for x in cand]))
        #     K -= 1

        if cand[0] < 9:
            cand[0] += 1
        else:
            n_digit += 1
            cand = [1] + [9] * (n_digit - 1)
    print(ans)
    for a in ans:
        print(a)
main()

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    K = I()
    num = 0
    n_digit = 1
    i = 0
    while K > 0:
        if i < 9:
            i += 1
        elif i == 9:
            i = 1
            n_digit += 1
        else:
            pass
        print(str(i) + '9' * (n_digit - 1))
        K -= 1

main()

Submission status: Wrong Answer

Solution code:
"""
A = []

def S(x):
  return sum(map(int, str(x)))

def f(d, a, s):
  global A
  if d>=20:
    return True
  if s==0:
    t = int("9"*len(str(a)))
    if a*S(t)<=t*S(a):
      if a<=10**15:
        A += [a]
      return True
    else:
      return False
  for i in range(min(s, 9)+1)[::-1]:
    if not f(d+1, a+i*10**d, s-i):
      return False
  return True

for i in range(1, 9*15+1):
  print i
  f(0, 0, i)

A.sort()
B = []

m = A[-1]
for i in range(len(A))[::-1]:
  if A[i]*S(m)<=m*S(A[i]):
    m = A[i]
    B += [A[i]]
for b in B[::-1]:
  print b
"""

S = [
  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, 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, 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, 519999999, 529999999, 539999999, 549999999, 559999999,
  569999999, 579999999, 589999999, 599999999, 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, 6899999999, 6999999999, 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, 79999999999, 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, 769999999999, 779999999999, 789999999999, 799999999999, 899999999999, 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, 8999999999999, 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, 84999999999999, 85999999999999,
  86999999999999, 87999999999999, 88999999999999, 89999999999999, 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, 999999999999999,
]

K = input()
for s in S[:K]:
  print s

Submission status: Wrong Answer

Solution code:
"""
A = []

def S(x):
  return sum(map(int, str(x)))

def f(d, a, s):
  global A
  if d>=15:
    return False
  if s==0:
    t = int("9"*len(str(a)))
    if a*S(t)<=t*S(a):
      A += [a]
      return True
    else:
      return False
  for i in range(min(s, 9)+1)[::-1]:
    if not f(d+1, a+i*10**d, s-i):
      return False
  return True

for i in range(1, 9*15):
  f(0, 0, i)

A.sort()
B = []
for i in range(len(A)):
  ok = True
  for j in range(i+1, len(A)):
    if A[i]*S(A[j])>A[j]*S(A[i]):
      ok = False
  if ok:
    B += [A[i]]

for b in B:
  print b
"""

S = [
  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, 29999,
  39999, 49999, 59999, 69999, 79999, 89999, 99999, 109999,
  119999, 129999, 139999, 149999, 159999, 169999, 179999, 189999,
  199999, 299999, 399999, 499999, 599999, 699999, 799999, 899999,
  999999, 1099999, 1199999, 1299999, 1399999, 1499999, 1599999, 1699999,
  1799999, 1899999, 1999999, 2999999, 3999999, 4999999, 5999999, 6999999,
  7999999, 8999999, 9999999, 10999999, 11999999, 12999999, 13999999, 14999999,
  15999999, 16999999, 17999999, 18999999, 19999999, 29999999, 39999999, 49999999,
  59999999, 69999999, 79999999, 89999999, 99999999, 109999999, 119999999, 129999999,
  139999999, 149999999, 159999999, 169999999, 179999999, 189999999, 199999999, 299999999,
  399999999, 499999999, 599999999, 699999999, 799999999, 899999999, 999999999, 1099999999,
  1199999999, 1299999999, 1399999999, 1499999999, 1599999999, 1699999999, 1799999999, 1899999999,
  1999999999, 2999999999, 3999999999, 4999999999, 5999999999, 6999999999, 7999999999, 8999999999,
  9999999999, 10999999999, 11999999999, 12999999999, 13999999999, 14999999999, 15999999999, 16999999999,
  17999999999, 18999999999, 19999999999, 29999999999, 39999999999, 49999999999, 59999999999, 69999999999,
  79999999999, 89999999999, 99999999999, 109999999999, 119999999999, 129999999999, 139999999999, 149999999999,
  159999999999, 169999999999, 179999999999, 189999999999, 199999999999, 299999999999, 399999999999, 499999999999,
  599999999999, 699999999999, 799999999999, 899999999999, 999999999999, 1099999999999, 1199999999999, 1299999999999,
  1399999999999, 1499999999999, 1599999999999, 1699999999999, 1799999999999, 1899999999999, 1999999999999, 2999999999999,
  3999999999999, 4999999999999, 5999999999999, 6999999999999, 7999999999999, 8999999999999, 9999999999999, 10999999999999,
  11999999999999, 12999999999999, 13999999999999, 14999999999999, 15999999999999, 16999999999999, 17999999999999, 18999999999999,
  19999999999999, 29999999999999, 39999999999999, 49999999999999, 59999999999999, 69999999999999, 79999999999999, 89999999999999,
  99999999999999,
]

K = input()

for s in S[:K]:
  print s

Submission status: Wrong Answer

Solution code:
k = int(input())
ii = 1
sn = 1

while k != 0:
  target = ii+1
  dig = len(str(target)) 
  sn1_temp=0
  for jj in range(dig)[::-1]:
    sn1_temp += int(target/10**jj) 
    target -= int(target/10**jj) * 10**jj
  sn1 = (ii+1)/sn1_temp
  
  if sn <= sn1:
    print(ii)
    k -=1
    
  sn = sn1
  sn1=0
  ii += 1

Submission status: Wrong Answer

Solution code:
def s_s(i):
    s = sum(list(map(int, str(i))))
    return s

k = int(input())

i = 1
j = 0

while j < k:
    if i/s_s(i) <= (i+1)/s_s(i+1):
        print(i)
        j += 1

    i += 1

Submission status: Wrong Answer

Solution code:
k=int(input())
res=[]
for i in range(17):
    for j in range(1,10):
        t = j*(10**i)
        if i!=0:
            t+=10**i-1
        res.append(t)
print("\n".join(map(str, res[:k])))

Submission status: Wrong Answer

Solution code:
k=int(input())
res=[]
for i in range(15):
    for j in range(1,10):
        t = j*(10**i)
        if i!=0:
            t+=10**i-1
        res.append(t)
print("\n".join(map(str, res[:k])))

Submission status: Wrong Answer

Solution code:
def main():
    k = int(input())
    gen = generate()
    for _ in range(k):
        print(next(gen))

def generate():
    i = 0
    while True:
        s = "9" * i
        for j in range(1, 10):
            yield str(j) + s
        i += 1

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
m=float("INF")
sunukes=[]
for i in range(7,-1,-1):
    for j in range(1000,10,-1):
        #print(i,j)
        sunuke=j*(100**(2*i))-1
        s=str(sunuke)
        sn=0
        for k in range(len(s)):
            sn+=int(s[k])
        x=sunuke/sn
        #print(sunuke,x)
        if x<=m :
            m=x
            sunukes.append(sunuke)
for i in range(9,0,-1):
    sunukes.append(i)
sunukes=sunukes[::-1]
k=int(input())
#print(sunukes)
for i in range(k):
    print(sunukes[i])

Submission status: Wrong Answer

Solution code:
m=float("INF")
sunukes=[]
for i in range(15,-1,-1):
    for j in range(100,10,-1):
        #print(i,j)
        sunuke=j*(10**i)-1
        s=str(sunuke)
        sn=0
        for k in range(len(s)):
            sn+=int(s[k])
        x=sunuke/sn
        #print(sn,x,i,j,j*10**i-1)
        if x<=m :
            m=x
            sunukes.append(sunuke)
for i in range(9,0,-1):
    sunukes.append(i)
sunukes=sunukes[::-1]
k=int(input())
#print(sunukes)
for i in range(k):
    print(sunukes[i])

Submission status: Wrong Answer

Solution code:
m=float("INF")
sunukes=[]
for i in range(15,-1,-1):
    for j in range(100,10,-1):
        #print(i,j)
        sunuke=j*(10**i)-1
        s=str(sunuke)
        sn=0
        for k in range(len(s)):
            sn+=int(s[k])
        x=sunuke/sn
        #print(sn,x,i,j,j*10**i-1)
        if x<=m :
            m=x
            sunukes.append(sunuke)
for i in range(9,0,-1):
    sunukes.append(i)
k=int(input())
#print(sunukes)
print(sunukes[-k])

Submission status: Wrong Answer

Solution code:
K = int(input())
Q = '9'
Ans = ['1','2','3','4','5','6','7','8','9']
AnsP = Ans[:]
k = 1
while len(AnsP) < K:
  Ad = [i+Q*k for i in Ans]
  AnsP += Ad
  k += 1
for i in range(K):
  print(AnsP[i])

Submission status: Wrong Answer

Solution code:
K = int(input())
def f(i):
  return i / sum([int(n) for n in str(i)])
Ans = [1,2,3,4,5,6,7,8]
k = 9
while len(Ans) < K:
  Ans.append(k)
  k += 10
for i in range(K):
  print(Ans[i])

Submission status: Wrong Answer

Solution code:
K = int(input())

P = [n for n in range(1, 10)]
Q = [n for n in range(1, 10)]
for d in range(20):
    for m in range(10, 100):
        P.append(int(str(m)+"9"*d))
        Q.append(m//10+m%10+9*d)

L = len(P)
c = 0
for i, (p, q) in enumerate(zip(P, Q)):
    ok = True
    for j in range(i+1, L):
        np, nq = P[j], Q[j]
        if np*q < nq*p:
            ok = False
            break
    if ok:
        print(p)
        c += 1
    if c == K:
        break


"""
import matplotlib.pyplot as plt

A = []
B = []
for n in range(1, 10**6):
    m = sum([int(s) for s in str(n)])
    A.append(n)
    B.append(n/m)


plt.plot(A, B)
plt.show()
"""

Submission status: Wrong Answer

Solution code:
K = int(input())

L = 10**3
P = []
Q = []
for n in range(1, L+1):
    if n%9 == 0:
        P.append(int("9"*(n//9)))
        Q.append(9*(n//9))
    else:
        P.append(int(str(n%9)+"9"*(n//9)))
        Q.append(n%9 + 9*(n//9))

c = 0
for i, (p, q) in enumerate(zip(P, Q)):
    ok = True
    for j in range(i+1, L):
        np, nq = P[j], Q[j]
        if np*q < nq*p:
            ok = False
            break
    if ok:
        print(p)
        c += 1
    if c == K:
        break


"""
import matplotlib.pyplot as plt

A = []
B = []
for n in range(1, 10**5):
    m = sum([int(s) for s in str(n)])
    A.append(n)
    B.append(n/m)


plt.plot(A, B)
plt.show()
"""

Submission status: Wrong Answer

Solution code:
K = int(input())

for n in range(1, K+1):
    if n%9 == 0:
        print("9"*(n//9))
    else:
        print(str(n%9)+"9"*(n//9))

Submission status: Wrong Answer

Solution code:
k = int(input())
head = 1
wai = 0
for _ in range(k):
    show = str(head) + '9'*wai
    print(int(show))
    
    
    head += 1
    if head == 10:
        head = 1
        wai += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

def calcurate_s(num):
  number = 0
  for i in range(0, len(str(num))):
    number += int(str(num)[i])
  return number

count = 0
m = 2
n = 1
while count < int(k):
  if n / calcurate_s(n) <= m / calcurate_s(m):
    print(n)
    count += 1
    n += 1
    m += 1
  else:
    n += 1
    m += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

def calcurate_s(num):
  number = 0
  for i in range(0, len(str(num))):
    number += int(str(num)[i])
  return number

count = 1
m = 2
n = 1
while count <= int(k):
  if n / calcurate_s(n) <= m / calcurate_s(m):
    print(n)
    count += 1
    n += 1
    m += 1
  else:
    n += 1
    m += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

l = [i for i in range(1,10)]
l[-1] = ""
for i in range(1,k+1):
    p = i // 9
    q = (i - 1) % 9
    print(str(l[q])+str("9"*p))

Submission status: Wrong Answer

Solution code:
k = int(input())

# 関数S(n)
def S(num):
  num = str(num)
  s = 0
  for st in num:
    s += int(st)
  return s

#1~9と〇9のやつだけ出力でよくね？
cnt = 0
n = 0
while cnt < k:
  n += 1
  if 1<=n<=9 or str(n)[-1]=="9":
    print(n)
    cnt += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

# 関数S(n)
def S(num):
  num = str(num)
  s = 0
  for st in num:
    s += int(st)
  return s

cnt = 1
ans_cnt = 0
prev_p = 1/S(1)
while ans_cnt < k:
  cnt += 1
  now_p = cnt/S(cnt)
  if prev_p <= now_p :
    print(cnt-1)
    ans_cnt += 1
  prev_p = now_p

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    k=int(input())
    d=1
    while(True):
        for i in range(1,10):
            print((i+1)*d-1)
            k-=1
            if(k==0): return
        d*=10
resolve()

Submission status: Wrong Answer

Solution code:
K=int(input())
i=1
while i<=min(K,9):
  print(i)
  i+=1
num=9
a=1
while num<K:
  num+=1
  print(str(a)+"9")
  a+=1

Submission status: Wrong Answer

Solution code:
import sys
k=int(input())
if k<=9:
    for i in range(1,k+1):
        print(i)
    sys.exit()
for i in range(1,9):
    print(i)
count=8
s=0
lst=[]
for i in range(1,17):
    for j in range(1,1000):
        if j%10==0:
            continue
        a=j*(10**i)-1
        b=list(str(a))
        c=0
        for u in b:
            c+=int(u)
        if (10**i)*c>=a:
            lst.append(a)
            count+=1
            if count==k:
                s=10
                break
        else:
            break
    if s==10:
        break
lst.sort()
s=1
while s<len(lst):
    if lst[s]==lst[s-1]:
        lst.pop(s)
    else:
        s+=1
for u in lst:
    print(u)

Submission status: Wrong Answer

Solution code:
import sys
k=int(input())
if k<=9:
    for i in range(1,k+1):
        print(i)
    sys.exit()
for i in range(1,9):
    print(i)
count=8
s=0
lst=[]
for i in range(1,16):
    for j in range(1,100):
        if j%10==0:
            continue
        a=j*(10**i)-1
        b=list(str(a))
        c=0
        for u in b:
            c+=int(u)
        if (10**i)*c>=a:
            lst.append(a)
            count+=1
            if count==k:
                s=10
                break
        else:
            break
    if s==10:
        break
lst.sort()
s=1
while s<len(lst):
    if lst[s]==lst[s-1]:
        lst.pop(s)
    else:
        s+=1
for u in lst:
    print(u)