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

n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
t = {}
t[0] = w
for i in range(n):
  keys = list(sorted(t.keys(), reverse = True)) # sort しないと品物iを複数回ナップサックに詰める可能性がある
  tw, tv = d[i]
  for j in keys:
    nw = t[j] - tw
    if nw < 0:
      continue
    nv = j + tv
    if nv in t:
      if nw > t[nv]:
        t[nv] = nw
    else:
      t[nv] = nw
print(max(t.keys()))

### FIXED CODE ###

n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
t = {}
t[w] = 0
for i in range(n):
  keys = list(sorted(t.keys()))
  tw, tv = d[i]
  for j in keys:
    nw = j - tw
    if nw < 0:
      continue
    nv = t[j] + tv
    if nw in t:
      if nv > t[nw]:
        t[nw] = nv
    else:
      t[nw] = nv
print(max(t.values()))
### BUGGY CODE ###

n=int(input())
l=sorted(list(map(int,input().split())))
cnt=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i]<l[j]+l[k] and l[j]<l[k]+l[i] and l[k]<l[i]+l[j]:
        cnt+=1
#        print(l[i],l[j],l[k])
print(cnt)
    

### FIXED CODE ###

import bisect
N=int(input())
d=sorted(list(map(int,input().split())))
cnt=0
for i in range(N-1,1,-1):
  for j in range(i-1,0,-1):
    k=bisect.bisect_right(d,d[i]-d[j])
    if j-k>0:
      cnt+=j-k
print(cnt)
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
dist_matrix = [[-1] * W for i in range(H)]
#queue = []
queue = deque()
for i in range(H):
  line = input()
  for j,ch in enumerate(line):
    if ch == "#":
      dist_matrix[i][j] = 0
      queue.append([i,j])

#cnt = 0
#print(queue)
max_value = 0
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  i,j = queue.popleft()
  max_value = dist_matrix[i][j]
  #cnt += 1
  if i > 0 and dist_matrix[i-1][j] == -1:
    dist_matrix[i-1][j] = max_value + 1
    queue.append([i-1,j])
  if i < H-1 and dist_matrix[i+1][j] == -1:
    dist_matrix[i+1][j] = max_value + 1
    queue.append([i+1,j])
  if j > 0 and dist_matrix[i][j-1] == -1:
    dist_matrix[i][j-1] = max_value + 1
    queue.append([i,j-1])
  if j < W-1 and dist_matrix[i][j+1] == -1:
    dist_matrix[i][j+1] = max_value + 1
    queue.append([i,j+1])

#print(cnt)
#print(dist_matrix)
print(max_value)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
 
H, W = map(int, input().split())
mark_matrix = [[True]*(W+2)]
#mark_matrix.extend([[True]+[False]*(W)+[True] for _ in range(H)])
mark_matrix.extend([[True]+[x!='.' for x in input()] for _ in range(H)])
mark_matrix[H].append(True)
mark_matrix.append([True]*(W+2))
#queue = []
queue = deque()
for i in range(1,H+1):
  for j in range(1,W+1):
    if mark_matrix[i][j]:
      queue.append((i,j))
#  line = input()
#  for j,ch in enumerate(line):
#    if ch == "#":
#      mark_matrix[i+1][j+1] = True
#      queue.append((i+1,j+1))
#for i in range(1,H+1):
#  mark_matrix[i][0] = True
#  mark_matrix[i][W+1] = True
#for j in range(W+2):
#  mark_matrix[0][j] = True
#  mark_matrix[H+1][j] = True
#print(mark_matrix)
 
#cnt = 0
#print(queue)
max_value = 0
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  new_queue = deque()
  for i,j in queue:
  
    if not mark_matrix[i-1][j]:
      mark_matrix[i-1][j] = True
      #queue.append((i-1,j))
      new_queue.append((i-1,j))
    if not mark_matrix[i+1][j]:
      mark_matrix[i+1][j] = True
      #queue.append((i+1,j))
      new_queue.append((i+1,j))
    if not mark_matrix[i][j-1]:
      mark_matrix[i][j-1] = True
      #queue.append((i,j-1))
      new_queue.append((i,j-1))
    if not mark_matrix[i][j+1]:
      mark_matrix[i][j+1] = True
      #queue.append((i,j+1))
      new_queue.append((i,j+1))
 
  if len(new_queue) == 0:
    break
  else:
    queue = new_queue
    max_value += 1
  
#print(cnt)
#print(dist_matrix)
print(max_value)
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()
A = []
B = []
for i in range(Q):
  l,r = map(int,input().split())
  A.append((l-1,r-1))
for el in A:
  res = 0
  m,n = el
  i = 0
  while True:
    if m + i + 2 > n+1:
      break
    if S[m+i:m+i+2] == 'AC':
      res += 1
    i += 1    
  print(res)

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
t = [0] * (N+1)
for i in range(N):
  t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
  l,r = map(int,input().split())
  print(t[r-1]-t[l-1])
### BUGGY CODE ###

n,m=map(int,input().split())
x=[int(input()) for _ in range(m)]
f=[0]*(n+1)
f[0]=1
for i in range(1,n+1):
  f[i]=f[i-1]+f[i-2]
  if i in x:
    f[i]=0
print(f[n]%(10**9+7))

### FIXED CODE ###

n,m=map(int,input().split())
x=set([int(input()) for _ in range(m)])
f=[0]*(n+1)
f[0]=1
for i in range(1,n+1):
  f[i]=f[i-1]+f[i-2]
  if i in x:
    f[i]=0
print(f[n]%(10**9+7))
### BUGGY CODE ###

n = int(input())
s = []
ans = 0
for i in range(n):
    s_str = list(input())
    s_str.sort()
    u="".join(s_str)
    s+=[u]
for i in range(n):
    for j in range(i + 1, n):
        if s[i] == s[j]:
            ans+=1
print(ans)


### FIXED CODE ###

import collections
n = int(input())
s = []
ans = 0
for i in range(n):
    s_str = list(input())
    s_str.sort()
    u="".join(s_str)
    s+=[u]
c = collections.Counter(s)
for i in c.values():
    if i > 1:
        p=0
        for o in range(i):
            p += o
        ans+=p
print(ans)
### BUGGY CODE ###

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

cnt = [0]*N

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


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


### FIXED CODE ###

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

cnt = [0]*N

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


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

N,K=map(int, input().split())
stopf = True
def exchangeK():
    global stopf
    global N
    if N > abs(N-K):
        N = abs(N-K)
    else:
        stopf = False
while stopf:
    exchangeK()
print(N)

### FIXED CODE ###

N,K=map(int, input().split())
stopf = True
wari = N // K
N = N - K*wari
def exchangeK():
    global stopf
    global N
    if N > abs(N-K):
        N = abs(N-K)
    else:
        stopf = False
while stopf:
    exchangeK()
print(N)
### BUGGY CODE ###

def ABcosts(A, B):
    mincos = 100000
    for i in A:
        for j in B:
            if mincos > i + j:
                mincos = i + j
    return mincos

A, B, M = map(int,input().split())

refredge = list(map(int, input().split()))
microwave = list(map(int, input().split()))

discounts = []
costs = []
for i in range(M):
    dis = list(map(int, input().split()))
    cos = (refredge[dis[0]-1] + microwave[dis[1]-1] - dis[2])
    costs.append(cos)
    discounts.append(dis)
abcost = ABcosts(refredge, microwave)
print(min(min(costs), abcost))


### FIXED CODE ###

A, B, M = map(int,input().split())

refredge = list(map(int, input().split()))
microwave = list(map(int, input().split()))

costs = []
for i in range(M):
    dis = list(map(int, input().split()))
    cos = (refredge[dis[0]-1] + microwave[dis[1]-1] - dis[2])
    costs.append(cos)
abcost = min(refredge) + min(microwave)
print(min(min(costs), abcost))
### BUGGY CODE ###

S = input()
L = len(S)
from collections import defaultdict

mod = 2019
t = 0
dic = defaultdict(int)
ans = 0
for l in range(L+1):
    t += pow(10, l)*int(S[-l])
    i = t%mod
    ans += dic[i]
    dic[i] += 1

print(ans)

### FIXED CODE ###

S = list(input())[::-1]
L = len(S)
from collections import defaultdict

mod = 2019
t = 0
dic = defaultdict(int)
ans = 0
for l in range(L):
    t += pow(10, l, mod)*int(S[l])%mod
    t %= mod
    ans += dic[t]
    dic[t] += 1
    if t==0:
        ans += 1

print(ans)
### BUGGY CODE ###

N, M, Q = list(map(int, input().split(' ')))
LR = []
for i in range(M):
    l, r = list(map(int, input().split(' ')))
    LR.append((l, r))
pq = []
for i in range(Q):
    p, q = list(map(int, input().split(' ')))
    pq.append((p, q))

for p, q in pq:
    print(sum([(p <= l and r <= q) for l, r in LR]))

### FIXED CODE ###

N, M, Q = list(map(int, input().split(' ')))
st_ed = {}
for i in range(M):
    l, r = list(map(int, input().split(' ')))
    st_ed[(l, r)] = st_ed.get((l, r), 0) + 1

memo_g = {}
def g(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_g:
        memo_g[(p, q)] = st_ed.get((p, q), 0) + g(p + 1, q)
    return memo_g[(p, q)]

memo_f = {}
# memo[(p, q)] = memo[(p, q-1)] + sum([st_ed.get((i, q), 0) for i in [1,2,3...p]])
def f(p, q):
    if p == q:
        return st_ed.get((p, q), 0)
    if not (p, q) in memo_f:
        temp = f(p, q - 1) + g(p, q)
        memo_f[(p, q)] = temp
    return memo_f[(p, q)]

memo = {}
for i in range(Q):  # 1e5
    p, q = list(map(int, input().split(' ')))
    if not (p, q) in memo:
        temp = f(p, q)
        memo[(p, q)] = temp
    print(memo[(p, q)])
### BUGGY CODE ###

k = int(input())
if k%2==0 or k%5==0:
    print(-1)
else:
    res = 7
    i = 1
    while True:
        if res%k==0:
            print(i)
        res *= 10
        res += 7
        res %= k
        i += 1

### FIXED CODE ###

k = int(input())
a = 7
for i in range(1, 10**6):
    if a%k == 0:
        print(i)
        exit()
    a = (a*10+7)%k
print(-1)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

### TESTCASE
test = ""
#test = \
"""
4 6
#..#..
.....#
....#.
#.#...
ans 8
"""

"""
8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#
ans 13
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN

h, w = map(int, input2().split())
s = [["#"] * (w+1)]
s += [list("#" + input2()) for _ in range(h)]

ws = [[0] * (w+1) for _ in range(h+1)]
hs = [[0] * (w+1) for _ in range(h+1)]

for hi in range(1, h+1):
    for wi in range(1, w+1):
        if s[hi][wi] == ".":
            ws[hi][wi] = ws[hi][wi-1] + 1
            hs[hi][wi] = hs[hi-1][wi] + 1

for hi in range(1, h+1):
    for wi in range(w-1, 0, -1):
        if ws[hi][wi]:
            ws[hi][wi] = max(ws[hi][wi+1], ws[hi][wi])
            
for wi in range(1, w+1):
    for hi in range(h-1, 0, -1):
        if hs[hi][wi]:
            hs[hi][wi] = max(hs[hi+1][wi], hs[hi][wi])           

print(max([ws[hi][wi] + hs[hi][wi] 
for hi in range(1, h+1) 
for wi in range(1, w+1)]) - 1)



### FIXED CODE ###

# -*- coding: utf-8 -*-

import numpy as np

### TESTCASE
test = ""
#test = \
"""
4 6
#..#..
.....#
....#.
#.#...
ans 8
"""

"""
8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#
ans 13
"""
############
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
####### MAIN

h, w = map(int, input2().split())
s = [["#"] * (w+1)]
s += [list("#" + input2()) for _ in range(h)]
s = np.array(s)

hs = np.zeros((h+1, w+1), dtype="int64")
ws = np.zeros((h+1, w+1), dtype="int64")

for hi in range(1, h+1):
    htmp = np.array(s[hi] == ".", dtype="int")
    hs[hi] = hs[hi-1] * htmp + htmp
    
for hj in range(h-1, 0, -1):
    hs[hj] = np.maximum(hs[hj], np.minimum(hs[hj+1], hs[hj] * hs[hj+1]))
    
for wi in range(1, w+1):
    wtmp = np.array(s[:, wi] == ".", dtype="int")
    ws[:, wi] = ws[:, wi-1] * wtmp + wtmp
    
for wj in range(w-1, 0, -1):
    ws[:, wj] = np.maximum(ws[:, wj], 
      np.minimum(ws[:, wj+1], ws[:, wj] * ws[:, wj+1]))
    
print(np.max(ws + hs) - 1)
### BUGGY CODE ###

N, M = map(int, input().split())
O = list(map(int, input().split()))
B = [[0 for i in range(N)] for j in range (N)]
 
for j in range(M):
  o_1, o_2 = map(int, input().split())
  B[o_1-1][o_2-1] = 1
  B[o_2-1][o_1-1] = 1
  
ans = 0
for k in range(N):
  flag =1
  for l in range(N):
    if B[k][l] == 1 and O[k] <= O[l]:
      flag = 0
      break
    else:
      continue
  if  flag ==1:
    ans += 1
print(ans)
      

### FIXED CODE ###

N, M = map(int, input().split())
O = list(map(int, input().split()))
B = [[] for i in range(N)]
 
for j in range(M):
  o_1, o_2 = map(int, input().split())
  B[o_1-1].append(o_2-1)
  B[o_2-1].append(o_1-1)

ans = 0
for node in range(N):
  flag =1
  for l in B[node]:
    if O[node] <= O[l]:
      flag = 0
  if  flag ==1:
    ans += 1
print(ans)
### BUGGY CODE ###

from collections import Counter, defaultdict

N = int(input())
X = input()

def f(n):
    init = n
    cnt = 0
    while n != 0:
        n %= Counter(bin(n))['1']
        cnt += 1
    return cnt

for i in range(N):
    if X[i] == '1':
        tmp = - (1<<(N-i-1))
        n = int(X, 2) + tmp
    else:
        tmp = (1<<(N-i-1))
        n = int(X, 2) + tmp
    print(f(n))

### FIXED CODE ###

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


def pop_cnt(n):
    return bin(n).count('1')


def f(n):
    cnt = 0
    while n != 0:
        n = n % pop_cnt(n)
        cnt += 1
    return cnt
 
n = int(readline())
x2 = list(readline().decode().rstrip())
x10 = int(''.join(x2), 2)

c = x2.count('1')
mod1 = x10 % (c + 1)
mod2 = x10 % (c - 1) if c-1 != 0 else 0

for i in range(n):
    ans = 0
    if x2[i] == '0':
        t = (mod1 + pow(2, n-i-1, c+1)) % (c+1)
    else:
        if c-1 != 0:
            t = (mod2 - pow(2, n-i-1, c-1)) % (c-1)
        else:
            print(0)
            continue
    
    ans = f(t) + 1
    print(ans)
### BUGGY CODE ###

import sys

import numpy as np

readline = sys.stdin.buffer.readline


# 同じ数値が複数あるとおかしくなる
def binary_search(A, n, p):
    if p == "+":
        n += 0.5
    else:
        n -= 0.5

    left = 0
    right = len(A) - 1

    if n < A[0]:
        return 0
    else:
        while left <= right:
            mid = (left + right) // 2
            if A[mid] < n:
                left = mid + 1
            else:
                right = mid - 1

        return left


def main():
    N = int(readline())
    A = np.array(list(map(int, readline().split())))
    B = np.array(list(map(int, readline().split())))
    C = np.array(list(map(int, readline().split())))

    A, B, C = np.sort(A), np.sort(B), np.sort(C)

    cnt = 0
    for i, b in enumerate(B):
        ab = binary_search(A, b, "-")
        bc = N - binary_search(C, b, "+")
        cnt += ab * bc

    print(cnt)


main()


### FIXED CODE ###

import sys

readline = sys.stdin.buffer.readline


def binary_search(A, n, p):
    if p == "+":
        n += 0.5
    else:
        n -= 0.5

    left = 0
    right = len(A) - 1

    if n < A[0]:
        return 0
    else:
        while left <= right:
            mid = (left + right) // 2
            if A[mid] < n:
                left = mid + 1
            else:
                right = mid - 1

        return left


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    A, B, C = sorted(A), sorted(B), sorted(C)

    cnt = 0
    for i, b in enumerate(B):
        ab = binary_search(A, b, "-")
        bc = N - binary_search(C, b, "+")
        cnt += ab * bc

    print(cnt)


main()
### BUGGY CODE ###

import fractions

A, B = map(int, input().split())

# 1は絶対入る
cd = [1]
answer = 1
for i in range(2, min(A, B)):
    if A%i == 0 and B%i == 0:
        for j in cd:
            if fractions.gcd(i, j) != 1:
                break
        else:
            cd.append(i)
            answer += 1
            
print(answer)

### FIXED CODE ###

import fractions

A, B = map(int, input().split())

GCD = fractions.gcd(A, B)

def pf(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

print(len(set(pf(GCD))) + 1)
### BUGGY CODE ###

N = int(input())
S = input()
List = [0 for x in range(0,N)]
answer = N

for x in range(0,N):
    a = S[:x]
    if not x == N-1:
        b = S[x+1:]
    anum = a.count('W')
    bnum = b.count('E')
    num = anum + bnum
    answer = min(answer,num)

print(answer)

### FIXED CODE ###

N = int(input())
S = input()
answer = S.count('E')
if S[0] =='E':
    test = S.count('E') - 1
else:
    test = S.count('E')

for x in range(0,N-1):
    if S[x] == 'W':
        test += 1
    if S[x+1] =='E':
        test -= 1
    answer = min (answer,test)

print(answer)
### BUGGY CODE ###

a=int(input())
l=list(map(int,input().split()))
b=int(input())
initial_sum=sum(l)
for _ in range(b):
  l1=list(map(int,input().split()))
  x=l1[0]
  y=l1[1]
  z=l.count(l1[0])
  for i in range(len(l)):
    if l[i] ==l1[0]:
      l[i]=l1[1]
  initial_sum+=(y-x)*z
  print(initial_sum)

### FIXED CODE ###

from collections import Counter
a=int(input())
l=list(map(int,input().split()))
b=int(input())
s=Counter(l)
initial_sum=sum(l)

for _ in range(b):
  x,y=map(int,input().split())
  k=s[x]
  s[x]=0
  s[y]+=k
  initial_sum+=(y-x)*k
  print(initial_sum)
### BUGGY CODE ###

k = int(input())
x = 0
ans = -1
if k % 2 == 1:
    for i in range(10**7):
        x = (x + 7 * pow(10, i, k)) % k
        if x == 0:
            ans = i + 1
            break
print(ans)

### FIXED CODE ###

k = int(input())
x = 0
ans = -1
if k % 2 == 1:
    for i in range(10**6):
        x = (x + 7 * pow(10, i, k)) % k
        if x == 0:
            ans = i + 1
            break
print(ans)
### BUGGY CODE ###

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

for i in range(n):
    b = a.count(i+1)
    print(b)
    


### FIXED CODE ###

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

lis = [0] * n
for i in A:
  lis[i-1] += 1

for j in range(len(lis)):
  print(lis[j])
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [10**9]*n
dp[0] = 0
for i in range(1,n):
    for j in range(1, k+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j]))
print(dp[n-1])

### FIXED CODE ###

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

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

#print(n,q)
edge = []
for i in range(n-1):
    a = list(map(int, input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int, input().split()))
    add_list.append(p)

#print(edge,add_list)


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

for e in edge:
    dir_edge[e[0]-1].append(e[1]-1)
    dir_edge[e[1]-1].append(e[0]-1)
#print(dir_edge)


add_value = [0]*n
for v in add_list:
    add_value[v[0]-1] += v[1]
#print(add_value)


dp = [-1] * n

def dfs(index, parent,value):
    if (dp[index] != -1):
        return dp[index]
    value += add_value[index]
    dp[index] = value
    for i in dir_edge[index]:
        if (parent == i):
            continue
        dfs(i,index,value)
        

dfs(0, -1, 0)
print(*dp)

### FIXED CODE ###

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

#print(n,q)
edge=[]
for i in range(n-1):
    a = list(map(int,input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int,input().split()))
    add_list.append(p)

#print(edge,add_list)

ans = [0] * n
edge_list = [-1] * n

for e in edge:
    edge_list[e[1]-1] = e[0]-1

add_value = [0]*n
for v in add_list:
    add_value[v[0]-1] += v[1]

#print(edge_list)
#print(add_value)


dp = [-1] * n
def get_value(i):
    if(dp[i]!=-1):
        return dp[i]
    tmp = add_value[i]
    if edge_list[i] != -1:
        tmp += get_value(edge_list[i])
    dp[i] = tmp
    return dp[i]

for i in range(n):
    ans[i] = get_value(i)
    #print(i,ans)

print(' '.join(map(str,ans)))
### BUGGY CODE ###

t=input()
s=list(map(int,input().split()))
a=int(t)
list=[]
for i in range(a-1):
  if s[i]>=s[i+1]:
    list.append(1)
  else:
    list.append(0)
d=0
for i in range(a-1):
  c=0
  for j in range(i,a-1):
    if list[j]==1:
      c += 1
    else: 
      break
  d=max(d,c)
print(d)

### FIXED CODE ###

t=input()
s=list(map(int,input().split()))
a=int(t)
list=[]
for i in range(a-1):
  if s[i]>=s[i+1]:
    list.append(1)
  else:
    list.append(0)
d=0
c=0
for i in range(a-1):
  if list[i]==1:
    c+=1
    d=max(d,c)
  else:
    c=0
print(d)
### BUGGY CODE ###

X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
P_=P[A-X:]
Q_=Q[B-Y:]
for i in range(X+Y):
    if len(R)==0 or min(P_[0],Q_[0])>R[-1]:
        break
    min(P_,Q_).pop(0)
    min(P_,Q_).append(R.pop(-1))
print(sum(P_)+sum(Q_))

### FIXED CODE ###

X,Y,A,B,C=map(int,input().split())
P=sorted(list(map(int,input().split())))
Q=sorted(list(map(int,input().split())))
R=sorted(list(map(int,input().split())))
S=sorted(P[A-X:]+Q[B-Y:])
ans=sum(S)
for i in range(min(len(R),len(S))):
    if S[i]<R[-1-i]:
        S[i]=R[-1-i]
    else:
        break
print(sum(S))
### BUGGY CODE ###

N = int(input())
A = input().split()
mod = 10**9+7
ans=0
for i in range(2**N):
  cl = [False]*N
  for j in range(N):
    if ((i>>j)&1):
        cl[N-1-j] = True
  total=''
  if cl.count(True) == 2:
        for k in range(len(cl)):
            if cl[k]:
                total += A[k] + '*'
        total+='1'
  if total =='':
    pass
  else:
        ans += eval(total)

print(ans%mod)


### FIXED CODE ###

mod=10**9 + 7
n=int(input())
a=list(map(int,input().split()))
ans=0
total=sum(a)
for i in a:
  total -= i
  ans += total*i
print(ans%mod)
### BUGGY CODE ###

from collections import Counter
N = int(input())
As = list(map(int, input().split()))
for i in range(N):
  Bs = As[:]
  Bs.pop(i)
  c = Counter(Bs)
  ans = 0
  for con in c.most_common():
    if con[1]<2:
      break
    ans += (con[1]*(con[1]-1)/2)
  print(int(ans))

### FIXED CODE ###

from collections import Counter
N = int(input())
As = list(map(int, input().split()))
c = Counter(As)
ans = 0
for con in c.most_common():
  if con[1]<2:
    break
  ans += (con[1]*(con[1]-1)/2)
for i in range(N):
  print(int(ans-c[As[i]]+1))
### BUGGY CODE ###

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

pn = list(map(lambda x: sum([i for i in range(1, x+1)]) / x, pn))

ans = 0
for i in range(n-k+1):
    ans = max(ans, sum(pn[i:i+k]))

print(ans)

### FIXED CODE ###

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

p = [0]*1001
for i in range(1, 1001):
    p[i] = p[i-1] + i
pn = list(map(lambda x: p[x] / x, pn))

ans = sum(pn[:k])
spn = sum(pn[:k])
for i in range(1, n-k+1):    
    spn = spn - pn[i-1] + pn[i+k-1]
    ans = max(ans, spn)

print(ans)
### BUGGY CODE ###

n = int(input())

count = 0
for c in range(1,n):
  ab = n - c
    
  for a in range(1,int(ab**(1/2))+1):
    if ab % a == 0:
      count += 2
  if int(ab**(1/2))**2 == ab:
    count -= 1
    
print(count)

### FIXED CODE ###

n = int(input())

count = 0
for a in range(1,n):
  #a=1ならBはn-1通り
  #a=2ならBはint(n-1/2)通り
  #a=3ならBはint(n-1/3)
  count += int((n-1)/a)
print(count)
### BUGGY CODE ###

N = int(input())
A1 = [0]
Ai = [int(a) for a in input().split()]
A = A1+Ai

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

### FIXED CODE ###

N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])