Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import statistics
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
nums = list(map(int, input().split()))
lcm = lcm_list(nums)

# print(nums, lcm)
sum =0
for num in nums:
    sum += (lcm-1)%num
print(sum)


Fixed submission:
import statistics
import math
import fractions
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
nums = list(map(int, input().split()))
lcm = lcm_list(nums)

# print(nums, lcm)
sum =0
for num in nums:
    sum += (lcm-1)%num
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
N,M = map(int , sys.stdin.readline().split())
A=[map(int , input().split()) for _ in range(M)]
data = np.zeros(N)
for L,R in A:
	data[L-1:R] +=1
print(np.sum(data == M)) 

Fixed submission:
N,M = map(int , input().split())
A=[map(int , input().split()) for _ in range(M)]
L_min = 0
R_max = N
for L,R in A:
	L_min = max(L_min , L)
	R_max = min(R_max , R)

if R_max - L_min+1 >=0:
	print(R_max - L_min+1)
else:
	print(0)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = map(int , input().split())
A=[map(int , input().split()) for _ in range(M)]
data = np.zeros(N)
for L,R in A:
	data[L-1:R] +=1
print(np.sum(data == M)) 

Fixed submission:
N,M = map(int , input().split())
A=[map(int , input().split()) for _ in range(M)]
L_min = 0
R_max = N
for L,R in A:
	L_min = max(L_min , L)
	R_max = min(R_max , R)

if R_max - L_min+1 >=0:
	print(R_max - L_min+1)
else:
	print(0)
Buggy python submission (verdict: Runtime Error):
A , B , T = map(int , input()split())

count =  T // A * B

print(count)

Fixed submission:
A , B , T = map(int , input().split())
 
count =  T // A * B
 
print(count)
Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


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

if N<=2:
	print(max(a))
else:
	ans = gcd_list(a[1:])
	for i in range(1,N):
		temp_gcd = gcd_list(a[0:i]+a[i+1:])

		ans = max(ans , temp_gcd)

print(ans)


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


def gcd(a, b):
    if a < b: return gcd(b, a)
    elif b > 0: return gcd(b, a % b)
    else:
        return a

L = [0,a[0]]
R = [0,a[-1]]

for i in range(1,N):
	L.append(gcd(a[i] , L[-1]))
	R.append(gcd(a[-(i+1)] , R[-1]))
gcd_val_list = []
for i in range(N):
	gcd_val_list.append(gcd(L[i] , R[-(i+2)]))
print(max(gcd_val_list))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i]) == H[i]):
        cnt += 1

print(cnt)

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)

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

H=list(map(int , input().split()))
cnt = 0
for i in range(len(H)):
  if max(H[0:i])==H[i]:
    cnt +=1
    
print(cnt)


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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)

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

H=list(map(int , input().split()))
cnt = 0
for i in range(len(H)):
  if max(H[0:i]==H[i]):
    cnt +=1
    
print(cnt)

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

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = np.array(list(map(int , input().split())))
A = [list(map(int , input().split())) for _ in range(N)]
ans = 0
for i in range(N):
	tem = np.array(A[i])
	if np.dot(tem,B)+C>0:
		ans +=1

print(ans)

Fixed submission:
import numpy as np
N,M,C = map(int,input().split())
B = np.array(list(map(int , input().split())))
A = [list(map(int , input().split())) for _ in range(N)]
ans = 0
for i in range(N):
	tem = np.array(A[i])
	if np.dot(tem,B)+C>0:
		ans +=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
cnt = 0

while True:
	if S.count('01') != 0:
		cnt += S.count('01')
		S=S.replace('01' , '')
	if S.count('10') != 0:
		cnt += S.count('10')
		S=S.replace('10' , '')

	if S.count('01') == 0 and S.count('10') == 0:
		print(cnt*2)
		exit()

Fixed submission:
S = input()
cnt_1 = S.count('1')
cnt_0 = S.count('0')

print(min(cnt_1 , cnt_0) * 2)
Buggy python submission (verdict: Runtime Error):
A,B = map(int , input().split())

if (A<=8) and (B<=8):
  print('Yay!')
else:
  pront(':(')

Fixed submission:
a,b = map(int,input().split())
if (a <= 8) and (b <= 8):
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
def valid_check(n, a, b, c, d, s):
    if not two_rocks(s[b:d]):
        return 0
    if c < d:
        return two_rocks(s[a:c])
    else:
        for possibility in enumerate_possibilities(b, d, s):
            if two_rocks(possibility[a:c]):
                return 1
        return 0



def enumerate_possibilities(b, d, s):
    possibilities = []
    for i in range(d-b+1):
        if s[b+i]=='.':
            tmp = s.copy()
            tmp[b+i] = '#'
            possibilities.append(tmp)
    return possibilities


def two_rocks(s):
    for i in range(len(s)-1):
        if s[i]=='#' and s[i+1]=='#':
            return 0
    return 1

n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = list(input())


if valid_check(n, a, b, c, d, s):
    print('Yes')
else:
    print('No')

Fixed submission:
def valid_check(n, a, b, c, d, s):
    if not two_rocks(s[b:d]):
        return 0
    # if not two_rocks()
    if c < d:
        return two_rocks(s[a:c])
    else:
        return three_spaces(s[b-1:d+2]) and two_rocks(s[a:c])


def three_spaces(s):
    for i in range(len(s)-2):
        if s[i]=='.' and s[i+1]=='.' and s[i+2]=='.':
            return 1
    return 0

# def enumerate_possibilities(b, d, s):
#     possibilities = []
#     for i in range(d-b+1):
#         if s[b+i]=='.':
#             tmp = s.copy()
#             tmp[b+i] = '#'
#             possibilities.append(tmp)
#     return possibilities


def two_rocks(s):
    for i in range(len(s)-1):
        if s[i]=='#' and s[i+1]=='#':
            return 0
    return 1

n, a, b, c, d = map(int, input().split())
a -= 1
b -= 1
c -= 1
d -= 1
s = list(input())


if valid_check(n, a, b, c, d, s):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
check = []
# a = []
for i in range(len(s)):
    if i < len(s)-1 and s[i]=='B' and s[i+1]=='C':
        check.append(1)
    else:
        check.append(0)
# print(check)
# for i in range(len(s)):
#     if


count = 0
for i in range(len(s)):
    if s[-i-1] == 'A':
        # a.insert(0, 1)
        tmp = -i-1
        while tmp <= -3 and check[tmp+1]==1:
            # s.pop(tmp)
            # s.insert(tmp+3, 'A')
            check[tmp+1] = 0
            check[tmp] = 1
            # s[tmp+1] = 'C'
            # s[tmp+2] = 'A'
            count += 1
            tmp += 2
print(count)

Fixed submission:
inp = input()
changed_input = inp.replace('BC', 'D')
A_count = 0
total_ans = 0
for st in changed_input:
    if st == 'A':
        A_count += 1
    elif st == 'D':
        total_ans += A_count
    else:
        A_count = 0
print(total_ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
count = 0
for i in range(len(s)):
    if s[-i-1] == 'A':
        tmp = -i-1
        while tmp <= -3 and s[tmp+1] == 'B' and s[tmp+2] == 'C':
            s[tmp] = 'B'
            s[tmp+1] = 'C'
            s[tmp+2] = 'A'
            count += 1
            tmp += 2
print(count)

Fixed submission:
inp = input()
changed_input = inp.replace('BC', 'D')
A_count = 0
total_ans = 0
for st in changed_input:
    if st == 'A':
        A_count += 1
    elif st == 'D':
        total_ans += A_count
    else:
        A_count = 0
print(total_ans)
Buggy python submission (verdict: Runtime Error):
s = raw_input()
valid = 0
left = 15 - len(s)
for tok in s:
    if tok == 'o':
        valid += 1
if valid + left >= 8:
    print('YES')
else:
    print('NO')

Fixed submission:
s = input()
valid = 0
left = 15 - len(s)
for tok in s:
    if tok == 'o':
        valid += 1
if valid + left >= 8:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())

edge = [[] for i in range(n)]

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

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

c.sort(reverse=True)

w = [0] * n

w[0] = c.pop(0)

chk = [i for i in edge[0]]
# print(chk)

while chk != []:
    node = chk.pop(0)
    if w[node] == 0:
        w[node] = c.pop(0)
        chk.extend(edge[node])

print(sum(c) - max(c))

print(' '.join(map(str, w)))

Fixed submission:
n = int(input())

edge = [[] for i in range(n)]

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)

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

hhh = c.copy()

c.sort(reverse=True)

w = [0] * n

w[0] = c.pop(0)

chk = [i for i in edge[0]]
# print(chk)

while chk != []:
    node = chk.pop(0)
    if w[node] == 0:
        w[node] = c.pop(0)
        chk.extend(edge[node])

print(sum(hhh) - max(hhh))

print(' '.join(map(str, w)))
Buggy python submission (verdict: Runtime Error):
b=input()
if b =="A"
  print("T")
elif b =="T"
  print("A")
elif b =="G"
  print("C")
elif b =="C"
  print("G")

Fixed submission:
b=input()
if b =="A":
  print("T")
elif b =="T":
  print("A")
elif b =="G":
  print("C")
elif b =="C":
  print("G")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N, M = map(int,input().split())


def main():
	k = []
	s = []
	answers = []

	for i in range(M + 1):
		inputs = list(map(int,input().split()))
		if i == M:
			answers = inputs.copy()
		else:
			k.append(inputs[0])
			s.append(inputs[1:])

	allCandidates = []
	for i in range(N + 1):
		candidates = [1] * i + [0] * (N - i)
		allCandidates.extend(list(itertools.permutations(candidates)))

	result = []
	for c in allCandidates:
		ok = True
		for i, ss in enumerate(s):
			sumBulk = 0
			for sNumber in ss:
				sumBulk += c[sNumber - 1]
			if sumBulk % 2 != answers[i]:
				ok = False
		if ok:
			result.append(c)

	print(len(list(set(result))))

if __name__ == '__main__':
	main()

Fixed submission:
import itertools

N, M = map(int,input().split())


def main():
	k = []
	s = []
	answers = []

	for i in range(M + 1):
		inputs = list(map(int,input().split()))
		if i == M:
			answers = inputs.copy()
		else:
			k.append(inputs[0])
			s.append(inputs[1:])

	allCandidates = (list(itertools.product(range(2), repeat=N)))

	result = []
	for c in allCandidates:
		ok = True
		for i, ss in enumerate(s):
			sumBulk = 0
			for sNumber in ss:
				sumBulk += c[sNumber - 1]
			if sumBulk % 2 != answers[i]:
				ok = False
		if ok:
			result.append(c)

	print(len(list(set(result))))

if __name__ == '__main__':
	main()
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
cities = [tuple(map(int, input().split())) for _ in range(M)]

argmax = lambda a: a.index(max(a))
ids = {i:[] for i in range(1, N+1)}
[ids[p].append(y) for p, y in cities]
for k in ids:
    for _ in ids[k]:
        ids[k][argmax(ids[k])] = 0
        ids[k] = list(map(lambda x: x+1, ids[k]))

[print("{:06}{:06}".format(p, ids[p].pop(0))) for p, _ in cities]


Fixed submission:
N, M = map(int, input().split())
cities = [int("{}{:010}".format(*tuple(map(int, input().split())))) for _ in range(M)]
sorted_cities = sorted(cities)

ids = {}
cnt = 1
before = -1
for c in sorted_cities:
    id_ = c//10000000000
    if before != id_:
        before = id_
        cnt = 1
    else:
        cnt += 1
    ids[c] = cnt

[print("{:06}{:06}".format(c//10000000000, ids[c])) for c in cities]
Buggy python submission (verdict: Runtime Error):
n = input()
x_str = input_row().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

for x in xs:
    print c_xs[center+1] if x <= c_xs[center] else c_xs[center]


Fixed submission:

import numpy as np

n = int(input())
x_str = input().split()
xs = np.array([int(c) for c in x_str])

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = np.sort(xs)

for x in xs:
    if x <= c_xs[center]:
        print(c_xs[center+1])
    else:
        print(c_xs[center])

Buggy python submission (verdict: Runtime Error):
n = int(input())
x_str = input().split()
xs = [int(c) for c in x_str]

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = xs[:]
c_xs.sort()

for x in xs:
    print(c_xs[center+1] if x <= c_xs[center] else c_xs[center])


Fixed submission:

import numpy as np

n = int(input())
x_str = input().split()
xs = np.array([int(c) for c in x_str])

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = np.sort(xs)

for x in xs:
    if x <= c_xs[center]:
        print(c_xs[center+1])
    else:
        print(c_xs[center])

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
x_str = input().split()
x = [int(c) for c in x_str]

x_len = len(x)
center = (x_len - 1)//2

c_x = x[:]
c_x.sort()

for i in range(x_len):
    cc_x = c_x[:]
    cc_x.remove(x[i])
    print(cc_x[center])


Fixed submission:

import numpy as np

n = int(input())
x_str = input().split()
xs = np.array([int(c) for c in x_str])

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = np.sort(xs)

for x in xs:
    if x <= c_xs[center]:
        print(c_xs[center+1])
    else:
        print(c_xs[center])

Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())
x_str = input().split()
x = [int(c) for c in x_str]

l_ = len(x) - 1

for i in range(len(x)):
    copy_x = x[:]
    copy_x.pop(i)
    copy_x.sort()
    print(copy_x[(l_)//2])


Fixed submission:

import numpy as np

n = int(input())
x_str = input().split()
xs = np.array([int(c) for c in x_str])

xs_len = len(xs)
center = (xs_len - 1)//2

c_xs = np.sort(xs)

for x in xs:
    if x <= c_xs[center]:
        print(c_xs[center+1])
    else:
        print(c_xs[center])
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, M = map(int, input().split())
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
AB_sorted = AB[AB[:,0].argsort(),:]

cs = np.cumsum(AB_sorted[:,1])
n_full_store = (cs <= M).sum()
money_a = np.sum(AB_sorted[:n_full_store,0] * AB_sorted[:n_full_store,1])
money_b = (M - cs[n_full_store-1]) * AB_sorted[n_full_store,0]
print(money_a + money_b)

Fixed submission:
import numpy as np

N, M = map(int, input().split())
AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))
    
AB = np.array(AB)
AB_sorted = AB[AB[:,0].argsort(),:]

cs = np.cumsum(AB_sorted[:,1])
n_full_store = (cs <= M).sum()
money_a = np.sum(AB_sorted[:n_full_store,0] * AB_sorted[:n_full_store,1])
if M - cs[n_full_store-1] > 0:
    money_b = (M - cs[n_full_store-1]) * AB_sorted[n_full_store,0]
elif M - cs[n_full_store-1] < 0:
               money_b = AB_sorted[0,0] * M
else:
    money_b = 0
print(money_a + money_b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
arr = list(map(int,input().split()))
res = []
for i in range(N-1):
    res.append(abs(sum(arr[:i+1])-arr(W[i+1:])))
print(min(res))

Fixed submission:
N = int(input())
res = []
arr = list(map(int,input().split()))
for i in range(N-1):
    res.append(abs(sum(arr[:i+1])-sum(arr[i+1:])))
print(min(res))
Buggy python submission (verdict: Runtime Error):
N=int(input(""))
K=int(input(""))
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])

Fixed submission:
N=input("")
N=N.split(" ")
K=int(N[1])
N=N[0]
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])

Buggy python submission (verdict: Runtime Error):
N=int(input(""))
K=int(input(""))
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])

Fixed submission:
N=input("")
N=N.split(" ")
K=int(N[1])
N=N[0]
s=str(input(""))
print(s[0:K-1]+s[K-1].lower()+s[K:])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
indices = range(n)
l = []
for i in range(1 << n):
  l.append([indices[j] for j in range(n) if (i & (1 << j))])
l.pop(0)#[]
#c.index()
max_diff = 0
for s in l:
  cost = 0
  value = 0
  for i in s:
    cost += c[i]
    value += v[i]
    if value - cost > max_diff:
      max_diff = value - cost
print(max_diff)
  


Fixed submission:
n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

total = 0
for i in range(n):
  if v[i] > c[i]:
    total += v[i] - c[i]
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
#feel like this is to easy

def read_input():
  n = int(input())
  a = []
  for i in range(n):
    a.append(int(input()))
  return n,a

def TLE():
  n,a = read_input()
  sheet = []
  for item in a:
    if item not in sheet:
      sheet.append(item)
    else:
      sheet.pop(sheet.index(item))
  print(len(sheet))
  
def main():
  n,a = read_input()
  items = list(set(a))
  count = 0
  for item in items:
    if a.count(item)%2 != 0:
      count += 1
  print(count)

if __name__ == '__main__':
  main()

Fixed submission:
#feel like this is to easy

def read_input():
  n = int(input())
  a = []
  for i in range(n):
    a.append(int(input()))
  return n,a

def TLE():
  n,a = read_input()
  sheet = []
  for item in a:
    if item not in sheet:
      sheet.append(item)
    else:
      sheet.pop(sheet.index(item))
  print(len(sheet))
  
def TLE2():
  n,a = read_input()
  items = list(set(a))
  count = 0
  for item in items:
    if a.count(item)%2 != 0:
      count += 1
  print(count)

def main():
  n,a = read_input()
  a.sort()
  items = list(set(a)).sort()
  t = 1
  count = 0
  for i in range(len(a)):
    if i+1 == len(a):
      count += t%2
      break
    if a[i] == a[i+1]:
      t += 1
    else:
      count += t%2
      t = 1
  print(count)

if __name__ == '__main__':
  main()

Buggy python submission (verdict: Time Limit Exceeded):
#feel like this is to easy

def read_input():
  n = int(input())
  a = []
  for i in range(n):
    a.append(int(input()))
  return n,a

def main():
  n,a = read_input()
  sheet = []
  for item in a:
    if item not in sheet:
      sheet.append(item)
    else:
      sheet.pop(sheet.index(item))
  print(len(sheet))
  
if __name__ == '__main__':
  main()

Fixed submission:
#feel like this is to easy

def read_input():
  n = int(input())
  a = []
  for i in range(n):
    a.append(int(input()))
  return n,a

def TLE():
  n,a = read_input()
  sheet = []
  for item in a:
    if item not in sheet:
      sheet.append(item)
    else:
      sheet.pop(sheet.index(item))
  print(len(sheet))
  
def TLE2():
  n,a = read_input()
  items = list(set(a))
  count = 0
  for item in items:
    if a.count(item)%2 != 0:
      count += 1
  print(count)

def main():
  n,a = read_input()
  a.sort()
  items = list(set(a)).sort()
  t = 1
  count = 0
  for i in range(len(a)):
    if i+1 == len(a):
      count += t%2
      break
    if a[i] == a[i+1]:
      t += 1
    else:
      count += t%2
      t = 1
  print(count)

if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
n = int(input()) #number of meals

return(n*800 - n%15*200)

Fixed submission:
n = int(input()) #number of meals
print(n*800 - n//15*200)

Buggy python submission (verdict: Runtime Error):
n = int(input()) #number of meals

payment = 0
while (n % 15 >= 1 ){
  payment = 800*15 + 200
  n -= 15
}
payment += n*800

print(payment)

Fixed submission:
n = int(input()) #number of meals
print(n*800 - n//15*200)
Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
import itertools

D, G = tuple(map(int, input().split()))

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])
summary = []

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = np.inf
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
      
print(int(ret))
  



Fixed submission:
import numpy as np
import itertools
import math

D, G = tuple(map(int, input().split()))

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = np.inf
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
  elif suc_num < ret:
    ret = suc_num
  else:
    continue
    
print(int(math.ceil(ret)))

Buggy python submission (verdict: Runtime Error):
import numpy as np
import math
import itertools

D, G = tuple(map(int, input().split()))

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])
summary = []

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = np.inf
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
      
print(int(ret))
  



Fixed submission:
import numpy as np
import itertools
import math

D, G = tuple(map(int, input().split()))

p_c_list = np.array([tuple(map(int, [100 * (i + 1)] + input().split())) for i in range(D)])

masks = itertools.product([False, True], repeat=len(p_c_list))

ret = np.inf
for mask in masks:
  maskedarr = p_c_list[np.array(mask), :]
  comp_sum = (maskedarr[:, 0] * maskedarr[:, 1] + maskedarr[:, 2]).sum()
  suc_num = maskedarr[:, 1].sum()
  if comp_sum < G:
    amari = (G - comp_sum) / p_c_list[~np.array(mask), 0][-1]
    if amari < p_c_list[~np.array(mask), 1][-1]:
      if ret > suc_num + amari:
        ret = suc_num + amari
    else:
      continue
  elif suc_num < ret:
    ret = suc_num
  else:
    continue
    
print(int(math.ceil(ret)))
Buggy python submission (verdict: Time Limit Exceeded):
K, S = tuple(map(int, input().split()))

ret = 0 
for X in range(K+1):
  for Y in range(X, K+1):
    for Z in range(Y, K+1):
      if X + Y + Z == S:
        if X == Y and Y == Z: ret += 1
        elif X != Y and Y != Z and Z != X: ret += 6
        else: ret += 3

print (ret)

Fixed submission:
K, S = tuple(map(int, input().split()))

ret = 0 
for X in range(K+1):
  for Y in range(X, K+1):
    Z = S - X - Y
    if Z < Y: break
    if Z >= 0 and Z <= K:
      if X == Y and Y == Z: ret += 1
      elif X != Y and Y != Z and Z != X: ret += 6
      else: ret += 3

print (ret)