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

ans = 1
for i in range(N):
    ans=ans*A[i]

if ans> (10**18):
    ans=-1

print(ans)

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

ans = 1

if 0 in A:
    print(0)
    exit()

for i in range(N):
    ans=ans*A[i]
    if ans> (10**18):
        ans=-1
        break


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
T=input()

ans=""
buff="D"

leng=len(T)

for i in range(leng):
    now=T[i]
    if now=="?":
        if (i+1 < leng) and T[i+1] in ["?", "D"]:
            if buff == "P":
                ans=ans+"D"
            else:
                ans=ans+"P"
        else:
            ans=ans+"D"
    else:
        ans=ans+now
    buff=now

print(ans)

Fixed submission:
T=list(input())


ans=[]
buff="D"

leng=len(T)

for i in range(leng):
    now=T[i]
    if now=="?":
        if (i+1 < leng) and T[i+1] in ["?", "D"]:
            if buff == "P":
                buff="D"
            else:
                buff="P"
        else:
            buff="D"
    else:
        buff=now
    ans.append(buff)


print("".join(ans))

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

ans=""
buff="D"
for i in range(len(T)):
    if T[i]=="?":
        if (i+1 < len(T)) and T[i+1] in ["?", "D"]:
            if i!=0 and ans[-1] == "P":
                ans=ans+"D"
            else:
                ans=ans+"P"
        else:
            ans=ans+"D"
    else:
        ans=ans+T[i]

print(ans)

Fixed submission:
T=list(input())


ans=[]
buff="D"

leng=len(T)

for i in range(leng):
    now=T[i]
    if now=="?":
        if (i+1 < leng) and T[i+1] in ["?", "D"]:
            if buff == "P":
                buff="D"
            else:
                buff="P"
        else:
            buff="D"
    else:
        buff=now
    ans.append(buff)


print("".join(ans))
Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
A=list(map(int, input().split()))

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+nokori < K:
    nokori=(K-startat) % loopcount

tmpPoint=1
for i in range(startat+nokori):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)

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

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+loopcount < K:
    nokori=(K-startat) % loopcount
    K=startat+nokori

tmpPoint=1
for i in range(K):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)

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

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+loopcount < K:
    nokori=(K-startat) % loopcount

tmpPoint=1
for i in range(startat+nokori):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)

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

loopcount=0
tmpPoint=1
vis={1:0}
for i in range(N):
    Next=A[tmpPoint-1]
    if Next in vis:
        startat=i
        #print(startat)
        #print(tmpPoint)
        #print(vis)
        #print(Next)
        #print(vis[Next]+1)
        loopcount=i - vis[Next]+1
        break
    vis[Next]=i+1
    tmpPoint=Next

if loopcount==0:
    print(tmpPoint)
    exit()
if startat+loopcount < K:
    nokori=(K-startat) % loopcount
    K=startat+nokori

tmpPoint=1
for i in range(K):
    Next=A[tmpPoint-1]
    tmpPoint=Next
print(tmpPoint)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())

S=[]

for i in range(N):
    a=input()
    if S.count(a) == 0:
        S.append(a)

print(len(S))



Fixed submission:
N=int(input())

S={}

for i in range(N):
    a=input()
    if a in S:
        pass
    else:
        S[a] = 0

print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
S=input()

ans = 0
for i in range(len(S)):
    for j in range(i+4,len(S)+1):
        if int(S[i:j]) % 2019 == 0:
            ans+=1
            j+3

print(ans)



Fixed submission:
from collections import defaultdict
 
 
def solve2(s):
    ans = 0
    for i, c in enumerate(s):
        if c in '02468':
            ans += i + 1
    return ans
 
 
def solve5(s):
    ans = 0
    for i, c in enumerate(s):
        if c in '05':
            ans += i + 1
    return ans
 
 
def solve_other(s, p):
    reminders = defaultdict(lambda: 0)
    tmp = 0
    mul = 1
    for c in s[::-1]:
        c = int(c)
        tmp = (tmp + c * mul) % p
        mul = mul * 10 % p
        reminders[tmp] += 1
    reminders[0] += 1
    ans = 0
    for r, cnt in reminders.items():
        ans += cnt * (cnt - 1) // 2
    return ans
 
 

s = input()
n = len(s)
p = 2019


if p == 2:
    print(solve2(s))
elif p == 5:
    print(solve5(s))
else:
    print(solve_other(s, p))

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

ans = 0
for i in range(len(S)):
    for j in range(i+4,len(S)+1):
        if int(S[i:j]) % 2019 == 0:
            ans+=1

print(ans)



Fixed submission:
from collections import defaultdict
 
 
def solve2(s):
    ans = 0
    for i, c in enumerate(s):
        if c in '02468':
            ans += i + 1
    return ans
 
 
def solve5(s):
    ans = 0
    for i, c in enumerate(s):
        if c in '05':
            ans += i + 1
    return ans
 
 
def solve_other(s, p):
    reminders = defaultdict(lambda: 0)
    tmp = 0
    mul = 1
    for c in s[::-1]:
        c = int(c)
        tmp = (tmp + c * mul) % p
        mul = mul * 10 % p
        reminders[tmp] += 1
    reminders[0] += 1
    ans = 0
    for r, cnt in reminders.items():
        ans += cnt * (cnt - 1) // 2
    return ans
 
 

s = input()
n = len(s)
p = 2019


if p == 2:
    print(solve2(s))
elif p == 5:
    print(solve5(s))
else:
    print(solve_other(s, p))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))

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

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

ans = [0] * N
for i in range(N-1):
    l = A[i]-1
    ans[l] +=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()))

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

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

ans = [0] * N
for i in range(N-1):
    l = A[i]-1
    ans[l] +=1

for i in range(N):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import math

K=int(input())

ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans+=math.gcd(i+1,math.gcd(j+1,k+1))


print(ans)

Fixed submission:
import math

K=int(input())

ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans+=math.gcd(i+1,math.gcd(j+1,k+1))


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

list.sort(A,reverse=True)

sumnum = sum(A)

if A[M] > (sumnum/(4*M)):
    print("Yes")
else:
    print("No")


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

list.sort(A,reverse=True)

sumnum = sum(A)
if A[M-1] >= (sumnum/(4*M)):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
print a>10?b:b+800

Fixed submission:
a,b=map(int, input().split())
x = b if a>10 else b+((10-a)*100)
print(x)
Buggy python submission (verdict: Runtime Error):
T = [int(a) for a in input().split()]
if (T[0]*T[1])%2 == 0:
  	print("No")
else
	print("Yes")

Fixed submission:
T = [int(a) for a in input().split()]
if (T[0]*T[1])%2 == 0:
  	print("No")
else:
	print("Yes")
Buggy python submission (verdict: Runtime Error):

N = int(input())
#N,K,d= map(int,input().split())
#A = list(map(int,input().split()))
#S = str(input())
#T = str(input())

num=np.zeros(10**4+1)
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if ans < 10**4+1:
                num[ans]+=1


for i in range(N):
    print(int(num[i+1]))


Fixed submission:
import numpy as np
#import functools
#import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm
#import collections as C #most_common
#import math
#import sympy

N = int(input())
#N,K,d= map(int,input().split())
#A = list(map(int,input().split()))
#S = str(input())
#T = str(input())

num=np.zeros(10**4+1)
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            ans = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if ans < 10**4+1:
                num[ans]+=1


for i in range(N):
    print(int(num[i+1]))
Buggy python submission (verdict: Runtime Error):
#import math
import numpy as np
#import torch
#import torch.nn as nn
#import matplotlib.pyplot as plt
#from decimal import Decimal
#import itertools
#import collections

D=int(input())
#N,M,K = map(int,input().split())
#B,W = map(int,input().split())
#T=int(input())
C = list(map(int,input().split()))
#S=str(input())
c=np.zeros(365)
l=np.zeros([26,365])
T=[]
for i in range(D):
    S = map(int,input().split())
    t=max(S)
    T.append(S.index(t))
    #for i in range(26):
    #    n=
for s in T:
    print(s)


Fixed submission:
#import math
import numpy as np
#import torch
#import torch.nn as nn
#import matplotlib.pyplot as plt
#from decimal import Decimal
#import itertools
#import collections

D=int(input())
#N,M,K = map(int,input().split())
#B,W = map(int,input().split())
#T=int(input())
C = list(map(int,input().split()))
#S=str(input())
c=np.zeros(365)
l=np.zeros([26,365])
T=[]
for i in range(D):
    S = list(map(int,input().split()))
    t=max(S)
    T.append(S.index(t))
    #for i in range(26):
    #    n=
for s in T:
    print(s+1)
Buggy python submission (verdict: Runtime Error):
#import math
#import numpy as np
#import torch
#import torch.nn as nn
#import matplotlib.pyplot as plt
#from decimal import Decimal

#N=int(input())
A,V = map(int,input().split())
B,W = map(int,input().split())
T=int(input())
#A = list(map(int,input().split()))
#S=str(input())

if V<=W:
    print('NO')
else:
    L=abs(A-B)
    if L%(V-W)==0:
        if L/(V-W)<=T:
            print('YES')
        else:
            print('NO')
    else:
        while T>0:
            T-=1
            L=L+V+W
            if L/(V-W)<=T:
                print('YES')
                exit()
            if V*T<L:
                ptint('NO')
                exit()

        print('NO')


Fixed submission:
#import math
#import numpy as np
#import torch
#import torch.nn as nn
#import matplotlib.pyplot as plt
#from decimal import Decimal

#N=int(input())
A,V = map(int,input().split())
B,W = map(int,input().split())
T=int(input())
#A = list(map(int,input().split()))
#S=str(input())

if V<=W:
    print('NO')
else:
    L=abs(A-B)
    if L/(V-W)<=T:
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
import functools
import operator
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
prod = functools.partial(functools.reduce, operator.mul)

#c=np.array(A)
p=prod(A)
if p<0:
    p=p*(-1)

if p>10**18:
    print(-1)
else:
    print(p)


Fixed submission:
N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)
c=1
if 0 in A:
    print(0)
    exit()
for i in A:
    c=c*i
    if c>10**18:
        print(-1)
        exit()
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
c=1
for i in A:
    c*=i
if c>10**18:
    print(-1)
else:
    print(c)


Fixed submission:
N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
#prod = functools.partial(functools.reduce, operator.mul)
#c=np.array(A)
#p=np.prod(A)
c=1
if 0 in A:
    print(0)
    exit()
for i in A:
    c=c*i
    if c>10**18:
        print(-1)
        exit()
print(c)
Buggy python submission (verdict: Runtime Error):
#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=Decimal(B*100)
c=A*B
c=str(c//100)
print(c)


Fixed submission:
#import math
#N=int(input())
A,B = map(float,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
A=int(A)
B=round(B*100)
c=A*B
c=str(c//100)
print(c)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
import numpy as np
#S= str(input())
#T= str(input())
N,M,X = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
a=[]
c=[]
ans=[]
for j in range(N):

    A = list(map(int,input().split()))
    c.append(A)
    a.append(A)

for i in range(1,N+1):
    for l in list(combinations(a,i)):
        s=np.zeros(M+1)
        for k in l:
            k=np.array(k)
            s=s+k
        #print(s)
        
        if min(s)>=X:
            ans.append(s[0])
print(int(min(ans)))


Fixed submission:
from itertools import combinations
import numpy as np
#S= str(input())
#T= str(input())
N,M,X = map(int,input().split())
#N = int(input())
#A = list(map(int,input().split()))
a=[]
ans=[]
for j in range(N):

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

for i in range(1,N+1):
    for l in list(combinations(a,i)):
        s=np.zeros(M+1)
        for k in l:
            k=np.array(k)
            s=s+k
        #print(s)

        if min(s[1:])>=X:
            ans.append(s[0])
if len(ans)==0:
    print(-1)
else:
    print(int(min(ans)))
Buggy python submission (verdict: Runtime Error):
#N=int(input())
N,K = map(int,input().split())
#N=int(input())
A = list(map(int,input().split()))
#S=str(input())

now=1
flag=[-1]*(N)

for i in range(N):
    if flag[now-1]==-1:
        flag[now-1]=i
        now = A[now-1]
    else:
        loop = i+1 - flag[now-1]
        zan=(K-(i-loop))%loop
        ans = flag.index(flag[now-1]+zan)+1
        print(ans)
        exit()

print(now)


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

now=1
flag=[-1]*(N)

for i in range(K):
    if flag[now-1]==-1:
        flag[now-1]=i
        now = A[now-1]
    else:
        loop = i - flag[now-1]
        zan=(K-(i-loop))%loop
        ans = flag.index(i-loop+zan)+1
        print(ans)
        exit()

print(now)
Buggy python submission (verdict: Time Limit Exceeded):
#import itertools
#K = int(input())
#N,K = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))
c=0
for i in range(N):
    s=i+A[i]+1
    if s>N:
        continue
    for j in range(s,N):
        if abs(i-j)==A[i]+A[j]:
            c+=1

print(c)


Fixed submission:
from collections import Counter
#K = int(input())
#N,K = map(int,input().split())
N = int(input())
A = list(map(int,input().split()))
c=0
l=[]
r=[]
for i in range(N):
    l.append(A[i]+i+1)
    r.append(i+1-A[i])

C=Counter(r)

for x in l:
    c+=C.get(x,0)
print(c)
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<N:
    N=B
s=int(B/A)
if s>N:
    print(0)
    exit()
for x in range(s,N+1,s):
    num=int(A*x/B) - A * int(x/B)

    m=max(num,m)

print(m)


Fixed submission:
import itertools
#K = int(input())
N,M,Q = map(int,input().split())
#N = str(input())
#A = list(map(int,input().split()))
nums=[i for i in range(1,M+1)]
count=0
inp=[]
for i in range(Q):
    I=list(map(int,input().split()))
    inp.append(I)

for v in itertools.combinations_with_replacement(nums, N):
    c=0
    v=list(v)
    for i in inp:

        if v[i[1]-1] - v[i[0]-1]==i[2]:
            c+=i[3]
    count=max(count,c)
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<N:
    N=B
s=int(B/A)
if s>N:
    print(0)
    exit()
for x in range(s,N+1):
    num=int(A*x/B) - A * int(x/B)

    m=max(num,m)

print(m)


Fixed submission:
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<=N:
    m=int(A * (B-1) / B)
    print(m)

else:
    m=int(A * N / B)
    print(m)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=-1
if B<N:
    N=B
for x in range(N+1):
    num=int(A*x/B) - A * int(x/B)
    m=max(num,m)

print(m)


Fixed submission:
A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<=N:
    m=int(A * (B-1) / B)
    print(m)

else:
    m=int(A * N / B)
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
#H,W = map(int,input().split())
N=int(input())
A = list(map(int,input().split()))
#S=str(input())
c=[]
for i in range(1,N+1):
    C=A.count(i)
    c.append(C)

for k in c:

    print(k)


Fixed submission:
#H,W = map(int,input().split())
N=int(input())
A = list(map(int,input().split()))
#S=str(input())
c=[0]*N
for i in A:
    c[i-1]+=1
for k in c:
    print(k)
Buggy python submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    print(b*A+A)
else:
    print(b*A+x)


Fixed submission:
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
    exit()
else:
    b=N//(A+B)
    x=N%(A+B)

    if x>A:
        print(b*A+A)
    else:
        print(b*A+x)

Buggy python submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    x=A

print(b*A+x)


Fixed submission:
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
    exit()
else:
    b=N//(A+B)
    x=N%(A+B)

    if x>A:
        print(b*A+A)
    else:
        print(b*A+x)

Buggy python submission (verdict: Runtime Error):
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
else:
    b=N//(A+B)
    x=N%(A+B)

if x>A:
    x=A

    print(b*A+x)


Fixed submission:
#N = str(input())
N,A,B = map(int,input().split())
#X=list(map(int,input().split()))

if A==0:
    print(0)
    exit()
else:
    b=N//(A+B)
    x=N%(A+B)

    if x>A:
        print(b*A+A)
    else:
        print(b*A+x)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dice = list(map(int, input().split()))

p=0
for j in range(N-K+1):
    su=sum(dice[j:j+K])
    if su>p:
        p=su
print((p+K)/2)


Fixed submission:
N,K=map(int,input().split())
dice = list(map(int, input().split()))
a=sum(dice[0:K])

l = [a]
for i in range(1,N-K+1):
    a = a - dice[i-1] + dice[K-1+i]
    l.append(a)
print((max(l)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dice = list(map(int, input().split()))#dic=[]


p=[0]*(N-K+1)
for j in range(N-K+1):
    su=sum(dice[j:j+K])
    p[j]=su
print((max(p)+K)/2)


Fixed submission:
N,K=map(int,input().split())
dice = list(map(int, input().split()))
a=sum(dice[0:K])

l = [a]
for i in range(1,N-K+1):
    a = a - dice[i-1] + dice[K-1+i]
    l.append(a)
print((max(l)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dice = list(map(int, input().split()))#dic=[]


#def calc(n):
#    return (n+1)/2
#t1=time.time()
#data = list(map(calc, dice))
#t2=time.time()
#t3=time.time()
p=[]
for j in range(N-K+1):
    su=sum(dice[j:j+K])
    p.append(su)
#t4=time.time()
print((max(p)+K)/2)


Fixed submission:
N,K=map(int,input().split())
dice = list(map(int, input().split()))
a=sum(dice[0:K])

l = [a]
for i in range(1,N-K+1):
    a = a - dice[i-1] + dice[K-1+i]
    l.append(a)
print((max(l)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
import time
N,K=map(int,input().split())
dice = list(map(int, input().split()))#dic=[]


def calc(n):
    return (n+1)/2
t1=time.time()
data = list(map(calc, dice))
t2=time.time()
t3=time.time()
p=0
for j in range(N-K+1):
    su=sum(data[j:j+K])
    if su>p:
        p=su
t4=time.time()
print(p)


Fixed submission:
N,K=map(int,input().split())
dice = list(map(int, input().split()))
a=sum(dice[0:K])

l = [a]
for i in range(1,N-K+1):
    a = a - dice[i-1] + dice[K-1+i]
    l.append(a)
print((max(l)+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
dice = list(map(int, input().split()))#dic=[]

kitai=[]
def calc(n):
    return (n+1)/2

data = list(map(calc, dice))
s=[]

for j in range(N-K+1):
    su=sum(data[j:j+K])
    s.append(su)
print(max(s))


Fixed submission:
N,K=map(int,input().split())
dice = list(map(int, input().split()))
a=sum(dice[0:K])

l = [a]
for i in range(1,N-K+1):
    a = a - dice[i-1] + dice[K-1+i]
    l.append(a)
print((max(l)+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
if N<=K:
    print(0)
else:
    H.sort(reverse=True)
    for j in range(K):
        H.pop(0)
    print(sum(H))


Fixed submission:
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
if N<=K:
    print(0)
else:
    H.sort(reverse=True)

    del H[0:K]
    print(sum(H))

Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
H=input().split()
P=[]
for i in H:
    P.append(int(i))
if N<=K:
    print(0)
else:
    P.sort(reverse=True)
    for j in range(K):
        P.pop(j)
    print(sum(P))


Fixed submission:
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
if N<=K:
    print(0)
else:
    H.sort(reverse=True)

    del H[0:K]
    print(sum(H))