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

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

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

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

cnt = [0]*N

def bfs(num):
    dq = deque()
    dq.append((num,0))
    visited = [-1]*N
    visited[num] = 0
    while dq:
        a, b = dq.popleft()
        for i in graph[a]:
            if visited[i] == -1:
                visited[i] = b+1
                dq.append((i, b+1))
    return visited

vx = bfs(X-1)
vy = bfs(Y-1)

for i in range(0,N-1):
    for j in range(i+1, N):
        if abs(X-1-i) <= abs(Y-1-i):
            idx = min(j-i, abs(X-1-i) + vx[j])
        else:
            idx = min(j-i, abs(Y-1-i) + vy[j])
        cnt[idx] += 1
    
for i in cnt[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):
        d=min(abs(j-i),abs(x-i)+1+abs(j-y))
        ans[d]+=1


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

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

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

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

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

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

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

Solution (Python):


def main():
    from itertools import combinations

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

    def dist(a, b, X=X, Y=Y):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for combi in combinations(range(N), r=2):
        ctr[dist(*combi)] += 1

    it = iter(ctr)
    next(it)
    print(*it, sep='\n')


if __name__ == '__main__':
    main()

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

ret = [0]*N
for s,e in list(itertools.combinations(range(1,N+1), 2)):
  d = min(e-s, abs(X-s)+1+abs(Y-e), abs(X-e)+1+abs(Y-s))
  ret[d] += 1

for r in ret[1:]:
  print(r)

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

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

for _ in range(1, n):
  print(klist[_])

Solution (Python):
import numpy as np
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):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(int(a))

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

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

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

Solution (Python):


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

    def dist(a, b, X=X, Y=Y):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for b in range(N):
        for a in range(b):
            ctr[dist(a, b)] += 1

    it = iter(ctr)
    next(it)
    print(*it, sep='\n')


if __name__ == '__main__':
    main()

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

def dist(a, b):
    return min(abs(b-a), abs(X-a) + 1 + abs(b-Y))

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

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

Solution (Python):
def resolve():
    n,x,y = map(int, input().split())
    ans = {}
    for i in range(1, n):
        for j in range(i+1, n+1):
            dist1 = j-i
            dist2 = abs(x-i)+1+abs(y-j)
            dist =min (dist1, dist2)
            if dist in ans:
                ans[dist] += 1
            else:
                ans[dist] = 1
    for i in range(1,n):
        if i not in ans:
            ans[i] =0
        print(ans[i])
resolve()

Solution (Python):


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

    def dist(a, b):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for b in range(N):
        for a in range(b):
            ctr[dist(a, b)] += 1

    it = iter(ctr)
    next(it)
    print(*it, sep='\n')


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = sys.stdin.readline

n, x, y = [int(x) for x in input().split()]

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

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

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

from collections import deque

def bfs(u):
    d = [-1]*n
    d[u] = 0
    queue = deque([u])
    while queue:
        v = queue.popleft()
        for i in g[v]:
            if d[i] < 0:
                d[i] = d[v] + 1
                queue.append(i)
    return d

ans = [0] * n

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

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

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

answer=[0]*(N-1)

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

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

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

Solution (Python):


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

    def dist(a, b):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for b in range(N):
        for a in range(b):
            d = dist(a, b)
            ctr[d] += 1

    it = iter(ctr)
    next(it)
    print(*it, sep='\n')


if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

d = [[sys.maxsize for _ in range(N)] for _ in range(N)]

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

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

for h in range(N):
  for i in range(h+1, N):
    if h != i:
      answer[d[h][i]-1] += 1

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

Solution (Python):
import numpy as np
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):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_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):
        ans[min(j - i, abs(i - (x - 1)) + 1 + abs(j - (y - 1)), abs(j - (x - 1)) + 1 + abs(i - (y - 1))) - 1] += 1
for a in ans:
    print(a)

Solution (Python):
n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  b_1 = k - x
  c_1 = k - y
  if b_1 < 0:
      b_1 = - b_1
  if c_1 < 0:
      c_1 = - c_1
  for j in range(i+1, n):
    l = j + 1
    a = l - k
    b_2 = l - y
    c_2 = l - x
    if b_2 < 0:
      b_2 = - b_2
    if c_2 < 0:
      c_2 = - c_2
    b = b_1 + b_2 + 1
    c = c_1 + c_2 + 1
    if b < a:
      a = b
    if c < a:
      a = c
    ans[a-1] += 1
for i in range(n-1):
  print(ans[i])

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

Solution (Python):
import sys

def main():
    n, x, y = [int(s) for s in sys.stdin.readline().strip().split()]
    x1 = x-1
    y1 = y-1

    score = {i:0 for i in range(n)}

    for i in range(n-1):
        for j in range(i+1, n):
            diff = j - i
            cand = abs(x1 - i) + 1 + abs(y1 - j)
            cand2 = abs(y1 - i) + 1 + abs(x1 - j)
            result = min(diff, cand, cand2)
            score[result] += 1

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

main()

Solution (Python):
def distance(i, j, x, y):
    return min([abs(j - i), abs(x - i) + 1 + abs(j - y), abs(y - i) + 1 + abs(j - x)])


if __name__ == '__main__':
    n, x, y = tuple([int(i) for i in input().split()])
    x, y = min(x, y), max(x, y)

    dists = [0 for k in range(n)]
    for i in range(1, n):
        for j in range(i + 1, n + 1):
            d = distance(i, j, x, y)
            dists[d] += 1

    for k in dists[1:]:
        print(k)

Solution (Python):


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

    def dist(a, b):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for b in range(N):
        for a in range(b):
            d = dist(a, b)
            ctr[d] += 1

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


if __name__ == '__main__':
    main()

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 k in a[1:]:
	print(k)

Solution (Python):


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

    def dist(a, b):
        return min(
            abs(a - b),
            abs(a - X) + abs(b - Y) + 1,
            abs(a - Y) + abs(b - X) + 1
        )

    ctr = [0] * N
    for b in range(N):
        for a in range(b):
            d = dist(a, b)
            ctr[d] += 1

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

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

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

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

Solution (Python):
import sys


from collections import Counter, deque, defaultdict










readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

    ans = [0] * n

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

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


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):

N,X,Y = map(int,input().split())
lst = [[0]*N for i in range(N)]
dct = {i+1: 0 for i in range(N-1)}
for i in range(N):
    for j in range(i+1, N):
        if (i+1 <= X and j+1 >= Y):
            num = X - (i + 1) + 1 + j + 1 - Y
        elif (i+1 < X and j + 1 > X and  j+1 < Y):
            num = min(j-i, X - (i+1) + 1 + Y - (j+1))
        elif (i+1 >= X and j+1 < Y):
            num = min(j-i, i+1 - X + 1 + Y - (j+1))
        elif (i+1 > X and i + 1 < Y and  j+1 >= Y):
            num = min(j-i, i+1 - X + 1 + j+1 - Y)
        else:
            num = j - i
        dct[num] += 1
for i in dct.values():
    print(i)

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

memo = [0] *(N)

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

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

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

Solution (Python):
def main():
    from collections import deque
    n,x,y=map(int,input().split())
    e=[[]for _ in range(n)]
    for i in range(n-1):
        e[i]+=i+1,
        e[i+1]+=i,
    e[x-1]+=y-1,
    e[y-1]+=x-1,
    a=[0]*n
    for s in range(n):
        d=[-1]*n
        d[s]=0
        q=deque([s])
        add,pop=q.append,q.popleft
        while q:
            v=pop()
            for w in e[v]:
                if d[w]<0:
                    d[w]=d[v]+1
                    add(w)
        for i in d:a[i]+=1
    print(' '.join(str(i//2)for i in a[1:]))
main()

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

Solution (Python):
import sys
import itertools
import queue
input = sys.stdin.readline
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n) 


def main():
    N, X, Y = read_values()
    X -= 1
    Y -= 1
    res = [0] * N

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

            res[d] += 1

    for r in res[1:]:
        print(r)


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

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

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

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

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

Solution (Python):
from collections import defaultdict

N, X, Y = map(int, input().split())
X, Y = X - 1, Y - 1
dist_to_cnt = defaultdict(int)
for i in range(N):
    for j in range(i, N):
        dist = min(j - i, abs(i - X) + 1 + abs(Y - j))
        dist_to_cnt[dist] += 1
for i in range(1, N):
    print(dist_to_cnt[i])

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

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

counter = [0] * n

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

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

Solution (Python):
from collections import*
n,x,y=map(int,input().split())
e=[[]for _ in range(n)]
for i in range(n-1):
    e[i]+=i+1,
    e[i+1]+=i,
e[x-1]+=y-1,
e[y-1]+=x-1,
a=[0]*n
for s in range(n):
    d=[-1]*n
    d[s]=0
    q=deque([s])
    while q:
        v=q.popleft()
        for w in e[v]:
            if d[w]<0:
                d[w]=d[v]+1
                q+=w,
    for i in d:a[i]+=1
print(*[i//2for i in a[1:]])

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

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

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

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

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

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

Solution (Python):
import sys

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

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

for k in range(1, N):
    if k == 1:
        print(N)
    else:
        print(ans[k])

Solution (Python):
def main():
    from collections import deque

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

    g = tuple(set() for _ in range(N))
    for v in range(N):
        if v > 0:
            g[v].add(v - 1)
        if v < N - 1:
            g[v].add(v + 1)

    g[X].add(Y)
    g[Y].add(X)

    ctr = [0] * N
    for v in range(N):
        dist = [-1] * N

        q = deque()
        q.append((v, 0))

        while q:
            v, d = q.popleft()
            if ~dist[v] and dist[v] < d: continue
            dist[v] = d
            for u in g[v]:
                if ~dist[u]: continue
                dist[u] = d + 1
                q.append((u, d + 1))

        for d in dist:
            ctr[d] += 1

    print(*map(lambda x: x // 2, ctr[1:]), sep='\n')


if __name__ == '__main__':
    main()

Solution (Python):

from collections import deque
def main(N, X, Y):
    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")
if __name__ == "__main__":
    N, X, Y = map(int, input().split())
    main(N, X, Y)

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

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

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

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

Solution (Python):
from itertools import combinations

N, X, Y = map(int, input().split())
count = [0] * N
for i, j in combinations(range(1, N+1), 2):
    k = min(j - i, abs(X - i) + 1 + abs(Y - j))
    count[k] += 1
print(*count[1:], sep='\n')

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

def f(l, k):
  if l+1 <= k:
    return 0
  else:
    return l-k+1

def g(l, k):
  if l < 2*k:
    return 0
  elif l==2*k:
    return l/2
  else:
    return l

def h(l, m, k):
  M = 0
  for i in range(1, k):
    if  i<=l and k-i >1:
      M += g(m,k-i)*2/m
    elif i<=l:
      M +=1 
  return M
    
A=[n]
for k in range(2, n):
  c=f(n+x-y,k)+g(y-x+1,k)+h(x-1,y-x+1,k)+h(n-y,y-x+1,k)
  A.append(int(c))

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

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



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



def bfs_graph(start):
    
    dist = [-1] * N
    que = deque([start])
    dist[start] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)
    return dist


ans = [0] * N

for i in range(N - 1):
    
    for ele in bfs_graph(i)[i + 1:]:
        ans[ele] += 1
for a in ans[1:]:
    print(a)

Solution (Python):

from collections import deque
def main():
    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")
main()

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

Solution (Python):








import numpy as np



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

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

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

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

Solution (Python):
from collections import defaultdict
import math
N, X, Y = map(int, input().split(' '))
d = defaultdict(int)
for i in range(1, N):
    for k in range(i+1, N+1):
        if(k < X):
            ans = k-i
            d[ans] += 1
        else:
            ans = min(k-i, abs(Y-k)+1+abs(i-X))
            d[ans] += 1

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

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

X = X-1
Y = Y-1

kDict = {}

for kIndx in range(1, N+1):
    kDict[kIndx] = 0

for jIndx in range(N):
    for iIndx in range(jIndx):
        if (jIndx <= X) or (iIndx >= Y):
            kDict[jIndx - iIndx] += 1
        elif (iIndx <= X) and (jIndx >= Y):
            kDict[(jIndx - iIndx) - (Y - X - 1)] += 1
        elif (iIndx <= X) and ((jIndx > X) and (jIndx < Y)):
            if 2 * jIndx - (X + Y) - 1 > 0:
                kDict[(jIndx - iIndx) - (2 * jIndx - (X + Y) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        elif ((iIndx > X) and (iIndx < Y)) and (jIndx >= Y):
            if (X + Y) - 2 * iIndx - 1 > 0:
                kDict[(jIndx - iIndx) - ((X + Y) - 2 * iIndx - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        else:
            if (2 * (jIndx - iIndx) - (Y - X) - 1) > 0:
                kDict[(jIndx - iIndx) - (2 * (jIndx - iIndx) - (Y - X) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1

for kIndx in range(1, N):
    print(kDict[kIndx])

Solution (Python):
n, x, y = list(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) + abs(j - y) + 1)] += 1
print('\n'.join(map(str, ans[1:])))

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

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

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

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

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

ans = {}
for i in range(n-1):
  ans[i+1] = 0
  
for i in range(n):
  for j in range(i+1,n):
    if i <= x-1:
      if j <= x-1:
      	t=j-i
      	ans[t] += 1
      elif j <= y-1:
      	t = min(j-i, (x-1)-i + 1 + (y-1) -j)
      	ans[t] += 1
      else: 
      	t = (x-1)-i + 1 + j -(y-1)
      	ans[t] += 1
    elif i < y-1:
      if j < y-1:
      	t = min(j-i, i-(x-1) + 1 + (y-1) -j)
      	ans[t] += 1
      else: 
      	t = min(j-i, i-(x-1) + 1 + j - (y-1))
      	ans[t] += 1
    elif i >= y-1:
      t=j-i
      ans[t] += 1
    else:
      print("error")

for i in range(1,n):
  print(ans[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 bfs(graph, initial):
    n = len(graph) - 1
    dist = [-1] * (n + 1)
    q = deque([initial])
    visited = [False] * (n + 1)
    visited[initial] = True
    dist[initial] = 0

    while len(q) != 0:
        edge = q.popleft()
        nxt = graph[edge]

        for i, e in enumerate(nxt):
            if visited[e] is False:
                q.append(e)
                dist[e] = dist[edge] + 1
                visited[e] = True

    return dist


def main():
    N, M = MI()

    ret = bfs(graph, 1)
    print(ret)


def main():
    N, X, Y = MI()
    graph = [[] for i in range(N+1)]

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

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

    d = defaultdict(int)
    for i in range(1, N+1):
        ret = bfs(graph, i)
        for j in range(1, len(ret)):
            if i != j:
                d[ret[j]] += 1
        

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

    
    
    
    
    
    

    
    
    
    
    


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter, deque

def main():
    N, X, Y = map(int, input().split())
    X -= 1
    Y -= 1
    edge = [[i-1, i+1] for i in range(N)]
    edge[0] = [1]
    edge[N-1] = [N-2]
    edge[X].append(Y)
    edge[Y].append(X)

    def bfs(i):
        q = deque()
        q.append(i)
        while len(q):
            now = q.popleft()
            for j in edge[now]:
                if j == i:
                    continue

                if not cost[j]:
                    cost[j] = cost[now] + 1
                    q.append(j)
        
    ct = Counter()
    for i in range(N):
        cost = [0] * N
        bfs(i)
        ct += Counter(cost)

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
from collections import defaultdict
import math
import numpy as np
N, X, Y = map(int, input().split(' '))
d = defaultdict(int)
for i in range(1, N):
    for k in range(i+1, N+1):
        if(k < X):
            ans = k-i
            d[ans] += 1
        else:
            ans = min(k-i, abs(Y-k)+1+abs(i-X))
            d[ans] += 1

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

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

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