Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[0][1]]
word_list.sort()
for word in word_list:
    print(word)

Fixed submission:
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
most_common = word_dict.most_common()[0][1]
word_list = [k for k,v in word_dict.items() if v == most_common]
word_list.sort()
for word in word_list:
    print(word)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[0][1]]
word_list.sort()
for word in word_list:
    print(word)

Fixed submission:
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
most_common = word_dict.most_common()[0][1]
word_list = [k for k,v in word_dict.items() if v == most_common]
word_list.sort()
for word in word_list:
    print(word)

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

num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[0][1]]
word_list.sort()
for word in word_list:
    print(word)

Fixed submission:
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
most_common = word_dict.most_common()[0][1]
word_list = [k for k,v in word_dict.items() if v == most_common]
word_list.sort()
for word in word_list:
    print(word)

Buggy python submission (verdict: Runtime Error):
import collections

num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[1][1]]
word_list.sort()
for word in word_list:
    print(word)

Fixed submission:
import collections
import sys
input = sys.stdin.readline
num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
most_common = word_dict.most_common()[0][1]
word_list = [k for k,v in word_dict.items() if v == most_common]
word_list.sort()
for word in word_list:
    print(word)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

def binary_search(li, item):
  low = 0
  high = len(li) - 1
  
  while low <= high:
    mid = (low + high) // 2
    guess = li[mid]
    if item == guess:
      return True
    if item < guess:
      high = mid-1
    else:
      low = mid+1
  return False

def main():
  input = sys.stdin.readline
  n = int(input())
  a_li = list(input().split())
  a_li = [int(s) for s in a_li]

  a_li.sort()
  for a in a_li:
    a_li.remove(a)
    if binary_search(a_li, a) == True:
      print("NO")
      sys.exit()
  print("YES")
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys


def main():
  input = sys.stdin.readline
  n = int(input())
  a_li = list(input().split())
  a_li = [int(s) for s in a_li]

  a_li.sort()
  for i in range(n-1):
    if a_li[i] == a_li[i+1]:
      print("NO")
      sys.exit()
  print("YES")
  
if __name__ == "__main__":
  main()

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

def binary_search(li, item):
  low = 0
  high = len(li) - 1
  
  while low <= high:
    mid = (low + high) // 2
    guess = li[mid]
    if item == guess:
      return True
    if item < guess:
      high = mid-1
    else:
      low = mid+1
  return False

n = int(input())
a_li = list(map(int, input().split()))
a_li.sort()
for a in a_li:
  a_li.remove(a)
  if binary_search(a_li, a) == True:
    print("NO")
    sys.exit()
print("YES")

Fixed submission:
import sys


def main():
  input = sys.stdin.readline
  n = int(input())
  a_li = list(input().split())
  a_li = [int(s) for s in a_li]

  a_li.sort()
  for i in range(n-1):
    if a_li[i] == a_li[i+1]:
      print("NO")
      sys.exit()
  print("YES")
  
if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
H,N = (int(x) for x in input().split())
a = list(map(int,input(),split()))

if sum(a) >= H:
  print('Yes')
else:
  print('No')

Fixed submission:
H,N = (int(x) for x in input().split())
a = list(map(int,input().split()))

if sum(a) >= H:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A,B,K = (int(x) for x in input().split())

if A > K:
  print(A-K+B)
  
elif A+B>K
  print(B-K-A)
else:
  print(0)

Fixed submission:
A,B,K = (int(x) for x in input().split())

if A > K:
  print(A-K,B)
  
elif A+B>K:
  print(0,B-K+A)
else:
  print(0,0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
p = 1000000007
max_n = len(bin(max(A)))-2
mask = 1
s = 0
for i in range(max_n):
  s0 = 0
  s1 = 0
  for j in range(N):
    s0 += (A[j] & (mask << i)) >> i
    s1 += (~(A[j] | ~(mask << i))) >> i
  s += ((2**i)*s0*s1)%p
print(s%p)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
p = 1000000007
max_n = len(bin(max(A)))-2
mask = 1
s = 0
for i in range(max_n):
  s0 = 0
  s1 = 0
  for j in range(N):
    s0 += (A[j] & (mask << i)) >> i
    s1 += (~(A[j] | ~(mask << i))) >> i
  s += ((2**i)*s0*s1)%p
print(s%p)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())

for i in range(len(S)):
  S[i] = chr(65+(ord(S[i])-64)%(26-N))

    
print("".join(map(str,S)))

Fixed submission:
N = int(input())
S = list(input())

for i in range(len(S)):
  S[i] = chr(65+(ord(S[i])-65+N)%26)

    
print("".join(map(str,S)))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math
import numpy as np

N = int(input())
x= []
y = []
town = []
for i in range(N):
    x_i,y_i = (int(x) for x in  input().split())
    x.append(x_i)
    y.append(y_i)
    town.append(i)

grand_sum = 0.0
for v in itertools.permutations(town):
    d_sum = 0.0
    v = list(v)
    for i in range(len(v)-1):
        n1 = np.array([x[v[i]],y[v[i]]])
        n2 = np.array([x[v[i+1]],y[v[i+1]]])
        d_sum += np.linalg.norm(n2-n1)

    grand_sum += d_sum
    
print(grand_sum / math.factorial(N))

Fixed submission:
import itertools
import math
def getdis(a,b):
  return math.sqrt((b[0] - a[0])**2+(b[1]-a[1])**2)

N = int(input())

city = []
l = [i for i in range(N)]
for i in range(1,N+1):
  x,y = map(int,input().split())
  city.append([x,y])
  
l = list(itertools.permutations(l))
sum_dis = [0]*len(l)
for i in range(len(l)):
  for j in range(N-1):
    sum_dis[i]+=getdis(city[l[i][j]],city[l[i][j+1]])
print(sum(sum_dis)/len(l))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
L.sort()
t_sum = 0
for i in range(N):
  for j in range(i+1,N-1):
    num = L[i]+L[j]
    search_list = L[j+1:]
    le = 0
    ri = len(search_list)-1
    mid = le + (ri -le)//2
    while le <= ri:
      mid = le + (ri -le)//2
      if search_list[mid] == num:
        break
      if search_list[mid] < num:
        le = mid+1
      else:
        ri = mid -1
        
    if search_list[mid] < num:
      mid+=1
    t_sum += mid
print(t_sum)

Fixed submission:
import bisect

n = int(input())

l = sorted(list(map(int, input().split())))
ans = 0

for i in range(n):
  for j in range(i+1, n):
    k = bisect.bisect_left(l, l[i]+l[j])
    #if k > j:
    ans += k - j - 1

print(ans)

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

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

l = list(itertools.combinations(L,3))
t_sum = 0
for li in l:
  li = list(li)
  li.sort()
  if li[0]+li[1] > li[2]:
    t_sum+=1
print(t_sum)

Fixed submission:
import bisect

n = int(input())

l = sorted(list(map(int, input().split())))
ans = 0

for i in range(n):
  for j in range(i+1, n):
    k = bisect.bisect_left(l, l[i]+l[j])
    #if k > j:
    ans += k - j - 1

print(ans)

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

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

l = list(itertools.combinations(L,3))
t_sum = 0
for li in l:
  li = list(li)
  li.sort()
  if li[0]+li[1] > li[2]:
    t_sum+=1
print(t_sum)

Fixed submission:
import bisect

n = int(input())

l = sorted(list(map(int, input().split())))
ans = 0

for i in range(n):
  for j in range(i+1, n):
    k = bisect.bisect_left(l, l[i]+l[j])
    #if k > j:
    ans += k - j - 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = (int(x) for x in input().split())
a = list(map(int,input().split()))

a.sort()

l = len(a) - 1
t = l
for i in range(M):
  t = l
  a[l] = a[l] // 2
  while a[t-1] > a[t]:
    tmp = a[t]
    a[t] = a[t-1]
    a[t-1] = tmp
    t -= 1
    if t==0:
      break;
print(sum(a))
    


Fixed submission:
import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print(-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
N = int(input())

C = []
sum_ana = 0
for _ in range(N):
  s = list(input())
  c = Counter(s)
  sum_ana += C.count(c)
  C.append(c)
  
print(sum_ana)



Fixed submission:
from collections import Counter
N = int(input())

S = []
sum_ana = 0
for _ in range(N):
  s = sorted(input())
  S.append("".join(s))

S.sort()
ana = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    ana+= 1
    continue
  sum_ana += (ana*(ana+1))//2
  ana = 0
sum_ana += (ana*(ana+1))//2
print(sum_ana)
Buggy python submission (verdict: Time Limit Exceeded):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())
A = list(map(int,input().split()))
is_ball = [-1]*(N+1)
for i in range(N,-1,-1):
  is_ball[i] = A[i-1]
  divisors = make_divisors(i)
  if A[i-1] == 1:
    for div in divisors:
      A[div-1] ^= 1
      
b=[]

for i in range(1,N+1):
  if is_ball[i] == 1:
    b.append(i)
    
print(len(b))
print(" ".join(map(str,b)))
    
    


Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

N = int(input())
A = list(map(int,input().split()))
is_ball = [-1]*(N+1)
for i in range(N,-1,-1):
  is_ball[i] = A[i-1]
  divisors = make_divisors(i)
  if A[i-1] == 1:
    for div in divisors:
      A[div-1] ^= 1
      
b=[]

for i in range(1,N+1):
  if is_ball[i] == 1:
    b.append(i)
    
print(len(b))
print(" ".join(map(str,b)))
Buggy python submission (verdict: Time Limit Exceeded):
H,W = map(int,input().split())
maze = []
for i in range(H):
  s = input()
  maze.append(s)
def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd

wd = distance(maze,H,W)
maze = [list(x) for x in zip(*maze)]
hd = distance(maze,W,H)
max_dist = 1

for i in range(H):
  for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1)
print(max_dist)

Fixed submission:
H,W = map(int,input().split())
maze = []
for i in range(H):
  s = input()
  maze.append(s)
def distance(maze,H,W):
  wall = []
  for i in range(H):
    w = [-1]
    for j in range(W):
      if maze[i][j] == '#':
        w.append(j)
    w.append(W)
    wall.append(w)

  wd = [[0]*W for _ in range(H)]
  for i in range(H):
    w1 = 0
    for j in range(W):
      if maze[i][j] == '#':
        w1 = min(w1+1,len(wall[i])-1)
        continue
      wd[i][j] = j-wall[i][w1]-1+wall[i][w1+1]-j-1

  return wd

wd = distance(maze,H,W)
maze = [list(x) for x in zip(*maze)]
hd = distance(maze,W,H)
max_dist = 1

for i in range(H):
  for j in range(W):
    max_dist = max(max_dist,wd[i][j] + hd[j][i]+1)
print(max_dist)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = (int(x) for x in input().split())
h = list(map(int,input().split()))
cost = [float('inf')]*N

cost[0] = 0
for i in range(N-1):
  l = min(i,K-1)
  for j in range(l+1):
    num2 = cost[i-j] + abs(h[i+1]-h[i-j])
    if cost[i+1] > num2:
      cost[i+1] =  num2
      
print(cost[N-1])

Fixed submission:
N,K = (int(x) for x in input().split())
h = list(map(int,input().split()))
cost = [float('inf')]*N

cost[0] = 0
for i in range(N-1):
  l = min(i,K-1)
  for j in range(l+1):
    num2 = cost[i-j] + abs(h[i+1]-h[i-j])
    if cost[i+1] > num2:
      cost[i+1] =  num2
      
print(cost[N-1])
Buggy python submission (verdict: Runtime Error):
N=int(input())
bars=list(map(int,input().split()))
if max(list)<sum(list)-max(list):
  print('Yes')
else:
  print('No')

Fixed submission:
N=int(input())
bars=list(map(int,input().split()))
if max(bars)<sum(bars)-max(bars):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N=input()
products=[int(input()) for i in range(N)]
print(sum(products)-max(products)//2)

Fixed submission:
N=int(input())
products=[int(input()) for i in range(N)]
print(sum(products)-max(products)//2)
Buggy python submission (verdict: Runtime Error):
s=input()
print(s.count('+')-s.count.('-'))

Fixed submission:
s=input()
print(s.count('+')-s.count('-'))
Buggy python submission (verdict: Runtime Error):
A,B,C,X=map(int,input() for i in range(4))
ans=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i*500+j*100+k*50==X:
        ans+=1
print(ans)        
      

Fixed submission:
A,B,C,X=map(int,[input() for i in range(4)])
ans=0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if i*500+j*100+k*50==X:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=input()
s=[int(input()) for i in range(N)]
print(len(list(set(s))))

Fixed submission:
N=int(input())
s=[int(input()) for i in range(N)]
print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
N=input()
s=[int(input()) for i in range(N)]
print(len(set(s)))

Fixed submission:
N=int(input())
s=[int(input()) for i in range(N)]
print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
N=input
s=[int(input()) for i in range(N)]
print(len(list(set(s))))

Fixed submission:
N=int(input())
s=[int(input()) for i in range(N)]
print(len(set(s)))

Buggy python submission (verdict: Runtime Error):
N=input
s=[int(input()) for i in range(N)]
print(len(set(s)))

Fixed submission:
N=int(input())
s=[int(input()) for i in range(N)]
print(len(set(s)))
Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(str,i))<=B:
    ans+=1
print(ans)    

Fixed submission:
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,str(i)))<=B:
    ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,i))<=B:
    ans+=1
print(ans)    
      
  

Fixed submission:
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(map(int,str(i)))<=B:
    ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C=input().split()
if A[-1]==B[0] and B[-1]=C[0]:
  print('YES')
else:
  print('NO')

Fixed submission:
A,B,C=input().split()
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
print('GREATER' if (A-B)>0 else 'EQUAL' if A==B else 'LESS')

Fixed submission:
A=int(input())
B=int(input())
print('GREATER' if (A-B)>0 else 'EQUAL' if A==B else 'LESS')
Buggy python submission (verdict: Runtime Error):
import math
N=int(input)
print(math.factorial(N)%(10**9+7))

Fixed submission:
import math
N=int(input())
print(math.factorial(N) % (10**9+7))
Buggy python submission (verdict: Runtime Error):
a,b,c=input().sprit(',')
print(a,b,c)

Fixed submission:
a, b, c = input().split(",")
print(a, b, c)

Buggy python submission (verdict: Runtime Error):
a,b,c=input().sprit(",")
print(a,b,c)

Fixed submission:
a, b, c = input().split(",")
print(a, b, c)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i<=K and 0<=j<=K and 0<=S-i-j<=K:
      ans+=1
print(ans)      

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i<=K and 0<=j<=K and 0<=S-i-j<=K:
      ans+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i,j,S-i-j<=K:
      ans+=1
print(ans)      

Fixed submission:
K,S=map(int,input().split())
ans=0
for i in range(S+1):
  for j in range(S+1-i):
    if 0<=i<=K and 0<=j<=K and 0<=S-i-j<=K:
      ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
print(a*b)

Fixed submission:
a, b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
li = list(map(int, input().split()))
a = 1
for i in range(N):
  a *= li[i]
if a > 10**18:
  print(-1)
else:
  print(a)

Fixed submission:
N =int(input())
li = list(map(int, input().split()))
a = 1
for i in li:
  if i == 0:
    print(0)
    exit()
for i in range(N):
  a *= li[i]
  if a > 10**18:
    print(-1)
    break
else:
  print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
li = list(map(int, input().split()))
a = 1
for i in range(N):
  a *= li[i]
if a > 10**18:
  print(-1)
else:
  print(a)

Fixed submission:
N =int(input())
li = list(map(int, input().split()))
a = 1
for i in li:
  if i == 0:
    print(0)
    exit()
for i in range(N):
  a *= li[i]
  if a > 10**18:
    print(-1)
    break
else:
  print(a)

Buggy python submission (verdict: Time Limit Exceeded):
N =int(input())
li = list(map(int, input().split()))
a = int(1)
for i in range(N):
  a *= li[i]
if a <= 10**18:
  print(a)
else:
  print(-1)

Fixed submission:
N =int(input())
li = list(map(int, input().split()))
a = 1
for i in li:
  if i == 0:
    print(0)
    exit()
for i in range(N):
  a *= li[i]
  if a > 10**18:
    print(-1)
    break
else:
  print(a)
Buggy python submission (verdict: Runtime Error):
K = int(input())
A, B = map(int, input().split())
for i in range(A:B+1):
  if i % K ==0:
    print("OK")
    exit()
else:
  print ("NG")

Fixed submission:
K = int(input())
A, B = map(int, input().split())
for i in range(A,B+1):
  if i % K ==0:
    print("OK")
    exit()
else:
  print ("NG")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a * b % 2 == 0:
  print("Even")
else:
  print("odd")

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

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Fixed submission:
a,b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x + y + z ==S:
        cnt += 1
print(cnt)

Fixed submission:
K, S = map(int,input().split())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    if S - x - y <= K and S - x- y >=0:
      cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int,input().split())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x + y + z ==S:
        cnt += 1
print(cnt)

Fixed submission:
K, S = map(int,input().split())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    if S - x - y <= K and S - x- y >=0:
      cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
# import numpy as np
INF = 10 **18
N= int(input())
ans =1
A= list(map(int,input().split()))
for a  in A:
    ans *= a
ans = -1 if ans > INF else ans
print(ans)

Fixed submission:
import numpy as np
INF = 10 **18
N= int(input())
# ans =1
A= list(map(int,input().split()))
# if 0 in A:
#     print(0)
# else:
def calc(A):
    if 0 in A:
        return 0
    ans = A.pop()
    for a in A:


        ans *= a
        if ans > INF:
            # print(-1)
            return -1
    return ans

# ans = np.prod(A)
# ans = -1 if ans > INF else ans
# hoge =[1]*(10 **5)
# hoge.append(10**18 +1)
# print(calc(hoge))
print(calc(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M= list(map(int, input().split()))
K = []
S=[]
state_S = np.zeros(N)
for m  in range(M):
    _input = list(map(int, input().split()))
    K.append(_input[0])
    S.append(np.array(_input[1:]))
P = list(map(int, input().split()))
ans=0
for i in range(N ** 2):
    pattern= np.array([i >> bit & 1 for bit in range(N)])
    if all(sum(pattern[K[j] -1 ]) % 2 == P[j] for j in range(M)):
        ans += 1
print(ans)





Fixed submission:
import numpy as np
N,M= list(map(int, input().split()))
K = []
S=[]
state_S = np.zeros(N)
for m  in range(M):
    _input = list(map(int, input().split()))
    K.append(_input[0])
    S.append(np.array(_input[1:]))
P = list(map(int, input().split()))
ans=0
for i in range(2 ** N):
    pattern= np.array([i >> bit & 1 for bit in range(N)])
    if all(np.sum(pattern[S[j] -1 ]) % 2 == P[j] for j in range(M)):
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,AB,X,Y= int(input.split())
ans = (X * A) + (Y * B)
max_ab_cnt = max(X,Y)
for ab_cnt in (max_ab_cnt+1):
    a_cnt = max(X - ab_cnt, 0)
    b_cnt = max(Y - ab_cnt,0)
    tmp = (a_cnt *A) + (ab_cnt * 2 * AB) + (b_cnt * B)
    ans = min(ans, tmp)
print(ans)

Fixed submission:
A,B,AB,X,Y= list(map(int, input().split()))
ans = (X * A) + (Y * B)
max_ab_cnt = max(X,Y)
for ab_cnt in range(max_ab_cnt+1):
    a_cnt = max(X - ab_cnt, 0)
    b_cnt = max(Y - ab_cnt,0)
    tmp = (a_cnt *A) + (ab_cnt * 2 * AB) + (b_cnt * B)
    ans = min(ans, tmp)
print(ans)