peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
x, y = map(int, input().split())

count = 0
while y >= x:
    count += 1
    y = y // 2
print(count)
# Judge status: Accepted
import statistics

n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n-2):

    l2=[l[i],l[i+1],l[i+2]]
    if statistics.median(l2)==l[i+1]:
        ans+=1

print(ans)
# Judge status: Wrong Answer
import bisect

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

p = [A[0]]
for i in A[1:]:
    if p[-1] <= i:
        p.append(i)
    else:
        p[bisect.bisect_left(p,i)] = i
print (len(p))
# Judge status: Accepted
a,b,c=map(int,input().split())
n=c-a-b
if n > 0 and n**2 > 4*a*b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x=int(input())
for i in range(1,361):
  if (i*x)%360==0:
    print(i)
    break
# Judge status: Accepted
n,m=map(int,input().split())
ac=[0]*n
pn=[0]*n
for i in range(m):
  ps=input().split()
  p=int(ps[0])-1
  s=ps[1]
  if ac[p]:
    continue
  if s=='AC':
    ac[p]=1
  else:
    pn[p]+=1
acs=sum(ac)
pns=sum([x for i,x in enumerate(pn) if ac[i]])
print(acs, pns)
# Judge status: Accepted
a, b, c ,d = map(int, input().split())
while True:
  c = c - b
  if c <= 0:
    print('Yes')
    break
  a = a - d
  if a <= 0:
    print('No')
    break
# Judge status: Accepted
input()
cnt, ans = 0, 0
for i, p in enumerate(map(int, input().split()), start=1):
    if i == p:
        cnt += 1
    else:
        ans += (cnt + 1) // 2
        cnt = 0
else:
    ans += (cnt + 1) // 2
print(ans)
# Judge status: Accepted
n = input()
ans = 0
for i in n:
    ans += int(i)
if ans%9 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
neighbor = [[] for _ in range(n)]

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

cnt = 0
for i in range(n):
    if all([h[i] > h[j] for j in neighbor[i]]):
        cnt += 1
print(cnt)
# Judge status: Accepted
n=int(input())
li = list(map(int,input().split()))

dic={}
for i in li:
    if i not in dic:
        dic[i] = 1
    elif dic[i] >= 1:
        dic[i] += 1
        
#print(dic)
cnt = 0
for i in dic:
    #print(i)
    #print(dic[i])
    if i>dic[i]:
        cnt += dic[i]
    else:
        cnt += dic[i]-i
print(cnt)
# Judge status: Accepted
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(M)]

ans = min(a) + min(b)
for i, (xi, yi, ci) in enumerate(xyc):
    ans = min(ans, max(0, a[xi - 1] + b[yi - 1] - ci))

print(ans)
# Judge status: Wrong Answer
N = int(input())

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist and time%2!=dist%2:
        flg = False
        break
    else:
        bt, bx, xy = t, x, y

if flg:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import defaultdict
import bisect
N = int(input())
A = list(map(int,input().split()))
plus = [A[i]+(i+1) for i in range(N)]
diff = [-A[i]+(i+1) for i in range(N)]

plusc = defaultdict(list)
for i in range(N):
    plusc[plus[i]].append(i)
ans = 0
for i in range(1,N):
    ans += bisect.bisect_left(plusc[diff[i]],i)
print(ans)
# Judge status: Accepted
import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
  _As = [0]*(n+1)
  for j in range(n):
    l = max(0, j - As[j])
    r = min(n - 1, j + As[j])
    _As[l] += 1
    _As[r+1] -= 1
  As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As]))
# Judge status: Accepted
r,g,b=map(int,input().split())
if (r*100+g*10+b)%4==0:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
from sys import stdin


def get_result(data):
    N, A = data[0], data[1]
    return 'Yes' if len(list(set(A))) == len(A) else 'NO'

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)
# Judge status: Wrong Answer
n = int(input())
a= [int(input()) for _ in range(n)]

count = 0
now = a[0]

while now != 2 and count < n:
  now = a[now-1]
  count += 1
print(count if count<n else -1)
# Judge status: Wrong Answer
# 8 = 2 * 2 * 2
# 6 = 2 * 3
x,y= map(int,(input().split()))

result = 0

if x % y == 0:
    result = -1
else:
    result = x * 2


print(result)
# Judge status: Accepted
N=int(input())
A=[int(input()) for _ in range(N)]

ans=A[0]//2
res=A[0]%2
for i in range(1,N):
    ans+=(A[i]+res)//2
    if A[i]>0:
        res=(A[i]+res)%2
    else:
        res=0
print(ans)
# Judge status: Wrong Answer
from itertools import permutations
from math import sqrt, pow, factorial

N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
print(l)

def calc(a, b):
    [x1, y1] = a
    [x2, y2] = b
    return sqrt(pow(x1 - x2, 2) + pow(y1 -y2, 2))
ans = 0
for order in permutations(range(N)):
    tmp = 0
    for i in range(1, N):
        tmp += calc(l[order[i]], l[order[i-1]])
    ans += tmp
print(ans/factorial(N))
# Judge status: Accepted
a,b= map(int,input().split())
if a >= 13:
    print(b)
elif a > 5:
    print(b//2)
elif a <= 5:
    print(0)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
count = 0

for i in range(N-1):
    l = 0
    r = i -1
    while(l< r):
        if (A[l] + A[r] >A[i]):
            count += (r-l)
            r -= 1
        else:
            l += 1
print(count)
# Judge status: Wrong Answer

N = int(input())
A = list(map(int,input().split()))
colors = [0] * 8
for a in A:
  index = min (a // 400,7)

  colors[index] += 1

min_color = sum([1 for c in colors if c != 0])
max_color = min(min_color+colors[-1]-1,7)
print(min_color,max(min_color,max_color))
# Judge status: Accepted
N=int(input()) # 足場の数
H=list(map(int,input().split(" "))) # 足場の高さ
C=[0 for _ in range(N)] # 各足場までの最小コスト

for i in range(1,N):
    if i==1: # 2つ目のは1つ目から移るしかない
        C[1]=C[0]+abs(H[1]-H[0])
    else: # 3つ目以降
        C[i]=min(C[i-1]+abs(H[i]-H[i-1]),C[i-2]+abs(H[i]-H[i-2]))

print(C[-1]) # 最後の足場に行く最小コスト
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
s = 0.5 * (a + b) * h
# Judge status: Wrong Answer
import math

a, b, x = map(int, input().split())

ans = a * (b**2) / (2 * x)
e = 90
s = 0
while e - s > 10**(-8):
    m = (e + s) / 2
    z = math.tan(math.radians(m))
    if z == ans:
        s = m
        break
    elif z > ans:
        e = m
    else:
        s = m
print(s)
# Judge status: Wrong Answer
#O(1)
from math import ceil
a,b = map(int, input().split( ))
if int(min(a/0.08,b/.01))<ceil(max(a/0.08,b/0.1)):
    print(-1)
    exit()
print(ceil(max(a/0.08,b/0.1)))
# Judge status: Accepted
import sys
def input():
    return sys.stdin.readline()[:-1]
q,h,s,d=map(int,input().split())
n=int(input())
li=[[0.25,q],[0.5,h],[1,s]]
li.sort(key=lambda x: x[1]/x[0])
li=[[1,int(li[0][1]/li[0][0])],[2,d]]
li.sort(key=lambda x: x[1]/x[0])
# print(li)
ans=0
now=0
for i in range(2):
    ko=(n-now)//li[i][0]
    ans+=ko*li[i][1]
    now+=ko*li[i][0]
    now=int(now)
    # print(ans,now)
print(int(ans))
# Judge status: Wrong Answer
n = int(input())
x = list(map(int, input().split()))
mid = int(sum(x)/n)
ans = 1000000000
total = 0
for j in range(x[0], x[n-1]):
    for i in range(n):
        total += (x[i] - j)**2
    if total < ans:
        ans = total
        total = 0
print(ans)
# Judge status: Wrong Answer
N= map(int, input())
a = list(map(int,input().split()))
# Judge status: Accepted
W,a,b = map(int, input().split())

if (a <= b <= a+W) or (a <= b+W <= a+W):
    print(0)
else:
    if a+W < b:
        print(abs(b-(a+W)))
    elif b+W < a:
        print(abs(a-(b+W)))
# Judge status: Wrong Answer
import math

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

def is_ok(mid):
    cnt = 0
    for i in range(N):  cnt += math.floor(A[i] / mid)
    return cnt <= K

def binary_search(left, right):
    while (abs(right - left) > 1):
        mid = (left + right) // 2
        if is_ok(mid):  right = mid
        else:  left = mid
    return right

if K == 0:  print(max(A))
else:
    left = max(A) + 1
    right = 0
    ret = binary_search(right, left)
    print(ret)
# Judge status: Wrong Answer
x,y,z=map(int,input().split())
x-=z
c=0
while y<=x:
    x-=y
    x-=z
    c+=1
print(c-1)
# Judge status: Accepted
import sys
import math
import bisect

def main():
    a, b, c = map(int, input().split())
    if a + c == b * 2:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()
# Judge status: Accepted
s = input()
if s[len(s)-1] == "s":
  print(s + "es")
else:
  print(s + "s")
# Judge status: Accepted
def main():
    a, b, n = map(int, input().split())

    ans = int(a * min(b - 1, n) / b) - a * int(min(b - 1, n) / b)

    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
c = input()
a = c.count("R")
ans = 0

for i in range(a):
    if c[i] == "W":
        ans += 1

print(ans)
# Judge status: Accepted

# coding: utf-8
DATA = """
5
1 1 2 2
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

N = int(get_line().strip())

Memo = [0] * (N+1)
for i in get_line().strip().split(" "):
    i = int(i)
    Memo[i] += 1    

for i in range(1, N+1):
    print (Memo[i])
# Judge status: Wrong Answer
X, N= list(map(int, input().split()))
P = list(map(int, input().split()))
if N == 0:
    print(X)
else:
    for i in range(1, 51):
        try:
            P.index(X - i)
        except Exception:
            print(X - i)
            break

        try:
            P.index(X + i)
        except Exception:
            print(X + i)
            break
# Judge status: Accepted
B = input()
order = True
F = ""
for q in range(int(input())):
    T = input().rstrip().split()
    if T[0] == "1":
        order ^= True
    else:
        f,c = T[1],T[2]
        if not((f == "1") ^ order):
            F += c
        else:
            B += c
    #print(F,B)
F = F[::-1]+B
if not order:
    F = F[::-1]
print(F)
# Judge status: Wrong Answer
a,b=map(int,input().split())
c=list(range(b-(a-1),b+(a-1)+1))
print(c)
d=' '.join(map(str,c))
print(d)
# Judge status: Accepted
import math

n = int(input())

town = []

ans = 0

for i in range(n):
    town.append(list(map(int,input().split())))

for i in range(n):
    for s in range(i,n):
        ans += math.sqrt((town[i][0]-town[s][0])**2+(town[i][1]-town[s][1])**2)
        
print(ans*2/n)
# Judge status: Accepted
def main():
    s = input()
    zero = s.count("0")
    one = s.count("1")
    print(min(zero, one) * 2)

main()
# Judge status: Wrong Answer
n=int(input())
w=list(map(int,input().split()))
m = sum(w)//2
s = 0
for i in range(n):
  s += w[i]
  if s >= m:
    if s == m:
      print(0)
      break
    else:
      print(abs(m-s)+1)
      break
# Judge status: Accepted
a,b,c,k=map(int,input().split())
if k%2==1:
    print(b-a)
else:
    print(a-b)
# Judge status: Wrong Answer
li=[]
ld=[]
k=0
ans=0
n,m,q=map(int,input().split())
A=[1]*n
for i in range(q):
    a,b,c,d=map(int,input().split())
    li.append([a,b,c])
    ld.append(d)
    if d>k:
        k=d
for i in range(q):
    dm=sorted(ld,reverse=True)[i]
    lia=li[ld.index(dm)]
    if A[lia[1]-1]==1:
        A[lia[1]-1]=A[lia[1]-lia[0]-1]+lia[2]
        ans+=dm
print(ans)
# Judge status: Wrong Answer
s = input() 
l = [int(x) for x in s]

if l[0] == 7 or l[1] == 7 or l[2] == 7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n=int(input())
s= [1 if c=="I" else -1  for c in input() ] 
ans=[0]
for i in range(n):
    ans.append(sum(s[:i+1]))
print (max(ans))
# Judge status: Accepted
N = int(input())
p = list(map(int,input().split()))
ans = 0
k = 0
while k < N:
    if p[k] == k+1:
        k += 1
        ans += 1
    k += 1
print(ans)
# Judge status: Wrong Answer
import numpy as np
let= raw_input()

letters="abcdefghijklmnopqrstuvwxyz"
print( letters[np.argmax(let)+1])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
s = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
    b,c = map(int,input().split())
    tmp = cc[b]
    cc[b] = 0
    s=s-b*tmp+c*tmp
    cc[c]+=tmp
    print(s)
# Judge status: Accepted
s = input()
if len(set(s)) - len(s) == 0:
    print('yes')
else:
    print('no')
# Judge status: Wrong Answer
N=int(input())
list=[]
for i in range(N):
  list.append(input())
  
print(len(list))
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
Pt=[0,p,r,s]
Ans=[0]*k
Prev=[0]*k
for i in range(n):
  if t[i]=="r":
    cur=1
  elif t[i]=="s":
    cur=2
  else:
    cur=3
  ii=i%k
  if Prev[ii]==cur:
    Prev[ii]=0
  else:
    Ans[ii]+=Pt[cur]
    Prev[ii]=cur
print(sum(Ans))
# Judge status: Accepted
# -*- coding: utf-8 -*-

a = int(input())
s = str(input())

if a >= 3200:
    print(s)
else:
    print('red')
# Judge status: Accepted
#

import sys
input=sys.stdin.readline

def main():
    N = int(input())
    R = [tuple(map(int, input().split())) for i in range(N)]
    A = sorted(R, key = lambda x: x[0] + x[1])
    B = sorted(R, key = lambda x: x[0] - x[1])
    a = abs(A[-1][0] - A[0][0]) + abs(A[-1][1] - A[0][1])
    b = abs(B[-1][0] - B[0][0]) + abs(B[-1][1] - B[0][1])
    print(max(a, b))
    
    
    
if __name__=="__main__":
    main()
# Judge status: Accepted
s=list(input())
t=list(input())
ans=0
for i in range(len(s)):
  if s[i]!=t[i]:
    ans+=1
print(ans)
# Judge status: Wrong Answer
s, w = map(int, input().split())  # 入力

if w >= s / 2:
    ans = 'unsafe'
else:
    ans = 'safe'
print(ans)
# Judge status: Accepted
import math
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n-1):
  ans = math.gcd(ans,a[i+1])
print(ans)
# Judge status: Accepted
import math
h=int(input())
i=int(math.log(h,2))
print((2**(i+1))-1)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
 
eight = 0
one = 0
two = 0
 
 
for i in A:
    if i%4 == 0:
        eight = eight + 1
    if i == 1:
        one = one + 1
    if i % 2 == 0 and i % 4 != 0:
        two = two + 1
 
if len(A)//2 <= eight:
    print("Yes")
elif (len(A)//2) <= (eight + (two//2)):
    print("Yes")
 
elif (eight >= one) and (eight + one +(two//2)) > (len(A)//2):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
S=input()
T=input()
if T.startswith(S):
    if len(T)==len(S)+1:
        print('YES')
else:
    print('NO')
# Judge status: Accepted
(n,m)=map(int,input().split())
a=list(map(int,input().split()))
i=max(-1,n-sum(a))
print(i)
# Judge status: Accepted
from collections import defaultdict

s=input()
t=input()

n=len(s)

ss=defaultdict(list)
tt=defaultdict(list)

for i in range(n):
  ss[s[i]].append(i)
  tt[t[i]].append(i)

  
sss=[]
ttt=[]
for k,v in ss.items():
  sss.append(v)
for k,v in tt.items():
  ttt.append(v)

sss.sort()
ttt.sort()


ans="No"
if sss==ttt:
  ans="Yes"
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

S = int(input())

if S == 1 or S == 2 or S == 4:
    print(4)
    exit()

A = [S]
e = S
cnt = 0
while True:
    if e % 2 == 0:
        v = e//2
    else:
        v = 3*e+1
    A.append(v)
    e = v
    cnt += 1
    if v == 4:
        print(cnt+4)
        exit()
# Judge status: Accepted

url = "https://atcoder.jp//contests/abc129/tasks/abc129_a"

def main():
    p, q, r = list(map(int, input().split()))
    print(sum([p,q,r]) - max(p,q,r))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
jdg = False
if a + b == c: jdg = True
if b + c == a: jdg = True
if c + a == b: jdg = True
print( 'Yes' if jdg else 'No')
# Judge status: Accepted
a,b,c = map(int,input().split())
res = 0
if a*b*c%2!=0:
    res = min([a*b,b*c,c*a])
print(res)
# Judge status: Wrong Answer
import math

n, m = map(int, input().split(" "))
aL = sorted(list(map(int, input().split(" "))))
bcL = sorted([list(map(int,
                       input().split(" "))) for _ in range(m)],
             key=lambda x: x[1],
             reverse=True)

csl = 0
for cnt, point in bcL:
    for i in range(cnt):
        if aL[csl] >= point or csl == n - 1:
            print(sum(aL))
            exit()
        aL[csl] = point
        csl += 1

print(sum(aL))
exit()
# Judge status: Accepted
a, b, c, d=map(int,input().split())
for i in range(100):
    c = c -b
    if c <= 0:
        print('Yes')
        break
    a = a - d
    if a <= 0:
        print('No')
        break
# Judge status: Wrong Answer
n=int(input())
s=input()
t=input()
for i in range(n):
  if s[n-i-1:]==t[:i+1]:
    print(2*n-i-1)
    exit()
print(2*n)
# Judge status: Wrong Answer
n,k = map(int,input().split())
import itertools

grid = []
for i in range(2*k):
    array = list(map(int, input().strip().split()))
    grid.append(array)
print(grid)
l = []
for j in range (k):
    l.append(grid[0+2*j+1])
print(l)
lis = list(itertools.chain.from_iterable(l))
print(lis)
count = 0
for m in range(n):
    if m+1 in lis:
        count = count +1
print(n - count)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

M = 0
sum = 0
for i in range(N):
  sum += A[i]

for i in range(N-1):
  sum = sum - A[i]
  M += A[i] * sum
  if M > 10 ** 9 + 7:
    M = M % (10 ** 9 + 7)
print(M)
# Judge status: Accepted
n = list(input())

if n[0] == "9" or n[1] == "9":
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    print(a-1,b)
else: print(a,b-1)
# Judge status: Accepted
n, k, s = map(int, input().split())
ans = [0] * n
for i in range(k): ans[i] = s
for i in range(k, n): ans[i] = s+1-2*(s==1e9)
print(*ans)
# Judge status: Accepted
N = input()

if ("9" in N):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
s = input()

d = {}
for x in s:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

ans = 1
for x in d.values():
    ans *= x+1

print(ans - 1)
# Judge status: Wrong Answer
H,N = map(int,input().split())
T = []
for i in range(N):
    a,b = map(int,input().split())
    T.append([a,b])

dp = [10**9]*(H+10**3+1)
dp[0] = 0
for i in range(1,H+10**3+1):
    for j in range(N):
        if i - T[j][0] >= 0:
            dp[i] = min(dp[i],dp[i-T[j][0]]+T[j][1])

for i in range(H,H+10**3+1):
    if dp[i] != 10**9:
        print(dp[i])
        break
# Judge status: Accepted
n = int(input())
power = 1
for i in range(1, n+1):
    power = (power * i) % 1000000007
print(power)
# Judge status: Wrong Answer
N = int(input())

def solve(N):
    ans = 0
    a = (N // 11) * 2
    b = N % 11
    
    if b == 0:
        ans = a
    elif 0 < b <= 5:
        ans = a + 1
    else:
        ans = a + 2
    return ans

print(solve(N-1))
# Judge status: Accepted
# ABC057
# B
# Checkpoints

n, m = map(int, input().split())
ax = [None]*n
by = [None]*n
cx = [None]*m
dy = [None]*m

d_list = [[None]*m for i in range(n)]

for i in range(n):
    ax[i],by[i] = map(int, input().split())
for i in range(m):
    cx[i],dy[i] = map(int, input().split())

for i in range(n):
    for j in range(m):
        d_list[i][j] = abs(ax[i]-cx[j]) + abs(by[i]-dy[j])
        
for i in range(n):
    print(d_list[i].index(min(d_list[i]))+1)
# Judge status: Accepted
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
ma=max(a)
if a.count(ma)>1:
  for i in range(n):
    print(ma)

else:
  for i in range(n):
    if a[i]==ma:
      a[i]=0
      print(max(a))
    else:
      print(ma)
# Judge status: Wrong Answer
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))

diff = []
for i in H:
	diff.append(abs(A-T+i*0.006))

diffmin = diff[0]
ans = 0
for i in range(N):
	if diffmin > diff[i]:
		diffmin = diff[i]
		ans = i
print(ans)
# Judge status: Accepted
n,k,q = map(int, input().split())
pdic = {}
for i in range(q):
    p = int(input())
    if p in pdic:
        pdic[p] += 1
    else:
        pdic[p] = 1
for i in range(1,n+1):
    if i in pdic:
        if k + pdic[i] - q <= 0:
            print('No')
        else:
            print('Yes')
    else:
        if k - q <= 0:
            print('No')
        else:
            print('Yes')
# Judge status: Accepted
import numpy as np

K, S = map(int, input().split())
fft_len = 1 << (K * 3).bit_length()

x = np.ones(K + 1)
Fx = np.fft.rfft(x, fft_len)
Fx3 = Fx * Fx * Fx
conv = np.fft.irfft(Fx3, fft_len)

ans = conv[S]
ans = int(ans + 0.5)
print(ans)
# Judge status: Wrong Answer
from math import ceil


def main():
    length = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    required_operation = sum(b) - sum(a)
    count_operation = 0
    for i in range(length):
        if a[i] < b[i]:
            count_operation += ceil((b[i] - a[i]) / 2)
        else:
            count_operation += a[i] - b[i]
    print("Yes" if required_operation == count_operation else "No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
import collections
N = int(input())
nums = list(map(int, input().split()))
Q = int(input())
nums_hash = collections.Counter(nums)
sum_point = sum(nums)
for _ in range(Q):
    # print(nums_hash)
    b, c = map(int, input().split())
    if b in nums_hash:
        sum_point = (sum_point - (b * nums_hash[b]) + (c * nums_hash[b]))
    print(sum_point)
    nums_hash[c] += nums_hash[b]
    nums_hash[b] = 0
# Judge status: Wrong Answer
print("Yes" if sorted(input())<sorted(input()) else "No")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A = sorted(A)
flag = 0
for i in range(N-1):
    if A[i]==A[i+1]:
        flag = 1
        break
if flag == 0:
    print('YES')
else:
    print("NO")
# Judge status: Accepted
k, x = map(int, input().split())

ret = "No"
if k * 500 >= x:
    ret = "Yes"

print("{}".format(ret))
# Judge status: Accepted
s = list(input())
t = list(input())

l_s = len(s)
l_t = len(t)

change = l_t
for i in range(l_s - l_t + 1):
    change_temp = 0
    for j in range(l_t):
        if s[i+j] != t[j]:
            change_temp += 1

    change = min(change, change_temp)

print(change)
# Judge status: Accepted
A,B=map(int,input().split())
K=abs((A+B)/2)
if K.is_integer()==True:
    print(int(K))
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
N, A, B, C, D = map(int, input().split())
S = input()

if C < D:
    if "##" in S[A - 1:C] or "##" in S[B - 1:D]:
        print("No")
    else:
        print("Yes")
else:
    if "..." in S[B - 2:D + 1] and "##" not in S[A - 1:C] and "##" not in S[B - 1:D]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
s=input()
f=int(s[:2])
b=int(s[2:])
if f>=13:
	if 0<b and b<13:
		print("YYMM")
	else:
		print("NA")
elif 0<f and f<13:
	if 0<b and b<13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	print("NA")
# Judge status: Wrong Answer
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)

if (B-A)%2 == 0:
  count = (B-A)/2
else:
  if (N-B)<A-1:
    count = (N-B)+1+((N-(A+(N-B)+1))/2)
  else:
    count = (A-1)+1+((((B-(A-1))-1)-1)/2)

print(int(count))
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

start = 0
for i in range(N):
    if A[i] == 1:
        start = i
        break

ans = N
for i in range(K):
    cnt = 1
    left = start + 1 - K + i
    if left > 0:
        if left % (K - 1) != 0: cnt += 1
        cnt += left // (K - 1)

    raight = N -1 - start - i
    if raight > 0:
        if raight % (K - 1) != 0: cnt += 1
        cnt += raight // (K - 1)
    ans = min(ans, cnt)

print(ans)
# Judge status: Accepted
[r, g, b] = list(input().split())
rgb = int(r + g + b)
if rgb % 4 == 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
# -*- coding: utf-8 -*-
import collections
n, m = map(int,input().split())
ab = []
for i in range(m):
    ab.extend(list(map(int, input().split())))

c = collections.Counter(ab)
for i in range(1,n + 1):
    print(c[i])