peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a, b = map(int, input().split())
n = 1


def snow(x):
  n = 1
  while n / 2 * (n + 1) < x:
    n += 1
  return round(n / 2 * (n + 1)) - x

if a == 1:
  A = 3
else:
  A = a
while snow(b + snow(A)) != 0 or snow(a+snow(A)) != 0:
  A += 1

print(snow(A))
# Judge status: Accepted
N, R = map(int, input().split())

if N < 10:
  print(100*(10-N) + R)
else:
  print(R)
# Judge status: Wrong Answer

def Postal_Code(a , b , s):

    ans = "No"

    if s[:a].isdecimal() and s[b:].isdecimal() and s[a] == '-':
        ans = "Yes"

    return ans

def main():
    a , b = map(int , input().split())
    s = str(input())
    print(Postal_Code(a , b , s))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c=map(int,input().split())
n=2*max(a,b,c)-(a+b+c-max(a,b,c))
if n%2==0:
    print(n//2)
else:
    n+=1
    print((n//2+1))
# Judge status: Wrong Answer
MM = input().split()
N = int(MM[0])
M = int(MM[1])
list1 = []
list2 = []
for i in range(N):
  LL = input().split()
  list1.append(LL)
print(list1)
for i in range(M):
  MM = input().split()
  list2.append(MM)
print(list2)
for i in list1:
  mini = 40**8
  ans = 0
  for j in range(len(list2)):
    x = int(i[0]) - int(list2[j][0])
    y = int(i[1]) - int(list2[j][1])
    xx = abs(x) + abs(y)
    if xx < mini:
      mini = xx
      ans = j+1
  print(ans)
# Judge status: Wrong Answer
n=int(input())
print('ABC{:03}'.format(n)if n<1000else'ABD{:03}'.format(n-999))
# Judge status: Accepted
N=int(input())
S=list(str(input()))
x=0
x_max=0
for i in S:
  if i=='I':
    x+=1
    if x>x_max:
      x_max=x
  else:
    x-=1
print(x_max)
# Judge status: Wrong Answer
h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

INF = 1 << 60

dp = [INF] * (h + 1)
dp[0] = 0

for i in range(1, h + 1):
    #　hを超えるために必要な最小コストは？
    for a, b in ab:
        p = max(i - a, 0)
        if dp[p] + a >= i:
            dp[i] = min(dp[i], dp[p] + b)

print(dp[-1])
# Judge status: Accepted
N,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(1,N):
    s = a[i-1]+a[i]
    if s > x:
        ans += s-x
        a[i] = max(0,x-a[i-1])
print(ans)
# Judge status: Wrong Answer
from math import gcd

n = int(input())
a = list(map(int, input().split()))[::-1]
l = [a[0], a[-1]]
r = [a[0]]
for x in a[1:-1]:
    l.append(gcd(l[-1], x))
    r.append(gcd(r[-1], x))
r = r[::-1]
r.append(a[-1])
print(max(gcd(l[i], r[i]) for i in range(n)))
# Judge status: Accepted
X = int(input())
for i in range(X+1):
    if i * ( i + 1 ) // 2 >= X:
        print(i)
        exit()
# Judge status: Accepted
S = input()
check = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]

for i in range(7):
  if check[i] == S:
    print(7 - i)
# Judge status: Accepted
s = list(input())
flg = 'WA'
if s[0] == 'A':
    if 'C'in s[2:len(s)-1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            flg = 'AC'
print(flg)
# Judge status: Accepted
ALL = []
for i in range(3):
    A = list(map(int,input().split()))
    ALL.append(A)

for i in range(3):
    A = [ALL[0][i],ALL[1][i],ALL[2][i]]
    ALL.append(A)

ALL.append([ALL[0][0],ALL[1][1],ALL[2][2]])
ALL.append([ALL[0][2],ALL[1][1],ALL[2][0]])

N = int(input())
c = []
for i in range(N):
    c.append(int(input()))

j = 0
for i in ALL:
    if i[0] in c and i[1] in c and i[2] in c:
        j = 1
        break

if j == 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from math import sqrt
n = int(input())
print(int(sqrt(n))**2)
# Judge status: Accepted
print(eval(input().replace(' ','+'))%24)
# Judge status: Accepted
from collections import defaultdict
N, M = map(int,input().split())
d = defaultdict(int)
for _ in range(M):
    a, b = map(int,input().split())
    d[a] += 1
    d[b] += 1
for i in range(1,N+1):
    print(d[i])
# Judge status: Wrong Answer
def maxvolume( L ): 
  
 
    length = int(L / 3) 
      
    L -= length 
      

    breadth = L / 2
      
    height = L - breadth 
      
    return int(length * breadth * height) 
      

L = 4
print( maxvolume(L) )
# Judge status: Accepted
N=int(input())
A=[1,6,36,6**3,6**4,6**5,6**6,9,81,9**3,9**4,9**5]
B=[0]+[N]*N
i=0
while i<=N:
    for a in A:
        if a+i<=N:
            B[a+i]=min(B[a+i],B[i]+1)
    i+=1
print(B[N])
# Judge status: Accepted
N, K = map(int, input().split())

MOD = 10 ** 9 + 7

count = 0	
for i in range(K, N + 2):
    count += (((2 * N - i + 1) - (i - 1)) * i // 2 + 1) % MOD
    
count %= MOD
print(count)
# Judge status: Accepted
S = list(input())
flg = True
for i in range(0,len(S),2):
    if S[i] == 'L':
        flg = False
for j in range(1,len(S),2):
    if S[j]== 'R':
        flg = False
if flg:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())
print("Yes" if b>=c>=a else "No")
# Judge status: Accepted
import math
import numpy as np

N, D = map(int, input().split())
X = [np.array(list(map(int, input().split()))) for _ in range(N)]
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        distance = np.linalg.norm(X[i] - X[j], ord=2)
        if distance.is_integer():
            ans += 1
print(ans)
# Judge status: Accepted
a=input()
b=map(int,input().split())
c=list(b)
i=0
j=1

for k in c:
  if j%2==1 and int(k)%2==1:
    i +=1
  j +=1
print(i)
# Judge status: Accepted
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
S = str(input())
r = S.count("R")
g = S.count("G")
b = S.count("B")
ans = (r*g*b)
for i in range (N-2):
    for j in range (i+1,N-1):
        k = 2*j-i
        if k < N and S[i]!=S[j] and S[j] != S[k] and S[k] != S[i]:
                ans -=1
                #print(r2[i],g2[j],b2[k])
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))

p = sorted(p)

c_left = p[int(n/2)-1]
c_right = p[int(n/2)]

print(c_right-c_left)
# Judge status: Accepted
def solve():
    n, k = map(int, input().split())
    h = [int(input()) for _ in range(n)]
    h.sort()
    hk = [h[i+k-1] - h[i] for i in range(n - k + 1)]
    print(min(hk))

if __name__ == '__main__':
    solve()
# Judge status: Accepted
if input() in ('hi', 'hihi', 'hihihi', 'hihihihi', 'hihihihihi'):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
li = list(map(int,input().split()))

if n%2 == 0:
    ans = li[1::2][::-1] + li[::2]
else:
    ans = li[::2][::-1] + li[1::2]

print(*ans)
# Judge status: Wrong Answer
from collections import defaultdict
N, M = map(int,input().split())
A = list(map(int,input().split()))
T = []
for _ in range(M):
  a, b = map(int,input().split()) 
  T.append((b,a))
A.sort()
T.sort(reverse = True)
newT = []
for b,a in T:
  newT+=[b]*a
ans = 0
for i in range(min(len(newT),N)):
  if A[i]>=newT[i]:
    break
  else:
    ans+=newT[i]
ans+=sum(A[i+1:])
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
print("possible" if a % 3 == 0 or b % 3 == 0 or (a+b)%3 == 0 else "Impossible")
# Judge status: Accepted
sx, sy, tx, ty = map(int,input().split())

w = tx - sx
h = ty - sy

ans = ['R'*w + 'U'*(h+1) + 'L'*(w+1) + 'D'*(h+1) + 'RD' + 'R'*(w+1) + 'U'*(h+1) + 'L'*(w+1) + 'D'*h]

print(*ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
if a > b:
  print(0)
elif a == b:
  print(1)
else:
  if n > 1:
    max_ = a*1 + (n-1)*b
    min_ = a*(n-1) + 1*b
    print(max_ - min_ + 1)
  else:
    print(0)
# Judge status: Wrong Answer
(L,R,d) = map(int, input().split())
print (int(R/d)-int(L/d)+1-L%d)
# Judge status: Accepted
import queue
q = queue.Queue()
for i in range(1,10):
    q.put(i)
K = int(input())
for k in range(K):
    x =q.get()
    last = x % 10
    if last != 0:
        q.put(10*x + last - 1)
    q.put(10*x + last)
    if last != 9:
        q.put(10*x + last + 1)
print (x)
# Judge status: Accepted
from collections import Counter

S = input()
T = input()

counter_s = Counter(S)
counter_t = Counter(T)

# print(counter_s, counter_t)
s_value = sorted(counter_s.values())
t_value = sorted(counter_t.values())

# print(s_value, t_value)
if s_value == t_value:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
M = 1000000007

N, K = map(int, input().split())
A = list(map(int, input().split()))
prefix = [1] * (N + 1)
for i, a in enumerate(A, 1):
    prefix[i] = prefix[i - 1] * a
    prefix[i] %= M

prev = prefix[K]
for i in range(K + 1, N + 1):
    cur = prefix[i] * pow(prefix[i - K], M - 2, M)
    cur %= M
    if cur > prev:
        print('Yes')
    else:
        print('No')
    prev = cur
# Judge status: Accepted
s = input()

print("Bad" if any(s[i]==s[i+1] for i in range(3)) else "Good")
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
for k in range(k):
    a_new = [0] * len(a)
    for i in range(n):

        b = list(range(int(i - a[i]), int(i + a[i] + 1)))
        for j in b:
            if j < 0 or j >= len(a):
                q = 0
            else:
                a_new[j] += 1
    a = a_new
    if len(list(set(a_new))) == 1:
        break

for i in a:
    print(int(i))
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
s=[ input() for i in range(n)]
alf=list("abcdefghijklmnopqrstuvwxyz")
ans=dict()
for i in alf:
  ans[i]=1000
for i in s:
  sl=list(i)
  sl=Counter(sl)
  for j in alf:
    if not sl[j]:
      ans[j]=0
    elif ans[j]>sl[j]:
      ans[j]=sl[j]
s=""
for i in ans:
  s+=i*ans[i]
print(str(s))
# Judge status: Accepted
N=int(input())
print((N-N//2)/N)
# Judge status: Accepted
n = int(input())
k = n%10
if k == 3:
    print('bon')
elif k==0 or k==1 or k==6 or k==8:
    print('pon')
else:
    print('hon')
# Judge status: Accepted
n,m=map(int,input().split())
A=[]
B=[]
for _ in range(m):
  a,b=map(int,input().split())
  A.append(a)
  B.append(b)
for k in range(1,n+1):
  print(A.count(k)+B.count(k))
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>=13:
    print(B)
if 6<=A<12:
    print(B/2)
else:
    print(0)
# Judge status: Wrong Answer
import re
print("YES" if re.match("^(dream|dreamer|erase|eraser)+$",input()) else "No")
# Judge status: Wrong Answer
N,D = [int(s) for s in input().split()]
total = 0
count = 0

for i in range(N,0,-1):
  total += (i-D + i+D)
  count += 1
  if total >= N:
    break

print(count)
# Judge status: Accepted
def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()]

    box = set()

    for i in range(N):
        num = N -i
        sum_num  = 0
        for j in range(1, N//num +1):
            if j*num in box:
                sum_num += 1

        if As[num-1] != sum_num % 2:
            box.add(num)

    print(len(box))

    for item in box:
        print(item)

if __name__ == "__main__":
    resolve()
# Judge status: Accepted
a = list(input().split())
print("Yes" if len(set(a)) == 2 else "No")
# Judge status: Accepted
w,h,n=map(int,input().split())
wx=[0]*w
hy=[0]*h
for i in range(n):
  x,y,a=map(int,input().split())
  x-=1
  y-=1
  if a==1:
    for j in range(x+1):
      wx[j]=1
  if a==2:
    for j in range(x+1,w):
      wx[j]=1
  if a==3:
    for j in range(y+1):
      hy[j]=1
  if a==4:
    for j in range(y+1,h):
      hy[j]=1
print(wx.count(0)*hy.count(0))
#print(wx)
#print(hy)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
s = [input() for _ in range(n)]
table = defaultdict(int)
ans = 0
for i in s:
    table["".join(sorted(i))] += 1
for num in table.values():
    ans += (num*(num-1)//2)
print(ans)
# Judge status: Accepted
S = input()
T = input()
Ans = T.startswith(S)
if Ans == True:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, m = map(int, input().split())

n -= 2
m -= 2

ans = 0

if n == 0 or m == 0:
    ans = 0

elif n == -1 and m == -1:
    ans = 0

elif n == -1 or m == -1:
    ans = max(n, m)

else:
    ans = n * m

print(ans)
# Judge status: Accepted
n=int(input())
ryuka=[0]*(n+1)
ryuka[0]=2
ryuka[1]=1
for i in range(2,n+1):
    ryuka[i]=ryuka[i-2]+ryuka[i-1]
print (ryuka[n])
# Judge status: Accepted
N = int(input())
first = input()
shiritori = [first]
t = 0
for i in range(N-1):
  lastword = shiritori[-1]
  nextword = input()
  lastchara = list(lastword)[-1]
  nextchara = list(nextword)[0]
  if lastchara == nextchara:
    shiritori.append(nextword)
    if shiritori.count(nextword) > 1:
      t += 1
  else:
    t += 1
if t == 0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
M=10**7
_,*l=map(int,open(0).read().split())
a=[0]*M
for i in sorted(l):
  a[i]+=1
  if a[i]==1:
    for j in range(2*i,M,i):a[j]+=9
print(a.count(1))
# Judge status: Accepted
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n = ni()
a = na()
b = na()

attack = 0
apre = a[0]
for ai, bi in zip(a[1:], b):
    attackleft = min(apre, bi)
    attack += attackleft
    bi -= attackleft
    attackright = min(ai, bi)
    attack += attackright
    apre = ai - attackright

print(attack)
# Judge status: Accepted
import sys
S = sys.stdin.readline().rstrip()
L = []
R = []
rev = 0
for _ in range(int(sys.stdin.readline().rstrip())):
    A = sys.stdin.readline().rstrip().split()
    if A[0] == "1":
        rev ^= 1
    else:
        if (int(A[1]) ^ rev) & 1:
            L.append(A[2])
        else:
            R.append(A[2])

if rev:
    print("".join(R[::-1]) + S[::-1] + "".join(L))
else:
    print("".join(L[::-1]) + S + "".join(R))
# Judge status: Accepted
N,K,X,Y = [int(input()) for _ in range(4)]
print(min(N,K)*X+max(0,N-K)*Y)
# Judge status: Wrong Answer
s = list(map(int, input().split()))
print(sum(s))
# Judge status: Accepted
from heapq import heappop,heappush,heapify
 
N,M = map(int,input().split())
A = [int(x) for x in input().split()]
 
A_minus = [-x for x in A]

# priority queue を使う
# 最小値を取り出す、要素を挿入する
heapify(A_minus)

for _ in range(M):
    tmp_min = heappop(A_minus)
    tmp_min = (-1)*(-tmp_min//2)
    heappush(A_minus,tmp_min)
    
print(-sum(A_minus))
# Judge status: Accepted
N = int(input())
S = input()
E = S.count('E')
W = 0
Min = N
for i in range(N):
  if S[i]=='E':
    E -= 1
  if i>0 and S[i-1]=='W':
    W += 1
  Min = min(Min,E+W)
print(Min)
# Judge status: Wrong Answer
def main():
    n, k = map(int, input().split())
    num_list = []
    for _ in range(n):
        num_list.append(int(input()))
    
    num_list.sort()

    abs_tree = min(num_list[k-1]-num_list[0], num_list[n-1]-num_list[n-k])

    print(abs_tree)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b,c,d=map(int, input().split())

l=[a*c, a*d, b*c, d*b]
print(max(l))
# Judge status: Accepted
# print('input >>')
X, K, D = map(int,(input().split()))

# 0を横切らない場合
if K * D <= abs(X):
    print(abs(X) - K * D)
# 0を横切る場合
else:
    sho = abs(X) // D
    # 偶奇一致
    if sho % 2 == K % 2:
        print(abs(X) % D)
    else:
        print(abs(abs(X) % D - D))

# print('-----output-----')
# Judge status: Accepted
def main():
    n, w = map(int, input().split())
    wv = [list(map(int, input().split())) for _ in range(n)]

    dp = [0] * (w + 1)
    for wi, vi in wv:
        for sum_w in range(w, wi - 1, -1):
            v = dp[sum_w - wi] + vi
            if dp[sum_w] < v:
                dp[sum_w] = v

    print(dp[w])


if __name__ == '__main__':
    main()
# Judge status: Accepted
#template
def inputlist(): return [int(j) for j in input().split()]
#template
#issueから始める
n,m = map(int,input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        a1 = [a[k][j:j+m] for k in range(i,i+m)]
        if a1 == b:
            print('Yes')
            exit()

print('No')
# Judge status: Wrong Answer
S,W=map(int,input().split())
if W<=S:
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
Q=4*q
H=2*h
S=s
D=d/2
b=[Q,H,S,D]
a=sorted(b)
if a[0]==D and n%2==1:
    ans=(n//2)*d+a[1]
elif a[0]==D:
    ans=(n//2)*d
else:
    ans=n*a[0]
print(ans)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
print(min(b,d)-max(a,c))
# Judge status: Accepted
lst1 = list(input())
if len(lst1) != 3:
    print("No")
    exit()
for i in ["a","b","c"]:
    if not i in lst1:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
N = int(input())
for i in range(10):
    if N <= i * 111:
        print(i * 111)
        break
# Judge status: Wrong Answer
k, s = map(int, input().split(" "))
answer = 0

for i in range(k + 1):
    for j in range(k + 1):
        rem = 3 * k - i - j
        if 0 <= rem <= k:
            answer += 1
print(answer)
# Judge status: Wrong Answer
q, h, s, d = map(int, input().split())
n = int(input())

one = min(q * 4, h * 2, s)
two = min(one, d)

ans = (n // 2) * two + (n % 2) * one
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(input()) for i in range(N)]
B = 1
for j in(A):
  if j == 2:
    print(B)
    break
  elif j == [-1]:
    print('-1')
  else:
    B += 1
# Judge status: Wrong Answer
n,a,b = map(int,input().split())

print(b*(n-1)+a-(a*(n-1)+b)+1)
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n =int(input())
ans = min([4*n*q, 2*n*h, n*s, (n//2)*d+(n%2)*min(4*q, 2*h, s)])
print(ans)
# Judge status: Wrong Answer
s=input()
a=list(s).count('a')
b=list(s).count('b')
c=list(s).count('c')

if(a*b*c==0):
    print("NO")
elif(max(a,b,c)-min(a,b,c)>1):
    print("NO")
else:
    print("YES")
# Judge status: Accepted
def check_prime(m):
  prime_flag = 1
  counter = 2
  while counter **2 <= m:
    if not m%counter:
      prime_flag = 0
      break
    counter += 1
  return prime_flag


n = int(input())

for i in range(n, 10**6):
  if check_prime(i):
    print(i)
    break
# Judge status: Accepted
import sys

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

if A > B:
    print(0)
    sys.exit()
elif N == 1:
    if A != B:
        print(0)
    else:
        print(1)
else:
    print((N - 2) * (B - A) + 1)
# Judge status: Accepted
a, b = map(lambda x: int(x), input().split())

num = a-1

if b >= a:
  num += 1

print(num)
# Judge status: Accepted
a,b,x=map(int,input().split())

if a>x or a+b<x:
  print("NO")
else:
  print("YES")
# Judge status: Accepted
X = int(input())
ret = 0
cur = 0
while True:
    ret += 1
    cur += X
    if cur % 360 == 0:
        print(ret)
        break
# Judge status: Wrong Answer
import bisect
n,k = map(int,input().split())
x = list(map(int,input().split()))
zero = bisect.bisect(x,0)
left = [0] + (x[:zero])[::-1]
right = [0] + x[zero:]
ans = 10**7
for i in range(min(k+1,len(left))):
  j = k-i
  if j >= len(right):
    continue
  ans = min(ans,2*right[j]-left[i],-2*left[i]+right[j])
print(ans)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
t = 10**9
for i in range(1,n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    if abs(s1-s2) < t:
        t = abs(s1-s2)
print(t)
# Judge status: Wrong Answer
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ab = sorted(ab, key=lambda x:(-x[1], x[0]))
ans = 0
MM = 1
while MM <= M:
  a, b = ab.pop(0)
  if MM >= a:
    ans += b
  else:
    ab += [[a,b]]
  MM += 1
  if len(ab) == 0:
    break
print(ans)
# Judge status: Accepted
N = int(input())
# N=100

if N % 2  == 0:
    print("0.5000000000")
else:
    tmp = (N+1)/2
    print(tmp/N)
# Judge status: Accepted
l=float(input())
print((l/3)**3)
# Judge status: Accepted
s = input()
count1 = 0
count2 = 0
for i in range(0, len(s)):
    if(i%2 == 0):
        if(s[i] == "0"):
            count1 += 1
    if(i%2 == 1):
        if(s[i] == "1"):
            count1 += 1

for i in range(0, len(s)):
    if(i%2 == 0):
        if(s[i] == "1"):
            count2 += 1
    if(i%2 == 1):
        if(s[i] == "0"):
            count2 += 1    
print(min(count1,count2))
# Judge status: Wrong Answer
a,b = map(int,input().split())
max = max(a,b)
min = min(a,b)
if max< 0 and min < 0:
	print(abs(min - max) + 2)
elif a < 0 or b < 0:
	print(abs(min) - max + 1)
else:
	print(abs(max - min))
# Judge status: Accepted
n,m = list(map(int, input().split()))
from collections import defaultdict
d=defaultdict(list)
for _ in range(m):
    a,b = list(map(int, input().split()))
    d[a].append(b)
    d[b].append(a)
ans=[0]*n
for k in d:
    ans[k-1]=len(d[k])
print(*ans, sep='\n')
# Judge status: Wrong Answer
n, m = map(int, input().split())
print(n*(n-1)/2+m*(m-1)/2)
# Judge status: Wrong Answer
N,=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
for i in range(1,N+1):
    if (i % 15==0):
        print("FizzBizz")
    elif(i % 5==0):
        print("Fizz")
    elif(i % 3==0):
        print("Bizz")
    else:
        print(i)
# Judge status: Accepted
x, n = map(int, input().split())
p_list = list(map(int, input().split()))

check = x
tansaku = 1
count = 0
while True:
    count += 1
    if not(check in p_list):
        print(check)
        exit()
    
    check -= tansaku
    tansaku = -tansaku
    if tansaku <0:
        tansaku -= 1
    else:
        tansaku += 1
    if count >= 500:
        exit()
# Judge status: Accepted
a, b, c = map(int, input().split())

if a-b > c:
  print("0")
else:
  print(c-(a-b))
# Judge status: Accepted
n = int(input())
ai = [int(i) for i in input().split()]
bi = []
for i in range(len(ai)):
    bi.append(ai[i]-(i+1))
bi = sorted(bi)
b = bi[int(len(bi)/2)]
ans = 0
for i in range(len(ai)):
    ans += abs(ai[i] - (b+i+1))
print(ans)
# Judge status: Accepted
n=int(input())
for i in range(1,10):
  if  n % i ==0 :
    for j in range(1,10):
      if n // i == j:
        print("Yes")
        exit()
else:
  print("No")
# Judge status: Accepted
N, K, Q = list(map(int, input().split()))
ans_list = [0 for i in range(N)]
for i in range(Q):
    a = int(input())
    ans_list[a-1] += 1
for a in ans_list:
    if a + K > Q:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n = int(input())
a, b, c = [], [], []
for _ in range(n):
    _a, _b, _c = map(int, input().split())
    a.append(_a)
    b.append(_b)
    c.append(_c)

dp = [[0]*3 for _ in range(n)]
dp[0] = [a[0], b[0], c[0]]

for i in range(1, n):
    dp[i][0] = a[i] + max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = b[i] + max(dp[i-1][0], dp[i-1][2])
    dp[i][2] = c[i] + max(dp[i-1][0], dp[i-1][1])

print(max(dp[n-1]))
# Judge status: Accepted
a,b,c = map(int, input().split())
print('Yes' if a<c<b or b<c<a else 'No')
# Judge status: Accepted
a = input()
b = input()

cnt = 0

for i in range(len(a)):
    if a[i] != b[i]:
        cnt += 1

print(cnt)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
if a>=12:
  print(b)
if 6<=a<12:
  print(int(b/2))
if a<6:
  print("0")
# Judge status: Accepted
from itertools import*
n, k = map(int, input().split())
print(min(sum(len(list(l))-1 for _, l in groupby(input())) + 2*k, n-1))
# Judge status: Accepted
def f(n,k):
  return (n+1)*(n+k+1)*(n-k+2)//2+k*(k-1)*(2*k-1)//6-(n+1)*(n+2)*(2*n+3)//6+n-k+2

n,k=map(int,input().split())
print(f(n,k)%1000000007)
# Judge status: Wrong Answer
a,b = (int (x) for x in input ().split ())
if a<=8 and b<=8:
  print ('Yey!')
else:
  print (':(')
# Judge status: Wrong Answer
S = input()
T = input()

for i in range(len(S) - 1, -1, -1):
    if S[i:] + S[:i] == T:
        print('yes')
        break
else:
    print('no')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
maxa = max(a)
mini = [[] for _ in range(n)]
for i, v in enumerate(a):
    r = maxa - v
    mini[i] = [v, abs(v - r)]
mini.sort(key=lambda x: x[1])
if n == 2:
    print(maxa, min(a))
else:
    print(maxa, mini[0][0])
# Judge status: Accepted
n=int(input())
a=[int(i)for i in input().split()]
count2=0
count4=0
for i in a:
    if i%4==0:
        count4+=1
        continue
    if i%2==0:
        count2+=1
if count2!=0:n-=count2-1
if count4>=int(n/2):print("Yes")
else:print("No")
# Judge status: Accepted
from collections import Counter
N, *A = map(int, open(0).read().split())
C = Counter(A)
C = [(k,v) for k,v in C.items() if v > 1]
if len(C) < 2:
  print(0)
else:
  C = sorted(C, key=lambda x:x[0])
  if C[-1][1] >= 4:
    print(C[-1][0]**2)
  else:
    print(C[-1][0]*C[-2][0])
# Judge status: Accepted
a = str(input())

if a == "a" or a == "i" or a == "u" or a == "e" or a == "o":
  print("vowel")
else:
  print("consonant")