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 sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


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


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

    D = [b - a for a, b in zip(A, B)]
    neg = 0
    pos = 0
    for d in D:
        if d < 0:
            neg -= d
        else:
            pos += d

    if pos < neg * 2:
        print("No")
    else:
        print("Yes")


if __name__ == '__main__':
    main()

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, readline().split()))
cnt = 0
for i in range(n):
    if a[i] > b[i]:
        cnt += a[i] - b[i]
    else:
        cnt += (b[i] - a[i]) // 2
if sum(b) - sum(a) >= cnt:
    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()))

diff = [a[i] - b[i] for i in range(N)]
plus = sum(filter(lambda x: x > 0, diff))
minus = sum(filter(lambda x: x < 0, diff))

# print(plus, minus)

if plus * 2 + minus > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

    num_a = 0
    num_b = 0
    for a, b in zip(A, B):
        if a > b:
            num_a += a - b
        elif a < b:
            num_b += b - a

    cnt_a = num_a
    cnt_b = (num_b + 1) // 2

    if cnt_a > cnt_b:
        return "No"
    else:
        return "Yes"


print(solve())

Submission status: Wrong Answer

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

    num_a = 0
    num_b = 0
    for a, b in zip(A, B):
        if a > b:
            num_a += a - b
        elif a < b:
            num_b += b - a

    cnt_a = num_a
    cnt_b = num_b // 2

    if cnt_a > cnt_b:
        return "No"
    else:
        return "Yes"


print(solve())

Submission status: Wrong Answer

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

    diff = 0
    num_a = 0
    num_b = 0
    for a, b in zip(A, B):
        if a > b:
            num_a += a - b
        elif a < b:
            num_b += b - a

    if num_a > num_b:
        return "No"

    cnt_a = num_a
    cnt_b = num_b // 2

    if cnt_a > cnt_b:
        return "No"
    else:
        return "Yes"


print(solve())

Submission status: Wrong Answer

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

def solve():
    delta = sum(B) - sum(A)
    if delta < 0:
        return False
    aup = [0] * N
    bup = [0] * N
    for i in range(N):
        d = B[i] - A[i]
        if d > 0:
            aup[i] = d // 2
            bup[i] = d % 2
        elif d < 0:
            bup[i] = -d
    #print('delta:', delta)
    #print('Aup:', aup)
    #print('Bup:', bup)
    adelta = delta - sum(aup)
    bdelta = delta - sum(bup)
    return adelta >= 0 and bdelta >= 0 and 2 * adelta == bdelta

print('Yes' if solve() else 'No')

Submission status: Wrong Answer

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

def solve():
    delta = sum(B) - sum(A)
    if delta < 0:
        return False
    aup = [0] * N
    bup = [0] * N
    for i in range(N):
        d = B[i] - A[i]
        if d > 0:
            aup[i] = d // 2
            bup[i] = d % 2
        elif d < 0:
            bup[i] = -d
    #print('delta:', delta)
    #print('Aup:', aup)
    #print('Bup:', bup)
    return 2 * (delta - sum(aup)) == delta - sum(bup)

print('Yes' if solve() 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()))

# 総和が等しくなることが必要条件なので、操作回数は sum(B) - sum(A)
def f():
    a_ctr = 0
    b_ctr = 0
    handle = sum(B) - sum(A)
    if handle < 0: return 0 # Aの総和が大きければ無理
    # A に足していく
    for i in range(N):
        if A[i] == B[i]:
            pass
        if A[i] > B[i]: 
            b_ctr += A[i] - B[i]
        else: 
            a_ctr += math.ceil((B[i] - A[i]) / 2)
            if (B[i] - A[i]) % 2 == 1: b_ctr += 1
    print(a_ctr, b_ctr, handle)
    if a_ctr == b_ctr == handle: return 1
    if a_ctr < handle and b_ctr < handle and (handle - a_ctr) * 2 == handle - b_ctr: return 1
    return 0

if f():
    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()))

# 総和が等しくなることが必要条件なので、操作回数は sum(B) - sum(A)
def f():
    a_ctr = 0
    b_ctr = 0
    handle = sum(B) - sum(A)
    if handle < 0: return 0 # Aの総和が大きければ無理
    # A に足していく
    for i in range(N):
        if A[i] == B[i]:
            pass
        if A[i] > B[i]: 
            b_ctr += A[i] - B[i]
        else: 
            a_ctr += math.ceil((B[i] - A[i]) / 2)
            if (B[i] - A[i]) % 2 == 1: b_ctr += 1
    print(a_ctr, b_ctr, handle)
    if a_ctr == b_ctr == handle: return 1
    if a_ctr < handle and b_ctr < handle and a_ctr == b_ctr * 2: return 1
    return 0

if f():
    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()))
abig = 0
bbig = 0
for i in range(n):
    if a[i] > b[i]:
        abig += 1
    elif a[i] < b[i]:
        bbig += 1
if abig % 2 == bbig % 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()))
abig = 0
bbig = 0
for i in range(n):
    if a[i] > b[i]:
        abig += 1
    elif a[i] < b[i]:
        bbig += 1
if abig % 2 != bbig % 2:
    print("Yes")
else:
    print("No")
print(abig, bbig)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
abig = 0
bbig = 0
for i in range(n):
    if a[i] > b[i]:
        abig += 1
    elif a[i] < b[i]:
        bbig += 1
if abig == bbig:
    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()))
plus=0
minus=0
for i in range(N):
  if(a[i]-b[i]<0):
    minus+=b[i]-a[i]
  else:
    plus+=a[i]-b[i]
if(minus>=plus*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()))
numa = 0
numb = 0
num = sum(b)-sum(a)
for i in range(n):
    x = b[i] - a[i]
    if x > 0:
        numa += -(-x//2)
        if x % 2 == 1:
            numb += 1
    else:
        numb -= x
if (num-numa)*2 == num-numb and num > numa:
    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()))
numa = 0
numb = 0
num = sum(b)-sum(a)
for i in range(n):
    x = b[i] - a[i]
    if x > 0:
        numa += -(-x//2)
        if x % 2 == 1:
            numb += 1
    else:
        numb -= x
print(num,numa,numb)
if (num-numa)*2 == num-numb and num > numa:
    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()
sA = sum(a)
sB = sum(b)

if sA >= sB:
    print("No")
    exit()

# print(a, sA)
# print(b, sB)

flag = True
for i in range(n):
    if a[i] > b[i]:
        flag = False

if flag:
    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()))

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

if(twosum<=onesum):
    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()))
diff=sum(b)-sum(a)

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

if(min(onesum,twosum)<=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(" ")))
plus_one, plus_two = 0, 0
op_num = sum(b) - sum(a)

for i in range(N):
    if a[i] > b[i]:
        plus_one = a[i] - b[i]
    elif a[i] < b[i]:
        plus_two += (b[i] - a[i] + 1) // 2

if plus_one < op_num and plus_two < op_num:
    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(" ")))
plus_one, plus_two = 0, 0
op_num = sum(b) - sum(a)

for i in range(N):
    if a[i] > b[i]:
        plus_one = a[i] - b[i]
    elif a[i] < b[i]:
        plus_two += (b[i] - a[i] + 1) // 2
        plus_one += 1 if (b[i] - a[i]) % 2 == 1 else 0

if plus_one < op_num and plus_two < op_num:
    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):
    ans='No'
else:
    c=0
    d=0
    for a,b in zip(A,B):
        if a<b:
            d+=(b-a)//2+(b-a)%2
            c+=(b-a)%2
        else:
            c+=a-b
    if d==c:
        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()))
if sum(A)>sum(B):
    ans='No'
else:
    l=sum(B)-sum(A)
    cnt_a=l*2
    cnt_b=l
    for i in range(n):
        if A[i]>B[i]:
            if (A[i]-B[i])%2==0:
                cnt_b-=(A[i]-B[i])
            else:
                cnt_b -= (A[i] - B[i])+1
                cnt_a -= 1
        else:
            cnt_a-=(B[i]-A[i])
    if cnt_a==cnt_b and cnt_a>=0:
        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()))
if sum(A)>sum(B):
    ans='No'
else:
    l=sum(B)-sum(A)
    cnt_a=l*2
    cnt_b=l
    for i in range(n):
        if A[i]>B[i]:
            if (A[i]-B[i])%2==0:
                cnt_b-=(A[i]-B[i])
            else:
                cnt_b -= (A[i] - B[i])-1
                cnt_a -= 1
        else:
            cnt_a-=(B[i]-A[i])
    if cnt_a==cnt_b and cnt_a>=0:
        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()))
if sum(A)>sum(B):
    ans='No'
else:
    l=sum(B)-sum(A)
    cnt_a=l*2
    cnt_b=l
    for i in range(n):
        if A[i]>B[i]:
            cnt_b-=(A[i]-B[i])
        else:
            cnt_a-=(B[i]-A[i])
    if cnt_a==cnt_b:
        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()))
p = 0
q = 0
r = 0
s = 0
d = 0
for i in range(0, n):
  p += a[i]
  q += b[i]
  r += a[i] % 2
  s += b[i] % 2
  d += a[i] - b[i]
if d == p - q and d >= 0 and (r-s)%2 == d%2:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

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

#処理
import math as m

SA=sum(A)
SB=sum(B)

xA=0
xB=0
for i in range(N):
    if A[i]>B[i]:
        xB+=A[i]-B[i]
    elif A[i]<B[i]:
        xA+=m.ceil((B[i]-A[i])/2)
        
if xA<SB-SA and xB<SB-SA:
    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()))

ca, cb = 0, 0

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

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

Submission status: Wrong Answer

Solution code:
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))
    x = [i - j for i,j in zip(a,b)]
    
    p = 0
    m = 0
    for num in x:
        if num < 0:
            m -= num
        else:
            p += num
    
    if 2 * p <= m:
        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()))
if sum(A) > sum(B):
  print("No")
else:
  d = sum(B) - sum(A)
  dd = 0
  for i in range(N):
    if A[i] > B[i]:
      dd += A[i] - B[i]
  if dd > d:
    print("No")
  else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/apc001/tasks/apc001_b
# greedyに前からシミュレーションかな
# 都合が悪いものはすべて一番後ろの要素に追いやる

# いやそれよりも、上段で何回操作が必要だったのか下段で何回操作が必要なのかメモしておけばよいのでは？(最小手順でね)
# 最小で一致箚せられるときに、+になる分を計算して、さらに操作でそれらを一致させられるならばOK


import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


N = read_a_int()
A = read_ints()
B = read_ints()

n1 = 0  # bに+1する回数
n2 = 0  # aに+2する回数
for a, b in zip(A, B):
    # print(n1, n2)
    if b > a:
        sa = b - a
        n1 += sa % 2
        n2 += sa % 2 + sa // 2
    elif b < a:
        n1 += a - b

# 各回数に対して、余分にたさなければ行けないのだからそれを計算する
# print(n1, n2)
print("Yes" if n2 >= n1 * 2 else "No")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/apc001/tasks/apc001_b
# greedyに前からシミュレーションかな
# 都合が悪いものはすべて一番後ろの要素に追いやる

# いやそれよりも、上段で何回操作が必要だったのか下段で何回操作が必要なのかメモしておけばよいのでは？(最小手順でね)
# 最小で一致箚せられるときに、+になる分を計算して、さらに操作でそれらを一致させられるならばOK


import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


N = read_a_int()
A = read_ints()
B = read_ints()

n1 = 0  # bに+1する回数
n2 = 0  # aに+2する回数
for a, b in zip(A, B):
    # print(n1, n2)
    if b > a:
        sa = b - a
        n1 += sa % 2
        n2 += n1 + sa // 2
    elif b < a:
        n1 += a - b

# 各回数に対して、余分にたさなければ行けないのだからそれを計算する
# print(n1, n2)
print("Yes" if n2 >= n1 * 2 else "No")

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/apc001/tasks/apc001_b
# greedyに前からシミュレーションかな
# 都合が悪いものはすべて一番後ろの要素に追いやる

# いやそれよりも、上段で何回操作が必要だったのか下段で何回操作が必要なのかメモしておけばよいのでは？(最小手順でね)
# 最小で一致箚せられるときに、+になる分を計算して、さらに操作でそれらを一致させられるならばOK


import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
rr = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


N = read_a_int()
A = read_ints()
B = read_ints()

n1 = 0  # bに+1する回数
n2 = 0  # aに+2する回数
for a, b in zip(A, B):
    # print(n1, n2)
    if b > a:
        sa = b - a
        n2 += sa // 2
        n1 += sa % 2
    elif b < a:
        n1 += a - b

# 各回数に対して、余分にたさなければ行けないのだからそれを計算する
# print(n1, n2)
print("Yes" if n2 >= n1 * 2 else "No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    a = LI()
    b = LI()
    suma = sum(a)
    sumb = sum(b)
    diff = sumb - suma
    tmp = 0
    for i in range(n):
        tmp += max((a[i] - b[i] + 1) // 2, 0)
    if diff >= tmp:
        print("Yes")
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    a = LI()
    b = LI()
    suma = sum(a)
    sumb = sum(b)
    diff = suma - sumb
    tmp = 0
    for i in range(n):
        tmp += max((a[i] - b[i] + 1) // 2, 0)
    if diff >= tmp:
        print("Yes")
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

aPlus=0
bPlus=0

for i in range(n):
    if a[i]>b[i]:
        aPlus+=(a[i]-b[i])
    elif a[i]<b[i]:
        if (b[i]-a[i])%2==0:
            bPlus+=(b[i]-a[i])//2
        else:
            aPlus+=1
            bPlus+=(b[i]+1-a[i])//2

if aPlus*2==bPlus or aPlus==bPlus:
    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()))

aPlus=0
bPlus=0

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

Submission status: Wrong Answer

Solution code:
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


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


def read_list():
    return list(read_values())


def main():
    N = int(input())
    A = read_list()
    B = read_list()

    A.sort()
    B.sort()

    KA = 0
    KB = 0
    for a, b in zip(A, B):
        if a == b:
            continue
 
        if a > b:
            KB += a - b
            continue
 
        if a % 2 != b % 2:
            KB += 1
            b += 1
 
        KA += (b - a) // 2
 
    print("Yes" if KA >= KB else "No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


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


def read_list():
    return list(read_values())


def main():
    N = int(input())
    A = read_list()
    B = read_list()

    KA = 0
    KB = 0
    for a, b in zip(A, B):
        if a == b:
            continue

        if a > b:
            KB += a - b
            continue

        if a % 2 != b % 2:
            KB += 1
            b += 1

        KA = (b - a) // 2

    print("Yes" if KA >= KB 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()))
a = 0
b = 0
for i in range(N):
    if A[i] > B[i]:
        a += A[i] - B[i]
    else:
        b += (B[i] - A[i])//2

print("YES") if a <= b 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 = 0
b = 0
for i in range(N):
    if A[i] > B[i]:
        a += A[i] - B[i]
    else:
        b += B[i] - A[i]
sa = sum(A)
sb = sum(B)
if a + sa > sb:
    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()]

sum1 = 0
sum2 = 0
for i in range(N):
    if a[i] > b[i]:
        sum1 += a[i] - b[i]
    elif a[i] + 1 < b[i]:
        sum2 += b[i] - a[i]
if 2*sum1 <= sum2:
    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()]

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

Submission status: Wrong Answer

Solution code:
from math import ceil


def main():
    length = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    required_operation = sum(b) - sum(a)
    count_operation = 0
    for i in range(length):
        if a[i] < b[i]:
            count_operation += ceil((b[i] - a[i]) / 2)
        else:
            count_operation += a[i] - b[i]
    print("Yes" if required_operation >= count_operation else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from math import ceil


def main():
    length = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    required_operation = sum(b) - sum(a)
    count_operation = 0
    for i in range(length):
        if a[i] < b[i]:
            count_operation += ceil((b[i] - a[i]) / 2)
        else:
            count_operation += a[i] - b[i]
    print("Yes" if required_operation == count_operation 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()))
a.sort(reverse=True)
b.sort()
sump=0
sumn=0
for i in range(n):
  if a[i]<=b[i]:
    sump+=b[i]-a[i]
  else:
    sumn+=a[i]-b[i]
if sump>=2*sumn:
  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()))
sump=0
sumn=0
for i in range(n):
  if a[i]<=b[i]:
    sump+=b[i]-a[i]
  else:
    sumn+=a[i]-b[i]
if sump>=2*sumn:
  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()))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2
if allSousa < atob:
  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()))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2
if atob < allSousa:
  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()))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2
if atob < allSousa:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2
if atob < allSousa or allSousa < 0:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2
if atob < allSousa:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
for a, b in zip(A, B):
  if a < b:
    atob += (b-a)//2+(b-a)%2
if atob < allSousa:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
btoa = 0
for a, b in zip(A, B):
  if a > b:
    btoa += a-b
  elif a < b:
    atob += (b-a)//2+(b-a)%2
if atob > allSousa or btoa > allSousa or allSousa < 0:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
btoa = 0
for a, b in zip(A, B):
  if a > b:
    atob += (a-b)//2+(a-b)%2
  elif a < b:
    btoa += b-a
if atob > allSousa or btoa > allSousa or allSousa < 0:
  print("No")
else:
  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())))
allSousa = sum(B)-sum(A)
atob = 0
btoa = 0
for a, b in zip(A, B):
  if a > b:
    atob += (a-b)//2+(a-b)%2
  elif a < b:
    btoa += b-a
if atob > allSousa or btoa > allSousa:
  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()))

n = sum(b) - sum(a)
c = 0
for i in range(N):
    if a[i] > b[i]:
        c += a[i] - b[i]
    elif a[i] < b[i]:
        c += (b[i] - a[i] + 2 - 1) // 2
print('Yes' if n >= 0 and c <= n else 'No')

Submission status: Wrong Answer

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

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

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()]
k = sum(b)-sum(a)
if k<0:
  print("No")
  exit()
ansa=0
ansb=0
for i in range(n):
  if b[i]<a[i]:
    ansb+=a[i]-b[i]
  else:
    re = b[i]-a[i]
    if re%2==0:
      ansa+=(b[i]-a[i])//2
    else:
      ansa+=(b[i]+1-a[i])//2
      ansb+=1
if (k-ansa)*2==k-ansb and 0<k-ansa and 0<k-ansb:
  print("Yes")
else:
  print("No")

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()]
k = sum(b)-sum(a)
if k<0:
  print("No")
  exit()
ansa=0
ansb=0
for i in range(n):
  if b[i]<a[i]:
    ansb+=a[i]-b[i]
  else:
    re = b[i]-a[i]
    if re%2==0:
      ansa+=(b[i]-a[i])//2
    else:
      ansa+=(b[i]+1-a[i])//2
      ansb+=1
if (k-ansa)*2==k-ansb:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
ans = "Yes"
for a, b in zip(A, B):
  if a > 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()))
x=0;y=0
for i in range(n):
  if a[i]<b[i]:
    x+=(b[i]-a[i])
  else:
    y+=(a[i]-b[i])
print('Yes' if x//2>=y else 'No')

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
a = LIST()
b = LIST()
dif = sum(b) - sum(a)
if dif < 0:
    print('No')
    exit()
cnt = 0
for i in range(n):
    tmp = b[i] - a[i]
    if tmp > 0:
        cnt += (tmp + 1) // 2
    else:
        cnt += -tmp
if dif < cnt:
    print('No')
    exit()
print('Yes')