Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02629 (python)

Fixed submission:
def main():
    n = int(input())
    res = ''
    d = 1
    base = []
    alp = 'abcdefghijklmnopqrstuvwxyz'
    for b in range(12):
        mod = n % 26
        if mod == 0:
            mod = 26
        res = alp[mod-1] + res
        if n - mod == 0:
            break
        else:
            n = int((n - mod) / 26)
            
    print(res)




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    res = ''
    d = 1
    base = []
    alp = 'abcdefghijklmnopqrstuvwxyz'
    for i in range(12):
        d *= 26
        base.append(d)
    for b in base:
        if b > n:
            break
        mod = n % b
        n = n - mod
        res = alp[mod-1] + res
    print(res)




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input()) - 1
    res = ''
    d = 1
    base = []
    alp = 'abcdefghijklmnopqrstuvwxyz'
    for i in range(11):
        d *= 26
        base.append(d)
    st = True
    for b in base[::-1]:
        if b < n:
            st = False
        if st:
            continue
        res += alp[(n // b) -1]
        n = n % b
    res += alp[n]
    print(res)



if __name__ == '__main__':
    main()
Problem p02729 (python)

Fixed submission:
n, m = [int(i) for i in input().split()]

def calc(s):
  if s < 2:
    return int(0)
  else:
    return int(s * (s-1) / 2)

print(calc(n) + calc(m))

Buggy submission (verdict: Runtime Error):
import itertools
import numpy as np

res = 999999999999999999

H, W, K = [int(i) for i in input().split()]
arr = []
for _ in range(H):
  arr.append([int(v) for v in input()])

arr = np.array(arr)
  
for p in itertools.product([0, 1], repeat = H-1):
  sp = np.zeros((sum(p)+1, W), int)
  row = 0
  sp[0] += arr[0]
  for j in range(H-1):
    if p[j]:
      row += 1
    sp[row] += arr[j+1]
  if np.max(sp) > K:
    continue
  
  sum_arr = np.zeros(len(sp), int)
  cut_cnt = sum(p)
  for c in range(W):
    sum_arr += sp[:, c]
    if max(sum_arr) > K:
      sum_arr = sp[:, c]
      cut_cnt += 1
  if cut_cnt < res:
    res = cut_cnt
print(res)
Problem p02792 (python)

Fixed submission:
n = int(input())
c = [[0 for _ in range(10)] for _ in range(10)]

for i in range(1, n+1):
  si = str(i)
  a = int(si[0])
  b = int(si[-1])
  c[a][b] += 1

res = 0
for i in range(10):
  for j in range(10):
    res += c[i][j] * c[j][i]
print(res)

Buggy submission (verdict: Runtime Error):
n = int(input())
l = len(n)
c = [[0 for _ in range(9)] for _ in range(9)]

for i in range(1, n+1):
  c[i[0]-1][i[-1]-1] += 1

res = 0
for i in range(9):
  for j in range(9):
    res += c[i][j] * c[j][i]
print(res)
Problem p02912 (python)

Fixed submission:
from heapq import heappop, heappush
heap = []
N, M = map(int, input().split())
for i in list(map(int,input().split())):
    heappush(heap, i*-1)
for j in range(M):
    num = -((-heappop(heap))//2)
    heappush(heap, num)

print(sum(heap) * - 1)

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush
heap = []
N, M = map(int, input().split())
for i in list(map(int,input().split())):
    heappush(heap, i*-1)
for j in range(M):
    num = -((-heappop(heap))//2)
    heappush(heap)

print(sum(heap))

Buggy submission (verdict: Runtime Error):
from heapq import heappop, heappush
heap = []
N, M = map(int, input().split())
for i in map(int,input().split()):
    heappush(heap, i*-1)
for j in range(M):
    num = -((-heappop(heap))//2)
    heappush(heap)

print(sum(heap))
Problem p03135 (python)

Fixed submission:
T, X = map(float, input().split())
 
print("{0:.4f}".format(T/X))

Buggy submission (verdict: Runtime Error):
T = float(input())
X = float(input())

print("%.4f".format(T/X))

Buggy submission (verdict: Runtime Error):
T = input()
X = input()

print("{0:.3f}".format(T/X))
Problem p02990 (python)

Fixed submission:
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

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

if n == k:
    for i in range(k):
        if i == 0:
            cnt = 1
        else:
            cnt = 0
        print(cnt % (10 ** 9 + 7))

else:
    for i in range(k):
        j = i + 1
        if j > n-k+1:
            cnt = 0
        else:
            cnt = cc(n-k+1, j) * cc(k-1, j-1)


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

Buggy submission (verdict: Runtime Error):
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

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

if n == k:
    for i in range(k):
        if i == 0:
            cnt = 1
        else:
            cnt = 0
        print(cnt % (10 ** 9 + 7))

else:
    for i in range(k):
        j = i + 15
        if j > n-k+1:
            cnt = 0
        else:
            cnt = cc(n-k+1, j) * cc(k-1, j-1)


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

Buggy submission (verdict: Runtime Error):
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

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

if n == k:
    for i in range(k):
        if i == 0:
            cnt = 1
        else:
            cnt = 0
        print(cnt % (10 ** 9 + 7))

else:
    for i in range(k):
        j = i + 1
        cnt = cc(n-k+1, j) * cc(k-1, j-1)


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

Buggy submission (verdict: Runtime Error):
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

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

if n == k:
    for i in range(k):
        if i == 0:
            cnt = 1
        else:
            cnt = 0
        print(cnt % (10 ** 9 + 7))
        
else:
    for i in range(k):
        j = i + 1
        print(n-k+1, j, k-1, j)
        cnt = cc(n-k+1, j) * cc(k-1, j-1)
    
    
        print(cnt % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
from math import factorial

def cc(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

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

for i in range(k):
    j = i + 1
    cnt = cc(n-k+1, j) * cc(k-1, j-1)
    print(cnt % (10**9 + 7))
Problem p02627 (python)

Fixed submission:
a =input()
if(a.islower()):
    print("a")
else:
    print("A")

Buggy submission (verdict: Runtime Error):
num = int(input())
d = {"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9,"j":10,"k":11,"l":12,"m":13,"n":14,"o":15,"p":16,"q":17,"r":18,"s":19,"t":20,"u":21,"v":22,"w":23,"x":24,"y":25,"z":0}
op_d = {}
for i,j in d.items():
    op_d[j] = i
ans =""
for i in list(range(0,12))[::-1]:
    if(int(num/(26**i)) == 0 ):
        pass
    else:
        ans += op_d[int(num/(26**i))]
        num = num % 26**i;
print(ans)
Problem p02623 (python)

Fixed submission:
# from collections import deque
import numpy as np
def main():
    n, m, k = map(int, input().split())
    A = np.array([0] + list(map(int, input().split())))
    B = np.array([0] + list(map(int, input().split())))
    X = np.cumsum(A)
    Y = np.cumsum(B)
    # print(P,Q)

    cnt = 0
    j = m
    # Aをi個、Bをj個選ぶ
    for i, x in enumerate(X):
        if x > k:
            break

        while x + Y[j] > k:
            j -= 1
        cnt = max(cnt, i + j)

    print(cnt)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# from collections import deque
def main():
    n, m, k = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    cnt_A = 0
    cnt_B = 0
    time = 0
    cnt = 0

    while time <= k:
        # Aの本がまだ無くなっていない時
        if cnt_A < n:
            # Aの本の方が読みやすい
            if A[cnt_A] < B[cnt_B]:
                time += A[cnt_A]
                cnt_A += 1
                cnt += 1

            # Bの本の方が読みやすい
            else:
                time += B[cnt_B]
                cnt_B += 1
                cnt += 1

        # Aの本がなくなっている時
        else:
            if cnt_B < m:
                time += B[cnt_B]
                cnt_B += 1
                cnt += 1
            else:
                break

        #print(cnt,time)


    if time > k:
        print(cnt - 1)
    else:
        print(cnt)




if __name__ == "__main__":
    main()
Problem p02627 (python)

Fixed submission:
def main():
    s = input()
    alphabets = [chr(ord("a") + x) for x in range(26)]
    if s in alphabets:
        print("a")
    else:
        print("A")


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    alphabets = [None] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26**2*"1"+26**1*"1"+ 0):2桁
    # 27 ~ 52番：aa ~ az(26+1~26)
    # 53 ~ 78番：ba ~ bz(26*"2"+"1~26")
    # 703 ~ 18278(26+26*26+26*26*26):３桁
    # 703 ~ 726: aaa ~ aaz(26**2*"1"+26*"1"+"1~26")

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        # 最初は、26で割り、次は
        y = n % (26 ** (i+1))
        #print("amari:", y, "nokori:", n)
        if y == 0:
          num += [26]
        else:
          n -= y
          num += [y // (26**i)]

    #print(num)

    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()
Problem p02629 (python)

Fixed submission:
def main():
    n = int(input())
    alphabets = [None] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26**2*"1"+26**1*"1"+ 0):2桁
    # 27 ~ 52番：aa ~ az(26+1~26)
    # 53 ~ 78番：ba ~ bz(26*"2"+"1~26")
    # 703 ~ 18278(26+26*26+26*26*26):３桁
    # 703 ~ 726: aaa ~ aaz(26**2*"1"+26*"1"+"1~26")

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        # 最初は、26で割り、次は
        y = n % (26 ** (i+1))
        #print("amari:", y, "nokori:", n)
        if y == 0:
          num += [26]
          n -= 26 ** (i+1)
        else:
          n -= y
          num += [y // (26**i)]

    #print(num)

    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    alphabets = [None] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26**2*"1"+26**1*"1"+ 0):2桁
    # 27 ~ 52番：aa ~ az(26+1~26)
    # 53 ~ 78番：ba ~ bz(26*"2"+"1~26")
    # 703 ~ 18278(26+26*26+26*26*26):３桁
    # 703 ~ 726: aaa ~ aaz(26**2*"1"+26*"1"+"1~26")

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        # 最初は、26で割り、次は
        y = n % (26 ** (i+1))
        if y == 0:
          y = 26
        #print("amari:", y, "nokori:", n)
        n -= y
        num += [y // (26**i)]

    #print(num)

    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    alphabets = ["z"] + [chr(ord("a") + x) for x in range(26)]
    # 1~26:１桁
    # 27 ~ 702(26*26 + 26):2桁
    # 703 ~ 18278(26+26*26+26*26*26):３桁

    #何桁か？
    cnt = 0
    m = n
    while m > 0:
        cnt += 1
        m -= 26 ** cnt
    #print(cnt)

    # 各桁がどの文字か？
    num = []
    for i in range(cnt):
        y = n % (26 ** (i + 1))
        n -= y * (26 ** i)
        num += [y]
    #print(num)
    ans = ""
    for s in num[::-1]:
        ans += alphabets[s]
    print(ans)


if __name__ == "__main__":
    main()
Problem p02659 (python)

Fixed submission:
from decimal import *

def main():
    a, b = input().split()
    a = Decimal(a)
    b = Decimal(b)
    print(int(a * b))





if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = input().split()
    cnt = 1
    a = int(a)
    a1 = a
    while True:
        if a % 10 == 0:
            a /= 10
            cnt += 1
        else:
            break

    if cnt >= 2:
        b = float(b)
        #print(a, b, a*b)
        ans = int(a * b * 100) * (10 ** (cnt-2))
        print(ans)
    else:
        print(int(a1 * b))



if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = input().split()
    a = int(a)
    b = int(float(b) * 100)
    ans = str(a * b)
    ans = int(ans[:-2])
    print(ans)



if __name__ == "__main__":
    main()
Problem p02729 (python)

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

Buggy submission (verdict: Runtime Error):
l = int(input())
a = l/3
print(round(a**3,13))
Problem p02881 (python)

Fixed submission:
import math
n = int(input())
half = math.floor(n**0.5)
#print(half)

num1 = 0
for i in range(half+1,0,-1):
  if n % i == 0:
    num1,num2 = i,n//i  
    #print("Yes")
    break

if num1 == 0:
  print(n-1)
else:
  print(num1+num2-2)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
half = math.floor(n**0.5)
#print(half)

for i in range(half+1,0,-1):
  if n % i == 0 and 1 <=n/i<=9 :
    num1,num2 = i,n//i  
    #print("Yes")
    break

if not num1:
  print(n-1)
else:
  print(num1+num2-2)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
half = math.floor(n**0.5)
#print(half)

for i in range(half+1,0,-1):
  if n % i == 0 and 1 <=n/i<=9 :
    num1,num2 = i,n//i  
    #print("Yes")
    break

print(num1+num2-2)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split())
ans = c - a + b
if  ans < 0:
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
x = a + b
y = a-b
z = a* b
print(max(x,y,z))
Problem p03013 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
hole = [0]*(n+1)
for i in range(m):
  hole[int(input())] = 1

dp = [0]*(n+1)
dp[0] = 1
MOD = 10**9+7
   
for i in range(1,n+1):
  if hole[i]==1:
    dp[i] = 0
  else:
    dp[i] = dp[i-1]+dp[i-2]
    dp[i] %= MOD

print(dp[-1])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
hole = []*(n+1)
for i in range(m):
  hole[int(input())] = 1
dp = [0]*(n+1)
MOD = 10**9+7
   
for i in range(1,n+1):
  if hole[i]==1:
    dp[i] = 0
  dp[i] = dp[i-1]+dp[i-2]
  dp[i] %= MOD

print(dp[-1])
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
r = 0
for i, a in enumerate(A):
    min_idx = 0
    max_idx = len(B) - 1
    while min_idx < max_idx:
        j = (min_idx + max_idx + 1) // 2
        k = K - A[i] - B[j]
        if k < 0:
            max_idx = j - 1
        else:
            min_idx = j
    j = min_idx
    while j + 1 < len(B) and K - A[i] - B[j + 1] >= 0:
        j += 1
    if K - A[i] - B[j] >= 0:
        r = max(r, i + j)
print(r)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
r = 0
for i, a in enumerate(A):
    min_idx = 0
    max_idx = len(B) - 1
    while min_idx < max_idx:
        j = (min_idx + max_idx + 1) // 2
        k = K - A[i] - B[j]
        if k < 0:
            max_idx = j - 1
        else:
            min_idx = j
    j = min_idx
    while j < len(B) and K - A[i] - B[j + 1] >= 0:
        j += 1
    if K - A[i] - B[j] >= 0:
        r = max(r, i + j)
print(r)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
r = 0
for i, a in enumerate(A):
    min_idx = 0
    max_idx = len(B) - 1
    while min_idx < max_idx:
        j = (min_idx + max_idx + 1) // 2
        k = K - A[i] - B[j]
        if k < 0:
            max_idx = j - 1
        else:
            min_idx = j
    while K - A[i] - B[j + 1] >= 0:
        j += 1
    k = K - A[i] - B[j]
    if k >= 0:
        r = max(r, i + j)
print(r)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
memo = [[None] * (M + 1) for _ in range(N + 1)]
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
K = [[K - a - b for b in B] for a in A]
def solution(i=0, j=0):
    if i > N or j > M:
        return -1
    if memo[i][j] is not None:
        return memo[i][j]
    if K[i][j] == 0:
        memo[i][j] = 0
        return 0
    elif K[i][j] < 0:
        memo[i][j] = -1
        return -1
    memo[i][j] = 1 + max(
        solution(i + 1, j),
        solution(i, j + 1))
    return memo[i][j]
print(solution())
Problem p02831 (python)

Fixed submission:
from fractions import gcd

a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(int(a * b / math.gcd(a, b)))
Problem p04005 (python)

Fixed submission:
A,B,C = map(int,input().split())
if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
	print(0)
else:
	S = A * B * C
	mi = min(A,min(B,C))
	ma = max(A,max(B,C))
	mid = S // ma // mi
	ma //= 2
	ans = ma * mi * mid
	print(abs(S - ans * 2))

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A % 2 == 0 or B % 2 == 0 or C % 2 == 0:
	print(0)
	return
S = A * B * C
mi = min(A,min(B,C))
ma = max(A,max(B,C))
mid = S // ma // mi // 2
ans = ma * mi * mid
print(abs(S - ans * 2))
Problem p02879 (python)

Fixed submission:
num = [int(_) for _ in input().split(" ")]
if 0<num[0]<10 and 0<num[1]<10:
  print(num[0]*num[1])
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
num = int(input())
Flag = False
for x in range(1,10):
    for y in range(x,10):
        if x * y == num:
            Flag = True
            break
    if Flag == True:
        break

if Flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
num = int(input())
Flag = False
for x in range(2,10):
    for y in range(x,10):
        print("x"+str(x)+":y"+str(y))
        if x * y == num:
            Flag = True
            break
    if Flag == True:
        break

if Flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
num = int(input())
Flag = True
for x in range(2,10):
  if num % x == 0:
    Flag = False
    break
if flag:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
_ = input().split(" ")
if 0<_[0]<10 and 0<_[1]<10:
  print(_[0]*_[1])
else:
  print(-1)
Problem p02880 (python)

Fixed submission:
num = int(input())
Flag = False
for x in range(1,10):
  for y in range(x,10):
    if x * y == num:
      Flag = True
      break
    if Flag == True:
      break

if Flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
num = int(input())
Flag = True
for x in range(2,10):
  if num % x == 0:
    Flag = False
    break
if flag:
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
num = int(input())
flag = True
for x in range(2,10):
  if num % x == 0:
    print("YES")
	flag = False
if flag:
  print("NO")

Buggy submission (verdict: Runtime Error):
num = int(input())
flag = True
for _ in range(2,10):
  if num % _ == 0:
    print("YES")
	flag = False
if flag:
  print("NO")
Problem p02753 (python)

Fixed submission:
S = list(i for i in input())

if 'A' in S and 'B' in S:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
Q = int(input())
Q_list = list()
for i in range(Q):
    Q_list.append(input().split())

from collections import deque
def operate(i):
    global count, str_list
    if Q_list[i][0] == '1':
        count += 1
    else:
        if count % 2 == 0:
            if Q_list[i][1] == '1':
                str_list.appendleft(Q_list[i][2])
            else:
                str_list.append(Q_list[i][2])
        else:
            if Q_list[i][1] == '1':
                str_list.append(Q_list[i][2])
            else:
                str_list.appendleft(Q_list[i][2])

check = 0
for i in range(Q):
    if Q_list[i][0] == '1':
        check += 1

if check % 2 == 1:
    S_list = list(reversed(S_list))

str_list = deque()
str_list.append(S)
count = check%2
for i in range(Q):
    operate(i)
print(''.join(str_list))
Problem p02777 (python)

Fixed submission:
S, T = map(str,input().split())
A, B = map(int,input().split())
U = input()
if U == S:
    A -= 1
else:
    B -= 1
print(str(A) +' '+ str(B))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Buggy submission (verdict: Runtime Error):
import numpy as np
def Expected_Value(x):
    EV = 0
    for i in range(1,x+1):
        EV += i/x
    return EV
N, K = map(int, input().split())
pi = np.array(list(map(int, input().split())))
ma = 0
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    if x > ma:
        ma = x
        max_index = i
array_max = (np.array(pi[max_index:max_index+K])-1) *0.5 + 1
print(array_max.sum())

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
pi = list(map(int, input().split()))
K_sum = []
for i in range(N-K+1):
    K_sum.append(sum(pi[i:i+K])) 
index = K_sum.index(max(K_sum))
array_max = (np.array(pi[index:index+K])-1) *0.5 + 1
print(array_max.sum())