Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + 1
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count[i][j] + 1
if (count.sum(axis=1)  ==3).any():
    print('Yes')
elif (count.sum(axis=0) ==3).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]==3:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]==3:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros(3,3)
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count + (i+1)*(j+1)
if (count.sum(axis=1) % 3 ==0).any():
    print('Yes')
elif (count.sum(axis=0) % 3 ==0).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]:
    print('Yes')
else:
    print('No')

Fixed submission:
import numpy as np
A = [list(map(int, input().split())) for i in range(0,3)]
N = int(input())
b_list =list([int(input()) for i in range(0,N)])
count = np.zeros((3,3))
for i in range(0,3):
    for j in range(0,3):
        if A[i][j] in b_list:
            count[i][j] = count[i][j] + 1
if (count.sum(axis=1)  ==3).any():
    print('Yes')
elif (count.sum(axis=0) ==3).any():
    print('Yes')
elif count[0][0] + count[1][1] + count[2][2]==3:
    print('Yes')
elif count[2][0] + count[1][1] + count[0][2]==3:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,R = map(int,input())

if N >= 10:
  print(R)
else:
  print(R-100*(10-N))

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

if N >= 10:
  print(R)
else:
  print(R+100*(10-N))
Buggy python submission (verdict: Runtime Error):
A,B,C = input().split(' ')

if A== B:
    if B =!C:
        print('Yes')
    else:
        print('No')
else:
    if B == C or A ==C:
        print('Yes')
    else:
        print('No')

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

if A== B:
    if B != C:
        print('Yes')
    else:
        print('No')
else:
    if B == C or A ==C:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])

print(max(answer))

Fixed submission:
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K+1):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = [0] + A
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])

print(max(answer))

Fixed submission:
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K+1):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

B = [0] + A
B = list(accumulate(B))
answer = []
for i in range(N-K):
    answer.append(B[i+K]-B[i])
    
print(max(answer))

Fixed submission:
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K+1):
    answer.append(B[i+K]-B[i])

print(max(answer))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = input().split()
N = int(N)
K = int(K)
A = [(int(x)+1)/2 for x in input().split()]

print(max([sum(A[i:i+K]) for i in range(0,N,1)]))

Fixed submission:
from itertools import accumulate
import numpy as np
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
A = (A+1)/2

B = np.insert(A,0,0)
B = list(accumulate(B))
answer = []
for i in range(N-K+1):
    answer.append(B[i+K]-B[i])

print(max(answer))
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())

def prime_list(X):
    N = X
    flg = True
    while flg :
        for i in range(2,int(N**(1/2))+1):
            if N % i == 0:
                N = N + 1
                flg = True
                break
            else:
                flg = False
    return N



print(prime_list(X))

Fixed submission:
import math
X = int(input())

def prime_list(X):
    N = X
    while True :
        for i in range(2,int(math.sqrt(N))+1):
            if N % i == 0:
                N = N + 1
                break
        else:
            break
    return N



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

if N%2==1:
    print(0)
else:
    i = 10
    count = 0
    while i <= N:
        count += N//i
        i = i*5

print(count)


Fixed submission:
N = int(input())

if N%2==1:
    print(0)
else:
    i = 10
    count = 0
    while i <= N:
        count += N//i
        i = i*5

    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = input()
S_list = [S[i] for i in range(N)]
S_c = collections.Counter(S_list)
list12 = []
ans = 0
for i in range(N-2):
    s1 = S_list[i]
    S_c[s1] = S_c[s1]-1
    S_c23 = S_c.copy()

    for j in range(i+1,N-1):

        s2 = S_list[j]

        S_c23[s2] = S_c23[s2] - 1
        if (s1+s2) in list12:
            pass
        else:
            list12.append(s1+s2)
            for key in S_c23.keys():
                if S_c23[key] != 0:
                    ans+=1
print(ans)

Fixed submission:
import collections
N = int(input())
S = input()
S_list = [S[i] for i in range(N)]
S_c = collections.Counter(S_list)
list12 = []
list1 = []

ans = 0
for i in range(N-2):
    s1 = S_list[i]

    S_c[s1] = S_c[s1]-1
    if s1 in list1:
        continue

    S_c23 = S_c.copy()
    list1.append(s1)
    for j in range(i+1,N-1):
        s2 = S_list[j]
        
        S_c23[s2] = S_c23[s2] - 1
        if (s1+s2) in list12:
            continue
        else:
            list12.append(s1+s2)
            for key in S_c23.keys():
                if S_c23[key] != 0:
                    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
X,Y = map(int,input().split())

dp =[[0]*(X+1) for i in range(Y+1)]
dp[0][0] = 1
mod = 10**9 +7
for x in range(X+1):
    for y in range(Y+1):
        if (x>1 and y>0) or (x>0 and y>1):

            dp[x][y] = (dp[x-1][y-2]+dp[x-2][y-1])%mod

print(dp[X][Y])

Fixed submission:
X, Y = map(int,input().split())

total = (X+Y)/3
k = (2*X-Y)//3

if (total == int(total)) and (k>=0):
    total = (X+Y)//3

    mod = 10 ** 9 + 7

    modinv_table = [-1] * (k + 1)
    for i in range(1, k + 1):
        modinv_table[i] = pow(i, -1, mod)


    def binomial_coefficients(n, k):
        ans = 1
        for i in range(k):
            ans *= n - i
            ans *= modinv_table[i + 1]
            ans %= mod
        return ans

    print(binomial_coefficients(total,k))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

B = [0]*N
for i in range(0,N):
    B[A[i]-1] = i+1

for i in range(B):
    print(i)

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

B = [0]*N
for i in range(0,N):
    B[A[i]-1] = i+1

for i in B:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

for i in range(1,N+1):
    print(A.index(i)+1)

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

B = [0]*N
for i in range(0,N):
    B[A[i]-1] = i+1

for i in B:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = map(int,input().split())
A = list(map(int,input().split()))

for i in range(M):
    ind = np.argmax(A)
    A[ind] = A[ind]//2

print(sum(A))

Fixed submission:
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)

for i in range(M):
    trgt = -heapq.heappop(A)//2
    heapq.heappush(A,-trgt)
print(-sum(A))

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

for i in range(M):
    ind = A.index(max(A))
    A[ind] = A[ind]//2

print(sum(A))

Fixed submission:
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)

for i in range(M):
    trgt = -heapq.heappop(A)//2
    heapq.heappush(A,-trgt)
print(-sum(A))

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))

for i in range(M):
    ind = A.index(max(A))
    A[ind] = A[ind]//2

print(sum(A))　　

Fixed submission:
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)

for i in range(M):
    trgt = -heapq.heappop(A)//2
    heapq.heappush(A,-trgt)
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
mod = 10**9 + 7
N, K = map(int,input().split())
for i in range(1,K+1):
    a = K-i
    b = i-1
    c = N-(i-1)-K
    d = i
    print(comb(a+b,b,exact=True)*comb(c+d,d,exact=True)%mod)


Fixed submission:
from scipy.special import comb
mod = 10**9 + 7
N, K = map(int,input().split())
for i in range(1,K+1):
    a = K-i
    b = i-1
    c = N-(i-1)-K
    d = i
    print(comb(a+b,b,exact=True)*comb(c+d,d,exact=True)%mod)
Buggy python submission (verdict: Runtime Error):
N = int(input())

xy = [list(map(int,input().split())) for i in range(N)]

cnt ={}

for i in range(N):
    xi = xy[i][0]
    yi = xy[i][1]

    for j in range(i+1,N):
        xj = xy[j][0]
        yj = xy[j][1]

        x_dif =xi-xj
        y_dif = yi-yj
        if x_dif<0:
            x_dif = -x_dif
            y_dif = -y_dif

        if (x_dif,y_dif)  in cnt.keys():
            cnt[x_dif,y_dif] += 1
        else:
            cnt[x_dif, y_dif] =1

print(N-max(cnt.values()))

Fixed submission:
from decimal import Decimal

N = int(input())

xy = [list(map(Decimal,input().split())) for i in range(N)]

cnt ={}

for i in range(N):
    xi = xy[i][0]
    yi = xy[i][1]

    for j in range(i+1,N):
        xj = xy[j][0]
        yj = xy[j][1]

        x_dif =xi-xj
        y_dif = yi-yj
        if x_dif<0:
            x_dif = -x_dif
            y_dif = -y_dif
        elif x_dif == 0:
            y_dif = abs(y_dif)

        if (x_dif,y_dif)  in cnt.keys():
            cnt[x_dif,y_dif] += 1
        else:
            cnt[x_dif, y_dif] =1

if N == 1:
    print(1)
else: print(N-max(cnt.values()))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, K = map(int, input().split())
h = np.array(list(map(int,input().split())))

cost_dp = np.array([float('inf')]*n)
cost_dp[0] = 0

for i in range(1,n):
    k = min(i,K)
    cost_dp[i] = np.min(cost_dp[i-k:i]+np.absolute(h[i-k:i]-h[i]))

print(int(cost_dp[-1]))

Fixed submission:
import numpy as np

n, K = map(int, input().split())
h = np.array(list(map(int,input().split())))

cost_dp = np.array([100000000]*n)
cost_dp[0] = 0

for i in range(1,n):
    k = min(i,K)
    cost_dp[i] = np.min(cost_dp[i-k:i]+np.absolute(h[i-k:i]-h[i]))

print(int(cost_dp[-1]))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n, K = map(int, input().split())
h = np.array(list(map(int,input().split())))

cost_dp = np.array([float('inf')]*n)
cost_dp[0] = 0

for i in range(1,n):
    k = min(i,K)
    cost_dp[i] = np.min((cost_dp+np.absolute(h-h[i]))[i-k:i])

print(int(cost_dp[-1]))

Fixed submission:
import numpy as np

n, K = map(int, input().split())
h = np.array(list(map(int,input().split())))

cost_dp = np.array([100000000]*n)
cost_dp[0] = 0

for i in range(1,n):
    k = min(i,K)
    cost_dp[i] = np.min(cost_dp[i-k:i]+np.absolute(h[i-k:i]-h[i]))

print(int(cost_dp[-1]))
Buggy python submission (verdict: Runtime Error):
N = input()

max_a= [0]*N
max_b = [0]*N
max_c = [0]*N

for i in range(0,N):
  a,b,c = map(int,input.split())
  max_a[i] = max(max_b[i-1]+a,max_c+a) 
  max_b[i] = max(max_a[i-1]+b,max_c[i-1]+b) 
  max_c[i] = max(max_a[i-1]+c,max_b[i-1]+c) 
  
print(max(max_a[-1],max_b[-1],max_c[-1]))

Fixed submission:
N = int(input())

max_a = [0] * N
max_b = [0] * N
max_c = [0] * N
if N>1:
    for i in range(0, N):
        a, b, c = map(int, input().split())
        max_a[i] = max(max_b[i - 1] + a, max_c[i-1] + a)
        max_b[i] = max(max_a[i - 1] + b, max_c[i - 1] + b)
        max_c[i] = max(max_a[i - 1] + c, max_b[i - 1] + c)

    print(max(max_a[-1], max_b[-1], max_c[-1]))
else:
    a, b, c = map(int, input().split())

    print(max(a, b, c))
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

A = [int(input()) for i in range(n)]

A.sort()

half = math.floor(n/2)

half_A = A[half]
dif = A[half+1] - half_A*2 +A[half-1]
if (n%2 == 1) & (dif>0):
    total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half] - A[half-1]
elif (n % 2 == 1) & (dif<=0):
    total = sum(A[half+2:])*2 - sum(A[:half])*2 + A[half] + A[half+1]
else:

    total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half-1] + A[half]

print(total)


Fixed submission:
import math
n = int(input())

A = [int(input()) for i in range(n)]

A.sort()

half = math.floor(n/2)
if n ==2:
    print(A[1]-A[0])
else:
    half_A = A[half]
    dif = A[half+1] - half_A*2 +A[half-1]
    if (n%2 == 1) & (dif>0):
        total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half] - A[half-1]
    elif (n % 2 == 1) & (dif<=0):
        total = sum(A[half+2:])*2 - sum(A[:half])*2 + A[half] + A[half+1]
    else:
        total = sum(A[half+1:])*2 - sum(A[:half-1])*2 -A[half-1] + A[half]
    
    print(total)
Buggy python submission (verdict: Runtime Error):
a = map(int,input().split())

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")



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

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")

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

b= int(input())

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")



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

if a*b % 2 == 1:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())

A = [input() for i in range(N)]
B = [input() for i in range(M)]


for i in range(N-M):
    for j in range(N-M):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] == B[k][l]:
                    pass
                else:
                    flg=False
                    break
            if flg==False:
                break

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

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

A = [input() for i in range(N)]
B = [input() for i in range(M)]


for i in range(N-M+1):
    for j in range(N-M+1):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] == B[k][l]:
                    pass
                else:
                    flg=False
                    break
            if flg==False:
                break

        if flg:
            break
    if flg:
        break
if flg:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')


Fixed submission:

N,A,B = map(int,input().split())
S = input()
total = A+B
for i in range(N):
    if S[i]=='c':
        print('No')
    elif total>0:
        if S[i] == 'a':
            print('Yes')
            total = total-1
        elif S[i] =='b' and B>0:
            print('Yes')
            total = total-1
            B = B-1
        else:
            print('No')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')　

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

if (a>0) & (b>0):
    print('Positive')
elif (a<0) & (b>0):
    print('Zero')
elif (a==0) or(b==0):
    print('Zero')
else:
    if (b-a)%2==1:
        print('Positive')
    else:
        print('Negative')
Buggy python submission (verdict: Runtime Error):
n = int(input())

ans = ''

while n > 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26

print(ans[::-1])


Fixed submission:
s = input()

if s == s.upper():
    print('A')
else:
    print('a')
Buggy python submission (verdict: Time Limit Exceeded):
from decimal import *
getcontext().prec = 100000

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

if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print('Yes')
else:
    print('No')


Fixed submission:
from decimal import *
getcontext().prec = 28

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

if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])


Fixed submission:
a,b,c=map(int,input().split())
if a*c<=b:
  print(c)
else:
  print(b//a)
Buggy python submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
d = [i for i in range(100,1,-1) if (A%i==0 and B%i==0)]
print(d[K-1])


Fixed submission:
a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
  if(a%i==0 and b%i==0):
    d.append(i)
e=d[::-1]
print(int(e[k-1]))

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
d=[]
for i in range(1,min(a,b)):
  if a%i==0 and b%i==0:
    d.append(i)
d=d[::-1]
print(d[k-1])

Fixed submission:
a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
  if(a%i==0 and b%i==0):
    d.append(i)
e=d[::-1]
print(int(e[k-1]))

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
d=[]
for i in range(1,min(a,b)):
  if a%i==0 and b%i==0:
    d.append(i)
print(d[-2])

Fixed submission:
a,b,k=map(int,input().split())
d=[]
for i in range(1,101):
  if(a%i==0 and b%i==0):
    d.append(i)
e=d[::-1]
print(int(e[k-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import re
txt = input()
cnt = 0
while True:
    if re.findall('10',txt):
        a = re.subn('10', '', txt)
        txt = a[0]
        cnt += a[1]
    else:
        if re.findall('01', txt):
            a = re.subn('01', '', txt)
            txt = a[0]
            cnt += a[1]
        else:
            break;
print(int(cnt*2))

Fixed submission:
s = input()
print(int(2*min(s.count('0'),s.count('1'))))

Buggy python submission (verdict: Time Limit Exceeded):
import re
s = input()
s = s.replace('01','10')
cnt=0
t = re.subn('10','',s)
while t[1]!=0:
    a = t[0].replace('01','10')
    cnt += t[1]
    t = re.subn('10','',a)
print(int(cnt*2))

Fixed submission:
s = input()
print(int(2*min(s.count('0'),s.count('1'))))

Buggy python submission (verdict: Time Limit Exceeded):
import re
s=input()
s=s.replace('01','10')
cnt=0
while re.subn('10','',s)[1]!=0:
  t=re.subn('10','',s)
  s=t[0].replace('01','10')
  cnt+=t[1]
print(int(cnt*2))

Fixed submission:
s = input()
print(int(2*min(s.count('0'),s.count('1'))))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = math.gcd(a, A[i])
print(a)


Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if all(A[0]==a for a in A):
    print(A[0])
else:
    B = []
    D = []
    for a in A:
        for i in range(len(A)):
            if A[i]%a != 0:
                B = append(A[i]%a)
                C = list(set(B))
    for i in range(len(C)-1):
        D.append(abs(C[i]-C[i+1]))
    print(min(min(C),min(D)))

Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if all(A[0]==a for a in A):
    print(A[0])
else:
    while len(A) != 1:
        B = []
        for a in A:
            for i in range(len(A)):
                if A[i]%a != 0:
                    B.append(A[i]%a)
            if B is not None:
                B.sort()
                C = list(set(B))
                C.sort()
        if B == []:
            break
        else:
            A = C
    print(C[0])


Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
while not all(a==0 for a in A[0:-1]):
    A.sort()
    A[-1] = A[-1] - A[-2]
print(A[-1])

Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = [s for s in S]
cnt=0
while not (all(t=='W' for t in T) or all(t=='B' for t in T)):
    if(T[0]=='W'):
        cnt+=1
        T = ['B'] + T
        for i in range(1,len(T)):
            if T[i]=='W':
                T[i]='B'
            else:
                break
    else:
        cnt+=1
        T = ['W'] + T
        for i in range(1,len(T)):
            if T[i]=='B':
                T[i]='W'
            else:
                break
print(cnt)


Fixed submission:
S = input()
cnt=0
for i in range(len(S)-1):
    if S[i]!=S[i+1]: cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import sys
N, _ = map(int, input().split())
D = list(map(int, input().split()))
E = [str(i) for i in [0,1,2,3,4,5,6,7,8,9] if i not in D]
for n in N:
    if not n in E:
        for e in E:
            if e>n:
                n=e
                sys.stdout.write(n)
                break;
    else:
        sys.stdout.write(n)


Fixed submission:
N, _ = map(int, input().split())
D = list(map(int, input().split()))
E = [str(i) for i in [0,1,2,3,4,5,6,7,8,9] if i not in D]
E
while not all(n in E for n in str(N)):
    N+=1
print(N)