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

Fixed submission:
K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
diffs =[]
for base, switch in zip(As[:-1], As[1:]):
  diffs.append(switch-base)
diffs.append(As[0]+K-As[-1])
print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
K, N = list(map(int, input().srtip().split()))
As = list(map(int, input().strip().split()))
 
diffs =[]
for base, switch in zip(As[:-1], As[1:]):
  diffs.append(switch-base)
 
diffs.append(As[0]+K-As[-1])
 
print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
K, N = list(map(int, input().srtip().split()))
As = list(map(int, input().strip().split()))
 
diffs =[]
for base, switch in zip(arr[:-1], arr[1:]):
  diffs.append(switch-base)

diffs.append(arr[0]+K-arr[-1])
 
print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stsin.readlines()
K, N = list(map(int, lines[0].srtip().split()))
As = list(map(int, lines[1].strip().split()))
 
diffs =[]
for base, switch in zip(arr[:-1], arr[1:]):
  diffs.append(switch-base)

diffs.append(arr[0]+K-arr[-1])
 
print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stsin.readlines()
K, N = list(map(int, lines[0].srtip().split()))
As = list(map(int, lines[1].strip().split()))

diffs =[]
for base, switch in zip(arr[:-1], arr[1:]):
  diffs.append(switch-base)

diffs.append(arr[0]+K-arr[-1])

print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stsin.readlines()
K, N = map(int, lines[0].srtip().split())
As = map(int, lines[1].strip().split())

diffs =[]
for base, switch in zip(arr[:-1], arr[1:]):
  diffs append(switch-base)

diffs append(arr[0]+K-arr[-1])

print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stsin.readlines()
K, N = map(int, lines[0].srtip().split())
As = map(int, lines[1].strip().split())

diffs =[]
for base, switch in zip(arr[:-1], arr[1:]+[0]):
  diffs append(switch-base)

diffs append(arr[0]+K-arr[-1])

print(K-max(diffs))

Buggy submission (verdict: Runtime Error):
import sys
lines = sys.stsin.readlines()
K, N = map(int, lines[0].srtip().split())
As = map(int, lines[1].strip().split())

range = max(As)-min(As)

if range*2<K:
  print(range)
else:
  print(K-range)
Problem p02753 (python)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
  print ("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
if input() == 'AAA' or input() == 'BBB':
  print ("No")
else:
  print("Yes")
Problem p02725 (python)

Fixed submission:
# A = [list(map(int, input().split())) for _ in range(3)]
# X = int(input())
# B = [int(input()) for _ in range(n)]
# A = list(map(int, input().split()))
k, n = map(int, input().split())
A = list(map(int, input().split()))
diff = []
for i in range(n-1):
    diff.append(A[i+1]-A[i])
diff.append((k-max(A))+min(A))
print(k-max(diff))

Buggy submission (verdict: Runtime Error):
# A = [list(map(int, input().split())) for _ in range(3)]
# X = int(input())
# B = [int(input()) for _ in range(n)]
# A = list(map(int, input().split()))
k, n = map(int, input().split())
A = list(map(int, input().split()))
A.append(A[0]+k)
diff = 0
for i in range(n):
    diff = A[i+1]-A[i]
print(k-max(diff))
Problem p02785 (python)

Fixed submission:
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if n-k <= 0:
    print(0)
    exit()
else:
    ans = sum(H[:n-k])
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if n-k <= 0:
    print(0)
else:
    ans = sum(H[:n-k])
print(ans)
Problem p02835 (python)

Fixed submission:
#y,m,d=map(int,input().split())
#a,b=map(int,input().split())
#n=int(input())
#a=int(input())
#b=int(input())
#s=list(input())
#recipe=[list(input().split())for _ in range(n)]
#m=int(input())
#have=[list(input().split())for _ in range(m)]
#s=[list(input())for _ in range(n)]
#b=list(map(int,input().split()))
#b=list(map(int,input().split()))
#a=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#a=[list(input().split())for _ in range(n)]
#a=[int(input())for _ in range(n)]
a=list(map(int,input().split()))
total=sum(a)
if 22<=total:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
#y,m,d=map(int,input().split())
#a,b=map(int,input().split())
#n=int(input())
#a=int(input())
#b=int(input())
#s=list(input())
#recipe=[list(input().split())for _ in range(n)]
#m=int(input())
#have=[list(input().split())for _ in range(m)]
#s=[list(input())for _ in range(n)]
#b=list(map(int,input().split()))
#b=list(map(int,input().split()))
#a=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#a=[list(input().split())for _ in range(n)]
#a=[int(input())for _ in range(n)]
a=list(map(int,input().split(())))
total=sum(a)
if 22<=total:
    print('bust')
else:
    print('win')
Problem p02881 (python)

Fixed submission:
#a,b=map(int,input().split())
n=int(input())
import math
ans=[]
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        dis=abs(i-1)+abs(n//i-1)
        ans.append(dis)
print(min(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
import math
ans=[]
for i in range(1,int(math.sqrt(n))):
    if n%i==0:
        tmp=n//i
        ans.append(abs(i-1)+abs(tmp-1))
print(min(ans))
Problem p03012 (python)

Fixed submission:
n=int(input())
w=list(map(int,input().split()))
ans=[]
total=sum(w)
for i in range(n):
    diff=total-sum(w[:i])
    ans.append(abs(diff-sum(w[:i])))
print(min(ans))

Buggy submission (verdict: Runtime Error):
n=int(input())
w=list(map(int,input().split()))
ans=[]
total=sum(w)
for i in range(n):
    diff=abs(total-w[:i])
    ans.append(diff)
print(min(ans))
Problem p03077 (python)

Fixed submission:
n=int(input())
A=[int(input())for i in range(5)]
if n%min(A)==0:
    print(n//min(A)+4)
else:
    print(n//min(A)+5)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[int(input())for i in range(5)]
if n%min(A)==0 print(n//min(A)+4) else print((n//min(A)+5)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[int(input())for i in range(5)]
if n//min(A)==0 print(n//min(A)+4) else print((n//min(A)+5)
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
    print(0)
    exit()
if n==1:
    print(max(a)-min(a))
    exit()
for i in range(m-1):
    ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
if len(ans)<=n:
    print(0)
    exit()
for i in range(n-1):
    total+=ans[i]
print(sum(ans)-total)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
    print(0)
    exit()
if n==1:
    print(max(a)-min(a))
    exit()
for i in range(m-1):
    ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
for i in range(n-1):
    total+=ans[i]
print(sum(ans)-total)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
ans=[]
if m==1:
    print(0)
    exit()
for i in range(m-1):
    ans.append(abs(a[i+1]-a[i]))
total=0
ans.sort(reverse=True)
for i in range(n-1):
    total+=ans[i]
print(sum(ans)-total)
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
ans=[]
ans.append(a)
ans.append(b)
ans.append(c)
ans.sort(reverse=True)
temp=""
temp+=str(ans[0])
temp+=str(ans[1])
print(int(temp)+ans[2])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
ans=[]
ans.append(a)
ans.append(b)
ans.append(c)
ans.sort(reverse=True)
temp=""
temp+=ans[0]
temp+=ans[1]
print(int(temp)+ans[2])
Problem p03307 (python)

Fixed submission:
a=int(input())
b=2
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
n=int(input())
import math
a=2
def lcm(a,n):
    return (a*n)//math.gcd(a,n)
print(lcm(a,n))
Problem p03631 (python)

Fixed submission:
n=list(map(int,input()))
re=n[::-1]
for i in range(len(n)):
    if n[i]==re[i]:
        print("Yes")
        break
    else:
        print("No")
        break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(min(b,d)-max(a,c))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if b<c:
    print(0)
else:
    print(min(b,d)-max(a,c))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
s=max(b,d)-min(a,c)
s_i=(c-a)+(d-b)
if b<c:
    print(0)
else:
    print(s-s_i)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
s=max(b,d)-min(a,c)
s_i=(c-a)+(d-b)
if b<c:
    print(0)
else:
    print(abs(s_i-s))

Buggy submission (verdict: Runtime Error):
n=list(map(int,input().split))
n_re=n.reverse()
if n==n_re:
    print("Yes")
else:
    print("No")
Problem p03775 (python)

Fixed submission:
import math
n=int(input())
ans=[]
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        ans.append(n//i)
v=min(ans)
data=int(math.log10(v)+1)
print(data)

Buggy submission (verdict: Runtime Error):
n=int(input())
import math
ans=[]
ans_i=[]
for i in range(1,int(math.sqrt(n))):
    if n%i==0:
        ans.append(i)
        ans_i.append(n//i)
v=list(str(max(max(ans,ans_i))))
print(len(v))
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
    print("Draw")
elif a==1:
    print("Alice")
elif b==1:
    print("Bob")
elif a<b:
    print("Bob")
else:
    print("Alice")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==1:
    print("Alice")
elif b==1:
    print("Bob")
elif a<b:
    print("Bob")
elif:b<a
    print("Alice")
else:
    print("Draw")
Problem p03805 (python)

Fixed submission:
import itertools
n,m=map(int,input().split())
e=[set() for _ in range(n+1)]
for _ in range(m):
    a,b=map(int,input().split())
    e[a].add(b)
    e[b].add(a)
count=0
for i in itertools.permutations(range(2,n+1)):
    if i[0] not in e[1]:
        continue
    f=True
    for j in range(n-2):
        if i[j+1] not in e[i[j]]:
            f=False
            break
    if f:
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
if m==0:
    print(0)
    exit()
ans=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    ans[a-1].append((b-1))
    ans[b-1].append((a-1))
v=[]
def dfs(now,visited=[]):
    global v
    if len(visited)==n:
        v.append([visited])
        return
    for j in ans[now]:
        for j not in visited:
            dfs(j,visited+[j])
dfs(0,[0])
print(len(v))
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
count=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            count+=1
print(count)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
count=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=s-x-y<=k:
            count+=1
print(count)
Problem p02723 (python)

Fixed submission:
S=input()
if (S[2]==S[3]) and (S[4]==S[5]):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
X = int(input())
 
ans = (X//500)*1000
ans += ((X % 500)//5) * 5
 
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
SS = S/500
SSS = (S%500)/5
print(1000*SS + 5*SSS)

Buggy submission (verdict: Runtime Error):
S = int(input())
SS = S//500
SSS = (S%500)//5
print(1000*SS + 5*SSS)

Buggy submission (verdict: Runtime Error):
S = int(input())
S500 = S/500
S5 = (S%500)/5
print(1000*S500 + 5*S5)

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

S500 = S/500

S_nokori = S%500

S5 = S_nokori/5

print(1000*S500 + 5*S5)
Problem p02729 (python)

Fixed submission:
N,M = map(int,input().split()) 
ans = (N-1)*N//2
ans =ans + (M-1)*M//2
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input()) 
ans = (N-1)*N/2
ans =ans + (M-1)*M/2
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = int(input().split())  ##Nが偶数　Mが奇数
all = N+M
ans = (N-1)*N/2
ans =ans + (M-1)*M/2
print(ans)
Problem p02723 (python)

Fixed submission:
S = input()

if S[2] == S[3] and S[4] == S[5]:
  print("Yes")
else:
  print("No")

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

for i in range(1, N):
  List.append(A[i] - A[i-1])
  
d = K - A[-1] + A[0]
List.append(d)
List.sort()
print(sum(List[:-1]))
Problem p02897 (python)

Fixed submission:
n = int(input())
ans = 0

if n % 2 == 0:
  ans = (n / 2) / n
else:
  ans = ((n + 1) / 2) / n
  
print(ans)

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

print(N)
print(K)
print(b)

passengers = 0

for i in b:
  if int(i) >= K:
    passengers += 1

print(passengers)
Problem p03186 (python)

Fixed submission:
a, b, c = map(int, input().split())
if (b >= c):
  print(b+c)
else:
  tot = 0
  tot += 2*b
  c -= b
  tot += c if a >= c-1 else a+1
  print(tot)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input.split())
if (b >= c):
  print(b+c)
else:
  tot = 0
  tot += 2*b
  c -= b
  tot += c if a >= c-1 else a+1
  print(tot)
Problem p03242 (python)

Fixed submission:
s = input()
s = list(s)
if s[0] == '1':
  s[0] = '9'
else:
  s[0] = '1'
if s[1] == '1':
  s[1] = '9'
else:
  s[1] = '1'
if s[2] == '1':
  s[2] = '9'
else:
  s[2] = '1'

print(''.join(s))

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == '1':
  s[0] = '9'
else:
  s[0] = '1'
if s[1] == '1':
  s[1] = '9'
else:
  s[1] = '1'
if s[2] == '1':
  s[2] = '9'
else:
  s[2] = '1'
print(s)
Problem p02987 (python)

Fixed submission:
sti = input()
x = set()
for i in sti:
    x.add(i)
if len(x) == 2 and sti.count(sti[0]) == 2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
sti = input()
up = False
down = False
for i in sti:
	if i == i.upper:
		up = True
    else:
		down = True
if up and down:
	print("Yes")
else:
  	print("No")
Problem p02723 (python)

Fixed submission:
def get_count(text):
    if text[2] == text[3] and text[4] == text[5]:
        return 'Yes'
    else:
        return 'No'
 
 
if __name__ == '__main__':
    string = input().strip()
 
    result = get_count(string)
    print(result)

Buggy submission (verdict: Runtime Error):
S = coffee
if S is coffee-like
    return("Yes")
    else
    print("No")
Problem p02835 (python)

Fixed submission:
A = [int(x) for x in input().split()]
if sum(A) >= 22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
A = [map(int, input().split())]
if sum(A) >= 22:
    print(bust)
else:
    print(win)
Problem p02847 (python)

Fixed submission:
cal = {"SUN":0,"MON":1,"TUE":2,"WED":3,"THU":4,"FRI":5,"SAT":6}
S = input()
print(7-cal[S])

Buggy submission (verdict: Runtime Error):
cal = {"SUN":0,"MON":1,"TUE":2,"WEN":3,"THU":4,"FRI":5,"SAT":6}
S = input()
print(7-cal[S])
Problem p02987 (python)

Fixed submission:
S = input()
ans = 0
for i in range(4):
    if S.count(S[i]) == 2:
        ans += 1
if ans == 4:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
for i in S:
    if S.count(a[i]) == 2:
        ans += 1
if ans == 4:
    print('Yes')
else:
    print('No')
Problem p02725 (python)

Fixed submission:
k,n=map(int,input().split())
list=list(map(int,input().split()))
dif_list=[]

for i in range(n):
  if i == 0:
    dif_list.append(k-list[-1]+list[0])
  else:
    dif_list.append(list[i]-list[i-1])

print(k-max(dif_list))

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
list=list(input().split())
dif_list=[]

for i in range(n):
  if i == 0:
    dif_list.append(k-list[-1]+list[0])
  else:
    dif_list.append(list[i]-list[i-1])

print(k-max(dif_list))
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())

if a==b and b==c and a==c:
  print('No')

elif a!=b and a!= c and b!= c:
    print('No')
else:
  print('Yes')

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

if a==b and b== c and a== c:
  print('No')
else:
  print('Yes')
Problem p02723 (python)

Fixed submission:
# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(input_str_list, int))
    return input_int_list


S = get_stdin_str_list()[0]
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
import os

def remove_empty(target_list: list):
    empty_removed_list = [x for x in target_list if x]
    return empty_removed_list

def get_stdin_str_list():
    input_str = input().strip()
    input_str_list = input_str.split()
    return input_str_list

def get_stdin_int_list():
    input_str_list = get_stdin_str_list()
    input_int_list = list(map(input_str_list, int))
    return input_int_list


S = get_stdin_str_list()
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")
Problem p03127 (python)

Fixed submission:
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = fractions.gcd(v, a[i])
print(v)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n):
    v = math.gcd(v, a[i])
print(v)

Buggy submission (verdict: Runtime Error):
import fractions
n = int(input())
a = list(map(int, input().split()))
v = fractions.gcd(a[0], a[1])
for i in range(2, n - 1):
    v = math.gcd(v, a[i])
print(v)
Problem p03631 (python)

Fixed submission:
n=input();print('YNeos'[n!=n[::-1]::2])

Buggy submission (verdict: Runtime Error):
print('YNeos'[input()!=input()[::-1]::2])
Problem p02723 (python)

Fixed submission:
input_value = input()

print(
  'Yes'
  if (input_value[2] == input_value[3]) and (input_value[4] == input_value[5])
  else
  'No')

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

return (input_value[2] == input_value[3]) and (input_value[4] == input_value[5])
Problem p02723 (python)

Fixed submission:
s = input()
if (s[2] == s[3]) and (s[4] == s[5]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
if (s[3] == s[4]) and (s[5] == s[6]):
  print('Yes')
else:
  print('No')
Problem p02785 (python)

Fixed submission:
monster_num, special_num = map(int ,input().split())
monster_list = list(map(int, input().split()))
 
monster_list = sorted(monster_list)[::-1]
 
monster_list = monster_list[special_num:]
  
print(sum(monster_list))

Buggy submission (verdict: Runtime Error):
monster_num, special_num = input().split()
monster_list = [input() for _ in range(monster_num)]


monster_list = sorted(monster_list)

for _ in range(special_num):
  monster_list = monster_list[:-1]
  
print(sum(monster_list))
Problem p02819 (python)

Fixed submission:
import math

x = int(input())

# エラトステネスの篩
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data


prime = Eratosthenes(10**5+3)
if x in prime:
    print(x)
else:
    import bisect
    min_prime_index = bisect.bisect_right(prime, x)
    print(prime[min_prime_index])

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

# エラトステネスの篩
def Eratosthenes(n):
    if n < 2:
        return None
    prime = [2]
    limit = math.ceil(n**0.5)
    data = list(range(3, n+1, 2))
    p = -1
    while p < limit:
        p = data[0]
        prime.append(p)
        data = [d for d in data if d%p != 0]
    return prime + data


prime = Eratosthenes(10**5+3)
if x in prime:
    print(x)
else:
    import bisect
    min_prime_index = bisect.bisect_right(prime, x)
    print(prime[min_prime_index])
Problem p02948 (python)

Fixed submission:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB = sorted(AB, key=lambda x: x[0])  # sort by days

import heapq
que = []
heapq.heapify(que)

ans = 0
i = 0
for day in range(1, M+1):
    while i < len(AB) and AB[i][0] <= day:
        heapq.heappush(que, (-1)*AB[i][1])
        i += 1
    if que:
        ans += (-1)*heapq.heappop(que)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
import numpy as np
dp = np.zeros([N+1, max(max(A), M)+1])
    
for i in range(1, N+1):
    for j in range(min(A[i-1], M+1), M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)
    
import numpy as np
dp = np.zeros([N+1, max(max(A), M)+1])
    
for i in range(1, N+1):
    for j in range(A[i-1], M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))

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

import numpy as np
dp = np.zeros([N+1, M+1])
    
for i in range(1, N+1):
    for j in range(A[i-1], M+1):
        dp[i][j] = B[i-1]

ans = 0
for j in range(1, M+1):
    i = np.argmax(dp[:, j])
    ans += dp[i, j]
    dp[i, :] = 0
print(int(ans))
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = [list(map(int, input().split())) for _ in range(m)]

a.sort()
bc.sort(reverse=True, key=lambda x: x[1])
j = 0
for i in range(m):
    while j < len(a) and bc[i][0] > 0:
        if a[j] < bc[i][1]:
            a[j] = bc[i][1]
            bc[i][0] -= 1
        j += 1
print(sum(a))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
bc = []
for _ in range(m):
    b, c = map(int, input().split())
    bc.append([b, c])
    
a = sorted(a)
bc = sorted(bc, key=lambda x: x[1])

que = []
for b, c in bc:
    que += [c]*b


c = que.pop()
ans = 0
i = 0
while True:
    if a[i] < c:
        ans += c
        if que:
            c = que.pop()
            i += 1
        else:
            i += 1
            break
    else:
        break
print(ans + sum(a[i:]))
Problem p03075 (python)

Fixed submission:
A = [int(input()) for _ in range(5)]
k = int(input())

if A[-1] - A[0] > k:
    print(':(')
else:
    print('Yay!')

Buggy submission (verdict: Runtime Error):
A = [int(input()) for _ in range(5)]
k = int(input())
cnt = 0
for i in range(n-1):
    if A[i+1] - A[i] > k:
        cnt += 1
if cnt:
    print(':(')
else:
    print('Yay!')
Problem p02723 (python)

Fixed submission:
a = input()
if (a[2] == a[3]) and (a[4] == a[5]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input()
if (a[2] == a[3]) and (a45] == a[5]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input()
if (a[3] == a[4]) and (a[5] == a[6]):
    print("Yes")
else:
    print("No")
Problem p02729 (python)

Fixed submission:
n,m = map(int,input().split())

print(int(n*(n-1)/2 + m*(m-1)/2))

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

from decimal import *
n = Decimal(l/3).quantize(Decimal('.001'))

print((l-2*n)*n*n)