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):
from collections import deque, defaultdict


def main():
    N, X, Y = map(int, input().split())
    g = [[] for _ 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)
    ans = defaultdict(int)

    for i in range(N):
        q = deque()
        q.append(i)
        visit_time = [0 for _ in range(N)]
        while len(q):
            v = q.popleft()
            time = visit_time[v]
            for j in g[v]:
                if visit_time[j] == 0 and j != i:
                    q.append(j)
                    visit_time[j] = time + 1
                else:
                    visit_time[j] = min(time + 1, visit_time[j])

        for v in visit_time:
            ans[v] += 1

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


if __name__ == '__main__':
    main()

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

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

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

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

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

for a in aggre:
  print(a // 2)

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)

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

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

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

ans = [0] * N

for i in range(1,N):
    for j in reversed(range(N+1)):
        if i >= j:
            break

        tmp = min(j-i,abs(X-i)+1+abs(Y-j))
        ans[tmp] += 1

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

Solution (Python):

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

pat = [0]*(N-1)

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

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

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

Solution (Python):





N, x, y = map(int, input().split())
normal =0
short =0
ans ={i:0 for i in range(1,N)}
for i in range(1,N):
    for j in range(i+1,N+1):
         normal =j -i
         short  =abs(x-i) +1 +abs(j-y)
         dist =min(normal,short)
         ans[dist] +=1
      


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

Solution (Python):

import sys
input = lambda: sys.stdin.readline().strip()
n, x, y = [int(x) for x in input().split()]
ans = [0 for k in range(n)]
for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        ans[min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(y - i) + 1 + abs(x - j))] += 1
print(*(ans[1:]), sep='\n')

Solution (Python):





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

ans ={i:0 for i in range(1,N)}
for i in range(1,N):
    for j in range(i+1,N+1):
         
        if (j <=x or y <=i) :
            ans[j-i] +=1
        
        elif i <=x and y <=j:
            ans[x-i +1 +j-y] +=1
        
        elif x <i and j <y:
            dist =min(j-i,i-x + y-j +1) 
            ans[dist] +=1
        
        elif i <=x and j < y:
            dist =x-i + min(j-x , y+1-j)
            ans[dist] +=1 
        
        elif x <i and y <=j:
            dist =min(y-i , 1 +i-x) + j-y
            ans[dist] +=1 


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

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

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

for i in range(1,n):
  for j in range(i+1,n+1):
    if i < x and j <= x:
      k[j-i] += 1
    elif i >= y and j > y:
      k[j-i] += 1
    elif x <= i < y and x< j <= y:
      ind = min(j-i,i-x+y-j+1)
      k[ind] += 1
    elif i < x and x < j <= y:
      ind = min(j-i,x-i+y-j+1)
      k[ind] += 1
    elif x <= i < y and y < j:
      ind = min(j-i,i-x+1+j-y)
      k[ind] += 1
    elif i< x and j > y:
      ind = x - i + 1 + j - y
      k[ind] += 1
      
for i in range(1,n):
  print(k[i])

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

for i in range(1,n):
  for j in range(i+1,n+1):
    if i < x and j <= x:
      k[j-i] += 1
    elif i >= y and j > y:
      k[j-i] += 1
    elif x <= i < y and x<j<=y:
      ind = min(j-i,abs((i-x))+abs((y-j))+1)
      k[ind] += 1
    elif i < x and x<j<=y:
      ind = min(j-i,abs((x-i))+abs((y-j))+1)
      k[ind] += 1
    elif x<=i<y and y<j:
      ind = min(j-i,abs((i-x))+1+abs((j-y)))
      k[ind] += 1
    elif i< x and j > y:
      ind = (x-i) + 1 + (j-y)
      k[ind] += 1
      
for i in range(1,n):
  print(k[i])

Solution (Python):

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

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

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

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

for a in ans:
    print(a)

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

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

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

for a in ans:
  print(a)

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

def main():
    N,X,Y = map(int,input().split())
    edge = [[] for _ in range(N)]
    for i in range(N):
        if i == 0:
            edge[i].append(i+1)
        elif i == N-1:
            edge[i].append(i-1)
        else:
            edge[i].append(i-1)
            edge[i].append(i+1)
    edge[X-1].append(Y-1)
    edge[Y-1].append(X-1)
    
    ans = [0]*(N-1)
    
    for i in range(N):
        visited = [0]*N
        dist = [0]*N
        q = deque([i])
        visited[i] = 1
        while q:
            now = q.popleft()
            for connection in edge[now]:
                if visited[connection]:
                    dist[connection] = min(dist[connection],dist[now]+1)
                else:
                    visited[connection] = 1
                    dist[connection] = dist[now] + 1
                    q.append(connection)
        for d in dist:
            if d == 0:
                continue
            ans[d-1] += 1
    ans = list(map(lambda x: x//2,ans))
    print(*ans,sep="\n")
if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    def bfs(root):
        dist = [f_inf] * n
        dist[root] = 0
        que = deque()
        que.append(root)
        while que:
            prev = que.popleft()
            for next in tree[prev]:
                if dist[next] == f_inf:
                    dist[next] = dist[prev] + 1
                    que.append(next)
        return dist

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

    cnt = [0] * n
    for i in range(n):
        dist = bfs(i)
        for d in dist:
            cnt[d] += 1

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


if __name__ == '__main__':
    resolve()

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

    for v in distances[1:]:
        print(v)


if __name__ == '__main__':
    main()

Solution (Python):
from itertools import combinations as cb
n,x,y = map(int, input().split())
pair = list(cb(range(1,n+1), 2))
dist = [0]*n
for a in pair:
  if a[1] <= x or a[0] >= y:
    dist[a[1]-a[0]] += 1
  else:
    dist[min(abs(x-a[0])+abs(y-a[1])+1,a[1]-a[0])] += 1
for i in range(1, n):
  print(dist[i])

Solution (Python):
from itertools import combinations as cb
node = []
n,x,y = map(int, input().split())
for i in range(1, n+1):
  node.append(i)
pair = list(cb(node, 2))
dist = [0]*n
for a in pair:
  if a[1] <= x or a[0] >= y:
    dist[a[1]-a[0]] += 1
  else:
    dist[min(abs(x-a[0])+abs(y-a[1])+1,a[1]-a[0])] += 1
for i in range(1, n):
  print(dist[i])

Solution (Python):
import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

combi = list(itertools.combinations(range(1,N+1),2))

ansList = [0 for _ in range(N)]

for i,j in combi:
    kyori = min(j-i, abs(j-Y) + abs(X-i) + 1)
    ansList[kyori] += 1


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

Solution (Python):
import itertools

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

combi = list(itertools.combinations(range(1,N+1),2))

ansList = [0 for _ in range(N)]

for i,j in combi:
    kyori = min(j-i, abs(j-Y) + abs(X-i) + 1)
    ansList[kyori] += 1


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

Solution (Python):
import sys

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

def calc(i, j, x, y):
    mindist = abs(j - i)
    mindist = min(mindist, abs(x - i) + 1 + abs(y - j))
    mindist = min(mindist, abs(y - i) + 1 + abs(x - j))
    return mindist

result = [0 for i in range(n)]
for i in range(n):
    for j in range(n):
        if i == j :
            continue
        k = calc(i, j, x, y)       
        result[k] += 1

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

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

c=min(x,y)-1
d=max(x,y)-1

e=[0]*n

for i in range(n):
    for j in range(i+1,n):
        a=j-i
        if i<c and d<j:
            b=c-i+j-d+1
        elif c<=i and d<j:
            b=i-c+j-d+1
        elif i<c and j<=d:
            b=c-i+d-j+1
        elif c<=i and j<=d:
            b=i-c+d-j+1
        t=min(a,b)
        
        e[t]+=1
for f in e[1:]:
    print(f)

Solution (Python):
from collections import defaultdict
N,X,Y = map(int,input().split())

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

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

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

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

for c in cnt:
    print(c)

Solution (Python):
from collections import defaultdict

N, X, Y = map(int, input().split())
INF = 10**20
ans = {i:0 for i in range(N)}
d = defaultdict(list)

for i in range(1, N):
    d[i].append(i+1)
    d[i+1].append(i)
d[X].append(Y)
d[Y].append(X)

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

    while q:
        a = q.pop()
        for b in d[a]:
            if dist[b]==-1 or dist[b] > dist[a]+1:
                dist[b] = dist[a] + 1
                q.append(b)
    for j in range(i+1, N+1):
        ans[dist[j]] += 1

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

Solution (Python):
n,x,y=map(int,input().split())
x-=1
y-=1
L=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        if j<=x or i>=y:
            L[j-i-1]+=1
        elif i<=x and y<=j:
            L[x-i+j-y]+=1
        else:
            a=j-i
            b=abs(x-i)+1+abs(y-j)
            L[min(a,b)-1]+=1
for k in L:
    print(k)

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

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

G=[[i+1] for i in range(N)]
G[N-1].pop()
for i in range(1,N):
    G[i].append(i-1)
G[X-1].append(Y-1)
G[Y-1].append(X-1)

from collections import deque

q=deque([])
cnt=[0]*N

for n in range(N-1):
    seen=[0]*N
    q.append([n,0])
    seen[n]=1
    while q:
        x,c=q.popleft()
        if c>=N-1:continue
        for g in G[x]:
            if seen[g]==0:
                q.append([g,c+1])
                seen[g]=1
                if n<g:
                    cnt[c+1]+=1
for i in range(1,N):
    print(cnt[i])

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect

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

Solution (Python):
import sys
import itertools

import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
N = [int(i) for i in input().split()]

answerList = []

for i in range(N[0]):
    answerList.append(0)

for i in range(N[0]):
    if i > 0:
        for j in range(N[0]):
            if j + 1 > i > 0:
                calculateList = [abs(j + 1 - i),
                                 abs(N[1] - i) + 1 + abs(j + 1 - N[2]),
                                 abs(N[2] - i) + 1 + abs(j + 1 - N[1])]
                answer = min(calculateList)
                answerList[answer] = answerList[answer] + 1

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

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue
from decimal import Decimal



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, X, Y = il()

    k = {n:0 for n in range(N-1)}
    X -= 1
    Y -= 1
    for i in range(N-1):
        for j in range(i+1, N):
            m = min(abs(i-j), abs(X-i) + abs(Y-j) + 1, abs(X-j) + abs(Y-i) + 1)
            k[m-1] += 1

    for i in range(len(k)):
        print(k[i])


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np

Mod = 1000000007
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

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

if __name__ == "__main__":
    main()

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

m()

Solution (Python):
import collections
N,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=collections.Counter(lit)
for i in range(1,N):
  print(a[i])

Solution (Python):
import sys
import heapq
import re
from heapq import heapify, heappop, heappush
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


n, x, y = map(int, input().split())
edge = [[] for i in range(n)]
x -= 1
y -= 1
for i in range(n):
    if i != 0:
        edge[i].append(i - 1)
    if i != n - 1:
        edge[i].append(i + 1)
    if i == x:
        edge[i].append(y)
    if i == y:
        edge[i].append(x)
ans = [0 for i in range(1, n)]
for i in range(n):
    queue = deque([[i, 0]])
    visited = [0 for i in range(n)]
    while queue:
        a, b = queue.popleft()
        if visited[a] == 1:
            continue
        visited[a] = 1
        if b != 0:
            ans[b - 1] += 1
        for j in edge[a]:
            queue.append([j, b + 1])
for i in ans:
    print(i // 2)

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

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

for i in l:
    print(i)

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

Solution (Python):
import sys
readline = sys.stdin.readline

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

G = [[] for i in range(N)]
G[X - 1].append(Y - 1)
G[Y - 1].append(X - 1)

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

from collections import deque
for st in range(N):
  q = deque([[st,0,-1]])
  visited = set()
  while q:
    v,dist,parent = q.popleft()
    if v in visited:
      continue
    visited.add(v)
    ans[dist] += 1
    for child in G[v]:
      if child == parent:
        continue
      q.append([child, dist + 1, v])
    
for i in range(1, N):
  print(ans[i] // 2)

Solution (Python):



def solve(N, X, Y):
    ans = [0] * (N)

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

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


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

Solution (Python):
import sys
from collections import defaultdict




def distance(X, Y, start, goal):
    ans = float('inf')

    tmp = goal - start
    if tmp < ans:
        ans = tmp

    
    tmp = abs(X - start) + 1 + abs(goal - Y)
    if tmp < ans:
        ans = tmp

    
    tmp = abs(Y - start) + 1 + abs(goal - X)
    if tmp < ans:
        ans = tmp

    return ans


















    

def main():
    

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

    distance_dict = defaultdict(int)
    for i in range(1, N+1):
        for j in range(i + 1, N+1):
            d = distance(X, Y, i, j)
            
            
            distance_dict[d] += 1

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

    
    
    
    
    
    

    return 0

if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
from collections import deque

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

adj = [[] for i in range(n)]

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

for i in range(n-1):
    adj[i].append(i+1) 
    adj[i+1].append(i)
        
ans = [0 for _ in range(n)]

def bfs(start):
    inf = 1001001001
    q = deque()
    q.append(start)
    dist = [inf]*n
    dist[start] = 0
    
    while q:
        v = q.popleft()

        for i in adj[v]:
            if dist[i] == inf:
                dist[i] = dist[v] + 1
                q.append(i)

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

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

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

Solution (Python):
from collections import deque

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

adj = [[] for i in range(n)]

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

for i in range(n-1):
    adj[i].append(i+1) 
    adj[i+1].append(i)
        
ans = [0 for _ in range(n)]

def bfs(start):
    inf = 1001001001
    q = deque()
    q.append(start)
    dist = [inf]*n
    dist[start] = 0
    
    while q:
        v = q.popleft()

        for i in adj[v]:
            if dist[i] == inf:
                dist[i] = dist[v] + 1
                q.append(i)

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

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

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

Solution (Python):
n,x,y=map(int,input().split())
 
ans=[0]*n
 
list =[]
for i in range(n):
  for j in range(i):
    b = i+1
    a = j+1
    if a<=x and b>=y:
      k =b-y+x-a+1
    elif a>x and b>=y:
      d =min(a-x+1,y-a)
      k =d+b-y
    elif a<=x and b<y:
      d =min(b-x,y-b+1)
      k =x-a+d
    elif a>x and b<y:
      k = min(b-a,y-b+a-x+1)
    ans[k]+=1
    
for i in range(1,n):
  print(ans[i])

Solution (Python):
from collections import deque

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

inf = 100100100
x -= 1
y -= 1

ans = [0] * n

for i in range(n):
    dist = [inf] * n
    queue = deque()
    queue.append(i)
    dist[i] = 0
    while queue:
        current = queue.popleft()
        d = dist[current]

        if current - 1 >= 0 and dist[current - 1] == inf:
            queue.append(current - 1)
            dist[current - 1] = d + 1
        if current + 1 < n and dist[current + 1] == inf:
            queue.append(current + 1)
            dist[current + 1] = d + 1
        if current == x and dist[y] == inf:
            queue.append(y)
            dist[y] = d + 1
        if current == y and dist[x] == inf:
            queue.append(x)
            dist[x] = d + 1

    for j in range(n):
        ans[dist[j]] += 1

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

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

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

dist_list =[0] *(N+10)
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))
        dist_list[dist] += 1
for k in range(1, N):
    print(dist_list[k])

Solution (Python):
import sys
import math
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


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

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



if __name__ == "__main__":
    main()

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

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