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

from math import floor
N = int(input())
a = list(map(int, input().split()))
cnt_4 = 0
for i in a:
    if i%4==0:
        cnt_4 += 1
        a.remove(i)

cnt_2 = 0
for i in a:
    if i%2==0:
        cnt_2 += 1

if floor(N//2)<=cnt_4+(cnt_2//2):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from math import floor
N = int(input())
a = list(map(int, input().split()))
cnt_4 = 0
for i in a:
    if i%4==0:
        cnt_4 += 1

cnt_2 = 0
for i in a:
    if i%2==0 and i%4!=0:
        cnt_2 += 1

if floor(N//2)<=cnt_4+(cnt_2//2):
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

N = int(input())
D = [int(i) for i in input().split()]
d = set(D)
M = int(input())
T = [int(i) for i in input().split()]

dict_d = {}
for i in d:
    dict_d[i] = D.count(i)

for i in T:
    if i not in d:
        print('NO')
        exit()
    else:
        if dict_d[i] > 0:
            dict_d[i] -= 1
        else:
            print('NO')
            exit()

print('YES')


### FIXED CODE ###

from collections import Counter

N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

d = Counter(D)
t = Counter(T)
d_key = list(d.keys())
t_key = list(t.keys())

p = len(d_key)
d_key += t_key
q = set(d_key)

if p != len(q):
    print('NO')
    exit()

for i in t_key:
    if t[i] > d[i]:
        print('NO')
        exit()

print('YES')
### BUGGY CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
E = set()
ans = 0
for i in range(N):
    a = A[i]
    if i < N-1:
        if a == A[i+1]:
            E.add(a)
            continue
    if a in E:
        continue
    Flag = True
    for e in E:
        if a%e == 0:
            Flag = False
    if Flag:
        ans += 1
    E.add(a)
print(ans)

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
m = A[-1]+1
dp = [0]*(m*2)
ans = 0

for a in A:
    for i in range(0, m//a+1):
        dp[a*i] += 1
for a in A:
    if dp[a] == 1:
        ans += 1

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

# -*- coding: utf-8 -*-
"""
Created on Sun Feb 24 16:22:35 2019
 
@author: Owner
"""
import numpy as np
 
N, K = map(int, input().split())
 
h = [0]*N
h[:] = map(int, input().split())
 
dp = []
 
for n in range(N):
    if n == 0:
        dp.append(0)
    else:
        temp = np.inf
        for k in range(1,K+1):
            if n-k >= 0:
                temp = min(temp, dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break
        dp.append(temp)
    #print(dp)
print(dp[N-1])

### FIXED CODE ###

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

import numpy as np

N, K = map(int, input().split())
 
h = np.array(list(map(int, input().split())))
 
dp = np.zeros(N)
 
for n in range(1, N):
    k = min(K, n)
    temp = np.min(dp[n-k:n] + np.abs(h[n]-h[n-k:n]))
    dp[n] = temp
print(int(dp[-1]))
### BUGGY CODE ###

def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 

def ciasteczka(): 
    N, K = wczytaj_liste()
    max_cukierkow = wczytaj_liste()
    przed = [1]
    for dziecko in max_cukierkow:
        po = [0]* min(len(przed)+ dziecko, K+1)
        for i in range(len(po)):
            for b in range(dziecko+1):
                j = i - b
                if  0 <= j < len(przed):
                    po[i] += przed[j]
                    if po[i] >= 10**9+7:
                        po[i] -= 10**9+7
        przed = po
    if K < len(przed):
        print(przed[K])
    else:
        print(0)
    
ciasteczka() 

### FIXED CODE ###

def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 

def ciasteczka(): 
    N, K = wczytaj_liste()
    max_cukierkow = wczytaj_liste()
    przed = [1]
    for dziecko in max_cukierkow:
        po = [None]* min(len(przed)+ dziecko, K+1)
        suma_kroczaca = 0
        for i in range(len(po)):
            if len(przed) > i: #trzeba dodać
                suma_kroczaca += przed[i]
            if i-dziecko-1 > -1:
                suma_kroczaca -= przed[i-dziecko-1]
            suma_kroczaca %= 10**9+7
            po[i] = suma_kroczaca
        przed = po
    if K < len(przed):
        print(przed[K])
    else:
        print(0)
    
ciasteczka()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)

n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

for i in range(n-1):
  a,b=map(int,input().split())
  t[a-1].append(b-1)
  t[b-1].append(a-1)

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def dsf(ci,pi):
  for i in t[ci]:
    if i == pi:
      continue
    c[i] += c[ci]
    dsf(i, ci)

dsf(0,-1)

print(*c)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline

n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

for i in range(n-1):
  a,b=map(int,input().split())
  t[a-1].append(b-1)
  t[b-1].append(a-1)

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def dsf(ci,pi):
  for i in t[ci]:
    if i != pi:
      c[i] += c[ci]
      dsf(i, ci)

dsf(0,-1)

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

a, b, k = map(int,input().split())
for x in range(a,b+1):
    if x < a+k or x > b-k:
        print(x)

### FIXED CODE ###

a, b, k = map(int, input().split())
if b-a+1 < 2*k:
    for i in range(a,b+1):
        print(i)
    exit(0)
for i in range(a,a+k):
    print(i)
for i in range(b-k+1,b+1):
    print(i)
### BUGGY CODE ###

N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a,_=input().split();s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+int(a))
print(D[-2]%(9**9)or-1)

### FIXED CODE ###

N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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


Parent = [None for _ in range(2*N+1)]
Points = [(2*N, 0), (0, A[0])]
Parent[0] = (2*N, A[0])
Parent[2*N] = (-1, 1)

for i, a in enumerate(A):
    if i == 0: continue
    lastp, lastd = Points.pop()
    while True:
        if a <= Points[-1][1]:
            lastp, lastd = Points.pop()
        else:
            break
    tmprootdepth = min(lastd, a) - 1
    if tmprootdepth == Points[-1][1]:
        Parent[i] = (Points[-1][0], a-tmprootdepth)
        Points.append((i, a))
    else:
        Parent[lastp] = (i+N, lastd-tmprootdepth)
        Parent[i] = (i+N, a-tmprootdepth)
        Parent[i+N] = (Points[-1][0], tmprootdepth-Points[-1][1])
        Points.append((i+N, tmprootdepth))
        Points.append((i, a))

graph = [[] for _ in range(2*N+1)]
for n in range(2*N):
    if not Parent[n] is None:
        graph[Parent[n][0]].append((Parent[n][1], n))

def dfs(p, span, checked):
    checked[p] = True
    W = 0
    for nd, np in graph[p]:
        if not checked[np]:
            W += dfs(np, span, checked)
    dis_to_parent = Parent[p][1]
    for _ in range(dis_to_parent):
        W = (W-1)//span
        if W <= 0:
            W = 0
            break
    return W

pre = -1
canonly = True
for a in A:
    if a <= pre:
        canonly = False
        break
    pre = a

if canonly:
    print(1)
else:
    l = 1
    r = N+1
    while r-l > 1:
        m = (l+r)//2
        W = dfs(2*N, m, [False]*(2*N+1))
        if W > m:
            l = m
        else:
            r = m

    print(r)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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


def check(m):
    if m == 1:
        pre = -1
        for a in A:
            if pre >= a:
                return False
            pre = a
    else:
        dp = {}
        pre = 0
        #count = 0
        for a in A:
            if pre < a:
                pre = a
                continue
            todelete = []
            for b in dp.keys():
                if b > a:
                    todelete.append(b)
            ind = a
            while ind > 0:
                if ind in dp and dp[ind] >= m-1:
                    todelete.append(ind)
                else:
                    break
                ind -= 1
            # 更新
            if ind in dp:
                dp[ind] += 1
            else:
                dp[ind] = 1
            if ind == 0 or dp[ind] >= m:
                return False
            for d in todelete:
                del dp[d]
            pre = a
    #print(m, count)
    return True



def main():
    l = 0
    r = N
    while r-l > 1:
        m = (r+l)//2
        if check(m):
            r = m
        else:
            l = m
    print(r)


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

import math
import heapq
xs,ys,xe,ye = map(int,input().split())
cs = [(xs,ys,0), (xe,ye,0)]
N = int(input())
for i in range(N):
    cs.append(tuple(map(int,input().split())))

def dist(x1,y1,x2,y2):
    dx,dy = x2-x1,y2-y1
    return math.sqrt(dx**2 + dy**2)

es = [[None for j in range(N+2)] for i in range(N+2)]
for i,(x1,y1,r1) in enumerate(cs[:-1]):
    for j,(x2,y2,r2) in enumerate(cs[i+1:]):
        j += i+1
        cost = max(0, dist(x1,y1,x2,y2) - r1 - r2)
        es[i][j] = es[j][i] = cost

hq = [(cost,i+1) for i,cost in enumerate(es[0][1:])]
heapq.heapify(hq)
visited = [1] + [0] * (N+1)
while hq:
    cost,v = heapq.heappop(hq)
    if v == 1:
        print(cost)
        exit()
    visited[v] = 1
    for to,newcost in enumerate(es[v]):
        if to == v or visited[to]: continue
        heapq.heappush(hq, (cost + newcost, to))


### FIXED CODE ###

import math,heapq,sys
input = sys.stdin.readline
xs,ys,xe,ye = map(int,input().split())
cs = [(xs,ys,0), (xe,ye,0)]
N = int(input())
for i in range(N):
    cs.append(tuple(map(int,input().split())))

def calc_cost(i,j):
    if i == j: return float('inf')
    x1,y1,r1 = cs[i]
    x2,y2,r2 = cs[j]
    cost = max(0, math.hypot(x1-x2,y1-y2) - r1 - r2)
    return cost

INF = float('inf')
direct = calc_cost(0,1)
hq = []
for i in range(1,N+2):
    c = calc_cost(0,i)
    if c > direct: continue
    hq.append((c,i))
heapq.heapify(hq)
not_visited = set(range(1,N+2))
cost = [0] + [INF] * (N+1)
while hq:
    c,v = heapq.heappop(hq)
    if v not in not_visited: continue
    if v == 1:
        print(c)
        exit()
    cost[v] = c
    not_visited.remove(v)
    for to in not_visited:
        newcost = calc_cost(v, to)
        if cost[to] <= cost[v] + newcost: continue
        if direct < cost[v] + newcost: continue
        heapq.heappush(hq, (cost[v] + newcost, to))
### BUGGY CODE ###

N = int(input())

S = []
cnt = []
for i in range(N):
  s = input()
  if s in S:
    cnt[S.index(s)] += 1
  else:
    S.append(s)
    cnt.append(1)

M = max(cnt)
ans = [S[i] for i in range(len(S)) if cnt[i]==M]
ans.sort()

for s in ans:
  print(s)

### FIXED CODE ###

N = int(input())

d = {}
for i in range(N):
  s = input()
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1

M = max(d.values())
for j,k in sorted(d.items()):
  if k == M:
    print(j)
### BUGGY CODE ###

from statistics import median
length = int(input())
text = list(input())

r_list = []
g_list = []
b_list = []

count = 0
for i, c in enumerate(text):
    if c == "R":
        r_list.append(i)
    elif c == "G":
        g_list.append(i)
    else:
        b_list.append(i)

num_list = [0, 0, 0]
for i in r_list:
    num_list[0] = i
    for j in g_list:
        num_list[1] = j
        for k in b_list:
            num_list[2] = k
            d1 = max(num_list) - median(num_list)
            d2 = median(num_list) - min(num_list)
            if d1 != d2:
                count += 1
print(count)

### FIXED CODE ###

length = int(input())
text = input()

r_count = text.count("R")
g_count = text.count("G")
b_count = text.count("B")

answer = r_count * g_count * b_count

for i in range(length-2):
    for j in range(i+1, length-1):
        k = i + (j-i)*2
        if k < length and text[i]!=text[j] and text[i]!=text[k] and text[j]!=text[k]:
            answer -= 1
        
print(answer)
### BUGGY CODE ###

s = input()
t = input()
n = len(s)

for i in range(n):
    if s.count(s[i]) == 1:
        continue
    else:
        memo1 = [t[i]]
        for j in range(i+1,n):
            if s[j] == s[i]:
                memo1.append(t[j])
        if len(set(memo1)) != 1:
            print('No')
            exit()


for i in range(n):
    if t.count(t[i]) == 1:
        continue
    else:
        memo2 = [s[i]]
        for j in range(i+1,n):
            if t[j] == t[i]:
                memo2.append(s[j])
        if len(set(memo2)) != 1:
            print('No')
            exit()
print('Yes')

### FIXED CODE ###

s = input()
t = input()
n = len(s)
x = []
y = []

for i in range(n):
    if s[i] not in x:
        x.append(s[i])
    if t[i] not in y:
        y.append(t[i])

for i in range(len(x)):
    s = s.replace(x[i], str(i))
for i in range(len(y)):
    t = t.replace(y[i], str(i))
print('Yes' if s == t else 'No')
### BUGGY CODE ###

#!/usr/bin/env python3

def func(n):
    cnt = 0
    for x in range(1, 20):
        if x * x > n:
            break
        for y in range(1, 20):
            if y * y > n:
                break
            for z in range(1, 20):
                if z * z > n:
                    break
                if x * x + y * y + z * z + x * y + y * z + z * x == n:
                    cnt += 1
                    break
    return cnt


def main():
    N = int(input())

    for i in range(1, N + 1):
        print(func(i))


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    N = int(input())

    ans = [0] * (N + 1)

    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                f = x * x + y * y + z * z + x * y + y * z + z * x
                if f < N + 1:
                    ans[f] += 1
    ans.remove(0)
    print('\n'.join(map(str, ans)))


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

from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())

    def count(k):
        ans = 0
        NN = int(k ** 0.5) + 1
        for x in range(1, NN):
            for y in range(1, min(NN, k - x * x)):
                for z in range(1, min(NN, k - x * x - y * y)):
                    if x * x + y * y + z * z + x * y + y * z + z * x == k:
                        ans += 1
        return ans

    for k in range(1, N + 1):
        print(count(k))

if __name__ == '__main__':
    main()

### FIXED CODE ###

from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil, sqrt
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    N = int(input())
    ans = [0] * 20000

    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 100):
                v = x * x + y * y + z * z + x * y + y * z + z * x
                if v <= 10001:
                    ans[v] += 1
    for k in range(1, N + 1):
        print(ans[k])


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

import sys
from itertools import combinations as combi
input = sys.stdin.readline
N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
mod = 10 ** 9 + 7
dp = [0] * (1 << N)
dp[0] = 1
for t in range(N):
  for c in combi([x for x in range(N)], t):
    x = 0
    for i in c: x += 1 << i
    s = set(c)
    for i in range(N):
      if i in s: continue
      if a[t][i]:
        dp[x + (1 << i)] += dp[x]
        dp[x + (1 << i)] %= mod
print(dp[-1])

### FIXED CODE ###

import sys
from itertools import combinations as combi
input = sys.stdin.readline
N = int(input())
a = [list(map(int, input().split())) for _ in range(N)]
mod = 10 ** 9 + 7
dp = [0] * (1 << N)
dp[0] = 1
for t in range(N):
  for c in combi([x for x in range(N)], t):
    x = 0
    table = [0] * N
    for i in c:
      x += 1 << i
      table[i] = 1
    for i in range(N):
      if table[i]: continue
      if a[t][i]:
        tt = 1 << i
        dp[x + tt] += dp[x]
        dp[x + tt] %= mod
print(dp[-1])
### BUGGY CODE ###

H, W, D = map(int, input().split())

A = [list(map(int, input().split())) for i in range(H)]
rA = [[0 for j in range(2)] for i in range(H * W + 1)]
for i in range(H):
	for j in range(W):
		rA[A[i][j]][0] = i
		rA[A[i][j]][1] = j

Q = int(input())
for i in range(Q):
	L, R = map(int, input().split())
	ans = 0
	for j in range(H * W) [L::D]:
		if j == R:
			break
		ans += abs(rA[j + D][1] - rA[j][1]) + abs(rA[j + D][0] - rA[j][0])
	print (ans)

### FIXED CODE ###

H, W, D = map(int, input().split())
 
A = [list(map(int, input().split())) for i in range(H)]
rA = [[0 for j in range(2)] for i in range(H * W + 1)]
S = [0 for i in range(H * W + 1)]
for i in range(H):
	for j in range(W):
		rA[A[i][j]][0] = i
		rA[A[i][j]][1] = j
 
Q = int(input())
for i in range(Q):
	L, R = map(int, input().split())
	ans = 0
	for j in range(H * W) [L::D]:
		if j + D > H * W:
			break
		if S[j]:
			ans += S[j]
			break
		S[j] -= ans
		ans += abs(rA[j + D][1] - rA[j][1]) + abs(rA[j + D][0] - rA[j][0])
	for j in range(H * W)[L::D]:
		if S[j] > 0:
			break
		if j + D > H * W:
			break
		S[j] += ans
	print(S[L] - S[R])
### BUGGY CODE ###

import heapq

n,m = map(int,input().split())
a_list = list(map(int,input().split()))
move = [list(map(int,input().split())) for _ in range(m)]

heapq.heapify(a_list)

for elem in move:
    for i in range(elem[0]):
        _min = heapq.heappop(a_list)
        if _min < elem[1]:
            heapq.heappush(a_list,elem[1])
        else:
            heapq.heappush(a_list,_min)
            break

print(sum(a_list))

### FIXED CODE ###

import heapq

n,m = map(int,input().split())
a_list = list(map(int,input().split()))
move = [list(map(int,input().split())) for _ in range(m)]

heapq.heapify(a_list)
move = sorted(move, key=lambda x: x[1],reverse=True)

for elem in move:
    for i in range(elem[0]):
        _min = heapq.heappop(a_list)
        if _min < elem[1]:
            heapq.heappush(a_list,elem[1])
        else:
            heapq.heappush(a_list,_min)
            break

print(sum(a_list))
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for i in range(3001):
    for j in range(3001):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            ans += 1
        if b < 0:
            break

print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for i in range(3001):
    for j in range(3001):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            ans += 1
        if b < 0:
            break

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

import heapq
def SME(start,end):
    A = []
    if end > N : end = N
    count = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] == 0:
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count > N * 0.9999 : break
    for i in range(L):
        if ANS[i] == 0 : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] == 0 : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
ANS = [0]*N
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

import collections
from collections import deque
import numpy as np

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

ca = collections.Counter(A)
cakeys = list(ca.keys())
cavalues = np.array(list(ca.values()))

#print(cakeys)
#print(np.array(list(ca.values())))

cavaluesmax = cavalues*(cavalues-1)//2
valuesum = np.sum(cavaluesmax)
#cavaluesmin = (cavalues-1)*(cavalues-2)//2
diff = cavalues-1

ans = valuesum - diff

#print(cavaluesmax)
#print(cavaluesmin)

for i in range(N):
    #print(cakeys[index])
    index = cakeys.index(A[i])
    #ans = cavaluesmin[index].sum() + cavaluesmax[:index].sum() + cavaluesmax[index+1:].sum()
    print(ans[index])


### FIXED CODE ###

import collections
from collections import deque
import numpy as np

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

ca = collections.Counter(A)
cakeys = list(ca.keys())
cavalues = np.array(list(ca.values()))

#print(cakeys)
#print(np.array(list(ca.values())))

cavaluesmax = cavalues*(cavalues-1)//2
valuesum = np.sum(cavaluesmax)
#cavaluesmin = (cavalues-1)*(cavalues-2)//2


for a in A:
    #print(cakeys[index])
    v = ca[a]
    ans = valuesum - v + 1
    #ans = cavaluesmin[index].sum() + cavaluesmax[:index].sum() + cavaluesmax[index+1:].sum()
    print(ans)
### BUGGY CODE ###

import numpy as np
from collections import defaultdict

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

x -= 1
y -= 1

inf = 1000000000
dist = np.full((n, n), inf, dtype=np.int)

for i in range(n):
    for j in range(n):
        if i == j:
            dist[i][j] = 0
        else:
            path1 = abs(j - i)
            path2 = abs(x - i) + 1 + abs(y - j)
            dist[i][j] = min(abs(j - i), path2)

dist_counts = defaultdict(int)
for i in range(n):
    for j in range(i + 1, n):
        d = dist[i][j]
        dist_counts[d] += 1

for k in range(1, n):
    print(dist_counts[k])


### FIXED CODE ###

from collections import defaultdict

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

x -= 1
y -= 1

dist_counts = defaultdict(int)
for i in range(n):
    for j in range(i + 1, n):
        path1 = abs(j - i)
        path2 = abs(x - i) + 1 + abs(y - j)
        dist = min(abs(j - i), path2)
        dist_counts[dist] += 1

for k in range(1, n):
    print(dist_counts[k])
### BUGGY CODE ###

if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    n, k = map(int, input().split())
    hs = list(map(int, input().split()))
    if n <= k+1:
        print(abs(hs[0]-hs[-1]))
        exit()
    ans_list = [0]*n
    for i in range(k):
        ans_list[i] = abs(hs[-1] - hs[-i-1])
    for i in range(k,n):
        ans_list[i] = min([abs(hs[-i-1]-hs[-i-1+x])+ans_list[i-x] for x in range(1,k+1)])
    print(ans_list[-1])


### FIXED CODE ###

if __name__ == '__main__':
    import sys
    input = sys.stdin.readline
    n, k = map(int, input().split())
    hs = list(map(int, input().split()))
    if n <= k+1:
        print(abs(hs[0]-hs[-1]))
        exit()
    ans_list = [0]*n
    last_hs = hs[-1]
    for i in range(1,k+2):
        ans_list[-i] = abs(last_hs - hs[-i])
    for i in range(k+2,n+1):
        hs_i = hs[-i]
        ans_list[-i] = min([abs(hs_i-x)+y for x,y in zip(hs[1-i:k+1-i],ans_list[1-i:k+1-i])])
    print(ans_list[0])