Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))

l = W[0]
r = sum(W[1:])
diff = abs(l - r)
for i in range(1, N):
    l += W[i]
    r -= W[i]
    new_diff = abs(l-r)
    if new_diff < diff:
        diff = new_diff
print(diff)

Fixed submission:
p,q,r = map(int, input().split())
l = [p,q,r]
l = sorted(l, reverse=True)
print(l[1] + l[2])
Buggy python submission (verdict: Runtime Error):
a, p = map(int, input().suplit())

kakera = 3 * a + p
pie = kakera // 2
print(pie)

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

kakera = 3 * a + p
pie = kakera // 2
print(pie)
Buggy python submission (verdict: Runtime Error):
r, d, x = map(int, input().split())

for i in range(10):
    ans = x * r - d
    print(ans)
    x = ans

Fixed submission:
age, price = map(int, input().split())
ans = 0

if age <= 5:
    ans = 0
elif age >= 6 and age <= 12:
    ans = price // 2
else:
    ans = price 

print(ans)

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

for i range (10):
    ans = x * r - d
    print(ans)
    x = ans

Fixed submission:
age, price = map(int, input().split())
ans = 0

if age <= 5:
    ans = 0
elif age >= 6 and age <= 12:
    ans = price // 2
else:
    ans = price 

print(ans)
Buggy python submission (verdict: Runtime Error):
r d x = map(int, input().split())

for i range (10):
    ans = x * r - d
    print(ans)
    x = ans

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

for i in range(10):
    ans = x * r - d
    print(ans)
    x = ans
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
S = input()

for i in range(1,N+1):
    if i == K:
        S[i] == S[i].lower()

print(S)

Fixed submission:
N,K = map(int, input().split())
S = input()
S = list(S)

for i in range(N):
    if i == K-1:
        S[i] = S[i].lower()

S = ''.join(S)
print(S)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(input())
most_highest_data = 0
ans = 0

for i in range(N):
    if int(L[i]) > most_highest_data:
            most_higest_data = L[i]
    if most_highest_data <= int(L[i+1]):
        ans += 1

print(ans)


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

highest = L[0]
ans = 0

for i in range(N):
        if L[i] >= highest:
                ans += 1
                highest = L[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i + j +1]):
            ans = max(ans, j-i+1)
print(ans)


Fixed submission:
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i : j + 1]):
            ans = max(ans, j-i+1)
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i + j +1]):
            ans = max(ans, j-i+1)
print(ans)


Fixed submission:
s = input()
n = len(s)
ans = 0
for i in range(n):
    for j in range(i, n):
        if all('ACGT'.count(c) == 1 for c in s[i : j + 1]):
            ans = max(ans, j-i+1)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(N):
    x,u = input().split()
    x = float(x)

    if u == 'JPY':
        ans += x
    else:
        ans += (x**380000)
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    x,u = input().split()
    x = float(x)

    if u == 'JPY':
        ans += x
    else:
        ans += (x*380000)
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans = min(h[i+K-1] - h[i] for i in range(N-k+1))
print(ans)


Fixed submission:
N,K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
ans = min(h[i+K-1] - h[i] for i in range(N-K+1))
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
l = []
for i in range(len(S) - 2):
    num = abs(int(S[i:i+3]) - 753)
    l.append(num)
print(min(l))

Fixed submission:
X = int(input())

if(X == 3):
    print("YES")
elif(X == 5):
    print("YES")
elif(X == 7):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
S = input()
l = []
for i in range(len(S) - 2):
    num = abs(int(S[i + i+3] - 753))
    l.append(num)
print(min(l))

Fixed submission:
S = input()
l = []
for i in range(len(S) - 2):
    num = abs(int(S[i:i+3]) - 753)
    l.append(num)
print(min(l))
Buggy python submission (verdict: Runtime Error):
N = int(input)

def dfs(s):
#文字列sで始まる七五三数の個数
    if int(s) > N:
        return 0
    #s自体が七五三数なら+1
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))


Fixed submission:
N = int(input())

def dfs(s):
#文字列sで始まる七五三数の個数
    if int(s) > N:
        return 0
    #s自体が七五三数なら+1
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0
    for c in '753':
        ret += dfs(s + c)
    return ret

print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

if N == 1:
    print("Hello World")
else:
    print(A + B)

Fixed submission:
N = int(input())


if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
Buggy python submission (verdict: Runtime Error):
N,T = int(input())
min_cost = 1001

for i in range(N):
    l = input()
    if l[1] <= T:
        if l[0] < min_cost:
            min_cost = l[0]

if min_cost = 1001:
    print('TLE')
else:
    print(min_cost)


Fixed submission:
N,T = map(int, input().split())
min_cost = 1001

for i in range(N):
    c,t = map(int, (input().split()))
    if t <= T:
        if c < min_cost:
            min_cost = c

if min_cost == 1001:
    print('TLE')
else:
    print(min_cost)
Buggy python submission (verdict: Runtime Error):
N = int(input())

l = []
for i in range(N):
    l.append(input())

#重複チェック
if len(set(l)) != n:
    print("No")
    exit()

#しりとりチェック
for i in range(n-1):
    if l[i][-1] != l[i+1][0]:
        print("No")
        exit()

print("Yes")


    


Fixed submission:
N = int(input())

l = []
for i in range(N):
    l.append(input())

#重複チェック
if len(set(l)) != N:
    print("No")
    exit()

#しりとりチェック
for i in range(N-1):
    if l[i][-1] != l[i+1][0]:
        print("No")
        exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0

#奇数判定
for i in range(1, N+1, 2):
    cnt = 0
    #約数判定
    for j in range(1, i+1):
        if j % i == 0:
            cnt += 1
        
    if cnt == 8:
        ans += 1

print(ans)
        



Fixed submission:
A,B = map(int, input().split())

print((A-1) * (B-1))

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0

#奇数判定
for i in range(1, N+1, 2):
    cnt = 0
    #約数判定
    for j in range(1, i+1):
        if j % i == 0:
            cnt += 1
        if cnt == 8:
            ans += 1

print(ans)
        



Fixed submission:
A,B = map(int, input().split())

print((A-1) * (B-1))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S)-1):
    if S == T:
        print('Yes')
        exit()
    x = S[-1]
    S = list(S)
    S.pop(-1)
    S.insert(0,x)
    S = ''.join(S)


print('No')

Fixed submission:
A,B,C = map(int, input().split())
num_list = [A,B,C]
num_sorted_list = sorted(num_list)
print(num_sorted_list[1]-num_sorted_list[0] + num_sorted_list[2]-num_sorted_list[1])

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

for i in range(len(S)-1):
    x = S[-1]
    S = list(S)
    S.pop(-1)
    S.insert(0,x)
    S = ''.join(S)
    if S == T:
        print('Yes')
        exit()

print('No')

Fixed submission:
A,B,C = map(int, input().split())
num_list = [A,B,C]
num_sorted_list = sorted(num_list)
print(num_sorted_list[1]-num_sorted_list[0] + num_sorted_list[2]-num_sorted_list[1])
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())

if N % 2 == 0:
    print(N)
else :
    print(N * 2)
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N>=1 and N<1000:
    print(ABC)
else:
    print(ABD)


Fixed submission:
N = int(input())
if N>=1 and N<1000:
    print('ABC')
else:
    print('ABD')
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input())

if A + B >= C:
    print('Yes')
else:
    print('No')


Fixed submission:
A,B,C = map(int,input().split())

if A + B >= C:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,(input()))

if A + B >= C:
    print('Yes')
else:
    print('No')


Fixed submission:
A,B,C = map(int,input().split())

if A + B >= C:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
A,B,C = map(int(input()))

if A + B >= C:
    print('Yes')
else:
    print('No')
    

Fixed submission:
A,B,C = map(int,input().split())

if A + B >= C:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())
print(str(c11) + str(c22) + str(c33))

Fixed submission:
c1 = input()
c2 = input()
c3 = input()
print(c1[0] + c2[1] + c3[2])

Buggy python submission (verdict: Runtime Error):
c11,c12,c13 = map(int,input().split())
c21,c22,c23 = map(int,input().split())
c31,c32,c33 = map(int,input().split())
print(c11 + c22 + c33)

Fixed submission:
c1 = input()
c2 = input()
c3 = input()
print(c1[0] + c2[1] + c3[2])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input().split()))

for i in range(len(S-1)):
    if S[i] == 'Y':
        print("Four")
        break
print("Three")

Fixed submission:
N = int(input())
S = list(map(str, input().split()))

for i in range(len(S)-1):
    if S[i] == 'Y':
        print("Four")
        exit()
print("Three")
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
total = 0
for num in range(1,N):
    cnt = 0
    num_str = str(num)
    for i in num_str:
        cnt += int(i)
        if A <= cnt <= B:
            total += num_str

print(total) 
    


Fixed submission:
n, a, b = map(int, input().split())
 
sum = 0
for i in range(n+1) :
    count = 0
    for num in str(i) :
        count += int(num)
 
    if (count >= a) and (count <= b) :
        sum += i
            
print(sum)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
l = []

for i in range(N):
    if i >= 10:
        keta_one = i //10
        keta_ten = i % 10
        sum = keta_one + keta_ten
    else:
        sum = i
    if 2 <= i <=5:
        l.append(i)
print(l)
print(sum(l))


Fixed submission:
n, a, b = map(int, input().split())
 
sum = 0
for i in range(n+1) :
    count = 0
    for num in str(i) :
        count += int(num)
 
    if (count >= a) and (count <= b) :
        sum += i
            
print(sum)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
ten_keta = N[:1]
one_keta = N[1:]
ans = 0

for i in range(N+1):
    if int(ten_keta) + int(one_keta) >= A and ten_keta + one_keta <= B:
        ans += i

print(ans)



Fixed submission:
n, a, b = map(int, input().split())
 
sum = 0
for i in range(n+1) :
    count = 0
    for num in str(i) :
        count += int(num)
 
    if (count >= a) and (count <= b) :
        sum += i
            
print(sum)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int, input().split())
ten_keta = int(N[0])
one_keta = int(N[1])
ans = 0

for i in range(N+1):
    if ten_keta + one_keta >= A and ten_keta + one_keta <= B:
        ans += i

print(ans)



Fixed submission:
n, a, b = map(int, input().split())
 
sum = 0
for i in range(n+1) :
    count = 0
    for num in str(i) :
        count += int(num)
 
    if (count >= a) and (count <= b) :
        sum += i
            
print(sum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
cnt = 0

#A内のaすべてが偶数の場合
while all(a%2==0 for a in A):
    A = A // 2
    cnt += 1

print(cnt)



Fixed submission:
N = int(input())
A = list(map(int, input().split()))
cnt = 0

#A内のaすべてが偶数の場合
while all(a%2==0 for a in A):
    A = [a/2 for a in A]
    cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
N = int(input())

N_str = str(N)
N_keta = N_str[0] + N_str[1]
N_keta = int(N_keta)

if N_keta % N == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
N = int(input())

N_str = str(N)
N_keta = []
N_sum = 0

for i in range(len(N_str)):
    N_keta.append(int(N_str[i]))
N_sum = sum(N_keta)

if N % N_sum == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
l = [int(input()) for i in range(N)]
zero_kyori = 0
K_kyori = 0
kyori_list = []

for i in range(N):
    zero_kyori = l[i] - 0
    K_kyori = abs(l[i] - 0)
    kyori_list.append(min(zero_kyori, K_kyori))

print(sum(kyori_list))


Fixed submission:
N = int(input())
K = int(input())
l = [int(i) for i in input().split()]
zero_kyori = 0
K_kyori = 0
kyori_list = []

for i in range(N):
    zero_kyori = (l[i] - 0) * 2
    K_kyori = (abs(l[i] - K)) * 2
    kyori_list.append(min(zero_kyori, K_kyori))

print(sum(kyori_list))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 'No'

if(N//10 == 9):
    ans = 'Yes'
if(N%0 == 9):
    ans ='Yes'

Fixed submission:
N = int(input())
ans = 'No'

if(N//10 == 9):
    ans = 'Yes'
if(N%10 == 9):
    ans ='Yes'
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
    l,r = map(int, input().split())
    ans += r - l + 1
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(N):
    l,r = map(int, input().split())
    ans += r - l + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
cnt = 0
S = list(S)
S_t = S[0]
S.pop(0)
S_b = S[-1]
S.pop(-1)
for i in range(S):
    cnt += 1

print(S_t + cnt + S_b)

Fixed submission:
S = input()
cnt = 0
S = list(S)
S_t = S[0]
S.pop(0)
S_b = S[-1]
S.pop(-1)
for i in range(len(S)):
    cnt += 1

print(S_t + str(cnt) + S_b)
Buggy python submission (verdict: Runtime Error):
r,g,b = map(input().split())
num = r + g + b
if int(num)%4 == 0:
    print('YES')
else:
    print('NO')



Fixed submission:
r,g,b = map(str, input().split())
num = r + g + b
if int(num)%4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
A,B = map(input().split())

if A + B >= 10:
    print('error')
else:
    print(A + B) 

Fixed submission:
A,B = map(int, input().split())

if A + B >= 10:
    print('error')
else:
    print(A + B)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

if x in a and y in a:
    print("Yes")
if x in b and y in b:
    print("Yes")
if x in c and y in c:
    print("Yes")
else:
    print("No")

Fixed submission:
x,y = map(int,input().split())
a = [1, 3, 5, 7, 8, 10, 12]
b = [4, 6, 9, 11]
c = [2]

if x in a and y in a:
    print("Yes")
    exit()
if x in b and y in b:
    print("Yes")
    exit()
if x in c and y in c:
    print("Yes")
    exit()
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()

print(a[:1] + b[:1] + c[:1])

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

print("A" + b[:1] + "C")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a[:1] + b[:1] + c[:1])

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

print("A" + b[:1] + "C")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(a + b[:1] + c)

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

print("A" + b[:1] + "C")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a + b == c:
    print('Yes')
    elif b + c == a:
        print('Yes')
    elif a + c == b:
        print('Yes')
    else: 
        print('No')

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

if a + b == c:
    print('Yes')
elif b + c == a:
    print('Yes')
elif a + c == b:
    print('Yes')
else: 
    print('No')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, (input()))

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

if a == b and b == c:
    print(1)
elif a == b or b == c or a == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

if a == b and b == c:
    print(1)
elif a == b or b == c or a == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

if a == b == c:
    print(1)
elif a == b or b == c or a == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

if a == b == c:
    print(1)
elif a == b or b == c or a == c:
    print(2)
else:
    print(3)


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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)

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

count = 3

if a == b:
    count -= 1
if b == c:
    count -= 1
if a == c:
    count -= 1

print(count)

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

if a == b and a == c:
    print(1)
elif a == b or a == c or b == c:
    print(2)
else:
    print(3)
Buggy python submission (verdict: Runtime Error):
n=int(inpyt())
k=int(inpyt())
sp_p=int(inpyt())
n_p=int(inpyt())
sum = 0

for i in k:
    sum += sp_p

for j in n-k:
    sum += n_p

print(sum)

Fixed submission:
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)

Buggy python submission (verdict: Runtime Error):
n, k, sp_p, n_p = map(int, input().split())
sum = 0

for i in k:
    sum += sp_p

for j in n-k:
    sum += n_p

print(sum)

Fixed submission:
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)

Buggy python submission (verdict: Runtime Error):
n, k, sp_p, n_p = map(int, input().split())
sum = 0

for i in k+1:
    sum += sp_p

for j in n-k+1:
    sum += n_p

print(sum)

Fixed submission:
all_days=int(input())
days1=int(input())
sp_p=int(input())
n_p=int(input())
ans = 0

if all_days <= days1:
    ans = sp_p * all_days
else:
    ans = days1 * sp_p + (all_days-days1) * n_p

print(ans)
Buggy python submission (verdict: Runtime Error):
w = input()
flg = True
for i in list("abcdefghijklmnopqrstuvwxyz"):
    if w.count(w[i]) % 2 != 0:
        flg = False

if flg:
    print('Yes')
else:
    print('No')
    


Fixed submission:
w = input()
flg = True
for i in list("abcdefghijklmnopqrstuvwxyz"):
    if w.count(i) % 2 != 0:
        flg = False

if flg:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a = int(input())
sum = 0
for i in range(i+1):
    sum += i
print(sum)

Fixed submission:
i = int(input())
sum = 0
for i in range(i+1):
    sum += i
print(sum)

Buggy python submission (verdict: Runtime Error):
a = input()
sum = 0
for a in range(a):
    sum += a
print(sum)

Fixed submission:
i = int(input())
sum = 0
for i in range(i+1):
    sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
s = input()
ans = []

for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        ans.pop(-1)

print(''.join(ans))


Fixed submission:
s = input()
ans = []

for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        if len(ans) != 0:
            ans.pop(-1)

print(''.join(ans))

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

for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        if len(s) != 0:
            ans.pop(-1)

print(''.join(ans))


Fixed submission:
s = input()
ans = []

for i in range(len(s)):
    if s[i] == '0':
        ans.append('0')
    if s[i] == '1':
        ans.append('1')
    if s[i] == 'B':
        if len(ans) != 0:
            ans.pop(-1)

print(''.join(ans))
Buggy python submission (verdict: Runtime Error):
N,L = map(int, input().split())
S = [i for i in input()]
S = sorted(S)
arr = []

for i in range(N):
    arr.append(S[i])

print(''.join(arr))

Fixed submission:
N,L = map(int, input().split())
S = [input() for _ in range(N)]
S = sorted(S)
string = ''

for i in range(N):
    string += S[i]

print(string)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def main():
    S = deque(input())
    Q = int(input())
    for _ in range(Q):
        query = input().split()
        if query[0] == "1":
            S.reverse()
            continue
        if query[1] == "1":
            S.appendleft(query[2])
        else:
            S.append(query[2])
    print("".join(list(S)))
        
if __name__ == "__main__":
    # print(timeit.timeit(lambda: main(), number=1))
    main()


Fixed submission:
from collections import deque

def main():
    S = deque(input())
    Q = int(input())
    rev_flag = False
    for _ in range(Q):
        query = input().split()
        if query[0] == "1":
            rev_flag = not(rev_flag)
            continue
        if query[1] == "1":
            if rev_flag:
                S.append(query[2])
            else:
                S.appendleft(query[2])
        else:
            if rev_flag:
                S.appendleft(query[2])
            else:
                S.append(query[2])
    
    if rev_flag:
        S.reverse()

    print("".join(list(S)))
        
if __name__ == "__main__":
    # print(timeit.timeit(lambda: main(), number=1))
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def main():
    N, K, Q = [int(x) for x in input().split()]
    X = np.array([K] * N)
    for _ in range(Q):
        X -= 1
        X[int(input())-1] += 1
    
    for x in X:
        if x > 0:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()


Fixed submission:
import numpy as np

def main():
    N, K, Q = [int(x) for x in input().split()]
    X = np.array([K - Q] * N)
    for _ in range(Q):
        X[int(input())-1] += 1
    
    for x in X:
        if x > 0:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    main()