Harryxun/testdata huggingface dataset:
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())))

dp = [0] * N

for i in range(1,N):
  s=max(i-K,0)
  dp[i]=np.min(dp[s:i]+np.abs(H[s:i]-H[i]))

print(dp[-1])

Fixed submission:
import numpy as np
N,K= map(int,input().split())
H = np.array(list(map(int, input().split())))

dp = np.zeros(N, dtype=int)

for i in range(1,N):
  s=max(i-K,0)
  dp[i]=np.min(dp[s:i]+np.abs(H[s:i]-H[i]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
cnt=0
a=[0]*len(S)
for i in range(len(S)-1,-1,-1):
  if S[i]=='W':
    cnt=S[:i+1].count('B')
    a[i]=cnt
print(sum(a))

Fixed submission:
S=list(input())
cnt=0
ans=0
for i in range(len(S)-1,-1,-1):
  if S[i]=='W':
    cnt+=1
  else:
    ans+=cnt

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
cnt=0
for i in range(len(S)):
  if S[i]=='B':
    for j in range(i,len(S)):
      if S[j]=='W':
        cnt+=1
print(cnt)

Fixed submission:
S=list(input())
cnt=0
ans=0
for i in range(len(S)-1,-1,-1):
  if S[i]=='W':
    cnt+=1
  else:
    ans+=cnt

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = [tuple(map(int, input().split())) for _ in range(N)]

S.sort(key=lambda x: -x[1])
st = set()
first_acc, other_acc = [0], [0]
for t, d in S:
  if t in st:
    other_acc.append(other_acc[-1] + d)
  else:
    st.add(t)
    first_acc.append(first_acc[-1] + d)

ans = 0
for i in range(K + 1):
  if len(first_acc) <= i or len(other_acc) <= K - i:
    continue
  ans = max(ans, first_acc[i] + other_acc[K - i] + i * i)

print(ans)

Fixed submission:
N, X = map(int, input().split())
a,p=[1],[1]
for i in range(N):
  a.append(a[i] * 2 + 3) 
  p.append(p[i] * 2 + 1)

def f(N,X):
  if N == 0:
    return 0 if X <= 0 else 1 
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1) 
  else:
    return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

setS = []
for i in range(len(S)):
  if S[i] not in setS:
    S = S.replace(S[i],al[i])
    setS.append(S[i])

setT = []
for i in range(len(T)):
  if T[i] not in setT:
    T = T.replace(T[i],al[i])
    setT.append(T[i])

if S == T:
  print('Yes')
else:
  print('No')

Fixed submission:
S = input()
T = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

setS = []
cnt = 0
for i in range(len(S)):
  if S[i] not in setS:
    S = S.replace(S[i],al[cnt])
    cnt += 1
    setS.append(S[i])

setT = []
cnt = 0
for i in range(len(T)):
  if T[i] not in setT:
    T = T.replace(T[i],al[cnt])
    cnt += 1
    setT.append(T[i])

if S == T:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
MOD=10**9+7
 
def cmb(n, r, p):
  numerator = 1
  for i in range(n-r+1, n+1):
    numerator = numerator * i % p
  denominator = 1
  for j in range(1, r+1):
    denominator = denominator * j % p
  denominator = pow(denominator, p-2, p)
  return (numerator * denominator)%p
 
def factorization(n):
  l = []
  t = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if t%i==0:
      cnt=0
      while t%i==0:
        cnt+=1
        t //= i
      l.append([i, cnt])
  if t!=1:
    l.append([temp, 1])
  if l==[]:
    l.append([n, 1])
  return l
 
ans=1
F=factorization(M)
for i in range(len(F)):
  f=F[i][1]
  ans*=cmb(f+N-1,f,MOD)
  ans%=MOD

if M==1:
  print(1)
else:
  print(ans)

Fixed submission:
N,M=map(int,input().split())
MOD=10**9+7
 
def cmb(n, r, p):
  numerator = 1
  for i in range(n-r+1, n+1):
    numerator = numerator * i % p
  denominator = 1
  for j in range(1, r+1):
    denominator = denominator * j % p
  denominator = pow(denominator, p-2, p)
  return (numerator * denominator)%p
 
def factorization(n):
  l = []
  t = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if t%i==0:
      cnt=0
      while t%i==0:
        cnt+=1
        t //= i
      l.append([i, cnt])
  if t!=1:
    l.append([t, 1])
  if l==[]:
    l.append([n, 1])
  return l
 
ans=1
F=factorization(M)
for i in range(len(F)):
  f=F[i][1]
  ans*=cmb(f+N-1,f,MOD)
  ans%=MOD

if M==1:
  print(1)
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
x = list(map(int,input().split()))
cand = []
for i in range(N-K+1):
  cand.append(x[i:i+K])

ans = float('inf')
for i in range(len(cand)):
  l = cand[i][0]
  r = cand[i][-1]
  temp = min(abs(l)+abs(r-l),abs(r)+abs(l-r))
  ans = min(temp,ans)

print(ans)

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

ans = float('inf')
for i in range(N-K+1):
  l = x[i]
  r = x[i+K-1]
  temp = min(abs(l)+abs(r-l),abs(r)+abs(l-r))
  ans = min(temp,ans)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
N,K = map(int,input().split())
x = list(map(int,input().split()))
cand = list(combinations(x, K))
ans = float('inf')
for i in range(len(cand)):
  l = cand[i][0]
  r = cand[i][-1]
  temp = min(abs(l)+abs(r-l),abs(r)+abs(l-r))
  ans = min(temp,ans)

print(ans)

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

ans = float('inf')
for i in range(N-K+1):
  l = x[i]
  r = x[i+K-1]
  temp = min(abs(l)+abs(r-l),abs(r)+abs(l-r))
  ans = min(temp,ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

class BIT:
  def __init__(self, size):
    self.bit = [0] * (size + 1)
    self.size = size

  def sum(self, i):
    i += 1
    s = 0
    while i > 0:
      s += self.bit[i]
      i -= i & -i
    return s

  def add(self, i, x):
    i += 1
    while i <= self.size:
      self.bit[i] += x
      i += i & -i

N = int(input())
a = list(map(int, input().split()))
lb, ub = -1, 10**9
while ub - lb > 1:
  m = (lb + ub) // 2
  b = [0] * (N+1)
  for i in range(N):
    if a[i] <= m:
      b[i+1] = 1
  b = list(accumulate(b))
  bit_odd = BIT(2*N)
  bit_even = BIT(2*N)
  cnt = 0
  for i in range(N):
    x = N + b[i+1] - i//2 - 1
    y = N + b[i+1] - (i+1)//2 - 1
    if i % 2 == 0:
      bit_even.add(N + b[i] - i//2, 1)
      cnt += bit_even.sum(x) + bit_odd.sum(y)
    else:
      bit_odd.add(N + b[i] - i//2, 1)
      cnt += bit_even.sum(y) + bit_odd.sum(x)
  if cnt < N*(N+1)//4 + 1:
    lb = m
  else:
    ub = m
print(ub)

Fixed submission:
from itertools import accumulate

class BIT:
  def __init__(self, size):
    self.bit = [0] * (size + 1)
    self.size = size

  def sum(self, i):
    i += 1
    s = 0
    while i > 0:
      s += self.bit[i]
      i -= i & -i
    return s

  def add(self, i, x):
    i += 1
    while i <= self.size:
      self.bit[i] += x
      i += i & -i

N = int(input())
a = list(map(int, input().split()))
lb, ub = -1, 10**9
while ub - lb > 1:
  m = (lb + ub) // 2
  b = [0] * (N+1)
  for i in range(N):
    if a[i] <= m:
      b[i+1] = 1
  b = list(accumulate(b))
  bit_odd = BIT(2*N)
  bit_even = BIT(2*N)
  cnt = 0
  for i in range(N):
    x = N + b[i+1] - i//2 - 1
    y = N + b[i+1] - (i+1)//2 - 1
    if i % 2 == 0:
      bit_even.add(N + b[i] - i//2, 1)
      cnt += bit_even.sum(x) + bit_odd.sum(y)
    else:
      bit_odd.add(N + b[i] - i//2, 1)
      cnt += bit_even.sum(y) + bit_odd.sum(x)
  if cnt < N*(N+1)//4 + 1:
    lb = m
  else:
    ub = m
print(ub)
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
s = list(reversed(s))
cnt =0
while cnt < k and s[-1] == '1':
  cnt +=1
  s.pop()

print(s[-1])

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

ans = '1'
for i in range(k):
  if s[i] != '1':
    ans = s[i]
    break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
A=list(map(int,input().split()))
accumA=[]
tmp=0
for i in range(len(A)):
  tmp+=A[i]
  accumA.append(tmp)

accumA=[0]+accumA
cnt=0
for i in range(1,N+1):
  for j in range(i,N+1):
    s=accumA[j]-accumA[i-1]
    if s%M==0:
      cnt+=1

print(cnt)

Fixed submission:
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[0]
tmp=0
for i in A:
  tmp+=i
  B.append(tmp)

d = {}
for i in B:
  i %= M
  if i not in d:
    d[i] = 0
  d[i] += 1

ans = 0
for i in d.values():
  ans += i*(i-1)//2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

minv = float('inf')
for i in range(-max(a),max(a)+1):
  cnt = 0
  for j in range(N):
    cnt += abs(a[j] - (i + j))
  if minv > cnt:
    minv = cnt
    
print(minv)

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

for i in range(N):
  a[i] = a[i] - (i+1)

a.sort()
med = [a[N//2-1],a[N//2]]
mina = 0
for i in range(N):
  mina += abs(a[i] - med[0])

minb = 0
for i in range(N):
  minb += abs(a[i] - med[1])

print(min(mina,minb))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
minb=min(min(A),max(A)-N)
maxb=max(max(A),min(A)+N)
ans=float('inf')
for b in range(minb,maxb+1):
  d=0
  for i in range(N):
    d+=abs(A[i]-(b+i))
  ans=min(ans,d)
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
  B.append(A[i]-(i+1))
B.sort()
b=B[N//2]
ans=0
for i in range(N):
  ans+=abs(B[i]-b)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
w = []
for i in range(len(s)-K+1):
  for j in range(i,i+K):
    temp = s[i:j+1]
    if temp not in w:
      w.append(temp)
      
w.sort()
print(w[K-1])

Fixed submission:
s = input()
K = int(input())
w = []
for i in range(len(s)):
  for j in range(i,i+K):
    temp = s[i:j+1]
    if temp not in w:
      w.append(temp)
      
w.sort()
print(w[K-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
w = []
for i in range(len(s)):
  for j in range(i,len(s)):
    temp = s[i:j+1]
    if temp not in w:
      w.append(temp)
      
w.sort()
print(w[K-1])

Fixed submission:
s = input()
K = int(input())
w = []
for i in range(len(s)):
  for j in range(i,i+K):
    temp = s[i:j+1]
    if temp not in w:
      w.append(temp)
      
w.sort()
print(w[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,X,Y=map(int,input().split())
if A>=2*C:
  if B>=2*C:
    print(2*C*max(X,Y))
    exit()
  else:
    print(2*C*X+B*max(0,(Y-X)))
    exit()
elif B>=2*C:
  print(2*C*Y+A*max(0,(X-Y)))
  exit()
else:
  ans=A*X+B*Y
  for p in range(X):
    for q in range(Y):
      r=max(2*(X-p),2*(Y-q))
      ans=min(ans,A*p+B*q+C*r)
  print(ans)

Fixed submission:
A,B,C,X,Y=map(int,input().split())
if A>=2*C:
  if B>=2*C:
    print(2*C*max(X,Y))
    exit()
  else:
    print(2*C*X+B*max(0,(Y-X)))
    exit()
elif B>=2*C:
  print(2*C*Y+A*max(0,(X-Y)))
  exit()
else:
  ans=A*X+B*Y
  for i in range(1,min(X,Y)+1):
    p=A*(X-i)+B*(Y-i)+2*C*i
    ans=min(ans,p)
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

for i in range(n):
  temp=a[:i+1]+a[i+2:]
  s =0
  for j in range(n):
    s+=abs(temp[j+1]-temp[j])
  print(s)

Fixed submission:
n=int(input())
a=[0]+list(map(int,input().split()))+[0]
s = sum([abs(a[i+1]-a[i]) for i in range(n+1)])
for i in range(1,n+1):
  ans = s+abs(a[i-1]-a[i+1])-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1]))
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
bits=[[] for i in range(29)]
for i in range(29):
  mod = 2**(i+1)
  for j in b:
    bits[i].append(j%mod)
  bits[i].sort()

ans = 0
for k in range(29):
  al = []
  cnt = 0
  mod = 2**k
  for i in a:
    al.append(i%(2*mod))
  al.sort(reverse=True)
  r1 = r2 = r3 = 0
  for j in al:
    while r1 < N and bits[k][r1]+j < mod:
      r1 += 1
    while r2 < N and bits[k][r2]+j < 2*mod:
      r2 += 1
    while r3 < N and bits[k][r3]+j < 3*mod:
      r3 += 1
    cnt += N-r3+r2-r1
  ans += (cnt%2) << k
print(ans)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
bits=[[] for i in range(29)]
for i in range(29):
  mod = 2**(i+1)
  for j in b:
    bits[i].append(j%mod)
  bits[i].sort()

ans = 0
for k in range(29):
  al = []
  cnt = 0
  mod = 2**k
  for i in a:
    al.append(i%(2*mod))
  al.sort(reverse=True)
  r1 = r2 = r3 = 0
  for j in al:
    while r1 < N and bits[k][r1]+j < mod:
      r1 += 1
    while r2 < N and bits[k][r2]+j < 2*mod:
      r2 += 1
    while r3 < N and bits[k][r3]+j < 3*mod:
      r3 += 1
    cnt += N-r3+r2-r1
  ans += (cnt%2) << k
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ab=[]
for i in range(N):
  for j in range(N):
    s=a[i]+b[j]
    if s in ab:
      ab.remove(s)
    else:
      ab.append(s)

ans=ab[0]
for i in range(1,len(ab)):
  ans^=ab[i]
print(ans)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
bits=[[] for i in range(29)]
for i in range(29):
  mod = 2**(i+1)
  for j in b:
    bits[i].append(j%mod)
  bits[i].sort()

ans = 0
for k in range(29):
  al = []
  cnt = 0
  mod = 2**k
  for i in a:
    al.append(i%(2*mod))
  al.sort(reverse=True)
  r1 = r2 = r3 = 0
  for j in al:
    while r1 < N and bits[k][r1]+j < mod:
      r1 += 1
    while r2 < N and bits[k][r2]+j < 2*mod:
      r2 += 1
    while r3 < N and bits[k][r3]+j < 3*mod:
      r3 += 1
    cnt += N-r3+r2-r1
  ans += (cnt%2) << k
print(ans)
Buggy python submission (verdict: Runtime Error):
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
LR=[list(map(int,input().split())) for _ in range(Q)]

c=[None]*(H*W)
for i in range(H):
  for j in range(W):
    c[A[i][j]-1] = (i, j)

d=[0]*(H*W)
for i in range(D, H*W):
  px,py = c[i-D]
  x, y = c[i]
  d[i]=d[i-D] + abs(x-px) + abs(y-py)
for l, r in LR:
  print(d[r]-d[l])

Fixed submission:
H,W,D=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(H)]
Q=int(input())
LR=[tuple(map(int,input().split())) for _ in range(Q)]

pos=[None]*(H*W)
for i in range(H):
  for j in range(W):
    pos[A[i][j]-1] = (i, j)

d=[0]*(H*W)
for i in range(D, H*W):
  px,py = pos[i-D]
  x, y = pos[i]
  d[i]=d[i-D] + abs(x-px) + abs(y-py)

for l, r in LR:
  print(d[r-1]-d[l-1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  return "Odd"
else:
  return "Even"

Fixed submission:
a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  return "Odd"
else:
  return "Een"

Fixed submission:
a, b = map(int, input().split())
if (a % 2 != 0) and (b % 2 != 0):
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Time Limit Exceeded):
import math

Q=int(input())
lr=[list(map(int,input().split())) for _ in range(Q)]

MAX=10**5
limit=int(math.sqrt(MAX))
primes=[2]
table=[i+1 for i in range(2,MAX,2)]
while limit>table[0]:
  primes.append(table[0])
  table=[j for j in table if j%table[0] != 0]
table=primes+table

similars=[]
for i in range(len(table)):
  n=table[i]
  if (n+1)//2 in table:
    similars.append(n)

for i in lr:
  l=i[0]
  r=i[1]
  cand=[x for x in similars if l<=x<=r]
  print(len(cand))

Fixed submission:
import math
from itertools import accumulate

Q=int(input())
lr=[list(map(int,input().split())) for _ in range(Q)]

MAX=10**5
limit=int(math.sqrt(MAX))
primes=[2]
table=[i+1 for i in range(2,MAX,2)]
while limit>table[0]:
  primes.append(table[0])
  table=[j for j in table if j%table[0] != 0]
primes=set(primes+table)

similars=[0]*MAX
for i in range(2,MAX):
  if i in primes and (i+1)//2 in primes:
    similars[i]=1

similars=list(accumulate(similars))

for i in lr:
  l=i[0]
  r=i[1]
  print(similars[r]-similars[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
a.sort()
b = list(set(a))
cnt = 0
for i in range(len(b)):
  c = a.count(b[i])
  if b[i] <= c:
    cnt += c - b[i]
  else:
    cnt += c
print(cnt)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
b = list(set(a))
ans = 0
for i in range(len(b)):
  cnt = 1
  while len(a) > 1 and a[-1] == a[-2]:
    a.pop()
    cnt += 1
  c = a.pop()
  if c <= cnt:
    ans += cnt - c
  else:
    ans += cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
b = list(set(a))
cnt = 0
for i in range(len(b)):
  c = a.count(b[i])
  if b[i] <= c:
    cnt += c - b[i]
  else:
    cnt += c
print(cnt)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
b = list(set(a))
ans = 0
for i in range(len(b)):
  cnt = 1
  while len(a) > 1 and a[-1] == a[-2]:
    a.pop()
    cnt += 1
  c = a.pop()
  if c <= cnt:
    ans += cnt - c
  else:
    ans += cnt
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())
a = list(map(int,input().split()))
b = list(set(a))
c = Counter(a)
cnt = 0
for i in range(len(b)):
  if b[i] <= c[b[i]]:
    cnt += c[b[i]] - b[i]
  else:
    cnt += a.count(b[i])
print(cnt)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
b = list(set(a))
ans = 0
for i in range(len(b)):
  cnt = 1
  while len(a) > 1 and a[-1] == a[-2]:
    a.pop()
    cnt += 1
  c = a.pop()
  if c <= cnt:
    ans += cnt - c
  else:
    ans += cnt
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
	counter += 1
 
prrint(counter)

Fixed submission:
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
  	counter += 1
 
prrint(counter)

Fixed submission:
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)

Buggy python submission (verdict: Runtime Error):
n = input()
a = list(map(int(i) for i in input().split()) 
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
  	counter += 1
 
prrint(counter)

Fixed submission:
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)

Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input().split()] 
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
  	counter += 1
 
prrint(counter)

Fixed submission:
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)

Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(i) for i in input().split()] 

counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
	a = list(map(lambda x: x / 2, a))
  	counter += 1

return counter

Fixed submission:
n = input()
a = list(map(int, input().split()))
 
counter = 0
while sum(list(map(lambda x: x % 2, a))) == 0:
    a = list(map(lambda x: x / 2, a))
    counter += 1
 
print(counter)
Buggy python submission (verdict: Runtime Error):
N,Z,W=map(int,input().split())
a=list(map(int,input().split()))
print(abs(W-a[0])if n==1 else max(abs(W-a[-1]),abs(a[-1]-a[-2])))

Fixed submission:
N,Z,W=map(int,input().split())
a=list(map(int,input().split()))
print(abs(W-a[0])if N==1 else max(abs(W-a[-1]),abs(a[-1]-a[-2])))

Buggy python submission (verdict: Runtime Error):
N,Z,W=map(int,input().split())
a=list(map(int,input().split()))
print(abs(w-a[0])if n==1 else max(abs(w-a[-1]),abs(a[-1]-a[-2])))

Fixed submission:
N,Z,W=map(int,input().split())
a=list(map(int,input().split()))
print(abs(W-a[0])if N==1 else max(abs(W-a[-1]),abs(a[-1]-a[-2])))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[list(map(int,input().split())) for _ in range(N)]

e=[[True]*N for _ in range(N)]
ans=0
for k in range(N):
  for i in range(N):
    for j in range(N):
      if A[i][j] > A[i][k] + A[k][j]:
        print(-1)
        exit()
      elif (A[i][j]==A[i][k]+A[k][j]) and (A[i][k]!= 0) and (A[k][j]!= 0):
        e[i][j]=False

ans=0
for i in range(N):
  for j in range(N):
    if e[i][j]: ans+=A[i][j]

print(ans//2)

Fixed submission:
import numpy as np
 
N = int(input())
A = np.array([input().split() for _ in range(N)], dtype=np.int64).reshape(N,N)

np.fill_diagonal(A, 10**9+1)

ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    d = np.min(A[i]+A[j])
    if d > A[i][j]:
      ans+=A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [list(map(int,input().split())) for _ in range(N)]
for i in range(N):
  A[i][i]=10**9+1
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    d=float('inf')
    for k in range(N):
      if k!=i and k!=j:
        d=min(d,A[i][k]+A[k][j])
    if d > A[i][j]:
      ans+=A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)

Fixed submission:
import numpy as np
 
N = int(input())
A = np.array([input().split() for _ in range(N)], dtype=np.int64).reshape(N,N)

np.fill_diagonal(A, 10**9+1)

ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    d = np.min(A[i]+A[j])
    if d > A[i][j]:
      ans+=A[i][j]
    elif d < A[i][j]:
      print(-1)
      exit()

print(ans)