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

n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=1
for i in range(n):
    tmp = a.count(a[i]-1)+a.count(a[i])+a.count(a[i]+1)
    if ans < tmp:
        ans = tmp
print(ans)




### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
collection = Counter(a)
# print(collection)
ans = [0] * 100010
for i in collection:
    ans[i] = collection[i-1]+collection[i]+collection[i+1]
print(max(ans))
### BUGGY CODE ###

import sys
import collections
from collections import Counter
# from collections import deque
# from collections import defaultdict
import itertools
# from itertools import accumulate
# from itertools import permutations
# from itertools import combinations
# from itertools import takewhile
from itertools import compress
import functools
# from functools import reduce
import math
# from math import gcd
# from math import inf
# from math import ceil
# from math import floor
# from math import log10
# from math import log2
# from math import log
from math import factorial

MOD = (10 ** 9) + 7
# import re

# input = sys.stdin.readline
# sys.setrecursionlimit(10000)

S = input()
N = len(S)

dp = [[0] * (N + 1) for _ in range(4)]

dp[0][0] = 1
dp[1][0] = 0
dp[2][0] = 0
dp[3][0] = 0

for i in range(1, N + 1):
    for j in range(4):
        s = S[i - 1]
        m = 3 if s == "?" else 1
        dp[j][i] += m * dp[j][i - 1]
        if j == 1:
            if s == "A" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 2:
            if s == "B" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 3:
            if s == "C" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]

print(dp[3][N] % MOD)


### FIXED CODE ###

import gc

MOD = (10 ** 9) + 7

S = input()
N = len(S)

dp = [[0] * (N + 1) for _ in range(4)]

dp[0][0] = 1
dp[1][0] = 0
dp[2][0] = 0
dp[3][0] = 0

for i in range(1, N + 1):
    for j in range(4):
        s = S[i - 1]
        m = 3 if s == "?" else 1
        dp[j][i] += m * dp[j][i - 1]
        if j == 1:
            if s == "A" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 2:
            if s == "B" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        elif j == 3:
            if s == "C" or s == "?":
                dp[j][i] += dp[j - 1][i - 1]
        dp[j][i] = dp[j][i] % MOD

print(dp[3][N] % MOD)
### BUGGY CODE ###

n,x,y = list(map(int,input().split()))

distance_list =[]

for i in range(1,n):
    for j in range(i+1,n+1):
        a = j - i
        b = abs(i - x) + abs(j-y) + 1
        if a <= b:
            distance_list.append(a)
        else:
            distance_list.append(b)

count_list = []

for i in range(n-1):
    count_list.append(distance_list.count(i+1))

for i in range(n-1):
    print(count_list[i])

### FIXED CODE ###

n,x,y = map(int,input().split())

distance_list =[0]*n

for i in range(1,n):
    for j in range(i+1,n+1):
        a = j - i
        b = abs(i - x) + abs(j-y) + 1
        distance_list[min(a,b)] += 1

for i in range(1,n):
    print(distance_list[i])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(500000)

N,Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int,input().split())
  a-=1;b-=1 #頂点を0indexに
  G[a].append(b);G[b].append(a)
query = {}
for i in range(Q):
  p,x = map(int,input().split())
  p-=1
  if p not in query:
    query[p] = x
  else:
    query[p] += x
ans = [0 for _ in range(N)]
def dfs(v,par): #vが今いる頂点、parが親。
  if v in query:
    ans[v] += query[v]
  for u in G[v]:
    if u != par:
      ans[u] += ans[v]
      dfs(u,v)
dfs(0,-1)
print(*ans)
  
  

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(500000)

N,Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int,input().split())
  a-=1;b-=1 #頂点を0indexに
  G[a].append(b);G[b].append(a)
#query = {}
ans = [0 for _ in range(N)]
for i in range(Q):
  p,x = map(int,input().split())
  p-=1
  ans[p] += x

def dfs(v,par): #vが今いる頂点、parが親。
  if par != -1:
    ans[v] += ans[par]
  for u in G[v]:
    if u != par:
      dfs(u,v)
dfs(0,-1)
print(*ans)
### BUGGY CODE ###

N = int(input())
cycles = [int(input()) for i in range(N)]


x = 1
M = max(cycles)
while 1:
    for num in cycles:
        if (M * x) % num != 0:
            x += 1
            break
    else:
        print(M * x)
        quit()


### FIXED CODE ###

def GCD(x: int, y: int):
    if x < y:
        x, y = y, x

    if x % y == 0:
        return y
    else:
        return GCD(y, x % y)


def LCM(x: int, y: int):
    return x * y // GCD(x, y)


N = int(input())
Tlist = [int(input()) for i in range(N)]
ans = 1
for num in Tlist:
    ans = LCM(ans, num)
print(ans)
### BUGGY CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
for i in range(n):
    count=0
    for k in range(i,n-1):
        if high[k]>=high[k+1]:
            count+=1
        else:
            break
    ans.append(count)

print(max(ans))

### FIXED CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
MaxC=0
for k in range(n-1):
    if high[k]>=high[k+1]:
        count+=1
        MaxC=max(MaxC,count)
    else:
        count=0
print(MaxC)
### BUGGY CODE ###

def resolve():
    s = input()
    q = int(input())
    qall = []
    for _ in range(q):
        qall.append(input())

    for i in range(q):
        if qall[i] == "1":
            s = s[::-1]
        else:
            z = qall[i].split()
            b = int(z[1])
            c = z[2]
            if b == 1:
                s = c + s
            else:
                s = s + c
    print(s)
resolve()

### FIXED CODE ###

def resolve():
    from collections import deque
    s = deque(input())
    q = int(input())
    qlist = [input().split() for i in range(q)]
    flip = False
    for j in range(q):
        if qlist[j][0] == "1":
            flip = not flip
        elif qlist[j][1] == "1":
            if flip:
                s.append(qlist[j][2])
            else:
                s.appendleft(qlist[j][2])
        elif qlist[j][1] == "2":
            if flip:
                s.appendleft(qlist[j][2])
            else:
                s.append(qlist[j][2])
    if not flip:
        print("".join(s))
    else:
        s.reverse()
        print("".join(s))
resolve()
### BUGGY CODE ###

from itertools import accumulate
from math import ceil
N = int(input())
A = list(map(int, input().split()))


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)

    def reset(self):
        self.bit = [0] * (self.size + 1)


# BIT準備
BIT = BinaryIndexedTree(N)
# 答えをにぶたん
lo, hi = -1, max(A) + 1  # sample2などに対応するためにhiを設定
while hi - lo > 1:
    m = (hi + lo) // 2

    # m以上かどうかで分類
    binary = [(1 if a >= m else -1) for a in A]
    binary = list(accumulate(binary))

    # BITの初期化
    BIT.reset()

    # 和が0以上となる連続部分列を数える
    tmp = 0

    # 転倒数っぽくやる
    binary_sorted = {b: i for i, b in enumerate(sorted(binary), start=1)}
    ans = 0
    for j, b in enumerate(binary):
        tmp += BIT.sum(binary_sorted[b]) + (binary_sorted[b] >= 0)
        BIT.add(binary_sorted[b], 1)

    # 連続する部分列の個数の半分以上和が0以上となる区間が存在するかで場合分け
    if tmp >= ceil(((N * (N + 1)) / 2) / 2):
        lo = m
    else:
        hi = m

print(lo)


### FIXED CODE ###

from itertools import accumulate
from math import ceil

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

if N == 1:
    print(A[0])
    exit()


class BinaryIndexedTree:
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= (i & -i)
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += (i & -i)

    def reset(self):
        self.bit = [0] * (self.size + 1)


BIT = BinaryIndexedTree(N)  # Binaryの先頭の分
lo, hi = -1, 10 ** 9 + 1
while hi - lo > 1:
    # Xは中央値候補
    X = (hi + lo) // 2

    # X以上なら1、X未満なら-1に変換
    Binary = [(1 if a >= X else -1) for a in A]

    # 累積和をとる
    Binary = list(accumulate(Binary))

    # BITを初期化
    BIT.reset()

    # 転倒数っぽいものを数える
    inversion = 0
    Binary_sorted = {b: i for i, b in enumerate(sorted(Binary), start=1)}
    for j, b in enumerate(Binary):
        inversion += BIT.sum(Binary_sorted[b]) + (b >= 0)
        BIT.add(Binary_sorted[b], 1)

    if inversion >= ceil((N * (N + 1) / 2) / 2):
        lo = X
    else:
        hi = X

print(lo)
### BUGGY CODE ###

N, M, Q = map(int, input().split())
ans = [0] * Q
Mi = [list(map(int, input().split())) for _ in range(M)]
Qi = [list(map(int, input().split())) for _ in range(Q)]
Mi.sort()
# Qi.sort()

for mi in Mi:
    for i in range(Q):
        if mi[0] >= Qi[i][0] and mi[1] <= Qi[i][1]:
            ans[i] += 1
for a in ans:
    print(a)

### FIXED CODE ###

N, M, Q = map(int, input().split())
LR = [[0] * (N+1) for _ in range(N+1)]
for m in range(M):
    l, r = map(int, input().split())
    LR[l][r] += 1

# 二次元累積和をとる
LR_sum = [[0] * (N+1) for _ in range(N+1)]
LR_sum[1][1] = LR[1][1]
## 初期化
for i in range(1, N+1):
    LR_sum[1][i] = LR_sum[1][i-1] + LR[1][i]
    LR_sum[i][1] = LR_sum[i-1][1] + LR[i][1]
## 累積和をとる
for i in range(2, N+1):
    for j in range(2, N+1):
        LR_sum[i][j] = LR_sum[i-1][j] + LR_sum[i][j-1] - LR_sum[i-1][j-1] + LR[i][j]

for q in range(Q):
    l, r = map(int, input().split())
    print(LR_sum[r][r] - LR_sum[r][l-1] - LR_sum[l-1][r] + LR_sum[l-1][l-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]

DP = [[[0] * 2 for _ in range(T)] for _ in range(N)]

a, b = AB[0]
if a < T:
  DP[0][a][0] = b
DP[0][0][1] = b

for i in range(1, N):
  a, b = AB[i]
  if a < T:
    DP[i][a][0] = b
  DP[i][0][1] = b
  for j in range(T):
    DP[i][j][0] = max(DP[i][j][0], DP[i - 1][j][0])
    DP[i][j][1] = max(DP[i][j][1], DP[i - 1][j][1])
    if j + a < T: 
      DP[i][j + a][0] = max(DP[i][j + a][0], DP[i - 1][j][0] + b)
      DP[i][j + a][1] = max(DP[i][j + a][1], DP[i - 1][j][1] + b)
    DP[i][j][1] = max(DP[i][j][1], DP[i - 1][j][1])
    DP[i][j][1] = max(DP[i][j][1], DP[i - 1][j][0] + b)

ans = 0
for i in range(T):
  ans = max(ans, DP[-1][i][0])
  ans = max(ans, DP[-1][i][1])

print(ans)

### FIXED CODE ###

N, T = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]


AB.sort(reverse = True)
DP = [[0] * T for _ in range(N)]
DP[0][0] = AB[0][1]
for i in range(1, N):
  a, b = AB[i]
  DP[i][0] = max(DP[i - 1][0], b)
  for j in range(T):
    DP[i][j] = max(DP[i][j], DP[i - 1][j])
    if j + a < T:
      DP[i][j + a] = DP[i - 1][j] + b

print(max(DP[-1]))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Sep  1 20:25:02 2019

@author: Yamazaki Kenichi
"""

N = int(input())
A = [list(map(int,input().split())) for i in range(N)]

T = [0 for i in range(N)]
today = [True for i in range(N)]

ans = 0
counta = 0
check, check2 = 0, 0
while counta < N:
    today = [True for i in range(N)]
    for i in range(N):
        if today[i]:
            vs = A[i][T[i]] - 1
            if A[vs][T[vs]] == i + 1 and today[vs]:
                T[i] += 1
                T[vs] += 1
                check2 += 1
                if T[i] == N - 1:
                    T[i] = 0
                    counta += 1
                if T[vs] == N - 1:
                    T[vs] = 0 
                    counta += 1
                today[i], today[vs] = False, False
#        print(i,vs,today,T)
    if check == check2:
        ans = -1
        break
    else:
        check = check2
    ans += 1
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Sep  1 21:55:48 2019

@author: Yamazaki Kenichi
"""


N = int(input())
A = [list(map(int,input().split())) for i in range(N)]

T = [0 for i in range(N)]
today = [True for i in range(N)]
yesterday = [i for i in range(N)]

ans = 0
counta = 0
while counta < N:
    today = set([])
    today_p = []
    for i in yesterday:
        if not i in today:
            vs = A[i][T[i]] - 1
            if A[vs][T[vs]] == i + 1 and not vs in today:
                T[i] += 1
                T[vs] += 1
                if T[i] == N - 1:
                    T[i] = 0
                    counta += 1
                if T[vs] == N - 1:
                    T[vs] = 0 
                    counta += 1
                today.add(i)
                today.add(vs)
                today_p.extend([i,vs])
    yesterday = today_p
#        print(i,vs,today,T)
    if len(today_p) == 0:
        ans = -1
        break
    ans += 1
print(ans)
### BUGGY CODE ###

import sys
INF = int(1e10)
n, m = [int(i) for i in sys.stdin.readline().split()]
# n : box, m : key
key_info = dict()
for i in range(m):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    c_ls = [int(i)-1 for i in sys.stdin.readline().split()]
    c_ls = "".join(["1" if c in c_ls else "0" for c in range(n-1,-1,-1)])
    key_info[i] = [a, int(c_ls, 2)]

memo_ls = [[INF for i in range(2**n)] for j in range(m)]
# memo_ls[i][j] : i番目までの鍵で状態を j にする為に必要な最小費用
for i in range(m):
    memo_ls[i][0] = 0
    for j in range(2**n):
        memo_ls[i][j] = min(memo_ls[i][j], memo_ls[max(0, i-1)][j])
        memo_ls[i][j | key_info[i][1]] = min(memo_ls[i][j | key_info[i][1]], memo_ls[max(i-1, 0)][j | key_info[i][1]], memo_ls[max(0, i-1)][j] + key_info[i][0])
if memo_ls[-1][-1] == INF:
    print(-1)
else:
    print(memo_ls[-1][-1])

### FIXED CODE ###

import sys
INF = int(1e10)
n, m = [int(i) for i in sys.stdin.readline().split()]
# n : box, m : key
key_info = dict()
for i in range(m):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    c_ls = [int(i)-1 for i in sys.stdin.readline().split()]
    c_ls = "".join(["1" if c in c_ls else "0" for c in range(n-1,-1,-1)])
    key_info[i] = [a, int(c_ls, 2)]

memo_ls = [[INF for i in range(2**n)] for j in range(m)]
# memo_ls[i][j] : i番目までの鍵で状態を j にする為に必要な最小費用
for i in range(m):
    memo_ls[i][0] = 0
    for j in range(2**n):
        memo_ls[i][j] = min(memo_ls[i][j], memo_ls[max(0, i-1)][j])
        memo_ls[i][j | key_info[i][1]] = min(memo_ls[i][j | key_info[i][1]], memo_ls[max(i-1, 0)][j | key_info[i][1]], memo_ls[max(0, i-1)][j] + key_info[i][0])
if memo_ls[-1][-1] == INF:
    print(-1)
else:
    print(memo_ls[-1][-1])
### BUGGY CODE ###

from itertools import permutations
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

c = []
for i in range(n):
    c.append((a[i], b[i]))


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


def bubcnt(v):
    bit = Bit(n)
    kaisu = 0
    for i in range(0, n):
        kaisu += i - bit.sum(v[i])
        bit.add(v[i], 1)
    return kaisu


l = [i+1 for i in range(n)]
ans = 10**9

xxx = permutations(l,n)

for v in xxx:
    tmp = 0
    cnt = 0
    for i in range(n):
        if tmp <= c[v[i]-1][(i-v[i]+1) % 2]:
            tmp = c[v[i]-1][(i-v[i]+1) % 2]
            cnt += 1
        else:
            break
    if cnt == n:
        ans = min(ans, bubcnt(v))

print(ans if ans != 10**9 else -1)


### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

dp = [[10**9 for _ in range(51)] for __ in range(1 << n)]
dp[0][0] = 0


for i in range(1 << n):
    target = bin(i).count("1")-1
    cnt = bin(i).count("1")
    for j in range(n):
        if i >> j & 1:
            cnt -= 1
            if abs(j - target) % 2 == 0:
                nxt = a[j]
            else:
                nxt = b[j]
            for k in range(nxt+1):
                if dp[i ^ (1 << j)][k] != 10**9:
                    dp[i][nxt] = min(dp[i][nxt], dp[i ^ (1 << j)][k] + abs(j+cnt-target))

ans = min(dp[2**n-1])

print(ans if ans < 10**9 else -1)
### BUGGY CODE ###

S = input()
dp = [[0]*13 for _ in range(len(S))]
mod = 10**9+7
for i in range(13):
    if S[0] == "?":
        dp[0][i] = 1 if i <= 9 else 0
    else:
        dp[0][i] = 1 if int(S[0]) == i else 0
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(k*10+j) % 13] = (dp[i][(k*10+j) % 13]+dp[i-1][k])%mod
    else:
        j = int(S[i])
        for k in range(13):
            dp[i][(k*10+j)%13] = (dp[i][(k*10+j)%13]+dp[i-1][k])%mod
print(dp[len(S)-1][5])

### FIXED CODE ###

S = input()
dp = [[0]*13 for _ in range(len(S))]
mod = 10**9+7
for i in range(13):
    if S[0] == "?":
        dp[0][i] = 1 if i <= 9 else 0
    else:
        dp[0][i] = 1 if int(S[0]) == i else 0
for i in range(1,len(S)):
    if S[i] == "?":
        for j in range(10):
            for k in range(13):
                dp[i][(k*10+j) % 13] = (dp[i][(k*10+j) % 13]+dp[i-1][k])%mod
    else:
        j = int(S[i])
        for k in range(13):
            dp[i][(k*10+j)%13] = (dp[i][(k*10+j)%13]+dp[i-1][k])%mod
print(dp[len(S)-1][5])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**5)
def bfs(ind):
    kouho=friends[ind]
    for i in kouho:
        if sans[i]!=-1:
            continue
        sans[i]=sans[ind]
        l[sans[ind]].append(i)
        bfs(i)
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list(map(lambda x:len(x),friends))
bl=[list(map(int,input().split())) for _ in range(k)]
l=[[i] for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
bfs(0)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    bfs(i)
ans=[0 for _ in range(n)]
for i in range(n):
    l[i]=set(l[i])


for i in range(n):
    tmp=l[sans[i]]-block[i]
    ans[i]=len(tmp)-len(friends[i])-1


ans=" ".join(map(str,ans))
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
total=0
def bfs(ind,num):
    kouho=friends[ind]
    
    for i in kouho:
        if sans[i]!=-1:
            continue
        num+=1
        sans[i]=sans[ind]
        l[sans[ind]].add(i)
        num+=bfs(i,0)
    return num
n,m,k=list(map(int,input().split()))
f=[list(map(int,input().split())) for _ in range(m)]
friends=[set() for _ in range(n)]
friends_num=list(map(lambda x:len(x),friends))
bl=[list(map(int,input().split())) for _ in range(k)]
l=[{i} for i in range(n)]

for each in f:
    a,b=each
    friends[a-1].add(b-1)
    friends[b-1].add(a-1)

block=[set() for _ in range(n)]
for each in bl:
    a,b=each
    block[a-1].add(b-1)
    block[b-1].add(a-1)

sans=[-1 for _ in range(n)]
sans[0]=0
total=bfs(0,total)
for i in range(n):
    if sans[i]!=-1:
        continue
    sans[i]=i
    total=bfs(i,total)
ans=[0 for _ in range(n)]


for i in range(n):
    l[i]=set(l[i])


for i in range(n):
    tmp=l[sans[i]]
    ans[i]+=len(tmp)-len(friends[i])-1
    for j in block[i]:
        if sans[i]==sans[j]:
            ans[j]-=1

ans=" ".join(map(str,ans))
#print("total:",total)
print(ans)
### BUGGY CODE ###

import functools
import operator
 
n = int(input())
ms = list(map(int, input().split()))
 
if 0 in ms:
  r = 0
else:
  r = functools.reduce(operator.mul, ms)
if r > 10 ** 18:
  r = -1
print(r)

### FIXED CODE ###

n = int(input())
ms = list(map(int, input().split()))
iter_ms = iter(ms) 
r = 1
if 0 in ms:
  r = 0
else:
    for i in range(n):
        x = next(iter_ms)
        r *= x
        if r > 10 ** 18:
            r = -1
            break
        
print(r)
### BUGGY CODE ###

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    for i, h in enumerate(H):
        try:
            if h - min(H[i+1:]) < 2:
                pass
            else:
                print('No')
                break
        except ValueError:
            pass
    else:
        print('Yes')

### FIXED CODE ###

if __name__ == '__main__':
    N = int(input())
    H = list(map(int, input().split()))
    #print(N, H)
    x1 = H.pop()
    for i in range(N-1):
        x2 = H.pop()
        if x1 - x2 <= -2:
            print('No')
            break
        elif x1 > x2:
            x1 = x2
    else:
        print('Yes')
### BUGGY CODE ###

import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

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

for i in range(len(P)):
    P[i] = ( P[i] + 1 ) / 2

max = 0
for i in range(len(P)-K+1):
    add = sum(P[i:i+K])
    if add > max:
        max = add


print(max)


### FIXED CODE ###

import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re

def main_sum():
    N,K=map(int,input().split())
    P=list(map(int,input().split()))

    for i in range(len(P)):
        P[i] = ( P[i] + 1 ) / 2

    max = sum(P[:K])
    add = max
    for i in range(len(P)-K):
        add = add + P[i+K] - P[i]
        if add > max:
            max = add
    print(max)


main_sum()
### BUGGY CODE ###

if __name__=="__main__":
    n = int(input())
    args = input().split()
    p = []
    for i in range(len(args)):
        p.append(int(args[i]))

    cnt = 1
    p_pre = [p[0]]
    for i in range(1,len(args)):
        p_pre.append(p[i])
        if p[i]==min(p_pre):
            cnt += 1

    print(cnt)

### FIXED CODE ###

if __name__=="__main__":
    n = int(input())
    args = input().split()
    p = []
    for i in range(len(args)):
        p.append(int(args[i]))

    cnt = 1
    p_pre = [p[0]]
    min_p_pre = p[0]
    for i in range(1,len(args)):
        p_pre.append(p[i])
        min_p_pre = min(min_p_pre, p[i])
        if p[i] == min_p_pre:
            cnt += 1

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

n, m = map(int, input().split())
a_l = list(map(int, input().split()))

sum = 0
for i in range(n):
    sum += a_l[i]

for i in range(m):
    a_l.sort(reverse=True)
    sum -= (a_l[0]+1)//2
    a_l[0] //= 2

print(sum)

### FIXED CODE ###

n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0
while True:
    max_price = a_l[0]//2
    for j in range(n):
        if a_l[j] >= max_price:
            a_l[j] //= 2
            m_count += 1
            if m_count == m:
                break
        else:
            break
        if m_count == m:
            break
    a_l.sort(reverse=True)
    if m_count == m:
        break

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
for i in range(1,N+1) :
    ans = A.count(i)
    print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
C = [0] * N
for i in range(len(A)) :
    x = A[i]
    C[x-1] += 1
for i in range(N) :
    print(C[i])