Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,Y = map(int, input().split())

Flag=False
for x in range(N+1):
    for y in range(N+1):
        for z in range(N+1):
            if 10000*x+5000*y+1000*z==Y and x+y+z==N:
                print(str(x)+' '+str(y)+' '+str(z))
                Flag=True
                break
        if Flag:
            break
    if Flag:
        break

if Flag==False:
    print('-1 -1 -1')


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

Flag=False
for x in range(N+1):
    for y in range(N+1):
        z=N-x-y
        if 10000*x+5000*y+1000*z==Y and z>=0:
            print(str(x)+' '+str(y)+' '+str(z))
            Flag=True
            break
    if Flag:
        break

if Flag==False:
    print('-1 -1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(i) for i in input().split()]

ans = 0
for a in set(A):
    cnt = A.count(a)
    if a == cnt: continue
    elif a < cnt: ans += cnt-a
    elif a > cnt: ans += cnt
print(ans)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
a.sort()

ans = 0
cnt = 1

if n ==1:
    if a[0] == 1: 
        print(0)
        exit()
    else:
        print(1)
        exit()
 

for i in range(n-1):
    if a[i] == a[i+1]:cnt+=1
    else:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
        cnt = 1
    if i+1 == n-1:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(i) for i in input().split()]

ans = 0
for a in set(A):
    if a == A.count(a): continue
    elif a < A.count(a): ans += A.count(a)-a
    elif a > A.count(a): ans += A.count(a)
print(ans)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
a.sort()

ans = 0
cnt = 1

if n ==1:
    if a[0] == 1: 
        print(0)
        exit()
    else:
        print(1)
        exit()
 

for i in range(n-1):
    if a[i] == a[i+1]:cnt+=1
    else:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
        cnt = 1
    if i+1 == n-1:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
A=[int(i) for i in input().split()]

ans = 0
for a in set(A):
    if a == A.count(a): continue
    elif a < A.count(a): ans += A.count(a)-a
    elif a > A.count(a): ans += A.count(a)
print(ans)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
a.sort()

ans = 0
cnt = 1

if n ==1:
    if a[0] == 1: 
        print(0)
        exit()
    else:
        print(1)
        exit()
 

for i in range(n-1):
    if a[i] == a[i+1]:cnt+=1
    else:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
        cnt = 1
    if i+1 == n-1:
        if cnt < a[i]: ans += cnt
        elif cnt > a[i]: ans += cnt-a[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int,input().split())

ans = 0
for n in range(N+1):
    temp = n
    sum = 0
    while (temp>=1):
            sum += temp%10
            temp = int(temp/10)

    if A <= sum <= B:
        ans += n

print(ans)


Fixed submission:
import numpy as np

input()
A = np.array(list(map(int, input().split())))

ans = 0
while(all(A%2==0)):
    A = A/2
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c=input()
print("yes" if a==c, else "No")

Fixed submission:
a,b,c=input()
print("Yes" if a==c else "No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
T=[]
for _ in range(n):
    t = int(input())
    T.append(t)

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

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

for i in range(n-1):
    ans=lcm(T[i], T[i+1])

print(ans)

Fixed submission:
n=int(input())
T=[]
for _ in range(n):
    t = int(input())
    T.append(t)

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

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

ans = T[0]
for i in range(1,n):
    ans=lcm(ans, T[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
if (a=="H" and b=="H") or (a=="D" and b=="D"):
  print(H)
  else:
    print(D)

Fixed submission:
a,b=input().split()
if (a=="H" and b=="H") or (a=="D" and b=="D"):
    print("H")
else:
    print("D")
Buggy python submission (verdict: Runtime Error):
# Your code here!
I =int(input())


if I>=500:
    J=I//500
    
    K=J*500*2#
    
    
    P=I-500*J
    
    if P>=5:
        Q=P//5
        R=Q*5#
        
        A=K+R
print(A)

Fixed submission:
# coding: utf-8
# Your code here!
I =int(input())


# if I ==0:
#     print(I)
    
if I>=500:
    J=I//500
    
    K=J*500*2#
    
    
    P=I-500*J
    if P==0:
        print(K)
    
    if P>=5:
        Q=P//5
        R=Q*5#
        
        A=K+R
        print(A)

if I<500:
        M=I//5
        A=M*5#
        
        
        print(A)
Buggy python submission (verdict: Runtime Error):
A=str(input()

if A[0]==A[1] and A[1]==A[2]:
    print("No")
if A[0]!=A[1] or A[1]!=A[2]:
     print("Yes")

Fixed submission:
# coding: utf-8
A=input()

if A[0]==A[1] and A[1]==A[2]:
    print("No")
if A[0]!=A[1] or A[1]!=A[2]:
     print("Yes")
Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]

S = N//(A+B)*A

S = S+(N%S,A)
print(S)

Fixed submission:
N, A, B = [int(i) for i in input().split()]
S = A+B
c = (N//S)*A
 
c += min(N%S,A)
print(c)
Buggy python submission (verdict: Runtime Error):
S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC
print(Ans)

Fixed submission:
S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC"
print(Ans)
Buggy python submission (verdict: Runtime Error):
(S,W)=input()
if S<=W:
  print("unsafe")
else:
  print("safe")

Fixed submission:
(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy python submission (verdict: Runtime Error):
s=int(input())
w=int(input())
if w >= s:
  print("unsafe")
else:
  print("safe")

Fixed submission:
(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy python submission (verdict: Runtime Error):
S=int(input())
W=int(input())
if S<=W:
  print("unsafe")
else:
  print("safe")

Fixed submission:
(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")

Buggy python submission (verdict: Runtime Error):
if S<=W:
  print("unsafe")
else:
  print("safe")

Fixed submission:
(S,W)=input().split()
S=int(S)
W=int(W)
if S<=W:
  print("unsafe")
else:
  print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
# 5 
# 1 1 2 2

# 5人の部下
# 社員番号 2の社員の直属の上司の社員番号が 1, 社員番号 3の社員の直属の上司の社員番号が 1, 社員番号 4の社員の直属の上司の社員番号が 2, 社員番号 5の社員の直属の上司の社員番号が 2,
 

N = int(input())

AnStr = input().split(' ')
zyosiList = []
for v in AnStr:
  zyosiList.append(int(v))

for i in range(1, N + 1):
  print(zyosiList.count(i))

Fixed submission:
N = int(input())

AnStr = input().split(' ')
zyosiList = []
a = {}
for v in AnStr:
  zyosiList.append(int(v))
  if v in a:
    a[v] += 1
  else:
    a[v] = 0

for i in range(1, N + 1):
  if str(i) in a:
    print(a[str(i)]+1)
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
# 5 
# 1 1 2 2

# 5人の部下
# 社員番号 2の社員の直属の上司の社員番号が 1, 社員番号 3の社員の直属の上司の社員番号が 1, 社員番号 4の社員の直属の上司の社員番号が 2, 社員番号 5の社員の直属の上司の社員番号が 2,
 

N = int(input())

AnStr = input().split(' ')
zyosiList = []
for v in AnStr:
  zyosiList.append(int(v))

for i in range(1, N + 1):
  print(zyosiList.count(i))

Fixed submission:
N = int(input())

AnStr = input().split(' ')
zyosiList = []
a = {}
for v in AnStr:
  zyosiList.append(int(v))
  if v in a:
    a[v] += 1
  else:
    a[v] = 0

for i in range(1, N + 1):
  if str(i) in a:
    print(a[str(i)]+1)
  else:
    print(0)

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

AnStr = input().split(' ')
zyosiList = []
for v in AnStr:
  zyosiList.append(int(v))

for i in range(1, N + 1):
  print(zyosiList.count(i))

Fixed submission:
N = int(input())

AnStr = input().split(' ')
zyosiList = []
a = {}
for v in AnStr:
  zyosiList.append(int(v))
  if v in a:
    a[v] += 1
  else:
    a[v] = 0

for i in range(1, N + 1):
  if str(i) in a:
    print(a[str(i)]+1)
  else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    arr = []
    ans = []
    for i in range(N):
        arr.append(V[i]-C[i])
    for j in range(1 << N):
        output = []
        for k in range(N):
            if ((j >> k) & 1) == 1:
                output.append(arr[k])
            ans.append(sum(output))
    if max(ans) < 0:
        print(0)
        return
    print(max(ans))
main()

Fixed submission:
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        ans += max(V[i]-C[i], 0)
    print(ans)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    arr = list()
    ans = list()

    for i in range(N):
        arr.append(V[i]-C[i])
    for j in range(1 << N):
        output = []
        for k in range(N):
            if ((j >> k) & 1) == 1:
                output.append(arr[k])
            ans.append(sum(output))
    if max(ans) > 0:
        print(max(ans))
    else:
        print(0)
main()

Fixed submission:
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        ans += max(V[i]-C[i], 0)
    print(ans)
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    arr = list()
    ans = list()
    for i in range(0, N):
        arr.append(V[i]-C[i])
    for j in range(1 << len(arr)):
        output = []
        for k in range(len(arr)):
            if ((j >> k) & 1) == 1:
                output.append(arr[k])
        if len(output) != 0:
            ans.append(sum(output))
    ma_ans = max(ans)
    if ma_ans > 0:
        print(ma_ans)
    else:
        print(0)
main()

Fixed submission:
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        ans += max(V[i]-C[i], 0)
    print(ans)
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def main():
    N, K = map(int, input().split())
    h = []
    for i in range(N):
        h.append(int(input()))

    arr = list(itertools.permutations(h, K))
    res1 = []
    res2 = []
    ans = []
    for j in range(len(arr)):
        res1.append(sorted(arr[j]))

    for k in range(len(res1)):
        res2.append(sorted(res1[k]))

    for l in range(len(res2)):
        ans.append(res2[l][K-1] - res2[l][0])
    print(min(ans))

if __name__ == "__main__":
    main()


Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def main():
    N, K = map(int, input().split())
    h = []
    for i in range(N):
        h.append(int(input()))
    arr = list(itertools.permutations(h, K))
    res1 = []
    res2 = []
    ans = []
    for j in range(len(arr)):
        res1.append(sorted(arr[j]))

    for k in range(len(res1)):
        res2.append(sorted(res1[k]))

    for l in range(len(res2)):
        ans.append(res2[l][K-1] - res2[l][0])
    print(min(ans))
main()


Fixed submission:
N, K = map(int, input().split())
h = [int(input()) for i in range(N)]
h.sort()
print(min(h[i+K-1] - h[i] for i in range(N-K+1)))
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    TA = list(map(int, input().split()))
    T, A = TA[0], TA[1]
    H = list(map(int, input().split()))
    arr = []
    ondo = 0
    for i in range(N):
        ondo = int(T - H[i] * 0.006)
        arr.append([ondo, i+1])
    for j in range(1, N):
        res1 = A - arr[j-1][0]
        res2 = A - arr[j][0]
        if res1 < res2:
            ans = arr[j-i][1]
        else:
            ans = arr[j][1]
    print(ans)
main(

Fixed submission:
def main():
    N = int(input())
    TA = list(map(int, input().split()))
    T, A = TA[0], TA[1]
    H = list(map(int, input().split()))

    temp1 = abs(A - (T - H[0] * 0.006))
    pos = 0

    for i in range(1, N):
        temp2 = abs(A - (T - H[i] * 0.006))
        if temp1 > temp2:
            temp1 = temp2
            pos = i
    print(pos+1)

if __name__  == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import math
ans = 0
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)
print(ans)

Fixed submission:
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import math
ans = 0
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import fractions
import itertools
N = int(input())
A = 0
M = []
T =0
for i in range(1,N+1):
  M.append(i)
for i in itertools.combinations_with_replacement(M, 3):
  tmp1 = list(i)
  tmp2 = fractions.gcd(tmp1[0],tmp1[1])
  tmp3 = fractions.gcd(tmp2,tmp1[2])
  if (tmp1[0]==tmp1[1] and tmp1[0]!=tmp1[2]) or (tmp1[1]==tmp1[2] and tmp1[1]!=tmp1[0]) or (tmp1[2]==tmp1[0] and tmp1[2]!=tmp1[1]):
    A += tmp3*3
  elif tmp1[0] != tmp1[1] and tmp1[0] != tmp1[2] and tmp1[1] != tmp1[2]:
    A += tmp3*6
  else:
    A += tmp3
  T +=1
print(A)

Fixed submission:
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import math
ans = 0
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import fractions
N = int(input())
A = 0
for a in range(1,N+1):
  for b in range(1,N+1):
    n = fractions.gcd(a,b)
    for c in range(1,N+1):
      m = fractions.gcd(n,c)
      A+=m
print(A)

Fixed submission:
#https://atcoder.jp/contests/abc162/tasks/abc162_c
# -*- coding: utf-8 -*-
import math
ans = 0
K = int(input())
for i in range(1,K+1):
  for j in range(1,K+1):
    for k in range(1,K+1):
      ans += math.gcd(math.gcd(i,j),k)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#https://atcoder.jp/contests/abc051/tasks/abc051_b
# -*- coding: utf-8 -*-
K,S = map(int,input().split())
ans = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == S: ans +=1 
print(ans)

Fixed submission:
#https://atcoder.jp/contests/abc051/tasks/abc051_b
# -*- coding: utf-8 -*-
K,S = map(int,input().split())
ans = 0
for i in range(0,K+1):
  for j in range(0,K+1):
    z = S-i-j
    if 0 <= z <= K: ans +=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

if b < n:
    n = b

ans_lst = []
for x in range(1, n+1):
    y = x / b
    ans = int(a*y) - a*int(y)
    ans_lst.append(ans)
print(max(ans_lst))


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

y = n//b
if y == 0:
    x = n
else:
    x = b - 1
print(int(a*x/b) - a*int(x/b))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())

i = 1
cnt = 0
while n > 0:
    if i % 2 != 0:
        if n-a > 0:
            n -= a
            cnt += a
        else:
            cnt += n
            n = 0
    else:
        n -= b
    i += 1

print(cnt)

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

ans = a * (n//(a+b)) + min(n%(a+b), a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())

for i in range(q):
    x = list(input().split())
    if len(x) == 3:
        if x[1] == '1':
            s.insert(0, x[2])
        else:
            s.append(x[2])
    else:
        s = s[::-1]
print(*s, sep='')

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
cnt = 0

for _ in range(q):
    qs = input().split()
    if qs[0] == '1':
        cnt += 1
    else:
        if qs[1] == '1':
            if cnt%2 == 0:
                s.appendleft(qs[2])
            else:
                s.append(qs[2])
        else:
            if cnt%2 == 0:
                s.append(qs[2])
            else:
                s.appendleft(qs[2])
ans = ''.join(s)
print(ans if cnt%2 == 0 else ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math

def f(x, y):
    return math.factorial(x) // (math.factorial(x - y) * math.factorial(y))

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

ans = pow(2, n) - 1
ans = ans - f(n, a) - f(n, b)
ans %= ((10**9)+7)
print(ans)

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

MOD = 10**9 + 7
x = 1
y = 1
ans = pow(2, n, MOD) - 1

for i in range(1, b+1):
    x = x * i % MOD
    y = y * (n-i+1) % MOD
    if i == a or i == b:
        ans -= y * pow(x, MOD-2, MOD)

print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import math

def f(x, y):
    return math.factorial(x) // (math.factorial(x - y) * math.factorial(y))

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

sum = 0
for i in range(n//2):
    x = f(n, i+1)
    sum += x
ans = sum*2+1

if n%2 == 0:
    ans = sum*2+1-x
ans = ans - f(n, a) - f(n, b)
ans %= ((10**9)+7)
print(ans)

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

MOD = 10**9 + 7
x = 1
y = 1
ans = pow(2, n, MOD) - 1

for i in range(1, b+1):
    x = x * i % MOD
    y = y * (n-i+1) % MOD
    if i == a or i == b:
        ans -= y * pow(x, MOD-2, MOD)

print(ans%MOD)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = list(map(int, input().split()))

for i in range(k):
  max_h = h.index(max(h))
  h[max_h] = 0
cnt = sum(h)
print(cnt)

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

h.sort(reverse=True)
del h[:k]
cnt = sum(h)
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
l = list()
for i in range(N):
    a = input()
    if a in l:
        a ==0
    else:
        l.append(a)

print(len(l))


Fixed submission:
N = int(input())
l = list()
for i in range(N):
    a = input()
    l.append(a)

print(len(set(l)))
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
g = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            g += gcd(i,j,k)
print(g)


Fixed submission:
K = int(input())
import math
g = 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 and j == k:
                g += math.gcd(math.gcd(i,j),k)
            elif i == j and j != k:
                g += math.gcd(math.gcd(i,j),k) * 3
            elif i != j and j == k:
                g += math.gcd(math.gcd(i,j),k) * 3
            else:
                g += math.gcd(math.gcd(i,j),k) * 6


print(g)
Buggy python submission (verdict: Runtime Error):
N, K =map(int,input().split())
r = N % K
print(min(r,abs(r-k)))


Fixed submission:
N, K =map(int,input().split())
r = N % K
print(min(r,abs(r-K)))
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()))
d = 0
x = 0
y = 0

while x < X and y < Y:
    a = max(p)
    b = max(q)
    c = max(r)
    if a >= c:
        d += a
        x += 1
        p.remove(a)
    elif b >= c:
        d += b
        y += 1
        q.remove(b)
    elif c > a >= b:
        d += c
        y += 1
        r.remove(c)
    elif c > b > a:
        d += c
        x += 1
        r.remove(c)

while x < X:
    p.extend(r)
    d += max(p)
    x += 1
    p.remove(max(p))
while y < Y:
    q.extend(r)
    d += max(q)
    y += 1
    q.remove(max(q))
print(d)

Fixed submission:
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.sort()
p.reverse()
q.sort()
q.reverse()
del p[X:]
del q[Y:]
p.extend(q)
p.extend(r)
p.sort()
p.reverse()
del p[X+Y:]
d = sum(p)
print(d)

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.sort()
p.reverse()
q.sort()
q.reverse()

d = 0
x = 0
y = 0

while x < X and y < Y:
    a = max(p)
    b = max(q)
    c = max(r)
    if a >= c:
        d += a
        x += 1
        p.remove(a)
    elif b >= c:
        d += b
        y += 1
        q.remove(b)
    elif c > a >= b:
        d += c
        y += 1
        r.remove(c)
    elif c > b > a:
        d += c
        x += 1
        r.remove(c)

while x < X:
    p.extend(r)
    d += max(p)
    x += 1
    p.remove(max(p))
while y < Y:
    q.extend(r)
    d += max(q)
    y += 1
    q.remove(max(q))
print(d)


Fixed submission:
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.sort()
p.reverse()
q.sort()
q.reverse()
del p[X:]
del q[Y:]
p.extend(q)
p.extend(r)
p.sort()
p.reverse()
del p[X+Y:]
d = sum(p)
print(d)
Buggy python submission (verdict: Runtime Error):
S = input()
if S == hi or S == hihi or S == hihihi or S == hihihihi or S == hihihihihi:
    print("Yes")
else:
    print("No")


Fixed submission:
S = input()
if S == "hi" or S == "hihi" or S == "hihihi" or S == "hihihihi" or S == "hihihihihi":
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
A, B, M = map(int,input().split())

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

x = list()
y = list()
c = list()
for i in range(M):
    xi, yi, ci = map(int,input().split())
    x.append(xi)
    y.append(yi)
    c.append(ci)

p = list()

for i in range(A):
    for j in range(B):
        pij = a[i] + b[j]
        p.append(pij)
        
for i in range(M):
    pi = a[x[i]-1] + b[y[i]-1] - c[i]
    p.append(pi)

print(min(p))


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

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

x = list()
y = list()
c = list()
for i in range(M):
    xi, yi, ci = map(int,input().split())
    x.append(xi)
    y.append(yi)
    c.append(ci)

p = list()

amin = min(a)
bmin = min(b)
pab  = amin + bmin
p.append(pab)
        
for i in range(M):
    pi = a[x[i]-1] + b[y[i]-1] - c[i]
    p.append(pi)

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

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