Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q=map(int, input().split())
score=[K]*N
for i in range(Q):
  A = int(input())
  score[A-1]+=1
  score = [x-1 for x in score]
  
for i in range(N):
  if score[i] > 0:
    print('Yes')
    
  else:
    print('No')

Fixed submission:
N,K,Q=map(int, input().split())
score=[K-Q]*N
for i in range(Q):
  A = int(input())
  score[A-1]+=1
  
for i in range(N):
  if score[i] > 0:
    print('Yes')
    
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
 
ans = 0
m=0
for i in range(N-1):
  count.append(0)
  if H[i] > H[i+1]:
    m+=1
    ans = max(ans, m)
    
  else:
    m=0
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Fixed submission:
S = input()
T = input()

count = 0
for s,t in zip(S,T):
  if s == t:
    count+=1
    
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
 
count = []
for i in range(N-1):
  count.append(0)
  if H[i] > H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Fixed submission:
S = input()
T = input()

count = 0
for s,t in zip(S,T):
  if s == t:
    count+=1
    
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())
 
count = [0]*len(H)
for i in range(len(H)-1):
  if H[i] >= H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Fixed submission:
S = input()
T = input()

count = 0
for s,t in zip(S,T):
  if s == t:
    count+=1
    
print(count)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
A, B = map(int, input().split())
B = B-A
for i in range(20):
	if B<=0:
    	print(i+1)
    	break()
    B=B-A+1

Fixed submission:
# coding: utf-8

A,B = map(int, input().split())
for i in range(20):
  if (A-1)*i+1 >= B:
    print(i)
    break

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

B = B-A
for i in range(20):
	if B<=0:
    	print(i+1)
    	break()
    B=B-A+1

Fixed submission:
# coding: utf-8

A,B = map(int, input().split())
for i in range(20):
  if (A-1)*i+1 >= B:
    print(i)
    break
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())

count = []
for i in range(len(H)-1):
  count.append(0)
  if H[i] > H[i+1]:
    count[i] = 1
    
S = str(count).split('0')
L = map(len, S)
print(max(L))

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
ans = 0
m=0
for i in range(N-1):
  if H[i] >= H[i+1]:
    m+=1
    ans = max(ans, m)
    
  else:
    ans = max(ans, m)
    m=0
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
  
for i in range(N):
  tmp=A.copy()
  tmp.remove(A[i])
  print(max(tmp))

Fixed submission:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
s=sorted(A,reverse=True)
for i in range(N):
  if A[i]!=s[0]:
    print(s[0])
  else:
    print(s[1])
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())

keys = list(range(1, N+1))
common = [x for x in keys if x>=max(L) and x<=min(R)]
    
print(len(common))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
    
print(max(min(R)-max(L)+1,0))

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

L=[0]*M
R=[0]*M
common = set(range(1, N+1))
for i in range(M):
  L, R = map(int, input().split())
  common = common & set(range(L,R+1))
print(len(common))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
    
print(max(min(R)-max(L)+1,0))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())

common = set(range(1, N+1))
for i in range(M):
  common = common & set(range(L[i],R[i]+1))

print(len(common))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
    
print(max(min(R)-max(L)+1,0))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())

keys = []

for i in range(M):
  keys.append(set(range(L[i],R[i]+1)))
  
common = set(range(1, N+1))
for i in range(M):
  common = common & keys[i]
    
print(len(common))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
    
print(max(min(R)-max(L)+1,0))

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())

keys = []

for i in range(M):
  keys.append(range(L[i],R[i]+1))
  
gcount = 0
for j in range(1,N+1):
  count = 0
  for i in range(M):
    if j in keys[i]:
      count+=1
      
  if count == M:
    gcount +=1
    
print(gcount)

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

L=[0]*M
R=[0]*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
    
print(max(min(R)-max(L)+1,0))
Buggy python submission (verdict: Runtime Error):
import re
S = input()
string = re.findall(r'([ACGT]+)', S)

lenst = [len(x) for x in string]
print(max(lenst))

Fixed submission:
import re
S = input()
string = re.findall(r'([ACGT]+)', S)

if len(string) != 0:
  lenst = [len(x) for x in string]
  print(max(lenst))
  
else:
  print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = input().split(' ')
N0 = int(N)
K = int(K)
N1 = abs(N0-K)
while N1 < N0:
  N0 = N1
  N1 = abs(N1-K)
else:
  print(N0)

Fixed submission:
N, K = input().split(' ')
NA = int(N)
K = int(K)
if NA - K > K:
  NA = NA - K*(NA//K - 1)
N1 = abs(NA-K)

while N1 < NA:
  NA = N1
  N1 = abs(N1-K)
else:
  print(NA)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = input().split(' ')
N = int(N)
K = int(K)
N1 = abs(N-K)
NB = [N, N1]
while NB[-1] < NB[-2]:
  NN = abs(NB[-1]-K)
  NB.append(NN)
else:
  print(NB[-2])

Fixed submission:
N, K = input().split(' ')
NA = int(N)
K = int(K)
if NA - K > K:
  NA = NA - K*(NA//K - 1)
N1 = abs(NA-K)

while N1 < NA:
  NA = N1
  N1 = abs(N1-K)
else:
  print(NA)
Buggy python submission (verdict: Runtime Error):
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
A11 = int(A11)
A12 = int(A12)
A13 = int(A13)
A21 = int(A21)
A22 = int(A22)
A23 = int(A23)
A31 = int(A31)
A32 = int(A32)
A33 = int(A33)
N = int(input())
b = []
for i in range(N):
  bi = int(input())
  b.append(bi)
if A11 in b and A12 in b and A13 in b:
  print('Yes')
elif A21 in b and A22 in b and A23 in b:
  print('Yes')
elif A31 in b and A32 in b and A33 in b:
  print('Yes')
elif A11 in b and A21 in b and A31 in b:
  print('Yes')
elif A12 in band A22 in b and A32 in b:
  print('Yes')
elif A13 in b and A23 in b and A33 in b:
  print('Yes')
elif A11 in b and A22 in b and A33 in b:
  print('Yes')
elif A13 in b and A22 in b  and A31 in b:
  print('Yes')
else:
  print('No')

Fixed submission:
A11, A12, A13 = input().split(' ')
A21, A22, A23 = input().split(' ')
A31, A32, A33 = input().split(' ')
A11 = int(A11)
A12 = int(A12)
A13 = int(A13)
A21 = int(A21)
A22 = int(A22)
A23 = int(A23)
A31 = int(A31)
A32 = int(A32)
A33 = int(A33)
N = int(input())
b = []
for i in range(N):
  bi = int(input())
  b.append(bi)
if A11 in b and A12 in b and A13 in b:
  print('Yes')
elif A21 in b and A22 in b and A23 in b:
  print('Yes')
elif A31 in b and A32 in b and A33 in b:
  print('Yes')
elif A11 in b and A21 in b and A31 in b:
  print('Yes')
elif A12 in b and A22 in b and A32 in b:
  print('Yes')
elif A13 in b and A23 in b and A33 in b:
  print('Yes')
elif A11 in b and A22 in b and A33 in b:
  print('Yes')
elif A13 in b and A22 in b  and A31 in b:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = -(-B // A)
print(C) 

Fixed submission:
A, B = input().split(' ')
A = int(A)
B = int(B)
if B == 1:
  print(0)
else:
  print(-(-(B-1) // (A-1)))
Buggy python submission (verdict: Runtime Error):
S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
print(max(counts))

Fixed submission:
S = input()
counts = []
count = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'G' or S[i] == 'C' or S[i] == 'T':
    count += 1
  else:
    counts.append(count)
    count = 0
counts.append(count)
if len(S) ==1:
  print(counts[0])
else:
  print(max(counts))
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C, K = input().split(' ')
A = int(A)
B = int(B)
C = int(C)
K = int(K)
while True:
  if A==B==C:
    print(0)
    break

  else:
    for i in range(K):
      a = B + C
      b = A + C
      c = A + B
      A = a
      B = b
      C = c
    if A-B>10**18:
      print('Unfair')
    else:
      print(A-B)

Fixed submission:
A, B, C, K = input().split(' ')
A = int(A)
B = int(B)
C = int(C)
K = int(K)
if K%2==0:
  print(A-B)
else:
  print(B-A)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = input().split(' ')
A = int(A)
B = int(B)
K = int(K)
N = []
for i in range(A, B+1):
  if i < A + K:
    print(i)
  elif i > B-K:
    print(i)

Fixed submission:
A, B, K = input().split(' ')
A = int(A)
B = int(B)
K = int(K)
N = []
if B-A>K:
  for i in range(A, A+K):
    print(i)
    N.append(i)
  for i in range(B-K+1, B+1):
    if not i in N:
      print(i)

else:
  for i in range(A, B+1):
    if i < A + K:
      print(i)
    elif i > B-K:
      print(i)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = input().split(' ')
A = int(A)
B = int(B)
K = int(K)
N = []
for i in range(A, B+1):
  if i < A + K:
    N.append(i)
  elif i > B-K:
    N.append(i)
for i in range(len(N)):
  print(N[i])

Fixed submission:
A, B, K = input().split(' ')
A = int(A)
B = int(B)
K = int(K)
N = []
if B-A>K:
  for i in range(A, A+K):
    print(i)
    N.append(i)
  for i in range(B-K+1, B+1):
    if not i in N:
      print(i)

else:
  for i in range(A, B+1):
    if i < A + K:
      print(i)
    elif i > B-K:
      print(i)
Buggy python submission (verdict: Runtime Error):
H, W = input().split(' ')
H = int(H)
W = int(W)
for i in range(W):
  a = input()
  print(a)
  print(a)

Fixed submission:
H, W = input().split(' ')
H = int(H)
W = int(W)
for i in range(H):
  a = input()
  print(a)
  print(a)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
 
for i in range(c):
  if(a == 0):
  	b -= 1
    if(b == 0):
      break
  elif(a > 0):
    a -= 1
print(str(a),str(b))


Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c = map(int, input().split())
 
for i in range(c):
  if(a == 0 and b > 0):
  	b -= 1
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))

Buggy python submission (verdict: Runtime Error):
a,b,c = int(input().split())
 
for i in range(c):
  if(a == 0 and b > 0):
  	b -= 1
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))

Buggy python submission (verdict: Runtime Error):
a,b,c = int(input().split())
 
for i in range(c):
  if(a == 0):
  	b -= 1
  elif(a > 0):
    a -= 1
print(str(a),str(b))

Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))

Buggy python submission (verdict: Runtime Error):
a,b,c = int(input().split())

for i in range(c):
  if(a == 0):
  	c -=1
  elif(a > 0):
    a -= 1
print(str(a),str(b))
    


Fixed submission:
a,b,c = map(int, input().split())
 
print(max(0,a-c),max(0, b - max(0,c-a)))
Buggy python submission (verdict: Runtime Error):
N,X = map(int, input().split())

for i in range(X-K+1,X+K):
	print(i,end = " ")

Fixed submission:
K,X = map(int, input().split())
 
for i in range(X-K+1,X+K):
	print(i,end = " ")
Buggy python submission (verdict: Runtime Error):
H,W = map(int, input().split())
h.w = map(int, input().split())
print(H*W -h*W-w*H+h*w)

Fixed submission:
H,W = map(int,input().split())
h,w = map(int,input().split())
print(H*W-h*W-w*H+w*h)
Buggy python submission (verdict: Runtime Error):
a = []
for i in range(3):
  a[i] = input()
print(a[0][0]+a[1][1]+a[2][2])

Fixed submission:
a = []
for i in range(3):
  a.append(input())
print(a[0][0]+a[1][1]+a[2][2])

Buggy python submission (verdict: Runtime Error):
a = []
for i in range(3):
  a[i] = input().split()
print(a[0][0]+a[1][1]+a[2][2])

Fixed submission:
a = []
for i in range(3):
  a.append(input())
print(a[0][0]+a[1][1]+a[2][2])
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print(factorial.(N)%(10**9+7))

Fixed submission:
import math

N = int(input())
print(math.factorial(N) % (10**9+7))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input.split())
print((n-1)*(m-1))

Fixed submission:
n,m=map(int,input().split())
print((n-1)*(m-1))

Buggy python submission (verdict: Runtime Error):
n=int(input())
m=int(input())
print((n-1)*(m-1))

Fixed submission:
n,m=map(int,input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
list = list(map(int,input().split()))

#結果出力用
result = 0
#整数個数
count = 0
#整数の個数分計算
while count % n == 0 :
    #2で割り切れるかどうか
    for i in range(n):
        if list[i] % 2 == 0:
            #割り切れる場合個数を加算
            count += 1
            #割り切れる個数と元の数が同じ場合
            if count == n:
                #計算回数を加算
                result += 1
                #個数を初期化
                count = 0
                #整数を2で割った商をlistにして再計算
                for i in range(n):
                    list[i] = list[i] / 2

print(result)


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

count = 0
while all(a%2 == 0 for a in A):
    count += 1
    A = [a/2  for a in A]
print(count)
Buggy python submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = sum(hyou)

# 得票数基準クリア数
count = 0
border = int(total_hyou/(4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print("Yes")
else:
  print("No")

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))

Buggy python submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
border = int(total_hyou/(4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))

Buggy python submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
border = int(total_hyou*(1/4*M))
for j in hyou:
  if j >= border:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))

Buggy python submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
for j in hyou:
  if j >= 1/4*M:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))

Buggy python submission (verdict: Runtime Error):
# N：全種類数、M：今回種類数
N,M = map(int, input().split())
# 得票数
hyou = list(map(int, input().split()))

# 総得票数
total_hyou = 0
for i in hyou:
  total_hyou += i

# 得票数基準クリア数
count = 0
for i in hyou:
  if i >= 1/4*M:
    count += 1
    
# 人気商品をM個選べるかどうか
if count >= M:
  print('Yes')
else:
  print('No')

Fixed submission:
# [箱A, 箱B, 箱C]
list = input().split()

# 箱Aと箱B入れ替え
temp = list[0]
list[0] = list[1]
list[1] = temp

# 箱Aと箱C入れ替え
temp = list[0]
list[0] = list[2]
list[2] = temp              
              
print(' '.join(list))
Buggy python submission (verdict: Time Limit Exceeded):
import collections
n=int(input())
a=list(input().split())
c=collections.Counter(a)
for i in range(n):
  ans=0
  for k,v in c.items():
    if a[i]==k:
      ans+=(v-1)*(v-2)//2
    else:
      ans+=v*(v-1)//2
  print(ans)



Fixed submission:
import collections
n=int(input())
a=list(input().split())
c=collections.Counter(a)
ans=0
for v in c.values():
  ans+=v*(v-1)//2
for i in range(n):
  v=c[a[i]]
  print(ans+((v-1)*(v-2)//2)-(v*(v-1)//2))
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
if n<=1:
  print("No")
  exit()
for i in range(n):
  if i!=n and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")


Fixed submission:
s=input()
n=len(s)
if n<=1:
  print("No")
  exit()
for i in range(n):
  if i!=n-1 and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n):
  if i!=n and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")


Fixed submission:
s=input()
n=len(s)
if n<=1:
  print("No")
  exit()
for i in range(n):
  if i!=n-1 and s[i]=="h":
    if s[i+1]!="i":
      print("No")
      exit()
  elif i!=0 and s[i]=="i":
    if s[i-1]!="h":
      print("No")
      exit()
  elif s[i]!="h" or s[i]!="i":
      print("No")
      exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
qv=[list(input().split()) for _ in range(q)]
for i in range(q):
  if len(qv[i])==1:
    s=s[::-1]
  else:
    _,f,c=qv[i]
    if f=="1":
      s=c+s
    elif f=="2":
      s+=c
print(s)

Fixed submission:
import collections
s=input()
q=int(input())
qv=[list(input().split()) for _ in range(q)]
cnt=0
ans=collections.deque()
for i in range(len(s)):
  ans.append(s[i])
for i in range(q):
  if qv[i][0]=="1":
    cnt+=1
  else:
    t,f,c = qv[i]
    if f=="1":
      if cnt%2==0:
        ans.appendleft(c)
      else:
        ans.append(c)
    elif f=="2":
      if cnt%2==0:
        ans.append(c)
      else:
        ans.appendleft(c)
if cnt%2!=0:
  ans.reverse()
print("".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
m=1/k
ans=0
l=[]
for i in range(k):
  tmp=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
ans=sum(l)
s=ans
for i in range(k,n):
  tmp=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
  s+=tmp
  s-=l[i-k]
  if ans<=s:
    ans=s
print(ans)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[0]*(n+1)
l[1]=(p[0]+1)/2
for i in range(2,n+1):
  l[i]=l[i-1]+(p[i-1]+1)/2
ans=0
for i in range(n-k+1):
  if ans<l[i+k]-l[i]:
    ans=l[i+k]-l[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
m=1/k
ans=0
l=[]
for i in range(k):
  tmp=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
ans=sum(l)
for i in range(k,n):
  tmp=0
  s=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
  s=sum(l[i-k+1:i+1])
  if ans<s:
    ans=s
print(ans)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[0]*(n+1)
l[1]=(p[0]+1)/2
for i in range(2,n+1):
  l[i]=l[i-1]+(p[i-1]+1)/2
ans=0
for i in range(n-k+1):
  if ans<l[i+k]-l[i]:
    ans=l[i+k]-l[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
m=1/k
ans=0
l=[]
for i in range(k):
  tmp=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
ans=sum(l)
for i in range(k,n):
  tmp=0
  s=0
  for j in range(1,p[i]+1):
    tmp+=1/p[i]*j
  l.append(tmp)
  s=sum(l[i-k+1:i+1])
  if ans<s:
    ans=s
print(ans)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
l=[0]*(n+1)
l[1]=(p[0]+1)/2
for i in range(2,n+1):
  l[i]=l[i-1]+(p[i-1]+1)/2
ans=0
for i in range(n-k+1):
  if ans<l[i+k]-l[i]:
    ans=l[i+k]-l[i]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
ans=0
for i in range(n):
  xi,li=xl[i]
  cnt=1
  for j in range(n):
    xj,lj=xl[j]
    if xi+li<=xj-lj:
      cnt+=1
      xi=xj
      li=lj
  ans=max(ans,cnt)
print(ans)


Fixed submission:
n=int(input())
xl=[list(map(int,input().split())) for _ in range(n)]
xl.sort(key=lambda x: x[0])
cnt=0
nx,nl=xl[0]
for i in range(1,n):
  x,l=xl[i]
  if nx+nl<=x-l:
    nx=x
    nl=l
  else:
    cnt+=1
    if nx+nl>=x+l:
      nx=x
      nl=l
print(n-cnt)
Buggy python submission (verdict: Runtime Error):
n,k,s=map(int,input().split())
if s<10**9:
  ans=[s]*k+[s+1]*(n-k)
else:
  ans=[s]*k+[1]*(n-k)
print(" ".join(map(str,arr)))

Fixed submission:
n,k,s=map(int,input().split())
if s<10**9:
  ans=[s]*k+[s+1]*(n-k)
else:
  ans=[s]*k+[1]*(n-k)
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
ans=0
m=[]
for i in range(n):
  if t[i] == "r":
    if i-k<0:
      m.append("p")
      ans+=p
    elif m[i-k]!="p":
      m.append("p")
      ans+=p
    elif i+k<=n and t[i+k] != "r":
      m.append("r")
    else:
      m.append("s")
  elif t[i] == "s":
    if i-k<0:
      m.append("r")
      ans+=r
    elif m[i-k]!="r":
      m.append("r")
      ans+=r
    elif i+k<=n and t[i+k] != "s":
      m.append("s")
    else:
      m.append("p")
  elif t[i]== "p":
    if i-k<0:
      m.append("s")
      ans+=s
    elif m[i-k]!="s":
      m.append("s")
      ans+=s
    elif i+k<=n and t[i+k] != "r":
      m.append("r")
    else:
      m.append("p")
print(ans)

Fixed submission:
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
ans=0
for i in range(n):
  if i>=k and t[i]==t[i-k]:
    t[i]=' '
  if t[i]=="r":
    ans+=p
  elif t[i]=="s":
    ans+=r
  elif t[i]=="p":
    ans+=s
print(ans)