Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03455 (python)

Fixed submission:
x, y = map(int, input().split())

if x*y % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
x, y = map(int, input(), input())

if x*y % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
x, y = map(int, input(), input())

if x*y/2 == 0:
    print("Even")
else:
    print("Odd")
Problem p03943 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes"if a+b==c or a+c==b or a==b+c else "No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a+b==c or a+c==b or a==b+c
print("yes")
else
print("no")
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
 
area = (a + b)*h//2
print(area)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

area = (a+b)*h%2
print(area)

Buggy submission (verdict: Runtime Error):
(a+b)*h%2
Problem p02861 (python)

Fixed submission:
n = int(input())
xy = list()
for i in range(n):
    xy.append(list(map(int,input().split())))
 
dsum = 0
dist_l = [[0] * n for k in range(n)]
for i in range(n-1):
    for j in range(i+1, n):
        dist = ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** (1/2)
        dist_l[i][j] = dist
        dist_l[j][i] = dist
        dsum = dsum + dist
 
ans = dsum * (n-1) / (n * (n-1) / 2)
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = list()
for i in range(n):
  xy.append(list(map(int, input().split())))
  
dsum = 0
dist_1 = [[0] * n for k in range(n)]
for i in range(n-1):
  for J in range(i+1, n):
    dist = ((xy[i][0] - xy[j][0] ** 2 + (xy[i][1] - xy[j][1]) ** 2)**(1/2)
    dist_1[i][j] = dist
Problem p02934 (python)

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

for i in A:
    ans += 1/i

print(1/ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = 0

for i in A:
    a += 1/i

print(1/a)
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
m = [i%10 for i in l if i%10!=0 ]
if len(m) == 0:
  sub = 0
else:
  sub = 10 - min(m)
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
sub = 10 - min([i%10 for i in l if i%10!=0 ])
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A,B,C,D,E]
sub = 10 - min([i%10 for i in l if i%10!==0])
M = []
for i in l:
  if i%10 == 0:
    M.append(i)
  else:
    M.append(((i//10)+1)*10)
print(sum(M)-sub)
Problem p03227 (python)

Fixed submission:
S = input()
if len(S)==2:
    print(S)
else:
    print(S[::-1])

Buggy submission (verdict: Runtime Error):
S = input()
if len(S)==2:
    print(S)
else:
    print(reverse(S))
Problem p03231 (python)

Fixed submission:
N,M = map(int,input().split())
S = input()
T = input()

def gcd(a,b):
    while b>0:
        a,b = b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

L = lcm(N,M)
G = gcd(N,M)
n = L//N
m = L//M

s = [S[i*m] for i in range(G)]
t = [T[i*n] for i in range(G)]

if s == t or (G == 1 and S[0]==T[0]):
    print(L)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
S = input()
T = input()

def gcd(a,b):
    while b>0:
        a,b = b,a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

L = lcm(N,M)
G = gcd(N,M)
n = L//N
m = L//M

s = [S[i*m] for i in range(G)]
t = [T[i*n] for i in range(G)]

if s == t or (G == 1 and S[0]==T[0}]):
    print(L)
else:
    print(-1)
Problem p03264 (python)

Fixed submission:
K = int(input())
if K%2 == 0:
    A = (K/2)*(K/2)
else:
    A = ((K-1)/2)*((K+1)/2)

print(int(A))

Buggy submission (verdict: Runtime Error):
K = int(input())
if K%2 = 0:
    A = (K/2)*(K/2)
else:
    A = ((K-1)/2)*((K+1)/2)

print(A)
Problem p03308 (python)

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

asorted = sorted(A)
print(asorted[N-1]-asorted[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

asorted = sorted(A)
print(asorted[N]-asorted[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))

asorted = sorted(A)
print(asorted[N+1]-asorted[0])
Problem p02861 (python)

Fixed submission:
N = int(input())

XY = []

for i in range(N):
    Xi, Yi = map (float, input().split())
    XY.append([Xi,Yi])

Z  = 0
for i in range(N-1):
    for j in range(i + 1, N):
        Z += ((XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2 ) ** 0.5

print(Z * 2 / N)

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

    XY = []

    for i in range(N):
        Xi, Yi = map (float, input().split())
        XY.append([Xi,Yi])

    Z  = 0
    for i in range(N-1):
        for j in range(i + 1, N):
            Z += ((XY[i][0] - XY[j][0])**2 + (XY[i][1] - XY[j][1])**2 ) ** 0.5
    
    print(Z * 2 / N)
Problem p03693 (python)

Fixed submission:
r,g,b = [int(x) for x in input().split()]

mul = r*100 + g*10 + b

if mul % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv
r = int(args[1])
g = int(args[2])
b = int(args[3])

mul = r*100 + g*10 + b

if mul % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv
r = int(args[1])
g = int(args[2])
b = int(args[3])

mul = r*100 + g*10 * b

if mul % 4 == 0:
    print("YES")
else:
    print("NO")
Problem p03543 (python)

Fixed submission:
from sys import stdin

def main():
    n = stdin.readline()
    if(n[0] == n[1] and n[1] == n[2]):
        print("Yes")
    elif(n[1] == n[2] and n[2] == n[3]):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin

def main():
    n = stdin.readline()
    if(n[0] == n[1] and n[1] == n[2]):
        print("Yes")
    elif(n[1] == n[2] and n[2] == n[3]):
        print("Yes")
    else:
        prinnt("No")

if __name__ == '__main__':
    main()
Problem p03494 (python)

Fixed submission:
import copy
 
kaisu = int(input())
 
s_suji_list = input().split(' ')
suji_list = []
count = 1
continue_flg = True
for suji in s_suji_list:
  i_suji = int(suji)
  if i_suji % 2 == 0:
    suji_list.append(i_suji / 2)
  else:
    continue_flg = False
    count = 0
    break
 
while(continue_flg):
  temp_list = copy.copy(suji_list)
  suji_list.clear()
  count += 1
  for suji in temp_list:
    if suji % 2 == 0:
      suji_list.append(suji / 2)
    else:
      count -= 1
      continue_flg = False
      break
 
print(count)

Buggy submission (verdict: Runtime Error):
import copy
 
kaisu = int(input())
 
s_suji_list = input().split(' ')
suji_list = []
count = 0
cotinule_flg = True
for suji in s_suji_list:
  i_suji = int(suji)
  if suji % 2 == 0:
    suji_list.append(suji / 2)
  else:
    continue_flg = False
    break
count = 1
 
while(continue_flg):
  temp_list = copy.copy(suji_list)
  suji_list.clear()
  count += 1
  for suji in temp_list:
    if suji % 2 == 0:
      suji_list.append(suji / 2)
    else:
      count -= 1
      continue_flg = False
      break
 
print(count)

Buggy submission (verdict: Runtime Error):
import copy

kaisu = int(input())

s_suji_list = input().split(' ')
suji_list = []
count = 0
cotinule_flg = true
for suji in s_suji_list:
  i_suji = int(suji)
  if suji % 2 == 0:
    suji_list.append(suji / 2)
  else:
    continue_flg = false
    break
count = 1

while(continue_flg):
  temp_list = copy.copy(suji_list)
  suji_list.clear()
  count += 1
  for suji in temp_list:
    if suji % 2 == 0:
      suji_list.append(suji / 2)
    else:
      count -= 1
      continue_flg = false
      break

print(count)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r**2)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(3a**2)
Problem p03206 (python)

Fixed submission:
d = int(input())
 
if d == 22:
  print("Christmas Eve Eve Eve")
elif d == 23:
  print("Christmas Eve Eve")
elif d == 24:
  print("Christmas Eve")
elif d == 25:
  print("Christmas")
else:
  exit()

Buggy submission (verdict: Runtime Error):
d = int(input())

if d == 22:
  print("Christmas Eve Eve Eve")
elif d == 23:
  print("Christmas Eve Eve")
elif d == 24:
  print("Christmas Eve")
elif d == 25:
  print("Christmas")
else:
  break
Problem p04030 (python)

Fixed submission:
s = input()
 
counter = 0
moji = ""
for i in s:
	
	if i == "B":
		moji = moji[:-1]
		
		continue
    	

	moji = moji+ i

print(moji)

Buggy submission (verdict: Runtime Error):
s = input()

counter = 0
moji = ""
for i in s:
  if i == "B":
	moji[:-1]
    continue
  else:
    moji+ i
Problem p02934 (python)

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

rev = []
for a in A:
  rev.append(1.0/float(a))
  
print(1.0/float(sum(rev)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input()))

rev = []
for a in A:
    rev.append(1/float(a))

print(1/float(sum(rev)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input()))

rev = []
for a in A:
    rev.append(1/float(a))

print(1/sum(rev))
Problem p02947 (python)

Fixed submission:
N = int(input())
S = [input() for _ in range(N)]
 
from collections import Counter
 
nS = []
for s in S:
    s  = ''.join(sorted(s))
    nS.append(s)

c = Counter(nS)
 
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

acc = 0
for cnt in list(c.values()):
    if cnt!=1:
        acc+=cmb(cnt, 2)
    
print(acc)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for _ in range(N)]

from collections import Counter
from scipy.special import comb

nS = []
for s in S:
    s  = ''.join(sorted(s))
    nS.append(s)

c = Counter(nS)

acc = 0
for cnt in list(c.values()):
    acc+=comb(cnt, 2, exact=True)
print(acc)
Problem p02953 (python)

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

idx = max(enumerate(H), key=lambda x: x[1])[0]

cmp = H[idx]-1
flg = 0

if N>1:
    if idx!=N-1:
        for i in range(idx, N):
            if H[i]<cmp:
                flg = 1
        if flg==0:
            print('Yes')
        else:
            print('No')

    else:
        idx = max(enumerate(H[0:N-1]), key=lambda x: x[1])[0]
        cmp = H[idx]-1
        flg = 0
        for i in range(idx, N-1):
            if H[i]<cmp:
                flg = 1
        if flg==0:
            print('Yes')
        else:
            print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

idx = max(enumerate(H), key=lambda x: x[1])[0]

cmp = H[idx]-1
flg = 0

if idx!=N-1:
    for i in range(idx, N):
        if H[i]<cmp:
            flg = 1
    if flg==0:
        print('Yes')
    else:
        print('No')

else:
    idx = max(enumerate(H[0:N-1]), key=lambda x: x[1])[0]
    cmp = H[idx]-1
    flg = 0
    for i in range(idx, N-1):
        if H[i]<cmp:
            flg = 1
    if flg==0:
        print('Yes')
    else:
        print('No')
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())

P = 2019

R = min(R, L+673)

tmp = 2018
for i in range(L, R):
    for j in range(L+1, R+1):
        tmp = min((i*j)%P, tmp)
        
print(tmp)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())

P = 2019

def mul(a, b):
    return ((a % P) * (b % P)) % P

R = min(R, l+4038)

tmp = 10**9
for i in range(L, R):
    for j in range(L+1, R+1):
        tmp = min(mul(i, j), tmp)
        
print(tmp)
Problem p02995 (python)

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

import math

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return int(a/gcd(a, b)*b)

def myfunc(x, div1, div2):
    div3 = lcm(div1, div2)
    return x-x//div1-x//div2+x//div3

print(myfunc(B, C, D)-myfunc(A-1, C, D))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

import math

E = C*D/math.gcd(C, D)
interval = B-A+1


n1 = math.ceil(A/C)
n2 = math.ceil(A/D)
n3 = math.ceil(A/E)


m1 = math.floor(B/C)
m2 = math.floor(B/D)
m3 = math.floor(B/E)

cnt_c = m1-n1+1
cnt_d = m2-n2+1
cnt_cd = m3-n3+1

print(interval-(cnt_c+cnt_d-cnt_cd))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())

import math

interval = B-A+1

n1 = math.ceil(A/C)
n2 = math.ceil(A/D)
m1 = math.ceil(B/C)
m2 = math.ceil(B/D)

arr1 = []
arr2 = []

if B%C==0:
    for i in range(n1, m1+1):
        arr1.append(i*C)
else:
    for i in range(n1, m1):
        arr1.append(i*C)
        
if B%D==0:
    for j in range(n2, m2+1):
        arr2.append(j*D)
else:
    for j in range(n2, m2):
        arr2.append(j*D)
    
cnt_c = len(arr1)
cnt_d = len(arr2)
cnt_cd = sum([arr[i]%C==0 for i in range(len(arr))])
cnt = cnt_c+cnt_d-cnt_cd

print(interval-cnt)
Problem p02999 (python)

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

if X<A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

if (W==0)or(H==0):
    print(float(0))
    print(1)
else:
    if ((y*W-x*H)/W==float(0))or((y*W+x*H)/W==float(H)):
        print(H*W/2)
        print(1)
    else:
        print(H*W/2)
        print(0)
Problem p03000 (python)

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

s = 0
pS = []
for i in range(N):
    s += List[i]
    pS.append(s)
    
pS = [0]+pS

if pS[-1]<=X:
    print(len(pS))
    
else:
    for j in range(N):
        if (pS[j]<=X)&(X<pS[j+1]):
            print(j+1)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
List = list(map(int, input().split()))

i = 0
s = 0
while s<=X:
    s += List[i]
    i+=1
    
print(i)
Problem p03006 (python)

Fixed submission:
N = int(input())
List = [list(map(int, input().split())) for _ in range(N)]

import itertools
import collections

if N==1:
    print(1)
    
else:
    arr = list(itertools.combinations(List, 2))
    vec1 = []
    vec2 = []
    for i in range(len(arr)):
        vec1.append([arr[i][1][0]-arr[i][0][0], arr[i][1][1]-arr[i][0][1]])
        vec2.append([arr[i][0][0]-arr[i][1][0], arr[i][0][1]-arr[i][1][1]])
        
    vec = vec1+vec2
    counter = collections.Counter(map(tuple, vec))
    
    v =  counter.most_common(1)[0][0]
    num = counter.most_common(1)[0][1]
    
    print(N-num)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = [list(map(int, input().split())) for _ in range(N)]

import itertools
import collections

arr = list(itertools.combinations(List, 2))
vec = []

for i in range(len(arr)):
    vec.append([arr[i][1][0]-arr[i][0][0], arr[i][1][1]-arr[i][0][1]])

counter = collections.Counter(map(tuple, vec))
num = counter.most_common(1)[0][1]

print(N-num)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = [list(map(int, input().split())) for _ in range(N)]

import itertools

arr = list(itertools.combinations(List, 2))
vec = []

for i in range(len(arr)):
    vec.append([arr[i][1][0]-arr[i][0][0], arr[i][1][1]-arr[i][0][1]])

counter = collections.Counter(map(tuple, vec))
num = counter.most_common(1)[0][1]

print(N-num)

Buggy submission (verdict: Runtime Error):
N = int(input())
List = [list(map(int, input().split())) for _ in range(N)]

import itertools
import collections

arr = list(itertools.combinations(List, 2))
vec = []

for i in range(len(arr)):
    vec.append([arr[i][1][0]-arr[i][0][0], arr[i][1][1]-arr[i][0][1]])

counter = collections.Counter(map(tuple, vec))
num = counter.most_common(1)[0][1]

print(N-num)
Problem p03050 (python)

Fixed submission:
N = int(input())

kmax = (N+1/4)**(1/2)-1/2

acc = 0
for k in range(1, int(kmax+1)):
    m = (N-k)//k
    if(((N-k)%k==0)&(k<m)):
        acc+=m
print(int(acc))

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

import math

kmax1 = (N+1/4)**(1/2)-1/2


kmax = min(kmax1, kmax2)

acc = 0
for k in range(1, int(kmax+1)):
    if((N-k)%k==0&N>k):
        acc+=(N-k)/k
print(int(acc))

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

kmax = math.floor((-1+math.sqrt(1+4*N))/2)
acc = 0
for k in range(1, kmax+1):
    if((N-k)%k==0):
        acc+=(N-k)/k
print(int(acc))
Problem p03076 (python)

Fixed submission:
List = [input() for _ in range(5)]

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

if unitsPlace==[]:
    res = sum([int(List[i]) for i in range(5)])
    print(res)
else:
    minUnitsPlace = min(unitsPlace)
    
    ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]
    res = sum(ceilList) + minUnitsPlace - 10
    
    print(res)

Buggy submission (verdict: Runtime Error):
List = [input() for _ in range(5)]

import math

unitsPlace = []
for i in range(5):
    if int(List[i][-1])!=0:
        unitsPlace.append(int(List[i][-1]))

minUnitsPlace = min(unitsPlace)

ceilList = [math.ceil(int(List[j])/10)*10 for j in range(5)]

res = sum(ceilList) + minUnitsPlace - 10

print(res)
Problem p03078 (python)

Fixed submission:
import heapq
 
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
 
heap = []
heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))
added = set([(0, 0, 0)])
for _ in range(K):
    p, i, j, k = heapq.heappop(heap)
    if (i + 1, j, k) not in added and i + 1 < X:
        heapq.heappush(heap, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))
        added.add((i + 1, j, k))
    if (i, j + 1, k) not in added and j + 1 < Y:
        heapq.heappush(heap, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))
        added.add((i, j + 1, k))
    if (i, j, k + 1) not in added and k + 1 < Z:
        heapq.heappush(heap, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))
        added.add((i, j, k + 1))
    print(-p)

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

import heapq

heap = []
heapq.heappush(heap, (-(A[0]+B[0]+C[0]), 0, 0, 0))
added = set([(0, 0, 0)])

for _ in range(K):
    p, i, j, k = heapq.heappop(heap)
    if (i+1, j, k) not in added and i+1<X:
        heapq.heappush(heap, (-(A[i+1]+B[j]+C[k]), i+1, j, k))
        added.add((i+1, j, k))
    if (i, j+1, k) not in added and j+1<Y:
        heapq.heappush(heap, (-(A[i]+B[j+1]+C[k]), i, k+1, j))
        added.add((i, j+1, k))
    if (i, j, k+1) not in added and k+1<Z:
        heapq.heappush(heap, (-(A[i]+B[j]+C[k+1]), i, j, k+1))
        added.add((i, j, k+1))
    print(-p)

Buggy submission (verdict: Runtime Error):
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

import heapq

heap = []
heapq.heappush(heap, (-(A[0]+B[0]+C[0]), 0, 0, 0))
added = set([(0, 0, 0)])

for _ in range(K):
    p, i, j, k = heapq.heappop(heap)
    if (i+1, j, k) not in added and i+1<X:
        heapq.heappush(heap, -(A[i+1]+B[j]+C[k]), i+1, j, k)
        added.add((i+1, j, k))
    if (i, j+1, k) not in added and j+1<Y:
        heapq.heappush(heap, -(A[i]+B[j+1]+C[k]), i, k+1, j)
        added.add((i, j+1, k))
    if (i, j, k+1) not in added and k+1<Z:
        heapq.heappush(heap, -(A[i]+B[j]+[k]), i, j, k+1)
        added.add((i, j, k+1))
    print(-p)
Problem p03103 (python)

Fixed submission:
N, M = map(int, input().split())
List = [list(map(int, input().split())) for _ in range(N)]

List.sort(key=lambda x:x[0])

amt = 0
money = 0
i=0
while amt<M:
    money+=List[i][0]*List[i][1]
    amt+=List[i][1]
    i+=1

ans = money-(amt-M)*List[i-1][0]
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
List = [list(map(int, input().split())) for _ in range(N)]

List.sort(key=lambda x:x[0])

amt = 0
money = 0
i=0
while amt<=M:
    money+=List[i][0]*List[i][1]
    amt+=List[i][1]
    i+=1
    
ans = money-(amt-M)*List[i-1][0]
print(ans)
Problem p03147 (python)

Fixed submission:
import numpy as np

N = int(input())
H = np.array(input().split(), dtype=np.int32)

def myfunc(left, right):
    if right<left:
        return 0
    idx = left+H[left:right+1].argmin()
    m = H[idx]
    H[left:right+1]-=m
    return m+myfunc(left, idx-1)+myfunc(idx+1, right)

print(myfunc(0, N-1))

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

N = int(input())
H = np.array(input().split(), dtype=np.int32)

def myfunc(left, right):
    if right<left:
        return 0
    idx = left+H[left:right+1].argmin()
    m = H[idx]
    H[left:right+1]-=m
    return m+myfunc(left, idx-1)+myfunc(right, idx+1)

print(myfunc(0, N-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = np.array(input().split(), dtype=np.int32)

def myfunc(left, right):
    if right<left:
        return 0
    idx = left+H[left:right+1].argmin()
    m = H[idx]
    H[left:right+1]-=m
    return m+myfunc(left, idx-1)+myfunc(right, idx+1)

print(myfunc(0, N-1))
Problem p03241 (python)

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

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)
                
    return divisors

if N==1:
    print(M)

else:
    div = sorted(make_divisors(M))
    i = 0 
    while i<=len(div) and M//div[i]>=N:
        ans = div[i]
        i+=1
    print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

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)
                
    return divisors

div = sorted(make_divisors(M))

i = 0
while i<=len(div) and M//div[i]>=N:
    ans = div[i]
    i+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

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)
                
    return divisors

div = sorted(make_divisors(M))
i = 0
while M//div[i]>=N:
    ans = div[i]
    i+=1
    
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

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)
    return divisors

div = sorted(make_divisors(M))
while M//div[i]>=N:
    ans = div[i]
    i+=1
    
print(ans)