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

Fixed submission:

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
import heapq
AB.sort()
heap = []
heapq.heapify(heap)
ans = 0
i = 0
day = 1
while day <= M:
    while i < N and AB[i][0] <= day:
        heapq.heappush(heap,-AB[i][1])
        i += 1
    day += 1
    if not(heap):continue
    ans -= heapq.heappop(heap)

print(ans)

Buggy submission (verdict: Runtime Error):

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
import heapq
AB.sort()
heap = []
heapq.heapify(heap)
ans = 0
i = 0
day = 1
while i < N and day <= M:
    while AB[i][0] <= day:
        heapq.heappush(heap,-AB[i][1])
        i += 1
    day += 1
    if not(heap):continue
    ans -= heapq.heappop(heap)

print(ans)

Buggy submission (verdict: Runtime Error):

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
import heapq
AB.sort()
heap = []
heapq.heapify(heap)
ans = 0
i = 0
day = 1
while i < N and day <= M:
    while AB[i][0] <= day:
        heapq.heappush(heap,-AB[i][1])
        i += 1
    
    ans -= heapq.heappush(heap)

print(ans)

Buggy submission (verdict: Runtime Error):

N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

AB.sort(key = lambda x:x[1],reverse=True)
ans =0
cnt = 0
i = 0
daylist = [i+1 for i in range(M)]
while i<N:
    d = AB[i][0]
    if d > M:continue
    if daylist[d] > 0 and cnt < M:
        daylist[d] = daylist[d]-1
        ans += AB[i][1]
        cnt += 1
    i += 1
print(ans)
Problem p02954 (python)

Fixed submission:
#import sys
#input = sys.stdin.readline
S = list(input())
N = len(S)

def solver(n,m,idx):
    if (n-m)%2 == 0:
        ans[idx[0]] = (n+m)//2
        ans[idx[1]] = (n+m)//2
    else:
        if m%2 == 1:
            ans[idx[1]] = (n+m)//2 + 1
            ans[idx[0]] = (n+m)//2
        else:
            ans[idx[0]] = (n+m)//2 + 1
            ans[idx[1]] = (n+m)//2
    return    
    
    
        
        
ans = [0] * N
m = 0
n = 0
flagL = False
idx = []
for i,s in enumerate(S):
    if s == 'R':
        if flagL:
            solver(n,m,idx)
            n = 0
            m = 0
            flagL = False
        n += 1
    elif s == 'L':
        if not flagL:
            flagL = True
            idx = [i-1,i]
        m += 1 
solver(n,m,idx)
    
print(*ans,sep = ' ')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline()
S = list(input())
N = len(S)

def solver(n,m,idx):
    if (n-m)%2 == 0:
        ans[idx[0]] = (n+m)//2
        ans[idx[1]] = (n+m)//2
    else:
        if m%2 == 1:
            ans[idx[1]] = (n+m)//2 + 1
            ans[idx[0]] = (n+m)//2
        else:
            ans[idx[0]] = (n+m)//2 + 1
            ans[idx[1]] = (n+m)//2
    return    
    
    
        
        
ans = [0] * N
m = 0
n = 0
flagL = False
idx = []
for i,s in enumerate(S):
    if s == 'R':
        if flagL:
            solver(n,m,idx)
            n = 0
            m = 0
            flagL = False
        n += 1
    elif s == 'L':
        if not flagL:
            flagL = True
            idx = [i-1,i]
        m += 1 
solver(n,m,idx)
    
print(*ans,sep = ' ')

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline()
S = list(input())
N = len(S)

def solver(n,m,idx):
    N = n+m
    if (n-m)%2 == 0:
        ans = [0] * N
        ans[idx[0]] = (n+m)//2
        ans[idx[1]] = (n+m)//2
    else:
        ans = [0] * N
        if m%2 == 1:
            ans[idx[1]] = (n+m)//2 + 1
            ans[idx[0]] = (n+m)//2
        else:
            ans[idx[0]] = (n+m)//2 + 1
            ans[idx[1]] = (n+m)//2
    return ans    
    
    
        
        
ans = []
m = 0
n = 0
flagL = False
idx = []
for s in S:
    if s == 'R':
        if flagL:
            ans = ans + solver(n,m,idx)
            n = 0
            m = 0
            flagL = False
        n += 1
    elif s == 'L':
        if not flagL:
            flagL = True
            idx = [n-1,n]
        m += 1 
ans = ans + solver(n,m,idx)
    
print(*ans,sep = ' ')
Problem p03013 (python)

Fixed submission:
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
MOD = 10 **9 + 7

import sys
for i in range(M-1):
    flag = a[i+1]-a[i]
    if flag == 1:
        print(0)
        sys.exit()
        
        
dp = [0] * (N+10)
dp[1] = 1
dp[2] = 1
for i in range(1,N+5):
    dp[i+2] = dp[i+1] + dp[i]
    dp[i+2] %= MOD
    
if M == 0:
    print(dp[N+1])
    sys.exit()
ans = 1
for i in range(M+1):
    if i == 0:
        number = a[i]
    elif i == M:
        number = N - a[i-1]
    else:
        number = a[i]-a[i-1] - 1
    number = max(1,number)
    ans *= dp[number]
    ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
mod = 10 **9 + 7

import sys
for i in range(M-1):
    flag = a[i+1]-a[i]
    if flag == 1:
        print(0)
        sys.exit()
        
        
dp = [0] * (N+10)
dp[1] = 1
dp[2] = 1
dp[3] = 2
for i in range(3,N+5):
    dp[i+1] = dp[i] + dp[i-1]
    dp[i+1] %= mod
ans = 1
for i in range(M+1):
    if i == 0:
        number = a[i]
    elif i == M:
        number = N - a[i-1]
    else:
        number = a[i]-a[i-1] - 1
    number = max(1,number)
    ans *= dp[number]
    ans %= mod
print(ans)
Problem p03017 (python)

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

import sys
if B > C:
    isi = 0
    cnt = 0
    for j in range(A-1,C):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    cnt = 0
    for j in range(B-1,D):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    if isi <= 1:
        print('Yes')
    else:
        print('No')
    sys.exit()


aki = 0
isi = 0
cnt = 0
for j in range(min(A,B)-1,max(C,D)):
    i = S[j]
    if i == '.':
        cnt = 0
    elif i == '#':
        cnt += 1
        isi = max(isi,cnt)
        
cnt = 0
for j in range(B-2,min(D+1,N)):
    i = S[j]
    if i == '#':
        cnt = 0
    elif i == '.':
        cnt += 1
        aki = max(aki,cnt)
        

if C > D:
    if aki >= 3 and isi <= 1:
        print('Yes')
    else:
        print('No')
else:
    if isi <= 1:
        print('Yes')
    else:
        print('No')

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

import sys
if B > C:
    isi = 0
    cnt = 0
    for j in range(A-1,C):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    cnt = 0
    for j in range(B-1,D):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    if isi <= 1:
        print('Yes')
    else:
        print('No')
    sys.exit()


aki = 0
isi = 0
cnt = 0
for j in range(min(A,B)-1,max(C,D)):
    i = S[j]
    if i == '.':
        cnt = 0
    elif i == '#':
        cnt += 1
        isi = max(isi,cnt)
        
cnt = 0
for j in range(B-2,max(D+1,N)):
    i = S[j]
    if i == '#':
        cnt = 0
    elif i == '.':
        cnt += 1
        aki = max(aki,cnt)
        

if C > D:
    if aki >= 3 and isi <= 1:
        print('Yes')
    else:
        print('No')
else:
    if isi <= 1:
        print('Yes')
    else:
        print('No')

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

import sys
if B > C:
    isi = 0
    cnt = 0
    for j in range(A-1,C):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    cnt = 0
    for j in range(B-1,D):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '#':
            cnt += 1
            isi = max(isi,cnt)
    if isi <= 1:
        print('Yes')
    else:
        print('No')
    sys.exit()


aki = 0
isi = 0
cnt = 0
for j in range(min(A,B)-1,max(C,D)):
    i = S[j]
    if i == '.':
        cnt = 0
    elif i == '#':
        cnt += 1
        isi = max(isi,cnt)
        
cnt = 0
for j in range(B-2,D+1):
    i = S[j]
    if i == '#':
        cnt = 0
    elif i == '.':
        cnt += 1
        aki = max(aki,cnt)
        

if C > D:
    if aki >= 3 and isi <= 1:
        print('Yes')
    else:
        print('No')
else:
    if isi <= 1:
        print('Yes')
    else:
        print('No')
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])
ans = sum(A)
idx = 0

for i in range(M):
    if idx + BC[i][0] >= N :
        BC[i][0] = N-idx
    if A[idx + BC[i][0]-1] < BC[i][1]:
        ans += BC[i][1] * BC[i][0] - sum(A[idx:idx+BC[i][0]])
    else:
        for j in range(BC[i][0]):
            if A[idx+j] >= BC[i][1]:
                break
        ans += BC[i][1] * j - sum(A[idx:idx + j])
        break
    idx += BC[i][0]
    if idx > N-1:break
print(ans)

Buggy submission (verdict: Runtime Error):
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])
ans = sum(A)
idx = 0

for i in range(M):
    if idx + BC[i][0] >= N :
        BC[i][0] = N-idx
    if A[idx + BC[i][0]] < BC[i][1]:
        ans += BC[i][1] * BC[i][0] - sum(A[idx:idx+BC[i][0]])
    else:
        for j in range(BC[i][0]):
            if A[idx+j] >= BC[i][1]:
                break
        ans += BC[i][1] * j - sum(A[idx:idx + j])
    idx += BC[i][0]
    if idx > N-1:break
print(ans)

Buggy submission (verdict: Runtime Error):
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])
ans = sum(A)
idx = 0

for i in range(M):
    if idx + BC[i][0] >= N :
        BC[i][0] = N-idx
    if A[idx + BC[i][0]] < BC[i][1]:
        ans += BC[i][1] * BC[i][0] - sum(A[idx:idx+BC[i][0]])
    else:
        for j in range(BC[i][0]):
            if A[idx+j] >= BC[i][1]:
                break
        ans += BC[i][1] * j - sum(A[idx:idx + j])
        print(A[idx:idx+j],j)
    idx += BC[i][0]
    if idx > N-1:break
print(ans)

Buggy submission (verdict: Runtime Error):
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])
ans = sum(A)
idx = 0

for i in range(M):
    if A[idx+BC[i][0]-1] < BC[i][1]:
        ans += BC[i][1] * BC[i][0] - sum(A[idx:idx+BC[i][0]])
    else:
        for j in range(BC[i][0]):
            if A[idx+j] >= BC[i][1]:
                break
        ans += BC[i][1] * j - sum(A[idx:idx+j])
        break
    idx += BC[i][0]
    
print(ans)
Problem p03127 (python)

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

ans = 2 ** 30

def GCD(a,b):
    c = a%b
    if c  == 0:
        return b
    return (GCD(b,c))

tmp = A[0]
for a in A[1:]:
    tmp = GCD(a,tmp)
    
print(tmp)

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

ans = min(A)
aset = set(A)
A = list(aset)

for i in range(N):
    for j in range(i+1,N):
        aset.add(A[i] % A[j])
        
Alist = list(aset)
Alist.sort()
for i in range(1,len(Alist)):
    ans = min(ans,Alist[i]-Alist[i-1])

print(ans)
Problem p03208 (python)

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

h = sorted(h)
hK = h[0:K]
ans = hK[K-1]-h[0]
for i in range(N-K+1):
    ans = min(ans,h[i+K-1]-h[i])

print(ans)

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

h = sorted(h)
Lh = len(h)
while Lh > K:
    print(h)
    head = h[1] - h[0]
    tail = h[Lh-1]-h[Lh-2]
    if head > tail:
        h = h[1:]
    else:
        h = h[:Lh-1]
    Lh = len(h)
        
print(h[Lh-1]-h[0])
Problem p03252 (python)

Fixed submission:
#from collections import Counter

S = list(input())
T = list(input())

dics = {}
dicst= {}
sets = set()
sett = set()
flag = True
for i in range(len(S)):
    s = S[i]
    t = T[i]
    if s in sets and t in sett:
        if dics[s] != t or dicst[t] != s:
            flag = False
            break
    elif s in sets and not(t in sett):
        flag = False
        break
    elif t in sett and not(s in sets):
        flag = False
        break
    else:
        sets.add(s)
        sett.add(t)
        dics[s] = t
        dicst[t] = s
    
print('Yes') if flag else print('No')

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())

dic = {}
sets = set()
flag = True
for s,t in S,T:
  if s in sets:
    if dic[s] != t:
      flag = False
      break
  else:
    sets.add(s)
    dic[s] = t
    
if flag:
  print('Yes')
else:
  print('No')
Problem p03329 (python)

Fixed submission:
N = int(input())

l1 = 2 ** 30
p6 = [1] * 7
p9 = [1] * 6
for i in range(1,7):
    p6[i] = p6[i-1] * 6
    if i < 6 : p9[i] = p9[i-1] * 9

dp = [l1] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for j in p6:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
    for j in p9:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
print(dp[N])

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

l1 = 2 ** 30
p6 = [1] * 6
p9 = [1] * 5
for i in range(1,7):
    p6[i] = p6[i-1] * 6
    if i < 6 : p9[i] = p9[i-1] * 9

dp = [l1] * (N+1)
dp[0] = 0

for i in range(1,N+1):
    for j in p6:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
    for j in p9:
        if j>i: break
        dp[i] = min(dp[i],dp[i-j]+1)
        
print(dp[N])
Problem p02629 (python)

Fixed submission:
def int2char(i):
    return chr(ord("a") + i - 1)

N = int(input())

ans = ""
while (True):
    N_lsb_int = ((N - 1) % 26) + 1
    N_next = int((N - N_lsb_int)/26)
    ans = int2char(N_lsb_int) + ans
    if N_next == 0:
        break
    N = N_next

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = input().split()
q = int(input())

for i in range(q):
    stdins = input().split()
    for j in range(n):
        a[j] = a[j].replace(stdins[0], stdins[1])
    ans = sum([int(an) for an in a])
    print(ans)
Problem p02659 (python)

Fixed submission:
words = input().split()
a = int(words[0])
b = float(words[1])
bb = round(b * 100)
abb = a * bb
ans = abb // 100
print(ans)

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

bb = int(b * 100)
abb = a * bb
ans = abb // 100
print(ans)
Problem p02633 (python)

Fixed submission:
import sys
x=int(input())
x=min(x,360-x)

for i in range(1,361):
    if (i*x)%360==0:
        print(i)
        sys.exit()

Buggy submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
a,b,c,d=map(int,input().split())
mod=998244353


dp=[[0]*3005 for _ in range(3005)]
for i in range(a+1):
    for j in range(b+1):
        dp[i][j]=1
#print(dp)

for i in range(3003-b):
    dp[a][b+i+1]=((dp[a][b+i])*a)%mod
for j in range(3003-a):
    dp[a+1+j][b]=((dp[a+j][b]*b))%mod

j=0
for i in range(a,3003-a):
    dp[a+j][b+i+1]=((dp[a+j][b+i])*(a+j)%mod)
    for j in range(b,3003-b):
        dp[a+1+j][b+i]=((dp[a+j][b+i]*(b+i))%mod)
        #dp[i+1][j+1]=(dp[i][j+1]*(j+1))%mod+(dp[i+1][j]*(i+1))%mod-(i*j)

#print(dp[1][1])
print(dp[c][d]%mod)
Problem p02753 (python)

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
a=input()

if a=="AAA" or a=="BBB":
  print("No")
else:
  print("Yes")

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

Fixed submission:
import numpy as np
s=input()
k=int(input())
cnt=1
a=[]
ss=s+"."
for i in range(len(s)):
    if ss[i]==ss[i+1]:
        cnt+=1
    else:
        a.append(cnt)
        cnt=1

pp=0
if s[0]==s[len(s)-1]:
    pp=a[0]+a[-1]
    
    b=[]
    if len(a)>1:
        b.append(pp)
        b+=a[1:len(a)-1]

    else:
        a=[len(s)*k]
        b=[]

else:
    
    b=a
arr=np.array(a)
arr2=np.array(b)

a=arr//2
b=arr2//2
if len(s)>=2:
    print(np.sum(a)+int((k-1)*np.sum(b)))
else:
    print(k//2)

Buggy submission (verdict: Runtime Error):
import numpy as np
s=input()
k=int(input())
cnt=1
a=[]
ss=s+"."
for i in range(len(s)):
    if ss[i]==ss[i+1]:
        cnt+=1
    else:
        a.append(cnt)
        cnt=1

pp=0
if s[0]==s[len(s)-1]:
    pp=a[0]+a[-1]
    
    b=[]
    if len(a)>1:
        b.append(pp)
        b+=a[1:len(a)-1]

    else:
        a=[len(s)*k]
        b=[]

arr=np.array(a)
arr2=np.array(b)

a=arr//2
b=arr2//2
if len(s)>=2:
    print(np.sum(a)+int((k-1)*np.sum(b)))
else:
    print(k//2)

Buggy submission (verdict: Runtime Error):
import numpy as np
s=input()
k=int(input())
cnt=1
a=[]
ss=s+"."
for i in range(len(s)):
    if ss[i]==ss[i+1]:
        cnt+=1
    else:
        a.append(cnt)
        cnt=1

pp=0
if s[0]==s[len(s)-1]:
    pp=a[0]+a[-1]
    
b=[]
b.append(pp)
b+=a[1:n-2]
    
arr=np.array(a)
arr2=np.array(b)

a=arr//2
b=arr//2
print(np.sum(a)+(k-1)*np.sum(b))
Problem p02954 (python)

Fixed submission:
s=input()

l=[0]
ans=[0]*(len(s))
for i in range(len(s)-1):
    if s[i]=="L" and s[i+1]=="R":
        l.append(i+1)
       
n=len(l)+1
l.append(len(s))
#print(set(s[l[0]:l[1]]))

for i in range(n-1):
    #print(s[l[i]:l[i+1]])
    for j in range(len(s[l[i]:l[i+1]])-1):
        p=len(s[l[i]:l[i+1]])
        if s[l[i]]=="L":
            ans[l[i]]=p
            break
        if s[l[i+1]-1]=="R":
            ans[l[i+1]-1]=p
            break
        if s[l[i]:l[i+1]][j]=="R" and s[l[i]:l[i+1]][j+1]=="L":
            if j%2==1:
                ans[l[i]+j]=p//2
                ans[l[i]+j+1]=p-p//2
                break
            else:
                ans[l[i]+j]=p-p//2
                ans[l[i]+j+1]=p//2
                break
print(*ans)

Buggy submission (verdict: Runtime Error):
if set(s[l[i]:l[i+1]])=={"L"}:
            ans[l[i]]=p
        if set(s[l[i]:l[i+1]])=={"R"}:
            ans[l[i+1]-1]=p
Problem p02970 (python)

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

print(-((-a)//(2*b+1)))

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

c=(-((-a)//(2*b+1)))
print(c)

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

print(-(a//(2*b+1)))

Buggy submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b=map(int,input().split())

print(-(-a)//(2b+1))

Buggy submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b=map(int,input().split())

print(-(-a//(2b+1)))
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce

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

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

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

p=gcd_list(a)

print(p)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

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

p=gcd_list(a)

print(p)

Buggy submission (verdict: Runtime Error):
import fraction
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

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

p=gcd_list(a)

print(p)
Problem p03137 (python)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
x=list(map(int,input().split()))

arr=np.array(sorted(x))
dif=np.diff(arr)

lis=dif.tolist()
lis=sorted(lis,reverse=True)

for i in range(n-1):
    if len(lis)>0:
        lis.pop(0)

print(sum(lis))

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
x=list(map(int,input().split()))

arr=np.array(sorted(x))
dif=np.diff(arr)

lis=dif.tolist()
lis=sorted(lis,reverse=True)

if m>1:
    for i in range(n-1):
        lis.pop(0)

print(sum(lis))
Problem p03207 (python)

Fixed submission:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
pay=0
p=[int(input()) for _ in range(N)]

for i in range(N):
	pay+=p[i]

print(pay-max(p)//2)

Buggy submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
pay=o
p=[int(input()) for _ in range(N)]

for i in range(N):
	pay+=p[i]

print(pay-max(p)//2)

Buggy submission (verdict: Runtime Error):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())

p=[int(input()) for _ in range(N)]

for i in range(N):
	pay+=p[i]

print(pay-max(p)//2)
Problem p03723 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b==c and a%2==0:
    print(-1)
elif a==b==c and a%2==1:
    print(0)
    
else:
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
    print(cnt)

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

else:
    cnt=0
    while a%2==b%2==c%2==0:
        total=a+b+c
        a=total//2-a//2
        b=total//2-b//2
        c=total//2-c//2
        cnt+=1
print(cnt)
Problem p03745 (python)

Fixed submission:
import numpy as np
n=int(input())
a=list(map(int,input().split()))
b=a.copy()
b.insert(0,0)

#連続する重複を除外
arr=np.array(b)
diff=np.diff(arr)
arr2=np.array(a)
aa=arr2[np.nonzero(diff)]

aaa=aa.tolist()
point=[]
cnt=1
if len(aaa)<=2:
    print(1)
else:
    for i in range(len(aaa)-2):
        if (aaa[i+1]-aaa[i])*(aaa[i+2]-aaa[i+1])<0:
            cnt+=1
            point.append(i)
    
    if len(point)>1:
        for i in range(1,len(point)):
            if point[i]-1==point[i-1]:
                point[i]-=1
                cnt-=1
    print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
a=list(map(int,input().split()))

#連続する重複を除外
arr=np.array(a)
diff=np.diff(arr,prepend=0)
aa=arr[np.nonzero(diff)]
#print(diff,aa)

aaa=aa.tolist()
point=[]
cnt=1

if len(aaa)<=2:
    print(1)
else:
    for i in range(len(aaa)-2):
        if (aaa[i+1]-aaa[i])*(aaa[i+2]-aaa[i+1])<0:
            cnt+=1
            point.append(i)
    
    if len(point)>1:
        for i in range(1,len(point)):
            if point[i]-1==point[i-1]:
                point[i]-=1
                cnt-=1
    print(cnt)
Problem p02773 (python)

Fixed submission:
n = int(input())

words = [input() for _ in range(n)]

d = {}

for i in range(n):
    if words[i] not in d:
        d[words[i]] = 1
    else:
        d[words[i]] += 1

m = max(d.values())
ANS = []

for keys in d.keys():
    if d[keys] == m:
        ANS.append(keys)

ANS = sorted(ANS)

for i in ANS:
    print(i)

Buggy submission (verdict: Runtime Error):
from itertools import groupby

n = int(input())

words = []

for i in range(n):
    words.append(input())

words.sort()

count_w = {}

for key, value in groupby(words):
    count_w[key] = len(list(value))

for i in list(count_w.keys):
    if count_w[i] == max(list(count_w.values)):
        print(i)
Problem p02831 (python)

Fixed submission:
import fractions


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


a, b = map(int, input().split())

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math


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


a, b = map(int, input().split())

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
from math import gcd


def lcm(x, y):
    return (x*y) // gcd(x, y)


a, b = map(int, input().split())

print(lcm(a, b))