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

def gcd(a,b):
    a,b=max(a,b),min(a,b)
    while b>=1:
        a,b=b,a%b
    return a

def multigcd(list):
    L=list[:]
    for _ in range(len(list)-1):
        L=[gcd(L[0],L[1])]+L[2:]
    return L[0]

print(multigcd(A))

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
ans=[A[0]]

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

i=1
while i<=N-1:
    ans.append(gcd(A[i],ans[-1]))
    i+=1

print(ans[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
v=list(map(int,input().split()))
v_odd=[]
v_even=[]
odd=[[0,0]]
even=[[0,0]]

for j in range(int(n/2)):
    v_odd.append(v[2*j])
    v_even.append(v[2*j+1])

for i in range(int(n/2)):
    odd.append([v_odd[i],v_odd.count(v_odd[i])])
    even.append([v_even[i],v_even.count(v_even[i])])

odd.sort(key=lambda x:(x[1],x[0]),reverse=True)
even.sort(key=lambda x:(x[1],x[0]),reverse=True)

if odd[0][0]!=even[0][0]:
    ans=n-odd[0][1]-even[0][1]
else:
    ans=min(n-odd[0][1]-even[even[0][1]][1],n-odd[odd[0][1]][1]-even[0][1])
    
print(ans)

Fixed submission:
from collections import Counter, deque
n=int(input())
V=deque(list(map(int,input().split())))
if len(set(V))==1:print(n//2)
else:
    Odd=[]
    Even=[]
    for _ in range(n//2):
        Odd.append(V.popleft())
        Even.append(V.popleft())
    O=Counter(Odd)
    E=Counter(Even)
    if len(set(Odd))==1:print(n//2-E.most_common()[0][1])
    elif len(set(Even))==1:print(n//2-O.most_common()[0][1])
    elif O.most_common()[0][0]==E.most_common()[0][0]:print(min(n-E.most_common()[0][1]-O.most_common()[1][1],n-E.most_common()[1][1]-O.most_common()[0][1]))
    else:print(n-E.most_common()[0][1]-O.most_common()[0][1])
Buggy python submission (verdict: Time Limit Exceeded):
N,X=map(int,input().split())
Lx=list(map(int,input().split()))
Lxabs=[]
for i in Lx:Lxabs.append(abs(i-X))

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

def multigcd(List):
    for _ in range(len(List)-1):
        List=[gcd(List[0],List[1])]+List[2:]
    return List

print (multigcd(Lxabs)[0])

Fixed submission:
from functools import reduce
N,X=map(int,input().split())
Lx=list(map(int,input().split()))
Lxabs=[]
for i in Lx:Lxabs.append(abs(i-X))

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

def multigcd(List):
    return reduce(gcd,List)
        
print (multigcd(Lxabs))
Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

h,w=map(int,input().split())

B,ans,cnt=[],[],0
Bappend=B.append
ansappend=ans.append
fflag=False

for i in range(h):
    A=list(map(int,input().split()))
    flag=False
    for j in range(w-1):
        if flag:
            if A[j]%2==0:
                ansappend((i+1,j+1,i+1,j+2))
                flag=True
                cnt+=1
            else:
                flag=False
        else:
            if A[j]%2==1:
                ansappend((i+1,j+1,i+1,j+2))
                flag=True
                cnt+=1
    if i!=h-1:
        if flag+fflag==1:
            if A[w-1]%2==0:
                ansappend((i+1,j+1,i+2,j+1))
                fflag=True
                cnt+=1
            else:
                fflag=False
        else:
            if A[w-1]%2==0:
                fflag=False
            else:
                ansappend((i+1,j+1,i+2,j+1))
                fflag=True
                cnt+=1
                
print(cnt)
for a in ans:
    print(*a)

Fixed submission:
import sys
input=sys.stdin.readline

h,w=map(int,input().split())

B,ans,cnt=[],[],0
Bappend=B.append
ansappend=ans.append
fflag=False

for i in range(h):
    A=list(map(int,input().split()))
    flag=False
    for j in range(w-1):
        if flag:
            if A[j]%2==0:
                ansappend((i+1,j+1,i+1,j+2))
                flag=True
                cnt+=1
            else:
                flag=False
        else:
            if A[j]%2==1:
                ansappend((i+1,j+1,i+1,j+2))
                flag=True
                cnt+=1
    if i!=h-1:
        if flag+fflag==1:
            if A[w-1]%2==0:
                ansappend((i+1,w,i+2,w))
                fflag=True
                cnt+=1
            else:
                fflag=False
        else:
            if A[w-1]%2==0:
                fflag=False
            else:
                ansappend((i+1,w,i+2,w))
                fflag=True
                cnt+=1
                
print(cnt)
for a in ans:
    print(*a)
Buggy python submission (verdict: Runtime Error):
S=input()
K=int(input())

i=0
while i<=len(S):
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])

Fixed submission:
S=input()
K=int(input())

i=0
while i<=len(S)-1:
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])

Buggy python submission (verdict: Runtime Error):
S=input()
K=int(input())

i=0
while i<=len(S):
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i-1:
    print(1)
else:
    print(S[i])

Fixed submission:
S=input()
K=int(input())

i=0
while i<=len(S)-1:
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])
Buggy python submission (verdict: Runtime Error):
n,a,b=int(input().split())
if (b-a+1)%2==0:
    print("Borys")
else:
    print("Alice")

Fixed submission:
n,a,b=map(int,input().split())
if (b-a+1)%2==0:
    print("Borys")
else:
    print("Alice")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
AA=list(set(A))
ans=0
for a in AA:
    aa=A.count(a)
    if aa>=a:
        ans+=aa-a
    else:
        ans+=aa
print(ans)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
A+=[10**9+1]
ans,memo,counter=0,0,0
for a in A:
    if a!=memo:
        if memo>counter:ans+=counter
        memo,counter=a,0
    counter+=1
    if counter>memo:ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
h,w=map(int,input().split())
distance=[]
for _ in range(10):
   distance.append(list(map(int,input().split())))

for k in range(10):
   for j in range(10):
      for i in range(10):
         distance[i][j]=min(distance[i][j],distance[i][k]+distance[k][j])

ans=0
for _ in range(h):
   A=list(map(int,input().split()))
   for a in A:
      if a!=-1:
         ans.append(distance[a][0])
print(ans)

Fixed submission:
import sys
input=sys.stdin.readline
h,w=map(int,input().split())
distance=[]
for _ in range(10):
   distance.append(list(map(int,input().split())))

for k in range(10):
   for j in range(10):
      for i in range(10):
         distance[i][j]=min(distance[i][j],distance[i][k]+distance[k][j])

ans=0
for _ in range(h):
   A=list(map(int,input().split()))
   for a in A:
      if a!=-1:
         ans+=distance[a][1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
n,k=map(int,input().split())
L,X,Y=[],[],[]
for _ in range(n):
    x,y=map(int,input().split())
    L.append((x,y))
    X.append(x)
    Y.append(y)
ans=10**19
for p in permutations(X,2):
    for q in permutations(Y,2):
        u,d,l,r=max(p),min(p),min(q),max(q)
        cnt=0
        for i in L:
            if d<=i[0]<=u and l<=i[1]<=r:
                cnt+=1
        if cnt>=k:
            ans=min(ans,(u-d)*(r-l))
print(ans)

Fixed submission:
n,k=map(int,input().split())
P,X,Y=[],[],[]
for _ in range(n):
    x,y=map(int,input().split())
    P.append((x,y))
    X.append(x)
    Y.append(y)
ans=10**19
X.sort()
Y.sort()
for d in range(n-1):
    for u in range(d,n):
        for l in range(n-1):
            for r in range(n):
                D,U,L,R=X[d],X[u],Y[l],Y[r]
                cnt=0
                for i in P:
                    if D<=i[0]<=U and L<=i[1]<=R:
                        cnt+=1
                if cnt>=k:
                    ans=min(ans,(U-D)*(R-L))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
n,k=map(int,input().split())
L,X,Y=[],[],[]
for _ in range(n):
    x,y=map(int,input().split())
    L.append((x,y))
    X.append(x)
    Y.append(y)
ans=10**19
for p in permutations(X,2):
    for q in permutations(Y,2):
        u,d,l,r=max(p),min(p),min(q),max(q)
        cnt=0
        for i in L:
            if d<=i[0]<=u and l<=i[1]<=r:
                cnt+=1
        if cnt>=k:
            ans=min(ans,(u-d)*(r-l))
print(ans)

Fixed submission:
n,k=map(int,input().split())
P,X,Y=[],[],[]
for _ in range(n):
    x,y=map(int,input().split())
    P.append((x,y))
    X.append(x)
    Y.append(y)
ans=10**19
X.sort()
Y.sort()
for d in range(n-1):
    for u in range(d,n):
        for l in range(n-1):
            for r in range(n):
                D,U,L,R=X[d],X[u],Y[l],Y[r]
                cnt=0
                for i in P:
                    if D<=i[0]<=U and L<=i[1]<=R:
                        cnt+=1
                if cnt>=k:
                    ans=min(ans,(U-D)*(R-L))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys,itertools
input=sys.stdin.readline
INF=float('inf')
n,m,r=map(int,input().split())
R=list(map(int,input().split()))
distance=[[INF]*n for _ in range(n)]
for _ in range(m):
   a,b,c=map(int,input().split())
   distance[a-1][b-1]=c
   distance[b-1][a-1]=c

for i in range(n):
   for j in range(n):
       for k in range(n):
           distance[j][k]=min(distance[j][k],distance[j][i]+distance[i][k])

ans=INF
for j in itertools.permutations(range(r)):
   cnt=0
   for k in range(r-1):
      cnt+=distance[j[k]-1][j[k+1]-1]
   ans=min(ans,cnt)

print(ans)

Fixed submission:
import sys,itertools
input=sys.stdin.readline
INF=float('inf')
n,m,r=map(int,input().split())
R=list(map(int,input().split()))
distance=[[INF]*n for _ in range(n)]
for _ in range(m):
   a,b,c=map(int,input().split())
   distance[a-1][b-1]=c
   distance[b-1][a-1]=c

for i in range(n):
   for j in range(n):
       for k in range(n):
           distance[j][k]=min(distance[j][k],distance[j][i]+distance[i][k])

ans=INF
for p in itertools.permutations(R):
   cnt=0
   for q in range(r-1):
      cnt+=distance[p[q]-1][p[q+1]-1]
   ans=min(ans,cnt)

print(ans)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
def lcm(a,b):return int(a*b/gcd(a,b))
N,x=int(input()),1
for _ in range(N):x=lcm(x,int(input()))
print(x)

Fixed submission:
from fractions import gcd
def lcm(a,b):return (a//gcd(a,b))*b
N,x=int(input()),1
for _ in range(N):x=lcm(x,int(input()))
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
IN,OUT,p=[],[],0
for _ in range(m):
    a,b=map(int,input().split())
    if a==1:IN.append(b)
    if b==n:OUT.append(a)
for i in IN:
    if i in OUT:p=1
if p==1:print("POSSIBLE")
else:print("IMPOSSIBLE")

Fixed submission:
n,m=map(int,input().split())
IN,OUT={},{}
for _ in range(m):
    a,b=map(int,input().split())
    if a==1:
        if b in OUT:
            print("POSSIBLE")
            exit()
        else:IN[b]=1
    if b==n:
        if a in IN:
            print("POSSIBLE")
            exit()
        else:OUT[a]=1
print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from bisect import bisect_right
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[n-1]:ans=-1
elif k=A[n-1]:ans=1
else:
    a=A[0]
    for i in range(1,n):
        a=gcd(a,A[i])
    m=A[bisect_right(A,k)]
    if (m-k)%a==0:
        ans=1
    else:
        ans=-1
if ans==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from fractions import gcd
from bisect import bisect_right
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[n-1]:ans=-1
elif k==A[n-1]:ans=1
else:
    a=A[0]
    for i in range(1,n):
        a=gcd(a,A[i])
    m=A[bisect_right(A,k)]
    if (m-k)%a==0:
        ans=1
    else:
        ans=-1
if ans==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from bisect import bisect_right
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[n-1]:ans=-1
else:
    a=A[0]
    for i in range(1,n):
        a=gcd(a,A[i])
    m=A[bisect_right(A,k)]
    if (m-k)%a==0:
        ans=1
    else:
        ans=-1
if ans==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
from fractions import gcd
from bisect import bisect_right
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[n-1]:ans=-1
elif k==A[n-1]:ans=1
else:
    a=A[0]
    for i in range(1,n):
        a=gcd(a,A[i])
    m=A[bisect_right(A,k)]
    if (m-k)%a==0:
        ans=1
    else:
        ans=-1
if ans==1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L)).sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()

Fixed submission:
a,b,c=map(int,input().split())
if a<=c<=b:print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L)).sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()

Fixed submission:
N,K=map(int,input().split())
D,L={},[]
for _ in range(N):
    a,b=map(int,input().split())
    L.append(a)
    if a in D:D[a]=D[a]+b
    else:D[a]=b
l=list(set(L))
l.sort()
for i in l:
    K-=D[i]
    if K<=0:
        print(i)
        exit()
Buggy python submission (verdict: Runtime Error):
n=int(input())
S=input()
D={}
for i in range(len(S)):
    s=S[i]
    if s in D:D[s]+=1
    else:D[s]=1
for _ in range(n-1):
    S=input()
    E={}
    DD={}
    for i in range(len(S)):
        s=S[i]
        if s in E:E[s]+=1
        else:E[s]=1
    for i in D:
        if i in E:DD[i]=min(E[i],D[i])
ans=[]
for j in DD:
    for _ in range(DD[j]):
        ans.append(j)
ans.sort()
print("".join(ans))

Fixed submission:
n=int(input())
S=input()
D={}
for i in range(len(S)):
    s=S[i]
    if s in D:D[s]+=1
    else:D[s]=1
for _ in range(n-1):
    S=input()
    E={}
    DD={}
    for i in range(len(S)):
        s=S[i]
        if s in E:E[s]+=1
        else:E[s]=1
    for i in D:
        if i in E:DD[i]=min(E[i],D[i])
    D=DD
ans=[]
for j in D:
    for _ in range(D[j]):
        ans.append(j)
ans.sort()
print("".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
##SPEED TEST##
n,ma,mb=map(int,input().split())
ab=[[[10**6]*401 for _ in range(401)] for _ in range(n+1)]
ab[0][0][0]=0

for p in range(1,n+1):
    a,b,c=map(int,input().split())
    for i in range(400):
        for j in range(400):
            ab[p][i][j]=min(ab[p][i][j],ab[p-1][i][j])
            if i+a<=400 and j+b<=400:
                ab[p][i+a][j+b]=min(ab[p][i+a][j+b],ab[p-1][i][j]+c)

ans=10**6-1
for i in range(401):
    for j in range(401):
        if i!=0 and j!=0:
            if i*mb==j*ma:
                ans=min(ans,ab[n][i][j])

if ans==10**6-1:
    print(-1)
else:
    print(ans)

Fixed submission:
n,ma,mb=map(int,input().split())
ab=[[[10**6]*401 for _ in range(401)] for _ in range(n+1)]
ab[0][0][0]=0

for p in range(1,n+1):
    a,b,c=map(int,input().split())
    for i in range(400):
        for j in range(400):
            ab[p][i][j]=min(ab[p][i][j],ab[p-1][i][j])
            if i+a<=400 and j+b<=400:
                ab[p][i+a][j+b]=min(ab[p][i+a][j+b],ab[p-1][i][j]+c)

ans=10**6-1
for i in range(401):
    for j in range(401):
        if i!=0 and j!=0:
            if i*mb==j*ma:
                ans=min(ans,ab[n][i][j])

if ans==10**6-1:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,ma,mb=map(int,input().split())
ab=[[[10**6]*401 for _ in range(401)] for _ in range(n+1)]
ab[0][0][0]=0

for p in range(1,n+1):
    a,b,c=map(int,input().split())
    for i in range(400):
        for j in range(400):
            if i+a<=400 and j+b<=400:
                ab[p][i+a][j+b]=min(ab[p][i+a][j+b],ab[p-1][i][j]+c)

ans=10**6-1
for p in range(1,n+1):
    for i in range(401):
        for j in range(401):
            if i!=0 and j!=0:
                if i*mb==j*ma:
                    ans=min(ans,ab[p][i][j])

if ans==10**6-1:
    print(-1)
else:
    print(ans)

Fixed submission:
n,ma,mb=map(int,input().split())
ab=[[[10**6]*401 for _ in range(401)] for _ in range(n+1)]
ab[0][0][0]=0

for p in range(1,n+1):
    a,b,c=map(int,input().split())
    for i in range(400):
        for j in range(400):
            ab[p][i][j]=min(ab[p][i][j],ab[p-1][i][j])
            if i+a<=400 and j+b<=400:
                ab[p][i+a][j+b]=min(ab[p][i+a][j+b],ab[p-1][i][j]+c)

ans=10**6-1
for i in range(401):
    for j in range(401):
        if i!=0 and j!=0:
            if i*mb==j*ma:
                ans=min(ans,ab[n][i][j])

if ans==10**6-1:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
import heapq,math,sys
input=sys.stdin.readline
INF=math.inf
heappush=heapq.heappush
heappop=heapq.heappop

n,m=map(int,input().split())
graph=[[] for _ in range(n)]
minway=[]
bridges=[]
ans=0
for _ in range(m):
    a,b,c=map(int,input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))
    bridges.append((a-1,b-1))

def dijkstra(graph,n,start):
    Q=[]
    distance=[]
    dappend=distance.append
    for i in range(n):
        dappend([INF,i])
    distance[start][0]=0
    for j in distance:
        heappush(Q,j)
    while Q!=[]:
        q=heappop(Q)
        for v,vl in graph[q[1]]:
            alt=vl+q[0]
            if alt<distance[v][0]:
                distance[v][0]=alt
                heappush(Q,[alt,v])
    return distance

for k in range(n):
    minway.append(dijkstra(graph,n,k))

for l in bridges:
    flag=0
    x,y=l[0],l[1]
    for p in graph[x]:
        if p!=y:
            if minway[x][p[0]][0]+minway[x][y][0]==minway[p[0]][y][0]:
                flag=1
    for q in graph[y]:
        if q!=x:
            if minway[x][y][0]+minway[y][q[0]][0]==minway[x][q[0]][0]:
                flag=1
    if flag==0:
        ans+=1
print(ans)

Fixed submission:
import heapq,sys
input=sys.stdin.readline
INF=float('inf')
heappush=heapq.heappush
heappop=heapq.heappop

n,m=map(int,input().split())
graph=[[] for _ in range(n)]
minway=[]
bridges=[]
ans=0
for _ in range(m):
    a,b,c=map(int,input().split())
    graph[a-1].append((b-1,c))
    graph[b-1].append((a-1,c))
    bridges.append((a-1,b-1,c))

def dijkstra(graph,n,start):
    Q=[]
    distance=[]
    dappend=distance.append
    for i in range(n):
        dappend([INF,i])
    distance[start][0]=0
    for j in distance:
        heappush(Q,j)
    while Q!=[]:
        q=heappop(Q)
        for v,vl in graph[q[1]]:
            alt=vl+q[0]
            if alt<distance[v][0]:
                distance[v][0]=alt
                heappush(Q,[alt,v])
    return distance

for k in range(n):
    minway.append(dijkstra(graph,n,k))

for l in bridges:
    x,y,z=l[0],l[1],l[2]
    flag=True
    for p in range(n):
        if minway[x][p][0]+z==minway[y][p][0] or minway[y][p][0]+z==minway[x][p][0]:
            flag=False
            break
    if flag:
        ans+=1

print(ans)
Buggy python submission (verdict: Runtime Error):
def f(s):
    if len(s)==0:
        print("YES")
        exit()
    elif 1<=len(s)<=4:
        print("NO")
        exit()
    else:
        if s[0:5]=="maerd" or s[0:5]=="esare":
            s=s[5:]
            f(s)
        elif len(s)==5:
            print("NO")
            exit()
        elif s[0:6]=="resare":
            s=s[6:]
            f(s)
        elif len(s)==6:
            print("NO")
            exit()
        elif s[0:7]=="remaerd":
            s=s[7:]
            f(s)
        else:
            print("NO")
            exit()
S=input()
S=S[::-1]
f(S)

Fixed submission:
s=input()
s=s.replace("eraser","")
s=s.replace("erase","")
s=s.replace("dreamer","")
s=s.replace("dream","")
if s=="":print("YES")
else:print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
for i in range(N-K+1):
  total = sum(p[i:i+K])
  if total >= max_total:
    max_total = total
print(max_total)

Fixed submission:
N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
  
total = sum(p[0:K])
max_total = total
for i in range(K,N):
  if p[i] > p[i-K]:
    total = total + p[i] - p[i-K]
    max_total = max(max_total,total)
  else:
    total = total + p[i] - p[i-K]

print(max_total)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for i in range(N-K+1):
  total = sum(p[i:i+K])
  if total >= max_total:
    max_total = total
    res_number = i
for j in range(res_number,res_number+K):
  res += (p[j]+1)/2
print(res)

Fixed submission:
N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
  
total = sum(p[0:K])
max_total = total
for i in range(K,N):
  if p[i] > p[i-K]:
    total = total + p[i] - p[i-K]
    max_total = max(max_total,total)
  else:
    total = total + p[i] - p[i-K]

print(max_total)

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
max_total = 0
p = list(map(int,input().split()))
for i in range(N-K+1):
  total = sum(p[i:i+K])
  if total >= max_total:
    max_total = total
    res = 0
    for j in range(i,i+K):

      res += (p[j]+1)/2
      
print(res)

Fixed submission:
N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
  
total = sum(p[0:K])
max_total = total
for i in range(K,N):
  if p[i] > p[i-K]:
    total = total + p[i] - p[i-K]
    max_total = max(max_total,total)
  else:
    total = total + p[i] - p[i-K]

print(max_total)
Buggy python submission (verdict: Runtime Error):
K,X = map(input().split())
if K*500 > X-1:
  print('Yes')
else:
  print('No')

Fixed submission:
K,X = map(int,input().split())
if K*500 > X-1:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int,input().split())

def lcd(x,y):
  return (x*y)//math.gcd(x,y)

print(lcd(A,B))


Fixed submission:
import fractions as fr
A,B = map(int,input().split())
 
def lcd(x,y):
  return (x*y)//fr.gcd(x,y)
 
print(lcd(A,B))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M = map(int,input().split())
A = np.array(map(int,input().split()))
C = np.array(A)
for i in range(M):
  p = np.argmax(C)
  C[p] = int(C[p]/2)
print(sum(C))

Fixed submission:
S = input()
if S == 'Sunny':
  print('Cloudy')
elif S == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):

N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
  p = A.index(max(A))
  A[p] = int(A[p]/2)
print(sum(A))
 


Fixed submission:
import numpy as np
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = [x*(-1) for x in A]
heapq.heapify(A)
for i in range(M):
  heapq.heapreplace(A,int(A[0]/2))
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = map(int,input().split())
A = list(map(int,input().split()))
C = np.array(A)
for i in range(M):
  p = np.argmax(C)
  C[p] = int(C[p]/2)
print(sum(C))



Fixed submission:
import numpy as np
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
A = [x*(-1) for x in A]
heapq.heapify(A)
for i in range(M):
  heapq.heapreplace(A,int(A[0]/2))
print(-sum(A))