peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))
Q = []
m = 10**17
for p in P:
    m = min(m, p)
    Q.append(m)
c = 0
for x, y in zip(P, Q):
    if x <= y:
        c += 1
print(c)
# Judge status: Accepted
import sys
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i%2==0:
    if i%3!=0 and i%5!=0:
      print("DENIED")
      sys.exit()
      
print("APPROVED")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = y = 0
for i in range(n):
    x += b[i]-a[i]
    if a[i]<b[i]: y+=(b[i]-a[i]+1)//2
print("YNeos"[y>x::2])
# Judge status: Accepted
raw = input()
N, K = raw.split(' ')
N = int(N)
K = int(K)
str_li = input().split(' ')
num_li = list(map(int, str_li))
sum_li = [0]
for i in num_li:
    sum_li.append(sum_li[-1] + i + 1)
ans = 0
for index in range(K, N+1):
    ans_tmp = sum_li[index] - sum_li[index - K]
    if ans_tmp > ans:
        ans = ans_tmp
print(ans/2)
# Judge status: Wrong Answer
from collections import deque

s = input()
q = int(input())
query = [list(input().split()) for i in range(q)]
now = 0
a = deque([s])
for i in query:
  if i[0] == "1":
    now ^= 1
  elif i[0] == "2":
    f,c = int(i[1]),i[2]
    if (f+now) % 2:
      a.appendleft(c)
    else:
      a.append(c)
if now:
  a.reverse()
ans = "".join(a)
print(ans)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
beforeKill = 0
for i in range(n):
    kill1 = min(A[i], B[i] - beforeKill)
    kill2 = max(min(A[i+1], B[i]-kill1), 0)
    cnt += kill1 + kill2
    beforeKill = kill2
print(cnt)
# Judge status: Accepted
N = int(input())
A = [int(m) for m in input().split(" ")]
B = [int(b) for b in input().split(" ")]

Sum = 0

for i in range(N):
    ai = A[i]
    ai_1 = A[i+1]
    a = ai_1 + ai
    b = B[i]
    if a<=b:
        A[i+1]=0
        Sum+=a
    else:
        if (ai - b)>0:
            Sum+=(b)
        else:
            A[i+1] = a-b
            Sum+=b
print(Sum)
# Judge status: Wrong Answer
n= int(input())
List = []
for i in range(n):
  x = int(input())
  List.append(x)
List = sorted(List)
total = sum(List)
for item in List:
  if total % 10 != 0:
    print(total)
    exit()
  elif total % 10 == 0:
    if item % 10 != 0:
      print(total-item)
      exit()
    else:
      total -= item
print(total)
# Judge status: Accepted
def main():
    a, b, c, d = map(int, input().split())
    if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
d=int(input())
ans={25:"Christmas",24:"Cristmas Eve",23:"Cristmas Eve Eve",22:"Cristmas Eve Eve Eve"}
print(ans[d])
# Judge status: Wrong Answer
import collections
i,j = 0,0 
s = raw_input()
q = collections.deque([])
while(j < len(s)):
	while(j < len(s) and s[j] == s[i]): j+=1
	q.append(j - i )
	i = j

ns = len(s)
while(len(q) > 1):
	u,v = q.popleft(), q.popleft()
	if q:  q[0] += abs(u-v)
print ns - (q[0] if q else 0)
# Judge status: Accepted
from collections import deque

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

d = deque()

for i in range(n):
    if n%2 == 0 and i%2 == 0:
        d.append(a[i])
    elif n%2==1 and i%2==1:
        d.append(a[i])
    else:
        d.appendleft(a[i])
print(' '.join(map(str,list(d))))
# Judge status: Accepted
s = str(input())
t = str(input())


if  1 <= len(s) and len(s) <= 10 and len(t) == len(s) + 1 and t.startswith(s):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from math import gcd
n=int(input())
ans=0
for i in range(n+1):
    for j in range(n+1):
        gcd_ij=gcd(i,j)
        for k in range(n+1):
            ans+=gcd(gcd_ij,k)
print(ans)
# Judge status: Accepted
anims, legs = map(int, input().split(' '))

for crane in range(anims + 1):
    if crane * 2 + (anims - crane) * 4 == legs:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
N = int(input())
strlist = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']


ans = [['a']]
for i in range(1, N):
  ans.append([])
  for s in ans[i-1]:
    n = len(set(s))
    for j in range(n+1):
      ans[i].append(s+strlist[j])

ans.sort()
print(*ans[-1], sep='\n')
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

m1, m2 = 0, 0
for a in A:
    if a >= m1:
        m2 = m1
        m1 = a
    elif a > m2:
        m2 = a

for a in A:
    if a == m1:
        print(m2)
    else:
        print(m1)
# Judge status: Accepted
import heapq
n,m= map(int,input().split())
feeindays = [[] for _ in range(m)]
for i in range(n):
    a,b= map(int,input().split())
    if a<=m:feeindays[a-1]+=[b]
q=[]
heapq.heapify(q)
pay=0
for l in feeindays:
    for c in l:heapq.heappush(q,-c)
    if len(q)!=0:pay+=-1 * heapq.heappop(q)
print(pay)
# Judge status: Wrong Answer
N = [input().split() for l in range(2)]

length = int(N[0][0])

array = []
for i in range(length):
  tmp = []
  for j in range(length):
    if i != j:
      tmp.extend(N[1][j])
  array.append(sorted(tmp))

#print(array)
for line in array:
  print(line[int(len(line)/2)])
# Judge status: Wrong Answer
n = int(input())
ans = 0
for i in range(n+1):
    if (i % 3 != 0) and (i % 5 != 0):
        ans += 0
print(ans)
# Judge status: Accepted
C = list(map(int, input().split()))
 
C.sort()
 
if C[2] == C[1] + C[0]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
r, g, b = map(int, input().split())
sum = r * 100 + g * 10 + b
if sum % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n,m=input().split()
n=int(n)
m=int(m)
f=[0]*n
wa=[0]*n
ac=0
for i in range(m):
    p,s=input().split()
    p=int(p)-1
    if f[p]==1:
        continue
    if s=="WA":
        wa[p]+=1
    else:
        ac+=1
        f[p]=1
x=0
for i in range(n):
    if f[i]==1:
        x+=wa[i]
print(ac,x)
# Judge status: Accepted
c11, c12, c13 = map(int, input().split())
c21, c22, c23 = map(int, input().split())
c31, c32, c33 = map(int, input().split())

if not(c12-c11 == c22-c21 == c32-c31):
    print("No")
    quit()
if not(c13-c12 == c23-c22 == c33-c32):
    print("No")
    quit()
if not(c21-c11 == c22-c12 == c23-c13):
    print("No")
    quit()
if not(c31-c21 == c32-c22 == c33-c23):
    print("No")
    quit()

print("Yes")
# Judge status: Accepted
N,L = map(int,input().split())
NL = [int(i)+L-1 for i in range(1,N+1)]
SNL = sum(NL)
ate = 10**18
count = 0
for i in range(N):
  ate = min(ate,abs(NL[i]))
  if ate == abs(NL[i]):
    count = i
print(SNL-NL[count])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

list =[0] * n

for i in range(n-1):
    list[a[i]-1] += 1


for i in range(n):
    print(list[i])
# Judge status: Accepted
from collections import defaultdict
from string import ascii_letters

n = int(input())
words = [input() for _ in range(n)]

ans = ''
for c in ascii_letters:
    cnt = 50
    for w in words:
        cnt = min(cnt, w.count(c))
    ans += c * cnt
print(ans)
# Judge status: Accepted
from math import log2, floor

N = int(input())

print(pow(2, floor((log2(N)))))
# Judge status: Accepted
W, H, N = map(int, input().split())
bl_x, tr_x, bl_y, tr_y = 0, W, 0, H
for i in range(N):
	x, y, a = map(int, input().split())
	if a == 1:
		bl_x = max(bl_x, x)
	elif a == 2:
		tr_x = min(tr_x, x)
	elif a == 3:
		bl_y = max(bl_y, y)
	elif a == 4:
		tr_y = min(tr_y, y)
print(max(tr_x - bl_x, 0) * max(tr_y - bl_y, 0))
# Judge status: Wrong Answer
s = input()
n = len(s)
ans = 999
for i in range(n-3):
    kar = int(s[i:i+3])

    ans = min(ans,abs(kar-753)) 
print(ans)
# Judge status: Accepted
N, M = map(int,input().split())
students = []
points = []
for _ in range(N):
    students.append(list(map(int,input().split())))
for _ in range(M):
    points.append(list(map(int,input().split())))
for i in range(N):
    ans = -1
    MIN = float('inf')
    for j in range(M):
        a, b = students[i]
        c, d = points[j]
        if MIN > abs(a-c) + abs(b-d):
            MIN = abs(a-c) + abs(b-d)
            ans = j + 1
    print(ans)
# Judge status: Accepted
N, L = map(int, input().split())
A = [L+i for i in range(N)]
if A[0] >= 0:
  print(sum(A) - A[0])
  exit()
if A[-1] <= 0:
  print(sum(A) - A[-1])
  exit()
print(sum(A))
# Judge status: Accepted
n = int(input())
nums = list(map(int, input().split()))
if n == 0:
  if nums[0] == 1:
    print(1)
  else:
    print(-1)
  exit()
if n > 0 and nums[0] != 0:
  print(-1)
  exit()
n_nods = 1
ans = 1
ret = sum(nums)
for i in range(1,n+1):
  n_nods = min(n_nods*2,ret)
  ans += n_nods
  ret -= nums[i]
  n_nods -= nums[i]
  if n_nods < 0:
    print(-1)
    exit()
  if n_nods == 0 and i < n:
    print(-1)
    exit()
print(ans)
# Judge status: Accepted
import sys
n,m,k=map(int,input().split())
#n:vertical
#m:horizontal
for i in range(n+1):
    for j in range(m+1):
        v=i*(m-j)+j*(n-i)
        if v==k:
            print('Yes')
            sys.exit()
print('No')
# Judge status: Accepted
s = input()
s = ''.join(sorted(s))
t = input()
t = ''.join(sorted(t, reverse=True))
if s < t:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

while K != 0:
    if B <= A:
        B *= 2
    elif C <= B:
        C *= 2
    else:
        break
    K -= 1

if (A < B) and (B < C):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

ans = 0
for i in range(n):
    c = sum(A[0][:i + 1]) + sum(A[1][i:])
    ans = max(c, ans)
print(ans)
# Judge status: Wrong Answer
N,K = map(int,input().split())
S = input()

S[K-1].lower()
print(S)
# Judge status: Accepted
N, K = map(int, input().split())
A_list = list(map(int, input().split()))

for i in range(K, N):
  if A_list[i - K] < A_list[i]:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
a, b, c, k = map(int, input().split())
if k % 2 == 0:
  ans = a-b
else:
  ans = b-a
print(ans)
# Judge status: Accepted
N,M=map(int, input().split())
A=set(int(input()) for _ in range(M))
D=[0]*(N+1)
D[0]=1

for i in range(1,N+1):
 if i in A: continue
 D[i]=(D[i-1]+D[i-2])%(10**9+7)
print(D[-1])
# Judge status: Wrong Answer
import math
n,d=map(int,input().split())
x=n/(n*d+1)
print(math.ceil(x))
# Judge status: Accepted
N = int(input())
count = 0
for i in range(N):
  D1,D2 = map(int,input().split())
  if D1 == D2:
    count += 1
    if count == 3:
      print('Yes')
      exit()
  else:
    count = 0
print('No')
# Judge status: Accepted
from collections import OrderedDict

N = int(input())
S = input()

ans = 0
for i in range(N):
    if (i == N - 1):
        break
    L = ''.join(OrderedDict.fromkeys(S[0:i + 1]))
    R = ''.join(OrderedDict.fromkeys(S[i + 1:]))
    count = 0
    for j in range(len(L)):
        if (L[j] in R):
            count += 1
        else:
            continue
    ans = max(ans, count)

print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())

if any(map(lambda x: x % 2 == 1, (A, B, C))):
    print(0)
elif A == B == C:
    print(-1)
else:
    count = 0
    while True:
        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        count += 1
        if any(map(lambda x: x % 2 == 1, (A, B, C))):
            break
    print(count)
# Judge status: Accepted
N = int(input())
S = input()
pool = [0]
ans = 0
for i in range(N):
    if S[i] == 'I':
        ans += 1
    else:
        ans -= 1
    pool.append(ans)
print(max(pool))
# Judge status: Wrong Answer
N = int(input())
*A, = map(int, input().split())
count = 0

ans = N//3+max(N%3,0)
for i in range(len(A)):
    if A[i]%4==0:
        count = count + 1

if count>=ans:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
s = input()
n = int(input())
for i in s:
	if i != '1':
		print(i)
		sys.exit()
# Judge status: Wrong Answer
a,b = map(int, input().split())

print(a+b/2)
# Judge status: Accepted
A,B,C,X,Y = map(int,input().split())

res = A*X +B*Y

for i in range(0,max(X,Y)+1):
  cand = 2*i*C + max(0,X-i)*A + max(0,Y-i)*B
  res = min(res,cand)
print(res)
# Judge status: Accepted
n,k = map(int, input().split())
hito = []
for i in range(k):
  d = int(input())
  x = list(map(int, input().split()))
  for j in range(d):
    hito.append(x[j])
a = list(set(hito))
ans = n
for i in range(n):
  if i+1 in a:
    ans -= 1
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
L = 1
R = N

for n in range(M):
    l, r = map(int, input().split())
    L = max(l, L)
    R = min(r, R)

print(max(0, R - L + 1))
# Judge status: Wrong Answer
n, k= map(int, input().split())
num = range(1,n)
c = set()
num = set(num)
for i in range(k):
  a = input()
  b = set(list(map(int, input().split())))
  c = b | c
num = list(num -c)
print(len(num))
# Judge status: Wrong Answer
x,y = map(int, input().split())

z = y//x 

import math 

res = math.log(z,2)

print(int(res)+1)
# Judge status: Accepted
N,X,Y=map(int,input().split())

Ans=[0]*N

i=1
d=0
while i<=N:
    j=i+1
    while j<=N:
        d=(min(j-i,abs(X-i)+1+abs(j-Y)))
        Ans[d]+=1
        j+=1
    i+=1

k=1
while k<=N-1:
    print(Ans[k])
    k+=1
# Judge status: Accepted
W, a, b = list(map(int, input().split()))

if abs(a - b) <= W:
    print(0)
else:
    print(abs(a - b) - W)
# Judge status: Wrong Answer
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
A = sorted(list(map(int,input().split())))
B = []
for i in range(1,N):
    b = gcd(A[0],A[i])
    if b==1:
        B.append(b)
if len(B)==0 or len(B)>1:
    A[0] = A[1]
elif len(B)==1:
    A[B[0]] = A[0]
a = A[0]
for i in range(1,N):
    a = gcd(a,A[i])
print(a)
# Judge status: Accepted
alpha=list('abcdefghijklmnopqrstuvwxyz')
a=input()
print(alpha[alpha.index(a)+1])
# Judge status: Accepted
import collections

li = list(map(int,input().split()))

c = collections.Counter(li)

if len(c) == 2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())
 
sorted(S_list)
name_list = []
vote_list = []
i, j = 0, 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for k in range(len(name_list)):
  if vote_list[k] == max_vote:
    print (name_list[k])
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
A=[0]+A
B=[0]*(N+1)
for i in range(N):
  k=N-i 
  c=0
  for j in range(k,N+1,k):
    c+=B[j]
    c%=2
  if A[k]!=c:
    B[k]=1
    
print(sum(B))
for i in range(len(B)):
  if B[i]==1:
    print(i)
# Judge status: Wrong Answer
X=int()
Y=int()
Z=int()
1<=X,Y,Z<=100
X,Y=Y,X
Y,Z=Z,Y
# Judge status: Accepted
from math import gcd
N = int(input())
A = list(map(int,input().split()))

front = [0] * N
front[0] = A[0]
for i in range(1,N):
    front[i] = gcd(front[i-1],A[i])
back = [0] * N
back[-1] = A[-1]
for i in reversed(range(N-1)):
    back[i] = gcd(back[i+1],A[i])

ans = max(front[-2],back[1])
for i in range(N-2):
    ans = max(ans,gcd(front[i],back[i+2]))
print(ans)
# Judge status: Accepted
N = int(input())
c = list(input())
count = 0
i = 0
j = N-1
while i < j:
    while c[i] == "R" and i <= N-2:
        i += 1
    while c[j] == "W" and j >= 1:
        j -= 1
    if i < j:
        count += 1
    i += 1
    j -= 1
    if i >= j or i >= N or j <= 0:
        break
print(count)
# Judge status: Accepted
x,y = map(int,input().split())
i =x
ans = []
while y >= i:
    i *= 2
    ans.append(i)
print(len(ans))
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
c=p=m=0
for i in l:
  c=(c+1)*(i<=p)
  m=max(m,c)
  p=i
print(m)
# Judge status: Wrong Answer
def evenodd(a,b):
  if (a * b) % 2 == 1:
    print("Odd")
  else:
    print("Even")
# Judge status: Wrong Answer
import itertools
import math
N=int(input())
R=list(range(1,N+1))
a=tuple(map(int,input().split()))
ai=0
b=tuple(map(int,input().split()))
bs=0
c=0
i=0
K=list(itertools.permutations(R))
for i in range(math.factorial(N)):
  if K[i]==a:
    ai=i
    c+=1
  elif K[i]==b:
    bs=i
    c+=1
  elif c==2:
    break
print(abs(ai-bs))
# Judge status: Wrong Answer
S = input().replace("eraser","").replace("erase","").replace("dream","").replace("dreamer","")

if S:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
from collections import deque

s = deque( list(input()) )
q = int(input())

l_q = []
for i in range(q):
  l_q.append( list(input().split())  ) 

#クエリ処理
c = 0
for i in l_q:

  if i[0] == "1":
    c = (c+1)%2

  else:
    if (c+int(i[1]))%2 ==1:
      s.appendleft(i[2])
    else:
      s.append(i[2])

s=list(s)

if c == 1:
  s.reverse()

s = ''.join(s)
print(s)
# Judge status: Wrong Answer
n = int(input())
num = [0]*(10**5+1)
for i in range(1,51):
    for j in range(1,51):
        for k in range(1,51):
            num[(i**2 + j**2 + k**2 + i*j + j*k + k*i)] += 1
for i in range(1,n+1):
    print(num[i])
# Judge status: Accepted
import bisect
N = int(input())
A = list(map(int, input().split()))

A.sort()
i = A[-1]
middle = i/2
j_right = bisect.bisect_right(A, middle)
left = A[j_right - 1]
right = A[j_right]
if abs(middle - left) <= abs(middle - right):
    j = left
else:
    j = right
print(i, j)
# Judge status: Wrong Answer
a,b=map(int,input().split())
print(max(a,b)+max(a,b)-1)
# Judge status: Accepted
n,m,x,y=map(int,input().strip().split(" "))
ar1=[int(i) for i in input().strip().split(" ")]
ar2=[int(i) for i in input().strip().split(" ")]
ar1.append(x)
ar2.append(y)
m1=max(ar1)
m2=min(ar2)
if m2>m1:
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
A, B = map(int, input().split())

if A + B > 24:
    print(A + B - 24)
else:
    print(A + B)
# Judge status: Wrong Answer
a,b,c,d=map(int,input().split())
print(max(a*c,b*d))
# Judge status: Wrong Answer
n=int(input())
print(0 if n==0 else 1)
# Judge status: Accepted
N = int(input())
gre = [3,5,7]

if (N in gre):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N,L = map(int, input().split())
s = [input() for i in range(N)]
s.sort()
print(''.join(s))
# Judge status: Accepted
n,k = map(int, input().split())
h = [int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1] - h[i] for i in range(n-k+1)))
# Judge status: Accepted
n = int(input())
arr = [int(x) for x in input().split()]
arr.insert(0,0)
prefix = [0 for x in range(n+1)]
for i in range(1,n+1):
    prefix[i] = prefix[i-1]+arr[i];

ans = 0
mod = int(1e9+7)
for i in range(1,n):
    ans += arr[i]*(prefix[n]-prefix[i])
print(ans%mod)
# Judge status: Wrong Answer

N = int(input())

print(1.0/2.0 if (N%2)==0 else (N+1)/2*N)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    if a[i] >= b[i]:
        ans += b[i]
    else:
        ans += a[i]
        nxt = min(a[i+1], b[i]-a[i])
        ans += nxt
        a[i+1] -= nxt
print(ans)
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
S = input()
R = 1000000007

#%%
count = Counter(S)
ans = 1
for c in count.values():
    ans *= (c + 1) % R

print(ans - 1)
# Judge status: Wrong Answer
n=int(input())
a=0
for i in range(1,n+1):
    a+=i**2
print(a)
# Judge status: Accepted
n = int(input())
L = list(map(int,input().split()))
curmin = L[0]
cnt = 1
for i in range(1,n):
  if L[i] < curmin:
    cnt += 1
    curmin = L[i]
print(cnt)
# Judge status: Accepted
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = list(map(int,input().split()))

cnt = 0
for i in range(N):
    if A[i] < 0:
        cnt += 1
        A[i] *= -1

A.sort()

if cnt%2==0:
    print(sum(A))
else:
    print(sum(A)- A[0]*2)
# Judge status: Wrong Answer
n = int(input())

l = [1] + [pow(6,i) for i in range(1,15)] + [pow(9,i) for i in range(1,10)]
l.sort(reverse=True)
ans = 0

for i in l:
  ans += n // i
  n = n % i
print(ans)
# Judge status: Wrong Answer
s = input()
n =(len(s)-1)//2
for i in range(n,0,-1):
  if s[0:i]==s[i:2*i]:
    print(i*2)
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline

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

    plus = 0
    minus = 0
    for a, b in zip(A, B):
        if b - a > 0:
            plus += (b - a)//2
        else:
            minus += a - b
    if plus >= minus:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C = list(map(int,input().split()))

K = int(input())

while A>=B:
    B*=2
    K-=1

while B>=C:
    C*=2
    K-=1

if K>=0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
a = input()

for bit in range(2**3):
    x = a[0]
    for i in range(3):
        if ((bit>>i) & 1):
            x += "+"
        else:
            x += "-"
        x += a[i+1]
    if eval(x) == 7:
        print(str(x)+"=7")
        sys.exit()
# Judge status: Wrong Answer
A,B,T=map(int,input().split())
a=T+0.5
b=(a//A)
print(b*B)
# Judge status: Wrong Answer
S=input()
l=len(S)
x=['A','C','G','T']
a=0
m=0
for i in range(l):
    if S[i] in x:
        a+=1
    else:
        if a>m:
            m=a
        a=0
print(m)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

A= [i for i in A if i%2==0]
if len( [j for j in A if not ((j%3==0)or(j%5==0))]) == 0:
    print("APPROVED")
else:
    print("DENIED")
# Judge status: Accepted
x=int(input())
ans=(x//11)*2
if x%11>6: ans+=2
elif x%11>0: ans+=1
print(ans)
# Judge status: Accepted
import bisect
n = int(input())
A = list(map(int,input().split()))
A.sort()
if n == 2:
  ans = [A[1],A[0]]
  print(*ans)
  exit()
MAX = A[-1]
target = MAX//2
ok = 0
ng = n
while abs(ok-ng)>1:
  mid = (ok+ng)//2
  if A[mid] <= target:
    ok = mid
  else:
    ng = mid
ans = [MAX,A[ok]]

nxt = ok+1
#print(A[nxt])
if nxt < n:
  dif0 = min(MAX-A[ok],A[ok])
  dif1 = min(MAX-A[nxt],A[nxt])
  if dif0 < dif1:
    ans[1] = A[nxt]
print(*ans)
# Judge status: Accepted
s = input().strip()
x=0
r=0
for c in s:
    if c == "S":
        x += 1
    else:
        if x != 0:
            x -= 1
            r += 2
print(len(s)-r)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K % 2 == 0:
    ans = A-B
else:
    ans = B-A
if ans > 10**18:
    ans = "Unfair"
print(ans)
# Judge status: Wrong Answer
import collections

s = input()
s_len = len(s)
n = 2019
mod_list = [0] * n

for i in range(s_len):
    t = s[i:]
    t_i = int(t)
    m = t_i % n
    #mod_list.append(m)
    mod_list[m] += 1

#c = collections.Counter(mod_list)
#result = sum(i * (i - 1) // 2 for i in c.values())
result = sum(i * (i - 1) // 2 for i in mod_list)
print(result)
# Judge status: Accepted
import math

num_of_points, distance = map(int, input().split())

ans = 0
for i in range(num_of_points):
    X, Y = map(int, input().split())
    d = math.sqrt(X ** 2 + Y ** 2)
    if d <= distance:
        ans = ans + 1

print(ans)
# Judge status: Accepted
x = [1,3,5,7,8,10,12]
y = [4,6,9,11]
z = [2]
a, b=map(int, input().split())
if (a in x and b in x) or (a in y and b in y) or (a in z and b in z):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a=int(input())
if a>=1000:
    print("ABD")
else:
    print("ABC")
# Judge status: Accepted
import heapq
N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))
heapq.heapify(A)

ans = 0
for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)

print(-sum(A))
# Judge status: Wrong Answer
N=int(input())
a=[]
for _ in range(N):
  a_=int(input())
  a.append(a_)
x=max(a)
b=a
if a.count(x)>=2:
  for i in range(N):
    print(x)
else:
  for i in range(N):
    if a[i]==x:
      b.sort()
      print(b[-2])
    else:print(x)
# Judge status: Accepted
from string import ascii_lowercase as alph

def gen_pattern(N, pre=""):
  for i in range(ord(max(pre or "\x60"))-0x5f):
    pattern = pre+alph[i]
    if len(pattern) == N:
      print(pattern)
    else:
      gen_pattern(N, pattern)

gen_pattern(int(input()))