Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 6)


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

    def dp(i, j):
        if i == 0 and j == 0:
            return 0
        if i == 0 and j == 1:
            return -float('inf')
        if j == 0:
            return max(dp(i - 1, 0) + a[i - 1], dp(i - 1, 1) - a[i - 1])
        if j == 1:
            return max(dp(i - 1, 0) - a[i - 1], dp(i - 1, 1) + a[i - 1])

    score = dp(n, 0)

    print(score)


main()


Fixed submission:
def main():
    n = int(input())
    aa = list(map(int, input().split()))

    pos = [0] * n
    neg = [0] * n

    pos[0] = aa[0]
    neg[0] = -aa[0]

    for i, a in enumerate(aa[1:-1], start=1):
        pos[i] = max(pos[i - 1] + a, neg[i - 1] - a)
        neg[i] = max(pos[i - 1] - a, neg[i - 1] + a)

    pos[n - 1] = pos[n - 2] + aa[n - 1]
    neg[n - 1] = neg[n - 2] - aa[n - 1]

    score = max(pos[n - 1], neg[n - 1])

    print(score)


main()

Buggy python submission (verdict: Runtime Error):


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

    def dp(i, j):
        if i == 0 and j == 0:
            return 0
        if i == 0 and j == 1:
            return -float('inf')
        if j == 0:
            return max(dp(i - 1, 0) + a[i - 1], dp(i - 1, 1) - a[i - 1])
        if j == 1:
            return max(dp(i - 1, 0) - a[i - 1], dp(i - 1, 1) + a[i - 1])

    score = dp(n, 0)

    print(score)


main()

Fixed submission:
def main():
    n = int(input())
    aa = list(map(int, input().split()))

    pos = [0] * n
    neg = [0] * n

    pos[0] = aa[0]
    neg[0] = -aa[0]

    for i, a in enumerate(aa[1:-1], start=1):
        pos[i] = max(pos[i - 1] + a, neg[i - 1] - a)
        neg[i] = max(pos[i - 1] - a, neg[i - 1] + a)

    pos[n - 1] = pos[n - 2] + aa[n - 1]
    neg[n - 1] = neg[n - 2] - aa[n - 1]

    score = max(pos[n - 1], neg[n - 1])

    print(score)


main()
Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter

n, m = list(map(int, input().split()))
shops = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    shops.append((a, b))

shops = sorted(shops, key=itemgetter(0))
drink = [[a] * b for (a, b) in shops]
drink = sum(drink, [])
# print(drink)
answer = sum(drink[:m])
print(answer)

Fixed submission:
from operator import itemgetter

n, m = list(map(int, input().split()))
shops = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    shops.append((a, b))

shops = sorted(shops, key=itemgetter(0))
rest = m
cost = 0
for a, b in shops:
    if rest > b:
        cost += a * b
        rest -= b
    else:
        cost += a * rest
        break

print(cost)
Buggy python submission (verdict: Runtime Error):

S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
    A = A - 1
elif U == T:
    B = B - 1

print(f'{A} {B}')



Fixed submission:
S, T = map(str, input().split())
A, B = map(int, input().split())
U = input()

if U == S:
    A = A - 1
elif U == T:
    B = B - 1

print("{} {}".format(A, B))
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
P = [input() for i in range(L)]
P.sort()
print("".join(P))

Fixed submission:
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))

Buggy python submission (verdict: Runtime Error):

alpha = [chr(ord('a') + i) for i in range(26)]
# print(alpha)

N, L = map(int, input().split())
P = [input().split() for i in range(L)]

scores = []

for word in P:
    score = 0
    for t in word[0]:
        score += alpha.index(t)
    scores.append({"word": word[0], "score": score})

sorted_dict_list = sorted(scores, key=lambda x:x['score'])

out_str = ""
for d in sorted_dict_list:
    out_str += d["word"]
print(out_str)

Fixed submission:
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))

Buggy python submission (verdict: Runtime Error):

alpha = [chr(ord('a') + i) for i in range(26)]
# print(alpha)
N, L = map(int, input().split())
P = [input().split() for i in range(L)]

scores = []

for word in P:
    score = 0
    for t in word[0]:
        score += alpha.index(t)
    scores.append({"word": word[0], "score": score})

sorted_dict_list = sorted(scores, key=lambda x:x['score'])

out_str = ""
for d in sorted_dict_list:
    out_str += d["word"]
print(out_str)

Fixed submission:
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
list.sort(H, reverse=True)
for i in range(K):
    if len(H) != 0:
        H.pop(0)
    else:
        print("0")
        exit()
print(sum(H))

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
list.sort(H, reverse=True)
print(sum(H[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))

cout = 0



for i in range(0,n):
    if i == 0:
        cout = cout + 1
    else:
        if min(p[0:i+1]) == p[i]:
            cout = cout + 1



print(cout)



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

cout = 1
saisyou = p[0]

for i in range(n-1):
    if p[i+1] <= saisyou:
        cout = cout + 1
        saisyou = p[i+1]

print(cout)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from itertools import combinations

def n_cmb(n, r):
    from math import factorial
    return factorial(n) / factorial(r) / factorial(n - r)

f = sys.stdin
n = int(f.readline())
s = f.readline()[:-1]

duplicates = defaultdict(list)
for idx, v in enumerate(s):
    duplicates[v].append(idx)
print(duplicates)
n_duplicates = 0
for key in duplicates:
    # import pdb
    # pdb.set_trace()
    idxs = duplicates[key]
    n_idxs = len(idxs)
    if n_idxs > 3:
        n_duplicates += n_cmb(n_idxs - 3, 1)
    if n_idxs == 1:
        continue
    for i in range(n_idxs-1):
        for j in range(i+1, n_idxs):
            m = idxs[i] + n - idxs[j] - 1
            if m < 2:
                continue
            n_duplicates += n_cmb(m, 2)
print(n_cmb(n, 3))
print(n_duplicates)
result = n_cmb(n, 3) - n_duplicates

print(result)

Fixed submission:
import sys

def is_password(s, p):
    check = s.find(p[0])
    idx = check + 1
    if check == -1:
        return False
    check = s[idx:].find(p[1])
    if check == -1:
        return False
    idx = idx + check + 1
    check = s[idx:].find(p[2])
    if check == -1:
        return False
    return True

f = sys.stdin
n = int(f.readline())
s = f.readline()[:-1]

count = 0
for l1 in range(10):
    for l2 in range(10):
        for l3 in range(10):
            p = str(l1) + str(l2) + str(l3)
            if is_password(s, p):
                count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
S = input()

S = np.array( [S[i] for i in range(len(S))] )

if (S[0::2]=='L').any():
  print('No')
elif (S[1::2]=='R').any():
  print('No')
else:
  print('Yes')

Fixed submission:
import numpy as np

S = input()
 
S = np.array( [S[i] for i in range(len(S))] )
 
if (S[0::2]=='L').any():
  print('No')
elif (S[1::2]=='R').any():
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a =< b:
  print(a)
else:
  print(a-1)

Fixed submission:
a,b = map(int,input().split())
 
if a <= b:
  print(a)
else:
  print(a-1)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = list(map(int, input().split()))
# ok_list = []
cnt = 0
for x in range(K + 1):
    if S - x > K:
        y_max = K + 1
    else:
        y_max = S - x + 1

    for y in range(y_max):
        if S - x - y > K:
            z_max = K + 1
        else:
            z_max = S - x - y + 1
        for z in range(z_max):
            # print((x, y, z))
            if x + y + z == S:
                # print((x, y, z))
                # ok_list.append((x, y, z))
                cnt += 1

print(cnt)

Fixed submission:
K, S = list(map(int, input().split()))
# ok_list = []
cnt = 0
for x in range(K + 1):
    if S - x > K:
        y_max = K + 1
    else:
        y_max = S - x + 1

    if S - x > 2 * K:
        continue
    else:
        # print(y_max, end=" ")
        pass

    for y in range(y_max):

        if S - (x + y) <= K:
            cnt += 1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = list(map(int, input().split()))
ok_list = []
for x in range(K + 1):
    if S - x > K:
        y_max = K + 1
    else:
        y_max = S - x + 1

    for y in range(y_max):
        if S - x - y > K:
            z_max = K + 1
        else:
            z_max = S - x - y + 1
        for z in range(z_max):
            # print((x, y, z))
            if x + y + z == S:
                # print((x, y, z))
                ok_list.append((x, y, z))

print(len(ok_list))

Fixed submission:
K, S = list(map(int, input().split()))
# ok_list = []
cnt = 0
for x in range(K + 1):
    if S - x > K:
        y_max = K + 1
    else:
        y_max = S - x + 1

    if S - x > 2 * K:
        continue
    else:
        # print(y_max, end=" ")
        pass

    for y in range(y_max):

        if S - (x + y) <= K:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N=int(input())
P = list(map(int,input().split()))
ans=0
 
 
for i in range(N):
    if min(P[:i+1])==P[i]:
      ans+=1
print(ans)

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

if N==M:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N=int(input())
P = list(map(int,input().split()))
ans=0
 
 
for i in range(N):
    if min(P[:i+1])==P[i]:
        ans+=1
print(ans)

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

if N==M:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]

for i in P:
	if m >= i:
    	ans += 1
   		m = i
print(ans)

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
P = list(map(int,input().split()))
ans=0
m=10*10

for i in range(N):
    if min(m,p[i])==P[i]:
        ans+=1
        m=P[i]
print(ans)

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P = list(map(int,input().split()))
ans=0
 
 
for i in range(N):
    if min(P[:i+1])==P[i]:
        ans+=1
print(ans)

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P = list(map(int,input().split()))
ans=0
 
 
for i in range(N):
    if min(P[:i+1])==P[i]:
        ans+=1
    else:
        ans+=0
print(ans)

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P = list(map(int,input().split()))
ans=0


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

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
P = list(map(int,input().split()))
ans=0


for i in range(N):
    an=0
    for j in range(0, i):
        if P[j]>=P[i]:
            an+=1
        else:
            an+=0
    if an==i:
        ans+=1
    else:
        ans+=0
print(ans)

Fixed submission:
N=int(input())
P = list(map(int,input().split()))
ans=0
m=P[0]
 
for i in range(N):
    if m >= P[i]:
        ans += 1
        m = P[i]

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

if A>B*2:
    print(A-B*2)
if A=B*2:
    print(0)
if A<B*2:
    print(0)

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

if A>B*2:
    print(A-B*2)

else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

ans=[]

for i in range(1,N+1):
    ans.append(int(1+A.index(i)))


print(*ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=[0]*N
for i in range(0,N):
  ans[A[i]-1]=i+1
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

ans=[]

for i in range(1,N+1):
    ans.append(int(1+A.index(i)))


print(*ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=[0]*N
for i in range(0,N):
  ans[A[i]-1]=i+1
print(*ans)
Buggy python submission (verdict: Runtime Error):
N,K,Q=map(int, input().split())
 
list=[(K-Q) for j in range(N)]
 
for i in range(Q):
	A=int(input())-1
  	list[A]+=1
 
for score in list:
  	if score>0:
      	print("Yes")
	else:
      	print("No")

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

list=[(K-Q) for j in range(N)]

for i in range(Q):
    a=int(input())-1
    list[a]+=1

for score in list:
    if 0<score:
        print("Yes")
    else:
        print("No")

Buggy python submission (verdict: Runtime Error):
N,K,Q=map(int,input().split())

list=[(K-Q) for i in range(N)]

for i in range(Q):
	A=int(input())-1
  	list[A]+=1

for score in list:
  	if score>0:
      	print("Yes")
	else:
      	print("No")

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

list=[(K-Q) for j in range(N)]

for i in range(Q):
    a=int(input())-1
    list[a]+=1

for score in list:
    if 0<score:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input().split())

if n >= 10:
  print(k)
else:
  print(r+100*(10-n))

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

if n >= 10:
  print(r)
else:
  print(r+100*(10-n))
Buggy python submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  A=sum(damage)
  print(A)

else:
  print(0)  

Fixed submission:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)

Buggy python submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)
#print(damage)
if N>K:
  for i in range(K):
    del damage[i]

  for i in range(N-K):
    A+=damage[i]
  print(A)

else:
  print(0)  

Fixed submission:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)

Buggy python submission (verdict: Runtime Error):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

damage.sort(reverse=True)
#print(damage)
for i in range(attack[1]):
  del damage[i]

for i in range(attack[0]-attack[1]):
  A+=damage[i]

print(A)

Fixed submission:
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list=list(map(int,input().split()))
A=1
for i in range(N):
	for j in range(i+1):
		if list[i]>list[j]:
			break
		else:
			if j==i-1:
				A+=1
print(A)

Fixed submission:
N=int(input())
list=list(map(int,input().split()))
A=1
i=0
j=0
for x in range(N):
  if list[i]<list[j]: 
      A=A+1
      j=i
  i=i+1
print(A)
Buggy python submission (verdict: Time Limit Exceeded):
N=list(map(int,input().split(" ")))
ans=[int(input()) for i in range(N[2])]	

point=[N[1] for i in range(N[0])]
def down(y):
	return y-1
for i in ans:
	point=list(map(down,point))
	point[i-1]+=1
#print(point)
for i in range(N[0]):
	if point[i]>0:
		print("Yes")
	else:
		print("No")

Fixed submission:
N=list(map(int,input().split(" ")))
ans=[int(input()) for i in range(N[2])]	

point=[N[1]-N[2] for i in range(N[0])]

for i in ans:
	point[i-1]+=1
#print(point)
for i in range(N[0]):
	if point[i]>0:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N=list(map(int,input().split(" ")))
answer=[input() for i in range(N[2])]	
X=list(map(int,answer))
#print(X)

point=[]
for i in range(N[0]):
	point.append(N[1])

def down(y):
	return y-1

for i in X:
	point=list(map(down,point))
	point[i-1]+=1
#print(point)
for i in range(N[0]):
	if point[i]>0:
		print("Yes")
	else:
		print("No")
 

Fixed submission:
N=list(map(int,input().split(" ")))
ans=[int(input()) for i in range(N[2])]	

point=[N[1]-N[2] for i in range(N[0])]

for i in ans:
	point[i-1]+=1
#print(point)
for i in range(N[0]):
	if point[i]>0:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
list1=list(map(int,input().split()))
#print(list1)

ans_list=[]
ans=0
for i in range(N):
	j=i
	ans=0
	while True:
		if j==N-1:
			break
		if list1[j]>=list1[j+1]:
			ans+=1
			j+=1
		else :
			break

	ans_list.append(ans)
print(max(ans_list))

Fixed submission:
N=int(input())
list1=list(map(int,input().split()))
#print(list1)
ans_list=[]
j=0
while True:
	ans=0
	while True:
		if j==N-1:
			break
		if list1[j]>=list1[j+1]:
			ans+=1
			j+=1
		else :
			break
	j+=1
	ans_list.append(ans)
	if j==N:
		break
print(max(ans_list))
Buggy python submission (verdict: Runtime Error):
N=int(input())
num2=input().split(" ")
num3=list(map(int,num2))
sum=0
fori in range(N):
  	sum+=1/num[i]
print(sum)

Fixed submission:
N=int(input())
num2=input().split(" ")
num3=list(map(int,num2))
sum=0
for i in range(N):
  	sum+=1/num3[i]
print(1/sum)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

tmin = 0
for i in range(0, n):
    t = 0
    for j in range(0, n):
        if j == i:
            continue
        sd = "E" if j < i else "W"
        if s[j] != sd:
             t += 1
    if t < tmin or i == 0:
         tmin = t
print(tmin)

Fixed submission:
n = int(input())
s = input()

e = [0 for i in range(n)]
w = [0 for i in range(n)]
for i in range(0, n - 1):
    et = e[i - 1] if i != 0 else 0
    et += 1 if s[i] != "E" else 0
    e[i] = et
    wt = w[(n - 1 - i) + 1] if i != 0 else 0
    wt += 1 if s[n - 1 - i] != "W" else 0
    w[n - 1 - i] = wt
# import pdb; pdb.set_trace()
tmin = 0
for i in range(0, n):
    t = 0
    t += e[i - 1] if i != 0 else 0
    t += w[i + 1] if i != (n - 1) else 0
    if t < tmin or i == 0:
        tmin = t 
print(tmin)
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    S = list(input())
    S.reverse()
    substr = ''
    p = ['dream', 'dreamer', 'erase', 'eraser']
    for i in S:
        substr = i + substr
        if substr in p:
            substr = ''
    ans = 'YES' if substr == '' else 'NO'
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    S = list(input())
    S.reverse()
    substr = ''
    p = ['dream', 'dreamer', 'erase', 'eraser']
    for i in S:
        substr = i + substr
        if substr in p:
            substr = ''
    ans = 'YES' if substr == '' else 'NO'
    print(ans)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def sum_to(n):
    return (n+1)*int((n/2))+(n%2)*((n+1)/2)

def expected(n):
    return sum_to(n) / n

N, K = map(int, input().split())
P = list(map(int, input().split()))

max_sum = 0
select = deque()
c = 0
for i in P:
    e_val = expected(i)
    select.append(e_val)
    if len(select) == K:
        s = sum(select)
        if s > max_sum:
            max_sum = s
        select.popleft()

print(max_sum)

Fixed submission:
from collections import deque

def sum_to(n):
    return (n+1)*int((n/2))+(n%2)*((n+1)/2)

def expected(n):
    return sum_to(n) / n

N, K = map(int, input().split())
P = list(map(int, input().split()))

max_sum = 0
cur_sum = 0
select = deque()
c = 0
for i in P:
    e_val = expected(i)
    select.append(e_val)
    cur_sum += e_val
    if len(select) == K:
        if cur_sum > max_sum:
            max_sum = cur_sum
        cur_sum -= select.popleft()

print(max_sum)

Buggy python submission (verdict: Time Limit Exceeded):
def sum_to(n):
    return (n+1)*int((n/2))+(n%2)*((n+1)/2)

def expected(n):
    return sum_to(n) / n

N, K = map(int, input().split())
P = list(map(int, input().split()))

max_sum = 0
select = []
for i in P:
    e_val = expected(i)
    select.append(e_val)
    if len(select) == K:
        s = sum(select)
        if s > max_sum:
            max_sum = s
        select.pop(0)

print(max_sum)

Fixed submission:
from collections import deque

def sum_to(n):
    return (n+1)*int((n/2))+(n%2)*((n+1)/2)

def expected(n):
    return sum_to(n) / n

N, K = map(int, input().split())
P = list(map(int, input().split()))

max_sum = 0
cur_sum = 0
select = deque()
c = 0
for i in P:
    e_val = expected(i)
    select.append(e_val)
    cur_sum += e_val
    if len(select) == K:
        if cur_sum > max_sum:
            max_sum = cur_sum
        cur_sum -= select.popleft()

print(max_sum)
Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())
 
ans = []

if S == 10**9:
    ans = [S for _ in range(K)] + [1] * (N - K)
else:
    ans = [S for _ in range(K)] + [S + 1] * (N - K)

print(' '.join(map(str, result)))

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

if S == 10**9:
    ans = [S for _ in range(K)] + [1] * (N - K)
else:
    ans = [S for _ in range(K)] + [S + 1] * (N - K)

print(' '.join(map(str, ans)))

Buggy python submission (verdict: Runtime Error):
N, K, S = map(int, input().split())
 
ans = []

if S == 10**9:
    ans = [s for _ in range(K)] + [1] * (N - K)
else:
    ans = [s for _ in range(K)] + [S + 1] * (N - K)

print(' '.join(map(str, result)))

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

if S == 10**9:
    ans = [S for _ in range(K)] + [1] * (N - K)
else:
    ans = [S for _ in range(K)] + [S + 1] * (N - K)

print(' '.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = []

for _ in range(N):
    P.append(list(map(int, input().split())))

dp = [[0 for _ in range(3)] for _ in range(1000)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            dp[i][k] = max(dp[i][k], dp[i-1][j] + P[i][k])
            
print(max(dp[N-1]))

Fixed submission:
N = int(input())
P = []

for _ in range(N):
    P.append(list(map(int, input().split())))

dp = [[0 for _ in range(3)] for _ in range(10**5)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if k == j:
                continue
            dp[i][k] = max(dp[i][k], dp[i-1][j] + P[i][k])
            
print(max(dp[N-1]))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
ans = a*b
if ans % 2 = 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a,b=map(int,input().split())
p = a*b % 2
if p == 0 :
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = list(map(int,input().split()))
li = []
for i in range(N+1):
    cnt = A.count(i+1)
    if cnt>0:
        li.append(cnt)
li.sort(reverse=True)
print(sum(li[K:]))

Fixed submission:
N, K = map(int,input().split())
A = list(map(int,input().split()))
li = {}
for i in A:
    c = li.setdefault(i,0)
    li[i] = c + 1
    # print(c)
w = len(li.keys()) - K
# print(w)
# print(len(li.keys()))
ans = sorted(li.values())
# print(ans)
if w > 0:
    print(sum(ans[:w]))
else:
    print(0)