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):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  if b<=x or a>=y:
    dist=b-a
    continue
  else:
    dist=min(b-a, abs(x-a)+abs(y-b)+1,abs(y-a)+abs(x-b)+1)
  dis[dist]+=1
print(*dis[1:],sep='\n')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  dist=min(b-a, abs(x-a)+abs(y-b)+1,abs(y-a)+abs(x-b)+1)
  dis[dist]+=1
print(dis)

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  dist=min(b-a, abs(x-a)+abs(y-b)+1,abs(y-a)+abs(x-b)+1)
  dis[dist]+=1
print(*dis,sep='\n')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

from itertools import combinations

n,x,y=map(int,readline().split())
dis=[0]*n
lst=list(range(1,n+1))
for a,b in combinations(lst,2):
  if b<=x or a>=y:
    dist=b-a
  else:
    dist=min(b-a, abs(x-a)+abs(y-b)+1)
  dis[dist]+=1
print(*dis[1:],sep='\n')

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, x, y = map(int, input().split())
a = [[0 for i in range(n)] for j in range(n)]
for i in range(n-1):
  for j in range(i+1, n):
    a[i][j] = j - i
for i in range(x):
  for j in range(y-1, n):
    a[i][j] = j - i - 3
for i in range(x):
  for j in range(y-2, x-1, -1):
    z = (x + y - 1 - j) - i
    if z < a[i][j]:
      a[i][j] = z
for i in range(y-2, x-1, -1):
  for j in range(y-1, n):
    z = j - (x + y - 3 - i)
    if z < a[i][j]:
      a[i][j] = z
ans = [0 for i in range(n-1)]
for i in range(n-1):
  l = i + 1
  for j in range(n):
    for k in range(n):
      if a[j][k] == l:
        ans[i] += 1
for i in ans:
  print(i)

n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  for j in range(i+1, n):
    a = l - k
    b = abs(k - x) + abs(j+1 - y) + 1
    if b < a:
      ans[b-1] += 1
    else:
      ans[a-1] += 1
for i in range(n-1):
  print(ans[i])

n, x, y = map(int, input().split())
ans = [0 for i in range(n-1)]
for i in range(n-1):
  k = i + 1
  for j in range(i+1, n):
    l = j+1
    a = l - k
    b = abs(k - x) + abs(l - y) + 1
    if b < a:
      ans[b-1] += 1
    else:
      ans[a-1] += 1
for i in range(n-1):
  print(ans[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 numpy as np

n, x, y = map(int,input().split())
ans = np.zeros(n-1, dtype=np.int)

for i in range(1,n):
    for j in range(i+1,n+1):
        if j <= x or y <= i:
            dist = j - i
        else:
            dist = j - i
            short = abs(x - i) + 1 + abs(y - j)
            if short < dist:
                dist = short
        ans[dist-1] = ans[dist-1] + 1

for k in ans:
    print(k)

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

for k in ans:
    print(k)

Verdicts: 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):
N, X, Y = map(int, input().split())

ans = [0] * (N - 1)
ans[0] = 1

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] += 1

print(ans)


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

ans = [0] * (N - 1)
ans[0] = 1

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] += 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):
n, x, y = [int(i) for i in input().split()]

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

print(*ans[1:], sep='\n')

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

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

print(*ans[1:], sep='\n')

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
from itertools import combinations
from collections import Counter

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

nodes = list(range(1, N + 1))
distance_counter = Counter()
a = Y - X - 1
p = (Y - X) // 2 + X
ans = []
for i, j in combinations(nodes, 2):
    if j - i == 1:
        continue
    if i <= X:
        if j < Y:
            jtoX = Y - j + 1 if j > p else j - X
            distance = X - i + jtoX
        else:
            distance = j - i - a
    else:
        if j < Y:
            d1 = j - i
            d2 = i - X + Y - j + 1
            distance = min(d1, d2)
        else:
            itoY = Y - i if i > p else i - X + 1
            distance = j - Y + itoY
    distance_counter[distance] += 1

for k in range(1, N):
    if k == 1:
        ans.append(str(N))
    else:
        ans.append(str(distance_counter.get(k, 0)))

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


import sys

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

nodes = list(range(1, N + 1))
ans = [0] * N
for i in range(1, N):
    for j in range(i + 2, N + 1):
        distance = min(abs(X - i) + abs(Y - j) + 1, j - i)
        ans[distance] += 1

for k in range(1, N):
    if k == 1:
        print(N)
    else:
        print(ans[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):
n,x,y = map(int,input().split())
x-=1
y-=1

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



for i in ans:
    print(i)



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

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



for i in ans[1:]:
    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):
from collections import deque
N,R1,R2 = map(int, input().split())
graph = [deque([]) for _ in range(N-1)]
count={}
for i in range(N-1):
    count[i+1] = 0


for i in range(N-1):
    if i != R1-1:
        graph[i].append(i+1)
    else:
        graph[i].append(i+1)
        graph[i].append(R2-1)

def dfs(v, counter):
    global count
    gs=[]
    for g in graph[v]:
        count[counter]+=1
        gs.append(g)
    gsm = max(gs)
    if gsm < N-1:
        dfs(gsm, counter+1)
    else:
        return

for i in range(N-1):
    dfs(i, 1)
    


N, R1, R2 = map(int, input().split())
n = R2 - R1 - 1
count={}
for m in range(N-1):
    count[m+1] = 0 
for i in range(N):
    for j in range(i+1, N):
        k = min(j-i, abs((R1-1)-i) + 1 +abs((R2-1)-j))
        count[k]+=1
for k in count.values():
    print(k)

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
sys.setrecursionlimit(10 ** 7)

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

    node = [[[] for _ in range(N)] for _ in range(N)]
    used = [[False] * N for _ in range(N)]

    for i in range(N):
        node[i][0].append(i)
        used[i][i] = True


    for k in range(1,N):
        ans = 0
        for i in range(N):
            for x in node[i][k-1]:
                if x == X-1 and (not used[i][Y -1]):
                    node[i][k].append(Y-1)
                    used[i][Y-1] = True
                    used[Y-1][i] = True
                    ans += 1

                if x == Y-1 and (not used[i][X -1]):
                    node[i][k].append(X-1)
                    used[i][X-1] = True
                    used[X-1][i] = True
                    ans += 1

                if (x - 1 >= 0 ) and (not used[i][x - 1]):
                    node[i][k].append(x - 1)
                    used[i][x - 1] = True
                    used[x-1][i] = True
                    ans += 1

                if (x + 1 < N) and (not used[i][x + 1]):
                    node[i][k].append(x + 1)
                    used[i][x + 1] = True
                    used[x+1][i] = True
                    ans += 1

        print(ans)

    for x in node:
        print(x)


if __name__ == "__main__":
    main()


import sys
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

    
    
    
    # |j - i|
    
    # |X - i| + 1 + |j - Y|
    
    # |Y - i| + 1 + |j - X|

    ans = [0] * N

    for i in range(N - 1):
        for j in range(i + 1, N):
            ij = abs(j - i)
            ixyj = abs(X - i) + 1 + abs(j - Y)
            iyxj = abs(Y - i) + 1 + abs(j - X)

            dist = min(ij, ixyj, iyxj)

            ans[dist] += 1

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


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())
dists = [0 for i in range(n)]

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

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

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

l = [0] * n


for i in range(n):
    for j in range(i+1,n):
        if i <= x and j >= y:
            a = j-i-y+x+1
            l[a-1] += 1
        else:
            a = j-i
            l[a-1] += 1

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

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

l = [0] * n


for i in range(n):
    for j in range(i+1,n):
        if i <= x and j >= y:
            a = j-i-y+x+1
            l[a] += 1
        else:
            a = j-i
            l[a] += 1

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

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

l = [0] * n


for i in range(1,n):
    for j in range(i+1,n):
        if i <= x and j >= y:
            a = j-i-y+x+1
            l[a] += 1
        else:
            a = j-i
            l[a] += 1

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

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

l = [0] * n


for i in range(n):
    for j in range(i+1,n):
        if i <= x and j >= y:
            a = j-i-y+x+1
            l[a-1] += 1
        else:
            a = j-i
            l[a-1] += 1

for i in range(0,n-1):
    print(l[i])

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

l = [0] * n


for i in range(1,n):
    for j in range(i+1,n+1):
        if j < x or i > y:
            a = j-i
            l[a] += 1
        else:
            p = j-i
            q = abs(j-y)+abs(i-x)+1
            a = min(p,q)
            l[a] +=1

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

Verdicts: 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):
array = list(map(int, input().split()))
miniDis = []
for i in range(1,array[0]):
  for j in range(i+1,array[0]+1):
    miniDis.append(min(j-i,abs(array[1]-i)+1+abs(array[2]-j)))
                     
for i in range(1,array[0]-1):
  print(miniDis.count(i))


array = list(map(int, input().split()))
miniDis = [0]*(array[0] -1)
for i in range(1,array[0]):
  for j in range(i+1,array[0]+1):
    miniDis[min(j-i,abs(array[1]-i)+1+abs(array[2]-j))-1] += 1
    
                   
                   
                   
                   
for i in range(array[0] -1):
  print(miniDis[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):
from collections import defaultdict

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

circle = y - x + 1
a = [0 for _ in range(circle)]
for i in range(1, circle // 2 + 1):
    a[i] = i
    a[-i] = i
print(a)

dists = defaultdict(int)
for i in range(n - 1):
    if i >= y:
        for j in range(i + 1, n):
            dists[j - i] += 1
    elif x < i < y:
        for j in a[:y - i + 1]:
            dists[j] += 1
        for j in range(1, n - y):
            dists[a[y - i + 1] + j - 1] += 1
    else: 
        for j in range(i + 1, x):
            dists[j] += 1
        for j in a:
            dists[x - i + j] += 1
        for j in range(1, n - y):
            dists[x - i + a[-1] + j] += 1

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


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

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


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()))
res = [0] * (n-1)
for i in range(1, N + 1):
    for j in range(1, N + 1):
        if i >= j:
            continue
        if i == X and Y == j:
            key = 1
        else:
            key = int(min(j - i, abs(X - i) + abs(Y - j) + 1))
        res[key] += 1

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


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

for i in range(1, N):
    print(res[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 numpy as np
N, X, Y = map(int, input().split())
dist = [0] * (N + 1)
cnt = [0] * (N + 1)

INF = 10**10 + 9

# d = [[INF] * N for _ in range(N)]
d = []
for i in range(N)
    
d = [j - i for i in range(N) for j in range(i, N)]
d = []
for i in range(N):
    tmp = [j - i for j in range(i, N)]
    d.append(tmp)
# d[i][j] = j - i
# d[j][i] = j - i
print('d', d)
exit()
d[X - 1][Y - 1] = 1
d[Y - 1][X - 1] = 1


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


d = warshall_floyd(d)
count = np.bincount(np.array(d).flatten(), minlength=N)
count = count[1:] // 2
print(*count, sep='\n')


import numpy as np
N, X, Y = map(int, input().split())
dist = [0] * (N + 1)
cnt = [0] * (N + 1)

d = [[abs(j - i) for j in range(N)] for i in range(N)]
d[X - 1][Y - 1] = 1
d[Y - 1][X - 1] = 1


def warshall_floyd(d):
    
    # for k in range(N):
    
    #         for j in range(N):
    #             d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    
    return [min(d[i][j], d[i][k] + d[k][j]) for k in range(N) for i in range(N) for j in range(N):]
                

d = warshall_floyd(d)
count = np.bincount(np.array(d).flatten(), minlength=N)
count = count[1:] // 2
print(*count, sep='\n')


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


def f(i, j):
    v1 = j - i
    v2 = abs(X - i) + 1 + abs(j - Y)
    v3 = abs(Y - i) + 1 + abs(j - X)
    return min(v1, v2, v3)


D = [0] * N
for i in range(1, N):
    for j in range(i + 1, N + 1):
        d = f(i, j)
        D[d] += 1

for d in D[1:]:
    print(d)


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):
n, x, y = input().split()
ans_list = []
for i in range(1, int(n)):
    for j in range(i+1, int(n)+1):
        ans_list.append(min(abs(i-j), abs(i-int(x))+1+abs(j-int(y)), abs(i-int(y))+1+abs(j-int(x))))
print(ans_list)
for i in range(1, int(n)):
    print(ans_list.count(i))

import collections

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

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

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

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

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 = [int(i) for i in input().split()]
# 0 index is 1 distance
result = [0] * (n-1)

for i in range(n-1):
	for j in range(i+1, n):
		if ((x-1) < i or j < (x-1)) and ((y-1) < i or j < (y-1)):
			dist = j - i
			result[dist-1] += 1 
		else:
			dist = min(j-i, abs(x-1-i) + 1 + abs(j-y+1), abs(i-x+1) + 1 + abs(y-1-j))
			result[dist-1] += 1
		print("a", i, j, result)

for ans in result:
	print(ans)


# TLE


	


# result = [0] * (n-1)

# for p in range(n):
# 	dist_list = [111111] * n
# 	dist = 0
# 	q.put(p)
# 	dist_list[p] = dist 
# 	while not q.empty():

# 		dist = dist_list[p]
# 		if p+1 < n: 
# 			if dist_list[p+1] > dist:
# 				dist_list[p+1] = dist
# 				q.put(p+1)
# 		if p-1 < n: 
# 			if dist_list[p-1] > dist:
# 				dist_list[p-1] = dist
# 				q.put(p-1)
# 		if p == (x-1): 
# 			if dist_list[y-1] > dist:
# 				dist_list[y-1] = dist
# 				q.put(y-1)
# 		if p == (y-1): 
# 			if dist_list[x-1] > dist:
# 				dist_list[x-1] = dist
# 				q.put(x-1)



# 			result[i-1] += 1

# for ans in result:
# 	print(ans//2)
		






n, x, y = [int(i) for i in input().split()]
# 0 index is 1 distance
result = [0] * (n-1)

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

for ans in result:
	print(ans)


# TLE


	


# result = [0] * (n-1)

# for p in range(n):
# 	dist_list = [111111] * n
# 	dist = 0
# 	q.put(p)
# 	dist_list[p] = dist 
# 	while not q.empty():

# 		dist = dist_list[p]
# 		if p+1 < n: 
# 			if dist_list[p+1] > dist:
# 				dist_list[p+1] = dist
# 				q.put(p+1)
# 		if p-1 < n: 
# 			if dist_list[p-1] > dist:
# 				dist_list[p-1] = dist
# 				q.put(p-1)
# 		if p == (x-1): 
# 			if dist_list[y-1] > dist:
# 				dist_list[y-1] = dist
# 				q.put(y-1)
# 		if p == (y-1): 
# 			if dist_list[x-1] > dist:
# 				dist_list[x-1] = dist
# 				q.put(x-1)



# 			result[i-1] += 1

# for ans in result:
# 	print(ans//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())
Z=Y-X-1
ans=0
for i in range(1,N):
  for j in range(1,N-i+1):
    if abs(j-X)+1<=i and Y-(i-abs(j-X)-1)>j+i:
      ans+=1
    if abs(j-X)+1<=i and Y<Y+i-abs(j-X)-1<N and j+i<N and Y+(i-abs(j-X)-1)>j+i:
      ans+=1
    if abs(j-X)+1<=i and Y-(i-abs(j-X)-1)<j+i:
      ans-=1
    if abs(j-X)+1<=i and Y<Y+i-abs(j-X)-1<N and j+i<N and Y+(i-abs(j-X)-1)<j+i:
      ans-=1
  ans+=(N-i)
  if ans<0:
    ans=0
  print(ans)
  ans=0

N,X,Y=map(int,input().split())
dp=[0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    dp[min(min(abs(X-i)+1,abs(Y-i))+abs(Y-j),abs(i-j))-1]+=1
for i in range(N-1):
  print(dp[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):
def main():
    n,x,y=map(int,input().split())
    dist=[0]*n
    x-=1
    y-=1
    for i in range(n-1):
        for j in range(i+1,n):
            d=j-i
            dist[min(d,abs(x-i)+abs(y-j)+1)-1]+=1
    for i in dist:
        print(i)

if __name__ == '__main__':
    main()

from collections import deque

def main():
    n,x,y=map(int,input().split())
    g=[[] for _ in range(n+1)]
    for i in range(1,n):
        g[i].append(i+1)
        g[i+1].append(i)
    g[x].append(y)
    g[y].append(x)
    
    def chk(s):
        d=[-1]*(n+1)
        a=deque()
        a.append((0,s))
        while a:
            i,j=a.popleft()
            d[j]=i
            for k in g[j]:
                if d[k]==-1 or d[k]>i+1:
                    a.append((i+1,k))
        return d

    dist=[0]*n                    
    for i in range(1,n):
        di=chk(i)
        for j in range(1,n+1):
            dist[di[j]]+=1
    for i in range(1,n):
        print(dist[i])

if __name__ == '__main__':
    main()

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

    for i in dist:
        print(i)

if __name__ == '__main__':
    main()

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())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n)] for j in range(i+1,n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        new_dist = abs(x-i)+abs(y-j)+1
        if new_dist < dist[i][j]:
            dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)


n, x, y = map(int, input().split())
edge = [[] for _ in range(n+1)]
dist = [[abs(i-j) for i in range(n+1)] for j in range(n+1)]
counter = [0 for i in range(n)]
for i in range(1, n):
    edge[i].append(i+1)
    edge[i+1].append(i)
edge[x].append(y)
edge[y].append(x)
for i in range(y+1):
    for j in range(x, n+1):
        if j > i:
            new_dist = abs(x-i)+abs(y-j)+1
            if new_dist < dist[i][j]:
                dist[i][j] = new_dist

for i in range(1, n+1):
    for num in dist[i][i+1:]:
        counter[num] += 1
# print(dist)

for num in counter[1:]:
    print(num)


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())
dist = [0] * (n-1)
x -= 1
y -= 1
for i in range(n):
  for j in range(i+1, n):
    if (i <= x and j <= x) or (x <= i <= y and x <= j <= y) or (y <= i and y <= j):
      dist[j-i] += 1
    elif i <= x and y <= j:
      dist[j-i-(y-x)+1] += 1
    elif i <= x and x <= j <= y:
      dist[x-i + min(j-x, y-j+1)] += 1
    else:
      dist[j-y + min(y-j, j-x+1)] += 1
for d in dist:
  print(d)

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

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

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

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

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):
        dist1=j-i
        dist2=abs(x-i)+abs(y-j)+1
        d=min(dist1,dist2) 
        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())


def distance(i,j):
    d = abs(i-y)+1+abs(j-x)    
    d = min(j-i, d)
    return d

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

for i in d:
    print(i)


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


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

for i in d:
    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):
from sys import stdin, stdout  

N,X,Y = [int(c) for c in input().split()]
A=[]
for i in range(1,N+1):
    A.append([0]*N)

        
res1={}
for x in range(0,N):
    for y in range(0,N):
        #print(x,y,abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1),min(abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1)))
        A[x][y]=min(abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1))
        if(x>=y):
            A[x][y]=0

for row in A:
    for y in row:
        if(y in res1):
                res1[y]=res1[y]+1
        else:
            res1[y]=1              
for ress in res1.keys():
    if(ress>0):
        print(res1[ress])


from sys import stdin, stdout  

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


res=[0]*N        
for x in range(0,N):
    for y in range(x,N):
        #print(x,y,abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1),min(abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1)))
        r=min(abs(x-y),abs(abs(X-1-x)+abs(Y-1-y)+1))
        res[r]=res[r]+1
        if(x>y):
            res[r]=res[r]-1


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

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

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

def dijkstra(s,n,w,cost):
    
    
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    
    while True:
        v = -1
        
        for i in range(n):
            if (not used[i]) and (v == -1):
               v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
               break
        used[v] = True
               
        for j in range(n):
               d[j] = min(d[j],d[v]+cost[v][j])
    return d

################################

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

##############################
cost = [[float("inf") for i in range(n)] for i in range(n)] 

for i in range(n):
  for j in range(n):
    if i+1==j or (i==x-1 and j==y-1) or i==j+1 or (i==y-1 and j==x-1):
      cost[i][j] = 1
      cost[j][i] = 1
for i in range(n):
    cost[i][i] = 0 
from collections import defaultdict
ans = [0]*(n+1)
for i in range(n):
  d = dijkstra(i,n,n,cost)
  for j in range(n)[i+1:]:
    if d[j] != float("inf"):
      ans[int(d[j])]+=1
for a in ans[1:]:
  print(a)

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

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

##############################

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

for i in range(n):
  for j in range(n):
    if i+1==j or (i==x-1 and j==y-1) or i==j+1 or (i==y-1 and j==x-1):
      d[i][j] = 1
      d[j][i] = 1
for i in range(n):
    d[i][i] = 0 
tmp = warshall_floyd(d)
from collections import defaultdict
ans = [0]*(n+1)
for i in range(n):
  for j in range(n)[i+1:]:
    ans[d[i][j]]+=1
for a in ans[1:]:
  print(a)

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

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

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


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 = [int(n) for n in input().split()]


ans = [0] * (n-1)

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

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


ans = [0] * (n-1)

for i in range(n-1):
    for j in range(i+1,n):
        a=j-i
        b=abs((y-1)-j)+abs(i-(x-1))+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):
x,y,a,b,c=map(int,input().split())
p=sorted(list(map(int,input().split())),reverse=True)[:x]
q=sorted(list(map(int,input().split())),reverse=True)[:y]
r=list(map(int,input().split()))
print(sum(sorted(p+q+r,reverse=True)[:x+y]))

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

node_num, l_connected_node, g_connected_node = [int(n) for n in input().rstrip().split()]

l_connected_node-=1
g_connected_node-=1

count=[0]*node_num

for i in range(node_num-1):
    for j in range(i+1, node_num):
        count[min(j-i, abs(i-l_connected_node)+abs(j-g_connected_node)+1)]+=1

for x in range(1, node_num):
    print(x,'jump :',count[x])

node_num, l_connected_node, g_connected_node = [int(n) for n in input().rstrip().split()]

l_connected_node-=1
g_connected_node-=1

count=[0]*node_num

for i in range(node_num-1):
    for j in range(i+1, node_num):
        count[min(j-i, abs(i-l_connected_node)+abs(j-g_connected_node)+1)]+=1

for x in range(1, node_num):
    print(count[x])


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


n,x,y=map(int,input().split())
ans=[[1000000]*n for i in range(n)]
for i in range(n-1):
    for j in range(i+1,n):
        ans[i][j]=min(j-i,abs(x-1-i)+1+abs(y-1-j))
_ans=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        _ans[ans[i][j]-1]+=1
for i in range(n-1):
    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())
l = [0]*n

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

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

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

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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n= int(input)
if n%2==0:
  print(int(n*0.5))
else:
  print(int(0.5*n)+1)

n= int(input())
if n%2==0:
  print(int(n*0.5))
else:
  print(int(0.5*n)+1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = input()
print(n // 2  + (n % 2))

n = int(input())
res = n // 2 
print(res + (res & 2))

lines = sys.stdin.readlines()

digits = int(lines[0][0])

nums = [l.split() for l in lines[1:]]
result = ['0'] * digits

digit_set = set()
for num in nums:
    num_index = int(num[0])-1
    num_value = num[1]
    if num_index in digit_set and result[num_index] != num_value:
        print(-1)
        break
    digit_set.add(num_index)
    result[num_index] = num_value
else:
    if digits > 1 and result[0] == '0':
        print(-1)
    else:
        print(''.join(result))
        

n = input()
res = n // 2 
print(res + (res & 2))

n = int(input())
print(n // 2  + (n % 2))

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
A11,A12,A13 = map(int, input().split())
A21,A22,A23 = map(int, input().split())
A31,A32,A33 = map(int, input().split())
N = int(input())
b = [int(input()) for _ in range(N)]

cnt11=0
cnt12=0
cnt13=0
cnt21=0
cnt22=0
cnt23=0
cnt31=0
cnt32=0
cnt33=0

for i in range(N):
    if b[i]==A11:
        cnt11+=1
    elif b[i]==A12:
        cnt12+=1
    elif b[i]==A13:
        cnt13+=1
    elif b[i]==A21:
        cnt21+=1
    elif b[i]==A22:
        cnt22+=1
    elif b[i]==A23:
        cnt23+=1
    elif b[i]==A31:
        cnt31+=1
    elif b[i]==A32:
        cnt32+=1
    elif b[i]==A33:
        cnt33+=1
    else:
        pass

bingo=0
if cnt11>0:
    if((cnt12>0 and cnt13>0)or(cnt22>0 and cnt33>0)or(cnt21>0 and cnt31>0)):
        bingo+=1
    else:
        pass
elif cnt12>0:
    if (cnt22>0 and cnt32>0):
        bingo+=1
    else:
        pass
elif cnt13>0:
    if((cnt22>0 and cnt31>0)or(cnt23>0 and cnt33>0)):
        bingo+=1
    else:
        pass
elif cnt21>0:
    if(cnt22>0 and cnt23>0):
        bingo+=1
    else:
        pass
elif cnt31>0:
    if(cnt32>0 and cnt33>0):
        bingo+=1
    else:
        pass
else:
    pass
if bingo>0:
    print('Yes')
else:
    print('No')

N=int(input())

if N%2==1:
	print(int(N/2)+1)
else:
	print(int(N/2))

Verdicts: Runtime Error

Accepted