Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))


Fixed submission:
import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))

Buggy python submission (verdict: Runtime Error):

N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))


Fixed submission:
import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
for i in range(min(X), max(X)):
    ans = 0
    for j in X:
        ans += (j - i) * (j - i)
    ans_list.append(ans)

print(min(ans_list))


Fixed submission:
import sys
N = int(input())
X = [int(_) for _ in input().split()]
ans_list = []
if N == 1:
    print('0')
    sys.exit()
for i in range(min(X), max(X) + 1):
    ans = 0
    for j in X:
        ans += (j - i) ** 2
    ans_list.append(ans)

print(min(ans_list))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1
max_list = [kv for kv in input_dict.items() if kv[1] == max(input_dict.values())]
max_list.sort()
for i in range(len(max_list)):
    print(max_list[i][0])

Fixed submission:
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1
max_value = max(input_dict.values())
max_list = []
for k, v in input_dict.items():
    if v == max_value:
        max_list.append(k)
max_list.sort()
[print(i) for i in max_list]
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while a == 1:
        H = H // 2
        n += 1
        if H == 1:
            break
    print(2 ** n - 1)
main()


Fixed submission:
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while H != 1:
        H = H // 2
        n += 1
    print(2 ** n - 1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while a == 1:
        H = H // 2
        n += 1
        if H == 1:
            ans = 2 ** n - 1
            break
    print(ans)
main()


Fixed submission:
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while H != 1:
        H = H // 2
        n += 1
    print(2 ** n - 1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H = int(input())
    n = 0
    ans = 0
    a = 1
    while a == 1:
        H = H // 2
        ans = ans + pow(2, n)
        n += 1
        if H == 1:
            ans = ans + pow(2, n)
            break
    print(ans)
main()


Fixed submission:
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while H != 1:
        H = H // 2
        n += 1
    print(2 ** n - 1)
main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    H = int(input())
    n = 0
    ans = 0
    a = 1
    while a == 1:
        H = H // 2
        ans = ans + 2 ** n
        n += 1
        if H == 1:
            ans = ans + 2 ** n
            break
    print(ans)
main()


Fixed submission:
def main():
    H = int(input())
    n = 1
    ans = 0
    a = 1
    while H != 1:
        H = H // 2
        n += 1
    print(2 ** n - 1)
main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    ans = 0
    P = [int(_) for _ in input().split()]
    for i in range(N):
        if min(P[:i+1]) == P[i]:
            ans += 1
    print(ans)
main()


Fixed submission:
def main():
    N = int(input())
    ans = 0
    P = [int(_) for _ in input().split()]
    for i in range(N):
        if i == 0:
            x = P[0]
        if P[i] <= x:
            ans += 1
            x = P[i]
    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>
int main(void){
  int N, A, B, sum, ans = 0;
  scanf("%d %d %d", &N, &A, &B);
  for(int i=0;i<=N;i++){
    int j=i;
    sum=0;
    while(j!=0){
      sum=sum+(j%10);
      j=j/10;
    }
    if(sum>=A && sum<=B){
      ans=ans+i;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Fixed submission:
def main():
    N = int(input())
    music = []
    m_time = []
    for _ in range(N):
        a, b = input().split()
        music.append(a)
        m_time.append(int(b))
    X = input()
    ans = 0
    for i, a in enumerate(music):
        if a == X:
            for j in range(i+1, N):
                ans += m_time[j]
    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
from math import inf

N = int(input())

line = input().split(" ")
X = []

for e in line:
	X.append(int(e))

ans = inf
for P in range(101):
	curr = 0

	for x in X:
		curr += (x - P)**2

	ans = min(ans, curr)


print(ans)

Fixed submission:
import sys

N = int(input())

line = input().split(" ")
X = []

for e in line:
	X.append(int(e))

ans = sys.maxsize
for P in range(101):
	curr = 0

	for x in X:
		curr += (x - P)**2

	ans = min(ans, curr)


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def get_spf(n):
	ans = [i for i in range(n + 1)]

	for p in range(2, n + 1):
		if ans[p] == p:
			for i in range(p**2, n + 1, p):
				if ans[i] == i:
					ans[i] = p

	return ans

def get_pf(n, spf):
	ans = []

	while n > 1:
		ans.append(spf[n])
		n = int(n / spf[n])

	return ans

if __name__ == "__main__":
	line = input().split(" ")

	a, b = int(line[0]), int(line[1])

	# spf = get_spf(max(math.ceil(math.sqrt(a)), math.ceil(math.sqrt(b))))
	spf = get_spf(max(a, b))

	primes_a = set(get_pf(a, spf))
	primes_b = set(get_pf(b, spf))

	ans = []
	for e in primes_a:
		if e in primes_b:
			ans.append(e)

	print(1 + len(ans))

Fixed submission:
import math

def is_prime(n):
	if n < 2: return False

	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0:
			return False

	return True

def get_pf(n):
	ans = [1]

	for p in range(2, math.ceil(math.sqrt(n))):
		while n % p == 0:
			n = int(n / p)
			ans.append(p)

	if n != 1:
		ans.append(n)

	return ans

if __name__ == "__main__":
	line = input().split(" ")

	a, b = int(line[0]), int(line[1])

	if a > b:
		a, b = b, a

	primes_a = set(get_pf(a))
	primes_b = set(get_pf(b))

	# if b % a == 0 and is_prime(a):
	# 	primes_a.add(a)
	# 	primes_b.add(a)

	ans = []
	for e in primes_a:
		if e in primes_b:
			ans.append(e)

	# print(ans)
	print(len(ans))
Buggy python submission (verdict: Runtime Error):
import numpy as np
MOD = 10**9+7

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

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)

Fixed submission:
import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)
Buggy python submission (verdict: Runtime Error):
Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)

Fixed submission:
MOD = 10**9+7

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

Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7

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

Ci = n
Si = n
Ai = 0
Bi = 0

if a == 1:
    Ai = Ci
if b == 1:
    Bi = Ci
    
for k in range(2,n+1):
    Ci = ((Ci)*(n-k+1) % MOD)//k
    #Ci %= MOD
    Si += Ci
    Si %= MOD
    if k == a:
        Ai = Ci
    if k == b:
        Bi = Ci

ans = (Si - Ai - Bi) % MOD
print(ans)

Fixed submission:
MOD = 10**9+7

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

Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7

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

Ci = n
Si = n
Ai = 0
Bi = 0

if a == 1:
    Ai = Ci
if b == 1:
    Bi = Ci
    
for k in range(2,n+1):
    Ci = Ci*(n-k+1)//k
    Ci %= MOD
    Si += Ci
    Si %= MOD
    if k == a:
        Ai = Ci
    if k == b:
        Bi = Ci

ans = (Si - Ai - Bi) % MOD
print(ans)

Fixed submission:
MOD = 10**9+7

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

Sn = pow(2,n,MOD) - 1
if a > b:
    a,b = b,a
Xa, Xb = 1,1
Ya, Yb = 1,1
for i in range(b):
    if i < a:
        Xa = ( Xa * (n-i) ) % MOD
        Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD
    Xb = ( Xb * (n-i) ) % MOD
    Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD

ans = Sn - Xa*Ya % MOD - Xb*Yb % MOD
while ans < 0:
    ans += MOD
    
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

X = np.zeros(10**9, dtype = int)
flg = 'YES'
for a in A:
    if X[a]==1:
        flg = 'NO'
        break
    else:
        X[a] += 1
print(flg)

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

X = set(A)
if len(A) == len(X):
    print('YES')
else:
    print('NO')

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

flg = 'YES'
for i,a in enumerate(A):
    if a in A[i+1:]:
        flg = 'NO'
        break

print(flg)

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

X = set(A)
if len(A) == len(X):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,K = map(int,input().split())
P = np.array(list(map(int,input().split())))

ans = 0
for i in range(N-K+1):
    s = (K+ np.sum(P[i:i+K]))/2
    if s > ans:
        ans = s
print(ans)

Fixed submission:
import numpy as np

N,K = map(int,input().split())
P = np.array(list(map(int,input().split())))

s = (K+ np.sum(P[:K]))/2
ans = s
for i in range(1,N-K+1):
    s = s - P[i-1]/2 + P[i+K-1]/2
    if s > ans:
        ans = s
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

def lcm(x,y):
    return x*y//gcd(x,y)

lm = A[0]
for a in A[1:]:
    lm = lcm(lm, a)

ans = 0
for i in range(N):
    ans += ( lm//A[i] )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a // gcd(lm,a)

ans = 0
for i in range(N):
    ans += ( lm//A[i] )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for i in range(1,N):
    lm = lm*A[i] // gcd(lm,A[i])

ans = 0
for i in range(N):
    ans += ( lm//A[i] )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

m = A[0]
for i in range(1,N):
    lm = lm*A[i] // gcd(lm,A[i])

ans = 0

for i in range(N):
    ans += ( lm//A[i] )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a // gcd(lm,a)

ans = 0

for a in A:
    ans += ( lm//a )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a // fractions.gcd(lm,a)

ans = 0

for a in A:
    ans += ( lm//a )
    ans %= Mod

print(ans)

Fixed submission:
from fractions import gcd

Mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))

lm = A[0]
for a in A[1:]:
    lm = lm*a//gcd(lm,a)

ans = 0
for i in range(N):
    ans += lm//A[i]
ans %= Mod

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

N,M = map(int,input().split())
P = np.zeros(M, dtype=int)
S = np.zeros(M, dtype=int)
for i in range(M):
    p,s = map(str,input().split())
    P[i] = int(p)
    if s == 'AC':
        S[i] = 1
    
cOK = 0
cNG = 0
for q in range(1,N+1):
    Q = list(S[P==q])
    if 1 in Q:
        cOK += 1
        cNG += Q.index(1)

print(cOK, cNG)

Fixed submission:
import numpy as np

N,M = map(int,input().split())
OK = np.zeros(N, dtype = int)
NG = np.zeros(N, dtype = int)
for i in range(M):
    p,s = map(str,input().split())
    p = int(p)
    if s == 'AC':
        s = 1
        OK[p-1]=1
    else:
        if OK[p-1]==0:
            NG[p-1]+=1
    
cOK = sum(OK)
cNG = sum(NG[OK==1])

print(cOK, cNG)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
from functools import reduce

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
A = A // 2

def lcmb(x,y):
    return (x*y)//math.gcd(x,y)
def lcm(L):
    return reduce(lcmb, L, 1)
    
T = lcm(A)
m = M//T
if m%2 == 0:
    ans = m//2
else:
    ans = m//2 + 1
print(ans)

Fixed submission:
import numpy as np
import fractions
from functools import reduce

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))
A = A // 2

def lcmb(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm(L):
    return reduce(lcmb, L, 1)
    
T = lcm(A)

flg = False
for a in A:
    if (T//a)%2 == 0:
        flg = True
        break

m = M//T
if flg:
    ans = 0
elif m%2 == 0:
    ans = m//2
else:
    ans = m//2 + 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,M = map(int,input().split())
A = np.sort(list(map(int,input().split())))
ans = 0

xOK = A[0]*2
xNG = A[-1]*2 + 1
nx = 0
while xOK+1 < xNG:
    x = (xOK + xNG)//2
    nx = 0
    for a in A:
        nx += N-(np.searchsorted(A,x-a))
        if nx >= M:
            xOK = x
            break
    else:
        xNG = x

from itertools import accumulate
S=[0]+list(accumulate(A))

ans = 0
nnx = 0        
for a in A:
    nx = np.searchsorted(A,xOK-a,side='right')
    ans += a*(N-nx) + (S[N]-S[nx])
    nnx += (N-nx)
ans += xOK*(M-nnx)
        
    
print(ans)

Fixed submission:
import bisect 
from itertools import accumulate

N,M = map(int,input().split())
A = sorted(list(map(int,input().split())))
ans = 0

xOK = A[0]*2
xNG = A[-1]*2 + 1
nx = 0
while xOK+1 < xNG:
    x = (xOK + xNG)//2
    nx = 0
    for a in A:
        nx += N-(bisect.bisect_left(A,x-a))
        if nx >= M:
            xOK = x
            break
    else:
        xNG = x

S=[0]+list(accumulate(A))

ans = 0
nnx = 0        
for a in A:
    nx = bisect.bisect_right(A,xOK-a)
    ans += a*(N-nx) + (S[N]-S[nx])
    nnx += (N-nx)
ans += xOK*(M-nnx)
        
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N,u,v = map(int,input().split())
u -= 1
v -= 1

du = [0]*N
dv = [0]*N
du[u] = 0
dv[v] = 0
G = [[]]*N

def dfs(v, d, p, dis):
    dis[v] = d
    if G[v] != 0:
        for u in G[v]:
            if( u == p):
                continue
            else:
                dfs( u, d+1, v, dis )

def calcDist(s, dist):
    dfs(s, 0, -1, dist)

for i in range(N-1):
    e1,e2 = map(int, input().split())
    e1 -= 1
    e2 -= 1
    if G[e1] == []:
        G[e1] = [e2]
    else:
        G[e1].append(e2)
    if G[e2] == []:
        G[e2] = [e1]
    else:
        G[e2].append(e1)

if G[u]==[v]:
    ans = 0
else:    

    calcDist(v,dv)
    calcDist(u,du)
    maxD = 0
    for idu,idv in zip(du,dv):
        if idu < idv:
            maxD = max(maxD, idv)       
    ans = maxD-1
    
print(ans)

Fixed submission:
A = int(input())
B = int(input())

print(1+2+3-A-B)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

if N%2 == 1:
    ans = 0
else:

    df = math.log10(N)
    d = math.floor(df)
    cnt = 0
    for i in range(d,0,-1):
        cnt += (N//10**i) * (10**i-1)//(10-1)
        N//=10**i

print(cnt)

Fixed submission:
A = int(input())
B = int(input())

print(1+2+3-A-B)
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())

g = math.gcd(A,B)
print(int(A*B//g))

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

g = fractions.gcd(A,B)
print(int(A*B//g))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

if N%2 == 1:
    cnt = 0
else:

    df = math.log10(N)
    d = math.floor(df)
    cnt = 0
    for i in range(d,0,-1):
        if N < 10:
            break
        cnt += (N//10**i) * (10**i-1)//(10-1)
        N%=10**i

print(cnt)

Fixed submission:
N = int(input())

if N%2 == 1:
    cnt = 0
else:
    cnt = 0
    a = 1
    while (5**a)*2<=N:
        cnt += N//((5**a)*2)
        a += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())

if N%2 == 1:
    ans = 0
else:

    df = math.log10(N)
    d = math.floor(df)
    cnt = 0
    for i in range(d,0,-1):
        cnt += (N//10**i) * (10**i-1)//(10-1)
        N/=10**i

print(cnt)

Fixed submission:
N = int(input())

if N%2 == 1:
    cnt = 0
else:
    cnt = 0
    a = 1
    while (5**a)*2<=N:
        cnt += N//((5**a)*2)
        a += 1

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

N = int(input())
A = [0]*N
X = np.zeros([N,N],dtype=int)
Y = np.zeros([N,N],dtype=int)

for n in range(N):
    A[n] = int(input())
    for a in range(A[n]):
        X[n][a], Y[n][a] = list(map(int,input().split()))

ans = 0

for bits in range( 1, 1<<N ):
    ok = True
    for i in range( 0, N ):
        if not ( bits & (1 << i) ):
            continue
        for j in range( 0, A[i] ):
            if (( bits >> (X[i][j]-1) ) & 1) ^ Y[i][j]:
                ok = False
    if ok:
        ans = max( ans, (str(bin(bits))[2:]).count('1'))
        
print(ans)

Fixed submission:
import numpy as np

N = int(input())
A = [0]*N
X = np.zeros([N,N],dtype=int)
Y = np.zeros([N,N],dtype=int)

for n in range(N):
    A[n] = int(input())
    for a in range(A[n]):
        X[n][a], Y[n][a] = list(map(int,input().split()))

ans = 0

for bits in range( 1, 1<<N ):
    ok = True
    for i in range( 0, N ):
        if not ok:
            break
        if not ( bits & (1 << i) ):
            continue
        for j in range( 0, A[i] ):
            if (( bits >> (X[i][j]-1) ) & 1) ^ Y[i][j]:
                ok = False
                break
    if ok:
        ans = max( ans, (str(bin(bits))[2:]).count('1'))
        
print(ans)

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

N = int(input())
A = [0]*N
X = np.zeros([N,N],dtype=int)
Y = np.zeros([N,N],dtype=int)

for n in range(N):
    A[n] = int(input())
    for a in range(A[n]):
        X[n][a], Y[n][a] = list(map(int,input().split()))

def counter( x ):
    if x == 0:
        return 0
    return counter( x >> 1 ) + (x & 1)

ans = 0
       
for bits in range( 1, 1<<N ):
    ok = True
    for i in range( 0, N ):
        if not ( bits & (1 << i) ):
            continue
        for j in range( 0, A[i] ):
            if (( bits >> (X[i][j]-1) ) & 1) ^ Y[i][j]:
                ok = False
    if ok:
        ans = max( ans, counter(bits) )
        
print(ans)

Fixed submission:
import numpy as np

N = int(input())
A = [0]*N
X = np.zeros([N,N],dtype=int)
Y = np.zeros([N,N],dtype=int)

for n in range(N):
    A[n] = int(input())
    for a in range(A[n]):
        X[n][a], Y[n][a] = list(map(int,input().split()))

ans = 0

for bits in range( 1, 1<<N ):
    ok = True
    for i in range( 0, N ):
        if not ok:
            break
        if not ( bits & (1 << i) ):
            continue
        for j in range( 0, A[i] ):
            if (( bits >> (X[i][j]-1) ) & 1) ^ Y[i][j]:
                ok = False
                break
    if ok:
        ans = max( ans, (str(bin(bits))[2:]).count('1'))
        
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,X = map(int,input().split())

i=0
N = 0
if A*(10**9) + B*(10) <= X:
    N=10**9
else:
    while i < 10:
        if A*(10**i) + B*(i+1) > X:
            if i==0:
                N = 0
            else:
                N = (X-B*i)//A
                if N < 10**(i-1):
                    N = 0
            break
        else:
            i += 1

print(N)

Fixed submission:
S = input()
WS = list(['SUN','MON','TUE','WED','THU','FRI','SAT'])

ans = 7 - WS.index(S)
print(ans)