Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())

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

for i in range(K):
    sample = nlist.pop(0)
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)      
    
print(sample)

Fixed submission:
K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)

Buggy python submission (verdict: Runtime Error):
K = int(input())

nlist = [1,2,3,4,5,6,7,8,9]
sample = 0
count = 0

def BFS(count,nlist,sample):
    if count == K:
        print(sample)
        return
    else:
        sample = nlist.pop(0)
        
        if sample%10 != 0:
            nlist.append(sample*10 - 1 + sample%10)
            
        nlist.append(sample*10 + sample%10)
        
        if sample%10 != 9:
            nlist.append(sample*10 + 1 + sample%10)
            
        count+=1

        BFS(count,nlist,sample)
        
BFS(count,nlist,sample)

Fixed submission:
K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)

Buggy python submission (verdict: Runtime Error):
K = int(input())

nlist = [1,2,3,4,5,6,7,8,9]
sample = 0
count = 0

def BFS(count,nlist,sample):
    if count == K:
        print(sample)
        return
    else:
        sample = nlist.pop(0)
        
        if sample%10 != 0:
            nlist.append(sample*10 - 1 + sample%10)
            
        nlist.append(sample*10 + + sample%10)
        
        if sample%10 != 9:
            nlist.append(sample*10 + 1 + sample%10)
            
        count+=1

        BFS(count,nlist,sample)
        
BFS(count,nlist,sample)

Fixed submission:
K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)

Buggy python submission (verdict: Runtime Error):
K = int(input())

nlist = [1,2,3,4,5,6,7,8,9]
sample = 0
count = 0

def BFS(count,nlist,sample):
    if count == K:
        print(sample)
        return
    else:
        sample = nlist.pop(0)
        
        if sample%10 != 0:
            nlist.append(sample*10 - 1 + sample%10)
            
        nlist.append(sample*10 + + sample%10)
        
        if sample%10 != 9:
            nlist.append(sample*10 + 1 + + sample%10)
            
        count+=1

        BFS(count,nlist,sample)
        
BFS(count,nlist,sample)

Fixed submission:
K = int(input())

from collections import deque

nlist = deque([1,2,3,4,5,6,7,8,9])

for i in range(K):
    sample = nlist.popleft()
        
    if sample%10 != 0:
        nlist.append(sample*10 - 1 + sample%10)
            
    nlist.append(sample*10 + sample%10)
        
    if sample%10 != 9:
        nlist.append(sample*10 + 1 + sample%10)
    
print(sample)