Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from itertools import product

def solve():
  n, k = map(int, input().split())
  count = 0
  # # A解法
  # for a in range(1, n+1):
  #   for b in range(1, n+1):
  #     # for c in range(1, n+1):
  #     count += min(a, cal(a, b, 3, n, k))

  # B解法
  ary = [(a, b, c)
    for a in range(1, n+1)
    for b in range(1, n+1)
    for c in range(1, n+1)]
  # print(ary)

  for i in range(len(ary)):
    A = ary[i][0] + ary[i][1]
    B = ary[i][1] + ary[i][2]
    C = ary[i][0] + ary[i][2]

    if A%k ==0 and B%k ==0 and C%k ==0:
      count += 1


  
  # for a, b, c in ary:
  #   if (a+b)%k == 0 and (b+c)%k == 0 and (c+a)%k == 0:
  #     count += 1

  # C解法
  # a = range(1, n+1)
  # for i in range(1, n+1):
  #   b = i


  
  print(count)


solve()


### FIXED CODE ###

def solve():
  n, k = map(int, input().split())
  
  divList = [0 for _ in range(k)]
  for i in range(1, n+1):
    divList[i % k] += 1
  
  count = 0
  for i in range(k):
    if (i*2) % k ==0:
      count += divList[i] ** 3
  print(count)
solve()
### BUGGY CODE ###

MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

n,a,b=list(map(int,input().split()))
p = 10 ** 9 + 7
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

# 2**n-1
total = power_func(2,n,MOD)-1

print(total-cmb(n,a,MOD)-cmb(n,b,MOD))



### FIXED CODE ###

MOD = 10**9+7
def power_func(a,n,p):
  bi=str(format(n,"b"))#2進表現に
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

def cmb(n,k,p):
    if n < k:
        return 0
    if n-k<k:
        k=n-k

    # 分母
    comb = 1
    for x in range(n-k+1, n+1):
        comb = (comb * x) % MOD

    # 逆行列
    d = 1
    for x in range(1, k+1):
        d = (d * x) % MOD
    comb *= pow(d, MOD-2, MOD)
    return comb % MOD

n,a,b=list(map(int,input().split()))

# 2**n-1
total = power_func(2,n,MOD)-1
print((total-cmb(n,a,MOD)-cmb(n,b,MOD))%MOD)
### BUGGY CODE ###

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

maxs = [0]
# print(ps)
for i in range(n-k + 1):

    vs = ps[i:i+k]
    # print(i, vs)
    if sum(vs) > sum(maxs):
        maxs = vs

result = 0
for m in maxs:
    result += (m + 1)/2
print(result)

### FIXED CODE ###

from collections import deque

n, k = map(int, input().split())
ps = list(map(int, input().split()))
ps = [(p + 1)/2 for p in ps]
# print(ps)

d = deque()
vmax = 0
v = 0
for p in ps:

    if len(d) == k:
        old = d.popleft()
        new = p
        d.append(new)
        v = v + new - old
        if v > vmax:
            # print("v > vmax")
            vmax = v
    else:
        d.append(p)
        v += p
        vmax = v
    # print(vmax, v, d)

print(vmax)
### BUGGY CODE ###

from collections import deque

N, *A = map(int, open(0).read().split())
G = {(i + 1, j + 1): [] for i in range(N) for j in range(i + 1, N)}
deg = {(i + 1, j + 1): 0 for i in range(N) for j in range(i + 1, N)}
for i, a in enumerate(zip(*[iter(A)] * (N - 1)), 1):
    P = ((i, p) if i < p else (p, i) for p in a)
    pre = next(P)
    for cur in P:
        G[pre].append(cur)
        deg[cur] += 1
        pre = cur

Q = deque((k, 1) for k, v in deg.items() if v == 0)

ans = 0
cnt = len(Q)
while Q:
    v, ans = Q.popleft()
    for t in G[v]:
        deg[t] -= 1
        if deg[t] == 0:
            Q.append((t, ans + 1))
            cnt += 1

if cnt != (N * (N - 1) // 2):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

import time
start = time.time()

import sys
input = sys.stdin.readline

N = int(input())
A = [[int(i) - 1 for i in input().split()] for _ in range(N)]

cur = [0] * N

max_pairs = N * (N - 1)

pairs = 0
cnt = 1
for _ in range(max_pairs // 2):
    visited = [False] * N
    for i, a in enumerate(A):
        if cur[i] >= N - 1:
            continue
        p = a[cur[i]]
        if A[p][cur[p]] == i:
            # print(cnt, p + 1, A[p][cur[p]] + 1, i + 1)
            visited[i] = True
            visited[a[cur[i]]] = True
            pairs += 1

    # print(pairs)
    if pairs == max_pairs:
        break
    if pairs > max_pairs:
        print(-1)
        quit()

    update = False
    for i, v in enumerate(visited):
        if v:
            cur[i] += 1
            update = True

    if not update:
        print(-1)
        quit()

    if time.time() - start > 1.8:
        print(N * (N - 1) // 2)
        exit()

    cnt += 1

print(cnt)
### BUGGY CODE ###

from time import time
start = time()

# 解説放送の解法

class BIT:
    '''https://tjkendev.github.io/procon-library/python/range_query/bit.html'''
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s
    def add(self, i, x):
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    def query(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)
      
def main():
  N,Q=map(int,input().split())
  *C,=map(int,input().split())
  q = [tuple(map(int,input().split())) for _ in range(Q)]

  # 重複度を数える。
  res=[]
  tmp_dict={}
  for i in range(N):
    if tmp_dict.get(C[i]) != None:
      #(クエリの種類、l, r）
      res.append((tmp_dict[C[i]]<<40) | (Q<<20) | i)
      del tmp_dict[C[i]]
    tmp_dict[C[i]] = i

  # クエリと合わせてソート。
  X = []
  for i in range(Q):
    l,r = q[i]
    # (元のクエリの順番、l, r)
    X.append(((l-1)<<40) | (i<<20) | r-1)
    
  X.extend(res) 
  X = sorted(X)

  # 平面走査
  bit = BIT(N)
  ans=[0]*Q
  mask = (1<<20) - 1
  for l in reversed(X):
    r = l & mask
    l >>= 20
    idx = l & mask
    l >>= 20
    if idx == Q:
      bit.add(r,1)
    else:
      ans[idx] = r-l+1-bit.query(l-1,r)
      
  print(*ans)
  
if __name__=="__main__":
  main()

### FIXED CODE ###

from time import time
start = time()

# 解説放送の解法

class BIT:
    '''https://tjkendev.github.io/procon-library/python/range_query/bit.html'''
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
        self.el = [0]*(n+1)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s
    def add(self, i, x):
        self.el[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i
    def query(self, i, j=None):
        if j is None:
            return self.el[i]
        return self.sum(j) - self.sum(i)
      
def main():
  N,Q=map(int,input().split())
  *C,=map(int,input().split())
  q = [tuple(map(int,input().split())) for _ in range(Q)]

  # 重複度を数える。
  res=[]
  tmp_dict={}
  for i in range(N):
    if tmp_dict.get(C[i]) != None:
      #(クエリの種類、l, r）
      res.append((tmp_dict[C[i]]<<40) | (Q<<20) | i)
      del tmp_dict[C[i]]
    tmp_dict[C[i]] = i

  # クエリと合わせてソート。
  X = []
  for i in range(Q):
    l,r = q[i]
    # (元のクエリの順番、l, r)
    X.append(((l-1)<<40) | (i<<20) | r-1)
    
  X.extend(res) 
  X = sorted(X)

  # 平面走査
  bit = BIT(N)
  ans=[0]*Q
  mask = (1<<20) - 1
  for l in reversed(X):
    r = l & mask
    l >>= 20
    idx = l & mask
    l >>= 20
    if idx == Q:
      bit.add(r,1)
    else:
      ans[idx] = r-l+1-bit.query(l-1,r)
      
  print(*ans)
  
if __name__=="__main__":
  main()
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline

n = int(input())
a_list = [None for _ in range(n)]
num = 0
day = 0
for i in range(n):
    a_list[i] = deque([int(i) - 1 for i in input().split()])

while (num < n * (n - 1) // 2):
    visit = set([])
    day += 1
    for j in range(n):
        if j not in visit:
            if len(a_list[j]) > 0:
                k = a_list[j][0]
                if k > j:
                    if k not in visit:
                        if a_list[k][0] == j:
                            num += 1
                            visit.add(a_list[j].popleft())
                            visit.add(a_list[k].popleft())
    if ((j == n - 1) & (len(visit) == 0)):
        day = -1
        break
print(day)



### FIXED CODE ###

from collections import deque
n = int(input())
a_list = []
for i in range(n):
    a_list.append(deque([int(aa) - 1 for aa in input().split()]))
day = 0
battle = 0
for _ in range(n * (n - 1) // 2):
    if battle == n * (n - 1) // 2:
        break
    day += 1
    battle_today = 0
    tomorrow = set([])
    if (day == 1):
        player = set([i for i in range(n)])
    for i in player:
        if len(a_list[i]) == 0:
            continue
        j = a_list[i][0]
        if (i == a_list[j][0]) & (j not in tomorrow) & (len(a_list[j]) > 0) & (i not in tomorrow):
            tomorrow.add(i)
            tomorrow.add(a_list[i][0])
            battle += 1
            battle_today += 1
            a_list[i].popleft()
            a_list[j].popleft()
    player = tomorrow
    if battle_today == 0:
        day = -1
        break
print(day)
### BUGGY CODE ###

k = int(input())
q = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(k):
    x = q.pop(0)
    y = x % 10
    if y != 0:
        q.append(10 * x + y - 1)
    q.append(10*x + y)
    if y != 9:
        q.append(10 * x + + y +1)
print(x)

### FIXED CODE ###

k = int(input())
q = [0]*100003
for i in range(9):
    q[i] = i + 1
c = 9
for i in range(k):
    x = q[i]
    y = x % 10
    if y != 0:
        q[c] = 10 * x + y - 1
        c = c + 1
    q[c] = 10 * x + y
    c = c + 1
    if y != 9:
        q[c] = 10 * x + y + 1
        c = c + 1
    if c > k:
        break
print(q[k - 1])
### BUGGY CODE ###

n=int(input())
p=list(map(int,input().split()))
p.append(10000000000)
cnt=1
for i in range(1,n):
	a=min(p[:i+1])
	if p[i]==a:
		cnt+=1
print(cnt)


### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
a=p[0]
cnt=1
for i in range(1,n):
	if p[i]<a:
		cnt+=1
		a=p[i]
print(cnt)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(2*10**5)
n,q=map(int,input().split())
graph=[[] for _ in range(n)]
for _ in range(n-1):
    a,b=map(int,input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
prev=[-1]*n
prev[0]=0
def f(n):
    for i in graph[n]:
        if prev[i]==-1:
            prev[i]=n
            f(i)
f(0)
counter=[0]*n
for _ in range(q):
    p,x=map(int,input().split())
    counter[p-1]+=x
score=[0]*n
score[0]=counter[0]
stack=[0]
while stack!=[]:
    memo=[]
    for i in stack:
        for j in graph[i]:
            if j!=prev[i]:
                score[j]=score[i]+counter[j]
                memo.append(j)
    stack=memo
for k in score:
    print(k,end=" ")

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(2*10**5)
n,q=map(int,input().split())
graph=[[] for _ in range(n)]
for _ in range(n-1):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
counter=[0]*n
for _ in range(q):
  p,x=map(int,input().split())
  counter[p-1]+=x
score=[0]*(n+1)
stack=[(0,-1)]
while stack!=[]:
  node,prev=stack.pop()
  score[node]=score[prev]+counter[node]
  for i in graph[node]:
    if i!=prev:
      stack.append((i,node))
print(*score[:-1])
### BUGGY CODE ###

k, s = [int(x) for x in input().split()]

count=0
for x in range(k+1):
	for y in range(x, k+1):
		for z in range(y, k+1):
			if x+y+z == s:
				if x==y and x==z:
					count+=1
				elif x==y or x==z or y==z:
					count+=3
				else:
					count+=6
print(count)

### FIXED CODE ###

k, s = [int(x) for x in input().split()]

count=0
for x in range(k+1):
    for y in range(k+1):
        if (s-(x+y) <= k and s-(x+y) >=0):
            count+=1
print(count)
### BUGGY CODE ###

def solve():
    n, m = map(int, input().split())
    a = sorted(list(map(int, input().split())))
    # 最大の値でチケットを使う
    # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
    for i in range(m):
        a[len(a)-1] //= 2
        if a[len(a)-1] < a[len(a)-2]:
            a = binary_search(a, a[len(a)-1])
    return sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)


### FIXED CODE ###

import heapq  # 優先度付きキュー
# def solve():  # TLE
#     n, m = map(int, input().split())
#     # O(nlog(n))
#     a = sorted(list(map(int, input().split())))
#     # 最大の値でチケットを使う
#     # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
#     # O(m)
#     for i in range(m):
#         a[len(a)-1] //= 2
#         if a[len(a)-1] < a[len(a)-2]:
#             # O(log2m)
#             a = binary_search(a, a[len(a)-1])
#     return sum(a)


def solve():
    n, m = map(int, input().split())
    a = list(map(lambda x: int(x)*-1, input().split()))
    heapq.heapify(a)  # aを優先度付きキューに変更
    for _ in range(m):  # _　iで注意が出ない(インスタンスを作らない)
        tmp_min = heapq.heappop(a)  # aの最大の値のpop
        heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差が生じるため(//2の返り値はintのため)
    return -sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)
### BUGGY CODE ###

N = int(input())

count = 0

while N != 1:
    count += 1
    N = N/2

print(2**count)


### FIXED CODE ###

N = int(input())

count = 0

while N != 1:
    count += 1
    N = N//2

print(2**count)
### BUGGY CODE ###

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

ans = set()

for i in range(N + 1):
  ans.add(int(i * A / B) - A * int(i / B))
  
print(max(ans))

### FIXED CODE ###

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

if N < B :
  print(N * A // B - A * (N // B))
else :
  print((B-1) * A // B - A * ((B-1) // B))
### BUGGY CODE ###

import copy
N=int(input())
A=list(int(input()) for _ in range(N))
a=copy.deepcopy(A)
for i in range(N):
    a = copy.deepcopy(A)
    a.pop(i)
    print(max(a))


### FIXED CODE ###

import copy
N=int(input())
A=list(int(input()) for _ in range(N))
a=copy.deepcopy(A)
a.sort(reverse=True)
x=a[0]
y=a[1]

for i in range(N):
    if A[i]==x:
        print(y)
    else:
        print(x)
### BUGGY CODE ###

s = input()

dp = [[0] * 13 for i in range(len(s))]

# 初期値
digit = s[0]
ii = len(s) - 1
if digit == '?':
    for j in range(10):
        num = j * (10**ii)
        amari = num % 13
        dp[0][amari] += 1
else:
    num = int(digit) * (10**ii)
    amari = num % 13
    dp[0][amari] += 1

for i in range(1, len(s)):
    ii = len(s) - 1 - i
    digit = s[i]
    if digit == '?':
        for j in range(10):
            num = j * (10**ii)
            amari = num % 13
            for k in range(13):
                dp[i][k] += dp[i-1][k-amari]
                dp[i][k] = dp[i][k] % (10**9+7)
    else:
        num = int(digit) * (10**ii)
        amari = num % 13
        for k in range(13):
            dp[i][k] += dp[i-1][k-amari]
            dp[i][k] = dp[i][k] % (10**9+7)

print(dp[len(s)-1][5] % (10**9+7))

### FIXED CODE ###

s = input()
s = s[::-1]
n = len(s)
mod = 10**9 + 7

dp = [[0 for j in range(13)] for i in range(n)]
if s[0] == '?':
    for i in range(10):
        dp[0][i] = 1
else:
    num = int(s[0])
    dp[0][num] = 1

mul = 1
for i in range(1, n):
    mul = (mul*10) % 13
    if s[i] == '?':
        for m in range(10):
            num = (m * mul) % 13
            for j in range(13):
                dp[i][(j+num)%13] = (dp[i][(j+num)%13] + dp[i-1][j]) % mod
    else:
        num = (int(s[i]) * mul) % 13
        for j in range(13):
            dp[i][(j+num)%13] = (dp[i][(j+num)%13] + dp[i-1][j]) % mod

print(dp[n-1][5])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def solve():
  R, C, K = map(int, input().split())
  item = [[0]*C for _ in range(R)]
  for i in range(K):
    r,c,v = map(int, input().split())
    item[r-1][c-1] = v
  dp = [[[0]*5 for _ in range(C+1)] for _ in range(R+1)]
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4): #横から取らない
        dp[i][j][k] = dp[i][j-1][k]
      #上から取らない
      dp[i][j][0] = max(dp[i][j][0],dp[i-1][j][-1])
      if item[i-1][j-1]>0:
        #上からとる
        dp[i][j][1] = max(dp[i][j][1],dp[i-1][j][-1]+item[i-1][j-1])
        for k in range(1,4): #横から取る
          dp[i][j][k] = max(dp[i][j][k],dp[i][j-1][k-1]+item[i-1][j-1])
      dp[i][j][4] = max(dp[i][j][:4])
  ans = max(dp[-1][-1])
  return ans
print(solve())

### FIXED CODE ###

import sys
input = sys.stdin.readline
def solve():
  R, C, K = map(int, input().split())
  item = [[0]*C for _ in range(R)]
  for i in range(K):
    r,c,v = map(int, input().split())
    item[r-1][c-1] = v
  dp = [[[0]*(C+1) for _ in range(R+1)] for _ in range(4)]
  for i in range(1,R+1):
    for j in range(1,C+1):
      for k in range(4): #横から取らない
        dp[k][i][j] = dp[k][i][j-1]
      #上から取らない
      dp[0][i][j] = max(dp[0][i][j],dp[-1][i-1][j])
      if item[i-1][j-1]>0:
        #上からとる
        dp[1][i][j] = max(dp[1][i][j],dp[-1][i-1][j]+item[i-1][j-1])
        for k in range(1,4): #横から取る
          dp[k][i][j] = max(dp[k][i][j],dp[k-1][i][j-1]+item[i-1][j-1])
      for k in range(1,4):
        dp[k][i][j] = max(dp[k-1][i][j],dp[k][i][j])
  ans = 0
  for k in range(4):
    ans = max(ans,dp[k][-1][-1])
  return ans
print(solve())
### BUGGY CODE ###

import collections
sum = 0
Asum=[]
N = int(input())
A =  [int(N) for N in input().split()]
B = A.copy()
for i in range(N):
    B.pop(i)
    c = collections.Counter(B)
    values, counts = zip(*c.most_common())
    for j in range(len(counts)):
        sum+=int(counts[j]*(counts[j]-1)/2)
    B=A.copy()
    Asum.append(int(sum))
    sum=0
for k in range(N):
    print(Asum[k])

### FIXED CODE ###

from collections import Counter
def choose2(n):
    return n*(n-1)/2
sum1=0
sum2=0
N = int(input())
A = [int(N) for N in input().split()]
S = Counter(A)
for i in  S.values():
    sum1+=int(choose2(i))
for j in range(N):
    sum2+=int(sum1-choose2(S[A[j]])+choose2(S[A[j]]-1))
    print(sum2)
    sum2=0
### BUGGY CODE ###

a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        print a
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = a[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = a[1:]
        if len(c) == 0:
            print 'C'
            break


### FIXED CODE ###

a=raw_input()
b=raw_input()
c=raw_input()

next = 'a'

while True:
    if next == 'a':
        next = a[0]
        a = a[1:]
        if len(a) == 0:
            print 'A'
            break
    elif next == 'b':
        next = b[0]
        b = b[1:]
        if len(b) == 0:
            print 'B'
            break
    else:
        next = c[0]
        c = c[1:]
        if len(c) == 0:
            print 'C'
            break
### BUGGY CODE ###

n = int(input())

s = input()

# print(s)
# brute force
rs = 0
gs = 0
bs = 0
for x in s:
    if x == 'R':
        rs += 1
    if x == 'G':
        gs += 1
    if x == 'B':
        bs += 1
# print(rs, gs, bs)

count = 0
for i in range(len(s)):
    for j in range(i, len(s)):
        for k in range(j, len(s)):
            if (s[i] != s[j] and s[j] != s[k] and s[i] != s[k]):
                if j - i != k - j:
                    count += 1
                    # print(s[i], s[j], s[k])

print(count)


### FIXED CODE ###

n = int(input())

s = input()

# print(s)
# brute force
rs = 0
gs = 0
bs = 0
for x in s:
    if x == 'R':
        rs += 1
    if x == 'G':
        gs += 1
    if x == 'B':
        bs += 1

i = 0
d = 1
count = 0
for i in range(0, n):
    d = 1
    while (i + 2*d < n):
        ok = s[i] != s[i+d] and s[i+d] != s[i+2*d] and s[i] != s[i+2*d]
        if ok:
            count += 1
        d += 1


print(rs * gs * bs - count)
# print(rs, gs, bs)

# count = 0
# for i in range(len(s)):
#     for j in range(i, len(s)):
#         for k in range(j, len(s)):
#             if (s[i] != s[j] and s[j] != s[k] and s[i] != s[k]):
#                 if j - i != k - j:
#                     count += 1
#                     # print(s[i], s[j], s[k])

# print(count)
### BUGGY CODE ###

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 CODE ###

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 CODE ###

N=int(input())
S = [input() for _ in range(N)]
maxA=0
B=[]
for i in set(S):
  A=(S.count(i))
  if A > maxA:
    maxA=A
    B = [i]
  if A == maxA and i not in B:
    B.append(i)
[print(j) for j in sorted(B)]

### FIXED CODE ###

N=int(input())
S = [input() for _ in range(N)]
import collections 
C=collections.Counter(S)
maxC=max(C.values())
keys = [k for k, v in C.items() if v == maxC]
[print(j) for j in sorted(keys)]