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

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

def dist(fr, to):
    return min(
        to - fr,
        abs(to - Y) + 1 + abs(fr - X),
        abs(fr - Y) + 1 + abs(to - X)
    )

cnt = [0] * N

ans = 0
for fr in range(1, N + 1):
    for to in range(fr + 1, N + 1):
        cnt[dist(fr, to)] += 1

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

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

ans = [0] * (n-1)

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

print("\n".join([str(d) for d in ans]))

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

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,x,y=INTM()
    z=y-x
    sc=y-x-1
    loop=y-x+1
    maxl=n-(y-x)+loop//2+1
    for i in range(1,n):
        ct=0
        if i<maxl:
            for j in range(1,n):
                if j+i<=x or j>=y:
                    if j+i<=n:
                        ct+=1
                else:
                    if j<=x:
                        if j+i+sc<=n:
                            ct+=1
                        temp=i-(x-j)
                        if temp>=2:
                            if loop>temp*2:
                                ct+=2
                            elif loop==temp*2:
                                ct+=1
                        else:
                            ct+=1
                        
                    else:
                        lpmin=min(y-j,+(j-x+1))
                        if lpmin==j-x+1:
                            if lpmin==y-j:
                                if lpmin+(n-y)>=i:
                                    ct+=1
                            else:
                                if lpmin>i:
                                    ct+=1
                                elif lpmin==i:
                                    ct+=2
                                else:
                                    if lpmin+(n-y)>=i:
                                        ct+=1
                                    
                                    if loop>i*2:
                                        ct+=2
                                    elif loop==i*2:
                                        ct+=1
                        else:
                            if lpmin+(n-y)>=i:
                                ct+=1
                
            print(ct)        
        else:
            print(ct)
                
        
if __name__ == '__main__':
    do()

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

    for i in dist:
        print(i)

if __name__ == '__main__':
    main()

Solution (Python):
import pprint
from itertools import chain
import collections
n, x, y = (int(each) for each in input().split(' '))



table = [[0] * n for i in range(n)]

















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


cntr = collections.Counter(list(chain.from_iterable(table)))


for each in range(1,n):
    print(cntr.get(each, 0))

Solution (Python):
import sys
n, x, y = [int(x) for x in input().split()]
ks = [0] * n
m = (x + y) // 2
for i in range(1, x + 1):
    for j in range(i + 1, n + 1):
        if j <= x:
            ks[j - i] += 1
        elif x < j < y:
            ks[min(j - i, y - j + 1 + x - i)] += 1
        else:
            ks[j - y + 1 + x - i] += 1
for i in range(x + 1, y + 1):
    for j in range(i + 1, n + 1):
        if j <= y:
            ks[min(j - i, i - x + y - j + 1)] += 1
        else:
            ks[min(j - i, i - x + 1 + j - y)] += 1
for i in range(y + 1, n + 1):
    for j in range(i + 1, n + 1):
        ks[j - i] += 1
for c in ks[1:]:
    print(c)

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

dist_list = [0] * N

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

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

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

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

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

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

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

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N, X, Y = MI()
    d = defaultdict(int)

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

    for i in range(1, N):
        if i in d:
            print(d[i])
        else:
            print(0)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque as dq
input = sys.stdin.readline

N, X, Y = map(int, input().split())
dp = [[N] * N for _ in range(N)]
for x in range(N):
  Q = dq([x])
  dp[x][x] = 0
  while len(Q):
    p = Q.popleft()
    if p == X - 1:
      if dp[x][Y - 1] > dp[x][p] + 1:
        dp[x][Y - 1] = min(dp[x][Y - 1], dp[x][p] + 1)
        Q.append(Y - 1)
    if p == Y - 1:
      if dp[x][X - 1] > dp[x][p] + 1:
        dp[x][X - 1] = min(dp[x][X - 1], dp[x][p] + 1)
        Q.append(X - 1)
    if p + 1 < N:
      if dp[x][p + 1] > dp[x][p] + 1:
        dp[x][p + 1] = min(dp[x][p + 1], dp[x][p] + 1)
        Q.append(p + 1)
    if p - 1 >= 0:
      if dp[x][p - 1] > dp[x][p] + 1:
        dp[x][p - 1] = min(dp[x][p - 1], dp[x][p] + 1)
        Q.append(p - 1)
table = [0] * N
for i in range(N):
  for j in range(i, N): table[dp[i][j]] += 1

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

Solution (Python):
import collections
n,x,y = map(int,input().split())
li = []
for i in range(1,n):
  for j in range(i+1,n+1):
    i_x = abs(x-i)
    y_j = abs(j-y)
    li.append(min(j-i,i_x + y_j + 1))
c = collections.Counter(li)
for k in range(1,n):
  print(c[k])

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

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


    return 0


if __name__ == '__main__':
    main()

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

ans = [0] * (N - 1)

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

for a in ans:
    print(a)

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):
          a = abs(x-i-1)
          b = abs(y-j-1)
          c = abs(a+b+1)
          if j-i < c:
               ans[j-i-1] += 1
          else:
               ans[c-1] += 1
for i in range(len(ans)):
     print(ans[i])

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

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

Solution (Python):
from heapq import *
from collections import defaultdict

N,X,Y = map(int,input().split())
X -= 1
Y -= 1
cost_pri = defaultdict(list)
for i in range(N-1):
    cost_pri[i].append((i+1,1))
    cost_pri[i+1].append((i,1))
cost_pri[X].append((Y,1))
cost_pri[Y].append((X,1))
ans = [0]*(N-1)
for s in range(N):
    dist = [2**60]*N
    dist[s] = 0
    que = [(0,s)]
    heapify(que)
    while que:
        p = heappop(que)
        v = p[1]
        if dist[v] < p[0]:continue
        for e in cost_pri[v]:
            if dist[e[0]] > dist[v] + e[1]:
                dist[e[0]] = dist[v] + e[1]
                heappush(que,(dist[e[0]],e[0]))
    
    for a in dist[s+1:]:
        ans[a-1] += 1

for a in ans:
    print(a)

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


def BFS(s):
    color=["white" for _ in range(n)]
    D=[float("inf") for _ in range(n)]

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

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

    return D


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

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

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

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

Solution (Python):


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

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

for i in range(n - 1):
    for j in range(i + 1, n):
        now = 0
        if (j <= x - 1):
            ans[j - i - 1] += 1

        elif(j > x - 1 and j <= y - 1 and i <= x - 1):
            now = now + x - 1 - i
            if (j - (x - 1) >= (y - 1) - j + 1):
                now = now + (y - 1) - j + 1
            else:
                now = now + j - (x - 1)
            ans[now - 1] += 1

        elif(j > x - 1 and j <= y - 1 and i > x - 1):
            if (j - i >= (i - (x - 1)) + ((y - 1) - j) + 1):
                now = (i - (x - 1)) + ((y - 1) - j) + 1
            else:
                now = j - i
            ans[now - 1] += 1

        elif(j > y - 1 and i <= x - 1):
            now = now + x - 1 - i
            now = now + j - (y - 1) + 1
            ans[now - 1] += 1

        elif(j > y - 1 and i > x - 1 and i < y - 1):
            if((y - 1) - i >= i - (x - 1) + 1):
                now = now + i - (x - 1) + 1
            else:
                now = now + (y - 1) - i
            now = now + j - (y - 1)
            ans[now - 1] += 1

        elif(i >= y - 1):
            ans[j - i - 1] += 1
print(*ans)

Solution (Python):
from collections import defaultdict

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

circle = y - x + 1
a = [0 for _ in range(circle)]
for i in range(1, circle // 2 + 1):
    a[i] = i
    a[-i] = i

dists = defaultdict(int)
for i in range(n - 1):
    if i >= y:
        for j in range(i + 1, n):
            dists[j - i] += 1
    elif x < i < y:
        for j in a[1:y - i + 1]:
            dists[j] += 1
        for j in range(1, n - y):
            dists[a[y - i] + j] += 1
    else:
        
        for j in range(i + 1, x):
            dists[j - i] += 1
        for j in a:
            dists[x - i + j] += 1
        for j in range(1, n - y):
            dists[x - i + a[-1] + j] += 1

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

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

array1 = [0] * n
array2 = [0] * n

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

ans = [0] * (n+1)
dis = [[0 for i in range(n)] for i in range(n)]


for i in range(n):
  if i <= x:
    for j in range(i+1,n):
      if y <= j:
        tmp = (x-i) + (j-y) + 1
      elif j <= x:
        tmp = j-i
      else:
        tmp = (x-i) + array1[j]
        
      ans[tmp] += 1
      dis[i][j] = tmp
      
  elif y <= i:
    for j in range(i+1,n):
      ans[j-i] += 1
      dis[i][j] = j-i
      
  else:
    for j in range(i+1,n):
      if y <= j:
        tmp = (j-y) + array2[i]
      else:
        tmp = min(j-i, (y-x+1)-(j-i))
        
      ans[tmp] += 1
      dis[i][j] = tmp

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

Solution (Python):
import sys
import numpy as np
from collections import deque, Counter
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, X, Y = map(int, read().split())
dist = []
for i in range(1, N):
    node = np.arange(i + 1, N + 1)

    d = np.abs(node - i)
    dd = np.abs(i - X) + np.abs(Y - node) + 1
    ddd = np.abs(i - Y) + np.abs(X - node) + 1

    acc = np.minimum(np.minimum(d, dd), ddd)

    dist.append(acc)

dist = np.concatenate(dist)

cnt = np.bincount(dist, minlength=N)
for i in range(1, N):
    print(cnt[i])

Solution (Python):
n, x, y = 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):
        t = min(j-i, abs(x-i) + abs(y-j) + 1)
        A[t] += 1
print(*A[1:], sep="\n")

Solution (Python):

import numpy as np
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(j-Y) + abs(i-X) + 1) 
        D[d] += 1
for i in range(1, N):
    print(D[i])

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

Solution (Python):
n, x, y = map(int, input().split())
x = x - 1
y = y - 1
kl = [0] * (n - 1)
 
for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        if (e <= x)or(s >= y):
            kl[d - 1] += 1
        else:
            kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1
 
for i in kl:
    print(i)

Solution (Python):
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

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

Solution (Python):
from collections import deque
from heapq import heappush, heappop

N, X, Y = [int(i) for i in input().split()]
X -= 1
Y -= 1
G = [[] for _ in range(N)]
for i in range(N):
    if i!=0: G[i].append((i-1, 1))
    if i!=N-1: G[i].append((i+1, 1))
G[X].append((Y, 1))
G[Y].append((X, 1))

INF = 10**30
def Johnson(G, N):
    h = [0]*N

    update = 1
    for i in range(N):
        update = 0
        for v in range(N):
            d = h[v]
            for w, c in G[v]:
                if c + d < h[w]:
                    h[w] = d + c
                    update = 1
        if not update:
            break
    else:
        return None

    for v in range(N):
        d = h[v]
        g = G[v]
        for j, (w, c) in enumerate(g):
            g[j] = (w, c + d - h[w])

    D = []
    for i in range(N):
        dst = [INF]*N
        dst[i] = 0
        que = [(0, i)]
        while que:
            cost, v = heappop(que)
            if dst[v] < cost:
                continue
            for w, c in G[v]:
                if cost + c < dst[w]:
                    dst[w] = r = cost + c
                    heappush(que, (r, w))
        v = h[i]
        for j in range(N):
            if dst[j] == INF:
                dst[j] = INF
            else:
                dst[j] -= v - h[j]
        D.append(dst)

    return D
res = [0]*(N+2)
D = Johnson(G, N)
for i in range(N):
    for j in range(i+1, N):
        res[D[i][j]] += 1

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

Solution (Python):
N, X, Y = list(map(int, input().split(' ')))
X -= 1
Y -= 1
dist_map = {}

def search(origin):
  dist = []
  
  for i in range(N):
    dist.append(abs(origin - i))
  
  if dist[X] < dist[Y]:
    dist[Y] = dist[X] + 1
  elif dist[Y] < dist[X]:
    dist[X] = dist[Y] + 1
  for i in range(N):
    if i - 1 >= 0:
      dist[i] = min(dist[i], dist[i-1]+1)
    if i + 1 < N:
      dist[i] = min(dist[i], dist[i+1]+1)
  for i in reversed(range(N)):
    if i - 1 >= 0:
      dist[i] = min(dist[i], dist[i-1]+1)
    if i + 1 < N:
      dist[i] = min(dist[i], dist[i+1]+1)
  
  return dist

count = [0 for i in range(N)]
for i in range(N):
  dist = search(i)
  for dis in dist:
    count[dis] += 1

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs(nodes, src):
    """ BFS(一般グラフ、重みなし) """
    from collections import deque

    N = len(nodes)
    que = deque([(src, 0)])
    dist = [INF] * N
    while que:
        u, c = que.popleft()
        if dist[u] != INF:
            continue
        dist[u] = c
        for v in nodes[u]:
            que.append((v, c+1))
    return dist

N, x, y = MAP()
x -= 1; y -= 1

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

distx = bfs(nodes, x)
disty = bfs(nodes, y)

G = list2d(N, N, 0)
for i in range(N):
    for j in range(i+1, N):
        G[i][j] = min(j - i, distx[i] + disty[j] + 1, distx[j] + disty[i] + 1)
ans = [0] * N
for i in range(N):
    for j in range(i+1, N):
        ans[G[i][j]] += 1
[print(a) for a in ans[1:]]

Solution (Python):
from collections import Counter
n,x,y = map(int, input().split())
x -= 1
y -= 1
ans = [0]*n
dp = [[0]*n for _ in range(n)]
for i in range(n):
    for j in range(i,n):
         ans[min(abs(i-j),(abs(i-x)+abs(j-y)+1),(abs(i-y)+abs(j-x)+1))]+=1
for k in range(1,n):
    print(ans[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):
		a=min(j-i,abs(i-X)+abs(Y-j)+1)
		ans[a-1]+=1
for i in range(N-1):
	print(ans[i])

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

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

ans.pop(0)
for i in ans:
    print(i)

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

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

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

Solution (Python):
import sys
from heapq import heappop, heappush
input = sys.stdin.readline

n, x, y = map(int, input().split()) 
graph = [[] for _ in range(n)]

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

def dijkstra(graph, n, start):
    inf = float('inf')
    visited = [inf] * n
    visited[start] = 0
    heap = [(0, start)] 
    while heap:
        _, vertex = heappop(heap)
        for c, v in graph[vertex]:
            cost = visited[vertex] + c
            if visited[v] > cost:
                visited[v] = cost
                heappush(heap, (cost, v))
    return visited

path = []
for i in range(n):
    visited = dijkstra(graph, n, i)
    path.append(visited)










t = [0] * n
for i in range(len(path)):
    visited = path[i]
    for j in range(i, len(visited)):
        diff = visited[j] - visited[i]
        t[diff] += 1
for k in range(1, n):
    ans = t[k]
    print(ans)

Solution (Python):

N, X, Y = map(int,input().split())
L = [0]*(N)

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

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

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

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

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

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

npath = [0] * (N-1)

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

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



byd = y - x


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

ld = byd + 1


for i in range(x, y):
    for j in range(x+1, y+1):
        if i == x and j == y:
            break

        altd = j - i
        d = ld - (j - i)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1


for i in range(1, x):
    for j in range(x+1, y):
        altd = j - i
        d = ld - (j - x) + (x-i)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1


for i in range(x+1, y):
    for j in range(y+1, n+1):
        altd = j - i
        d = ld - (y - i) + (j - y)
        if altd > d:
            ans[altd] -= 1
            ans[d] += 1

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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
def input(): return sys.stdin.readline().strip()
def STR(): return input()
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 = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n, x, y = MAP()
yx = y - x + 1
lnf = x
lne = n - y + 1

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

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

Solution (Python):
n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1


for num in counter[1:]:
    print(num)

Solution (Python):
n, x, y = map(int, input().split())
x = x - 1
y = y - 1
kl = [0] * (n - 1)
 
for s in range(n - 1):
    for e in range(s+1, n):
        d = e-s
        if (e <= x)or(s >= y):
            kl[d - 1] += 1
        else:
            kl[min(d, abs(s-x)+abs(e-y)+1)-1] += 1
 
for i in kl:
    print(i)

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

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

for i in kl:
    print(i)

Solution (Python):
N, X, Y = [int(s) for s in 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(j - Y) + abs(i - X) + 1)
        D[d] += 1
for i in range(1, N):
    print(D[i])

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

ans = []

cnt = [0] * (N+1)
for a, b in itertools.combinations(range(1, N + 1), 2):
    d1 = b - a
    d2 = abs(X - a) + abs(Y - b) + 1

    d = min(d1, d2)

    cnt[d] += 1

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

Solution (Python):
from collections import deque
n,x,y=map(int,input().split())
G=[[10**5]*(n+2) for i in range(n+2)]
for i in range(n+2):
  G[i][i]=0
X=deque([i for i in range(1,n+1)])
Y=deque([i for i in range(1,n+1)])
V=[[0]*(n+2) for i in range(n+2)]
for i in range(1,n+1):
  V[i][i]=1
G[x][y]=1
G[y][x]=1
V[x][y]=1
V[y][x]=1
for i in range(n+2):
  V[0][i]=1
  V[n+1][i]=1
for i in range(1,n+1):
  V[i][0]=1
  V[i][n+1]=1
X.append(x)
X.append(y)
Y.append(y)
Y.append(x)
XX=[-1,0,0,1]
YY=[0,-1,1,0]
while len(X)>0:
  x=X[0]
  y=Y[0]
  X.popleft()
  Y.popleft()
  for i in range(4):
    if V[x+XX[i]][y+YY[i]]==0:
      X.append(x+XX[i])
      Y.append(y+YY[i])
      V[x+XX[i]][y+YY[i]]=1
      G[x+XX[i]][y+YY[i]]=G[x][y]+1
ans=[0]*n
for i in range(1,n+1):
  for j in range(1,n+1):
    ans[G[i][j]]+=1
for i in range(1,n):
  print(ans[i]//2)

Solution (Python):
import collections 
N,X,Y = map(int,input().split())
d = [[0]*(N+1) for _ in range(N+1)]
for i in range(1,N):
    for j in range(i+1,N+1):
        if(i>=Y or j<=X):
            d[i][j] = j-i
        elif(i<=X and j>=Y):
            d[i][j] = (X-i)+1+(j-Y)
        else:
            a_path = j-i
            b_path = abs(X-i)+1+abs(Y-j)
            d[i][j] = min(a_path,b_path)

ans = [0]
for i in range(N+1):
    ans += d[i]
c = collections.Counter(ans)
for k in range(1,N): 
    print(c[k])