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

import sys
l = list(map(int, input().split(' ')))
N = l[0]
N_ = l[0] + 1
M = l[1]
y = []
u = []

for i in range(M):
    k = list(map(int, input().split()))
    a = k[0]
    b = k[1]
    if (a == 1):
        y.append(b)
    elif (b == N):
        u.append(a)

for i in y:
    if (i in u):
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')


### FIXED CODE ###

import sys
l = list(map(int, input().split(' ')))
N = l[0]
N_ = l[0] + 1
M = l[1]
y = []
u = set()

for i in range(M):
    k = list(map(int, input().split()))
    a = k[0]
    b = k[1]
    if (a == 1):
        y.append(b)
    elif (b == N):
        u.add(a)

for i in y:
    if (i in u):
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')
### BUGGY CODE ###

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

b = []

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.insert(0 , a[i])

if i % 2 == 0 : b.reverse()        

for i in range(N):
    print(b[i],end=" ")

### FIXED CODE ###

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

b = deque()

for i in range(N) : 
    if i % 2 == 0 : b.append(a[i])
    if i % 2 == 1 : b.appendleft(a[i])

if i % 2 == 0 : b.reverse()        

print(" ".join(map(str, b)))
### BUGGY CODE ###

import sys
input = sys.stdin.readline 
sys.setrecursionlimit(10 ** 6) 
N,Q = map(int, input().split())

tree = [[] for _ in range(N)]

for i in range(N - 1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  if a > b:
    a,b = b,a
  elif a == b:
    continue
  tree[a].append(b)
  tree[b].append(a)

ans = [0] * N

for i in range(Q):
  p,x = map(int, input().split())
  ans[p - 1] += x
  
def dfs(cur, par):
  for chl in tree[cur]:
    ans[chl] += ans[cur]
    dfs(chl,cur)

dfs(0, -1)

print(*ans)



### FIXED CODE ###

import sys
input = sys.stdin.readline 
sys.setrecursionlimit(10 ** 6) 
N,Q = map(int, input().split())

tree = [[] for _ in range(N)]

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

ans = [0] * N

for i in range(Q):
  p,x = map(int, input().split())
  ans[p - 1] += x
  
def dfs(cur, par):
  for chl in tree[cur]:
    if chl == par:
      continue
    ans[chl] += ans[cur]
    dfs(chl,cur)

dfs(0, -1)

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

N=int(input())
A=[int(x) for x in input().split()]
S=0
for i in range(N):
  for j in range(i+1,N):
    if j-i==A[i]+A[j]:
      S+=1
print(S)


### FIXED CODE ###

# 解答みた
N=int(input())
A=[int(x) for x in input().split()]
X={}
Y={}
for i in range(N):
  L=i+A[i]
  R=i-A[i]
  X[L]=X[L]+1 if L in X else 1
  Y[R]=Y[R]+1 if R in Y else 1
ans=0
for n in X:
  if n in Y:
    ans+=X[n]*Y[n]
print(ans)
### BUGGY CODE ###

N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
ans = set(j for j in range(mat[0][0], mat[0][-1] + 1))
for i in range(1, M):
    s = set(j for j in range(mat[i][0], mat[i][-1] + 1))
    ans = ans & s
print(len(ans))


### FIXED CODE ###

N, M = map(int,input().split())
mat = [list(map(int,input().split())) for o in range(M)]
lmax = mat[0][0]
for i in range(M):
    if mat[i][0] > lmax:
        lmax = mat[i][0]
rmin = mat[0][1]
for i in range(M):
    if mat[i][1] < rmin:
        rmin = mat[i][1]

ans = rmin - lmax + 1
if ans >= 1:
    print(ans)
else:
    print(0)
### BUGGY CODE ###

# import numpy as np
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
exp = []
for p in P:
    exp.append(sum(range(1,p+1))/p)
high = 0
for i in range(N-K+1):
    tmp = 0
    for e in exp[i:i+K]:
        tmp += e
    if tmp > high:
        high = tmp
print(high)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
tmp = sum(P[:K])
high = tmp
e = 0
for i in range(1, N-K+1):
    tmp -= P[i-1]
    tmp += P[i+K-1]
    if tmp > high:
        high = tmp
        e = i
exp = 0
for p in P[e:e+K]:
    exp += sum(range(1,p+1)) / p

print(exp)
### BUGGY CODE ###

n,m= map(int,input().split())
def f(x):
  return [int(x),1]
A = list(map(f,input().split()))
for _ in range(m):
  b,c = map(int,input().split())
  A += [[c,b]]
A.sort()
A.reverse()
rest = n
score = 0
while True:
  C = A[0][0]
  B = A[0][1]
  score += B * C
  rest -= B
  del A[0]
  if rest < 0:
    score += rest * C
    break
print(score)

### FIXED CODE ###

n,m= map(int,input().split())
AA = list(map(int,input().split()))
A = [(AA[i],1) for i in range(n)]
for _ in range(m):
  b,c = map(int,input().split())
  A += [(c,b)]
A.sort()
A.reverse()
rest = n
score = 0
for (cc,bb) in A:
  use = min(bb,rest)
  rest -= use
  score += use*cc
print(score)
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline
n,x,y = map(int,input().split())
to = [[] for _ in range(n)]
for i in range(n-1):
    to[i].append(i+1)
    to[i+1].append(i)
x -= 1
y -= 1
to[x].append(y)
to[y].append(x)

ans = [0]*(n-1)
d = {}
Q = deque()
flag = [False]*n
for i in range(n-1):
    Q.clear()
    Q.append((i,-1,0))
    for j in range(n): flag[j] = False
    flag[i] = True
    while Q:
        cur,prev,dist = Q.popleft()
        for nxt in to[cur]:
            if nxt == prev: continue
            if flag[nxt]: continue
            flag[nxt] = True
            if (i,nxt) not in d: ans[dist] += 1
            Q.append((nxt,cur,dist+1))
            d[(i,nxt)] = 1
            d[(nxt,i)] = 1

for i in range(n-1): print(ans[i])

### FIXED CODE ###

n,x,y = map(int,input().split())
ans = [0]*(n-1)
x -= 1
y -= 1
for i in range(n-1):
    for j in range(i+1,n):
        dist = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))
        ans[dist-1] += 1
print("\n".join(map(str,ans)))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

A_new = {}
for a in A:
    if not a in A_new:
        A_new[a] = 1
    else:
        A_new[a] += 1

for i in range(Q):
    b = B[i]
    c = C[i]
    if b in A_new:
        n = A_new[b]
        A_new[b] = 0
        if c in A_new:
            A_new[c] += n
        else:
            A_new[c] = n
    key_list = A_new.keys()
    res = 0
    for k in key_list:
        res += A_new[k] * k
    print(res)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

A_new = {}
for a in A:
    if not a in A_new:
        A_new[a] = 1
    else:
        A_new[a] += 1

sum = 0
for i in range(0, 1):
    b = B[i]
    c = C[i]
    if b in A_new:
        n = A_new[b]
        A_new[b] = 0
        if c in A_new:
            A_new[c] += n
        else:
            A_new[c] = n
    key_list = A_new.keys()
    res = 0
    for k in key_list:
        res += A_new[k] * k
    print(res)
    sum = res


for i in range(1, Q):
    b = B[i]
    c = C[i]
    dif = 0
    if b in A_new:
        n = A_new[b]
        A_new[b] = 0
        if c in A_new:
            A_new[c] += n
        else:
            A_new[c] = n
        dif = c * n - b * n
    sum += dif
    print(sum)
### BUGGY CODE ###

n = int(input())
list = [int(x+1) for x in range(1,n)]
list.append(1)
mod = 0

for i in range(n) :
    mod += (i + 1) % list[i]
print(mod)


### FIXED CODE ###

n = int(input())
print((n*(n-1))//2)
### BUGGY CODE ###

k = int(input())
s = input()
L = len(s)
mod = 10**9+7

com = [1]*(k+1)
p25 = [1]*(k+1)
p26 = [1]*(k+1)

for i in range(k):
  com[i+1] = com[i]*(L+i)//(i+1)
  p25[i+1] = p25[i]*25%mod
  p26[i+1] = p26[i]*26%mod

ans = 0
for p in range(k+1):
  chk = p25[p]*com[p]%mod
  chk *= p26[k-p]%mod
  ans += chk
  ans %= mod
  
print(ans)

### FIXED CODE ###

k = int(input())
s = input()
L = len(s)
mod = 10**9+7

MAX = 2*10**6
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i) % mod

inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod % i]*(mod-mod//i) % mod

fact_inv = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod
  
p25 = [1]*(k+1)
p26 = [1]*(k+1)

for i in range(k):
  p25[i+1] = p25[i]*25%mod
  p26[i+1] = p26[i]*26%mod

ans = 0
for p in range(k+1):
  chk = p25[p]*comb(L-1+p,L-1)%mod
  chk *= p26[k-p]%mod
  ans += chk
  ans %= mod
  
print(ans)
### BUGGY CODE ###

H, W, D = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
Q = int(input())
LR = [list(map(int,input().split())) for _ in range(Q)]

def find(n):
  for i in range(len(A)):
    if n in A[i]:
      return [i, A[i].index(n)]

def magic(LR):
  magic = 0
  for i in range(int((LR[1]-LR[0])/D)):
    start = find(LR[0]+i*D)
    goal = find((LR[0]+(i+1)*D))
    magic += (abs(start[0]-goal[0]) + abs(start[1]-goal[1]))
  return magic
  
for i in range(len(LR)):
  if (LR[i][0] == LR[i][1]):
    print(0)
  else:
    print(magic(LR[i]))


### FIXED CODE ###

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

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

Q = int(input())
LR = [list(map(int,input().split())) for _ in range(Q)]

def magic(LR):
  magic = 0
  x = LR[0]
  y = LR[1]
  magicx = abs(A[x][0] - A[y][0]) 
  magicy = abs(A[x][1] - A[y][1]) 
  return magicx + magicy

magiclist = [0]*(H*W+1)
for i in range(D+1,H*W+1):
  magiclist[i] = magiclist[i-D] + magic([i-D,i])

for i in range(Q):
  x = LR[i][0]
  y = LR[i][1]
  if (x == y):
    print(0)
  else:
    print(magiclist[y]- magiclist[x])
### BUGGY CODE ###

h,s,q=map(int,input().split())
l=[int(input()) for i in range(q)]
for d in range(h+1)[1:]:
  print("Yes") if s-q+l.count(d)>0 else print("No")

### FIXED CODE ###

from collections import Counter as co
h,s,q=map(int,input().split())
l=co([int(input()) for e in range(q)])
for i in range(h+1)[1:]:
  print("Yes") if s-q+l[i]>0 else print("No")
### BUGGY CODE ###

import sys
import collections

input = sys.stdin.readline


def main():
    N = int(input())
    A = [collections.deque([int(x) for x in input().split()]) for _ in range(N)]

    day = 0
    c = 0
    while c != N * (N - 1):
        day += 1
        f = False
        for i in range(N):
            x = float("inf")

            if A[i]:
                x = A[i][0]
                if 0 > x > -day:
                    A[i].popleft()
                    if A[i]:
                        x = A[i][0]
                    else:
                        x = float("inf")

            if x == -day or x == float("inf"):
                continue
            if A[x - 1][0] and 0 > A[x - 1][0] > -day:
                A[x - 1].popleft()
            if A[x - 1] and A[x - 1][0] == i + 1:
                c += 2
                A[i][0] = -day
                A[x - 1][0] = -day
                f = True
        if not f:
            print(-1)
            return

    print(day)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import collections
import copy

input = sys.stdin.readline


def main():
    N = int(input())
    A = [collections.deque([int(x) for x in input().split()]) for _ in range(N)]

    day = 0
    c = 0
    nxt = [x for x in range(N)]
    oppo = [0] * N

    while c != N * (N - 1):
        day += 1

        for i in nxt:
            oppo[i] = A[i].popleft() if A[i] else -1

        tmp = set()
        for i in nxt:
            if i == -1 or i in tmp:
                continue
            if i == oppo[oppo[i] - 1] - 1:
                tmp.add(i)
                tmp.add(oppo[i] - 1)
                c += 2
        if not tmp:
            print(-1)
            return

        nxt = tmp

    print(day)


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

from collections import deque
#q = deque()
q= []
m = {}
K = int(input())
q.append((1,1))
while len(q):
  #n,s = q.popleft()
  n,s = q.pop(0)
  if n in m:
    continue
  m[n] = s
  #q.appendleft((n*10%K,s))
  q.insert(0,(n*10%K,s))
  #q.append(((n+1)%K,s+1))
  q.append(((n+1)%K,s+1))
print(m[0])

### FIXED CODE ###

from collections import deque
q = deque()
ans = {}
K = int(input())
q.append((1,1))
while len(q):
  resid,total = q.popleft()
  if resid in ans:
    continue
  ans[resid] = total
  q.appendleft((resid*10%K,total))
  q.append(((resid+1)%K,total+1))
print(ans[0])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
a = int(input())
count = 0
first = 2
def num_div(num):
  a = 2
  while num!=1:
    if num % a == 0:
      while True:
        if num % a ==0:
          num /= a
        elif num == 1:
          return 0
        else:
          return -1
    a += 1

#print(num_div(2))
#sys.exit(0)

while a!=1:
  #素因数は一つ？
  if a % first == 0:
    if num_div(first) == -1:
      first += 1
      continue
    else:
      a /= first
      count += 1
  first += 1
print(count)

### FIXED CODE ###

from collections import Counter

def prime_factor(num):
  factor_list = []
  while num % 2 == 0:
    factor_list.append(2)
    num /= 2
  f = 3
  while f * f <= num:
    if num % f == 0:
      factor_list.append(f)
      num /= f
    else:
      f += 2
  if num!=1:
    factor_list.append(num)
  return factor_list

def get_count(c):
  ans = 0
  _max = c
  for i in range(1,c+1):
    if i <= _max:
      ans += 1
      _max -= i
    else:
      break
  return ans
a = int(input())
counter = Counter(prime_factor(a))
ans = 0
for i in counter:
  ans += get_count(counter[i])
print(ans)
### BUGGY CODE ###

from collections import deque

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

ans = [0] * (n+1)
INF = 10 ** 10

for i in range(n):
    distance = [INF] * n
    q = deque([])
    distance[i] = 0
    q.append(i)
    while len(q) > 0:
        v = q.popleft()
        if v - 1 >= 0:
            if distance[v-1] == INF:
                q.append(v-1) 
                distance[v-1] = distance[v] + 1
        if v + 1 < n:
            if distance[v+1] == INF:
                q.append(v+1)
                d = distance[v] + 1
                distance[v+1] = distance[v] + 1
        if v == x:
            if distance[y] == INF:
                q.append(y)
                distance[y] = distance[v] + 1
        if v == y:
            if distance[x] == INF:
                q.append(x)
                distance[x] = distance[v] + 1
    for i in range(n):
        ans[distance[i]] += 1

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

### FIXED CODE ###

from collections import deque

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

ans = [0] * (n+1)
INF = 10 ** 10

for i in range(n):
    distance = [INF] * n
    q = deque([])
    distance[i] = 0
    q.append(i)
    while len(q) > 0:
        v = q.popleft()
        if v - 1 >= 0:
            if distance[v-1] == INF:
                q.append(v-1) 
                distance[v-1] = distance[v] + 1
        if v + 1 < n:
            if distance[v+1] == INF:
                q.append(v+1)
                d = distance[v] + 1
                distance[v+1] = distance[v] + 1
        if v == x:
            if distance[y] == INF:
                q.append(y)
                distance[y] = distance[v] + 1
        if v == y:
            if distance[x] == INF:
                q.append(x)
                distance[x] = distance[v] + 1
    for i in range(n):
        ans[distance[i]] += 1

for i in range(1, n):
    ans[i] //= 2
    print(ans[i])
### BUGGY CODE ###

N = int(input())
C = input()

C = C.lstrip('R')

count = 0
while True:

    try:
        base_index = C[::-1].index('RW')
        target_index = C.index('W')
        base_index = len(C) - base_index - 1

        C = C[:target_index] + 'R' + C[target_index+1:base_index] + 'W' + C[base_index+1:]
        count += 1
    except ValueError:
        break

print(count)


### FIXED CODE ###

N = int(input())
C = list(input())

l = 0
r = N - 1
count = 0
while l < r:
    if C[l] == 'R' and C[r] == 'W':
        l += 1
        r -= 1
    elif C[l] == 'R' and C[r] == 'R':
        l += 1
    elif C[r] == 'W' and C[r] == 'W':
        r -= 1
    elif C[l] == 'W' and C[r] == 'R':
        l += 1
        r -= 1
        count += 1

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

#coding: utf-8
import math
from fractions import gcd

# GCDの約数を素因数分解する
def primeFactor(n):
    flg = 0
    count = 0
    i = 2

    if n == 1:
        return 1

    while i <= n:
        # print(str(i)+str(',')+str(gcd_cnt))
        if n % i == 0:
            if flg == 0:
                flg = 1
                count += 1
            n = n // i
        else:
            flg = 0
            i += 1
    # if flg == 1:
    #     count += 1
    count += 1
    return count


# # print(len(div))
m,n = map(int,input().split())
p = gcd(m,n)
ans = primeFactor(p)
print(ans)


### FIXED CODE ###

#coding: utf-8
from fractions import gcd
import math

# GCDの約数を素因数分解する
def primeFactor(n):
    flg = 0
    count = 0
    tmp = math.sqrt(n)
    i = 2

    if n == 1:
        return 1

    while i <= tmp:
        # print(str(i)+str(',')+str(gcd_cnt))
        if n % i == 0:
            if flg == 0:
                flg = 1
                count += 1
            n = n // i
        else:
            flg = 0
            i += 1
    # if flg == 1:
    #     count += 1
    # print(str('素数=')+str(count)+str(' n=')+str(n)+str(' i=')+str(i))
    if n > 1:
        count += 1
    # 1を足す
    count += 1
    return count


# # print(len(div))
m,n = map(int,input().split())
p = gcd(m,n)
# print(str('gcd=')+ str(p))
ans = primeFactor(p)
print(ans)
### BUGGY CODE ###

import numpy as np
from collections import Counter

n = int(input())
arr = np.array(list(map(int, input().split())))

arr.sort()
c = Counter(arr)

cnt = 0

while cnt < arr.shape[0]:
    arr = np.concatenate([np.array([arr[cnt]]), arr[np.where(arr % arr[cnt] != 0)[0]]])
    arr.sort()
    cnt += 1

result = set(arr) - {x for x, y in c.items() if y >= 2}

print(len(result))

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().split()))
arr.sort()

dp = [0] * (10**7)

cnt = 0
for i in range(n):
    if dp[arr[i]] == 0:
        for j in range(1, (10**6 + 10) // arr[i] + 1):
            dp[arr[i] * j] += 1
        if i < n - 1:
            if arr[i] == arr[i + 1]:
                continue
        cnt += 1
    else:
        continue

print(cnt)
### BUGGY CODE ###

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

tree = {}
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] = tree.get(a, []) + [b]

count = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    count[p] += x

stack = [1]
while stack:
    label = stack.pop()
    if tree.get(label):
        for next_label in tree[label]:
            count[next_label] += count[label]
        stack += tree[label]

print(*count[1:])


### FIXED CODE ###

import sys


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


def dfs(tree: dict, count: list) -> list:
    res = [0] * (N + 1)

    stack = [1]
    while stack:
        label = stack.pop()
        res[label] = count[label]
        if tree[label] != []:
            for next_label in tree[label]:
                count[next_label] += count[label]
            stack += tree[label]

    return res


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

tree = {}
for i in range(1, N + 1):
    tree[i] = []
for i in range(N - 1):
    a, b = map(int, input().split())
    tree[a] += [b]

count = [0] * (N + 1)
for i in range(Q):
    p, x = map(int, input().split())
    count[p] += x

ans = dfs(tree, count)
print(*ans[1:])
### BUGGY CODE ###

import itertools
import numpy as np
costs = []
N = int(input())
x, y = [], []
# (x,y)の値を取得
for n in range(N):
    temp = list(map(int, input().split()))
    x.append(temp[0])
    y.append(temp[1])
# コスト計算
for n, perm in enumerate(itertools.permutations(zip(x,y), N)):
    sol = 0
    cost = 1
    for i in range(1, N):
        if i == 1:
            sol = [perm[i][0] - perm[i-1][0], perm[i][1] - perm[i-1][1]]
        else:
            if perm[i][0] - sol[0] == perm[i-1][0] and perm[i][1] - sol[1] == perm[i-1][1]:
                cost += 0
            else:
                cost += 1
    costs.append(cost)
print(np.min(costs))

### FIXED CODE ###

N = int(input())
arr = sorted([list(map(int, input().split())) for _ in range(N)])
cnt = {}
for i in range(N):
    for j in range(i+1,N):
        pq = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
        cnt.setdefault(pq, 0)
        cnt[pq] += 1
print(1 if cnt == {} else N - max(cnt.values()))
### BUGGY CODE ###

N, Q = map(int, input().split(' '))
S = input()

for _ in range(Q):
    cnt = 0
    l, r = map(int, input().split(' '))
    p_S = S[l-1:r]
    for i in range(len(p_S)-1):
        if p_S[i:i+2] == 'AC':
            cnt += 1
    print(cnt)

### FIXED CODE ###

N, Q = map(int, input().split()) 
S = input()
tmp = [0] * (N+1)

for i in range(N):
    which = (1 if S[i : i + 2] == 'AC' else 0)
    tmp[i + 1] = tmp[i] + which
for _ in range(Q):
    l, r = map(int, input().split())
    print(tmp[r-1] - tmp[l-1])
### BUGGY CODE ###

if __name__ == '__main__':
	N, X, Y = map(int, input().split())

	ans = [0] * (N - 1)

	for i in range(1,N):
		for j in range(i+1,N+1):
			l1 = abs(j-i)
			l2 = abs(X-i) + 1 + abs(j-Y)
			l3 = abs(Y-i) + 1 + abs(j-X)
			lm = min(l1,l2,l3)
			ans[lm - 1] += 1

	for k in range(N-1):
		print(ans[k])

### FIXED CODE ###

if __name__ == '__main__':
	N, X, Y = map(int, input().split())

	ans = [0] * (N - 1)

	for i in range(1,N):
		for j in range(i+1,N+1):
			l1 = abs(j-i)
			l2 = abs(X-i) + 1 + abs(j-Y)
			lm = min(l1,l2)
			ans[lm - 1] += 1

	for k in range(N-1):
		print(ans[k])
### BUGGY CODE ###

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

def quicksort(a):
  if len(set(a)) < 2:
    return a
  left = []
  center = a.pop(0)
  right = []
  for i in a:
    if center > i:
      left.append(i)
    else:
      right.append(i)
  left = quicksort(left)
  right = quicksort(right)
  left.append(center)
  left.extend(right)
  return left

D = quicksort(D)

left = D[int((N/2)-1)]
right = D[int(N/2)]
ans = 0
if left < right:
  ans = right - left
print(ans)



### FIXED CODE ###

N = int(input())
d = list(map(int, input().split()))
d.sort()
middle = (N // 2) -1
print(d[middle+1] - d[middle])
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
L = []
for i in range(M):
    L.append(list(map(int, input().split())))
for i in range(M):
    for j in range(L[i][0]):
        A.append(L[i][1])
sA = sorted(A, reverse = True)
print(sum(sA[:N]))


### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
K = [1] * N
L = list(zip(K,A))
for i in range(M):
	L.append(list(map(int, input().split())))
S = sorted(L, key = lambda x:x[1], reverse = True)
sum = 0
cnt = 0
for i in range(N):
	if N - cnt <= S[i][0]:
		sum += S[i][1] * (N - cnt)
		break
	else:
		sum += S[i][1] * S[i][0]
		cnt += S[i][0]
print(sum)
### BUGGY CODE ###

from collections import deque
n = int(input())
A = deque(sorted(list(map(int, input().split())), reverse = True))

ans = 0
while len(A) > 0:    
    f = 0
    ans += 1
    s = A.pop()
    N = deque([])
    if len(A) == 0:
        break
    else:
        for i in range(len(A)):
            t = A.popleft()
            if t == s:
                f = 1
            elif t % s == 0:
                f = 0
                pass
            else:
                N.append(t)

        A = N
        #print(A)

        if f == 1:
            ans -= 1
        else:
            pass

print(ans)

### FIXED CODE ###

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

Cnt = [0 for i in range(10**6 + 8)]
for i in A:
    if Cnt[i] != 0:
        Cnt[i] = 2
        continue
    else:
        pass
    for j in range(i, 10**6 + 8, i):
        Cnt[j] += 1

ans = 0
for i in A:
    if Cnt[i] == 1:
        ans += 1
    else:
        pass

print(ans)