AtCoder Beginner Contest 101 - Snuke Numbers

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-----
10

-----Sample Output-----
1
2
3
4
5
6
7
8
9
19

Difficulty: MEDIUM_HARD

Starter code:

Solutions:
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])


K = int(input())

def sunuke(n):
	sumN = sum(map(int, list(str(n))))
	return n / sumN
digit = 0
now = 1
for i in range(K):
	print(now)
	if sunuke(now + 10 ** digit) > sunuke(now + 10 ** (digit + 1)):
		digit += 1
	now += 10 ** digit


K = int(input())

def minSunuke(n):
	sumDigit = sum(map(int, list(str(n))))
	return n / sumDigit
digit = 0
now = 1
for i in range(K):
	print(now)
	if minSunuke(now + 10 ** digit) > minSunuke(now + 10 ** (digit + 1)):
		digit += 1
	now += 10 ** digit


MAX = 10 ** 15

def find_next_n(n):
	cand = []
	n_str = str(n)
	n_list = list(n_str)
	for i in range(1, len(str(n)) + 1):
		n_list[-i] = '9'
		cand.append(int(''.join(n_list)))
	cand_result = [num / snuke(num) for num in cand]
	min_idx = cand_result.index(min(cand_result))
	return cand[min_idx]

def snuke(num):
	ans = 0
	while num // 10 != 0:
		ans += num % 10
		num = num // 10
	return ans + num

def main():
	K = int(input())
	if K < 10:
		for i in range(1, K + 1):
			print(i)
	else:
		n = 10
		for i in range(1, n):
			print(i)
		for i in range(10, K + 1):
			ans = find_next_n(n)
			print(ans)
			n = ans + 1
			if n > MAX:
				break
main()


K = int(input())

def ns(n):
	(ret, tmp) = (0, n)
	while tmp > 0:
		r = tmp % 10
		tmp //= 10
		ret += r
	return ret
(ans, base) = (0, 1)
for _ in range(K):
	ans += base
	print(ans)
	if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
		base *= 10


def s(n):
	return sum([ord(x) - ord('0') for x in str(n)])

def r(n):
	return n / s(n)

def f(n):
	d = 10
	m = n
	while d <= n * 10:
		n //= d
		n *= d
		n += d - 1
		d *= 10
		if r(n) < r(m):
			m = n
	return m
n = 1
for _ in range(int(input())):
	print(n)
	n = f(n + 1)


def sk(k):
	tk = k
	ret = 0
	while tk != 0:
		ret += tk % 10
		tk //= 10
	return ret
an = []
for i in range(1, 100):
	tp = i / sk(i)
	if len(an) == 0:
		an.append((i, tp))
	else:
		ls = an[-1]
		if ls[1] > tp:
			an[-1] = (i, tp)
		else:
			an.append((i, tp))
for j in range(15):
	for i in range(100, 1000):
		ns = str(i) + ''.join(['9'] * j)
		nm = int(ns)
		tp = nm / sk(nm)
		if an[-1][1] > tp:
			while an[-1][1] > tp:
				an.pop()
		an.append((nm, tp))
for i in range(int(input())):
	print(an[i][0])


def snuke(n):
	s = sum(map(int, str(n)))
	return n / s
k = int(input())
digit = 0
ans = 1
for _ in range(k):
	print(ans)
	if snuke(ans + 10 ** digit) > snuke(ans + 10 ** (digit + 1)):
		digit += 1
	ans += 10 ** digit


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


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


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


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])


k = int(input())
l = []
for i in range(17):
	ten = 10 ** i
	for j in range(1, 1000):
		a = ten
		b = j
		n = a * b - 1
		if n == 0:
			continue
		s = sum(map(int, str(n)))
		l.append([n / s, n])
l.sort()
now = 0
count = 0
i = 0
while count < k:
	if l[i][1] > now:
		now = l[i][1]
		count += 1
		print(l[i][1])
	i += 1


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)


def main():

	def f(N):
		S = 0
		tmp = N
		while tmp > 0:
			S += tmp % 10
			tmp //= 10
		return N / S
	import sys
	input = sys.stdin.readline
	K = int(input())
	Ans = []
	for i in range(1, 10):
		Ans.append(i)
	tmp = 0
	T = 1
	nine = 1
	while tmp < 10 ** 15:
		N = T * 10 ** nine + 10 ** nine - 1
		if f(N) <= f(N + 10 ** nine):
			Ans.append(N)
			T += 1
		else:
			nine += 1
			T //= 10
		tmp = T * 10 ** nine + 10 ** nine - 1
	print(*Ans[:K], sep='\n')
main()


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log10
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7
K = INT()

def S(n):
	return sum([int(x) for x in list(n)])

def f(N):
	sunuke = []
	for d in range(-1, int(log10(N) + 1)):
		sunuke.append(10 ** (d + 1) * (N // 10 ** (d + 1) + 1) - 1)
	sunuke2 = [x / S(str(x)) for x in sunuke]
	return sunuke[sunuke2.index(min(sunuke2))]
N = 1
for _ in range(K):
	print(N)
	N = f(N + 1)


def d_snuke_numbers(K):
	import math

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

	def f(n):
		digit = len(str(n))
		min_ns = ns(n)
		ret = n
		for d in range(digit + 1):
			x = 10 ** (d + 1) * math.floor(n / 10 ** (d + 1) + 1) - 1
			s = ns(x)
			if min_ns > s:
				min_ns = s
				ret = x
		return ret
	n = 0
	candidate = []
	for _ in range(K):
		n = f(n + 1)
		candidate.append(n)
	ans = '\n'.join(map(str, candidate))
	return ans
K = int(input())
print(d_snuke_numbers(K))


from math import log, floor
from itertools import islice
k = int(input())

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

def f(n):
	ds = range(int(log(n + 1, 10)) + 2)
	xs = [10 ** (d + 1) * floor(n / 10 ** (d + 1) + 1) - 1 for d in ds]
	return min(xs, key=s)

def g():
	for n in range(1, 10):
		yield n
	while True:
		n = f(n + 1)
		yield n
for x in islice(g(), k):
	print(x)


k = int(input())
ans = []
for i in range(1, 10):
	ans.append(str(i))
for i in range(1, 10):
	ans.append(str(i) + '9')
for i in range(1, 10):
	ans.append(str(i) + '99')
for i in range(10):
	ans.append('1' + str(i) + '99')
for i in range(2, 10):
	ans.append(str(i) + '999')
for i in range(1, 3):
	for j in range(10):
		ans.append(str(i) + str(j) + '999')
for i in range(3, 10):
	ans.append(str(i) + '9999')
for i in range(1, 4):
	for j in range(10):
		ans.append(str(i) + str(j) + '9999')
for i in range(4, 10):
	ans.append(str(i) + '99999')
for i in range(1, 5):
	for j in range(10):
		ans.append(str(i) + str(j) + '99999')
for i in range(5, 10):
	ans.append(str(i) + '999999')
for i in range(1, 6):
	for j in range(10):
		ans.append(str(i) + str(j) + '999999')
for i in range(6, 10):
	ans.append(str(i) + '9999999')
for i in range(1, 7):
	for j in range(10):
		ans.append(str(i) + str(j) + '9999999')
for i in range(7, 10):
	ans.append(str(i) + '99999999')
for i in range(1, 8):
	for j in range(10):
		ans.append(str(i) + str(j) + '99999999')
for i in range(8, 10):
	ans.append(str(i) + '999999999')
for i in range(1, 9):
	for j in range(10):
		ans.append(str(i) + str(j) + '999999999')
for i in range(9, 10):
	ans.append(str(i) + '9999999999')
for i in range(1, 10):
	for j in range(10):
		ans.append(str(i) + str(j) + '9999999999')
for i in range(10, 10):
	ans.append(str(i) + '99999999999')
for i in range(1, 10):
	for j in range(10):
		ans.append(str(i) + str(j) + '99999999999')
for i in range(10, 10):
	ans.append(str(i) + '999999999999')
for i in range(1, 10):
	for j in range(10):
		ans.append(str(i) + str(j) + '999999999999')
for i in range(10, 10):
	ans.append(str(i) + '9999999999999')
for i in range(10):
	ans.append('10' + str(i) + '999999999999')
for i in range(1, 10):
	ans.append('1' + str(i) + '9999999999999')
for i in range(2, 10):
	for j in range(10):
		ans.append(str(i) + str(j) + '9999999999999')
for val in ans[:k]:
	print(val)


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])


from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10 ** 5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right

def LI():
	return list(map(int, stdin.readline().split()))

def LF():
	return list(map(float, stdin.readline().split()))

def LI_():
	return list(map(lambda x: int(x) - 1, stdin.readline().split()))

def II():
	return int(stdin.readline())

def IF():
	return float(stdin.readline())

def LS():
	return list(map(list, stdin.readline().split()))

def S():
	return list(stdin.readline().rstrip())

def IR(n):
	return [II() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def FR(n):
	return [IF() for _ in range(n)]

def LFR(n):
	return [LI() for _ in range(n)]

def LIR_(n):
	return [LI_() for _ in range(n)]

def SR(n):
	return [S() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

def A():
	s = S()
	a = s.count('-')
	b = s.count('+')
	print(b - a)
	return

def B():
	n = S()
	num = sum(map(int, n))
	n = int(''.join(n))
	print(['Yes', 'No'][n % num > 0])
	return

def C():
	(n, k) = LI()
	LI()
	print((n - k) // (k - 1) + 1 + bool((n - k) % (k - 1)))
	return

def D():
	K = II()
	ans = 1
	i = 0

	def Sunuke(a):
		return a / sum(map(int, str(a)))

	def Check(a, i):
		return Sunuke(a + 10 ** i) > Sunuke(ans + 10 ** (i + 1))
	while K:
		print(ans)
		K -= 1
		i += Check(ans, i)
		ans += 10 ** i
	return
D()


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


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


K = int(input())

def calc_sunuke(num):
	st = str(num)
	s_num = 0
	for c in st:
		s_num += int(c)
	return num / s_num

def search_sunuke(num):
	num_sunuke = calc_sunuke(num)
	if num >= 100:
		digits = len(str(num))
		if digits < 12:
			for i in range(count + 10 ** (digits - 2), 10 ** digits, 10 ** (digits - 2)):
				if num_sunuke > calc_sunuke(i):
					return False
			return True
		else:
			for i in range(count + 10 ** (digits - 3), 10 ** digits, 10 ** (digits - 3)):
				if num_sunuke > calc_sunuke(i):
					return False
			return True
	else:
		for i in range(count + 1, 100):
			if num_sunuke > calc_sunuke(i):
				return False
		return True
count = 1
sunuke_num = 0
while sunuke_num != K:
	if search_sunuke(count):
		print(count)
		sunuke_num += 1
	if count < 99:
		count += 1
	else:
		count_str = str(count)
		digits = len(count_str)
		r_count = count
		if digits < 12:
			for c in count_str:
				if c != '9':
					count += 10 ** (digits - 2)
					break
			if r_count == count:
				count += 10 ** (digits - 1)
		else:
			for c in count_str:
				if c != '9':
					count += 10 ** (digits - 3)
					break
			if r_count == count:
				count += 10 ** (digits - 2)


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)


K = int(input())

def snuke(n):
	sum_num = sum(map(int, list(str(n))))
	return n / sum_num
ans = 1
digit = 0
while K > 0:
	print(ans)
	if snuke(ans + 10 ** digit) > snuke(ans + 10 ** (digit + 1)):
		digit += 1
	ans += 10 ** digit
	K -= 1


def ri():
	return int(input())

def rl():
	return list(input().split())

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

def calc(n):
	s = sum(map(int, str(n)))
	return n / s

def f(n):
	ld = list(map(int, str(n)))
	cand = []
	for i in range(len(ld) - 1):
		d = len(ld) - 1 - i
		ld[d] = 9
		for i in range(1, 10):
			if i < ld[d - 1]:
				continue
			ld[d - 1] = i
			p = int(''.join(map(str, ld)))
			cand.append((calc(p), p))
	cand.sort()
	return cand[0][1]
MAX = 10 ** 15

def main():
	k = ri()
	cand = list(range(1, 10))
	n = 10
	while True:
		if n > MAX:
			break
		p = f(n)
		cand.append(p)
		n = p + 1
	print('\n'.join(map(str, cand[:k])))

def __starting_point():
	main()
__starting_point()


K = int(input())

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

def norm(n):
	return n / S(n)
snk = 1
order = 0
for i in range(K):
	print(snk)
	nxt1 = snk + 10 ** order
	nxt2 = snk + 10 ** (order + 1)
	if norm(nxt2) < norm(nxt1):
		order += 1
		snk = nxt2
	else:
		snk = nxt1


K = int(input())
num = 1
pls = 1
coun = 0
while num <= 1000000000000000 and coun < K:
	while num / sum(list(map(int, list(str(num))))) <= (num + pls) / sum(list(map(int, list(str(num + pls))))) and coun < K:
		print(num)
		coun = coun + 1
		num = num + pls
	num = num - pls
	pls = pls * 10
	num = num + pls


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)


K = int(input())
a = 0
b = 1
for k in range(K):
	a += b
	print(a)
	if b < (a + b) / sum(map(int, str(a + b))):
		b *= 10


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


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


k = int(input())
cnt = 0
step = 1
base = 1
tail = ''
now = 0

def f(x):
	s = list(str(x))
	return sum([int(i) for i in s])
while 1:
	now += step
	if now > step * f(now):
		now -= step
		step *= 10
	else:
		cnt += 1
		print(now)
		if cnt == k:
			exit(0)


K = int(input())

def ns(n):
	return sum([int(c) for c in str(n)])
(ans, base) = (0, 1)
for _ in range(K):
	ans += base
	print(ans)
	if (ans + base) / ns(ans + base) > (ans + 10 * base) / ns(ans + 10 * base):
		base *= 10


K = int(input())

def f(n):
	return n / sum([int(s) for s in str(n)])
ans = [1]
for k in range(K - 1):
	(min_f_val, next_snuke) = (float('inf'), None)
	n = str(ans[-1] + 1)
	for i in range(len(n)):
		for x in range(int(n[i]), 10):
			X = n[:i] + str(x) + '9' * (len(n) - i - 1)
			f_val = f(int(X))
			if f_val < min_f_val:
				next_snuke = int(X)
				min_f_val = f_val
	ans.append(next_snuke)
print(*ans, sep='\n')


K = int(input())
snukePairs = []
for i in range(1, 16):
	top = 1
	if i >= 12:
		top = 3
	elif i >= 4:
		top = 2
	p = pow(10, i - top)
	fill9 = p - 1
	top_num = pow(10, max(top, 1))
	check_index = len(snukePairs)
	for j in range(pow(10, top - 1), top_num):
		num = j * p + fill9
		nn = num
		s = 0
		while nn > 0:
			s += nn % 10
			nn = nn // 10
		val = num / s
		idx = len(snukePairs) - 1
		while idx >= 0:
			if snukePairs[idx][1] > val:
				del snukePairs[idx]
			idx -= 1
		snukePairs.append([num, val])
for i in range(0, K):
	print(snukePairs[i][0])


def SUNUKE(i):
	x = str(i)
	SUM = 0
	for j in range(len(x)):
		SUM += int(x[j])
	return (SUM, i / SUM)
SUNUKESUU = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
i = 10
keta = 0
while i < 10 ** 16:
	if SUNUKE(i)[1] >= 10 ** keta:
		i -= 10 ** keta
		keta += 1
	else:
		if SUNUKESUU[-1] != i:
			SUNUKESUU += [i]
		i += 10 ** keta
for i in range(1, int(input()) + 1):
	print(SUNUKESUU[i])


def digit_sum(number):
	ans = 0
	for n in str(number):
		ans += int(n)
	return ans

def obj_func(number):
	return number / digit_sum(number)
K = int(input())
num_list = []
d = 1
n = 1
for i in range(K):
	num_list.append(n)
	if obj_func(n + 10 ** (d - 1)) > obj_func(n + 10 ** d):
		d += 1
	n += 10 ** (d - 1)
print(*num_list, sep='\n')


def S(n):
	k = list(str(n))
	import functools
	return functools.reduce(lambda x, y: x + y, [int(i) for i in k])
k = int(input())

def T(n):
	return n / S(n)

def f(N):
	len_N = len(str(N))
	A = [10 ** len_N + 10 ** i - 1 for i in range(len_N)]
	B = [T(i) for i in A]
	ans1 = A[B.index(min(B))]
	i = 0
	while True:
		I = 10 ** (len_N - 1) + 10 ** i - 1
		J = 10 ** (len_N - 1) + 10 ** (i + 1) - 1
		if T(J) < T(I):
			i += 1
		else:
			break
	C = [(N + 1) // 10 ** i * 10 ** i + j * 10 ** i - 1 for j in range(1, 11)]
	D = [T(i) for i in C]
	ans2 = C[D.index(min(D))]
	if T(ans1) < T(ans2):
		return ans1
	else:
		return ans2
K = []
N = 1
while len(K) < k:
	K.append(N)
	N = f(N)
for i in range(k):
	print(K[i])


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


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


def s(n):
	ret = 0
	while n > 0:
		ret += n % 10
		n //= 10
	return ret
numbers = [999999999999999999]
while numbers[-1] > 1:
	for d in range(0, 100):
		n = numbers[-1]
		m = n - 10 ** d
		if n * s(m) >= m * s(n):
			numbers.append(m)
			break
numbers = list(reversed(numbers))
n = int(input())
for i in range(n):
	print(numbers[i])


def S(n):
	if n < 10:
		return n
	return S(n // 10) + n % 10
li = []
for d in range(20):
	a = 10 ** d
	for x in range(200):
		y = (x + 1) * a - 1
		if y > 0:
			z = S(y)
			li.append((y, z))
li = sorted(list(set(li)), reverse=True)
answer = []
(min_N, min_S) = li[0]
for (n, s) in li[1:]:
	if n * min_S <= s * min_N:
		min_N = n
		min_S = s
		answer.append(n)
K = int(input())
answer.sort()
answer = answer[:K]
print('\n'.join(map(str, answer)))


from math import log10, ceil

def S(n: int) -> int:
	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

def __starting_point():
	K = int(input())
	N = 1
	for _ in range(K):
		print(N)
		N = f(N + 1)
__starting_point()


k = int(input())
n = 0
a = 1
b = 0
if a == 1 and n < 9:
	while n < 9 and b < k:
		n += 1
		print(n)
		b += 1
	a += 1
if a == 2:
	while n < 90 and b < k:
		n += 10
		print(n)
		b += 1
	a += 1
while b < k:
	n += 10 ** (a - 1)
	print(n)
	b += 1
	if n > (a - 1) * 10 ** a - 10 ** (a - 1) and a < 12 or (n > (a - 2) * 10 ** a - 10 ** (a - 1) and a >= 12):
		a += 1


K = int(input())

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


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


k = int(input())
count = 0
ans = []
minN = 10 ** 15
for i in reversed(range(13)):
	minN = 10 ** 15
	for j in reversed(range(1, 10 ** 3)):
		num = str(j) + '9' * i
		n = sum([int(k) for k in num])
		n = int(num) / n
		if minN > n or n == 1:
			minN = n
			ans.append(int(num))
for i in list(sorted(list(set(ans))))[:k]:
	print(i)


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])


import math

def s(n):
	ret = 0
	while n > 0:
		ret += n % 10
		n = n // 10
	return ret

def snuke(n):
	candidate = []
	for d in range(int(math.log(n, 10)) + 2):
		x = n - n % 10 ** d + (10 ** d - 1)
		candidate.append(x)
	min_value = candidate[0] / s(candidate[0])
	ans = candidate[0]
	for c in candidate[1:]:
		tmp = c / s(c)
		if tmp < min_value:
			min_value = tmp
			ans = c
	return ans
K = int(input())
N = 0
for i in range(K):
	N = snuke(N + 1)
	print(N)


def s(n):
	return n / sum(map(int, str(n)))
k = int(input())
p = 1
e = 0
i = 0
while i < k:
	n = (p + 1) * 10 ** e - 1
	nxt = (p + 2) * 10 ** e - 1
	if s(n) <= s(nxt):
		print(n)
		p += 1
		i += 1
	else:
		e += 1
		p = (p + 1) // 10


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])
main()


from fractions import Fraction
import sys

def g():
	i = 1
	while True:
		si = str(i)
		ni = min({int(si[:j] + '9' * (len(si) - j)) for j in range(len(si) + 1)}, key=lambda a: (Fraction(a, sum((int(x) for x in str(a)))), a))
		yield ni
		i = ni + 1

def solve(K: int):
	it = g()
	for i in range(K):
		print(next(it))

def main():

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


K = int(input())
keta = 1
now = 1
count = 0

def sunuke(n):
	a = 0
	for i in str(n):
		a += int(i)
	return n / a
while count < K:
	if sunuke(now) <= sunuke(now + keta):
		print(now)
		now += keta
		count += 1
	else:
		now += 9 * keta
		keta *= 10


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


import math
K = int(input())

def S_n(i):
	return sum(list(map(int, str(i))))

def snuke(n):
	return n / S_n(n)
j = 1
order = 1
for i in range(K):
	print(j)
	if snuke(j + 10 ** (order - 1)) > snuke(j + 10 ** order):
		order += 1
	j += 10 ** (order - 1)


K = int(input())

def f(n):
	s = 0
	for n_i in str(n):
		s += int(n_i)
	x = int(n) / s
	return x
order = 1
x = 1
for i in range(K):
	print(x)
	if f(x + 10 ** (order - 1)) > f(x + 10 ** order):
		order += 1
	x += 10 ** (order - 1)


def f(n):
	(s, a) = (0, n)
	while n > 0:
		s += n % 10
		n //= 10
	return a / s

def main():
	snuke = []
	base = 1
	for i in range(15):
		for j in range(1, 140):
			snuke.append(base * (j + 1) - 1)
		base *= 10
	snuke.sort()
	snuke.append(0)
	snuke2 = []
	for i in range(len(snuke) - 1):
		if snuke[i] != snuke[i + 1]:
			snuke2.append(snuke[i])
	(k, idx, t) = (int(input()), 0, 0)
	while t < k:
		for i in range(idx + 1, len(snuke2)):
			if f(snuke2[idx]) > f(snuke2[i]):
				idx += 1
				break
		else:
			print(snuke2[idx])
			t += 1
			idx += 1
main()


k = int(input())
candili = []
for i in range(1, 1000):
	candili.append(i)
tmpli = []
for i in candili:
	for j in range(1, 15):
		tmpli.append(int(str(i) + '9' * j))
tmpli = list(set(tmpli))
tmp2li = []
for i in tmpli:
	if i <= 10 ** 15:
		tmp2li.append(i)
candili += tmp2li
candili = list(set(candili))
candili.sort()

def S(n):
	return sum((int(i) for i in str(n)))
conli = []
for i in candili:
	conli.append(i / S(i))
ansli = []
for i in range(len(conli)):
	for j in range(i, len(conli)):
		if conli[i] > conli[j]:
			break
	else:
		ansli.append(candili[i])
for i in range(k):
	print(ansli[i])


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)


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys

def input():
	return sys.stdin.readline().rstrip()

def I():
	return int(input())

def Is():
	return map(int, input().split())

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

def TI():
	return tuple(map(int, input().split()))

def IR(n):
	return [I() for _ in range(n)]

def LIR(n):
	return [LI() for _ in range(n)]

def TIR(n):
	return [TI() for _ in range(n)]

def S():
	return input()

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

def LS():
	return list(input())

def SR(n):
	return [S() for _ in range(n)]

def SsR(n):
	return [Ss() for _ in range(n)]

def LSR(n):
	return [LS() for _ in range(n)]
sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 18

def f(n):
	return n / sum((int(x) for x in str(n)))
ANS = []
tmp = INF
for i in reversed(range(16)):
	for j in reversed(range(100, 1000)):
		x = int(str(j) + '9' * i)
		if f(x) <= tmp:
			ANS.append(x)
			tmp = f(x)
for x in reversed([1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99]):
	ANS.append(x)
ANS.reverse()
k = I()
for i in range(k):
	print(ANS[i])


k = int(input())
keta = 1
ima = 1

def sunuke(n):
	a = 0
	for i in str(n):
		a += int(i)
	return n / a
count = 0
while count < k:
	if sunuke(ima) <= sunuke(ima + keta):
		print(ima)
		ima += keta
		count += 1
	else:
		ima += 9 * keta
		keta *= 10


def nsn(n):
	s = 0
	nn = n
	while nn > 0:
		s += nn % 10
		nn = int(nn / 10)
	return n / s

def big(a):
	r = 1
	while a > 0:
		r *= 10
		a = int(a / 10)
	return r

def clear(a, d):
	aa = a
	asa = nsn(a)
	b = True
	ba = big(a)
	while aa < ba:
		aa += d
		if nsn(aa) < asa:
			b = False
			break
	return b
K = int(input())
T = [1]
a = 1
d = 1
while len(T) < K:
	n = 1
	while 1:
		an = a + n * d
		if clear(an, d):
			T.append(an)
			a = an
			d = n * d
			break
		n += 1
for x in T:
	print(x)


def snu(n):
	s = str(n)
	kei = sum((int(x) for x in s))
	return n / kei

def nn(n):
	s = str(n)
	kt = len(str(int(snu(n))))
	if s[-kt:].count('9') == kt:
		if s[-kt - 1] == '9':
			n += 10 ** kt
			s = str(n)
			kt = len(str(int(snu(n))))
			if s[-kt:].count('9') == kt:
				return n
			else:
				s = s[:-kt] + '9' * kt
				return int(s)
		else:
			return n + 10 ** kt
	else:
		s = s[:-kt] + '9' * kt
		return int(s)
k = int(input())
t = 9 if k > 9 else k
for i in range(1, t + 1):
	print(i)
if k <= 9:
	return
n = 19
for _ in range(k - 9):
	print(n)
	n = nn(n)


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


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)


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


import numpy as np

def set_power(a, power_array):
	res = 1
	for i in range(len(power_array)):
		power_array[i] = res
		res *= a

def solve(ans, K, arr):
	p = 0
	for d in range(15):
		pow = arr[d]
		x = pow - 1
		for i in range(1, 10):
			if d > 2:
				y = i * pow + arr[d - 1] - 1
				if y <= (9 * (d - 1) + 1) * arr[d - 1]:
					for j in range(0, 9):
						if d > 9:
							z = i * pow + j * arr[d - 1] + arr[d - 2] - 1
							if z <= (9 * (d - 2) + j + 1) * arr[d - 2]:
								for j2 in range(0, 9):
									ans[p] = z + j2 * arr[d - 2]
									p += 1
						ans[p] = y + j * arr[d - 1]
						p += 1
			ans[p] = i * pow + x
			p += 1
	return p
K = int(input())
ans = np.empty(10000, dtype=np.int64)
power_array = np.empty(16, dtype=np.int64)
set_power(10, power_array)
p = solve(ans, K, power_array)
print(*ans[:K].tolist(), sep='\n')


from math import log10

def S(x):
	rst = 0
	while x > 0:
		rst += x % 10
		x //= 10
	return rst

def f(N):
	rst = (N, N / S(N))
	for d in range(int(log10(N) - 1) + 1):
		x = pow(10, d + 1) * int(N / pow(10, d + 1) + 1) - 1
		sunuke = x / S(x)
		if rst[1] > sunuke:
			rst = (x, sunuke)
	return rst[0]
K = int(input())
ans = [1]
N = 1
K -= 1
while K > 0:
	N = f(N + 1)
	ans.append(N)
	K -= 1
print(*ans, sep='\n')


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')


def f(n):
	return n / sum(map(int, list(str(n))))
a = 1
b = 0
for i in range(int(input())):
	print(a)
	if f(a + 10 ** b) > f(a + 10 ** (b + 1)):
		b += 1
	a += 10 ** b


K = int(input())

def NS(N):
	NS = 0
	while N > 0:
		NS += N % 10
		N //= 10
	return NS
(answer, diff) = (0, 1)
for i in range(K):
	answer += diff
	print(answer)
	if (answer + diff) / NS(answer + diff) > (answer + 10 * diff) / NS(answer + 10 * diff):
		diff *= 10


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))]


k = int(input())

def S(num):
	s = sum(map(int, list(str(num))))
	return num / s
ten = 0
now = 1
for _ in range(k):
	print(now)
	if S(now + 10 ** ten) > S(now + 10 ** (ten + 1)):
		ten += 1
	now += 10 ** ten


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])


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


def sunuke_sum(arg):
	sum_digit = 0
	for char in arg:
		sum_digit += int(char)
	return sum_digit
input_num = int(input())
sunuke_dict = {}
min_sunuke_div = 10 ** 20
for d in reversed(range(1, 16)):
	for n in reversed(range(10, 1000)):
		i = n * 10 ** d + (10 ** d - 1)
		sunuke_div = i / sunuke_sum(str(i))
		sunuke_dict[i] = sunuke_div
for i in reversed(range(1, 110)):
	sunuke_div = i / sunuke_sum(str(i))
	sunuke_dict[i] = sunuke_div
sunuke_sorted = sorted(sunuke_dict.items())
sunuke_list = []
for (value, div_value) in reversed(sunuke_sorted):
	if min_sunuke_div >= div_value:
		sunuke_list.append(value)
		min_sunuke_div = div_value
sunuke_list.reverse()
for i in range(0, input_num):
	print(str(sunuke_list[i]))


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])


def S(n):
	return sum(map(int, str(n)))
K = int(input())
x = 1
d = 1
while K > 0:
	if S(x) * d < x:
		x += 9 * d
		d *= 10
	else:
		print(x)
		x += d
		K -= 1


from math import log, floor
from itertools import accumulate, chain, islice, repeat
k = int(input())

def f(n):
	ds = range(int(log(n + 1, 10)) + 1)
	xs = [10 ** (d + 1) * floor(n / 10 ** (d + 1) + 1) - 1 for d in ds]
	return min(xs, key=lambda n: n / sum(map(int, str(n))))
snukes = chain(range(1, 9), accumulate(repeat(9), lambda x, _: f(x + 1)))
for x in islice(snukes, k):
	print(x)


def cal(n):
	m = n
	ret = 0
	while n != 0:
		ret += n % 10
		n //= 10
	return m / ret

def f(n):
	cand = []
	s = str(n)
	for i in range(len(s) - 1, -1, -1):
		if s[i] == '9':
			continue
		for j in range(int(s[i]), 10):
			t = int(s[:i] + str(j) + s[i + 1:])
			cand += [t]
		s = s[:i] + '9' + s[i + 1:]
	ret = n
	for x in cand:
		if cal(x) < cal(ret):
			ret = x
	return ret
k = int(input())
ans = 1
for _ in range(k):
	print(ans)
	ans = f(ans + 1)


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])


K = int(input())
tmp = 0
i = 0
k = 0
res = 1

def S(a):
	res = 0
	while a != 0:
		res += a % 10
		a //= 10
	return res

def check(i, a):
	if 10 ** i * S(a) < a:
		return True
	return False
while True:
	if k == K:
		break
	print(res)
	k += 1
	res += 10 ** i
	if check(i, res):
		res -= 10 ** i
		i += 1
		res += 10 ** i


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, 500):
		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])


K = int(input())

def calc(n):
	m = 0
	while n:
		(n, d) = divmod(n, 10)
		m += d
	return m

def find(xs, i):
	(ri, rv) = (None, 10 ** 20)
	for j in range(i, len(xs)):
		if xs[j] < rv:
			ri = j
			rv = xs[j]
	return (ri, rv)
c = 0
i = 1
prev = 0
d = 1
while 1:
	n = i
	r = 0
	k = 0
	vs = []
	while 1:
		(n, m) = divmod(n, 10)
		r += m
		if n == 0:
			break
		k += 1
		vs.append((n + 1) * 10 ** k - 1)
	if not vs or i / r <= min((v / calc(v) for v in vs)):
		print(i)
		d = max(d, i - prev)
		prev = i
		c += 1
		if c >= K:
			break
	i += d


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


k = int(input())
A = []
for i in range(1, 9):
	A.append([i, 1])
now = 0
for i in range(15):
	now += 9 * 10 ** i
	for j in range(1000):
		c = now + j * 10 ** (i + 1)
		S = str(c)
		cnt = 0
		for s in S:
			cnt += int(s)
		A.append([c, c / cnt])
A = list(reversed(sorted(A)))
now = 0
m = A[0][1]
Ans = []
for a in A:
	if a[0] == now:
		continue
	else:
		now = a[0]
		if a[1] <= m:
			Ans.append(now)
			m = a[1]
Ans = list(reversed(Ans))
for i in range(k):
	print(Ans[i])


k = int(input())

def f(num):
	return num / sum(map(int, list(str(num))))
order = 0
sunuke = 1
for i in range(k):
	print(sunuke)
	sunuke += 10 ** order
	if f(sunuke + 10 ** (order + 1)) < f(sunuke + 10 ** order):
		order += 1


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))
main()


from math import log10

def S(x):
	a = [int(i) for i in str(x)]
	return sum(a)

def f(N):
	tmp = (N, N / S(N))
	for d in range(int(log10(N) - 1) + 1):
		x = pow(10, d + 1) * int(N / pow(10, d + 1) + 1) - 1
		sunuke = x / S(x)
		if tmp[1] > sunuke:
			tmp = (x, sunuke)
	return tmp[0]
K = int(input())
ans = [1]
N = 1
K -= 1
while K > 0:
	N = f(N + 1)
	ans.append(N)
	K -= 1
print(*ans, sep='\n')


import sys
sys.setrecursionlimit(2147483647)
INF = float('inf')
MOD = 10 ** 9 + 7
input = lambda : sys.stdin.readline().rstrip()
from math import log10

def f(x):
	s = sum((int(c) for c in str(x)))
	return x / s

def next(x):
	d = int(log10(x))
	A = list(str(x))
	res = -1
	score = INF
	for i in range(d, -1, -1):
		A[i] = '9'
		tmp = int(''.join(A))
		if score > f(tmp):
			score = f(tmp)
			res = tmp
	return res

def resolve():
	k = int(input())
	if k < 10:
		for i in range(1, k + 1):
			print(i)
		return
	for i in range(1, 10):
		print(i)
	k -= 9
	now = 9
	for _ in range(k):
		now = next(now + 1)
		print(now)
resolve()


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):
	nonlocal 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)


def funuke(now):
	count = 0
	for ele in list(str(now)):
		count += int(ele)
	return now / count

def main():
	num = int(input())
	keta = 1
	now = 1
	count = 0
	while count < num:
		if funuke(now) <= funuke(now + keta):
			count += 1
			print(now)
			now += keta
		else:
			now += 9 * keta
			keta *= 10
main()


def f(N):
	l = 0
	NN = N
	while True:
		l += 1
		NN //= 10
		if NN < 10:
			break
	m = N / sum(map(int, list(str(N))))
	num = -1
	for d in range(0, l + 2):
		x = 10 ** (d + 1) * int(N / 10 ** (d + 1) + 1) - 1
		sx = sum(map(int, list(str(x))))
		value = x / sx
		if value < m:
			m = value
			num = d
	if num == -1:
		return N
	else:
		return 10 ** (num + 1) * int(N / 10 ** (num + 1) + 1) - 1
K = int(input())
N = 1
ans = [1]
while len(ans) < K:
	N = f(N + 1)
	ans.append(N)
for i in ans:
	print(i)


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


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)


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)
main()


from collections import defaultdict as dd
from collections import Counter
from pprint import pprint as pp
import itertools as it
import functools
import math
YN = {True: 'Yes', False: 'No'}
ri = lambda : int(input())
ria = lambda : list(map(int, input().split()))
rian = lambda n: [ria() for _ in range(n)]
rs = lambda : input()
rsa = lambda : input().split()
rsn = lambda n: [rs() for _ in range(n)]
K = ri()

@functools.lru_cache()
def Sx(i):
	return i / sum((int(s) for s in str(i)))

def gen():
	diff = 1
	n = 1
	while True:
		if Sx(n) <= Sx(n + diff):
			yield n
			n += diff
		else:
			n -= diff
			diff *= 10
			n += diff
for n in it.islice(gen(), K):
	print(n)


import sys
from itertools import combinations

def input():
	return sys.stdin.readline().strip()
carry = False

def f(n):
	c = str(n)
	L = len(c)
	digit_sum = [0] * (L + 1)
	for i in range(1, L + 1):
		digit_sum[i] = digit_sum[i - 1] + int(c[i - 1])
	ret = n
	val = n / digit_sum[-1]
	for d in range(L - 1, -1, -1):
		N = int(c[:d] + '9' * (L - d))
		valN = N / (digit_sum[d] + 9 * (L - d))
		if val > valN:
			ret = N
			val = valN
	return ret

def main():
	K = int(input())
	print(1)
	n = 1
	for _ in range(1, K):
		n = f(n + 1)
		print(n)
main()


def main():
	s = set()
	for digit in range(16):
		for i in range(1, 1000):
			c = i * 10 ** digit + int('9' * digit or 0)
			if c < 10 ** 15:
				s.add(c)
	c = sorted(s)
	for (i, n) in enumerate(c):
		sn = n / sum(map(int, str(n)))
		for m in c[i + 1:i + 50]:
			sm = m / sum(map(int, str(m)))
			if sm < sn:
				s.remove(n)
				break
	print(*sorted(s)[:int(input())], sep='\n')
main()


LEN = 0
SNK = [1, 2, 3, 4, 5, 6, 7, 8, 9]
LEN += 1
for i in range(1, 10):
	SNK.append(i * 10 + 9)
LEN += 1
LEN += 1
for loop in range(2):
	SNK_sub = list(range(pow(10, loop), pow(10, loop + 1)))
	SNK += list(map(lambda x: x * pow(10, LEN - 1) + (pow(10, LEN - 1) - 1), SNK_sub))
	LEN += len(str(max(SNK_sub))) - 1
	for d in SNK_sub:
		SNK += [i * pow(10, LEN - 1) + (pow(10, LEN - 1) - 1) for i in range(10, 10 * (d + 1))]
		SNK += list(map(lambda x: x * pow(10, LEN) + (pow(10, LEN) - 1), SNK_sub[SNK_sub.index(d) + 1:]))
		LEN += 1 + loop
		if LEN > 20:
			break
print('\n'.join((str(i) for i in SNK[:int(input())])))


k = int(input())

def f(n):
	(num, ans) = (n / sum([int(i) for i in str(n)]), n)
	for i in range(len(str(n)) + 1):
		x = 10 ** (i + 1) * (n // 10 ** (i + 1) + 1) - 1
		y = x / sum([int(j) for j in str(x)])
		if num > y:
			(ans, num) = (x, y)
	return ans
n = 0
for _ in range(k):
	n = f(n + 1)
	print(n)


k = int(input())

def s(n):
	r = 0
	while n > 0:
		r += n % 10
		n = n // 10
	return r

def find_next(n):
	d = 0
	m = n // 10
	sm = s(m)
	r = 0
	grad = 10 * m + 1 - sm - 9 * d - 1 / 10 ** d
	while grad > 0:
		r += 9 * 10 ** d
		d += 1
		sm -= m % 10
		m = m // 10
		grad = 10 * m + 1 - sm - 9 * d - 1 / 10 ** d
	r += n // 10 ** d * 10 ** d
	return r
for i in range(1, min(k, 9) + 1):
	print(i)
k -= min(k, 9)
p = 10
for i in range(0, k):
	p = find_next(p)
	print(p)
	p += 1


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


def digitsum(n):
	s = str(n)
	array = list(map(int, s))
	return sum(array)

def list_to_num(l):
	s = 0
	for i in range(len(l)):
		s += l[i] * pow(10, i)
	return s
k = int(input())

def func(a):
	n = a + 1
	if a == 0:
		return 1
	elif n / digitsum(n) == 1:
		return n
	else:
		s = str(n)
		array = list(map(int, s))[::-1]
		if len(list(set(array))) == 1 and list(set(array))[0] == 9:
			n = list_to_num(array) + 1
			s = str(n)
			array = list(map(int, s))[::-1]
		min = pow(10, 15)
		ans = 0
		for i in range(len(array)):
			for j in range(array[i] + 1, 10):
				array[i] = j
				temp = list_to_num(array) / digitsum(list_to_num(array))
				if temp < min:
					min = temp
					ans = list_to_num(array)
		return ans
n = 0
for i in range(k):
	print(func(n))
	n = func(n)


K = int(input())
P = [n for n in range(1, 10)]
Q = [n for n in range(1, 10)]
for d in range(20):
	if d < 12:
		for m in range(10, 100):
			P.append(int(str(m) + '9' * d))
			Q.append(m // 10 + m % 10 + 9 * d)
	else:
		for m in range(100, 1000):
			P.append(int(str(m) + '9' * (d - 1)))
			Q.append(sum([int(s) for s in str(m)]) + 9 * (d - 1))
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 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])


from sys import stdout
from bisect import bisect_left as binl
from copy import copy, deepcopy
from collections import defaultdict
mod = 1

def intin():
	input_tuple = input().split()
	if len(input_tuple) <= 1:
		return int(input_tuple[0])
	return tuple(map(int, input_tuple))

def intina():
	return [int(i) for i in input().split()]

def intinl(count):
	return [intin() for _ in range(count)]

def modadd(x, y):
	global mod
	return (x + y) % mod

def modmlt(x, y):
	global mod
	return x * y % mod

def lcm(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x

def combination(x, y):
	assert x >= y
	if y > x // 2:
		y = x - y
	ret = 1
	for i in range(0, y):
		j = x - i
		i = i + 1
		ret = ret * j
		ret = ret // i
	return ret

def get_divisors(x):
	retlist = []
	for i in range(1, int(x ** 0.5) + 3):
		if x % i == 0:
			retlist.append(i)
			retlist.append(x // i)
	return retlist

def get_factors(x):
	retlist = []
	for i in range(2, int(x ** 0.5) + 3):
		while x % i == 0:
			retlist.append(i)
			x = x // i
	retlist.append(x)
	return retlist

def make_linklist(xylist):
	linklist = {}
	for (a, b) in xylist:
		linklist.setdefault(a, [])
		linklist.setdefault(b, [])
		linklist[a].append(b)
		linklist[b].append(a)
	return linklist

def calc_longest_distance(linklist, v=1):
	distance_list = {}
	distance_count = 0
	distance = 0
	vlist_previous = []
	vlist = [v]
	nodecount = len(linklist)
	while distance_count < nodecount:
		vlist_next = []
		for v in vlist:
			distance_list[v] = distance
			distance_count += 1
			vlist_next.extend(linklist[v])
		distance += 1
		vlist_to_del = vlist_previous
		vlist_previous = vlist
		vlist = list(set(vlist_next) - set(vlist_to_del))
	max_distance = -1
	max_v = None
	for (v, distance) in distance_list.items():
		if distance > max_distance:
			max_distance = distance
			max_v = v
	return (max_distance, max_v)

def calc_tree_diameter(linklist, v=1):
	(_, u) = calc_longest_distance(linklist, v)
	(distance, _) = calc_longest_distance(linklist, u)
	return distance
k = 0

def print_ans(x):
	global k
	print(x)
	k -= 1
	if k <= 0:
		exit(0)
	return x

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

def get_anslist(base, msnum, pownum):
	do_break = False
	end = (msnum + 10) // 10 * 10
	ret = []
	for i in range(msnum, end):
		m = base + i * 10 ** pownum
		snuke = m / s(m)
		ret.append((m, snuke))
		if snuke >= 10 ** pownum:
			do_break = True
	return (ret, do_break)

def main():
	global k
	k = intin()
	max_print = -1
	for i in range(16):
		base = 0 if i == 0 else int('9' * i)
		msnum = 1
		if max_print >= base:
			msnum = (max_print - base) // 10 ** i + 1
		anslist = []
		while True:
			(part_anslist, do_break) = get_anslist(base, msnum, i)
			anslist.append(part_anslist)
			if do_break:
				break
			msnum = (msnum + 10) // 10 * 10
		for part_anslist in anslist:
			prev = None
			incr = True
			for (ans, snuke) in part_anslist:
				if prev is not None and snuke < prev:
					incr = False
				prev = last = snuke
			if incr:
				for (ans, snuke) in part_anslist:
					max_print = print_ans(ans)
			else:
				prev = None
				for (ans, snuke) in part_anslist:
					if snuke <= last:
						max_print = print_ans(ans)
					if prev is not None and prev > snuke:
						break
					prev = snuke
main()


K = int(input())
i = 1
addNum = 1
ans = []
while K != 0:
	print(i)
	K -= 1
	S1 = 0
	S2 = 0
	for j in list(str(i + addNum)):
		S1 += int(j)
	for j in list(str(i + addNum + addNum)):
		S2 += int(j)
	if (i + addNum) / S1 > (i + addNum + addNum) / S2:
		addNum *= 10
	i += addNum


K = int(input())
res = [(0, 0)]
mm = 0
cands = []
for i in range(1, 1000):
	v = i
	for j in range(16):
		cands.append(v)
		v = 10 * v + 9
cands = list(sorted(set(cands)))
for x in cands:
	i = sum((ord(c) - ord('0') for c in str(x)))
	while x / i < res[-1][0]:
		res = res[:-1]
	res.append((x / i, x))
for i in range(1, K + 1):
	print(res[i][1])


import sys
input = sys.stdin.readline

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

def f(x):
	nines = max(0, len(str(x)) - 3)
	base = 10 ** nines - 1
	d = 10 ** nines
	snuke = x
	ratio = x / s(x)
	candidate = base + (x - base + d - 1) // d * d
	for _ in range(150):
		new_ratio = candidate / s(candidate)
		if new_ratio < ratio:
			snuke = candidate
			ratio = new_ratio
		candidate += d
	return snuke

def main():
	k = int(input())
	snuke = 0
	for _ in range(k):
		snuke = f(snuke + 1)
		print(snuke)

def __starting_point():
	main()
__starting_point()


K = int(input())

def S(n):
	m = n
	s = 0
	while m > 0:
		s += m % 10
		m //= 10
	return s
n9 = 0
e = 10 ** n9
count = 0
upper = 1
while count < K:
	n = (upper + 1) * e - 1
	s = S(upper) + 9 * n9
	if n <= e * s:
		print(n)
		upper += 1
		count += 1
	else:
		n9 += 1
		e *= 10
		upper //= 10


def ri():
	return int(input())

def rl():
	return list(input().split())

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

def calc(n):
	s = sum(map(int, str(n)))
	return n / s

def main():
	k = ri()
	cand = list(range(1, 10))
	last = 9
	for n in range(1, 15):
		pow10n = pow(10, n)
		for d in range(1, 10):
			lim = (d + 1) * pow10n
			e = 0
			while True:
				e1 = d * pow10n + e * (last + 1) + last
				if e1 >= lim:
					break
				e2 = e1 + (last + 1)
				if calc(e1) > calc(e2):
					last = last * 10 + 9
					e = 0
					continue
				cand.append(e1)
				e += 1
	cand = sorted(list(set(cand)))
	print('\n'.join(map(str, cand[:k])))

def __starting_point():
	main()
__starting_point()


K = int(input())

def snuke(n):
	n_list = [int(i) for i in list(str(n))]
	return n / sum(n_list)
ans = 1
digit = 0
while K > 0:
	print(ans)
	if snuke(ans + 10 ** digit) > snuke(ans + 10 ** (digit + 1)):
		digit += 1
	ans += 10 ** digit
	K -= 1


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

def norm(n):
	return n / S(n)
k = int(input())
j = 1
order = 1
for i in range(k):
	print(j)
	if norm(j + 10 ** (order - 1)) > norm(j + 10 ** order):
		order += 1
	j += 10 ** (order - 1)


K = int(input())
Sunuke = [1, 2, 3, 4, 5, 6, 7, 8, 9]

def ns(n):
	return n / sum(map(int, list(str(n))))
if K <= len(Sunuke):
	for i in range(K):
		print(Sunuke[i])
else:
	resi = K - len(Sunuke)
	digit = 0
	snk = 9
	while resi > 0:
		nxt1 = snk + 10 ** digit
		nxt2 = snk + 10 ** (digit + 1)
		if ns(nxt1) > ns(nxt2):
			digit += 1
			snk = nxt2
			Sunuke.append(snk)
			resi -= 1
		else:
			snk = nxt1
			Sunuke.append(snk)
			resi -= 1
for i in range(K):
	print(Sunuke[i])


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)


def f(num):
	s = 0
	for char in str(num):
		s += int(char)
	return num / s
K = int(input())
num = 1
power = 1
for _ in range(K):
	print(num)
	if f(num + 10 ** (power - 1)) > f(num + 10 ** power):
		power += 1
	num += 10 ** (power - 1)


def digitsum(n):
	if n < 10:
		return n
	else:
		m = n // 10
		return n % 10 + digitsum(m)
snuke = []
for i in range(4, 16):
	snuke.append(10 ** i - 1)
	min = 10 ** i - 1
	k = 998
	while k >= 100:
		test = k * 10 ** (i - 3) + 10 ** (i - 3) - 1
		if min * digitsum(test) >= test * digitsum(min):
			snuke.append(test)
			min = test
		k -= 1
snuke.append(999)
min = 999
k = 998
while k > 0:
	if min * digitsum(k) >= k * digitsum(min):
		snuke.append(k)
		min = k
	k -= 1
snuke.sort()
K = int(input())
for i in range(0, K):
	print(snuke[i])


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):
		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
		else:
			break
lst.sort()
s = 1
while s < len(lst):
	if lst[s] == lst[s - 1]:
		lst.pop(s)
	else:
		s += 1
for i in range(k - 8):
	print(lst[i])


K = int(input())

def nd(n):
	ans = 0
	nn = n
	while nn > 0:
		ans += nn % 10
		nn //= 10
	return ans / n

def k_next(k):
	d = 1
	c_max = 0
	ans = k
	while d < k * 10:
		cand = (k // d + 1) * d + k % d
		if nd(cand) >= c_max:
			c_max = nd(cand)
			ans = cand
		d *= 10
	return ans
k = 1
for i in range(K):
	print(k)
	k = k_next(k)


K = int(input())
D = {}
for i in range(1, 10 ** 4):
	for j in range(12):
		Sunuke = str(i) + '9' * j
		if len(Sunuke) <= 15 and Sunuke not in D:
			S = 0
			for k in range(len(Sunuke)):
				S += int(Sunuke[k])
			D[int(Sunuke)] = S
D = list(D.items())
D.sort()
import bisect
d = [10 ** 16 for i in range(len(D))]
d[0] = 0
ans = [0 for i in range(len(D))]
for i in range(len(D)):
	ans[bisect.bisect_right(d, D[i][0] / D[i][1])] = D[i][0]
	d[bisect.bisect_right(d, D[i][0] / D[i][1])] = D[i][0] / D[i][1]
ANS = []
MAX = 0
for i in range(len(ans)):
	if ans[i] > MAX:
		ANS.append(ans[i])
		MAX = ans[i]
for i in range(K):
	print(ANS[i])


k = int(input())

def s(n):
	m = str(n)
	l = list(m)
	l = map(int, l)
	return n / sum(l)
p = 1
q = 0
for i in range(k):
	print(p)
	if s(p + 10 ** q) > s(p + 10 ** (q + 1)):
		q += 1
	p += 10 ** q


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

def norm(n):
	return n / S(n)
k = int(input())
j = 1
order = 1
for i in range(k):
	print(j)
	if norm(j + 10 ** (order - 1)) > norm(j + 10 ** order):
		order += 1
	j += 10 ** (order - 1)


K = int(input())
c = 0
tick = 1
i = 1
while c < K:
	s = sum(map(int, list(str(i))))
	if s * tick < i:
		i += 9 * tick
		tick *= 10
	else:
		print(i)
		c += 1
		i += tick


K = int(input())

def calc(n):
	return sum((int(c) for c in str(n)))

def check(n):
	for i in range(1, len(str(n))):
		p = 10 ** i
		m = (n // p + 1) * p - 1
		if n / calc(n) > m / calc(m):
			return False
	return True

def getlist():
	(n, prev_n, d) = (1, 0, 1)
	while 1:
		if check(n):
			yield n
			d = n - prev_n
			prev_n = n
		n += d
from itertools import islice
for n in islice(getlist(), K):
	print(n)


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


k = int(input())

def s(n):
	return sum(list(map(int, str(n))))
seeds = [i for i in range(1, 10)]
for i in range(15):
	for j in range(10):
		for m in range(10):
			for y in range(10):
				seeds.append(int(str(m + j * 10 + y * 100) + str(9) * i))
seeds = [i for i in seeds if i != 0]
l = []
for i in seeds:
	l.append([i, s(i), i / s(i)])
l.sort(key=lambda x: x[2])
max = 0
ans = []
for i in range(len(l)):
	if l[i][0] > max:
		max = l[i][0]
		ans.append(l[i][0])
for i in range(k):
	print(ans[i])


def s(n):
	ret = 0
	for i in range(15):
		ret += n % 10 ** (i + 1) // 10 ** i
	return ret
k = int(input())
ans = set()
for i in reversed(range(14)):
	m = float('inf')
	for j in reversed(range(1, 1000)):
		n = int(str(j) + '9' * i)
		if n / s(n) <= m:
			ans.add(n)
			m = n / s(n)
ans = sorted(list(ans))
for a in ans[:k]:
	print(a)


def sk(k):
	tk = k
	ret = 0
	while tk != 0:
		ret += tk % 10
		tk //= 10
	return ret
ans = []
for i in range(1, 100):
	tmp = i / sk(i)
	if len(ans) == 0:
		ans.append((i, tmp))
	else:
		l = ans[-1]
		if l[1] > tmp:
			ans[-1] = (i, tmp)
		else:
			ans.append((i, tmp))
for j in range(15):
	for i in range(100, 1000):
		n = int(str(i) + ''.join(['9'] * j))
		tmp = n / sk(n)
		if ans[-1][1] > tmp:
			while ans[-1][1] > tmp:
				ans.pop()
		ans.append((n, tmp))
for i in range(int(input())):
	print(ans[i][0])


import sys

def I():
	return int(sys.stdin.readline().rstrip())
K = I()
A = [i for i in range(1, 100)]
for i in range(13):
	for j in range(100, 1000):
		A.append(j * 10 ** i + 10 ** i - 1)
A.sort(reverse=True)
B = []
m = 10 ** 18
for a in A:
	x = a / sum((int(i) for i in list(str(a))))
	if x <= m:
		B.append(a)
		m = x
B.reverse()
print(*B[:K], sep='\n')


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
K = int(read())
cand = set()
for d in range(15):
	for x in range(1, 1000):
		y = x * 10 ** d - 1
		cand.add(y)
cand.remove(0)
cand = sorted(cand, reverse=True)

def S(n):
	x = 0
	while n:
		(q, r) = divmod(n, 10)
		x += r
		n = q
	return x
answer = []
opt_S = 1
opt_N = cand[0] + 1
for x in cand:
	s = S(x)
	if x * opt_S <= s * opt_N:
		answer.append(x)
		opt_S = s
		opt_N = x
print('\n'.join(map(str, answer[::-1][:K])))


K = int(input())

def S(x):
	ret = 0
	while x:
		ret += x % 10
		x //= 10
	return ret
L = set()
nine = ''
for i in range(16):
	for j in range(1, 1000):
		x = int(str(j) + nine)
		L.add(x)
	nine += '9'
L = list(L)
L.sort()
v = [1]
n = [1]
for l in L[1:]:
	x = l / S(l)
	while v[-1] > x:
		v.pop()
		n.pop()
	v.append(x)
	n.append(l)
for i in range(K):
	print(n[i])


K = int(input())
n = 1
k = 0
x = []
y = x.append
while n <= 10 ** 15:
	plus = 10 ** k
	if n >= 1350 * plus:
		n += 9 * plus
		k += 1
		plus *= 10
	y([n, n / sum(map(int, list(str(n))))])
	n += plus
x2 = []
y2 = x2.append
min_ = 10 ** 15
for i in range(len(x) - 1, -1, -1):
	if x[i][1] <= min_:
		y2(x[i][0])
		min_ = x[i][1]
x2 = list(reversed(x2))
for i in range(K):
	print(x2[i])