Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N= int(input())
a = [input().split() for i in range(N)]

n = int(a[0])
Is = []
for i in range(N):
    Ds = list(map(int, a[i].split()))
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i] == Is[i+1] and Is[i+1] == Is[i+2]:
        Boooo = True

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



Fixed submission:
N= int(input())
a = [input().split() for i in range(N)]

Is = []
for i in range(N):
    Ds = a[i]
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i]+1 == Is[i+1] and Is[i+1]+1 == Is[i+2]:
        Boooo = True

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

Buggy python submission (verdict: Runtime Error):
import sys
a = []
for l in sys.stdin:
    a.append(int(l))
n = a[0]
Is = []
for i in range(n):
    Ds = list(map(int, a[i+1].split()))
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i] == Is[i+1] and Is[i+1] == Is[i+2]:
        Boooo = True

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



Fixed submission:
N= int(input())
a = [input().split() for i in range(N)]

Is = []
for i in range(N):
    Ds = a[i]
    if Ds[0] == Ds[1]:
        Is.append(i)

Boooo = False
for i in range(len(Is)-2):
    if Is[i]+1 == Is[i+1] and Is[i+1]+1 == Is[i+2]:
        Boooo = True

if Boooo:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
N = int(input())
A = list(map(int,input().split()))

A.reverse()
val = A[0]
flg = True
for i in range(1,N):
    if gcd(val,A[i]) != 1:
        flg = False
    val *= A[i]
if flg == True:
    print('pairwise coprime')
    exit()





val = A[0]
for i in range(1,N):
    val = gcd(val,A[i])
if val == 1:
    print('setwise coprime')
    exit()
print('not coprime')

Fixed submission:
from math import gcd
INF = float('inf')
N = int(input())
A = list(map(int,input().split()))
flg = True
lis = [INF] * (10**6+5)
for i in range(2,int((10**6)**0.5)+1):
    if lis[i] == INF:
        for j in range(i*2,10**6+1,i):
            lis[j] = i
st = set()
for i in range(N):
    p = A[i]
    d  =[]
    while lis[p] != INF:
        d.append(lis[p])
        p //= lis[p]
    if p > 1:
        d.append(p)
    for i in range(len(d)):
        if d[i] in st:
            flg = False
    for i in range(len(d)):
        st.add(d[i]) 
#print(lis[:15])

if flg == True:
    print('pairwise coprime')
    exit()



val = A[0]
for i in range(1,N):
    val = gcd(val,A[i])
if val == 1:
    print('setwise coprime')
    exit()
print('not coprime')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
R,C,K = map(int,input().split())
lis = [[0] * (C+1) for i in range(R+1)]
for _ in range(K):
    r,c,v = map(int,input().split())
    lis[r][c] = v

dp = [[[0] * 4 for _ in range(C+1)] for _ in range(R+1)]
#print(dp)
for i in range(1,R+1):
    for j in range(1,C+1):
        for k in range(4):
            dp[i][j][0] = max(dp[i][j][0],dp[i-1][j][k])
            dp[i][j][1] = max(dp[i][j][1],dp[i-1][j][k] + lis[i][j])

            dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k])
            if k > 0:
                dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k-1] + lis[i][j])
# print(dp[0])
# print(dp[1])
# print(dp[2])
# print(dp[3])
print(max(dp[R][C][0],dp[R][C][1],dp[R][C][2],dp[R][C][3]))


Fixed submission:
import sys
input = sys.stdin.readline
R,C,K = map(int,input().split())
lis = [[0] * (C+1) for i in range(R+1)]
for _ in range(K):
    r,c,v = map(int,input().split())
    lis[r][c] = v

dp = [[[0] * (C+1) for _ in range(R+1)] for _ in range(4)]
#print(dp)
for i in range(1,R+1):
    for j in range(1,C+1):
        for k in range(4):
            dp[0][i][j] = max(dp[0][i][j],dp[k][i-1][j])
            dp[1][i][j] = max(dp[1][i][j],dp[k][i-1][j] + lis[i][j])

            dp[k][i][j] = max(dp[k][i][j],dp[k][i][j-1])
            if k > 0:
                dp[k][i][j] = max(dp[k][i][j],dp[k-1][i][j-1] + lis[i][j])
# print(dp[0])
# print(dp[1])
# print(dp[2])
# print(dp[3])
print(max(dp[0][R][C],dp[1][R][C],dp[2][R][C],dp[3][R][C]))
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
val = set()
if K % 2 == 0:
    print(-1)
    exit()
for i in range(1,200000):
    val.add(i*K)
j = 7
for i in range(1000000):
    if j in val:
        print(len(str(j)))
        exit()
    j *= 10
    j += 7
print(-1)


Fixed submission:
K = int(input())
val = 7
for i in range(1,2000000):
    val %= K
    if val == 0:
        print(i)
        exit()
    else:
        val = val*10+7
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = list(map(int,input().split()))
val = 1
for i in range(N):
    if i < K:
        val *= A[i]
    else:
        if val < (val//(A[i-K])) * (A[i]):
            print('Yes')
        else:
            print('No')
        val //= (A[i-K])
        val *= A[i]


Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
val = 1
for i in range(N):
    if i < K:
        continue
    else:
        if A[i-K] < A[i]:
            print('Yes')
        else:
            print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
money = 1000
kabu = 0
for i in range(N-1):
    if A[i+1] < A[i]:
        while kabu != 0:
            money += A[i]
            kabu -= 1
    else:
        while money >= A[i]:
            money -= A[i]
            kabu += 1
while kabu != 0:
    money += A[-1]
    kabu -= 1
print(money)


Fixed submission:
N = int(input())
A = list(map(int,input().split()))
money = 1000
kabu = 0
for i in range(N-1):
    if A[i+1] < A[i]:
        money += A[i] * kabu
        kabu = 0
    else:
        kabu += money//A[i]
        money -= A[i] * (money//A[i])
    #print(kabu,money)
money += A[-1] * kabu


print(money)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X = input()
x = X[::-1]
one = X.count('1')
up = 0
down = 0
for i in range(N):
    up += (int(x[i]) * pow(2,i,one+1) % (one+1))
    up %= one+1
    if one > 1:
        down += (int(x[i]) * pow(2,i,one-1) % (one-1))
        down %= one-1
# print(up,down)
def f(ud,one):
    if one <= 0:
        return 0
    else:
        if ud == 0:
            return 1

        cnt = 0
        while ud != 0:
            ud = ud % one
            one = format(ud,'b').count('1')
            cnt += 1
        return cnt



for i in range(len(X)):
    if X[i] == '1':
        print(f((down - pow(2,(len(X)-1) - i, one-1)) % (one-1),one-1))
        #print(down - pow(2,(len(X)-1) - i, one-1) % (one-1))
    else:
        print(f((up + pow(2,(len(X)-1) - i, one+1)) % (one+1),one+1))
        #print(up + pow(2,(len(X)-1) - i, one+1) % (one+1))


Fixed submission:
N = int(input())
X = input()
x = X[::-1]
one = X.count('1')
up = 0
down = 0
for i in range(N):
    up += (int(x[i]) * pow(2,i,one+1) % (one+1))
    up %= one+1
    if one > 1:
        down += (int(x[i]) * pow(2,i,one-1) % (one-1))
        down %= one-1
# print(up,down)
def f(ud,one):
    if one <= 0:
        return 0
    else:
        if ud == 0:
            return 1

        cnt = 0
        while ud != 0:
            ud = ud % one
            one = format(ud,'b').count('1')
            cnt += 1
        return cnt



for i in range(len(X)):
    if X[i] == '1':
        if one > 1:
            print(f((down - pow(2,(len(X)-1) - i, one-1)) % (one-1),one-1))
        #print(down - pow(2,(len(X)-1) - i, one-1) % (one-1))
        else:
            print(0)

    else:
        print(f((up + pow(2,(len(X)-1) - i, one+1)) % (one+1),one+1))
        #print(up + pow(2,(len(X)-1) - i, one+1) % (one+1))
Buggy python submission (verdict: Time Limit Exceeded):
def divisor(n):
    cnt = 1
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            cnt += 1
    return cnt


N = int(input())
lis = [0] * (10**7+1)
lis[1] = 1
#print(divisor(N))
for i in range(2,10**7):
    if lis[i] != 0:
        continue
    val = divisor(i)
    for j in range(1,100):
        if i ** j > int(1e7):
            break
        lis[i**j] = val + j-1

ans = 0
for i in range(1,N+1):
    ans += i*lis[i]
print(ans)


Fixed submission:
N = int(input())
lis = [1] * (10**7+1)
for i in range(2,10**7+1):
    for j in range(i,10**7+1,i):
        lis[j] += 1
ans = 0
for i in range(1,N+1):
    ans += lis[i] * i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(K):
    lis = [0] * (N+1)
    for j in range(N):
        lis[min(N,j+A[j]+1)] -= 1
        lis[max(0, j-A[j])] += 1
    cnt = 0
    for j in range(N):
        cnt += lis[j]
        A[j] = cnt

    cnt2 = 0
    for j in range(N):
        if A[j] == N:
            cnt2 += 1
    if cnt2 == N:
        break
    #print(lis)
print(' '.join(map(str,A)))


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

for i in range(K):
    lis = [0] * (N+1)
    for j in range(N):
        lis[min(N,j+A[j]+1)] -= 1
        lis[max(0, j-A[j])] += 1
    cnt = 0
    for j in range(N):
        cnt += lis[j]
        A[j] = cnt

    cnt2 = 0
    for j in range(N):
        if A[j] == N:
            cnt2 += 1
    if cnt2 == N:
        break
    #print(lis)
print(' '.join(map(str,A)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
lis = [0] * (n+1)


for i in range(n):
    if a[i] == 0:
        lis[i+1] += 1
    lis[i+1] += lis[i]
#print(lis)
for i in range(n):
    ans *= a[i]
    if lis[-1]-lis[i+1] == 0:
        if ans > int(1e18):
            print(-1)
            exit()
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
lis = [0] * (n+1)


for i in range(n):
    if a[i] == 0:
        lis[i+1] += 1
    lis[i+1] += lis[i]
#print(lis)
if lis[-1] > 0:
    print(0)
    exit()
for i in range(n):
    ans *= a[i]
    if lis[-1]-lis[i+1] == 0:
        if ans > int(1e18):
            print(-1)
            exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
if ans > int(1e18):
    print(-1)
    exit()
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
lis = [0] * (n+1)


for i in range(n):
    if a[i] == 0:
        lis[i+1] += 1
    lis[i+1] += lis[i]
#print(lis)
if lis[-1] > 0:
    print(0)
    exit()
for i in range(n):
    ans *= a[i]
    if lis[-1]-lis[i+1] == 0:
        if ans > int(1e18):
            print(-1)
            exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
def prime_factorize(n):
    a = []
    N = n
    cnt = 0
    while n % 2 == 0:
        cnt += 1
        n //= 2
    if cnt > 0:
        a.append(cnt)
        #print(2)
    f = 3
    cnt = 0
    while f * f <= n:

        if n % f == 0:
            cnt += 1
            n //= f
        else:
            f += 2
            cnt = 0
        a.append(cnt)
    if n != 1:
        a.append(1)
    return a


n = int(input())
ans = 0
lis = prime_factorize(n)
#print(lis)

for i in range(len(lis)):
    val = 1
    while val <= lis[i]:
        lis[i] -= val
        val += 1
        ans += 1
print(ans)


Fixed submission:
a,b = map(str,input().split())
b100 = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])
# print(b)
# print(b100)
print((int(a)*b100)//100)

Buggy python submission (verdict: Runtime Error):
a,b = map(str,input().split())
b100 = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])
# print(b)
# print(b100)
print(int(int(a)*b/100))


Fixed submission:
a,b = map(str,input().split())
b100 = int(b[0]) * 100 + int(b[2]) * 10 + int(b[3])
# print(b)
# print(b100)
print((int(a)*b100)//100)
Buggy python submission (verdict: Runtime Error):
h1,m1,h2,m2,k = map(int, input().split())
h1 += m1/60
h2 += m2/60
val = h2-h1
val *= 60
val -= k
print(max(0,int(val))


Fixed submission:
h1,m1,h2,m2,k = map(int, input().split())
m1 += h1*60
m2 += h2 * 60
val = m2 - m1
val -= k
print(max(0,int(val)))
Buggy python submission (verdict: Runtime Error):
t = list(input())
if t[0] == "?":
    if t[1] == "P":
        t[0] = "D"
    else:
        t[0] == "P"
for i in range(1,len(t)):
    if t[i] == "?":
        if t[i-1] == "P":
            t[i] = "D"
        else:
            t[i] = "P"
print("".join(t))


Fixed submission:
t = list(input())
for i in range(len(t)):
    if t[i] == "?":
        t[i] = "D"
print("".join(t))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if n == 0 and a[0] == 0:
    print(-1)
    exit()
if n != 0 and a[0] >= 1:
    print(-1)
    exit()
val = 1
ans = 1
vlis = []
for i in range(n):
    ans += val * 2
    val *= 2
    val -= a[i+1]
    if val < 0:
        print(-1)
        exit()
    if val == 0 and i != (n-1):
        print(-1)
        exit()
    vlis.append(val-a[i+1])
val3 = (vlis[-2] - a[-2])
val -= val3
if val//2 > vlis[-2]:
    print(-1)
    exit()
ans -= val//2
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n == 0 and a[0] == 0:
    print(-1)
    exit()
if n != 0 and a[0] >= 1:
    print(-1)
    exit()
if n == 0 and a[0] >= 2:
    print(-1)
    exit()
ar = list(reversed(a))
#print(ar)
com = [ar[0]]
for i in range(n):
    com.append(com[i] + ar[i+1])
#print(com)
com.reverse()
ans = 1
val = 1
for i in range(1,n+1):
    val *= 2
    ans += min(val,com[i])
    val -= a[i]
    if (i < n and val <= 0) or (i == n and val < 0):
        print(-1)
        exit()
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if n == 0 and a[0] == 0:
    print(-1)
    exit()
if n != 0 and a[0] >= 1:
    print(-1)
    exit()
val = 1
ans = 1
for i in range(n):
    ans += val * 2
    val *= 2
    val -= a[i+1]
    if val < 0:
        print(-1)
        exit()
    if val == 0 and i != (n-1):
        print(-1)
        exit()
    if i == n-2:
        val2 = val
val3 = (val2 - a[-2])
val -= val3
if val//2 > val2:
    print(-1)
    exit()
ans -= val//2
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n == 0 and a[0] == 0:
    print(-1)
    exit()
if n != 0 and a[0] >= 1:
    print(-1)
    exit()
if n == 0 and a[0] >= 2:
    print(-1)
    exit()
ar = list(reversed(a))
#print(ar)
com = [ar[0]]
for i in range(n):
    com.append(com[i] + ar[i+1])
#print(com)
com.reverse()
ans = 1
val = 1
for i in range(1,n+1):
    val *= 2
    ans += min(val,com[i])
    val -= a[i]
    if (i < n and val <= 0) or (i == n and val < 0):
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import ceil
n, k = map(int, input().split())
val = abs(ceil(n/k)
print(min(n%k,abs(n-(k*val)),n))

Fixed submission:
n, k = map(int, input().split())
val = n//k
print(min(n%k,abs(n-(k*val + k)),n))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
INF = int(1e9) + 7
n, x, y = map(int, input().split())
x -= 1
y -= 1
d = [[INF] * n for i in range(n)]
ans = [0] * (n+1)
def bfs(i):
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    que = deque([i])
    d[i][i] = 0

    while len(que) != 0:
        val = que.popleft()
        #print(val)
        if val-1 >= 0 and d[i][val-1] == INF:
            que.append(val-1)
            d[i][val-1] = d[i][val] + 1
        if val+1 < n and d[i][val+1] == INF:
            que.append(val+1)
            d[i][val+1] = d[i][val] + 1
        if val == x and d[i][y] == INF:
            que.append(y)
            d[i][y] = d[i][val] + 1
        if val == y and d[i][x] == INF:
            que.append(x)
            d[i][x] = d[i][val] + 1
    return d[i]

for i in range(n-1):
    val = bfs(i)
    #print(val)
    for j in range(i+1,n):
        ans[val[j]] += 1
for i in range(1, n):
    print(ans[i])


Fixed submission:
from collections import deque
INF = int(1e9) + 7
n, x, y = map(int, input().split())
x -= 1
y -= 1
d = [[INF] * n for i in range(n)]
ans = [0] * (n+1)
def bfs(i):
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    que = deque([i])
    d[i][i] = 0

    while len(que) != 0:
        val = que.popleft()
        #print(val)
        if val-1 >= 0 and d[i][val-1] == INF:
            que.append(val-1)
            d[i][val-1] = d[i][val] + 1
        if val+1 < n and d[i][val+1] == INF:
            que.append(val+1)
            d[i][val+1] = d[i][val] + 1
        if val == x and d[i][y] == INF:
            que.append(y)
            d[i][y] = d[i][val] + 1
        if val == y and d[i][x] == INF:
            que.append(x)
            d[i][x] = d[i][val] + 1
    return d[i]

for i in range(n-1):
    val = bfs(i)
    #print(val)
    for j in range(i+1,n):
        ans[val[j]] += 1
for i in range(1, n):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
ans = 2 ** n -1
val = 1
val2 = 1
for i in range(a):
    val *= n - i
    val2 *= i + 1
ans -= (val // val2)
val = 1
val2 = 1
for i in range(b):
    val *= n - i
    val2 *= i + 1
ans -= (val // val2)
print(ans % (int(1e9) + 7))

Fixed submission:
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
ans %= m
val = 1
val2 = 1
for i in range(b):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
print(ans % (int(1e9) + 7))

Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
ans = 2 ** n -1
val = 1
val2 = 1
for i in range(a):
    val *= n - i
    val2 *= i + 1
ans -= (val // val2)
val = 1
val2 = 1
for i in range(b):
    val *= n - i
    val2 *= i + 1
ans -= (val // val2)
print(ans % (int(1e9) + 7))

Fixed submission:
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
ans %= m
val = 1
val2 = 1
for i in range(b):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
print(ans % (int(1e9) + 7))

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 2 ** n -1
val = 1
for i in range(a):
    val *= (n-i) / (i+1)
ans -= val
val = 1
for i in range(b):
    val *= (n-i) / (i+1)
ans -= val
print(int(ans % (int(1e9) + 7)))

Fixed submission:
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
ans %= m
val = 1
val2 = 1
for i in range(b):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
print(ans % (int(1e9) + 7))

Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
ans = 2 ** n -1
val = 1
for i in range(a):
    val *= (n-i) / (i+1)
ans -= val
val = 1
for i in range(b):
    val *= (n-i) / (i+1)
ans -= val
print(int(ans % int(1e9) + 7))

Fixed submission:
n, a, b = map(int, input().split())
m = int(1e9) + 7
ans = (pow(2, n, m) -1) % m
val = 1
val2 = 1
for i in range(a):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
ans %= m
val = 1
val2 = 1
for i in range(b):
    val = (val * (n - i)) % m
    val2 = (val2 * (i + 1)) % m
ans -= ((val % m) * (pow(val2, m-2, m)))
#print(((val % m) * (pow(val2, m-2, m))))
print(ans % (int(1e9) + 7))
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
p = list(map(int, input().split()))

val = 0
for i in range(k):
    val += p[i]
point = k-1

cnt = val
for i in range(k,n):
    cnt += p[i] - p[i-k]
    if cnt > val:
        val = cnt
        point = i-k+1
#print(point)

ans = 0
for i in range(k):
    ans += (p[point] + 1) / 2
    point += 1

print(ans)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int,input().split()))
val = 0
atai = 0
val2 = 0
for i in range(k):
    val2 += p[i]
#print(val2)
val = val2
for i in range(k,n):
    if val < val2:
        val = val2
        atai = i-k+1
    #print(i,p[i],p[i-k])
    val2 += p[i]
    if i==k:
        val2 == 0
    else:
        val2 -= p[i-k]
    #print(val2)
    if val < val2:
        val = val2

        atai = i-k+1
#print(atai)

#print(atai)
ans = 0
for i in range(k):
    ans += (p[atai]+1)/2
    atai += 1
    #print(atai)
    #print(kitai)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))
val = 0
atai = 0
for i in range(n-k+1):
    ans = 0
    for j in range(i,i+k):
        ans += p[j]
    if ans > val:
        val = ans
        atai = i

#print(atai)
ans = 0
for i in range(k):
    kitai = 0
    for j in range(1,p[atai]+1):
        kitai += j
    ans += kitai / p[atai]
    atai += 1
    #print(atai)
    #print(kitai)
print(ans)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int,input().split()))
val = 0
atai = 0
val2 = 0
for i in range(k):
    val2 += p[i]
#print(val2)
val = val2
for i in range(k,n):
    if val < val2:
        val = val2
        atai = i-k+1
    #print(i,p[i],p[i-k])
    val2 += p[i]
    if i==k:
        val2 == 0
    else:
        val2 -= p[i-k]
    #print(val2)
    if val < val2:
        val = val2

        atai = i-k+1
#print(atai)

#print(atai)
ans = 0
for i in range(k):
    ans += (p[atai]+1)/2
    atai += 1
    #print(atai)
    #print(kitai)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math

h, n = map(int, input().split())
a = [0] * n
b = [0] * n
#print(a, b)
for i in range(n):
    a[i], b[i] = map(int, input().split())

#print(a)
#print(b)
INF = int(1e10)
dp = [[INF] * (h+1) for i in range(n+1)]
for i in range(h+1):
    dp[0][i] = math.ceil(i / a[0]) * b[0]
for i in range(n):
    dp[i][0] = 0
for i in range(n):
    for j in range(h+1):
        if j < a[i]:
            dp[i+1][j] = min(math.ceil(j / a[i]) * b[i], dp[i][j])
        else:
            dp[i+1][j] = min(math.ceil(j/ a[i]) * b[i], dp[i][j], dp[i+1][j - a[i]] + b[i])
#print(dp)
print(dp[n][h])

Fixed submission:
import math

h, n = map(int, input().split())
a = [0] * n
b = [0] * n
#print(a, b)
for i in range(n):
    a[i], b[i] = map(int, input().split())

#print(a)
#print(b)
INF = int(1e10)
dp = [[INF] * (h+1) for i in range(n+1)]
for i in range(h+1):
    dp[0][i] = math.ceil(i / a[0]) * b[0]
for i in range(n):
    dp[i][0] = 0
for i in range(n):
    for j in range(h+1):
        if j < a[i]:
            dp[i+1][j] = min(-(-j // a[i]) * b[i], dp[i][j])
        else:
            dp[i+1][j] = min(-(-j // a[i]) * b[i], dp[i][j], dp[i+1][j - a[i]] + b[i])
#print(dp)
print(dp[n][h])
Buggy python submission (verdict: Runtime Error):
from math import gcd
MOD = 10**9+7

def LCM(n,r):
    return ((n*r) * pow(gcd(n,r), MOD-2,MOD)) % MOD
    
N = int(input())
A = list(map(int,input().split()))
lcm = LCM(A[0],A[1])
for i in range(1,N):
    lcm = LCM(lcm,A[i])

ans = 0
for i in range(N):
    ans += lcm * pow(A[i],MOD-2,MOD)
    ans %= MOD
print(ans)


Fixed submission:
from collections import Counter
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
def prime_factorize(n):
    N = n
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= N:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
prime = [0] * (10**6+5)
for i in range(N):
    c = Counter(prime_factorize(A[i]))
    for j in c.items():
        prime[j[0]] = max(j[1],prime[j[0]])
lcm = 1
for i in range(10**6+2):
    if prime[i] > 0:
        lcm *= pow(i,prime[i])
        lcm %= MOD

ans = 0
for i in range(N):
    ans += lcm * pow(A[i],MOD-2,MOD)
    ans %= MOD
print(ans)