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 sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

























def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007




def main():
	N,X,Y = inputMap()
	g2 = Graph()

	for i in range(N):
		if i == 0:
			continue

		g2.add_edge(i-1, i, 1)
		if i >= X:
			g2.add_edge(i, i-1, 1)

	g2.add_edge(X-1, Y-1, 1)
	

	ans2 = 0
	ans = []
	ansans = [0 for i in range(N)]
	for ii in range(N):
		d2 = Dijkstra(g2, ii)
		for jj in range(N):
			if ii >= jj:
				continue
			tmp2 = d2.shortest_distance(jj)

			if (jj,ii) in ans:
				continue
			
			ansans[tmp2] += 1
			

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









class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        
        
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        
        self.prev = defaultdict(lambda: None)

        
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))



def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y



def H(n, r, mod=10**9+7):
	
	
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        
        
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
from collections import defaultdict
from heapq import heappop, heappush

from decimal import *

























def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

inf = float('inf')
mod = 1000000007




def main():
	N,X,Y = inputMap()
	g2 = Graph()

	for i in range(N):
		if i == 0:
			continue

		g2.add_edge(i-1, i, 1)
		if i >= X:
			g2.add_edge(i, i-1, 1)

	g2.add_edge(X-1, Y-1, 1)
	

	ans2 = 0
	ans = []
	ansans = [0 for i in range(N)]
	for ii in range(N):
		d2 = Dijkstra(g2, ii)
		for jj in range(N):
			if ii >= jj:
				continue
			tmp2 = d2.shortest_distance(jj)

			
				
			
			ansans[tmp2] += 1
			

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









class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return self.graph.keys()


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        
        
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        
        self.prev = defaultdict(lambda: None)

        
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m

    return f(int(math.sqrt(n) * (1 + 1e-10)))



def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res


def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def egcd(a, b):
    if a == 0:
        return b, 0, 1
    else:
        g, y, x = egcd(b % a, a)
        return g, x - (b // a) * y, y



def H(n, r, mod=10**9+7):
	
	
    return combination(n+r-1, r, mod)

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        
        
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

if __name__ == "__main__":
	main()

Solution (Python):
from scipy.sparse.csgraph import dijkstra
import sys
def main():
	input = sys.stdin.readline

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

	route = [[0 for _ in range(n)]for _ in range(n)]
	for i in range(n-1):
		route[i][i+1] = 1

	route[x-1][y-1] = 1
	route[y-1][x-1] = 1
	route = tuple(route)
	
	res = tuple(dijkstra(route, directed=False))

	ans = [0 for _ in range(n)]
	for i in range(n):
		for j in range(i,n):
			ans[int(res[i][j])] += 1

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

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

for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        if (e <= x)or(s >= y):
            kl[d - 1] += 1
        else:
            kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1

for i in kl:
    print(i)

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

lis = [0]*(n-1)
for i in range(n):
    disxi = min(abs(x-1-i), abs(y-1-i))
    for j in range(i+1, n):
        a = j-i
        if a == 1:
            dist = 1
        else:
            b = disxi + 1 + min(abs(y-1-j), abs(x-1-j))
            dist = min(a, b)
        lis[dist-1] += 1

for i in lis:
    print(i)

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

g = [[i-1, i+1] for i in range(N)]
g[0].remove(-1)
g[N-1].remove(N)
g[X-1].append(Y-1)
g[Y-1].append(X-1)

ans_list = [0] * N

for i in range(N):
    queue = g[i]
    seen = [False] * N
    length = 0
    while queue:
        length += 1
        add = []
        for qi in queue:
            if seen[qi] == False:
                if i < qi:
                    ans_list[length] += 1
                seen[qi] = True
                add += g[qi]
        queue = list(set(add))


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

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

    for dc in S:
        print(dc)

if __name__ == '__main__':
    resolve()

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

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

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

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

Solution (Python):

import sys
from collections import deque
from collections import defaultdict

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

al=[ [] for i in range(N+1) ]	

for i in range(1,N):
    al[i].append(i+1)
    al[i+1].append(i)

al[X].append(Y)
al[Y].append(X)


C=defaultdict(lambda: 0)

for start in range(1,N+1):
    
    d=[ float("inf") for _ in range(N+1) ]
    d[start]=0

    
    
    Visit=[ 0 for _ in range(N+1) ]
    q=deque()
    q.append(start)
    Visit[start]=1

    while q:
        fro=q.popleft()
        for to in al[fro]:
            if Visit[to]==0:
                Visit[to]=1	
                q.append(to)
                d[to]=min(d[to],d[fro]+1)

    for i in range(start+1,N+1):
        C[d[i]]+=1

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

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

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

cnt = [0] * (n+1)
for i in range(n-1):
    for j in range(i+1, n):
        mind = d[i][j]
        cnt[mind] += 1

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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


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

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

Solution (Python):
N,X,Y = map(int,input().split())
A = [0]*(N-1)
mi = 0
for i in range(1,N+1):
  for j in range(1,N+1):
    if i < j :
      mi = min(j-i,(abs(X-i)+abs(Y-j)+1))
      A[mi-1] += 1
for i in range(N-1):
  print(A[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):
        ans[min(j-i,1+abs(i-x)+abs(j-y))-1]+=1

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

Solution (Python):
N, X, Y = map(int, input().split())
graph = [set() for _ in range(N)]
graph[X - 1].add(Y - 1)
graph[Y - 1].add(X - 1)
for i in range(N - 1):
    graph[i].add(i + 1)
    graph[i + 1].add(i)


dist = [[10 ** 9] * N for _ in range(N)]
for i in range(N):
    queue = [i]
    seen = {i}
    dist[i][i] = 0
    while queue:
        new = []
        for cur in queue:
            for nei in graph[cur]:
                dist[i][nei] = min(dist[i][nei], dist[i][cur] + 1)
                if nei not in seen:
                    new.append(nei)
                    seen.add(nei)
        queue = new
count = [0] * N
for i in range(N):
    for j in range(i + 1, N):
        count[dist[i][j]] += 1

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

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

d = {}

for i in range(1, N):
    for j in range(i + 1, N + 1):
        if j >= Y and i <= X:
            d[(i, j)] = min(j - i - (Y - X) + 1, j - i)    
        elif i <= X:
            d[(i, j)] = min(j - i, X - i + 1 + Y - j)    
        elif j >= Y:
            d[(i, j)] = min(j - i, i - X + 1 + j - Y)    
        else:
            d[(i, j)] = min(j - i, i - X + 1 + Y - j)

ans = [0] * (N - 1)

for k, v in d.items():
    ans[v - 1] += 1

for v in ans:
    print(v)

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

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

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

d = defaultdict(set)
for i in range(N-1):
    d[i].add(i+1)
    d[i+1].add(i)
d[X-1].add(Y-1)
d[Y-1].add(X-1)


cost = [[N]*N for _ in range(N)]

q = deque()

for i in range(N):
    q.append((i, 0))
    cost[i][i] = 0

    while q:
        u, st = q.popleft()

        for v in d[u]:
            if v != u and cost[i][v] > st+1:
                cost[i][v] = st+1
                q.append((v, st+1))

res = Counter()
for i, c in enumerate(cost):
    res += Counter(c[:i])

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

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


nums = [None] + [0 for _ in range(n-1)]























numx = n - (y-x-1)
if numx >= 2:
    for i in range(1, numx):
        nums[i] = numx - i

x1 = x + 1
y2 = y - 1

for i in range(x1, y2+1):
    for j in range(i+1, y2+1):
        d = min(j-i, y-j + 1 + i-x)
        
        nums[d] += 1


for i in range(1, x+1):
    for j in range(x1, y2+1):
        d = min(j-i,x-i+1+y-j)
        
        nums[d] += 1


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

nums = nums[1:]
for num in nums:
    print(num)

Solution (Python):
N, X, Y = map(int, input().split())
r = X - 1
l = N - Y
m = Y - X + 1
for i in range(1, N):
    ans = 0
    
    if i * 2 == m:
        ans += i
    elif i * 2 < m:
        ans += m
    
    ans += max(0, r + 1 - i)
    for j in range(1, r+1):
        if j >= i:
            continue
        diff = i - j
        
        if diff * 2 == m:
            ans += 1
        elif diff * 2 < m:
            ans += 2
        
        if diff - 1  >= 1 and diff - 1 <= l:
            ans += 1
    
    ans += max(0, l + 1 - i)
    for j in range(1, l+1):
        if j >= i:
            continue
        diff = i - j
        
        if diff * 2 == m:
            ans += 1
        elif diff * 2 < m:
            ans += 2
    print(ans)

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

lists = [0 for i in range(N-1)]
for i in range(1,Y):
    for j in range(i+1,N+1):
        if i <= X and Y <= j:
            pro = j-i-dis+1
            lists[pro-1] += 1
        elif i <= X and X <= j <= Y:
            pro = X+Y-i-j+1
            sta = j-i
            lists[min(pro,sta)-1] += 1
        elif X <= i <= Y and Y <= j:
            pro = i+j-X-Y+1
            sta = j-i
            lists[min(pro,sta)-1] += 1
        elif X <= i <= Y and X <= j <= Y:
            pro = i-j-X+Y+1
            sta = j-i
            lists[min(pro,sta)-1] += 1
        else:
            lists[j-i-1] += 1

for i in range(1,N-Y+1):
    lists[i-1] += N-Y-i+1
    
for i in lists:
    print(i)

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

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

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

kl = [0] * (n - 1)

for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        if (e <= x)or(s >= y):
            kl[d - 1] += 1
        else:
            kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1

for i in kl:
    print(i)

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

def flatten_2dim(array):
    return [item for sublist in array for item in sublist]

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



l = [[0]*n for i in range(n)]
for i in range(n-1):
    l[i][i+1] = 1
    l[i+1][i] = 1 
l[x-1][y-1] = 1
l[y-1][x-1] = 1


a = np.array(l)
ans = shortest_path(a,method ="D")
ans_counter = Counter(flatten_2dim(ans))



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

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

Solution (Python):



from math import *
from copy import *
from string import *				
from random import *				
from bisect import *				
from sys import stdin				
from sys import maxsize
from operator import *				
from itertools import *
from collections import Counter		
from collections import defaultdict 

'''
5 2 4
'''

def solve(n,x,y):
	adj = [[] for i in range(n+1)]
	adj[x].append(y)
	adj[y].append(x)
	for i in range(1,n):
		adj[i].append(i+1)
		adj[i+1].append(i)
	
	ans = []
	d = {}
	for i in range(1,n):
		d[i] = 0
	for k in range(1,n+1):
		q = [k]
		dis = [maxsize]*(n+1)
		dis[k] = 0
		while(q):
			src = q.pop()
			for nn in adj[src]:
				
				if(dis[nn] > dis[src]+1):
					
						
					dis[nn] = dis[src] + 1
					q.append(nn)
				
				
			
			
			
		curr = 0
		
		
		for ii in range(k+1,n+1):
			d[dis[ii]] += 1
	return d

N,X,Y = list(map(int, stdin.readline().rstrip().split()))
ans = solve(N,X,Y)
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(n+1):
        if j<=i:
            continue
        a=j-i
        b=abs(x-i)+1+abs(y-j)
        aa=min(a,b)
        ans[aa]+=1

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

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



r = y - x - 1
left = x
right = n - y + 1
base = left + right
arr = np.array([0] * (n - 1))
for k in range(base):
    arr[k] += base - k - 1
    
r += 2
if r % 2 == 0:
    arr_r = [r] * ((r // 2) - 1) + [r // 2]
else:
    arr_r = [r] * (r // 2)
    
r -= 2
for k in range(len(arr_r)):
    arr[k] += arr_r[k]





if r % 2 == 0:
    arr_r = [1] + [2] * ((r // 2) - 1)  + [1]
else:
    arr_r = [1] + [2] *(r // 2)
    


arr = np.array(arr)
if right > 1:
    for k in range(1, right):
        arr[k : k + len(arr_r)] += arr_r
if left > 1:
    for k in range(1, left):
        arr[k : k + len(arr_r)] += arr_r
arr[0] -= 1
for a in arr:
    print(a)

Solution (Python):
import sys

from collections import Counter, defaultdict, deque

input = sys.stdin.readline

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


def bfs(source):
    q = deque([source])
    dist = {source: 0}
    while q:
        i = q.popleft()
        d = dist[i]
        nbr = []
        if i - 1 >= 1:
            nbr.append(i - 1)
        if i + 1 <= N:
            nbr.append(i + 1)
        if i == X:
            nbr.append(Y)
        if i == Y:
            nbr.append(X)
        for j in nbr:
            if j not in dist:
                q.append(j)
                dist[j] = d + 1
    return dist


count = Counter()
for i in range(1, N + 1):
    dist = bfs(i)
    assert len(dist) == N
    for j, d in dist.items():
        if i < j:
            count[d] += 1

ans = []
for k in range(1, N):
    ans.append(str(count[k]))
print('\n'.join(ans))

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

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

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

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

distList = [0] * (n-1)

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

for distItem in distList:
  print(distItem)

Solution (Python):
nxy = input().split()
n = int(nxy[0])
x = int(nxy[1])
y  = int(nxy[2])
r = [0 for i in range(1,n)] 


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

Solution (Python):
def main():
    import sys
    import collections
    
    N, X, Y = map(int, sys.stdin.readline().split())
    
    dist_list = []
    
    if X == 1 and Y == N:
        for i in range(1, N):
            for j in range(i + 1, N + 1):
                dist = min(j - i, N - j + i)
                dist_list.append(dist)
        
        c = collections.Counter(dist_list)
        for i in range(1, N):
            print(c[i])
    
    else:
        for i in range(1, N):
            for j in range(i + 1, N + 1):
                if j <= X or i >= Y:
                    dist_list.append(j - i)
                else:
                    dist = min(j - i, abs(X - i) + abs(j - Y) + 1)
                    dist_list.append(dist)
                    
        
        c = collections.Counter(dist_list)
        for i in range(1, N):
            print(c[i])
            
if __name__ == '__main__':
    main()

Solution (Python):
from itertools import combinations

def get_d_min(a, b, X, Y):

    d = abs(a - b)
    if a == X and b == Y:
        d = 1
    elif a <= X and b > X and b <= Y:
        dd = (X - a) + (Y - b) + 1
        d = min(d, dd)
    elif a >= X and a < Y and b >= Y:
        dd = (a - X) + (b - Y) + 1
        d = min(d, dd)
    elif a > X and b < Y:
        dd = (a - X) + (Y - b) + 1
        d = min(d, dd)
    elif a < X and b > Y:
        dd = (X - a) + (b - Y) + 1
        d = min(d, dd)
    return d

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

comb = combinations(range(1, N + 1), 2)

counts = [0] * N
for a, b in comb:
    a, b = min(a, b), max(a, b)
    d_min = get_d_min(a, b, X, Y)
    counts[d_min] += 1

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

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

sets=[]
for i in range(n-1):
  sets.append([])

for i in range(n):
  for j in range(i+1,n):
    a=abs(x-(i+1))
    b=abs(y-(j+1))
    c=a+b+1
    if c>=(j-i):
      sets[j-i-1].append(1)
    else:
      sets[c-1].append(1)

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

Solution (Python):
import queue
def main():
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1
    ans = [0]*n
    t = [[i+1, i-1] for i in range(n)]
    t[x].append(y)
    t[y].append(x)
    for i in range(n):
        for j in range(i+1, n):
            if j <= x:
                ans[j-i] += 1
            elif j <= y:
                buf = min(j-i, abs(i-x) + 1 + (y-j))
                ans[buf] += 1
            else:
                buf = min(y-i, abs(x-i)+1)
                ans[buf + (j-y)] += 1
    for i in range(1, n):
        print(ans[i])
if __name__ == "__main__":
    main()

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

ans = dict()
for k in range(1, N):
    ans[k] = 0
for i in range(1, N):
    for k in range(i+1, N+1):
        dif1 = k - i
        dif2 = abs(X-i) + 1 + abs(Y-k)
        dif = min([dif1, dif2])
        ans[dif] += 1
for k, v in ans.items():
    print(v)

Solution (Python):
inputNumbers=input()
N=int(inputNumbers.split(" ")[0])
X=int(inputNumbers.split(" ")[1])
Y=int(inputNumbers.split(" ")[2])

result = []
for k in range(1,N):
    result.append(0)

allBranchLength=[]

for i in range(1, N+1):
    for j in range(i+1,N+1):

        if i <= X:
            if j <= X:
                length = j - i
                result[length - 1] += 1

            if j > X and j < Y:
                length = X - i + min(j-X, Y-j+1)
                result[length - 1] += 1

            if j >= Y:
                length = (X - i) + 1 + (j - Y)
                result[length - 1] += 1

        if i > X and i < Y:
            if j > X and j < Y:
                length = min( (i - X) + 1 + (Y - j) , j - i )
                result[length - 1] += 1

            if j >= Y:
                length = min( (i - X) + 1 + (j - Y) , j - i )
                result[length - 1] += 1
                
        if i >= Y:
            if j >= Y:
                length = j - i
                result[length - 1] += 1





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

Solution (Python):
n, x, y = map(int, input().split(' '))
d_dict = {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:
            d_dict[j - i] += 1
        elif i <= x and x < j <= y:
            d_dict[min(j - i, x - i + y - j + 1)] += 1
        elif i <= x and j > y:
            d_dict[x - i + j - y + 1] += 1
        elif x < i < y and j < y:
            d_dict[min(j - i, i - x + y - j + 1)] += 1
        elif x < i < y and j >= y:
            d_dict[min(j - i, i - x + j - y + 1)] += 1
for i in range(1, n):
    print(d_dict[i])

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


N, X, Y = map(int, input().split())
l = [[0] * N for _ in range(N)]
l[X-1][Y-1] = 1
l[Y-1][X-1] = 1
for i in range(1, N):
    l[i-1][i] = 1
    l[i][i-1] = 1

csr = np.array(l)
s = shortest_path(csr, directed=False).astype(np.int16)
arr = s.flatten()
c = Counter(arr)
for i in range(1, N):
    print(c[i]//2)

Solution (Python):
n,a,b = list(map(int,input().split()))
output_list = [0] * n
def d1(x,y,a,b):
    return y - x
def d2(x,y,a,b):
    if x <= a and b <= y:
        return a - x + y - b + 1
    if x <= a and y < b:
        return a - x + b - y + 1
    if a < x and b <= y:
        return x - a + y - b + 1
    if a < x and y < b:
        return x - a + b - y + 1
def d(x,y,a,b):
    return min(d1(x,y,a,b),d2(x,y,a,b))
for x in range(1,n):
    for y in range(x + 1,n + 1):
        output_list[d(x,y,a,b)] += 1
for k in range(1,n):
    print(output_list[k])

Solution (Python):
n, x, y = list(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 j>=y:   
      d = (x-i)+(j-y)+1
    elif i<=x and j<y:  
      if (y-j)<(j-x):
        d = (x-i)+(y-j)+1
      else:
        d = (x-i)+(j-x)
    elif i>x and j>=y:  
      if (y-i)>(i-x):
        d = (i-x)+(j-y)+1
      else:
        d = (y-i)+(j-y)
    else:               
      if (j-i)>((i-x)+(y-j)):
        d = (i-x)+(y-j)+1
      else:
        d = j-i
    
    count[d] += 1

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