Problem:
 Score : 400 points    Problem Statement  We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:   For each i=1,2,...,N-1 , there is an edge between Vertex i and Vertex i+1 .  There is an edge between Vertex X and Vertex Y .   For each k=1,2,...,N-1 , solve the problem below:   Find the number of pairs of integers (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j in G is k .       Constraints   3 \leq N \leq 2 \times 10^3  1 \leq X,Y \leq N  X+1 < Y  All values in input are integers.         Input  Input is given from Standard Input in the following format:  N  X  Y       Output  For each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.        Sample Input 1 5 2 4      Sample Output 1 5
4
1
0  The graph in this input is as follows:     There are five pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 1 : (1,2)\,,(2,3)\,,(2,4)\,,(3,4)\,,(4,5) . There are four pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 2 : (1,3)\,,(1,4)\,,(2,5)\,,(3,5) . There is one pair (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 3 : (1,5) . There are no pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 4 .       Sample Input 2 3 1 3      Sample Output 2 3
0  The graph in this input is as follows:           Sample Input 3 7 3 7      Sample Output 3 7
8
4
2
0
0       Sample Input 4 10 4 8      Sample Output 4 10
12
10
8
4
1
0
0
0

Solution (Python):
n,x,y=map(int,input().split())
x-=1
y-=1
half=(x+y)//2
ans=[0]*n
for i in range(n):
    for j in range(i,n):
        if i<=x:
            if j<=half:
                ans[j-i]+=1
            else:
                ans[x-i+1+abs(y-j)]+=1
        elif x<i and i<=y:
            ans[min(j-i,i-x+1+abs(y-j))]+=1
        else:
            ans[j-i]+=1
for i in range(1,n):
    print(ans[i])

Solution (Python):
N, X, Y = [int(_) for _ in input().split()]

INF = 10 ** 9
dp = [[INF] * N for _ in range(N)]

for i in range(N - 1):
    for j in range(i + 1, N):
        dp[i][j] = j - i
        dp[j][i] = j - i

dp[X - 1][Y - 1] = 1
dp[Y - 1][X - 1] = 1

for k in [X - 1, Y - 1]:
    for i in range(N):
        for j in range(N):
            
            dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])

cnt = [0] * N
for i in range(N):
    for j in range(i + 1, N):
        v = dp[i][j]
        cnt[v] += 1
for i in range(1, N):
    print(cnt[i])

Solution (Python):
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7


def lcm(a, b): return a * b / gcd(a, b)





def LI(): return list(map(int, sys.stdin.buffer.readline().split()))




def I(): return int(sys.stdin.buffer.readline())





def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()




def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')







def IR(n): return [I() for i in range(n)]







def LIR(n): return [LI() for i in range(n)]







def SR(n): return [S() for i in range(n)]







def LSR(n): return [LS() for i in range(n)]







def SRL(n): return [list(S()) for i in range(n)]


def main():
    n, x, y = LI()
    d = [0]*n
    for i in range(1, n):
        for j in range(i + 1, n + 1):
            d[min(j - i, abs(x - i) + 1 + abs(j - y)) - 1] += 1
    for k in range(n-1):
        print(d[k])


if __name__ == "__main__":
    main()

Solution (Python):
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7


def lcm(a, b): return a * b / gcd(a, b)





def LI(): return list(map(int, sys.stdin.buffer.readline().split()))




def I(): return int(sys.stdin.buffer.readline())





def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()




def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')







def IR(n): return [I() for i in range(n)]







def LIR(n): return [LI() for i in range(n)]







def SR(n): return [S() for i in range(n)]







def LSR(n): return [LS() for i in range(n)]







def SRL(n): return [list(S()) for i in range(n)]


def main():
    n, x, y = LI()
    d = [0]*n
    for i in range(1, n):
        for j in range(i + 1, n + 1):
            d[min(j - i, abs(x - i) + 1 + abs(j - y),
                  abs(y - i) + 1 + abs(j - x)) - 1] += 1
    for k in range(n-1):
        print(d[k])


if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque

N, X, Y = map(int, input().split())

dist = [[0 for _ in range(N)] for _ in range(N)]
ans = [0 for _ in range(N)]

for i in range(N):
    for j in range(N):
        tmp1 = abs(i - X + 1) + abs(j - Y + 1) + 1
        tmp2 = abs(i - Y + 1) + abs(j - X + 1) + 1

        dist[i][j] = min(abs(i - j), tmp1, tmp2)
        dist[j][i] = min(abs(i - j), tmp1, tmp2)

for i in range(N):
    for j in range(i+1, N):
        ans[dist[i][j]-1] += 1

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

Solution (Python):

def search(start, N, X, Y):
    dist = [0 for _ in range(N)]
    if start <= X:
        for i in range(X):
            dist[i] = abs(start - i)
        for i in range(Y, N):
            dist[i] = (X - start) + 1 + (i - Y)
        for i in range(X, (Y - X) // 2 + X + 1):
            dist[i] = (i - start)
        for i in range((Y - X) // 2 + X + 1, Y):
            dist[i] = (X - start) + 1 + (Y - i)
    elif start >= Y:
        for i in range(Y, N):
            dist[i] = abs(start - i)
        for i in range(X):
            dist[i] = (start - Y) + 1 + (X - i)
        for i in range(X, (Y - X) // 2 + X):
            dist[i] = (start - Y) + 1 + (i - X)
        for i in range((Y - X) // 2 + X, Y):
            dist[i] = (start - i)
    else:
        toX = min(start - X, Y - start + 1)
        toY = min(Y - start, start - X + 1)
        dist[start] = 0
        for i in range(X):
            dist[i] = (X - i) + toX
        for i in range(Y, N):
            dist[i] = toY + (i - Y)
        for i in range(X, start):
            dist[i] = min(start - i, Y - start + 1 + i - X)
        for i in range(start + 1, Y):
            dist[i] = min(i - start, start - X + 1 + Y - i)
    return dist


def main():
    N, X, Y = [int(n) for n in input().split(" ")]
    

    X = X - 1
    Y = Y - 1

    lenD = []
    for i in range(N):
        d = search(i, N, X, Y)
        lenD.append(d)

    kcounter = [0 for _ in range(N - 1)]

    for i in range(N):
        for j in range(i + 1, N):
            k = lenD[i][j]
            kcounter[k - 1] += 1

    for k in kcounter:
        print(k)

main()

Solution (Python):
N, X, Y = [int(_) for _ in input().split()]
X -= 1
Y -= 1

V = [0 for _ in range(N)]
for i in range(N):
    for j in range(i+1, N):
        v1 = j - i
        v2 = abs(i - X) + abs(j - Y) + 1
        V[min(v1, v2)] += 1
        
for v in V[1:]:
    print(v)

Solution (Python):
n,x,y=map(int,input().split())

a=[0]*n




for i in range(1,n+1):
    for j in range(i+1,n+1):
        s=min(j-i,abs(x-i)+abs(y-j)+1)
        a[s-1]+=1
        s=10000000

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

Solution (Python):
import math
import itertools
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N, X, Y =map(int,input().split())

L = [i for i in range(1,N+1)]
c_list = list(itertools.combinations(L,2))

Answer = {}
for i in range(1,N):
    inti = str(i)
    Answer[inti] = 0
def des(a,b):
    if b <= X or a >=  Y:
        return (b-a)
    else:
        return min(b-a, abs(Y-b)+abs(X-a)+1)
for cl in c_list:
    a = cl[0]
    b = cl[1]
    inti = des(a,b)
    inti = str(inti)
    Answer[inti] += 1
for n, m in Answer.items():
    print(m)

Solution (Python):
n, x, y = map(int, input().split())
ans = [0 for _ in range(n)]

for i in range(1, n+1):
    for j in range(i+1, n+1):
        a = min(abs(i-j), abs(x-i)++abs(j-y)+1, abs(y-i)+abs(j-x)+1)
        ans[a] += 1
for i in range(1, n):
    print(ans[i])

Solution (Python):
N,X,Y = map(int,input().split())
a = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    ans = min(j-i,abs(X-i)+1+abs(Y-j),abs(X-j)+1+abs(Y-i))
    a[ans -1] += 1
for item in a:
  print(item)

Solution (Python):
N, X, Y = map(int, input().split())
A = [N - i for i in range(1, N)]
for i in range(N-1):
  for j in range(i+1, N):
    c = min(abs(X-i-1)+abs(Y-j-1)+1, abs(X-j-1)+abs(Y-i-1)+1)
    if c < j-i:
      A[j-i-1] -= 1
      A[c-1] += 1
for a in A:
  print(a)

Solution (Python):
N, X, Y = [int(x) for x in input().split()]

counter = [0] * N
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        d = min(abs(i - j), abs(i - X) + abs(j - Y) + 1, abs(i - Y) + abs(j - X) + 1)
        counter[d] += 1

for i in range(1, N):
    print(counter[i])

Solution (Python):
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,x,y = readInts()

d = defaultdict(int)

for i in range(1,n+1):
	for j in range(i+1,n+1):
		d[min(abs(i-j),abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(j-x))]+=1

for i in range(1,n):
	print(d[i])

Solution (Python):
from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,x,y = readInts()

d = defaultdict(int)

for i in range(1,n+1):
	for j in range(1,n+1):
		d[min(abs(i-j),abs(i-x)+1+abs(y-j),abs(i-y)+1+abs(j-x))]+=1

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

Solution (Python):
n,x,y = map(int, input().split())
lis = [0] * n
x -= 1
y -= 1

for i in range(n):
    for j in range(i+1, n):
        t = min(abs(i-j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
        lis[t] += 1

for i in range(1,n):
    print(lis[i])

Solution (Python):
n, x, y = map(int, input().split())
a = [0]*(n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        b = min(j-i, abs(x-i)+1+abs(y-j))
        a[b-1] += 1
print(*a, sep="\n")

Solution (Python):
from numba import njit


@njit(cache=True)
def solve(n,x,y):
    ans = [0] * (n - 1)
    for i in range(n):
        for j in range(n):
            c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
            if c:
                ans[c-1] += 1
    return ans


n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = solve(n,x,y)
for ai in ans:
    print(ai//2)

Solution (Python):
from numba import njit,prange


@njit(cache=True,parallel=True)
def solve(n,x,y):
    ans = [0] * (n - 1)
    for i in prange(n):
        for j in prange(n):
            c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
            if c:
                ans[c-1] += 1
    return ans


n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = solve(n,x,y)
for ai in ans:
    print(ai//2)

Solution (Python):
from numba import njit,prange


@njit(parallel=True)
def solve(n,x,y):
    ans = [0] * (n - 1)
    for i in prange(n):
        for j in prange(n):
            c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
            if c:
                ans[c-1] += 1
    return ans


n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = solve(n,x,y)
for ai in ans:
    print(ai//2)

Solution (Python):
n, x, y = map(int, input().split())
ans = [0] * (n - 1)

x -= 1
y -= 1
for i in range(n):
    for j in range(n):
        c = min(abs(i - j), abs(i-x)+abs(j-y)+1,abs(i-y)+abs(j-x)+1)
        if c:
            ans[c-1] += 1

for ai in ans:
    print(ai//2)

Solution (Python):
def 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):
            
            d1 = abs(j-i)
            
            d2 = abs(x-i) + 1 + abs(j-y) 
            
            d3 = abs(y-i) + 1 + abs(j-x)
            dist = min(min(d1, d2), d3)
            ans[dist] += 1
    print(*ans[1:n], sep='\n')

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, x, y = map(int, input().split())
    ans = [0] * (n+1)
    d = list()
    for i in range(1, n):
        for j in range(i+1, n+1):
            
            d1 = abs(j-i)
            
            d2 = abs(x-i) + 1 + abs(j-y) 
            
            d3 = abs(y-i) + 1 + abs(j-x)
            dist = min(min(d1, d2), d3)
            d.append(dist)
            ans[dist] += 1
    print(*ans[1:n], sep='\n')

if __name__ == '__main__':
    main()

Solution (Python):
N, X, Y = map(int, input().split())


def f(i, j):
    v1 = j - i
    v2 = abs(X - i) + 1 + abs(j - Y)
    v3 = abs(Y - i) + 1 + abs(j - X)
    return min(v1, v2, v3)


D = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = f(i, j)
        D[d] += 1

for d in D[1:]:
    print(d)

Solution (Python):
n,x,y=map(int,input().split())
anslist = [0]*(n)
temp = 0
for i in range(1,n):
    for j in range(i+1,n+1):
        temp = min(abs(j-i),(abs(x-i)+1+abs(y-j)),(abs(y-i)+1+abs(x-j)))
        anslist[temp] += 1

anslist.pop(0)

for i in anslist:
    print(i)

Solution (Python):
n, x, y = map(int, input().split())
counter = {i + 1: 0 for i in range(n - 1)}

for i in range(n - 1):
  for j in range(i + 1, n):
    k = min(j - i, abs(x - 1 - i) + abs(y - 1 - j) + 1)
    counter[k] += 1

print(*[counter[i + 1] for i in range(n - 1)], sep='\n')

Solution (Python):
from collections import defaultdict

N, X, Y = map(int, input().split())
cnt_dict = defaultdict(int)

for i in range(1,N):
    for j in range(i+1, N+1):
        if j<=X or i>=Y:
            path = j-i
        else:
            path = min(j-i, abs(X-i)+abs(j-Y)+1)
        cnt_dict[path] += 1

for i in range(1,N):
    print(cnt_dict[i])

Solution (Python):
N, X, Y = map(int, input().split())
ans = [0] * N
for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        dist = min(abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(Y - i) + 1 + abs(X - j))
        ans[dist] += 1
for a in ans[1:]:
    print(a)

Solution (Python):
from collections import deque

N, X, Y = map(int, input().split())

ans_list = [0 for _ in range(N-1)]

for i in range(1, N+1): 
    for j in range(i+1, N+1): 
        ans1 = j - i
        ans2 = abs(i-X) + 1 + abs(j-Y)
        ans_list[min(ans1, ans2)-1] += 1
print(*ans_list, sep="\n")

Solution (Python):

import sys

input = sys.stdin.readline


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


N, X, Y = MI()
cnt = [0] * N

for i in range(1, N + 1):
    for j in range(i + 1, N + 1):
        idx = min(j - i, abs(X - i) + abs(Y - j) + 1)
        cnt[idx] += 1

for c in cnt[1:]:
    print(c)

Solution (Python):
n,x,y = map(int,input().split())

l= [0]*n

for i in range(1,n+1):
    for j in range(i+1,n+1):
        k = min(abs(j-i),abs(x-i)+1+abs(j-y))
        l[k] += 1

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

Solution (Python):
def resolve():
    N, X, Y = list(map(int, input().split()))
    X -= 1
    Y -= 1
    dists = [[0 for _ in range(N)] for __ in range(N)]
    for i in range(N):
        for j in range(i+1, N):
            dists[i][j] = min(j-i, abs(X-i)+abs(Y-j)+1)
    counts = [0 for _ in range(N)]
    for i in range(N):
        for j in range(i+1, N):
            counts[dists[i][j]] += 1
    for i in range(1, N):
        print(counts[i])


if '__main__' == __name__:
    resolve()

Solution (Python):
def main():
  N, X, Y = map(int, input().split())
  G = [[i] for i in range(1,N+1)]
  ans=[0]*(N-1)
  for i in range(1,N+1):
    for j in range(i+1,N+1):
      d = min(j-i, abs(X-i)+1+abs(j-Y), abs(Y-i)+1+abs(j-X))
      
      ans[d-1]+=1
  for a in ans:
    print(a)

if __name__=='__main__':
  main()

Solution (Python):
def mlt(): return map(int, input().split())


x, a, b = mlt()

dp = [0 for n in range(x)]

for n in range(1, x+1):
    for k in range(n+1, x+1):
        d1 = k-n
        d2 = abs(a-n)+1+abs(b-k)
        ds = min(d1, d2)
        dp[ds] += 1

print(*dp[1:], sep='\n')

Solution (Python):
N,X,Y=map(int,input().split())
A=[0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    A[min(j-i,abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))-1]+=1
for a in A:
  print(a)

Solution (Python):
N,X,Y=map(int,input().split())

if Y<X:
    X,Y=Y,X

Dist=[0 for i in range(N)]

for i in range(1,N):
    for j in range(i,N+1):
        dist_a=j-i
        dist_b=abs(i-X)+abs(j-Y)+1
        ans=min(dist_a,dist_b)
        Dist[ans]+=1

for i in range(1,N):
    print(Dist[i])

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,x,y=nii()
x-=1
y-=1
ans=[0 for i in range(n)]

for i in range(n-1):
  for j in range(i+1,n):
    dist1=j-i
    dist2=abs(i-x)+1+abs(j-y)
    dist=min(dist1,dist2)
    ans[dist]+=1

for i in ans[1:]:
  print(i)

Solution (Python):
n, x, y = map(int, input().split())
L1 = x - 1
L2 = n - y
C = y - x + 1
for k in range(1, n):
    ans = 0
    if 2 * k == C:
        ans += C // 2
    elif 2 * k < C:
        ans += C
    for L in L1, L2:
        if C % 2 == 0 and 0 < k - C // 2 <= L:
            ans += 1
        ans += max(0, (min(L, k-1) - max(1, k - (C - 1) // 2) + 1) * 2) + (L >= k)
    ans += max(0, L1 + L2 + 2 - k) - sum(k <= x for x in [L1, L2+1, L2, L1+1]) + (k == 1)
    print(ans)

Solution (Python):
n,x,y=map(int,input().split())

ans=[0 for _ in range(n-1)]

for i in range(n-1):
  for j in range(i+1,n):
    t=i+1
    u=j+1
    H=min(abs(u-t),abs(t-x)+1+abs(y-u),abs(t-y)+1+abs(x-u))
    ans[H-1]+=1
    
for l in ans:
  print(l)

Solution (Python):
n,x,y=map(int,input().split())

ans=[0 for _ in range(n-1)]

for i in range(n-1):
  for j in range(i+1,n):
    t=i+1
    u=j+1
    H=min(abs(u-t),abs(t-x)+1+abs(y-u),abs(t-y)+1+abs(x-u))
    ans[H-1]+=1
    
for l in ans:
  print(l)

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

from collections import deque
def bfs(u, n, g):
    queue = deque([u])
    d = [None] * n 
    d[u] = 0 
    while queue:
        v = queue.popleft()
        for i in g[v]:
            if d[i] is None:
                d[i] = d[v] + 1
                queue.append(i)
    return d

N, X, Y =MI()
E = [[] for _ in range(N + 1)]
for i in range(1, N):
    a = i
    b = i + 1
    E[a].append(b)
    E[b].append(a)
E[X].append(Y)
E[Y].append(X)

dist = [0] * N

for i in range(1, N + 1):
    D = deque(bfs(i, N + 1, E))
    D.popleft()
    for d in D:
        dist[d] += 1

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, X, Y = mapint()
X, Y = X-1, Y-1
dist = [0]*(N-1)
for i in range(N-1):
    for j in range(i+1, N):
        d = min(j-i, abs(i-X)+abs(j-Y)+1, abs(i-Y)+abs(j-X)+1)
        dist[d-1] += 1
for k in range(N-1):
    print(dist[k])

Solution (Python):


from pprint import pprint
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)









N, X, Y = map(int, input().split())

X -= 1
Y -= 1

count_dict = defaultdict(int)


for s in range(N - 1):
    for t in range(s + 1, N):
        dist = min(t - s, abs(X - s) + 1 + abs(t - Y))
        count_dict[dist] += 1

for k in range(1, N):
    ans = 0
    if k in count_dict:
        ans = count_dict[k]
    print(ans)

Solution (Python):
from collections import Counter
n, x, y = map(int, input().split())
c = Counter()
for i in range(1, n):
    for j in range(i+1, n+1):
        dist = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        c[dist] += 1

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

Solution (Python):
from collections import deque

N, X, Y = [int(x) for x in input().split()]
result = {x: 0 for x in range(N)}


X -= 1
Y -= 1


for i in range(N):

    queue = deque()
    visited = set()

    
    queue.appendleft((i, 0))

    while queue:
        now_pos, distance = queue.pop()

        
        
        if not now_pos in visited:
            result[distance] += 1
            visited.add(now_pos)

        
        
        if now_pos - 1 >= 0:
            if not now_pos - 1 in visited:
                queue.appendleft((now_pos - 1, distance + 1))

        if now_pos + 1 < N:
            if not now_pos + 1 in visited:
                queue.appendleft((now_pos + 1, distance + 1))

        if now_pos == X:
            if not Y in visited:
                queue.appendleft((Y, distance+1))

        if now_pos == Y:
            if not X in visited:
                queue.appendleft((X, distance+1))

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

Solution (Python):
import heapq
INFTY = 10**4
N,X,Y = map(int,input().split())
G = {i:[] for i in range(1,N+1)}
for i in range(1,N):
    G[i].append(i+1)
    G[i+1].append(i)
G[X].append(Y)
G[Y].append(X)
dist = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
for i in range(N+1):
    dist[i][i] = 0
for i in range(1,N+1):
    hist = [0 for _ in range(N+1)]
    heap = [(0,i)]
    hist[i] = 1
    while heap:
        d,x = heapq.heappop(heap)
        if d>dist[i][x]:continue
        hist[x] = 1
        for y in G[x]:
            if hist[y]==0:
                if dist[i][y]>d+1:
                    dist[i][y] = d+1
                    heapq.heappush(heap,(d+1,y))
C = {k:0 for k in range(1,N)}
for i in range(1,N):
    for j in range(i+1,N+1):
        C[dist[i][j]] += 1
for k in range(1,N):
    print(C[k])

Solution (Python):
import sys

N, X, Y = map(int, sys.stdin.readline().split())

ans = [0] * (N-1)
for i in range(1, N):
    for j in range(i+1, N+1):
        k = min((j - i, abs(X - i) + 1 + abs(j - Y), abs(X - j) + 1 + abs(i - Y)))
        
        ans[k-1] += 1


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

Solution (Python):
N,X,Y = map(int,input().split())
X-=1;Y-=1
ans = [0 for _ in range(N-1)]
for i in range(N):
  for j in range(i+1,N):
    direct = j-i
    shortcut = abs(X-i)+1+abs(Y-j)
    shortest = min(direct,shortcut)
    ans[shortest-1] += 1
print(*ans,sep="\n")

Solution (Python):
from collections import deque

N,X,Y= map(int,input().split())

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

root[X-1].append(Y-1)
root[Y-1].append(X-1)

ans = [0]*(N-1)

for i in range(N):
    stack=deque([i])
    check = [-1]*N
    check[i] = 0

    while len(stack)>0:
        v = stack.popleft()
        for i in root[v]:
            if check[i] == -1:
                check[i]=check[v]+1
                stack.append(i)
    
    for ch in check:
        if ch > 0:
            ans[ch-1] += 1

for aa in ans:
    print(aa//2)

Solution (Python):
from collections import defaultdict

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

d = defaultdict(int)

for i in range(1, n):
    for j in range(i + 1, n + 1):
        d[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1

for i in range(1, n):
    print(d[i])

Solution (Python):
n,x,y=map(int,input().split())

ans=[0]*n

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

for i in range(1,n):
    tree[i-1].append(i)
    tree[i].append(i-1)

tree[x-1].append(y-1)
tree[y-1].append(x-1)

from collections import deque

ans=[0]*n
for i in range(n):
    checked=[-1]*n
    stack=deque([i])
    checked[i]=0
    while len(stack)>0:
        tmp=stack.popleft()
        for item in tree[tmp]:
            if checked[item]==-1:
                checked[item]=checked[tmp]+1
                stack.append(item)
    for item in checked:
        ans[item]+=1

for item in ans[1:]:
    print(item//2)

Solution (Python):
from collections import deque

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

adj[X-1].append(Y-1)
adj[Y-1].append(X-1)

dist = [[-1]*N for _ in range(N)]

for i in range(N):
    queue = deque([i])
    dist[i][i] = 0

    while queue:
        now = queue.popleft()
        for u in adj[now]:
            if dist[i][u] < 0:
                queue.append(u)
                dist[i][u] = dist[i][now] + 1

ans = [0] * (N-1)
for i in range(N):
    for j in range(i+1,N):
        ans[dist[i][j]-1] += 1

[print(a) for a in ans]

Solution (Python):
n,x,y = map(int, input().split())

ans = [0]*n
for i in range(1,n):
    for j in range(i+1,n+1):
        v1 = j-i
        v2 = abs(x-i) + 1 + abs(y-j)
        v3 = abs(y-i) + 1 + abs(x-j)
        minv = min(v1,v2,v3)
        ans[minv] += 1

for a in ans[1:]:
    print(a)

Solution (Python):
import collections

N, X, Y = [int(x) for x in input().split()]

c = collections.Counter()

for i in range(1, N + 1):
    for j in range(i, N + 1):
        if (i == X and j == Y) or (i == Y and j == X):
            c[1] += 1
        else:
            c[min([j - i, abs(X - i) + 1 + abs(Y - j), abs(X - j) + 1 + abs(Y - i)])] += 1

for i in range(1, N):
    print(c[i])

Solution (Python):

def main():
    from collections import deque
        
    N, X, Y = map(int, input().split())

    G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
    G[X - 1].append(Y - 1)
    G[Y - 1].append(X - 1)

    dist = [[-1] * N for _ in [0] * N]
    for start in range(N):
        q = deque([start])
        dist[start][start] = 0
        while q:
            now = q.popleft()
            for next in G[now]:
                if dist[start][next] == -1:
                    dist[start][next] = dist[start][now] + 1
                    q.append(next)
    res = [0] * N
    for i in range(N):
        for j in range(i + 1, N):
            res[dist[i][j]] += 1
    for d in range(1, N):
        print(res[d])


if __name__ == '__main__':
    main()

Solution (Python):

def main():
    from collections import deque
        
    N, X, Y = map(int, input().split())

    G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
    G[X - 1].append(Y - 1)
    G[Y - 1].append(X - 1)

    dist = [[-1] * N for _ in [0] * N]
    for s in range(N):
        q = deque([s])
        dist[s][s] = 0
        while q:
            v = q.popleft()
            for nv in G[v]:
                if dist[s][nv] == -1:
                    dist[s][nv] = dist[s][v] + 1
                    q.append(nv)
    res = [0] * N
    for i in range(N):
        for j in range(i + 1, N):
            res[dist[i][j]] += 1
    for d in range(1, N):
        print(res[d])


if __name__ == '__main__':
    main()

Solution (Python):
import heapq

def dijkstra(s):  
    hq = [(0, s)]  
    heapq.heapify(hq) 
    cost = [float('inf')] * n 
    cost[s] = 0 
    while hq:
        c, v = heapq.heappop(hq)
        if c > cost[v]: 
            continue
        for d, u in e[v]:
            tmp = d + cost[v]
            if tmp < cost[u]:
                cost[u] = tmp
                heapq.heappush(hq, (tmp, u))
    return cost


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

e[x-1].append((1,y-1))
e[y-1].append((1,x-1))

ans=[0]*(n-1)

for i in range(n):
  xxx=dijkstra(i)
  for j in xxx:
    ans[j-1]+=1

ans[-1]=0

for i in ans:
  print(i//2)

Solution (Python):
from collections import Counter
def main():
    n,x,y=map(int,input().split())
    x,y=x-1,y-1
    ans=[]
    for i in range(n):
        dp = [n]*n
        dp[i] = 0
        calcstep(i, dp)
        dp[y] = min(dp[y], dp[x]+1)
        dp[x] = min(dp[x], dp[y]+1)
        calcstep(x, dp)
        calcstep(y, dp)
        
        ans += dp
    ans = Counter(ans)
    for i in range(1,n):
        print(ans[i]//2)

def calcstep(i, dp):
    for j in range(i, len(dp)-1):
        if dp[j+1] > dp[j]+1:
            dp[j+1] = dp[j]+1
        else:
            break
    for j in range(1,i+1)[::-1]:
        if dp[j-1] > dp[j]+1:
            dp[j-1] = dp[j]+1
        else:
            break

if __name__ == "__main__":
    main()

Solution (Python):
n,x,y=map(int,input().split())

ans=0
ans=[0]*(n-1)
for i in range(1,n+1):
  for j in range(i+1,n+1):
    now=min(j-i,abs(j-y)+abs(i-x)+1)
    ans[now-1]+=1

for i in ans:
  print(i)

Solution (Python):
n,x,y=map(int,input().split())
dp=[0]*n
for i in range(1,n):
  for j in range(i+1,n+1):
    cnt=min(j-i,1+abs(x-i)+abs(y-j))
    dp[cnt]+=1
for k in range(1,n):
  print(dp[k])

Solution (Python):
def main():

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

    cnt = 0

    ans=[0]*n

    for i in range(1,n+1):
        for j in range(i+1,n+1):
            d = min(j-i,abs(x-i)+abs(y-j)+1)
            ans[d] += 1

    for i in range(1,n):
        print(ans[i])
   
if __name__ == "__main__":
    main()

Solution (Python):
n, x, y = map(int,input().split())

cnt = 0

ans=[0]*n

for i in range(1,n+1):
    for j in range(i+1,n+1):
        d = min(j-i,abs(x-i)+abs(y-j)+1)
        ans[d] += 1
for i in range(1,n):
    print(ans[i])

Solution (Python):
n,x,y = map(int,input().split())
ans_ls = [0] * (n-1)
for start in range(1,n):
    for end in range(start+1,n+1):
        cost_1 = end - start
        cost_2 = abs(start - x) + abs(end - y) + 1
        cost = min(cost_1,cost_2)
        ans_ls[cost-1] += 1
for ans in ans_ls:
    print(ans)

Solution (Python):
N, X, Y = list(map(int, input().split()))

dist_cnt = [0]*N

for i in range(1, N):
    for j in range(i+1, N+1):
        dist = min([j-i, abs(i - X) + abs(j - Y) + 1])
        dist_cnt[dist] += 1

for i in range(1, N):
    print(dist_cnt[i])

Solution (Python):
n,x,y=map(int,input().split())



def min_route_count(i,j):
  return min(abs(j-i),abs(j-y)+1+abs(x-i))

ans_list=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    ans_list[min_route_count(i,j)-1]+=1
    
for t in range(n-1):
  print(ans_list[t])

Solution (Python):
n,x,y=map(int,input().split())



def min_route_count(i,j):
  return min(abs(j-i),abs(j-y)+1+abs(x-i))

ans_list=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    ans_list[min_route_count(i,j)-1]+=1
    
for t in range(n-1):
  print(ans_list[t])

Solution (Python):
def main():
    n, x, y = map(int, input().split())
    ans = [0]*(n)
    for i in range(1, n):
        for j in range(i+1, n+1):
            ans[min(j-i, abs(x-i)+abs(y-j)+1)] += 1
    for v in ans[1:]:
        print(v)

if __name__ == "__main__":
    main()

Solution (Python):
from itertools import combinations
N, X, Y = map(int, input().split())
N_lst = [i for i in range(1, N + 1)]
michi = combinations(N_lst, r = 2)
dis = [0 for _ in range(N + 1)]
for i,j in michi:
    seiki = j - i
    betsu = abs(j-Y) + 1 + abs(X-i)
    if seiki <= betsu:
        dis[seiki] += 1
    else:
        dis[betsu] += 1
for h in range(1, N):
    print(dis[h])

Solution (Python):
n,x,y = map(int, input().split())
g = [0]*(n)
for i in range(1,n+1):
  for j in range(1,i):
    e = abs(y-i)+1+abs(x-j)
    f = i-j
    g[min(e,f)]+=1
for i in g[1:]:
  print(i)