Problem:


Score : 500 points

Problem Statement

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

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

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

Constraints

1 \leq K

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

Input

Input is given from Standard Input in the following format:

K

Output

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

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19



Sample input:
10


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

Submission status: Wrong Answer

Solution code:
K = int(input())

tmp = 0
dif = 1
for i in range(1,K+1):
  tmp += dif
  print(tmp)
  if i % 9 == 0:
    dif *= 10

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
K = int(input())

# 求解処理
k = 1
while k <= K:
    snuke = 0
    if k <= 9:
        snuke = k
    else:
        snuke = 2 * 10**(k - 9) - 1
    print(snuke)
    k += 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
K = int(input())

# 求解処理
k = 1
while k <= K:
    snuke = 0
    if k <= 9:
        snuke = k
    else:
        snuke = 10**(k - 9) + 9
    print(snuke)
    k += 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# 標準入力を取得
K = int(input())

# 求解処理
k = 1
while k <= K:
    snuke = 0
    if k <= 9:
        snuke = k
    else:
        snuke = (k - 9) * 10 + 9
    print(snuke)
    k += 1

Submission status: Wrong Answer

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

print(snuke(10248))

Submission status: Wrong Answer

Solution code:
k = int(input())

numbers = ['1', '2', '3', '4', '5', '6', '7', '8', '9']

for i in range(k//9):
    for j in numbers:
        print(j + '9' * i)
i += 1
for j in numbers[:k%9]:
    print(j + '9' * i)

Submission status: Wrong Answer

Solution code:
from itertools import count
import sys
K = int(input())

def solve(K):
    for i in count():
        for j in range(1, 10):
            if K == 0:
                return
            print(int(str(j) + ('9' * i))) 
            K -= 1

solve(K)

Submission status: Wrong Answer

Solution code:
L=list()
N=int(input())
for i in range(1,N+1):
  s=i//9
  t=i%9
  L.append(((t+1)*pow(10,s))-1)
for i in range(2,19):
  for j in range(1,10):
    for s in range(1,min(10,i)):
      L.append((s*10+j)*pow(10,i)-1)
L=sorted(list(set(L)))
for i in range(N):
  print(L[i])

Submission status: Wrong Answer

Solution code:
L=list()
N=int(input())
for i in range(1,N+1):
  s=i//9
  t=i%9
  L.append(((t+1)*pow(10,s))-1)
for i in range(2,19):
  for j in range(1,10):
    for s in range(1,i):
      L.append((s*10+j)*pow(10,i)-1)
L=sorted(list(set(L)))
for i in range(N):
  print(L[i])

Submission status: Wrong Answer

Solution code:
L=list()
N=int(input())
for i in range(1,N+1):
  s=i//9
  t=i%9
  L.append(((t+1)*pow(10,s))-1)
for i in range(2,19):
  for j in range(1,10):
    L.append((10+j)*pow(10,i)-1)
L=sorted(L)
for i in range(N):
  print(L[i])

Submission status: Wrong Answer

Solution code:
L=list()
N=int(input())
for i in range(1,N+1):
  s=i//9
  t=i%9
  L.append(((t+1)*pow(10,s))-1)
for i in range(2,15):
  for j in range(1,10):
    L.append((10+j)*pow(10,i)-1)
L=sorted(L)
for i in range(N):
  print(L[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
for i in range(1,N+1):
  s=i//9
  t=i%9
  print(((t+1)*pow(10,s))-1)

Submission status: Wrong Answer

Solution code:
def main():
    K = int(input())
    d = ''
    cnt = 0
    while True:
        for n in range(1, 10):
            print(str(n)+d)
            cnt += 1
            if cnt >= K:
                return
        d += '9'


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline


def main():
    k = int(input())
    snuke = 1
    d = 1
    for _ in range(k):
        print(snuke)
        if snuke == 10*d - 1:
            d *= 10
        snuke += d


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

k = int(input())

a = 0
keta = 10**0
obj = 9
for i in range(k):
    a += keta
    print(a)
    if a == obj:
        keta *= 10
        obj = a+9*keta

Submission status: Wrong Answer

Solution code:
K = int(input())
if K < 10:
    print(*list(range(1, K + 1)), sep='\n')
    exit()
prev = list(range(1, 10))
ans = prev[:]
while len(ans) < K:
    cur = []
    for n in prev:
        cur.append(10 * n + 9)
    ans += cur
    prev = cur
print(*ans[:K], sep='\n')

Submission status: Wrong Answer

Solution code:
K = int(input())
if K < 10:
    print(*list(range(1, K + 1)), sep='\n')
    exit()
print(*list(range(1, 10)), sep='\n')
K -= 9
for i in range(K):
    print(10 * (i + 1) + 9)

Submission status: Wrong Answer

Solution code:
s=set()
for i in range(1,10):
    s.add(i)
for i in range(17):
    k=str(10**(i+1) - 1)
    for j in range(0,(i+1)*10):
        s.add(int(str(j)+k))
ar=sorted(s)

k=int(input())
for i in range(k):
    print(ar[i])

Submission status: Wrong Answer

Solution code:
s=set()
for i in range(1,10):
    s.add(i)
for i in range(17):
    k=str(10**(i+1) - 1)
    for j in range(1,(i+1)*10):
        s.add(int(str(j)+k))
ar=sorted(s)

k=int(input())
for i in range(k):
    print(ar[i])

Submission status: Wrong Answer

Solution code:
temp=[ 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]
s=set()
for i in range(1,10):
    s.add(i)
for i in range(17):
    k=str(10**(i+1) - 1)
    for j in range(1,temp[i]+1):
        s.add(int(str(j)+k))
ar=sorted(s)

k=int(input())
for i in range(k):
    print(ar[i])

Submission status: Wrong Answer

Solution code:
temp=[ 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]
s=set()
for i in range(1,10):
    s.add(i)
for i in range(13):
    k=str(10**(i+1) - 1)
    for j in range(1,temp[i]+1):
        s.add(int(str(j)+k))
ar=sorted(s)

k=int(input())
for i in range(k):
    print(ar[i])

Submission status: Wrong Answer

Solution code:
k= int(input())

for i in range(k):
    x = i//9
    y = i%9 +1
    z = int(str(y)+"9"*x)
    if x <=1:
        print(z)
    else:
        y = (i-17)%99
        z = (i-17)//99
        print(int(str(y)+"9"*2))

Submission status: Wrong Answer

Solution code:
k= int(input())

for i in range(k):
    x = i//9
    y = i%9 +1
    z = int( str(y)+"9"*x)
    print(z)

Submission status: Wrong Answer

Solution code:
def nineNumber(n):
    shou = n // 9
    amari = n % 9
    return (amari + 2) * (10 ** shou) - 1


if __name__ == "__main__":
    K = int(input())
    for i in range(K):
        print(nineNumber(i))

Submission status: Wrong Answer

Solution code:
K = int(input())

for i in range(K):
    if i < 9:
        print(i + 1)
    else:
        print((i - 8) * 10 + 9)

Submission status: Wrong Answer

Solution code:
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(14):
    for i in range(10,100):
        ns=str(i)+''.join(['9']*j)
        nm=int(ns)
        tp=nm/sk(nm)
        ls=an[-1]
        if ls[1] > tp:an[-1]=(nm,tp)
        else:an.append((nm,tp))
for i in range(int(input())):print(an[i][0])

Submission status: Wrong Answer

Solution code:
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret

ansl = []
heapq.heapify(ansl)
#maxnum=0
for i in range(1,100):
    temp =  i/sk(i)
    heapq.heappush(ansl,(temp,i))
for i in range(100,1000):
    for j in range(12):
        numstr = str(i)+''.join(['9']*j)
        num = int(numstr)
        #maxnum=max(maxnum,num)
        temp = num/sk(num)
        heapq.heappush(ansl,(temp,num))
#print('maxnum:',maxnum)
k= int(input())
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(tempa[1])
    if i==k:
        break
    i+=1

Submission status: Wrong Answer

Solution code:
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret
ansl = []
heapq.heapify(ansl)
for i in range(1,100):
    temp =  i/sk(i)
    heapq.heappush(ansl,(temp,i))
for i in range(100,1000):
    for j in range(14):
        numstr = str(i)+''.join(['9']*j)
        num = int(numstr)
        temp = num/sk(num)
        heapq.heappush(ansl,(temp,num))
k= int(input())
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(tempa[1])
    if i==k:
        break
    i+=1

Submission status: Wrong Answer

Solution code:
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret

k= int(input())
ansl = []
heapq.heapify(ansl)
mmin = 99999999.0
for i in range(1,10*k+1):
    if i%10==0:pass
    else:
        temp = i/sk(i)
        heapq.heappush(ansl,(temp,i))
        mmin = min(mmin,temp)
needcalc=0
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(tempa[1])
    if i==k:
        break
    i+=1

Submission status: Wrong Answer

Solution code:
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret
k= int(input())
ansl = []
heapq.heapify(ansl)
mmin = 99999999.0
for i in range(1,3*k+1):
    if i%10==0:pass
    else:
        temp = i/sk(i)
        heapq.heappush(ansl,(temp,i))
        mmin = min(mmin,temp)
needcalc=0
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(tempa[1])
    if i==k:
        break
    i+=1

Submission status: Wrong Answer

Solution code:
import heapq
def sk(k):
    tempk = k
    ret = 0
    while tempk!=0:
        ret+=tempk%10
        tempk//=10
    return ret
k= int(input())
ansl = []
heapq.heapify(ansl)
mmin = 99999999.0
for i in range(1,3*k+1):
    if i%10==0:pass
    else:
        temp = i/sk(i)
        heapq.heappush(ansl,(temp,i))
        mmin = min(mmin,temp)
needcalc=0
i=1
while len(ansl)!=0:
    tempa = heapq.heappop(ansl)
    print(i,tempa[1])
    if i==k:break
    i+=1

Submission status: Wrong Answer

Solution code:
k=int(input())
ans=0
count=0
for i in range(1,k+1):
    ans+=1
    if ans==10:
        ans=1
        count+=1
    anser=str(ans)
    for _ in range(count):
        anser+='9'

    print(anser)

Submission status: Wrong Answer

Solution code:
k=int(input())
for i in range(1,k+1):
    if i%10==0:continue
    ans=str(i%10)
    for j in range(int(i/10)):
        ans+='9'
    print(ans)

Submission status: Wrong Answer

Solution code:
k=int(input())
for i in range(1,k+1):
    ans=str(i%10)
    if ans=='0':  ans='1' 
    for j in range(int(i/10)):
        ans+='9'
    print(ans)

Submission status: Wrong Answer

Solution code:
k=int(input())
cnt=0
pre=0
while cnt<k:
  if cnt<27:
    print(str(cnt%9+1)+'9'*(cnt//9))
    pre=int(str(cnt%9+1)+'9'*(cnt//9))
  else:
    ans_len=len(str(pre+1))
    if str(pre+1)[0]<=str(ans_len-3):
      print(str(pre+1)[:2]+'9'*(ans_len-2))
      pre=int(str(pre+1)[:2]+'9'*(ans_len-2))
    else:
      print(str(pre+1)[0]+'9'*(ans_len-1))
      pre=int(str(pre+1)[0]+'9'*(ans_len-1))
  cnt+=1

Submission status: Wrong Answer

Solution code:
k=int(input())
l=list(range(1,10))
cnt=0
while cnt<k:
  print(str(l[cnt%9])+'9'*(cnt//9))
  cnt+=1

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


def main():
    K = int(input())
    for i in range(K // 9):
        base = 10 ** i
        for j in range(2, 11):
            print(base * j - 1)
    base = 10 ** (K // 9)
    for j in range(2, K - (K // 9) * 9 + 2):
        print(base * j - 1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
K = int(input())
snuke = []
for i in range(100):
    for j in range(1,10):
        snuke.append(int(str(j) + "9"*i))

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

Submission status: Wrong Answer

Solution code:
K = int(input())
num = 0
count = 0
d = 0
while count <K:
    for _ in range(9):
        num += 10**d
        count += 1
        print(num)
        if count>=K: break
    d += 1

Submission status: Wrong Answer

Solution code:
k=int(input())
for i in range(15):
  for j in range(1,10):
    print((j+1)*(10**i)-1)
    k-=1
    if k==0:
      exit()

Submission status: Wrong Answer

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

import sys
sys.setrecursionlimit(300000)


def solve(K: int):
    d = 1
    while K > 0:
        for i in range(1, 10):
            ret = i * d + d - 1
            print(ret)
            K -= 1
            if K == 0:
                return
        d *= 10
    return

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
k=int(input())

for i in range(1,k+1):
    b = i % 9
    a = i - b
    while a > 0:
        b = b*10 + 9
        a -= 9
    print(b)

Submission status: Wrong Answer

Solution code:
k=int(input())

p = 0
for i in range(k):
    n = i%9 + 1
    pr = n * pow(10,p)
    if p > 0:
        pr -= 1
    print(pr)
    if n == 9:
        p += 1

Submission status: Wrong Answer

Solution code:
k=int(input())

p = 0
for i in range(k):
    n = i%9 + 1
    print(n * pow(10,p))
    if n == 9:
        p += 1

Submission status: Wrong Answer

Solution code:
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(n,base=2):
    rt=[]
    for tb in range(base**n):s=[tb//(base**bt)%base for bt in range(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
 
YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
input=lambda: sys.stdin.readline().rstrip()

class Tree:
    def __init__(self,inp_size=None,ls=None,init=True,index=0):
        self.LCA_init_stat=False
        self.ETtable=[]
        if init:
            if ls==None:
                self.stdin(inp_size,index=index)
            else:
                self.size=len(ls)+1
                self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def stdin(self,inp_size=None,index=1):
        if inp_size==None:
            self.size=int(input())
        else:
            self.size=inp_size
        self.edges,_=GI(self.size,self.size-1,index=index)
        return
    
    def listin(self,ls,index=0):
        self.size=len(ls)+1
        self.edges,_=GI(self.size,self.size-1,ls,index=index)
        return
 
    def __str__(self):
        return  str(self.edges)
 
    def dfs(self,x,func=lambda prv,nx,dist:prv+dist,root_v=0):
        q=deque()
        q.append(x)
        v=[-1]*self.size
        v[x]=root_v
        while q:
            c=q.pop()
            for nb,d in self.edges[c]:
                if v[nb]==-1:
                    q.append(nb)
                    v[nb]=func(v[c],nb,d)
        return v
 
    def EulerTour(self,x):
        q=deque()
        q.append(x)
        self.depth=[None]*self.size
        self.depth[x]=0
        self.ETtable=[]
        self.ETdepth=[]
        self.ETin=[-1]*self.size
        self.ETout=[-1]*self.size
        cnt=0
        while q:
            c=q.pop()
            if c<0:
                ce=~c
            else:
                ce=c
                for nb,d in self.edges[ce]:
                    if self.depth[nb]==None:
                        q.append(~ce)
                        q.append(nb)
                        self.depth[nb]=self.depth[ce]+1
            self.ETtable.append(ce)
            self.ETdepth.append(self.depth[ce])
            if self.ETin[ce]==-1:
                self.ETin[ce]=cnt
            else:
                self.ETout[ce]=cnt
            cnt+=1
        return
    
    def LCA_init(self,root):
        self.EulerTour(root)
        self.st=SparseTable(self.ETdepth,init_func=min,init_idl=inf)
        self.LCA_init_stat=True
        return
    
    def LCA(self,root,x,y):
        if self.LCA_init_stat==False:
            self.LCA_init(root)
        xin,xout=self.ETin[x],self.ETout[x]
        yin,yout=self.ETin[y],self.ETout[y]
        a=min(xin,yin)
        b=max(xout,yout,xin,yin)
        id_of_min_dep_in_et=self.st.query_id(a,b+1)
        return self.ETtable[id_of_min_dep_in_et]
 
class SparseTable: # O(N log N) for init, O(1) for query(l,r)
    def __init__(self,ls,init_func=min,init_idl=float('inf')):
        self.func=init_func
        self.idl=init_idl
        self.size=len(ls)
        self.N0=self.size.bit_length()
        self.table=[ls[:]]
        self.index=[list(range(self.size))]
        self.lg=[0]*(self.size+1)
        
        for i in range(2,self.size+1):
            self.lg[i]=self.lg[i>>1]+1
 
        for i in range(self.N0):
            tmp=[self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) for j in range(self.size)]
            tmp_id=[self.index[i][j] if self.table[i][j]==self.func(self.table[i][j],self.table[i][min(j+(1<<i),self.size-1)]) else self.index[i][min(j+(1<<i),self.size-1)] for j in range(self.size)]
            self.table+=[tmp]
            self.index+=[tmp_id]
    
    # return func of [l,r)
    def query(self,l,r):
        if r>self.size:r=self.size
        #N=(r-l).bit_length()-1
        N=self.lg[r-l]
        return self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))])
    
    # return index of which val[i] = func of v among [l,r)
    def query_id(self,l,r):
        if r>self.size:r=self.size
        #N=(r-l).bit_length()-1
        N=self.lg[r-l]
        a,b=self.index[N][l],self.index[N][max(0,r-(1<<N))]
        if self.table[0][a]==self.func(self.table[N][l],self.table[N][max(0,r-(1<<N))]):
            b=a
        return b
    
    def __str__(self):
        return str(self.table[0])
 
    def print(self):
        for i in self.table:
            print(*i)

def dijkstra(edge,st):
    # edge=[[(v_to,dist_to_v),...],[],...]
    # initialize: def: d=dist(st,i), prev=[previous vertex in minimum path], q[]
    n=len(edge)
    d=[(0 if st==i else inf) for i in range(n)]
    prev=[0]*n
    q=[(j,i) for i,j in enumerate(d)]
    heapify(q)
    v=[False]*n
    # calc
    while q:
        dist,cur=heappop(q)
        if v[cur]:
            continue
        v[cur]=True
        for dst,dist in edge[cur]:
            alt=d[cur]+dist
            if alt<d[dst]:
                d[dst]=alt
                prev[dst]=cur
                heappush(q,(alt,dst))
    return d,prev

show_flg=False
show_flg=True
ans=0



k=I()


def sn(x):
    return x/sum([int(i) for i in str(x)])

c=i=0
m=-1
ans=list(range(1,10))
while c<k:
    c+=1
    i+=1
    ans+=[i*10+9]

for i in ans[:k]:
    print(i)
exit()

N=1000
for i in range(1,N):
    print(i,sn(i),)

while c<k and i<100:
    i+=1
    
    if sn(i)>=m:
        m=sn(i)
        print(i,sn(i),m)
        c+=1

Submission status: Wrong Answer

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

# 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 29, 39, 49, 59, 69, 79, 89, 99, 199, 299, 399, ... , 1999, 2999, ...

k = I()
for i in range(k):
    a = i // 9
    b = i % 9
    print(str(b+1)+str(9)*a)

Submission status: Wrong Answer

Solution code:
k = int(input())

footer = ""
footer_sub = ""
flag_num = -1
count = 0
while True:
    for i in range(1, 10):
        if i <= flag_num:
            for j in range(9):
                print(str(i) + str(j) + footer_sub)
                count += 1
                if count >= k:
                    exit()
        print(str(i) + footer)
        count += 1
        if count >= k:
            exit()
    
    footer += "9"
    footer_sub = footer[:-1]
    flag_num += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

footer = ""
count = 0
while count < k:
    for i in range(1, 10):
        print(str(i) + footer)
        count += 1
        if count >= k:
            break
    footer += "9"

Submission status: Wrong Answer

Solution code:
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)
A=[i for i in range(1,10)]
import functools
i=1
j=1
while len(A)<k:
    A.append((j+1)*10**(i)-1)
    j+=1
    if j==10:
        j=1
        i+=1
for i in range(k):
    print(A[i])

Submission status: Wrong Answer

Solution code:
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())
A=list()
i=0
while len(A)<k:
    i+=1
    if i/S(i)<=(i+1)/S(i+1):
        A.append(i)
for j in A:
    print(j)

Submission status: Wrong Answer

Solution code:
k = int(input())
p = 1
e = 0
for i in range(k):
  print(str(p) + '9' * e)
  p += 1
  if p > 9:
    p = 1
    e += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

l = []
for i in range(17):
    ten = 10**i
    for j in range(1,100):
        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

Submission status: Wrong Answer

Solution code:
k = int(input())

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

Submission status: Wrong Answer

Solution code:
k = int(input())

for i in range(1, min(10, k)):
    print(i)
if k <= 9:
    exit()

j = 1
cnt = 9

while True:
    for i in range(2, 11):
        print((i * 10**j) - 1)
        cnt = cnt + 1
        if cnt >= k:
            exit()
    j = j + 1

Submission status: Wrong Answer

Solution code:
k = int(input())

for i in range(1, min(10, k+1)):
    print(i)

for i in range(10, k+1):
    print(9 + 10*(i-9))

Submission status: Wrong Answer

Solution code:
K = int(input())

count = 0

finished = False

nines = 0

while not finished:
    for i in range(1, 10):
        print(str(i) + '9' * nines)
        count += 1
        if count == K:
            finished = True
            break
    nines += 1

Submission status: Wrong Answer

Solution code:
k = int(input())

def S(n):
  str_n = str(n)
  return sum([int(i) for i in str_n])

count = 0
mul = 1

while count < k:
  for i in range(1,10):
    if mul==1:
      ans = i*mul
    else:
      ans = i*mul + 9
    print(ans)
    count += 1
    if count==k:
      break
  mul *= 10

Submission status: Wrong Answer

Solution code:
k = int(input())

def S(n):
  str_n = str(n)
  return sum([int(i) for i in str_n])

count = 0
mul = 1

while count <= k:
  for i in range(1,10):
    if mul==1:
      ans = i*mul
    else:
      ans = i*mul + 9
    print(ans)
    count += 1
  mul *= 10

Submission status: Wrong Answer

Solution code:
k = int(input())
 
print(1)
print(2)
print(3)
print(4)
print(5)
print(6)
print(7)
print(8)
print(9)
 
for i in range(1, k-8):
  print(i * 10 + 9)

Submission status: Wrong Answer

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

k = 10
i = 1

while k > 0:
  if sunuke(i) < 2: 
    print(i)
    k -= 1
    
  i += 1

Submission status: Wrong Answer

Solution code:
K = int(input())
count = 1
num = 1
while count <= K:
    if num <= 9:
        print(num)
        count += 1
    elif num % 10 == 9:
        print(num)
        count += 1
    num += 1

Submission status: Wrong Answer

Solution code:
from queue import Queue
K = int(input())
q = Queue()
for i in range(1,10):
    q.put(i)
for i in range(K):
    temp = q.get()
    print(temp)
    q.put(temp * 10 + 9)

Submission status: Wrong Answer

Solution code:
K=int(input())

def NS(N):
  NS=0
  while(N>0):
    NS+=N%10
    N//=10
  return NS

answer_list=list(range(1,10))
for i in range(1,10):
  answer_list.append(10*i+9)
  
for d in range(2,14):
  for h in range(1,10):
    first=h*10**d+10**(d-1)-1
    second=h*10**d+2*10**(d-1)-1
    if first/NS(first)<second/NS(second):
      for i in range(1,11):
        answer_list.append(h*10**d+i*10**(d-1)-1)
    else:
      answer_list.append(h*10**d+10**d-1)

for d in range(14,16):
  for h in range(1,10):
    first=h*10**d+10**(d-2)-1
    second=h*10**d+2*10**(d-2)-1
    third=h*10**d+11*10**(d-2)-1
    if first/NS(first)<second/NS(second):
      for i in range(1,101):
        answer_list.append(h*10**d+i*10**(d-2)-1)
    elif first/NS(first)<third/NS(third):
      for i in range(1,11):
        answer_list.append(h*10**d+i*10**(d-1)-1)
    else:
      answer_list.append(h*10**d+10**d-1)
      
#print(answer_list[100:200])
for i in range(K):
  print(answer_list[i])

Submission status: Wrong Answer

Solution code:
K=int(input())

def NS(N):
  NS=0
  while(N>0):
    NS+=N%10
    N//=10
  return NS

answer_list=list(range(1,10))
for i in range(1,10):
  answer_list.append(10*i+9)
  
for d in range(2,15):
  for h in range(1,10):
    first=h*10**d+10**(d-1)-1
    second=h*10**d+2*10**(d-1)-1
    if first/NS(first)<second/NS(second):
      for i in range(1,11):
        answer_list.append(h*10**d+i*10**(d-1)-1)
    else:
      answer_list.append(h*10**d+10**d-1)

d=15
for h in range(1,10):
  first=h*10**d+10**(d-2)-1
  second=h*10**d+2*10**(d-2)-1
  third=h*10**d+11*10**(d-2)-1
  if first/NS(first)<second/NS(second):
    for i in range(1,101):
      answer_list.append(h*10**d+i*10**(d-2)-1)
  elif first/NS(first)<third/NS(third):
    for i in range(1,11):
      answer_list.append(h*10**d+i*10**(d-1)-1)
  else:
    answer_list.append(h*10**d+10**d-1)
      
#print(answer_list[100:200])
for i in range(K):
  print(answer_list[i])

Submission status: Wrong Answer

Solution code:
K=int(input())

def NS(N):
  NS=0
  while(N>0):
    NS+=N%10
    N//=10
  return NS

answer_list=list(range(1,10))
for i in range(1,10):
  answer_list.append(10*i+9)
  
for d in range(2,18):
  for h in range(1,10):
    first=h*10**d+10**(d-1)-1
    second=h*10**d+2*10**(d-1)-1
    if first/NS(first)<second/NS(second):
      for i in range(1,11):
        answer_list.append(h*10**d+i*10**(d-1)-1)
    else:
      answer_list.append(h*10**d+10**d-1)
      
#print(len(answer_list))
for i in range(K):
  print(answer_list[i])

Submission status: Wrong Answer

Solution code:
#!python3

# input
K = int(input())


def solve(k):
    w = k // 9
    ans = ""
    if k % 9 != 0:
        ans += str(k % 9)
    ans += "9" * w
    print(ans)


def main():
    for i in range(1, K + 1):
        solve(i)
        

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!python3

# input
K = int(input())


def main():
    w = K // 9
    ans = ""
    if K % 9 != 0:
        ans += str(K % 9)
    ans += "9" * w
    print(int(ans))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!python3

# input
K = int(input())


def main():
    w = K // 9
    ans = ""
    if K % 9 != 0:
        ans += str(K % 9)
    ans += "9" * w
    print(ans)


if __name__ == "__main__":
    main()