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):
N, X, Y = map(int, input().split())
dist_dict = {k:0 for k in range(1, N)}

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


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

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

Solution (Python):
from collections import Counter

class Dijkstra():
    """ ダイクストラ法
    重み付きグラフにおける単一始点最短路アルゴリズム

    * 使用条件
        - 負のコストがないこと
        - 有向グラフ、無向グラフともにOK
    
    * 計算量はO(E*log(V))

    * ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
    """
    class Edge():
        """ 重み付き有向辺 """
        def __init__(self, _to, _cost):
            self.to = _to
            self.cost = _cost

    def __init__(self, V):
        """ 重み付き有向辺
        無向辺を表現したいときは、_fromと_toを逆にした有向辺を加えればよい

        Args:
            V(int): 頂点の数
        """
        self.G = [[] for i in range(V)]  
        self._E = 0  
        self._V = V  

    @property
    def E(self):
        """ 辺数
        無向グラフのときは、辺数は有向グラフの倍になる
        """
        return self._E
    
    @property
    def V(self):
        """ 頂点数 """
        return self._V
    
    def add(self, _from, _to, _cost):
        """ 2頂点と、辺のコストを追加する """
        self.G[_from].append(self.Edge(_to, _cost))
        self.G[_to].append(self.Edge(_from, _cost))
        self._E += 1
        
    def shortest_path(self, s):
        """ 始点sから頂点iまでの最短路を格納したリストを返す 
        Args:
            s(int): 始点s
        Returns:
            d(list): d[i] := 始点sから頂点iまでの最短コストを格納したリスト。
                     到達不可の場合、値はfloat("inf")
        """
        import heapq
        que = []  
        d = [float("inf")] * self.V
        d[s] = 0
        heapq.heappush(que, (0, s))  

        while len(que) != 0:
            cost, v = heapq.heappop(que)
            
            if d[v] < cost: continue

            for i in range(len(self.G[v])):
                
                e = self.G[v][i]  
                if d[e.to] > d[v] + e.cost:
                    d[e.to] = d[v] + e.cost  
                    heapq.heappush(que, (d[e.to], e.to))  
        return d
      
n, x, y = [int(i) for i in input().split()]

dij = Dijkstra(n)

for i in range(n-1):
  dij.add(i, i+1, 1)
dij.add(x-1, y-1, 1)

c = Counter([])
for i in range(n):
  c.update(dij.shortest_path(i))

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

Solution (Python):
n, x, y = map(int, input().split())
l=[0]*n
hr=(y-x+1)/2

for i in range(1, n):
  if i<x:
    for j in range(i+1, n+1):
      if j < x + hr:
        l[j-i]+=1
      elif j<y:
        l[x-i+1+y-j]+=1
      else:
        l[x-i+1+j-y]+=1
  else:
    for j in range(i+1, n+1):
      if j<y:
        if j < i + hr:
          l[j-i]+=1
        else:
          l[i-x+1+y-j]+=1
      else:
        if y < i+hr:
          l[j-i]+=1
        else:
          l[i-x+1+j-y]+=1
for i in range(1, n):
  print(l[i])

Solution (Python):
import sys
import numpy as np
import itertools
import collections
from collections import deque
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix

sys.setrecursionlimit(10**6)
readline = sys.stdin.readline


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


Graph = np.array([[0] * N for i in range(N)])
for i in range(N):
    if i-1 < 0:
        Graph[i, i+1] = 1
    elif N <= i+1:
        Graph[i, i-1] = 1
    else:
        Graph[i, i-1] = 1
        Graph[i, i+1] = 1

Graph[X-1, Y-1] = 1
Graph[Y-1, X-1] = 1



spath = shortest_path(Graph)
spathu = np.triu(spath)





def flatten_2dim(array):
    return [item for sublist in array for item in sublist]

c = collections.Counter(flatten_2dim(spathu))




for i in range(1, N):
    print(c.get(i, 0))

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)  
to_index = lambda x: int(x) - 1  
print_list_in_2D = lambda x: print(*x, sep="\n")  


def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

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

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())


def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

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


def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

N, X, Y = MII_split()

dist_counts = {}
for start_node in range(N - 1):
    back_s = abs(start_node - (X - 1))
    for i in range(start_node, N):
        dist_t = back_s + 1 + abs(Y - 1 - i)
        dist = min(dist_t, i - start_node)
        if dist in dist_counts:
            dist_counts[dist] += 1
        else:
            dist_counts[dist] = 1

for k in range(1, N):
    print(dist_counts[k] if k in dist_counts else 0)

Solution (Python):
from collections import Counter

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

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

if __name__ == "__main__":
    main()

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

p = []

for i in range(1, N):
    for j in range(i+1, N+1):
        if j<=X:
            p.append(j-i)
        elif j<=Y:
            if i <= X:
                p.append(min(j-i, X-i+1+Y-j))
            else:
                p.append(min(j-i, i-X+1+Y-j))
        else:
            if i <= X:
                p.append(j-i-(Y-X)+1)
            elif i <=Y:
                p.append(min(j-i, i-X+1+j-Y))
            else:
                p.append(j-i)
    
import collections
c = collections.Counter(p)
for k in range(1,N):
    print(c[k])

Solution (Python):

import sys






















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

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

            
            dist[d] = dist.get(d, 0) + 1

    
    for i in range(1, N):
        print(dist.get(i, 0))

    
    
    
    
    
    
    return



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

if __name__ == '__main__':
    main()

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

Solution (Python):


n,x1,y1 = map(int,input().split())
x = min(x1,y1)
y = max(x1,y1)

def ans(k):
    c = 0
    for i in range(1,x):
        if (y-x+1)/2.==k-i and k-i>0:
            c+=1
        elif (y-x+1)//2 >= k-i and k-i>0:
            c+=2

    

    for i in range(1,n-y+1):
        if (y-x+1)/2.==k-i and k-i>0:
            c+=1
        elif (y-x+1)//2 >= k-i and k-i>0:
            c+=2

    

    c+= max((n-y+x+1-k),0)

    

    if (y-x +1)/2. == k:
        c += k
    elif (y-x+1)//2 >=k:
        c += y-x+1
    
    if x-1 >= k-1 and c>0:
        c-=1
    if n-y >= k-1 and c>0:
        c-=1
    
    if c<0: 
        return 0

    return c+1 if k==1 else c
    


for k in range(n-1):
    print(ans(k+1))

Solution (Python):

from collections import Counter

def update_distance(d, num, N):
    minn = num
    maxx = num
    
    while True:
        if minn > 0:
            minn -= 1
        else:
            break
        if d[minn] > d[minn+1] + 1:
            d[minn] = d[minn+1] + 1
        else:
            break
    
    while True:
        if maxx < (N - 1):
            maxx += 1
        else:
            break
        if d[maxx] > d[maxx-1] + 1:
            d[maxx] = d[maxx-1] + 1
        else:
            break

(N, X, Y) = (int(i) for i in input().split())
X = X-1
Y = Y-1




d = []
for i in range(N):
    dd = []
    for j in range(N):
        dd.append(abs(i - j))
    d.append(dd)


for i in range(N):
    dd = d[i]
    dd[X] = min(dd[X], dd[Y] + 1)
    dd[Y] = min(dd[Y], dd[X] + 1)
    update_distance(dd, X, N)
    update_distance(dd, Y, N)


d_list = []
for i in range(N - 1):
    d_list += d[i][i+1:]


c = Counter(d_list)

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

Solution (Python):
N, X, Y = map(int,input().split())
X = X-1
Y = Y-1
CNT = [0]*(N)
for i in range(N):
  for j in range(i+1,N):
    nn1 = j-i
    nn2 = abs(i-X)+abs(j-Y)+1
    if nn1>nn2:
      CNT[nn2] += 1
    else:
      CNT[nn1] += 1
for i in range(1,N):
  print(CNT[i])

Solution (Python):
from heapq import heapify, heappop, heappush, heappushpop
import sys
input = sys.stdin.readline
N,X,Y=map(int, input().split())
def f(i,j):
  ret1 = abs(j-i)
  ret2 = abs(j-Y)+1+abs(i-X)
  ret3 = abs(i-Y)+1+abs(j-X)
  return min(ret1,ret2,ret3)
  
dp=[0]*N
for i in range(1,N+1):
  for j in range(i+1,N+1):
    dp[f(i,j)] += 1
for i in range(1,N):
  print(dp[i])

Solution (Python):
n, x, y = map(int, input().split())
r = (y-x+1)//2
dist = [0] * n
for i in range(1, n+1):
  for j in range(i+1, n+1):
    if i <= x:
      if j <= x:
        dist[j-i] += 1
      elif j <= y:
        dist[min(j-i, y-j+1+ x-i)] += 1
      else:
        dist[j-i-(y-x)+1] += 1
    elif i < y:
      if j <= y:
        dist[min(j-i, y-j+i-x+1)] += 1
      else:
        dist[min(j-i, i-x + 1 + j-y)] += 1
    else:
      dist[j-i] += 1
for i in range(1, n):
  print(dist[i])

Solution (Python):

import collections
from collections import defaultdict

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

skip_d = abs(X - Y)
d_count = defaultdict(lambda: 0)

for i in range(N):
    
    for j in range(N):
        if i == j:
            d = 0
            d_count[d] += 1
            
            continue
        
        min_index = min(i, j)
        max_index = max(i, j)

        if min_index <= X - 1 and Y - 1 <= max_index:
            
            d = abs(i - j) - skip_d + 1
        elif X - 1 <= min_index and max_index <= Y - 1:
            
            d_1 = abs(i - j)
            x2min = abs(min_index - (X - 1))
            max2y = abs((Y - 1) - max_index)
            d_2 = x2min + max2y + 1
            d = min(d_1, d_2)
        elif max_index <= Y - 1:
            
            
            d_1 = abs(i - j)
            max2y = abs((Y - 1) - max_index)
            min2y = abs(min_index - (Y - 1)) - skip_d + 1
            d_2 = max2y + min2y
            d = min(d_1, d_2)
        elif X - 1 <= min_index:
            
            
            d_1 = abs(i - j)
            d_2 = (abs(max_index - (X - 1)) - skip_d + 1) + abs((X - 1) - min_index)
            d = min(d_1, d_2)

        
        d_count[d] += 1
    

ans_s = []
for k in range(1, N):  
    c = d_count[k]
    c = c // 2
    ans_s.append(str(c))
ans = "\n".join(ans_s)
print(ans)

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

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,x,y = mi()

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

inf = 10 **9
date = [[inf]*n for _ in range(n)]
date[0][x-1] = x-1
date[0][y-1] = x
for i in range(1,n):
    date[0][i] = min(i,date[0][y-1] + abs(y-1-i))
for i in range(1,n):
    for k in range(i+1,n):
        if i < x:
            date[i][k] = date[i-1][k] -1
        elif i < y:
            date[i][k] = min(i-x+1 + date[x-1][k],k-i)
        else:
            date[i][k] = k-i
aaa = [0]*n
for i in range(n):
    for k in range(i+1,n):
        if date[i][k] != inf:
            aaa[date[i][k] -1] += 1
for i in range(n-1):
    print(aaa[i])

Solution (Python):
mod = 10**9 + 7

def iip(listed = False):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret

def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <=0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n-r+1, n+1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r+1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        
        pass
    return ret


def inv(n, mod):
    return power(n, mod-2)

def power(n, p):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p//2) ** 2) % mod
    if p % 2 == 1:
        return (n * power(n, p-1)) % mod



def main():
    N, X, Y = iip()
    X -= 1
    Y -= 1

    ret = 0

    result = []
    for k in range(1, N):
        ret = 0
        for i in range(N):
            ret += search(i, k, N, X, Y)
        result.append(str(ret))

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

def search(a, k, N, X, Y):
    kouho = []

    if abs(a-X)+1+abs(a+k-Y) >= k and abs(a-Y) + 1 + abs(a+k-X) >= k:
        
        kouho.append(a+k)

    asy = k-abs(a-X)-1
    if asy < 0:
        pass
    elif asy == 0:
        if abs(a-X) + 1 <= abs(a-Y):
            kouho.append(Y)
            
    else:
        if abs(a-(Y-asy)) > k:
            kouho.append(Y-asy)
            
        if abs(a-(Y+asy)) > k:
            
            kouho.append(Y+asy)

    asx = k-abs(a-Y)-1
    if asx < 0:
        pass
    elif asx == 0:
        if abs(a-Y) + 1 < abs(a-X):
            kouho.append(X)
            
    else:
        if abs(a-(X-asx)) > k:
            kouho.append(X-asx)
            
        if abs(a-(X+asx)) > k:
            kouho.append(X+asx)
            

    kakutei = []
    result = 0
    for kh in kouho:
        if kh == a:
            continue
        if kh < 0:
            continue
        if kh > N-1:
            continue
        if kh in kakutei:
            continue
        if kh < a:
            continue
        kakutei.append(kh)
        result += 1
    
    
    
    
    return result



if __name__ == "__main__":
    main()

Solution (Python):
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
import numpy as np
from collections import Counter

N, X, Y = map(int, input().split())
F = [[0 for i in range(N)] for j in range(N)]

for i in range(N - 1):
    F[i][i + 1] = 1
    F[i + 1][i] = 1
F[X - 1][Y - 1] = 1
F[Y - 1][X - 1] = 1

G = csgraph_from_dense(F, null_value=0)
d = dijkstra(G)





s = Counter(d.flatten().astype(np.int64))

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

Solution (Python):
import sys
input = sys.stdin.readline
from collections import defaultdict, Counter

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

Solution (Python):
N, X, Y = map(int,input().split())
s = Y - X - 1
t = (X+Y)/2
ans = [0] * (N)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if i >= Y:
            ans[j-i] += 1
        if i <= X:
            if j <= X:
                ans[j-i] += 1
            elif X < j and j <= Y:
                if j <= t:
                    ans[j-i] += 1
                else:
                    ans[X - i + 1 + Y - j] += 1
            elif j > Y:
                ans[X - i + 1 + j - Y] += 1
        if X < i and i < Y:
            if j < Y:
                if 2*(j-i) <= Y-X+1:
                    ans[j-i] += 1
                else:
                    ans[Y-X+1-j+i] += 1
            elif j >= Y:
                if Y - i <= i - X + 1:
                    ans[j-i] += 1
                else:
                    ans[i - X + 1 + j - Y] += 1

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

Solution (Python):
n, x, y = map(int, input().split())
x -= 1 
y -= 1
def dist(a, b):
    return min(b - a, abs(b - y) + abs(a - x) + 1)
ans = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        ans[dist(i, j)] += 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):
    if i<x:
      if j<=x:
        ans[j-i-1]+=1
      elif j<=y:
        ans[min(j-i-1,x-i+y-j)]+=1
      else:
        ans[x-i+j-y]+=1
    elif i<y:
      if j<=y:
        ans[min(j-i-1,i-x+y-j)]+=1
      else:
        ans[min(j-i-1,i-x+j-y)]+=1
    else:
        ans[j-i-1]+=1

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

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

min_diff = [[-1] * (n+1) for _ in range(n+1)]
for st in range(1, n+1):
    for go in range(st, n+1):
        min_diff[st][go] = go-st
        if x < st and go < y:
            min_diff[st][go] = min(min_diff[st][go], (st-x)+(y-go)+1)
        elif x >= st and go < y:
            min_diff[st][go] = min(min_diff[st][go], (x-st)+(y-go)+1)
        elif x < st and go >= y:
            min_diff[st][go] = min(min_diff[st][go], (st-x)+(go-y)+1)
        else:
            min_diff[st][go] = min_diff[st][go] - (y-x) + 1



ans = [0] * (n+1)
for i in range(n+1):
    for j in range(n+1):
        ans[min_diff[i][j]] += 1

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

Solution (Python):
import sys


from collections import Counter, deque, defaultdict





import math



readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n, x, y = list(map(int, readline().split()))
    x, y = x - 1, y - 1
    que = deque()
    ans = [0] * n
    loopsize = y - x + 1

    if loopsize % 2 == 1:
        for i in range(1, loopsize // 2 + 1):
            ans[i] = loopsize
    else:
        for i in range(1, loopsize // 2 + 1):
            ans[i] = loopsize
        ans[loopsize // 2] = loopsize // 2

    loopdist = [0] * n
    que.append((0, 0))
    que.append((loopsize - 1, 1))
    visited = [False] * loopsize
    visited[0] = True
    visited[-1] = True

    while que:
        cn, dist = que.popleft()
        loopdist[dist] += 1
        if not cn == 0:
            if not visited[cn - 1]:
                visited[cn - 1] = True
                que.append((cn - 1, dist + 1))
        if not cn == (loopsize - 1):
            if not visited[cn + 1]:
                visited[cn + 1] = True
                que.append((cn + 1, dist + 1))

    left = x
    right = n - y - 1

    for i in range(left):
        for j in range(loopsize // 2 + 1):
            ans[i + 1 + j] += loopdist[j]

    for i in range(1, left):
        ans[i] += left - i

    for i in range(right):
        for j in range(loopsize // 2 + 1):
            ans[i + 1 + j] += loopdist[j]

    if left > 0 and right > 0:
        for i in range(left):
            for j in range(right):
                ans[i + j + 3] += 1


    for i in range(1, right):
        ans[i] += right - i



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

if __name__ == '__main__':
    main()

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

cnt = [0]*N

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


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

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

print(n)

for i in range(2,n):
    ans=0
    if i<a+c+2: 
        ans+=a+c+2-i
    if i<(b+2)//2+a+1 and a>0: 
        if i-1<=a:
            ans+=min(i-1,(b+2)//2)*2-1
        else:
            ans+=min((b+2)//2+a-i+1,a)*2
        if i>(b+2)//2 and b%2==0:
            ans-=1
    if i<(b+2)//2+c+1 and c>0: 
        if i-1<=c:
            ans+=min(i-1,(b+2)//2)*2-1
        else:
            ans+=min((b+2)//2+c-i+1,c)*2
        if i>(b+2)//2 and b%2==0:
            ans-=1
    if i<=(b+2)//2: 
        if i==(b+2)/2:
            ans+=(b+2)//2
        else:
            ans+=b+2
    print(ans)

Solution (Python):
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,x,y=map(int,input().split())


l1=n-y-x
l2=y-x

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

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

Solution (Python):
from sys import stdin

N, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
d = {}

for k in range(1, N):
    for i in range(1, N+1-k):
        temp = min(k, (abs(i-X)+1+abs(Y-(i+k))))
        d[temp] = d.get(temp, 0)+1
        
        
        
for l in range(1, N):
    print(d.get(l, 0))

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

l = [0] * (N)

graph = [[0] * N] * N

for i in range(1, N+1):
    for j in range(i+1, N+1):
        if i < X:
            distAX = X - i
        else:
            distAX = i - X            
        if j < Y:
            distBY = Y - j
        else:
            distBY = j -Y
        distAB = j - i
        if distAX + distBY + 1 < distAB:
            distAB = distAX + distBY + 1

        l[distAB] = l[distAB] + 1

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

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

xy = y - x

ans = [0 for i in range(n)]

for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        if i == j:
            continue
        if (i <= x and j <= x) or (i >= y and j >= y):
            ans[j - i] += 1
        elif i <= x and y <= j:
            ans[j - i - xy + 1] += 1
        else:
            ans[min(j - i, abs(x - i) + abs(y - j) + 1)] += 1

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

Solution (Python):
N,X,Y = map(int,input().split())
for k in range(1,N):
    s = 0
    for i in range(1,N-k+1):
        d = abs(i - X)
        if d <= k-1:
            front = Y + k -1 -d
            back = Y - k + 1+ d
            first = i + k
            if front == back:
                if first >= front :
                    s += 1
                else:
                    s += 2
            else:
                if back - i == k:
                    if front <= N:
                        s += 2
                    else:
                        s += 1
                elif back - i > k:
                    if front <= N:
                        s += 3
                    else:
                        s += 2
                else:
                    if first >= front:
                        s += 1
                    else :
                        if front <= N:
                            s += 1
                        c = abs(Y - first)
                        if d + c + 1 >= k:
                            s += 1


        else:
            s += 1
    print(s)

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

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

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

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


def dist(a, b):
    if b < a:
        a, b = b, a
    p = b - a
    q = abs(b - y) + abs(a - x) + 1
    return min(p, q)


for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
        ans[dist(i, j)] += 1
print(*ans[1:], sep="\n")

Solution (Python):
N,X,Y = (int(x) for x in input().split())
X -=1
Y-=1
dist = [[0]*N for _ in range(N)]
for i in range(N):
  for j in range(N):
    if i >= j :
      continue
    d1 = j - i
    d2 = abs(X-i)+abs(Y-j)+1
    dist[i][j] = min(d1,d2)

cnt = [0]*(N)
for i in range(N):
  for j in range(N):
    num = dist[i][j]
    if num >0:
      cnt[num] += 1
for i in range(N-1):
  print(cnt[i+1])

Solution (Python):
import copy

N, X, Y = map(int, input().split())
def check(num, distance):
    if num!=0:
        distance[num-1]=min(distance[num]+1, distance[num-1])
    if num!=N-1:
        distance[num+1]=min(distance[num+1], distance[num]+1)
    if num==X-1:
        distance[Y-1]=min(distance[Y-1], distance[X-1]+1)
    elif num==Y-1:
        distance[X-1] = min(distance[X-1], distance[Y-1]+1)
total_answer=[]
answer=[N]*N
for k in range(N):
    temp=copy.copy(answer)
    temp[k]=0
    
    for i in range(0, N):
        check(i, temp)
        
    
    for j in range(N-1,-1,-1):
        check(j, temp)
    
    

    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)
    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)

        
    
    total_answer+=temp

import collections
dict=collections.Counter(total_answer)

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

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

tb=[[0]*(n+1) for i in xrange(n+1)]
tb[x][y]=1
for i in xrange(1, n+1):
    for j in xrange(i+1,n+1):
        if x==i and j==y:
            continue
        if i<x:
            
            tb[i][j]=min(j-i, x-i+1+abs(y-j))
        elif i>=x and i<=y:
            tb[i][j]=min(j-i, i-x+1+abs(y-j))
        else:
            tb[i][j]=j-i

res=[0]*(n+1)

for i in xrange(1 ,n+1):
    for j in xrange(i+1, n+1):
        res[tb[i][j]]+=1

s=''
for i in xrange(1, n):
    s+=str(res[i])+'\n' 



print s

Solution (Python):


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

ans=[0]*N
for n in range(N-1):
    for tgt in range(n+1,N):
        temp=min(abs(tgt-n),abs(n-X)+abs(Y-tgt)+1)
        
        ans[temp]+=1


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

Solution (Python):
n, x, y = map(int, input().split())
a = [0 for i in range(n-1)]
for ii in range(n):
	for jj in range(ii+1,n):
		i = ii+1
		j = jj+1
		if i < x and j < x:
			b = j-i
		elif i < x and j >= x and j <= y:
			b = min(j-i, y-j+1+x-i)
		elif i < x and j > y:
			b = j-i-(y-x)+1
		elif i >= x and i <= y and j >= x and j <= y:
			b = min(j-i,i-x+y-j+1)
		elif i >= x and i <= y and j > y:
			b = min(j-i,i-x+1+j-y)
		else:
			b = j-i
		
		a[b-1] += 1
for i in a:
	print (i)

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

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

for i in range(1,n+1):
    for j in range(i+1,n+1):
        if j<=x or y<i:
            num = j-i
        elif i<=x and x<j<=y:
            num = (x-i)+min(j-x, y-j+1)
        elif i<=x and y<j:
            num = (x-i)+(j-y)+1
        elif x<i and j<=y:
            num = min(j-i,(i-x)+(y-j)+1)
        elif x<i<=y and y<j:
            num = min(i-x+1, y-i)+(j-y)
        li[num-1] += 1

for i in li:
    print(i)

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

anss=[0]*(N-1)

def judge(i, j):
  
  
  
  if 1<=i and i<X:
    if 1<=j and j<X:
      return j-i
    if X<=j and j<=Y:
      
      return min(j-i, Y-j+X-i+1)
    if Y<j and j<=N:
      return j-i-(Y-X-1)
    
  if X<=i and i<=Y:
    if X<=j and j<=Y:
      return min(j-i, Y-j+i-X+1)
    if Y<j and j<=N:
      return min(j-i, i-X+j-Y+1)
    
  if Y<i and i<=N:
    return j-i

for i in range(1,N):
  for j in range(i+1, N+1):
    l=judge(i,j)
    
    anss[l-1]+=1

for a in anss:
  print(a)

Solution (Python):
n, x, y = map(int, input().split())
x -= 1
y -= 1
r = {i: 0 for i in range(1, n)}
for i in range(n - 1):
    for k in range(i + 1, n):
        if (x < i and k < y) or (x <= i and k < y) or (x < i and k <= y):
            t = min(i - x + y - k + 1, k - i)
            r[t] += 1
        elif i <= x and y <= k:
            t = k - i - (y - x - 1)
            r[t] += 1
        elif i < x < k < y:
            t = min(k - i, x - i + 1 + y - k)
            r[t] += 1
        elif x < i < y < k:
            t = min(k - i, i - x + 1 + k - y)
            r[t] += 1
        else:
            t = k - i
            r[t] += 1
for i in range(1, n):
    print(r[i])

Solution (Python):
n,x,y = map(int,input().split())
a = [0 for i in range(1,n)]
l=y-x;m= max(x-1+l//2,x+n-y)
x-=1;y-=1
for i in range(n):
  for j in range(i+1,n):
    if i+1==j:
      a[0]+=1
    else:
      k = j-i
      if i<=x and j>=y:
      	k=k-l+1
      elif i>=x and j<=y:
        k=min(k,(l+1)-k)
      elif i<=x:
        k=x-i+min((j-x),(l+1)-(j-x))
      else:
        k = j-y+min(y-i,(l+1)-(y-i))  

      a[k-1]+=1
for i in a:
  print(i)