Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#input
X = int(input())

#output
left = 1
right = 10**2
while left + 1 < right:
    mid = (left + right)//2
    if mid **5  > X:
        right = mid
    else:
        left = mid

A = right
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not B.is_integer():
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)
print(A, int(B))

Fixed submission:
#input
X = int(input())

#output
for a in range(200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
#input
X = int(input())

#output

import math
initial_num = 1

left = 1
right = 10**2
while left + 1 < right:
    mid = (left + right)//2
    if mid **5  > X:
        right = mid
    else:
        left = mid

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
A = left
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not is_integer(B):
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)

print(A, int(B))

Fixed submission:
#input
X = int(input())

#output
for a in range(200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
#input
X = int(input())

#output
initial_num = 1

left = 1
right = 10**2
while left + 1 < right:
    mid = (left + right)//2
    if mid **5  > X:
        right = mid
    else:
        left = mid

def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
A = left
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not is_integer(B):
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)

print(A, int(B))

Fixed submission:
#input
X = int(input())

#output
for a in range(200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(a, b)
            exit()

Buggy python submission (verdict: Time Limit Exceeded):
#input
X = int(input())

#output
import math
initial_num = 1
while initial_num**5 < X:
    initial_num += 1
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()
A = initial_num
C = A**5 -X

if C >= 0:
    B = pow(C, 1/5)
else:
    B = -pow(-C, 1/5)

while not is_integer(B):
    A -= 1
    C = A**5 - X
    if C >= 0:
        B = pow(C, 1/5)
    else:
        B = -pow(-C, 1/5)

print(A, int(B))

Fixed submission:
#input
X = int(input())

#output
for a in range(200):
    for b in range(-200, 200):
        if a**5 - b**5 == X:
            print(a, b)
            exit()
Buggy python submission (verdict: Runtime Error):
A
#input
K = int(input())
A, B = map(int, input().split())

#output
answer = "NG"
for i in range(A, B+1):
    if i % K == 0:
        answer = "OK"
    else:
        continue

print(answer)

Fixed submission:
#input
K = int(input())
A, B = map(int, input().split())

#output
answer = "NG"
for i in range(A, B+1):
    if i % K == 0:
        answer = "OK"
    else:
        continue

print(answer)
Buggy python submission (verdict: Runtime Error):
#input
N, K = map(int, input().split())

#output
answer = 0
for i in range(K, N+2):
    answer += ((N*(N+1)//2)  - ((N-i)*(N-i+1)//2) - (i*(i-1)//2) + 1) % mod

print(answer % mod)

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

#output
mod = pow(10, 9) + 7
answer = 0
for i in range(K, N+2):
    answer += ((N*(N+1)//2)  - ((N-i)*(N-i+1)//2) - (i*(i-1)//2) + 1) % mod

print(answer % mod)
Buggy python submission (verdict: Runtime Error):
A
#input
N = int(input())

#output
if "7" in str(N):
    print("Yes")
else:
    print("No")

Fixed submission:
#input
N = int(input())

#output
if "7" in str(N):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#input
K = int(input())

#output
q = queue.Queue()
for i in range(1, 10):
    q.put(i)

for i in range(1, K+2):
    x = q.get()
    if x % 10 != 0:
        q.put(10*x + (x % 10)-1)
    q.put(10*x+(x % 10))
    if x % 10 != 9:
        q.put(10*x + (x % 10)+1)
    if i == K:
        print(x)

Fixed submission:
import queue

#input
K = int(input())

#output
q = queue.Queue()
for i in range(1, 10):
    q.put(i)

for i in range(1, K+2):
    x = q.get()
    if x % 10 != 0:
        q.put(10*x + (x % 10)-1)
    q.put(10*x+(x % 10))
    if x % 10 != 9:
        q.put(10*x + (x % 10)+1)
    if i == K:
        print(x)
Buggy python submission (verdict: Runtime Error):
#input
S = input()

#output
N = len(S)
k = N//2
l = (N-3)//4
m = (3*N-1)//4
if N == 3:
    if S[0] == S[3]:
        print("Yes")
    else:
        print("No")
else:
    if (S[0:k] == S[-1:k:-1] )and (S[0:l] == S[(N-3)//2:l:-1]) and (S[(N+1)//2:m] == S[N-1:m:-1]):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
S = input()

#output
N = len(S)

if (S == S[::-1]) and (S[:(N-1)//2] == S[:(N-1)//2][::-1]) and (S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
#input
S = input()

#output
N = len(S)
k = N//2
l = (N-3)//4
m = (3*N-1)//4
if N == 3:
    if S[0] == S[3]:
        print("Yes")
    else:
        print("No")
elif N > 3:
    if (S[0:k] == S[-1:k:-1] )and (S[0:l] == S[(N-3)//2:l:-1]) and (S[(N+1)//2:m] == S[N-1:m:-1]):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
S = input()

#output
N = len(S)

if (S == S[::-1]) and (S[:(N-1)//2] == S[:(N-1)//2][::-1]) and (S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]):
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
#input
S = input()

#output
N = len(S)
k = N//2
l = (N-3)//4
m = (3*N-1)//4
if N == 3:
    if S[0] == S[3]:
        print("Yes"):
    else:
        print("No"):
else:
    if (S[0:k] == S[-1:k:-1] )and (S[0:l] == S[(N-3)//2:l:-1]) and (S[(N+1)//2:m] == S[N-1:m:-1]):
        print("Yes")
    else:
        print("No")

Fixed submission:
#input
S = input()

#output
N = len(S)

if (S == S[::-1]) and (S[:(N-1)//2] == S[:(N-1)//2][::-1]) and (S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#input
H, N = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())

#output
M = max(A)
inf = 10**10
dp = [inf]*(H+(M+1))
dp[0] = 0
for i in range(N):
    for j in range(A[i], H+M):
        dp[j] = min(dp[j], dp[j-A[i]] + B[i])

answer = min(dp[H:(H+M+1)])
print(answer)

Fixed submission:
#input
H, N = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())

#output
M = max(A)
inf = 10**10
dp = [inf]*(H+(M+1))
dp[0] = 0
for i in range(N):
    for j in range(A[i], H+M):
        dp[j] = min(dp[j], dp[j-A[i]] + B[i])

answer = min(dp[H:(H+M+1)])
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
#input
H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

#output
M = max(A)
inf = 10**10
dp = [inf]*(H+(M+1))
dp[0] = 0
for i in range(N):
    for j in range(A[i], H+M):
        dp[j] = min(dp[j], dp[j-A[i]] + B[i])

answer = min(dp[H:(H+M+1)])
print(answer)

Fixed submission:
#input
H, N = map(int, input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = map(int, input().split())

#output
M = max(A)
inf = 10**10
dp = [inf]*(H+(M+1))
dp[0] = 0
for i in range(N):
    for j in range(A[i], H+M):
        dp[j] = min(dp[j], dp[j-A[i]] + B[i])

answer = min(dp[H:(H+M+1)])
print(answer)
Buggy python submission (verdict: Runtime Error):
#input
N, M = map(int, input().split())
A = (list(map(int, input().split()))

#output
import numpy as np
A = np.array(A)
A.sort()

def number_of_shake(K):
    p = np.searchsorted(A, K-A)
    return N*N - p.sum()

left = 0
right = 10**10+1
while left + 1 < right:
    mid = (left + right) // 2
    if number_of_shake(mid) >= M:
        left = mid
    else:
        right = mid

L = np.searchsorted(A, right-A)
Acum = np.zeros(N+1, np.int64)
Acum[1:] = np.cumsum(A)

shake = N*N - L.sum()
happy = (Acum[-1] - Acum[L]).sum() + (A*(N-L)).sum()
happy += (M-shake)*left

print(happy)

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

#output
import numpy as np
A = np.array(A)
A.sort()

def number_of_shake(K):
    p = np.searchsorted(A, K-A)
    return N*N - p.sum()

left = 0
right = 10**6
while left + 1 < right:
    mid = (left + right) // 2
    if number_of_shake(mid) >= M:
        left = mid
    else:
        right = mid

L = np.searchsorted(A, right-A)
Acum = np.zeros(N+1, np.int64)
Acum[1:] = np.cumsum(A)

shake = N*N - L.sum()
happy = (Acum[-1] - Acum[L]).sum() + (A*(N-L)).sum()
happy += (M-shake)*left

print(happy)

Buggy python submission (verdict: Runtime Error):
#input
N, M = map(int, input().split())
A = np.array(list(map(int, input().split())))

#output
import numpy as np
A.sort()

def number_of_shake(K):
    p = np.searchsorted(A, K-A)
    return N*N - p.sum()

left = 0
right = 10**10+1
while left + 1 < right:
    mid = (left + right) // 2
    if number_of_shake(mid) >= M:
        left = mid
    else:
        right = mid

L = np.searchsorted(A, right-A)
Acum = np.zeros(N+1, np.int64)
Acum[1:] = np.cumsum(A)

shake = N*N - L.sum()
happy = (Acum[-1] - Acum[L]).sum() + (A*(N-L)).sum()
happy += (M-shake)*left

print(happy)

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

#output
import numpy as np
A = np.array(A)
A.sort()

def number_of_shake(K):
    p = np.searchsorted(A, K-A)
    return N*N - p.sum()

left = 0
right = 10**6
while left + 1 < right:
    mid = (left + right) // 2
    if number_of_shake(mid) >= M:
        left = mid
    else:
        right = mid

L = np.searchsorted(A, right-A)
Acum = np.zeros(N+1, np.int64)
Acum[1:] = np.cumsum(A)

shake = N*N - L.sum()
happy = (Acum[-1] - Acum[L]).sum() + (A*(N-L)).sum()
happy += (M-shake)*left

print(happy)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

#input
X, Y = map(int, input().split())

#output
import math

from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

if (X + Y) % 3 == 0:
    k = (-X + 2*Y) //3
    l = (2*X -Y) //3
    if k < 0 or l <0:
        answer = 0
    else:
        answer = combinations_count(k+l, l) % (10**9 + 7)
else:
    answer = 0

print(answer)

Fixed submission:
import sys
input = sys.stdin.readline

#input
X, Y = map(int, input().split())

#output
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if (X + Y) % 3 == 0:
    k = (-X + 2*Y) //3
    l = (2*X -Y) //3
    if k < 0 or l <0:
        answer = 0
    else:
        answer = cmb(k+l, l) % (10**9 + 7)
else:
    answer = 0

print(answer)

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

#input
X, Y = map(int, input().split())

#output
import math

if (X + Y) % 3 == 0:
    k = (-X + 2*Y) //3
    l = (2*X -Y) //3
    answer = math.factorial(k+l)//(math.factorial(k)*math.factorial(l)) % (10**9 + 7)
else:
    answer = 0

print(answer)    

Fixed submission:
import sys
input = sys.stdin.readline

#input
X, Y = map(int, input().split())

#output
import math

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

if (X + Y) % 3 == 0:
    k = (-X + 2*Y) //3
    l = (2*X -Y) //3
    if k < 0 or l <0:
        answer = 0
    else:
        answer = cmb(k+l, l) % (10**9 + 7)
else:
    answer = 0

print(answer)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

#input
N = int(input())
D = list(map(int, input().split()))

#output
from collections import Counter
l = Counter(D).most_common()
l = sorted(l, key = lambda x:x[0])
M = len(l)

if M > 1:
    for i in range(l[1][1]):
        answer *= i
    else:
        answer = 1
if l[0] != (0, 1):
    answer = 0
else:
    for i in range(1, M-1):
        answer *= pow(l[i][1],l[i+1][1])
print(answer % 998244353)


Fixed submission:
import sys
input = sys.stdin.readline

#input
N = int(input())
D = list(map(int, input().split()))

#output
from collections import Counter
l = Counter(D).most_common()
l = sorted(l, key = lambda x:x[0])
M = len(l)

answer = 1

if D[0] != 0:
    answer = 0
elif l[0][1] != 1:
    answer = 0
else:
    for i in range(M-1):
        if l[i][0] + 1 != l[i+1][0]:
            answer = 0
for i in range(M-1):
    answer *= pow(l[i][1],l[i+1][1])
print(answer % 998244353)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

#input
N = int(input())

#output
minimum = 0
ans = N-1
for i in range(1, N+1):
    if float.is_integer(N/i):
        a = i
        b = int(N/i)
        c = a+b-2
        ans = min(c, ans)
        
print(ans)

Fixed submission:
import sys
input = sys.stdin.readline

#input
N = int(input())

#output
import math
M = int(math.sqrt(N))

ans = N
for i in reversed(range(1, M+1)):
    if float.is_integer(N/i):
        a = i
        b = int(N/i)
        c = a + b -2
        ans = min(ans, c)
        
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

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

#output
import numpy as np
A = np.array(A)
F = np.array(F)

A = np.sort(A)[::-1]
F = np.sort(F)
B = np.sum(A)
M = max([a*f for a, f in zip(A, F)])

def is_possible(x):
    return B - np.minimum(A, x//F).sum() <= K

for i in range(M):
    if is_possible(i):
        print(i)
        break


Fixed submission:
import sys
input = sys.stdin.readline

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

#output
import numpy as np
A = np.array(A)
F = np.array(F)

A = np.sort(A)[::-1]
F = np.sort(F)
B = np.sum(A)
M = max([a*f for a, f in zip(A, F)])

def is_possible(x):
    return B - np.minimum(A, x//F).sum() <= K

left = -1
right = M
while left + 1 < right:
    mid = (left + right)//2
    if is_possible(mid):
        right = mid
    else:
        left = mid

print(right)
Buggy python submission (verdict: Time Limit Exceeded):
#input
N = int(input())
L = list(map(int, input().split()))

#output
import heapq

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    target = heapq.heappop(L)
    for i in range(len(L)-1):
        for j in range(i+1, len(L)):
            if target > L[i] +  L[j]:
                sum += 1
        
print(sum)

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

#output
import heapq
import bisect

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    largest = heapq.heappop(L)
    L.sort()
    for i in range(len(L)-1):
        p = bisect.bisect_left(L, largest-L[i])
        if p-(i+1) >0:
            sum += p-(i+1)
        
print(sum)

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

#output
import heapq

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    target = heapq.heappop(L)
    L.sort()
    for i in range(len(L)-1):
        for j in range(i+1, len(L)):
            if target > L[i] +  L[j]:
                sum += 1
        
print(sum)


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

#output
import heapq
import bisect

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    largest = heapq.heappop(L)
    L.sort()
    for i in range(len(L)-1):
        p = bisect.bisect_left(L, largest-L[i])
        if p-(i+1) >0:
            sum += p-(i+1)
        
print(sum)

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

#output
import heapq

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    target = heapq.heappop(L)
    L.sort()
    for i in range(len(L)-1):
        for j in range(i+1, len(L)):
            if target > L[i] +  L[j]:
                sum += 1
        
print(sum)


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

#output
import heapq
import bisect

L = [-l for l in L]
heapq.heapify(L)

sum = 0
while len(L) > 2:
    largest = heapq.heappop(L)
    L.sort()
    for i in range(len(L)-1):
        p = bisect.bisect_left(L, largest-L[i])
        if p-(i+1) >0:
            sum += p-(i+1)
        
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
#input
A, B = map(int, input().split())

#output
import math

A1 = []
for k in range(2, int(math.sqrt(A))+1):
    l = 1
    for i in range(2, math.floor(math.sqrt(k))+1):
        l *= k % i
    if l != 0 and A % k == 0:
        A1.append(k)
    else:
        pass
B1 = []
for k in range(2, int(math.sqrt(B))+1):
    l = 1
    for i in range(2, math.floor(math.sqrt(k))+1):
        l *= k % i
    if l != 0 and B % k == 0:
        B1.append(k)
    else:
        pass
        
C = set(A1) & set(B1)

print(len(C)+1)

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

#output
import math

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
A1 = prime_factors(A)
B1 = prime_factors(B)        
C = set(A1) & set(B1)

print(len(C)+1)

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

#output
import math

common_diviser = []
for i in range(1, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        common_diviser.append(i)

def is_prime(n):
    if n == 1:return False
    for k in range(2, int(math.sqrt(n))+1):
        if n % k == 0:
            return False
    return True

ans = 0
for c in common_diviser:
    if is_prime(c):
        ans += 1

print(ans+1)   

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

#output
import math

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
A1 = prime_factors(A)
B1 = prime_factors(B)        
C = set(A1) & set(B1)

print(len(C)+1)

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

#output
import math
from functools import reduce

common_diviser = []
for i in range(1, min(A, B)+1):
    if A % i == 0 and B % i == 0:
        common_diviser.append(i)

def is_prime(n):
    if n == 1:return False
    for k in range(2, int(math.sqrt(n))+1):
        if n % k == 0:
            return False
    return True

ans = []
for c in common_diviser:
    if is_prime(c):
        ans.append(c)

print(len(ans)+1)    

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

#output
import math

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
A1 = prime_factors(A)
B1 = prime_factors(B)        
C = set(A1) & set(B1)

print(len(C)+1)
Buggy python submission (verdict: Time Limit Exceeded):
#input
N, M = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    C[i] = list(map(int, input().split()))

#output
dp = [9**9]* (1<<N)

def list_to_bin(my_list):
    my_bin = 0
    for l in my_list:
        my_bin += 1<<(l-1)
    return my_bin

dp[0] = 0
for i in range(M):
    for s in range(1<<N):
        dp[s|list_to_bin(C[i])] = min(dp[s|list_to_bin(C[i])], dp[s] + A[i])

if dp[-1] == 9**9:
    print(-1)
else:
    print(dp[-1])

Fixed submission:
#input
N, M = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    C[i] = list(map(int, input().split()))

#output
dp = [9**9]* (1<<N)

def list_to_bin(my_list):
    my_bin = 0
    for l in my_list:
        my_bin += 1<<(l-1)
    return my_bin

for i in range(M):
    C[i] = list_to_bin(C[i])

dp[0] = 0
for i in range(M):
    for s in range(1<<N):
        dp[s|C[i]] = min(dp[s|C[i]], dp[s] + A[i])

if dp[-1] == 9**9:
    print(-1)
else:
    print(dp[-1])
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())

import numpy as np
initial_point = np.array([K] * N)

for i in range(Q):
    initial_point -= 1
    initial_point[(A[i]-1)] += 1

for i in range(N):
    if initial_point[i] > 0 :
        print("Yes")
    else:
        print("No") 

Fixed submission:
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())

initial_point = [(K-Q)]*N

for i in range(Q):
    initial_point[(A[i]-1)] += 1

for i in range(N):
    if initial_point[i] > 0 :
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())

initial_point = [K] * N
import numpy as np
initial_point = np.array(initial_point)

for i in range(Q):
    initial_point -= 1
    initial_point[(A[i]-1)] += 1

for i in range(N):
    if initial_point[i] > 0 :
        print("Yes")
    else:
        print("No")   

Fixed submission:
N, K, Q = map(int, input().split())
A = [0] * Q
for i in range(Q):
    A[i] = int(input())

initial_point = [(K-Q)]*N

for i in range(Q):
    initial_point[(A[i]-1)] += 1

for i in range(N):
    if initial_point[i] > 0 :
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
#input
N = int(input())
A = list(map(int, input()))
B = list(map(int, input()))
C = list(map(int, input()))

#output
sum1 = sum(B)
sum2 = 0 
for i in range(N-1):
    if A[i] + 1 == A[i+1]:
        sum2 += C[(A[i]-1)]
print(sum1 + sum2)

Fixed submission:
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

sum1 = sum(B)
sum2 = 0 
for i in range(N-1):
    if A[i] + 1 == A[i+1]:
        sum2 += C[(A[i]-1)]
print(sum1 + sum2)
Buggy python submission (verdict: Runtime Error):
N = int(input())

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

import statistics as st

print(st.harmonic_mean(A)/N)

Fixed submission:
N = int(input())

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

import numpy as np
A = np.array([A])
print(1/np.sum(1/A))