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 in Python (2.7.6) (judge verdict: Runtime Error)

#! /usr/bin/env python3

from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

N, X, Y = [int(_) for _ in input().split()]

al = []

def dfs(f, n, pos, dis):

    global al
    if n in pos:
        return
    pos2 = pos + [n]
    if f != n:
        al += [[[f, n], dis]]
    
    for i in [-1, 1]:
        if 1 <= n + i <= N and not n+i in pos:
            dfs(f, n+i, pos2, dis+1)

    if n == X:
        dfs(f, Y, pos2, dis+1)
    if n == Y:
        dfs(f, X, pos2, dis+1)


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

new = []
for i in range(len(al)):
    if al[i][0][0] > al[i][0][1]:
        al[i][0][0], al[i][0][1] = al[i][0][1], al[i][0][0]


a = [[0, 0], 0]
dis = 0
ne = []

for ct, i in enumerate(sorted(al)):
    if a[0] != i[0]:
        ne += [[a[0], dis]]
        a = i
        dis = a[1]
    else:
        dis = min(dis, i[1])

    if ct == len(sorted(al)) - 1: 
        ne += [[i[0], dis]]

ne = ne[1:]
s = [0] * (N-1)
for i in ne:
    s[i[1]-1] += 1
for i in s:
    print(i)