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

N, K = map(int, input().split())
h = [0] + list(map(int, input().split())) # 便宜上、先頭に[0]

dp = [1000000007 for _ in range(N+1)] # dp[i]：足場iに移動する最小コスト
dp[1] = 0 # 初期位置のため、0
dp[2] = abs(h[2]-h[1]) # 足場2への移動は1パターンのみのため

for dst in range(3, N+1):
    for k in range(1,K+1):
        src = dst-k
        if src < 1:
            break
        dp[dst] = min(dp[dst], dp[src] + abs(h[dst]-h[src]))
print(dp[N])

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, K = map(int, input().split())
    h = [0] + list(map(int, input().split())) # 便宜上、先頭に[0]

    dp = [1000000007 for _ in range(N+1)] # dp[i]：足場iに移動する最小コスト
    dp[1] = 0 # 初期位置のため、0
    dp[2] = abs(h[2]-h[1]) # 足場2への移動は1パターンのみのため

    for dst in range(3, N+1):
        for k in range(1,K+1):
            src = dst-k
            if src < 1:
                break
            dp[dst] = min(dp[dst], dp[src] + abs(h[dst]-h[src]))
    print(dp[N])

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

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

n = 1

for i in a:
    n *= i

if n > 10**18:
    print('-1')
else:
    print(n)


### FIXED CODE ###

n = int(input())
As = list(map(int,input().split()))

ans = 1

for i in As:
    ans *= i
    ans = min(ans, 10**18 + 1)

if ans == 10**18 + 1:
    print(-1)

else:
    print(ans)
### BUGGY CODE ###

k, s = map(int, input().split())

ans = 0
for i in range(k + 1):
  for j in range(k + 1):
    if i + j == s:
      ans += 1
    elif 0 <= s - (i + j) <= k:
      ans += 1

print(ans)

### FIXED CODE ###

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

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)
### BUGGY CODE ###

import sys
import itertools

input = sys.stdin.readline


def main():
    n = int(input())
    l = map(int, input().split())
    # 種類組み合わせ・条件
    hoge = 0
    for a, b, c in itertools.combinations(l, 3):
        if a < b + c and b < c + a and c < a + b:
            hoge += 1
    print(hoge)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import bisect

input = sys.stdin.readline


def main():
    n = int(input())
    l = map(int, input().split())
    # 種類組み合わせ・条件
    l = sorted(l)
    hoge = 0
    for i, a in enumerate(l[:-2], start=1):
        for j, b in enumerate(l[i:-1], start=i):
            index = bisect.bisect_left(l, a + b)
            hoge += index - j - 1
    print(hoge)


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

n, k = map(int, input().split())
a_in = list(map(int, input().split()))

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
# if k > 41:
#     itr = 41
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')


### FIXED CODE ###

n, k = map(int, input().split())
a_in = list(map(int, input().split()))

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
if k > 41:
    itr = 41
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')
### BUGGY CODE ###

s = input()
q = int(input())
for i in range(q):
  query = input()
  if query == '1':
    s = s[::-1]
    continue
  else:
    t, f, c = query.split()
    if f == '1':
      s = c + s
    else:
      s = s + c
print(s)

### FIXED CODE ###

from collections import deque
s = deque(input())
q = int(input())
cnt = 0
for i in range(q):
  query = input()
  if query == '1':
    cnt += 1
  else:
    t, f, c = query.split()
    if (f == '1' and cnt % 2 == 0) or (f == '2' and cnt % 2 == 1):
      s.appendleft(c)
    else:
      s.append(c)
if cnt % 2 == 0:
  print(''.join(s))
else:
  s.reverse()
  print(''.join(s))
### BUGGY CODE ###

from collections import Counter
 
def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s.upper().replace(' ', ''))
 
    return get_counter(first_word) == get_counter(second_word)
flag=0
n=int(input())
list1=[]
check_list=[]
for i in range(n):
    list1.append(input())
for i in range(n):
    for j in range(n):
        if verify_anagrams(list1[i], list1[j]):
            if (i!=j)and(list1[j] not in check_list):
                check_list.append(list1[i])
                flag=flag+1
print(flag)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
d = defaultdict(int)
 
for i in range(N):
    s = str(sorted(input()))
    d[s] += 1
ans = 0
 
for key in d.keys():
    ans += d[key]*(d[key]-1)//2
print(ans)
### BUGGY CODE ###

N,M=map(int,input().split())
a=[]
b=[]
for i in range(0,M):
	c,d=map(int,input().split())
	a.append(c)
	b.append(d)

pos=0
i=0
while pos==0 and i<M:
	if a[i] == 1:
		c=b[i]
		for j in range(1, M):
			if (a[j]==c and b[j]==N) or (a[j]==N and b[j]==c):
				pos=1
	if b[i] == 1:
		c=a[i]
		for j in range(1, M):
			if (a[j]==c and b[j]==N) or (a[j]==N and b[j]==c):
				pos=1
	i=i+1
if pos == 1:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

### FIXED CODE ###

N,M=map(int,input().split())
a=[]
b=[]
for i in range(0,M):
	c,d=map(int,input().split())
	a.append(c)
	b.append(d)

pos=0
i=0
g=[0 for i in range(0,200000)]
e=[]
f=[]
k=0
l=0
while i < M and pos == 0:
	if a[i] == 1:
		g[b[i]] = 1
	if b[i] == 1:
		g[a[i]] = 1
	i=i+1
i=0
while i < M and pos == 0:
	if a[i] == N:
		if g[b[i]] == 1:
			pos=1
	if b[i] == N:
		if g[a[i]] == 1:
			pos=1
	i = i + 1
if pos == 1:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")
### BUGGY CODE ###

F_str = input().split()
F = [int(f) for f in F_str]
N = F[0]
M = F[1]

WA_list = [0 for _ in range(N)]
AC_list = []

for i in range(M):
    S_str = input().split()
    S = [str(s) for s in S_str]
    if(S[1] == "AC"):
        AC_list.append(S[0])
    elif(not(S[0] in AC_list)):
        WA_list[int(S[0])-1] += 1

AC_set = list(set(AC_list))

WA_count = 0

for item in AC_set:
    WA_count += WA_list[int(item)-1]

print(str(len(AC_set)) + " " + str(WA_count))

### FIXED CODE ###

F_str = input().split()
F = [int(f) for f in F_str]
N = F[0]
M = F[1]

WA_list = [0 for _ in range(N)]
AC_list = [0 for _ in range(N)]

for i in range(M):
    S_str = input().split()
    S = [str(s) for s in S_str]
    if(S[1] == "AC"):
        AC_list[int(S[0])-1] = 1
    elif(AC_list[int(S[0])-1] != 1):
        WA_list[int(S[0])-1] += 1

WA_count = 0
AC_count = 0

for i in range(N):
    if(AC_list[i] == 1):
        AC_count += 1
        WA_count += WA_list[i]

print(AC_count, WA_count)
### BUGGY CODE ###

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

print(*b)

### FIXED CODE ###

from collections import deque
n=int(input())
a=deque([int(i) for i in input().split()])
b=deque()

if n%2==0:
    for i in range(n):
        if i % 2 == 0:
            b.append(a.popleft())
        else:
            b.appendleft(a.popleft())
else:
    for i in range(n):
        if i % 2 == 0:
            b.appendleft(a.popleft())
        else:
            b.append(a.popleft())
print(*b)
### BUGGY CODE ###

n = int(input()) 
t = [int(input()) for i in range(n)]
m = max(t)
for i in range(n):
	x = t.copy()
	if t[i] != m:
		print(m)
	else:
		x.pop(i)
		print(max(x))

### FIXED CODE ###

n = int(input()) 
t = [int(input()) for i in range(n)]
m2 = sorted(t)[-2]
m = max(t)
for i in range(n):
	if t[i] != m:
		print(m)
	else:
		print(m2)
### BUGGY CODE ###

import numpy as np
inputs = open(0).readlines()

h, w, k = map(int, inputs[0].split())
cake = np.zeros((h, w), dtype=np.int)
count = 0
coords = {}
for i, s in enumerate(inputs[1:]):
    for j, c in enumerate(s):
        if c == '#':
            count += 1
            cake[i, j] = count
            coords[count] = (j, i)
            
for i in range(1, count+1):
    x, y = coords[i]
    x0, y0 = x-1, y-1
    x1, y1 = x+1, y+1
    while 0 <= x0 and cake[y, x0] == 0:
        cake[y, x0] = i
        x0 -= 1
    x0 += 1
    while x1 < w and cake[y, x1] == 0:
        cake[y, x1] = i
        x1 += 1
    while 0 <= y0 and not np.any(cake[y0, x0:x1]):
        cake[y0, x0:x1] = i
        y0 -= 1
    while y1 < h and not np.any(cake[y1, x0:x1]):
        cake[y1, x0:x1] = i
        y1 += 1

for rows in cake:
    print(*rows)

### FIXED CODE ###

import numpy as np
inputs = open(0).readlines()

def main(inputs):
    h, w, k = map(int, inputs[0].split())
    cake, count, coords = np.zeros((h, w), dtype=np.uint), 0, {}
    for i, s in enumerate(inputs[1:]):
        for j, c in enumerate(s):
            if c == '#':
                count += 1
                cake[i, j] = count
                coords[count] = (j, i)
    empty_rows = {i for i, rows in enumerate(cake) if not np.any(rows)}

    for i in range(1, count+1):
        x, y = coords[i]
        x0, y0 = x-1, y-1
        x1, y1 = x+1, y+1
        while 0 <= x0 and cake[y, x0] == 0:
            cake[y, x0] = i
            x0 -= 1
        x0 += 1
        while x1 < w and cake[y, x1] == 0:
            cake[y, x1] = i
            x1 += 1
        while 0 <= y0 and y0 in empty_rows:
            cake[y0, x0:x1] = i
            y0 -= 1
        while y1 < h and y1 in empty_rows:
            cake[y1, x0:x1] = i
            y1 += 1

    for rows in cake:
        print(*rows)

main(inputs)
### BUGGY CODE ###

r,g,b,n = map(int,input().split())

ans = 0

for i in range(n+1):
    if i * r > n:
        break
    for j in range(n+1):
        #if i + j >= n:
            #ans = ans + 1
        #    break
        if (n - i*r - j*g) < 0:
            break
        if (n - i*r - j*g) % b == 0:
            ans = ans + 1

print(ans)

### FIXED CODE ###

r,g,b,n = map(int,input().split())

ans = 0

num = [r,g,b]
#print(num)
num.sort()
#print(num[0],num[1])
#exit()

for i in range(n+1):
    if i * num[2] > n:
        break
    for j in range(n+1):
        #if i + j >= n:
            #ans = ans + 1
        #    break
        if (n - i*num[2] - j*num[1]) < 0:
            break
        if (n - i*num[2] - j*num[1]) % num[0] == 0:
            ans = ans + 1

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

li=[]
N,A,B=map(int,input().split())
for i in range((N//(A+B))):
    for i in range(A):
        li.append("b")
    for i in range(B):
        li.append("r")
ctpossible=li.count("b")#ペアでカウント可能
if N%(A+B)<=A:
    adding=N%(A+B)
else:
    adding=A
print(ctpossible+adding)


### FIXED CODE ###

N,A,B=map(int,input().split())
ctpossible=A*(N//(A+B))#ペアでカウント可能
if N%(A+B)<=A:
    adding=N%(A+B)
else:
    adding=A
print(ctpossible+adding)
### BUGGY CODE ###

import math
# Calculate amount of water that won't oveflow
def calc(a,b,deg): 
    
    rad = math.radians(deg)
    deg90_in_rad = math.radians(90)
    a_sect = a*math.sin(rad) - b*math.sin(deg90_in_rad - rad)
    b_sect = b*math.sin(deg90_in_rad - rad) - a*math.sin(rad) # 縦と水の切片

    if b_sect >= 0:
        sqr_a = a * b_sect 
        tri_a = (b-b_sect)*a*1/2  

    else:
        sqr_a = 0
        tri_a = (a - a_sect) * b *1/2

    if b*math.tan(math.pi/2-rad)>a:
        return (a*b - a*math.tan(rad)*a*1/2) *a
    else:
        return b*math.tan(rad/2-rad)*b*1/2*a
    # print(a_sect, b_sect)
    return (sqr_a + tri_a) * a

import bisect
def main():
    a, b, x = list(map(int, input().split()))

    left = 0
    right = 90
    deg = 45
    while True:
        y = calc(a, b, deg)
        if abs(y - x) < 10**-12:
            break
        if y > x:
            deg, left = (right+deg)/2, deg
        elif y < x:
            deg, right = (left+deg)/2, deg
        
    print(deg)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import math
# Calculate amount of water that won't oveflow
def calc(a,b,deg): 
    
    rad = math.radians(deg)
    # deg90_in_rad = math.radians(90)
    # a_sect = a*math.sin(rad) - b*math.sin(deg90_in_rad - rad)
    # b_sect = b*math.sin(deg90_in_rad - rad) - a*math.sin(rad) # 縦と水の切片

    # if b_sect >= 0:
    #     sqr_a = a * b_sect 
    #     tri_a = (b-b_sect)*a*1/2  

    # else:
    #     sqr_a = 0
    #     tri_a = (a - a_sect) * b *1/2
    # total_area = (sqr_a + tri_a) 

    if b*math.tan(math.pi/2-rad) <= a:
        total_area = (b*math.tan(math.pi/2-rad)*b*1/2)
    if b*math.tan(math.pi/2-rad)>a:
        total_area = (a*b - a*math.tan(rad)*a*1/2)       

    return total_area * a

import bisect
def main():
    a, b, x = list(map(int, input().split()))

    left = 0
    right = 90
    deg = 45
    while True:
        y = calc(a, b, deg)
        if y - x >= -10 ** -7 and y - x <= 0:
            break
        if y > x:
            deg, left = (right+deg)/2, deg
        elif y < x:
            deg, right = (left+deg)/2, deg
    print(deg)

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

# kが極端に少ないので、下位K個を管理してよさそうな気がする
# -> なんかダメ
# じゃ決め打ちして全探索することにしてみる どうせ長さは最大でKなので
# 時間的に間に合うか微妙な気がする
# -> はい

s = list(input())
k = int(input())
d = {}
for i in range(len(s)):
    for j in range(i, len(s)):
        t = "".join(s[i:j + 1])
        if t not in d:
            d[t] = True
dk = sorted(d.keys())
print(dk[k - 1])


### FIXED CODE ###

# 最小かつ最長はzzzzzなので各文字+4まで調べてみるか（27^5-1で全探索もできると思うがやり方がわからん
s = input()
k = int(input())
d = set()
for i in range(len(s)):
    for j in range(1, 6):
        if i + j <= len(s):
            d.add(s[i : i + j])
print(sorted(list(d))[k-1])
### BUGGY CODE ###

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

b = 0
c = 0
cnt = 0
flag = False
while True:
    b = 0
    c = 0
    for i in range(n):
        if a[i] % 2 == 0 and c == 0:
            a[i] /= 2
            c += 1
        else:
            b += 1
    #print(a,b)
    if b != n:
        cnt += 1
    else:
        break

print(cnt)


### FIXED CODE ###

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

'''
b = 0
c = 0
cnt = 0
flag = False
while True:
    b = 0
    c = 0
    for i in range(n):
        if a[i] % 2 == 0 and c == 0:
            a[i] /= 2
            c += 1
        else:
            b += 1
    #print(a,b)
    if b != n:
        cnt += 1
    else:
        break
'''
b = [0] * n
for i in range(n):
    while True:
        if a[i] % 2 == 0:
            a[i] /= 2
            b[i] += 1
        else:
            break

print(sum(b))
### BUGGY CODE ###

def ryuka(n):
    if n==0:
        return 2
    if n==1:
        return 1
    return ryuka(n-1)+ryuka(n-2)    
print(ryuka(int(input())))   

### FIXED CODE ###

n=int(input())
l=[2,1]
for i in range(3,n+2):
    l.append(l[i-2]+l[i-3])
print(l[-1])
### BUGGY CODE ###

import numpy as np

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = np.array(list(map(int, num[1].split())))

history = []
count = 0

for i in range(0,num_0):
    history.append(num_1[i])
    num_min = np.min(history)
    if(num_1[i] <= num_min):
        count = count + 1

print(count)

### FIXED CODE ###

num = [input() for i in range(2)]
num_0 = int(num[0])
num_1 = list(map(int, num[1].split()))

num_min = num_1[0]
count = 0

for i in range(0,num_0):
  if(num_min >= num_1[i]):
    count = count+1
    num_min = num_1[i]
    
print(count)
### BUGGY CODE ###

import sys
input=sys.stdin.readline

N = int(input())
A = [0] + list(map(int, input().split()))

B = []
for i in range(len(A)):
    tmp = A[0:i+1]
    B.append(sum(tmp))
B.sort()

ans = 0
for i in range(len(B)-1):
    for j in range(i+1,len(B)):
        if B[j]-B[i] == 0:
            ans += 1
print(ans)


### FIXED CODE ###

import sys
input=sys.stdin.readline

from math import factorial
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

N = int(input())
A = [0] + list(map(int, input().split()))

B = {}
x = 0
for i in A:
    x += i
    if x not in B:
        B[x] = 1
    else:
        B[x] += 1

ans = 0
for i in B.values():
    if i >= 2:
        ans += combinations_count(i,2)

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

N = int(input())

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

A.sort()

s1 = 0
s2 = 0

t = -1
for a in A:
    if a != t:
        ac = A.count(a)
        if ac >= 4:
            s1 = a
            s2 = a
        elif ac >= 2:
            s2 = s1
            s1 = a

    t = a

print(s1 * s2)


### FIXED CODE ###

N = int(input())

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

A.sort()

s1 = 0
s2 = 0

at = -1
atc = 0

for a in A:
    if at == a:
        atc += 1

    else:
        if atc >= 4:
            s1 = at
            s2 = at
        elif atc >= 2:
            s2 = s1
            s1 = at
        
        at = a
        atc = 1

if atc >= 4:
    s1 = at
    s2 = at
elif atc >= 2:
    s2 = s1
    s1 = at

print(s1 * s2)
### BUGGY CODE ###

from functools import reduce
from fractions import gcd
from collections import deque


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

ans = 1
a = A.pop()
for i in range(N):
  ans = max(ans, reduce(gcd, A))
  A.appendleft(a)
  a = A.pop()

print(ans)

### FIXED CODE ###

from fractions import gcd

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

L = [0]
R = [0]

g = A[0]
for a in A:
  g = gcd(g, a)
  L.append(g)

A = A[::-1]
g = A[0]
for a in A:
  g = gcd(g, a)
  R.append(g)

R = R[::-1]

ans = 1
for l, r in zip(L, R[1:]):
  ans = max(ans, gcd(l, r))

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

n=int(input())
s=input()
data=[]
for i in range(n):
    if i==0:
        data.append(s[1:].count('E'))
    elif i==n-1:
        data.append(s[:i].count('W'))
    else:
        data.append(s[i+1:].count('E')+s[:i].count('W'))
print(min(data))

### FIXED CODE ###

n=int(input())
s=input()
data=[]
data.append(s[1:].count('E'))
for i in range(1,n):
    d=data[-1]
    if s[i-1]=='W':d+=1
    if s[i]=='E':d-=1
    data.append(d)
    
print(min(data))
### BUGGY CODE ###

N = int(input())
A = [(a, i+1) for i, a in enumerate(map(int, input().split()))]
A.sort(reverse=True)
INF = float('inf')
dp = [[-INF] * (N+1) for _ in range(N+1)]
dp[0][0] = 0

for s in range(1, N+1):
    for l in range(s+1):
        r = s - l
        dp[l][r] = max(dp[l-1][r] + A[s-1][0] * abs(A[s-1][1]-l), dp[l][r-1] + A[s-1][0] * abs(N-r+1-A[s-1][1]))

ans = 0
for m in range(N):
    if dp[m][N-m] > ans:
        ans = dp[m][N-m]

print(ans)

### FIXED CODE ###

def main():
  N = int(input())
  INF = float('inf')
  A = [(i+1, a) for i, a in enumerate(map(int, input().split()))]
  A = sorted(A, key=lambda x: x[1], reverse = True)

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

  for s in range(1, N+1):
    for l in range(s+1):
      r = s - l
      dp[l][r] = max(dp[l-1][r] + A[s-1][1] * abs(A[s-1][0]-l), dp[l][r-1] + A[s-1][1] * abs(N-r+1-A[s-1][0]))
    
  ans = 0
  for m in range(N):
    if(dp[m][N-m] > ans):
      ans = dp[m][N-m]
    
  print(ans)

main()
### BUGGY CODE ###

N, K = map(int, input().split())  #数字

B=[]
for i in range(N + 1):
    B.append(i)

D = []

import itertools
for i in range(K,len(B)+1):
    for j in itertools.combinations(B, i):
        D.append(j)

#print(D)
E = []
F = []
G = 0
for i in range(K, len(D[-1])):
    if G == 1:
        G = 0
    for j in range(len(D)):
        if len(D[j]) == i:
            E.append(sum(D[j]))
#            print(E)
        if len(D[j]) > i:
            G = 1
            break
    F.append(set(E))
    E = []
        
#print(F)
H = 0
for i in range(len(F)):
    for j in range(len(F[i])):
        H += 1
print(H+1)

### FIXED CODE ###

N, K = map(int, input().split())  #数字
MOD = 10 ** 9 + 7

ans = 0
for i in range(K, N + 2):
    A = (i - 1) * i // 2
    B = N * (1 + N) // 2 - (N + 1 - i - 1) * (N + 1 - i) // 2
    ans += B - A + 1

print(ans % MOD)
### BUGGY CODE ###

K,X,Y = (int(x) for x in input().split())
num = K*(K-1)/2
distance = [0] *int(num)
ct = 0
for i in range(1,K):
    for j in range (i+1,K+1):
            distance[ct] = min(j-i,abs(i-X)+abs(j-Y)+1)
            ct += 1
for k in range (1,K):
    print(distance.count(k))

### FIXED CODE ###

K,X,Y = (int(x) for x in input().split())
ans = [0] * K
ct = 0
for i in range(1,K):
    for j in range (i+1,K+1):
            ans[min(j-i,abs(i-X)+abs(j-Y)+1)] += 1
for k in range (1,K):
    print(ans[k])
### BUGGY CODE ###

from sys import stdin
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
prime_list=[i for i in range(2,100000) if is_prime(i)]
oppai=[0]*100000
oppai[1]=0
before=1
for num in prime_list:
    if (num+1)//2 in prime_list:
        oppai[before:num - 2] = [oppai[before]] * (num-1 - before)
        oppai[num-1]=oppai[before]+1
    else:oppai[before:num-1]=[oppai[before]]*(num-before)
    before=num-1
N=list(map(int,stdin.readline().strip().split()))[0]
for _ in range(N):
    count = 0
    a,b=map(int,(input().split()))
    if a==b:
        bb = (oppai[b - 1])
        aa = (oppai[a - 2])
        count = bb - aa
        print(count)
    else:
        if a>=2:
            bb = oppai[b - 1]
            aa = oppai[a - 2]
            count = bb - aa
            print(count)
        else:
            bb = oppai[b - 1]
            count = bb
            print(count)





### FIXED CODE ###

from sys import stdin
def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
prime_list=[i for i in range(2,100000) if is_prime(i)]
oppai=[0]*100000
oppai[1]=0
before=1
for num in prime_list:
    if (num+1)//2 in prime_list:
        oppai[before:num - 2] = [oppai[before]] * (num-1 - before)
        oppai[num-1]=oppai[before]+1
    else:oppai[before:num-1]=[oppai[before]]*(num-before)
    before=num-1
oppai[99991:99999]=[oppai[99990]]*8
N=list(map(int,stdin.readline().strip().split()))[0]
for _ in range(N):
    count = 0
    a,b=list(map(int,stdin.readline().strip().split()))
    if a==b:
        bb = (oppai[b - 1])
        aa = (oppai[a - 2])
        count = bb - aa
        print(count)
    else:
        if a>=2:
            bb = oppai[b - 1]
            aa = oppai[a - 2]
            count = bb - aa
            print(count)
        else:
            bb = oppai[b - 1]
            count = bb
            print(count)
### BUGGY CODE ###

import sys

if __name__ == '__main__':
    input = sys.stdin.readline
    n = int(input())
    s = list(input())
    s.remove('\n')
    r = 0
    g = 0
    b = 0
    for i in s:
        if i == "R":
            r += 1
        elif i == "G":
            g += 1
        else:
            b += 1
    ans = r * g * b
    for i in range(n):
        for j in range(i, n):
            out = j * 2 - i
            if out >= n:
                continue
            if len({s[i], s[j], s[out]}) == 3:
                ans -= 1
    print(ans)


### FIXED CODE ###

import sys

if __name__ == '__main__':
    input = sys.stdin.readline
    n = int(input())
    s = list(input())
    s.remove('\n')
    r = 0
    g = 0
    b = 0
    for i in s:
        if i == "R":
            r += 1
        elif i == "G":
            g += 1
        else:
            b += 1
    ans = r * g * b
    for i in range(n):
        for j in range(i, n):
            out = j * 2 - i
            if out >= n:
                continue
            if len({s[i], s[j], s[out]}) == 3:
                ans -= 1
    print(ans)