Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(N-K+1):
    ans = max(ans,sum(p[i:i+K]))
print(ans/2+0.5*K)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ans = sum(p[:K])
tmp = ans
for i in range(K,N):
    tmp += p[i]-p[i-K]
    ans = max(ans,tmp)
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
Q = [0]*(N-K+1)
for i in range(N-K+1):
    Q[i] = sum(p[i:i+K])
print(max(Q)/2+0.5*K)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ans = sum(p[:K])
tmp = ans
for i in range(K,N):
    tmp += p[i]-p[i-K]
    ans = max(ans,tmp)
print((ans+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))
Q = [ ((i*(i+1))/2)/i for i in p]
ans = 0

for i in range(N-K+1):
    ans = max(ans,sum(Q[i:i+K]))
print(ans)


Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ans = sum(p[:K])
tmp = ans
for i in range(K,N):
    tmp += p[i]-p[i-K]
    ans = max(ans,tmp)
print((ans+K)/2)
Buggy python submission (verdict: Runtime Error):
A1,A2,A3 = map(int,input().split())
if sum(A1,A2,A3)>21:
    print("bust")
else:
    print("win")

Fixed submission:
A1,A2,A3 = map(int,input().split())
if A1+A2+A3>21:
    print("bust")
else:
    print("win")

Buggy python submission (verdict: Runtime Error):
A1,A2,A3 = map(int,input().split())
if sum(A1,A2,A3)>21:
    print("bust")
else:
    ("win")

Fixed submission:
A1,A2,A3 = map(int,input().split())
if A1+A2+A3>21:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
count = 0
L.sort()
#print(L)
for i in range(N-2):
    a = L[i]
    for j in range(i+1,N-1):
        limit = N
        b = L[j]
        c = L[j+1]

        for k in range(N-1,j,-1):
            if L[k]<a+b:
                limit = k+1
                break

        if abs(b-c)<a<b+c:
            count += (limit-1) - j
        #print(a,b,c,i,j,k,"limit=",limit,"count=",count)

print(count)

Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m = bisect.bisect_right(L,L[j]-L[i])
    if i>m:
      ans += i-m
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list(map(int,input().split()))
count = 0
L.sort()
#print(L)
for i in range(N-2):
    a = L[i]
    for j in range(i+1,N-1):
        limit = N
        b = L[j]
        c = L[j+1]

        #もしどうやっても無理な値を見つけたとき
        for k in range(j+1,N):
            if L[k]>a+b:
                limit = k
                break

        if a<b+c and b<a+c and c<a+b:
            count += (limit-1) - j
            #print(a,b,c,i,j,j+1,"limit=",limit,"count=",count)

print(count)

Fixed submission:
import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

ans = 0
for i in range(1,N-1):
  for j in range(i+1,N):
    m = bisect.bisect_right(L,L[j]-L[i])
    if i>m:
      ans += i-m
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [i+1 for i in range(N-1)]
print(sum(a))

Fixed submission:
N = int(input())
if N%2==0:
    print(N//2+N*((N-1)//2))
elif N%2!=0:
    print(N*(N//2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
for i in range(N):
    print(max(max(A[0:i],A[i+1:])))

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
tmp = max(A)
li = list(A)
li.sort(reverse=True)
if len(li)==1:
    tmp2 = li[0]
else:
    tmp2 = li[1]
for i in range(N):
    if A[i] != tmp:
        print(tmp)
    else:
        print(tmp2)
Buggy python submission (verdict: Time Limit Exceeded):
L,R = map(int,input().split())
r = min(R,L+4038)
ans = 2018
for i in range(L,r+1,1):
    for j in range(i+1,r+1):
        tmp = (i*j)%2019
        ans = min(tmp,ans)
print(ans)


Fixed submission:
L,R = map(int,input().split())
r = min(R,L+4038)
ans = 2018
for i in range(L,r+1,1):
    for j in range(i+1,r+1):
        tmp = (i*j)%2019
        ans = min(tmp,ans)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L,R = map(int,input().split())
r = min(R,L+4038)
ans = 2018
for i in range(L,R+1,1):
    for j in range(i+1,R+1):
        tmp = (i*j)%2019
        ans = min(tmp,ans)
print(ans)

Fixed submission:
L,R = map(int,input().split())
r = min(R,L+4038)
ans = 2018
for i in range(L,r+1,1):
    for j in range(i+1,r+1):
        tmp = (i*j)%2019
        ans = min(tmp,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
L,R = map(int,input().split())
mod = 2019
if R-L==1:
    print((L*R)%mod)
    exit()
li = [i%mod for i in range(L,R+2019)]
li.sort()
if li[0]==0:
    print(li[1]*li[2])
else:
    print(li[0*li[1])

Fixed submission:
L,R = map(int,input().split())
r = min(R,L+4038)
ans = 2018
for i in range(L,r+1,1):
    for j in range(i+1,r+1):
        tmp = (i*j)%2019
        ans = min(tmp,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 1
now = 0
for i in range(N+1):
    if now+L[i]>X:
        break
    else:
        now += L[i]
        count += 1
print(count)

Fixed submission:
N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 1
now = 0
for i in range(N):
    if now+L[i]>X:
        break
    else:
        now += L[i]
        count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 0
tmp = 0
i = 0
while(tmp<=X):
    tmp += L[i]
    count += 1
    i += 1
print(count)

Fixed submission:
N, X = map(int,input().split())
L = list(map(int,input().split()))
count = 1
now = 0
for i in range(N):
    if now+L[i]>X:
        break
    else:
        now += L[i]
        count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
li = [0]*N
for i in range(M):
    L, R = map(int,input().split())
    for j in range(L-1,R,1):
        li[j] += 1
print(li.count(M))

Fixed submission:
N, M = map(int,input().split())
li1 = []
li2 = []
for i in range(M):
    L, R = map(int,input().split())
    li1.append([L,R])
    li2.append([R,L])
li1.sort()
li2.sort(reverse=True)
if (li2[M-1][0])<(li1[M-1][0]):
    print("0")
    exit()
print((li2[M-1][0])-(li1[M-1][0])+1)
Buggy python submission (verdict: Runtime Error):
    N, K = map(int,input().split())
    ans = 0.0
    for i in range(1,N+1,1):
        count = 0
        tmp = i
        if tmp < K:
            while True:
                tmp *= 2
                count += 1
                if tmp>K:
                    break
    ans += float(1/N)*(0.5**count)
    print(ans)

Fixed submission:
N, K = map(int,input().split())
ans = 0.0
for i in range(1,N+1,1):
    count = 0
    tmp = i
    if tmp < K:
        while True:
            tmp *= 2
            count += 1
            if tmp>=K:
                break
    ans += float(1/N)*(0.5**count)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N = map(int,input().split())
count = 0
for i in range(N+1):
    for j in range(N+1):
        tmp = N-(R*i)-(G*j)
        if tmp >= 0 and tmp % B == 0:
            count += 1
print(count)


Fixed submission:
R,G,B,N = map(int,input().split())
count = 0
for i in range(N+1):
    for j in range(N+1):
        tmp = N-(R*i)-(G*j)
        if tmp >= 0 and tmp % B == 0:
            count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = str(input())
count = S.count("#.")
ans = 0

while count != 0:

    for i in range(count):
        bwindex = S.index("#.")
        S = list(S)
        S[bwindex+1] = "#"
        S = "".join(S)
        ans += 1

    count = S.count("#.")
    
print(ans)

Fixed submission:
N = int(input())
S = str(input())
x = S.count(".")
ans = x
for i in range(N):
    if S[i]=="#":
        x += 1
    else:
        x -= 1
    ans = (min(ans,x))
print(ans)
Buggy python submission (verdict: Runtime Error):
li = [str(input()) for i in range(5)]
tmp = []
tmp_2 = []
s = 0
for i in range(5):
    if 10-int(li[i][-1]) != 10:
        tmp.append(10-int(li[i][-1]))
    tmp_2.append(int(li[i]))
tmp.sort()
print(sum(tmp_2)+(sum(tmp)-tmp[-1]))

Fixed submission:
li = [str(input()) for i in range(5)]
tmp = []
tmp_2 = []
s = 0
for i in range(5):
    if 10-int(li[i][-1]) != 10:
        tmp.append(10-int(li[i][-1]))
    tmp_2.append(int(li[i]))
tmp.sort()
if len(tmp) != 0:
    print(sum(tmp_2)+(sum(tmp)-tmp[-1]))
else:
    print(sum(tmp_2))
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = str(input())
for i in range(Q):
    l, r = map(int,input().split())
    p = l-1
    S_tmp = S[p:r]
    S_tmp.strip("T")
    S_tmp.strip("G")
    print(S_tmp.count("AC"))

Fixed submission:
N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = str(input())
for i in range(Q):
    l, r = map(int,input().split())
    p = l-1
    S_tmp = S[p:r]
    print(S_tmp.count("AC"))

Fixed submission:
N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = str(input())
for i in range(Q):
    l, r = map(int,input().split())
    S_tmp = S[l-1:r]
    print(S_tmp.count("AC"))


Fixed submission:
N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = str(input())
for i in range(Q):
    l, r = map(int,input().split())
    S_tmp = S[l-1:r]
    tmp = []
    for j in range(0,len(S_tmp),1):
        tmp.append(S_tmp[j:j+2])
    print(tmp.count("AC"))


Fixed submission:
N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = str(input())
S_list = []
for i in range(0,N,1):
    S_list.append(S[i:i+2])
del S_list[-1]
for j in range(Q):
    tmp = []
    l, r = map(int,input().split())
    for k in range(l,r,1):
        tmp.append(S_list[k-1])
    print(tmp.count("AC"))


Fixed submission:
N, Q = map(int,input().split())
S = str(input())
count = 0
li = [0]
for i in range(N-1):
    if S[i:i+2] == "AC":
        count += 1
    li.append(count)
for i in range(Q):
    l,r = map(int,input().split())
    print(li[r-1]-li[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
count = yen = 0
li = [list(map(int,input().split())) for i in range(N)]
li.sort() 
for i in range(0,len(li),1):
  count += li[i][1] 
  yen += li[i][0]*li[i][1] 
  if count > M: 
    for j in range(0,li[i][1],1):
      count -= 1
      yen -= li[i][0]
      if count == M: 
        break
print(yen)

Fixed submission:
N, M = map(int,input().split())
count = yen = imp = 0
li = [list(map(int,input().split())) for i in range(N)]
li.sort()
for i in range(0,len(li),1):
  count += li[i][1] 
  yen += li[i][0]*li[i][1] 
  if count > M:
    imp = abs(M-count)
    count -= abs(M-count)
    yen -= li[i][0]*imp
  if count == M: 
    break
print(yen)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
S_li = list(S)
count = 0
flag = False
i = 0
while True:
  if i == len(S_li) or len(S_li) == 0:
    break
  if S_li[i-1] == "0" and S_li[i] == "1" and i-1 >= 0:
    flag = True
  elif S_li[i-1] == "1" and S_li[i] == "0" and i-1 >= 0:
    flag = True
  if flag == True:
    del S_li[i-1:i+1]
    count += 2
    i = 0
    flag = False
  else:
    i += 1
print(count)

Fixed submission:
S = str(input())
count_0 = 0
count_1 = 0
for i in range(len(S)):
  if int(S[i]) == 0:
    count_0 += 1
  else:
    count_1 += 1
print((min(count_0,count_1))*2)
Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
X = list(map(int,input().split()))
li = []
i = j = ans = 0
X.sort()

for i in range(M-1):
  a = abs(int(X[i+1])-int(X[i]))
  li.append(a)
  i += 1
  
li.sort(reverse=True)
del li[0:N-1]

for j in range(N+1):
  if int(len(li)) == 0:
    break
  ans = ans + int(li[j])
  j += 1

print(ans)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
li = [0]*(M-1)
X.sort()
for i in range(M-1):
    li[i] = abs(X[i+1]-X[i])
li.sort()
print(sum(li[:max(0,M-N)]))

Buggy python submission (verdict: Runtime Error):
N, M = map(int,input().split())
X = list(map(int,input().split()))
li = []
i = j = ans = 0
X.sort()
for i in range(M-1):
  a = abs(int(X[i+1])-int(X[i]))
  li.append(a)
  i += 1
li.sort(reverse=True)
del li[0:N-1]
for j in range(N+1):
  ans = ans + int(li[j])
  j += 1
print(ans)

Fixed submission:
N,M = map(int,input().split())
X = list(map(int,input().split()))
li = [0]*(M-1)
X.sort()
for i in range(M-1):
    li[i] = abs(X[i+1]-X[i])
li.sort()
print(sum(li[:max(0,M-N)]))
Buggy python submission (verdict: Runtime Error):
a,b = list(map(int,input().split())
print(a+b//2)

Fixed submission:
a,b = map(int,input().split())
print(a+b//2)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
v = list(map(int,input().split()))
ans = 0
lia = v[::2]
lib = v[1::2]
tmp1 = len(lia)
tmp2 = len(lib)
lia.sort()
lib.sort()
if lia[0]==lib[-1]:
  print(n//2)
  exit()
lib.sort(reverse=True)
lia = collections.Counter(lia)
lib = collections.Counter(lib)
ans += tmp1-lia.most_common()[0][1]
ans += tmp2-lib.most_common()[0][1]
if lia.most_common()[0][1]%2==1 and lib.most_common()[0][1]2==1:
  print(ans+1)
else:
  print(ans)

Fixed submission:
from collections import Counter
N = int(input())
V = list(map(int, input().split()))
a = Counter(V[0::2]).most_common() + [(0,0)]
b = Counter(V[1::2]).most_common() + [(0,0)]
if a[0][0]!=b[0][0]:
    print(N-a[0][1]-b[0][1])
else:
    print(N-max(a[1][1]+b[0][1],a[0][1]+b[1][1]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
v = list(map(int,input().split()))
li = [0]*(10**5)
for i in range(n):
  li[v[i]] += 1
li.sort(reverse=True)
tmp = li[0]+li[1]
if tmp==n and li[0]!=li[1]:
  print(n//2)
else:
  print(n-tmp)

Fixed submission:
from collections import Counter
N = int(input())
V = list(map(int, input().split()))
a = Counter(V[0::2]).most_common() + [(0,0)]
b = Counter(V[1::2]).most_common() + [(0,0)]
if a[0][0]!=b[0][0]:
    print(N-a[0][1]-b[0][1])
else:
    print(N-max(a[1][1]+b[0][1],a[0][1]+b[1][1]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [input() for _ in range(N)]
flag = True 
b = W[0][-1] 
for i in range(1,N): 
  if b == W[i][0]:　
    b = W[i][-1]　
  else: 
    flag = False
    exit()
    
if int(len(W))!=len(set(W)):
  flag = False

if flag == True:
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
W = [input() for _ in range(N)]
flag = True
b = W[0][-1]
for i in range(1,N): 
  if b == W[i][0]:
    b = W[i][-1]
  else:
    flag = False
    break
    
if int(len(W))!=len(set(W)):
  flag = False

if flag == True:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(105,n+1,2):
  x = 0
  for j in range(1,i+1):
    if i%j==0:
      c+=1
  if x == 8:
    count += 1
print(count)

Fixed submission:
n = int(input())
count = 0
for i in range(105,n+1,2):
  x = 0
  for j in range(1,i+1):
    if i%j==0:
      x+=1
  if x == 8:
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
S = str(input())
k = int(input())
if len(S) == 1:
    print(S)
    exit()
for i in range(10):
    if S[i] == "1" and int(S[i]) == k:
        print("1")
        break
    elif S[i] != "1":
        print(S[i])
        break


Fixed submission:
S = str(input())
k = int(input())
for i in range(k):
    if S[i] != "1":
        print(S[i])
        exit()
print("1")

Buggy python submission (verdict: Runtime Error):
S = str(input())
k = int(input())
if len(S) == 1:
    print(S)
    exit()
for i in range(10):
    if S[i] == "1" and int(S[i]) == k:
        print("1")
    elif S[i] != "1":
        print(S[i])
        break


Fixed submission:
S = str(input())
k = int(input())
for i in range(k):
    if S[i] != "1":
        print(S[i])
        exit()
print("1")
Buggy python submission (verdict: Runtime Error):
A,B,C = list(map(int,input().split()))
list.sort()
print(list[2]-list[0])

Fixed submission:
A = list(map(int,input().split()))
A.sort()
print(A[2]-A[0])
Buggy python submission (verdict: Runtime Error):
D, N = map(int,input().split())
if N <= 99:
    print((100*D)*N)
else:
    print((100**D)*(N+1)))


Fixed submission:
D, N = map(int,input().split())
if N == 100:
    print((100**D)*(N+1))
else:
    print((100**D)*N)
Buggy python submission (verdict: Time Limit Exceeded):
import statistics
N = int(input())
X = list(map(int,input().split()))
for i in range(1,N+1):
    tmp = X[0:i-1]+X[i:]
    print(statistics.median(tmp))

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
a = sorted(X)
b = a[N//2]
c = a[(N//2)-1]
for i in X:
    print(b if i<b else c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int,input().split()))
for i in range(1,N+1):
    tmp = X[0:i-1]+X[i:]
    tmp.sort()
    print(tmp[N//2-1])

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
a = sorted(X)
b = a[N//2]
c = a[(N//2)-1]
for i in X:
    print(b if i<b else c)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
X = list(map(int,input().split()))
for i in range(1,N+1):
    tmp1 = X[0:i-1]
    tmp2 = X[i:]
    tmp3 = tmp1+tmp2
    tmp3.sort()
    print(tmp3[N//2-1])

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
a = sorted(X)
b = a[N//2]
c = a[(N//2)-1]
for i in X:
    print(b if i<b else c)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int,input().split())
n = A
for i in range(B-A+1):
  if int(n-A)<K or int(B-n)<K:
    print(n)
  n += 1

Fixed submission:
A, B, K = map(int,input().split())
for i in range(A,min(B,A+K-1)+1,1):
    print(i)
for j in range(max(B-K+1,A+K),B+1,1):
    print(j)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K =map(int,input().split())
n = A
for i in range(B-A+1):

  if int(n-A)<K or int(B-n)<K:
    print(n)
  n += 1

Fixed submission:
A, B, K = map(int,input().split())
for i in range(A,min(B,A+K-1)+1,1):
    print(i)
for j in range(max(B-K+1,A+K),B+1,1):
    print(j)
Buggy python submission (verdict: Runtime Error):
N = str(input())
count = 0
new_n = ""

for i in range(len(N)):
    if N[i]!="9" and i==len(N)-1:
        new_n = str(int(N)-int(N[-1])-1)
        break
    elif N[i]!="9":
        new_n = str((int(N[i]) * 10**(len(N)-i-1)) -1)
        break

for j in new_n:
    count += int(j)

print(count)

Fixed submission:
N = str(input())
K = len(N)
c = int(N[0])
for i in N[1:]:
    if i!="9":
        print(c+9*(K-1)-1)
        exit()
print(c+9*(K-1))
Buggy python submission (verdict: Runtime Error):
a,b = input().split()
c = 0
n = 0
flag = False
c = a*(1**len(b))+b
for i in range(100000):
  n += 1
  if int(n*n) == int(c):
    flag = True
    break
if flag == True:
  pritn("Yes")
else:
  print("No")

Fixed submission:
a,b = input().split()
c = 0
n = 0
flag = False
c = a*(1**len(b))+b
for i in range(100000):
  n += 1
  if int(n*n) == int(c):
    flag = True
    break
if flag == True:
  print("Yes")
else:
  print("No")
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 Y == x*10000 + y*5000 + z*1000 and N == (x+y+z):
        print(x, y, z)
        flag = True
        break
      if flag == True:
        break
  if flag == True:
    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-x):
    if Y == x*10000 + y*5000 + (N-x-y)*1000:
      print(x, y, N-x-y)
      flag = True
      exit()
if flag == False:
  print(-1,-1,-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
li = list(set(a))
a.sort()
li.sort()
count = 0
for i in range(len(li)):
    tmp1= a.count(li[i])
    tmp2 = li[i]
    if tmp1 > tmp2:
        count += tmp1-tmp2
    elif tmp2 > tmp1:
        count += tmp1
print(count)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
A = Counter(A)
keys = list(A.keys())
count = 0
for i in range(len(A)):
    if keys[i]!=A[keys[i]]:
        if keys[i]>A[keys[i]]:
            count += A[keys[i]]
        else:
            count += A[keys[i]]-keys[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
li = list(set(a))
a.sort()
li.sort()
count = 0
for i in range(len(li)):
    tmp1= a.count(li[i])
    tmp2 = li[i]
    if tmp1 > tmp2:
        count += tmp1-tmp2
    elif tmp2 > tmp1:
        count += tmp1
print(count)

Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
A = Counter(A)
keys = list(A.keys())
count = 0
for i in range(len(A)):
    if keys[i]!=A[keys[i]]:
        if keys[i]>A[keys[i]]:
            count += A[keys[i]]
        else:
            count += A[keys[i]]-keys[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))
li = list(set(a))
a.sort()
li.sort()
count = 0
for i in range(len(li)):
    if a.count(li[i]) > li[i]:
        count += a.count(li[i])-li[i]
    elif li[i] > a.count(li[i]):
        count += a.count(li[i])
print(count)


Fixed submission:
from collections import Counter

N = int(input())
A = list(map(int,input().split()))
A = Counter(A)
keys = list(A.keys())
count = 0
for i in range(len(A)):
    if keys[i]!=A[keys[i]]:
        if keys[i]>A[keys[i]]:
            count += A[keys[i]]
        else:
            count += A[keys[i]]-keys[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))
sum = 0
tmp = len(list(set(A)))
li = collections.Counter(A)
for i in range(K,tmp,1):
    sum += li.most_common()[i][1]
print(sum)

Fixed submission:
import collections
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = 0
tmp = len(list(set(A)))
li = collections.Counter(A)
value,counts = zip(*li.most_common())
for i in range(K,tmp,1):
    ans += counts[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def intersect_list(lst1, lst2):
    arr = []
    lst = lst1.copy()
    for element in lst2:
        try:
            lst.remove(element)
        except ValueError:
            pass
        else:
            arr.append(element)
    return arr


N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))



li = intersect_list(D,T)

T.sort()
li.sort()
if T == li:
    print("YES")
else:
    print("NO")

Fixed submission:
from collections import Counter

N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))

D = Counter(D)
T = Counter(T)

for i in T:
    D_count = D[i]
    T_count = T[i]
    if T_count > D_count:
        print("NO")
        exit()
print("YES")