Problem:
 Score : 400 points    Problem Statement  We have an undirected graph G with N vertices numbered 1 to N and N edges as follows:   For each i=1,2,...,N-1 , there is an edge between Vertex i and Vertex i+1 .  There is an edge between Vertex X and Vertex Y .   For each k=1,2,...,N-1 , solve the problem below:   Find the number of pairs of integers (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j in G is k .       Constraints   3 \leq N \leq 2 \times 10^3  1 \leq X,Y \leq N  X+1 < Y  All values in input are integers.         Input  Input is given from Standard Input in the following format:  N  X  Y       Output  For each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.        Sample Input 1 5 2 4      Sample Output 1 5
4
1
0  The graph in this input is as follows:     There are five pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 1 : (1,2)\,,(2,3)\,,(2,4)\,,(3,4)\,,(4,5) . There are four pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 2 : (1,3)\,,(1,4)\,,(2,5)\,,(3,5) . There is one pair (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 3 : (1,5) . There are no pairs (i,j) (1 \leq i < j \leq N) such that the shortest distance between Vertex i and Vertex j is 4 .       Sample Input 2 3 1 3      Sample Output 2 3
0  The graph in this input is as follows:           Sample Input 3 7 3 7      Sample Output 3 7
8
4
2
0
0       Sample Input 4 10 4 8      Sample Output 4 10
12
10
8
4
1
0
0
0

Solution (Python):
from collections import deque


def main():
    N, X, Y = map(int, input().split())
    ans = [0] * N  
    X -= 1
    Y -= 1

    for start_vertex in range(N):
        dist = [float('inf')] * N
        q = deque()

        def push(vertex, distance):
            if dist[vertex] != float('inf'):
                return
            dist[vertex] = distance
            q.append(vertex)

        push(start_vertex, 0)  

        while len(q) != 0:
            vertex = q.popleft()
            distance = dist[vertex]

            if vertex - 1 >= 0:
                push(vertex - 1, distance + 1)
            if vertex + 1 < N:
                push(vertex + 1, distance + 1)
            if vertex == X:
                push(Y, distance + 1)
            if vertex == Y:
                push(X, distance + 1)

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

    for i in range(N):
        ans[i] //= 2

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


if __name__ == '__main__':
    main()

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

def min_dist(a,b):
    return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a))
for i in range(n):
    for j in range(i, n):
        ans_l[min_dist(i,j)] += 1
print('\n'.join([str(ans) for ans in ans_l[1:]]))

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

def min_dist(a,b):
    return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a))
for i in range(n):
    for j in range(i, n):
        ans_l[min_dist(i,j)] += 1
for ans in ans_l[1:]:
    print(ans)

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

def min_dist(a,b):
    return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a))
for i in range(n):
    for j in range(i, n):
        k = min_dist(i,j)
        ans_l[k] += 1
for ans in ans_l[1:]:
    print(ans)

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

Solution (Python):
N, X, Y = map(int, input().split())
ks = [0]*(N-1)
for A in range(1,N):
    for B in range(A+1,N+1):
        if B - A > abs(X -A) + abs(Y - B) + 1:
            ks[B-A-1] -= 1
            ks[abs(X -A) + abs(Y - B)] += 1
for k in range(1,N):
    print(N - k + ks[k-1])

Solution (Python):
from collections import Counter

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

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

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

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

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

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

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

m = {i:[] for i in range(1, N+1)}
for i in range(1, N+1):
    if i > 1:
        m[i].append(i-1)
    if i < N:
        m[i].append(i+1)
m[X].append(Y)
m[Y].append(X)



from collections import deque

dists = [[]]
for i in range(1, N+1):
    dist = [float('inf')]*(N+1)
    dist[i] = 0
    q = deque([i])
    while q:
        p = q.popleft()
        for j in m[p]:
            if dist[j] > dist[p]+1:
                dist[j] = dist[p]+1
                q.append(j)
    dists.append(dist)



ansm = {i:0 for i in range(1, N+1)}
for i in range(1, N+1):
    for j in range(1, N+1):
        if dists[i][j] == 0:
            continue
        ansm[dists[i][j]] += 1

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

Solution (Python):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n, x, y = map(int, sys.stdin.readline().split())
	x -= 1
	y -= 1
	ans = [0]*(n-1)
	for i in range(n):
		for j in range(i+1, n):
			log.print(i, j, ans)
			if i == j:
				continue
			if (i <= x and j <= x) or (y <= i and y <= j):
				ans[abs(i-j)-1] += 1
			elif (i <= x and y <= j):
				ans[x-i + j-y + 1 - 1] += 1
			elif (x < i < y and x < j < y):
				ans[min(abs(i-j), i-x + 1 + y-j)-1] += 1
			elif (i <= x and x < j < y):
				ans[min(abs(i-j), x-i + 1 + y-j)-1] += 1
			elif (x < i < y and y <= j):
				ans[min(abs(i-j), j-y + 1 + i-x)-1] += 1
	for i in range(len(ans)):
		print(ans[i])







main()

Solution (Python):
import sys


def input() -> str:
    return sys.stdin.readline().rstrip("\r\n")


def main():
    def min_dest(a, b):
        return min(b-a, abs(x-a)+1+abs(y-b))

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

    for i in range(n):
        for j in range(i+1, n):
            ans[min_dest(i, j)-1] += 1
    for a in ans:
        print(a)


if __name__ == "__main__":

    main()

Solution (Python):
import sys


def input() -> str:
    return sys.stdin.readline().rstrip("\r\n")


def main():
    def min_dest(a, b):
        return min(b-a, abs(x-a)+1+abs(y-b), abs(x-b)+1+abs(y-a))

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

    for i in range(n):
        for j in range(i+1, n):
            ans[min_dest(i, j)-1] += 1
    for a in ans:
        print(a)


if __name__ == "__main__":

    main()

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    inf = 10**17
    

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


if __name__ == '__main__':
    main()

Solution (Python):


def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    inf = 10**17
    

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


if __name__ == '__main__':
    main()

Solution (Python):
n, x, y = map(int, input().split())
ans = {x: 0 for x in range(1, n)}

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

for v in ans.values():
    print(v)

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

Solution (Python):
N,X,Y = map(int,input().split())
from collections import defaultdict as ddict
ans = ddict(int)
for n in range(N):
    for i in range(n+1,N):
        s = i+1
        d = n+1
        p1 = abs(s-d)
        p2 = abs(s-X)+abs(d-Y)+1
        p3 = abs(s-Y)+abs(d-X)+1
        ans[min(p1,p2,p3)] += 1
for n in range(1,N):
    print(ans[n])

Solution (Python):
n,x,y = map(int,input().split())
from collections import defaultdict,deque
gr = defaultdict(list)
for i in range(1,n):
  gr[i].append(i+1)
  gr[i+1].append(i)
gr[x].append(y)
gr[y].append(x)

res  = defaultdict(int)
for i in range(1,n+1):
  q = deque()
  q.append(i)
  vis = {}
  vis[i] = 0
  while q:
    tmp = q.popleft()
    for item in gr[tmp]:
      if item not in vis:
        vis[item] = vis[tmp]+1
        q.append(item)
  for j in range(i+1,n+1):
    res[vis[j]]+=1
for i in range(1,n):
  print(res[i])

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):
         tmp = min(j-i, abs(i-X)+abs(j-Y)+1)
         cnt[tmp] += 1

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

Solution (Python):
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())
 
def inp_list(): return list(map(int, sys.stdin.readline().split()))

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


N, X, Y = inp_list()

"""
    XY間のショートカット経路を使う場合と使わない場合の距離をそれぞれ計算して、
    その小さい方が最短経路。
"""

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

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

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


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

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

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

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

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

Solution (Python):


import sys
import math
import collections
import itertools
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def PL(L) : print(*L, sep="\n")

N, X, Y = LI()

ans = [0] * N

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

PL(ans[1:])

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
 
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

n,x,y = i_l()
x -= 1
y -= 1
a = [0]*n

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

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

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1

Solution (Python):


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

n_k = [0] * (N+1)

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

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

Solution (Python):

from collections import defaultdict, deque
import sys


def input():
    return sys.stdin.readline()


def push(v, d, dist, q, INF=1e10):
    if dist[v] != INF:
        return
    dist[v] = d
    q.append(v)


def main():
    n, x, y = map(int, input().split())
    
    x, y = x - 1, y - 1
    INF = 1e10
    ans = defaultdict(int)
    for i in range(n):
        
        dist = [INF] * n
        q = deque()
        push(i, 0, dist, q)
        while len(q) != 0:
            v = q.popleft()
            d = dist[v]
            if v - 1 >= 0:
                push(v-1, d+1, dist, q)
            if v + 1 < n:
                push(v+1, d+1, dist, q)
            if v == x:
                push(y, d+1, dist, q)
            if v == y:
                push(x, d+1, dist, q)

            ans[dist[v]] += 1

    for i in range(n):
        if i != 0:
            print(ans[i] // 2)


if __name__ == "__main__":
    main()

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


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


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

from collections import deque

dis = [[float('Inf')] * N for _ in range(N)]

count = [0] * (N - 1)

def bfs(i):
    d = [False] * N 
    que = deque()
    
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    
    while que:
        p = que.popleft()

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

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

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

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

Solution (Python):
N,X,Y=map(int,input().split())
def shortest(x,y,a,b):
    ans=min(y-x,abs(y-b)+1+abs(a-x))
    return ans
distance=[0]*(N-1)
for x in range(1,N):
    for y in range(2,N+1):
        if y<=x:
            continue
        a=shortest(x,y,X,Y)
        distance[a-1]+=1
for i in distance:
    print(i)

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

ans = [0]*(n-1)

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

for i in ans:
  print(i)

Solution (Python):
from collections import deque
INF = 10**9

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

for sv in range(n):
  dist = [INF] * n
  q = deque()

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

  push(sv, 0)

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

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

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

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

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

dist = [i*0 for i in range(N)]


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








  




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

Solution (Python):
from collections import deque

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


def node_search(i):
    node_list = []
    if i != 1:
        node_list.append(i-1)
    if i != N:
        node_list.append(i+1)
    if i == X:
        node_list.append(Y)
    if i == Y:
        node_list.append(X)
    return node_list


def bfs(k):
    q = deque()
    dist = [N]*(N+1)
    q.append(k)
    check = [0]*(N+1)
    check[k] = 1
    dist[k] = 0
    while q:
        now_node = q.pop()
        check[now_node] = 1
        next_nodes = node_search(now_node)
        for node in next_nodes:
            if check[node] == 0:
                dist[node] = min(dist[now_node]+1, dist[node])
                q.appendleft(node)
    return dist


ans = [0]*N
for k in range(1, N+1):
    dist_list = bfs(k)
    for i in range(k+1, N+1):
        ans[dist_list[i]] += 1

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

Solution (Python):
def MI():return map(int,input().split())
def LI():return list(MI())

from collections import deque
INF=float("inf")
n,x,y=MI()
x-=1
y-=1
ans=[0]*n

for sv in range(n):
  dist=[INF]*n
  q=deque()
  def push(v,d):
    if dist[v]!=INF:
      return
    dist[v]=d
    q.append(v)
  push(sv,0)
  while q:
    v=q.popleft()
    d=dist[v]
    if v-1>=0:push(v-1,d+1)
    if v+1<n:push(v+1,d+1)  
    if v==x:push(y,d+1)
    if v==y:push(x,d+1)
        
  for i in range(n):ans[dist[i]]+=1
for i in range(1,n):print(ans[i]//2)

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

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

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

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

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

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

for v in D[1:N]:
    print(v)

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

dist = [i*0 for i in range(N)]


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

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

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

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

Solution (Python):
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]

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

d=deque()
for i in range(n):
    tmp=[0]*n
    tmp[i]=1
    d.append([[i],tmp])


x,y=x-1,y-1
for i in range(n-1):
    ans=0
    for j in range(n):
        now,itta=d.popleft()
        tugi=[]
        for k in now:
            if k==n-1:
                if itta[k-1]==0:
                    itta[k-1]=1
                    tugi.append(k-1)
                if y==k and itta[x]==0:
                    itta[x]=1
                    tugi.append(x)
            elif k==0:
                if itta[k+1]==0:
                    itta[k+1]=1
                    tugi.append(k+1)
                if x==k and itta[y]==0:
                    itta[y]=1
                    tugi.append(y)
            else:
                if itta[k-1]==0:
                    itta[k-1]=1
                    tugi.append(k-1)
                if y==k and itta[x]==0:
                    itta[x]=1
                    tugi.append(x)
                if itta[k+1]==0:
                    itta[k+1]=1
                    tugi.append(k+1)
                if x==k and itta[y]==0:
                    itta[y]=1
                    tugi.append(y)
        ans+=len(tugi)
        d.append([tugi,itta])
        
        
    print(ans//2)
    ans=0

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

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

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

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

for v in D[1:N]:
    print(v)

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

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

for i in li:
    print(i)

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

Solution (Python):

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


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

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

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

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

Solution (Python):
import sys
from itertools import combinations
from collections import Counter
n, x, y = [int(i) for i in sys.stdin.readline().split()]
x -= 1
y -= 1
ls = [[0 for i in range(n)] for j in range(n)]
for i, j in combinations(range(n), 2):
    ls[i][j] = min(abs(i - j), abs(y - j) + abs(x - i) + 1)
ct = Counter()
for i in range(n):
    ct.update(ls[i])
for i in range(1, n):
    print(ct[i])

Solution (Python):
import sys
sys.setrecursionlimit(10**7)

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

dst = [0] * n



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

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

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

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






X -= 1
Y -= 1




def main(N, X, Y):
    graph = np.zeros((N, N))
    
    np.fill_diagonal(graph[:, 1:], 1)
    graph[X, Y] = 1
    
    dist = dijkstra(graph, directed=False).astype(int).ravel()
    

    ans = np.bincount(dist, minlength=N)//2
    print(*ans[1:], sep="\n")


main(N, X, Y)

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

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

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

ans=[0 for _ in range(N)]
for k in range(N):
    for l in range(k+1,N):
        if d[k][l]<N:
            ans[d[k][l]]+=1
    
for o in range(N-1):
    print(ans[o+1])

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

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

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

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

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

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

listlist = [0]*(n-1)

for i in range(1,n):
  for j in range(i+1,n+1):
    distance = dist(i,j)
    listlist[distance-1] = listlist[distance-1] + 1
    
for k in listlist:
  print(k)

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

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

Solution (Python):


line = [int(x) for x in input().split()]
n = line[0]
x = line[1]
y = line[2]

results =[0]*(n+2)

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

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

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

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

Solution (Python):

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

for s in range(1,n):
    for p in range(s+1,n+1):
        distance = min(abs(p - s),abs(x - s) + 1 + abs(p - y),abs(y - s) + 1 + abs(p - x))
        anslist[distance - 1] += 1

for k in range(len(anslist)):
    print("{}".format(anslist[k]))

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

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

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

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

edge1 = np.array(edge, dtype = np.int64).T
graph = csr_matrix((edge1[2], (edge1[:2])), (N, N))



ans = dijkstra(graph, directed = False)
lst = [0] * N
for i in range(N - 1):
    
    
    for j in range(i + 1, N):
        lst[int(ans[i,j])] += 1
    
print (*lst[1:], sep = '\n')

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

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

l = []

for i in range(1,N+1):
    for j in range(i+1,N+1):
        mindis = min(abs(j - i), abs(X - i) + 1 + abs(j - Y ), abs(Y - i) + 1 + abs(j - X))
        l.append(mindis)
        
d = col.Counter(l)

for k in range (N-1):
    print(d[k+1])

Solution (Python):
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))

n, x, y = load_list()

class Node():
    def __init__(self, n):
        self.n = n
        self.adjs = []

    def add(self, adj):
        self.adjs.append(adj)

    def __str__(self):
        return self.n

nodes = dict()
for i in range(1, n+1):
    nodes[i] = Node(i)

for i in range(1, n):
    nodes[i].add(nodes[i+1])
    nodes[i+1].add(nodes[i])

nodes[x].add(nodes[y])
nodes[y].add(nodes[x])






def inf():
    return 100000


dist2count = defaultdict(int)
for node in nodes.values():
    visited = set()
    visited.add(node.n)
    dist = defaultdict(int)
    dist[node.n] = 0
    q = deque()
    q.append(node)
    while len(q):
        t = q.popleft()
        for a in t.adjs:
            if a.n in visited:
                continue
            dist[a.n] = dist[t.n] + 1
            visited.add(a.n)
            q.append(a)
    for target, dist in dist.items():
        if target == node.n:
            continue
        dist2count[dist] += 1
        

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