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

N = int(input())
A = list(map(int, input().split()))
S = 0
for i in range(N-1):
  for j in range(i+1, N):
    S = S + A[i] * A[j]
S = S % (10**9+7)
print(S)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
S = 0
ans = 0
for k in range(N):
  S = S + A[k]

for i in range(N-1):
  S = S - A[i]
  ans = ans + S * A[i]

ans = ans % (10**9 + 7)
print(ans)
### BUGGY CODE ###

N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [0]*(N+1) #dp[i]...i番目にいる時の移動方法の数
dp[0] = 1

count = 0
for i in range(1,N):
    if i in a:
        count += 1
        if count == 2:
            print(0)
            exit()
    else:
        count = 0
    
if 1 in a:
    dp[2] = 1
    for i in range(1,N-1):
        dp[i+2] = dp[i+1] + dp[i]
        if i+2 in a:
            dp[i+2] = 0
else:
    dp[1] = 1
    for i in range(N-1):
        dp[i+2] = dp[i+1] + dp[i]
        if i+2 in a:
            dp[i+2] = 0
print(dp[N]%Mod)

### FIXED CODE ###

N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
Mod = 1000000007
dp = [1]*(N+1) #dp[i]...i番目にいる時の移動方法の数

count = 0
for i in a:
    if i+1 in a:
        print(0)
        exit()

for i in a:
    dp[i] = 0
if dp[1] == 0:
    for i in range(1,N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod
else:
    dp[1] = 1
    for i in range(N-1):
        if dp[i+2] != 0:
            dp[i+2] = dp[i+1] + dp[i]
            dp[i+2] %= Mod

print(dp[N])
### BUGGY CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
ans = 0
c = Counter(A)

for i in A:
    ans = 0
    for key in c:
        if key == i:
            tmp = c[key] - 1
            ans += tmp*(tmp-1) // 2
        else:
            ans += c[key]*(c[key]-1) // 2
    print(ans)

### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
ans = 0
c = Counter(A)

for v in c.values():
    ans += v*(v-1)//2

for i in A:
    print(ans - (c[i] - 1))
### BUGGY CODE ###

mod = 10 ** 9 + 7
N = int(input())
A = list(map(lambda x: int(x) % mod, input().split(" ")))

print(sum((A[i] * A[j]) % mod for i in range(0,N-1) for j in range(i+1,N)) % mod)

### FIXED CODE ###

mod = 1000000007
N = int(input())
A = list(map(lambda x: int(x) % mod, input().split(" ")))

"""
累積話を計算しておく: O(N)
"""
_sum = 0
for i in range(N):
    _sum += A[i]
    _sum %= mod

"""
1重ループ内で下記を行う: O(N)

- 端のブロックを累積和から崩す（減算）
- 端のブロックと累積和をかける
- modをとる
"""
ans = 0
for i in range(N):
    # 累積和の端のブロックを崩す
    _sum -= A[i]

    ans += A[i] * _sum
    ans %= mod

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

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

l = [nu for nu in range(1, n + 1)]

for i in range(m):
    L, R = map(int, input().split())
    card = [nu for nu in range(L, R + 1)]
    l = list(set(l) & set(card))

print(len(l))



### FIXED CODE ###

n, m = map(int, input().split())
l, r = map(int, input().split())
li = []


for _ in range(m - 1):
    l_, r_ = map(int, input().split())
    l = max(l, l_)
    r = min(r, r_)


print(max(r - l + 1, 0))
### BUGGY CODE ###

from collections import Counter
import sys

def input():
    return sys.stdin.readline().strip()

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

memo = {}
def make_divisors(n):
    if n in memo:
        return memo[n]
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    
    memo[n] = lower_divisors + upper_divisors[::-1]
    return memo[n]

n,*A = get_all_int()
C = dict(Counter(A))
keys = C.keys()
# log(C)

ans = 0

for i,a in enumerate(A):
    div = make_divisors(a)
    ok = True
    for d in div:
        if d == a:
            if C[d] > 1:
                # log(C[d])
                ok = False
                break
        elif d in keys:
            ok = False
            break
    if ok:
        ans += 1

print(ans)


### FIXED CODE ###

from collections import Counter
import sys

def input():
    return sys.stdin.readline().strip()

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            yield i
            if i != n // i:
                yield n//i
        i += 1

n,*A = get_all_int()
A.sort()



C = dict(Counter(A))
keys = C.keys()
# log(C)

checks = [False] * (1000009)

B = []
for i,a in enumerate(A):
    if C[a] == 1:
        B.append(a)
    elif not checks[a]:
        for j in range(a, 1000009, a):
            checks[j] = True

# log(B)

ans = 0

for i,a in enumerate(B):
    if not checks[a]:
        ans += 1
        for j in range(a, 1000009, a):
            checks[j] = True

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

from sys import stdin
from collections import defaultdict
from collections import deque

N,M = list(map(int,stdin.readline().split()))
Cs = [tuple(map(int,stdin.readline().split())) for _ in range(M)]
S,T = list(map(int,stdin.readline().split()))

INF = 10 ** 15
# visit = [False] * ( (N + 1) * 3 )
dist  = [-1] * ( (N) * 3 + 1 )
graph_connection = defaultdict(lambda :[])
graph_cost = defaultdict(lambda :defaultdict(lambda :INF))
#
# def dfs(v,dist_before):
#
#     dist[v] = dist_before + 1
#     next_vertexs = graph_connection[v]
#     for next_v  in next_vertexs :
#         if dist[next_v] == -1:
#             dfs(next_v,dist[v])
#     return 0
#

for cost in  Cs:
    a,b= cost
    for i in range(0,3):
        from_v = a + (i) * N
        to_v = b + (i + 1) % 3 * N
        graph_connection[from_v].append(to_v )

        # from_v = b + (i) * N
        # to_v = a + (i + 1) % 3 * N
        # graph_connection[from_v].append(to_v )

# dist[S] = 0


que = deque()
#(from_v,to_v)
que.append((S,S))

while que:
    from_v, to_v = que.popleft()
    dist[to_v] = dist[from_v] + 1
    for next_v in graph_connection[to_v]:
        if dist[next_v] == -1:
            que.append((to_v,next_v))
if dist[T] < 0:
    print(dist[T] )
else:
    print(dist[T]//3)


### FIXED CODE ###

from sys import stdin
from collections import defaultdict
from collections import deque

N,M = list(map(int,stdin.readline().split()))
Cs = [tuple(map(int,stdin.readline().split())) for _ in range(M)]
S,T = list(map(int,stdin.readline().split()))

INF = 10 ** 15
# visit = [False] * ( (N + 1) * 3 )
dist  = [-1] * ( (N) * 3 + 1 )
graph_connection = defaultdict(lambda :[])
graph_cost = defaultdict(lambda :defaultdict(lambda :INF))
#
# def dfs(v,dist_before):
#
#     dist[v] = dist_before + 1
#     next_vertexs = graph_connection[v]
#     for next_v  in next_vertexs :
#         if dist[next_v] == -1:
#             dfs(next_v,dist[v])
#     return 0
#

for cost in  Cs:
    a,b= cost
    for i in range(0,3):
        from_v = a + (i) * N
        to_v = b + (i + 1) % 3 * N
        graph_connection[from_v].append(to_v )

        # from_v = b + (i) * N
        # to_v = a + (i + 1) % 3 * N
        # graph_connection[from_v].append(to_v )

# dist[S] = 0


que = deque()
#(from_v,to_v)
dist[S] = 0
que.append(S)
while len(que) != 0:
    from_v = que.popleft()
    nexts = graph_connection[from_v]
    for next_v in nexts:
        if dist[next_v] == -1:
            dist[next_v] = dist[from_v] + 1
            que.append(next_v)

if dist[T] < 0:
    print(dist[T] )
else:
    print(dist[T]//3)
### BUGGY CODE ###

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

dp = [0] * (W + 1)

for i in range(N):
    w, v = map(int, input().split())
    for j in range(W, w-1, -1):
        dp[j] = max(dp[j], dp[j-w] + v)

print(dp[W])

### FIXED CODE ###

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

dp = [0] * (W + 1)

for i in range(N):
    w, v = map(int, input().split())
    for j in range(W, w-1, -1):
        dp[j] = max(dp[j], dp[j-w] + v)

print(dp[W])
### BUGGY CODE ###

import string

n = int(input())

li = []
ls = []
cnt = 0
res = [[list(i) for i in string.ascii_lowercase] for _ in range(n)]
# print(res)

for _ in range(n):
  s = str(input())
  sl = list(s)
#  print(s)
#  print(sl)
  li.append(sl)

for i in range(n):
  for j in range(26):
    res[i][j].append(0)

#print(res)

for i in range(n):
  for j in li[i]:
    for k in range(26):
      if res[i][k][0] == j:
        res[i][k][1] += 1
        #print(res[i])

for m in range(n):
  for l in range(n):
    if l <= m:
      continue
    else:
      if res[m] == res[l]:
        cnt += 1

print(cnt)

### FIXED CODE ###

n = int(input())

l = []
cnt = 0
t = 0

for i in range(n):
    s = str(input())
    sl = ''.join(sorted(s))
    l.append(sl)

l.sort()

tmp = l[0]

for i in range(1, n):
  if tmp == l[i]:
    cnt += 1
  else:
    tmp = l[i]
    t += int(cnt * (cnt + 1) / 2)
    cnt = 0
else:
    t += int(cnt * (cnt + 1) / 2)

print(t)
### BUGGY CODE ###


def BinarySearch(n, S, t):
    """ ????????????????????? """
    left = 0
    right = n - 1

    while left <= right:
        center = (left + right) // 2

        if t > S[center]:
            left = center + 1
        elif t < S[center]:
            right = center - 1
        else:
            return center

    return -1

n = int(input())
S = [int(s) for s in input().split()]

q = int(input())
T = [int(t) for t in input().split()]

cnt = 0

for t in T:
    if BinarySearch(n, S[:], t) != -1:
        cnt += 1

print(cnt)

### FIXED CODE ###

import sys

def BinarySearch(S, n, t):
    bottom = 0
    top = n - 1

    while bottom <= top:
        center = (bottom + top) // 2

        if S[center] == t:
            return center
        elif S[center] < t:
            bottom = center + 1
        else:
            top = center - 1

    return -1


n = int(sys.stdin.readline())
S = [int(s) for s in sys.stdin.readline().split()]

q = int(sys.stdin.readline())
T = {int(t) for t in sys.stdin.readline().split()}

ans = sum(BinarySearch(S, n, t) != -1 for t in T)

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

from math import gcd, sqrt, ceil
from functools import reduce
_, *aa = map(int, open(0).read().split())

def factorize(n):
    factors = set()
    if n % 2 == 0:
        factors.add(2)
        n //= 2
    while n % 2 == 0:
        n //= 2
    for i in range(3, ceil(sqrt(n + 1)) + 1):
        if n % i == 0:
            factors.add(i)
            n //= i
        while n % i == 0:
            n //= i
    if n > 2:
        factors.add(n)
    return factors

def main(aa):
    
    pair_co = True
    max_factors = set()
    for a in aa:
        factors = factorize(a)
        new_max_factors = max_factors | factors
        if len(new_max_factors) < len(max_factors) + len(factors):
            pair_co = False
            break
        max_factors = new_max_factors
#     if min_factors:
#         return 'not coprime'
#     elif pair_co
    if pair_co:
        return 'pairwise coprime'
    elif reduce(gcd, aa) == 1:
        return 'setwise coprime'
    else:
        return 'not coprime'
        

print(main(aa))

### FIXED CODE ###

from math import gcd, sqrt, ceil
from functools import reduce

def sieve(n):
    A = list(range(n+1))
    for i in range(2, n+1 ,2):
        A[i] = 2
    for j in range(3, ceil(sqrt(n+1))+1, 2)[::-1]:
        for i in range(j, n+1, j):
            A[i] = j
    return A

def factorize(n, A):
    factors = set()
    while n != 1:
        f = A[n]
        factors.add(f)
        n //= f
    return factors

_, *aa = map(int, open(0).read().split())

def main(aa):
    pair_co = True
    A = sieve(10**6)
    all_factors = [0] * (10**6+1)
    for a in aa:
        factors = factorize(a, A)
        for factor in factors:
            if all_factors[factor]:
                pair_co = False
                break
            else:
                all_factors[factor] = 1
        if not pair_co:
            break
    if pair_co:
        return 'pairwise coprime'
    elif reduce(gcd, aa) == 1:
        return 'setwise coprime'
    else:
        return 'not coprime'

print(main(aa))
### BUGGY CODE ###

n = int(input())
list = [int(e) for e in input().split()]

for i in range(1,n+1):
    print(list.count(i))
    del list[0:list.count(i)]

### FIXED CODE ###

n = int(input())
list = [int(e) for e in input().split()]

import collections
list2 = collections.Counter(list)

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

import collections
N = int(input())
A = list(map(int , input().split()))
a = collections.Counter(A)
for i in range(N):
    K =[]
    K.extend(A)
    K.pop(i)
    a = collections.Counter(K)
    S = len(list(set(K)))
    k = 0
    for j in range (S):
        b =a.most_common()[j][1]
        k = b * (b-1)/2 + k
    print(int(k))
    K.clear()
    K.extend(A)

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int , input().split()))
a = collections.Counter(A)
k = 0
def comb(n):
    return n * (n - 1) // 2
for j in a.values():
    k += comb(j)
    
for i in range(N):
    s = A[i]
    p = a[s]
    print(int(k - p + 1))
### BUGGY CODE ###

N = int(input())
S = []
for i in range(N):
    s = input()
    if s not in S:
        S.append(s)
print(len(S))


### FIXED CODE ###

N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)
ans = len(S)
S.sort()
for i in range(1,N):
    if S[i] == S[i-1]:
        ans -= 1
print(ans)
### BUGGY CODE ###

import sys
#import time
#import copy
from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
#input = sys.stdin.readline
sys.setrecursionlimit(10**6)
 
def ri():
    return list(map(int, input().split()))
def rs():
    return list(input().strip())

n,m = ri()
edge=[[0]*n for i in range(n)]
for i in range(m):
    a, b = ri()
    a+=-1
    b+=-1
    edge[a][b]=1
    edge[b][a]=1

visited=[0]*n
dis = [0]*n
ans=[0]*n
def bfs(now, p=-1):
    q = deque([])
    q.append((now, p, -1))
    while len(q):
        if now==p:
            continue
        now, p, d = q.popleft()
        if visited[now]==0:
            ans[now]=p+1
            dis[now]=d+1
            visited[now]=1
            for i in range(n):
                if edge[now][i]==1 and visited[i]==0:
                    q.append((i, now, dis[now]))
                    
                    visited[i]==1
bfs(0)

flag=True
for i in range(n):
    if visited[i]==0:
        flag=False
if flag:
    print("Yes")
    for i in range(1,n):
        print(ans[i])
else:
    print("No")

### FIXED CODE ###

import sys
#import time
#import copy
from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
#input = sys.stdin.readline
sys.setrecursionlimit(10**6)
 
def ri():
    return list(map(int, input().split()))
def rs():
    return list(input().strip())

n,m = ri()
edge=[[] for _ in range(n)]
for i in range(m):
    a, b = ri()
    a+=-1
    b+=-1
    edge[a].append(b)
    edge[b].append(a)

visited=[0]*n
dis = [0]*n
ans=[0]*n
def bfs(now, p=-1):
    q = deque([])
    q.append((now, p, -1))
    while len(q):
        now, p, d = q.popleft()
        dis[now] = d+1
        visited[now]=1
        ans[now]=p+1
        
        for e in edge[now]:
            if visited[e]==1:
                continue
            if e==now:
                continue
            q.append((e, now, dis[now]))
            visited[e]=1
        
        
        
        
bfs(0)
flag=True
for i in range(n):
    if visited[i]==0:
        flag=False
if flag:
    print("Yes")
    for i in range(1,n):
        print(ans[i])
else:
    print("No")
### BUGGY CODE ###

N=int(input())
LST=[]
for i in range(N):
    a=input()
    lst=[]
    for j in range(len(a)):
        lst.append(a[j])

    LST.append(sorted(lst))

count=0
for i in range(N-1):
    for j in range(i+1,N):
        if LST[i]==LST[j]:
            count+=1
print(count)



### FIXED CODE ###

N=int(input())

count=0
dic=dict()

for i in range(N):
    s="".join(sorted(input()))
#    print(s)

    if s in dic:
        count+=dic[s]
#        print(dic[s])
        dic[s]+=1
    else:
        dic[s]=1
#        print(dic)

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

def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]

    U = [[0 for i in range(W)] for j in range(H)]
    D = [[0 for i in range(W)] for j in range(H)]
    L = [[0 for i in range(W)] for j in range(H)]
    R = [[0 for i in range(W)] for j in range(H)]

    for i in range(H):
        for j in range(W):
            # 上方向
            if i > 0:
                if S[i - 1][j] == '#':
                    U[i][j] = 0
                else:
                    U[i][j] = U[i - 1][j] + 1
            
            # 左方向
            
            if j > 0:
                if S[i][j - 1] == '#':
                    L[i][j] = 0
                else:
                    L[i][j] = L[i][j - 1] + 1
    
    for i in range(H - 1, -1, -1):
        for j in range(W - 1, -1, -1):
            # 下方向
            if i < H - 1:
                if S[i + 1][j] == '#':
                    D[i][j] = 0
                else:
                    D[i][j] = D[i + 1][j] + 1
            
            # 右方向
            if j < W - 1:
                if S[i][j + 1] == '#':
                    R[i][j] = 0
                else:
                    R[i][j] = R[i][j + 1] + 1
                
            

    res = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] != '#':
                res = max(res, U[i][j] + D[i][j] + R[i][j] + L[i][j])
    
    print(res + 1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]

    U = [[0 for i in range(W)] for j in range(H)]
    D = [[0 for i in range(W)] for j in range(H)]
    L = [[0 for i in range(W)] for j in range(H)]
    R = [[0 for i in range(W)] for j in range(H)]

    for i in range(H):
        for j in range(W):
            # 上方向
            if i > 0:
                if S[i - 1][j] == '#':
                    U[i][j] = 0
                else:
                    U[i][j] = U[i - 1][j] + 1
            
            # 左方向
            if j > 0:
                if S[i][j - 1] == '#':
                    L[i][j] = 0
                else:
                    L[i][j] = L[i][j - 1] + 1
    
    for i in range(H - 1, -1, -1):
        for j in range(W - 1, -1, -1):
            # 下方向
            if i < H - 1:
                if S[i + 1][j] == '#':
                    D[i][j] = 0
                else:
                    D[i][j] = D[i + 1][j] + 1
            
            # 右方向
            if j < W - 1:
                if S[i][j + 1] == '#':
                    R[i][j] = 0
                else:
                    R[i][j] = R[i][j + 1] + 1

    res = 0
    for i in range(H):
        for j in range(W):
            if S[i][j] != '#':
                res = max(res, U[i][j] + D[i][j] + R[i][j] + L[i][j])
    
    print(res + 1)

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

s = list(str(input()))
n = len(s)

dl = {'A':0, 'C':0, '?':0}
dr = {'A':0, 'C':0, '?':0}

dls = []
drs = []

import copy

for i in range(n):
    if s[i] == 'A' or s[i] == 'C':
        dl[s[i]] += 1
    elif s[i] == 'B':
        dl_ = copy.copy(dl)
        dls.append(dl_)
    else:
        dl_ = copy.copy(dl)
        dls.append(dl_)
        dl[s[i]] += 1
    j = n - 1- i
    if s[j] == 'A' or s[j] == 'C':
        dr[s[j]] += 1
    elif s[j] == 'B':
        dr_ = copy.copy(dr)
        drs.append(dr_)
    else:
        dr_ = copy.copy(dr)
        drs.append(dr_)
        dr[s[j]] += 1

drs = list(reversed(drs))
#print(dls)
#print(drs)

ans = 0
mod = 10**9+7

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

for i in range(len(dls)):
    a = (dls[i]['A']*power(3, dls[i]['?'], mod) + dls[i]['?']*power(3, max(0, dls[i]['?']-1), mod))%mod
    b = (drs[i]['C']*power(3, drs[i]['?'], mod) + drs[i]['?']*power(3, max(0, drs[i]['?']-1), mod))%mod
    ans += (a*b)%mod
    #print(ans)
ans %=mod
print(ans)

### FIXED CODE ###

s = list(str(input()))
n = len(s)

dl = {'A':0, 'C':0, '?':0}
dr = {'A':0, 'C':0, '?':0}

dls = []
drs = []

import copy

for i in range(n):
    if s[i] == 'A' or s[i] == 'C':
        dl[s[i]] += 1
    elif s[i] == 'B':
        dl_ = copy.copy(dl)
        dls.append(dl_)
    else:
        dl_ = copy.copy(dl)
        dls.append(dl_)
        dl[s[i]] += 1
    j = n - 1- i
    if s[j] == 'A' or s[j] == 'C':
        dr[s[j]] += 1
    elif s[j] == 'B':
        dr_ = copy.copy(dr)
        drs.append(dr_)
    else:
        dr_ = copy.copy(dr)
        drs.append(dr_)
        dr[s[j]] += 1

drs = list(reversed(drs))
#print(dls)
#print(drs)

ans = 0
mod = 10**9+7

def power(a, n, mod):
  bi=str(format(n,"b")) #2進数
  res=1
  for i in range(len(bi)):
    res=(res*res) %mod
    if bi[i]=="1":
      res=(res*a) %mod
  return res

for i in range(len(dls)):
    a = (dls[i]['A']*power(3, dls[i]['?'], mod) + dls[i]['?']*power(3, max(0, dls[i]['?']-1), mod))%mod
    b = (drs[i]['C']*power(3, drs[i]['?'], mod) + drs[i]['?']*power(3, max(0, drs[i]['?']-1), mod))%mod
    ans += (a*b)%mod
    #print(ans)
ans %=mod
print(ans)
### BUGGY CODE ###

N = int(input())
que = []

for i in range(N):
    A = int(input())
    q = A in que
    if q == True:
        num = que.index(A)
        que.pop(num)
    else:
        que.append(A)
print(len(que))

### FIXED CODE ###

import collections

N = int(input())
que = [int(input()) for i in range(N)]
count = 0
count_dict = collections.Counter(que)
for k, v in count_dict.items():
    if v % 2 == 1:
        count += 1
print(count)
### BUGGY CODE ###

#!/usr/bin/env python3
n,k = [int(i) for i in input().split(" ")]
p = [int(i) for i in input().split(" ")]
kita = {}
maxn = 0
for i in range(n-k+1):
    kt = 0
    for j in range(k):
        if not p[i+j] in kita.keys():
            kita[p[i+j]] = 0.5*(p[i+j]+1)
        kt += kita[p[i+j]]
    if kt > maxn:
        maxn = kt
print(maxn)

### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
maxn = 0
sum = 0
for i in range(n-k+1):
	if i == 0:
		for j in range(k):
			sum += p[j]
		maxn = sum
	else:
		sum -= p[i-1]
		sum += p[i+k-1]
		if maxn < sum:
			maxn = sum
print(0.5*(maxn+k))