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
input = lambda: sys.stdin.readline().rstrip() 

def resolve():
    N, X, Y = map(int, input().split())
    X -= 1
    Y -= 1

    ans = [0]*(N-1)
    d = [[0]*N for i in range(N)]

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

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

if __name__ == '__main__':
    resolve()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from heapq import heappop, heappush, heapify
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
def dijkstra(E, start):
    N_d = len(E)
    dist = [INF] * N_d
    dist[start] = 0
    q = [(0, start)]
    while q:
        dist_v, v = heappop(q)
        if dist[v] != dist_v:
            continue
        for u, dist_vu in E[v]:
            dist_u = dist_v + dist_vu
            if dist_u < dist[u]:
                dist[u] = dist_u
                heappush(q, (dist_u, u))
    return dist
 
N, X, Y = MAP()
 
graph = defaultdict(list)
 
for i in range(N-1):
    graph[i].append((i+1, 1))
    graph[i+1].append((i, 1))
 
graph[X-1].append((Y-1, 1))
graph[Y-1].append((X-1, 1))
 
a = dijkstra(graph, 0)
count = defaultdict(int)
for i in range(N):
    a = dijkstra(graph, i)
    
    
    for c in a[i+1:]:
        count[c] += 1

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

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

ans_list = [0] * (n-1)

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

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

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

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


d = defaultdict(int)
for i in range(n-1):
    for j in range(i+1, n):
        distance = j - i
        if i <= x and y <= j:
            
            distance -= y - x - 1
        
        
        distance2 = abs(i - x) + abs(y - j) + 1
        
        
        
        
        
        
        
        
        distance = min(distance, distance2)

        
        d[distance] += 1

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

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

counts = [0 for i in range(N-1)]

for i in range(N):
    for j in range(i+1, N):
        if i <= X-1 :
            if j >= Y-1:
                dis = j-i -(Y-X-1)
            elif j < Y-1:
                dis = min([j-i, (X-1)-i+1+abs(j-(Y-1))])
                
        else:
            dis = min([j-i, i-(X-1)+1+abs(j-(Y-1))])
        
        
        k = dis-1
        counts[k] += 1
        
for k in range(N-1):
    print(counts[k])

Solution (Python):
from collections import OrderedDict


if __name__ == "__main__":
    N, X, Y = map(int, input().split())
    k_dict = OrderedDict()

    for i in range(1, N):
        k_dict[i] = 0

    for i in range(1, N):
        for j in range(i+1, N+1):
            if i <= X and j <= X:
                d = j - i
                k_dict[d] += 1
                
                continue

            if i <= X and X < j and j < Y:
                d = min(j-i, X-i + 1 + Y-j)
                k_dict[d] += 1
                
                continue

            if i <= X and Y <= j:
                d = X-i + 1 + j-Y
                k_dict[d] += 1
                
                continue

            if X < i and i < Y and X < j and j < Y:
                d = min(j-i, i-X + 1 + Y-j)
                k_dict[d] += 1
                
                continue

            if X < i and i < Y and Y <= j:
                d = min(j-i, i-X + 1 + j - Y)
                k_dict[d] += 1
                
                continue

            if Y <= i and Y <= j:
                d = j-i
                k_dict[d] += 1
                
                continue

    for k, v in k_dict.items():
        
        print(v)

Solution (Python):
import itertools

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

l=list(range(1,N+1))
cnt=[0]*(N-1)

for p in itertools.combinations(l, 2):
    a=p[1]-p[0]
    b=abs(p[1]-Y)+abs(p[0]-X)+1
    cnt[min(a,b)-1]+=1

for k in cnt:
    print(k)

Solution (Python):
from itertools import combinations
from collections import defaultdict
n,x,y=map(int,input().split())
x-=1
y-=1
cnt=defaultdict(int)
for i,j in combinations(range(n),2):
  cnt[min(abs(j-i),abs(j-y)+1+abs(i-x),abs(j-x)+1+abs(i-y))]+=1
for k in range(1,n):
  print(cnt[k])

Solution (Python):


iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, X, Y = iim()
    ans = [N-i-1 for i in range(N-1)]
    X1, Y1 = X-1, Y -1

    xy2 = (X+Y)  // 2
    for i in range(N):
        x1 = X1 - i
        if x1 < 0: x1 = -x1
        for j in range(i+1, N):
            d1 = j - i - 1
            y1 = Y1-j
            if y1 < 0: y1 = -y1
            d2 = x1 + y1
            if d1 > d2:
                
                ans[d1] -= 1
                ans[d2] += 1

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

if __name__ == "__main__":
    resolve()

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

edges = [[] for _ in range(n)]
for i in range(n-1):
   edges[i].append(i+1)
   edges[i+1].append(i)

edges[x-1].append(y-1)
edges[y-1].append(x-1)

def bfs(v):
   dist = [-1] * n
   dist[v] = 0
   visit = [v]
   c = 1
   while visit:
      next = []
      for i in visit:
         for j in edges[i]:
            if dist[j] == -1:
               dist[j] = c
               next.append(j)
      visit = next
      c += 1

   return dist

minpath = []
for i in range(n):
   minpath.extend(bfs(i))

from collections import Counter
cnt = Counter(minpath)

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

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

c = [0 for _ in range(n - 1)]
for left_i in range(n):
    for right_i in range(left_i + 1, n):
        dis = 0
        if left_i <= x_i:
            if right_i <= x_i:
                dis = right_i - left_i
                c[dis - 1] += 1
            elif x_i < right_i <= y_i:
                dis_1 = right_i - left_i
                dis_2 = x_i - left_i + 1 + y_i - right_i
                c[min(dis_1, dis_2) - 1] += 1
            else:
                dis = x_i - left_i + right_i - y_i + 1
                c[dis - 1] += 1
        elif x_i < left_i < y_i:
            dis_1 = right_i - left_i
            dis_2 = left_i - x_i + 1 + abs(right_i - y_i)
            c[min(dis_1, dis_2) - 1] += 1
        else:
            dis = right_i - left_i
            c[dis - 1] += 1

for i in c:
    print(i)

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

D = [0 for _ in range(N+1)]


def dist(i,j):
    return min(j-i,abs(X-i)+abs(j-Y)+1)

for i in range(1,N):
    for j in range(i+1,N+1):
        D[dist(i,j)] += 1

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

Solution (Python):
def bfs(v):
    d=[-1]*n
    d[v]=0
    q=[v]
    c=1
    while q:
        q1=[]
        for i in q:
            for j in pt[i]:
                if d[j]==-1:
                    d[j]=c
                    q1.append(j)
        q=q1
        c+=1
    return d
n,x,y = map(int,input().split())
pt = [[i-1,i+1] for i in range(0,n)]
pt[0].remove(-1)
pt[n-1].remove(n)
pt[x-1].append(y-1)
pt[y-1].append(x-1)
cnt = [0]*(n)

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

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

Solution (Python):
from collections import deque
N, X, Y = map(int, input().split())
graphs = [[i - 1, i + 1] for i in range(1, N - 1)]
graphs.insert(0, [1])
graphs.append([N - 2])



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




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


for index, start_point in enumerate(graphs):
    scores = [10**9 + 7 for _ in range(N)]
    queue = deque([index])
    scores[index] = 0
    while queue:
        now_index = queue.pop()
        for next_index in graphs[now_index]:
            if scores[next_index] > scores[now_index] + 1:
                queue.append(next_index)
                scores[next_index] = scores[now_index] + 1
    for score in scores[index:]:
        counts[score] += 1

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

Solution (Python):
from collections import defaultdict, deque

N, X, Y = map(int, input().split())
X -= 1
Y -= 1
mp = defaultdict(list)
ans = defaultdict(int)
for i in range(N - 1):
    mp[i].append(i + 1)
    mp[i + 1].append(i)
mp[X].append(Y)
mp[Y].append(X)

dist = [[-1 for _ in range(N)] for _ in range(N)]


def bfs(st):
    q = deque()
    q.append(st)
    dist[st][st] = 0
    while q:
        now = q.popleft()
        for new in mp[now]:
            if dist[st][new] != -1:
                continue
            q.append(new)
            dist[st][new] = dist[st][now] + 1


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

for i in range(N):
    for j in range(N):
        if j >= i:
            continue
        d = dist[i][j]
        ans[d] += 1

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

Solution (Python):

from collections import deque
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
D = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        D[i][j] = abs(j-i)
        D[j][i] = abs(j-i)
D[X][Y] = 1
D[Y][X] = 1

queue = deque([[X, Y]])
visited = [[False for _ in range(N)] for _ in range(N)]
visited[X][Y] = True 
while queue:
    x,y = queue.popleft()
    for i, j in zip([1, 0, -1, 0], [0, 1, 0, -1]):
        nx, ny = x+i, y+j
        if nx < 0 or nx >= N or ny < 0 or ny >= N:
            continue
        if visited[nx][ny]:
            continue
        else:
            visited[nx][ny] = True
            D[nx][ny] = min(D[nx][ny], D[x][y]+1)
            queue.append([nx, ny])

ans = [0 for _ in range(N)]
cnt = 0
for i in range(N):
    for j in range(i+1, N):
        
        v = D[i][j]
        
        ans[v-1] += 1
print(*ans[:-1], sep="\n")

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

    ans = [0] * N
    for i in range(1, N):
        for j in range(i+1, N+1):
            if i >= Y or j <= X:
                ans[j-i] += 1
            else:
                ans[min(j-i, abs(X-i) + abs(Y-j)+1)] += 1
    print(*ans[1:], sep='\n')

if __name__ == '__main__':
    main()

Solution (Python):


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


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

        


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

Solution (Python):
N, X, Y = map(int, input().split())
k = [0 for i in range(N - 1)]

for i in range(N):
  for j in range(N - i - 1):
    a = i + 1
    b = N - j
    if a <= X:
      if b >= Y:
        l = (X - a) + 1 + (b - Y)
      else:
        l = min(b - a, (X - a) + 1 + (Y - b))

    elif a > X:
      if b >= Y:
        l = min(b - a, (a - X) + 1 + (b - Y))
      else:
        l = min(b - a, (a - X) + 1 + (Y - b))
        
    k[l - 1] += 1
    
for val in k:
  print(val)

Solution (Python):


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

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

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

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

D = [0] * N
for i in range(N):
    for j in range(i + 1, N):
        if i < X and X <= j <= Y:
            start_to_ent = X - i
            ent_to_goal = j - X
            d = min(ent_to_goal, circle - ent_to_goal) + start_to_ent
            D[d] += 1
        elif X <= i <= Y and X <= j <= Y:
            start_to_goal = j - i
            d = min(start_to_goal, circle - start_to_goal)
            D[d] += 1
        elif X <= i <= Y and Y < j:
            start_to_ent = j - Y
            ent_to_goal = Y - i
            d = min(ent_to_goal, circle - ent_to_goal) + start_to_ent
            D[d] += 1
        elif i < X and Y < j:
            start_to_ent = X - i
            ent2_to_goal = j - Y
            r = Y - X
            d = start_to_ent + min(r, circle-r) + ent2_to_goal
            D[d] += 1
        else:
            d = j - i
            D[d] += 1

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

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

Solution (Python):
l = [int(x) for x in input().split()]

num_youso = l[0]
hidari = l[1]
migi = l[2]

lis = [0]*(num_youso -1)

for x in range(1,num_youso + 1):
  for y in range(x +1,num_youso + 1 ):
    saitan = y - x
    hidari_kyori = abs(x - hidari)
    migi_kyori = abs(y - migi)
    if hidari_kyori + migi_kyori + 1 < saitan:
      saitan = hidari_kyori + migi_kyori + 1
    lis[saitan -1] += 1
    
    

for i in range(num_youso -1):
  print(lis[i])

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

def clc(i1, i2):
    if (i1 < x and i2 <= x) or (y <= i1 and y < i2):
        return i2 - i1
    else:
        return min(1 + abs(i2 - y) + abs(i1 - x), i2 - i1)

for k in range(1, n+1):
    for l in range(k+1, n+1):
        tmp = clc(k, l)
        kyori.append(tmp)
outs = [0 for _ in range(n-1)]
for k in kyori:
    outs[k-1] += 1
for i in range(n-1):
    print(outs[i])

Solution (Python):
import collections


def bfs(i, path, dist, N):
    moves = 0

    pp = []
    pp = path[i]

    reached = [False for _ in range(N)]
    dist[i] = 0
    reached[i] = True
    for j in range(N + 1):
        moves += 1
        next_pp = []
        for i in pp:
            if reached[i]:
                continue
            else:
                reached[i] = True
                dist[i] = moves
                for p in path[i]:
                    next_pp.append(p)

        pp = next_pp


def flatten(nested_list):
    return [e for inner_list in nested_list for e in inner_list]


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

    path = [[] for _ in range(N)]

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

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

    dist = [N for _ in range(N)]

    D_list = []

    for i in range(N):
        dist[i] = 0
        bfs(i, path, dist, N)
        D_list.append(dist)
        dist = [N for _ in range(N)]

    D = flatten(D_list)
    dic = collections.Counter(D)

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


main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

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

ans = [0]*(N-1)
branch1 = X-1
branch2 = N-Y
cycle = Y-X+1
for i in range(cycle//2):   
    ans[i] += cycle
if cycle%2==0:     
    ans[cycle//2-1] -= cycle//2
ans[0] -= 1

for i in range(branch1):
    for j in range(cycle//2):
        if cycle%2==0 and j==cycle//2-1:
            ans[i+j+1] += 1
        elif j == 0:    
            ans[i+j+1] += 1
        else:
            ans[i+j+1] += 2
for i in range(branch2):
    for j in range(cycle//2):
        if cycle%2==0 and j==cycle//2-1:
            ans[i+j+1] += 1
        elif j == 0:    
            ans[i+j+1] += 1
        else:
            ans[i+j+1] += 2

for i in range(branch1+branch2+1):   
    ans[i] += branch1+branch2+1 - i

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

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

k = [0] * (N + 1)

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

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

Solution (Python):









def resolve():
    from heapq import heappush, heappop

    
    
    def dijkstra(V, g, r):

        dist = [INF] * V
        queue = [(0, r)]  
        dist[r] = 0  

        while queue:
            c, v = heappop(queue)
            if dist[v] < c:  
                continue
            for cost, t in g[v]:
                if dist[v] + cost < dist[t]:
                    dist[t] = dist[v] + cost
                    heappush(queue, (dist[t], t))

        return dist

    N,X,Y=map(int,input().split())
    V, E= N,N
    g = [[] for i in range(V)]

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

    INF = 10 ** 10
    ans = [0] * N

    for r in range(N):
        for i in dijkstra(V, g, r):
            if i<INF:
                ans[i]+=1

    for j in range(1, N):
        print(ans[j] // 2)


resolve()

Solution (Python):
n, x, y = [int(i) for i in input().split()]

juli = dict()
for i in range(1, n + 1):
    juli[i] = dict()
    for j in range(1, n + 1):
        juli[i][j] = 5000

for i in range(1, n + 1):
    juli[i][i] = 0

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

juli[x][y] = 1
juli[y][x] = 1


for i in range(1, x + 1):
    for j in range(i, x + 1):
        juli[i][j] = j - i

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

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

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

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

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

table = dict()
for i in range(0, n + 1):
    table[i] = 0

for i in range(1, n + 1):
    for j in range(i, n + 1):
        table[juli[i][j]] += 1

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

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    N, X, Y = input_nums()
    dist = {}
    for i in range(1, N):
        dist[i] = 0
    for s in range(1, N):
        for g in range(s+1, N+1):
            if X == s and Y == g:
                dist[1] += 1
                continue
            a = abs(X - s) + abs(Y - g) + 1
            b = g - s
            if a < b:
                dist[a] += 1
            else:
                dist[b] += 1
    for i in range(1, N):
        print(dist[i])

if __name__ == '__main__':
    main()

Solution (Python):
first = str(input()).split(' ')
n = int(first[0])
x = int(first[1])
y = int(first[2])

dist = [0 for i in range(1,n)]

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

Solution (Python):

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





dic={}

for i in range(n):
    for j in range(i,n):
        
        
        dis=j-i
        maybe=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(dis,maybe)
        
        dic[dis]=dic.get(dis,0)+1

for k in range(1,n):
    print(dic.get(k,0))

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


a=[0]*n
m={}
for i in range(1,n+1):
	for j in range(i+1,n+1):
	    
	    d=min(j-i,abs(i-x)+1+abs(j-y))
	    if d in m:
	        m[d]+=1
	    else :
	        m[d]=1




for i in range(1,n):
    if i in m:
        print m[i]
    else:
        print 0

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(1)
	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):
			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):
N, X, Y = map(int, input().split())
A = [0 for i in range(N - 1)]
for i in range(1, N):
  for j in range(i+1, N+1):
    if j <= X:
      A[j-i-1] += 1
    elif i >= Y:
      A[j-i-1] += 1
    elif i <= X:
      if j >= Y:
        A[j-Y+X-i] += 1
      elif X < j < Y:
        m = min(X-i+1+Y-j, j-i)
        A[m-1] += 1
    elif j >= Y:
      if i <= X:
        A[j-Y+X-i] += 1
      elif X < i < Y:
        m = min(i-X+1+j-Y, j-i)
        A[m-1] += 1
    elif X <= i and j <= Y:
      m = min(i-X+1+Y-j, j-i)
      A[m-1] += 1
for i in range(N-1):
  print(A[i])

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

X -= 1
Y -= 1

ans = [0] * (N-1)

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

for x in ans: print(x)

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

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

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

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

Solution (Python):
import collections 
nxy=input().rstrip().split(" ")
n=int(nxy[0])
x=int(nxy[1])
y=int(nxy[2])
dis=[]
for i in range(1,n):
    
    j=i+1
    while j>i and j<=n:
        l1=abs(x-i)+1+abs(y-j)
        l2=j-i
        if l1>=l2:
            L=l2
        else:
            L=l1
        
        dis.append(L)
        j=j+1

c=collections.Counter(dis)

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

Solution (Python):
N, X, Y = map(int,input().split())
G = [k for k in range(N)]
G[Y-1] = G[X-1] + 1
dx = [abs(X-1-k) for k in range(N)]
dy = [abs(Y-1-k) for k in range(N)]

ans = [[10**9]*N for l in range(N)]
for k in range(N):
    d = [10**9]*N
    for l in range(N):
        d[l] = min(abs(k-l),abs(X-1-k)+dy[l]+1,abs(Y-1-k)+dx[l]+1)
    for l in range(N):
        ans[k][l] = min(ans[k][l],d[l])
d = [0]*(N-1)
for k in range(N-1):
    for l in range(k+1,N):
        d[ans[k][l]-1] += 1
for e in d:
    print(e)

Solution (Python):
N, X, Y = map(int, input().split())
ans = {}
for i in range(1, N):
    ans[i] = 0

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

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
























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

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

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

Solution (Python):
from collections import defaultdict

def main():
    N, X, Y = [int(x) for x in input().split()]
    shortcut_len = Y - X - 1
    count = defaultdict(int)
    for start in range(1, N+1):
        for end in range(start + 1, N+1):
            length = end - start
            if start <= X and end >= Y:
                length -= shortcut_len
            elif start < Y:
                temp = 1 + abs(X - start) + abs(Y - end)
                length = temp if temp < length else length

            
            count[length] += 1
    
    for i in range(1, N):
        print(count[i])

if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque

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

graph = [[] for _ in range(N)]

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

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




def bfs(s):
    q = deque([])
    q.append(s)
    dist[s][s] = 0

    while q:
        x = q.popleft()

        for nx in graph[x]:
            if dist[s][nx] != 0:
                continue
            else:
                dist[s][nx] = dist[s][x] + 1
                q.append(nx)


inf = 10 ** 9

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

dist_lis = [0] * N

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

for i in range(N):
    for j in range(i + 1, N):
        dist_lis[dist[i][j]] += 1




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

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

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

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

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

a=[[0 for i in range(n)]for j in range(n)]
for i in range(n-1):
  for j in range(n):
    a[i][j]=j-i
    
l=y-x+1
l//=2
l-=1

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

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





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

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

A, B = N-(Y-X-1), Y-X-1
for i in range(1, A):
    ans[i] += A - i
ans[1] -= 1

if B % 2 == 0:
    C = [x for x in range(1, B//2 + 1)]
    C = C[1:] + C + [B//2 + 1]

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

    for i in range(1, (B+2)//2):
        ans[i] += (B+2)
    ans[(B+2)//2] += (B+2)//2


else:
    C = [x for x in range(1, B//2 + 2)]
    C = C[1:] + C

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

    for i in range(1, (B+2)//2 + 1):
        ans[i] += (B+2)


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

Solution (Python):
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

from collections import deque
n,x,y = inm()
ans = [0]*n
for i in range(1,n+1):
    
    done = [False]*(n+1)
    
    
    q = deque([(i,0)])
    while len(q)>0:
        z,d = q.popleft()
        
        if done[z]:
            
            continue
        done[z] = True
        if z>i:
            ans[d] += 1
        if z>1 and not done[z-1]:
            q.append((z-1,d+1))
        if z<n and not done[z+1]:
            q.append((z+1,d+1))
        if z==x and not done[y]:
            q.append((y,d+1))
for i in range(1,n):
    print(ans[i])