Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
v=list(map(int,input().split()))

ans=0

for a in range(50):
  for b in range(50):
    if a+b <= min(n,k):
      li=v[:a]+v[n-b:]
      sumv = sum(li)
      li.sort()
      for i in range(min(k-a-b,len(li))):
        if li[i] < 0:
          li[i] = 0:
        else:
          break:
      ans=max(ans,sum(li))
      
print(ans)
            
      

Fixed submission:
n,k=map(int,input().split())
v=list(map(int,input().split()))
 
ans=0
 
for a in range(50):
  for b in range(50):
    if a+b <= min(n,k):
      li=v[:a]+v[n-b:]
      sumv = sum(li)
      li.sort()
      for i in range(min(k-a-b,len(li))):
        if li[i] < 0:
          li[i] = 0
        else:
          break
      ans=max(ans,sum(li))
      
print(ans)
Buggy python submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i range(10):
  x=r*x-d
  print(x)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Buggy python submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i range(10):
  x=rx-d
  print(x)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)
Buggy python submission (verdict: Runtime Error):
minlist=[]
maxlist=[]

n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=max(minlist)-min(maxlist)
if(diff>=0):
  ans=diff+1
else:
  ans=0
print(ans)

Fixed submission:
minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
minlist=[]
maxlist=[]

n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=max(linlist)-min(maxlist)
if(diff>=0):
  ans=diff+1
else:
  ans=0
print(ans)

Fixed submission:
minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=max(linlist)-min(maxlist)
if(diff>=0):
  ans=diff+1
else:
  ans=0
print(ans)

Fixed submission:
minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
ans=0
dif=max(l)-min(r)
if(diff>=0):
  ans=diff+1
else:
  ans=0
print(ans)

Fixed submission:
minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
ans=0
dif=max(l)-min(r)
if(diff>=0):
  ans=diff+1
else:
  ans=0


Fixed submission:
minlist=[]
maxlist=[]
 
n,m=map(int,input().split())
for i in range(m):
  l,r=list(map(int,input().split()))
  minlist.append(l)
  if r>0:
    maxlist.append(r)
ans=0
dif=min(maxlist)-max(minlist)
if(dif>=0):
  ans=dif+1
else:
  ans=0
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
for i in range(n):
  s=list(map(int,input().split()))
s[k].lower()
for i in range(n):
  print(s[i],end="")

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[0:k-1]+s[k-1].lower()+s[k:])
Buggy python submission (verdict: Runtime Error):
n=int(input())
xlist=[]
ylist=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
  if v[i]>c[i]:
    xlist.append(v[i])
    ylist.append(c[i])
ans=sum(xlist)-sum(ylist)
print(ans)

Fixed submission:
a,b,t=map(int,input().split())
ans=int(((t+0.5)//a)*b)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,t=map(input().split())
ans=0.0
ans=int(((t+0.5)//a)*b)
print(ans)

Fixed submission:
a,b,t=map(int,input().split())
ans=int(((t+0.5)//a)*b)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
ans=0
ans=(((t+0.5)//a)*b
print(int(ans))

Fixed submission:
a,b,t=map(int,input().split())
ans=int(((t+0.5)//a)*b)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,t=map(input().split())
ans=0
ans=int(((t+0.5)//a)*b)
print(ans)

Fixed submission:
a,b,t=map(int,input().split())
ans=int(((t+0.5)//a)*b)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=map(int,input().split())
xlist=[]
ylist=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
  if v[i]>c[i]:
    xlist.append(v[i])
    ylist.append(c[i])
ans=sum(xlist)-sum(ylist)
print(ans)

Fixed submission:
n=int(input())
xlist=[]
ylist=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
  if v[i]>c[i]:
    xlist.append(v[i])
    ylist.append(c[i])
ans=0
ans=sum(xlist)-sum(ylist)
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a%2==1)&&(b%2==1):
  print('Odd')
else:
  print('Even')
  

Fixed submission:
a,b=map(int,input().split())
if (a%2==1)and(b%2==1):
  print('Odd')
else:
  print('Even')
Buggy python submission (verdict: Runtime Error):
N=int(input())
t=0
x=0
y=0
for i in range(N):
    t_next,x_next,y_next=map(int,input().split())
    zikan=t_next - t
    kyori=abs(x_next-x)+abs(y_next-y)
    if kyori>zikan or (zikan-kyori)%2==1:
        print('NO')
        exit(0)
    t,x,y=t_next,x_next,y_next
print('YES')

Fixed submission:
import re
s=input()
s=s[::-1]
#print(s)

#dream|dreamer|erase|eraser

#maerd|remaerd|esare|resare
t=re.split('maerd|remaerd|esare|resare', s)
#print(len(t))
#print(t.count(''))
if len(t)==t.count(''):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n, max_dist = int(input())
points = 0

for _ in range(n):
  x, y = int(input())
  dist = sqrt(x * x + y * y)
  
  if dist <= max_dist:
    points += 1
	
print(points)

Fixed submission:
import math

n, max_dist = input().split()

points = 0

for _ in range(int(n)):
    x, y = input().split()
    x = int(x)
    y = int(y)

    dist = math.sqrt(x * x + y * y)

    if dist <= float(max_dist):
        points += 1

print(points)

Buggy python submission (verdict: Runtime Error):
n, max_dist = int(input().split())

points = 0

for _ in range(n):
  x, y = int(input().split())
  
  dist_origin = sqrt(x * x + y * y)
	if dist_origin <= max_dist:
    	points += 1
        
print(points)


Fixed submission:
import math

n, max_dist = input().split()

points = 0

for _ in range(int(n)):
    x, y = input().split()
    x = int(x)
    y = int(y)

    dist = math.sqrt(x * x + y * y)

    if dist <= float(max_dist):
        points += 1

print(points)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())
s = 0
for i in range(0,n):
    for j in range(0,n):
        for k in range(0, n):
            s += math.gcd(i+1, math.gcd(j+1, k+1))
print(s)

Fixed submission:
import math
n = int(input())
s = 0
for i in range(0,n):
    for j in range(0,n):
        for k in range(0, n):
            s += math.gcd(i+1, math.gcd(j+1, k+1))
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())

D=7
for i in range(10000000):
    if D%K==0:
        print(i+1)
        break
#    print(D)
    D=D*10+7
    D%=K
else:
    print(-1)


Fixed submission:
K=int(input())

D=7
for i in range(1000000):
    if D%K==0:
        print(i+1)
        break
#    print(D)
    D=D*10+7
    D%=K
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
7 2 5
3


Fixed submission:
import sys

def check(r,g,b):
    return r<g and g<b

r,g,b=input().split()
r,g,b=int(r),int(g),int(b)

K=int(input())+1

#print(r,g,b,K)

for i in range(K):
    for j in range(K-i):
        for k in range(K-i-j):
            if check(r*2**(i),g*2**(j),b*2**(k)):
                print("Yes")
                sys.exit(0)
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

sum_A = [0]*N
sum_A_k = 1
for i in range(K):
  sum_A_k = sum_A_k*A[i]
sum_A[K-1] = sum_A_k

for i in range(N-K):
  sum_A[K+i] = sum_A[K-1+i]*A[K+i]/A[i]
  if sum_A[K+i] > sum_A[K-1+i]:
    print('Yes')
  else:
    print('No')

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

for i in range(N-K):
  if A[K+i]/A[i] > 1:
    print('Yes')
  else:
    print('No')

# sum_A = [0]*N
# sum_A_k = 1
# for i in range(K):
#   sum_A_k = sum_A_k*A[i]
# sum_A[K-1] = sum_A_k

# for i in range(N-K):
#   sum_A[K+i] = sum_A[K-1+i]*A[K+i]/A[i]
#   if sum_A[K+i] > sum_A[K-1+i]:
#     print('Yes')
#   else:
#     print('No')
Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
c = [input() for i in range(H)]
max_num = count_num(c)

ans = 0
for h in range(2**H):
  for w in range(2**W):
    cnt = 0
    for i in range(H):
      for j in range(W):
        if (h >> i) & 1:
          continue
        if (w >> j) & 1:
          continue
        if c[i][j] == '#'
          cnt +=1
    if cnt == K:
      ans +=1
print(ans) 

Fixed submission:
H, W, K = map(int, input().split())
c = [input() for i in range(H)]

ans = 0
for h in range(2**H):
  for w in range(2**W):
    cnt = 0
    for i in range(H):
      for j in range(W):
        if (h >> i) & 1:
          continue
        if (w >> j) & 1:
          continue
        if c[i][j] == '#':
          cnt +=1
    if cnt == K:
      ans +=1
print(ans)

Buggy python submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
c = [input() for i in range(H)]
max_num = count_num(c)

ans = 0
for h in range(2**H):
  for w in range(2**W):
    cnt = 0
    for i in range(H):
      for j in range(W):
        if (h >> i) & 1:
          continue
        if (w >> j) & 1:
          continue
        if x[i][j] == '#'
          cnt +=1
    if cnt == K:
      ans +=1
print(ans) 

Fixed submission:
H, W, K = map(int, input().split())
c = [input() for i in range(H)]

ans = 0
for h in range(2**H):
  for w in range(2**W):
    cnt = 0
    for i in range(H):
      for j in range(W):
        if (h >> i) & 1:
          continue
        if (w >> j) & 1:
          continue
        if c[i][j] == '#':
          cnt +=1
    if cnt == K:
      ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

ans = 'NO'
distance = abs(B-A)

t = distance/(V-W)

if 0 < t <= T:
  ans = 'YES'

print(ans)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

ans = 'NO'
distance = abs(B-A)
if V == W:
  pass
else:
  t = distance/(V-W)
  if 0 < t <= T:
    ans = 'YES'

print(ans)

Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

ans = 'NO'
t = (B-A)/(V-W)

if 0 < t <= T:
  ans = 'YES'

print(ans)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

ans = 'NO'
distance = abs(B-A)
if V == W:
  pass
else:
  t = distance/(V-W)
  if 0 < t <= T:
    ans = 'YES'

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())

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

ans = 0
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += gcd(i,j,k)
      # print(f'i,j,k:{i},{j},{k}, ans:{gcd(i,j,k)}')
print(ans)

Fixed submission:
import math
from functools import reduce

K = int(input())

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

ans = 0
for i in range(1,K+1):
  for j in range(i,K+1):
    for k in range(j,K+1):
      if i == j  == k:
        ans += gcd(i,j,k)
      elif i == j or j == k:
        ans += 3*gcd(i,j,k)
      else:
        ans += 6*gcd(i,j,k)
      # print(f'i,j,k:{i},{j},{k}, ans:{gcd(i,j,k)}')
print(ans)
Buggy python submission (verdict: Runtime Error):
, M = map(int, input().split())
A = list(map(int, input().split()))

cnt = 0
th = sum(A)/(4*M)

for i in range(len(A)):
  if A[i] >= th:
    cnt += 1

ans = 'Yes' if cnt >= M else 'No'
print(ans)

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

cnt = 0
th = sum(A)/(4*M)

for i in range(len(A)):
  if A[i] >= th:
    cnt += 1

ans = 'Yes' if cnt >= M else 'No'
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for e in sys.stdin:
  c.append(list(map(int, e.split())))

ans = min(a) + min(b)

for i in range(len(c)):
  temp_val = a[c[i][0]] + b[c[i][1]] - c[i][2]
  if temp_val < ans:
    ans = temp_val

print(ans)

Fixed submission:
import sys

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
for e in sys.stdin:
  c.append(list(map(int, e.split())))

ans = min(a) + min(b)

for i in range(len(c)):
  temp_val = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
  if temp_val < ans:
    ans = temp_val

print(ans)
Buggy python submission (verdict: Runtime Error):
S = inpit()

ans = 'Yes'

if (S == 'AAA') or (S=='BBB'):
  ans = 'No'
  
print(ans)

Fixed submission:
S = input()

ans = 'Yes'

if (S == 'AAA') or (S=='BBB'):
  ans = 'No'
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []

for i in range(N):
  S.append(input())

set_S = list(set(S))
ans = []
max_cnt = 0
for i in range(len(set_S)):
  cnt = 0
  for j in range(N):
    if set_S[i] == S[j]:
      cnt += 1
  if max_cnt <= cnt:
    max_cnt = cnt
    temp = [set_S[i],cnt]
    ans.append(temp)

ans_f = []

for i in range(len(ans)):
  if ans[i][1] == max_cnt:
    ans_f.append(ans[i][0])

ans_f.sort()

for i in range(len(ans_f)):
  print(ans_f[i])

Fixed submission:
N = int(input())

d = {}

for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
    d[S] = 1

m = max(d.values())

for s in sorted(k for k in d if d[k] == m):
  print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

S = []

for i in range(N):
  S.append(input())

set_S = list(set(S))
ans = []
for i in range(len(set_S)):
  cnt = 0
  for j in range(N):
    if set_S[i] == S[j]:
      cnt += 1
  temp = [set_S[i],cnt]
  ans.append(temp)

max_cnt = 0
for i in range(len(set_S)):
  if ans[i][1] > max_cnt:
    max_cnt = ans[i][1]

ans_f = []

for i in range(len(set_S)):
  if ans[i][1] == max_cnt:
    ans_f.append(ans[i][0])

ans_f.sort()

for i in range(len(ans_f)):
  print(ans_f[i])

Fixed submission:
N = int(input())

d = {}

for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
    d[S] = 1

m = max(d.values())

for s in sorted(k for k in d if d[k] == m):
  print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

ans = [0]*N
for i in range(N):
  if min(P[0:i+1]) >= P[i]:
    ans[i] = 1

print(sum(ans))

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

ans = [0]*N
min_cal = [0]*N
min_cal[0] = P[0]

for i in range(N-1):
  min_cal[i+1] = min(min_cal[i],P[i+1])

for i in range(N):
  if min_cal[i] >= P[i]:
    ans[i] = 1

print(sum(ans))
Buggy python submission (verdict: Runtime Error):
A, B, K= map(int, input().split())

if A >= K:
  ans_t = A - K
  ans_a = B
elif B >= ( K - A):
  ans_t = 0
  ans_a = B - ( K - A)
else:
  ans_t = 0
  ans_a = 0

print( ’{} {}’.format( ans_t, ans_a))


Fixed submission:
A, B, K= map(int, input().split())
 
if A >= K:
  ans_t = A - K
  ans_a = B
elif B >= ( K - A):
  ans_t = 0
  ans_a = B - ( K - A)
else:
  ans_t = 0
  ans_a = 0
 
print( '{} {}'.format( ans_t, ans_a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())

for i in range(q):
  b, c = map(int, input().split())
  a = [c if i == b else i for i in a]
  print(sum(a))

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
q = int(input())
ans = sum(a)

for i in range(q):
  b, c = map(int, input().split())
  ans += (c - b) * count[b]
  count[c] += count[b]
  count[b] = 0
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [] * n

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

ans = 1

for i in range(n):
  ans *= a[i]
  
if ans > 10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = int(input())
a = [] * n
ans = 1

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

if a.count(0) > 0:
  ans = 0
else:
  for i in range(n):
    if ans > 10**18:
      break
    else:
      ans *= a[i]

if ans == 0:
  print(ans)
elif ans > 10**18:
  print(-1)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
lst = []

for i in range(1,max(a)+1):
  count = a.count(i)
  lst.append(count)
lst.append(0)

for i in range(n):
  print(lst[i])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n

for i in range(n-1):
  ans[a[i]-1] += 1

for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
lst = []

for i in range(1,n):
  count = a.count(i)
  lst.append(count)
lst.append(0)

for i in range(n):
  print(lst[i])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n

for i in range(n-1):
  ans[a[i]-1] += 1

for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, x, y = map(int, input().split())
num_list = list(range(1,n+1))

ans_list = []

for i in range(1, n):
  for j in range(2, n+1):
    ans1 = j - i
    ans2 = abs(x-i) + 1 + abs(y-j)
    ans = min(ans1, ans2)
    ans_list.append(ans)

for i in range(1, n):
  print(ans_list.count(i))

Fixed submission:
n, x, y = map(int, input().split())
num_list = list(range(1,n+1))

ans_list = [0] * (n-1)

for i in range(1, n):
  for j in range(i+1, n+1):
    ans = min(j - i, abs(x-i) + 1 + abs(y-j))
    ans_list[ans-1] += 1

for i in range(n-1):
  print(ans_list[i])
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

for i in range(min(x+y, len(r))):
  if min(p) >= min(q) and r[0] > min(q):
    heapq.heapify(q)
    heapq.heappop(q)
    q.append(r[0])
    r.pop(0)
  elif min(q) >= min(p) and r[0] > min(p):
    heapq.heapify(p)
    heapq.heappop(p)
    p.append(r[0])
    r.pop(0)

print(sum(p) + sum(q))

Fixed submission:
import heapq

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

pqr = p + q + r
pqr = sorted(pqr, reverse = True)[:x+y]

print(sum(pqr))

Buggy python submission (verdict: Time Limit Exceeded):
x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

for i in range(min(x+y, len(r))):
  if p[x-1] >= q[y-1] and r[0] > q[y-1]:
    q.pop(y-1)
    q.append(r[0])
    r.pop(0)
    q = sorted(q, reverse = True)
  elif q[y-1] >= p[x-1] and r[0] > p[x-1]:
    p.pop(x-1)
    p.append(r[0])
    r.pop(0)
    p = sorted(p, reverse = True)

print(sum(p) + sum(q))

Fixed submission:
import heapq

x,y,a,b,c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p = sorted(p, reverse = True)[:x]
q = sorted(q, reverse = True)[:y]
r = sorted(r, reverse = True)

pqr = p + q + r
pqr = sorted(pqr, reverse = True)[:x+y]

print(sum(pqr))
Buggy python submission (verdict: Runtime Error):
import math
h, w = map(int, input().split())

if h == 1 or w == 1:
  print(1)
elif h % 2 == 0 or w % 2 ==0:
  print(int((h * w) // 2))
else:
  print(int(math.ceil((h * w) // 2)))

Fixed submission:
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k-1])
Buggy python submission (verdict: Runtime Error):
import math

N, A, B = map(int, input().split())
x = math.floor(N // (A + B))
y = N % (A + B)

print(A * x + min(A, y))

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S = input()
if S[1] == S[2] and S[2] == S[3]:
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
S = input()
if N[1] == N[2] and N[2] == N[3]:
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
N = input()
if N[1] == N[2] and N[2] == N[3]:
  print("No")
else:
  print("Yes")

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
print("YES" if len(set(A)) = N, else "NO")

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

if len(set(A)) < len(A):
  print("NO")
else:
  print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

if len(h) <= k:
  ans = 0
else:
  while k > 0:
    h.remove(max(h))
    k -= 1
  ans = sum(h)
  
print(ans)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))

h = sorted(h, reverse = True)
h = h[k:]
print(sum(h))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for i in range(K):
  if A >= 1:
    A -= 1
  elif B >= 1:
    B -= 1

print(A, B)

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

if A >= K:
  print(A - K, B)
elif A + B >= K:
  print(0, A + B - K)
else:
  print(0, 0)
Buggy python submission (verdict: Runtime Error):
x = [input() for i in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0
for t in range(N):
    if x[t] == 'AC':
        AC += 1
    elif x[t] == 'WA':
        WA += 1
    elif x[t] == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC x',AC)
print('WA x',WA)
print('TLE x',TLE)
print('RE x',RE)

Fixed submission:
N = int(input())
x = [input() for i in range(N)]
AC = 0
WA = 0
TLE = 0
RE = 0
for t in range(N):
    if x[t] == 'AC':
        AC += 1
    elif x[t] == 'WA':
        WA += 1
    elif x[t] == 'TLE':
        TLE += 1
    else:
        RE += 1
print('AC x',AC)
print('WA x',WA)
print('TLE x',TLE)
print('RE x',RE)