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 sys import stdin
def main():
    readline=stdin.readline
    N,X,Y=map(int,readline().split())
    X-=1
    Y-=1
    k=[0]*N
    for a in range(N-1):
        for b in range(a+1,N):
            if a<=X and Y<=b:
                k[X-a+b-Y+1]+=1
            else:
                c=min(b-a,abs(X-a)+1+abs(Y-b))
                k[c]+=1

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

if __name__=="__main__":
    main()

Solution (Python):
N, X, Y = map(int, input().split())
dists = [[-1] * N for _ in range(N)]
graph = [[1]]
graph .extend([i - 1, i + 1] for i in range(1, N - 1))
graph.append([N - 2])
graph[X - 1].append(Y - 1)
graph[Y - 1].append(X - 1)

d_count = [0] * N

for i in range(N):
    q = [i]
    dists[i][i] = 0
    while len(q) >= 1:
        n = q.pop(0)
        for n_next in graph[n]:
            if dists[i][n_next] >= 0:
                continue
            dists[i][n_next] = dists[i][n] + 1
            d_count[dists[i][n_next]] += 1
            q.append(n_next)

print("\n".join(str(d_count[i] // 2) for i in range(1, N)))

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False
"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

import heapq

def dijkstra(s,n,w,cost):
    
    
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    
    while True:
        v = -1
        
        for i in range(n):
            if (not used[i]) and (v == -1):
               v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
               break
        used[v] = True
               
        for j in range(n):
               d[j] = min(d[j],d[v]+cost[v][j])
    return d

def warshall_floyd(n,d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d





n,x,y = m()

dp = [[mod for i in range(n)] for j in range(n)]

for i in range(n):
    dp[i][i] = 0

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

dp[x-1][y-1] = 1

dp[y-1][x-1] = 1


po = dijkstra(x-1,n,n,dp)

ppo = dijkstra(y-1,n,n,dp)

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

for i in range(n):
    for j in range(n):
        on = min(abs(i-j),po[i]+po[j],ppo[i]+ppo[j],po[i]+ppo[j] + 1,ppo[i]+po[j] + 1)
            
            
        ans[on] += 1
for i in range(1,n):
    print(ans[i]//2)

Solution (Python):
from collections import defaultdict
from heapq import heappush, heappop
from collections import deque
n, x, y = list(map(int, input().split()))
G = [[]*n for _ in range(n)]

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

INF = 10**30
N = n






dd = []
for i in range(n):
    s = i
    dist = [10**9] * N
    S = deque([s])
    T = deque()
    dist[s] = 0

    d = 0
    while S:
        while S:
            v = S.popleft()
            for w, c in G[v]:
                if d+c < dist[w]:
                    dist[w] = d+c
                    if c:
                        T.append(w)
                    else:
                        S.append(w)
        S, T = T, S
        d += 1
    dd.append(dist)

ans = defaultdict(lambda: 0)
for dist in dd:
    for t in dist:
        ans[t] += 1
for i in range(n-1):
    print(ans[i+1]//2)

Solution (Python):
import heapq
INFTY = 10**4
N,X,Y = map(int,input().split())
G = {1:[2],N:[N-1]}
for i in range(2,N):
    G[i] = [i-1,i+1]
G[X].append(Y)
G[Y].append(X)
dist = [[INFTY for _ in range(N+1)] for _ in range(N+1)]
for s in range(1,N):
    hist = [0 for _ in range(N+1)]
    heap = [(0,s)]
    dist[s][s] = 0
    hist[s] = 1
    while heap:
        d,x = heapq.heappop(heap)
        if d>dist[s][x]:continue
        hist[x] = 1
        for y in G[x]:
            if hist[y]==0 and dist[s][y]>d+1:
                dist[s][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
import math
from collections import defaultdict
n,x,y=map(int,sys.stdin.readline().split())
dis=defaultdict(lambda:10000)
dis=[[0 for _ in range(n)] for a in range(n)]
dis[x-1][y-1]=1
x-=1
y-=1

k=[0 for _ in range(n-1)]
for i in range(n):
    for j in range(i+1,n):
        dis[i][j]=j-i
        if i<=x:
            dis_x=x-i
        else:
            dis_x=i-x
        if j<=y:
            dis_y=y-j
        else:
            dis_y=j-y
        dis[i][j]=min(dis[i][j],dis_x+dis_y+1)
        k[dis[i][j]-1]+=1

for i in range(n-1):
    print(k[i])
'''dis[(x-1,y-1)]=1
for i in range(n):
    dis[(i,i)]=0
d=defaultdict(int)
for i in range(n-1,-1,-1):
    for j in range(i+1,n):
        dis[(i,j)]=min(dis[(i,j)],dis[(i+1,j)]+1,dis[(i,j-1)]+1,dis[(i-1,j)]+1,dis[(i,j+1)]+1)
        d[dis[(i,j)]]+=1

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

Solution (Python):
n, x, y = map(int, input().split())
x -= 1
y -= 1
distance_dic = {}

def add_dic(p):
    if not p in distance_dic:
        distance_dic[p] = 1
    else:
        distance_dic[p] += 1

for i in range(x):
    for j in range(i+1,x):
        add_dic(j-i)
    for j in range(x,y):
        add_dic(min(j-i, x+y+1-i-j))
    for j in range(y,n):
        add_dic(x-y+1+j-i)
for i in range(x,y):
    for j in range(i+1,y):
        add_dic(min(j-i, y-x+1+i-j))
    for j in range(y, n):
        add_dic(min(j-i, -x-y+1+i+j))
for i in range(y,n-1):
    for j in range(i+1,n):
        add_dic(j-i)

for k in range(1, n):
    if k in distance_dic:
        print(distance_dic[k])
    else:
        print(0)

Solution (Python):
def kyori(a, b, x, y):
    if a > b:
        a, b = b, a
    return min(abs(b - a), abs(x - a) + abs(b - y) + 1)


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

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

Solution (Python):
import heapq




def dijkstra(e,n,s):
    inf = 10**18
    d = [inf]*n
    d[s] = 0

    q = [(d[s],s)] 
    heapq.heapify([q])
    while len(q)>0:
        _,v = heapq.heappop(q)
        for u,c in e[v]:
            if d[v]+c>=d[u]:
                continue
            d[u] = d[v] + c
            heapq.heappush(q, (d[u],u))
    return d

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

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

res = [0]*n
for i in range(n):
    d = dijkstra(g,n,i)
    for j in range(i+1,n):
        res[d[j]] += 1

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

Solution (Python):
n,x,y=map(int,input().split())
ans=[0 for i in range(n)]
for start in range(n):
  gone=[0 for i in range(n)]
  gone[start]=1
  now ={start}
  for i in range(1,n):
    go=set()
    for s in now:
      if s!=0 and gone[s-1]==0:
        go.add(s-1)
        gone[s-1]=1
        ans[i]+=1
      if s!=n-1 and gone[s+1]==0:
        go.add(s+1)
        gone[s+1]=1
        ans[i]+=1
      if s==x-1 and gone[y-1]==0:
        go.add(y-1)
        gone[y-1]=1
        ans[i]+=1
      if s==y-1 and gone[x-1]==0:
        go.add(x-1)
        gone[x-1]=1
        ans[i]+=1
    now=go
for i in range(1,n):
  print(ans[i]//2)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Solution (Python):
n,x,y = map(int,input().split())
sc = y - x - 1
nl = [0]*(n-1)
for i in range(1,n+1):
    for j in range(1,n+1):
        if i < j:
            dis = j - i
            if i <= x and j >= y:
                dis -= sc
            elif i >= x and j <= y:
                dis = min(dis,i-x + y-j  +1)
            elif i <= x and j >= x and j <= y:
                dis = min(dis,y-i-sc+y-j)
            elif i >= x and i <= y and j >= y:
                dis = min(dis,j-x-sc+i-x)
            nl[dis-1] += 1
for i in nl:
    print (i)

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

dist_from_X = list(abs(i - (X - 1)) for i in range(N))
dist_from_Y = list(abs(i - (Y - 1)) for i in range(N))

ans_list = [0] * N

for i in range(N):
    for j in range(i, N):
        i_X_Y_j = dist_from_X[i] + 1 + dist_from_Y[j]
        i_Y_X_j = dist_from_Y[i] + 1 + dist_from_X[j]
        i_j = abs(i - j)
        min_dist_i_j = min(i_X_Y_j, i_Y_X_j, i_j)
        ans_list[min_dist_i_j] += 1

for num in ans_list[1:]:
    print(num)

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

le=0

for i in range(N):
    for j in range(i+1,N):
        le=(j-i)
        if (i<=xdex)and(ydex<=j):
            le = min(j - i, (j - i) - (Y - X - 1))
        elif ((i<=xdex)and(j<=ydex)and(xdex<=j)):
            le=min(j - i, (xdex-i)+(ydex- j)+1)
        elif ((xdex<i)and(j<=ydex)and(xdex<=j)):
            le=min(j-i,(i-xdex)+(ydex-j)+1)
        elif ((xdex<i)and(ydex<j)):
            le=min(j-i,(i-xdex)+(j-ydex)+1)
        
        l[le]=l[le]+1

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

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

x -= 1
y -= 1

dis = [[-1]*n for _ in range(n)]
dis_cnt = [0]*(n-1)

for i in range(n):
  for j in range(n):
    if i>j:
      continue
    dis[i][j] = min( abs(j-i), abs(x-i) + abs(j-y) + 1, abs(y-i) + abs(j-x)+1 )
    if dis[i][j]>0:
      dis_cnt[dis[i][j]-1] += 1
    

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

Solution (Python):
n,x,y=map(int,input().split())
ans={i:0 for i in range(n)}
dp=[[0]*n for _ in range(n)]
for i in range(1,n+1):
  for j in range(i+1,n+1):
    if j<=x or y<=i:
      dp[i-1][j-1]=j-i  
    elif j<y:
      if i<=x:
        dp[i-1][j-1]=x-i+min(j-x,1+y-j)
      else:
        dp[i-1][j-1]=min(j-i,i-x+y-j+1)
    elif y<=j:
      if i<=x:
        dp[i-1][j-1]=x-i+1+j-y
      else:
        dp[i-1][j-1]=j-y+min(y-i,1+i-x)
    else:
      print("Error")
      print(i,j)
for i in range(0,n):
  for j in range(i,n):
    ans[dp[i][j]]+=1
for i in range(1,n):
  print(ans[i])

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

from collections import defaultdict,deque
cnt = defaultdict(int)

INF = 10 ** 18

def bfs(n):
    que = deque([n])
    dist = [INF] * (N + 2)
    dist[n] = 0
    dist[0] = -INF
    dist[N + 1] = -INF
    
    while que:
        v = que.popleft()
        d = dist[v]

        
        if v == X:
            if dist[Y] > d + 1:
                dist[Y] = d + 1
                que.appendleft(Y)
        elif v == Y:
            if dist[X] > d + 1:
                dist[X] = d + 1
                que.appendleft(X)

        
        if dist[v - 1] > d + 1:
            dist[v - 1] = d + 1
            que.append(v - 1)
        
        
        if dist[v + 1] > d + 1:
            dist[v + 1] = d + 1
            que.append(v + 1)
    
    for i in range(n+1, N+1):
        cnt[dist[i]] += 1


for i in range(1,N+1):
    bfs(i)
for k in range(1,N):
    print(cnt[k])

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N, X, Y = map(int, read().split())

dist = []
for i in range(1, N):
    x = np.arange(i + 1, N + 1)
    
    d1 = np.abs(x - i)
    
    d2 = np.abs(i - X) + np.abs(Y - x) + 1
    
    d3 = np.abs(i - Y) + np.abs(X - x) + 1
    d = np.minimum(np.minimum(d1, d2), d3)
    dist.append(d)

dist = np.concatenate(dist)
count = np.bincount(dist, minlength=N)
print('\n'.join(count[1:].astype(str)))

Solution (Python):
from sys import stdin
n,x,y = [int(x) for x in stdin.readline().rstrip().split()]
a = [0] * n
for i in range(x):
    a[i] = x - (i+1)
k = y - x
if k % 2 == 1:
    k = k//2 + 1
    for i in range(k):
        a[i+x] = i+1
        a[y-1-i] = i+1
else:
    k = k//2 
    for i in range(k):
        a[i+x] = i+1
        a[y-1-i] = i+1
for i in range(n-y):
    a[y+i] = a[y-1]+i+1
c = [0] * n
for i in range(n):
    for j in range(i+1,n):
        A = j-i
        B = abs(x-1 - i) + a[j]
        p = min(A,B)
        c[p] += 1
for i in range(n-1):
    print(c[i+1])

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

Solution (Python):
N, X, Y = map(int, input().split())
count = [0]*N
for i in range(1, N):
    for j in range(i+1, N+1):
        if i <= X and Y <= j:
            

            count[j-i-(Y-X)+1] += 1
        else:
            
            

            count[min((j-i), abs(X-i)+abs(Y-j)+1)] += 1
for c in count[1:]:
    print(c)

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

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  if b<=x or a>=y:
    dist=b-a
  else:
    dist=min(b-a, abs(x-a)+abs(y-b)+1)
  dis[dist]+=1
print(*dis[1:],sep='\n')

Solution (Python):

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N, X, Y = map(int, read().split())

dist = []
for i in range(1, N):
    x = np.arange(i+1, N + 1)
    
    d1 = np.abs(x - i)
    
    d2 = np.abs(i - X) + np.abs(Y - x) + 1
    
    d3 = np.abs(i - Y) + np.abs(X - x) + 1
    d = np.minimum(np.minimum(d1, d2), d3)
    dist.append(d)

dist = np.concatenate(dist)
count = np.bincount(dist, minlength=N)
print('\n'.join(count[1:].astype(str)))

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


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

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

for i in range(X+1,math.ceil((X+Y)/2)):
  for j in range(Y,N+1):
    d[i][j]= (j-Y)+1+(i-X)


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



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

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

Solution (Python):


n, x, y = [0] * 3

def format_input(filename = None):
	global n, x, y
	if filename == None:
		n, x, y = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(3, 2 * 10**3)
		x = rng(1, n-1)
		y = rng(x+1, n)
		print(n, x, y)

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

def get_answer():
	num_dist = [0] * n
	for i in range(1, n):
		for j in range(i+1, n+1):
			num_dist[distance(i, j)] += 1

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

if __name__ == '__main__':
	format_input()

	get_answer()

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

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

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

dist_dict = {i:0 for i in range(1,N)}
for i in range(N-1):
    for j in range(i+1,N):
        
        d0 = j -i
        
        d1 = abs(X-i) + 1 + abs(j-Y)

        d = min(d0,d1)
        dist_dict[d] += 1
for i in range(1,N):
    print(dist_dict[i])

Solution (Python):
n, x, y = map(int, input().split())
ans = [[n]*n for i in range(n)]
for i in range(n):
  for j in range(n):
    ans[i][j] = abs(i-j)

ans[x-1][y-1] = 1
ans[y-1][x-1] = 1
for i in range(n):
  for j in range(n):
    if ans[i][j] > ans[i][x-1]+ans[x-1][j]:
      ans[i][j] = ans[i][x-1]+ans[x-1][j]
    
for i in range(n):
  for j in range(n):
    if ans[i][j] > ans[i][y-1]+ans[y-1][j]:
      ans[i][j] = ans[i][y-1]+ans[y-1][j]

answer = [0]*(n-1)
for i in range(n):
  for j in range(n):
    if ans[i][j] == n or ans[i][j] == 0:
      continue
    answer[ans[i][j]-1] += 1
for i in range(n-1):
  print(answer[i]//2)

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

Solution (Python):
n,x,y = map(int,input().split())
al = [0 for i in range(n-1)]
for i in range(1,n):
    for j in range(i+1,n+1):
        if i <= x:
            if j <= x:
                al[j-i-1] += 1
            elif j <= y:
                now = min(j-i,y-j+(x-i)+1)
                al[now-1] += 1
            else:
                al[j-y+(x-i)] += 1
        elif i <= y:
            if j <= y:
                now = min(j-i,y-j+(i-x)+1)
                al[now-1] += 1
            else:
                now = min(j-i,j-y+(i-x)+1)
                al[now-1] += 1
        else:
            al[j-i-1] += 1
for i in al:
    print(i)

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

lnd=[0 for _ in range(N)]
for i in range(N):
    for j in range(i+1,N):
        if (0<=i<=X and 0<=j<=X) or (Y<=i<=N-1 and Y<=j<=N-1):
            
            lnd[j-i]+=1

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

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

for i in range(n-1):
  for j in range(i+1,n):
    a=j-i
    b=abs(x-i)+1+abs(y-j)


    mn=min(a,b)
    
    ans[mn-1]+=1
    



for x in ans:
  print(x)

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):
        r = min(j-i, abs(X-i)+abs(X-j)+1, abs(X-i)+abs(Y-j)+1, abs(Y-i)+abs(Y-j)+1)
        D[r] += 1
for i in range(1, N):
    print(D[i])

Solution (Python):
from collections import defaultdict

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

x -= 1
y -= 1

dist_counts = defaultdict(int)
for i in range(n):
    for j in range(i + 1, n):
        path1 = abs(j - i)
        path2 = abs(x - i) + 1 + abs(y - j)
        dist = min(abs(j - i), path2)
        dist_counts[dist] += 1

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

Solution (Python):
def main():
    from collections import deque
    N, X, Y = (int(i) for i in input().split())
    X -= 1
    Y -= 1
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        edge[i].append(i+1)
        edge[i+1].append(i)
    edge[X].append(Y)
    edge[Y].append(X)

    def bfs(s):
        d = [-1 for _ in range(N)]
        que = deque()
        d[s] = 0
        que.append(s)
        while que:
            u = que.popleft()
            for v in edge[u]:
                if d[v] != -1:
                    continue
                d[v] = d[u] + 1
                que.append(v)
        return d

    dist = [[] for _ in range(N)]
    for i in range(N):
        dist[i] = bfs(i)
    cnt = [0]*N
    for i in range(N):
        for j in range(i+1, N):
            cnt[dist[i][j]] += 1
    for c in cnt[1:]:
        print(c)


if __name__ == '__main__':
    main()

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):
    if j <= X or Y <= i:
      ans[j-i-1] += 1
    elif i <= X and Y <= j:
      ans[(X-i)+1+(j-Y)-1] += 1
    elif i <= X and X < j and j < Y:
      a = min(j-X,1+Y-j)
      ans[X-i+a-1] += 1
    elif X < i and i < Y and Y <= j:
      a = min(Y-i,i-X+1)
      ans[a+j-Y-1] += 1
    elif X < i and j < Y:
      a = min(j-i,i-X+1+Y-j)
      ans[a-1] += 1
for r in ans:
  print(r)

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
from re import split
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy
import re

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
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 MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n, x, y = LI()
G = [[] for _ in range(n)]
ans = [0] * (n - 1)
for i in range(n - 1):
    G[i] += [i + 1]
    G[i + 1] += [i]

for j in range(n):
    q = [j]
    par = [-1] * n
    dist = [-1] * n
    dist[j] = 0
    while q:
        u = q.pop()
        for v in G[u]:
            if dist[v] == -1:
                dist[v] = dist[u] + 1
                q += [v]
    flag = [0] * n
    q2 = [x - 1, y - 1]
    dist[x - 1] = min(dist[x - 1], dist[y - 1] + 1)
    dist[y - 1] = min(dist[y - 1], dist[x - 1] + 1)
    while q2:
        a = q2.pop()
        for b in G[a]:
            if dist[a] + 1 < dist[b]:
                dist[b] = dist[a] + 1
                q2 += [b]

    for k in range(n):
        if k == j: 
            continue
        else:
            ans[dist[k] - 1] += 1


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

Solution (Python):

import sys


def solve(N: int, X: int, Y: int):
    D = [0 for _ in range(N)]
    for i in range(N):
        for j in range(i+1, N):
            if j <= X-1:
                d = j - i
            elif i >= Y-1:
                d = j - i
            else:
                d = min(j-i, abs(i-X+1)+abs(j-Y+1)+1)
            D[d] += 1
    for i in range(N-1):
        print(D[i+1])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    X = int(next(tokens))  
    Y = int(next(tokens))  
    solve(N, X, Y)

if __name__ == '__main__':
    main()

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

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def dijkstra_heap(s,edge):
    
    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

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

ans=[0]*n
for i in range(n):
  a=dijkstra_heap(i,edge)
  
  for x in a[i:]:
    ans[x]+=1

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

Solution (Python):
def calc(N, X, Y):
    X -= 1
    Y -= 1
    d = {i: 0 for i in range(N)}
    for i in range(N):
        for j in range(i, N):
            e = min(
                abs(j - i),
                abs(X - i) + 1 + abs(Y - j),
                abs(Y - i) + 1 + abs(X - j)
                )
            d[e] += 1
    ans = '\n'.join([str(d[i]) for i in range(1, N)])
    return ans



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

Solution (Python):
N,X,Y=map(int,input().split())
c=[[1]]+[[i-1,i+1] for i in range(1,N-1)]+[[N-2]]
c[X-1].append(Y-1)
c[Y-1].append(X-1)
from collections import deque
q=deque()
a=[0]*(N-1)
for i in range(N):
    d=[-1]*N
    d[i]=0
    q.append(i)
    while q:
        p=q.popleft()
        for n in c[p]:
            if d[n]<0:
                q.append(n)
                d[n]=d[p]+1
                a[d[p]]+=1
print(*[i//2 for i in a],sep='\n')

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

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

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

    if i == 0:
        G[i].append(1)
    elif i == N-1:
        G[i].append(N-2)
    else:
        G[i].append(i+1)
        G[i].append(i-1)

ans = [0]*(N-1)
for s in range(N):
    dist = [-1]*N
    q = deque([])
    q.append(s)
    dist[s] = 0

    while len(q) != 0:
        v = q.popleft()
        for nv in G[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            q.append(nv)
    for d in dist:
        if d != 0:
            ans[d-1] += 1

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

Solution (Python):

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

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

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

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

N,X,Y = map(int,input().split(' '))
M = -(-(X+Y)//2)
ANS = []
for i in range(N):
    for j in range(i+1,N):
        d = j-i
        dd = abs(X-1-i)+1+abs(Y-1-j)
        ANS.append(min(d,dd))
ANS.sort()
L = len(ANS)
cnt = 0
ans = [0]*(N-1)
while cnt != L:
    k = ANS[cnt]
    ans[k-1] += 1
    cnt += 1
for i in range(N-1):
    print(ans[i])

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

d = {i:0 for i in range(1, n)}
for i in range(n-1):
    for j in range(i+1, n):
        d[min(j-i, abs(j-y)+1+abs(x-i))] += 1
print(*d.values(), sep='\n')

Solution (Python):
from math import *


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

d = y - x + 1
res = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        if j <= x:
            res[j-i] += 1
        elif i >= y:
            res[j-i] += 1
        elif i >= x and j <= y:
            t = min(j - i, d - j + i)
            res[t] += 1
        elif i <= x and  x <= j <= y:
            d1 = x - i
            t = d1 + min(j - x, d - j + x)
            res[t] += 1
        elif y >= i >= x  and j >= y:
            d1 = j - y
            t = d1 + min(y - i, d - y + i)
            res[t] += 1
        else:
            res[j - i - d + 2] += 1
            

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

Solution (Python):
from collections import deque

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

ret = [0] * N

vec = [[] for _ in range(N)]
for i in range(N - 1) :
  vec[i].append(i + 1)
  vec[i + 1].append(i)
vec[X - 1].append(Y - 1)
vec[Y - 1].append(X - 1)
  
for i in range(N) :
  dist = [-1] * N
  dist[i] = 0
  q = deque([i])
  while q :
    cur = q.popleft()
    cd = dist[cur]
    for nex in vec[cur] :
      if dist[nex] != -1 : continue
      q.append(nex)
      dist[nex] = cd + 1
  
  for i in range(N) :
    ret[dist[i]] += 1
    
    
for i in range(1, N) :
  print(ret[i] // 2)

Solution (Python):


def main():
     n, x, y = map(int, input().split())
     ans = [0 for i in range(n)]

     for i in range(1, n+1):
          for j in range(i+1, n+1):
               route_a = j - i
               route_b = abs(x-i) + abs(j-y) + 1
               dis = min(route_a, route_b)
               
               ans[dis] += 1
     
     print('\n'.join(map(str, ans[1:])))

if __name__ == "__main__":
    main()

Solution (Python):

n, x, y = map(int, input().split())
count = [0]*(n-1)

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

for ci in count:
    print(ci)