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):

import collections


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

    inf = 10**9

    
    def pus(v, d, dist, q):
        if dist[v] == inf:
            dist[v] = d
            q.append(v)
        return 0

    ans = [0]*N

    for i in range(N):
        dist = [inf]*N
        q = collections.deque()
        pus(i, 0, dist, q)
        while len(q) != 0:
            v = q.popleft()
            d = dist[v]
            if (v-1 >= 0):
                pus(v-1, d+1, dist, q)
            if (v+1 < N):
                pus(v+1, d+1, dist, q)
            if v == X-1:
                pus(Y-1, d+1, dist, q)
            if v == Y-1:
                pus(X-1, d+1, dist, q)
        for i in range(N):
            ans[dist[i]] = ans[dist[i]]+1
    for i in range(1, N):
        print(ans[i]//2)


if __name__ == "__main__":
    solve()

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

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

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

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                
                count[dis[i][k] - 1] += 1 
                
        

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)

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

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

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

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)

Solution (Python):
from collections import deque
def main():
    n, x, y = map(int, input().split())
    g = dict()
    for i in range(n):
        if i == 0:
            g[i] = [i+1]
        elif i == n-1:
            g[i] = [i-1]
        else:
            g[i] = [i-1, i+1]
    g[x-1].append(y-1)
    g[y-1].append(x-1)
    distance = [0]*(n-1)

    for i in range(n):
        queue = deque()
        visited = [0]*n
    
        queue.append(i)
        while queue:
            target = queue.popleft()
            for j in g[target]:
                if visited[j] == 0 or visited[j] > visited[target] + 1:
                    visited[j] = visited[target] + 1
                    queue.append(j)
        for k, a in enumerate(visited):
            if k > i:
                if a >= 1:
                    distance[a-1] += 1
    
    for l in distance:
        print(l)

if __name__ == "__main__":
    main()

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

g = [[] for _ in range(N)]
for i in range(N - 1):
    u = i
    v = i + 1
    g[u].append(v)
    g[v].append(u)
g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[0] * N for _ in range(N)]
def bfs(i):
    visited = [False] * N
    que = deque([i])
    dis[i][i] = 0
    visited[i] = True
    
    while que:
        p = que.popleft()
        for new in g[p]:
            if visited[new]:
                continue
            else:
                visited[new] = True
                que.append(new)
                dis[i][new] = dis[i][p] + 1
                count[dis[i][new] - 1] += 1

count = [0] * (N - 1)
for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)

Solution (Python):
from _collections import deque
N,X,Y=map(int,input().split())
X-=1
Y-=1
inf=pow(10,9)
answers=[0]*N
def bfs(n):
    visited_point=[inf for _ in range(N)]
    visited_point[n]=0
    stack=deque([n])
    while len(stack)>0:
        x=stack.pop()
        if x==X and visited_point[Y]==inf:
            visited_point[Y]=visited_point[x]+1
            stack.appendleft(Y)
        if x==Y and visited_point[X]==inf:
            visited_point[X]=visited_point[x]+1
            stack.appendleft(X)
        for nx in (1,-1):
            new_n=x+nx
            if new_n<0 or new_n>=N:
                continue
            if visited_point[new_n]==inf:
                visited_point[new_n]=visited_point[x]+1
                stack.appendleft(new_n)
    for i in visited_point:
        answers[i]+=1
for a in range(N):
    bfs(a)
for b in range(1,N):
    print(answers[b]//2)

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

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

Solution (Python):
from collections import deque


n, x, y = map(int, input().split())
g = dict()
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1, i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

distance = [0]*(n-1)

for i in range(n):
    queue = deque()
    visited = [0]*n
    
    queue.append(i)
    while queue:
        target = queue.popleft()
        for j in g[target]:
                if visited[j] == 0 or visited[j] > visited[target] + 1:
                    visited[j] = visited[target] + 1
                    queue.append(j)
    for k, a in enumerate(visited):
        if k > i:
            if a >= 1:
                distance[a-1] += 1
    
for l in distance:
    print(l)

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

a=X-1
b=N-Y
c=Y-X+1

for k in range(1,N):
    
    ans=0
    
    if a < k:
        pass
    else:
        ans+=a-k+1
    
    
    
    if b < k:
        pass
    else:
        ans+=b-k+1
    
    
    
    if c/2 < k:
        pass
    elif c%2==0 and c//2 == k:
        ans+=c//2
    else:
        ans+=c
    
    
    
    if a!=0 and b!=0 and 3<=k<=a+b+1:
        suba=(k-3)-(a-1) if (k-3)-(a-1)>0 else 0 
        subb=(k-3)-(b-1) if (k-3)-(b-1)>0 else 0
        ans += k-2-suba-subb
    
    
    
    if a!=0 and 2<=k<=a+c//2:
        aa=a-1
        cc=c//2
        suba=(k-2)-(aa) if (k-2)-(aa)>0 else 0 
        subc=(k-1)-(cc) if (k-1)-(cc)>0 else 0
        ans += (k-1-suba-subc)*2
        
        if c%2==0 and 0<k-c//2:
            ans-=1

    
    
    
    
    
    if b!=0 and 2<=k<=b+c//2:
        bb=b-1
        cc=c//2
        subb=(k-2)-(bb) if (k-2)-(bb)>0 else 0 
        subc=(k-1)-(cc) if (k-1)-(cc)>0 else 0
        ans += (k-1-subb-subc)*2

        if c%2==0 and 0<k-c//2:
            ans-=1
    
    
    print(ans)

Solution (Python):
from collections import deque
import sys
input = sys.stdin.readline
n, x, y = map(int, input().split())
g = dict()
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1, i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

distance = [0]*(n-1)

for i in range(n):
    queue = deque()
    visited = [0]*n
    
    queue.append(i)
    while queue:
        target = queue.popleft()
        for j in g[target]:
                if visited[j] == 0 or visited[j] > visited[target] + 1:
                    visited[j] = visited[target] + 1
                    queue.append(j)
    for k, a in enumerate(visited):
        if k > i:
            if a >= 1:
                distance[a-1] += 1
    
for l in distance:
    print(l)

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

ret = [0] * (n-1)
for i in range(1, n):
    for j in range(i+1, n+1):
        p1 = j-i
        p2 = abs(i - x) + 1 + abs(j - y)
        p3 = abs(i - y) + 1 + abs(j - x)
        if p1 > p2:
            p1 = p2
        if p1 > p3:
            p1 = p3
        ret[p1-1] += 1

for data in ret:
    print(data)

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

Solution (Python):




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

Solution (Python):
n,x,y=map(int, input().split())
es=[[] for _ in range(n)]
for i in range(n):
    if i<n-1:
        es[i].append(i+1)
    if i>0:
        es[i].append(i-1)
    es[x-1].append(y-1)
    es[y-1].append(x-1)

from collections import deque, defaultdict

def bfs(s,es):
    d=[-1]*n
    d[s]=0
    que=deque()
    que.append(s)
    while que:
        p=que.popleft()
        cnt=d[p]+1
        for e in es[p]:
            if d[e]!=-1:
                continue
            que.append(e)
            d[e]=cnt
    return d

x=[]

for i in range(n):
    x+=bfs(i,es)[i:]
    
x=sorted(x)

from bisect import bisect_left, bisect_right

for i in range(1,n):
    l=bisect_left(x,i)
    r=bisect_right(x,i)
    print(r-l)

Solution (Python):
from collections import deque
import sys
input = sys.stdin.readline

f_inf = float('inf')

def push(v, d):
    if dist[v] != f_inf: return
    dist[v] = d
    que.append(v)

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

ans = [0]*n
for sv in range(n):
    dist = [f_inf] * n
    que = deque([])
    push(sv, 0)

    while que:
        v = que.popleft()
        d = dist[v]+1
        if v-1 >= 0: push(v-1, d)
        if v+1 < n: push(v+1, d)
        if v == x: push(y, d)
        if v == y: push(x, d)

    for i in range(n):
        ans[dist[i]] += 1
        
for i in range(n):
    ans[i] = ans[i]//2

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

Solution (Python):
N, X, Y = map(int, input().split())
ans = [0] * N

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

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

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


main()

Solution (Python):
import sys
from collections import deque
sys.setrecursionlimit(10**7)
inf=10**7


def BFS(s):
    color=["white" for _ in range(n)]
    D=[inf for _ in range(n)]

    color[s-1]="gray"
    D[s-1]=0
    queue=deque([s-1])

    while len(queue)!=0:
        u=queue.popleft()
        for i in M[u]:
            if color[i]=="white":
                color[i]="gray"
                D[i]=D[u]+1
                queue.append(i)
        color[u]="black"

    return D


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

M=[[] for _ in range(n)]
for i in range(n-1):
    M[i].append(i+1)
    M[i+1].append(i)
M[x-1].append(y-1)
M[y-1].append(x-1)

C=[0]*n
for i in range(n):
    for j in BFS(i+1)[i:]:
        C[j] +=1

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

Solution (Python):
from collections import deque
import sys
input = sys.stdin.readline
n, x, y = map(int, input().split())
g = dict()
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1, i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

distance = [0]*(n-1)

for i in range(n):
    queue = deque()
    visited = [0]*n
    
    queue.append(i)
    while queue:
        target = queue.popleft()
        for j in g[target]:
                if visited[j] == 0 or visited[j] > visited[target] + 1:
                    visited[j] = visited[target] + 1
                    queue.append(j)
    for k in range(len(visited)):
        if k > i:
            if visited[k] >= 1:
                distance[visited[k]-1] += 1
    
for l in distance:
    print(l)

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

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

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

ans = [0] * (n+10)

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

Solution (Python):
from collections import deque
n, x, y = map(int, input().split())
g = dict()
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1, i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

distance = [0]*(n-1)

for i in range(n):
    queue = deque()
    visited = [0]*n
    
    queue.append(i)
    while queue:
        target = queue.popleft()
        for j in g[target]:
                if visited[j] == 0 or visited[j] > visited[target] + 1:
                    visited[j] = visited[target] + 1
                    queue.append(j)
    for k in range(len(visited)):
        if k > i:
            if visited[k] >= 1:
                distance[visited[k]-1] += 1
    
for l in distance:
    print(l)

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

print(*d[1:],sep="\n")

Solution (Python):
import heapq


def dijkstra(s):
    color=["white" for _ in range(n)]
    D=[inf for _ in range(n)]

    M=[[] for _ in range(n)]
    for i in range(n-1):
        M[i].append((1,i+1))
        M[i+1].append((1,i))
    M[x-1].append((1,y-1))
    M[y-1].append((1,x-1))

    D[s]=0

    H=[(0,s)]
    heapq.heapify(H)

    while len(H)>=1:
        u=heapq.heappop(H)[1]
        if color[u]=="black":continue
        color[u]="black"

        V=[(i,j) for i,j in M[u] if color[j]!="black"]
        while len(V)!=0:
            for i,j in V:
                if D[u]+i<D[j]:
                    D[j]=D[u]+i
                    color[j]="gray"
                    heapq.heappush(H,(D[j],j))
            break
    return D


inf=10**7
n,x,y=map(int,input().split())

A=[0]*n
for i in range(n):
    for j in dijkstra(i)[:i]:
        A[j] +=1

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

Solution (Python):
import sys
from collections import deque

sys.setrecursionlimit(10**7)


def BFS(s):
    color=["white" for _ in range(n)]
    D=[float("inf") for _ in range(n)]

    color[s-1]="gray"
    D[s-1]=0
    queue=deque([s-1])

    while len(queue)!=0:
        u=queue.popleft()
        for i in M[u]:
            if color[i]=="white":
                color[i]="gray"
                D[i]=D[u]+1
                queue.append(i)
        color[u]="black"

    return D


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

M=[[] for _ in range(n)]
for i in range(n-1):
    M[i].append(i+1)
    M[i+1].append(i)
M[x-1].append(y-1)
M[y-1].append(x-1)

C=[0]*n
for i in range(n):
    for j in BFS(i+1)[i:]:
        C[j] +=1

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

Solution (Python):



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


kyori_graph = [[N]*N for i in range(N)]
kosu_list = [0]*(N-1)


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


for i in range(N):
    for j in range(i+1, N):
        kyori = kyori_graph[i][j]
        kosu_list[kyori-1] += 1
for k in kosu_list:
    print(k)

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

Solution (Python):
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

N, X, Y = map(int,input().split())
l = [[0]*(N) for _ in range(N)]
for i in range(N-1):
    l[i][i+1] = 1
    l[i+1][i] = 1
l[X-1][Y-1] = 1
l[Y-1][X-1] = 1
csr = csr_matrix(l)
step = np.array(np.ravel(dijkstra(csr, unweighted=True)), dtype=int)
memo = np.bincount(step)//2
ma = np.max(step)
for i in range(1,ma+1):
    print(memo[i])
for i in range(ma+1, N):
    print(0)

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

Solution (Python):
import math

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

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


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

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

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

ans = [0] * (n)

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))
        ans[dist] += 1

for x in range(1, len(ans)):
    print(ans[x])

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


min_dist = [0] * n

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

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

Solution (Python):
def distance(i,j,X,Y):
    return min([abs(i-j), abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j)])

N,X,Y=[int(e) for e in input().split(' ')]
cnt=[0]*(N-1)

for i in range(1,N):
    for j in range(i+1,N+1):
        
        d=distance(i,j,X,Y)
        cnt[d-1]+=1
for c in cnt:
    print(c)

Solution (Python):

from itertools import combinations
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []
for i, j in combinations(range(N), 2):
    ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))
c = Counter(ans)
for i in range(1,N):
    print(c[i])

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

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

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

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

X -= 1
Y -= 1

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

Solution (Python):

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


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

for k in range(1, N):
    print(dp[k])

Solution (Python):
N, X, Y = list(map(int,input().split()))
kyori = dict()
for j in range(N-1):
    kyori[j+1] = 0
for i in range(1,N,1):
    for j in range(i+1,N+1,1):
        k = min(abs(j-i),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(X-j))
        
        kyori[k] += 1


for i in kyori.values():
    print(i)

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

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


[print(v) for v in ans]

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

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

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

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


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

ans = [0] * (N-1)

queue = deque([])

def bfs(start):
    queue.extend(edges[start])
    visited = [False] *  N
    visited[start] = True
    i = 0
    while queue:
        length = len(queue)
        for l in range(length):
            current = queue.popleft()
            if not visited[current]:
                ans[i] += 1
                if edges[current]:
                    queue.extend(edges[current])
                visited[current] = True    
        i += 1

for i in range(N):
    bfs(i)

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

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):
        ans[min(j - i, min(abs(i - x) + 1 + abs(y - j),
                           abs(i - y) + 1 + abs(x - j)))] += 1

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

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

from collections import defaultdict
ds = defaultdict(int)
for i in range(N):
    for j in range(i+1, N):
        d = min(j-i, abs(X-1-i)+1+abs(Y-1-j))
        ds[d] += 1

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

Solution (Python):
def main():
  N,X,Y = map(int,input().split())
  V = [[] for _ in range(N)]
  
  for i in range(N-1):
    V[i].append(i+1)
    V[i+1].append(i)
  X -= 1
  Y -= 1
  V[X].append(Y)
  V[Y].append(X)
  
  
  ans = [0 for _ in range(N)]
  INF = float('INF')
  for s in range(N):
    D = [INF for _ in range(N)]
    q = [s]
    d = 0
    while(q):
      q2 = []
      for v in q:
        D[v] = min(D[v],d)
        for u in V[v]:
          if D[u] == INF:
            q2.append(u)
      q = q2[:]
      d += 1
      
    for i in range(N):
      ans[D[i]] += 1
  for i in range(1,N):
    print(ans[i]//2)

main()

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

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

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

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

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

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

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

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

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

Solution (Python):
N, X, Y = map(int, input().split())
res = [0] * N
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)
        res[d] += 1

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

Solution (Python):
from collections import deque

def breadth_first_search(start):
    work_q = deque([])
    visited = set()
    work_q.append(start)
    visited.add(start)
    cnt_array = [0] * (n+1)
    while work_q:
        here = work_q.popleft()
        for i in edge[here]:
            if i not in visited:
                work_q.append(i)
                visited.add(i)
                cnt_array[i] = cnt_array[here] + 1
    return cnt_array

n,x,y = map(int,input().split())
edge = []
for i in range(n+1):
    edge.append([])
for i in range(1,n+1):
    if i != n:
        edge[i].append(i+1)
    if i != 1:
        edge[i].append(i-1)
edge[x].append(y)
edge[y].append(x)

ans = [0] * n
for i in range(1, n+1):
    a = breadth_first_search(i)
    for j in range(len(a)):
        ans[a[j]] += 1
for i in range(1,n):
    print(ans[i]//2)

Solution (Python):
N,X,Y = map(int,input().split())
def dist(i,j):
    return min(j-i,abs(i-X)+1+abs(j-Y),abs(i-Y)+1+abs(j-X))
L = [0 for i in range(N-1)]
for i in range(1,N):
    for j in range(i+1,N+1):
        L[dist(i,j)-1] += 1
for k in range(0,len(L)):
    print(L[k])

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

x = X-1
y = Y-1

a = [0]*N

for i in range(N):
    for j in range(N-i-1):
        
        p = i+j+1
        c = min(abs(p-i), abs(x-i)+1+abs(y-p))
        a[c]+=1
        

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

Solution (Python):
import itertools
import collections

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

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

dist_l = [min(abs(i-j), abs(i - X) + 1 + abs(Y - j)) for i,j in ways]

dic = collections.Counter(dist_l)
for i in range(1,N):
    print(dic[i])

Solution (Python):
from collections import deque
n,x,y = map(int,input().split())
cnt = [0]*n
for i in range(n):
    d = [float('inf')]*n
    que = deque([(i, 0)])
    while que:
        idx, c = que.popleft()
        if d[idx]!=float('inf'):
            d[idx] = min(d[idx], c)
            continue
        else:
            d[idx] = min(d[idx], c)
            if idx!=0:
                que.append((idx-1, c+1))
            if idx!=n-1:
                que.append((idx+1, c+1))
            if idx==x-1:
                que.append((y-1, c+1))
            if idx==y-1:
                que.append((x-1, c+1))
    for j in range(i+1, n):
        cnt[d[j]] += 1
for c in cnt[1:]:
    print(c)

Solution (Python):
from collections import deque
def main():
    n,x,y = map(int,input().split())
    cnt = [0]*n
    for i in range(n):
        d = [float('inf')]*n
        que = deque([(i, 0)])
        while que:
            idx, c = que.popleft()
            if d[idx]!=float('inf'):
                d[idx] = min(d[idx], c)
                continue
            else:
                d[idx] = min(d[idx], c)
                if idx!=0:
                    que.append((idx-1, c+1))
                if idx!=n-1:
                    que.append((idx+1, c+1))
                if idx==x-1:
                    que.append((y-1, c+1))
                if idx==y-1:
                    que.append((x-1, c+1))
        for j in range(i+1, n):
            cnt[d[j]] += 1
    for c in cnt[1:]:
        print(c)
    
if __name__ == '__main__':
    main()

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

Solution (Python):
from collections import deque
n,x,y = map(int,input().split())
x,y = x-1 ,y-1
g = [[float('inf')]*n for _ in range(n)]
for i in range(n):
    que = deque([(i, 0)])
    while que:
        node, cost = que.popleft()
        if g[i][node]!=float('inf'):
            continue
        else:
            g[i][node] = cost
            if node>0:
                que.append((node-1, cost+1))
            if node<n-1:
                que.append((node+1, cost+1))
            if node==x:
                que.append((y, cost+1))
            if node==y:
                que.append((x, cost+1))
cnt = [0]*n
for i in range(n):
    for j in range(i+1, n):
        cnt[g[i][j]] += 1
for c in cnt[1:]:
    print(c)

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

Solution (Python):
n,x,y=map(int,input().split())
g=[[]*n for i in range(n)]
for i in range(n-1):
    g[i].append(i+1)
    g[i+1].append(i)
g[x-1].append(y-1)
g[y-1].append(x-1)

from collections import deque
distance=[]

for i in range(n):
    option=deque()
    option.append(i)
    completed=[False]*n
    memo=[0]*n
    while option:
        now=option.popleft()
        completed[now]=True
        for j in g[now]:
            if completed[j]==False and j not in option:
                memo[j]=memo[now]+1
                option.append(j)
    distance.append(memo)

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

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