Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
A = []
for i in range(q):
    A.append(int(input()))

for i in range(1,n+1):
    if A.count(i) > q-k:
        print('Yes')
    else:
        print('No')



Fixed submission:
import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
A = [0]*n
for i in range(q):
    A[int(input())-1] +=1

for i in range(n):
    if A[i] > q-k:
        print('Yes')
    else:
        print('No')

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

for i in range(1,n+1):
    if A.count(i) > q-k:
        print('Yes')
    else:
        print('No')



Fixed submission:
import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
A = [0]*n
for i in range(q):
    A[int(input())-1] +=1

for i in range(n):
    if A[i] > q-k:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k,q = map(int,input().split())
A = []
for i in range(q):
    A.append(int(input()))

for i in range(1,n+1):
    if A.count(i) > q-k:
        print('Yes')
    else:
        print('No')



Fixed submission:
import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
A = [0]*n
for i in range(q):
    A[int(input())-1] +=1

for i in range(n):
    if A[i] > q-k:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n= map(int,input().split())
R = n//r
G = n // g
B = n // b
ans =0
for i in range(R+2):
    for j in range(G+2):
        if n - (i*r+j*g)< 0:
            continue
        if (n - (i*r+j*g) )%b ==0 and n - (i*r+j*g)>=0:
            ans +=1
print(ans)

Fixed submission:
r,g,b,n= map(int,input().split())
R = n//r
G = n // g
B = n // b
ans =0
for i in range(R+2):
    for j in range(G+2):
        if n - (i*r+j*g)< 0:
            continue
        if (n - (i*r+j*g) )%b ==0 and n - (i*r+j*g)>=0:
            ans +=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import math
import sys
from collections import defaultdict
input = sys.stdin.readline
r,g,b,n= map(int,input().split())
R = n//r
G = n // g
B = n // b
ans =0
for i in range(R+2):
    for j in range(G+2):
        if (n - (i*r+j*g) )%b ==0 and n - (i*r+j*g)>=0:
            ans +=1
print(ans)

Fixed submission:
r,g,b,n= map(int,input().split())
R = n//r
G = n // g
B = n // b
ans =0
for i in range(R+2):
    for j in range(G+2):
        if n - (i*r+j*g)< 0:
            continue
        if (n - (i*r+j*g) )%b ==0 and n - (i*r+j*g)>=0:
            ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
H = list(map(int,input().split()))
dp=[0 for i in range(H+1)]
dp[0]=0
dp[1]=abs(H[0-H[1]])
for i in range(2,N):
    dp[i+1] +=min(dp[i]+abs(H[i]-H[i+1]),dp[i-1]+abs(H[i-1]-H[i+1]))
    return dp[N]
print(dp[N])

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
dp=[0]*N
dp[0]=0
dp[1]=abs(H[0]-H[1])
for i in range(1,int(N)-1,1):
    dp[i+1] +=min(dp[i]+abs(H[i]-H[i+1]),dp[i-1]+abs(H[i-1]-H[i+1]))
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,m= map(int,input().split())

B = []
C = [0]*n
ans = 0
pna = 0
for i in range(m):
    A = list(map(str,input().split()))
    if A[0] not in B:
        if A[1]=="AC" :
            B.append(A[0])
            ans += 1
            pna += C[int(A[0])-1]
    	else:
      	  C[int(A[0])-1] += 1 
print(ans,pna)

Fixed submission:
import sys
input = sys.stdin.readline
n,m= map(int,input().split())
A = [ int(input()) for _ in range(n)]
a=sorted(A)
ans = 10 **10
for i in range(n-m+1):
    ans = min(abs(a[i+m-1] - a[i]),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
SA = sorted(A,reverse=True)
ALI =0
BOB=0
for i in range(0,N,2):
    ALI += int(SA[i])
for n in range(1,N,2):
    BOB += int(SA[n])
ans = ALI - BOB
print(ans)

Fixed submission:
n = int(input())
a = int(input())
print('Yes') if n%500<=a else print('No')
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if i*500+n*100+m*50==X:
                count += 1
print(count)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500+b*100+c*50==X:
                count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for i in range(A):
    for n in range(B):
        for m in range(C):
        if i*500+n*100+m*50==X:
        count += 1
print(count)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if a*500+b*100+c*50==X:
                count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')
end

Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a*b%2==0:
    print(Even)
elif a*b%2==1:
    print(Odd)
end





Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if x*y%2==0:
    print("Even")
elif x*y%2==1:
    print("Odd")
end





Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if x*y　%2==0:
    print("Even")
elif x*y%2==1:
    print("Odd")


Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
	if x*y%2==0:
    	print("Even")
    elif :
      print("Odd")





Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
if x*y%2==0:
    print("Even")
    elif :
      print("Odd")
end



Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input.split())
if x*y % 2 == 0 :
    print("Even")
    else print("Odd")
end



Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input.split())
if x*y%2==0
    print("Even")
    else print("Odd")
end



Fixed submission:
a,b = map(int,input().split())
if a*b%2==0:
    print('Even')
elif a*b%2==1:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
n=int(input())
int_list=[input() for i in range(n)]
print(len(set(int_list())))

Fixed submission:
n=int(input())
int_list=[input() for i in range(n)]
print(len(set(int_list)))
Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
for i in range(int(N)):
	for n in range(int(N-i)):
		m = N-i-n
		if i*10000+n*5000+m*1000 ==Y:
			print(i,n,m)
        else:
	break
if 10000*i+5000*n+1000*m != Y:
	print(-1,-1,-1)

Fixed submission:
N,Y = map(int,input().split())
for i in range(N+1):
    for n in range(N-i+1):
        if 10000*i+5000*n+1000*(N-i-n) == Y:
            print(i,n,N-i-n)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
N,Y = map(int,input().split())
for a in range(N):
    for b in range(N):
        10000*a+5000*b+1000*(N-a-b) == Y
        print(a,b,N-a-b)
    	break
	break

Fixed submission:
N,Y = map(int,input().split())
for i in range(N+1):
    for n in range(N-i+1):
        if 10000*i+5000*n+1000*(N-i-n) == Y:
            print(i,n,N-i-n)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
9 45000N,Y = map(int,input().split())
for a in range(N):
    for b in range(N):
        10000*a+5000*b+1000*(N-a-b) == Y
        print(a,b,N-a-b)
    	break
	break

Fixed submission:
N,Y = map(int,input().split())
for i in range(N+1):
    for n in range(N-i+1):
        if 10000*i+5000*n+1000*(N-i-n) == Y:
            print(i,n,N-i-n)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
Y = int(input())
for a in range(N):
    for b in range(N):
        10000*a+5000*b+1000*(N-a-b) == Y
        print(a,b,N-a-b)
    break

Fixed submission:
N,Y = map(int,input().split())
for i in range(N+1):
    for n in range(N-i+1):
        if 10000*i+5000*n+1000*(N-i-n) == Y:
            print(i,n,N-i-n)
            break
    else:
        continue
    break
else:
    print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
x,y,z = map(int,input().split())
count = 0
for i in range(1:x) 
    LIST = [int(x) for x in list(str(i))]
    if y <sum(LIST) <z :
        count +=1        
print(count)

Fixed submission:
x,y,z = map(int,input().split())
count = 0
for i in range(1,x+1) :
    LIST = [int(x) for x in list(str(i))]
    if y <=sum(LIST) <=z :
        count += i       
print(count)
Buggy python submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(input())
a = map(int,input().split())
ans = min(map(how_many_times_divisible, a))
 
print (ans)

Fixed submission:
s=list(input())
count = 0
for i in range(3):
    if s[i] == '1':
        count = count + 1    
print(count)

Buggy python submission (verdict: Runtime Error):
s=list(input())
count = 0
for i in range(2):
    if s[i] == 1 :
        count +=1    
print(count())

Fixed submission:
s=list(input())
count = 0
for i in range(3):
    if s[i] == '1':
        count = count + 1    
print(count)

Buggy python submission (verdict: Runtime Error):
s=list(str,input())
count = 0
for i in range(2):
    if s[i] == 1 :
        count = count+1    
print(count)

Fixed submission:
s=list(input())
count = 0
for i in range(3):
    if s[i] == '1':
        count = count + 1    
print(count)

Buggy python submission (verdict: Runtime Error):
s=list(str,input())
count = 0
for i in range(2):
    if s[i] == 1 :
        count +=1    
break
print(count())

Fixed submission:
s=list(input())
count = 0
for i in range(3):
    if s[i] == '1':
        count = count + 1    
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s=list(str,input())
count = 0
for s in range(10) 
    for i in range(n):
        if type(s[i]/2) ==True :
            s[i]=s[i]/2
            i = i+1
        count +=1
        elif type(s[i]/2) ==False:
        break
break
print(count)

Fixed submission:
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(input())
a = map(int,input().split())
ans = min(map(how_many_times_divisible, a))
 
print (ans)
Buggy python submission (verdict: Runtime Error):
N = input()
n = [int(N[i]) for i in range(4)]  


def addd(lista,op):
    cnt = lista[0]


    tmp = [lista[0]]
    for i in range(len(op)):
        if op[i]==0:
            cnt+=lista[i+1]
            tmp.append("+")
            tmp.append(lista[i+1])
        else:
            cnt -=lista[i+1]
            tmp.append("-")
            tmp.append(lista[i+1])
    if cnt ==7:
        tmp.append("=7")
        return tmp
    else:
        False

for i in range(2):
    for j in range(2):
        for k in range(2):
            ans = addd(n,[i,j,k])
            if ans != False:
                print("".join([str(n) for n in ans]))
                exit()
    




Fixed submission:
N = input()
n = [int(N[i]) for i in range(4)]  

def addd(lista,op):
    cnt = lista[0]


    tmp = [lista[0]]
    for i in range(len(op)):
        if op[i]==0:
            cnt+=lista[i+1]
            tmp.append("+")
            tmp.append(lista[i+1])
        else:
            cnt -=lista[i+1]
            tmp.append("-")
            tmp.append(lista[i+1])
    if cnt ==7:
        tmp.append("=7")
        return tmp
    else:
        return False

for i in range(2):
    for j in range(2):
        for k in range(2):
            ans = addd(n,[i,j,k])
            if ans != False:
                print("".join([str(n) for n in ans]))
                exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n=int(input())
A = [0]*n
B = [int(input())-1 for i in range(n)]
C = [0]

def fun(k):
    if B[k] in C:
        print(-1)
        sys.exit()                      
    else:
        C.append(B[k])
        if B[k] == 1:
            return False                                                    
        else:
            return B[k]
ans = 0
cnt = 0
for i in range(n):
    cnt = fun(cnt)
    ans +=1
    if cnt ==False:
        print(ans)
        sys.exit() 


        

Fixed submission:
import sys
input = sys.stdin.readline
n=int(input())

B = [int(input())-1 for i in range(n)]


def fun(k):
    if B[k] == 1:
     	return -5                                                    
    else:
        return B[k]
ans = 0
cnt = 0
for i in range(n+1):
    cnt = fun(cnt)
    ans +=1
    
    if cnt ==-5:
        print(ans)
        sys.exit() 
print(-1)
sys.exit()
Buggy python submission (verdict: Runtime Error):
atcoderbeginnercontest
atcoderregularcontest

Fixed submission:
o= input()
e= input()
P = ''

if len(o)==len(e):
    for i in range(len(o)):
        P += o[i]
        P += e[i]
else:
    for i in range(len(o)-1):
        P += o[i]
        P += e[i]
    P += o[len(o)-1]
print(P)
Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 0
time = 0.1 
num = 0
for i in range(n):
    if ans == 0:
        ans +=1
        time = a[0] -0.1
        num +=1
    elif ans != 0 and a[i] < time +k and num < c :
        num +=1
    elif  ans != 0 and (c <=num  or  time +k <=a[i]):
      
        time = a[i] -0.1
        num = 1
        ans +=1
print(ans)

Fixed submission:
#!/usr/bin/env python3
# sys.stdin.readline()
import numpy as np
import sys
import math
input = sys.stdin.readline
n,c,k = map(int,input().split())
A = [int(input()) for i in range(n)]
a = sorted(A)
ans = 0
time = 0.1 
num = 0
for i in range(n):
    if ans == 0:
        ans +=1
        time = a[0] 
        num +=1
    elif ans != 0 and a[i] <= time +k and num < c :
        num +=1
    elif  ans != 0 and (c <=num  or  time +k <=a[i]):
      
        time = a[i] 
        num = 1
        ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
A = input().split()
count=0
for i in range(N):
  if A[i]%2==1:
    count+=1
if conut%2=1:
  print("NO")
else:
  print("YES")

Fixed submission:
N = input()
A = input().split()
count=0
for i in range(int(N)):
  if int(A[i]) % 2==1:
    count+=1
if count%2==1:
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Runtime Error):
int(input())
# 初期位置
x_old, y_old, t_old = 0, 0, 0

for _ in range(n):
    # 都度読み込み
    t, x, y = map(int, input().split())
    d = (t - t_old) - abs(x - x_old) - abs(y - y_old)
    if d >= 0 and d % 2 == 0:
        x_old, y_old, t_old = x, y, t
    else:
        print('No')
        exit()

print('Yes')

Fixed submission:
n = int(input())
# 初期位置
x_old, y_old, t_old = 0, 0, 0

for _ in range(n):
    # 都度読み込み
    t, x, y = map(int, input().split())
    d = (t - t_old) - abs(x - x_old) - abs(y - y_old)
    if d >= 0 and d % 2 == 0:
        x_old, y_old, t_old = x, y, t
    else:
        print('No')
        exit()

print('Yes')
Buggy python submission (verdict: Runtime Error):
import math
def main():
    with open('in.csv', 'r') as r:
        args = list(r.readlines())
    N = int(args[0])
    use = math.ceil(N/1000)
    print(1000*use - N)
    
if __name__ == "__main__":
    main()


Fixed submission:
import math
def main():
    N = int(input().rstrip())
    use = math.ceil(N/1000)
    print(1000*use - N)
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    with open('in.csv', 'r') as r:
        args = list(r.readlines())
    N = int(args[0])
    print(N%1000)
    
if __name__ == "__main__":
    main()


Fixed submission:
import math
def main():
    N = int(input().rstrip())
    use = math.ceil(N/1000)
    print(1000*use - N)
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
    args1, args2 = input().rstrip().split(' '), input().rstrip().split(' ')
    N, M = int(args1[0]), int(args1[1])
    items = np.array([int(val) for val in args2])
    items = np.sort(items)[::-1]
    items_sum = np.sum(items)
    bottom = items_sum / 4. / M
    
    if(items[M-1] >= bottom):
        print('Yes')
    else:
        print('No')
    
if __name__ == "__main__":
    main()

Fixed submission:
def main():
    args = input().rstrip().split(' ')
    a, b, c = int(args[0]), int(args[1]), int(args[2])
    print('{} {} {}'.format(c, a, b))
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import sys
args = sys.argv

a, b, c = int(args[1]), int(args[2]), int(args[3])
print('{} {} {}'.format(c, a, b))

Fixed submission:
def main():
    args = input().rstrip().split(' ')
    a, b, c = int(args[0]), int(args[1]), int(args[2])
    print('{} {} {}'.format(c, a, b))
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for ball in balls:
        balls_map[ball] -= 1
        sum_ = 0
        for val in balls_map.values():
            sum_ += comb(val)
        print(sum_)
        balls_map[ball] += 1
    
if __name__ == "__main__":
    main()

Fixed submission:
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0

def main():
    args = input().rstrip().split(' ')
    N, M = int(args[0]), int(args[1])
    print(comb(N) + comb(M))
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for ball in balls:
        balls_map[ball] -= 1
        sum_ = 0
        for val in balls_map.values():
            sum_ += comb(val)
        print(sum_)
        balls_map[ball] += 1
    
if __name__ == "__main__":
    main()

Fixed submission:
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for val in balls_map.values():
        sum_ += comb(val)
    for ball in balls:
        print(sum_ - (balls_map[ball]-1))
    
if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    for ball in balls:
        balls_map[ball] -= 1
        sum_ = 0
        for val in balls_map.values():
            sum_ += comb(val)
        print(sum_)
        balls_map[ball] += 1
    
if __name__ == "__main__":
    main()

Fixed submission:
def comb(val):
    if(val > 0):
        return int(val*(val-1) / 2)
    else:
        return 0
    
def make_map(balls):
    balls_map = {}
    for ball in balls:
        if(ball in balls_map):
            balls_map[ball] += 1
        else:
            balls_map[ball] = 1
    return balls_map

def main():
    args = input().rstrip().split(' ')
    N = int(args[0])
    balls = [val for val in input().rstrip().split(' ')]
    balls_map = make_map(balls)
    
    sum_ = 0
    for val in balls_map.values():
        sum_ += comb(val)
    for ball in balls:
        print(sum_ - (balls_map[ball]-1))
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

def main():
    rule = {1:[0, 10], 2:[10, 100], 3:[100, 1000]}
    args = input().rstrip().split(' ')
    N, M = int(args[0]), int(args[1])
    query = []
    for i in range(M):
        args = input().rstrip().split(' ')
        query.append([int(args[0]), int(args[1])])
        
    for i in range(rule[N][0], rule[N][1]):
        if(N==1):
            val = np.array([i, -1,-1, -1, -1])
        elif(N==2):
            val = np.array([int(i/10), i%10, -1, -1, -1])
        else:
            val = np.array([int(i/100), int(i%100/10), i%10, -1, -1])
        
        flag = True
        for q in query:
            if(val[q[0]] != q[1]):
                flag = False
                break
        if(flag == True):
            print(i)
            sys.exit(1)
    print('-1')
    
if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np

def main():
    rule = {1:[0, 10], 2:[10, 100], 3:[100, 1000]}
    args = input().rstrip().split(' ')
    N, M = int(args[0]), int(args[1])
    query = []
    for i in range(M):
        args = input().rstrip().split(' ')
        query.append([int(args[0]), int(args[1])])
        
    global_flag = False
    for i in range(rule[N][0], rule[N][1]):
        if(N==1):
            val = np.array([i, -1,-1, -1, -1])
        elif(N==2):
            val = np.array([int(i/10), i%10, -1, -1, -1])
        else:
            val = np.array([int(i/100), int(i%100/10), i%10, -1, -1])
        
        flag = True
        for q in query:
            if(val[q[0]-1] != q[1]):
                flag = False
                break
        if(flag == True):
            print(i)
            global_flag = True
            break
    if(global_flag == False):
        print('-1')
    
if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
a = input()
ans = 0

for i in range(3):
    if (a[i] == '1'):
        ans += 1

print(ans)


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

ans = -1
f = True

while (f):
    ans += 1
    for i in range(n):
        if (A[i] == 0 or A[i] % 2 != 0):
            f = False
            break
        A[i] /= 2

print(ans)