Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a = list(input())
b = np.array([1 for i in range(len(a))])
#print(a)
keep1 = np.array([0 for i in range(len(a))])
keep2 = np.array([0 for i in range(len(a))])
hako = np.array([0 for i in range(len(a))])
for j in range(1000000000):
    hako = np.array([0 for i in range(len(a))])
    #print(b,keep1, keep2-b,(keep2 - b).any())
    if j % 2 == 0 and not (keep2 - b).any():
        print(' '.join(map(str,b)))
        break
    for i in range(len(a)):
        if a[i] == 'L' and b[i] >= 1:
            hako[i - 1] += b[i]

        elif a[i] == 'R' and b[i] >= 1:
            hako[i + 1] += b[i]
    
    keep2 = np.copy(keep1)
    keep1 = np.copy(b)
    b = np.copy(hako)

Fixed submission:

a = list(input().split('LR'))
for i in range(len(a) - 1):
    a[i] += 'L'
    a[i + 1] = 'R' + a[i + 1]

#print(a)

b = []
c = 0
d = []
for j in range(len(a)):
    b = [0 for i in range(len(a[j]))]
    c = a[j].find('L')
    #print(c)
    if c % 2 == 0:
        b[c - 1] = len(a[j]) // 2
        b[c] = len(a[j]) - len(a[j]) // 2
    else:
        b[c] = len(a[j]) // 2
        b[c - 1] = len(a[j]) - len(a[j]) // 2

    d.extend(b)

print(' '.join(map(str,d)))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

if a % 2 == 0 and b % 2 != 0:
	print('IMPOSSIBLE')
	exit()
if a % 2 != 0 and b % 2 == 0:
  	print('IMPOSSIBLE')
	exit()
print((a + b) // 2)


Fixed submission:
a,b = map(int,input().split())
 
if a % 2 == 0 and b % 2 != 0:
  print('IMPOSSIBLE')
  exit()
if a % 2 != 0 and b % 2 == 0:
  print('IMPOSSIBLE')
  exit()
print((a + b) // 2)

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

if a % 2 == 0 and b % 2 != 0:
	print('Impossible')
    exit()
if a % 2 != 0 and b % 2 == 0:
  	print('Impossible')
    exit()
print((a + b) // 2)

Fixed submission:
a,b = map(int,input().split())
 
if a % 2 == 0 and b % 2 != 0:
  print('IMPOSSIBLE')
  exit()
if a % 2 != 0 and b % 2 == 0:
  print('IMPOSSIBLE')
  exit()
print((a + b) // 2)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input()))
c = list(map(int,input()))

ans = 0
for i in range(a):
  ans += min(b[i],c[i])
  c[i] -= min(b[i],c[i])
  ans += min(b[i + 1], c[i])

print(ans)
    

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0
for i in range(a):
  ans += min(b[i],c[i])
  c[i] -= min(b[i],c[i])
  ans += min(b[i + 1], c[i])
  b[i + 1] -= min(b[i + 1], c[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < a[2]):
  print(b)
 
else:
  print(a[2])

Fixed submission:
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < int(a[2])):
  print(b)
 
else:
  print(a[2])
Buggy python submission (verdict: Runtime Error):
a,b = input().split(' ')

c = []
for i in range(int(a)):
  c.append(input().split(' '))

count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
    ans = 0
    for l in rnage(int(b)):
      ans = ans + (int(c[j][l]) ** 2 - int(c[k][l]) ** 2) ** 0.5

    if ans = int(ans):
      count = count + 1

print(count)

Fixed submission:
a,b = input().split(' ')
 
c = []
for i in range(int(a)):
  c.append(input().split(' '))

ans = 0
count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
        ans = 0
        for l in range(int(b)):
            ans = ans + (int(c[j][l]) - int(c[k][l])) ** 2
        if ans ** 0.5 == round(ans ** 0.5):
            count = count + 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = input().split(' ')
a = int(a)
b = int(b)

ans = 100000000000
check = False

for i in range(a, b):
    if check:
        break
    for j in range(i + 1, b + 1):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019

print(ans)


Fixed submission:
a,b = input().split(' ')
a = int(a)
b = int(b)
 
ans = 100000000000
 
for i in range(a, min(b, a + 2019)):
    for j in range(i + 1, min(b + 1, a + 2019)):
        if (i * j) % 2019 < ans:
            ans = (i * j) % 2019
 
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
s.sorted()
if s.count(s[0]) == s.count(s[-1]):
  print('Yes')
else:
  print('No')


Fixed submission:
s = list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
s = input()
s.sort()
if s.count(s[0]) == s.count(s[-1]):
  print('Yes')
else:
  print('No')

Fixed submission:
s = list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a = input().split('/')
if a[0] > 2019 and a[1] > 5:
  print('TBD')
  
else:
  print('Heisei')


Fixed submission:
a = input().split('/')
if a[1][0] == '0':
  a[1] = a[1][1]
if int(a[0]) >= 2019 and int(a[1]) >= 5:
  print('TBD')
  
else:
  print('Heisei')
Buggy python submission (verdict: Runtime Error):
l = list(map(float,input.split()))
m =l［0］/l［1］
print(m)

Fixed submission:
l = list(map(float,input().split()))
m =l[0]/l[1]
print(m)
Buggy python submission (verdict: Runtime Error):
n = input()
m = list(map(int,input().split()))
m = m.sorted()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()
m = list(map(int,input().split()))
m.sort()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

c = list(map(int,input().split()))
c.sort()

d = []
for i in range(b-1):
    d.append(c[i+1] - c[i])

d.sort()

#print(c,d)

for k in range(a - 1):
    d.pop()

print(sum(d))

Fixed submission:
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  c.sort()
  for j in range(min(a[0] - 1,a[1])):
    c[len(c)- 1 - j] = 0
  print(sum(c))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  for j in range(min(a[0] - 1,a[1])):
    for k in range(len(c)):
      if c[k] == max(c):
        c[k] = 0
        break
  print(sum(c))



Fixed submission:
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  c.sort()
  for j in range(min(a[0] - 1,a[1])):
    c[len(c)- 1 - j] = 0
  print(sum(c))

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

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(1)
  
    
else:  
  for j in range(min(a[0] - 1,a[1]):
    for k in range(len(c)):
      if c[k] == max(c):
        c[k] = 0

  print(sum(c))


Fixed submission:
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  c.sort()
  for j in range(min(a[0] - 1,a[1])):
    c[len(c)- 1 - j] = 0
  print(sum(c))

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

c = []
if len(b) != 0:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 0:
  print(1)
  
    
else:  
  for j in range(min(a[0] - 1,a[1]):
    for k in range(len(c)):
      if c[k] == max(c):
        c[k] = 0

  print(sum(c))

Fixed submission:
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  c.sort()
  for j in range(min(a[0] - 1,a[1])):
    c[len(c)- 1 - j] = 0
  print(sum(c))
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])

for i in range(a):
    if c[i] != []:
        c[i].sort()

#print(z)
x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    x = '0' * (6 - len(x)) + x
    y = str(c[z[j][0] - 1].index(z[j][1]) + 1)
    y = '0' * (6 - len(y)) + y
    print(x + y)

Fixed submission:
import bisect
a,b = map(int,input().split())

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])

for i in range(a):
    if c[i] != []:
        c[i].sort()

x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    x = '0' * (6 - len(x)) + x
    y = str(bisect.bisect(c[z[j][0] - 1], z[j][1]))
    y = '0' * (6 - len(y)) + y
    print(x + y)

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

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])
d = c.copy()


for i in range(a):
    if c[i] != []:
        c[i].sort()

#print(z)
h = []
x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    while len(x) <= 5:
        x = '0' + x
    y = str(c[z[j][0] - 1].index(z[j][1]) + 1)
    while len(y) <= 5:
        y = '0' + y
    print(x + y)

Fixed submission:
import bisect
a,b = map(int,input().split())

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])

for i in range(a):
    if c[i] != []:
        c[i].sort()

x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    x = '0' * (6 - len(x)) + x
    y = str(bisect.bisect(c[z[j][0] - 1], z[j][1]))
    y = '0' * (6 - len(y)) + y
    print(x + y)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())

a = []
for i in range(n):
    a.append(list(map(int,input().split())))

b = []
for i in range(n):
    b += [100 * (i + 1) for j in range(a[i][0])]

d = []
ans = 1000000000000000
for i in range(2 ** len(b)):
    check = 0
    c = []
    counter = {}
    for j in range(len(b)):
        if (i >> j) & 1:
            if b[j] in counter.keys():
                c.append(b[j])
                counter[b[j]] += 1
            else:
                c.append(b[j])
                counter[b[j]] = 1
    for k in range(n):
        if 100 * (k + 1) in counter.keys():
            if counter[100 * (k + 1)] == a[k][0]:
                check += a[k][1]
    check += sum(c)
    if check >= m and len(c) < ans:
        ans = len(c)
    #print(ans, check, c)
print(ans)

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

a = []
for i in range(n):
    a.append(list(map(int,input().split())))

ans = 1000000000000000
for i in range(2 ** n):
    check = 0
    ac = 0
    tmp = 0
    for j in range(n):
        if (i >> j) & 1:
            check += a[j][0] * 100 * (j + 1) + a[j][1]
            tmp += a[j][0]
        
        if check >= m:
            ans = min(ans, tmp)

        else:
            for k in reversed(range(n)):
                if not (i >> k) & 1:
                    ac = -(-(m - check) // ((k + 1) * 100))
                    if ac < a[k][0]:
                        ans = min(ans, ac + tmp)

print(ans)

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

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

b = []
for i in range(n):
    b += [100 * (i + 1) for j in range(a[i][0])]
#print(b)

d = []
ans = 1000000000000000
for i in range(2 ** len(b)):
    check = 0
    c = []
    for j in range(len(b)):
        if (i >> j) & 1:
            c.append(b[j])
    for k in range(n):
        if c.count(100 * (k + 1)) == a[k][0]:
            check += a[k][1]
    #print(check)
    check += sum(c)
    if check >= m and len(c) < ans:
        ans = len(c)
    #print(ans, check, c)
    
    d.append(c)

print(ans)



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

a = []
for i in range(n):
    a.append(list(map(int,input().split())))

ans = 1000000000000000
for i in range(2 ** n):
    check = 0
    ac = 0
    tmp = 0
    for j in range(n):
        if (i >> j) & 1:
            check += a[j][0] * 100 * (j + 1) + a[j][1]
            tmp += a[j][0]
        
        if check >= m:
            ans = min(ans, tmp)

        else:
            for k in reversed(range(n)):
                if not (i >> k) & 1:
                    ac = -(-(m - check) // ((k + 1) * 100))
                    if ac < a[k][0]:
                        ans = min(ans, ac + tmp)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int,input().split())

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

bridge = n
ans = 0
for i in range(m):
    count = True
    for j in range(a[m - i - 1][0],a[m - i - 1][1]):
        if j >= bridge:
            count = False
            break
            
    if count:
        ans += 1
        bridge = a[m - i - 1][0]

print(ans)

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

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

bridge = n
ans = 0
for i in range(m):
    count = True
    if a[m - i - 1][1] > bridge:
        count = False
            
    if count:
        ans += 1
        bridge = a[m - i - 1][0]

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

a_list = list(map(int, input().split()))
s = 0
for i in range(n-1):
    for j in range(i+1, n):
        s += a_list[i] * a_list[j]

ans = s % 1000000007

print(ans)



Fixed submission:
n = int(input())

a_list = list(map(int, input().split()))
sum_l = sum(a_list)
ans = 0
for i in range(n-1):
    sum_l -= a_list[i]
    ans += sum_l * a_list[i]
print(ans % 1000000007)

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

a_list = list(map(int, input().split()))
s = 0
for i in range(n-1):
    for j in range(i+1, n):
        s += a_list[i] * a_list[j]

ans = s % 1000000007

print(ans)



Fixed submission:
n = int(input())

a_list = list(map(int, input().split()))
sum_l = sum(a_list)
ans = 0
for i in range(n-1):
    sum_l -= a_list[i]
    ans += sum_l * a_list[i]
print(ans % 1000000007)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
while True:
    n, m = divmod(n, 10)
    s += m * 10
    if n <= 0:
        break
print('Yes' if s % 9 == 0 else 'No')

Fixed submission:
n = input()
s = 0
for i in range(len(n)):
    s += int(n[i])
print('Yes' if s % 9 == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
x = list(map(int, input().split()))

for i in range(x):
    if x[i] == 0:
        print(i+1)
        break

Fixed submission:
x = list(map(int, input().split()))
for i in range(len(x)):
    if x[i] == 0:
        print(i+1)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split(' '))
a = [int(tmp) for tmp in input().split(' ')]
point = 1

for i in range(k):
    point *= a[i]

for i in range(n - k):
    f_point = point // a[i] * a[k+i]
    if point < f_point:
        print('Yes')
    else:
        print('No')
    
    point = f_point


Fixed submission:
n, k = map(int, input().split(' '))
a = [int(tmp) for tmp in input().split(' ')]
[print('Yes') if a < b else print('No') for a, b in zip(a[:n - k], a[k:])]
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

mae = []
stepsum = 0
for i in A:
  if mae and max(mae) > i:
    stepsum += max(mae)-i
  mae.append(i)

print(stepsum)

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

heighest = 0
stepsum = 0
for i in A:
  if heighest < i:
    heighest = i
    continue
  else:
    stepsum += heighest-i

print(stepsum)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
count = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x+y+z == S:
        count += 1

print(count)

Fixed submission:
K, S = map(int, input().split())
count = 0
for x in range(K+1):
  for y in range(K+1):
    z = S - x - y
    if z >= 0 and z <= K:
      count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a=set(int,input().split())
print(len(a)

Fixed submission:
a=set(map(int,input().split()))
print(len(a))
Buggy python submission (verdict: Runtime Error):
N,K,X,Y=[int(input()) for i in range(4)]

if(K>N):
  N=K
else:
  

Z=K*X+(N-K)*Y
print(Z)

Fixed submission:
N,K,X,Y=[int(input()) for i in range(4)]

if(K>=N):
  Z=N*X
  print(Z)
else:
  Z=K*X+(N-K)*Y
  print(Z)
Buggy python submission (verdict: Runtime Error):
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    if b==2:
      print(b)
      import sys
      sys.exit()
    
  if i==S and b>0 :
    b-=1
    
print(b)

Fixed submission:
a = input()
 
if("RRR" in a):
  print("3")
elif("RR" in a):
  print("2")
elif("R" in a):
  print("1")
else:
  print("0")

Buggy python submission (verdict: Runtime Error):
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    
  if i==S and b>0:
    b-=1
    
print(b)

Fixed submission:
a = input()
 
if("RRR" in a):
  print("3")
elif("RR" in a):
  print("2")
elif("R" in a):
  print("1")
else:
  print("0")
Buggy python submission (verdict: Runtime Error):
print(ABC+input())

Fixed submission:
print('ABC'+input())
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=sum(a)

if (b%3 or a[0]%3 or a[1]) !=0 :
  print('Impossible')
elif :
  print('Possible')

Fixed submission:
a=list(map(int,input().split()))
b=sum(a)
 
if (b%3 ==0 or a[0]%3 ==0 or a[1]%3==0) :
  print('Possible')
else :
  print('Impossible')
Buggy python submission (verdict: Runtime Error):
a=input().split()
b=[]

for i in range(3):
  b.append(a[0][i].upper())
  
  
print(b[0]+b[1]+b[2])

Fixed submission:
a=input().split()
b=[]

for i in range(3):
  b.append(a[i][0].upper())
  
  
print(b[0]+b[1]+b[2])
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))

if a[0]+a[2]=2*a[1]:
  print('YES')

else:
  print('NO')

Fixed submission:
a=list(map(int,input().split()))
 
if a[0]+a[2]==2*a[1]:
  print('YES')
 
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
ans=1
for i in range(a):
  ans*=(i+1)
  

print(ans%(10**9+7))

Fixed submission:
a=int(input())
import math

b=math.factorial(a)
print(b%(10**9+7))
Buggy python submission (verdict: Runtime Error):
a,b=[input() for i in range(2)]
p=0
ans=0

for i in b:
  if i =='I':
    p+=1
  elif i =='D' and p>0:
    p-=1
  else:
    p-=1
  
  if ans<p:
    ans=p
 
print(ans)

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

b=a[0]*a[1]
c=a[2]*a[3]

if b-c>0:
  print(b)

else:
  print(c)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
n=0

for x in range(a+1):
  for y in range(a+1):
    for z in range(a+1):
      
      if x+y+z==b:
        n+=1
print(n)
      
   

Fixed submission:
a,b=map(int,input().split())
n=0

for y in range(a+1):
  for z in range(a+1):
      p=b-y-z
      if 0<=p and p<=a:
        n+=1
print(n)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
c=[]

for i in range(a):
  c.append(input())

d=sorted(c)  
print(''.join(d))

Fixed submission:
import sys
a=list(map(int,input().split()))
s=0
f=0

for i in range(3):
  s+=a[i]
  
if s!=17:
  print('NO')
  sys.exit()
  
else:
  for t in range(3):
    if a[t]==5:
      f+=1
      
if f==2:
  print('YES')
  

else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
def decisum(n):
    if n == 0:
        return 0
    else:
        return n%10 + decisum(n//10)

n = int(input()) 

ans = not (decisum(n)%9)

if ans:
    print('Yes')
else:
    print('No')

Fixed submission:
n = list(input())

ans = 0
for i in n:
    ans += int(i)
    ans = ans%9

print('Yes' if ans == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
print(max(p_cum_diff))

Fixed submission:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
if len(p_cum_diff) > 0:
    print(max(p_cum_diff))
else:
    print(p_cum[-1])

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))

def expc(x):
    return (x + 1.0)/2.0

sum_max = sum(expc(p_array[0:k]) )
temp_sum = sum_max
for i in range(n-k):
    temp_sum -= expc(p_array[i])
    temp_sum += expc(p_array[i+k])
    if temp_sum > sum_max:
        sum_max = temp_sum

print(sum_max)



Fixed submission:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
if len(p_cum_diff) > 0:
    print(max(p_cum_diff))
else:
    print(p_cum[-1])