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

s = input()
len_s = len(s)
mod = 10 ** 9 + 7
dp = [[0] * 13 for i in range(len_s)]

for i in range(len_s):
    if s[-(i + 1)] == '?':
        for j in range(13):
            if i == 0:
                if j < 10:
                    dp[i][j] = 1
                continue

            if dp[i - 1][j] > 0:
                for k in range(10):
                #k:先頭に加える数字
                    add = k * pow(10, i)
                    dp[i][(j + add)%13] = (dp[i][(j + add)%13] + dp[i - 1][j])%mod

    else:
        if i == 0:
            dp[i][int(s[-(i + 1)])] = 1
            continue

        add = int(s[-(i + 1)]) * pow(10, i)
        for j in range(13):
            if dp[i - 1][j] > 0:
                dp[i][(j + add)%13] = (dp[i][(j + add)%13] + dp[i - 1][j])%mod

print(dp[-1][5] % mod)

### FIXED CODE ###

s=input()
len_s=len(s)
mod=10**9+7
dp=[[0]*13 for i in range(len_s)]

if s[-1]!='?':
    dp[0][int(s[-1])%13]=1
else:
    for i in range(10):
        dp[0][i]=1

a=1
for i in range(1,len_s):
    a=10*a%13
    if s[-(i+1)]!='?':
        temp_S=int(s[-(i+1)])
        amari=(temp_S*a)%13
        for j in range(13):
            dp[i][(amari+j)%13]+=dp[i-1][j]%mod

    else:
        for k in range(10):
            amari=(k*a)%13
            for l in range(13):
                dp[i][(amari+l)%13]+=dp[i-1][l]%mod
#print(*dp,sep='\n')
print(dp[-1][5]%mod)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter

N, M = map(int, input().split())
cards = sorted(list(map(int, input().split())))
candidates = [list(map(int, input().split())) for _ in range(M)]
candidates.sort(key=itemgetter(1), reverse=True)

for canditate in candidates:
    n_card = canditate[0]
    replace_value = canditate[1]
    if  replace_value  < cards[0]:
        break
    
    for i in range(n_card):
        if cards[i] < replace_value:
            cards[i] = replace_value
        else:
            break
    cards.sort()

print(sum(cards))

### FIXED CODE ###

from heapq import heapify, heappush, heappop
from operator import itemgetter

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    heapify(A)

    query = [list(map(int, input().split())) for _ in range(M)]
    query.sort(key=itemgetter(1), reverse=True)

    for b, c in query:
        for _ in range(b):
            m = heappop(A)
            if m >= c:
                heappush(A, m)
                break
            heappush(A, c)
        else:
            continue
        break
    
    print(sum(A))


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

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

dp = [[0]*(W+1) for i in range(N+1)]
w = [-1] * N
v = [-1] * N

for i in range(N):
    w[i], v[i] = map(int, input().split())
    
for i in range(N):
    for j in range(W+1):
        if j >= w[i]:
            dp[i+1][j] = max(dp[i][j-w[i]] + v[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[N][W])

### FIXED CODE ###

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

dp = [[0]*(W+1) for i in range(N+1)]
w = [-1] * N
v = [-1] * N

for i in range(N):
    w[i], v[i] = map(int, input().split())
    
for i in range(N):
    for j in range(W+1):
        if j >= w[i]:
            dp[i+1][j] = max(dp[i][j-w[i]] + v[i], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[N][W])
### BUGGY CODE ###

N=int(input())
a=[int(input()) for _ in range(N)]

x=dict(zip(range(1,N+1),a))
#print(x)
route=[1,]
while 2 not in route:
  #print(x[route[-1]])
  if x[route[-1]] not in route:
    route.append(x[route[-1]])
  elif len(route)-1>N:
    print(-1)
    exit()
  else:
    print(-1)
    exit()
print(len(route)-1)


### FIXED CODE ###

N=int(input())
x=[int(input()) for _ in range(N)]

on=1
ans=0
for _ in range(N):
  on=x[on-1]
  ans=ans+1
  if on==2:
    print(ans)
    exit()
  
print(-1)
### BUGGY CODE ###

def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  n,k = list(map(int,input().split()))
  #a = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = n
  zen = n
  count = 0
  lis = []
  
  if k == 1:
    print(0)
  elif k == 2:
    if n % 2 == 0:
      print(2)
    else:
      print(3)
  else:  
    while 1:
      hi = abs(ans-k)
      if hi < zen:
        zen = hi
        ans = hi
        
      else:
        print(ans)
        exit()
      
if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  #n = int(input())
  #s = input()
  #s = input().split()
  n,k = list(map(int,input().split()))
  #a = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = n
  zen = n
  count = 0
  lis = []
  
  if k == 1:
    print(0)
  elif n <= abs(n-k):
    print(n)
  else:
    ans = n % k
    if ans > 2:
      while 1:
        hi = abs(ans-k)
        if hi < zen:
          zen = hi
          ans = hi

        else:
          print(ans)
          exit()
    else:
      print(ans)
    
      
if __name__ == '__main__':
  main()
### BUGGY CODE ###

import numpy as np

def main():
  n=int(input())
  s=np.array([ord(i) for i in input()])
  dp=np.zeros((n+1,n+1),dtype=int)
  ans=0
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
        now=dp[i][j] if dp[i][j]<j-1 else j-1
        if ans<now:
          ans=now
        #ans=max(ans,min(dp[i][j],j-i))
  #for i in dp:
  #  print(i)
  print(ans)      
        

if __name__=='__main__':
  main()

### FIXED CODE ###

def main():
  n=int(input())
  s=input()
  dp=[[0]*(n+1) for i in range(n+1)]
  for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
      if s[i]==s[j]:
        dp[i][j]=dp[i+1][j+1]+1
  #for i in dp:
  #  print(i)
  
  ans=0
  for i in range(n-1):
    for j in range(i+1,n):
      ans=max(ans,min(j-i,dp[i][j]))
  print(ans)      
        

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

from collections import deque
import sys
input = sys.stdin.readline

H, W = map(int, input().split())
table = []
dist = [[-1]*W for i in range(H)]
Q = deque()
dx = [0,1,0,-1]
dy = [1,0,-1,0]
ans = 0

for y in range(H):
    A = list(input())
    for x in range(W):
        if A[x] == "#":
            Q.append((y,x))
            dist[y][x] = 0
    table.append(A)

while Q:
    y,x = Q.popleft()
    for i in range(4):
        ny = y+dy[i]
        nx = x+dx[i]
        if 0<=ny<H and 0<=nx<W and dist[ny][nx] == -1 and table[ny][nx] == ".":
            dist[ny][nx] = dist[y][x]+1
            Q.append((ny,nx))
for i in range(H):
    ans = max(ans,max(dist[i]))
print(ans)

### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
A = [input() for i in range(H)]
X = [1,0,-1,0]
Y = [0,-1,0,1]

INF = 99999
dp = [[-1]*W for i in range(H)]
q = deque()
for y, row in enumerate(A):
  for x,c in enumerate(row):
    if c == "#":
      dp[y][x] = 0
      q.append((y,x))
while q:
  y,x = q.popleft()
  d = dp[y][x]
  for i in range(4):
    nx = x + X[i]
    ny = y + Y[i]
    if (0 <= nx < W) and (0 <= ny < H) and (dp[ny][nx] == -1):
      dp[ny][nx] = d + 1
      q.append((ny,nx))
print(max(max(row) for row in dp))
### BUGGY CODE ###

def BC132_E():
    n, m = list(map(int, input().split(' ')))
    e = [[] for _ in range(n)]
    for _ in range(m):
        u, v = list(map(int, input().split(' ')))
        e[u - 1].append(v - 1)
    s, t = list(map(int, input().split(' ')))
    s, t = s - 1, t - 1
    stack, visited = [(s, 0)], set()
    while stack:
        i, d = stack.pop(0)
        if i == t: return d
        if i in visited:
            continue
        visited.add(i)
        a = set()
        for j in e[i]:
            a.update(e[j])
        b = set()
        for j in list(a):
            b.update(e[j])
        stack += [(x, d + 1) for x in list(b)]
    return -1


print(BC132_E())

### FIXED CODE ###

def BC132_E():
    n, m = list(map(int, input().split(' ')))
    e = [[] for _ in range(n)]
    for _ in range(m):
        u, v = list(map(int, input().split(' ')))
        e[u - 1].append(v - 1)
    s, t = list(map(int, input().split(' ')))
    s, t = s - 1, t - 1
    stack, visited = [(s, 0)], set()
    a, b = set(), set()
    while stack:
        i, d = stack.pop(0)
        if i == t: return d
        if i in visited:
            continue
        visited.add(i)
        v = set()
        for j in e[i]:
            if j in a: continue
            a.add(j)
            for k in e[j]:
                if k in b: continue
                b.add(k)
                v.update(e[k])
        if t in v:
            return d + 1
        else:
            stack += [(x, d + 1) for x in list(v)]
    return -1


print(BC132_E())
### BUGGY CODE ###

import sys
from collections import deque as dq
input = sys.stdin.readline
H, W, K = map(int, input().split())
x, y, u, v = map(int, input().split())
x -= 1
y -= 1
u -= 1
v -= 1
a = [list(input())[: -1] for _ in range(H)]
Q = dq([x * W + y])
inf = H * W + 1
dp = [inf] * (H * W)
dp[x * W + y] = 0
while len(Q):
  t = Q.popleft()
  p = t // W
  q = t % W
  if (p, q) == (u, v):
    print(dp[t])
    exit(0)
  for i in range(1, K + 1):
    pp = p + i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      dp[pp * W + q] = dp[t] + 1
      Q.append(pp * W + q)
  for i in range(1, K + 1):
    pp = p - i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      dp[pp * W + q] = dp[t] + 1
      Q.append(pp * W + q)

  for i in range(1, K + 1):
    qq = q + i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      dp[p * W + qq] = dp[t] + 1
      Q.append(p * W + qq)

  for i in range(1, K + 1):
    qq = q - i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      dp[p * W + qq] = dp[t] + 1
      Q.append(p * W + qq)
print(-1)


### FIXED CODE ###

import sys
from collections import deque as dq
input = sys.stdin.readline
H, W, K = map(int, input().split())
x, y, u, v = map(int, input().split())
x -= 1
y -= 1
u -= 1
v -= 1
a = [list(input())[: -1] for _ in range(H)]
Q = dq([(0, x * W + y)])
inf = H * W + 1
dp = [inf] * (H * W)
dp[x * W + y] = 0
while len(Q):
  cost, t = Q.popleft()
  dp[t] = cost
  p = t // W
  q = t % W
  if (p, q) == (u, v):
    print(cost)
    exit(0)
  for i in range(1, K + 1):
    pp = p + i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      if dp[pp * W + q] != inf: continue
      dp[pp * W + q] = dp[t] + 1
      Q.append((dp[t] + 1, pp * W + q))
  for i in range(1, K + 1):
    pp = p - i
    if pp in range(H):
      if a[pp][q] == "@": break
      if dp[pp * W + q] <= dp[t]: break
      if dp[pp * W + q] != inf: continue
      dp[pp * W + q] = dp[t] + 1
      Q.append((dp[t] + 1, pp * W + q))

  for i in range(1, K + 1):
    qq = q + i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      if dp[p * W + qq] != inf: continue
      dp[p * W + qq] = dp[t] + 1
      Q.append((dp[t] + 1, p * W + qq))

  for i in range(1, K + 1):
    qq = q - i
    if qq in range(W):
      if a[p][qq] == "@": break
      if dp[p * W + qq] <= dp[t]: break
      if dp[p * W + qq] != inf: continue
      dp[p * W + qq] = dp[t] + 1
      Q.append((dp[t] + 1, p * W + qq))
print(-1)
### BUGGY CODE ###

h,m = map(int, input().split())
atack = list(map(int, input().split()))

atack_select=[] #候補を保存しておくリスト

for i in range(m):
    atack_select.append(max(atack))
    atack.remove(max(atack)) #最大値を消していく

if h - sum(atack_select) <= 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

h,m = map(int, input().split())
atack = list(map(int, input().split()))

atack.sort(reverse=True) #降順に並び替え
atack_select = atack[:m]

if h - sum(atack_select) <= 0:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

import heapq
import math
xs, ys, xt, yt = map(int, input().split())
N = int(input())

Coordinate = {-1: (xs, ys, 0), N:(xt, yt, 0)}
minRadiation = {int(i):10**20 for i in range(-1, N+1)}
ToVisit = {int(i) for i in range(-1, N+1)}
for i in range(N):
    x, y, r = map(int, input().split())
    Coordinate[i] = (x, y, r)

Q = [(0, -1)]
heapq.heapify(Q)
while Q:
    nowRadiation, index = heapq.heappop(Q)
    if index == N:
        print(nowRadiation)
        break
    elif index in ToVisit:
      ToVisit ^= {index}
      nowx, nowy, nowr = Coordinate[index]
      for nextIndex in ToVisit:
          nextx, nexty, nextr = Coordinate[nextIndex]
          tempTime = max(0, math.sqrt((nextx-nowx)**2 + (nexty-nowy)**2) - nowr - nextr) + nowRadiation
          if minRadiation[nextIndex] > tempTime:
              minRadiation[nextIndex] = tempTime
              heapq.heappush(Q, (tempTime, nextIndex))

### FIXED CODE ###

import heapq
import math
xs, ys, xt, yt = map(int, input().split())
N = int(input())

Coordinate = {-1: (xs, ys, 0), N:(xt, yt, 0)}
minRadiation = {int(i):10**20 for i in range(-1, N+1)}
ToVisit = {int(i) for i in range(-1, N+1)}
for i in range(N):
    x, y, r = map(int, input().split())
    Coordinate[i] = (x, y, r)

Q = [(0, -1)]
heapq.heapify(Q)
while Q:
    nowRadiation, index = heapq.heappop(Q)
    if index == N:
        print(nowRadiation)
        break
    elif index in ToVisit:
      ToVisit.difference_update({index})
      nowx, nowy, nowr = Coordinate[index]
      for nextIndex in ToVisit:
          nextx, nexty, nextr = Coordinate[nextIndex]
          tempTime = max(0, math.sqrt((nextx-nowx)**2 + (nexty-nowy)**2) - nowr - nextr) + nowRadiation
          if minRadiation[nextIndex] > tempTime:
              minRadiation[nextIndex] = tempTime
              heapq.heappush(Q, (tempTime, nextIndex))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
INF = 10 ** 9
MOD = 10 ** 9 + 7

def main(): 
    h,w,d = map(int,input().split())
    n = h * w

    idx = [0]*(1+n)
    for i in range(h):
        a = tuple(map(int,input().split()))
        for j in range(w):
            idx[a[j]] = (i + 1 , j + 1)
    idx[0] = idx[d]

    D = [[0]*(n+1) for _ in range(n+1)]
    
    def dist(i,j):
        return abs(idx[i][0] - idx[j][0]) + abs(idx[i][1] - idx[j][1])
        
    for i in range(d):
        for j in range(i,n - d + 1,d):
            D[j + d][i] = D[j][i] + dist(j,j + d)
    
    q = int(input())
    for _ in range(q):
        l,r = map(int,input().split())
        modd = l%d
        print(D[r][modd] - D[l][modd])        

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
INF = 10 ** 9
MOD = 10 ** 9 + 7

def main(): 
    h,w,d = map(int,input().split())
    n = h * w

    idx = [0]*(1+n)
    for i in range(h):
        a = tuple(map(int,input().split()))
        for j in range(w):
            idx[a[j]] = (i + 1 , j + 1)
    idx[0] = idx[d]

    D = [0] * (n + 1)
    
    def dist(i,j):
        return abs(idx[i][0] - idx[j][0]) + abs(idx[i][1] - idx[j][1])
        
    for i in range(d):
        for j in range(i,n - d + 1,d):
            D[j + d] = D[j] + dist(j,j + d)
    
    q = int(input())
    for _ in range(q):
        l,r = map(int,input().split())
        print(D[r] - D[l])        

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


import sys
from collections import deque, defaultdict
import copy
import bisect
#input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


N, Q = list(map(int, input().split()))
tree = [dict() for i in range(N)]
for i in range(N):
	tree[i]["edge"] = []
	tree[i]["ope"] = 0
	tree[i]["score"] = 0
	tree[i]["parent"] = -1

for i in range(N - 1):
	a, b = list(map(int, input().split()))
	tree[a - 1]["edge"].append(b - 1)
	tree[b - 1]["edge"].append(a - 1)

for i in range(Q):
	p, x = list(map(int, input().split()))
	tree[p - 1]["ope"] += x

que = deque()
que.append(0)
tree[0]["score"] = tree[0]["ope"]
while len(que) > 0:
	loc = que.popleft()
	for edge in tree[loc]["edge"]:
		if tree[loc]["parent"] != edge:
			tree[edge]["score"] += tree[loc]["score"] + tree[edge]["ope"]
			que.append(edge)
			tree[edge]["parent"] = loc

for i in range(N - 1):
	print(tree[i]["score"], end = "")
	print(" ", end = "")
print(tree[N - 1]["score"])










### FIXED CODE ###


import sys
from collections import deque, defaultdict
import copy
import bisect
input=sys.stdin.readline
#sys.setrecursionlimit(10 ** 9)
import math
import heapq


N, Q = list(map(int, input().split()))
eda = [[] for i in range(N)]
ope = [0]*N
score = [0]*N
parent = [-1]*N


for i in range(N - 1):
	a, b = list(map(int, input().split()))
	eda[a - 1].append(b - 1)
	eda[b - 1].append(a - 1)

for i in range(Q):
	p, x = list(map(int, input().split()))
	ope[p - 1] += x


que = []
que.append(0)
score[0] = ope[0]
for ss in range(N - 1):
	loc = que.pop()
	for edge in eda[loc]:
		if parent[loc] != edge:
			score[edge] += score[loc] + ope[edge]
			que.append(edge)
			parent[edge] = loc

for i in range(N - 1):
	print(score[i], end = "")
	print(" ", end = "")
print(score[N - 1])
### BUGGY CODE ###

h,n=map(int,input().split())
INF=10**9
A=[]; dp=[INF]*(h+10)
for i in range(n):
  x,y=map(int,input().split())
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(h):
    index=h if i+a>h else i+a
    dp[index]=dp[index]if dp[index]<dp[i]+b else dp[i]+b
print(dp[h])


### FIXED CODE ###

def IN(): return map(int,input().split())
ans = pow(2,31); mod = pow(10,9)+7
h,n=IN()
A=[]; dp=[pow(2,31)]*111111
for i in range(n):
  x,y=IN()
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(h+1111):
    dp[i+a]=min(dp[i+a],dp[i]+b)
for i in range(h,11111):
  ans=min(ans,dp[i])
print(ans)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
m=0
count=0
for i in range(n):
    o=l[i]
    for j in range(i+1,n):
        if o>=l[j]:
           # print(o,j)
            o=l[j]
            count+=1
        else:
            m=max(m,count)
            count=0
            break
    m=max(m,count)
    count=0
print(m)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
m=0
count=0
a=[]
for i in range(n-1):
    a.append(l[i]-l[i+1])
for i in a:
    if i>=0:
        count+=1
    else:
        m=max(m,count)
        count=0
    m=max(m,count)
#print(a)
print(m)
### BUGGY CODE ###

ans = 1
n = int(input())
A = [int(i) for i in input().split()]
A.sort()
for i in A:
    if i==0:
        print('0')
        exit()
    ans *= i
if ans>10**18:
        print('-1')
        exit()
print(ans)

### FIXED CODE ###

ans = 1
n = int(input())
A = [int(i) for i in input().split()]
A.sort()
for i in A:
    if i==0:
        print('0')
        exit()
    ans *= i
    if ans>10**18:
        print('-1')
        exit()
print(ans)
### BUGGY CODE ###

n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0
while 1:
 try:
  if(h>0)*(b[-1]>a):h-=b.pop();c+=1
 except:break
print(c-(-h//a)*(h>0))

### FIXED CODE ###

#!/usr/bin/env python3
n, h, *d = map(int, open(0).read().split())
a = max(d[::2])
b = sorted(b for b in d[1::2] if b >= a)[::-1]
i = 0
for b in b:
    h -= b
    i += 1
    if h <= 0:
        print(i)
        exit()
print(i + 0--h // a)
### BUGGY CODE ###

from collections import deque

N = int(input())
A = [deque(int(e)-1 for e in input().split()) for _ in range(N)]

#ad = [[0] * N for _ in range(N)]
game = 0

for d in range(1,N**2+1):
    #print("---------{}日目---------".format(d))
    matched = [0] * N
    for i in range(N):
        if matched[i]:
            continue
        if not A[i]:
            continue
        # 相手の候補
        j = A[i][0]
        if not A[j]:
            continue
        # お互いに最優先で今日中に試合をしていないなら試合をする
        if A[j][0] == i and not matched[j]:
            #print("{}と{}が試合".format(i+1,j+1))
            A[i].popleft()
            A[j].popleft()
            matched[i] = 1
            matched[j] = 1
            #ad[i][j] = 1
            #ad[j][i] = 1
            game += 1
    if game == N*(N-1)//2:
        print(d)
        exit()

print(-1)

### FIXED CODE ###

from collections import deque

N = int(input())
ad = [[] for _ in range(N*N)]
num = [0] * (N*N)

for i in range(N):
    a = [int(e)-1 for e in input().split()]
    for k in range(N-2):
        j = a[k]
        nj = a[k+1]
        v = N*max(i,j) + min(i,j)
        nv = N*max(i,nj) + min(i,nj)
        ad[v].append(nv)
        num[nv] += 1

S = deque()
L = []

for v in range(N*N):
    if num[v] == 0:
        S.append((v,1))

while S:
    v, d = S.popleft()
    L.append(d)
    for nv in ad[v]:
        num[nv] -= 1
        if num[nv] == 0:
            S.append((nv, d+1))

if len(L) != N*N:
    print(-1)
    exit()

ans = max(L)
print(ans)
### BUGGY CODE ###

def get_subordinate(n, members):

    for i in range(1, n+1):
        count = 0
        if i in members:
            for member in members:
                if i == member:
                    count += 1
        else:
            count = 0
        print(count)


if __name__ == '__main__':
    n = int(input())
    members = list(map(int, input().rstrip().split()))
    get_subordinate(n, members)



### FIXED CODE ###

def get_subordinate(n, members):
    new_dict = {}

    for i in range(1, n+1):
        new_dict[i] = 0

    for member in members:
        if member in new_dict:
            new_dict[member] += 1

    print(*new_dict.values(), sep="\n")


if __name__ == '__main__':
    n = int(input())
    members = list(map(int, input().rstrip().split()))
    get_subordinate(n, members)
### BUGGY CODE ###

N,M = map(int, input().split())
L = []
for i in range(M):
    p,S = map(str, input().split())
    L.append([p,S])
C = 0
P = 0
A = []
for k in range(M):
    if L[k][1] == 'AC' and L[k] not in A:
        A.append(L[k])
        C += 1
    elif L[k][1] == 'WA' and [L[k][0],'AC'] not in A:
        A.append(L[k])
        P += 1
print(C,P)

### FIXED CODE ###

N,M = map(int, input().split())
A = {}
C = 0
P = 0
for i in range(M):
    p,S = map(str, input().split())
    if S == 'AC' and A.get(p+S) is None:
        A[p+S] = 0
        C += 1
    elif S == 'WA' and A.get(p+'AC') is None and A.get(p+S) is None:
        A[p+S] = 1
    elif S == 'WA' and A.get(p+'AC') is None:
        A[p+S] += 1
for i in range(1,N+1):
    if A.get(str(i)+'AC') is not None and A.get(str(i)+'WA') is not None:
        P += A[str(i)+'WA']
print(C,P)
### BUGGY CODE ###

h = int(input())
i= 0

while(1):
    if h >= 2**(i+1) and h < 2**(i+2):
        print(2**(i+2)-1)
        exit(0)

    i = i + 1

### FIXED CODE ###

h = int(input())
i= 0

if h == 1:
    print(1)
    exit(0)

while(1):
    if h >= 2**(i+1) and h < 2**(i+2):
        print(2**(i+2)-1)
        exit(0)

    i = i + 1
### BUGGY CODE ###

N, K = map(int, input().split())
num = list(map(int, input().split()))

# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)

# 隣接するN個の期待値を出す
max = 0
for i in range(N):
  if i > N - K:
    break
  temp = 0
  for j in range(K):
	  temp = temp + expect[i + j]
  if max < temp:
    max = temp
print(max)

### FIXED CODE ###

N, K = map(int, input().split())
num = list(map(int, input().split()))

# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)

# 累積和を作る
cs = [0]
for (i, number) in enumerate(expect):
  cs.append(cs[i] + expect[i])

max = 0
for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)