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



Sample input:
3
1 2 3
5 2 2


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
x=0
for i in range(n):
    if a[i]>b[i]:
        x+=a[i]-b[i]
    elif a[i]<b[i]:
        x-=(b[i]-a[i])//2
print(["Yes","No"][x>=0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
x=[0,0]
for i in range(n):
    if a[i]>b[i]:
        x[0]+=2
    elif a[i]<b[i]:
        x[1]+=1
print(["Yes","No"][x[0]<=0])

Submission status: Wrong Answer

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

a.sort()
b.sort()

for i in range(N):
    if a[i]>b[i]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit+=(lb[i]-la[i])//2
if limit*2<must:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit=(lb[i]-la[i])//2
if limit<must:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit=(lb[i]-la[i])//2
if limit*2<must:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

total = sum(B) - sum(A)
each = 0
for i in range(N):
    if B[i] - A[i] == 0:
        continue
    elif B[i] - A[i] > 0:
        each += math.ceil((B[i] - A[i]) / 2)
    else:
        each += 1
if each <= total:
    print('Yes') 
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=sorted(a)
b=sorted(b)
count=0
for i in range(n):
    if a[i]<=b[i]:
        s=(b[i]-a[i])//2
        count+=s
    else:
        s=a[i]-b[i]
        count-=s
if count>=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

flag=True
for i in range(n):
    if a[i]>b[i]:
        flag=False
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

diff = sum(b) - sum(a)
if diff < 0:
    print("No")
else:
    count = 0
    for i in range(N):
        if a[i] > b[i]:
            count += a[i] - b[i]
        elif a[i] < b[i]:
            count += math.ceil((b[i] - a[i])/2)
    if count > diff:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

diff = sum(b) - sum(a)
if diff < 0:
    print("No")
else:
    count = 0
    for i in range(N):
        if a[i] > b[i]:
            count += a[i] - b[i]
        else:
            count += math.ceil((b[i] - a[i])/2)
    if count > diff:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

if abs(sum(b) - sum(a)) == 3 or abs(sum(b) - sum(a)) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if (sum(b) - sum(a)) == 3 or (sum(b) - sum(a)) == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if (sum(b) - sum(a)) % N == 0 or (sum(b) - sum(a)) % N == 2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if (sum(b) - sum(a)) % N == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

cnt=0
for a,b in zip(A,B):
  if a>b:
    cnt+=a-b
  else:
    cnt-=(b-a)//2
print('Yes' if cnt<=0 else 'NO')

Submission status: Wrong Answer

Solution code:
# APC001B - Two Arrays
def main():
    N, *AB = map(int, open(0).read().split())
    A, B = AB[:N], AB[N:]
    cnt = 0
    for a, b in zip(A, B):
        if a > b:
            cnt += (b - a) // 2
        else:
            cnt -= a - b
    print("Yes" if cnt <= 0 else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# APC001B - Two Arrays
def main():
    n = int(input())
    arr = [tuple(map(int, input().rstrip().split())) for _ in range(2)]
    cnt = 0
    for a, b in zip(arr[0], arr[1]):
        if a > b:
            cnt += a - b
        else:
            cnt -= (b - a) // 2
    print("Yes" if cnt >= 0 else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# APC001B - Two Arrays
def main():
    N, *AB = map(int, open(0).read().split())
    A, B = AB[:N], AB[N:]
    cnt = 0
    for a, b in zip(A, B):
        if a > b:  # 可能な特殊操作の回数 (b(i)は他の操作:a(j)を手伝える)
            cnt += (b - a) // 2
        else:  # 必要な特殊操作の回数
            cnt -= a - b
    print("Yes" if cnt >= 0 else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

a_cnt = 0
b_cnt = 0
for i in range(N):
    if a[i] > b[i]:
        b_cnt += a[i] - b[i]
    else:
        a_cnt += b[i] - a[i]
if b_cnt * 2 <= a_cnt:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

a_cnt = 0
b_cnt = 0
for i in range(N):
    if a[i] > b[i]:
        b_cnt += a[i] - b[i]
    else:
        a_cnt += b[i] - a[i]
if a_cnt % 2 == 0 and a_cnt // 2 > b_cnt:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N,*A=map(int,open(0).read().split());print("YNeos"[sum((b-a+1)//2for a,b in zip(A[:N],A[N:])if b>a)<(sum(A[:N])-sum(A[N:]))::2])

Submission status: Wrong Answer

Solution code:
N,*A=map(int,open(0).read().split());print("YNeos"[sum(b-a for a,b in zip(A[:N],A[N:])if a<b)>2*(sum(A[N:])-sum(A[:N]))::2])

Submission status: Wrong Answer

Solution code:
import numpy as np

N = input()
a = np.array([int(a) for a in input().split()])
b = np.array([int(b) for b in input().split()])
ab = a - b
minus = 0
plus = 0
for i in ab:
    if i < 0:
        minus += i
    else:
        plus += i

if 2 * plus + minus <= 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    operations = sum(b) - sum(a)
    # if operations <= 0:
    #     print("No")
    #     return 0
    # else:
    o1, o2 = 0, 0
    for ai, bi in zip(a, b):
        if ai >= bi:
            o1 += ai - bi
        else:
            o2 += math.ceil((bi - ai) // 2)
    print("Yes" if o1 <= operations and o2 <= operations else "No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    operations = sum(b) - sum(a)
    if operations <= 0:
        print("No")
        return 0
    else:
        o1, o2 = 0, 0
        for ai, bi in zip(a, b):
            if ai >= bi:
                o1 += ai - bi
            else:
                o2 += math.ceil((bi - ai) // 2)
    print("Yes" if o1 <= operations and o2 <= operations else "No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    operations = sum(b) - sum(a)
    if operations <= 0:
        print("No")
        return 0
    else:
        o = sum([ai - bi if ai >= bi else (bi - ai) // 2 for ai, bi in zip(a, b)])
        print("Yes" if o <= operations else "No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    operations = sum(b) - sum(a)
    if operations <= 0:
        print("No")
        return 0
    else:
        o = sum([ai - bi if ai >= bi else math.ceil((bi - ai) / 2) for ai, bi in zip(a, b)])
        print("Yes" if o <= operations else "No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import math


def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    operations = sum(b) - sum(a)
    if operations < 0:
        print("No")
        return 0
    else:
        o = sum([ai - bi if ai >= bi else math.ceil((bi - ai) / 2) for ai, bi in zip(a, b)])
        print("Yes" if o <= operations else "No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
flag = 0
for i in range(N):
  if(A[i] < B[i] ):
    flag -= A[i] - B[i]
  else:
    flag -= 2 * (A[i] - B[i])
if(flag >= 0):
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a+1)//2

print("Yes" if count>=0 else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count_A,count_B=0,0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count_A +=a-b
   elif b>a:count_B +=(a-b+1)//2

print("Yes" if all>=count_A and all>=count_B else "No")

Submission status: Wrong Answer

Solution code:
import math
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=math.ceil((b-a)/2)

print("Yes" if all>=count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a+1)//2

print("Yes" if all>=count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if not count>all else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
all=sum(B)-sum(A)
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a+1)//2

print("Yes" if not count>all else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a+1)//2

print("Yes" if sum(B)-sum(A)>count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a+1)//2

print("Yes" if sum(B)-sum(A)>=count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if (sum(B)-sum(A))>=count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if sum(B)-sum(A)>=count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count +=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if sum(B)-sum(A)>count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if sum(B)-sum(A)>count else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)/2

print("Yes" if count>=0 else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if count>0 else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)/2

print("Yes" if count>0 else "No")

Submission status: Wrong Answer

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(n):
    point=A[i]-B[i]
    if point<0 and point%2!=0:continue
    elif point<0:
        count +=point//2
    elif point>0:
        count +=point*2

print("Yes" if count==0 else "No")

Submission status: Wrong Answer

Solution code:
N,*A=map(int,open(0).read().split());print("YNeos"[any(a-b-A[0]+A[N]for a,b in zip(A,A[N:]))::2])

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
b = inpl()
x = 0
y = 0
for i in range(n):
    if b[i] - a[i] > 0:
        x += b[i] - a[i]
    else:
        y += a[i] - b[i]
if x - y*2 >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():

    N = int(input())
    A = list(map(int, input().split()))
    ave = sum(A)/N
    min_d = float('inf')
    min_i = None
    for i in range(N):
        d = abs(A[i]-ave)
        if d < min_d:
            min_d = d
            min_i = i
    return min_i

if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

lessA = 0
lessB = 0

for a, b in zip(A, B):
    if a > b:
        lessB += a - b
    elif a < b:
        lessA += b - a

if lessB * 2 <= lessA:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

if sum(A) > sum(B):
    print('No')
    exit()

allow_ope = sum(B) - sum(A)

need_a = 0
need_b = 0
for i in range(N):
    if A[i] > B[i]:  # この時困る
        need_b += A[i]-B[i]
    if B[i] > A[i]:
        need_a += (B[i]-A[i])//2

if need_b > allow_ope+need_a:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if sum(A) > sum(B):
    print('No')
    exit()

allow_ope = sum(B) - sum(A)

need_a = 0
need_b = 0
for i in range(N):
    if A[i] > B[i]:  # この時困る
        need_b += A[i]-B[i]
    if B[i] > A[i]:
        need_a += (B[i]-A[i])//2

if need_b > allow_ope:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if sum(A) > sum(B):
    print('No')
    exit()

allow_ope = sum(B) - sum(A)

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

if need_a+need_b > allow_ope:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if sum(A) > sum(B):
    print('No')
    exit()

allow_ope = sum(B) - sum(A)

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

if need_a+need_b > allow_ope:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if sum(A) > sum(B):
    print('No')
    exit()

if sum(B)-sum(A) > N:
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

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


bsup = 0
asup = 0
for i in range(n):
    if b[i] > a[i]:
        bsup += b[i]-a[i]
    else:
        asup += a[i]-b[i]

if bsup//2 >= asup:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if (sum(b)-sum(a))%2 != 0 and (sum(b)-sum(a)) > 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

if (sum(b)-sum(a))%2 != 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

if cnt <= sum(B) - sum(A):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

if cnt <= sum(B) - sum(A):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

if cnt <= sum(B) - sum(A):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

if cnt <= sum(B) - sum(A):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(N):
  cnt+=max(0, b[i]-a[i])
if sum(b)-sum(a)<cnt/2:
  print('No')
  exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
dif=0
for i in range(N):
  if a[i]!=b[i]:
    dif+=1
if dif>sum(b)-sum(a):
  print('No')
  exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
for i in range(N):
  if a[i]>b[i]:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
cnt = 0
for i in range(N):
    if(A[i]%2!=B[i]%2):
        cnt += 1
if(cnt%2==0 and cnt!=0):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#APC1 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = LI()
sa,sb = sum(a),sum(b)
cnt = 0
if sa > sb:
    print('No')
    quit()
for i in range(n):
    if a[i] > b[i]:
        cnt += a[i] - b[i]
    elif a[i] < b[i]:
        cnt += math.ceil((b[i] - a[i])/2)
if cnt > (sb - sa):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#APC1 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = LI()
sa,sb = sum(a),sum(b)
cnt = 0
for i in range(n):
    if a[i] > b[i]:
        cnt += a[i] - b[i]
    elif a[i] < b[i]:
        cnt += math.ceil((b[i] - a[i])/2)
if cnt > (sb - sa):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#APC1 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = LI()
b = LI()
s = 0
for i in range(n):
    s += a[i]-b[i]
if s % 2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

minus = 0
plus = 0

for i in range(n):
  temp = b[i] - a[i]
  if temp < 0:
    minus += temp
  else:
    plus += temp

if minus * 2 + plus <= 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

minus = 0
plus = 0

for i in range(n):
  temp = b[i] - a[i]
  if temp < 0:
    minus += temp
  else:
    plus += temp

if minus * 2 + plus < 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[]
Cappend=C.append
for i in range(N):
    Cappend(A[i]-B[i])
D=sum(C)
if D==0:
    if A==B:
        print("Yes")
    else:
        print("No")
elif D>0:
    print("No")
else:
    memo=0
    for c in C:
        if c<0:
            memo+=c
    if memo<D*2:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[]
Cappend=C.append
for i in range(N):
    Cappend(A[i]-B[i])
D=sum(C)
if D==0:
    if A==B:print("Yes")
    else:print("No")
elif D>0:print("No")
else:
    memo=0
    for c in C:
        if c<0:
            memo+=c
    if memo<=D*2:print("No")
    else:print("Yes")

Submission status: Wrong Answer

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

ab=0
ba=0
if sum(a)>sum(b):
    ans="No"
else:
    for i in range(N):
        abtmp=max(b[i]-a[i],0)
        ab+=abtmp//2
        batmp=max(a[i]-b[i],0)
        ba+=batmp

    if ab>ba:
        ans="No"
    else:
        ans="Yes"

print(ans)

Submission status: Wrong Answer

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

ab=0
ba=0
d=sum(b)-sum(a)
for i in range(N):
    abtmp=max(b[i]-a[i],0)
    ab+=abtmp//2
    batmp=max(a[i]-b[i],0)
    ba+=batmp

if ab<=ba:
    ans="Yes"
else:
    ans="No"

if sum(a)>sum(b):
    ans="No"
print(ans)

Submission status: Wrong Answer

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

ab=0
ba=0
d=sum(b)-sum(a)
for i in range(N):
    abtmp=max(b[i]-a[i],0)
    ab+=abtmp//2
    batmp=max(a[i]-b[i],0)
    ba+=batmp

if ab>ba:
    ans="Yes"
else:
    ans="No"

if sum(a)>sum(b):
    ans="No"
print(ans)

Submission status: Wrong Answer

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

ab=0
ba=0
d=sum(b)-sum(a)
for i in range(N):
    abtmp=max(b[i]-a[i],0)
    ab+=abtmp//2
    batmp=max(a[i]-b[i],0)
    ba+=batmp

if ab>ba:
    ans="Yes"
else:
    ans="No"

print(ans)

Submission status: Wrong Answer

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

ab=0
ba=0
d=sum(b)-sum(a)
for i in range(N):
    abtmp=max(b[i]-a[i],0)
    if abtmp%2==0:
        ab+=abtmp//2
    else:
        ab+=abtmp
    #print("abtmp,ab",abtmp,ab)
    
    batmp=max(a[i]-b[i],0)
    if batmp%2==2:
        ba+=batmp//2
    else:
        ba+=batmp
    #print("batmp,ba",batmp,ba)

if ab<=d and ba<=d:
    ans="Yes"
else:
    ans="No"

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
sum_a = sum(a)
sum_b = sum(b)

if (sum_a == sum_b) :
    print("Yes")
elif (sum_a > sum_b) :
    print("No")
else :
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
sum_a = sum(a)
sum_b = sum(b)

if (sum_a == sum_b) :
    print("Yes")
elif (abs(sum_a-sum_b) % 2 == 1) :
    print("Yes")
else :
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [int(b) for b in input().split()]
    
    sousa = sum(A) - sum(B)
    if sousa<0:
        print("No")
    else:
        A_sousa_min = sum([B[i]-A[i] for i in range(N) if B[i]>A[i]])/2
        B_sousa_min = sum([A[i]-B[i] for i in range(N) if A[i]>B[i]])
        if A_sousa_min>sousa or B_sousa_min>sousa:
            print("No")
        else:
            print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

    left = 0
    right = 0
    for i in range(N):
        if A[i]>B[i]:
            left += (A[i]-B[i])
        else:
            right += (B[i]-A[i])
    if left*2<right:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

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

    left = 0
    right = 0
    for i in range(N):
        if A[i]>B[i]:
            left += (A[i]-B[i])
        else:
            right += (B[i]-A[i])
    if left*2<=right:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=[sorted(map(int,input().split())) for _ in range(2)]
cnt=0
for a, b in zip(A,B):
    if b-a >= 2:
        cnt += (b-a)//2
    elif b-a < 0:
        if abs(b-a) <= cnt:
            cnt-=abs(b-a)
        else:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=[sorted(map(int,input().split())) for _ in range(2)]
cnt=0
for a, b in zip(A,B):
    if b-a >= 2:
        cnt += (b-a)//2
    elif b-a < 0:
        if abs(b-a) <= cnt:
            cnt-=(b-a)
        else:
            print("No")
            exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
A,B=[sorted(map(int,input().split())) for _ in range(2)]
print("Yes" if all([a<=b for a, b in zip(A,B)]) else "No")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=sorted(map(int,input().split()))
B=sorted(map(int,input().split()))
for a, b in zip(A,B):
    if a>b:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

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

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

c = 0
d = 0
if sum(a) > sum(b):
    print('No')
else:
    for i in range(N):
        c += max(0, a[i]-b[i])
        d += max(0, math.ceil((b[i]-a[i])/2))
    if c > N or d > N:
        print('No')
    else:
        print('Yes')