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

Fixed submission:
N = int(input())
mylist = []
for i in range(1,10):
    for j in range(1,10):
        mylist.append(i*j)
if mylist.count(N):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=int(input)
def c(x):
  co=0
  for i in range(1,9):
    if x%i==0 and x//i<=9:
      co+=1
  if co>0:
    return("Yes")
  else:
    return("No")
print(c(s))
Problem p02959 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
for i in range(n):
    t1 = min(a[i], b[i])
    a[i] -= t1
    b[i] -= t1
    res += t1
    t2 = min(a[i+1], b[i])
    a[i+1] -= t2
    b[i] -= t2
    res += t2
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a1 = sum(A)
for i in range(N):
  b = B[i]
  if A[i] >= b:A[i] -= b
  else:
    if A[i+1]+A[i] >= b:
      A[i+1] = A[i+1]+A[i]-b
      A[i] = 0
    else:A[i], A[i+1] = 0, 0
a2 = sum(A)
print(a1-a2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
for i in range(n):
    t1 = min(a[i], b[i])
    a[i] -= t1
    b[i] -= t1
    res += t
    t2 = min(a[i+1], b[i])
    a[i+1] -= t2
    b[i] -= t2
    res += t2
print(res)
Problem p03011 (python)

Fixed submission:
a = [int(x) for x in input().split()]
a.sort()
print(a[0] + a[1])

Buggy submission (verdict: Runtime Error):
valores = [int(input()), int(input()), int(input())]
valores.remove(max(valores))
print(valores[0]+valores[1])

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

a.sort()
return(a[0]+a[1])
Problem p03107 (python)

Fixed submission:
def main(s):
    a = s.count("0")
    b = s.count("1")
    return 2*min(a,b)

s = input()


print(main(s))

Buggy submission (verdict: Runtime Error):
def sonu(a,count,pivot):
    if(a[pivot]!=a[pivot+1]):
        a.pop(pivot)
        a.pop(pivot)
        pivot=0
        count+=1
        if(len(set(a))!=1 and len(a)!=0):
            sonu(a,count,pivot)
        else:
            print(count*2)
        

    else:
        
        pivot+=1
        if(len(set(a))!=1):
            sonu(a,count,pivot)
        else:
            print(count*2)
        
    
    




a=list(input())
if(len(a)==1):
    print(0)
else:
    count=0
    pivot=0
    sonu(a,count,pivot)

Buggy submission (verdict: Runtime Error):
for a in Str:
    Codigo.append(a)

lenMax=len(Codigo)-1
k=0

while i < len(Codigo)-1:
    lenAnterior = len(Codigo)-1
    
    if Codigo[i] == "0" and Codigo[i+1]=="1":
        contador+=2
        Codigo.pop(i)
        Codigo.pop(i)
    elif Codigo[i] == "1" and Codigo[i+1]=="0":
        contador+=2
        Codigo.pop(i)
        Codigo.pop(i)
        
    if lenAnterior != len(Codigo)-1:
        i=i-1
    else:
        i=i+1

    k+=1

    if k >= lenMax:
        break
    
print(contador)
Problem p03252 (python)

Fixed submission:
#!/usr/bin/python
# -*- coding: utf-8 -*-
s = raw_input()
t = raw_input()
dd1 = {}
dd2 = {}
flag = True
for i in xrange(len(s)):
    c1, c2 = s[i], t[i]
    if dd1.get(c1, c2) != c2:
        flag = False
        break
    if dd2.get(c2, c1) != c1:
        flag = False
        break
    dd1[c1] = c2
    dd2[c2] = c1
print 'Yes' if flag else 'No'

Buggy submission (verdict: Runtime Error):
def ctonum(c):
	alp="qwertyuiopasdfghjklzxcvbnm"
	for i in range(len(alp)):
		if c == alp[i]:
			return i

countS=[0 for i in range(100)]
countT=countS

S,T=input(),input()

for i in range(len(S)):
	countS[ctonum[S[i]]]+=1
	countT[ctonum[T[i]]]+=1
	
countS.sort()
countT.sort()

if countS==countT:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
s=list(S)
t=list(T)
ss=[]
tt=[]
for i in range(97,123):
    a=s.count(chr(i))
    ss.append(a)
    b=t.count(chr(i))
    tt.append(b)
ss.sort()
tt.sort()
if ss==tt:
    print("Yes")
else:
    print("No")
Problem p03272 (python)

Fixed submission:
t,i = map(int,input().split(" "))
j=t-i+1 
print(j)

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())
if x == y:
    print(y)
else:
    print(y - x + 1)

Buggy submission (verdict: Runtime Error):
x = int(input())
y = int(input())
if x ==y :
    print(y)
else:
    print(y-x+1)

Buggy submission (verdict: Runtime Error):
s=list(map(int,input().split()))
    print(s[0]-s[1]+1)

Buggy submission (verdict: Runtime Error):
n,i=int(input("enter the numbers"))
x=n-i+1
Print("the result")
print(x)

Buggy submission (verdict: Runtime Error):
totalnumber,numberfromfront=map(int, input().split())
numberfromback=totalnumber-numberfromfront+1
print(j)

Buggy submission (verdict: Runtime Error):
N = int(input("enter the number of cars: "))
i = int(input("enter the front of the train "))
if (1<=N and N<=100) or (1<=i and i<=N):
    i  = N - i +1
    print(i)

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

print (N-i+1)
Problem p03286 (python)

Fixed submission:
a = int(input(""))
list = []
if(a == 0):
    list.append(0)
while(a):
    if(a%(-2)==0):
        list.append(0)
        a//=-2
    elif(a%(-2)==-1):
        list.append(1)
        a -= 1
        a//=-2

list.reverse()
for i in list:print(i,end='')
print()

Buggy submission (verdict: Runtime Error):
n = input()
negBase = -2

if (n == 0): 
        return "0"
  
    converted = "01"
    while (n != 0): 
      
        remainder = n % (negBase) 
        n = int(n/negBase) 
  
        if (remainder < 0): 
            remainder += ((-1) * negBase) 
            n += 1
  
        converted = str(remainder) + converted
Problem p03307 (python)

Fixed submission:
#jiaofhaosfhao
n=int(input())
if(n%2==1):
	n*=2
print(n)

Buggy submission (verdict: Runtime Error):
line = input()
num = [int(n) for n in line.split()]

smaller_divisible_number = num
if num%2 != 0:
    smaller_divisible_number *= 2
print(smaller_divisible_number)

Buggy submission (verdict: Runtime Error):
num = int(input())
  
elif num%2 != 0:
    print(str(num))
else:
    print(str(2*num))
Problem p03329 (python)

Fixed submission:

def mi():
	return map(int, input().split())

maxn = 100000
s = [1]
n = int(input())
for i in range(20):
	if 6**i<=maxn:
		s.append(6**i)
	if 9**i<=maxn:
		s.append(9**i)
dp = [10**10]*(maxn+4)
dp[0] = 0
m = len(s)
for i in range(1,maxn+1):
	for j in range(m):
		if s[j]<=i:
			subres = dp[i-s[j]]
		if subres!=10**10 and subres+1<dp[i]:
			dp[i] = subres+1
print (dp[n])

Buggy submission (verdict: Runtime Error):
kalanbaba = 1
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))

n , = I()
c = n
from math import log
count = 0
m = int(log(n,9))
n -= 9**m
count += m>0
l9 = int(log(n,9))
l6 = int(log(n,6))
while l9 > 0 or l6 > 0:
	count += 1
	if 6**l6 > 9**l9:
		n -= 6**l6
	else:
		n -= 9**l9
	l9 = int(log(n,9))
	l6 = int(log(n,6)) 
print(count + n)
Problem p03617 (python)

Fixed submission:
a,b,c,d=map(int, input().split())
n=int(input())
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, c+b+2*a,c+4*a,4*a+2*b,b+6*a,3*b+2*a)

if n%2==0 :
               print(twoltr * (n//2))
else :
               print(oneltr+twoltr * ((n-1)//2))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split)
n=int(input)
oneltr=min(4*a, 2*b, c, 2*a+b)
twoltr=min(8*a, 4*b, 2*c, d, c+2*b, 4*a+2*b)

if n%2==0 :
               print(twoltr*n//2)
else :
               print(oneltr+twoltr*(n-1)//2)
Problem p03834 (python)

Fixed submission:
x=input()
def fun():
     print(11)
     print(22)
     print(33)
     print(34)
     print(23)
x=x.replace(',',' ')
print(x)

Buggy submission (verdict: Runtime Error):
s=str(input("please enter your statment))
s[3]=" "
s[13]=" "
print(s)
Problem p02550 (python)

Fixed submission:
N,X,M = map(int,input().split())
L = [X]
S = set([X])
idx = N
MOD = 10**9+7
for i in range(1,N):
  X = (X**2%M)
  if len(S) != len(L):
    idx = L.index(X)
    break
  L.append(X)
  S.add(X)

if idx == N:
  print(sum(L[:idx]))
else:
  k = (N-idx)%len(L[idx:])
  print(sum(L[:idx])+((N-idx)//len(L[idx:]))*sum(L[idx:])+sum(L[idx:idx+k]))

Buggy submission (verdict: Runtime Error):
N,X,M = map(int,input().split())
er = [0]*N
er[0] = X
MOD = 10**9+7
for i in range(1,N):
  er[i] = (er[i-1]**2%M)%MOD
  if er[i] == 0:
    break
print(sum(er)%MOD)
Problem p02659 (python)

Fixed submission:
from decimal import *
A,B = map(str,input().split())
num = str(Decimal(A)*Decimal(B))
ans = ''
 
for i in range(len(num)):
  if num[i] == '.':
    break
  ans += num[i]
print(int(ans))

Buggy submission (verdict: Runtime Error):
from decimal import *
A,B = map(float,input().split())
num = str(Decimal(A)*Decimal(B))
ans = ''

for i in range(len(num)):
  if num[i] == '.':
    break
  ans += num[i]
print(int(ans))
Problem p02754 (python)

Fixed submission:
import math
N,A,B = map(int,input().split())
c = N%(A+B)
p = math.floor(N/(A+B))
if c >= A:
  print((A*p)+A)
else:
  print((A*p)+c)

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
a = ""
b = ""
for i in range(A):
  a += "a"
for j in range(B):
  b += "b"
c = a+b
while len(c) <= N:
  c += c

d = c[:N]
print(d.count("a"))
Problem p02773 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for j,k in CS.items():
  if v == k:
    ans.append(j)
ans.sort()
print(*ans,sep="\n")

Buggy submission (verdict: Runtime Error):
rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort()
print(ans[i] for i in range(len(ans)))

Buggy submission (verdict: Runtime Error):
rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
math = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))
Problem p02779 (python)

Fixed submission:
def has_duplicates(seq):
    return len(seq) != len(set(seq))
    
N = map(int,input())
A = list(map(int,input().split()))
print("NO" if has_duplicates(A) else "YES")

Buggy submission (verdict: Runtime Error):
N = map(int,input())
A = [list(map(int,input().split())) for i in range(N)]
dup = [i for i in set(A) if A.count(i) > 1]
print("NO" if dup else "YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [list(map(int,input().split())) for i in range(N)]
dup = [i for i in set(A) if A.count(i) > 1]
if not dup:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [input().split() for i in range(N)]
dup = [j for j in set(A) if A.count(j) > 1]
if dup == True:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input().split() for i in range(N))]
dup = [j for j in set(A) if A.count(j) > 1]
if dup == True:
  print("NO")
else:
  print("YES")
Problem p02785 (python)

Fixed submission:
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
 
sum = 0
for count in range(N):
        if count >= K:
            sum += H[count]
 
print(sum)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
h = H.sort()
i = 0
count = 0
while sum(h[N-K]) == 0:
  while h[N-K] == 0:
    count += 1
    while i <= N-K:
      i += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
H = list(map(int,input().split()))
i = 0
count = 0
while sum(H[N-K]) == 0:
  while H[N-K] == 0:
    count += 1
    while i <= N-K:
      i += 1
print(count)
Problem p02790 (python)

Fixed submission:
a,b = map(str,input().split())
if a > b:
  print(b*int(a))
else:
  print(a*int(b))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
la = []
lb = []
i = 0
map_la = map(str, la)
map_lb = map(str, lb)
while i <= b:
  la.append(a)
  map_la = ''.join(map_la)
  i += 1
while i <= a:
  la.append(b)
  map_lb = ''.join(map_lb)
  i += 1
if map_la <= map_lb:
  print(map_la)
else:
  print(map_lb)
Problem p02792 (python)

Fixed submission:
N = int(input())
count = [10*[0]for _ in range(10)]
ans = 0
for i in range(1,N+1):
  s = str(i)
  if s[0] == '0' or s[-1] == '0':
    pass
  else:
    count[int(s[0])][int(s[-1])] += 1
for j in range(1,10):
  for k in range(1,10):
    ans += count[j][k]*count[k][j]
print(ans)

Buggy submission (verdict: Runtime Error):
N,A,B= map(int,input().split())
count = 0
for A in range(N):
  for B in range(N):
    if A[0:] == B[:-1] and A[:-1] == B[0]:
      count += 1
print(count)
Problem p02819 (python)

Fixed submission:
X = int(input())
def price(n):
  if n == 1:
    return False
  for i in range(2, int(n**0.5)+1):
    if n%i == 0:
      return False
  return True

while(1):
  if price(X):
    print(X)
    break
  else:
    X += 1

Buggy submission (verdict: Runtime Error):
X = int(input())
from sympy import primerange, sieve
L = list(sieve.primerange(X, 10**5))
print(L[0])

Buggy submission (verdict: Runtime Error):
X = int(input())
from sympy import sieve
L = [i for i in sieve.primerange(X,10**5)]
print(L[0])

Buggy submission (verdict: Runtime Error):
X = map(int,input().split())
from sympy import sieve
L = [i for i in sieve.primerange(X,23)]
print(L[0])
Problem p02820 (python)

Fixed submission:
N,K = map(int,input().split())
R,S,P = map(int,input().split())
T = str(input())
i = 0
point = 0
L = [""]*N
for i in range(N):
  if T[i] == "r": 
    if i >= K and L[i-K] == "p":
      pass
    else:
      point += P
      L[i] = "p"
  elif T[i] == "s":
    if i >= K and L[i-K] == "r":
      pass
    else:
      point += R
      L[i] = "r"
  elif T[i] == "p":
    if i >= K and L[i-K] == "s":
      pass
    else:
      point += S
      L[i] = "s"
  else:
    break
print(point)

Buggy submission (verdict: Runtime Error):
N,K,R,S,P = map(int,input().split())
T = str(input())
i = 0
point = 0
for i in range(N):
  if T[i] == "r" and T[K] != "p":
    point += P
  elif T[i] == "s" and T[K] != "r":
    point += R
  elif T[i] == "p" and T[K] != "s":
    point += S
  else:
    break
  i += 1
print(point)

Buggy submission (verdict: Runtime Error):
N,K,R,S,P = map(int,input().split())
T = map(str,input())
i = 0
point = 0
for i in range(N):
  if T[i] == "r" and T[K] != "p":
    point += P
  elif T[i] == "s" and T[K] != "r":
    point += R
  elif T[i] == "p" and T[K] != "s":
    point += S
  else:
    break
  i += 1
print(point)

Buggy submission (verdict: Runtime Error):
N,K,R,S,P = map(int,input().split())
T = str(input())
point = 0
for i in range(N):
  if T[i] == "r" and T[K] != "p":
    point += P
  elif T[i] == "s" and T[K] != "r":
    point += R
  elif T[i] == "p" and T[K] != "s":
    point += S
  else:
    break
  i += 1
print(point)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
C = [1,2,3]
C.remove(A)
C.remove(B)
print(C[0])

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = [1,2,3]
if A,B <=3 and A != B:
  C.remove(A)
  C.remove(B)
  print(C)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
C = [1,2,3]
C.remove(A)
C.remove(B)
print(C)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
C = [1,2,3]
ans = C.remove(A,B)
print(ans)
Problem p02831 (python)

Fixed submission:
from fractions import gcd
A,B = map(int,input().split())
lcm = A * B // gcd(A, B)
print(lcm)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
for i in range(1,10**5):
  if i%A == 0 and i%B == 0:
    ans = i
    break
  else:
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = (map(int,input().split())
for i in range(1,10**5):
  if i%A == 0 and i%B == 0:
    ans = i
    break
  else:
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
for i in range(1,10**5):
  if i%A == 0 and i%B == 0:
    ans = i
    break
  else:
    i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
for i in range():
  if i%A == 0 and i%B == 0:
    ans = i
  else:
    i += 0
print(ans)

Buggy submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
list_ans = []
for i in range():
  if i%A == 0 and i%B == 0:
    ans = i
  else:
    i += 0
print(ans)
Problem p02832 (python)

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

for i in range(N):
  if j == a[i]:
    j += 1
if j == 1:
  print(-1)
else:
  print(N-j+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(N):
  while i+1 != a[i]:
    a.pop(i)
    count += 1
    if a == []:
      print(-1)
      exit()
  if len(a) == a[-1]:
    print(count)
    exit()

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
count = 0
for i in range(len(a)):
  while i+1 != a[i]:
    a.pop(i)
    count += 1
    if a == []:
      print(-1)
      exit()
  if len(a) == a[-1]:
    print(count)
    exit()

Buggy submission (verdict: Runtime Error):
N =int(input())
a =map(int,input())
count = 1
ans = 0
for i in a:
  if i == count:
    count += 1
    ans += 1
if ans == 0:
  print(-1)
else:
  print(min(N - 1, N - ans))

Buggy submission (verdict: Runtime Error):
N =int(input())
a =int(input())
count = 1
ans = 0
for i in a:
  if i == count:
    count += 1
    ans += 1
if ans == 0:
  print(-1)
else:
  print(min(N - 1, N - ans))
Problem p02835 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b+c <= 21:
  print("win")
else:
  print("bust")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
if a+b+c <= 21:
  print("win")
else:
  print("bust")
Problem p02881 (python)

Fixed submission:
N = int(input())
count = 0
for i in range(int(N**0.5),0,-1):
  if N % i == 0:
    count = i + (N//i)
    break
print(count-2)

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = []
dp[0] = 0
i = 1
j = 1
for k in range(1,N):
  dp[k] = max(i+1*j,i*j+1)
  if max(i+1*j,i*j+1) == i+1*j:
    i += 1
  elif max(i+1*j,i*j+1) == i*j+1:
    j += 1
  if N == dp[k]:
    print(k)
    break
Problem p02987 (python)

Fixed submission:
S = str(input())
S = sorted(S)
if S.count(S[0]) == 2 and S.count(S[2]) == 2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
S = S.sort()
if S.count(S[0]) == 2 and S.count(S[2]) == 2:
  print("Yes")
else:
  print("No")
Problem p03017 (python)

Fixed submission:
N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E]
BD = S[B-2:D+1]
if "##" in AE:
  print("No")
elif C > D and "..." not in BD:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E+1]
BD = S[B-2:D+1]
check = 0
if "##" in AE:
  check = 1
  break
else:
  check = 0
if check == 0 and C > D:
  if "..." in BD:
    check = 0
  else:
    check = 1
    break
if check == 0
  print("OK")
else:
  print("MISS")
Problem p03038 (python)

Fixed submission:
N,M = map(int,input().split())
A = list(map(int,input().split()))
BC = [(A[i], 1) for i in range(N)]
for _ in range(M):
    B, C = map(int, input().split())
    BC.append((C,B))
BC = sorted(BC,reverse = True)
ans = 0
a = 0
count = N
for c,b in BC:
  lamb = min(count,b)
  ans += c * lamb
  count -= lamb

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)]
ans = []
A.sort()
count = 0
for b,c in BC:
    if c <= A[b]:
      break
    ans += [c]*b
    count += b
ans.extend(A)
ans = sorted(ans,reverse = True)
print(sum(ans[:N]))

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)]
ans = [0]*(10**10)
A.sort()
count = 0
for b,c in BC:
    ans[count:b] = [c]*b
    count += b
ans.extend(A)
ans = sorted(ans,reverse = True)
print(sum(ans[:N]))

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)]
ans = [0]*(N*M)
A.sort()
count = 0
for b,c in BC:
    ans[count:b] = [c]*b
    count += b
ans.extend(A)
ans = sorted(ans,reverse = True)
print(sum(ans[:N]))
Problem p03041 (python)

Fixed submission:
N,K = map(int,input().split())
S = list(str(input()))
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S[K-1] == 'B':
  S[K-1] = 'b'
else:
  S[K-1] = 'c'
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = str(input())
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S[K-1] == 'B':
  S[K-1] = 'b'
else:
  S[K-1] = 'c'
print(S)
Problem p03053 (python)

Fixed submission:
import numpy
import sys
input = sys.stdin.readline
H,W = map(int,input().split())
INF = H * W
S = numpy.array([[INF if i == '.' else 0 for i in input().strip()] for _ in range(H)])

for h in range(1, H):
    S[h, :] = numpy.minimum(S[h,:],S[h-1,:] + 1)
for h in range(H - 2, -1, -1):
    S[h, :] = numpy.minimum(S[h,:],S[h+1,:] + 1)
for w in range(1, W):
    S[:, w] = numpy.minimum(S[:,w],S[:,w-1] + 1)
for w in range(W - 2, -1, -1):
    S[:, w] = numpy.minimum(S[:,w],S[:,w+1] + 1)

print(numpy.max(S))

Buggy submission (verdict: Runtime Error):
import numpy
import sys
input = sys.stdin.readline
H,W = map(int,input().split())
INF = H * W
S = numpy.array([[INF if i == '.' else 0 for i in input().strip()] for _ in range(H)])

for h in range(1, H):
    S[h, :] = numpy.minimum(S[h,:],S[h-1,:] + 1)
for h in range(H - 2, -1, -1):
    S[h, :] = numpy.minimum(S[h,:],S[h+1,:] + 1)
for w in range(1, W):
    S[:, w] = numpy.minimum(S[:,w],S[:,w-1] + 1)
for w in range(w - 2, -1, -1):
    S[:, w] = numpy.minimum(S[:,w],S[:,w+1] + 1)

print(numpy.max(S))

Buggy submission (verdict: Runtime Error):
import numpy

H,W = map(int,input().split())
INF = H * W
S = numpy.array([[INF if i == '.' else 0 for i in input().strip()] for _ in range(H)])

for h in range(1, H):
    S[h, :] = numpy.minimum(S[h,:],S[h-1,:] + 1)
for h in range(H - 2, -1, -1):
    S[h, :] = numpy.minimum(S[h,:],S[h+1,:] + 1)
for w in range(1, W):
    S[:, w] = numpy.minimum(S[:,w],S[:,w-1] + 1)
for w in range(w - 2, -1, -1):
    S[:, w] = numpy.minimum(S[:,w],S[:,w+1] + 1)

print(numpy.max(S))
Problem p03107 (python)

Fixed submission:
S = str(input())
zero = 0
one = 0
for i in S:
  if i == "0":
    zero += 1
  else:
    one += 1
ans = min(zero,one)*2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
S = str(input())
SC = Counter(S)
v,c = zip(*SC.most_common())
print(len(S) - abs(c[1]-c[0]))
Problem p03137 (python)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
x = []
ans = 0
X.sort()
if N >= M:
  print(0)
  exit()
for i in range(M-1):
  x.append(abs(X[i]-X[i+1]))
xx = sorted(x,reverse=True)
for j in range(N-1):
  xx[j] = 0
ans = sum(xx)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int,input().split())
X = list(map(int,input().split()))
x = []
ans = 0
X.sort()
for i in range(M-1):
  x.append(abs(X[i]-X[i+1]))
xx = sorted(x,reverse=True)
for j in range(math.ceil(N/2)):
  xx.pop(0)
ans = sum(xx)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N,M = map(int,input().split())
X = list(map(int,input().split()))
x = []
count = 0
ans = 0
X.sort()
if N >= M:
  print(0)
for i in range(M-1):
  x.append(abs(X[i]-X[i+1]))
xx = sorted(x,reverse=True)
for j in range(math.ceil(N/2)):
  xx.pop(0)
ans = sum(xx)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
X = list(map(int,input().split()))
x = []
count = 0
ans = 0
X.sort()
if N >= M:
  print(0)
for i in range(M-1):
  x.append(abs(X[i]-X[i+1]))
xx = sorted(x,reverse=True)
for j in range(N//2):
  xx.pop(j)
ans = xx[-1] - xx[0]
print(ans)