Problem:


Score : 500 points

Problem Statement

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

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

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

Constraints

1 \leq K

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

Input

Input is given from Standard Input in the following format:

K

Output

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

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19



Sample input:
10


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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
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')

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

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

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

#D
def D():
    K = II()
    ans = 1
    i = 0
    k = 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


#Solve
if __name__ == '__main__':
    D()

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
ans = [1,2,3,4,5,6,7,8]
num = 9
while(len(ans)<K):
    if str(num)[-1]=="9":
        if str(num)[1:].count("9")==len(str(num)[1:]):
            ans.append(num)
    num += 1

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

Submission status: Time Limit Exceeded

Solution code:
def sumdigit(n):
    sum = 0
    for char in str(n):
      sum += int(char)
    return sum

def frac(n):
    return float(n)/sumdigit(n)


if __name__ == "__main__":
    K = int(input())
    ans = [1,2,3,4,5,6,7,8]
    num = 9
    while(len(ans)<K):
        if str(num)[-1]=="9":
            if str(num)[1:].count("9")==len(str(num)[1:]):
                ans.append(num)
        num += 1

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

Submission status: Time Limit Exceeded

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

biggest = 0
numNow = 1
numAns = 0

while numAns < K:
    #make S(n)
    numNowString = str(numNow)
    snuke = 0
    for i in range(len(numNowString)):
        snuke += int(numNowString[i])
    
    if snuke > biggest:
        biggest = snuke
        numAns += 1
        print(numNow)
    
    numNow += 1

Submission status: Time Limit Exceeded

Solution code:
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)

Submission status: Time Limit Exceeded

Solution code:
k = int(''.join(input()))
n = 1
f = 1
min = 0

while k > 0:
  if n < 10:
    min = n
    print(min)
    n = n + 1
    k = k-1
    
  else:
    str_n = str(n)
    ans = str_n[0]
    numlen = len(str_n) - 1
    
    for i in range(numlen):
      ans = ans + '9'
    numans = int(ans)
    if numans > min:
      min = numans
      print(min)
      n = n+1
      k = k-1
    else:
      n = n+1

Submission status: Time Limit Exceeded

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())

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


snum = [0]
for i in range(1, 100000):
    snum.append( i/S(i))
    # print("{i:4d} : ".format(i=i), S(i))
    # print("{i:4d}  S(i): {S}:  i/S(i): {Si}".format(i=i, S=S(i), Si=i/S(i) ))

for i in range(1, 100000):
    if snum[i] == min(snum[i:]):
        print("{i:4d}  S(i): {S}:  i/S(i): {Si}".format(i=i, S=S(i), Si=i/S(i) ))

Submission status: Time Limit Exceeded

Solution code:
iii=int(input())
sunukenumber=0

sn=0
max=0

j=2
while sunukenumber<iii:
  sn=sum(map(int,str(j)))
    
  if max<=j/sn:
    print(j-1)
    max=j/sn
    sunukenumber=sunukenumber+1
    
  sn=0
  j=j+1

exit()

Submission status: Time Limit Exceeded

Solution code:
iii=int(input())
sunukenumber=0
sn=0
max=0

j=2
while sunukenumber<iii:
  sn=sum(map(int,str(j)))
    
  if max<=j/sn:
    print(str(j-1))
    max=j/sn
    sunukenumber=sunukenumber+1
    
  sn=0
  j=j+1

Submission status: Time Limit Exceeded

Solution code:
iii=int(input())
sunukenumber=0

sn=0
max=0

j=2
while sunukenumber<iii:
  jj=str(j)
  for k in range(len(jj)):
    sn=sn+int(jj[k])
    
  if max<=j/sn:
    print(str(j-1))
    max=j/sn
    sunukenumber=sunukenumber+1
    
  sn=0
  j=j+1

Submission status: Time Limit Exceeded

Solution code:
iii=int(input())
sunukelist=[]
sunukenumber=0
#sn=0
 
#for j in range(len(i)):
#  sn=sn+int(i[j])
#mae=0
sn=0
max=0
min=0
j=2
while sunukenumber<iii:
  jj=str(j)
  for k in range(len(jj)):
    sn=sn+int(jj[k])
    
  if max<=j/sn:
    #print(str(j)+"-"+ str(j/sn) +"o ")
    sunukelist.append(j-1)
    max=j/sn
    #print("max="+str(max) +"sonotoki"+str(j))
    sunukenumber=sunukenumber+1
    
  #else:
    #print(str(j)+"-"+ str(j/sn) +"x ")
    
  sn=0
  j=j+1

  
for w in sunukelist:
  print(w)

Submission status: Time Limit Exceeded

Solution code:
K=int(input())
for i in range(3):
    for j in range(1,10):
        print(10**i*j+10**i-1)
        K-=1
        if K==0:
            break
    if K==0:
        break

if K!=0:
    for i in range(3,1000000):
        for j in range(1,10):
            if j < 3:
                for k in range(0,10):
                    print(10**i*j+10**(i-1)*(k+1)+-1)
                    K-=1
                    if K==0:
                        break
                if K==0:
                    break
            if K==0:
                break

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
count = 0
n = 1
while count < K:
	n_ = str(n)
	if n < 10:
		n_ = "9"
	elif 9 < n < 100:
		n_ = n_[0] + "9"
	else:
		n_ = n_[0:-2] + "9"
	
	n = str(n)
	S_n = 0
	S_n_ = 0	
	for i in range(len(n_)):
		S_n_ += int(n_[i])
	
	for i in range(len(n)):
		S_n += int(n[i])
	
	n = int(n)
	n_ = int(n_)
	if (n_ / S_n_) >= (n / S_n):
		print(n)
		count += 1
	n += 1

Submission status: Time Limit Exceeded

Solution code:
import math
n=int(input())
a,b=0,0
while b<n:
    a+=1
    x=math.ceil(a/10)*10+10
    if all([a/sum(map(int,str(a)))<=float(i)/sum(map(int,str(i)))for i in range(a+1,x)]):
        b+=1
        print(a)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
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

# @mt
def slv(K):
    ans = [(i, i/S(i)) for i in range(1, 10)]
    for i in range(16):
        a = i
        if a > 5:
            a = 5
        for j in range(1, 10**a):
            b = (10**(i-a+1))*j + (10**(i-a+1)-1)
            s = S(b)
            
            while ans[-1][1] > b/s or ans[-1][0] == b:
                ans.pop()
            ans.append((b, b/s))
            # print(ans[-1])
    # error_print(len(ans))
    # for r in ans:
    #     error_print(r)
    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()

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
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

# @mt
def slv(K):
    ans = [(-1, 0)]
    for i in range(16):
        if i < 5:
            a = 1
        else:
            a = 5
        for j in range(1, 10**a):
            b = (10**(i-a+1))*j + (10**(i-a+1)-1)
            s = S(b)
            
            while ans[-1][1] > b/s:
                ans.pop()
            ans.append((b, b/s))
            # print(ans[-1])
    ans.pop(0)

    
    return '\n'.join(map(str, map(lambda x: x[0], ans[:K])))


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

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

def isSunuke(n):

	if n >= 10:
		sn = str(n)
		length = len(sn)
		nines = 0
		for c in sn:
			if c == "9":
				nines += 1
		if nines < length / 2:
			n += 1
			return False

	for m in range(n+1, n * 2):
		if m >= 10:
			sm = str(m)
			length = len(sm)
			nines = 0
			for c in sm:
				if c == "9":
					nines += 1
			if nines < length / 2:
				continue

		if (n / s(n)) > (m / s(m)):
			return False

	return True

k = int(input())
found=0
n = 1
while(found < k):

	if isSunuke(n):
		print(n)
		found +=1
		#n += (n//20)
	n += 1

Submission status: Time Limit Exceeded

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

def isSunuke(n):
	for m in range(n+1, n * 100):
		if m >= 10:
			sm = str(m)
			length = len(sm)
			nines = 0
			for c in sm:
				if c == "9":
					nines += 1
			if nines < length / 2:
				continue

		if (n / s(n)) > (m / s(m)):
			return False
	return True

k = int(input())
found=0
n = 1
while(found < k):

	if n >= 10:
		sn = str(n)
		length = len(sn)
		nines = 0
		for c in sn:
			if c == "9":
				nines += 1
		if nines < length / 2:
			n += 1
			continue

	if isSunuke(n):
		print(n)
		found+=1
	n += 1

Submission status: Time Limit Exceeded

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

def isSunuke(n):
	for m in range(n+1, n * 100):
		if (n / s(n)) > (m / s(m)):
			return False
	return True

k = int(input())
found=0
n = 1
while(found < k):
	
	if n >= 10:
		sn = str(n)
		length = len(sn)
		nines = 0
		for c in sn:
			if c == "9":
				nines += 1
		if nines < length / 2:
			n += 1
			continue

	if isSunuke(n):
		print(n)
		found+=1
	n += 1

Submission status: Time Limit Exceeded

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

def isSunuke(n):
	for m in range(n+1, n * 10):
		if (n / s(n)) > (m / s(m)):
			return False
	return True

k = int(input())
found=0
n = 1
while(found < k):
	if isSunuke(n):
		print(n)
		found+=1
	n += 1

Submission status: Time Limit Exceeded

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

def isSunuke(n):
	for m in range(n+1, n * 100):
		if (n / s(n)) > (m / s(m)):
			return False
	return True

k = int(input())
found=0
n = 1
while(found < k):
	if isSunuke(n):
		print(n)
		found+=1
	n += 1

Submission status: Time Limit Exceeded

Solution code:
K=int(input())

def ch(n):
  for s in n:
    if s!='9':
      return False
  return True

c=0
i=1
while c<K:
  if i<10:
    print(i)
    c+=1
  elif ch(list(str(i))[1:]):
    print(i)
    c+=1
  i+=1

Submission status: Time Limit Exceeded

Solution code:
k = input()
K = int(k)
j = 1
count = 0
while True:
    a = 0
    j = str(j)
    for i in range(len(j)):
        a += int(j[i:i+1])
    j = int(j)
    if j/a < 2:
        print(j)
        count += 1
    if count == K:
        break
    j += 1

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-


def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]         
for i in range(0,16):
    for j in range(1,136):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=1

A = list(set(A))
A.sort()

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-


def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]         
for i in range(0,30):
    for j in range(1,151):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=1

A = list(set(A))
A.sort()

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

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python
# -*- coding:utf-8 -*-


def digit(i):
    if i>0:
        return digit(i//10)+[i%10]
    else:
        return []

def Sooo(N):
    return float(N/sum(digit(N)))
base=1
A=[]
for i in range(0,16):
    for j in range(1,151):
        re=base*(j+1)-1
        A.append(int(re))
    base = base*10
A = list(set(A))
A.sort()

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        N=Sooo(A[i])
        M=Sooo(A[j])
        if N>M:
            A[i]=1

A = list(set(A))
A.sort()

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

Submission status: Time Limit Exceeded

Solution code:
def sn(x):
    return x / sum(map(int, str(x)))

##10 ** (d - 1) <= n < 10 ** dのとき、n / S(n) の下界
def lb(d):
    return 10 ** (d - 1) / (9 * d)

def f(N):
    d = 1
    while lb(d) <= sn(N):
        d += 1

    buf = float('inf')
    idx = -1
    for i in range(N, 10 ** (d - 1)):
        if buf > sn(i):
            buf = sn(i)
            idx = i
    return idx

if __name__ == '__main__':
    k = int(input())
    a = []
    N = 0
    while len(a) < k:
        N =  f(N + 1)
        print(N)
        a += [N]

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
k = int(input())

count = 0
ans = []
minN = 10**15

for i in reversed(range(10)):
    for j in reversed(range(1,10**5)):
        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(num)

print(len(ans[0]))
for i in list(reversed(ans))[:k]:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
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
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)
        c += 1
        if c >= K:
            break
    i += 1

Submission status: Time Limit Exceeded

Solution code:
K = int(input())

a,b = [],[]
for i in range(16):
    for j in range(1,1001):
        a.append(int(str(j)+"9"*i))
        b.append(a[-1] / sum(list(map(int, str(a[-1])))))

n = 0
while True:
    for i in range(len(b)):
        if min(b[(i+1):]) >= b[i]:
            print(a[i])
            n += 1
            if n == K: exit()

Submission status: Time Limit Exceeded

Solution code:
k = int(input())
z=1
n=1
while z<=k:
    a=1
    l=len(str(n))
    s = str(n)
    x = list(map(int, list(s)))
    while a<=l:
        if x[0]==1 and l>3:
            if l-a-1==0:
                print(n)
                a=a+100
                z=z+1
            elif n==19:
                print(19)
                a=a+100
                z=z+1
            elif x[l-a]==9:
                a=a+1
            else:
                a=a+100
        else:
            if a-l==0:
                print(n)
                a=a+100
                z=z+1
            elif n==19:
                print(19)
                a=a+100
                z=z+1
            elif x[l-a]==9:
                a=a+1
            else:
                a=a+100
    n=n+1

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
#K = 10

c = 0
keta = 0
keta_now = 1
for i in range(10 **15 +1):
    i += 1
    if keta_now * 10 == i:
        keta_now *= 10
    if (i+1) % keta_now == 0:
        print(i)
        c += 1
        if c == K:
            break

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
f = 0
num = 1
while f < K:
	keta = len(str(num))
	if keta == 1:
		print(num)
		f += 1
	elif keta == 2:
		if num % 10 == 9:
			print(num)
			f += 1
	else:
		if num % 10 ** (keta-2) == int('9'*(keta-2)):
			print(num)
			f += 1 
	num += 1

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 5):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for i in range(len(str(n)) - 2, len(str(n))):
        if i < 1:
            continue
        m = str(n)[:-i]
        add_num = 1
        for _ in range(0, i):
            m += '0'
            add_num *= 10
        m = int(m)
        m += add_num - 1
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break

    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 5):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for i in range(len(str(n)) - 3, len(str(n))):
        if i < 1:
            continue
        m = str(n)[:-i]
        add_num = 1
        for _ in range(0, i):
            m += '0'
            add_num *= 10
        m = int(m)
        m += add_num - 1
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break

    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

Solution code:
# https://beta.atcoder.jp/contests/abc101/tasks/arc099_b
# D - Snuke Numbers

# D_Snuke_Numbers.py

K = int(input())
#K = 10

M = 10 **15 +1
c = 0
keta = 0
for i in range(M):
    i += 1
    if 10 ** (keta + 1) == i:
        keta += 1
    if (i+1) % (10**keta) == 0:
        print(i)
        c += 1
        if c == K:
            break

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 5):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for i in range(len(str(n)) - 5, len(str(n))):
        if i < 1:
            continue
        m = str(n)[:-i]
        add_num = 1
        for _ in range(0, i):
            m += '0'
            add_num *= 10
        m = int(m)
        m += add_num - 1
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break

    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 10):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for i in range(len(str(n)) - 5, len(str(n))):
        if i < 1:
            continue
        m = str(n)[:-i]
        add_num = 1
        for _ in range(0, i):
            m += '0'
            add_num *= 10
        m = int(m)
        m += add_num - 1
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break

    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 10):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for i in range(len(str(n)) - 10, len(str(n))):
        if i < 1:
            continue
        m = str(n)[:-i]
        add_num = 1
        for _ in range(0, i):
            m += '0'
            add_num *= 10
        m = int(m)
        m += add_num - 1
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break

    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

Solution code:
from bisect import insort_right
from sys import stdin, stdout
input = lambda: stdin.readline().rstrip()
write = stdout.write

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

    num = []
    for i in range(1, 200000):
        n = i / sum(map(int, list(str(i))))
        insort_right(num, (n, i))

    for i in num[:K]:
        write(str(i[1]) + '\n')

main()

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 10):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for m in range(n + 1+10, n + 1 + 10+100*3, 3):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
            
    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

Solution code:
k = int(input())

def sum_digit(num):
    strnum = str(num)
    sumdig = 0
    for d in strnum:
        sumdig += int(d)
    return num / sumdig

s = []
i = 1
while True:
    if len(s) == k:
        break
    if sum_digit(i) <= min(sum_digit(i+1), sum_digit(i+10), sum_digit(i+100)) :
        s.append(i)
        print(i)
    i += 1

Submission status: Time Limit Exceeded

Solution code:
k = int(input())
sunuke = [1,2,3,4,5,6,7,8,9]


now = 10
l = 1
while len(sunuke) < k:
    tmp = []
    a = tmp.append
    for i in str(now):
        a(int(i))

    tmp2 = sum(tmp)

    if len(str(tmp2)) == len(tmp):

        sunuke.append(now)
        l = len(tmp)

    now += 1


for i in sunuke:
    print(i,end=" ")
print()

Submission status: Time Limit Exceeded

Solution code:
K = input()


def Sn(N1):
    Sn = 0
    N = str(N1)
    for i in range(len(N)):
        Sn = Sn + int(N[i])

    return Sn

R = []
for i in range(1,1000):
    X = 0
    for j in range(i,2000):
        if(i/Sn(i) <= j/Sn(j)):
            X = X + 1

        if (X ==  2000 - i ):
            R.append(i)


for i in range(0,int(K)):
    print(R[i])

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
count = 0
for i in range(1000000000000000000000000000000000000000000000000000000000000):
    if(count == K):
        break
    num = 0
    try:
        tmp = str(i)
        for j in tmp:
            num += int(j)
        # print("n:{},  s:{}, ans ={}".format(i,num,int(i) / num))
        if(i < 10 or tmp[1:] == "9" * (len(tmp)-1)):
            if(i != 0):
                print(i)
                # print("n:{},  s:{}, ans ={}".format(i, num, int(i) / num))
                count += 1
    except:
        continue

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
f = 0
num = 1
while f < K:
	keta = len(str(num))
	if keta == 1:
		print(num)
		f += 1
	elif keta == 2:
		if num % 10 == 9:
			print(num)
			f += 1
	else:
		if num == 10 ** (keta-1):
			nine = ''
		for _ in range(keta-1):
			nine += '9'
		if num % 10 ** (keta-1) == int(nine):
			print(num)
			f += 1 
	num += 1

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 10):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for m in range(n + 1+10, n + 1 + 10+10*30, 3):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
            
    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

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

def get_s(n):
    s_n = 0
    for e_str in str(n):
        s_n += int(e_str)
    return s_n

n = 1
ans = set()
while(True):
    s_n = get_s(n)
    left = n / s_n
    is_not_sunuke = False
    for m in range(n + 1, n + 1 + 10):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
    for m in range(n + 1+10, n + 1 + 10+10*40, 3):
        s_m = get_s(m)
        right = m / s_m
        if left > right:
            is_not_sunuke = True
            break
            
    if not is_not_sunuke:
        ans.add(n)
    n += 1
    if len(ans) >= k:
        break

ans_list = list(ans)
ans_list.sort()
for i in range(0, k):
    print(ans_list[i])

Submission status: Time Limit Exceeded

Solution code:
k = int(input())
sunuke = [1,2,3,4,5,6,7,8,9]


now = 10
l = 1
while len(sunuke) < k:
    tmp = []
    for i in str(now):
        tmp.append(int(i))

    tmp2 = sum(tmp)

    if len(str(tmp2)) == len(tmp):

        sunuke.append(now)
        l = len(tmp)

    now += 1


for i in sunuke:
    print(i,end=" ")
print()

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
sunuke_num = [0] * 250000
for num in range(1, 250001):
    sunuke_num[num-1] = num / sum([int(i) for i in list(str(num))])

for i in range(len(sunuke_num)-1):
    flg = 1
    for j in range(i + 1, len(sunuke_num)):
        if sunuke_num[i] > sunuke_num[j]:
            flg = 0
            break
    if flg:
        K -= 1
        print(i+1)
        if K == 0:
            break

Submission status: Time Limit Exceeded

Solution code:
K = int(input())
f = 0
num = 1
while f < K:
	keta = len(str(num))
	if keta == 1:
		print(num)
		f += 1
	elif keta == 2:
		if num % 10 == 9:
			print(num)
			f += 1
	else:
		nine = ''
		for _ in range(keta-1):
			nine += '9'
		if num % 10 ** (keta-1) == int(nine):
			print(num)
			f += 1 
	num += 1