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:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 15
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = sum(a)
sumb = sum(b)
count = sumb-suma
subsum = 0
if count < 0:
    print('No')
    sys.exit()
for i in range(n):
    subsum += abs(a[i]-b[i])
if subsum <= 3*count and subsum%2 == count%2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
import math
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
from collections import deque
inf = 10 ** 15
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
suma = sum(a)
sumb = sum(b)
count = sumb-suma
subsum = 0
if count < 0:
    print('No')
    sys.exit()
for i in range(n):
    subsum += abs(a[i]-b[i])
if subsum <= 3*count:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()
    b = na()

    a_cnt = 0
    b_cnt = 0

    for ai, bi in zip(a, b):
        tmp = bi - ai
        if tmp < 0:
            b_cnt += abs(tmp)
            a_cnt -= abs(tmp)
        elif tmp > 0:
            a_cnt += (tmp + 1) // 2
            b_cnt += tmp % 2 - (tmp + 1) // 2
        # print(ai, bi, a_cnt, b_cnt)

    print("Yes" if a_cnt > b_cnt else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()
    b = na()

    a_cnt = 0
    b_cnt = 0

    for ai, bi in zip(a, b):
        tmp = bi - ai
        if tmp < 0:
            b_cnt += abs(tmp)
            a_cnt -= abs(tmp)
        elif tmp > 0:
            a_cnt += (tmp + 1) // 2
            b_cnt += tmp % 2 - (tmp + 1) // 2
        print(ai, bi, a_cnt, b_cnt)

    print("Yes" if a_cnt > b_cnt else "No")


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

#print(A)
#print(B)

x=y=0
for i in range(len(A)):
  a, b = A[i], B[i]

  if a>b: y+=a-b
  if a<b: x+=b-a

ans="Yes" if x >= y*2 else "No"
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arra=limii()
arrb=limii()

if arra==arrb:
    print("Yes")
    exit()

p=sum(arra)-sum(arrb)
if p%n==0:
    print("Yes")



else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arra=limii()
arrb=limii()

if arra==arrb:
    print("Yes")
    exit()

p=sum(arra)-sum(arrb)
if p>0 and p%n==0:
    print("Yes")



else:
    print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())

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

m=sum(b)-sum(a)
l=0
for i in range(n):
  if a[i]<b[i]:
    l+= (b[i]-a[i])//2
    
if l>=m:
  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()))

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

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

Submission status: Wrong Answer

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

cnt=0
margin=0
for i in range(n):
  x=a[i]
  y=b[i]
  if x>y:
    cnt+=x-y
  elif x<y:
    margin+=y-x

print('Yes' if margin>=2*cnt else 'No')

Submission status: Wrong Answer

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

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

if 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_diff = 0
b_diff = 0
for i in range(n):
    if a[i] > b[i]:
        a_diff += a[i] - b[i]
    elif a[i] < b[i]:
        b_diff += b[i] - a[i]

if a_diff*2 <= b_diff:
    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()))

res = 0
for i in range(n):
    res += a[i]-b[i]
if abs(res) % 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()))

res = 0
for i in range(n):
    res += abs(a[i]-b[i])
if res % 2 == 0:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    aa = MII()
    bb = MII()
    aa.sort()
    bb.sort()
    for a,b in zip(aa, bb):
        if a > b:
            print('No')
            return None
    print('Yes')
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
#======================================================#
def main():
    n = II()
    aa = MII()
    bb = MII()
    suma = sum(aa)
    sumb = sum(bb)
    if aa == bb:
        print('Yes')
        return None
    if suma >= sumb:
        print('No')
        return None
    if (sumb-suma)%2==1:
        print('Yes')
    else:
        print('No')

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

sum_a = sum(a)
sum_b = sum(b)
if sum_a <= sum_b:
    cnt_a = 0
    cnt_b = 0
    for i in range(n):
        if a[i] > b[i]:
            cnt_b += a[i] - b[i]
        else:
            cnt_a += (b[i] - a[i]) // 2
            if (b[i] - a[i]) % 2 == 0:
                cnt_b += 1
    if cnt_a >= cnt_b:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

sum_a = sum(a)
sum_b = sum(b)
if sum_a <= sum_b:
    cnt_a = 0
    cnt_b = 0
    for i in range(n):
        if a[i] >= b[i]:
            cnt_b += a[i] - b[i]
        else:
            cnt_a += (b[i] - a[i]) // 2
            if (b[i] - a[i]) % 2 == 0:
                cnt_b += 1
    if cnt_a >= cnt_b:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

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

sum_a = sum(a)
sum_b = sum(b)
if sum_a <= sum_b:
    cnt_a = 0
    cnt_b = 0
    for i in range(n):
        if a[i] >= b[i]:
            cnt_b += a[i] - b[i]
        else:
            cnt_a += (b[i] - a[i]) // 2
            if (b[i] - a[i]) % 2 == 0:
                cnt_b += 1
    if cnt_a == cnt_b:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    A=list(pin())
    B=list(pin())
    
    C=[A[i]-B[i]for i in range(N)]
    C.sort(reverse=True)
    for i in range(N-1):
        if C[i]>0:
            t=C[i]
            C[i]=0
            C[i+1]+=2*t
            #print(t)
    print(["No","Yes"][C[-1]<=0])             
#%%submit!
resolve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    N,=pin()
    A=list(pin())
    B=list(pin())
    
    C=[A[i]-B[i]for i in range(N)]
    C.sort(reverse=True)
    for i in range(N-1):
        if C[i]>0:
            t=C[i]
            C[i]=0
            C[i+1]+=2*t
            #print(t)
    print(["No","Yes"][C[-1]==0])             
#%%submit!
resolve()

Submission status: Wrong Answer

Solution code:
def petrozavodsk001_b():
    _ = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    act = sum(B) - sum(A)
    if act < 0:
        print('No')
        return

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

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

petrozavodsk001_b()

Submission status: Wrong Answer

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

operation = sum(B) - sum(A)

cntp = 0
cntn = 0
for a, b in zip(A, B):
    c = b - a
    if c > 0:
        cntp += c
    elif c < 0:
        cntn += -c


if operation >= cntn:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

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

As.sort(reverse=True)
Bs.sort(reverse=True)

ds = [b-a for a,b in zip(As,Bs)]
# print(ds)
s = sum(ds)
if s  < 0:
    print("No")
    exit()
ds.sort(reverse=True)
cnt = {2:0,-1:0}
for d in ds:
    if d % 2 == 1:
        cnt[2] += 1
        d += 1
    else:
        cnt[-1] += d//2

if cnt[-1] == cnt[2] < s:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
"""
s回の操作は、偶数奇数の反転だと捉える
"""
n = int(input())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))

As.sort(reverse=True)
Bs.sort(reverse=True)

ds = [b-a for a,b in zip(As,Bs)]
print(ds)
s = sum(ds)
if s  < 0:
    print("No")
    exit()
ds.sort(reverse=True)
cnt = {2:0,-1:0}
for d in ds[:]:
    if d % 2 == 1:
        cnt[2] += 1
        d += 1
    else:
        cnt[-1] += d//2

if cnt[-1] ==cnt[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()))
S=sum(b)-sum(a)
if S<0:print("No")
else:
    cnt=0
    for i in range(n):
        cnt+=max((b[i]-a[i])//2,0)
    if cnt<=S: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=sum(b)-sum(a)
if S<0:print("No")
else:
    cnt=0
    for i in range(n):
        cnt+=max(a[i]-b[i],0)
    if cnt<=S:print('Yes')
    else:print("No")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/apc001/tasks/apc001_b

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
t = sum(b) - sum(a)
c = 0
for i in range(n):
    d = a[i] - b[i]
    if d > 0:
        c += d
    elif d < 0:
        c += (-1 * d + 1) // 2

if c <= t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/apc001/tasks/apc001_b

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
t = sum(b) - sum(a)
c = 0
for i in range(n):
    d = a[i] - b[i]
    if d > 0:
        c += d
    elif d < 0:
        c += (-1 * d) // 2

if c <= t:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    D=[a-b if a>b else -(b-a)//2 for a,b in zip(A,B)]
    if sum(B)-sum(A)>=max(sum([p for p in D if p>0]),sum([m for m in D if m<0])):print("Yes")
    else:print("No")

if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    B=list(map(int,input().split()))
    D=[a-b if a>=b else -(-(b-a)//2) for a,b in zip(A,B)]
    if sum(B)-sum(A)>=sum(D):print("Yes")
    else:print("No")

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

c = max(0, sum(B) - sum(A))
ca = 0
cb = 0

for a, b in zip(A, B):
    if a < b:
        ca += (b - a + 1) // 2
        cb += (b - a) % 2
    if a > b:
        cb += a - b

if c < ca + cb:
    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 = max(0, sum(B) - sum(A))
ca = 0
cb = 0

for a, b in zip(A, B):
    if a < b:
        ca += (b - a) // 2
        cb += (b - a) % 2
    if a > b:
        cb += a - b

if c < ca + cb:
    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 = max(0, sum(B) - sum(A))
ca = 0
cb = 0
import math
for a, b in zip(A, B):
    if a < b:
        ca += math.ceil((b - a) / 2)
    if a > b:
        cb += a - b

if c <= ca + cb:
    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 = max(0, sum(B) - sum(A))
ca = 0
cb = 0
import math
for a, b in zip(A, B):
    if a < b:
        ca += math.ceil((b - a) / 2)
    if a > b:
        cb += a - b

if c < ca + cb:
    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 = max(0, sum(B) - sum(A))
ca = 0
cb = 0

for a, b in zip(A, B):
    if a < b:
        ca += (b - a) // 2
    if a > b:
        cb += a - b

if c < ca + cb:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
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("No" if s >= 0 == s%2 else "Yes")

Submission status: Wrong Answer

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

sa = sum(a)
sb = sum(b)

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

if sa >= sb:
    print("No")

else:
    dif = sb - sa
    for i in range(n):
        if a[i] < b[i]:
            dif -= (b[i] - a[i]) // 2
        elif a[i] > b[i]:
            dif -= a[i] - b[i]
    if dif >= 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()))

sa = sum(a)
sb = sum(b)

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

if sa >= sb:
    print("No")

else:
    dif = sb - sa
    while dif >= 0:
        for i in range(n):
            if a[i] < b[i]:
                dif -= (b[i] - a[i])//2
            elif a[i] > b[i]:
                dif -= a[i] - b[i]

    if dif >= 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()))

sa = sum(a)
sb = sum(b)

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

if sa >= sb:
    print("No")

else:
    dif = sb - sa
    while dif > 0:
        for i in range(n):
            if a[i] < b[i]:
                dif -= (b[i] - a[i])//2
            elif a[i] > b[i]:
                dif -= a[i] - b[i]

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

countA,countB = 0,0

for i in range(N):
  if A[i] <= B[i]:
    countA += (B[i]-A[i])//2
  else:
    countB += A[i]-B[i]
if sum(B)-sum(A) >= max(countA,countB):
  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()))

countA,countB = 0,0

for i in range(N):
  if A[i] <= B[i]:
    countA += (B[i]-A[i])/2
  else:
    countB += A[i]-B[i]
if sum(B)-sum(A) >= max(countA,countB):
  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()))

count = 0

for i in range(N):
  if A[i] <= B[i]:
    count += (B[i]-A[i])/2
  else:
    count += A[i]-B[i]
if sum(B)-sum(A) >= count:
  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()))

count = 0

for i in range(N):
  if A[i] <= B[i]:
    count += (B[i]-A[i])//2
  else:
    count += A[i]-B[i]
if sum(B)-sum(A) >= count:
  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()))
sum_a = sum(A)
sum_b = sum(B)
ans = 'No'
if sum_a % 3 == 0 and sum_b % 3 == 0:
    if abs(sum_a - sum_b) // 3 <= 2:
        ans = 'Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, read().split()))
cnt = 0
for aa, bb in zip(a, b):
    v = bb - aa
    if bb < aa:
        v *= 2
    else:
        v //= 2
    cnt += v
if cnt >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, read().split()))
cnt = 0
for aa, bb in zip(a, b):
    v = bb - aa
    if bb < aa:
        v *= 2
    cnt += v
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()))
k = sum(B)-sum(A)


if k < 0:
    print('No')
else:
    cnt_a = 0
    cnt_b = 0
    for a, b in zip(A, B):
        if a < b:
            cnt_a += -(a-b)//2
        elif b < a:
            cnt_b += a-b
    if max(cnt_a, cnt_b) <= k:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
cnt = sum(b) - sum(a)
diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add*2 == b_add:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())
    *B,=map(int, input().split())

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

    print('Yes' if opa>=opb else 'No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())
    *B,=map(int, input().split())

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

    print('Yes' if a>=b else 'No')

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()))
k = sum(B)-sum(A)


if k < 0:
    print('No')
else:
    cnt = 0
    for a, b in zip(A, B):
        if a < b:
            cnt += -(a-b)//2
        elif b < a:
            cnt += a-b
    if cnt <= k:
        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)


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

Submission status: Wrong Answer

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

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

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)
# 一致
if len(diff1) == 0 and len(diff2) == 0:
    print("Yes")
    sys.exit()

cnt = sum(b) - sum(a) # 操作回数
if cnt <= 0:
    print("No")
    sys.exit()

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add*2 == b_add:
    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)


if k < 0:
    print('No')
else:
    cnt = 0
    for a, b in zip(A, B):
        if a < b:
            x, y = divmod((b-a), 2)
            cnt += x+2*y
        elif b < a:
            cnt += a-b
    if cnt == k:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

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

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

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)
# 一致
if len(diff1) == 0 and len(diff2) == 0:
    print("Yes")
    sys.exit()

cnt = sum(b) - sum(a) # 操作回数
if cnt <= 0:
    print("No")
    sys.exit()

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt# 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add == 0 and b_add == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())
    *B,=map(int, input().split())

    asum=sum(A)
    bsum=sum(B)
    asmall=0
    bsmall=0
    for a,b in zip(A,B):
        asmall+=(max(0, b-a)+1)//2
        bsmall+=max(0, a-b)
    t=bsum-asum
    print('Yes' if t>=asmall+bsmall else 'No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())
    *B,=map(int, input().split())

    asum=sum(A)
    bsum=sum(B)
    asmall=0
    bsmall=0
    for a,b in zip(A,B):
        asmall+=max(0, b-a)
        bsmall+=max(0, a-b)
    t=bsum-asum
    print('Yes' if t>=(asmall+1)//2+bsmall else 'No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)
# 一致
if len(diff1) == 0 and len(diff2) == 0:
    print("Yes")
    sys.exit()

cnt = sum(b) - sum(a) # 操作回数
if cnt <= 0:
    print("No")
    sys.exit()

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
a_add -= sum(c)
b_add -= sum(c)
if a_add == 0 and b_add == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N=int(input())
    *A,=map(int, input().split())
    *B,=map(int, input().split())

    asum=sum(A)
    bsum=sum(B)
    asmall=0
    bsmall=0
    for a,b in zip(A,B):
        asmall+=max(0, b-a)
        bsmall+=max(0, a-b)
    t=bsum-asum
    print('Yes' if asmall >= bsmall*2 and t>=(asmall-bsmall*2)+bsmall else 'No')

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()))
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]
if y>=2*x:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)
if len(diff1) == 0 and len(diff2) == 0:
    print("Yes")
    sys.exit()

cnt = sum(b) - sum(a) # 操作回数
if cnt <= 0:
    print("No")
    sys.exit()

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
if b_add + sum(c) == 2*a_add:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

cnt = sum(b) - sum(a) # 操作回数
if cnt < 0:
    print("No")
    sys.exit()
elif cnt == 0:
    print("Yes")
diff1 = [] # a > b
diff2 = [] # b > a
for i, j in zip(a, b):
    if i > j:
        diff1.append(i - j)
    elif j > i:
        diff2.append(j - i)

if cnt < sum(diff1):
    print("No")
    sys.exit()
else:
    cnt -= sum(diff1)

a_add = cnt + sum(diff1) # 2を足す
b_add = cnt # 1を足す

c = []
for i in diff2:
    if i % 2 == 0:
        a_add -= i//2
    else:
        c.append(1)
        a_add -= (i - 1)//2
if b_add + sum(c) == 2*a_add:
    print("Yes")
else:
    print("No")