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():
    N, X, Y = map(int, input().split())
    dist_cnt = [0] * N
    calc_min_dist = lambda x, y: min(y - x, abs(X - x) + abs(y - Y) + 1)  
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist_cnt[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist_cnt[1:])))


if __name__ == "__main__":
    main()

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

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


dic = {}

X = X - 1
Y = Y - 1

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

        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1


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

Solution (Python):
from collections import deque

def bfs(u):
    dist = [-1 for _ in range(n)]
    dist[u] = 0
    que = deque([])
    que.append(u)
    
    while que:
        v = que.popleft()
        for nv in G[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            que.append(nv)

    for d in dist:
        if d == 0:
            continue
        ans[d-1] += 1
    return ans


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)

ans = [0]*(n-1)
for i in range(n):
    bfs(i)

for i in ans:
    print(i//2)

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

def bfs(u):
    dist = [-1 for _ in range(n)]
    dist[u] = 0
    que = deque([])
    que.append(u)
    
    while que:
        v = que.popleft()
        for nv in G[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            que.append(nv)

    for d in dist:
        if d == 0:
            continue
        ans[d-1] += 1
    return ans


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)

ans = [0]*(n-1)
for i in range(n):
    bfs(i)

for i in ans:
    print(i//2)

Solution (Python):

def main():
    N, X, Y = map(int, input().split())
    dist = [0] * N
    calc_min_dist = lambda x, y: min(
        y - x, abs(X - x) + abs(y - Y) + 1, abs(Y - x) + abs(y - X) + 1
    )  
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist[1:])))


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, X, Y = map(int, input().split())
    dist = [0] * N
    calc_min_dist = lambda x, y: min(
        y - x, abs(X - x) + abs(y - Y) + 1, abs(Y - x) + abs(y - X) + 1
    )
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist[1:])))


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, X, Y = map(int, input().split())
    dist = [0] * N
    calc_min_dist = lambda x, y: min(
        abs(x - y), abs(X - x) + abs(y - Y) + 1, abs(Y - x) + abs(y - X) + 1
    )
    for i in range(1, N + 1):
        for j in range(i + 1, N + 1):
            dist[calc_min_dist(i, j)] += 1
    print("\n".join(map(str, dist[1:])))


if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque
import sys
sys.setrecursionlimit(10**6)

def bfs(u):
    dist = [-1 for _ in range(n)]
    dist[u] = 0
    que = deque([])
    que.append(u)
    
    while que:
        v = que.popleft()
        for nv in G[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v] + 1
            que.append(nv)

    for d in dist:
        if d == 0:
            continue
        ans[d-1] += 1
    return ans


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)

ans = [0]*(n-1)
for i in range(n):
    bfs(i)

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

Solution (Python):
N,X,Y = map(int,(input().split()))
cn = [[] for _ in range(N+1)]
for i in range(1,N+1):
    if i-1 >= 1:
        cn[i].append(i-1)
    if i+1 <= N:
        cn[i].append(i+1)
    if i == X:
        cn[X].append(Y)
    if i == Y:
        cn[Y].append(X)

result = {}

for i in range(1,N+1):

    dis = [0]*(N+1)

    not_visit = [True]*(N+1) 
    stack = [i]
    not_visit[i] = False

    while stack:
        now = stack.pop(0)
        for j in cn[now]:
            if not_visit[j]:
                not_visit[j] = False
                stack.append(j)
                dis[j] = dis[now] + 1

    for i in range (0,len(dis)):
        item = dis[i]
        if item in result:
            result[item] = result[item]+1
        else:
            result[item] = 1

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

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

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

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

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

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

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

print(N)

X -= 1
Y -= 1

def disdance(i, j):
    if i <= X and j >= Y:
        return X - i + j - Y + 1
    elif i >= X and j <= Y:
        return min(j - i, i - X + Y - j + 1)
    elif i >= X and j >= Y:
        return min(j - i, i - X + j - Y + 1)
    elif i <= X and j <= Y:
        return min(j - i, X - i + Y - j + 1)

d = [0] * N

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

for k in range(2, N):
    print(d[k])

Solution (Python):
from collections import deque
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
K = [0 for _ in range(N)]
INF = 10 ** 9
def bfs(n):
    d = deque()
    d.append(n)
    reached = [INF for _ in range(N)]
    reached[n] = 0
    dx = [-1, 1]
    while d:
        x = d.popleft()
        for i in range(2):
            nx = x + dx[i]
            if nx < 0 or nx > N - 1 or reached[nx] != INF:
                continue
            d.append(nx)
            reached[nx] =reached[x] + 1
        if x == X and reached[Y] == INF:
            reached[Y] = reached[x] + 1
            d.append(Y)
        if x == Y and reached[X] == INF:
            reached[X] = reached[x] + 1
            d.append(X)
    for i in range(N):
        K[reached[i]] += 1            

for i in range(N):
    bfs(i)

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

Solution (Python):
s=input().split()
n=int(s[0])
x=int(s[1])
y=int(s[2])
current=0
list=[0]*(n-1)
for i in range(n) :
  for j in range(i+1,n) :
    k=min(j-i,abs(x-i-1)+1+abs(y-j-1))
    
    list[k-1]+=1
for youso in list :
  print(youso)

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

K = [0 for _ in range(N)]
INF = 10 ** 9
def bfs(n):
    d = deque()
    d.append(n)
    reached = [INF for _ in range(N)]
    reached[n] = 0
    dx = [-1, 1]
    while d:
        x = d.popleft()
        for i in range(2):
            nx = x + dx[i]
            if nx < 0 or nx > N - 1 or reached[nx] != INF:
                continue
            d.append(nx)
            reached[nx] =reached[x] + 1
        if x == X-1 and reached[Y-1] == INF:
            reached[Y-1] = reached[x] + 1
            d.append(Y-1)
        if x == Y-1 and reached[X-1] == INF:
            reached[X-1] = reached[x] + 1
            d.append(X-1)
    for i in range(N):
        K[reached[i]] += 1            

for i in range(N):
    bfs(i)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]



def main():
    a=LI()
    n=a[0]
    x=a[1]-1
    y=a[2]-1
    dist={}
    ans={}
    for i in range(n):
        dist[i]={}
        ans[i]=0
    for i in range(n):
        for j in range(i+1, n):
            dist[i][j]=min(j-i, 1+abs(j-y)+abs(i-x))
            ans[dist[i][j]]+=1
    for i in range(1,n):
        print(ans[i])
main()

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

ans_list = [0]*(N-1)

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

for i in ans_list:
    print(i)

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

def node_search(i):
    nodes = []
    if i < N and check[i+1] == 0:
        nodes.append(i+1)
    if i > 1 and check[i-1] == 0:
        nodes.append(i-1)
    if i == X and check[Y] == 0:
        nodes.append(Y)
    return nodes


cnt = [0]*N
for i in range(1, N):
    check = [0]*(N+1)
    dist = [INF] * (N + 1)
    dist[i] = 0
    q.append(i)
    d = 1
    while q:
        now_node = q.pop()
        check[now_node] = 1
        for next_node in node_search(now_node):
            dist[next_node] = min(dist[now_node]+1, dist[next_node])
            q.appendleft(next_node)


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

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


a = 0

Solution (Python):
def inpl():
    return list(map(int, input().split()))


N, X, Y = inpl()
X -= 1
Y -= 1
ans = {i: 0 for i in range(N)}
for i in range(N):
    for j in range(i + 1, N):
        c = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
        ans[c] += 1

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

Solution (Python):
def inpl():
    return list(map(int, input().split()))


N, X, Y = inpl()
X -= 1
Y -= 1
ans = {i: 0 for i in range(N)}
for i in range(N):
    for j in range(i + 1, N):
        c = min(j - i, abs(i - X) + 1 + abs(j - Y), abs(i - Y) + 1 + abs(j - X))
        ans[c] += 1

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

Solution (Python):
from sys import stdin
N, X, Y = (int(i) for i in input().split())



ans = [0]*N


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


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

Solution (Python):
from collections import Counter

N, X, Y = map(int, input().split())
g = [[float("inf")] * N for _ in range(N)]

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

c = Counter()
for i in range(N):
    c.update(g[i][:i])

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

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

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

def bfs(i):
    dist = [-1]*N
    dist[i] = 0
    que = collections.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)
    return dist[i+1:]

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)

d = collections.Counter([])
for i in range(N):
    d += collections.Counter(bfs(i))
for i in range(1,N):
    if i == N-1:
        print(0)
    else:
        print(d[i])

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

answer = [0 for _ in range(0, N)]
for i in range(1, N+1):
    for j in range(i, N+1):
        distance1 = abs(i-j)
        distance2 = abs(X-i) + abs(Y-j) + 1
        distance3 = abs(X-j) + abs(Y-i) + 1
        min_distance = min(distance1, distance2, distance3)
        answer[min_distance] += 1
for a in answer[1:]:
    print(a)

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

    x -= 1
    y -= 1

    ans_list = [0]*n

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

answer = [0 for _ in range(0, N)]
for i in range(1, N+1):
    for j in range(i, N+1):
        distance1 = abs(i-j)
        distance2 = abs(X-i) + abs(Y-j) + 1
        distance3 = abs(X-j) + abs(Y-i) + 1
        min_distance = min(distance1, distance2, distance3)
        answer[min_distance] += 1
for i, a in enumerate(answer):
    if i != 0:
        print(a)

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

Solution (Python):
from collections import defaultdict
from heapq import heappush, heappop
from collections import deque
n, x, y = list(map(int, input().split()))
G = [[]*n 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)

N = n


dd = []
for i in range(n):
    dist = [-1]*N
    que = deque([i])
    dist[i] = 0
    while que:
        v = que.popleft()
        d = dist[v]
        for w in G[v]:
            if dist[w] > -1:
                continue
            dist[w] = d + 1
            que.append(w)
    dd.append(dist)
ans = defaultdict(lambda: 0)
for dist in dd:
    for t in dist:
        ans[t] += 1
for i in range(n-1):
    print(ans[i+1]//2)

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

k = [0 for _ in range(n)]
for i in range(n):
    for j in range(i + 1, n):
        dist = min(j-i, abs(x-i)+1+abs(j-y))
        if dist < n:
            k[dist] += 1
for i in range(1, len(k)):
    print(k[i])

Solution (Python):

import sys
from heapq import heappush,heappop
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,X,Y=map(int,input().split())
    X-=1
    Y-=1
    
    def dijkstra(start,n,edges):
        d=[INF]*n
        used=[False]*n
        d[start]=0
        used[start]=True
        edgelist=[]
        for edge in edges[start]:
            heappush(edgelist,edge)
        while edgelist:
            minedge=heappop(edgelist)
            if used[minedge[1]]:
                continue
            v=minedge[1]
            d[v]=minedge[0]
            used[v]=True
            for edge in edges[v]:
                if not used[edge[1]]:
                    heappush(edgelist,(edge[0]+d[v],edge[1]))
        return d
    
    edges=[[] for _ in range(N)]
    for i in range(N-1):
        edges[i].append((1,i+1))
        edges[i+1].append((1,i))
    edges[X].append((1,Y))
    edges[Y].append((1,X))

    ans=[0]*N
    for i in range(N):
        d=dijkstra(i,N,edges)
        for x in d:
            ans[x]+=1
    for row in ans[1:]:
        print(row//2)

if __name__ == '__main__':
    main()

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



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

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

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

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

def dfs(st, graph):
    INF = 10 ** 18
    dist = [INF] * len(graph)
    dist[st] = 0
    stack = [st]
    while stack:
        s = stack.pop()
        for t in graph[s]:
            if dist[t] > dist[s] + 1:
                dist[t] = dist[s] + 1
                stack.append(t)
    return dist

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

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

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

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

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

k = [0]*N
for p1 in range(1,N):
  for p2 in range(p1+1,N+1):
    d = [0]*3
    d[0] = p2-p1
    d[1] = abs(X-p1)+1+abs(Y-p2)
    d[2] = abs(X-p2)+1+abs(Y-p1)
    k[min(d)] += 1
k = list(map(str, k))
print('\n'.join(k[1:N]))

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

x = x-1
y = y-1

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

for i in range(n):
    for k in range(n):
        key = min(abs(i-k), abs(i-x)+abs(k-y) + 1, abs(i-y) +abs(k-x) + 1)
        count_dict[key] += 1

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

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

Solution (Python):
N,X,Y=map(int,input().split())
answers=[0]*(N-1)
for i in range(1,N+1):
    numbers=[a for a in range(1,N+1) if a!=i]
    for j in numbers:
        answer=min(abs(i-j),abs(X-i)+1+abs(j-Y),abs(i-Y)+1+abs(j-X))
        answers[answer-1]+=1
for a in answers:
    print(a//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,N+1):
    dis = min( abs(j-i), abs(X-i) +1+abs(j-Y), abs(Y-i) +1+abs(j-X) )
    ans[dis]+=1
    
for i in range(1,N):
  print( ans[i] )

Solution (Python):

import sys
import numpy as np
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

Solution (Python):

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

for s in dists:
  print(s)

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

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

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

Solution (Python):
from itertools import combinations

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


def length(i, j):
  return min(j - i, abs(X - i) + abs(Y - j) + 1, abs(X - j) + abs(Y - i) + 1)


counter = [0] * (N - 1)

for i, j in combinations(range(1, N + 1), 2):
  l = length(i, j)
  counter[l - 1] += 1

for c in counter:
  print(c)

Solution (Python):
from sys import stdin


def get_result(data):
    N, X, Y = data
    dist_cnt = [0 for i in range(N)]
    for i in range(1, N+1):
        for j in range(i+1, N+1):
            min_dist = min([j-i, abs(X-i) + 1 + abs(Y-j), abs(Y-i) + 1 + abs(X-j)])
            dist_cnt[min_dist] += 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())
dis = [0] * (N - 1)

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

[print(i) for i in dis]

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

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

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

x-=1
y-=1

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

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

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

for i in range(1, len(ans_list)):
    print(ans_list[i])

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

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

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

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

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

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

Solution (Python):
import collections
N,X,Y=map(int,input().split())
xdex=X-1            
ydex=Y-1            
"""

l=[0]*(N)

le=0

for i in range(N):
    for j in range(i+1,N):
        le=(j-i)
        if (i<=xdex)and(ydex<=j):
            le = min(j - i, (j - i) - (Y - X - 1))
        elif ((i<=xdex)and(j<=ydex)and(xdex<=j)):
            le=min(j - i, (xdex-i)+(ydex- j)+1)
        elif ((xdex<i)and(j<=ydex)and(xdex<=j)):
            le=min(j-i,(i-xdex)+(ydex-j)+1)
        elif ((xdex<i)and(ydex<j)):
            le=min(j-i,(i-xdex)+(j-ydex)+1)
        
        l[le]=l[le]+1

for i in range(N-1):
    print(l[i+1])
"""

inf=1001001
def pus(v,d,dist,q):    
    if dist[v]==inf:    
        dist[v]=d       
        q.append(v)     
    return 0


v=0
d=0
ans=[0]*N
for i in range(N):                  
    dist=[inf]*N                    
    q = collections.deque()         
    pus(i,0,dist,q)                 
    while len(q)!=0:                
        
        v=q.popleft()               
        d=dist[v]                   
        if (v-1>=0):                
            pus(v-1,d+1,dist,q)     
        if (v+1<N):                 
            pus(v+1,d+1,dist,q)     
        if v==xdex:                 
            pus(ydex,d+1,dist,q)    
        if v==ydex:                 
            pus(xdex,d+1,dist,q)    
        
        
    for i in range(N):              
        ans[dist[i]]=ans[dist[i]]+1 
for i in range(1,N):                
    print(ans[i]//2)

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

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

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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

    print(*ret, sep="\n")


if __name__ == '__main__':
    main()

Solution (Python):



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

    x -= 1
    y -= 1

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

    for ret in result:
        print(ret)


if __name__ == '__main__':
    main()

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

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

def dist(i,j):
    return min(abs(j-i), abs(X-i)+1+abs(j-Y))

ans = [0]*N
for i in range(N):
    for j in range(i+1, N):
        d = dist(i+1,j+1)
        ans[d] += 1
for i in range(N):
    if i == 0:
        continue
    print(ans[i])

Solution (Python):
def MI():return map(int,input().split())
def LI():return list(MI())

from collections import deque
INF=float("inf")
n,x,y=MI()
x-=1
y-=1
ans=[0]*n

for sv in range(n):
  dist=[INF]*n
  q=deque()
  def push(v,d):
    if dist[v]!=INF:
      return
    dist[v]=d
    q.append(v)
  push(sv,0)
  while q:
    v=q.popleft()
    d=dist[v]
    if v-1>=0:
      push(v-1,d+1)
    if v+1<n:
      push(v+1,d+1)  
    if v==x:
      push(y,d+1)
    if v==y:
      push(x,d+1)
        
  for i in range(n):
    ans[dist[i]]+=1
for i in range(n):
  ans[i]//=2
for i in range(1,n):
  print(ans[i])

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

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

    for r in ret:
        print(r)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter

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

dists = Counter([min(j - i, abs(x - i) + abs(y - j) + 1) for i in range(n - 1) for j in range(i + 1, n)])
[print(dists.get(i, 0)) for i in range(1, n)]

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

pdic = dd(lambda:0)



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



        
        d1 = j-i
        
        i2x = abs(X-i)
        y2j = abs(Y-j)
        d2 = i2x + y2j + 1

        dist = min(d1,d2)
        pdic[str(dist)] += 1

for n in range(1,N):
    print(pdic[str(n)])

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

Solution (Python):
n, x, y = map(int, input().split())
k = y - x + 1
s = [0 for i in range(n-1)]
a = x - 1
b = n - y
if k % 2 == 0:
    for i in range(k // 2-1):
        s[i] += k
    s[k//2-1] += k // 2
    for i in range(a):
        for j in range(k // 2):
            if j == 0:
                s[i+j] += 1
                s[i+k//2] += 1
            else:
                s[i+j] += 2
    for i in range(b):
        for j in range(k // 2):
            if j == 0:
                s[i+j] += 1
                s[i+k//2] += 1
            else:
                s[i+j] += 2
    for i in range(a):
      for j in range(b):
        s[2+i+j] += 1
    for i in range(a-1):
        for j in range(i+1, a):
            s[j-i-1] += 1
    for i in range(b-1):
        for j in range(i+1, b):
            s[j-i-1] += 1
else:
    for i in range(k // 2):
        s[i] += k
    for i in range(a):
        for j in range(k // 2 + 1):
            if j == 0:
                s[i+j] += 1
            else:
                s[i+j] += 2
    for i in range(b):
        for j in range(k // 2 + 1):
            if j == 0:
                s[i+j] += 1
            else:
                s[i+j] += 2
    for i in range(a):
        for j in range(b):
            s[2+i+j] += 1
    for i in range(a-1):
        for j in range(i+1, a):
            s[j-i-1] += 1
    for i in range(b-1):
        for j in range(i+1, b):
            s[j-i-1] += 1

print(*s)