Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
s = S
while '01' in s or '10' in s:
    s = s.replace('01','')
    s = s.replace('10','')
print(len(S) - len(s))

Fixed submission:
S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
s = S
res = True
while res == True:
    s = s.replace('01','')
    s = s.replace('10','')
    res0 = s.find('01')
    res1 = s.find('10')
    if res0 == -1 and res1 == -1:
        res = False
print(len(S) - len(s))

Fixed submission:
S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
s = S
res = True
while res == True:
    s = s.replace('01','',1)
    s = s.replace('10','',1)
    res0 = s.find('01')
    res1 = s.find('10')
    if res0 == -1 and res1 == -1:
        res = False
print(len(S) - len(s))

Fixed submission:
S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)

Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
s = S
res = True
while res == True:
    if s.find('01') >= 0:
        s = s.replace('01','',1)
    elif s.find('10') >= 0:
        s = s.replace('10','',1)
    res0 = s.find('01')
    res1 = s.find('10')
    if res0 == -1 and res1 == -1:
        res = False
print(len(S) - len(s))

Fixed submission:
S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
big_array = []
for i in range(N):
    a,b = map(int,input().split())
    for j in range(b):
        big_array.append(a)
big_array.sort()
print(big_array[K-1])

Fixed submission:
N,K = map(int,input().split())
ab = []
for i in range(N):
    a,b = map(int,input().split())
    ab.append([a,b])
ab.sort()
while K > 0:
    for _ab in ab:
        K -= _ab[1]
        if K <= 0:
            print(_ab[0])
            break
Buggy python submission (verdict: Time Limit Exceeded):
import math

def F(A,B):
    if A > B:
        return len(str(A))
    else:
        return len(str(B))
            

N = int(input())
min = F(1,N)
rt = int(math.sqrt(N))
for i in range(rt,N+1):
    if N % i != 0:
        continue
    f = F(i,int(N/i))
    if f < min:
        min = f
        break
print(min)

Fixed submission:
import math

def F(A,B):
    if A > B:
        return len(str(A))
    else:
        return len(str(B))
            

N = int(input())
min = F(1,N)
rt = int(math.sqrt(N))
for i in range(2,rt+1):
    if N % i != 0:
        continue
    f = F(i,int(N/i))
    if f < min:
        min = f
print(min)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
answer = 0
ac =a*c
ad = a*d
bc = b*C
bd = b*d
answer = max(ac,ad)
answer = max(answer,bc)
answer = max(answer,bd)
print(answer)

Fixed submission:
a,b,c,d = map(int,input().split())
answer = 0
ac =a*c
ad = a*d
bc = b*c
bd = b*d
answer = max(ac,ad)
answer = max(answer,bc)
answer = max(answer,bd)
print(answer)
Buggy python submission (verdict: Runtime Error):
n = int(input())
c = input()
l = 0
j = 0
a = [0]*n
b = [0]*n
for i in range(n):
  if(c[i]=='W'):
    a[l] =i+1
    l +=1
l = 0
for i in range(n-1,0,-1):
  if(c[i]=='R'):
    b[j] = i+1
    j +=1
j = 0
while(a[l] < b[l]):
      a[l]=0
      b[l]=0
      l+=1
      j+=1
if(a[l+1]==0):
  while(b[l+1]>0):
    j +=1
else:
  while(a[l+1]>0):
    j +=1
print(j)

Fixed submission:
n = int(input())
c = input()
l = 0
j = 0
a = [0]*n
b = [0]*n
for i in range(n):
  if(c[i]=='W'):
    a[l] =i+1
    l +=1
l = 0
for i in range(n-1,0,-1):
  if(c[i]=='R'):
    b[j] = i+1
    j +=1
j = 0
while(a[l] < b[l] and not(a[l]==0 or b[l] == 0)):
      a[l]=0
      b[l]=0
      l+=1
      j+=1
print(j)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [0]*10**4
a = [0]+a
x = 0
y = 0
z = 0
total = 0
for i in range(1,N+1):
  x = i
  for j in range(i,N+1):
    y = j
    for k in range(i,j+1):
      z = k
      total = int(((x+y)**2+(y+z)**2+(z+x)**2)/2)
      if(x==y and y==z):
        a[total]+=1
      elif(x==y or y==z or z==x):
        a[total]+=3
      else:
        a[total]+=6
for l in range(1,N+1):
  print(a[l])

Fixed submission:
N = int(input())
a = [0]*10**5
a = [0]+a
x = 0
y = 0
z = 0
total = 0
for i in range(1,101):
  x = i
  for j in range(i,101):
    y = j
    for k in range(i,j+1):
      z = k
      total = int(((x+y)**2+(y+z)**2+(z+x)**2)/2)
      if(x==y and y==z):
        a[total]+=1
      elif(x==y or y==z or z==x):
        a[total]+=3
      else:
        a[total]+=6
for l in range(1,N+1):
  print(a[l])
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
a = [0]*10**7
x = math.sqrt(10)
b = math.floor(x)
l = 0
for i in range(1,n+1):
  x = math.sqrt(i)
  b = math.floor(x)
  for j in range(1,b+1):
    if(i%j==0 and i//j == j):
      a[i-1] +=1
    elif(i%j==0):
      a[i-1] +=2
for k in range(n):
  l = l + a[k]*(k+1)
print(l)
 


Fixed submission:
import math

n = int(input())
answer = 0
c = 0
b = 0
for i in range(1,n+1):
  b = n//i
  c = i*b*(b+1)/2
  answer = answer + c
print(int(answer))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0]*q
c = [0]*q
s = 0
for i in range(q):
  b[i],c[i] = map(int,input().split())
for i in range(q):
  for j in range(n):
    if(a[j]==b[i]):
      a[j]=c[i]
    s +=a[j]
  print(s)
  s=0

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
q = int(input())
r = [0]*(10**5+10)
for i in range(n):
  r[a[i]] +=1
b = [0]*q
c = [0]*q
for i in range(q):
  b[i],c[i] = map(int,input().split())
s = 0
for m in range(n):
  s += a[m] 
for ii in range(q):
  s = s + (c[ii]-b[ii])*r[b[ii]]
  r[c[ii]] +=r[b[ii]]
  r[b[ii]]=0
  print(s)
Buggy python submission (verdict: Runtime Error):
x,y = map(int input().split())
a = -y+4x
b = y-2x
if(a%2==0 and b%2==0):
  print("Yes")
else:
  print("No")

Fixed submission:
x,y = map(int, input().split())
a = -y+4*x
b = y-2*x
if(a%2==0 and b%2==0 and a>=0 and b>=0):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
for i in range(n):
  wa = wa*a[i]
if(wa>10**18):
  print("-1")
else:
  print(wa)


Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)

Buggy python submission (verdict: Runtime Error):
import numpy as np
 
N = int(input())
A = list(map(int, input().split()))  
a = 1
if 0 in A:
	print(0)
for i in range(N):
  a *= *A[i] 
  if (a > 10**18):
  	a = -1
print(a)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)

Buggy python submission (verdict: Runtime Error):
import numpy as np
 
N = int(input())
A = list(map(int, input().split()))  
a = 1
if 0 in A:
	print(0)
for i in range(N):
  a = a*A[i] 
	if (a > 10**18):
  	a = -1
    return
print(a)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)

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

N = int(input())
A = list(map(int, input().split()))  
a = 1
for i in range(N):
  a = a*A[i] 
if (a > 10**18):
  	a = -1
print(a)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)

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

N = int(input())
A = list(map(int, input().split()))  
a = 1
for i in range(N):
  a = a*A[i] 
if (a > 10**18):
  	a = -1
print(a)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = 1
ka = 0
if(a.count(0)>=1):
  print(0)
  ka +=1
else:
  for i in range(n):
    wa = wa*a[i]
    if(wa>10**18):
      print("-1")
      ka +=1
      break
if(ka==0):
  print(wa)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import scipy as sp
import math
 
x, y = input().split()
a = int(x)
b = math.floor(y*100)
c = b/100
print(math.floor(a*c))

Fixed submission:
import numpy as np
import scipy as sp
import math
 
a, b = map(str, input().split())
a = int(a)
b = int(float(b) * 100.001)
ans = int(a * b // 100)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b=0
for i in range(n):
  print(a.count(i+1))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b=0
c = [0]*n+[0]
for i in range(n-1):
  c[a[i]] +=1
for j in range(1,n+1):
  print(c[j])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b=0
for i in range(n):
  for j in range(n-1):
    if(a[j]==i+1):
      b+=1
  print(b)
  b=0

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b=0
c = [0]*n+[0]
for i in range(n-1):
  c[a[i]] +=1
for j in range(1,n+1):
  print(c[j])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
wa = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      wa +=gcd(i,j,l)
print(wa)

Fixed submission:
import math

k = int(input())
wa = 0
aa = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    aa =math.gcd(i,j)
    for l in range(1,k+1):
      wa +=math.gcd(aa,l)
print(wa)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a =list(map(int,input().split()))
b = sorted(a,reverse='True')n,m = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n
b = sorted(a,reverse=True)
c = sum(a)
if(b[m-1]>=c/(4*m)):
  print('Yes')
else:
  print("No")

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*n
b = sorted(a,reverse=True)
c = sum(a)
if(b[m-1]>=c/(4*m)):
  print('Yes')
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a =list(map(int,input().split()))
d = [0]*(n+1)
answer = 0
for i in range(n):
  d[a[i]]+=1
for j in range(n):
  answer+= (d[j]*(d[j]-1))//2
for k in range(n)  
  print(answer+1-(d[a[k]]))

Fixed submission:
n = int(input())
a =list(map(int,input().split()))
d = [0]*(n+1)
answer = 0
for i in range(n):
  d[a[i]]+=1
for j in range(n+1):
  answer+= (d[j]*(d[j]-1))//2
for k in range(n):
  print(answer+1-(d[a[k]]))
Buggy python submission (verdict: Runtime Error):
S = input()
if(S = "AAA" or S = "BBB"):
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if(S == "AAA" or S == "BBB"):
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
s = input()
for i in range(len(s)):
  s[i]='x'
print(s)

Fixed submission:
s = input()
for i in range(len(s)):
  print('x',sep='',end='')
Buggy python submission (verdict: Runtime Error):
s = input()
if((s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]) or (s[0]==s[2] and s[1] ==s[3] and s[0]!=s[1])
   and (s[0]===s[3] and s[1]==s[2] and s[0]!=s[1])):
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
if((s[0]==s[1] and s[2]==s[3] and s[0]!=s[2]) or (s[0]==s[2] and s[1] ==s[3] and s[0]!=s[1])
   or (s[0]==s[3] and s[1]==s[2] and s[0]!=s[1])):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = int(input())
s = str(s)
if(s[-4]==s[-3] or s[-3]==s[-2] or s[-2]==s[-1]):
  print("Bad")
else:
  print("Good")

Fixed submission:
s = int(input())
a = [0]*4
a[0] = s//1000 
s = s-a[0]*1000
a[1] = s//100
s = s-a[1]*100
a[2] = s//10
s = s-a[2]*10
a[3] = s
if(a[0]==a[1] or a[1]==a[2] or a[2]==a[3]):
  print("Bad")
else:
  print("Good")
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
a = 0
if(h==2*x and w ==2*y)
a +=1
print(w*h/2,a)

Fixed submission:
w,h,x,y=map(int,input().split())
a = 0
if(h==2*y and w ==2*x):
  a +=1
print(w*h/2,a)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
x = [0]*n
a = 0
for i in range(m):
  l,r = map(int,input().split())
  for j in range(l-1,r):
    if(n>j):
      x[j] +=1
for i in range(n):
  if(x[i]==m):
    a+=1
print(a)

Fixed submission:
n,m = map(int, input().split())
x = [0]*n
a = 0
l  =[0]*m
r = [0]*m
for i in range(m):
  l[i],r[i]=map(int,input().split())
a = min(r)-max(l)+1
print(max(0,a))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
S = list(input())
if(S[k-1]=="A"):
  S[k-1]="a"
elif(S[k-1]=="B"):
  S[k-1]="b"
else:
  S[K-1]="c"
for i in range(n):
  print(S[i],end='')

Fixed submission:
n,k = map(int,input().split())
S = list(input())
if(S[k-1]=="A"):
  S[k-1]="a"
elif(S[k-1]=="B"):
  S[k-1]="b"
else:
  S[k-1]="c"
for i in range(n):
  print(S[i],end='')
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int, input().split())) 
a = 0
b = [0]*(10**5+10)
c = [0]*10**5
d = [0]*10**5
e = [0]*10**5
for i in range(n-1):
  if v[i]==v[i+1]:
    a +=1
if(a == n-1):
  print(int(n/2))
else:
  for i in range(0,n,2):
    b[v[i]] = b[v[i]] + 1
  for j in range(1,n+1,2):
    c[v[j]] =c[v[j]] + 1
  d = sorted(b,reverse=True)
  e = sorted(c,reverse=True)
  f = int(n/2)-d[0]
  g = int(n/2)-e[0]
  print(f+g)

Fixed submission:
n = int(input())
v = list(map(int, input().split())) 
a = 0
ab = 0
ac = 0
b = [0]*(10**5+10)
c = [0]*(10**5+10)
d = [0]*(10**5+10)
e = [0]*(10**5+10)
for i in range(n-1):
  if v[i]==v[i+1]:
    a +=1
if(a == n-1):
  print(int(n/2))
else:
  for i in range(0,n,2):
    b[v[i]] = b[v[i]] + 1
  for j in range(1,n+1,2):
    c[v[j]] =c[v[j]] + 1
  d = sorted(b,reverse=True)
  e = sorted(c,reverse=True)
  for s in range(10**5+1):
    if(d[0]==b[s]):
      ab = s
      break
  for t in range(10**5+1):
    if(e[0]==c[t]):
      ac = t
      break
  if(s==t):
    print(min(2*int(n/2)-d[0]-e[1],2*int(n/2)-d[1]-e[0]))
  else: 
    f = int(n/2)-d[0]
    g = int(n/2)-e[0]
    print(f+g)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
print(6-n-m)


Fixed submission:
n =int(input())
m = int(input())
print(6-n-m)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
print(6-n-m)


Fixed submission:
n =int(input())
m = int(input())
print(6-n-m)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
print(6-n-m)


Fixed submission:
n =int(input())
m = int(input())
print(6-n-m)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
s = math.ceil(math.sqrt(n))
h = 10**5
for i in range(1,s+1):
  if n%i==0:
    if h > max(len(str(i)),len(str(int(n/i)))):
      h = max(len(str(i)),len(str(int(n/i))))
print(h)

Fixed submission:
x,y = map(int, input().split())
print((x+y)%24)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
M = 10**9+7
sum = 1
for i in range(1,n+1):
  sum *= i%M
print(sum%M)


Fixed submission:
n = int(input())
d = 1
for i in range(1,n+1):
  d = (d*i)%(10**9+7)
print(d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
M = 10**9+7
sum = 1
for i in range(1,n+1):
  sum *= i%M
print(sum%M)

Fixed submission:
n = int(input())
d = 1
for i in range(1,n+1):
  d = (d*i)%(10**9+7)
print(d)
Buggy python submission (verdict: Runtime Error):
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]



def main():
    N, X, M = read_values()
    F = [-1] * M

    A = X
    t = 0
    while F[A] < 0:
        F[A] = t
        A = pow(A, 2, M)
        t += 1
    
    if t == 1:
        print(X * N)
    else:
        d = (N - F[A]) // (t - F[A])
        r = (N - F[A]) % (t - F[A]) + F[A]

    K = 0
    for i in range(F[A], t):
        K += A
        A = pow(A, 2, M)
    
    K *= d

    A = X
    for _ in range(r):
        K += A
        A = pow(A, 2, M)

    print(K)


if __name__ == "__main__":
    main()



Fixed submission:
import bisect
from collections import deque
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
# mod = 10 ** 9 + 7
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]



def main():
    N, X, M = read_values()
    F = [-1] * (M + 1)

    A = X
    t = 0
    while F[A] < 0:
        F[A] = t
        A = pow(A, 2, M)
        t += 1
    
    if t == 1:
        print(X * N)
        return
    d = (N - F[A]) // (t - F[A])
    r = ((N - F[A]) % (t - F[A])) + F[A]

    K = 0
    for _ in range(F[A], t):
        K += A
        A = pow(A, 2, M)
    
    K *= d

    A = X
    for _ in range(r):
        K += A
        A = pow(A, 2, M)

    print(K)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    H, W = read_values()
    C = tuple(read_index())
    D = tuple(read_index())
    S = [input().strip() for _ in range(H)]

    F = [10 ** 10] * (H * W)

    Q = [(0, C)]
    F[C[0] * W + C[1]] = 0
    while Q:
        c, (h, w) = heapq.heappop(Q)
        if (h, w) == D:
            print(c)
            return

        if F[h * W + w] > c:
            continue
        for d in (1, -1):
            if 0 <= w + d < W and S[h][w + d] == "." and F[h * W + w + d] > c:
                F[h * W + w + d] = c
                heapq.heappush(Q, (c, (h, w + d)))
            if 0 <= h + d < H and S[h + d][w] == "." and F[(h + d) * W + w] > c:
                F[(h + d) * W + w] = c
                heapq.heappush(Q, (c, (h + d, w)))
        
        for hh in range(h - 2, h + 3):
            for ww in range(w - 2, w + 3):
                if 0 <= ww < W and 0 <= hh < H and S[hh][ww] == "." and F[hh * W + ww] > c:
                    F[hh * W + ww] = c + 1
                    heapq.heappush(Q, (c + 1, (hh, ww)))
    
    print(-1)
            

if __name__ == "__main__":
    main()



Fixed submission:
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    H, W = read_values()
    C = tuple(read_index())
    D = tuple(read_index())
    S = [input().strip() for _ in range(H)]

    F = [False] * (H * W)

    M = {C}
    Q = [C]
    F[C[0] * W + C[1]] = 0
    c = 0
    while len(M) > 0:
        M.clear()
        while Q:
            h, w = Q.pop()
            M.add((h, w))
            if (h, w) == D:
                print(c)
                return

            for d in (1, -1):
                if 0 <= w + d < W and S[h][w + d] == "." and not F[h * W + w + d]:
                    F[h * W + w + d] = True
                    Q.append((h, w + d))
                if 0 <= h + d < H and S[h + d][w] == "." and not F[(h + d) * W + w]:
                    F[(h + d) * W + w] = True
                    Q.append((h + d, w))
        for h, w in M:
            for hh in range(h - 2, h + 3):
                for ww in range(w - 2, w + 3):
                    if 0 <= ww < W and 0 <= hh < H and S[hh][ww] == "." and not F[hh * W + ww]:
                        F[hh * W + ww] = True
                        Q.append((hh, ww))
        c += 1
    print(-1)
            

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N, K = read_values()
    A = read_list()

    D = {}
    L = []

    l = 0
    r = max(A) + 1

    while l != r:
        m = (l + r) // 2 
        k = 0

        for a in A:
            k += (a - 1) // m 
        if k > K:
            l = m + 1
        else:
            r = m

    print(r)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
from collections import deque
import bisect
import copy
import heapq
import itertools
import math
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    N, K = read_values()
    A = read_list()

    D = {}
    L = []

    l = 1
    r = max(A) + 1

    while l != r:
        m = (l + r) // 2 
        k = 0

        for a in A:
            k += (a - 1) // m 
        if k > K:
            l = m + 1
        else:
            r = m

    print(r)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
print(sum([1 if s, t else 0 for s, t in zip(input(), input())]))

Fixed submission:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7 

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    S = input().strip()
    T = input().strip()
    
    res = 0
    for s, t in zip(S, T):
        if s != t:
            res += 1

    print(res)


if __name__ == "__main__":
    main()