Problem:
 Score : 300 points    Problem Statement You are given two integer sequences of length N : a_1,a_2,..,a_N and b_1,b_2,..,b_N .
Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal.  Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously :   Add 2 to a_i .  Add 1 to b_j .       Constraints  1 ≤ N ≤ 10  000  0 ≤ a_i,b_i ≤ 10^9 ( 1 ≤ i ≤ N )  All input values are integers.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ..  a_N  b_1  b_2  ..  b_N       Output If we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes ; otherwise, print No .        Sample Input 1 3
1 2 3
5 2 2      Sample Output 1 Yes  For example, we can perform three operations as follows to do our job:   First operation: i=1 and j=2 . Now we have a = \{3,2,3\} , b = \{5,3,2\} .  Second operation: i=1 and j=2 . Now we have a = \{5,2,3\} , b = \{5,4,2\} .  Third operation: i=2 and j=3 . Now we have a = \{5,4,3\} , b = \{5,4,3\} .        Sample Input 2 5
3 1 4 1 5
2 7 1 8 2      Sample Output 2 No       Sample Input 3 5
2 7 1 8 2
3 1 4 1 5      Sample Output 3 No

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]

sa=[a[i]-b[i] for i in range(n)]

p=0
m=0
for i in sa:
  if 0<i:
    m+=i
  else:
    p+=abs(i)//2

if m<=p:
  print("Yes")
else:
  print("No")

Solution (Python):

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

    cnt_A = 0
    cnt_B = 0
    for i in range(N):
        if A[i] > B[i]:
            cnt_A += A[i] - B[i]
        if B[i] > A[i]:
            cnt_B += (B[i] - A[i]) // 2

    if cnt_B >= cnt_A:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    resolve()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt1=[0]*n
cnt2=[0]*n
for i in range(n):
    if a[i]>b[i]:
        cnt2[i]=a[i]-b[i]
    else:
        num4=b[i]-a[i]
        cnt1[i]=-(num4//-2)
        cnt2[i]=num4%2
num5=abs(sum(a)-sum(b))
if max(sum(cnt1),sum(cnt2))+abs(sum(cnt1)-sum(cnt2))<=num5:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt2 += a[i] - b[i]
    else:
        cnt1 += (b[i] - a[i] + 1) // 2
        cnt2 += (b[i] - a[i]) % 2


if cnt1 >= cnt2:
    print("Yes")
else:
    print("No")

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq


import bisect
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
sa=sum(a)
sb=sum(b)
if sb<sa:
    print("No")
else:
    cnt=sb-sa
    resa=0
    resb=0
    for i in range(n):
        if b[i]<a[i]:
            resa+=a[i]-b[i]
        else:
            resb+=math.ceil((b[i]-a[i])/2)
    if resa>cnt or resb>cnt:
        print("No")
    else:
        print("Yes")

Solution (Python):
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if sum(a) > sum(b):
  print ('No')
  exit()
elif sum(a) == sum(b):
  for i in range(n):
    if a[i] != b[i]:
      print ('No')
      exit()
  print ('Yes')
  exit()

s = sum(b)-sum(a)
c = 0
for i in range(n):
  if a[i] < b[i]:
    c += math.ceil((b[i]-a[i])/2)
if c > s:
  print ('No')
else:
  print ('Yes')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

biggerA = 0
biggerB = 0
for ai, bi in zip(a, b):
  if ai > bi:
    biggerA += ai - bi
  if ai < bi:
    biggerB += (bi - ai) // 2
if biggerB >= biggerA:
  print("Yes")
else:
  print("No")

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    D = [a - b for a, b in zip(A, B)]
    
    cnt_m2 = 0
    cnt_p1 = 0
    
    for d in D:
        if d < 0:
            if d % 2 == 0:
                cnt_m2 += abs(d) // 2
            else:
                cnt_m2 += (abs(d) + 1) // 2
                cnt_p1 += 1
        elif d > 0:
            cnt_p1 += d
    
    
    
    
    if cnt_m2 >= cnt_p1:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
k = sum(b)-sum(a)
c,d = 0,0
for i in range(n):
  e = b[i]-a[i]
  if e<=0:
    d -= e
  else:
    c+= (e+1)//2
    d+= e%2 
print("Yes" if k>=c and k>=d else "No")

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

plus_2 = 0
minus = 0
for a, b in zip(A, B):
    if a < b:
        plus_2 += (b-a)//2
    else:
        minus += a-b

if plus_2 >= minus:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]

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

Solution (Python):
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())

capacity=0
for i in range(n):
    capacity+=max(0,b[i]-a[i]-(b[i]-a[i])%2)

for i in range(n):
    if a[i]>b[i]:
        capacity-=(a[i]-b[i])*2

if capacity>=0:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

pos = 0
neg = 0

for i in range(n):
    dif = b[i]-a[i]

    if dif > 0:
        pos += dif//2
    elif dif < 0:
        neg += dif

neg = abs(neg)

print("Yes" if pos >= neg else "No")

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
aa=sum(A) ; bb=sum(B)
if aa>bb:
    print("No");exit()
if aa==bb:
    if A==B:print("Yes");exit()
    print("No");exit()

C=[i-j for i,j in zip(A,B)]
D=[[0,0]]*n
for i in range(n):
    if C[i]>=0:
        D[i]= [0,C[i]]
    else:
        D[i]= [(-C[i]+ (C[i]%2))//2 , C[i]%2]
if sum([i[0] for i in D])>= sum([l[1] for l in D]):
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
from sys import exit
from collections import deque
from copy import deepcopy
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x,mode='counter'):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    if mode=='counter':
        return C
    S = set([1])
    for k in C:
        T = deepcopy(S)
        for x in T:
            for i in range(1,C[k]+1):
                S.add(x*(k**i))
    if mode=='set':
        return S
    if mode=='list':
        return sorted(list(S))

N=intput()
A=lint()
B=lint()
k=sum(B)-sum(A)
opa=opb=0
for a,b in zip(A,B):
    opa+=max(0,(b-a+1)//2)
    opb+=max(0,a-b)
judge(opa<=k and opb<=k)

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

x = sum(B)-sum(A)

one = 0
two = 0

for i in range(N):
    if A[i] > B[i]:
        one += A[i]-B[i]
    if A[i] < B[i]:
        two += (B[i]-A[i])//2
        if (B[i]-A[i])%2 == 1:
            one += 1

if one<=x and two<=x:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_diffA = 0
sum_diffB = 0
for i, (ai, bi) in enumerate(zip(A,B)):
    if ai == bi:
        continue
    elif ai > bi:
        sum_diffB += (ai - bi)
    elif ai < bi:
        diffA = (bi - ai)
        sum_diffA += diffA // 2 + diffA % 2
        sum_diffB += diffA % 2
if sum_diffA >= sum_diffB:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A_sum=0
for i in range(N):
   if A[i]>B[i]:
      A_sum+=A[i]-B[i]
   elif A[i]<B[i]:
      A_sum-=(B[i]-A[i])//2
if A_sum<=0:
   print("Yes")
else:
   print("No")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a_s=sum(a)
b_s=sum(b)
if a_s>b_s:
    print("No")
    exit()
count=b_s-a_s
temp1=0
temp2=0
for i in range(n):
    if a[i]>=b[i]:
        temp1+=a[i]-b[i]
    else:
        if a[i]%2==b[i]%2:
            temp2+=(b[i]-a[i])//2
        else:
            temp1+=1
            temp2+=(b[i]+1-a[i])//2

if temp1>count or temp2>count:
    print("No")
    exit()
if (count-temp1)==(count-temp2)*2:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
plus, minus = 0, 0

if n == 1:
    if a[0] <= b[0]:
        print('Yes')
    else:
        print('No')
    sys.exit()

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
a_sum = 0
b_sum = 0
for i in range(n):
    c.append(b[i]-a[i])
    if c[i] < 0:
        b_sum += c[i]
    else:
        a_sum += c[i]//2

if a_sum < abs(b_sum):
    print("No")
else:
    print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    CNT = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a < b:
            CNT += (b-a+1)// 2
    sa = sum(A)
    sb = sum(B)
    if sa > sb:
        print('No')
    elif sb - sa >= CNT:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

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

print("Yes" if c>=ne else "No")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = [B[i] - A[i] for i in range(N)]
K = sum(B) - sum(A)
flag = True
if(K < 0):
    flag = False

if(flag):
    p1 = K
    m2 = K
    for i in range(N):
        if(C[i] == 0):
            pass
        elif(C[i] < 0):
            p1 += C[i]
        elif(C[i] > 0):
            if(C[i] % 2 == 0):
                m2 -= C[i] // 2
            else:
                m2 -= C[i] // 2 + 1
                p1 -= 1
    if(p1 < 0 or m2 < 0):
        flag = False
    else:
        if(p1 == 2*m2):
            flag = True
        else:
            flag = False
    

if(flag):
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
*A,=map(int,input().split())
*B,=map(int,input().split())

ca=cb=0
for a,b in zip(A,B):
    ca+=max(0,(b-a)//2)
    cb+=max(0,a-b)

print('YNeos'[ca<cb::2])

Solution (Python):
import sys
input = sys.stdin.readline
from collections import Counter

def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    B = list(map(int, input().strip().split()))
    return N, A, B


def solve(N, A, B):
    
    k = 0
    
    m = 0
    for a, b in zip(A, B):
        d = b - a
        if d > 0:
            k += d // 2
        elif d < 0:
            m -= d
    return "Yes" if k >= m else "No"


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 9)

def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')







def solve():
    N = II()
    A = LI()
    B = LI()

    a = sum(A)
    b = sum(B)
    t = b - a
    if t < 0:
        print('No')
        return 
    a_cnt = 0
    b_cnt = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a > b:
            c = a - b
            b_cnt += c
        elif a < b:
            c = b - a
            if c % 2 == 0:
                a_cnt += (c // 2)
            else:
                a_cnt += (c // 2) + 1
                b_cnt += 1
    
    a_left = t - a_cnt
    b_left = t - b_cnt
    if a_left >= 0 and b_left >= 0:
        if a_left * 2 == b_left:
            print('Yes')
    else:
        print('No')

                
            

if __name__ == '__main__':
    solve()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A_sum=0
for i in range(N):
   if A[i]>B[i]:
      A_sum+=A[i]-B[i]
   elif A[i]<B[i]:
      A_sum-=(B[i]-A[i])//2
if A_sum<=0:
   print("Yes")
else:
   print("No")

Solution (Python):
def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    suma = sum(a)
    sumb = sum(b)
    k = sumb - suma

    s = [0] * N
    t = [0] * N
    for i in range(N):
        diff = a[i] - b[i]
        if diff < 0:
            if diff % 2 == 1:
                s[i] += (abs(diff)+1)//2
                t[i] += 1
            else:
                s[i] += abs(diff)//2
        else:
            t[i] += diff
    sums = sum(s)
    sumt = sum(t)
    remains = k - sums
    remaint = k - sumt
    if remains < 0 or remaint < 0:
        print('No')
        return
    if remains == 0 and remaint == 0:
        print('Yes')
        return
    if remains * 2 == remaint:
        print('Yes')
        return

if __name__ == "__main__":
    main()

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
ceil = math.ceil

n = ni()
A = lma()
B = lma()
D = [B[i]-A[i] for i in range(n)]
tmp = 0

for d in D:
    if d>0:
        d//=2
    tmp+=d
f=False
if tmp>=0:
    f=True

yn(f)

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


K=sum(B)-sum(A) 


Plus_Two=K
Minus_One=K


for i in range(N):
    D=B[i]-A[i]
    if D>0:
        Plus_Two-=(D+1)//2
        Minus_One-=D%2
    else:
        D=-D
        Minus_One-=D

if min(Plus_Two,Minus_One)>=0:
    print("Yes")
else:
    print("No")

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


K=sum(B)-sum(A) 


Plus_Two=K
Minus_One=K


for i in range(N):
    D=B[i]-A[i]
    if D>0:
        Plus_Two-=(D+1)//2
        Minus_One-=D%2
    else:
        D=-D
        Minus_One-=D

if min(Plus_Two,Minus_One)>=0 and Plus_Two*2-Minus_One==0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys, math
from functools import lru_cache
from collections import deque

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    a = list(mi())
    b = list(mi())
    K = sum(b) - sum(a)

    if sum(max(0, (b[i]-a[i]+1)//2) for i in range(N)) <= K:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
step = sum(B) - sum(A)
if step < 0:
    print('No')
    exit()

a_cnt = 0
b_cnt = 0

for a, b in zip(A, B):
    tmp = a - b
    if tmp > 0:
        b_cnt += tmp
    elif tmp < 0:
        tmp = abs(tmp)
        if tmp % 2 == 0:
            a_cnt += tmp // 2
        else:
            a_cnt += tmp // 2 + 1
            b_cnt += 1
if step >= a_cnt >= b_cnt:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

plus, minus = 0, 0
for i in range(N):
  if a[i]-b[i] >= 0:
    minus += a[i]-b[i]
  else:
    m = b[i]-a[i]
    plus += (m+1) // 2
    if m%2 == 1:
      minus += 1
    
if plus >= minus:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ca = 0
cb = 0
for aa, bb in zip(a, b):
    if aa < bb:
        cb += (bb - aa)//2
    if bb < aa:
        ca += aa - bb

if cb >= ca:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))
B = list(map(int, sys.stdin.readline().rsplit()))

a = 0
b = 0
for i in range(N):
    if A[i] > B[i]:
        a += A[i] - B[i]
    elif B[i] > A[i]:
        b += (B[i] - A[i]) // 2

if b >= a:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())

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

total1 = 0
total2 = 0

for i in range(N):
    if a[i]>b[i]:
        total1 += a[i]-b[i]
    else:
        total2 += (b[i]-a[i])//2

if total1 <=total2:
    print('Yes')
else:
    print('No')

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=sum(b)-sum(a)
for i,j in zip(a,b):
  if i<j:cnt-=(j-i+1)//2
print(['No','Yes'][cnt>=0])

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

j = sum(b) - sum(a)
c = [0, 0]
for i in range(n):
    if a[i] > b[i]:
        c[0] += a[i] - b[i]
    if a[i] < b[i]:
        c[1] += -(-(b[i]-a[i])//2)

print("Yes" if max(c) <= j else "No")

Solution (Python):
n, *p = map(int, open(0).read().split())
s = sum(j - i - max(0, i - j) - max(0, j - i)%2 for i, j in zip(p, p[n:]))
print("Yes" if s >= 0 == s%2 else "No")

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    need = 0
    stock = 0
    for a, b in zip(A, B):
        if a > b: need += (a-b)
        if b > a: stock += (b-a)//2

    if stock >= need:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
(n,),a,b=[[*map(int,i.split())]for i in open(0)]
print("YNeos"[sum(min(j-i,(j-i)//2) for i,j in zip(a,b))<0::2])

Solution (Python):
(n,),a,b=[[*map(int, i.split())]for i in open(0)]
print("YNeos"[sum(j - i if i > j else (j-i)//2 for i, j in zip(a,b))<0::2])

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))

    cnt = 0
    for x, y in zip(a, b):
        diff = x - y
        if diff < 0:
            cnt += abs(diff) // 2

    for x, y in zip(a, b):
        diff = x - y
        if diff > 0:
            cnt -= diff

    if cnt >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def division_with_round_up(x, y):
    return -(-x // y)


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    acnt = 0
    bcnt = 0

    for i in range(N):
        if A[i] == B[i]:
            continue
        elif A[i] > B[i]:
            bcnt += A[i] - B[i]
        else:
            acnt += division_with_round_up(B[i] - A[i], 2)
            bcnt += (B[i] - A[i]) % 2

    if acnt < bcnt:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    acnt = 0
    bcnt = 0

    for i in range(N):
        if A[i] == B[i]:
            continue
        elif A[i] > B[i]:
            bcnt += A[i] - B[i]
        else:
            acnt += -(-(B[i] - A[i]) // 2)
            bcnt += (B[i] - A[i]) % 2

    if acnt < bcnt:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())

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




if a==b:
    print("Yes")
    exit()

suma=sum(a)
sumb=sum(b)





k=sumb-suma




cnta=0
cntb=0
for i in range(n):
    if a[i]>b[i]:
        cntb+=a[i]-b[i]
    elif a[i]<b[i]:
        cnta+=(-1)*((a[i]-b[i])//2)

if cntb<=k and cnta<=k:
    print("Yes")
else:
    print("No")

Solution (Python):









N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

la = 0
lb = 0
for i in range(N):
    if a[i] > b[i]:
        la += a[i] - b[i]
    elif b[i] > a[i]:
        lb += (b[i] - a[i]) // 2

if lb >= la:
    print("Yes")
else:
    print("No")

Solution (Python):


N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

la = 0
lb = 0
for i in range(N):
    if a[i] > b[i]:
        la += a[i] - b[i]
    elif b[i] > a[i]:
        lb += (b[i] - a[i]) // 2

if lb >= la:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def ceil(x, y):
    return -(-x // y)


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    sa = sum(B) - sum(A)

    x = 0
    y = 0
    for i in range(N):
        if A[i] == B[i]:
            continue
        elif A[i] > B[i]:
            x += A[i] - B[i]
        else:
            y += ceil(B[i] - A[i], 2)

    if x <= sa and y <= sa:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def ceil(x, y):
    return -(-x // y)


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]

    bamari = 0
    for i in range(N):
        if A[i] == B[i]:
            continue
        elif A[i] > B[i]:
            bamari -= A[i] - B[i]
        else:
            bamari += ceil(B[i] - A[i], 2)
            bamari -= (B[i] - A[i]) % 2

    if bamari >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]


    bamari = 0
    for i in range(N):
        if A[i] == B[i]:
            continue
        elif A[i] > B[i]:
            bamari -= A[i] - B[i]
        else:
            bamari += -(-(B[i] - A[i]) // 2)
            bamari -= (B[i] - A[i]) % 2

    if bamari >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
(n,),aa,bb = [list(map(int, s.split())) for s in open(0)]

up = down = 0

for i in range(n):
    a = aa[i]
    b = bb[i]
    if a > b:
        down += a-b
    if b > a:
        d,m = divmod(b-a,2)
        up += d+m
        down += m

diff = sum(bb) - sum(aa)

if up <= diff and down <= diff:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

input = sys.stdin.readline


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

    n = sum(B) - sum(A)
    if n < 0:
        print("No")
        exit()

    n_need = 0
    for a, b in zip(A, B):
        if a > b:
            n_need += (a - b)
        elif a < b:
            n_need += (b - a) % 2

    ans = "Yes" if n_need <= n else "No"
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

cnt1 = 0
cnt2 = 0
for i in range(n):
    if a[i] > b[i]:
        cnt1 += a[i] - b[i]
    elif a[i] < b[i]:
        cnt2 += -(-(b[i] - a[i]) // 2)
        if (b[i] - a[i]) % 2 == 1:
            cnt1 += 1
if cnt1 <= cnt2:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    ba = 0
    bb = 0
    for i in range(N):
        if a[i] > b[i]:
            ba += a[i] - b[i]
        if b[i] > a[i]:
            bb += (b[i] - a[i]) // 2

    if bb >= ba:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Solution (Python):
N,*f = map(int, open(0).read().split())
ab = [f[i] - f[i+N] for i in range(N)]
c = 0
d = 0
for x in ab:
    if x < 0:
        c += abs(x) // 2
    elif x > 0:
        d += x
if c >= d:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

result = False

big_a = sum([ai - bi for ai, bi in zip(a,b) if ai > bi])
big_b = sum([(bi - ai) // 2 for ai, bi in zip(a,b) if bi > ai])
sum_diff = sum(b) - sum(a)

if big_a <= big_b:
  result = True

ans = "Yes" if result else "No"
print(ans)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

k = sum(B)-sum(A)
cb = sum([a-b for b,a in zip(B,A) if b<a])
ca = sum([(b-a+1)//2 for b,a in zip(B,A) if b>a])
if ca<=k and cb<= k:
  print('Yes')
else:
  print('No')

Solution (Python):
import math

N = int(input())

As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

if sum(As) > sum(Bs):
  print('No')
  exit()
  
dif = sum(Bs) - sum(As)
A = 0
for i in range(N):
  if Bs[i] > As[i]:
    A += math.ceil((Bs[i]-As[i])/2)
    
if A > dif:
  print('No')
else:
  print('Yes')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ba = 0
bb = 0
for i in range(N):
    if a[i] > b[i]:
        ba += a[i] - b[i]
    if b[i] > a[i]:
        bb += (b[i] - a[i])//2

if bb >= ba:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
input = sys.stdin.readline

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

cnt =0
for ai,bi in zip(a,b):
    if ai<=bi:
        cnt+= (bi-ai)//2
    else:
        cnt+= bi-ai

if cnt>=0:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))






need_an = 0
need_bn = 0
for i in range(N):
    if A[i] > B[i]:
        need_bn += A[i] - B[i]
    elif A[i] < B[i]:
        need_an += (B[i] - A[i]) // 2


if need_an >= need_bn:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    s = 0
    sm = 0
    for x, y in zip(a,b):
        tmp = y-x
        sm += tmp
        if tmp > 0:
            tmp //= 2
        s += tmp
    if s >= 0 and sm >= 0:
        print('Yes')
    else:
        print('No')

    
if __name__ == '__main__':
    main()

Solution (Python):
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))



sum_a = sum(A)
sum_b = sum(B)
need_n = sum_b - sum_a

need_an = 0
need_bn = 0
for i in range(N):
    if A[i] > B[i]:
        need_bn += A[i] - B[i]
    elif A[i] < B[i]:
        tmp = B[i] - A[i]
        need_an += tmp // 2


if sum_a <= sum_b and need_an >= need_bn:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
B = list(map(int, sys.stdin.readline().split()))



sum_a = sum(A)
sum_b = sum(B)
need_n = sum_b - sum_a

need_an = 0
need_bn = 0
for i in range(N):
    if A[i] > B[i]:
        need_bn += A[i] - B[i]
    elif A[i] < B[i]:
        tmp = B[i] - A[i]
        need_an += tmp // 2


if sum_a <= sum_b and need_an >= need_bn:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().strip().split()]
    B = [int(i) for i in input().strip().split()]

    _diff_A, _diff_B = 0, 0
    m = sum(B) - sum(A)  
    for i in range(n):
        if A[i] > B[i]:
            _diff_A += A[i] - B[i]
        elif B[i] > A[i]:
            _diff_B += (B[i] - A[i] + 1) // 2

    if _diff_B <= m and _diff_A <= m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    A = [int(i) for i in input().strip().split()]
    B = [int(i) for i in input().strip().split()]

    _diff_A, _diff_B = 0, 0
    m = sum(B) - sum(A)
    for i in range(n):
        if A[i] > B[i]:
            _diff_A += A[i] - B[i]
        elif B[i] > A[i]:
            _diff_B += (B[i] - A[i] + 1) // 2

    if _diff_B <= m and _diff_A <= m:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()