AtCoder Beginner Contest 160 - Line++

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-----
5 2 4

-----Sample Output-----
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.

Difficulty: MEDIUM_HARD

Starter code:

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


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


(n, x, y) = map(int, input().split())
ret = [0] * (n - 1)
for s in range(1, n):
	for e in range(s + 1, n + 1):
		d = min(e - s, abs(s - x) + abs(e - y) + 1)
		ret[d - 1] += 1
for r in ret:
	print(r)


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

def __starting_point():
	main()
__starting_point()


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


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


(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)


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


(N, X, Y) = map(int, input().split())
res = [0] * (N - 1)
for l in range(1, N):
	for r in range(l + 1, N + 1):
		i = min(r - l, abs(l - X) + abs(r - Y) + 1)
		res[i - 1] += 1
for r in res:
	print(r)


(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)


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


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


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


(N, X, Y) = map(int, input().split())
a = [0 for _ in range(N - 1)]
for lt in range(1, N + 1):
	for rt in range(lt + 1, N + 1):
		a[min(rt - lt - 1, abs(X - lt) + abs(Y - rt))] += 1
print(*a, sep='\n')


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


def main():
	(N, X, Y) = map(int, input().split())
	G = [[i] for i in range(1, N + 1)]
	ans = [0] * (N - 1)
	for i in range(1, N + 1):
		for j in range(i + 1, N + 1):
			d = min(j - i, abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X))
			ans[d - 1] += 1
	for a in ans:
		print(a)

def __starting_point():
	main()
__starting_point()


from collections import deque
(n, x, y) = map(int, 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)

def bfs(g, n_node, start_node):
	dist = [-1] * n_node
	dist[start_node] = 0
	queue = deque([start_node])
	while queue:
		node = queue.popleft()
		for n in g[node]:
			if dist[n] != -1:
				continue
			dist[n] = dist[node] + 1
			queue.append(n)
	return dist
ans_array = [0] * n
for i in range(n):
	dist = bfs(g, n, i)
	for d in dist:
		ans_array[d] += 1
for i in ans_array[1:]:
	print(i // 2)


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


(N, X, Y) = map(int, input().split())
A = [0] * (N - 1)
t = 0
for i in range(N):
	for j in range(N - 1 - i):
		t = min(j + 1, abs(X - i - 1) + abs(Y - j - i - 2) + 1)
		A[t - 1] += 1
for e in A:
	print(e)


import sys
readline = sys.stdin.readline
(N, X, Y) = map(int, readline().split())
X -= 1
Y -= 1
ans = [0] * N
for i in range(N - 1):
	for j in range(i + 1, N):
		val = min(abs(i - j), abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
		ans[val] += 1
for i in range(1, len(ans)):
	print(ans[i])


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict

def main():
	(n, x, y) = list(map(int, input().split()))
	edges = {e: [] for e in range(n)}
	for i1 in range(1, n - 1):
		edges[i1].append(i1 - 1)
		edges[i1].append(i1 + 1)
	edges[0].append(1)
	edges[n - 1].append(n - 2)
	edges[x - 1].append(y - 1)
	edges[y - 1].append(x - 1)
	dis = defaultdict(int)
	for j1 in range(n):
		seen = set()
		cnt = 0
		dis_each = [n] * n
		nexts = [j1]
		nextnext = []
		while len(seen) < n:
			for next in nexts:
				if next not in seen:
					seen.add(next)
					dis_each[next] = cnt
					nextnext += edges[next]
			nexts = nextnext
			nextnext = []
			cnt += 1
		for d in dis_each:
			dis[d] += 1
	for k1 in range(1, n):
		print(dis[k1] // 2)

def __starting_point():
	main()
__starting_point()


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


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

def f(i, j):
	v1 = j - i
	v2 = abs(X - i) + 1 + abs(j - Y)
	v3 = abs(Y - i) + 1 + abs(j - X)
	return min(v1, v2, v3)
D = [0] * N
for i in range(1, N):
	for j in range(i + 1, N + 1):
		d = f(i, j)
		D[d] += 1
for d in D[1:]:
	print(d)


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


from collections import defaultdict
(N, X, Y) = map(int, input().split())
cnt_dict = defaultdict(int)
for i in range(1, N):
	for j in range(i + 1, N + 1):
		if j <= X or i >= Y:
			path = j - i
		else:
			path = min(j - i, abs(X - i) + abs(j - Y) + 1)
		cnt_dict[path] += 1
for i in range(1, N):
	print(cnt_dict[i])


import sys
from io import StringIO
import unittest

def yn(b):
	print('Yes' if b == 1 else 'No')
	return

def resolve():
	readline = sys.stdin.readline
	(n, x, y) = list(map(int, readline().rstrip().split()))
	ans = [0] * (n - 1)
	for i in range(1, n + 1):
		for j in range(i + 1, n + 1):
			d1 = abs(i - x) + abs(j - y) + 1
			d2 = abs(i - y) + abs(j - x) + 1
			d3 = abs(i - j)
			d = min(d1, d2, d3)
			ans[d - 1] += 1
	for a in ans:
		print(a)
	return
if 'doTest' not in globals():
	resolve()
	return


from itertools import *
from numpy import *
from scipy.sparse.csgraph import *
(N, X, Y) = map(int, input().split())
A = (N - 1) * [0]
G = zeros((N, N))
G[X - 1][Y - 1] = 1
G[Y - 1][X - 1] = 1
for n in range(N - 1):
	G[n][n + 1] = 1
	G[n + 1][n] = 1
S = shortest_path(G)
for (i, j) in combinations(range(N), 2):
	A[int(S[i][j]) - 1] += 1
print(*A, sep='\n')


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


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


from collections import defaultdict
(n, x, y) = map(int, input().split())
d = defaultdict(int)
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)] += 1
for i in range(1, n):
	print(d[i])


def search(start, N, X, Y):
	dist = [0 for _ in range(N)]
	if start <= X:
		for i in range(X):
			dist[i] = abs(start - i)
		for i in range(Y, N):
			dist[i] = X - start + 1 + (i - Y)
		for i in range(X, (Y - X) // 2 + X + 1):
			dist[i] = i - start
		for i in range((Y - X) // 2 + X + 1, Y):
			dist[i] = X - start + 1 + (Y - i)
	elif start >= Y:
		for i in range(Y, N):
			dist[i] = abs(start - i)
		for i in range(X):
			dist[i] = start - Y + 1 + (X - i)
		for i in range(X, (Y - X) // 2 + X):
			dist[i] = start - Y + 1 + (i - X)
		for i in range((Y - X) // 2 + X, Y):
			dist[i] = start - i
	else:
		toX = min(start - X, Y - start + 1)
		toY = min(Y - start, start - X + 1)
		dist[start] = 0
		for i in range(X):
			dist[i] = X - i + toX
		for i in range(Y, N):
			dist[i] = toY + (i - Y)
		for i in range(X, start):
			dist[i] = min(start - i, Y - start + 1 + i - X)
		for i in range(start + 1, Y):
			dist[i] = min(i - start, start - X + 1 + Y - i)
	return dist

def main():
	(N, X, Y) = [int(n) for n in input().split(' ')]
	X = X - 1
	Y = Y - 1
	lenD = []
	for i in range(N):
		d = search(i, N, X, Y)
		lenD.append(d)
	kcounter = [0 for _ in range(N - 1)]
	for i in range(N):
		for j in range(i + 1, N):
			k = lenD[i][j]
			kcounter[k - 1] += 1
	for k in kcounter:
		print(k)
main()


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


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


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


(N, X, Y) = list(map(int, input().split()))
dict_lis = {i: 0 for i in range(1, N)}
for i in range(1, N):
	for j in range(i + 1, N + 1):
		length_ij = min(j - i, abs(j - Y) + abs(i - X) + 1)
		dict_lis[length_ij] += 1
for i in range(1, N):
	print(dict_lis[i])


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


(N, X, Y) = map(int, input().split())
dp = [[0] * N for i in range(N)]
dist = [0] * N
X -= 1
Y -= 1
for i in range(N):
	for j in range(N):
		if not i < j:
			continue
		dp[i][j] = min(j - i, abs(j - Y) + 1 + abs(X - i))
		dist[dp[i][j]] += 1
for i in dist[1:]:
	print(i)


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


(N, X, Y) = map(int, input().split())
res = [0] * (N - 1)
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		d1 = abs(j - i)
		d2 = abs(X - i) + abs(Y - j) + 1
		d3 = abs(Y - i) + abs(X - j) + 1
		min_d = min(d1, d2, d3)
		res[min_d - 1] += 1
print(*res, sep='\n')


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


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


(N, X, Y) = map(int, input().split())
b = [0] * N
for i in range(N):
	for j in range(i + 1, N):
		p = max(X - 1 - i, 1 + i - X)
		q = max(Y - 1 - j, 1 + j - Y)
		b[min(j - i, p + 1 + q)] += 1
for i in range(1, N):
	print(b[i])


(n, x, y) = list(map(int, input().split()))
x -= 1
y -= 1
half = (x + y) // 2
ans = [0] * n
for i in range(n):
	for j in range(i, n):
		if i <= x:
			if j <= half:
				ans[j - i] += 1
			else:
				ans[x - i + 1 + abs(y - j)] += 1
		elif x < i and i <= y:
			ans[min(j - i, i - x + 1 + abs(y - j))] += 1
		else:
			ans[j - i] += 1
for i in range(1, n):
	print(ans[i])


import sys
from collections import deque
r = sys.stdin.readline
(N, X, Y) = map(int, r().split())
res = [0] * N
G = [[] for _ in range(N + 1)]
for i in range(1, N):
	G[i].append(i + 1)
	G[i + 1].append(i)
G[X].append(Y)
G[Y].append(X)

def bfs(start):
	q = deque([(start, 0)])
	visited = [False] * (N + 1)
	visited[start] = True
	cnt = 0
	while q:
		(cur, d) = q.popleft()
		if d != 0:
			res[d] += 1
		for v in G[cur]:
			if not visited[v]:
				visited[v] = True
				q.append((v, d + 1))
	return cnt
for i in range(1, N + 1):
	bfs(i)
for j in range(1, N):
	print(res[j] // 2)


(N, X, Y) = map(int, input().split())
d = [0 for i in range(N)]
for a in range(1, N):
	for b in range(a + 1, N + 1):
		dest = min(b - a, abs(b - Y) + abs(a - X) + 1)
		d[dest] += 1
for n in d[1:]:
	print(n)


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


(n, x, y) = list(map(int, input().split()))
dic = {}
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))
		if l in dic:
			dic[l] += 1
		else:
			dic[l] = 1
for l in range(1, n):
	if l in dic:
		print(dic[l])
	else:
		print(0)


(N, X, Y) = map(int, input().split())
distance = [[] for i in range(N - 1)]
for i in range(1, N):
	for j in range(i + 1, N + 1):
		distance[i - 1].append(min(abs(j - i), abs(X - i) + 1 + abs(j - Y), abs(Y - i) + 1 + abs(j - X)))
count = [0 for i in range(N)]
for i in range(N - 1):
	for dis in distance[i]:
		count[dis] += 1
for i in range(1, len(count)):
	print(count[i])


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


(N, X, Y) = map(int, input().split())
X -= 1
Y -= 1
ans = [0 for _ in range(N - 1)]
for i in range(N):
	for j in range(i + 1, N):
		direct = j - i
		shortcut = abs(X - i) + 1 + abs(Y - j)
		shortest = min(direct, shortcut)
		ans[shortest - 1] += 1
print(*ans, sep='\n')


(n, x, y) = list(map(int, input().split()))
dists = [0] * (n - 1)
for start in range(n):
	for end in range(start + 1, n):
		dist = min(end - start, abs(x - 1 - start) + 1 + abs(end - (y - 1)))
		dists[dist - 1] += 1
for dist in dists:
	print(dist)


import collections
(N, X, Y) = [int(x) for x in input().split()]
c = collections.Counter()
for i in range(1, N + 1):
	for j in range(i, N + 1):
		if i == X and j == Y or (i == Y and j == X):
			c[1] += 1
		else:
			c[min([j - i, abs(X - i) + 1 + abs(Y - j), abs(X - j) + 1 + abs(Y - i)])] += 1
for i in range(1, N):
	print(c[i])


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


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


from collections import deque
from collections import Counter
(n, x, y) = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for i in range(1, n):
	(a, b) = (i, i + 1)
	graph[a].append(b)
	graph[b].append(a)
graph[x].append(y)
graph[y].append(x)
l = []
for j in range(1, n + 1):
	dist = [-1] * (n + 1)
	dist[0] = 0
	dist[j] = 0
	d = deque()
	d.append(j)
	while d:
		v = d.popleft()
		for i in graph[v]:
			if dist[i] != -1:
				continue
			dist[i] = dist[v] + 1
			d.append(i)
	l.extend(dist[1:])
c = Counter(l)
for i in range(1, n):
	print(int(c[i] / 2))


(n, x, y) = list(map(int, input().split()))
ans = [0] * n
for i in range(1, n + 1):
	for j in range(i + 1, n + 1):
		if i <= x and j >= y:
			a = abs(j - i) - abs(y - x) + 1
			b = abs(i - x) + abs(j - y) + 1
			ans[min(a, b)] += 1
		else:
			c = abs(x - i) + abs(y - j) + 1
			d = abs(j - i)
			ans[min(c, d)] += 1
for i in range(1, n):
	print(ans[i])


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


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import defaultdict

def main():
	(n, x, y) = map(int, input().split())
	x -= 1
	y -= 1
	dis = defaultdict(int)
	for i1 in range(n):
		for i2 in range(i1 + 1, n):
			d = min(abs(i2 - i1), abs(x - i1) + abs(y - i2) + 1, abs(x - i2) + abs(y - i1) + 1)
			dis[d] += 1
	for k1 in range(1, n):
		print(dis[k1])

def __starting_point():
	main()
__starting_point()


(N, X, Y) = list(map(int, input().split()))
anss = [0] * N
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		d1 = j - i
		d2 = abs(i - X) + 1 + abs(Y - j)
		d = d1 if d1 <= d2 else d2
		anss[d] += 1
print('\n'.join(map(str, anss[1:])))


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, bisect
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
import sys
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
nf = lambda : float(ns())
na = lambda : list(map(int, stdin.readline().split()))
nb = lambda : list(map(float, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
(N, X, Y) = na()
g = [[0] * N for _ in range(N)]
for i in range(N - 1):
	g[i][i + 1] = 1
	g[i + 1][i] = 1
g[X - 1][Y - 1] = 1
g[Y - 1][X - 1] = 1
g = np.array(g)
d = shortest_path(g)
ct = [0] * N
for i in range(N):
	for j in range(i, N):
		ct[int(d[i][j])] += 1
for i in range(1, N):
	print(ct[i])


def main():
	import itertools
	(n, x, y) = list(map(int, input().split()))
	stat = [i for i in range(n)]
	ans = [0 for i in range(n - 1)]
	for s in itertools.combinations(stat, 2):
		d = min(s[1] - s[0], abs(x - 1 - s[0]) + 1 + abs(y - 1 - s[1]))
		ans[d - 1] += 1
	for i in range(len(ans)):
		print(ans[i])

def __starting_point():
	main()
__starting_point()


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

def __starting_point():
	main()
__starting_point()


(n, x, y) = list(map(int, input().split()))
ans_ls = [0] * (n - 1)
for start in range(1, n):
	for end in range(start + 1, n + 1):
		cost_1 = end - start
		cost_2 = abs(start - x) + abs(end - y) + 1
		cost = min(cost_1, cost_2)
		ans_ls[cost - 1] += 1
for ans in ans_ls:
	print(ans)


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

def min_dist(i, j):
	d1 = abs(i - j)
	d2 = abs(X - i) + abs(Y - j) + 1
	return min(d1, d2)
ans = [0] * N
for i in range(N):
	for j in range(i + 1, N):
		ans[min_dist(i, j)] += 1
[print(a) for a in ans[1:]]


import math
from math import gcd, pi, sqrt
INF = float('inf')
import sys
sys.setrecursionlimit(10 ** 6)
import itertools
from collections import Counter, deque

def i_input():
	return int(input())

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

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

def s_map():
	return input().split()

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def main():
	(n, x, y) = i_map()
	ans = [0] * n
	for fr in range(1, n + 1):
		for to in range(fr + 1, n + 1):
			cost = min(to - fr, abs(x - fr) + abs(to - y) + 1)
			ans[cost] += 1
	print(*ans[1:], sep='\n')

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline

def S():
	return input().rstrip()

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

def MI():
	return list(map(int, input().split()))
(N, X, Y) = MI()
cnt = [0] * N
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		idx = min(j - i, abs(X - i) + abs(Y - j) + 1)
		cnt[idx] += 1
for c in cnt[1:]:
	print(c)


(N, X, Y) = map(int, input().split())
p = Y - X + 1
arm_a = X - 1
arm_b = N - Y
if p % 2:
	for i in range(1, N):
		ans = 0
		if i * 2 < p:
			ans += p
		if 1 < i <= p // 2 + arm_a:
			ans += 2 * min(arm_a, p // 2, arm_a + p // 2 - i + 1, i - 1)
		if 1 < i <= p // 2 + arm_b:
			ans += 2 * min(arm_b, p // 2, arm_b + p // 2 - i + 1, i - 1)
		if i <= arm_a:
			ans += arm_a - i + 1
		if i <= arm_b:
			ans += arm_b - i + 1
		if 2 < i <= arm_a + arm_b + 1:
			ans += min(arm_a, arm_b, arm_a + arm_b - i + 2, i - 2)
		print(ans)
else:
	for i in range(1, N):
		ans = 0
		if i * 2 < p:
			ans += p
		elif i * 2 == p:
			ans += p // 2
		if 1 < i < p // 2 + arm_a:
			ans += 2 * min(arm_a, p // 2 - 1, arm_a + p // 2 - i, i - 1)
		if p // 2 < i <= p // 2 + arm_a:
			ans += 1
		if 1 < i < p // 2 + arm_b:
			ans += 2 * min(arm_b, p // 2 - 1, arm_b + p // 2 - i, i - 1)
		if p // 2 < i <= p // 2 + arm_b:
			ans += 1
		if i <= arm_a:
			ans += arm_a - i + 1
		if i <= arm_b:
			ans += arm_b - i + 1
		if 2 < i <= arm_a + arm_b + 1:
			ans += min(arm_a, arm_b, arm_a + arm_b - i + 2, i - 2)
		print(ans)


(n, x, y) = map(int, input().split())
a = [0 for _ in range(n - 1)]
for i in range(1, n):
	for j in range(i + 1, n + 1):
		l = min(j - i, abs(x - i) + 1 + abs(j - y))
		a[l - 1] += 1
print('\n'.join(map(str, a)))


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


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


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


import math
import itertools

def comb(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
(N, X, Y) = list(map(int, input().split()))
L = [i for i in range(1, N + 1)]
c_list = list(itertools.combinations(L, 2))
Answer = {}
for i in range(1, N):
	inti = str(i)
	Answer[inti] = 0

def des(a, b):
	if b <= X or a >= Y:
		return b - a
	else:
		return min(b - a, abs(Y - b) + abs(X - a) + 1)
for cl in c_list:
	a = cl[0]
	b = cl[1]
	inti = des(a, b)
	inti = str(inti)
	Answer[inti] += 1
for (n, m) in list(Answer.items()):
	print(m)


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


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


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


(N, X, Y) = [int(_) for _ in input().split()]
X -= 1
Y -= 1
V = [0 for _ in range(N)]
for i in range(N):
	for j in range(i + 1, N):
		v1 = j - i
		v2 = abs(i - X) + abs(j - Y) + 1
		V[min(v1, v2)] += 1
for v in V[1:]:
	print(v)


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


from collections import Counter

def main():
	(n, x, y) = map(int, input().split())
	(x, y) = (x - 1, y - 1)
	ans = []
	for i in range(n):
		dp = [n] * n
		dp[i] = 0
		calcstep(i, dp)
		dp[y] = min(dp[y], dp[x] + 1)
		dp[x] = min(dp[x], dp[y] + 1)
		calcstep(x, dp)
		calcstep(y, dp)
		ans += dp
	ans = Counter(ans)
	for i in range(1, n):
		print(ans[i] // 2)

def calcstep(i, dp):
	for j in range(i, len(dp) - 1):
		if dp[j + 1] > dp[j] + 1:
			dp[j + 1] = dp[j] + 1
		else:
			break
	for j in range(1, i + 1)[::-1]:
		if dp[j - 1] > dp[j] + 1:
			dp[j - 1] = dp[j] + 1
		else:
			break

def __starting_point():
	main()
__starting_point()


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

def __starting_point():
	main()
__starting_point()


(N, X, Y) = [int(x) for x in input().split()]
D = [0 for _ in range(N)]
for i in range(1, N):
	for j in range(i + 1, N + 1):
		D[min(j - i, abs(i - X) + 1 + abs(j - Y))] += 1
for i in range(1, N):
	print(D[i])


import scipy.sparse as sparse
from scipy.sparse.csgraph import shortest_path
import numpy as np
(n, x, y) = [int(i) for i in input().split()]
x -= 1
y -= 1
one = np.ones((2, n), dtype=int)
c = sparse.spdiags(one, np.array([-1, 1]), n, n, format='lil')
(c[x, y], c[y, x]) = (1, 1)
c = c.tocsr()
path = shortest_path(c, directed=False, unweighted=True)
(u, counts) = np.unique(path, return_counts=True)
counts = counts // 2
for i in range(1, int(u[-1]) + 1):
	print(counts[i])
for i in range(int(u[-1]) + 1, n):
	print(0)


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


from itertools import *
(n, x, y) = map(int, input().split())
a = [0] * n
for (i, j) in combinations(range(1, n + 1), 2):
	b = min(abs(i - j), abs(x - i) + 1 + abs(y - j), abs(x - j) + 1 + abs(y - i))
	a[b] += 1
print(*a[1:], sep='\n')


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


from collections import defaultdict
ans = defaultdict(int)
(N, X, Y) = map(int, input().split())
for i in range(1, N + 1):
	for j in range(1 + i, N + 1):
		l1 = j - i
		l2 = abs(X - i) + 1 + abs(Y - j)
		ans[min(l1, l2)] += 1
for i in range(1, N):
	print(ans[i])


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


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


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


def main():
	(N, X, Y) = [int(n) for n in input().split(' ')]
	vertex = [[1]] + [[i - 1, i + 1] for i in range(1, N - 1)] + [[N - 2]]
	vertex[X - 1].append(Y - 1)
	vertex[Y - 1].append(X - 1)
	count = [0] * N
	for i in range(N):
		to_visit = [i]
		checked = [0] * N
		steps = [0] * N
		checked[i] = 1
		while len(to_visit) > 0:
			visiting = to_visit.pop(0)
			vs = vertex[visiting]
			step = steps[visiting]
			for v in vs:
				if checked[v] == 0:
					checked[v] = 1
					to_visit.append(v)
					steps[v] = step + 1
					count[step + 1] += 1
	for c in count[1:]:
		print(int(c / 2))
main()


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


def main():
	from collections import deque
	(N, X, Y) = list(map(int, input().split()))
	G = [[1]] + [[x - 1, x + 1] for x in range(1, N - 1)] + [[N - 2]]
	G[X - 1].append(Y - 1)
	G[Y - 1].append(X - 1)
	dist = [[-1] * N for _ in [0] * N]
	for s in range(N):
		q = deque([s])
		dist[s][s] = 0
		while q:
			v = q.popleft()
			for nv in G[v]:
				if dist[s][nv] == -1:
					dist[s][nv] = dist[s][v] + 1
					q.append(nv)
	res = [0] * N
	for i in range(N):
		for j in range(i + 1, N):
			res[dist[i][j]] += 1
	for d in range(1, N):
		print(res[d])

def __starting_point():
	main()
__starting_point()


(n, x, y) = map(int, input().split())
g = [[] for _ in range(n)]
g[0].append(1)
g[n - 1].append(n - 2)
g[x - 1].append(y - 1)
g[y - 1].append(x - 1)
for i in range(n - 2):
	g[i + 1].append(i)
	g[i + 1].append(i + 2)
from collections import deque

def bfs(u):
	queue = deque([u])
	d = [None] * n
	d[u] = 0
	while queue:
		v = queue.popleft()
		for i in g[v]:
			if d[i] is None:
				d[i] = d[v] + 1
				queue.append(i)
	return d
ans_dist = [0 for i in range(n)]
for i in range(n):
	D = bfs(i)
	for d in D:
		ans_dist[d] += 1
for i in range(n - 1):
	print(ans_dist[i + 1] // 2)


(N, X, Y) = list(map(int, input().split()))
dis_list = [0] * (N - 1)
dis_X = [0] * N
for i in range(N):
	dis_X[i] = min(abs(X - (i + 1)), abs(Y - (i + 1)) + 1)
for start in range(N):
	for goal in range(start + 1, N):
		dis = min(abs(X - (start + 1)) + abs(Y - (goal + 1)) + 1, goal - start)
		dis_list[dis - 1] += 1
for ans in dis_list:
	print(ans)


(n, x, y) = list(map(int, input().split()))
dis_list = [0] * n
for start in range(1, n + 1):
	for end in range(start + 1, n + 1):
		dis1 = end - start
		dis3 = abs(x - start) + abs(y - end) + 1
		a = min(dis1, dis3)
		dis_list[a] += 1
for i in range(1, n):
	print(dis_list[i])


from collections import defaultdict
from collections import deque
from collections import Counter
import math

def readInt():
	return int(input())

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

def readChar():
	return input()

def readChars():
	return input().split()
(n, x, y) = readInts()
d = defaultdict(int)
for i in range(1, n + 1):
	for j in range(i + 1, n + 1):
		d[min(abs(i - j), abs(i - x) + 1 + abs(y - j), abs(i - y) + 1 + abs(j - x))] += 1
for i in range(1, n):
	print(d[i])


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


(N, X, Y) = map(int, input().split())
ansvec = [0] * N
for a in range(N - 1):
	for b in range(a + 1, N):
		ansvec[min(b - a, abs(a - X + 1) + abs(b - Y + 1) + 1)] += 1
for k in range(N - 1):
	print(ansvec[k + 1])


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


from collections import deque
(N, X, Y) = map(int, input().split())
ans_list = [0 for _ in range(N - 1)]
for i in range(1, N + 1):
	for j in range(i + 1, N + 1):
		ans1 = j - i
		ans2 = abs(i - X) + 1 + abs(j - Y)
		ans_list[min(ans1, ans2) - 1] += 1
print(*ans_list, sep='\n')


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


(N, X, Y) = list(map(int, input().split()))
d = [0] * N
for i in range(1, N):
	for j in range(i + 1, N + 1):
		if j <= X:
			a = j - i
		elif i <= X and j >= Y:
			a = X - i + (j - Y) + 1
		else:
			a = min(j - i, abs(X - i) + 1 + abs(Y - j))
		d[a] += 1
for ans in d[1:]:
	print(ans)


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
(n, x, y) = nii()
x -= 1
y -= 1
ans = [0 for i in range(n)]
for i in range(n - 1):
	for j in range(i + 1, n):
		dist1 = j - i
		dist2 = abs(i - x) + 1 + abs(j - y)
		dist = min(dist1, dist2)
		ans[dist] += 1
for i in ans[1:]:
	print(i)


(N, X, Y) = map(int, input().split())
X -= 1
Y -= 1
ans = [0] * (N - 1)
for l in range(N):
	for r in range(l + 1, N):
		a = min(r - l, abs(X - l) + abs(Y - r) + 1)
		ans[a - 1] += 1
for a in ans:
	print(a)