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

import collections

N = int(input())
dic = {}
for i in range(N):
  s = str(input())
  if dic.get(s):
    dic[s] += 1
  else:
    dic[s] = 1

max_k_list = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]
max_k_list.sort()
s_n = '\n'.join(max_k_list)
print(s_n)

### FIXED CODE ###

N = int(input())
dic = {}
nmax = 1
for i in range(N):
  s = str(input())
  if s in dic:
    dic[s] += 1
    #毎回dic更新する度に最大値も更新
    nmax = max(dic[s], nmax)
  else:
    dic[s] = 1
slist = []
for k in dic:
  if dic[k] == nmax:
    slist.append(k)
for s in sorted(slist):
  print(s)
### BUGGY CODE ###

def find_current_score(current_big_score, current_small_score, big_ratio, small_ratio):
    candidate_big_score = current_big_score
    candidate_small_score = 0
    while(True):
        candidate_small_score = candidate_big_score / big_ratio * small_ratio
        flag1 = candidate_small_score % 1 == 0.0
        flag2 = candidate_small_score >= current_small_score
        if(flag1 and flag2):
            break
        candidate_big_score += 1
    return int(candidate_big_score), int(candidate_small_score)

t_list = []
a_list = []

N = int(input())
for  n in range(N):
    t, a = list(map(int, input().strip().split()))
    t_list.append(t)
    a_list.append(a)
    
t_score = t_list[0]
a_score = a_list[0]

for n in range(1, N):
    t_ratio = t_list[n]
    a_ratio = a_list[n]
    t_score, a_score = find_current_score(t_score, a_score, t_ratio, a_ratio)
    
print(t_score + a_score)

### FIXED CODE ###

def compute_current_score(previous_t_score, previous_a_score, current_t_ratio, current_a_ratio):
    initial_divisor = max(previous_t_score // current_t_ratio, previous_a_score // current_a_ratio)
    current_t_score = 0
    current_a_score = 0
    while(True):
        current_t_score = initial_divisor * current_t_ratio
        current_a_score = initial_divisor * current_a_ratio
        if((current_t_score >= previous_t_score) and (current_a_score >= previous_a_score)):
            break
        initial_divisor += 1
    return current_t_score, current_a_score

N = int(input())
t_score, a_score = list(map(int, input().strip().split()))

for  n in range(N-1):
    t_ratio, a_ratio = list(map(int, input().strip().split()))
    t_score, a_score = compute_current_score(t_score, a_score, t_ratio, a_ratio)
    
print(t_score + a_score)
### BUGGY CODE ###

import math  
from itertools import product  

x = int(input())  

s = 0  
for a, b, c in product(range(1, x+1), repeat=3):  
  s += math.gcd(math.gcd(a, b), c)  
print(s)  

### FIXED CODE ###

import math  
from itertools import product  

x = int(input())  

s = 0  
for a, b, c in product(range(1, x+1), repeat=3):  
  s += math.gcd(math.gcd(a, b), c)  
print(s)
### BUGGY CODE ###

import collections
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
M=collections.Counter(A)
for i in range(Q):
  B,C=map(int,input().split())
  M[C]+=M[B]
  M[B]=0
  ans=0
  for j in M.items():
    ans+=j[0]*j[1]
  print(ans)

### FIXED CODE ###

import collections
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
M=collections.Counter(A)
ans=0
for j in M.items():
  ans+=j[0]*j[1]
for i in range(Q):
  B,C=map(int,input().split())
  ans+=(C-B)*M[B]
  M[C]+=M[B]
  M[B]=0
  print(ans)
### BUGGY CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    A = list(map(int, input().split()))
    q = int(input())
    import numpy as np
    A = np.array(A)
    ans = sum(A)
    for i in range(q):
        b,c = map(int, input().split())
        count = np.count_nonzero(A[A==b])
        A[A==b] = c
        ans += (c-b)* count
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    A = list(map(int, input().split()))
    q = int(input())
    import numpy as np
    A.sort()
    ans = sum(A)
    from bisect import bisect_left,bisect_right
    from collections import Counter
    count = Counter(A)
    for i in range(q):
        b,c = map(int, input().split())
        k = count[b]
        if k != 0:
            count[c] += count.pop(b)
        ans += (c-b)* k
        print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/python3
N, Q = [int(x) for x in input().split()]
S = input()
#print(S)

qs = []
for _ in range(Q):
    t, d = [x for x in input().split()]
    #print(t, d)
    qs.append((t,-1 if d == 'L' else 1))

memo = [None] * N

def move(i):
    org = i
    if memo[i]:
        return memo[i]
    for t, d in qs:
        if S[i] == t:
            i+=d
        if i == -1:
            break
        elif i == N:
            break
    memo[org] = i
    return i

def search_right(lo, hi, t):
    while lo < hi:
        m = lo + (hi - lo) // 2
        e = move(m)
        msg = "l=%d, r=%d, m=%d\t=> last[%d] = %3d (t=%d)" % (lo, hi, m, m, e, t)
        # 
        if e <= t:
            lo = m + 1
        else: # e <= t
            hi = m
    return lo

def search_left(lo, hi, t):
    while lo < hi:
        m = lo + (hi - lo) // 2
        e = move(m)
        msg = "l=%d, r=%d, m=%d\t=> last[%d] = %3d (t=%d)" % (lo, hi, m, m, e, t)
        # 
        if t < e:
            hi = m
        else: # e <= t
            lo = m +1
    return lo


#l = search(0, N-1, -1)
#assert move(l) == 2, "%d" % move(l)
#print("search(-1)=", l)

l = search_right(0, N-1, -1)
r = search_left(0, N, N-1)

m = [0] * (N)
for i in range(N):
    m[i] = move(i)

#print(" ".join("%2d" % i for i in range(N+1)))
#print(" ".join("%+d" % x for x in m))
#print(" ".join(" *" if l == i else "  " for i in range(N+1)))
#print(" ".join(" *" if r == i else "  " for i in range(N+1)))

print(r-l)





### FIXED CODE ###

#!/usr/bin/python3
N, Q = [int(x) for x in input().split()]
S = input()

qs = []
for _ in range(Q):
    t, d = [x for x in input().split()]
    #print(t, d)
    qs.append((t,-1 if d == 'L' else 1))

memo = [None] * N
memo.append(N)

def move(i):
    org = i
    if memo[i]:
        return memo[i]
    for t, d in qs:
        if S[i] == t:
            i+=d
        if i == -1:
            break
        elif i == N:
            break
    memo[org] = i
    return i

def search_right(lo, hi, x):
    while lo < hi:
        mid = lo + (hi - lo) // 2
        if x < move(mid):
            hi = mid 
        else: # e <= t
            lo = mid +1
    return lo

def search_left(lo, hi, x):
    while lo < hi:
        mid = lo + (hi - lo) // 2
        if move(mid) < x:
            lo = mid +1
        else: # e <= t
            hi = mid
    return lo


#l = search(0, N-1, -1)
#assert move(l) == 2, "%d" % move(l)
#print("search(-1)=", l)

l = search_right(0, N, -1)
r = search_left(0, N, N)

if 1==0:
    print(S)
    for t, d in qs:
        print(t, {-1:'L', 1:'R'}[d])
    m = [move(i) for i in range(N+1)]
    print(" ".join("%2d" % i for i in range(N+1)))
    print(" ".join("%+d" % x for x in m))
    print(" ".join(" *" if l == i else "  " for i in range(N+1)))
    print(" ".join(" *" if r == i else "  " for i in range(N+1)))

print(r-l)
### BUGGY CODE ###

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

result = set(range(A,B+1)) & set(list(range(A, A+K))+list(range(B-K+1, B+1)))
for i in sorted(list(result)):
    print(i)

### FIXED CODE ###

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


if B-A <= K:
    for i in range(A,B+1):
        print(i)
else:
    result = set(list(range(A, A+K))+list(range(B,B-K, -1)))

    for i in sorted(list(result)):
        print(i)
### BUGGY CODE ###

N,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(N-1):
    if sum(a[i:i+2])>x:
        while sum(a[i:i+2])>x:
            a[i+1]-=1
            ans+=1
        while sum(a[i:i+2])>x:
            a[i]-=1
            ans+=1

print(ans)

### FIXED CODE ###

N,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
for i in range(N-1):
    ex=sum(a[i:i+2])-x
    if ex>0:
        ans+=ex
        if a[i+1]>=ex:
            a[i+1]-=ex
        else:
            a[i+1]=0
            a[i]-=ex-a[i+1]
print(ans)
### BUGGY CODE ###

s = list(input())
q = int(input())

inn = []

for i in range(q):
    inn = list(input().split())
    if inn[0] == "1":
        s = s[::-1]
    elif inn[0] == "2":
        if inn[1] == "1":
            s.insert(0,inn[2])
        elif inn[1] == "2":
            s.append(inn[2])

news = ''.join(s)
    
print(news)
               

### FIXED CODE ###

import collections

s = list(input())
q = int(input())

s2 = collections.deque(s)

inn = []
jun = 0

for i in range(q):
    inn = list(input().split())
    if inn[0] == "1":
        if jun == 0:
            jun = 1
        else:
            jun = 0#jun = 0はそのまま　jun = 1は逆をする
    elif inn[0] == "2":
        if inn[1] == "1" and jun == 0:
            s2.appendleft(inn[2])
        elif inn[1] == "2" and jun == 0:
            s2.append(inn[2])
        if inn[1] == "1" and jun == 1:
            s2.append(inn[2])
        elif inn[1] == "2" and jun == 1:
            s2.appendleft(inn[2])
    
if jun == 0:
    news = ''.join(s2)
else:
    s2.reverse()
    news = ''.join(s2)

print(news)
### BUGGY CODE ###

import heapq
N, M = map(int, input().split())
P = [0 for i in range(M)]
Y = [0 for i in range(M)]
country = [[] for i in range(N+1)]
for i in range(M):
    P[i], Y[i] = map(int, input().split())
    heapq.heappush(country[P[i]], Y[i])
cs = [[] for i in range(N+1)]
for i in range(N+1):
    cs[i] = [heapq.heappop(country[i]) for j in range(len(country[i]))]

for i in range(M):
    num = cs[P[i]].index(Y[i]) + 1
    line = str(P[i]).zfill(6) + str(num).zfill(6)
    print(line)


### FIXED CODE ###

import heapq
N, M = map(int, input().split())
P = [0 for i in range(M)]
Y = [0 for i in range(M)]
country = [[] for i in range(N+1)]
for i in range(M):
    P[i], Y[i] = map(int, input().split())
    heapq.heappush(country[P[i]], (Y[i],i))
cs = [0 for i in range(M)]
for i in range(N+1):
    ran = len(country[i])
    for j in range(ran):
        year, num = heapq.heappop(country[i])
        cs[num] = str(j+1).zfill(6)

for i in range(M):
    line = str(P[i]).zfill(6) + cs[i]
    print(line)
### BUGGY CODE ###

import bisect
n,m = map(int,input().split())

g = [[ ] for i in range(n+1)]

for i in range(m):
    a,b = map(int,input().split())
    bisect.insort(g[a],b)
    bisect.insort(g[b],a)
    #print(bisect.bisect_left(g[a],b))
    #g[a][] = b
    #g[a].append(b)
    #g[b].append(a)

if len(g[n]) == 0:
    print('IMPOSSIBLE')
    exit()

for i in g[n]:
    if g[i][0] == 1:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

### FIXED CODE ###

import bisect
n,m = map(int,input().split())

g = [[ ] for i in range(n+1)]

for i in range(m):
    a,b = map(int,input().split())
    if a == 1 or a == n or b == 1 or b == n:
        g[a].append(b)
        g[b].append(a)

    #print(bisect.bisect_left(g[a],b))
    #g[a][] = b
    #g[a].append(b)
    #g[b].append(a)

#g[4].sort()

#print(g[4])

if len(g[n]) == 0:
    print('IMPOSSIBLE')
    exit()

for i in g[n]:
    g[i].sort()
    if g[i][0] == 1:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
### BUGGY CODE ###

al='abcdefghijklmnopqrstuvwxyz'
nums=[]
N=int(input())
s=[]
an=0
for i in range(N):
    s.append([x for x in input()])
    s[i].sort()
for i in range(N):
    for n in range(i+1,N):
        if s[i]==s[n]:
            an+=1
print(an)

### FIXED CODE ###

from collections import defaultdict
x=defaultdict(int)
N=int(input())
for i in range(N):
    x[''.join(sorted(input()))]+=1
an=0
for i in x.values():
    an+=int(i*(i-1)/2)
print(an)
### BUGGY CODE ###

(N,P) = map(int,input().split())

if N == 1:
    print(P)
    exit()

primelist=[]
powerlist=[]

p=2
while P >= p**N:        
    f = 0
    for q in primelist:
        if p % q == 0:
            f = 1
            break
    if f == 1:
        p += 1
        continue
    else:
        k = 0
        while P % (p**N) == 0:
            P //= (p**N)
            k += 1
        primelist.append(p)
        powerlist.append(k)
        p += 1

ans = 1
for i in range(len(primelist)):
    ans *= (primelist[i]**powerlist[i])

print(ans)

### FIXED CODE ###

import math

(N,P) = map(int,input().split())

if N == 1:
    print(P)
    exit()

ans = 1
p = 2
logP = math.log(P)
while N * math.log(p) <= logP:
    k = 0
    while P % p == 0:
        P //= p
        k += 1
    ans *= p**(k//N)
    if k > 0:
        logP = math.log(P)

    r = p % 6
    if r == 1:
        p += 4
    elif r == 5:
        p += 2
    else:
        p += 1

print(ans)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
s = S()



left = 0
right = n//2
flag = 0
while left <= right:
    mid = (left + right) // 2
    str_len = mid
    for sousa_point in range(n - str_len + 1):
        string = s[sousa_point: sousa_point + str_len]
        if string in s[:sousa_point] or string in s[sousa_point + str_len:]:
            left = mid + 1
            flag = 1
            break
    else:
        right = mid - 1
        flag = False


if flag:
    print(mid)
else:
    print(mid - 1)

### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n = I()
s = S()


def z_algorithm(S):
    l = len(S)
    A = [0] * l
    i = 1; j = 0
    while i < l:
        while i+j < l and S[j] == S[i+j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i+k] = A[k]
            k += 1
        i += k; j -= k


    ret = 0
    for p in range(l):
        if p >= A[p] > ret:
            ret = A[p]
    return ret


ans = 0
for i in range(n):
    ans = max(ans, z_algorithm(s[i:]))



print(ans)
### BUGGY CODE ###

import itertools
def resolve():
    n = int(input())
    l = tuple(map(int,input().split()))
    cnt = 0
    for i in itertools.combinations(l,3):
        a,b,c = i
        if a<b+c and b<c+a and c<a+b:
            cnt += 1
    print(cnt)
resolve()

### FIXED CODE ###

import bisect
def resolve():
    n = int(input())
    l = sorted(list(map(int,input().split())))
    ans = 0
    for a in range(n):
        for b in range(a+1,n):
            c = bisect.bisect_left(l,l[a]+l[b])
            if c > b:
                ans += c-b-1
            else:
                pass
    print(ans)
resolve()
### BUGGY CODE ###


import collections

h,w,m = map(int,input().split())

gyou = collections.defaultdict(int)
retu = collections.defaultdict(int)
maze = [[0 for i in range(w)] for j in range(h)]

for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    maze[y-1][x-1] = 1

ymax = max(gyou.values())
xmax = max(retu.values())
ans =  ymax + xmax 

for xk,xv in retu.items():
    if xv != xmax:
        continue
    for yk, yv in gyou.items():
        if yv != ymax:
            continue
        if maze[yk][xk] != 1:
            print(ans)
            exit()

print(ans-1)


### FIXED CODE ###

import collections

h,w,m = map(int,input().split())

gyou = [0 for i in range(h)]
retu = [0 for i in range(w)]
l = []

for i in range(m):
    y,x = map(int,input().split())
    gyou[y-1] += 1
    retu[x-1] += 1
    l.append((y-1,x-1))

ymax = max(gyou)
xmax = max(retu)
c_ymax = gyou.count(ymax)
c_xmax = retu.count(xmax)
ans = ymax + xmax

c = 0
for y,x in l:
    if gyou[y] == ymax and retu[x] == xmax:
        c += 1

if c == c_ymax*c_xmax:
    print(ans-1)
else:
    print(ans)
### BUGGY CODE ###

N = int(input())
S = input()

sum = 0
for i in range(N):
    for j in range(i+1, N):
        if S[i] == S[j]:
            continue

        RGB = ['R','G','B']
        RGB.remove(S[j])
        RGB.remove(S[i])
        sum += S[(j+1):].count(RGB[0])

        # S[k]
        k = 2 * j - i
        if k < len(S):
            if S[k] == RGB[0]:
                sum -= 1
print(sum)

### FIXED CODE ###

from collections import Counter

N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')

sum = r*g*b

for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if k > N - 1:
            break
        if not S[i] == S[j] and not S[j] == S[k] and not S[k] == S[i]:
            sum -= 1
print(sum)
### BUGGY CODE ###

import sys
def ment(dp,hcost,i,K):
  K=min(i,K)
  ret=sys.maxsize
  for k in range(1,K+1):
    cost=dp[i-k]+abs(hcost[i-k]-hcost[i])
    ret=min(ret,cost)
    #print(cost)
  return ret                               
                                 

N,K=list(map(int,input().split()))
hcost=list(map(int,input().split()))
dp=[0]*(N)
#dp[1]=abs(hcost[1]-hcost[0])

for i in range(1,N):
  #dp[i]=min(dp[i-2]+abs(hcost[i-2]-hcost[i]),dp[i-1]+abs(hcost[i-1]-hcost[i]))
  dp[i]=ment(dp,hcost,i,K)
  
print(dp[N-1])
#print(dp)

### FIXED CODE ###

N,K= list(map(int,input().split()))
hc=list(map(int,input().split()))
dp=[0]*N
for i in range(1,N):
  li=[abs(hc[i]-hc[j])+dp[j] for j in range( max(i-K,0),i) ]
  dp[i]=min(li)
print(dp[-1])
### BUGGY CODE ###

x=int(input())
for i in range(-x,x):
  for j in range(-x,x):
    if (i**5)-(j**5)==x:
      print(i,j)
      exit()


### FIXED CODE ###

x=int(input())
for i in range(-200,200):
  for j in range(-200,200):
    if (i**5)-(j**5)==x:
      print(i,j)
      exit()
### BUGGY CODE ###

def z_algorithm(s: str) -> list:
	n = len(s)
	Z = [0] * n
	Z[0] = n
	i, j = 1, 0
	while i < n:
		while i + j < n and s[j] == s[i + j]:
			j += 1
		Z[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < n and k + Z[k] < j:
			Z[i + k] = Z[k]
			k += 1
		i += k
		j -= k
	return Z


n = int(input())
s = input()
ans = 0
for i in range(n):
	z = z_algorithm(s[i:])
	t = max(min(j, z[j]) for j in range(n - i))
	ans = max(ans, t)
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
a=0
i=0
j=1
while j<n:
	if s[i:j] in s[j:]:
		a=max(a,len(s[i:j]))
		j+=1
	else:
		i+=1
	if i==j:
		i+=1
		j+=2
print(a)
### BUGGY CODE ###

N = int(input())
S = list(str(input()) for i in range(N))

Dic = {}

for s in S:
    if s in Dic:
        Dic[s] += 1
    else:
        Dic[s] = 1

for max_key in sorted([k for k, v in Dic.items() if v==max(Dic.values())]):
    print(max_key)

### FIXED CODE ###

import collections

n = int(input())
s = []
for i in range(n):
    s.append(input())

c = collections.Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
ans = []
for j in range(len(c_s)):
    if c_s[j][1] != m:
        break
    else:
        ans.append(c_s[j][0])
ans.sort()
for t in ans:
    print(t)
### BUGGY CODE ###

import collections

def main():
    N  = int(input()) 
    A=list(map(int, input().split()))
    C = collections.Counter(A)
    B = list(set(A))
    B.sort()
    lenb = len(B)
    Boo = [True]*lenb
    s,_ = sieve((10**6)+9)

    zero =  A.count(1)
    if zero>1:
        print(0)
        return
    if zero==1:
        print(1)
        return

    for i in range(lenb):
        if Boo[i]:
            for j in range(i+1,lenb):
                if Boo[j] and s[B[j]-1]==False and B[j] % B[i] == 0:
                    Boo[j] = False

    cnt = 0
    for i in range(lenb):
        if Boo[i] and C[B[i]]==1:
            cnt += 1

    print(cnt)


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table


if __name__ == '__main__':
    main()

### FIXED CODE ###

import collections

def main():
    N  = int(input()) 
    A=list(map(int, input().split()))
    C = collections.Counter(A)
    B = list(set(A))
    B.sort()
    lenb = len(B)
    Boo = [True]*lenb
    ZENBU = [False]*(10**6+4)

    if C[1]>1:
        print(0)
        return
    if C[1]==1:
        print(1)
        return

    for i in range(lenb):
        temp = 2
        if ZENBU[B[i]]==False:
            while B[i]*temp < 1000002:
                ZENBU[B[i]*temp] = True
                temp+=1

    cnt = 0
    for i in range(lenb):
        if ZENBU[B[i]]==False and C[B[i]]==1:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from sys import stdin
def main():

    input = stdin.readline

    N,K = map(int,input().split())
    p_list = tuple(map(int,input().split()))

    max_sum = 0
    listN = list(range(N))
    for i in listN:
        tmp_sum = sum(p_list[i:i+K])
        if(max_sum < tmp_sum):
            max_sum = tmp_sum
            ichi = i

    kitaichi = ((p+1)/2 for p in p_list[ichi:ichi+K])

    print(sum(kitaichi))

if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin

def main():

    input = stdin.readline

    N,K = map(int,input().split())
    p_list = [(p+1)/2 for p in list(map(int,input().split()))]

    # Sを計算
    S = [0]
    for p in p_list:
        S.append(S[-1] + p)
        # print(S)

    # i:i+kを計算

    maxs = 0
    for i in range(N-K+1):
        p_num = S[i+K] - S[i]
        if(maxs < p_num):
            maxs = p_num
    
    print(maxs)

if __name__ == "__main__":
    main()