Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))

ans=0
for i in range(1,N+1):
  ans=A.count(i)
  print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))

ans=[0]*N
for i in range(N-1):
  ans[A[i]-1]+=1

for i in range(N):
  print(ans[i])
### BUGGY CODE ###

S = input()
Q = int(input())



for i in range(Q):
    quary = input().split()
    if quary[0]=='1':
        S = S[::-1]
    else:
        if quary[1]=='1':
            S = quary[2] + S
        else:
            S = S + quary[2]

print(S)

### FIXED CODE ###

from collections import deque
S = input()
Q = int(input())
quer = [input().split() for _ in range(Q)]

hanten = 0
t = 0
d = deque(S)
for i in quer:
    quary = i
    if quary[0]=='1':
        #S = S[::-1]
        hanten = hanten ^ 1
    else:
        t = (int(quary[1])-1) ^ hanten
        if t:
            #S = S + quary[2]
            d.append(quary[2])
        else:
            #S = quary[2] + S
            d.appendleft(quary[2])
    #print(S)
if hanten:
    d.reverse()
s = ''.join(list(d))
print(s)
### BUGGY CODE ###

import heapq
from queue import PriorityQueue as PQ

def pcc(src, adj):
	pq = PQ()
	pq.put((0,src))
	dist = [float('inf')]*n
	dist[src] = 0
	while not pq.empty():
		d, u = pq.get()
		# ~ print(d,u)
		for w, v in adj[u]:
			if dist[v] > dist[u] + w:
				dist[v] = dist[u] + w
				pq.put((dist[v], v))
	return dist

n,m,s,t = map(int,input().split())
s,t = s-1,t-1
adjs = [[] for _ in range(n)]
adjt = [[] for _ in range(n)]
for _ in range(m):
	u,v,a,b = map(int, input().split())
	u,v = u-1,v-1
	adjs[u].append((a,v))
	adjs[v].append((a,u))
	adjt[u].append((b,v))
	adjt[v].append((b,u))

dist_s = pcc(s, adjs)
dist_t = pcc(t, adjt)

ans = [0]*n
ans[n-1] = 10**15 - dist_s[n-1]-dist_t[n-1]
for i in range(n-2,-1,-1):
	ans[i] = max(ans[i+1], 10**15 - dist_s[i] - dist_t[i])
print(*ans, sep = "\n")


### FIXED CODE ###

import heapq
def dijkstra(s, neighbor):
	dist = [float('inf')] * N
	dist[s] = 0
	que = [(0, s)]
	heapq.heapify(que)
	while que:
		d, v = heapq.heappop(que)
		if d > dist[v]:
			continue
		for u, l in neighbor[v]:
			tmp_d = d + l
			if tmp_d < dist[u]:
				dist[u] = tmp_d
				heapq.heappush(que, (tmp_d, u))
	return dist
 
N, M, s, t = map(int, input().split())
yen = [[] for _ in range(N)]
snuuk = [[] for _ in range(N)]
for _ in range(M):
	u, v, a, b = map(int, input().split())
	yen[u-1].append((v-1, a))
	yen[v-1].append((u-1, a))
	snuuk[u-1].append((v-1, b))
	snuuk[v-1].append((u-1, b))
 
dist_s = dijkstra(s-1, yen)
dist_t = dijkstra(t-1, snuuk)
ans = [-1] * N
tmp = float('inf')
for i in range(N-1, -1, -1):
	if dist_s[i] + dist_t[i] < tmp:
		tmp = dist_s[i] + dist_t[i]
	ans[i] = 10 ** 15 - tmp
print(*ans, sep='\n')
### BUGGY CODE ###

def main():
    n, m = map(int, input().split())
    a, b = [], []
    for _ in range(m):
        x, y = map(int, input().split())
        a.append(x)
        b.append(y)
    to_n = []
    for i in range(m):
        if b[i] == n:
            to_n.append(a[i])

    for j in range(m):
        if a[j] == 1:
            if b[j] in to_n:
                return 'POSSIBLE'
    return 'IMPOSSIBLE'


print(main())

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    a, b = [], []
    from_1 = set()
    to_n = set()
    for _ in range(m):
        x, y = map(int, input().split())
        if x == 1:
            from_1.add(y)
            continue
        if y == n:
            to_n.add(x)
            continue
    ans = from_1 & to_n
    if ans:
        return "POSSIBLE"

    return 'IMPOSSIBLE'


print(main())
### BUGGY CODE ###


K=int(input())

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
    return x

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        x=gcd(i,j)
        for k in range(1,K+1):
            ans+=gcd(x,k)
print(ans)


### FIXED CODE ###

n = int(input())
 
from math import gcd
 
y = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        x = gcd(i, j)
        for k in range(1, n+1):
            y += gcd(x,k)
 
print(y)
### BUGGY CODE ###

from collections import deque
h, w = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
maze = [[9]*(w+4)]
maze.append([9]*(w+4))
for i in range(h):
  s = input()
  tmp = [9,9]
  for i in s:
    if i == "#":
      tmp.append(9)
    else:
      tmp.append(0)
  tmp.append(9)
  tmp.append(9)
  maze.append(tmp)
maze.append([9]*(w+4))
maze.append([9]*(w+4))
#print(maze)

pos = deque()
pos.append([ch+1,cw+1,0])
while len(pos)>0:
  x, y, hop = pos.popleft()
  #print(pos)
  #print[x,y,hop)
  if (x,y) == (dh+1,dw+1):
    print(hop)
    break
  maze[x][y] = 2
  
  if maze[x-1][y] <2:
    pos.appendleft([x-1,y,hop])
    
  if maze[x+1][y] <2:
    pos.appendleft([x+1,y,hop])
    
  if maze[x][y-1] <2:
    pos.appendleft([x,y-1,hop])
    
  if maze[x][y+1] <2:
    pos.appendleft([x,y+1,hop])


  move =[(-2,0),(-2,1),(-2,2),(-2,-1),(-2,-2),(2,0),(2,1),(2,2),(2,-1),(2,-2),(0,-2),(-1,-2),(1,-2),(0,2),(-1,2),(1,2),(-1,1),(-1,-1),(1,1),(1,-1)]
  for dx,dy in move:
    if maze[x+dx][y+dy] <2:
      if ([x+dx,y+dy,hop+1] not in pos) or ([x-dx,y,hop] not in pos):
        pos.append([x+dx,y+dy,hop+1])
  
else:
  print(-1)

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
ch, cw = map(int, input().split())
dh, dw = map(int, input().split())
maze = [[9]*(w+4)]
maze.append([9]*(w+4))
for i in range(h):
  s = input()
  tmp = [9,9]
  for i in s:
    if i == "#":
      tmp.append(9)
    else:
      tmp.append(0)
  tmp.append(9)
  tmp.append(9)
  maze.append(tmp)
maze.append([9]*(w+4))
maze.append([9]*(w+4))
#print(maze)

pos = deque()
pos.append([ch+1,cw+1,0])
while len(pos)>0:
  x, y, hop = pos.popleft()
  #print(pos)
  #print[x,y,hop)
  if (x,y) == (dh+1,dw+1):
    print(hop)
    break
  maze[x][y] = 3
  
  if maze[x-1][y] <3:
    pos.appendleft([x-1,y,hop])
    maze[x-1][y] = 3  
    
  if maze[x+1][y] <3:
    pos.appendleft([x+1,y,hop])
    maze[x+1][y] = 3
    
  if maze[x][y-1] <3:
    pos.appendleft([x,y-1,hop])
    maze[x][y-1] = 3
    
  if maze[x][y+1] <3:
    pos.appendleft([x,y+1,hop])
    maze[x][y+1] = 3

  move =[(-2,0),(-2,1),(-2,2),(-2,-1),(-2,-2),(2,0),(2,1),(2,2),(2,-1),(2,-2),(0,-2),(-1,-2),(1,-2),(0,2),(-1,2),(1,2),(-1,1),(-1,-1),(1,1),(1,-1)]
  for dx,dy in move:
    if maze[x+dx][y+dy] <2:
      pos.append([x+dx,y+dy,hop+1])
      maze[x+dx][y+dy] = 2
  
else:
  print(-1)
### BUGGY CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_, k = Is()
towns = [i-1 for i in Is()]

now = 0
seen = [0]
seenx = {0: 0}

while k > 0:
  k -= 1
  now = towns[now]
  
  if now not in seen:
    seenx[now] = len(seen)
    seen.append(now)
  else:
    seen = seen[seenx[now]:]
    break

if k == 0:
  print(1 + now)
else:
  print(1 + (seen[k % len(seen)]))

### FIXED CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_, k = Is()
towns = [i-1 for i in Is()]

now = 0
seen = [0]
seenx = {0: 0}

while k > 0:
  k -= 1
  now = towns[now]
  
  if now not in seenx:
    seenx[now] = len(seen)
    seen.append(now)
  else:
    seen = seen[seenx[now]:]
    break

if k == 0:
  print(1 + now)
else:
  print(1 + (seen[k % len(seen)]))
### BUGGY CODE ###

n = int(input())
boss_list = list(map(int, input().split(" ")))

boss_list = sorted(boss_list)


for i in range(1, n+1):
    # boss_count = boss_list.count(i)
    boss_count = 0
    while (True):
        index = 0
        if boss_list[index] == i:
            boss_count += 1
        else:
            break

    del boss_list[:boss_count]
    print(boss_count)

### FIXED CODE ###

n = int(input())
boss_list = list(map(int, input().split(" ")))

boss_count_list = [0] * n


for val in boss_list:
  boss_count_list[val - 1] += 1

for val in boss_count_list:
  print(val)
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
X = []
for i in range(K,N+1):
    ans = 1
    for j in range(i-K,i):
        ans = ans*A[j]
    X.append(ans)
for i in range(N-K):
    if X[i] < X[i+1]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(K,N):
    if A[i] > A[i-K]:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))

#n=10
#a=[3, 1, 4, 1, 5, 9, 2, 6, 5, 3]
#a=[3, 14, 159, 2653, 58979, 323846, 2643383, 27950288, 419716939, 9375105820]

mod=10**9+7
asum=0
for i in range(60):
    zcnt=0
    for ii in range(n):
        asht=a[ii]>>i
        if asht&1==0:
            zcnt+=1
    tmp=(zcnt*(n-zcnt))%mod*((2**i)%mod)
    asum+=(tmp)%mod
               
asum=asum%mod
print(asum)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))

#n=10
#a=[3, 1, 4, 1, 5, 9, 2, 6, 5, 3]
#a=[3, 14, 159, 2653, 58979, 323846, 2643383, 27950288, 419716939, 9375105820]

mod=10**9+7
asum=0
for i in range(60):
    zcnt=0
    for ii in range(n):
        asht=a[ii]>>i
        if asht&1==0:
            zcnt+=1
    tmp=(zcnt*(n-zcnt))%mod*((2**i)%mod)
    asum+=(tmp)%mod
               
asum=asum%mod
print(asum)
### BUGGY CODE ###

from collections import deque

def f1(x,y,xa,ya):
    if reach[xa][ya] == -1 and c[xa][ya] == ".":
        reach[xa][ya] = reach[x][y]
        r.append([xa,ya])
        q.append([xa,ya])

def f2(x,y,xa,ya):
    if 0 <= xa <= h+1 and 0 <= ya <= w+1:
    
        if reach[xa][ya] == -1 or reach[xa][ya] > reach[x][y] + 1:
            if c[xa][ya] == ".":
                reach[xa][ya] = reach[x][y] + 1
                q.append([xa,ya])

h,w = map(int,input().split())
cx, cy = map(int,input().split())
dx, dy = map(int,input().split())

c = [0]*(h+2)
for i in range(1,h+1):
    c[i] = [0] + list(input()) + [0]
c[0]  = [0]*(w+2)
c[-1] = [0]*(w+2)

reach = [[-1 for j in range(w+2)] for i in range(h+2)]
q = deque([])

reach[cx][cy] = 0
q.append([cx,cy])

ans = 0

while q:
    x,y = q.pop()
    
    r = deque()
    r.append([x,y])
    while r:
        xx,yy = r.popleft()
        
        f1(xx,yy,xx-1,yy)
        f1(xx,yy,xx+1,yy)
        f1(xx,yy,xx,yy-1)
        f1(xx,yy,xx,yy+1)
    
    for i in range(-2,3):
        for j in range(-2,3):
            f2(x,y,x+i,y+j)
            
            if x == dx and y == dy:
                break


print(reach[dx][dy])


### FIXED CODE ###

from collections import deque
import time


def f1(x,y,xa,ya):
    if reach[xa][ya] == -1 or reach[xa][ya] > reach[x][y]:
         if c[xa][ya] == ".":
            reach[xa][ya] = reach[x][y]
            r.append([xa,ya])
            q.append([xa,ya])

            
            
def f2(x,y,xa,ya):
    if 0 <= xa <= h and 0 <= ya <= w:
    
        if reach[xa][ya] == -1 or reach[xa][ya] > reach[x][y] + 1:
            if c[xa][ya] == ".":
                reach[xa][ya] = reach[x][y] + 1
                q.append([xa,ya])

h,w = map(int,input().split())
cx, cy = map(int,input().split())
dx, dy = map(int,input().split())

t0 = time.time()

c = ["#"]*(h+2)
for i in range(1,h+1):
    c[i] = ["#"] + list(input()) + ["#"]
c[0]  = [0]*(w+2)
c[-1] = [0]*(w+2)

reach = [[-1 for j in range(w+2)] for i in range(h+2)]
q = deque([])

reach[cx][cy] = 0
q.append([cx,cy])

ans = 0

while q:
    
    if time.time() - t0 >= 1.5:
        break
    
    
    x,y = q.popleft()
    
    r = deque()
    r.append([x,y])
    while r:
        xx,yy = r.popleft()
        
        f1(xx,yy,xx-1,yy)
        f1(xx,yy,xx+1,yy)
        f1(xx,yy,xx,yy-1)
        f1(xx,yy,xx,yy+1)
    
    for i in range(-2,3):
        for j in range(-2,3):
            f2(x,y,x+i,y+j)


print(reach[dx][dy])
### BUGGY CODE ###

import itertools


def main():
    n = int(input())
    a = map(int, input().split())
    count = 0
    for i in list(itertools.combinations(a, 2)):
        count += i[0]*i[1]
    return count % (10**9+7)


if __name__ == "__main__":
    print(main())


### FIXED CODE ###

import itertools


def main():
    count = 0
    MOD = 10**9+7
    n = int(input())
    a = list(map(int, input().split()))
    s = [0]
    for i in range(n-1):
        s.append((s[i]+a[i]) % MOD)
    for ai, si in zip(a, s):
        count += (ai*si) % MOD
    return count % MOD


if __name__ == "__main__":
    print(main())
### BUGGY CODE ###

# coding: UTF-8
def solve(i, goal, A):
    # to decrese goal
    # then return boolean
    if goal == 0:
        return True
    elif i == n:
        return False
    else:
        return solve(i + 1, goal, A) or solve(i + 1, goal - A[i], A)

n = input() # parts total
A = map (int, raw_input().split()) # parts
q = input() # goal total
M = map (int, raw_input().split()) # goal

for j in range(q):
    if solve(0, M[j], A): # default
        print "yes"
    else:
        print "no"

### FIXED CODE ###

def solve(i, m):
    if m == 0:
        return True
    if n <= i or sum(A) < m:
        return False
    res = (solve(i+1, m) or solve(i+1, m-A[i]))
    return res

n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())

for m in M:
    if solve(0, m):
        print "yes"
    else:
        print "no"
### BUGGY CODE ###

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


def main():
    a = input()
    d = deque(a)
    n = int(input())
    for i in range(n):
        j = list(readline().split())
        if len(j) == 3 and j[1] == "1":
            d.appendleft(j[2])
        elif len(j) == 3 and j[1] == "2":
            d.append(j[2])
        else:
            d.reverse()
    ans = ""
    for j in d:
        ans = ans + j
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

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


def main():
    a = input()
    d = deque(a)
    n = int(input())
    flagr = 1
    for i in range(n):
        j = list(readline().split())
        if len(j) == 3 and j[1] == "1" and flagr == 1:
            d.appendleft(j[2])
        elif len(j) == 3 and j[1] == "2" and flagr == 1:
            d.append(j[2])
        elif len(j) == 3 and j[1] == "2" and flagr == -1:
            d.appendleft(j[2])
        elif len(j) == 3 and j[1] == "1" and flagr == -1:
            d.append(j[2])
        else:
            flagr *= -1
    if flagr == -1:
        d.reverse()
    ans = ""
    for j in d:
        ans = ans + j
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))  
B = [None]*N

for i in range(N):
  if all([A[v] >= A[i] for v in range(i)]): 
    B[i]=True
  else:
    B[i]=False

print(B.count(True))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))  

min = 0
cnt = 0
for i in range(N):
  if i == 0:
    cnt += 1
    min = A[i]
    continue
  if A[i] <= min:
    cnt += 1
    min = A[i]

print(cnt)
### BUGGY CODE ###

N, M = input().split()
pS = [input().split() for i in range(int(M))]
ans = {}
for i in pS:
    if i[0] not in ans.keys():
        ans[i[0]] = [0, 0]
        if i[1] == "AC":
            ans[i[0]][0] += 1
        elif i[1] == "WA":
            ans[i[0]][1] += 1
    else:
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                    ans[i[0]][0] += 1
        elif i[1] == "WA":
            if ans[i[0]][0] >= 1:
                pass
            else:
                ans[i[0]][1] += 1
ac = 0
wa = 0
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
print(ac, wa)

### FIXED CODE ###

from sys import stdin
def main(pS):
    ans = {}
    ac = 0
    wa = 0
    for i in pS:
        if i[0] not in ans.keys():
            ans[i[0]] = [0, 0] 
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                    ans[i[0]][0] += 1
                    ac += 1
                    wa += ans[i[0]][1]
        elif i[1] == "WA":
            if ans[i[0]][0] == 0:
                ans[i[0]][1] += 1
    return [ac, wa]

"""
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
"""
if __name__ == "__main__":
    N, M = input().split()
    pS = [stdin.readline().rstrip().split() for _ in range(int(M))]
    ac, wa = main(pS)
    print(ac, wa)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        sum = (sum+ A[i]*A[j])%(10**9+7)
print(sum)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
a = 0
s = 0
for i in range(N):
    a = (a+A[i])%(10**9+7)
for i in range(N-1):
    a = a-A[i]
    s = (s+A[i]*a)%(10**9+7)
print(s)
### BUGGY CODE ###

def exp(x):
  ans = 0
  for i in range(x+1):
    ans += i
  return ans / x

n, k = map(int, input().split())
p = list(map(int, input().split()))

e = []
for i in range(n):
  e.append(exp(p[i]))
  
ans = []
for i in range(n-k+1):
  sum = 0
  for j in range(k):
    sum += e[i+j]
  ans.append(sum)

print(max(ans))

### FIXED CODE ###

def exp(x):
  return (1+x) / 2

n, k = map(int, input().split())
p = list(map(int, input().split()))
  
sum = 0
for i in range(k):
  sum += exp(p[i])
max = sum

for i in range(n-k):
  sum += exp(p[i+k]) - exp(p[i])
  if max < sum:
    max = sum

print(max)
### BUGGY CODE ###

n, k = map(int,input().split())
h = list(map(int, input().split()))
c = [0 for i in range(n)]
c[0] = 0
c[1] = abs(h[1] - h[0])
# c[2] = c[0] + abs(h[2]-h[0])
# c[2] = c[1] + abs(h[2]-h[1])
# c[3] = c[1] + abs(h[3]-h[1])
# c[3] = c[2] + abs(h[3]-h[1])
for i in range(2, n):
    # c[i] = min(c[i-1]+abs(h[i]-h[i-1]), c[i-2]+abs(h[i]-h[i-2]))
    temp_min = float('inf')
    for j in range(1,k+1):
        temp_min = min(c[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(k,i)+1))
    c[i] = temp_min
print(c[-1])

### FIXED CODE ###

n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
# dp[2] = min(abs(h[2]-h[0]), dp[1]+abs(h[2]-h[1]))
# dp[3] = min((abs(h[3]-h[1])+dp[1]), abs(h[3]-h[2])+dp[2])
for i in range(2,n):
    ans = 10000000000000000000000000
    for j in range(1,k+1):
        if i-j >= 0:
            tmp = abs(h[i]-h[i-j])+dp[i-j]
            ans = min(ans,tmp)
    # dp[i] = min((abs(h[i]-h[i-2])+dp[i-2]), abs(h[i]-h[i-1])+dp[i-1])
    dp[i] = ans
print(dp[-1])
### BUGGY CODE ###

import numpy as np

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

ans = np.zeros(N-1, int)

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

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


### FIXED CODE ###

import numpy as np

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

ans = [0] * (N-1)

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

[print(ans[i]) for i in range(N - 1)]
### BUGGY CODE ###

N,M = map(int,input().split())
p = []
S = []
for i in range(M):
    p1,S1=[i for i in input().split()]
    p.append(p1)
    S.append(S1)
a = 0
b = 0
c = 0

for j in range(N):
    for k in range(M):
        if int(p[k]) == j+1:
            if S[k] == 'WA':
                b += 1
            elif S[k] == 'AC':
                a += 1
                c = b
                break
print(a,c)

### FIXED CODE ###

N,M = map(int,input().split())
P = []
S = []
for _ in range(M):
  p,s = map(str,input().split())
  P.append(int(p))
  S.append(s)
ac = ['WA']*N
wa = [0]*N

for i in range(M):
  if S[i] == 'WA':
    if ac[P[i]-1] == 'WA':
      wa[P[i]-1] += 1
  else:
    ac[P[i]-1] = 'AC'
for j in range(N):
  if ac[j] == 'WA':
    wa[j] = 0
print(ac.count('AC'),sum(wa))
### BUGGY CODE ###

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))

def check(t):
    "if the number of the pairs (i, j) that satisfies Ai * Aj <= t is < K, return True"
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            index = bisect_right(As, t//A, lo = i+1) - (i+1)
        elif A < 0:
            index = N - bisect_left(As, -(t//(-A)), lo = i+1)
        else:
            if t < 0:
                index = 0
            else:
                index = N - i - 1
        count += index
        if count > K:
            return False
    return (count < K)

m_count = 0
p_count = 0
for A in As:
    if A < 0:
        m_count += 1
    if A > 0:
        p_count += 1

if K <= m_count * p_count:
    l = - (10 ** 18 + 10)
    r = 0
elif K > N * (N-1) // 2 - p_count * (p_count-1) // 2 - m_count * (m_count-1) // 2 :
    l = 0
    r = 10 ** 18 + 10
else:
    print(0)
    exit()

while r - l > 1:
    mid = (l + r) // 2
    if check(mid):
        l = mid
    else:
        r = mid

print(r)


### FIXED CODE ###

from bisect import bisect_left, bisect_right

N, K = map(int, input().split())
As = sorted(map(int, input().split()))
        
l = - (10 ** 18 + 10)
r = 10 ** 18 + 10
while True:
    mid = (l + r) // 2
    count = 0
    for i, A in enumerate(As):
        if A > 0:
            count += bisect_right(As, mid//A, lo = i+1) - (i+1)
        elif A < 0:
            count += N - bisect_left(As, -((-mid)//A), lo = i+1)
        else:
            if mid >= 0:
                count += N - i - 1
    if count < K:
        l = mid
    else:
        r = mid
    if r - l == 1:
        break

print(r)
### BUGGY CODE ###

n=int(input())
a=[float(input()) for _ in range(n)]
cnt=[]*n
for i in a:
  x=int(i*1000000000)
  i2,i5=0,0
  while x%2==0:
    x//=2
    i2+=1
  while x%5==0:
    x//=5
    i5+=1
  cnt.append((i2,i5))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    x2,x5=cnt[i]
    y2,y5=cnt[j]
    if min(x2+y2,x5+y5)>=18:
      ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
cnt=[[0]*19 for _ in range(19)]
for i in range(n):
  a=input()
  i2,i5=0,0
  if '.' in a:
    b,c=a.split('.')
    i2-=len(c)
    i5-=len(c)
    x=int(b+c)
  else:
    x=int(a)
  while x%2==0:
    x//=2
    i2+=1
  while x%5==0:
    x//=5
    i5+=1
  i2=min(i2,9)
  i5=min(i5,9)
  cnt[i2+9][i5+9]+=1

csum=[[0]*19 for _ in range(19)]

for i in range(17,-1,-1):
  csum[i][-1]=cnt[i][-1]+csum[i+1][-1]
  
for j in range(17,-1,-1):
  csum[-1][j]=cnt[-1][j]+csum[-1][j+1]
  
for i in range(17,-1,-1):
  for j in range(17,-1,-1):
    csum[i][j]=csum[i+1][j]+csum[i][j+1]+cnt[i][j]-csum[i+1][j+1]

ans=0
for i in range(19):
  for j in range(19):
    if cnt[i][j]==0:
      continue
    i2=i-9
    i5=j-9
    x=csum[9-i2][9-i5]
    if 9-i2<=i and 9-i5<=j:
      x-=1
    ans+=x*cnt[i][j]
print(ans//2)
### BUGGY CODE ###

n = int(input())
dic = {}

for i in range(n):
    a = int(input())
    dic[i+1] = a
    
    if a==1 and max(dic.values())<=i+1:
        break
    
light = dic[1]
ans = 1

if len(dic) < n:
    ans = -1
else:
    while light != 2:
        ans += 1
        light = dic[light]
    
print(ans)

### FIXED CODE ###

n = int(input())
dic = {i+1:int(input()) for i in range(n)}
light = dic[1]
ans = 1

for i in range(n):
    if light == 2:
        break
    elif light == 1 or i == n-1:
        ans = -1
        break
    else:
        ans += 1
        light = dic[light]
    
print(ans)