TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
def bfs(linkL, chckL, nextNL, breath):
    pasNL = []
    for item in nextNL:
        chckL[item] = breath

    for item in nextNL:
        for lnkItem in linkL[item]:
            linkL[lnkItem].remove(item)
            if (chckL[lnkItem] != -1) and (lnkItem not in pasNL):
                pasNL.append(lnkItem)
        linkL[item] = []
    
    if len(pasNL) == 0:
        return chckL
    else:
        chckL = bfs(linkL, chckL, pasNL, breath+1)
        return chckL

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

lList = []

for indx in range(N):
    tmpList = []
    if indx != 0:   tmpList.append(indx-1)
    if indx != N-1: tmpList.append(indx+1)
    if indx == X-1: tmpList.append(Y-1)
    if indx == Y-1: tmpList.append(X-1)
    lList.append(tmpList)

mySum = [0] * (N-1)

for baseIndx in range(N):
    chckList = [-1] * N

    chckList = bfs(lList, chckList, [baseIndx], 0)
    chckList = chckList[baseIndx+1:N]

    for sumIndx in range(N-1):
        mySum[sumIndx] += chckList.count(sumIndx+1)

for printIndx in range(N-1):
    print(mySum[printIndx])

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

X = X-1
Y = Y-1

kDict = {}

for kIndx in range(1, N+1):
    kDict[kIndx] = 0

for jIndx in range(N):
    for iIndx in range(jIndx):
        if (jIndx <= X) or (iIndx >= Y):
            kDict[jIndx - iIndx] += 1
        elif (iIndx <= X) and (jIndx >= Y):
            kDict[(jIndx - iIndx) - (Y - X - 1)] += 1
        elif (iIndx <= X) and ((jIndx > X) and (jIndx < Y)):
            if 2 * jIndx - (X + Y) - 1 > 0:
                kDict[(jIndx - iIndx) - (2 * jIndx - (X + Y) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        elif ((iIndx > X) and (iIndx < Y)) and (jIndx >= Y):
            if (X + Y) - 2 * iIndx - 1 > 0:
                kDict[(jIndx - iIndx) - ((X + Y) - 2 * iIndx - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1
        else:
            if (2 * (jIndx - iIndx) - (Y - X) - 1) > 0:
                kDict[(jIndx - iIndx) - (2 * (jIndx - iIndx) - (Y - X) - 1)] += 1
            else:
                kDict[jIndx - iIndx] += 1

for kIndx in range(1, N):
    print(kDict[kIndx])


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, x, y = list(map(int,input().split()))
d = [0 for i in range(1,n)] 
for i in range(1,n+1):
  for j in range(1,i+1):
    d[min([j-i, abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x)])-1] += 1

for i in d:
  print(i)

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

for i in d:
  print(i)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import math
n, x, y = map(int,input().split())
num = [0 for i in range(n)]

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

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


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

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

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


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

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

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


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

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

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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-

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)
print(d)


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

#print(d_list)

for i in range(1, N):
    count = d_list.count(i)
    print(count)

# -*- coding: utf-8 -*-
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:]

#print(d_list)
c = Counter(d_list)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
a = list(map(int,input().split()))
N = a[0]
X = a[1]
Y = a[2]
ans = []
for k in range(1,N+1):
  ans[k] = N-k

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

for dist in ans:
  print(dist)
      




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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import math
import numpy

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

k = [0] * (n-1)

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

[print(p) for p in k]


import sys
import math
import numpy

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

k = [0] * (n-1)

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

[print(p) for p in k]


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from numba import njit
@nJit
def D_160():
    N, X, Y = map(int, input().split())
    count_list = [[0]*N for i in range(N)]
    for i in range(0,N):
        for j in range(i,N):
            count_list[i][j] = min(j-i,abs(X-1-i) + abs(j-(Y-1)) + 1)
    
    #print(count_list)
    count_list = sum(count_list,[])
    
    for i in range(1,N):
        print(count_list.count(i))

D_160()

import numpy as np
from numba import njit
@nJit
def D_160():
    N, X, Y = map(int, input().split())
    count_list = [[0]*N for i in range(N)]
    for i in range(0,N):
        for j in range(i,N):
            count_list[i][j] = min(j-i,abs(X-1-i) + abs(j-(Y-1)) + 1)
    
    #print(count_list)
    count_list = sum(count_list,[])
    
    for i in range(1,N):
        print(count_list.count(i))

D_160()


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

D_160()

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import queue
n,x,y = map(int,input().split())

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

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

for i in range(n-1):
    adj[i].append(i+1) 
    adj[i+1].append(i)
        
ans = [0 for _ in range(n+1)]

def bfs(start):
    inf = 1001001001
    q = queue.Queue()
    q.put(start)
    dist = [inf]*n
    dist[start] = 0
    
    while not q.empty():
        v = q.get()

        for i in adj[v]:
            if dist[i] == inf:
                dist[i] = dist[v] + 1
                q.put(i)

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

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

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

from collections import deque

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

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

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

for i in range(n-1):
    adj[i].append(i+1) 
    adj[i+1].append(i)
        
ans = [0 for _ in range(n)]

def bfs(start):
    inf = 1001001001
    q = deque()
    q.append(start)
    dist = [inf]*n
    dist[start] = 0
    
    while q:
        v = q.popleft()

        for i in adj[v]:
            if dist[i] == inf:
                dist[i] = dist[v] + 1
                q.append(i)

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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
        
        print(i, j, distAX, distBY, distAB)

        l[distAB] = l[distAB] + 1

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):

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


INF = 10**4


queue_list = []


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

for i in range(N):
    
    queue_list.append([i, 0])
    
    min_dist_list = [INF for i in range(N)] 

    
    while(len(queue_list) != 0):
        
        
        pop_data = queue_list.pop(0)

        
        if(min_dist_list[pop_data[0]] != INF):
            continue

        
        min_dist_list[pop_data[0]] = pop_data[1]

        
        if(i < pop_data[0]):
            min_e_list[pop_data[1]] += 1

        
        if(pop_data[0]+1 < N):
            queue_list.append([pop_data[0]+1, pop_data[1]+1])
        if(pop_data[0] > 0 and pop_data[0]-1 < N):
            queue_list.append([pop_data[0]-1, pop_data[1]+1])
        
        
        if(pop_data[0] == X):
            queue_list.append([Y, pop_data[1]+1])
        if(pop_data[0] == Y):
            queue_list.append([X, pop_data[1]+1])


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


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


min_dist_list = [0 for i in range(N+1)]

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,X,Y =map(int,input().split())

def solve(k):
    global N
    global X
    global Y
    count = 0
    count = N-k
    if count<0:
        count = 0
    
    for i in range(N):
        p = i+1
        if abs(X-p)+1+N-Y>=k and abs(X-p)+1<=k:
            count += 1
        if abs(X-p)+1+(Y-p)>k and  abs(X-p)+1<=k:
            count += 1
    
        
    print(count)
    
for i in range(N-1):
    solve(i+1)

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


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,x,y = map(int, input().split())

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

for a in ans:
  print(a)


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

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

for a in ans:
  print(a)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# D
N, X, Y = map(int, input().split())

X = X - 1
Y = Y - 1

x = np.zeros((N,N))
for i in range(N):
    x[i,i:] = np.array(range(N-i))
y = np.zeros((N,N))
for i in range(0, N):
    for j in range(i+1, N):
        y[i, j] = abs(i-X) + abs(j-Y) + 1

ans = np.minimum(x, y)

for i in range(1,N):
    print(np.sum(ans==i))

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

X = X - 1
Y = Y - 1

x = np.zeros((N,N),dtype=np.int)
for i in range(N):
    x[i,i:] = np.array(range(N-i))
y = np.zeros((N,N),dtype=np.int)
for i in range(0, N):
    for j in range(i+1, N):
        y[i, j] = abs(i-X) + abs(j-Y) + 1

ans = np.minimum(x, y)

count = [0]*(N)
for i in ans.reshape(-1):
    count[i]+=1

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

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

X = X - 1
Y = Y - 1

x = np.zeros((N,N),dtype=np.int)
for i in range(N):
    x[i,i:] = np.array(range(N-i))
y = np.zeros((N,N),dtype=np.int)
for i in range(0, N):
    for j in range(i+1, N):
        y[i, j] = abs(i-X) + abs(j-Y) + 1

ans = np.minimum(x, y)

count = [0]*(N)
for i in ans.reshape(-1):
    count[i]+=1

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

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

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

Verdicts: Runtime Error

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
# import itertools
# import math
# import sys

# import numpy as np

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, X, Y = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()


# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)


#     for l in tree[s]:


#             dfs(tree, l[0])
# dfs(tree, 1)


#     arr = []
#     temp = n

#         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

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

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

# import itertools
# import math
# import sys

# import numpy as np

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, X, Y = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()


# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)


#     for l in tree[s]:


#             dfs(tree, l[0])
# dfs(tree, 1)


#     arr = []
#     temp = n

#         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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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):
        
        a = abs(j - i)
        
        b = abs(i - X) + abs(j - Y) + 1
        ans[(min(a, b))] += 1
for i in ans:
    print(i)


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input().split()
n=int(s[0])
x=int(s[1])-1
y=int(s[2])-1
inf=float('inf')
map=[[0]*n for i in range(n)]
map[x][y]=1
for i in range(n):
    for j in range(i+1,n):
        print(i,j)
        print(abs(j-i), abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        map[i][j]=min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))
print(map)
for i in range(1,n):
    count=0
    for j in map:
        count+=j.count(i)
    print(count)


s = input().split()
n=int(s[0])
x=int(s[1])-1
y=int(s[2])-1
inf=float('inf')
map={}
for i in range(n):
    map[i]=0
for i in range(n):
    for j in range(i+1,n):
        map[min(abs(j-i),abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x))]+=1
for i in range(1,n):
    print(map[i])


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
n,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=lit.collections.Counter
for i in range(1,N):
  print(a[i])

import collections
N,x,y=map(int,input().split())
lit=[]
for i in range(1,N+1):
  for j in range(i+1,N+1):
     lit.append(min(abs(i-j),abs(x-j)+abs(y-i)+1,abs(y-j)+abs(x-i)+1))
a=collections.Counter(lit)
for i in range(1,N):
  print(a[i])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
NXY = list(map(int, input().split()))
N, X, Y = NXY[0], NXY[1], NXY[2]


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


dp = []
for i in range(N):
    dp.append([])
    for j in range(N):
        if j < i:
            dp[i].append(0)
        else:
            dp[i].append(j-i)

for i in range(int(N*0.5)):
    for j in range(int(N*0.5)):
        if i == 0 and j == 0:
            dp[X-1][Y-1] = 1
        else:
            dp[X-1-i][Y-1-j] = min(1+i+j, dp[X-1-i][Y-1-j])
            dp[X-1+i][Y-1-j] = min(1+i+j, dp[X-1+i][Y-1-j])
            dp[X-1-i][Y-1+j] = min(1+i+j, dp[X-1-i][Y-1+j])
            dp[X-1+i][Y-1+j] = min(1+i+j, dp[X-1+i][Y-1+j])
print(dp)
for k in range(1, N):
    print(flatten_2dim(dp).count(k))


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

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

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#include<bits/stdc++.h>



#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
using LP = pair<ll,ll>;
using P = pair<ll,int>;
ll mod = 998244353;

int main()
{
    int n, x, y;
    cin>> n >> x>>y;
    x--;y--;
    vector<int> table(n,0);
    rep(i, n) rep(j,i){
        int tmp = min(i-j, abs(x-i)+abs(y-j)+1);
        tmp = min(tmp,abs(x-j)+abs(y-i)+1);
        table[tmp]++;
    }
    repran(i, 1, n) cout << table[i] << endl;
}

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

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

N, X, Y= map(int, input().split())
l = N + X - Y + 1
for k in range(1,N):
    count = 0
    i = 1
    while i+k <= N:
        if i > X or  Y > i+k: 
            count += 1
        else:
            pass
        if i <= X and i+k >= X + 1:
            count += 1
        i +=1
    print(count)

        

N, X, Y= map(int, input().split())
for k in range(1,N):
    count = 0
    i = 1
    while i+k < N:
        if i > X or  Y > i+k: 
            count += 1
        else:
            if i+k-1 <= X:
                count += 1
        i +=1
    print(count)
        

        

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

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, X, Y = map(int, input().split())

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

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import numpy as np
N,X,Y = map(int, input().split())
cnt = np.zeros(N+1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if abs(X-i)+abs(j-Y)+1 < j-i:
            cnt[abs(X-i)+abs(j-Y)+1] += 1
        else:
            cnt[j-i] += 1
for i in range(1,N+1):
    print(int(cnt[i]))

import numpy as np
N,X,Y = map(int, input().split())
cnt = np.zeros(N+1)
for i in range(1,N+1):
    for j in range(i+1,N+1):
        if abs(X-i)+abs(j-Y)+1 < j-i:
            cnt[abs(X-i)+abs(j-Y)+1] += 1
        else:
            cnt[j-i] += 1
for i in range(1,N+1):
    print(cnt[i])

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




Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,x,y = map(int, input().split())
l = [0]*(n+1)
for i in range(1,n+1):
    for j in range(1,i):#j<i
        a = min(i-j,abs(x-j)+abs(y-i)+1)
        l[a] += 1
        print(j,i,a)
for i in range(1,n):
    print(l[i])

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n,x,y = map(int, input().split())
    costList = [0]*n

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


    for i in range(n):
        if i >0:
            print(costList[i]//2)

import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n,x,y = map(int, input().split())
    costList = [0]*n

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


    for i in range(n):
        if i >0:
            print(costList[i])

import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n,x,y = map(int, input().split())
    costList = [0]*n

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


    for i in range(n):
        if i >0:
            print(costList[i]//2)

import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    n,x,y = map(int, input().split())
    costList = [0]*n

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


    for i in range(n):
        if i >0:
            print(costList[i])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,a,b=map(int,input().split())
l=[0]*n
for i in range(n):
  for j in range(i+1,n):
    temp=min(abs(j-i),abs(x-i)+1+abs(y-j),abs(y-i)+1+abs(j-x))
    l[temp]+=1
for i in range(1,n):
  print(l[i])



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



Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,x,y = map(int,input().split())
k = [0]*(n)

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

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input = sys.stdin.readline

def main():
    N, X, Y = map(int, input().split())
    dic = {key: 0 for key in range(1, N)}
    for i in range(1, N+1):
        for j in range(1, N+1):
            if(i < j):
                key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
                dic[key] += 1
        for ans in dic.values():
            print(ans)
if __name__ == "__main__":
    main()

import sys
input = sys.stdin.readline

def main():
    N, X, Y = map(int, input().split())
    dic = {key: 0 for key in range(1, N)}
    for i in range(1, N+1):
        for j in range(1, N+1):
            if(i < j):
                key = min(abs(j - i), abs(X - i)+1+abs(j - Y),
                      abs(Y - i) + 1 + abs(j - X))
                dic[key] += 1
    for ans in dic.values():
        print(ans)

if __name__ == "__main__":
    main()

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n , x , y = map(int,input().split())
p = [[0 for i in range(j+1)] for j in range(n)]
for i in range(1,n+1):
    for j in range(1,i+1):
        p[i-1][j-1] = min(abs(i-j),abs(i-x)+1+abs(j-y),abs(j-x)+1+abs(i-y))

for i in range(1,n+1):
    ans = 0
    for j in range(n):
        ans += p[j].count(i)
    print(ans)

def warshall_floyd(d):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    
a , b , c = map(int,input().split())

n = a
w = a 

d = [[float("inf")]*n for i in range(n)] 

for i in range(n-1):
    x = i
    y = i+1
    d[x][y] = 1
    d[y][x] = 1
d[b-1][c-1] = 1
d[c-1][b-1] = 1

for i in range(n):
    d[i][i] = 0 
    
warshall_floyd(d)

for i in range(1,n):
    ans = 0
    if i >= b + a - c + 1:
        print(ans)
        continue
    for j in range(n):
        ans += def[j].count(i)
    print(ans)

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,x,y = [int(i) for i in readline().split()]

ans = [0] * n

for a in range(1, n+1):
    for b in range(a+1, n+1):
        d = b - a
        d2 = abs(X-a) + abs(Y-b) + 1
        d = d if d < d2 else d2
        ans[d] += 1

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

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
n,x,y = [int(i) for i in readline().split()]

ans = [0] * n

for a in range(1, n+1):
    for b in range(a+1, n+1):
        d = b - a
        d2 = abs(x-a) + abs(y-b) + 1
        d = d if d < d2 else d2
        ans[d] += 1

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,x,y=map(int,input().split())
#a<b
def dis(a,b):
    return min (b-a,abs(a-x)+1+abs(b-y))

# for k in range(1,n):
#   count=0
#   #i<j

#     for j in range(i+1,n+1):

#         count+=1
#   print(count)
ans=[0]*(n-1)
#i<j
for i in range(1,n):
  for j in range(i+1,n+1):
    ans[dis(i,j)-1]+=1
print(ans,sep="\n")

n,x,y=map(int,input().split())
#a<b
def dis(a,b):
  if a<=x and b<=y:
    return min(b-a,(x-a)+1+(y-b))
  elif a<=x and b>=y:
    return min(b-a,(x-a)+1+(b-y))
  if x+1<= a <=y-1:
    return min (b-a,(a-x)+1+abs(b-y))

for k in range(1,n):
  count=0
  #i<j
  for i in range(1,n+1):
    for j in range(i+1,n+1):
      if dis(i,j)==k:
        count+=1
  print(count)

n,x,y=map(int,input().split())
#a<b
def dis(a,b):
    return min (b-a,abs(a-x)+1+abs(b-y))

# for k in range(1,n):
#   count=0
#   #i<j

#     for j in range(i+1,n+1):

#         count+=1
#   print(count)
ans=[0]*(n-1)
#i<j
for i in range(1,n):
  for j in range(i+1,n+1):
    ans[dis(i,j)-1]+=1
#print(*ans,sep="\n")
print("\n".join(map(str,ans)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, x, y = input().split()
n, x, y = int(n), int(x)-1, int(y)-1
d = [[abs(i-j) for i in range(n)] for j in range(n)]
for i in range(x+1):
    for j in range(y, n):
        d[i][j] -= y-x-1
    for j in range(y-1, x+(y-x)//2, -1):
        d[i][j] = d[i][j+1]+1
for i in range(x+1, x+(y-x)//2):
    d[i][y] = d[i][x] + 1
    for j in range(y+1, n):
        d[i][j] = d[i][j-1]+1
    for j in range(y-1, x+(y-x)//2+1, -1):
        d[i][j] = d[i][j+1]+1
print(d)
apar = [0 for i in range(n)]
for i in range(n-1):
    for j in range(i+1, n):
        apar[d[i][j]] += 1
for i in range(1, n):
    print(apar[i])


n, x, y = input().split()
n, x, y = int(n), int(x)-1, int(y)-1
d = [[abs(i-j) for i in range(n)] for j in range(n)]
for i in range(x+1):
    for j in range(y, n):
        d[i][j] -= y-x-1
    for j in range(y-1, x+(y-x)//2, -1):
        d[i][j] = d[i][j+1]+1
for i in range(x+1, x+(y-x)//2):
    d[i][y] = d[i][x] + 1
    for j in range(y+1, n):
        d[i][j] = d[i][j-1]+1
    for j in range(y-1, x+(y-x)//2+(i-x), -1):
        d[i][j] = d[i][j+1]+1
apar = [0 for i in range(n)]
for i in range(n-1):
    for j in range(i+1, n):
        apar[d[i][j]] += 1
for i in range(1, n):
    print(apar[i])


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, x, y = map(int, input().split())
loop = y-x+1
line = n-y+x
l1 = x-1
l2 = n-y
print(n)
for k in range(2, n):
    ans = max(line-k+1, 0)
    if k<=loop//2:
        ans += loop
    if k-l1<=1 and k>2:
        ans += (loop//2)*2-1
    else:
        ans += max((loop//2-(k-l1)+1), 0)*2
    if k-l2<=1 and k>2:
        ans += (loop//2)*2-1
    else:
        ans += max((loop//2-(k-l2)+1), 0)*2
    print(ans)


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(i-x)+abs(j-y)+1)-1] += 1

for i in ans:
    print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,X,Y = map(int,input().split())
A = [0]*(N-1)
mi = 0
for i in range(1,N+1):
  for j in range(1,N+1):
    if i < j :
      mi = min(j-i,(abs(X-i)+abs(Y-j)+1))
      A[mi-1] += 1
      print(mi)
for i in range(N-1):
  print(A[i])

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

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

Verdicts: Wrong Answer

Accepted