Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, K = map(int, input().split())
X = list(map(int, input().split()))

ps = [0] + list(filter(lambda x: x >= 0, X))
ns = [0] + list(sorted(filter(lambda x: x < 0, X), reverse=True))
ans = INF
for i in range(len(ns)):
    val = abs(ns[i]) * 2
    if K - i < len(ps):
        val += abs(ps[K - i])
        ans = min(ans, val)
for i in range(len(ps)):
    val = abs(ps[i]) * 2
    if K - i < len(ns):
        val += abs(ns[K - i])
        ans = min(ans, val)
print(ans)


Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, K = map(int, input().split())
X = list(map(int, input().split()))

ps = [0] + list(filter(lambda x: x >= 0, X))
ns = [0] + list(sorted(filter(lambda x: x < 0, X), reverse=True))

ans = INF
for i in range(len(ns)):
    val = abs(ns[i]) * 2
    if K - i >= 0 and K - i < len(ps):
        val += abs(ps[K - i])
        ans = min(ans, val)

for i in range(len(ps)):
    val = abs(ps[i]) * 2
    if K - i >= 0 and K - i < len(ns):
        val += abs(ns[K - i])
        ans = min(ans, val)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
adj = [[] for _ in range(N)]
for i in range(N - 1):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    adj[x].append(y)
    adj[y].append(x)


def dfs(v, p):
    nim = 0
    for u in adj[v]:
        if u == p:
            continue
        nim ^= dfs(u, v)
    if p == -1:
        return nim
    nim += 1
    return nim

res = dfs(0, -1)

if res:
    print("Alice")
else:
    print("Bob")

Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
adj = [[] for _ in range(N)]
for i in range(N - 1):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    adj[x].append(y)
    adj[y].append(x)


def dfs(v, p):
    nim = 0
    for u in adj[v]:
        if u == p:
            continue
        nim ^= dfs(u, v)
    if p == -1:
        return nim
    nim += 1
    return nim

res = dfs(0, -1)

if res:
    print("Alice")
else:
    print("Bob")
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

from collections import deque
b = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        b.append(a)
    else:
        b.appendleft(a)

if n % 2 == 0:
    print(*b)
else:
    print(*b[::-1])

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

from collections import deque
b = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        b.append(a)
    else:
        b.appendleft(a)

if n % 2 == 0:
    print(*b)
else:
    print(*reversed(b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N = int(input())
A = [0] + [int(input()) for _ in range(N)]

cur = 1
ans = 0
pushed = [False] * (N + 1)
pushed[1] = True
ok = True
while True:
    ans += 1
    cur = A[cur]
    if cur == 2:
        break
    if pushed[cur]:
        ok = False
        break

if ok:
    print(ans)
else:
    print(-1)

        



Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N = int(input())
A = [0] + [int(input()) for _ in range(N)]

cur = 1
ans = 0
pushed = [False] * (N + 1)
pushed[1] = True
ok = True
while True:
    pushed[cur] = True
    ans += 1
    cur = A[cur]
    if cur == 2:
        break
    if pushed[cur]:
        ok = False
        break

if ok:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()))

colors = [0] * 9

for a in A:
    colors[a // 400] += 1

ans = 0
for i in range(8):
    if colors[i] > 0:
        ans += 1

max_ans = ans
if colors[8] > 0:
    max_ans += colors[8]
print(ans, max_ans)

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

colors = [0] * 9
for a in A:
    idx = a // 400
    if idx >= 8:
        idx = 8
    colors[idx] += 1
ans = 0
for i in range(8):
    if colors[i] > 0:
        ans += 1
max_ans = ans
if colors[8] > 0:
    max_ans += colors[8]

if ans == 0 and max_ans > 0:
    ans += 1
print(ans, max_ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

xs = 0
for i in range(N):
    xs += i  * X[i]
    xs -= (N - i - 1) * X[i]
    xs %= MOD
ys = 0
for i in range(M):
    ys += i  * Y[i]
    ys -= (M - i - 1) * Y[i]
    ys %= MOD
print(xs * ys % MOD)


Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

xs = 0
for i in range(N):
    xs += i  * X[i]
    xs -= (N - i - 1) * X[i]
    xs %= MOD
ys = 0
for i in range(M):
    ys += i  * Y[i]
    ys -= (M - i - 1) * Y[i]
    ys %= MOD
print(xs * ys % MOD)
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, M = map(int, input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def check(x, y):
    for i in range(M):
        for j in range(M):
            if A[y + i][x + j] != B[i][j]:
                return False
    return True

for i in range(N):
    for j in range(N):
        if check(i, j):
            print("Yes")
            exit()
print("No")



Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N, M = map(int, input().split())

A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def check(x, y):
    for i in range(M):
        for j in range(M):
            if y + i >= N or x + j >= N:
                return False
            if A[y + i][x + j] != B[i][j]:
                return False
    return True

for i in range(N):
    for j in range(N):
        if check(i, j):
            print("Yes")
            exit()
print("No")
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
X = list(map(int, input().split()))

ans = 0
for i in range(1, N):
    d = X[i] - X[i - 1]
    if d * A > B:
        ans += B
    else:
        ans += d * A
print(ans

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

ans = 0
for i in range(1, N):
    d = X[i] - X[i - 1]
    if d * A > B:
        ans += B
    else:
        ans += d * A
print(ans)
Buggy python submission (verdict: Runtime Error):
K, T = map(int, input().split())
A = list(map(int, input().split()))

A = sorted(A, reverse=True)

print(max(0, A[0] - 1 - sum(A[1:]))

Fixed submission:

K, T = map(int, input().split())
A = list(map(int, input().split()))

A = sorted(A, reverse=True)

print(max(0, A[0] - 1 - sum(A[1:])))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
print(K * ((K - 1) ** (N - 1))

Fixed submission:
N, K = map(int, input().split())
print(K * ((K - 1) ** (N - 1)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
x, y = map(int, input().split())
s = x + y
for i in range(N - 1):
    t, a = map(int, input().split())
    if s % (t + a) == 0:
        x2 = t * (s // (t + a))
        y2 = a * (s // (t + a))
        while x2 < x or y2 < y:
            x2 += t
            y2 += a
        x, y = x2, y2
    else:
        s += (t + a) - s % (t + a)
        x2 = t * (s // (t + a))
        y2 = a * (s // (t + a))
        while x2 < x or y2 < y:
            x2 += t
            y2 += a
        x, y = x2, y2
    s = x + y
print(s)


Fixed submission:
N = int(input())
a, b = 1, 1
for i in range(N):
    x, y = map(int, input().split())
    n = max((a + x - 1) // x, (b + y - 1) // y)
    a = n * x
    b = n * y
print(a + b)
Buggy python submission (verdict: Runtime Error):
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
S = input()
K = int(input())

ans = []
for i, c in enumerate(S):
    num = ord('z') - ord(c) + 1
    if K >= num:
        K -= num
        ans.append('a')
    else:
        ans.append(c)
if K > 0:
    ans[-1] = chr((ord(S[-1]) - ord('a') + K) % 26 + ord('a'))
print("".join(an))
    


Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import permutations
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
S = input()
K = int(input())

ans = []
for i, c in enumerate(S):
    if c == 'a':
        ans.append(c)
        continue
    num = ord('z') - ord(c) + 1
    if K >= num:
        K -= num
        ans.append('a')
    else:
        ans.append(c)
if K > 0:
    ans[-1] = chr((ord(ans[-1]) - ord('a') + K % 26) % 26 + ord('a'))
print("".join(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

ans = INF
for i in range(-100, 101):
    val = 0
    for a in A:
        val += (a - i) ** 2
    ans = min(ans, val)
print(ans)

Fixed submission:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

ans = INF
for i in range(-100, 101):
    val = 0
    for a in A:
        val += (a - i) ** 2
    ans = min(ans, val)
print(ans)
Buggy python submission (verdict: Runtime Error):
#include<iostream>
main(){long a,b,c;std::cin>>a>>b>>c;std::cout<<(4*a*b+2*c*(a+b)<c*c+(a+b)*(a+b)&&c>=a+b?"Yes":"No");}

Fixed submission:
A=list(map(int, input().split()))
a=A[0]
b=A[1]
c=A[2]
print('No') if c<a+b or 4*a*b+2*c*(a+b)>=c*c+(a+b)**2 else print('Yes')
Buggy python submission (verdict: Runtime Error):
# https://atcoder.jp/contests/abc174/tasks/abc174_e

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

if K == 0:
    print(max(A))
    exit()

# K回切って全ての長さをL未満にできるかどうか
def valid(L):
    # print(A, L)
    count = 0
    for a in A:
        # print(a, L, a // L, a % L)
        count += (a - 1) // L
    # print(count)
    return count <= K

# 長さLの二分探索
ng = -1
# ok = max(A) + 1
ok = 10 ** 9
while abs(ok - ng) > 1:
    m = (ok + ng) // 2
    # print(m, valid(m))
    if valid(m):
        ok = m
    else:
        ng = m
print(ok)

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

def is_ok(L):
    count = 0
    for a in A:
        count += a // L
        if a % L == 0:
            count -= 1
    return count <= K

ng = 0
ok = max(A)
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K == 0:
    print(max(A))
    exit()

# K回切って全ての長さをL未満にできるかどうか
def valid(L):
    # print(A, L)
    count = 0
    for a in A:
        # print(a, L, a // L, a % L)
        count += a // L
    # print(count)
    return count <= K

# 長さLの二分探索
ng = -1
ok = max(A) + 1
while abs(ok - ng) > 1:
    m = (ok + ng) // 2
    # print(m, valid(m))
    if valid(m):
        ok = m
    else:
        ng = m
print(ok)

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

def is_ok(L):
    count = 0
    for a in A:
        count += a // L
        if a % L == 0:
            count -= 1
    return count <= K

ng = 0
ok = max(A)
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K == 0:
    print(max(A))
    exit()

# K回切って全ての長さをL未満にできるかどうか
def valid(L):
    # print(A, L)
    count = 0
    for a in A:
        # print(a, L, a // L, a % L)
        count += a // L
    # print(count)
    return count <= K

# 長さLの二分探索
ng = -1
ok = max(A) + 1
while abs(ok - ng) > 1:
    m = (ok + ng) // 2
    # print(m, valid(m))
    if valid(m):
        ok = m
    else:
        ng = m
print(ok)

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

def is_ok(L):
    count = 0
    for a in A:
        count += a // L
        if a % L == 0:
            count -= 1
    return count <= K

ng = 0
ok = max(A)
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
AA = []
for i in range(N - K + 1):
  f = 1
  for j in range(i, i + K):
    f *= A[j]
  AA.append(f)
  
for i in range(len(AA) - 1):
  if AA[i] < AA[i + 1]:
    print("Yes")
  else:
    print("No")

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

for i in range(K, N):
  if A[i - K] < A[i]:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())

    def count(k):
        ans = 0
        NN = int(k ** 0.5) + 1
        for x in range(1, NN):
            for y in range(1, min(NN, k - x * x)):
                for z in range(1, min(NN, k - x * x - y * y)):
                    if x * x + y * y + z * z + x * y + y * z + z * x == k:
                        ans += 1
        return ans

    for k in range(1, N + 1):
        print(count(k))

if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil, sqrt
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    ans = [0] * 20000

    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                v = x * x + y * y + z * z + x * y + y * z + z * x
                if v <= 10001:
                    ans[v] += 1
    for k in range(1, N + 1):
        print(ans[k])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# do simulation

X = int(input())
Y, K = 0, 0
while True:
  Y += X
  K += 1
  if Y % 360 == 0:
    print(k)
    exit()

Fixed submission:
# do simulation

X = int(input())
Y, K = 0, 0
while True:
  Y += X
  K += 1
  if Y % 360 == 0:
    print(K)
    exit()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter
setrecursionlimit(1000000)

# INF = float('inf')
INF = int(1e10)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    N = int(input())
    A = list(map(int, input().split()))
    cA = Counter(A)

    for ai in A:
        cA[ai] -= 1
        count = 0
        for key in cA:
            v = cA[key]
            count += (v * (v - 1)) // 2
        cA[ai] += 1
        print(count)

if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
from sys import setrecursionlimit
from collections import Counter
setrecursionlimit(1000000)

# INF = float('inf')
INF = int(1e10)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    N = int(input())
    A = list(map(int, input().split()))
    cA = Counter(A)

    diff = {}
    total = 0
    for key in cA:
        v = cA[key]
        total += (v * (v - 1)) // 2
        diff[key] = (v - 1) * (v - 2) // 2 - (v * (v - 1)) // 2

    for ai in A:
        print(total + diff[ai])
        # cA[ai] -= 1
        # count = 0
        # for key in cA:
        #     v = cA[key]
        #     count += (v * (v - 1)) // 2
        # cA[ai] += 1
        # print(count)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
s, c = [], []
mapSC = {}
for _ in range(M):
    si, ci = list(map(int, input().split()))
    s.append(si)
    c.append(ci)
    if si not in mapSC:
        mapSC[si] = ci
    else:
        if mapSC[si] != ci:
            print("-1")
            exit(0)

if len(mapSC) > N:
    print("-1")
    exit(0)

if N > 1 and s[0] == 0:
    print("-1")
    exit(0)

if s == 1:
    rb, re = 0, 10
elif s == 2:
    rb, re = 10, 100
else:
    rb, re = 100, 1000

ans = -1
for v in range(rb, re):
    sv = "{}".format(v)
    lf = []
    for i in range(M):
        lf.append(int(sv[s[i] - 1]) == int(c[i]))
    if all(lf):
        ans = v
        break
    # print(sv, lf, all(lf))

print(ans)

Fixed submission:
N, M = list(map(int, input().split()))
s, c = [], []
mapSC = {}
for _ in range(M):
    si, ci = list(map(int, input().split()))
    s.append(si)
    c.append(ci)
    if si not in mapSC:
        mapSC[si] = ci
    else:
        if mapSC[si] != ci:
            print("-1")
            exit(0)

if len(mapSC) > N:
    print("-1")
    exit(0)

# if N > 1 and s[0] == 0:
#     print("-1")
#     exit(0)

if N == 1:
    rb, re = 0, 10
elif N == 2:
    rb, re = 10, 100
else:
    rb, re = 100, 1000

ans = -1
for v in range(rb, re):
    sv = "{}".format(v)
    lf = []
    for i in range(M):
        lf.append(int(sv[s[i] - 1]) == int(c[i]))
    if all(lf):
        ans = v
        break
    # print(sv, lf, all(lf))

print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if len(set({A, B, C}) == 2:
       print("Yes")
else:
       print("No")

Fixed submission:
A, B, C = map(int, input().split())
if len(set({A, B, C})) == 2:
       print("Yes")
else:
       print("No")
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
r, b = map(int, input().split())
N = input()

if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 print(r, b)

Fixed submission:
S,  T = input().split()
r, b = map(int, input().split())
N = input()
 
if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 
print(r, b)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
P = list(map(int, input().split()))

# estP = [-1]
def est(i):
    return 1.0 + (i - 1) * 0.5
# for i in range(1, 1001):
# print(i, sum([j * 1.0 / i for j in range(1, i + 1)]))
# estP.append(sum([j * 1.0 / i for j in range(1, i + 1)]))
# print(i, 1.0 + (i - 1) * 0.5)
# # print(estP)

m = -1.0
for i in range(N - K + 1):
    vi = sum([est(P[j]) for j in range(i, i + K)])
    m = max(vi, m)
print(m)

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

# estP = [-1]
def est(i):
    return 1.0 + (i - 1) * 0.5
# for i in range(1, 1001):
# print(i, sum([j * 1.0 / i for j in range(1, i + 1)]))
# estP.append(sum([j * 1.0 / i for j in range(1, i + 1)]))
# print(i, 1.0 + (i - 1) * 0.5)
# # print(estP)

# 普通に計算する
# - 2x10e5 の2重ループなのでTLE

# m = -1.0
# for i in range(N - K + 1):
#     vi = sum([est(P[j]) for j in range(i, i + K)])
#     m = max(vi, m)
# print(m)


# かしこい計算: 累積和
# WAになってしまった
# sumA = [est(P[0])]
# for i in range(1, N):
#     sumA.append(sumA[-1] + est(P[i]))
# # print([est(P[i]) for i in range(N)])
# # print(sumA)

# m = -1
# for i in range(N - K):
#     # print(i, i + K, sumA[i + K] - sumA[i])
#     m = max(m, sumA[i + K] - sumA[i])
# print(m)

expected = [(P[i] + 1) / 2 for i in range(N)]
# print(expected)
# print(expected[:K])

# 0 ~ K-1 の期待値
ans = sum(expected[:K])
tmp = ans
for i in range(N - K):
    # 新しく追加 (i番目を抜いて，i+K番目を入れる，横に移動)
    tmp = tmp + expected[i + K] - expected[i]
    ans = max(ans, tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())

dp = [False for _ in range(100000)]
dp[0] = True

price = [100, 101, 102, 103, 104, 105]

for i in range(X + 1):
    if dp[i]:
        for p in price:
            dp[i + p] = True

if dp[X]:
    print(1)
else:
    print(0)

Fixed submission:
X = int(input())

dp = [False for _ in range(110000)]
dp[0] = True

price = [100, 101, 102, 103, 104, 105]

for i in range(X + 1):
    if dp[i]:
        for p in price:
            dp[i + p] = True

if dp[X]:
    print(1)
else:
    print(0)