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

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort(reverse=True)

ans = 0
for ei, i in enumerate(ll):
    for ej, j in enumerate(ll[ei + 1:]):
        ans += len([w for w in ll[ei + ej + 2:] if w > i - j])

print(ans)


### FIXED CODE ###

import bisect

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(ll, ll[i] + ll[j]) - (j + 1)

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

from scipy.sparse import*
from itertools import permutations as pm

n,m,h = map(int,input().split())
r = [int(i) for i in input().split()]

A = lil_matrix((n+1,n+1))
for i in range(m):
  u,v,l = map(int,input().split())
  A[u,v] = l

A=csgraph.shortest_path(A,method='D',directed=False)
s=1e9
for a in pm(r):
  s=min(s,sum([A[i][j] for i,j in zip(a[:-1],a[1:])]))

print(int(s))

### FIXED CODE ###

from scipy.sparse import*
from itertools import permutations as pm

n,m,h = map(int,input().split())
r = [int(i) for i in input().split()]

u,v,l = zip(*[map(int,input().split()) for i in range(m)])

A=csgraph.dijkstra(csr_matrix((l,(u,v)),(n+1,n+1)),0)

s=min(sum(A[i][j] for i,j in zip(a[:-1],a[1:])) for a in pm(r))
print(int(s))
### BUGGY CODE ###

N = int(input())
AB = []
for _ in range(N-1):
    AB.append([int(i) for i in input().split()])
from collections import defaultdict as ddict
import numpy as np
R_children = ddict(set)
R_parents = ddict(set)
for ab in AB:
    R_children[ab[0]].add(ab[1])
    R_parents[ab[1]].add(ab[0])
ans = [0] * (N-1)
for i in range(N-1):
    used = set()
    for parent in R_parents[AB[i][0]]:
        color = ans[np.where(np.array(AB)[:,1]==AB[i][0])[0][0]]
        if color != 0:
            used.add(color) 
    for child in R_children[AB[i][1]]:
        color = ans[np.where(np.array(AB)[:,1]==child)[0][0]]
        if color != 0:
            used.add(color) 
    for child in R_children[AB[i][0]]:
        color = ans[np.where(np.array(AB)[:,1]==child)[0][0]]
        if color != 0:
            used.add(color) 
    if used == set():
        ans[i] = 1
    else:
        ans[i] = min(set(range(1,max(used)+2)) - used)
print(max(ans))
for a in ans:
    print(a)

### FIXED CODE ###

N = int(input())
AB = [[]]*(N-1)
for i in range(N-1):
    AB[i] = list(map(int,input().split()))
from collections import defaultdict as ddict
from collections import deque
tree = ddict(list)
B = [0]*(N-1)
for i,ab in enumerate(AB):
    tree[ab[0]].append(ab[1])
    B[i] = ab[1]
# 各エッジの色を格納する変数の初期化
# C[0]は使わない
C = [0]*N
# 幅優先探索用のcue
Q = deque([1])
while Q:
    q = Q.popleft()
    c = 0
    for w in tree[q]:
        # 色をインクリメントした際に親の色とかぶったら更に1を加算する
        # 他は単純なインクリメント
        c += 1 + int(C[q-1] == c+1)
        # エッジの色を格納
        C[w-1] = c
        # 子供をcueに追加
        Q.append(w)
print(max(C))
for b in B:
    print(C[b-1])
### BUGGY CODE ###

n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])

### FIXED CODE ###

n,w=map(int,input().split())
val=[]
we=[]
for i in range(n):
  a,b=map(int,input().split())
  we.append(a)
  val.append(b)
dp=[[0 for _ in range(w+1)]for _ in range(n+1)]
for i in range(n+1):
  for j in range(w+1):
    if i==0 or j==0:
      continue
    if we[i-1]>j:
      dp[i][j]=dp[i-1][j]
    else:
      dp[i][j]=max(dp[i-1][j],val[i-1]+dp[i-1][j-we[i-1]])
print(dp[n][w])
### BUGGY CODE ###

n,m = map(int,input().split())
A = sorted(list(map(int,input().split())))
C = []
for i in range(m):
  b,c = map(int,input().split())
  for i in range(b):
    C.append(c)
    
Cs = sorted(C)
CS = Cs[::-1]
ans = 0

if len(CS)<n:
  CS = CS +[0]*(n-m+1)
for i in range(n):
  ans += max(A[i],CS[i])

print(ans)
  


### FIXED CODE ###

n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=sorted([list(map(int,input().split())) for i in range(m)],reverse=True,key=lambda x: x[1])
 
c_l=[]
for b,c in l:
  c_l+=[c]*b
  if len(c_l)>=n:
    break
 
for i in range(min(n,len(c_l))):
  a[i]=max(a[i],c_l[i])
 
print(sum(a))
### BUGGY CODE ###

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

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = [sum(L[2*i:2*(i+K)+1]) for i in range(max(1, len(L) // 2 + 1 - K))]

print(max(R))


### FIXED CODE ###

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

L = S.replace('01', '0,1')
L = L.replace('10', '1,0')
L = L.split(',')
L = [len(l) for l in L]

if S[0] == '0':
    L = [0] + L

R = []
for i in range(max(1, len(L) // 2 + 1 - K)):
    if i == 0:
        R.append(sum(L[2*i:2*(i+K)+1]))
    else:
        R.append(R[-1] - sum(L[2*(i-1):2*(i-1)+2]) + sum(L[2*(i+K)-1:2*(i+K)+1]))

print(max(R))
### BUGGY CODE ###

from bisect import bisect_right

n = int(input())
a = [int(input()) for _ in range(n)]

c = []
c.append(a[0])
for ai in a[1:]:
    ci = bisect_right(c, ai)
    if ci == 0 or c[ci - 1] == ai:
        c.append(ai)
        c.sort()
    else:
        c[ci - 1] = ai
        c.sort()

print(len(c))


### FIXED CODE ###

from bisect import bisect_left

n = int(input())
a = [int(input()) for _ in range(n)]

c = [0] * n
end = n

for ai in a:
    ci = bisect_left(c, ai, end, n)
    c[ci - 1] = ai
    if ci <= end:
        end -= 1
print(n - end)
### BUGGY CODE ###


N, P = map(int, input().split())
S = list(map(int, input()))
ans = 0
if P == 2:
    for i in range(N):
        if S[i]%2 == 0:
            ans +=i+1
    print(ans)

elif P ==5:
    for i in range(N):
        if S[i]%5 == 0:
            ans +=i+1
    print(ans)
else:
    data =[0]*P
    tens = 1
    k = 0
    for i in range(N-1,-1,-1):
        k += S[i] *tens %P
        k = k%P
        data[k] += 1
        tens *=10

    for i in data:
        ans += i*(i-1)/2
    ans +=data[0]
    print(int(ans))

### FIXED CODE ###

N, P = map(int, input().split())
S = list(map(int, input()))
ans = 0
if P == 2:
    for i in range(N):
        if S[i]%2 == 0:
            ans +=i+1
    print(ans)

elif P ==5:
    for i in range(N):
        if S[i]%5 == 0:
            ans +=i+1
    print(ans)
else:
    data =[0]*P
    tens = 1
    k = 0
    for i in range(N-1,-1,-1):
        k += S[i] *tens %P
        k = k%P
        data[k] += 1
        tens *=10
        tens %=P

    for i in data:
        ans += i*(i-1)/2
    ans +=data[0]
    print(int(ans))
### BUGGY CODE ###

n=int(input())
kind=[0]*n
aa=[]
bb=[]
for _ in range(n-1):
	a,b=map(int,input().split())
	aa.append(a)
	bb.append(b)
	kind[a-1]+=1
	kind[b-1]+=1
print(max(kind))
p=[[set()]for _ in range(n)]
for i in range(n-1):
	flag=False
	for j in range(1,max(kind)+1):
		if flag==True:
			break
		if j not in p[aa[i]-1][0] and j not in p[bb[i]-1][0]:
			p[aa[i]-1][0].add(j)
			p[bb[i]-1][0].add(j)
			flag=True
			print(j)



### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**5*2)
n=int(input())
child=[[]for _ in range(n)]
color=[-1]*(n-1)
#adj は(子供,辺番号)
for i in range(n-1):
	a,b=map(int,input().split())
	child[a-1].append((b-1,i))
#x=現在見ている頂点
#r=その頂点の親とその頂点の間のnodeの色
def f(now,parent_node):
	color_num=1
	for i,j in child[now]:
		if color_num==parent_node:
			color_num+=1
		color[j]=color_num 
		f(i,color_num)
		color_num+=1
f(0,0)
print(max(color))
for x in color:
	print(x)
### BUGGY CODE ###

n=int(input())
s=input()
if n<=3:
    print(0)
    exit()
r=[]
g=[]
b=[]
for i,c in enumerate(s):
    if c=='R':
        r.append(i)
    elif c=='G':
        b.append(i)
    else:
        g.append(i)
ans=0
for i in r:
    for j in g:
        t1=-1
        if abs(i-j)%2==0:
            t1=min(i,j)+abs(i-j)//2
        t2=max(i,j)+abs(i-j)
        t3=min(i,j)-abs(i-j)
        for k in b:
            if k!=t1 and k!=t2 and k!=t3:
                ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
if n<=3:
    print(0)
    exit()
r=set()
g=set()
b=set()
for i,c in enumerate(s):
    if c=='R':
        r.add(i)
    elif c=='G':
        b.add(i)
    else:
        g.add(i)
ans=0
lb=len(b)
for i in r:
    for j in g:
        t1=-1
        if abs(i-j)%2==0:
            t1=min(i,j)+abs(i-j)//2
        t2=max(i,j)+abs(i-j)
        t3=min(i,j)-abs(i-j)
        tc=0
        if t1 in b:
            tc+=1
        if t2 in b:
            tc+=1
        if t3 in b:
            tc+=1
        ans+=max(0,lb-tc)
print(ans)
### BUGGY CODE ###

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

E = [(i + 1)/2 for i in p]
ans = 0
for i in range(N - K + 1):
    s = sum(E[i:i+K])
    ans = max([ans, s])
print(ans)

### FIXED CODE ###

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

E = [(i + 1)/2 for i in p]
S = sum(E[0:K])
ans = S
for i in range(1, N - K + 1):
    S += E[i+K-1] - E[i-1]
    if ans < S:
        ans = S
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    h, w, m = MI()
    targets = [[] for i in range(h)]
    tate = [[] for i in range(w)]
    original = []
    lengths = [0] * h
    for i in range(m):
        target = LI()
        original.append(target)
        targets[target[0] - 1].append(target[1] - 1)
        tate[target[1] - 1].append(target[0] - 1)
        lengths[target[0] - 1] += 1

    max_length = max(lengths)
    max_h_indexes = [i for i, x in enumerate(lengths) if x == max_length]
    semi_max_h_indexes = [i for i, x in enumerate(
        lengths) if x == max_length - 1]

    for j in range(len(tate)):
        tate[j] = set(tate[j])
    ans = 0

    for index in max_h_indexes:
        for j in range(w):
            if index in tate[j]:
                ans = max(ans, len(tate[j]) + lengths[index] - 1)
            else:
                ans = max(ans, len(tate[j]) + lengths[index])
    for index in semi_max_h_indexes:
        for j in range(w):
            if index in tate[j]:
                ans = max(ans, len(tate[j]) + lengths[index] - 1)
            else:
                ans = max(ans, len(tate[j]) + lengths[index])

    print(ans)


main()


### FIXED CODE ###

#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    h, w, m = MI()
    targets = [[] for i in range(h)]
    tate = [[] for i in range(w)]
    tate_length = [0] * w
    original = []
    lengths = [0] * h
    for i in range(m):
        target = LI()
        original.append(target)
        targets[target[0] - 1].append(target[1] - 1)
        tate[target[1] - 1].append(target[0] - 1)
        lengths[target[0] - 1] += 1
        tate_length[target[1] - 1] += 1

    max_length = max(lengths)
    max_length_tate = max(tate_length)

    max_w_indexes = [i for i, x in enumerate(
        tate_length) if x == max_length_tate]

    max_h_indexes = [i for i, x in enumerate(
        lengths) if x == max_length]

    max_h_indexes = set(max_h_indexes)
    max_w_indexes = set(max_w_indexes)

    ttl = len(max_h_indexes) * len(max_w_indexes)

    for target in original:
        if target[0] - 1 in max_h_indexes and target[1] - 1 in max_w_indexes:
            ttl -= 1

    if ttl > 0:
        print(max_length + max_length_tate)
    else:
        print(max_length+max_length_tate - 1)


main()
### BUGGY CODE ###

import heapq
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
done = [[[True for _ in range(Z+1)] for _ in range(Y+1)] for _ in range(Z+1)]

h = []
heapq.heappush(h, (-(A[0]+B[0]+C[0]), 0, 0, 0))  # リストaのheap化
done[0][0][0] = False

for _ in range(K):
    p, i, j, k = heapq.heappop(h)
    # print(h)
    print(-p)

    if done[i+1][j][k] and i+1 < X:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i+1]+B[j]+C[k]), i+1, j, k))
        # print(h)
        done[i+1][j][k] = False

    if done[i][j+1][k] and j+1 < Y:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i]+B[j+1]+C[k]), i, j+1, k))
        # print(h)
        done[i][j+1][k] = False

    if done[i][j][k+1] and k+1 < Z:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i]+B[j]+C[k+1]), i, j, k+1))
        # print(h)
        done[i][j][k+1] = False


### FIXED CODE ###

import heapq
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
# done = [[[True for _ in range(Z+1)] for _ in range(Y+1)] for _ in range(Z+1)]
done = set()

h = []
heapq.heappush(h, (-(A[0]+B[0]+C[0]), 0, 0, 0))  # リストaのheap化
done.add((0, 0, 0))

for _ in range(K):
    p, i, j, k = heapq.heappop(h)
    # print(h)
    print(-p)

    if (i+1, j, k) not in done and i+1 < X:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i+1]+B[j]+C[k]), i+1, j, k))
        # print(h)
        done.add((i+1, j, k))

    if (i, j+1, k) not in done and j+1 < Y:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i]+B[j+1]+C[k]), i, j+1, k))
        # print(h)
        done.add((i, j+1, k))

    if (i, j, k+1) not in done and k+1 < Z:
        # heap化されたリストaに要素xを追加
        heapq.heappush(h, (-(A[i]+B[j]+C[k+1]), i, j, k+1))
        # print(h)
        done.add((i, j, k+1))
### BUGGY CODE ###

N = int(input())
S = []
for i in range(N):
  Ss = input()
  S.append(Ss)
E = [set() for i in range(N)]
D = [[100000]*N for i in range(N)]
for i in range(N):
  D[i][i] = 0
  for j in range(i+1, N):
    if S[i][j] == "1":
      #print(i, j)
      E[i].add(j)
      E[j].add(i)
      D[i][j] = 1
      D[j][i] = 1
ok = True
V = [-1]*N
c = 0
V[0] = 0
q = [0]
while q:
  c = q.pop()
  ns = E[c]
  for n in ns:
    if V[n] == V[c]:
      ok = False
    if not V[n] < 0:
      continue
    V[n] = 1 if V[c] == 0 else 0
    q.append(n)
if not ok:
  print(-1)
  exit()
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j] = min(D[i][j], D[i][k]+D[k][j])
#print(D)
r = max([max(Ds) for Ds in D])+1
print(r)


### FIXED CODE ###

N = int(input())
S = []
for i in range(N):
  Ss = input()
  S.append(Ss)
E = [set() for i in range(N)]
D = [[100000]*N for i in range(N)]
for i in range(N):
  D[i][i] = 0
  for j in range(i+1, N):
    if S[i][j] == "1":
      #print(i, j)
      E[i].add(j)
      E[j].add(i)
      D[i][j] = 1
      D[j][i] = 1
ok = True
V = [-1]*N
c = 0
V[0] = 0
q = [0]
while q:
  c = q.pop()
  ns = E[c]
  for n in ns:
    if V[n] == V[c]:
      ok = False
    if not V[n] < 0:
      continue
    V[n] = 1 if V[c] == 0 else 0
    q.append(n)
if not ok:
  print(-1)
  exit()
for k in range(N):
  for i in range(N):
    for j in range(N):
      D[i][j] = min(D[i][j], D[i][k]+D[k][j])
#print(D)
r = max([max(Ds) for Ds in D])+1
print(r)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import io
import sys
import math

def solve(n, k, a_lst):
    # implement process
    a_set = set(a_lst)
    ak = len(a_set)
    diff = ak - k
    if diff < 1:
        return 0
    
    min_change = float("inf")
    cnt_lst = []
    for a in a_set:
        cnt_lst.append(a_lst.count(a))
    cnt_lst.sort()
    return sum(cnt_lst[0:diff])

def main():
    # input
    n, k = map(int,input().split())
    a_lst = list(map(int,input().split()))

    # process
    ans = str( solve(n, k, a_lst) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
10 3
5 1 3 2 4 1 1 2 3 4
"""
_EXPECTED = """\
0
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

### FIXED CODE ###

# -*- coding: utf-8 -*-

import io
import sys
import math

def solve(n, k, a_lst):
    # implement process
    a_set = set(a_lst)
    ak = len(a_set)
    diff = ak - k
    if diff < 1:
        return 0
    
    #ソート済み配列を検査することで、count処理を線形にする
    a_lst.sort()
    tmp = a_lst[0]
    cnt = 0
    cnt_lst = []
    for i in range(len(a_lst)):
        if tmp != a_lst[i]:
            tmp = a_lst[i]
            cnt_lst.append(cnt)
            cnt = 0
        cnt += 1
    cnt_lst.append(cnt)
    cnt_lst.sort()
    return sum(cnt_lst[0:diff])

def main():
    # input
    n, k = map(int,input().split())
    a_lst = list(map(int,input().split()))

    # process
    ans = str( solve(n, k, a_lst) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
5 2
1 1 2 2 5
"""
_EXPECTED = """\
0
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")
### BUGGY CODE ###

S = input()
Q = int(input())
judge = False
for _ in range(Q):
  l = list(input().split())
  if int(l[0])==1:
    if judge:
      judge = False
    else:
      judge = True
      
  elif int(l[0])==2:
    f,c = int(l[1]),l[2]
    if judge:
      if f==1:
        f=2
      elif f==2:
        f=1
    if f==1:
      S=c+S
    elif f==2:
      S=S+c
      
if judge:
  S=S[::-1]
print(S)

### FIXED CODE ###

def main():
  S = input()
  Q = int(input())
  import sys
  que = [list(sys.stdin.readline().split()) for _ in range(Q)]
  pre=''
  post=''
  judge = False
  for l in que:
    if int(l[0])==1:
      if judge:
        judge = False
      else:
        judge = True

    elif int(l[0])==2:
      f,c = int(l[1]),l[2]
      if judge:
        if f==1:
          f=2
        elif f==2:
          f=1
      if f==1:
        pre = ''.join([pre,c])
      elif f==2:
        post = ''.join([post,c])

  pre = pre[::-1]
  S = pre+S+post
  if judge:
    S=S[::-1]
  print(S)
  
main()
### BUGGY CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


s = input()
K = int(input())
n = len(s)
dp = [[[0]*(K+1) for _ in range(n+1)] for _ in range(n+1)]
for i in range(n):
    for j in range(K+1):
        dp[i][i+1][j] = 1
for l in range(2, n+1):
    for i in range(n-l+1):
        for k in range(K+1):
#             print(l, i, i+l, j)
            if s[i]==s[i+l-1]:
                dp[i][i+l][k] = dp[i+1][i+l-1][k] + 2
            else:
                dp[i][i+l][k] = max(dp[i+1][i+l][k], dp[i][i+l-1][k])
                if k>=1:
                    dp[i][i+l][k] = max(dp[i][i+l][k], dp[i+1][i+l-1][k-1]+2)
ans = max(dp[0][n][j] for j in range(K+1))
print(ans)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



s = input()
K = int(input())
n = len(s)
dp = [[[0]*(K+1) for _ in range(n+2-i)] for i in range(n+1)]
for i in range(n):
    for j in range(K+1):
        dp[i][1][j] = 1
for l in range(2, n+1):
    for i in range(n-l+1):
        for k in range(K+1):
#             print(l, i, i+l, j)
            if s[i]==s[i+l-1]:
                dp[i][l][k] = dp[i+1][l-2][k] + 2
            else:
                dp[i][l][k] = max(dp[i+1][l-1][k], dp[i][l-1][k])
                if k>=1:
                    dp[i][l][k] = max(dp[i][l][k], dp[i+1][l-2][k-1]+2)
ans = max(dp[0][i][j] for i in range(n+2) for j in range(K+1))
print(ans)
### BUGGY CODE ###

n,k = map(lambda x:int(x),input().split())
p_n = list(map(lambda x:int(x),input().split()))

max = 0
for i in range(len(p_n)-(k-1)):
    tmp = p_n[i]
    for j in range(k-1):
        tmp = tmp + p_n[i+j+1]
    if tmp > max:
        max = tmp


print((max+k)*0.5)


### FIXED CODE ###

#x,y = map(lambda x: int(x), input().split())
#list = list(map(lambda x: int(x), input().split()))


n,k = map(lambda x: int(x), input().split())
p_lst = list(map(lambda x: int(x), input().split()))


def cum_sum(list):
    result = []
    for i in range(len(list)):
        if i == 0:
            result.append(list[i])
        else:
            result.append(result[i-1] + list[i])
    return result


def cum_sum_exp(list):
    result = []
    for i in range(len(list)):
        if i == 0:
            result.append((list[i]+1)/2)
        else:
            result.append(result[i-1] + (list[i]+1)/2)
    return result



cum_sum_main = cum_sum_exp(p_lst)


cmp = cum_sum_main[k-1]


for i in range(k-1,n):
    if i == k-1:
        cmp = cum_sum_main[i]
    else:
        tmp = cum_sum_main[i] - cum_sum_main[i-k]

        if cmp < tmp:
            cmp = tmp



print(cmp)
### BUGGY CODE ###

H,W=map(int,input().split())
A=[[int(i) for i in input().split()] for j in range(H)]
B=[[int(i) for i in input().split()] for j in range(H)]
dp=[[0 for j in range(W)] for i in range(H)]
dp[0][0]=1<<abs(A[0][0]-B[0][0])
M=80*80*2
for i in range(H):
    for j in range(W):
        dij=A[i][j]-B[i][j]
        if i>0:
            for x in range(M):
                if (1<<x)&dp[i-1][j]==0:
                    continue
                dp[i][j]|=1<<abs(x+dij)
                dp[i][j]|=1<<abs(x-dij)
        if j>0:
            for y in range(M):
                if (1<<y)&dp[i][j-1]==0:
                    continue
                dp[i][j]|=1<<abs(y+dij)
                dp[i][j]|=1<<abs(y-dij)
for i in range(M):
    if (1<<i)&dp[-1][-1]!=0:
        print(i)
        break

### FIXED CODE ###

H,W=map(int,input().split())
A=[[int(i) for i in input().split()] for j in range(H)]
B=[[int(i) for i in input().split()] for j in range(H)]
dp=[[0 for j in range(W)] for i in range(H)]
M=161*161
dp[0][0]|=1<<(A[0][0]-B[0][0]+M)
dp[0][0]|=1<<(-A[0][0]+B[0][0]+M)

for i in range(H):
    for j in range(W):
        dij=abs(A[i][j]-B[i][j])
        if i>0:
            dp[i][j]|=dp[i-1][j]<<dij
            dp[i][j]|=dp[i-1][j]>>dij
        if j>0:
            dp[i][j]|=dp[i][j-1]>>dij
            dp[i][j]|=dp[i][j-1]<<dij
ans=[]
for k in range(2*M+1):
    if (1<<k)&dp[-1][-1]!=0:
        ans.append(abs(k-M))
print(min(ans))
### BUGGY CODE ###

#!/usr/bin/env pypy


def main():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]
    diff_a = [a[i+1] - a[i] for i in range(m - 1)]
    if 1 in diff_a:
        print(0)
        return
    method = [0] * (n + 1)
    method[0] = 1
    if 1 not in a:
        method[1] = 1
    for i in range(2, n + 1):
        if i in a:
            continue
        else:
            method[i] = method[i-1] + method[i-2]
            method[i] %= 1000000007
    print(method[n])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = list(map(int, readlines()))
assert len(A) == M

MOD = 10 ** 9 + 7


def solve():
    broken = [False] * (N + 1)
    for a in A:
        broken[a] = True
    p1, p2 = 1, 0
    for i in range(1, N + 1):
        if broken[i]:
            p1, p2 = 0, p1
        elif i == 1:
            p1, p2 = p1, p1
        else:
            p1, p2 = (p1 + p2) % MOD, p1
    return p1


if __name__ == "__main__":
    print(solve())