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

if __name__ == "__main__":
    n, x, y = map(int, input().split())
    x -= 1
    y -= 1

    ans = [0] * (n+1)
    for start in range(n):
        for end in range(start + 1, n):
            if (start < x and end < x) or (start > y and end > y):
                ans[end - start] += 1
            
            elif start < x and end >= x and end <= y:
                tmp = x - start
                tmp += min(end - x, y - end + 1)
                ans[tmp] += 1
            
            elif start >= x and start <= y and end > y:
                tmp = end - y
                tmp += min(start - x + 1, y - start)
                ans[tmp] += 1
            
            elif start < x and end > y:
                tmp = x - start + end - y + 1
                ans[tmp] += 1
            
            else:
                ans[min(end - start, start - x + y - end + 1)] += 1
    
    for i in range(1, n):
        print(ans[i])

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

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

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

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

Solution (Python):
import collections

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

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

c = collections.Counter(L)

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

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):
        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])

Solution (Python):

import numpy as np
N, X, Y = list(map(int, input().split()))

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

Solution (Python):
from collections import deque

n, x, y = map(int, input().split())
dist = [[i - 1, i + 1] for i in range(n)]
dist[0].pop(0)
dist[-1].pop()
dist[x - 1].append(y - 1)
dist[y - 1].append(x - 1)
list = [0] * n

def line(num):
    pos = deque([[num, 0]])
    dp = [-1] * n

    while len(pos) > 0:
        now, depth = pos.popleft()
        dp[num] = 0
        for i in dist[now]:
            if dp[i] > 0:
                continue
            dp[i] = depth + 1
            pos.append([i, depth + 1])
    for i in dp:
        list[i] += 1
for i in range(n):
    line(i)
for i in range(1, n):
    print(int(list[i] / 2))

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):
        a = min(abs(i-j),abs(X-i)+1+abs(j-Y),abs(Y-i)+1+abs(j-X))
        l[a] += 1

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

Solution (Python):
a, b, c = map(int, input().split())

b = b - 1
c = c - 1
A = []

for i in range(a):
    for j in range(i+1, a):
        A.append(min(abs(i - b) + 1 + abs(j - c), abs(j - i)))
import collections
C = collections.Counter(A)

for i in range(1, a):
    print(C[i])

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

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

dists = [0] * (n-1)

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

        dists[d-1] += 1

print(*dists, sep='\n')

Solution (Python):



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


graph = [[float('INF')]*(N+1) for i in range(N+1)]
for i in range(1, N):
    graph[i][i+1] = 1
graph[X][Y] = 1
kyori = [0]*N


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


for i in range(1, N+1):
    for j in range(i+1, N+1):
        if not graph[i][j]==float('INF'):
            kyori[graph[i][j]] += 1


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

Solution (Python):
N,x,y = map(int, input().split())
long_list=[0 for _ in range(N-1)]

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

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

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

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

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

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

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

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

Solution (Python):
from collections import deque

def solve(N, X, Y):
    ret = [0] * N
    already_used = [[False for _ in range(N + 1)] for _ in range(N + 1)]
    for i in range(1, N + 1):
        already_used[i][i] = True
        reached = [False for _ in range(N + 1)]
        reached[i] = True
        stack = deque([[i, 0]])

        while stack:
            node, step = stack.popleft()
            if 1 <= step and not already_used[i][node]:
               ret[step] += 1
            already_used[i][node], already_used[node][i] = True, True

            for x in [node + 1, node - 1]:
                if 0 < x < N + 1 and not reached[x]:
                    stack.append([x, step + 1])
                    reached[x] = True
            if node == X and not reached[Y]:
                stack.append([Y, step + 1])
                reached[x] = True
            if node == Y and not reached[X]:
                stack.append([X, step + 1])
                reached[x] = True
    return ret

if __name__ == '__main__':
    N, X, Y = map(int, input().split())
    for r in solve(N, X, Y)[1:]:
        print(r)

Solution (Python):
from collections import deque, Counter

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

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

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

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

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

for i in range(n):
    d = deque([(i, 0)])
    dist[i][i] = 0

    while len(d) > 0:
        node, length = d.pop()

        for ne in neighbor[node]:
            if dist[i][ne] < 0:
                dist[i][ne] = length + 1
                d.appendleft((ne, length+1))

c = []
for i in range(n):
    c.append(Counter(dist[i]))

for i in range(1, n):
    total = 0
    for j in range(n):
        total += c[j][i]
    print(total // 2)

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

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

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

dp = [0]*N

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

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

dp = [0]*N

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

Solution (Python):
from collections import deque


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


A = [0 for i in range(n)]   
for i in range(n):  
    Q = deque([i])  
    
    R = [-1 for i in range(n)]  
    R[i] = 0
    
    while len(Q) != 0:
        t = Q[0]    
        d = R[t]    
        Q.popleft()
        
        def push_and_record(t:int, d:int):
            if R[t] < 0:
                R[t] = d
                Q.append(t)
            else:
                pass
        
        if t < n-1:
            push_and_record(t+1, d+1)
        else:
            pass
        
        if t > 0:
            push_and_record(t-1, d+1)
        else: 
            pass
        
        if t == x-1:
            push_and_record(y-1, d+1)
        elif t == y-1:
            push_and_record(x-1, d+1)
        else:
            pass
    
    for i in range(n):
        A[R[i]] += 1


for i in range(1, n):
    print(A[i] // 2)

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

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

Solution (Python):
tmp = list(map(int, input().split()))
n, x, y = tmp
cnt = [0 for k in range(n-1)]

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

for c in cnt:
    print(c)

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

from collections import defaultdict
dd = defaultdict(lambda:0)

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

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

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

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

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

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

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

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


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

Solution (Python):
from collections import Counter
n,x,y=map(int,input().split())
l=[]
for i in range(n-1):
  for k in range (i+1,n):
      l.append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
S=Counter(l)
for i in range(1,n):
  print(S[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):
        distance_ij = min(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        ans[distance_ij-1] += 1

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

Solution (Python):

import sys
import collections

def solve(N: int, X: int, Y: int):
    X = X - 1
    Y = Y - 1

    counter = collections.defaultdict(int)
    for i in range(N):
        for j in range(i+1, N):
            k = min(j - i, abs(Y-j) + abs(X-i) + 1)
            counter[k] += 1
    for i in range(1, N):
        print(counter[i])
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    X = int(next(tokens))  
    Y = int(next(tokens))  
    solve(N, X, Y)

if __name__ == '__main__':
    main()

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

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

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

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


x -= 1
y -= 1


lengh_list = [0]*n

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

for length in lengh_list[1:]:
    print(length)

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

Solution (Python):
from itertools import combinations

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

num = []
for i in range(1,n+1):
    num.append(i)

ans = [0] * (n+1)

for i,j in combinations(num,2):
    ans[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))] += 1

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

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

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


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

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

Solution (Python):
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:])))

Solution (Python):
import sys
input = sys.stdin.readline
from collections import deque
from collections import Counter
def main():
    N, X, Y = map(int, input().split())
    graph = {}
    for i in range(N):
        graph[i] = set()
    for i in range(N-1):
        graph[i].add(i+1)
        graph[i+1].add(i)
    graph[X-1].add(Y-1)
    graph[Y-1].add(X-1)

    ans = []
    for i in range(N):
        dist = [-1] * N
        dist[i] = 0
        que = deque([])
        que.append(i)
        while len(que) != 0:
            v = que.popleft()
            for nv in graph[v]:
                if dist[nv] != -1:continue
                dist[nv] = dist[v] + 1
                que.append(nv)
        ans += dist
    ans = Counter(ans)
    for i in range(1, N):
        print(ans[i]//2)
if __name__ == "__main__":
    main()

Solution (Python):
n,x,y=map(int,input().split())
wk={}
for i in range(1,n+1):
  for j in range(i+1,n+1):
    k=min(j-i,abs(x-i)+1+abs(y-j))
    if k in wk:
      wk[k]+=1
    else:
      wk[k]=1
for i in range(n-1):
  print(wk[i+1] if i+1 in wk else 0)

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):
    l=min(j-i,abs(X-i)+1+abs(j-Y))
    L[l]+=1

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

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

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

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

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

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

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

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

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

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

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

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

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):
    if i <= X and X < j < Y and (j - i) > (X - i + 1 + (Y - j)):
      t = (X - i + 1 + (Y - j))
      
    elif X < i < Y and X < j < Y and (j - i) > (i - X + 1 + Y - j):
      t = (i - X + 1 + Y - j)
      
    elif j >= Y and X <= i < Y and j - i > (i - X + 1 + (j - Y)):
      t = (i - X + 1 + (j - Y))
      
    elif i <= X and Y <= j:
      t = j - i - (Y - X - 1)
      
    else:
      t = j - i
      
    A[t] += 1
A.pop(0)
[print(i) for i in A]

Solution (Python):


import sys
import math

sys.setrecursionlimit(10 ** 6)

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

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

for d in ans:
    print(d)

Solution (Python):
















def main():
    N,X,Y = (int(i) for i in input().split())


    NUM = [0] * (N-1)

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


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


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, x, y = (int(i) for i in input().split())
    num_list = [0] * (n - 1)

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

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


if __name__ == '__main__':
    main()

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

l = [0 for _ in range(N)]
line = []

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

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

Solution (Python):
def main():
  n,x,y = (int(i) for i in input().split())
  num_list = [0] * (n - 1)

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

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

if __name__ == '__main__':
  main()

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

for k in range(Y):
    for r in range(k+1, N):
        old = r - k
        new = abs(X - k) + 1 + abs(Y - r)
        if new < old:
            dist[k][old] -= 1
            dist[k][new] += 1

for i in range(1, N):
    cnt = 0
    for d in dist:
        if i < len(d):
            cnt += d[i]
    print(cnt)

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

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

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

Solution (Python):
import numpy as np
n, x, y = map(int, input().split())

dist_cnt = [0] * (n-1)

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

for cnt in dist_cnt:
    print(cnt)

Solution (Python):
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])

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

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

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


def bfs(init_v):
    queue = deque([init_v])
    INF = 10**10
    dist = [INF]*n
    dist[init_v] = 0
    while queue:
        v = queue.popleft()
        for v2 in edges[v]:
            if dist[v2] <= dist[v]+1:
                continue
            dist[v2] = dist[v]+1
            dd[dist[v2]] += 1
            queue.append(v2)


dd = defaultdict(int)
for i in range(n):
    bfs(i)

for i in range(1, n):
    print(dd[i]//2)

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


def bfs(init_v):
    queue = deque([init_v])
    INF = 10**10
    dist = [INF]*n
    dist[init_v] = 0
    while queue:
        v = queue.popleft()
        for v2 in edges[v]:
            if dist[v2] <= dist[v]+1:
                continue
            dist[v2] = dist[v]+1
            queue.append(v2)
    return dist


dd = defaultdict(int)
for i in range(n):
    sp = bfs(i)
    for x in sp:
        dd[x] += 1

for i in range(1, n):
    print(dd[i]//2)

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

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

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

for a in ans:
    print(a)

Solution (Python):
from collections import defaultdict

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

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

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

Solution (Python):
from collections import defaultdict

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

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

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

Solution (Python):
from collections import defaultdict

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

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

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

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

result = [0] * (n-1)

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

for ans in result:
	print(ans)

Solution (Python):

DATA = """
10 4 8
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N, X, Y = [int(i) for i in get_line().strip().split(" ")]
X-=1
Y-=1
INF = 10 * 20
m = [[0] * N for _ in range(N)]
tt = [0] * N




for r in range(N):
	for c in range(r+1, N):
		m[r][c] = c - r
		
		tt[m[r][c]] += 1
		m[c][r] = m[r][c]

def Set(r, c, v):
	if m[r][c] < v:
		return False
	else:
		tt[m[r][c]] -= 1
		m[r][c] = v
		tt[m[r][c]] += 1
		return True

for r in range(N):
	if not Set(r, Y, m[r][X]+1):
		continue
	for c in range(Y+1, N):
		if not Set(r, c, m[r][c-1]+1):
			break
	for c in range(Y-1, X, -1):
		if not Set(r,c, m[r][c+1]+1):
			break

for t in tt[1:]:
	print (t)

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

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

for d in dst:
    print(d)

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

Solution (Python):
from collections import deque 
from collections import defaultdict
n, x, y = map(int, input().split())
graph = [[] for _ in range(n)]     
for i in range(n-1):
  graph[i] += [i+1]
  graph[i+1] += [i]
graph[x-1] += [y-1]
graph[y-1] += [x-1]
moves = ((1, 0), (0, 1), (0, -1), (-1, 0)) 

def bfs(s):
  dist = [float('inf')]*n
  dist[s] = 0
  q = deque([s])

  while q:
    u = q.popleft() 
    for v in graph[u]:
      if dist[v] == float('inf'):
        q += [v]
        dist[v] = dist[u] + 1

  return dist

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

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

Solution (Python):
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = {i:0 for i in range(1, 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))
        ans[d] += 1
        
for _, v in ans.items():
    print(v)

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

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

Solution (Python):


import sys
import math
import bisect
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint

INF = float('inf')

ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
lmtx = lambda h: [list(map(int, lmis())) for _ in range(h)]
sys.setrecursionlimit(1000000000)


def lcm(a, b):
    return (a * b) // gcd(a, b)



n, x, y = mis()

ans = [0] * n

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

for i, a in zip(range(len(ans)), ans):
    if i == 0:
        continue
    print(a)

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

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

miner = [0] * (N - 1)

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

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

Solution (Python):
from collections import deque
class Graph:
    edges = {}

    def append_edge(self, sv, ev, weight = 1):
        if sv in self.edges:
            self.edges[sv].append((ev, weight))
        else:
            self.edges[sv] = [(ev, weight)]

    def bfs(self, sv):
        dist = [-1]*len(self.edges.keys())
        q = deque([])   
        q.append(sv)
        dist[sv] = 0
        connect_vtxs = []
        while len(q) > 0:
            p = q.popleft()     
            connect_vtxs.append(p)
            for (ev, w) in self.edges[p]:
                if dist[ev] != -1:
                    continue
                q.append(ev)    
                dist[ev] = dist[p] + 1
        return dist, connect_vtxs


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

g = Graph()
for i in range(N - 1):
    g.append_edge(i, i + 1)
    g.append_edge(i + 1, i)
g.append_edge(X - 1, Y - 1)
g.append_edge(Y - 1, X - 1)

dist_cnt = [0]*N
for sv in range(N):
    dist, connect_vtxs = g.bfs(sv)
    for j in range(len(dist)):
        if dist[j] == -1: continue
        dist_cnt[dist[j]] += 1

for i in range(N-1):
    print(int(dist_cnt[i+1]/2))

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