Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = input()

count = x.count("1")

mod1 = 0 # 1少ない
mod2 = 0 # 1多い

#　初回の各桁のbitを反転させた場合のmod結果を格納するリスト
mod1_list = [0]*n
mod2_list = [0]*n

now1 = 1

x = x[::-1]

# mod1の計算
for i in range(n):
    mod1_list[i] = now1
    if x[i] == "1":
        mod1 += now1%(count+1)
    now1 *= 2
    now1 %= (count+1)

mod1 %= (count+1)

now2 = 1

# mod2の計算
if count >= 3:
    for i in range(n):
        mod2_list[i] = now2
        if x[i] == "1":
            mod2 += now2%(count-1)
        now2 *= 2
        now2 %= (count-1)
    
    mod2 %= (count-1)

mod1_list = mod1_list[::-1]
mod2_list = mod2_list[::-1]
x = x[::-1]

for i in range(n):
    total = 1
    if x[i] == "1":
        now = mod2-mod2_list[i]
        now %= (count-1)
    else:
        now = mod1+mod1_list[i]
        now %= (count+1)
        
    while now != 0:
        now = now%(bin(now).count("1"))
        total += 1

    print(total)

Fixed submission:
n = int(input())
x = input()

count = x.count("1")

mod1 = 0 # 1少ない
mod2 = 0 # 1多い

#　初回の各桁のbitを反転させた場合のmod結果を格納するリスト
mod1_list = [0]*n
mod2_list = [0]*n

now1 = 1

x = x[::-1]

# mod1の計算
for i in range(n):
    mod1_list[i] = now1
    if x[i] == "1":
        mod1 += now1%(count+1)
    now1 *= 2
    now1 %= (count+1)

mod1 %= (count+1)

now2 = 1

# mod2の計算
if count >= 3:
    for i in range(n):
        mod2_list[i] = now2
        if x[i] == "1":
            mod2 += now2%(count-1)
        now2 *= 2
        now2 %= (count-1)
    
    mod2 %= (count-1)

mod1_list = mod1_list[::-1]
mod2_list = mod2_list[::-1]
x = x[::-1]

for i in range(n):
    total = 1
    if x[i] == "1":
        if count == 1:
            print(0)
            continue
        elif count == 2:
            print(1)
            continue
        now = mod2-mod2_list[i]
        now %= (count-1)
    else:
        now = mod1+mod1_list[i]
        now %= (count+1)

    while now != 0:
        now = now%(bin(now).count("1"))
        total += 1

    print(total)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n,m,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
b = list(map(int,stdin.readline().rstrip().split()))

nowa = 0
nowb = 0

li = []
total = 0

while total <= k:
    if nowa == n and nowb == m:
        break
    if nowa == n and nowb < m:
        total += b[nowb]
        li.append(b[nowb])
        nowb += 1
    elif nowa < n and nowb == m:
        total += b[nowb]
        li.append(b[nowb])
        nowa += 1  
    elif a[nowa] <= b[nowb]:
        total += a[nowa]
        li.append(a[nowa])
        nowa += 1
    elif a[nowa] > b[nowb]:
        total += b[nowb]
        li.append(b[nowb])
        nowb += 1

if sum(li) <= k:
    print(len(li))
else:
    print(len(li)-1)

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
from itertools import accumulate
import bisect

n,m,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
b = list(map(int,stdin.readline().rstrip().split()))

aa = [0]+list(accumulate(a))
bb = [0]+list(accumulate(b))
ma = 0

for i,j in  enumerate(aa):
    if j > k:
        break
    nowa = i
    nowb = bisect.bisect(bb,k-j)-1
    ma = max(ma,nowa+nowb)

print(ma)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter
setrecursionlimit(10 ** 7)

n = int(input())
a = list(map(int,stdin.readline().rstrip().split()))

q = int(input())
cc = Counter(a)

for _ in range(q):
    b,c = map(int,input().split())
    cc[c] += cc[b]
    cc[b] -= cc[b]
    su = 0
    for i,j in cc.items():
        su += i*j
    print(su)

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter
setrecursionlimit(10 ** 7)

n = int(input())
a = list(map(int,stdin.readline().rstrip().split()))
su = sum(a)

q = int(input())
cc = Counter(a)

for _ in range(q):
    b,c = map(int,input().split())
    cc[c] += cc[b]
    su += c*cc[b]-b*cc[b]
    cc[b] -= cc[b]
    print(su)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = list(map(int,input().split()))
a = np.array(a,dtype=np.int64)
b = [((a>>i)&1).sum() for i in range(21)]
li = []
for i in a:
    c = np.array([((i>>j)&1) for j in range(21)],dtype=np.int64)
    d = b-c
    point = 0
    for i in range(31):
        if d[i]%2 == 1:
            point += 2**(i)
    li.append(point)

print(*li)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
now = 0
for i in a:
    now ^= i
li = []
for i in a:
    li.append(i^now)

print(*li)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = list(map(int,input().split()))
a = np.array(a,dtype=np.int64)
b = [((a>>i)&1).sum() for i in range(31)]
li = []
for i in a:
    c = np.array([((i>>j)&1) for j in range(31)],dtype=np.int64)
    d = b-c
    point = 0
    for i in range(31):
        if d[i]%2 == 1:
            point += 2**(i)
    li.append(point)

print(*li)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
now = 0
for i in a:
    now ^= i
li = []
for i in a:
    li.append(i^now)

print(*li)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n = int(input())
a = list(map(int,input().split()))
a = np.array(a,dtype=np.int64)
b = [((a>>i)&1).sum() for i in range(61)]
li = []
for i in a:
    c = np.array([((i>>j)&1) for j in range(61)],dtype=np.int64)
    d = b-c
    point = 0
    for i in range(61):
        if d[i]%2 == 1:
            point += 2**(i)
    li.append(point)

print(*li)

Fixed submission:
import numpy as np

n = int(input())
a = list(map(int,input().split()))
now = 0
for i in a:
    now ^= i
li = []
for i in a:
    li.append(i^now)

print(*li)
Buggy python submission (verdict: Runtime Error):
from itertools import accumulate
from copy import deepcopy

n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [0]*(n+1)

if k > 41:
    k = 41

for _ in range(k):
    b = [0]*(n+1)
    for i,j in enumerate(a):
        b[max(0,i-j)] += 1
        b[min(n,i+j+1)] -= 1
    a = list(accumulate(b))
    for i in range(n+1):
        if a[i] >= n:
            a[i] = n

print(*a[:-1])

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

s = input()
print(s[:3])
Buggy python submission (verdict: Runtime Error):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,d = map(int,stdin.readline().rstrip().split())

li = [1]*a+[0]*b+[-1]*c

print(sum(li[:d]))

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

a,b,c,d = map(int,stdin.readline().rstrip().split())

if d > a+b:
    print(a-(d-a-b))
elif d < a:
    print(d)
else:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
a = [0]+a
bunki = 0
now = a[1]
lip = [1]
while True:
    bunki += 1
    if now in lip:
        break
    lip.append(now)
    now = a[now]

tenki = lip.index(now)

lis = lip[tenki:]

roop = bunki-tenki

if k < tenki: 
    print(lip[k])
    exit()
k -= tenki

print(lis[k%roop])

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
a = [0]+a
bunki = 0
now = a[1]
lip = [1]
se = set()
while True:
    bunki += 1
    if now in se:
        break
    se.add(now)
    lip.append(now)
    now = a[now]

tenki = lip.index(now)
lis = lip[tenki:]
roop = bunki-tenki

if k < tenki: 
    print(lip[k])
    exit()
k -= tenki

print(lis[k%roop])

Buggy python submission (verdict: Runtime Error):
from sys import stdin
from sys import setrecursionlimit
import numpy as np
setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
a = [0]+a
bunki = 0
now = a[1]
lip = [1]
while True:
    bunki += 1
    if now in lip:
        break
    lip.append(now)
    now = a[now]

tenki = lip.index(now)

lis = lip[tenki:]

roop = bunki-tenki

if k < tenki: 
    print(lip[k])
    exit()
k -= tenki

print(lis[k%roop])

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

n,k = map(int,stdin.readline().rstrip().split())
a = list(map(int,stdin.readline().rstrip().split()))
a = [0]+a
bunki = 0
now = a[1]
lip = [1]
se = set()
while True:
    bunki += 1
    if now in se:
        break
    se.add(now)
    lip.append(now)
    now = a[now]

tenki = lip.index(now)
lis = lip[tenki:]
roop = bunki-tenki

if k < tenki: 
    print(lip[k])
    exit()
k -= tenki

print(lis[k%roop])
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from sys import setrecursionlimit
from itertools import accumulate

setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))
point = 0

for i in range(2,n):
    for j in range(n-i):
        if a[j]+a[j+i] == i:
            point += 1

print(point)

Fixed submission:
from sys import stdin
from sys import setrecursionlimit

setrecursionlimit(10 ** 7)

n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))

dic = {}
point = 0

for i,j in enumerate(a):
    if i+j in dic:
        dic[i+j] += 1
    else:
        dic[i+j] = 1

for i,j in enumerate(a):
    if i-j in dic:
        point += dic[i-j]

print(point)
Buggy python submission (verdict: Runtime Error):
from math import gcd
import numpy as np
k = int(input())
point = 0
li = [[0 for i in range(k+1)]for j in range(k+1)]
for i in range(1,k+1):
    for j in range(1,k+1):
        li[i][j] = gcd(i,j)
lin = []
for i in li:
    for j in i:
        if j != 0:
            lin.append(j)
for i in lin:
    for j in range(1,k+1):
        point += li[i][j]
print(point)

Fixed submission:
from math import gcd
k = int(input())
point = 0
li = [[0 for i in range(k+1)]for j in range(k+1)]
for i in range(1,k+1):
    for j in range(1,k+1):
        li[i][j] = gcd(i,j)
lin = []
for i in li:
    for j in i:
        if j != 0:
            lin.append(j)
for i in lin:
    for j in range(1,k+1):
        point += li[i][j]
print(point)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(stdin.readline().rstrip())
s = list(stdin.readline().rstrip())
li = [i for i in range(n)]
lin = list(combinations(li, 3))
point = 0
for i in lin:
    if s[i[0]] != s[i[1]] and s[i[2]] != s[i[1]] and s[i[0]] != s[i[2]]:
        if i[2]-i[1] != i[1]-i[0]:
            point += 1
print(point) 

Fixed submission:
n = int(input())
s = input()
R = s.count("R")
G = s.count("G")
B = s.count("B")
point = 0
#全ての組み合わせ
for i in range(n-2):
    for j in range(i+1,n-1):
        k = j + j-i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            point += 1
print(R*G*B-point)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(stdin.readline().rstrip())
s = list(stdin.readline().rstrip())
li = [i for i in range(n)]
lin = list(combinations(li, 3))
point = 0
for i in lin:
    if s[i[0]] != s[i[1]] and s[i[2]] != s[i[1]] and s[i[0]] != s[i[2]]:
        if i[2]-i[1] != i[1]-i[0]:
            point += 1
print(point) 

Fixed submission:
n = int(input())
s = input()
R = s.count("R")
G = s.count("G")
B = s.count("B")
point = 0
#全ての組み合わせ
for i in range(n-2):
    for j in range(i+1,n-1):
        k = j + j-i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            point += 1
print(R*G*B-point)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin,setrecursionlimit
setrecursionlimit(10 ** 7)
n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
point = 0
for k in range(2,len(s)):
    for j in range(1,k):
        for i in range(j):
            if s[i] != s[j] and s[i]!= s[k] and s[j] != s[k]:
                if j-i != k-j:
                    point += 1
print(point)

Fixed submission:
n = int(input())
s = input()
R = s.count("R")
G = s.count("G")
B = s.count("B")
point = 0
#全ての組み合わせ
for i in range(n-2):
    for j in range(i+1,n-1):
        k = j + j-i
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            point += 1
print(R*G*B-point)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

for i in a:
    point = 0
    for j,k in dic.items():
        if j == i:
            point += (k-1)*(k-2)//2
        else:
            point += k*(k-1)//2
    print(point)

Fixed submission:
from sys import stdin,setrecursionlimit
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
lin = [0]*(n+1)
for i in li:
    lin[i] += 1
liv = [0]*(n+1)
point = 0
for j,k in enumerate(lin):
    point += k*(k-1)//2
    liv[j] += k*(k-1)//2
for i in li:
    print(point-liv[i]+(lin[i]-1)*(lin[i]-2)//2)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin,setrecursionlimit
import string
from itertools import product
setrecursionlimit(10**7)
n = int(stdin.readline().rstrip())
alpha = "abcdefghijklmn"
kouho = set("")
#0~9までの数字を列挙
li = [str(i) for i in range(n)]
#重複ありで全探索
lin = list(product(li, repeat=n))
for i in lin:
    #数列にする
    s = ''.join(map(str, i))
    point = 0
    moto = s[:]
    while True:
        flag = False
        for j in s:
            #数字が出てきたらアルファベットに置換する
            if j in "0123456789":
                s = s.replace(j,alpha[point])
                point += 1
                flag = True
                break
        #すべての文字列が置換されたらbreak
        if flag == False:
            break
    #重複してたら候補に入れない
    kouho.add(s)
kouho = list(kouho)
kouho.sort()
for i in kouho:
    print(i)

Fixed submission:
import string

alphabet = string.ascii_lowercase

n = int(input())

def DFS(before,keta):
    num = 0
    if keta == n:
        print(before)
        return
    for i in before:
        num = max(num,alphabet.index(i))
    num += 1
    for j in range(num+1):
        DFS(before+alphabet[j],keta+1)

DFS("a",1)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input())

for i in range(0,100):
    if int(i*1.08) == a and int(i*1.1) == b:
        print(i)
        exit()
        
print(-1)

Fixed submission:
from sys import stdin
a,b = map(int,stdin.readline().rstrip().split())
for i in range(1001):
    if int(i*0.08) == a and int(i*0.1) == b:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                sin = i[2] + sin
            else:
                sin += i[2]
        else:
            if point%2 == 0:
                sin += i[2]
            else:
                sin = i[2] + sin
if point%2 == 1:
    sin = sin[::-1]
print(sin)

Fixed submission:
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
omote = ""
ura = ""
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                omote += i[2]
            else:
                ura += i[2]
        else:
            if point%2 == 0:
                ura += i[2]
            else:
                omote += i[2]
if point%2 == 0:
    omote = omote[::-1]
    sin = omote + sin + ura
    print(sin)
else:
    sin = sin[::-1]
    ura = ura[::-1]
    sin = ura + sin + omote
    print(sin)

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
for i in li:
    if i[0] == "1":
        sin = sin[::-1]
    elif i[0] == "2":
        if i[1] == "1":
            sin = i[2] + sin
        else:
            sin += i[2]
print(sin)

Fixed submission:
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
omote = ""
ura = ""
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                omote += i[2]
            else:
                ura += i[2]
        else:
            if point%2 == 0:
                ura += i[2]
            else:
                omote += i[2]
if point%2 == 0:
    omote = omote[::-1]
    sin = omote + sin + ura
    print(sin)
else:
    sin = sin[::-1]
    ura = ura[::-1]
    sin = ura + sin + omote
    print(sin)
Buggy python submission (verdict: Runtime Error):
#解法その１
a,b,c = map(int,input().split())
if a == b != c:
    print("Yes")
elif a == c != b:
    print("Yes")
elif b == c != a:
    print("Yes")
else:
    print("No")
#解法その２
li = list(map(int,input().split()))
li2 = set(li)#liの中の被っている要素を排除する（例：3 2 2 > 3 2）
if len(li2) == 2:#かぶり要素を排除したときのリスト内部の個数が２になっている
    print("Yes")
else:
    print("No")

Fixed submission:
from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
li = list(set(li))
if len(li) == 2:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
li = list(map(int,input.split()))
li2 = set(li2)#liの中の被っている要素を排除する（例：3 2 2 > 3 2）
if len(li2) == 2:#かぶり要素を排除したときのリスト内部の個数が２になっている
    print("Yes")
else:
    print("No")

Fixed submission:
from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
li = list(set(li))
if len(li) == 2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from sys import setrecursionlimit
setrecursionlimit(10 **7)
n = "0"+input()
N = len(n)
#num:それまでに何枚使ったか
#keta:何桁目まで確認したか（上の桁から数えて)
def oturi(num,keta):
    one_push = num + 10-int(n[keta])+1#前の桁で一つ多い分
    no_push = num + int(n[keta])
    if keta == N-1:
        return min(one_push,no_push)
    num = min(one_push,no_push)
    return oturi(num,keta+1)
print(oturi(0,0))

Fixed submission:
n = "0" + input() # 文字列として受け取り
N = len(n)
plus = 1
just = 0
for i in range(1,N):
    #前の桁がplusだった場合の最低枚数を計算する
    plus_plus = plus+10-(int(n[i])+1)#この桁も１枚多く払う
    plus_just = plus+10-int(n[i])#この桁はちょうど払う
    #前の桁はちょうど払っていた場合
    just_plus = just+1+int(n[i])#この桁は１枚多く払う
    just_just = just+int(n[i])#この桁もちょうど払う
    
    plus = min(plus_plus,just_plus)
    just = min(just_just,plus_just)

#最後の桁は1枚余分に払う必要がない
print(just)

Buggy python submission (verdict: Runtime Error):
n = "0"+input()
N = len(n)
mi = 10**100
#num:それまでに何枚使ったか
#keta:何桁目まで確認したか（上の桁から数えて)
#mae:前の桁で一つ多めに支払ったか
def oturi(num,keta,mae):
    global mi
    #最後の桁までたどり着いた場合
    if keta == N-1:
        #前の桁で一つ多めに支払ってた場合
        if mae == True:
            num += 10-int(n[keta])
            mi = min(mi,num)
            return
        #前の桁でちょっきり支払ってた場合
        else:
            num += int(n[keta])
            mi = min(mi,num)
            return
    #最後の桁ではない場合
    #前の桁で一つ多めに支払ってた場合
    if mae == True:
        num += 10-int(n[keta])
        return oturi(num+1,keta+1,True),oturi(num,keta+1,False)
    #前の桁でちょっきり支払ってた場合
    else:
        num += int(n[keta])
        return oturi(num+1,keta+1,True),oturi(num,keta+1,False)
oturi(0,0,True);oturi(0,0,False)
print(mi)

Fixed submission:
n = "0" + input() # 文字列として受け取り
N = len(n)
plus = 1
just = 0
for i in range(1,N):
    #前の桁がplusだった場合の最低枚数を計算する
    plus_plus = plus+10-(int(n[i])+1)#この桁も１枚多く払う
    plus_just = plus+10-int(n[i])#この桁はちょうど払う
    #前の桁はちょうど払っていた場合
    just_plus = just+1+int(n[i])#この桁は１枚多く払う
    just_just = just+int(n[i])#この桁もちょうど払う
    
    plus = min(plus_plus,just_plus)
    just = min(just_just,plus_just)

#最後の桁は1枚余分に払う必要がない
print(just)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
n,k = map(int,stdin.readline().rstrip().split())
li = list(map(int,stdin.readline().rstrip().split()))
ma = 0
for i in range(n-k+1):
    lin = li[i:i+k]
    point = 0
    if len(lin) != k:
        break
    for j in lin:
        point += (1+j)/2
    ma = max(ma,point)
print(ma)

Fixed submission:
from sys import stdin
from itertools import accumulate
n,k = map(int,stdin.readline().rstrip().split())
li = list(map(int,stdin.readline().rstrip().split()))
ma = 0
lin = []
for i in li:
    lin.append((i+1)/2)
lis = [0]+list(accumulate(lin))
ma = 0
for i in range(n-k+1):
    if i+k > n:
        break
    l = lis[i+k]-lis[i]
    ma = max(ma,l)
print(ma)
Buggy python submission (verdict: Runtime Error):
from sys import stdin

h,n = [int(x) for x in stdin.readline().rstrip().split()]
a = [0]*n ;b = [0]*n

for i in range(n):
    a[i],b[i] = [int(x) for x in stdin.readline().rstrip().split()]

#最高で削られる可能性がある体力
H = max(a)

inf = 10**10

#体力をちょうどi削るために必要な最低の魔力
dp = [inf for _ in range(h+H+1)];dp[0] = 0

for i in range(n):
    for j in range(h+1):
        if dp[j+a[i]] > dp[j] + b[i]:
            dp[j+a[i]] = dp[j] + b[i]

print(min(dp[h:]))

Fixed submission:
from sys import stdin
import math
a,b = [int(x) for x in stdin.readline().rstrip().split()]
print(math.ceil(a/b))