Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
def ss(s,k):
    M=len(s)
    sss=set()
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            sss.add(tmp)
    l = list(sss)
    l.sort()
    #print(l)
    ret = l[k-1]
    return(ret)
 
res=ss(s,k)
print(res)

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
def ss(s,k):
    M=len(s)
    sss=set()
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            sss.update(tmp)
    l = list(sss)
    l.sort()
    #print(l)
    ret = l[k-1]
    return(ret)
 
res=ss(s,k)
print(res)

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])

Buggy python submission (verdict: Time Limit Exceeded):

s = input()
k=int(input())
alphabet='abcdefghijklmnopqrstuvwxyz'


def ss(s,k):
    M=len(s)
    l=[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            #print(l)
            if tmp[0] == 'a':
                if tmp not in l[0]:
                    l[0].append(tmp)
            elif tmp[0] == 'b':
                if tmp not in l[1]:
                    l[1].append(tmp)
            elif tmp[0] == 'c':
                if tmp not in l[2]:
                    l[2].append(tmp)
            elif tmp[0] == 'd':
                if tmp not in l[3]:
                    l[3].append(tmp)
            elif tmp[0] == 'e':
                if tmp not in l[4]:
                    l[4].append(tmp)
            elif tmp[0] == 'f':
                if tmp not in l[5]:
                    l[5].append(tmp)
            elif tmp[0] == 'g':
                if tmp not in l[6]:
                    l[6].append(tmp)
            elif tmp[0] == 'h':
                if tmp not in l[7]:
                    l[7].append(tmp)
            elif tmp[0] == 'i':
                if tmp not in l[8]:
                    l[8].append(tmp)
            elif tmp[0] == 'j':
                if tmp not in l[9]:
                    l[9].append(tmp)
            elif tmp[0] == 'k':
                if tmp not in l[10]:
                    l[10].append(tmp)
            elif tmp[0] == 'l':
                if tmp not in l[11]:
                    l[11].append(tmp)
            elif tmp[0] == 'm':
                if tmp not in l[12]:
                    l[12].append(tmp)
            elif tmp[0] == 'n':
                if tmp not in l[13]:
                    l[13].append(tmp)
            elif tmp[0] == 'o':
                if tmp not in l[14]:
                    l[14].append(tmp)
            elif tmp[0] == 'p':
                if tmp not in l[15]:
                    l[15].append(tmp)
            elif tmp[0] == 'q':
                if tmp not in l[16]:
                    l[16].append(tmp)
            elif tmp[0] == 'r':
                if tmp not in l[17]:
                    l[17].append(tmp)
            elif tmp[0] == 's':
                if tmp not in l[18]:
                    l[18].append(tmp)
            elif tmp[0] == 't':
                if tmp not in l[19]:
                    l[19].append(tmp)
            elif tmp[0] == 'u':
                if tmp not in l[20]:
                    l[20].append(tmp)
            elif tmp[0] == 'v':
                if tmp not in l[21]:
                    l[21].append(tmp)
            elif tmp[0] == 'w':
                if tmp not in l[22]:
                    l[22].append(tmp)
            elif tmp[0] == 'x':
                if tmp not in l[23]:
                    l[23].append(tmp)
            elif tmp[0] == 'y':
                if tmp not in l[24]:
                    l[24].append(tmp)
            elif tmp[0] == 'z':
                if tmp not in l[25]:
                    l[25].append(tmp)
    lis=[]
    for li in l:
        li.sort()
        lis.extend(li)
    l=lis
    #print(l)
    ret = l[k-1]
    return(ret)

print(ss(s,k))

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k=int(input())
def ss(s,k):
    M=len(s)
    l=[]
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            if tmp not in l:
                l.append(tmp)
    l.sort()
    #print(l)
    ret = l[k-1]
    return(ret)

print(ss(s,k))

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k=int(input())
def ss(s,k):
    M=len(s)
    l=[]
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            l.append(tmp)
    l.sort()
    l=f7(l)
    #print(l)
    ret = l[k-1]
    return(ret)

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

print(ss(s,k))

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])

Buggy python submission (verdict: Runtime Error):
s = input()
k=int(input())
def ss(s,k):
    M=len(s)
    l=[]
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            l.append(tmp)
    l.sort()
    #print(l)
    ret = l[k-1]
    return(ret)

print(ss(s,k))

Fixed submission:
s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])