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


int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n, x, y = MI()

    def dist(a, b):
        return b - a

    ans = [0 for _ in range(n-1)]
    for i in range(1, n):
        for j in range(i+1, n+1):
            if i <= x and y <= j:
                d = dist(i, x) + 1 + dist(y, j)
            elif x < i < y:
                if x < j < y:
                    d = min(dist(i, j), dist(x, i) + 1 + dist(j, y))
                else:
                    d = min(dist(x, i)+1, dist(i, y)) + dist(y, j)
            elif x < j < y:
                d = min(dist(i, j), dist(i, x) + 1 + dist(j, y))
            else:
                d = dist(i, j)
            
            ans[d-1] += 1
    print("\n".join(map(str, ans)))



if __name__ == '__main__':
    solve()

Solution (Python):


int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solve():
    n, x, y = MI()

    def dist(a, b):
        return b - a

    ans = [0 for _ in range(n-1)]
    for i in range(1, n):
        for j in range(i+1, n+1):
            if i <= x and y <= j:
                d = dist(i, x) + 1 + dist(y, j)
            elif x < i < y:
                if x < j < y:
                    d = min(dist(i, j), dist(x, i) + 1 + dist(j, y))
                else:
                    d = min(dist(x, i)+1, dist(i, y)) + dist(y, j)
            elif x < j < y:
                d = min(dist(i, j), dist(i, x) + 1 + dist(j, y))
            else:
                d = dist(i, j)
            
            ans[d-1] += 1
    print("\n".join(map(str, ans)))



if __name__ == '__main__':
    solve()

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

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

import collections
u2 = collections.Counter(u)
u2 = list(u2.items())
for k in range(n):
    u2.append((0,0))

for i in range(n-1):
    if u2[i][0] == i+1:
        print(u2[i][1])
    else:
        print(0)

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

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

for i in range(1,N):

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

Solution (Python):
N,X,Y=map(int, input().split())
dislist = [0]*N
midXY = (X+Y)//2
def caldis(i,l):
    return min((l-i),(abs(X-i)+1+abs(Y-l)))
for i in range(1,N):
    for l in range(i+1,N+1):
        dislist[caldis(i,l)] += 1
for i in dislist[1:]:
    print(i)

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

k = defaultdict(lambda: 0)

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

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

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

count = [0]*n

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



[print(k) for k in count[1:]]

Solution (Python):


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

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

x -= 1
y -= 1
graph[x].append((1, y))
graph[y].append((1, x))

from heapq import heappop, heappush
def dijkstra_with_heap(graph, start, v):
    
    
    
    
    distance = [float('infinity')] * v
    distance[start] = 0
    stack = [[0, start]] 
    while stack:
        _, vertex = heappop(stack)
        edges = graph[vertex]
        for d, t in edges:
            if d + distance[vertex] < distance[t]:
                distance[t] = d + distance[vertex]
                heappush(stack, (d, t))
    return distance

ans = [0] * n
for i in range(n):
    d = dijkstra_with_heap(graph, i, n)
    for j in range(i, n):
        ans[d[j]] += 1
for a in ans[1:]: 
    print(a)

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

Solution (Python):

"""
Created on Mon Apr 27 21:23:16 2020
"""

import sys
from collections import deque


sys.setrecursionlimit(10 ** 9)


mod = 10**9+7


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


X -= 1
Y -= 1
ans = [0 for i in range(N)]

for i in range(N):
    q = deque([i])
    counta = 0
    visited = [False for i in range(N)]
    visited[i] = True
    while len(q) > 0:
        buf = []
        for j in range(len(q)):
            a = q.popleft()
            b1, b2 = a+1, a-1
            if b1 >= 0 and b1 < N and not visited[b1]:
                q.append(b1)
                ans[counta] += 1
                visited[b1] = True
            if b2 >= 0 and b2 < N and not visited[b2]:
                q.append(b2)
                ans[counta] += 1
                visited[b2] = True
            if a == X:
                b3 = Y
            elif a == Y:
                b3 = X
            else:
                b3 = i
            if b3 >= 0 and b3 < N and not visited[b3]:
                q.append(b3)
                ans[counta] += 1
                visited[b3] = True
        counta += 1



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

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

ans = [0]*(N+1)

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

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

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

ans = [0]*(N+1)

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

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

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): 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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)

import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): 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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)


from collections import deque

N,X,Y=MI()
l = []
for i in range(N):
    if i!=0 and i!=N-1:
        n = [i-1,i+1]
    elif i==0:
        n = [1]
    else:
        n = [N-2]
    if i==X-1:
        n += [Y-1]
    if i==Y-1:
        n += [X-1]
    l.append(n)
ans = [0]*(N-1)
for i in range(N):
    dist = [-1]*N
    q=deque()
    q.append(i)
    dist[i]=0
    while q:
        u = q.popleft()
        for next in l[u]:
            if dist[next]==-1:
                dist[next]=dist[u]+1
                ans[dist[u]] += 1
                q.append(next)

[print(x//2) for x in ans]

Solution (Python):
from collections import deque

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

to = [[] * N for i in range(N)]

for i in range(N-1):
    to[i].append(i+1)
    to[i+1].append(i)

to[X-1].append(Y-1)
to[Y-1].append(X-1)

ans = [0] * N

for i in range(N):
    dis = [0] * N
    dis[i] = 0
    visited = [False] * N
    q = deque([])
    q.append(i)
    visited[i] = True

    while len(q) != 0:
        tmp_v = q.popleft()
        for j in to[tmp_v]:
            if not visited[j]:
                dis[j] = dis[tmp_v] + 1
                visited[j] = True
                q.append(j)

    for j in range(N):
        ans[dis[j]] += 1

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

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

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

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

ans=[0]*(n+1)



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

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

ans=[0]*(n+1)



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

Solution (Python):

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

  for a in ans:
    print(a)


main()

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

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

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

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

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

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

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

Solution (Python):
import math
n,x,y=map(int,input().split())
pairs=[]
for i in range(0,n-1):
    pairs.append(0)
for i in range(1,n):
    for j in range(i+1,n+1):
        if j<=x or i>=y:
            pairs[j-i-1]+=1
        elif i<=x and j>=y:
            pairs[j-i-y+x]+=1
        else:
            if j-i>(abs(y-j)+abs(x-i)+1):
                pairs[abs(y-j)+abs(x-i)]+=1
            else:
                pairs[j-i-1]+=1
for pair in pairs:
    print(pair)

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

Solution (Python):










def main():
    solve()


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

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

            ans = min(dist1, dist2)
            ans_list[ans] += 1

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

    return


if __name__ == '__main__':
    main()

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

if __name__ == "__main__":
    main()

Solution (Python):






import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]


def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr


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





N,X,Y = inputIL()



res = [0 for i in range(N)]

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

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

ans = [0] * (N - 1)
for i in range(N - 1):
    for j in range(i + 1, N):
        ij = j - i
        ix = abs(i - X)
        iy = abs(i - Y)
        jx = abs(j - X)
        jy = abs(j - Y)

        minn = ij
        minn = min(minn, ix + 1 + jy)
        minn = min(minn, iy + 1 + jx)

        ans[minn - 1] += 1

for i in ans:
    print(i)

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

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

ans = list(map(str, ans))

print("\n".join(ans))

Solution (Python):
def main():
    N, X, Y = map(int, input().split())
    tree = [[float('inf')] * N for _ in range(N)]
    ans = [0] * (N + 1)
    X -= 1
    Y -= 1
    for i in range(N):
        for j in range(i,N):
            dist = min(j - i, abs(X - i) + 1 + abs(Y - j))
            ans[dist] += 1

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


if __name__ == "__main__":
    main()

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

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

for lt in range(1, N+1):
    for rt in range(lt+1, N+1):
        a[min(rt-lt-1, abs(X-lt) + abs(Y-rt))] += 1

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

Solution (Python):
from collections import Counter

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

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

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

Solution (Python):
from collections import Counter

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

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

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

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

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

G = [[] for _ in range(N)]
for i in range(N - 1):
  G[i].append([i + 1, 1])
  G[i + 1].append([i, 1])

iX = X - 1
iY = Y - 1
G[iX].append([iY, 1])
G[iY].append([iX, 1])

d = {}
for i in range(N):
  d[i] = 0

for i in range(N):
  to_see_queue = deque()
  to_see_queue.append(i)
  costs = [-1] * N
  costs[i] = 0

  while to_see_queue:
    cur = to_see_queue.popleft()
    for node_next, cost_nn in G[cur]:
      if costs[node_next] == -1:
        costs[node_next] = costs[cur] + cost_nn
        to_see_queue.append(node_next)
  
  for nn in range(i + 1, N): 
    d[costs[nn]] += 1

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

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

d = {}
for i in range(1, N):
    for j in range(i+1, N+1):
        mi_n = min(abs(j-i), abs(X-i)+1+abs(j-Y))
        if mi_n not in d:
            d[mi_n] = 1
        else:
            d[mi_n] += 1

for idx in range(1, N):
    if idx not in d:
        print('0')
    else:
        print(d[idx])

Solution (Python):

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

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

def shortest_dist(a, b):
    return min(min(abs(a - b), abs(a - x) + 1 + abs(b - y)), abs(a - x) + 2 + abs(b - x))

distance = [0] * n
for i in range(n):
    for j in range(i+1, n):
        distance[shortest_dist(i, j)] += 1

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

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

Solution (Python):
import heapq
import sys

N, X, Y = map(int, input().split())
a = [[] for i in range(N)]
a[X - 1].append(Y - 1)
a[Y - 1].append(X - 1)
for i in range(N - 1):
	a[i].append(i + 1)
	a[i + 1].append(i)
ans = [0] * (N - 1)
for i in range(N - 1):
	b = [[0, i]]
	c = [False] * N
	d = [sys.maxsize] * N
	d[i] = 0
	while len(b):
		e = heapq.heappop(b)
		c[e[1]] = True
		for j in a[e[1]]:
			if c[j]:
				continue
			if e[0] + 1 < d[j]:
				d[j] = e[0] + 1
				heapq.heappush(b, [d[j], j])
	j = i + 1
	while j < N:
		ans[d[j] - 1] += 1
		j += 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):
        distance=min(j-i,abs(x-i)+1+abs(j-y))
        ans[distance]+=1
for i in range(1,n):
    print(ans[i])

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

res_dict = {}
for i in range(1, n+1):
    for j in range(i+1, n+1):
        tmp = min(j-i, abs(x-i)+abs(y-j)+1)
        if not tmp in res_dict.keys():
            res_dict[tmp] = 1
        else:
            res_dict[tmp] += 1

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

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

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

Solution (Python):
N, X, Y = [int(x) for x in input().split()]

a = [0]*N 

for i in range(1,N+1):
    for j in range(i+1,N+1):
        if (i <= X) and (j >= Y):
                a[(j - i) - (Y - X) + 1 ] += 1
        else:
            if (j - i ) > (abs(X - i) + abs(Y - j) + 1):
                a[abs(X - i) + abs(Y - j) + 1] +=  1
            else:
                a[j - i] += 1
for i in range(1,len(a)):
    print(a[i])

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

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

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

lenList = [0 for x in range(N)]
for start in range(1,N):
    for end in range(start+1,N+1):
        len = end - start
        if start <= X:
            if end <= X:
                lenList[len] += 1
            elif end < Y:
                len = min(len,((X-start) + 1 + (Y-end)))
                lenList[len] += 1
            else:
                len = (X-start) + 1 + (end-Y)
                lenList[len] += 1
        elif start < Y:
            if end < Y:
                len = min(len,(start-X) + 1 + (Y-end))
                lenList[len] += 1
            else:
                len = min(len,(start-X) + 1 + (end-Y))
                lenList[len] += 1
        else:
            lenList[len] += 1

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

Solution (Python):


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

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

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

Solution (Python):


import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,x,y = na()
ans = [0]*(n-1)

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

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

Solution (Python):
N,X,Y = map(int,input().split(sep=" "))
root = []
X = X-1
Y = Y-1
sumRoot = [0 for i in range(0,N-1,1)]
for i in range(0,N,1):
    for j in range(i+1,N,1):
        if j - i < abs(i-X)+abs(j-Y)+1:
            sumRoot[j-i-1] += 1
        else:
            sumRoot[abs(i-X)+abs(j-Y)] += 1
for k in range(0,N-1,1):
    print(sumRoot[k])

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

Solution (Python):
def solve(n, x, y):
    ans = [0] * n
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            d = min(j-i, abs(y-j) + abs(x-i) + 1)
            ans[d] += 1
    return "\n".join(map(str, ans[1:]))

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

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

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

dist = [0]*5000

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

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

Solution (Python):
import sys
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
for test in range(int(input())):
'''
inf = 100000000000000000  

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

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

dis = [0] * (n - 1)
for i in range(n - 1):
    for j in range(i + 1, n):
        d = min(abs(x - i - 1) + abs(y - j - 1) + 1, j - i)
        dis[d - 1] += 1
print(*dis, sep = '\n')

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

for i in range(N-1):
    for j in range(i+1, N):
        a = j-i
        b = abs(i-X)+1+abs(Y-j)
        c = abs(j-X)+1+abs(Y-i)
        m =  min(a, b, c)
        k[m] += 1

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

Solution (Python):

def solve():
    dists_y = [abs(y-a) for a in range(0,n+1)]
    dists_x = [abs(x-a) for a in range(0,n+1)]
    count_dists = [0]*(n+1)
    for a in range(1,n+1):
        for b in range(1,a+1):
            dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
            count_dists[dis] += 1
    
    for j in range(1,n):
        print(count_dists[j])











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




solve()

Solution (Python):
import numpy as np

inf = np.iinfo(np.uint32).max















def solve():
    dists_y = [abs(y-a) for a in range(1,n+1)]
    dists_x = [abs(x-a) for a in range(1,n+1)]

    aa = np.tile(np.arange(1, n+1), (n, 1))
    bb = aa.transpose().copy()
    base_dists = np.abs(aa-bb).copy()
    aa = np.tile(dists_y, (n, 1))
    bb = np.tile(dists_x, (n, 1)).transpose().copy()
    ab_dists = aa + bb + 1
    ba_dists = ab_dists.transpose().copy()
    min_dists = np.minimum(ab_dists, ba_dists)
    min_dists = np.minimum(min_dists, base_dists)
    count_dists = np.bincount(min_dists.reshape(n**2))
    for j in range(1,n):
        if j+1>len(count_dists):
            print(0)
        else:
            print(count_dists[j]//2)









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






solve()

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

Solution (Python):
n,x,y=map(int,input().split())
ans=[0]*(n-1)
t=[]
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,abs(y-i)+abs(x-j)+1)-1]+=1
for _ in ans:
	print(_)

Solution (Python):
import math
N ,X ,Y = map(int,input().split())
x = [0] * (N-1)
for i in range(1,N+1):
    for u in range(i+1,N+1):
        y =[abs(u - i), abs(X - i) + 1 + abs(u - Y ), abs(Y - i) + 1 + abs(u - X)]
        x[min(y)-1] += 1
for h in x:
    print(h)

Solution (Python):
n,x,y=list(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)+1+abs(j-y)])-1]+=1
for i in ans:
    print(str(i))

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

for ans_total in ans_list :
  print(ans_total)

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+1,n):
        l = min(j-i, abs(x-i)+1+abs(y-j))
        ans[l]+=1
print('\n'.join(map(str, ans[1:])))

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

import collections

c = collections.Counter(l)
for i in range(1, n):
    print(c[i])

Solution (Python):
from collections import deque
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
ans = [0] * N
def BFS(s):
	cnt = [0] * (N+1)
	flg = [-1] * (N+1)
	flg[s] = 0
	q = deque([s])
	while q:
		cp = q.popleft()
		for d in [-1,1]:
			tmp = cp + d
			if (0 <= tmp < N) and (flg[tmp] == -1):
				flg[tmp] = flg[cp] + 1
				ans[flg[tmp]] += 1
				q.append(tmp)
		if cp == X:
			if flg[Y] == -1:
				flg[Y] = flg[cp] + 1
				ans[flg[Y]] += 1
				q.append(Y)
		if cp == Y:
			if flg[X] == -1:
				flg[X] = flg[cp] + 1
				ans[flg[X]] += 1
				q.append(X)
	return cnt

for i in range(N):
	C = BFS(i)

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