Buggy python submission (verdict: Runtime Error):
import numpy as np
K = int(input())
lis = ['1','2','3','4','5','6','7','8','9']
lis = np.array(lis)
if K == 1:
  print(1)
elif K < 10:
  print(K)
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp[-1] == '9':
      count += 2
      lis.append(tmp + '8')
      lis.append(tmp + '9')
      sub_count += 1
    elif  tmp[-1] == '0':
      count += 2
      lis.append(tmp + '0')
      lis.append(tmp + '1')
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp + str(int(tmp[-1]) + i))
      sub_count += 1
  print(lis[count-1])


Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)

Buggy python submission (verdict: Runtime Error):
import queue
K = int(intut())
q = queue.Queue()
ans = 0
for i in range(9):
  q.put(i + 1)
for i in range(K):
  ans = q.get()
  if tmp % 10 == 0:
    q.put(10 * tmp)
    q.put(10 * tmp + 1)
  elif tmp % 10 == 9:
    q.put(10 * tmp + 8)
    q.put(10 * tmp + 9)
  else:
    for t in range(-1,2):
      q.put(10 * tmp + tmp % 10 + t)
print(ans)


Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)

Buggy python submission (verdict: Runtime Error):
import queue
K = int(intut())
q = queue.Queue()
for i in range(9):
  q.put(i + 1)
for i in range(K):
  tmp = q.get()
  if tmp % 10 == 0:
    q.put(10 * tmp)
    q.put(10 * tmp + 1)
  elif tmp % 10 == 9:
    q.put(10 * tmp + 8)
    q.put(10 * tmp + 9)
  else:
    for t in range(-1,2):
      q.put(10 * tmp + tmp % 10 + t)
print(tmp)

Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)

Buggy python submission (verdict: Runtime Error):
import numpy as np
K = int(input())
lis = [1,2,3,4,5,6,7,8,9]
lis = np.array(lis)
  
if K < 10:
  print(K)
    
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp % 10 == 9:
      count += 2
      lis.append(tmp * 10  + 8)
      lis.append(tmp * 10 + 9)
      sub_count += 1
    elif  tmp % 10== 0:
      count += 2
      lis.append(tmp * 10 )
      lis.append(tmp * 10 + 1)
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp * 10 + tmp % 10 + i)
      sub_count += 1
  print(lis[count-1])


Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)

Buggy python submission (verdict: Runtime Error):
import numpy as np
K = int(input())
lis = [1,2,3,4,5,6,7,8,9]
lis = np.array(lis)
  
if K < 10:
  print(K)
    
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp % 10 == 9:
      count += 2
      lis.append(tmp * 10  + 8)
      lis.append(tmp + 9)
      sub_count += 1
    elif  tmp % 10== 0:
      count += 2
      lis.append(tmp * 10 + 0)
      lis.append(tmp * 10 + 1)
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp * 10 + tmp % 10 + i)
      sub_count += 1
  print(lis[count-1])


Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)

Buggy python submission (verdict: Runtime Error):
import numpy as np
K = int(input())
lis = ['1','2','3','4','5','6','7','8','9']
lis = np.array(lis)
if K == 1:
  print(1)
elif K < 10:
  print(K)
else:
  count = 9
  sub_count = 0
  while count < K:
    if lis[sub_count][-1] == '9':
      count += 2
      lis.append(lis[sub_count] + '8')
      lis.append(lis[sub_count] + '9')
      sub_count += 1
    elif  lis[sub_count][-1] == '0':
      count += 2
      lis.append(lis[sub_count] + '0')
      lis.append(lis[sub_count] + '1')
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(lis[sub_count] + str(int(lis[sub_count][-1]) + i))
      sub_count += 1
  print(lis[count-1])

Fixed submission:
import queue
K = int(input())
q = queue.Queue()
count = 0
for i in range(1,10):
  q.put(str(i))
while count < K:
  tmp = q.get()
  count += 1
  if count == K:
    print(tmp)
    break
  if tmp[-1] == '0':
    for add in ['0', '1']:
      q.put(tmp + add)
  elif tmp[-1] == '9':
    for add in ['8', '9']:
      q.put(tmp + add)
  else:
    for add in [str(int(tmp[-1]) - 1),tmp[-1], str(int(tmp[-1]) + 1)]:
      q.put(tmp + add)