Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
t = input()

for i in range(len(s)):
    if s[i] == t[i]:
        continue
    else:
        s = s.translate(str.maketrans({s[i]: t[i], t[i]: s[i]}))
if s == t:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
t = input()
s_memo = {}
t_memo = {}

for i in range(len(s)):
    c1 = s[i]
    c2 = t[i]
    if (c1 in s_memo and s_memo[c1] != c2) or \
            (c2 in t_memo and t_memo[c2] != c1):
        print("No")
        exit()
    s_memo[c1] = c2
    t_memo[c2] = c1

print("Yes")
Buggy python submission (verdict: Runtime Error):
from collections import deque
def DFS(S):
    word_list = ["dream", "dreamer", "erase", "eraser"]
    stack = deque(word_list)
    while stack:
        print(stack)
        word = stack.pop()
        if word == S[0]:
            return "Yes"
        for i in word_list:
            next_word = word + i
            check = S[0][:len(word + i)]
            if next_word != check:
                continue
            if next_word == check:
                stack.append(next_word)
    return "NO"






if __name__ == "__main__":
    S = [input()]
    print(DFS(S))

Fixed submission:
def DFS(S):
    word_list = [ "dreamer","dream", "eraser", "erase"]
    stack = ["dream", "dreamer", "erase", "eraser"]
    while stack:
        word = stack.pop()
        if word == S[0]:
            return "YES"
        for i in word_list:
            next_word = word + i
            check = S[0][:len(word + i)]
            if next_word != check:
                continue
            if next_word == check:
                stack.append(next_word)
    return "NO"






if __name__ == "__main__":
    S = [input()]
    print(DFS(S))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    x, y = map(int, input().split())
    A.append(x)
    B.append(y)

ans = 0
while m > 0:
    idx = A.index(min(A))
    p = A.pop(idx)
    a = B.pop(idx)
    if a >= m:
        ans += p * m
        m -= a
    else:
        ans += p * a
        m -= a
print(ans)

Fixed submission:
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    x, y = map(int, input().split())
    A.append(x)
    B.append(y)

ans = 0
for price, amount in sorted(zip(A, B)):
    ans += price * min(m, amount)
    m -= amount
    if m <= 0:
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    x, y = map(int, input().split())
    A.append(x)
    B.append(y)

ans = 0
while m > 0:
    idx = A.index(min(A))
    p = A.pop(idx)
    a = B.pop(idx)
    if a >= m:
        ans += p * m
        m -= a
    else:
        ans += p * a
        m -= a
print(ans)

Fixed submission:
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    x, y = map(int, input().split())
    A.append(x)
    B.append(y)

ans = 0
for price, amount in sorted(zip(A, B)):
    ans += price * min(m, amount)
    m -= amount
    if m <= 0:
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = t = input()

ans = 0
flag = True
while flag:
    s = s.replace('01','').replace('10','')
    if len(s) == len(t):
        flag = False
    else:
        ans += len(t) - len(s)
        t = s

print(ans)

Fixed submission:
s = input()
c0 = s.count('0')
c1 = s.count('1')  # len(s)-c0
print(2 * min(c0, c1))

Buggy python submission (verdict: Time Limit Exceeded):
s = t = input()

ans = 0
flag = True
while flag:
    s = s.replace('01','').replace('10','')
    if len(s) == len(t):
        flag = False
    else:
        ans += len(t) - len(s)
        t = s

print(ans)

Fixed submission:
s = input()
c0 = s.count('0')
c1 = s.count('1')  # len(s)-c0
print(2 * min(c0, c1))
Buggy python submission (verdict: Time Limit Exceeded):
N, *a = map(int, open(0).read().split())
ans = 0
flag = True
while flag:
    cnt = 0
    for i in range(N):
        if a[i] % 2 != 0:
            continue
        elif a[i] % 2 == 0 and cnt == 0:
            a[i] //= 2
            cnt += 1
            break

    if cnt == 0:
        flag = False
    else:
        ans += 1

print(ans)


Fixed submission:
N, *a = map(int, open(0).read().split())
ans = 0
for i in range(N):
    ans += len(bin(a[i])) - bin(a[i]).rfind('1') - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, *a = map(int, open(0).read().split())
ans = 0
flag = True
while flag:
    cnt = 0
    for i in range(N):
        if a[i] % 2 == 0 and cnt == 0:
            a[i] //= 2
            cnt += 1
        else:
            a[i] *= 3
    else:
        if cnt == 0:
            flag = False
        else:
            ans += 1

print(ans)


Fixed submission:
N, *a = map(int, open(0).read().split())
ans = 0
for i in range(N):
    ans += len(bin(a[i])) - bin(a[i]).rfind('1') - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, *a = map(int, open(0).read().split())
ans = 0
flag = True
while flag:
    cnt = 0
    for i in range(N):
        if a[i] % 2 == 0 and cnt == 0:
            a[i] //= 2
            cnt += 1
        else:
            a[i] *= 3
    else:
        if cnt == 0:
            flag = False
        else:
            ans += 1

print(ans)


Fixed submission:
N, *a = map(int, open(0).read().split())
ans = 0
for i in range(N):
    ans += len(bin(a[i])) - bin(a[i]).rfind('1') - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,a = map(int,open(0).read())
print("Yes" if n%500 <= a else "No")

Fixed submission:
n,a = map(int,open(0).read().split())
print("Yes" if n%500 <= a else "No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
print(*a[::-2], *a[n%2::2])

Fixed submission:
n = int(input())
a = input().split()
print(' '.join(a[::-2] + a[n%2::2]))

Buggy python submission (verdict: Runtime Error):
n, *a = map(int, open(0).read().split())
print(*a[::-2], *a[n%2::2])

Fixed submission:
n = int(input())
a = input().split()
print(' '.join(a[::-2] + a[n%2::2]))

Buggy python submission (verdict: Time Limit Exceeded):
n, *a = map(int, open(0).read().split())
b = []
for i in a:
  b.append(int(i))
  b.reverse()

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

Fixed submission:
n = int(input())
a = input().split()
print(' '.join(a[::-2] + a[n%2::2]))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

print(max(a+b,a-b,a*b))

Fixed submission:
a,b = map(int,input().split())

print(max(a+b,a-b,a*b))

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

print(max(a+b,a-b,a*b))

Fixed submission:
a,b = map(int,input().split())

print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
a,b = map(int, imput().split())
 
if abs(a+b)%2 ==0:
    print(abs(a+b)//2)
else:
    print('IMPOSSIBLE')

Fixed submission:
a, b = map(int, input().split())
if abs(b+a) % 2 == 0:
    print(abs(a+b)//2)
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
a,b = map(int, imput().split())

if (a+b)%2 ==0:
    print(abs((a+b)//2))
else:
    print('IMPOSSIBLE')

Fixed submission:
a, b = map(int, input().split())
if abs(b+a) % 2 == 0:
    print(abs(a+b)//2)
else:
    print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
s = input()

if s[0] == s[1] or s[1] == s[2] or s[2] == pas[3]:
    print('Bad')
else:
    print('Good')




Fixed submission:
s = input()

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')

Buggy python submission (verdict: Runtime Error):
s = input()

if pas[0] == pas[1] or pas[1] == pas[2] or pas[2] == pas[3]:
    print('Bad')
else:
    print('Good')




Fixed submission:
s = input()

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
Buggy python submission (verdict: Runtime Error):
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

lv = []
lc = []
diff = []
for i in range(1,n+1):
    for p in itertools.combinations(v,i):
        lv.append(sum(p))
    for p in itertools.combinations(c,i):
        lc.append(sum(p))
for i in range(len(lv)):
    diff.append(lv[i]-lc[i])
print(0 if max(diff)<0 else max(diff))


Fixed submission:
a,b,t = map(int, input().split())

print(int((t+0.5)//a*b))
Buggy python submission (verdict: Runtime Error):
import itertools
lv = []
lc = []
diff = []
for i in range(1,n+1):
    for p in itertools.combinations(v,i):
        lv.append(sum(p))
    for p in itertools.combinations(c,i):
        lc.append(sum(p))
for i in range(len(lv)):
    diff.append(lv[i]-lc[i])
print(0 if max(diff)<0 else max(diff))

Fixed submission:
n = int(input())
lv = list(map(int, input().split()))
lc = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += max(lv[i] - lc[i], 0)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

cnt = 0
for e in l:
    ll = l[1:]
    for ee in ll:
        if e == ee:
            cnt += 1
    l = ll

print(cnt)

Fixed submission:
n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

d = dict()
cnt = 0
for e in l:
    if e in d:
        d[e] += 1
        cnt += d[e]
    else:
        d[e] = 0

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

cnt = 0
for idx, e in enumerate(l):
    ll = l[idx+1:]
    for ee in ll:
        if e == ee:
            cnt += 1

print(cnt)

Fixed submission:
n= int(input())
l = []
for _ in range(n):
    l.append(''.join(sorted(input())))

d = dict()
cnt = 0
for e in l:
    if e in d:
        d[e] += 1
        cnt += d[e]
    else:
        d[e] = 0

print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys

x = sys.argv[1]
y = sys.argv[2]

a_to_b = int(x)
b_to_c = int(y) / 2

print(a_to_b + b_to_c)

Fixed submission:
x, y = map(int, input().split())

print(x + y//2)

Buggy python submission (verdict: Runtime Error):
import sys

x = sys.argv[1]
y = sys.argv[2]

a_to_b = int(x)
b_to_c = int(y) / 2

print(a_to_b + b_to_c)

Fixed submission:
x, y = map(int, input().split())

print(x + y//2)

Buggy python submission (verdict: Runtime Error):
import sys

x = sys.argv[1]
y = sys.argv[2]

a_to_b = x
b_to_c = y/2

print(a_to_b + b_to_c)

Fixed submission:
x, y = map(int, input().split())

print(x + y//2)
Buggy python submission (verdict: Runtime Error):
a, b  = raw_input().split()

if int(a) > 8 or int(b) > 8:
    print(":(")
else:
    print("yay!")

Fixed submission:
a, b  = input().split()

if int(a) > 8 or int(b) > 8:
    print(":(")
else:
    print("Yay!")
Buggy python submission (verdict: Runtime Error):
d, n  = map(int, input().split())

if d == 0:
    if n == 100:
        print 101
    else:
        print(1 * n)
if d == 1:
    if n == 100:
        print 10001
    else:
        print(100 * n)
if d == 2:
    if n == 100:
        print 1000001
    else:
        print(10000 * n)

Fixed submission:
d, n  = map(int, input().split())

if d == 0:
    if n == 100:
        print(101)
    else:
        print(1 * n)
if d == 1:
    if n == 100:
        print(10100)
    else:
        print(100 * n)
if d == 2:
    if n == 100:
        print(1010000)
    else:
        print(10000 * n)

Buggy python submission (verdict: Runtime Error):
d, n  = map(int, input().split())

if d = 0:
    print(1 * n)
if d = 1:
    print(100 * n)
if d = 2:
    print(10000 * n)

Fixed submission:
d, n  = map(int, input().split())

if d == 0:
    if n == 100:
        print(101)
    else:
        print(1 * n)
if d == 1:
    if n == 100:
        print(10100)
    else:
        print(100 * n)
if d == 2:
    if n == 100:
        print(1010000)
    else:
        print(10000 * n)
Buggy python submission (verdict: Runtime Error):
import sys

c = sys.argv[1]
vowel = ("a", "i", "u", "e", "o")

if c in vowel:
        print "vowel"
else:
        print "consonant"


Fixed submission:
c = raw_input()
vowel = ("a", "i", "u", "e", "o")

if c in vowel:
        print "vowel"
else:
        print "consonant"
Buggy python submission (verdict: Runtime Error):
a = input()
s = input()

if ( a > 3200 ):
    print( s )
else:
    print( "red" )

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

if ( a >= 3200 ):
    print( s )
else:
    print( "red" )
Buggy python submission (verdict: Runtime Error):
max_num = 1000000
min_num = -1000000
k,x = map(int, input().split())
if x + k > 1000000:
    min_num = x - k
elif x - k < -1000000:
    max_num = x + k
else:
    min_num = x - k
    max_num = x + k

for i range( min_num, max_num ):
    print i

Fixed submission:
max_num = 1000000
min_num = -1000000
k,x = map(int, input().split())
if x + k > 1000000:
    min_num = x - k + 1
elif x - k < -1000000:
    max_num = x + k - 1
else:
    min_num = x - k + 1
    max_num = x + k - 1

ans = ""
for i in range( min_num, max_num + 1 ):
    ans = ans + str(i) + " "

print( ans )
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = [input() for _ in range(n)]
ans_dict = {}

for s in arr:
    tmp = sorted(s)
    if tmp in ans_dict:
        ans_dict[tmp] += 1
    else:
        ans_dict[tmp] = 1

ans = 0
for i in ans_dict.values():
    ans += i * ( i - 1) / 2
print( int(ans) )

Fixed submission:
n = int(input())
arr = [input() for _ in range(n)]
dict = {}
alpha = "abcdefghijklmnopqrstuvwxyz"

for s in arr:
    count = [0]*26
    for i in range(10):
        for j in range(26):
            if s[i] == alpha[j]:
                count[j] += 1
                break
    count = tuple(count)
    if count not in dict:
        dict[count] = 1
    else:
        dict[count] += 1
ans = 0
for val in dict.values():
    ans += val * ( val - 1 ) / 2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_list = input().split()

ans = True
for i in range(len(h_list)):
    for j in range( i, len(h_list)):
        if int(h_list[i]) - int(h_list[j]) >= 2:
            print()
            ans = False
            break
if ans:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
h_list = list(map(int, input().split() ) )

ans = True
for i in range(1, len(h_list) ):
    if h_list[-i] - h_list[-i-1] >= 0:
        continue
    elif h_list[-i] - h_list[-i-1] == -1:
        h_list[-i-1] -= 1
    else:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_list = input().split()

ans = True
for i in range(len(h_list)):
    for j in range( i, len(h_list)):
        if int(h_list[i]) - int(h_list[j]) >= 2:
            print()
            ans = False
if ans:
    print("Yes")
else:
    print("No")

Fixed submission:
n = int(input())
h_list = list(map(int, input().split() ) )

ans = True
for i in range(1, len(h_list) ):
    if h_list[-i] - h_list[-i-1] >= 0:
        continue
    elif h_list[-i] - h_list[-i-1] == -1:
        h_list[-i-1] -= 1
    else:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
c=list(map(input().split()))
print(len(set(c)))

Fixed submission:
c=list(input().split())
print(len(set(c)))
Buggy python submission (verdict: Runtime Error):
A=int(input())
B=int(input())

print(max[A+B,A-B,A*B])
  


Fixed submission:
A,B=[int(i) for i in input().split(" ")]
print(max([A+B,A-B,A*B]))
Buggy python submission (verdict: Runtime Error):
A,B,C=[int(i) for i in input().split(" ")
print(B+C-A if B+C-A>0 else 0)


Fixed submission:
A,B,C=[int(i) for i in input().split(" ")]
print(B+C-A if B+C-A>0 else 0)
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))
A = sum(list(map(lambda x: 1/x, A))
print(1/A)

Fixed submission:
N = input()
A = list(map(int,input().split()))
A = sum(list(map(lambda x: 1/x, A)))
print(1/A)
Buggy python submission (verdict: Runtime Error):
N = input()
V = list(map(int, input().split()))
V = sorted(V)
value = V.pop(-1)
while value:
    value += V.pop(-1)
print(value)

Fixed submission:

N = input()
V = list(map(int, input().split()))
V = sorted(V)
value = V.pop(0)
while V:
    value =(value + V.pop(0))/2
print(value)
Buggy python submission (verdict: Runtime Error):

N,K = map(int, input().split())
ab_list = {}
for i in range(N):
    a,b = map(int, input().split())
    akagi=str(a)
    if akagi in ab_list:
        ab_list[akagi] += b
        print("if")
        print(ab_list)
    else:
        ab_list[akagi] = b
        print("else")
        print(ab_list)
        

  
        
count =0
for i in sorted(ab_list.items(), key=lambda x: x[0]):
    count+=i[1]
    if (count >= K):
        print(i[0])
        break


Fixed submission:
N,K = map(int, input().split())
ab_list = []
for i in range(N):
    a = list(map(int, input().split()))
    ab_list.append(a)
    
ab_list.sort()
    
count =0
for i in ab_list:
    count+=i[1]
    if (count >= K):
        print(i[0])
        break
Buggy python submission (verdict: Runtime Error):
ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = 1000


for index in range(count+1):
    if (A*index)%B ==C:
        print("Yes")
        break
    elif index ==800:
        print("NO")
    

Fixed submission:


ABC = input().split()


if ABC[0][-1] ==ABC[1][0]:
    if ABC[1][-1] == ABC[2][0]:
        print("YES")
    else:
        print("NO")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 100
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
        break
    elif index == (count):
        print("NO")
    else:
        N+=1

Fixed submission:
ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = A*B


for index in range(count+1):
    if (A*index)%B==C:
        print("YES")
        break
    elif index ==count:
        print("NO")

Buggy python submission (verdict: Runtime Error):
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 50
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
    elif index == (count):
        print("NO")
    else:
        N+=1

Fixed submission:
ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = A*B


for index in range(count+1):
    if (A*index)%B==C:
        print("YES")
        break
    elif index ==count:
        print("NO")
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = int(input())

if a >= 3200:
    print(s)
else:
    print('red')

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

if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
id=[[int(i) for i in input().split()]+[j] for j in range(m)]

print(id)

pre_num=[0]*(n+1)
ans=[""]*m

id.sort(key=lambda x:x[1])

for p,y,i in id:
    pre_num[p]+=1
    ans[i]=str(p).zfill(6)+str(pre_num[p]).zfill(6)
    
print("\n".join(ans))


Fixed submission:
a, b, t = map(int, input().split())

print(t//a * b)
Buggy python submission (verdict: Runtime Error):

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(max_count, count)
    else:
        count = 0

print(ans)

Fixed submission:

S = input()
ans = 0
count = 0

for s in S:
    if s in ["A", "C", "G", "T"]:
        count += 1
        ans = max(ans, count)
    else:
        count = 0

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

drink = []
ans = 0

for i in range(N):
    A, B = map(int, input().split())
    for j in range(B):
        drink.append(A)

drink.sort()

for i in range(M):
    ans += drink[i]

print(ans)

Fixed submission:
N, M = map(int, input().split())

drink = []
sum = 0
count = 0

for i in range(N):
    A, B = map(int, input().split())
    drink.append([A, B])

drink.sort()


for d in drink:
    if count >= M:
            break
    for i in range(d[1]):
        sum += d[0]
        count += 1
        if count >= M:
            break

print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
t = S

while '01' in t or '10' in t:
    t= t.replace('01', '').replace('10', '')

print(len(S) - len(t))

Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
count = 0

while '01' in S:
    count += 1
    S = S.replace('01', '', 1)

while '10' in S:
    count += 1
    S = S.replace('10', '', 1)

print(count * 2)

Fixed submission:
S = input()

print(min(S.count('0'), S.count('1')) * 2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = [list(map(int, input().split())) for _ in range(n)]

li.sort(key=lambda x: x[2])
a, b, c = li[-1]

for x in range(101):
    for y in range(101):
        h=c+abs(a-x)+abs(b-y)
        if all(k==max(h-abs(i-x)-abs(j-y),0) for i,j,k in li):
        print(x,y,h)
        exit()

Fixed submission:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
li.sort(key=lambda x: x[2])
a,b,c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j),0) for i,j,k in li):
            print(x,y,h)
            exit()
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

a = 0
b = 0

for i in range(len(S)):
    if S[i] = 1:
        a = i+1
    else:
        b = S[i]
        break

if K <= a:
    print(1)
else:
    print(b)


Fixed submission:
S = input()
K = int(input())

a = 0
b = 0

for i in range(len(S)):
    if S[i] == "1":
        a = i+1
    else:
        b = S[i]
        break

if K <= a:
    print(1)
else:
    print(b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split))
print(max(A)- min(A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(max(A)- min(A))
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) >= K:
        pass
    for m in li:
        if l+m in s:
            return substring(l+m)

for l in li:
    substring(l)

print(result[K-1])

Fixed submission:
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) < K:
        for m in li:
            if l+m in s:
                return substring(l+m)
    else:
        pass

for l in li:
    substring(l)

print(result[K-1])

Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) >= K:
        pass
    for m in li:
        if l+m in s:
            return substring(l+m)

for l in li:
    substring(l)
print(result)

print(result[K-1])

Fixed submission:
s = input()
K = int(input())
 
li = sorted(list(set(s)))
result = []

def substring(l):
    result.append(l)
    if len(result) < K:
        for m in li:
            if l+m in s:
                return substring(l+m)
    else:
        pass

for l in li:
    substring(l)

print(result[K-1])
Buggy python submission (verdict: Runtime Error):
a= input()
s=input()

if a<3200:
  print("red")
else:
  print(s)

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

if a<3200:
  print("red")
else:
  print(s)