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

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
for i in range(k):
  for j in range(k):
    for h in range(k):
      s += gcd(i+1,j+1,h+1)
print(s)


### FIXED CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
  
k = int(input())
s = 0
l = []
for i in range(k):
  for j in range(k):
    l.append(math.gcd(i+1,j+1))
for h in range(k):
  for n in l:
    s += math.gcd(h+1, n)
print(s)
### BUGGY CODE ###

S = input()
Q = int(input())
query = []
for _ in range(Q):
    q = list(input().split())
    if len(q) != 1:
        q = [int(x) for x in q[:2]] + [q[2]]
    else:
        q = list(map(int, q)) + [0, '']
    query.append(q)

S = list(S)
for t, f, c in query:
    if t == 1:
        S = list(reversed(S))
    else:
        if f == 1:
            S.insert(0, c)
        else:
            S.append(c)
print(''.join(S))

### FIXED CODE ###

S = input()
Q = int(input())
query = [list(input().split()) for _ in range(Q)]
forward = 1
f = ''
b = ''
for i in range(Q):
    if query[i][0] == '1':
        forward *= -1
    else:
        if query[i][1] == '1':
            if forward == 1:
                f += query[i][2]
            else:
                b += query[i][2] 
        else:
            if forward == 1:
                b += query[i][2] 
            else:
                f += query[i][2]
S = ''.join(list(reversed(f))) + S + b

if forward == -1:
    ans = ''.join(list(reversed(S)))
else:
    ans = S
print(ans)
### BUGGY CODE ###


n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [[0] * n for _ in range(n)]

for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  d[a][b] = h[b]
  d[b][a] = h[a]

mh = [1] * n
ans = 0

for i in range(n):
  if h[i] > max(d[i]):
    ans += 1
  
print(ans)

### FIXED CODE ###


n,m = list(map(int,input().split()))
h = list(map(int,input().split()))
d = [1] * n
for i in range(m):
  a,b = list(map(int,input().split()))
  a -= 1
  b -= 1
  if h[a] > h[b]:
    d[b] = 0
  elif h[b] > h[a]:
    d[a] = 0
  else:
    d[a] = 0
    d[b] = 0

print(sum(d))
### BUGGY CODE ###

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

table = [list(map(int, input().split())) for k in range(n)]
table.sort()

ans = 0

for day in range(1, m+1):
    
    choice = False
    pay = 0
    
    for t in table:
        if t[0] > day:
            break
        else:
            if pay < t[1]:
                pay = t[1]
                choice = t
                
    if choice:
        table.remove(choice)
        
    ans += pay
  
print(ans)

### FIXED CODE ###

import heapq

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

table = [list(map(int, input().split())) for _ in range(n)]
table.sort(reverse=True)

ans = 0
pay = []

for day in range(1, m+1):
    while table and table[-1][0] <= day:
        tmp = table.pop()
        heapq.heappush(pay, -tmp[1])
   
    if pay:
        ans -= heapq.heappop(pay)

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

import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

while (l < len(A)):
    x = np.bitwise_xor.reduce(A[l:r])
    s = np.add.reduce(A[l:r])
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = x ^ A[r-1]
        s += A[r-1]
    r -= 1
    c += (r - l)
    #print((l,r,r))
    l += 1

print(c)

### FIXED CODE ###

import numpy as np
#from numba import njit

#(N, K) = map(int, input().split())
#A = np.array(list(map(int, input().split())))
N = int(input())
A = np.array(list(map(int, input().split())))
l = 0
r = 0
c = 0

x = 0
s = 0

while (l < len(A)):
    while (x == s):
        r += 1
        if (r > len(A)):
            break
        x = x ^ A[r-1]
        s += A[r-1]
    if (r <= len(A)):
        x = x ^ A[r-1]
        s -= A[r-1]
    r -= 1
    c += (r - l)
    x = x ^ A[l]
    s -= A[l]
    l += 1

print(c)
### BUGGY CODE ###

def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)

### FIXED CODE ###

def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

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

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

for i in range(M):
    A[A.index((max(A)))] //= 2

print(sum(A))


### FIXED CODE ###

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x * (-1), a))
heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a) * (-1)
    price //= 2
    m -= 1
    heapq.heappush(a, (-1) * price)
print(sum(a) * (-1))
### BUGGY CODE ###

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

trial_num = int(input())
stones = list(input())

min_turn_stones = 2 * 10 ** 5

for i in range(trial_num):
    tmp_min = stones[:i].count("#") + stones[i+1:].count(".")
    if (tmp_min < min_turn_stones):
        min_turn_stones = tmp_min

print(min_turn_stones)

### FIXED CODE ###

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

trial_num = int(input())
stones = list(input())

left_black_stone = 0
right_white_stone = stones.count(".")
min_turn_stones = right_white_stone

for i in range(trial_num):
    if(stones[i] == "#"):
        left_black_stone += 1
    else:
        right_white_stone -= 1

    tmp_min = left_black_stone + right_white_stone
    if(tmp_min < min_turn_stones):
        min_turn_stones = tmp_min


print(min_turn_stones)
### BUGGY CODE ###

N=int(input())
L=list(map(int,input().split()))
for i in range(N):
  if i==0:
    print(sorted(L[i+1:])[N//2-1])
  else:
    print(sorted(L[:i]+L[i+1:])[N//2-1])

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
LL=sorted(L)
M1=LL[N//2-1]
M2=LL[N//2]
for i in L:
  if i>=M2:
    print(M1)
  else:
    print(M2)
### BUGGY CODE ###

n = int(input())
xlist = []
for i in range(n):
    command = list(map(str,input().split()))
    if (command[0] == 'insert'):
        x = command[1]
        if (len(xlist) == 0):
            xlist.append(int(x))
        else:
            xlist = [int(x)] + xlist
        #print(xlist)
    elif (command[0] == 'delete'):
        x = command[1]
        if (int(x) in xlist) :
            xlist.remove(int(x))
        #print(xlist)
    elif (command[0] == 'deleteFirst'):
        if (len(xlist) > 0):
            xlist.pop(0)
        #print(xlist)
    elif (command[0] == 'deleteLast'):
        if (len(xlist) > 0):
            xlist.pop(-1)
        #print(xlist)
n = len(xlist)
for i in range(n):
    if (i == n-1):
        print('{}'.format(xlist[i]), end = '')
    else:
        print('{} '.format(xlist[i]), end = '')
print()


### FIXED CODE ###

from collections import deque
n = int(input())
a = deque()
for i in range(n):
    c = input()
    if c == "deleteFirst":
        a.popleft()
    elif c == "deleteLast":
        a.pop()
    else:
        c, v = c.split()
        if c == "insert":
            a.appendleft(v)
        else:
            try:
                a.remove(v)
            except:
                pass
print(" ".join(a))
### BUGGY CODE ###

n,k=map(int,input().split())
A=[int(i) for i in input().split()]
AA=[0]*n
B=[2*n+1]*(2*(10**5)+1)
for i in reversed(range(n)):
  B[A[i]]=n+i+1
for i in reversed(range(n)):
  AA[i]=B[A[i]]-(i+1)
  B[A[i]]=i+1
count,index,inc=0,0,0
while count<n*k:
  index=(index+inc)%n
  inc=AA[index]+1
  count+=inc  
  if count%n==0:
    count*=(n*k)//count

count-=inc
d=n*k-count
Ans1=A+A
Ans2=AA+AA
Ans=[]
i=index
while i<d+index:
  if i+Ans2[i]>=d+index:
    Ans.append(Ans1[i])
    i+=1
  else:
    i+=Ans2[i]+1
print(*Ans)

### FIXED CODE ###

n,k=map(int,input().split())
A=[int(i) for i in input().split()]
AA=[0]*n
B=[2*n+1]*(2*(10**5)+1)
for i in reversed(range(n)):
  B[A[i]]=n+i+1
for i in reversed(range(n)):
  AA[i]=B[A[i]]-(i+1)
  B[A[i]]=i+1
count,index,inc=0,0,0
Chk=[0]*n
flag=False
while count<n*k:

  inc=AA[index]+1
  count+=inc  
  index=(index+inc)%n
  if Chk[index]!=0 or index==0:
    if flag==False:
      dd=count-Chk[index]
      count+=(((n*k)-count)//dd)*dd
      flag=True
  Chk[index]=count

count-=inc
index=(index+n-inc)%n

d=n*k-count
Ans1=A+A
Ans2=AA+AA
Ans=[]
i=index
while i<d+index:
  if i+Ans2[i]>=d+index:
    Ans.append(Ans1[i])
    i+=1
  else:
    i+=Ans2[i]+1
print(*Ans)
### BUGGY CODE ###

N = int(input())
c = list(input())
n = 0
for i in range(N):
    if c[i] == 'W':
        for j in range(N - 1, i, -1):
            if c[j] == 'R':
                n += 1
                c[i] = 'R'
                c[j] = 'W'
                break
print(n)

### FIXED CODE ###

import sys
N = int(input())
c = list(input())
n = 0
k = N - 1
for i in range(N):
    if c[i] == 'W':
        for j in range(k, i, -1):
            if c[j] == 'R':
                n += 1
                c[i] = 'R'
                c[j] = 'W'
                k = j - 1
                break
            if j == i + 1:
                print(n)
                sys.exit()
print(n)
### BUGGY CODE ###

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))

### FIXED CODE ###

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

w = [0] * N
v = [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = {0: 0}
for i in range(N):
    for cw, cv in list(dp.items()):
        if cw + w[i] > W:
            continue
        dp[cw + w[i]] = max(
            dp.get(cw + w[i], 0),
            cv + v[i])
print(max(dp.values()))
### BUGGY CODE ###

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

import functools
import operator

result = functools.reduce(operator.mul, a)

if result > 10**18:
    result = -1

print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 1
a.sort()
if a[0] == 0:
    ans = 0
    print(ans)
    exit()

for i in range(n):
    ans *= a[i]
    if ans > 10**18:
        print(-1)
        exit()

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

A, B, C, K = map(int, input().split())
if A == B == C:
    print(0)
else:
    x = 10**18
    for _ in range(K):
        a = B+C
        b = A+C
        c = A+B
        A=a
        B=b
        C=c
        if A - B > x:
            print("Unfair")
            break
    else:
        print(A-B)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
if K % 2 == 0:
    print(A-B)
else:
    print(B-A)
### BUGGY CODE ###

from heapq import heappush, heappop
import sys
readline = open(0).readline
xs, ys, xt, yt = map(int, readline().split())
N = int(readline())
C = [list(map(int, readline().split())) for i in range(N)]

que = []
dist = [10**18]*N
rest = set(range(N))
for i in range(N):
    x, y, r = C[i]
    d0 = (xs - x)**2 + (ys - y)**2
    r0 = (d0)**.5 - r if d0 > r**2 else 0
    dist[i] = r0
    heappush(que, (r0, i))

remove = rest.remove
while que:
    c, i = heappop(que)
    if i not in rest:
        continue
    xi, yi, ri = C[i]
    remove(i)
    d = dist[i]
    for j in rest:
        x, y, r = C[j]
        d0 = (xi - x)**2 + (yi - y)**2
        r0 = (d0)**.5 - ri - r if d0 > (ri + r)**2 else 0
        if d + r0 < dist[j]:
            dist[j] = v = d + r0
            heappush(que, (v, j))
ans = ((xs - xt) ** 2 + (ys - yt) ** 2)**.5
for i in range(N):
    x, y, r = C[i]
    d0 = (xt - x)**2 + (yt - y)**2
    r0 = (d0)**.5 - r if d0 > r**2 else 0
    ans = min(ans, dist[i] + r0)
print("%.16f" % ans)

### FIXED CODE ###

from heapq import heappush, heappop
from math import sqrt
xs, ys, xt, yt = map(int, raw_input().split())
n = input()
ps = [map(int, raw_input().split()) for i in xrange(n)]
cant = [0]*n
for i in xrange(n):
    x0, y0, r0 = ps[i]
    for j in xrange(n):
        x1, y1, r1 = ps[j]
        if i == j or r0 > r1: continue
        if (x0 - x1)**2 + (y0 - y1)**2 <= (r1 - r0)**2:
            cant[i] = 1
            break

EPS = 1e-10
que = []
dist = [10**18+7]*n
def calc(x0, y0, r0, x1, y1, r1):
    v = (x0 - x1)**2 + (y0 - y1)**2
    if v <= (r0+r1)**2:
        return 0.
    return sqrt(v) - r0 - r1
for i in xrange(n):
    if cant[i]: continue
    x, y, r = ps[i]
    d = dist[i] = calc(xs, ys, 0, x, y, r)
    heappush(que, (d, i))
while que:
    d, v = heappop(que)
    if dist[v] < d:
        continue
    x0, y0, r0 = ps[v]
    for t in xrange(n):
        if v == t or cant[t]: continue
        x1, y1, r1 = ps[t]
        nd = calc(x0, y0, r0, x1, y1, r1)
        if d+nd < dist[t]:
            dist[t] = d+nd
            heappush(que, (d+nd, t))
ans = sqrt((xs - xt)**2 + (ys - yt)**2)
for i in xrange(n):
    if cant[i]: continue
    x, y, r = ps[i]
    d = calc(xt, yt, 0, x, y, r) + dist[i]
    ans = min(ans, d)
print "%.010f" % ans
### BUGGY CODE ###

from operator import itemgetter
import sys


class BIT:
    def __init__(self, size: int):
        self.size = size + 1
        self.array = [0] * self.size

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

    def sub(self, i):
        while i < self.size:
            self.array[i] -= 1
            i += i & -i

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


def read():
    return sys.stdin.readline().rstrip()


def main():
    n, q = map(int, read().split())
    c = [int(i) - 1 for i in read().split()]
    queries = [(0, 0, 0) for _ in range(q)]
    for i in range(q):
        l, r = map(int, read().split())
        queries[i] = (i, l, r)
    queries = iter(sorted(queries, key=itemgetter(2)))
    last = [0] * n
    bit = BIT(n)
    ans = [-1] * q
    k, l, r = next(queries)
    for i in range(n):
        ci = c[i]
        li = last[ci]
        if li > 0:
            bit.sub(li)
        last[ci] = i + 1
        bit.add(i + 1)
        while i + 1 == r:
            ans[k] = bit.sum(l, r)
            try:
                k, l, r = next(queries)
            except StopIteration:
                print(*ans, sep="\n")
                return


if __name__ == '__main__':
    main()


### FIXED CODE ###

from operator import itemgetter
import sys


class BIT:
    def __init__(self, size: int):
        self.size = size + 1
        self.array = [0] * self.size

    def add(self, i, x):
        if not i > 0:
            return
        while i < self.size:
            self.array[i] += x
            i += i & -i

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


def read():
    return sys.stdin.readline().rstrip()


def main():
    n, q = map(int, read().split())
    c = [int(i) for i in read().split()]
    queries = [() for _ in range(q)]
    for i in range(q):
        l, r = map(int, read().split())
        queries[i] = (i, l, r)
    queries.sort(key=itemgetter(2))
    last = [0] * n
    bit = BIT(n)
    ans = [-1] * q
    cr = 0
    for i, l, r in queries:
        for ri in range(cr, r):
            ci = c[ri] - 1
            bit.add(last[ci], -1)
            last[ci] = ri + 1
            bit.add(last[ci], 1)
            cr = ri
        ans[i] = bit.sum(r) - bit.sum(l - 1)
    print(*ans, sep="\n")


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

N,Q = (int(x) for x in input().split())
connection ={i:[] for i in range(1,N+1)}
#木の構造
for i in range(1,N):
    a,b = (int(x) for x in input().split())
    connection[a].append(b)
    connection[b].append(a)
#頂点を通過した時のポイント
point ={i:0 for i in range(1,N+1)}
for i in range(1,Q+1):
    p,x = (int(x) for x in input().split())
    point[p] +=x

#幅優先探索
start =1
stack=[start]
#prev =0
#point[0]=0
passed =[]
while stack:
    sarch =stack.pop()
    next = connection[sarch]
    for i in next:
        if i not in passed:
            point[i] +=point[sarch]
            
            stack.append(i)
            passed.append(sarch)
            #print(i,end=" ")
print(*(point.values()))

### FIXED CODE ###

from collections import OrderedDict
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
#初期データ、構造
N,Q = (int(x) for x in input().split())
connection ={i:set() for i in range(1,N+1)}
for i in range(N-1):
    a,b = (int(x) for x in input().split())
    connection[a].add(b)
    connection[b].add(a)
#point =OrderedDict({i:0 for i in range(1,N+1)})
point ={i:0 for i in range(1,N+1)}
for i in range(Q):
    p,x = (int(x) for x in input().split())
    point[p] +=x

def DFS(now,prev = -1):
    for next in connection[now]:
        if next == prev:
            continue
        point[next] +=point[now] 
        DFS(next,now)

DFS(1)
print(*point.values())
### BUGGY CODE ###

import collections

N,M = map(int,input().split())
A=[int(x) for x in input().split()]
B=[]
for i in range(N+1):
  B+=[sum(A[:i])]
C=[]
for i in range(N+1):
  C +=[B[i]%M]
answer=0
D = collections.Counter(C)
E = list(D.values())

for i in range(len(E)):
  answer += E[i]*(E[i]-1)//2
print(answer)

### FIXED CODE ###

import collections
import numpy as np

N,M = map(int,input().split())
A=np.array([0]+[int(x) for x in input().split()])
B=np.mod(A.cumsum(),M)
answer=0
C = collections.Counter(B)

for x in C.values():
  answer += x*(x-1)//2
print(answer)
### BUGGY CODE ###

N = int(input().rstrip())
a = []
for n in range(N):
    a.append(int(input().rstrip()))

button = [1]
while True:
    button.append(a[button[-1] - 1])
    current = button[-1]
    if current == 2:
        break
    if any([b == current for b in button[:-1]]):
        print(-1)
        exit()

print(len(button) - 1)

### FIXED CODE ###

N = int(input().rstrip())
a = []
for n in range(N):
    a.append(int(input().rstrip()))

button = [1]
for _ in range(N-1):
    button.append(a[button[-1] - 1])
    if button[-1] == 2:
        print(len(button) - 1)
        exit()
    if button[-1] == button[-2]:
        break
    
print(-1)
### BUGGY CODE ###

#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

d,g = LI()
pc = [LI() for _ in range(d)]
ans = inf
for i in permutations(range(d)):
    cnt = 0
    tmp = 0
    for j in list(i):
        p,c = pc[j]
        flg = (g-tmp) % (100*(j+1))
        t = min(p,(g - tmp)//(100*(j+1)))
        tmp += 100*(j+1)*t
        if t == p:
            tmp += c
            cnt += t
            if tmp >= g:
                break
        else:
            cnt += t + (flg != 0)
            break
    ans = min(ans,cnt)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import numpy as np
import math
import re

a,b=map(int,input().split())
c=[0]+[list(map(int,input().split()))for i in range(a)]

def f(t,s):
    if t==0:
        return 10**9
    l=min(s//(t*100),c[t][0])
    k=100*t*l
    if l==c[t][0]:
        k+=c[t][1]
    if k<s:
        l+=f(t-1,s-k)
    return min(l,f(t-1,s))
print(f(a,b))
### BUGGY CODE ###

class UnionFindTree():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
size = [uft.parents.count(n) for n in range(N)]
print(max(size))

### FIXED CODE ###

class UnionFindTree():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 常にxの要素数＞yの要素数とする
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        # self.parents[x] に　yの要素数を追加してから併合
        self.parents[x] += self.parents[y]
        self.parents[y] = x
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
print(-min(uft.parents))
### BUGGY CODE ###

N, K = [int(n) for n in input().split()]
P =  [int(n) for n in input().split()]
q =[]
ans = 0

for p in P:
    if len(q) < K:
        q.append((p-1)/2+1)
    else:
        m = sum(q)
        if m > ans:
            ans = m
        q.append((p-1)/2+1)
        q.pop(0)
print(ans if ans>sum(q) else sum(q))

### FIXED CODE ###

N, K = [int(n) for n in input().split()]
P = [(int(n)+1)/2 for n in input().split()]
ans = sum(P[:K])
e = ans
for p,x in zip(P, P[K:]):
    e = e-p+x
    if ans < e:
        ans = e
print(ans)
### BUGGY CODE ###

from collections import deque, defaultdict


def main():
    N, X, Y = map(int, input().split())
    g = [[] for _ in range(N)]
    for i in range(N-1):
        g[i].append(i+1)
        g[i+1].append(i)
    g[X-1].append(Y-1)
    g[Y-1].append(X-1)
    ans = defaultdict(int)

    for i in range(N):
        q = deque()
        q.append(i)
        visit_time = [0 for _ in range(N)]
        while len(q):
            v = q.popleft()
            time = visit_time[v]
            for j in g[v]:
                if visit_time[j] == 0 and j != i:
                    q.append(j)
                    visit_time[j] = time + 1
                else:
                    visit_time[j] = min(time + 1, visit_time[j])

        for v in visit_time:
            ans[v] += 1

    for i in range(1, N):
        print(ans[i] // 2)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# Using BFS
from collections import defaultdict, deque
import sys


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


def push(v, d, dist, q, INF=1e10):
    if dist[v] != INF:
        return
    dist[v] = d
    q.append(v)


def main():
    n, x, y = map(int, input().split())
    # modify the values of x, y so that they start from zero
    x, y = x - 1, y - 1
    INF = 1e10
    ans = defaultdict(int)
    for i in range(n):
        # dist[idx]: distance between i and idx.
        dist = [INF] * n
        q = deque()
        push(i, 0, dist, q)
        while len(q) != 0:
            v = q.popleft()
            d = dist[v]
            if v - 1 >= 0:
                push(v-1, d+1, dist, q)
            if v + 1 < n:
                push(v+1, d+1, dist, q)
            if v == x:
                push(y, d+1, dist, q)
            if v == y:
                push(x, d+1, dist, q)

            ans[dist[v]] += 1

    for i in range(n):
        if i != 0:
            print(ans[i] // 2)


if __name__ == "__main__":
    main()