Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
from decimal import *
import heapq
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

k = INT()
num = 0
for i in range(1, 10 ** 6 + 100):
    num *= 10
    num += 7
    if num % k == 0:
        print(i)
        exit()
print(-1)


Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
from decimal import *
import heapq
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

k = INT()
l = len(str(k))
if k % 2 == 0:
    print(-1)
    exit()
dp = [-1 for _ in range(10 ** 6 + 100)]
for i in range(10 ** 6 + 100):
    if l > i + 1:
        continue
    elif l == i + 1:
        num = 0
        for _ in range(i):
            num *= 10
            num += 7
        if k > num:
            continue
    if dp[i - 1] == -1:
        num = 0
        for _ in range(i):
            num *= 10
            num += 7
        dp[i] = num % k
    else:
        dp[i] = (dp[i - 1] * 10 + 7) % k
    if dp[i] == 0:
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()
ans = 1
flag = 0 in a
for i in a:
    ans *= i
    if ans > 10 ** 18 and not flag:
        print(-1)
        exit()
print(ans)

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

t = 10 ** 18

n = INT()
a = LIST()
ans = 1
a.sort(reverse=True)
if a[-1] == 0:
    print(0)
    exit()
for i in a:
    ans *= i
    if ans > t:
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n = INT()
a = LIST()

arr = [[a[i], i + 1] for i in range(n)]
arr.sort()

ans = 0
for i in range(n - 1): #低い方
    if arr[i][0] + arr[i + 1][0] > n:
        continue
    for j in range(i + 1, n): #高い方
        if arr[i][0] + arr[j][0] == abs(arr[i][1] - arr[j][1]):
            ans += 1

print(ans)


Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

#にぶたんサーチ
def search(arr, num):
    l = 0
    r = len(arr) - 1
    while r - l > 1:
        c = (r + l) // 2
        if arr[c] > num:
            r = c
        elif arr[c] < num:
            l = c
        else:
            r = c
            l = c
    if arr[l] == num:
        return l
    elif arr[r] == num:
        return r
    else:
        return -1

n = INT()
a = LIST()

l = [i + 1 + a[i] for i in range(n)]
r = [i + 1 - a[i] for i in range(n)]
b = Counter(r)
c = list(set(r))
c.sort()
ans = 0
for i in l:
    if search(c, i) < 0:
        continue
    ans += b[i]

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n, m, q = MAP()
tmp = list(range(1, m + 1)) * m
arr = list(combinations(tmp, n))
arr = [sorted(list(i)) for i in arr]
#print(arr)
point = [0 for _ in range(len(arr))]
for i in range(q):
    a, b, c, d = MAP()
    for j in range(len(arr)):
        if arr[j][b - 1] - arr[j][a - 1] == c:
            point[j] += d
#print(point)
print(max(point))


Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

n, m, q = MAP()
arr = [[]]
for i in range(n):
    tmp = deepcopy(arr)
    arr = []
    for j in range(1, m + 1):
        for k in range(len(tmp)):
            if len(tmp[k]) == 0 or tmp[k][-1] <= j:
                arr.append(deepcopy(tmp[k]))
                arr[-1].append(j)

point = [0 for _ in range(len(arr))]
for i in range(q):
    a, b, c, d = MAP()
    for j in range(len(arr)):
        if arr[j][b - 1] - arr[j][a - 1] == c:
            point[j] += d
#print(point)
print(max(point))
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = p[:x] + q[:y]
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(c):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = p[:x] + q[:y]
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(min(c, x + y)):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)

Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = deepcopy(p[:x]) + deepcopy(q[:y])
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(c):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

x, y, a, b, c = MAP()
p = LIST()
q = LIST()
r = LIST()
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
pq = p[:x] + q[:y]
pq.sort()
pqsum = 0
rsum = 0
d = 0
for i in range(min(c, x + y)):
    pqsum += pq[i]
    rsum += r[i]
    if rsum - pqsum > d:
        d = rsum - pqsum
print(sum(pq) + d)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

a, b, c = MAP()
'''
n = 5 * pow(10, 8)
m = 3 * n * n + 2 * n * (a + b + c)
a -= n
b -= n
c -= n
'''
ans = 'No'
'''
aa = reversed(str((a - b - c) * a))
bb = reversed(str((b - c - a) * b))
cc = reversed(str((c - a - b) * c))
'''
#print(-m, aa + bb + cc)
if floor(2 * sqrt(a * b)) < c - a - b:
    ans = 'Yes'
print(ans)


Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

from decimal import *

a, b, c = MAP()

if c - a - b > 0 and (c - a - b) ** 2 > 4 * a * b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

def func(remain):
    if remain == 1:
        return ['a']
    arr = [chr(ord('a') + i) for i in range(remain)]
    tmp = func(remain - 1)
    res = []
    for i in range(remain):
        res.extend(deepcopy(tmp))
        for j in range(i * len(tmp), (i + 1) * len(tmp)):
            if len(set(res[j])) < i:
                continue
            res[j] += arr[i]
    i = 0
    while i < len(res):
        if len(res[i]) < remain:
            del res[i]
        else:
            i += 1
    return res

n = INT()
ans = func(n)
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Fixed submission:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

def func(remain):
    if remain == 1:
        return ['a']
    arr = [chr(ord('a') + i) for i in range(remain)]
    tmp = func(remain - 1)
    res = []
    for i in range(remain):
        res.extend(deepcopy(tmp))
        for j in range(i * len(tmp), (i + 1) * len(tmp)):
            if len(set(res[j])) < i:
                continue
            res[j] += arr[i]
    i = 0
    while i < len(res):
        if len(res[i]) < remain:
            del res[i]
        else:
            i += 1
    return res

n = INT()
ans = func(n)
ans.sort()
for i in range(len(ans)):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
rev = 0
for i in range(q):
    qvery = input()
    if len(qvery) == 1: #t == 1
        rev += 1
    else:
        qq, f, c = qvery.split(' ')
        f = int(f)
        if rev % 2 == 0:
            if f == 1:
                s = c + s
            else:
                s = s + c
        else:
            if f == 2:
                s = c + s
            else:
                s = s + c
if rev % 2 == 1:
    s = s[::-1]
print(s)

Fixed submission:
s = input()
q = int(input())
rev = 0
fir = ''
end = ''
for i in range(q):
    qvery = input()
    if len(qvery) == 1: #t == 1
        rev += 1
    else:
        qq, f, c = qvery.split(' ')
        f = int(f)
        if rev % 2 == 0:
            if f == 1:
                fir += c
            else:
                end += c
        else:
            if f == 2:
                fir += c
            else:
                end += c
fir = fir[::-1]
s = fir + s + end
if rev % 2 == 1:
    s = s[::-1]
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
for i in range(q):
    qvery = input()
    if len(qvery) == 1: #t == 1
        s = list(reversed(s))
    else:
        qq, f, c = qvery.split(' ')
        f = int(f)
        if f == 1:
            s.insert(0, c)
        else:
            s.append(c)
for i in range(len(s)):
    print(s[i], end='')
print('')

Fixed submission:
s = input()
q = int(input())
rev = 0
fir = ''
end = ''
for i in range(q):
    qvery = input()
    if len(qvery) == 1: #t == 1
        rev += 1
    else:
        qq, f, c = qvery.split(' ')
        f = int(f)
        if rev % 2 == 0:
            if f == 1:
                fir += c
            else:
                end += c
        else:
            if f == 2:
                fir += c
            else:
                end += c
fir = fir[::-1]
s = fir + s + end
if rev % 2 == 1:
    s = s[::-1]
print(s)
Buggy python submission (verdict: Runtime Error):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False

n, m = MAP()
arr = [[] for _ in range(n)]
for _ in range(m):
    s, c = MAP()
    arr[s - 1].append(c)
tmp1 = [len(set(arr[i])) for i in range(n)]
tmp2 = Counter(tmp1)
if tmp2[0] + tmp2[1] != n or (arr[0][0] == 0 and n != 0):
    print(-1)
    exit()
tmp3 = [str(arr[i][0]) if tmp1[i] else '0' for i in range(n)]
if tmp3[0] == '0' and n > 1:
    tmp3[0] = '1'
print(''.join(tmp3))


Fixed submission:
n,m = map(int,input().split())
d = [0 for _ in range(n)]
d[0] = 1
sarr = []
if m == 0 and n == 1:
    d[0] = 0
for i in range(m):
    s,c = map(int,input().split())
    if s == 1 and c == 0 and not n == 1:
        print(-1)
        exit()
    if s in sarr and c != d[s-1]:
        print(-1)
        exit()
    d[s-1] = c
    sarr.append(s)
    #print(sarr)
    #print(d)
ans = ''
for i in range(n):
    ans += str(d[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, k = MAP()
p = LIST()
psum = [0 for _ in range(n - k + 1)]
for i in range(n - k + 1):
    for j in range(i, i + k):
        psum[i] += (p[j] + 1) / 2
print(max(psum))

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

a = sum(p[0:k])
m = a
o = 0
for i in range(n - k):
    a += p[i + k] - p[i]
    #print(i, p[i + k], p[i], a)
    if a > m:
        m = a
        o = i + 1
'''
q = []
for i in range(n):
    q.append((p[i] + 1) / 2)
'''
ans = 0
#for i in range(k - 1, n):
#tmp = 0
for j in range(o, o + k):
    ans += (p[j] + 1) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = [int(i) for i in input().split()]
q = []
for i in range(n):
    q.append((p[i] + 1) / 2)

ans = 0
for i in range(k - 1, n):
    tmp = 0
    for j in range(k):
        tmp += q[i - j]
    ans = max(ans, tmp)

print(ans)


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

a = sum(p[0:k])
m = a
o = 0
for i in range(n - k):
    a += p[i + k] - p[i]
    #print(i, p[i + k], p[i], a)
    if a > m:
        m = a
        o = i + 1
'''
q = []
for i in range(n):
    q.append((p[i] + 1) / 2)
'''
ans = 0
#for i in range(k - 1, n):
#tmp = 0
for j in range(o, o + k):
    ans += (p[j] + 1) / 2

print(ans)