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):
def main():
    dist = []
    import numpy as np
    from collections import deque
    n, x, y = map(int,input().split())
    g = [[] for _ in range(n)] 
    for i in range(n-1):

        g[i] += i+1,
        g[i+1] += i,
    g[x-1] += y-1,
    g[y-1] += x-1,
    a = [0]*n
    for start in range(n):
        d = [-1] * n
        d[start] = 0
        q = deque([start])
        add,pop=q.append,q.popleft
        while q:
            v = pop()
            for nv in g[v]:
                if d[nv] < 0:
                    d[nv] = d[v]+1
                    add(nv)
        for i in d:
            a[i] += 1
    
    
    
    
    for i in range(1,n):
        print(int(a[i]/2))
    
main()

Solution (Python):
def main():
    dist = []
    import numpy as np
    from collections import deque
    n, x, y = map(int,input().split())
    g = [[] for _ in range(n)] 
    for i in range(n-1):

        g[i] += i+1,
        g[i+1] += i,
    g[x-1] += y-1,
    g[y-1] += x-1,
    a = [0]*n
    for start in range(n):
        d = [-1] * n
        d[start] = 0
        q = deque([start])
        while q:
            v = q.popleft()
            for nv in g[v]:
                if d[nv] < 0:
                    d[nv] = d[v]+1
                    q.append(nv)
        for i in d:
            a[i] += 1
    
    
    
    
    
    
    print(' '.join(str(i//2) for i in a[1:]))
main()

Solution (Python):
def main():
    dist = []
    import numpy as np
    from collections import deque
    n, x, y = map(int,input().split())
    g = [[] for _ in range(n)] 
    for i in range(n-1):

        g[i] += i+1,
        g[i+1] += i,
    g[x-1] += y-1,
    g[y-1] += x-1,
    a = [0]*n
    for start in range(n):
        d = [-1] * n
        d[start] = 0
        q = deque([start])
        while q:
            v = q.popleft()
            for nv in g[v]:
                if d[nv] < 0:
                    d[nv] = d[v]+1
                    q.append(nv)
        for i in d:
            a[i] += 1
    
    
    
    
    for i in range(1,n):
        print(int(a[i]/2))
    
main()

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

        g[i] += i+1,
        g[i+1] += i,
    g[x-1] += y-1,
    g[y-1] += x-1,
    a = [0]*n
    for start in range(n):
        d = [-1] * n
        d[start] = 0
        q = deque([start])
        add,pop = q.append,q.popleft
        while q:
            v = pop()
            for nv in g[v]:
                if d[nv] < 0:
                    d[nv] = d[v]+1
                    add(nv)
        for i in d:
            a[i] += 1
        
    
    
    
    
    print(' '.join(str(i//2) for i in a[1:]))
main()

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

Solution (Python):
import sys
n, x, y = map(int, sys.stdin.readline().split())

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

ans_list = [0 for _ in range(n-1)]

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

for num in ans_list:
    print(num)

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

res = [0] * (N)

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

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

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

lst = [0 for _ in range(1, n)]
for _ in itertools.combinations([_ for _ in range(1, n+1)], 2):
    i, j = _[0], _[1] 
    ans = min(abs(i-j), abs(x-j)+1+abs(y-i),abs(x-i)+1+abs(y-j))
    lst[ans-1] += 1
    
for _ in lst:
    print(_)

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

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), abs(Y-a) + 1 + abs(b-X))

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

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

Solution (Python):
N, X, Y = map(int, input().split())
ans = [0 for _ in range(N)]

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

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

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

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

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

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

start = X
end = Y

for left in range(1, N): 
    for right in range(left + 1, N + 1): 
        
        if left <= start and end <= right: 
            dist = (right - left) - (end - start - 1)
        
        elif left <= start and right < end:
            dist = min(right - left, start - left + 1 + end - right)
        
        elif start < left and end <= right:
            dist = min(right - left, left - start + 1 + right - end)
        
        else:
            dist = min(right - left, left - start + 1 + end - right)

        
        ans[dist - 1] += 1

for a in ans:
    print(a)

Solution (Python):
import collections

def distances(n,x,y):
    for i in range(1, int(n)):
        for j in range(i+1, int(n)+1):
            yield min(abs(i-j), abs(i-x)+abs(j-y)+1, abs(i-y)+abs(j-x)+1)

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

c = collections.Counter(distances(n,x,y))

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

Solution (Python):
def main(n, x, y):
    d_s = [0] * (n-1)

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

    print("\n".join(str(d) for d in d_s))


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

    main(n, x-1, y-1)

Solution (Python):
a = list(map(int,input().split()))
dis = [0]*a[0]

for i in range(1,a[0]):
    for j in range(i+1,a[0]+1):
        dis[min([ abs(j-i) -1 , abs(i-a[1]) + abs(j-a[2]) + 1 -1 ]) ] += 1

for i in range(a[0]-1):
    print(dis[i])

Solution (Python):

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





dic={}

for i in range(n):
    for j in range(i,n):
        
        
        dis=j-i
        maybe=abs(x-(i+1))+1+abs(y-(j+1))
        dis=min(dis,maybe)
        
        dic[dis]=dic.get(dis,0)+1

for k in range(1,n):
    print(dic.get(k,0))

Solution (Python):


















from sys import stdin
from heapq import heappush, heappop


class Dijkstra:
    def __init__(self, num_nodes):
        self.n = num_nodes
        self.adj_list = [[] for _ in range(self.n)]

    
    def add_edge(self, start, end, weight=1, undirected=True):
        self.adj_list[start].append((end, weight))
        if undirected:
            self.adj_list[end].append((start, weight))

    def distance(self, start):
        
        self.dist = [float('inf') for _ in range(self.n)]
        
        self.prev = [-1 for _ in range(self.n)]
        self.dist[start] = 0
        
        q = []
        heappush(q, (start, 0))
        while len(q) != 0:
            src, prov_cost  = heappop(q)
            
            if self.dist[src] < prov_cost:
                continue
            
            for val in self.adj_list[src]:
                dest, cost = val
                if self.dist[dest] > self.dist[src] + cost:
                    self.dist[dest] = self.dist[src] + cost 
                    heappush(q, (dest, self.dist[dest])) 
                    self.prev[dest] = src
        return self.dist



def get_result(data):
    N, X, Y = data
    _data = [[i, i+1] for i in range(1, N)]
    _data += [[X, Y]]
    solver = Dijkstra(N)
    for val in _data:
        solver.add_edge(val[0]-1, val[1]-1, undirected=True)
    dist_cnt = [0 for i in range(N)]
    for i in range(N):
        dist = solver.distance(i)
        for j in range(i, N):
            dist_cnt[dist[j]] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)

Solution (Python):
n,x,y=map(int,input().split())
x-=1
y-=1
inf=1<<30
d=[[inf]*n for _ in range(n)]
for i in range(n):
    for j in range(i+1,n):
        d[i][j]=min((j-i,abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(x-j)))
from collections import Counter
c=Counter()
for i in range(n):
    c+=Counter(d[i])
for k in range(1,n):
    print(c[k])

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

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




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

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

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

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

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


def update(dist, queue, d, x):
    if dist[x] >= 0: return dist, queue
    dist[x] = d+1
    queue.append(x)
    return dist, queue

ans = [0 for _ in range(n)]
for i in range(n):
    dist = [-1 for _ in range(n)]
    dist[i] = 0
    queue = [i]
    while True:
        if len(queue) == 0: break
        now = queue.pop(0)
        d = dist[now]
        if now-1 >= 0:
            dist, queue = update(dist, queue, d, now-1)
        if now+1 < n:
            dist, queue = update(dist, queue, d, now+1)
        if now == x:
            dist, queue = update(dist, queue, d, y)
        if now == y:
            dist, queue = update(dist, queue, d, x)
    for d in dist:
        ans[d] += 1

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

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

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

Solution (Python):
def solve(string):
    n, x, y = map(int, string.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), abs(y - i) + 1 + abs(j - x))] += 1
    return "\n".join(map(str, ans[1:]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
from collections import defaultdict

dd = defaultdict(int)

n,x,y = map(int,input().split())
x -= 1
y -= 1
for k in range(1,n):
    dd[k] =0

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

for k in dd:
    print(dd[k])

Solution (Python):
import itertools

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

a = [i for i in range(1, n+1)]
b = [0]*(n-1)

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

for l in range(n-1):
    print(b[l])

Solution (Python):


















from sys import stdin
from collections import deque


class BreadthFirstSearch:
    def __init__(self, num_nodes):
        self.n = num_nodes
        self.graph = [[] for _ in range(self.n)]

    
    def add_edge(self, start, end, undirected=True):
        self.graph[start].append(end)
        if undirected:
            self.graph[end].append(start)

    
    def search(self, start_node):
        order = [-1] * self.n 
        parent = [-1] * self.n 
        depth = [-1] * self.n 
        q = deque([(start_node, -1, 0)]) 
        num = 0 
        while len(q) > 0:
            v, p, d = q.popleft()
            if order[v] < 0: 
                order[v] = num; parent[v] = p; depth[v] = d
                num += 1
                for u in self.graph[v]:
                    if order[u] >= 0: continue
                    q.append((u, v, d+1))
        return order, parent, depth



def get_result(data):
    N, X, Y = data
    _data = [[i, i+1] for i in range(1, N)]
    _data += [[X, Y]]
    bfs = BreadthFirstSearch(N)
    for val in _data:
        bfs.add_edge(val[0]-1, val[1]-1)
    dist_cnt = [0 for i in range(N)]
    for i in range(N):
        _, _, depth = bfs.search(i)
        for j in range(i, N):
            dist_cnt[depth[j]] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)

Solution (Python):

n,x,y = list(map(int,input().split()))
x-=1
y-=1
inf=float("inf")

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

from math import isinf
ret_bucket = [0] * n
for a_list in am:
    for min_dist in a_list:
        if not isinf(min_dist):
            ret_bucket[min_dist]+=1

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

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

[print(l) for l in ans]

Solution (Python):
from sys import stdin
from collections import deque




def get_adj_list(num_nodes, data, undirected=True):
    graph = [[] for _ in range(num_nodes)]
    for val in data:
        x, y = val
        graph[x-1].append(y-1)
        if undirected:
            graph[y-1].append(x-1)
    return graph



def breadth_first_search(adj_list, start_node):
    N = len(adj_list)
    order = [-1] * N 
    parent = [-1] * N 
    depth = [-1] * N 
    q = deque([(start_node, -1, 0)]) 
    num = 0 
    while len(q) > 0:
        v, p, d = q.popleft()
        if order[v] < 0: 
            order[v] = num; parent[v] = p; depth[v] = d
            num += 1
            for u in adj_list[v]:
                if order[u] >= 0: continue
                q.append((u, v, d+1))
    return order, parent, depth



def get_result(data):
    N, X, Y = data
    _data = [[i, i+1] for i in range(1, N)]
    _data += [[X, Y]]
    adj_list = get_adj_list(N, _data)
    dist_cnt = [0 for i in range(N)]
    for i in range(N):
        _, _, depth = breadth_first_search(adj_list, i)
        for j in range(i, N):
            dist_cnt[depth[j]] += 1
    for i in range(1, N):
        print(dist_cnt[i])


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    get_result(data)

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

count=[0]*N

def bfs(start):
    dist=[-1]*(N+1)
    q=deque()
    q.append([start,0])
    dist[start]=0
    while q:
        j,kyori=q.popleft()

        if j-1>=1:
            if dist[j-1]==-1:
                q.append([j-1,kyori+1])
                dist[j-1]=kyori+1

        if j+1<=N:
            if dist[j+1]==-1:
                q.append([j+1,kyori+1])
                dist[j+1]=kyori+1
        
        if j == X and dist[Y]==-1:
            q.append([Y,kyori+1])
            dist[Y]=kyori+1

        if j == Y and dist[X]==-1:
            q.append([X,kyori+1])
            dist[X]=kyori+1

    return dist[1:]

def main():
    for start in range(1,N+1):
        dist=bfs(start)
        for d in dist:
            count[d]+=1

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

main()

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

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

ans_list = [0] * (a-1)

for i in range(1,a+1):
    for j in range(i+1,a+1):
        normal = j-i
        abnormal = abs(b-i)+1+abs(j-c)
        if (normal <= abnormal):
            ans = normal
        else:
            ans = abnormal
        ans_list[ans-1] += 1
print(*ans_list, sep='\n')

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

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

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

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

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

Solution (Python):
import collections


def distances(n, x, y):
    for i in range(1, N):
        for j in range(i + 1, N + 1):
            yield min(j - i, abs(x - i) + abs(y - j) + 1)


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

c = collections.Counter(distances(N, X, Y))

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

Solution (Python):
N, X, Y = tuple(int(v) for v in input().split())

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

for i in range(N):
    for j in range(i+1, N):
        
        d = j - i

        
        
        to_X   = abs(X-1 - i)
        
        from_Y = abs(Y-1 - j)
        d_p = to_X + from_Y + 1
        ans[min(d, d_p)] += 1
        
        
        
        

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

Solution (Python):
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): 
        
        
        if j<=X or Y<=i:
            d = j-i
            
        
        elif i<=X and Y<=j:
            d = X-i + 1 + j-Y
            
        
        else:
            d = min(j-i,abs(X-i)+abs(Y-j)+1)
        
        D[d-1] += 1


for d in D:
    print(d)

Solution (Python):
from collections import deque

n, x, y = [int(x) for x in input().split()]
x -= 1
y -= 1
BIG = 65521
ans = [0] * n






def bfs(start_v):
    """ある始点からほかの全点に行くまでの最短距離を求める。"""
    qu = (start_v,)
    
    dist = [BIG] * n

    def push(v, d):
        """始点からvまでの最短距離が算出されていないときに，その距離を保存し，
        キューに頂点vを追加する。"""
        nonlocal qu
        if dist[v] != BIG:
            
            return
        dist[v] = d
        qu = qu + (v,)

    push(start_v, 0)

    while len(qu):
        v = qu[0]
        qu = qu[1:]
        
        d = dist[v] + 1
        if v < n - 1:
            push(v + 1, d)
        if v > 0:
            push(v - 1, d)
        if v == x:
            push(y, d)
        if v == y:
            push(x, d)

    for i in range(n):
        ans[dist[i]] += 1


def main():
    for i in range(n):
        bfs(i)

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


if __name__ == '__main__':
    main()

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

Solution (Python):

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


def sp_root(i, j, X, Y): 
    root = abs(X-i) + abs(Y-j) + 1
    return root


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

Solution (Python):
if __name__ == '__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):
			l1 = abs(j-i)
			l2 = abs(X-i) + 1 + abs(j-Y)
			lm = min(l1,l2)
			ans[lm - 1] += 1

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

Solution (Python):
import heapq

def dijkstra(s,edge):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

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

edge = [[] for i in range(n)]

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

ans = [0 for _ in range(n)]
for i in range(n):
    
    res = dijkstra(i,edge)
    for j in range(i+1,n):
        ans[res[j]] += 1

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

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

    def dijkstra(s,edge):
        
        d = [10**20] * n
        used = [True] * n 
        d[s] = 0
        used[s] = False
        edgelist = []
        for a,b in edge[s]:
            heapq.heappush(edgelist,a*(10**6)+b)
        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            
            if not used[minedge%(10**6)]:
                continue
            v = minedge%(10**6)
            d[v] = minedge//(10**6)
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
        return d

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

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

    for i in range(n):
        edge[i] = tuple(edge[i])
    edge = tuple(edge)

    ans = [0 for _ in range(n)]
    for i in range(n):
        
        res = dijkstra(i,edge)
        for j in range(i+1,n):
            ans[res[j]] += 1

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

if __name__ == '__main__':
    main()

Solution (Python):
import heapq
import sys

input = sys.stdin.readline

def dijkstra(s,edge):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

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

edge = [[] for i in range(n)]

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

ans = [0 for _ in range(n)]
for i in range(n):
    
    res = dijkstra(i,edge)
    for j in range(i+1,n):
        ans[res[j]] += 1

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

Solution (Python):
import heapq
import sys

input = sys.stdin.readline

def dijkstra(s,edge):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

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

edge = [[] for i in range(n)]

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

ans = [0 for _ in range(n)]
for i in range(n):
    
    res = dijkstra(i,edge)
    for j in range(i+1,n):
        ans[res[j]] += 1

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

Solution (Python):
import heapq
import sys

input = sys.stdin.readline

def dijkstra(s,edge):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

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

edge = [[] for i in range(n)]

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

for i in range(n):
    edge[i] = tuple(edge[i])
edge = tuple(edge)

ans = [0 for _ in range(n)]
for i in range(n):
    
    res = dijkstra(i,edge)
    for j in range(i+1,n):
        ans[res[j]] += 1

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

Solution (Python):
import sys

input = sys.stdin.readline

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

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

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

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

Solution (Python):
N, X, Y = 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):
        d1 = abs(j - i)
        d2 = abs(X - i) + 1 + abs(j - Y)
        ans[min(d1, d2) - 1] += 1

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

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

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

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

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

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

Solution (Python):
import numpy as np

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

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

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

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

Solution (Python):
N,X,Y = list(map(int,input().split()))
for i in range (1,N):
    a = max(N - 1 - (Y - X - 1) - (i - 1),0)
    if Y - X + 1 > 2 * i:
        b = Y - X + 1
        if i == 1:
            b = b - 1
    elif Y - X + 1 == 2 * i:
        b = i
    else:
        b = 0
    c = 0
    for j in range (max(X + 1 - i,1),X):
        if i - (X - j) == 1:
            c = c + 1
        elif 2 * (i - (X - j)) < Y - X + 1:
            c = c + 2
        elif 2 * (i - (X - j)) == Y - X + 1:
            c = c + 1
    for j in range(Y + 1,min(Y + i,N + 1)):
        if i - (j - Y) == 1:
            c = c + 1
        elif 2 * (i - (j - Y)) < Y - X + 1:
            c = c + 2
        elif 2 * (i - (j - Y)) == Y - X + 1:
            c = c + 1
        
    print(a+b+c)

Solution (Python):
import numpy as np

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

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

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

ans=[0]*n

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

Solution (Python):
K,X,Y = (int(x) for x in input().split())
ans = [0] * K
ct = 0
for i in range(1,K):
    for j in range (i+1,K+1):
            ans[min(j-i,abs(i-X)+abs(j-Y)+1)] += 1
for k in range (1,K):
    print(ans[k])