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:
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')

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()]

c=0
if sum(a)>sum(b):
    print('No')
    exit()
else:
    for i in range(N):
        c+=max(0,a[i]-b[i])
    if c>N:
        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()]

flg=True

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

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    cnt = sum(B) - sum(A)
    acnt = 0
    bcnt = 0
    for i in range(N):
        x = B[i] - A[i]
        if x > 0:
            acnt += x//2
            if x % 2 == 1:
                acnt += 1
                bcnt += 1
        elif x < 0:
            bcnt += 1
    if acnt <= cnt and bcnt <= cnt and (cnt - acnt) * 2 == (cnt - bcnt):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    cnt = sum(B) - sum(A)
    if cnt < 0:
        print("No")
        return
    acnt = 0
    bcnt = 0
    for i in range(N):
        x = B[i] - A[i]
        if x > 0:
            acnt += x//2
            if x % 2 == 1:
                acnt += 1
                bcnt += 1
        elif x < 0:
            bcnt += 1
    if acnt <= cnt and bcnt <= cnt and (cnt*2-(acnt+bcnt)) % 3 == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = [abs(A[i] - B[i]) for i in range(N)]
    cnt = sum(B) - sum(A)
    if cnt < 0:
        print("No")
    elif sum(C) > cnt * 3:
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())), dtype=int)
B = np.array(list(map(int, input().split())), dtype=int)
diff = A - B

print('Yes' if sum(diff) % 2 else 'No')

Submission status: Wrong Answer

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

print('No' if abs(b-a)%2==0 else 'Yes')

Submission status: Wrong Answer

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

print('No' if (b-a)%2==0 else 'Yes')

Submission status: Wrong Answer

Solution code:
def solve(n, a, b):
    total = sum(b) - sum(a)
    num = 0
    for i in range(n):
        if a[i] > b[i]:
            num += a[i] - b[i]
        elif a[i] < b[i]:
            num += (b[i] - a[i] + 1) // 2
    return "Yes" if total > num else "No"

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

Submission status: Wrong Answer

Solution code:
def solve(n, a, b):
    total = sum(b) - sum(a)
    num = 0
    for i in range(n):
        if a[i] > b[i]:
            num += a[i] - b[i]
        elif a[i] < b[i]:
            num += (b[i] - a[i] + 1) // 2
    return "Yes" if total >= num else "No"

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

Submission status: Wrong Answer

Solution code:
def solve(n, a, b):
    a = sorted(a)
    b = sorted(b)
    for i in range(n):
        if a[i] > b[i]:
            return "No"
    return "Yes"

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a_s = [int(item) for item in input().split()]
b_s = [int(item) for item in input().split()]
num = sum(b_s) - sum(a_s)
val1 = 0
val2 = 0
for a, b in zip(a_s, b_s):
    if a > b:
        val1 += (a-b)
    else:
        val2 += (b-a)
if val1 * 2 <= num:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_s = [int(item) for item in input().split()]
b_s = [int(item) for item in input().split()]
val1 = 0
val2 = 0
for a, b in zip(a_s, b_s):
    if a > b:
        val1 += (a-b)
    else:
        val2 += (b-a)
if val1 * 2 < val2:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a_s = [int(item) for item in input().split()]
b_s = [int(item) for item in input().split()]
val1 = 0
val2 = 0
for a, b in zip(a_s, b_s):
    if a > b:
        val1 += (a-b)
    else:
        val2 += (b-a)
if val1 * 2 <= val2:
    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()]

if 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()]

L = []
for i in range(n):
    L.append(b[i] - a[i])
if sum(L) % 2 == 1:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# APC001B - Two Arrays
def main():
    n = int(input())
    a = sorted(map(int, input().rstrip().split()))
    b = sorted(map(int, input().rstrip().split()))
    for i in range(n):
        if a[i] > b[i]:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
chance = sum(b)-sum(a)
for i in range(n):
    if a[i]<b[i]:
        chance -= (b[i]-a[i])//2

if chance < 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np

N = map(int, raw_input().split())[0]
A = np.array(map(int, raw_input().split()))
B = np.array(map(int, raw_input().split()))
if np.sum(A-B) * 2 <= np.sum(B-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()]
t=sum(b)-sum(a)
for i in range(n):
    t-=a[i]-b[i] if a[i]>b[i] else (b[i]-a[i]+1)//2
ans='Yes' if t>=0 else 'No'
if sum(b)-sum(a)<0:
    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()]
t=sum(b)-sum(a)
for i in range(n):
    t-=a[i]-b[i] if a[i]>b[i] else (b[i]-a[i]+1)//2
print('Yes' if t>0 else '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()]
t=sum(b)-sum(a)
for i in range(n):
    t-=a[i]-b[i] if a[i]>b[i] else (b[i]-a[i]+1)//2
print('Yes' if t>=0 else '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()]
t=sum(b)-sum(a)
for i in range(n):
    t-=a[i]-b[i] if a[i]>b[i] else (b[i]-a[i]+1)//2
print('Yes' if t==0 else '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()]
t=sum(b)-sum(a)
for i in range(n):
    t-=a[i]-b[i] if a[i]>b[i] else (b[i]-a[i])//2
print('Yes' if t==0 else 'No')

Submission status: Wrong Answer

Solution code:
n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(n):
  if arr1[i]>arr2[i]:
    cnt2+=arr1[i]-arr2[i]
  elif arr1[i]<arr2[i]:
    if (arr2[i]-arr1[i])%2==0:
      cnt1+=(arr2[i]-arr1[i])//2
    else:
      cnt1+=(arr2[i]-arr1[i])//2
      cnt2+=1
cnt3=max(0,sum(arr2)-sum(arr1))
if cnt3>=cnt1>=cnt2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
arr1=list(map(int,input().split()))
arr1=sorted(arr1)
arr2=list(map(int,input().split()))
arr2=sorted(arr2)
cnt1=0
cnt2=0
for i in range(n):
  if arr1[i]>arr2[i]:
    cnt2+=arr1[i]-arr2[i]
  elif arr1[i]<arr2[i]:
    if (arr2[i]-arr1[i])%2==0:
      cnt1+=(arr2[i]-arr1[i])//2
    else:
      cnt1+=(arr2[i]-arr1[i])//2
      cnt2+=1
if cnt1>=cnt2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(n):
  if arr1[i]>arr2[i]:
    cnt2+=arr1[i]-arr2[i]
  elif arr1[i]<arr2[i]:
    if (arr2[i]-arr1[i])%2==0:
      cnt1+=(arr2[i]-arr1[i])//2
    else:
      cnt1+=(arr2[i]-arr1[i])//2
      cnt2+=1
if cnt1>=cnt2:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
B - Two Arrays
https://atcoder.jp/contests/apc001/tasks/apc001_b

"""
import sys


def solve(N, A, B):
    a_rem, b_rem = 0, 0
    for a, b in zip(A, B):
        if a == b:
            continue
        if a > b:
            g = a - b
            if g <= b_rem:
                b_rem -= g
            else:
                g -= b_rem
                b_rem = 0
                a_rem += g*2
        else:
            g = b - a
            if g % 2:
                g-= 1
                a_rem += 2
            if g <= a_rem:
                a_rem -= g
            else:
                g -= a_rem
                a_rem = 0
                b_rem += g//2
    if b_rem >= a_rem:
        return 'Yes'
    return 'No'


def main(args):
    N = int(input())
    A = [int(a) for a in input().split()]
    B = [int(b) for b in input().split()]
    ans = solve(N, A, B)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=0
for i in range(n):x+=max((b[i]-a[i]+1)//2,0)+max(a[i]-b[i],0)
print("YNeos"[sum(b)-sum(a)<x::2])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s,t = 0,0
for i in range(n):
    if a[i]>b[i]:
        s+=a[i]-b[i]
    else:
        t+=(b[i]-a[i])//2
        s += (b[i] - a[i])%2
if s<=t:
    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()))
s,t = 0,0
for i in range(n):
    if a[i]>b[i]:
        s+=a[i]-b[i]
    else:
        t+=(b[i]-a[i])//2
if s+t > sum(b)-sum(a):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
def check():
    globals()
    s,t = 0,0
    for i in range(n):
        if a[i]>b[i]:
            s+=a[i]-b[i]
        else:
            t+=(b[i]-a[i])//2
    if s<t:
        print('Yes')
    else:
        print('No')

n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(b)<sum(a):
    print('No')
else:
    check()

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s= 0
t = 0
for i,j in zip(a,b):
    if i > j :
        s+=i-j
    if j > i :
        t+=(j - i)//2
        s+=1
s = sum(a)
t = sum(b)
if s<=t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s= 0
t = 0
for i,j in zip(a,b):
    if i > j :
        s+=i-j
    if j > i :
        t+=(j - i)//2
if s==t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
x = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s= 0
t = 0
for i,j in zip(a,b):
    if i > j :
        s+=i-j
    if j > i :
        t+=(j - i)//2
        s+=1
if s==t:
    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()]
ct1,ct2,ct3=0,0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
  if B[i]>A[i]:
    ct3+=(B[i]-A[i]-1)//2+1
print("Yes" if ct2+ct3<=ct1 else "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()]
ct1,ct2,ct3=0,0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
  ct3+=-min(A[i]-B[i],0)
if ct3==0:
  print("Yes" if ct2<=ct1 else "No")
else:
  print("Yes" if ct2+(ct3-1)//2+1<=ct1 else "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()]
ct1,ct2,ct3=0,0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
  ct3+=-min(A[i]-B[i],0)
print("Yes" if ct2+(ct3-1)//2+1<=ct1 else "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()]
ct1,ct2,ct3=0,0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
  ct3+=-min(A[i]-B[i],0)
print("Yes" if ct2+ct3//2<=ct1 else "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()]
ct1,ct2,ct3=0,0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
  ct3+=-min(A[i]-B[i],0)
print("Yes" if ct1>=ct2 and ct3>=2*ct2 else "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()]
ct1,ct2=0,0
for i in range(n):
  ct1+=(B[i]-A[i])
  ct2+=max(A[i]-B[i],0)
print("Yes" if ct1>=ct2 else "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")
else:
    x=0
    for i in range(n):
        if b[i]<a[i]:x+=a[i]-b[i]
    if sum(b)-sum(a)<x:print("No")
    else:print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=np.array(list(map(int,input().split())))
C=B-A
plus=np.sum(C>0)
minus=np.sum(C<0)
print('Yes') if np.sum(C)>=plus+minus 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 = - sum(A) + sum(B) #操作回数
inv = 0
for i in range(N):
  inv += max(0, A[i] - B[i])
  
inv2 = 0
for i in range(N):
  inv2 += max(0, (B[i] - A[i]+1)//2-1)
  
if count >= 0 and inv <= count and inv2 <= count:
  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 = - sum(A) + sum(B) #操作回数
inv = 0
for i in range(N):
  inv += max(0, A[i] - B[i])
  
inv2 = 0
for i in range(N):
  inv2 += max(0, (B[i] - A[i])//2)
  
if count >= 0 and inv <= count and inv2 <= count:
  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 = - sum(A) + sum(B)
inv = 0
for i in range(N):
  inv += max(0, A[i] - B[i])
  
if count >= 0 and 2*inv <= count:
  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 = - sum(A) + sum(B)
for i in range(N):
  inv = max(0, A[i] - B[i])
  
if count >= 0 and inv <= count:
  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 = - sum(A) + sum(B)
for i in range(N):
  inv = max(0, A[i] - B[i])
  
if count >= 0 and inv <= count:
  print("YES")
else :
  print("NO")

Submission status: Wrong Answer

Solution code:

#!/usr/bin/env python
N = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
if sum(b) -sum(a) < 0:
		print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:

#!/usr/bin/env python
N = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
for i in range(N):
	if b[i] < a[i]:
		print("No")
		break	
	if i==N-1:
		if b[i] >= a[i]:
			print("Yes")
		else:
			print("No")

Submission status: Wrong Answer

Solution code:

#!/usr/bin/env python
N = int(input())
a = sorted(map(int,input().split()))
b = sorted(map(int,input().split()))
for i in range(N):
	if b[i] < a[i]:
		print("No")
		break	
	if b[i] >= a[i] and i==N-1:
		print("Yes")

Submission status: Wrong Answer

Solution code:

#!/usr/bin/env python
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if N > sum(b)-sum(a):
	print("No")
else:
	print("Yes")

Submission status: Wrong Answer

Solution code:

#!/usr/bin/env python
N = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if N > sum(b)-sum(a):
	print("No")
else:
	print("Yes")

print(sum(b)-sum(a))

Submission status: Wrong Answer

Solution code:
n=int(input())
*A,=map(int,input().split())
*B,=map(int,input().split())
print("Yes" if sum(B)-sum(A) >= sum(max(0,a-b) for a,b in zip(A,B)) else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(lambda x,y: y-x, a, b))

if sum(c)%2==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 = list(map(lambda x,y: y-x, a, b))

if sum(c)%2==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()))
for i in range(n - 1):
    if a[i] == b[i]:
        continue
    elif a[i] > b[i]:
        a[n - 1] += (a[i] - b[i]) * 2
    else:
        if (b[i] - a[i]) % 2 == 0:
            b[n - 1] += (b[i] - a[i]) // 2
        else:
            a[i] += 2
            b[i] += 1
            b[n - 1] += (b[i] - a[i]) // 2


if a[n - 1] <= b[n - 1]:
    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)
for i in range(N - 1):
    if a[i] > b[i]:
        print('No')
        exit()
    if a[i] % 2 == b[i] % 2:
        b[N - 1] += (a[i] - b[i]) // 2
    else:
        a[i] += 2
        b[i] += 1
        b[N - 1] += (a[i] - b[i]) // 2

if a[N - 1] > b[N - 1]:
    print('No')
elif a[N - 1] % 2 != b[N - 1] % 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()))
a = sorted(a)
b = sorted(b)
for i in range(N - 1):
    if a[i] > b[i]:
        print('NO')
        exit()
    if a[i] % 2 == b[i] % 2:
        b[N - 1] += (a[i] - b[i]) // 2
    else:
        a[i] += 2
        b[i] += 1
        b[N - 1] += (a[i] - b[i]) // 2

if a[N - 1] > b[N - 1]:
    print('NO')
elif a[N - 1] % 2 != b[N - 1] % 2:
    print('NO')
else:
    print('YES')

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
  if (lip[i]>0):
    sb+=lip[i]
sa2 = 0
for i in range(N):
  if (lip[i]<0):
    sa2=(-lip[i])//2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (sa2>=sb):
    print ("Yes")
  else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
    if (lip[i]>0):
        sb+=lip[i]
sa2 = 0
sas = 0
for i in range(N):
    if (lip[i]<0):
        sa2=(-lip[i])//2
        sas+=(-lip[i])
sas-=sb*2
x = sum(lib)-sum(lia)

if (sa2>=sb and sb+sas == x):
    print ("Yes")
else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
  if (lip[i]>0):
    sb+=lip[i]
sa2 = 0
sas = 0
for i in range(N):
  if (lip[i]<0):
    sa2=(-lip[i])//2
    sas+=(-lip[i])
sas-=sb*2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (sa2>=sb and sb+sas == x):
    print ("Yes")
  else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
  if (lip[i]>0):
    sb+=lip[i]
sa2 = 0
sas = 0
for i in range(N):
  if (lip[i]<0):
    sa2=(-lip[i])//2
    sas+=(-lip[i])
sas-=sb*2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (sa2>=sb and sb+sas <= x):
    print ("Yes")
  else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
s = 0
for i in range(N):
  if (lia[i]>lib[i]):
    s+= lia[i]-lib[i]
  if (lia[i]<lib[i]):
    s+= (lib[i]-lia[i]+1)//2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (x>=s):
    print ("Yes")
  else:
    print ("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]

gg = (sum(lia)%2)
ff = (sum(lib)-sum(lia))%2 
if sum(lib)-sum(lia)<0:
  print ("No")
else:
  if (gg == ff):
    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()]

if sum(b)-sum(a) > n or 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()]

if sum(b)-sum(a) > n:
    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()))
dif = list(x-y for x,y in zip(a,b))
cnt = 0
for d in dif:
    if d>0:
        cnt += d*2
    else:
        cnt += d
if cnt < 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()))
dif = list(x-y for x,y in zip(a,b))
cnt = 0
for d in dif:
    if d>0:
        cnt += d*2
    else:
        cnt += d
if cnt <= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    s = 0
    t = 0
    for i in range(N):
        s += (b[i]-a[i])
        if a[i] > b[i]:
            t += (a[i] - b[i])
    if s >= t:
        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()))

K = sum(b) - sum(a)

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

Submission status: Wrong Answer

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

t=sum(B)-sum(A)
if t==0: print("Yes")
elif t<0: print("No")
else:
    pa=0
    pb=0
    for a,b in zip(A,B):
        if a==b: continue
        if a>b: pb+=(a-b)
        else:
            if (b-a)%2==0: pa+=(b-a)//2
            else:
                pa+=(b-a+1)//2
                pb+=1
    if pa>t or pb>t: 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()))


a.sort()
b.sort()

diff = []
for i in range(N):
    diff.append(b[i] - a[i])
if min(diff) >= 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.sort()
b.sort()

diff = []
for i in range(N):
    diff.append(b[i] - a[i])
if max(diff) >= 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()))

if sum(a) > sum(b):
    print("No")
    exit()
c =[a[i]-b[i] for i in range(n)]
c.sort(reverse=True)
i = 0
for j in range(n):
    if c[j] < 0:
        break
#print(c)
while c[i] > 0:
    if c[i] > 0:
        #print(c[i],c[j])
        c[j] = c[j] + 2*c[i]
        c[i] = 0
        #print(c[i],c[j])
        if c[j] >=0:
            j += 1
    i += 1
    if j == n:
        print("No")
        exit()
#print(c)
print("Yes")

Submission status: Wrong Answer

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

t=sum(B)-sum(A)
if t==0: print("Yes")
elif t<0: print("No")
else:
    pa=0
    pb=0
    for a,b in zip(A,B):
        if a==b: continue
        if a>b: pb+=(a-b)
        else:
            if (b-a)%2==0: pa+=(b-a)//2
            else:
                pa+=(b-a+1)//2
                pb+=1
        if pa>t or pb>t:
            print("No")
            exit()
    if (t-pa)*2==(t-pb): 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()))

suma = sum(A)
sumb = sum(B)

if all( A[i] == B[i] for i in range(N)):
    print("Yes")
    exit()
if all( A[i] <= B[i] for i in range(N)):
    print("Yes")
    exit()    
if suma >= sumb:
    print("No")
    exit()
margin = 0
ato = 0
for i in range(N):
    if A[i] < B[i]:
        margin += B[i] - A[i]
    if A[i] > B[i]:
        ato += A[i] - B[i]

if margin >= 2 * ato:
    print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

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

t=sum(B)-sum(A)
if t==0: print("Yes")
elif t<0: print("No")
else:
    pa=0
    pb=0
    for a,b in zip(A,B):
        if a==b: continue
        if a>b: pb+=(a-b)
        else:
            if (b-a)%2==0: pa+=(b-a)//2
            else:
                pa+=(b-a+1)//2
                pb+=1
        if pa>t or pb>t: break
    if pa==t and pb==t: print("Yes")
    else: print("No")

Submission status: Wrong Answer

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

t=sum(B)-sum(A)
if t==0: print("Yes")
elif t<0: print("No")
else:
    pa=0
    pb=0
    for a,b in zip(A,B):
        if a==b: continue
        if a>b: pb+=(a-b)
        else:
            if (b-a)%2==0: pa+=(b-a)//2
            else:
                pa+=(b-a+1)//2
                pb+=1
        if pa>t or pb>t:
            print("No")
            exit()
    print("Yes")

Submission status: Wrong Answer

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

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

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()
print("Yes" if all([a[i] <= b[i] for i in range(n)]) else "No")

Submission status: Wrong Answer

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

x=y=0
for i in range(n):
    if a[i]<b[i]:
        x+=(b[i]-a[i])//2
    else:
        y+=(a[i]-b[i])

if y>=x:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
ans=0
lim=sum(b)-sum(a)
for i in range(n):
    if a[i]<b[i]:
        ans+=(b[i]-a[i])/2
    else:
        ans+=(a[i]-b[i])

if ans>lim:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
ans=0
lim=sum(b)-sum(a)
for i in range(n):
    if a[i]<b[i]:
        ans+=(b[i]-a[i])//2
    else:
        ans+=(a[i]-b[i])

if ans>lim:
    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")
else:
    ans=0
    lim=sum(b)-sum(a)
    for i in range(n):
        if a[i]<b[i]:
            ans+=(b[i]-a[i])//2
    if ans>lim:
        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")
else:
    ans=0
    lim=sum(b)-sum(a)
    for i in range(n):
        if a[i]<b[i]:
            ans+=(b[i]-a[i])/2
    if ans>lim:
        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 = [b[i] - a[i] for i in range(N)]
n = sum(c)

judge = "Yes"
for i in c:
	if i > 0:
		if i % 2 != 0:
			judge = "No"
			break

print(judge)

Submission status: Wrong Answer

Solution code:
from numpy import*;i=lambda:list(map(int,input().split()));i();
c=array(i())
d=array(i())
a=c-d
print("YNeos"[sum(a[a>0])+sum(abs(a[a<0]))//2<sum(d)-sum(c)::2])

Submission status: Wrong Answer

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

num = 0
diff = 0
for i in range(N):
    if A[i] < B[i]:
        num += 1
        
        diff += A[i] - B[i]

if num == 0:
    print('Yes')
else:
    if diff%num == 0 and diff >= 0:
        print('Yes')
    else:
        print('No')