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):
n,x,y = map(int, input().split())
ans = [0]*(n-1)

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

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

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

dp = [[0]*N for _ in range(N)]
for i in range(N):
    for j in range(i+1, N):
        dp[i][j] = j-i
        dp[j][i] = j-i
dp[X-1][Y-1] = 1
dp[Y-1][X-1] = 1
for i in range(N):
    for j in range(N):
        if dp[i][j] > dp[i][X-1] + dp[X-1][j]:
            dp[i][j] = dp[i][X-1] + dp[X-1][j]
            dp[j][i] = dp[i][X-1] + dp[X-1][j]
        if dp[i][j] > dp[i][Y-1] + dp[Y-1][j]:
            dp[i][j] = dp[i][Y-1] + dp[Y-1][j]
            dp[j][i] = dp[i][Y-1] + dp[Y-1][j]

n_map = {}
for i in range(N):
    for j in range(i+1,N):
        if dp[i][j] not in n_map:
            n_map[dp[i][j]] = 1
        else:
            n_map[dp[i][j]] += 1
for i in range(1, N):
    if i not in n_map:
        print(0)
    else:
        print(n_map[i])

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

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

Solution (Python):
import numpy as np
from scipy.sparse import csr_matrix, csgraph
N, X, Y = map(int, input().split())
data = [1] * N
row = list(range(N - 1)) + [X - 1]
column = list(range(1, N)) + [Y - 1]
graph = csr_matrix((data, (row, column)), dtype=np.int32, shape=(N, N))
dists = csgraph.shortest_path(graph.toarray(), directed=False).astype(np.int32)
print(*np.bincount(np.triu(dists).ravel(), minlength=N)[1:], sep="\n")

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

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

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

Solution (Python):
import sys; input = sys.stdin.buffer.readline
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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


def main():
	N, X, Y = getlist()
	X -= 1; Y -= 1
	D = defaultdict(int)
	for i in range(N):
		for j in range(i + 1, N):
			var = min(j - i, abs(X - i) + abs(Y - j) + 1)
			D[var] += 1

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




if __name__ == '__main__':
	main()

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

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

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

Solution (Python):
import itertools

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

result = [0]*(N-1)
list = list(itertools.combinations(list(range(1,N+1)),2))
for i in list:
    g = i[1]-i[0]
    j = abs(Y-i[1]) + abs(X-i[0]) + 1
    result[min([g,j])-1] += 1

for i in result:
    print(i)

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

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

for j in ptns:
    print(j)

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


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

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

Solution (Python):
n,x,y = map(int,input().split())
mid = (x + y) // 2

num_roots = [0] * n
for start in range(1,n):
    for goal in range(start + 1,n+1):
        if start <= mid:
            if goal <= mid:
                d = goal - start
            else:
                d = min(goal - start, abs(x - start) + 1 + abs(goal - y))
        else:
            d = goal - start
        num_roots[d] += 1
for i in range(1,n):
    print(num_roots[i])

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

Solution (Python):

import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    
    dis = deque()
    for i1 in range(n):
        if x < i1:
            right = i1 + 1
            while right < n:
                dis_now = min(right - i1, (i1 - x + abs(right - y) + 1))
                dis.append(dis_now)
                right += 1
        else:
            right = i1 + 1
            while right < n:
                if right < y:
                    dis_now = min(right - i1,(x - i1 + abs(y - right) + 1))
                    dis.append(dis_now)
                else:
                    dis.append(right - i1 - (y - x) + 1)
                right += 1
    dis_c = Counter(dis)
    dis_list = [0] * (n - 1)
    for i2 in range(1, n):
        dis_list[i2 - 1] = dis_c[i2]

    

    for edis in dis_list:
        print(edis)

if __name__ == '__main__':
    main()

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

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

List.sort()

import collections
C=collections.Counter(List)

for p in range(1,N):
  if p in C.keys():
    print(C[p])
  else:
    print(0)

Solution (Python):
import queue

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

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

res = [0 for i 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) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X))
        res[d] += 1

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

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

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

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

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

Solution (Python):
import itertools

N,X,Y = map(int,input().split())
n = list(range(1,N+1))
l = [0]*N
for v in itertools.combinations(n,2):
  l[min(abs(Y-v[1]) + abs(X-v[0]) + 1,v[1] - v[0])] += 1
for k in range(1,N):
  print(l[k])

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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, x, y = map(int, read().split())
ans = [0] * n
for k in range(1, n):
    for i in range(k + 1, n + 1):
        ans[min(i - k, abs(y - i) + abs(x - k) + 1)] += 1
print('\n'.join(map(str, ans[1:])))

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, x, y = map(int, read().split())
ans = [0] * n
for k in range(1, n):
    for i in range(k + 1, n + 1):
        if i <= x:
            ans[i - k] += 1
        elif x < i <= y:
            ans[min(i - k, y - i + abs(x - k) + 1)] += 1
        else:
            if k <= x:
                ans[i - y + x - k + 1] += 1
            elif x <= k <= y:
                ans[min(k - x + 1 + i - y, i - k)] += 1
            else:
                ans[i - k] += 1
print('\n'.join(map(str, ans[1:])))

Solution (Python):
import itertools
from collections import deque
from collections import Counter
N,X,Y = list(map(int,input().split()))
moto = [x for x in range(1,N+1)]
d = deque([])
C = itertools.combinations(moto,2)
C = list(C)
for c in C:
    i = c[0]
    j = c[1]
    d.append(min(j-i,abs(i-X)+abs(j-Y)+1))
c = Counter(list(d))
for v in c.values():
  print(v)
for _ in range(N-1-len(list(c))):
  print(0)

Solution (Python):
from collections import defaultdict

def getdis(a, b, n, x, y):
    mini = abs(a - b)
    mini = min(mini, abs(a - x) + 1 + abs(b - y))
    mini = min(mini, abs(a - y) + 1 + abs(b - x))
    return mini

def solve(n, x, y):
    dis = [0 for i in xrange(n)]
    for i in xrange(1, n + 1):
        for j in xrange(i + 1, n + 1):
            u = getdis(i, j, n, x, y)
            
            dis[u] += 1
    return dis[1:]

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

res = solve(n, x, y)
for num in res:
    print num

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

Solution (Python):
n,x,y = 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 itertools
from collections import deque,Counter
n,x,y = map(int,input().split())
route=[[10**10]*(n+1) for i in range(n+1)]
for i in range(1,n+1):
  q=deque([i])
  j=i
  route[i][j]=0
  while q:
    j=q.pop()
    if j == y:
      if route[i][j]+1 < route[i][x]:
        route[i][x]=route[i][j]+1
        q.append(x)
    if j == x:
      if route[i][j]+1 < route[i][y]:
        route[i][y]=route[i][j]+1
        q.append(y)
    if 1 < j:
      if route[i][j]+1 < route[i][j-1]:
        route[i][j-1]=route[i][j]+1
        q.append(j-1)
    if j < n:
      if route[i][j]+1 < route[i][j+1]:
        route[i][j+1]=route[i][j]+1
        q.append(j+1)

ans=Counter(list(itertools.chain.from_iterable(route)))
for i in range(1,n):
  print(ans[i]//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):
        t=min(j-i,abs(x-i)+abs(y-j)+1)
        ans[t-1]+=1
for i in ans:
    print(i)

Solution (Python):
from sys import stdin


def main():
    n, x, y = map(int, stdin.readline().split())
    x -= 1
    y -= 1

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


if __name__ == "__main__":
    main()

Solution (Python):
from heapq import heappush, heappop

INF = 10 ** 18

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heappush(h, (0, s))

    while h:
        
        d, v = heappop(h)
        if dist[v] < d:
            continue
        
        for b, cost in G[v]:
            if dist[b] > dist[v] + cost:
                dist[b] = dist[v] + cost
                heappush(h, (dist[b], b))
    return dist

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

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

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

g[x-1].append((y-1, 1))
g[y-1].append((x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)

Solution (Python):
import heapq




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

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

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

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

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

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

Solution (Python):
from heapq import heappush, heappop

INF = float('inf')

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heappush(h, (0, s))

    while h:
        
        d, v = heappop(h)
        if dist[v] < d:
            continue
        
        for b, cost in G[v]:
            if dist[b] > dist[v] + cost:
                dist[b] = dist[v] + cost
                heappush(h, (dist[b], b))
    return dist

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

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

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

g[x-1].append((y-1, 1))
g[y-1].append((x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)

Solution (Python):
import heapq

INF = float('inf')

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        
        for b, cost in G[v]:
            if dist[b] > dist[v] + cost:
                dist[b] = dist[v] + cost
                heapq.heappush(h, (dist[b], b))
    return dist

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

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

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

g[x-1].append((y-1, 1))
g[y-1].append((x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)

Solution (Python):
import heapq

INF = float('inf')

class Edge():
    def __init__(self, a, b, cost):
        self.a = a
        self.b = b
        self.cost = cost
    def __str__(self):
        return 'Edge: {} -> {}, cost {}'.format(self.a, self.b, self.cost)

def dijkstra(n, G, s):
    dist = [INF] * n
    dist[s] = 0
    h = []
    heapq.heappush(h, (0, s))

    while h:
        
        d, v = heapq.heappop(h)
        if dist[v] < d:
            continue
        
        for e in G[v]:
            if dist[e.b] > dist[v] + e.cost:
                dist[e.b] = dist[v] + e.cost
                heapq.heappush(h, (dist[e.b], e.b))
    return dist

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

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

for i in range(n-1):
    g[i].append(Edge(i, i+1, 1))
    g[i+1].append(Edge(i+1, i, 1))

g[x-1].append(Edge(x-1, y-1, 1))
g[y-1].append(Edge(y-1, x-1, 1))

ans = [0] * n

for i in range(n):
    for d in dijkstra(n, g, i):
        ans[d] += 1

for item in ans[1:]:
    print(item // 2)

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

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

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

Solution (Python):
def function(args):
    N, X, Y = map(int, args.split())
    dests = [0] * (N)
    
    for i in range(1, N):
        for j in range(i+1, N+1):
            dist_direct = j - i
            dist_throughX = abs(X - i) + 1 + abs(Y - j)
            shortest = min(dist_direct, dist_throughX)
            dests[shortest] += 1
    dests.pop(0)
    return dests

if __name__ == '__main__':
    dests = function(input())
    for d in dests:
        print(d)

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

for x in ans:
    print(x)

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

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

for cnt in ans:
    print(cnt)

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 collections import deque


def BFS(s):
    color=["white" for _ in range(n+1)]
    D=[0 for _ in range(n+1)]

    D[s]=0
    color[s]="gray"
    queue=deque([s])

    while len(queue)>0:
        u=queue.popleft()
        for i in M[u]:
            if color[i]=="white":
                D[i]=D[u]+1
                color[i]="gray"
                queue.append(i)
        color[u]="black"

    return D


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

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

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

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

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

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

Solution (Python):

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


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

for i in d:
    print(i)

Solution (Python):

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

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

for i in d:
    print(i)

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

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

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

X -= 1
Y -= 1

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

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

Solution (Python):

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

visited = set()


for i in range(N - 1):
    visited.add((i, i + 1))
visited.add((X - 1, Y - 1))

print(len(visited))

next_items = visited.copy()
for _ in range(N - 2):
    candidates = []

    for point in next_items:
        x, y = point

        if (x - 1, y) not in visited and x - 1 >= 0:
            visited.add((x - 1, y))
            candidates.append((x - 1, y))

        if (x + 1, y) not in visited and x + 1 != y:
            visited.add((x + 1, y))
            candidates.append((x + 1, y))

        if (x, y - 1) not in visited and x != y - 1:
            visited.add((x, y - 1))
            candidates.append((x, y - 1))

        if (x, y + 1) not in visited and y + 1 < N:
            visited.add((x, y + 1))
            candidates.append((x, y + 1))

    print(len(candidates))
    next_items = candidates

Solution (Python):
def dist(i,j,x,y):
    a = abs(i-j)
    b = abs(x-i) + abs(y-j) + 1
    c = abs(x-j) + abs(y-i) + 1
    return min(a,b,c)

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

    X -= 1
    Y -= 1
    K = [0 for i in range(N+1)]

    for i in range(N):
        for j in range(N):
            index = dist(i,j,X,Y)
            K[index] += 1

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

if __name__ == "__main__":
    main()

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

X -= 1
Y -= 1

output = [0]*N

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

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

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

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,x,y = LI()
    x -= 1
    y -= 1
    c = collections.defaultdict(int)
    for i in range(n):
        xi = abs(i-x)
        for j in range(i+1,n):
            yj = abs(j-y)
            c[min(j-i, xi+yj+1)] += 1

    return JA([c[i] for i in range(1,n)], "\n")


print(main())

Solution (Python):

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

a = {i:0 for i in range(1, n)}


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

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

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

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, x, y = MI()

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


if __name__ == '__main__':
    solve()

Solution (Python):

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

Solution (Python):
import collections

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

ans = []
for i in range(n):
    for j in range(i + 1, n):
        min_l = min(j - i, abs(x - i) + abs(y - j) + 1)
        ans.append(min_l)
t = collections.Counter(ans)
for i in range(1, n):
    print(t[i])

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys
import collections

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

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))


N, X, Y = LI()
X -= 1
Y -= 1
anss = [0 for i in range(N)]

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

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

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

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

c = collections.Counter(disList)
cList = list(c.values())
for i in range(n-1):
    if(i < len(cList)):
        print(cList[i])
    else:
        print(0)

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

ans = [0]*n

x = x-1
y = y-1

def search(i, j):
    if j <= x or y <= i:
        ans[j-i] += 1
    elif i <= x and x <= j and j <= y:
        d = min(j-i, x-i+y-j+1)
        ans[d] += 1
    elif x <= i and j <= y:
        d = min(j-i, i-x+y-j+1)
        ans[d] += 1
    elif x <= i and i <= y and y <= j:
        d = min(j-i, i-x+j-y+1)
        ans[d] += 1
    elif i <= x and y <= j:
        ans[x-i+j-y+1] += 1
    
    
for i in range(0, n-1, 1):
    for j in range(i+1, n, 1):
        search(i,j)
        
for i in range(1,n):
    print(ans[i])

Solution (Python):

import sys


def solve(N: int, X: int, Y: int):
    distances = [0] * (N - 1)
    for i in range(0, N - 1):
        for j in range(i + 1, N):
            distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)
            distances[distance - 1] += 1

    for k in distances:
        print(k)
    return



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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,x,y = [int(i) for i in readline().split()]

ans = [0] * n

for a in range(1, n+1):
    for b in range(a+1, n+1):
        d = b - a
        d2 = abs(x-a) + abs(y-b) + 1
        d = d if d < d2 else d2
        ans[d] += 1

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

Solution (Python):

import sys


def solve(N: int, X: int, Y: int):
    distances = [0] * (N - 1)
    for i in range(0, N - 1):
        for j in range(i + 1, N):
            if j < X - 1 or Y - 1 < i:
                distance = j - i
            else:
                distance = min(j - i, abs(X - 1 - i) + abs(Y - 1 - j) + 1)
            distances[distance - 1] += 1

    for k in distances:
        print(k)

            
    return



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

if __name__ == '__main__':
    main()

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

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

for i in range(n):
    for j in range(i + 1, n):
        if j <= (x + y - 1) // 2 or (x + y - 2) // 2 <= i or j - i <= (y - x) // 2:
            ans[j - i] += 1
        else:
            ans[abs(i - x + 1) + abs(j - y + 1) + 1] += 1

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

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

kdic={}
for a in range(1,n):
    kdic[a]=0
for i in range(1,n+1):
    for j in range(i+1,n+1):
        tmp=min(j-i,abs(j-x)+abs(y-i)+1,abs(j-y)+abs(i-x)+1)
        kdic[tmp]=kdic[tmp]+1

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

Solution (Python):
from collections import Counter
def min_distance(i,j):
    return min(abs(i-j),abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j))
               
n,x,y=list(map(int,input().split()))
x=x-1
y=y-1
dp=[]
for i in range(n-1):
    for j in range(i+1,n):
        dp.append(min_distance(i,j))
dic=Counter(dp)
for i in range(1,n):
    print(int(dic[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):
        dis = min(j-i, abs(j-x)+1+abs(y-i), abs(j-y)+1+abs(x-i))
        ans[dis-1] += 1
for i in range(n-1):
    print(ans[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):
    dis = min(j - i, abs(i - x) + abs(j - y) + 1)
    ans[dis-1] += 1
    
for i in range(n-1):
  print(ans[i])

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

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

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

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

ls = [0 for i in range(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))
		ls[l-1] = ls[l-1] + 1

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

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

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