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

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

def func(a):
    s = 0
    for i in str(a):
        s += int(i)
    return a/s

candidate_lst = []
for i in range(18):
    for j in range(1, 150):
         candidate_lst.append(int(str(j) + '9' * i))
candidate_lst = sorted(list(set(candidate_lst)))

count = 0
index = -1
snuke = 1
while count < k:
    min_snuke = 10**100
    for m, i in enumerate(candidate_lst[index+1:]):
        if i > 100*snuke:
            break
        po_snuke = func(i)
        if min_snuke > po_snuke:
            min_snuke = po_snuke
            next_snuke = i
            next_index = m
    print(next_snuke)
    snuke = next_snuke
    index = index + next_index + 1
    count += 1

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

def snuke(n):
    def func(a):
        s = 0
        for i in str(a):
            s += int(i)
        return a/s
    
    len_n = len(str(n))
    min_snu = 10 ** 100
    for i in range(len_n):
        snu = str(n)[:len_n-i] + i * '9'
        func_snu = func(int(snu))
        if min_snu > func_snu:
            min_snu = func_snu
            snukee = int(snu)
            
    return snukee

count = 0
n = 1
while count < k:
    next_snuke = snuke(n)
    print(next_snuke)
    n = next_snuke + 1
    count += 1

Solution (Python):
from math import log10, ceil


def S(n: int) -> int:
    """n を十進法で表した時の各桁のあたいの総和
    :param n: 任意の正の整数
    :return: 十進法の各桁の和
    """
    s = 0
    while n > 0:
        s += n % 10
        n //= 10
    return s


def f(N: int) -> int:
    if N < 10:
        return N

    D = ceil(log10(N) + 1)
    x = 10 * (N // 10 + 1) - 1
    for d in range(1, D + 1):
        td = 10 ** (d + 1)
        nx = td * (N // td + 1) - 1

        if nx / S(nx) < x / S(x):
            x = nx
    return x


if __name__ == "__main__":
    K = int(input())
    N = 1
    for _ in range(K):
        print(N)
        N = f(N+1)

Solution (Python):
inf = 1 << 60
m = inf
i = 10 ** 15 - 1
sunuke = []
while i > 0:
    a=sum(map(int,str(i)))
    b=i/a
    if m >= b:
        
        m = b
        sunuke.append(i)
    for j in range(15,2,-1):
        if i > 10**j:
            i -= 10**(j-3)
            break
    else:
        i -= 1

K=int(input())
for i in range(K):
    print(sunuke[-i-1])

Solution (Python):
t = i = 1
k = int(input()) 
while k:
  if t < i / sum(map(int, list(str(i)))):
    i += 9 * t
    t *= 10
  else:
    print(i)
    i += t
    k -= 1

Solution (Python):
t = i = 1
k = int(input()) 
while k:
  if t < i / sum(map(int, list(str(i)))):
    i += 9 * t
    t *= 10
  else:
    print(i)
    i += t
    k -= 1

Solution (Python):
import sys
K = int(input())
count = 0
nine = ""

arr = []
arr_sunuke = []
for k in range(14):
    for i in range(10):
        for j in range(10):
            for l in range(10):
                if i == 0 and nine != "":
                    pass
                else:
                    arr.append(int(str(i)+str(j)+str(l)+nine))
                    arr_sunuke.append(i + j + l + k*9)
    nine = nine + str(9)

arr.remove(0)
arr_sunuke.remove(0)
arr_sunuke2 = [arr[i]/arr_sunuke[i] for i in range(len(arr))]

ans = []
tmp = 10**15
for i in range(len(arr)-1, -1, -1):
    if arr_sunuke2[i] <= tmp:
        ans.append(arr[i])
        tmp = arr_sunuke2[i]

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

Solution (Python):
import sys

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


def f(n):
  d = 0
  C = [n]
  while S(n) > (10**d / 9*(d+1)):
    c = 10**(d+1) * (n // 10**(d+1) + 1) - 1
    C.append(c)
    d += 1
  Smin = float('inf')
  res = 0
  for c in C:
    if S(c) < Smin:
      Smin = S(c)
      res = c  
  return res


def main():
  input = sys.stdin.readline
  K = int(input())
  ans = 1
  for _ in range(K):
    print(ans)
    ans = f(ans+1)


if __name__ == '__main__':
  main()

Solution (Python):
K = int(input())
n = 1
dn = 1
c = 0
while c < K:
    print(n)
    c += 1
    if (n + dn) > sum(map(int, str(n + dn))) * dn:
        dn *= 10
    n += dn

Solution (Python):
serch_table = []

for i in range(100):
    for j in range(1,1000):
        x = str(j) + '9'*i
        x = int(x)
        serch_table.append(x)


L = []
for i in serch_table:
    l = [x for x in str(i)]
    x = sum(map(int,l))
    l = [i/x,i]
    L.append(l)
L= sorted(L)
M = []
tmp = -1
for i in L:
    if tmp < i[1]:
        M.append(i[1])
        tmp = i[1]

N = int(input())
for i in range(N):
    print(M[i])

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


def dsum(n):
    return sum(list(map(int, str(n))))


def g(n):
    return n / dsum(n)

j = 1
order = 1
for i in range(K):
    print(j)
    if g(j + 10 ** (order - 1)) > g(j + 10 ** order):
        order += 1
    j += 10 ** (order - 1)

Solution (Python):


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

    l = []
    for i in range(1, 1000):
        l.append(i)
    for k in range(1, 13):
        n0 = 10 ** k
        for i in range(100, 1000):
            l.append(i * n0 + n0 - 1)

    r = []
    for n in l:
        sn = 0
        d = n
        while 0 < d:
            d, m = int(d / 10), d % 10
            sn += m
        r.append(n / sn)

    min_r = r[-1]
    for i in range(len(r) - 2, -1, -1):
        if min_r < r[i]:
            r.pop(i)
            l.pop(i)
        else:
            min_r = r[i]

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


if __name__ == '__main__':
    main()

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

def digit_sum(s):
    return sum(map(int, list(s)))

def func1(s):
    return int(s)/digit_sum(s)

def func2(n):
    n = str(n)
    fm, fa = float("inf"), -1
    for i in range(len(n)):
        s = n[:i+1] + "9"*(len(n)-i-1)
        if fm > func1(s):
            fm = func1(s)
            fa = int(s)
    return fa

n = 1
for _ in range(k):
    print(n)
    n = func2(n+1)

Solution (Python):
from collections import deque
k = int(input())

digsum = lambda x: sum(map(int, list(str(x))))
dignorm = lambda x: x/digsum(x)

n = 1
order = 1
while k > 0:
    print(n)
    k -= 1
    if dignorm(n+10**(order-1)) > dignorm(n+10**order):
        order += 1
    n += 10**(order-1)

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


def digit_sum(s):
    return sum([int(i) for i in str(s)])


def f(n):
    n = str(n)
    f_min, f_ans = float('inf'), -1
    for i in range(len(n)):  
        for x in range(int(n[i]), 10):
            s = n[:i] + str(x) + '9' * (len(n) - i - 1)
            if f_min > int(s) / digit_sum(s):
                f_min = int(s) / digit_sum(s)
                f_ans = int(s)
    return f_ans


ans = [1]
for k in range(K - 1):
    ans.append(f(ans[-1] + 1))

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

Solution (Python):
k = int(input())
sunuke_list = [1,2,3,4,5,6,7,8]
def s(n):
    n_charlist = list(str(n))
    return sum(list(map(int, n_charlist)))
def combine_int(i,n):
    i_charlist = list(str(i))
    n_charlist = ['9'] * n
    ret_charlist = i_charlist + n_charlist
    ret_str = ''.join(ret_charlist)
    return int(ret_str)
for n in range(1,14):
    if n >= 12:
        i = n-2
    else:
        i = n-1
    while((i+1)/(s(i)+9*n) <= (i+2)/(s(i+1)+9*n)):
        sunuke_list.append(combine_int(i,n))
        i += 1
for i in range(k):
    print(sunuke_list[i])

Solution (Python):


"""
参考：https://nuekodory.github.io/2018/06/24/AtCoder-ABC101-ARC-099-%E3%82%92-Python3-%E3%81%A7%E8%A7%A3%E3%81%8F/
　　　http://xxxasdfghjk999.hatenablog.jp/entry/2018/07/22/162323
　　　http://drken1215.hatenablog.com/entry/2018/06/24/010600
　　　http://phyllo-algo.hatenablog.com/entry/2018/06/24/160442
・事前にいくつかの範囲を調べて、候補の数がabc9999....のあたりだけだと予測しておく。
・候補の値だけに絞って最大値から下がっていく。
"""

K = int(input())

def make_snk(num):
    s = str(num)
    sm = 0
    for c in s:
        sm += int(c)
    return num / sm

snk_list = []
mn = float('inf')
suff = '999999999999'

for i in range(11):
    
    for j in range(999, 99, -1):
        j = int(str(j) + suff)
        num = make_snk(j)
        if num <= mn:
            snk_list.append(j)
            mn = num
    suff = suff[:-1]

for i in range(9999, 0, -1):
    num = make_snk(i)
    if num <= mn:
        snk_list.append(i)
        mn = num
snk_list.reverse()
for i in range(K):
    print(snk_list[i])

Solution (Python):
from math import log10 as l
s=lambda f:sum(map(int,list(str(f))))
p=lambda a,j:(a//10**(j+1)+1)*10**(j+1)-1
n=int(input())
a=1
for i in range(n):
  print(a)
  if(a<9):
    a+=1
    continue
  a+=1
  k=[p(a,j) for j in range(int(l(a)))]
  o=[p(a,j)/s(p(a,j)) for j in range(int(l(a)))]
  a=k[o.index(min(o))]

Solution (Python):
import math
K=int(input())
k=2
m=0
def D(x):
  s=str(x)
  array=list(map(int,list(s)))
  return sum(array)
N=1
S=1
a=0
print(1)
while k<=K:
  N+=10**a
  S=D(N)
  if a<math.log10(N/S):
    a+=1
    N=(N//10**a+1)*10**a-1
  S=D(N)
  print(N)
  k+=1

Solution (Python):
def f(n):
    return n/sum(map(int,str(n)))

K = int(input())
x = 1
p = 0 
for k in range(K):
    print(x)
    if f(x+10**p) > f(x+10**(p+1)):
        p += 1
    x += 10**p

Solution (Python):
from collections import deque
k = int(input())

digsum = lambda x: sum(list(map(int, list(str(x)))))
dignorm = lambda x: x/digsum(x)

n = 1
order = 1
while k > 0:
    print(n)
    k -= 1
    if dignorm(n+10**(order-1)) > dignorm(n+10**order):
        order += 1
    n += 10**(order-1)

Solution (Python):
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

def ds(n:int):
    return sum([int(i) for i in str(n)])

def snuke(n:int):
    return n/ds(n)

def cands(n:int):
    ret = []
    nl = len(str(n))
    for i in range(nl):
        ret.append(str(n)[:nl-i-1] + "9"*(i+1))
        
    return ret

k = ni()


ans = [i for i in range(1,10)]


cur = 10
while len(ans) < k:
    cand = cands(cur)
    temp = 10**18
    nex = -1
    for c in cand:
        if snuke(int(c)) <= temp:
            temp = snuke(int(c))
            nex = int(c)
            
    ans.append(nex)
    cur = nex+1
    
for ai in ans[:k]:
    print(ai)

Solution (Python):
K = int(input())
def snuke(n):
  _n = n
  S = n % 10
  while _n:
    _n //= 10
    S += _n % 10
  return n / S
cnt = 0
k = 0
x = 1
sx = 2
while cnt < K:
  a = max(k - 1, 1)
  b = max(k, 1) * 10
  c = int('0' + ('9' * k))
  for i in range(a, b):
    y = x
    sy = sx
    x = i * 10 ** k + c
    sx = snuke(x)
    if sx >= sy:
      print(y)
      cnt += 1
      if cnt >= K:
        break
  k += 1

Solution (Python):
def S(i):
    ans = 0
    while i // 10 > 0:
        ans += i % 10
        i //= 10
    ans += i
    return ans

K = int(input())
count, N = 0, 1
while count < K:
    N2, Nd = N, 1
    while N2//10 > 0:
        Nd += 1
        N2 //= 10
    minX, X = N/S(N), N
    for i in range(Nd+2):
        x = (N//10**(i+1) + 1) * 10**(i+1) -1
        if minX > x/S(x):
            minX, X = x/S(x), x
    print(X)
    count += 1
    N = X+1

Solution (Python):
def S(i):
    ans = 0
    while i // 10 > 0:
        ans += i % 10
        i //= 10
    ans += i
    return ans

K = int(input())
Ans, count, N = [], 0, 1
while count < K:
    N2, Nd = N, 1
    while N2//10 > 0:
        Nd += 1
        N2 //= 10
    minX, X = N/S(N), N
    for i in range(Nd+2):
        x = (N//10**(i+1) + 1) * 10**(i+1) -1
        if minX > x/S(x):
            minX, X = x/S(x), x
    Ans.append((minX, X))
    count += 1
    N = X+1

for i in range(K):
    print(Ans[i][1])

Solution (Python):
from math import log10
def nsn(N):
    K = sum( list( map( int, list( str(N)))))
    return N/K

def snuke(N):
    k = int( log10(N))+1
    s = N
    now = nsn(N)
    for d in range(k+1):
        x = (10**(d+1))*(N//(10**(d+1)) + 1) - 1
        y = nsn(x)
        if y < now:
            s = x
            now = y
    return s

K = int( input())
ans = 1
print(1)
for i in range(K-1):
    ans = snuke( ans + 1)
    print(ans)

Solution (Python):
def snk_cal(i):
    snk = i
    i = str(i)
    q = 0
    for j in range(len(i)):
        q += int(i[j])
    snk /= q
    return snk

K = int(input())
if K <= 9:
    for i in range(K):
        print(i+1)
else:
    for i in range(9):
        print(i+1)
    K -= 9
    snk = 9
    while K > 0:
        res = snk+1
        d = len(str(res))
        l = []
        for i in range(d):
            n = int(str(res)[:-i-1]+'9'*(i+1))
            l.append(snk_cal(n))
        i = l.index(min(l))
        snk = int(str(res)[:-i-1]+'9'*(i+1))
        print(snk)
        K -= 1

Solution (Python):
def R(x):
    return x / sum(map(int, str(x)))
K = int(input())
D = 0
l = 0
for i in range(K):
    D += 10**l
    print(D)
    if 10**l < R(D+10**l):
        l += 1

Solution (Python):
def f(x):
    return x / sum(map(int, str(x)))
 
K = int(input()) 
x, y = 1, 1
 
for i in range(K):
    print(x)
    if f(x + y) > f(x + y * 10):
        y *= 10
    x += y

Solution (Python):
import math


def next_sunuke(N):
    D = math.ceil(math.log(N, 10) + 1)
    z = str(N)
    zx = [int(z[:1]) for z in z]
    Z = N / sum(zx)
    ret_val = N
    ret_vals = [ret_val]
    for d in range(0, D):
        x = ((10 ** (d + 1)) * math.floor((N / (10 ** (d + 1))) + 1)) - 1
        w = str(x)
        sx = [int(w[:1]) for w in w]
        y = x / sum(sx)
        if y == Z:
            Z = y
            ret_vals.append(x)
        elif y < Z:
            Z = y
            ret_vals = []
            ret_vals.append(x)
    return min(ret_vals)


K = int(input())
n = 1
for i in range(1, K + 1):
    print(next_sunuke(n))
    n = next_sunuke(n) + 1

Solution (Python):
res = []
for digit in range(1,16):
    if digit<=3:
        for i in range(2,11):
            res.append(10**(digit-1)*i-1)
    elif 4<=digit<=12:
        for i in range(11,(digit-2)*10):
            res.append(i*10**(digit-2)-1)
        for i in range(digit-2,11):
            res.append(i*10**(digit-1)-1)
    elif digit==15:
        for i in range(101,110):
            res.append(i*10**(digit-3)-1)
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
    else:
        for i in range(11,101):
            res.append(i*10**(digit-2)-1)
for i in range(int(input())):
    print(res[i])

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

def S(n):
    return sum(int(c) for c in str(n))
d9 = 0
cnt = 0
upper = 1
while cnt < K:
    n = int(str(upper) + ('9' * d9))
    if n <= S(n) * (10 ** d9):
        print(n)
        cnt += 1
        upper += 1
    else:
        d9 += 1
        upper //= 10

Solution (Python):
K = int(input())
snuke = [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, 999999999999999]
for k in range(K):
    print(snuke[k])

Solution (Python):
def sum_digit(n):
    n_str = str(n)
    ans = 0
    for dig in n_str:
        ans += int(dig)
    return ans

def snuke(n):
    return n / sum_digit(n)

K = int(input())

ans = 1
print(ans)
for i in range(K - 1):
    s = len(str(ans))
    x = snuke(ans)
    L = [[ans + 10 ** k, snuke(ans + 10 ** k)] for k in range(s+1)]
    L.sort(key = lambda x: x[1])
    ans = L[0][0]
    print(ans)

Solution (Python):
import sys 

K = int(input())

if K <= 0:
    sys.exit(0)

step = 1 
snuke = 1 

while K > 0:
    if step < snuke/sum(map(int, str(snuke))):
        snuke += 9 * step
        step *= 10
    else:
        print(snuke)
        snuke += step
        K -= 1

Solution (Python):
t=1
i=1
l=int(input()) 
while l:
  if t<i/sum(map(int,list(str(i)))):
    i+=9*t
    t*=10
  else:
    print(i)
    i+=t
    l-=1

Solution (Python):
import math


def s(n):
	sum = 0
	for c in str(n):
		sum += int(c)
	return sum

k = int(input())
found=0

def next_sunuke(n, s_n, s_n_div):

	global found

	if n == 1:
		return

	log_n = int(math.log(n,10))
	m = n - 10 ** int(log_n // 1.25)

	while m >= 1:
		s_m = s(m)
		s_mplus1 = s(m + 1)

		if (s_m < s_mplus1 or (s_n - s_m != 1 and s_n - s_m != -8 and s_n - s_m != -17)) and m > 9:
			m -= 10 ** int(log_n // 1.25)
			continue

		

		s_m_div = m / s(m)

		if s_m_div <= s_n_div:
			next_sunuke(m, s_m, s_m_div)
			if found >= k:
				return

			found += 1
			
			print(m)
			break


		m -= 10 ** int(log_n // 1.25)



current_sunuke = 999999999999999
s_current_sunuke = s(current_sunuke)
s_current_sunuke_div = current_sunuke / s_current_sunuke


next_sunuke(current_sunuke, s_current_sunuke, s_current_sunuke_div)
if found < k:
	print(current_sunuke)

Solution (Python):
import math


def s(n):
	sum = 0
	for c in str(n):
		sum += int(c)
	return sum

k = int(input())
found=0

def next_sunuke(n, s_n, s_n_div):

	global found

	if n == 1:
		return

	log_n = int(math.log(n,10))
	m = n - 10 ** int(log_n // 1.25)
	

	while m >= 1:
		s_m = s(m)
		s_mplus1 = s(m + 1)

		
		if (s_m < s_mplus1) and m > 9:
			m -= 10 ** int(log_n // 1.25)
			continue

		

		s_m_div = m / s(m)

		if s_m_div <= s_n_div:
			next_sunuke(m, s_m, s_m_div)
			if found >= k:
				return

			found += 1
			
			print(m)
			break
		
		
		

		

		
		
		

		m -= 10 ** int(log_n // 1.25)



current_sunuke = 999999999999999
s_current_sunuke = s(current_sunuke)
s_current_sunuke_div = current_sunuke / s_current_sunuke


next_sunuke(current_sunuke, s_current_sunuke, s_current_sunuke_div)
if found < k:
	print(current_sunuke)

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

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

a=[]
for i in range(1,16):
	if i<=3:
		for j in range(1,10):
			a.append((j+1)*(10**(i-1))-1)
	elif i<=12:
		for j in range(1,10):
			b=[j*(10**(i-1))+(k+1)*(10**(i-2))-1 for k in range(10)]
			for k in range(9)[::-1]:
				if f(b[k])>f(b[k+1]):
					b.pop(k)
			a+=b
	else:
		for j in range(1,10):
			b=[j*(10**(i-1))+(k+1)*(10**(i-3))-1 for k in range(100)]
			for k in range(99)[::-1]:
				if f(b[k])>f(b[k+1]):
					b.pop(k)
			a+=b

for i in range(l):
	print(a[i])

Solution (Python):

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

sys.setrecursionlimit(10000)


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


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


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


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


def read_str():
    return input()


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


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


def mt(f):
    import time

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

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

    return wrap


def S(n):
    s = 0
    while n != 0:
        s += n % 10
        n //= 10
    return s


def slv(K):
    ans = [(i, i/S(i)) for i in range(1, 10)]
    for i in range(16):
        a = i
        if a > 4:
            a = 4
        for j in range(1, 10**a):
            b = (10**(i-a+1))*j + (10**(i-a+1)-1)
            if b < 10**(i-1):
                continue
            s = S(b)
            
            while ans[-1][1] > b/s or ans[-1][0] == b:
                (ans.pop())
            ans.append((b, b/s))
            
    
    
    
    error_print(len(ans))
    
    return '\n'.join(map(str, map(lambda x: x[0], ans[:K])))


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

if __name__ == '__main__':
    main()

Solution (Python):

k = int(input())


def snuke(n):
    s = 0
    for _ in str(n):
        s += int(_)
    return n / s


n = 1
d = 0
for _ in range(k):
    print(n)
    if snuke(n + 10**d) > snuke(n + 10**(d + 1)):
        d += 1
    n += 10**d

Solution (Python):
k = int(input())
n = 1
dif = 1
cnt = 0

while cnt!=k:
  sn = 0
  for ele in str(n):
    sn+=int(ele)

  m = n+dif
  sm = 0
  for ele in str(m):
    sm+=int(ele)
  if (n/sn) <= (m/sm):
    print(n)
    cnt+=1
    n+=dif
  else:
    n-=dif
    dif*=10
    n+=dif

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

def snk(n):
   s = 0
   for i in str(n):
       s += int(i)
   return n / s

x = 1
y = 1
for _ in range(K):
    print(x)
    if snk(x + y) > snk(x + y * 10):
        y *= 10
    x += y

Solution (Python):
def f(x):
    return x / sum(map(int, str(x)))

n = int(input())

x = 1
y = 1

for i in range(n):
    print(x)
    if f(x + y) > f(x + y * 10):
        y *= 10
    x += y

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

a = 1
b = 0

def snk(n):
    s = 0
    for i in str(n):
        s += int(i)
    return(n/s)
    
count = 0
while True:
    print(a)
    count += 1
    if snk(a + 10 ** b) > snk(a + 10 ** (b + 1)):
        b += 1
    a += 10 ** b
    if count == K:
        break

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

a = 1
b = 1

def snk(n):
    s = 0
    for i in str(n):
        s += int(i)
    return n / s

for _ in range(k):
    print(a)
    if snk(a + 10 ** (b -1)) > snk(a + 10 ** b):
        b += 1
    a += 10 ** (b-1)

Solution (Python):
K = int(raw_input())
x = 1
d = 1
for i in range(K):
  print x
  s1 = sum(map(int,str(x+d)))
  s10 = sum(map(int,str(x+d*10)))
  if (x+d)*s10 >= (x+d*10)*s1:
    d *= 10
  x += d