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

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

cnt_max = 0
for i in range(N):
    cnt = 0
    for j in range(i, N-1):
        if masu[j] < masu[j+1]:
            break
        cnt += 1
    if cnt_max < cnt:
        cnt_max = cnt
        
print(cnt_max)

### FIXED CODE ###

N = int(input())
masu = list(map(int, input().split()))
cnt = 0
masu2 = []
for i in range(N-1):
    if masu[i] < masu[i+1]:
        masu2.append(cnt)
        cnt = 0
    else:
      cnt += 1
else:
  masu2.append(cnt)
print(max(masu2))
### BUGGY CODE ###

num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

duplicate=[x for x in set(stl) if stl.count(x) > 1]

count=0

for dup in duplicate:
    n=stl.count(dup)
    count += n*(n-1) // 2
print(count)

### FIXED CODE ###

num=int(input())
stl =[''.join(sorted(input())) for i in range(num)]

#duplicate=[x for x in set(stl) if stl.count(x) > 1]

t = {}
for i in range(num):
  if stl[i] in t:
    t[stl[i]] += 1
  else:
    t[stl[i]] = 1
print(sum(t[k] * (t[k] -1) // 2 for k in t))
### BUGGY CODE ###

import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
G = [[] for _ in range(N)]
e = []
queue = deque([])
for l in range(N-1):
    temp = list(map(int,input().split()))
    temp[0] -= 1
    temp[1] -= 1
    e.append(temp)
    G[temp[0]].append(temp[1])
    G[temp[1]].append(temp[0])
    if l == 0:
        queue.append(temp[0])
#使えない色
nuc = [[0] for _ in range(N)]
#使った色
auc = []
#答え
ans = [[0] * N for _ in range(N)]
def bfs(x):
    k = 1
    for i in G[x]:
        if ans[x][i] ==0:
            queue.append(i)
            flag = 1
            while flag:
                if k not in nuc[x]:         
                    ans[x][i] = k
                    ans[i][x] = k
                    nuc[x].append(k)
                    nuc[i].append(k)
                    if k not in auc:
                        auc.append(k)
                    flag = 0
                else:
                    k += 1
                
while len(queue) > 0:
    next_ = queue.popleft()
    bfs(next_)
print(len(auc))
for m in e:
    print(ans[m[0]][m[1]])

### FIXED CODE ###

import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
G = [[] for _ in range(N)]
ans = {}
queue = deque([])
e = []
for l in range(N-1):
    temp = list(map(int,input().split()))
    temp[0] -= 1
    temp[1] -= 1
    e.append(tuple(temp))
    ans[(temp[0],temp[1])] = 0
    ans[(temp[1],temp[0])] = 0
    G[temp[0]].append(temp[1])
    G[temp[1]].append(temp[0])
    if l == 0:
        queue.append(temp[0])
#使えない色
nuc = [[0] for _ in range(N)]
#使った色
auc = []
#答え
def bfs(x):
    k = 1
    for i in G[x]:
        if ans[(x,i)] ==0:
            queue.append(i)
            flag = 1
            while flag:
                if k not in nuc[x]:         
                    ans[(x,i)] = k
                    ans[(i,x)] = k
                    nuc[x].append(k)
                    nuc[i].append(k)
                    if k not in auc:
                        auc.append(k)
                    flag = 0
                else:
                    k += 1
                
while len(queue) > 0:
    next_ = queue.popleft()
    bfs(next_)
print(len(auc))
for m in e:
    print(ans[m])
### BUGGY CODE ###

import math

n = int(input())

for i in range(1, n+1):
  if i <= 5:
    print(0)
  else:
    cnt = 0
    for x in range(1, math.floor(math.sqrt(i-5))+1):
      for y in range(1, math.floor(math.sqrt(i-x**2-4))+1):
        for z in range(1, math.floor(math.sqrt(i-x**2-y**2-3))+1):
          if x**2 + y**2 + z**2 + x*y + y*z + z*x == i:
            cnt += 1
    print(cnt)


### FIXED CODE ###

n = int(input())

ans = [0 for _ in range(10001)]
for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1, 100):
      v = x**2 + y**2 + z**2 + x*y + y*z + z*x
      if v < 10001:
        ans[v] += 1

for i in range(n):
  print(ans[i+1])
### BUGGY CODE ###

# import numpy as np
# from collections import defaultdict
# from functools import reduce

import bisect

# s = input()
Q = int(input())
# A = list(map(int, input().split()))
# n, m, k = map(int, input().split())


As = []
A_left = 0
A_right = 0

b_sum = 0

# n = len(As)
# n is odd:
# A_left + As[n//2] + B_left
# n is even:
# A_left + B_left

for i in range(Q):
    query = list(map(int, input().split()))

    if query[0] == 1:
      a =  query[1]
      n = len(As)
      if n == 0:
        As.append(a)
      else:
        idx = bisect.bisect_left(As, a)
        if n%2 == 0: # even
          if idx < n//2:
            A_left += a
            A_left -= As[n//2-1]
          elif idx > n//2:
            A_right += a
            A_right -= As[n//2]
        else: # odd
          if idx <= n//2:
            A_left += a
            A_right += As[n//2]
          else:
            A_right += a
            A_left += As[n//2]
        bisect.insort_left(As, a)

      # print(As)
      # print(A_left)
      # print(A_right)

      b_sum += query[2]
    else:
      n = len(As)
      if n%2 == 0: #even
        print(As[n//2-1], A_right - A_left + b_sum)
      else:
        print(As[n//2], A_right - A_left + b_sum)


### FIXED CODE ###

# import numpy as np
# from collections import defaultdict
# from functools import reduce

import heapq

# s = input()
Q = int(input())
# A = list(map(int, input().split()))
# n, m, k = map(int, input().split())


A_left_sum = 0
A_left = []
A_right_sum = 0
A_right = []
A_med = None
query_size = 0
b_sum = 0

# n = len(As)
# n is odd:
# A_left + As[n//2] + B_left
# n is even:
# A_left + B_left

for i in range(Q):
    query = list(map(int, input().split()))

    if query[0] == 1:
      a =  query[1]
      if A_med is None:
        A_med = a
      else:
        if query_size%2 == 0: # even
          left_max = -A_left[0]
          right_min = A_right[0]
          if a < left_max:
            heapq.heappushpop(A_left, -a)
            A_left_sum += a - left_max
            A_med = left_max
          elif a > right_min:
            heapq.heappushpop(A_right, a)
            A_right_sum += a - right_min
            A_med = right_min
          else:
            A_med = a
        else: # odd
          if A_med <= a:
            heapq.heappush(A_left, -A_med)
            heapq.heappush(A_right, a)
            A_left_sum += A_med
            A_right_sum += a
          else:
            heapq.heappush(A_left, -a)
            heapq.heappush(A_right, A_med)
            A_right_sum += A_med
            A_left_sum += a

      # print(As)
      # print(A_left)
      # print(A_right)
      query_size += 1

      b_sum += query[2]
    else:
      if query_size%2 == 0: #even
        print(-A_left[0], A_right_sum - A_left_sum + b_sum)
      else:
        print(A_med, A_right_sum - A_left_sum + b_sum)
### BUGGY CODE ###

n,m = map(int,input().split())
a_lst = []
for i in range(m):
  a_lst.append( list(map(int,input().split())) )

ans = "IMPOSSIBLE"

start_lst = []
goal_lst = []
for a in a_lst:
  if a[0] == 1:
    start_lst.append(a[1])
  if a[1] == n:
    goal_lst.append(a[0])
    
for s in start_lst:
  if s in goal_lst:
    ans = "POSSIBLE"
    
print(ans)

### FIXED CODE ###

n,m = map(int,input().split())

start_set = set()
goal_set = set()
for i in range(m):
  s,g = map(int,input().split())
  if s == 1:
    start_set.add(g)
  if g == n:
    goal_set.add(s)    

ans = "POSSIBLE" if (start_set & goal_set) else "IMPOSSIBLE"
print(ans)
### BUGGY CODE ###

a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            for r in range(b//1000+1):
                if 10000*s+5000*t+1000*r==b and s+t+r==a:
                    print(s,t,r)
                    exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)

### FIXED CODE ###

a,b=map(int,input().split())
for s in range(b//10000+1):
    try:
        for t in range(b//5000+1):
            r=a-s-t
            if r<0:
                break
            if 10000*s+5000*t+1000*r==b and s+t+r==a:
                print(s,t,r)
                exit()
    except ZeroDivisionError:
        continue
print(-1,-1,-1)
### BUGGY CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n,k = list(map(int, input().split()))
v = [[0]*(2*k) for _ in range(2*k)]

for i in range(n):
    x,y,c = input().split()
    x = int(x)
    y = int(y)
    if c=="B":
        x += k
    x %= 2*k
    y %= 2*k
    v[x][y] += 1
#     v[x][y+2*k] += 1
#     v[x+2*k][y] += 1
#     v[x+2*k][y+2*k] += 1
def cumsum2(v):
    # v: h*wの2次元リスト
    h,w = len(v), len(v[0])
    v.insert(0, [0]*w)
    for l in v:
        l.insert(0, 0)
    for i in range(1,h+1):
        for j in range(1,w+1):
            v[i][j] = v[i-1][j] + v[i][j-1] - v[i-1][j-1] + v[i][j]
    return v
cumsum2(v)

def sub(c, i, j):
    i %= 2*k
    j %= 2*k
    l = []
    if i<=k and j<=k:
        l = [[i,i+k,j,j+k]]
    elif i>k and j<=k:
        l = [[i,2*k,j,j+k], [0,i-k,j,j+k]]
    elif i<=k and j>k:
        l = [[i,i+k,j,2*k], [i,i+k,0,j-k]]
    else:
        l = [[i,2*k,j,2*k], [0,i-k,j,2*k], [i,2*k,0,j-k], [0,i-k,0,j-k]]
    return sum((c[z][w] - c[z][y] - c[x][w] + c[x][y]) for x,z,y,w in l)
ans = -1
for i in range(2*k):
    for j in range(2*k):
        val0 = sub(v, i,j) + sub(v, i+k, j+k)
#         val0 = v[i+k][j+k]-v[i+k][j]-v[i][j+k]+v[i][j] + v[i+2*k][j+2*k]-v[i+2*k][j+k]-v[i+k][j+2*k]+v[i+k][j+k]
#         val1 = v[i+2*k][j+k]-v[i+2*k][j]-v[i+k][j+k]+v[i+k][j] + v[i+k][j+2*k]-v[i+k][j+k]-v[i][j+2*k]+v[i][j+k]
        ans = max(ans, val0)
print(ans)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n,k = list(map(int, input().split()))
v = [[0]*(2*k) for _ in range(2*k)]

for i in range(n):
    x,y,c = input().split()
    x = int(x)
    y = int(y)
    if c=="B":
        x += k
    x %= 2*k
    y %= 2*k
    v[x][y] += 1
#     v[x][y+2*k] += 1
#     v[x+2*k][y] += 1
#     v[x+2*k][y+2*k] += 1
def cumsum2(v):
    # v: h*wの2次元リスト
    h,w = len(v), len(v[0])
    v.insert(0, [0]*w)
    for l in v:
        l.insert(0, 0)
    for i in range(1,h+1):
        for j in range(1,w+1):
            v[i][j] = v[i-1][j] + v[i][j-1] - v[i-1][j-1] + v[i][j]
    return v
cumsum2(v)

def sub(c, i, j):
    i %= 2*k
    j %= 2*k
    l = []
    if i<=k and j<=k:
        l = [[i,i+k,j,j+k]]
    elif i>k and j<=k:
        l = [[i,2*k,j,j+k], [0,i-k,j,j+k]]
    elif i<=k and j>k:
        l = [[i,i+k,j,2*k], [i,i+k,0,j-k]]
    else:
        l = [[i,2*k,j,2*k], [0,i-k,j,2*k], [i,2*k,0,j-k], [0,i-k,0,j-k]]
    return sum((c[z][w] - c[z][y] - c[x][w] + c[x][y]) for x,z,y,w in l)
ans = -1
for i in range(2*k):
    for j in range(2*k-i):
        val0 = sub(v, i,j) + sub(v, i+k, j+k)
#         val0 = v[i+k][j+k]-v[i+k][j]-v[i][j+k]+v[i][j] + v[i+2*k][j+2*k]-v[i+2*k][j+k]-v[i+k][j+2*k]+v[i+k][j+k]
#         val1 = v[i+2*k][j+k]-v[i+2*k][j]-v[i+k][j+k]+v[i+k][j] + v[i+k][j+2*k]-v[i+k][j+k]-v[i][j+2*k]+v[i][j+k]
        ans = max(ans, val0)
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]

sum_temp_list = []
for i in range(len(p_list)-k+1):
    sum_temp = sum(p_list[i:i+k])
    sum_temp_list.append(sum_temp)
    
index = sum_temp_list.index(max(sum_temp_list))

kitaichi = 0
for i in range(k):
    temp_index = index + i
    kitaichi += (1+p_list[temp_index])/2
    
print(kitaichi)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
p_list = [int(i) for i in input().split()]

p_list = [0] + p_list

cum_list = []
p_sum = 0
for p in p_list:
    p_sum += p
    cum_list.append(p_sum)
    
cum_list = np.array(cum_list)
sum_list = cum_list[k:]-cum_list[:-k]
index = np.argmax(sum_list)

kitaichi = k/2 + sum_list[index]/2

print(kitaichi)
### BUGGY CODE ###

import fractions as math
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    t=1
    for i in numbers:
      t=lcm_base(t,i)
    return t
N=int(input())
A=list(map(int,input().split()))
tmp=lcm_list(set(A))
ans=0
for i in A:
  ans+=tmp//i
  ans%=(10**9+7)
print(int(ans))


### FIXED CODE ###

import fractions 
N=int(input())
A=list(map(int,input().split()))
t=A[0]
for i in range(1,N):
  t=(t*A[i])//fractions.gcd(t,A[i])
ans=0
for i in range(N):
  ans+=t//A[i]
print(ans%(10**9+7))
### BUGGY CODE ###

import collections
n=int(input())
l=[]
for i in range(1,n+1):
  cnt=0
  j=2
  ll=[]
  while j<=i**0.5:
    if i%j==0:
      i//=j
      ll.append(j)
    else:
      j+=1
  if i>i**0.5:
    ll.append(i)
  l.append(ll)
ans=0
for t in range(n):
  c=collections.Counter(l[t])
  v=c.values()
  p=1
  for vv in v:
    p*=(vv+1)
  ans+=(t+1)*p
print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
  ans+=i*(1+n//i)*(n//i)//2
print(ans)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
A = LI()

cnt = [0] * n

for i in range(n-1):
    if cnt[A[i]-1] == 0:
        cnt[A[i]-1] = A.count(A[i])

for c in cnt:
  print(c)


### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import fractions
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
A = LI()

cnt = [0] * n

sa = set(A)
csa = Counter(A)

for v in sa:
    if cnt[v-1] != 0:
        continue
    cnt[v-1] = csa[v]

for c in cnt:
  print(c)
### BUGGY CODE ###

from bisect import bisect_left, bisect_right
n = int(input())
ls = sorted(list(map(int, input().split())))
total = 0
for i in range(n):
    for j in range(i+1, n):
        b, c = ls[i], ls[j]
        lower = abs(b-c) + 0.5
        upper = b+c - 0.5
        ii = bisect_left(ls, lower)
        jj = bisect_left(ls, upper)
        cnt = jj - ii
        if i in range(ii, jj):
            cnt -= 1
        if j in range(ii, jj):
            cnt -= 1
        total += cnt
total //= 3

print(total)


### FIXED CODE ###

from bisect import bisect_left, bisect_right
n = int(input())
ls = sorted(list(map(int, input().split())))
total = 0
for i in range(n):
    for j in range(i+1, n):
        b, c = ls[i], ls[j]
        lower = abs(b-c) + 0.5
        upper = b+c - 0.5
        ii = bisect_left(ls, lower)
        jj = bisect_left(ls, upper)
        cnt = jj - ii
        if ii <= i < jj:
            cnt -= 1
        if ii <= j < jj:
            cnt -= 1
        total += cnt
total //= 3

print(total)
### BUGGY CODE ###

import bisect

n, m = map(int, input().split())
a = map(int, input().split())
a = sorted(list(a))
for _ in range(m):
    max_num = a.pop()
    bisect.insort(a, max_num // 2)
print(sum(a))


### FIXED CODE ###

class heap():
    def __init__(self, maxcom=True):
        if maxcom:
            self.compare = lambda x, y: x > y
        else:
            self.compare = lambda x, y: x < y

    def heappush(self, x, heap):
        heap.append(x)
        length = len(heap)
        pointer = length
        while True:
            if pointer == 1:
                break
            if self.compare(heap[pointer - 1], heap[(pointer >> 1) - 1]):
                heap[pointer - 1], heap[(pointer >> 1) - 1] = heap[(pointer >> 1) - 1], heap[pointer - 1]
                pointer = pointer >> 1
            else:
                break

    def heapreplace(self, function, heap):
        heap[0] = function(heap[0])
        pointer = 1
        length = len(heap)
        while True:
            if (pointer << 1) > length:
                break
            elif (pointer << 1) + 1 > length :
                if self.compare(heap[(pointer << 1) - 1], heap[pointer - 1]):
                    heap[(pointer << 1) - 1], heap[pointer - 1] = heap[pointer - 1], heap[(pointer << 1) - 1]
                else:
                    break
            else:
                if self.compare(heap[(pointer << 1) - 1], heap[pointer << 1]):
                    next_pointer = pointer << 1
                else:
                    next_pointer = (pointer << 1) + 1
                if self.compare(heap[next_pointer - 1], heap[pointer - 1]):
                    heap[next_pointer - 1], heap[pointer - 1] = heap[pointer - 1], heap[next_pointer - 1]
                    pointer=next_pointer
                else:
                    break


n, m = map(int, input().split())
a = map(int, input().split())
heapq = []
heapc=heap(True)
for i in a:
    heapc.heappush(i,heapq)
for _ in range(m):
    heapc.heapreplace(lambda x:x>>1,heapq)
print(sum(heapq))
### BUGGY CODE ###

S = list(input())
def n(S, count=0):
    S = list(S)
    for i in range(len(S)-1):
        if S[i] == "B" and S[i+1] == "W":
            S[i] = "W"
            S[i+1] = "B"
            return n(S, count+1)
    return count
print(n(S), flush=True)

### FIXED CODE ###

S = list(input())
def f(S):
    N = S.count("B")
    k = N
    i = len(S)-1
    res = 0
    while i >= 1:
        if S[i] == "B":
            k -= 1
        else:
            res += k
        i -= 1
    return res
print(f(S), flush=True)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(1,n):
  for j in range(i):
    if a[i] == a[j]:
      cnt = 1
if cnt == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if len(a) == len(set(a)):
  print("YES")
else:
  print("NO")
### BUGGY CODE ###

from heapq import *

N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]

h = []
for i in range(N):
    heappush(h, (-B[i], i))

ans = 0
while h:
    b, i = heappop(h)
    b = -b
    if b == A[i]:
        continue
    k = - (-(B[i] - max(B[i-1], B[(i+1)%N], A[i])) // (B[i-1] + B[(i+1)%N]))
    if k <= 0:
        print("-1")
        break
    B[i] -= (B[i-1] + B[(i+1)%N]) * k
    heappush(h, (-B[i], i))
    ans += k
else:
    print(ans)


### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]
B = [int(a) for a in input().split()]
if N > 10000:
    A = A[5050:] + A[:5050]
    B = B[5050:] + B[:5050]
ans = -1

D = [0] * N
L = [i-1 for i in range(N)]
R = [i+1 for i in range(N)]

def calc():
    i = 0
    c = 0
    ans = 0
    while c < N:
        while i < N:
            if B[i] == A[i]:
                if D[i] == 0:
                    c += 1
                    D[i] = 1
                if L[i] >= 0: R[L[i]] = R[i]
                if R[i] < N: L[R[i]] = L[i]
            if B[i] > A[i] and B[i] >= max(B[i-1], B[(i+1)%N]):
                k = - (-(B[i] - max(B[i-1], B[(i+1)%N], A[i])) // (B[i-1] + B[(i+1)%N]))
                B[i] -= (B[i-1] + B[(i+1)%N]) * k
                ans += k
                if k <= 0:
                    return -1
            i = R[i]
        i = N-1
        while i >= 0:
            if B[i] == A[i]:
                if D[i] == 0:
                    c += 1
                    D[i] = 1
                if L[i] >= 0: R[L[i]] = R[i]
                if R[i] < N: L[R[i]] = L[i]
            if B[i] > A[i] and B[i] >= max(B[i-1], B[(i+1)%N]):
                k = - (-(B[i] - max(B[i-1], B[(i+1)%N], A[i])) // (B[i-1] + B[(i+1)%N]))
                B[i] -= (B[i-1] + B[(i+1)%N]) * k
                ans += k
                if k <= 0:
                    return -1
            i = L[i]
    return ans

print(calc())
### BUGGY CODE ###

n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
for i in range(n-2):
    t = i+1
    while 2*t-i <= n-1:
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
        t += 1
print(res)

### FIXED CODE ###

n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
k = n//2
for i in range(n-2):
    for t in range(i+1,((n-1+i)//2)+1):
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
print(res)
### BUGGY CODE ###

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

def bfs(start):
    queue = [[start,0]]
    isNotSearched = [False]*(n+1)
    
    while(len(queue)>0):
        i,cnt = queue.pop(0)
        
        if(isNotSearched[i]):
            continue
        
        isNotSearched[i]=True
        
        cnt_l[cnt]+=1
        pre = (i-1)
        nex = (i+1)
        if(i==x):
            queue.append([y,cnt+1])
        if(i==y):
            queue.append([x,cnt+1])
        if(pre>=1):
            queue.append([pre,cnt+1])
        if(nex<=n):
            queue.append([nex,cnt+1])
            
        

        
for i in range(1,n+1):
    bfs(i)


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


### FIXED CODE ###

n,x,y = map(int,input().split())
cnt_l = [0]*n
from collections import deque
def bfs(start):
    queue = deque()
    queue.append(start)
    isSearched = [-1]*(n+1)
    isSearched[start] = 0
    while(len(queue)>0):
        i = queue.popleft()
        cnt = isSearched[i]
        if(i==x):
            nex_l = (i-1,y,i+1)
        elif(i==y):
            nex_l = (i-1,x,i+1)
        else:
            nex_l = (i-1,i+1)

        cnt += 1
        for j in nex_l:
            if(j < 1 or n < j):
                continue
            if(isSearched[j]!=-1):
                continue
            queue.append(j)
            isSearched[j] = cnt
            cnt_l[cnt] += 1
            
        
 
        
for i in range(1,n+1):
    bfs(i)
 
 
for i in range(1,n):
    print(cnt_l[i]//2)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())

E = [[] for _ in range(N + 1)]
X = [0 for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)

for _ in range(Q):
    p, x = map(int, input().split())
    X[p] += x

visited = [False for _ in range(N + 1)]
visited[1] = True


def add(i, val):
    X[i] += val
    for to in E[i]:
        if visited[to]:
            continue
        visited[to] = True
        add(to, X[i])


add(1, 0)

print(*X[1:])


### FIXED CODE ###

import sys

N, Q = map(int, input().split())

E = [[] for _ in range(N + 1)]
X = [0 for _ in range(N + 1)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)

for _ in range(Q):
    p, x = map(int, input().split())
    X[p] += x

stack = [1]
visited = [False for _ in range(N + 1)]
visited[1] = True

while stack:
    i = stack.pop()
    for j in E[i]:
        if visited[j]:
            continue
        visited[j] = True
        stack.append(j)
        X[j] += X[i]

print(*X[1:])