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 heapq as hq

def D_stra(N,connections,st):
    mxc=2**29
    cost =[mxc for i in range(N)]
    visited =[False for i in range(N)]
    cost[st]=0
    q=[]

    hq.heappush(q,(0,st))

    while q:
        c,node=hq.heappop(q)

        if visited[node]:
            continue
        visited[node]=True

        for connection in connections[node]:

            target,mc=connection
            if cost[target]>c+mc:
                cost[target]=c+mc
                hq.heappush(q,(c+mc,target))
    
    return cost



def resolve():
    N , X, Y = map(int,input().split())
    conections =[[[1,1]]]
    for i in range(1,N-1):
        conections.append([[i-1,1],[i+1,1]])
    conections.append([[N-2,1]])
    conections[X-1].append([Y-1,1])
    conections[Y-1].append([X-1,1])

    dist = [0 for i in range(N)]
    for i in range(N):
        cost = D_stra(N,conections,i)
        for j in cost[i:]:
            dist[j] += 1
    for i in dist[1:]:
        print(i)






if __name__ == "__main__":
    resolve()

Solution (Python):
import sys

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

res = {}

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

		

		if d in res:
			res[d] += 1
		else:
			res[d] = 1

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

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

    ans = [0]*(N-1)

    for i in range(1, N):
        for j in range(i+1, N+1):
            if j <= X or Y <= i:
                tmp = j - i
            elif i <= X and j <= Y:
                tmp = (X - i) + min(j - X, Y - j + 1)
            elif i <= X and Y <= j:
                tmp = (X - i) + (j - Y) + 1
            elif i <= Y and Y <= j:
                tmp = (j - Y) + min(Y - i, i - X + 1)
            else:
                tmp = min(j - i, i - X + Y - j + 1)

            ans[tmp - 1] += 1

    print(*ans, sep="\n")


main()

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

dist = [0] * n

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

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

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]


def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n,x,y = get_nums_l()

x,y = (min(x,y), max(x,y))

by_cost = [0] * (n+1)

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

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

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

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

Solution (Python):
N, X, Y = map(int, input().split())
f = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        if j <= X or Y < i:
            d = j - i
        elif i <= X and j <= Y:
            d = min(j - i, Y - j + 1 + X - i)
        elif i <= X and Y < j:
            d = X - i + 1 + j - Y
        elif X < i and Y < j:
            d = min(j - i, j - Y + 1 + i - X)
        elif X < i and j <= Y:
            d = min(j - i, i - X + 1 + Y - j)
        f[d] += 1
for i in range(1, N):
    print(f[i])

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, X, Y = LI()
    X-=1
    Y-=1
    G = [[N+1 for _ in range(N)] for __ in range(N)]
    dists = []
    for i in range(N):
        for j in range(i, N):
            if i == j:
                continue
            
            
            route = abs(X-i) + 1 + abs(Y-j)
            G[i][j] = min(abs(i-j), route)
            dists.append(G[i][j])
    c_dists = collections.Counter(dists)
    for i in range(1, N):
        print(c_dists[i])

main()

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


ans=[0]*(n+1)
for i in range(n):
    for j in range(n):
        ans[d[i][j]]+=1
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(1, n):
    for j in range(i + 1, n + 1):
        ans[min(j - i, abs(i - x) + abs(j - y) + 1)] += 1

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

Solution (Python):


import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

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

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):
        d = min(j-i, abs(i-x)+abs(y-j)+1)
        ANS[d-1] += 1
print(*ANS, sep='\n')

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

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n,x,y = l_in()
d = [0 for _ in range(n)]















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


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

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

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

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

Solution (Python):
import itertools
N,X,Y = map(int,input().split())
C = list(itertools.combinations(range(1,N+1),2))
ansdic = {i:0 for i in range(1,N)}

for i in C:
    a = i[0]
    b = i[1]
    tmpxy = abs(X - a) + 1 + abs(Y - b)
    tmp = b - a
    
    ansdic[min(tmpxy,tmp)] += 1
    
for i in ansdic.keys():
    print(ansdic[i])

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 i >= y:
      k = j-i
    elif i <= x and j >= y:
      k = x-i+j-y+1
    elif i <= x and j <= y:
      k = min(j-i,x-i+1+y-j)
    elif i >= x and j >= y:
      k = min(j-i,j-y+1+i-x)
    else:
      k = min(j-i,y-j+1+i-x)
    ans[k] += 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):
        l[min(j-i,abs(X-i)+abs(Y-j)+1)-1]+=1
print(*l,sep="\n")

Solution (Python):
def inputs(): return [int(x) for x in input().split()]
from collections import defaultdict
n,x,y = inputs()
ans = defaultdict(int)
for i in range(1,n):
    ans[i]=0
for i in range(1,n+1):
    for j in range(i+1,n+1):
        if i<=x and y<=j:
            a = x-i+1+j-y
            ans[a]+=1
        else:
            if i<=x:
                a=min(j-i,x-i+1+y-j)
            elif y<=j:
                a = min(j-i,i-x+1+j-y)
            elif x<i and j<y:
                a = min(j-i,i-x+1+y-j)
            ans[a]+=1
for i in ans.keys():
    print(ans[i])

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

dist_list = [0 for _ in range(n)]

for i in range(1,n+1):
    for j in range(i+1,n+1):
        if j <= x or i >= y:
            distance = j-i
        else:
            distance = min(j-i,abs(x-i)+abs(y-j)+1)
        dist_list[distance] += 1

for i,dist in enumerate(dist_list):
    if i >= 1:
        print(dist)

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

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

Solution (Python):
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):
        ans[min(abs(i-j), abs(X-i)+abs(Y-j)+1)] += 1
for x in ans[1:]:
    print(x)

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

anss = [0] * N
for a in range(1, N+1):
    for b in range(a+1, N+1):
        d1 = b-a
        d2 = abs(X-a) + 1 + abs(Y-b)
        d = d1 if d1 <= d2 else d2
        anss[d] += 1

print('\n'.join(map(str, anss[1:])))

Solution (Python):
from collections import deque
n,x,y = map(int, input().split())
INF=1001001001001
x-=1
y-=1
mp=[list() for _ in range(n)]
for i in range(1,n-1):
    mp[i] = [i-1,i+1]

mp[0]=[1]
mp[-1]=[n-2]
mp[x].append(y)
mp[y].append(x)

ans=[0]*n

for i in range(n):
    dist=[INF]*n
    dist[i]=0
    d=deque()
    d.append(i)
    while d:
        s = d.popleft()
        for g in mp[s]:
            if dist[g]==INF:
                dist[g]=dist[s]+1
                d.append(g)

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

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy


from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd

sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def dijkstra(s,n,g):
    dis = [10**10]*n
    dis[s] = 0
    que = deque([])
    que.append(s)
    while que:
        go = que.pop()
        for i in range(len(g[go])):
            if dis[g[go][i]] <= dis[go] + 1:
                continue
            dis[g[go][i]] = dis[go] + 1
            que.append(g[go][i])
    return dis

def main():
    n,x,y = inpm()
    x -= 1
    y -= 1
    g = [[] for _ in range(n)]
    for i in range(n-1):
        a = i
        b = i+1
        g[a].append(b)
        g[b].append(a)
    g[x].append(y)
    g[y].append(x)
    ans = [0 for _ in range(n-1)]
    for i in range(n-1):
        d = dijkstra(i,n,g)
        for j in range(i+1,n):
            ans[d[j]-1] += 1
    for i in range(n-1):
        print(ans[i])
        
    
if __name__ == "__main__":
    main()

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


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

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

ans = [0] * n

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

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

Solution (Python):
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)
x -= 1
y -= 1
g[x].append(y)
g[y].append(x)

d = {}
for i in range(n):
    d[i] = 0

from collections import deque
for i in range(n):
    q = deque()
    q.append(i)
    visit = [-1]*n
    visit[i] = 0
    while q:
        x = q.popleft()
        for nx in g[x]:
            if visit[nx] == -1:
                visit[nx] = visit[x]+1
                q.append(nx)
    for i in range(n):
        d[visit[i]] += 1

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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

def dijkstra(s,graph):
    d = [inf]*n
    d[s] = 0
    h = [(0,s)]
    while h:
        c,v = heappop(h)
        if d[v] < c:
            continue
        for t,cost in graph[v]:
            if d[v] + cost < d[t]:
                d[t] = d[v] + cost
                heappush(h,(d[t],t))
    return d

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

edge[x-1].append([y-1,1])
edge[y-1].append([x-1,1])
for i in range(n):
    d = dijkstra(i, edge)
    for j in range(i+1,n):
        ans[d[j]] += 1
for k in range(1,n):
    print(ans[k])

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '
        
        
    return ret


MOD = 10**9 + 7

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  

N, X, Y = read_ints()
X -= 1
Y -= 1






from scipy.sparse import csr_matrix  


from scipy.sparse.csgraph import dijkstra
graph = [[0] * N for _ in range(N)]
for i in range(N - 1):
    graph[i][i + 1] = 1
    graph[i + 1][i] = 1
graph[X][Y] = 1
graph[Y][X] = 1
adj_mat = csr_matrix(graph)
D = dijkstra(adj_mat, directed=False)
cnt = Counter(D.reshape(-1))
for i in range(1, N):
    print(int(cnt[i]) // 2)

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

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

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

print('\n'.join(map(str, ans[1:])))

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):
        if j <= X:
            ans[j-i-1] += 1
        elif i <= X:
            ans[min(j-i, X-i+1+abs(Y-j))-1] += 1
        elif i < Y:
            ans[min(j-i, i-X+abs(j-Y)+1)-1] += 1
        else:
            ans[j-i-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):
    for j in range(i+1, n):
        dist = min(j-i, abs(j-x) + 1 + abs(i-y),  abs(j-y) + 1 + abs(i-x))
        cnt[dist] += 1
        
for i in range(1, n):
    print(cnt[i])

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'

    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase

input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0
n,x,y=LI()
d=[0]*n

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

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

Solution (Python):
def dis(i,j,x,y):
    a = j-i
    b = abs(i-x)+abs(j-y)+1
    c = abs(i-y)+abs(j-x)+1
    return min(a,b,c)
n,x,y = map(int,input().split())
ans = [0 for i in range(n)]
for i in range(1,n):
    for j in range(i+1,n+1):
        ans[dis(i,j,x,y)-1]+= 1
for i in range(n-1):
    print(ans[i])

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

import heapq
from collections import defaultdict
cost = defaultdict(list)
for i in range(1, n):
    cost[i-1].append((i, 1))
    cost[i].append((i - 1, 1))
cost[x-1].append((y - 1, 1))
cost[y-1].append((x - 1, 1))

dists = []

for start in range(n):
    d = [float('inf')] * n 
    d[start] = 0

    q = [(d[start], start)] 
    prev = [None] * n 
    heapq.heapify(q)
    while q:
        du, u = heapq.heappop(q) 
        if d[u] < du:
            continue
        for v, weight in cost[u]:
            if du + weight < d[v]:
                d[v] = du + weight
                prev[v] = u
                heapq.heappush(q, (d[v], v))

    dists.append(d)



from collections import Counter
c = Counter()
for i in range(n):
    for j in range(i+1, n):
        c[dists[i][j]] += 1

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

Solution (Python):
def main():
    N, X, Y = map( int, input().split())
    K = [0]*N
    X -= 1
    Y -= 1
    for i in range(N-1):
        for j in range(i+1,N):
            if i <= X:
                if j <= X:
                    K[j-i] += 1
                elif X <= j <= Y:
                    if (X-i) + 1 + (Y-j) <= j-i:
                        K[(X-i) + 1 + (Y-j)] += 1
                    else:
                        K[j-i] += 1
                else:
                    K[(X-i) + 1 + (j-Y)] += 1
            elif i <= Y:
                if j <= Y:
                    if (i-X) + 1 + (Y-j) <= j-i:
                        K[(i-X) + 1 + (Y-j)] += 1
                    else:
                        K[j-i] += 1
                else:
                    if (i-X) + 1 + (j-Y) <= j-i:
                        K[(i-X) + 1 + (j-Y)] += 1
                    else:
                        K[j-i] += 1
            else:
                K[j-i] += 1

    print( "\n".join( map( str, K[1:])))
if __name__ == '__main__':
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X, Y = MAP()
graph = [[] for _ in range(N)]

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

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

dic = defaultdict(int)
for i in range(N):
    q = deque()
    q.append(i)
    dist = [INF]*N
    dist[i] = 0
    while q:
        n = q.popleft()
        for node in graph[n]:
            if dist[node] == INF:
                dist[node] = dist[n] + 1
                q.append(node)

    for d in dist:
        dic[d] += 1

for k in range(1, N):
    print(dic[k]//2)

Solution (Python):
from collections import deque
n, x, y = map(int, input().split())
g = [[] for _ in range(n)]
g[0].append(1)
g[-1].append(n - 2)
g[x - 1].append(y - 1)
g[y - 1].append(x - 1)
for i in range(1, n - 1):
    g[i].append(i - 1)
    g[i].append(i + 1)
ans = [0] * n
for i in range(n):
    q = deque([i])
    d = [-1] * n
    d[i] = 0
    while q:
        p = q.popleft()
        for node in g[p]:
            if d[node] == -1:
                q.append(node)
                d[node] = d[p] + 1
                ans[d[node]] += 1
for k in range(1, n):
    print(ans[k] // 2)

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

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):
        if i<X:
            if j<X:
                ans[j-i]+=1
            elif j<=Y:
                ans[X-i+min(j-X, Y-j+1)]+=1
            else:
                ans[X-i+j-Y+1]+=1
        elif i<=Y:
            if j<=Y:
                ans[min(j-i, i-X+Y-j+1)]+=1
            else:
                ans[min(i-X+1, Y-i)+j-Y]+=1
        else:
            ans[j-i]+=1

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

Solution (Python):
n,x,y = map(int,input().split())
d = y-x-1
x -= 1
y -= 1
A = [0 for i in range(n)]
for i in range(n):
    for j in range(i+1, n):
        if i <= x and y <= j:
            A[j-i-d] += 1
        else:
            
            A[min(j-i, abs(x-i)+abs(y-j)+1)] += 1
        

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

Solution (Python):
import sys

def solve():
    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 Y <= i:
                L[j - i - 1] += 1
            elif i <= X and Y <= j:
                L[j - i - (Y - X)] += 1
            elif X <= i < j <= Y:
                L[min(j - i - 1, i - X + Y - j)] += 1
            elif i <= X and X <= j < Y:
                L[min(j - i - 1, X - i + Y -j)] += 1
            else:
                L[min(j - i - 1, j - Y + i - X)] += 1
    print("\n".join(map(str, L)))

    return 0

if __name__ == "__main__":
    solve()

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

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

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

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N, X, Y = inpl()
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(X-i)+abs(Y-j)+1)
        ans[d] += 1
for n in range(1,N):
    print(ans[n])

Solution (Python):
def main():
    N, X, Y = list(map(int, input().split()))
    X, Y = X - 1, Y - 1
    K = [0] * N
    for i in range(N - 1):
        for j in range(i + 1, N):
            if j <= X or Y <= i:
                K[j - i] += 1
            else:
                K[min(j - i, abs(X - i) + 1 + abs(Y - j))] += 1
    print("\n".join(str(i) for i in K[1:]))

main()

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(100000000)
MOD = 10**9+7
INF = 10 ** 9

def 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):
            tmp = min(j - i,abs(i - x) + 1 + abs(j - y))
            ans[tmp] += 1
    for i in range(1,n):
        print(ans[i])           

if __name__=='__main__':
    main()

Solution (Python):
def main():
    import sys
    from collections import defaultdict
    N,x,y=list(map(int,sys.stdin.readline().split()))
    
    x-=1
    y-=1

    dists=defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i>=j:
                continue

            a=j-i
            b=abs(i-x)+abs(j-y)+1

            dists[min(a,b)]+=1

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

main()

Solution (Python):
from scipy.sparse.csgraph import dijkstra
import numpy as np
from collections import Counter

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

l = np.zeros((n,n))
l[range(n-1),range(1,n)] = 1
l[x-1,y-1] = 1
dis = dijkstra(l,directed = False)

ans = Counter(dis.reshape(-1))

for i in range(1,n):
    print(ans.get(i,0)//2)

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):
    index = min(j-i,abs(x-i)+abs(y-j)+1)
    k[index] += 1
for i in k[1:]:
  print(i)

Solution (Python):
n,x,y=map(int,input().split())
dist=[[0 for i in range(n)] for j in range(n)]
m=n
connection=[[] for i in range(n)]
for i in range(n-1):
  connection[i].append(i+1)
for i in range(1,n):
  connection[i].append(i-1)
connection[x-1].append(y-1)
connection[y-1].append(x-1)

def bfs(v):
  distance=[-1]*n
  distance[v]=0
  next=connection[v]
  next2=set()
  visited=[-1]*n
  visited[v]=1
  visitct=1
  ct=0
  while len(next)!=0 and visitct!=n:
    ct+=1
    for i in range(len(next)):
      if visited[next[i]]==-1:
        distance[next[i]]=ct
        visited[next[i]]=1
        visitct+=1
        for j in range(len(connection[next[i]])):
          if visited[connection[next[i]][j]]==-1:
            next2.add(connection[next[i]][j])
    next=list(next2)
    next2=set()
  return distance

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

for i in range(n):
  b=bfs(i)
  for j in range(n):
    ct[b[j]]+=1

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

Solution (Python):
from collections import deque


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

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


ans = [0] * n
def solve(i):
    q = deque([i])
    visited = [-1] * n
    visited[i] = 0
    while q:
        v = q.popleft()
        for nxt_v in graph[v]:
            if visited[nxt_v] >= 0:
                continue
            else:
                visited[nxt_v] = visited[v] + 1
                q.append(nxt_v)
    for i in range(n):
        ans[visited[i]] += 1

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