Problem:


Score : 300 points

Problem Statement

You are given two integer sequences of length N: a_1,a_2,..,a_N and b_1,b_2,..,b_N.
Determine if we can repeat the following operation zero or more times so that the sequences a and b become equal.

Operation: Choose two integers i and j (possibly the same) between 1 and N (inclusive), then perform the following two actions simultaneously:

Add 2 to a_i.

Add 1 to b_j.

Constraints

1 ≤ N ≤ 10 000

0 ≤ a_i,b_i ≤ 10^9 (1 ≤ i ≤ N)

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 .. a_N
b_1 b_2 .. b_N

Output

If we can repeat the operation zero or more times so that the sequences a and b become equal, print Yes; otherwise, print No.

Sample Input 1

3
1 2 3
5 2 2

Sample Output 1

Yes

For example, we can perform three operations as follows to do our job:

First operation: i=1 and j=2. Now we have a = \{3,2,3\}, b = \{5,3,2\}.

Second operation: i=1 and j=2. Now we have a = \{5,2,3\}, b = \{5,4,2\}.

Third operation: i=2 and j=3. Now we have a = \{5,4,3\}, b = \{5,4,3\}.

Sample Input 2

5
3 1 4 1 5
2 7 1 8 2

Sample Output 2

No

Sample Input 3

5
2 7 1 8 2
3 1 4 1 5

Sample Output 3

No



Sample input:
3
1 2 3
5 2 2


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
s=0
t=0
for i in range(N):
    if A[i]>=B[i]:
        s+=A[i]-B[i]
    else:
        t+=B[i]-A[i]
if 2*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()]

cnt = [0,0]
for ai, bi in zip(a, b):
    if ai < bi:
        cnt[0] += (bi - ai) // 2
    elif ai > bi:
        cnt[1] += ai - bi

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

Submission status: Wrong Answer

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

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

diff = [None for i in range(len(a))]
pm_sum = [0,0]
for i in range(len(a)):
    diff[i] = b[i] - a[i]
    if diff[i] < 0:
        pm_sum[1] += diff[i]
    elif diff[i] > 0:
        pm_sum[0] += diff[i]

print("YNeos"[pm_sum[1]*(-2) >= pm_sum[0]::2])

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 a == b:
    print("Yes")
    exit()

diff = [None for i in range(len(a))]
pm_sum = [0,0]
for i in range(len(a)):
    diff[i] = b[i] - a[i]
    if diff[i] < 0:
        pm_sum[1] += diff[i]
    elif diff[i] > 0:
        pm_sum[0] += diff[i]

print("YNeos"[pm_sum[1]*(-2) > pm_sum[0]::2])

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 a == b:
    print("Yes")
    exit()

a.sort(); b.sort()

del_list = []
for a_i in a:
    if a_i in b:
        del_list.append(a_i)
        b.remove(a_i)

for d in del_list:
    a.remove(d)

if len(a) == 0:
    print("No")
    exit()

diff = [None for i in range(len(a))]
for i in range(len(a)):
    diff[i] = b[i] - a[i]

print("YNeos"[any(map(lambda x:x<0, diff))::2])

Submission status: Wrong Answer

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

del_list = []
for a_i in a:
    if a_i in b:
        del_list.append(a_i)
        b.remove(a_i)

for d in del_list:
    a.remove(d)

if len(a) == 0:
    print("Yes")
    exit()

diff = [None for i in range(len(a))]
for i in range(len(a)):
    diff[i] = b[i] - a[i]

print("YNeos"[any(map(lambda x:x<0, diff))::2])

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):
    if a[i] > b[i]:
        x += (a[i] - b[i]) * 2
    else:
        x += (a[i] - b[i])
if x > 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()))
s,t=0,0
for i,j in zip(a,b):
    if i>j:t+=(i-j)//2
    else:s+=j-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()))
s,t=0,0
for i,j in zip(a,b):
    if i>j:t+=i-j
    else:s+=j-i
if s>=t*2:print('Yes')
else:print('No')

Submission status: Wrong Answer

Solution code:
from math import ceil
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = sum(b) - sum(a)
d = 0
for i,j in zip(a,b):
    if i>j:
        d += i-j
    elif i<j:
        d += ceil((j-i)/2)
if c >= d:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = map(int, input().split())
b = map(int, input().split())
f = 0
for i, j in zip(a, b):
    if i > j:
        f += 2 * (i - j)
    else:
        f += (i - j)
if f <= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

negatives = 0
positives = 0

for aa, bb in zip(a,b):
    if aa - bb < 0:
        negatives += bb-aa
    else:
        positives += aa-bb

if negatives >= 2*positives:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if sum(a) <  sum(b):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
ai = lambda: list(map(int, input().split()))

n = int(input())
a = ai()
b = ai()
d = [b[i] - a[i] for i in range(n)]
s,t = sum(i for i in d if i>0), -sum(i for i in d if i<0)
if s > t*2:
    print('Yes')
elif s == t*2 and not any(i%2 for i in d):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
ai = lambda: list(map(int, input().split()))

n = int(input())
a = ai()
b = ai()
d = [b[i] - a[i] for i in range(n)]
if sum(i for i in d if i>0) > -sum(i for i in d if i<0)*2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
ai = lambda: list(map(int, input().split()))

n = int(input())
a = ai()
b = ai()
d = [b[i] - a[i] for i in range(n)]
if sum(i for i in d if i>0) > sum(i for i in d if i<0)*2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

c=[j-i for i,j in zip(a,b) if j-i>=0]

d=[i-j for i,j in zip(a,b) if i-j>0]

if sum(d)*2>sum(c):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
def iin(): return int(input())
def nl(): return list(map(int, input().split()))

n = iin()
a = nl()
b = nl()

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

time = sum(b) - sum(a)
if time < 0:
	print("No")
else:
	pos = 0
	neg = 0
	for i in range(n):
		if a[i] <= b[i]:
			pos += b[i] - a[i]
		else:
			neg += a[i] - b[i]
	if pos <= 2 * time and neg <= time:
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N = inp()
aa = inpl()
bb = inpl()

tmp1 = 0
tmp2 = 0
for i in range(N):
	a,b = aa[i],bb[i]
	if a < b:
		tmp1 += b-a
	else:
		tmp2 += a-b

if tmp2*2 <= tmp1:
	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()))

# 可能操作回数
op = sum(b) - sum(a)

# 必要操作回数のカウント
a_must = 0
b_must = 0
for ai, bi in zip(a,b):
    if ai  > bi:
        b_must += (ai - bi)
    
    elif bi > ai:
        a_must += (bi - ai +1) // 2
        b_must += (bi - ai) % 2
    

# 可能回数と比較して、可能ならYes
if a_must <= op and b_must < op:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

a = map(int,raw_input().split())
b = map(int,raw_input().split())

a_t = 0
b_t = 0

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

	else:
		b_t += (b[i]-a[i])/2

print 'Yes' if a_t <= b_t else 'No'

Submission status: Wrong Answer

Solution code:
n = int(input())

a = map(int,raw_input().split())
b = map(int,raw_input().split())

a_t = 0
b_t = 0

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

	else:
		b_t += (b[i]-a[i])/2

print 'Yes' if a_t == b_t 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()]
print('Yes' if sum([max(A[i] - B[i], 0) for i in range(N)]) <= sum(B) - sum(A) 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()]

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

if x < y:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

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


    Flag = False
    biga = 0
    lessa = 0
    for i in range(n):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += b[i] - a[i]

    tmp = lessa -(biga*2)

    if tmp >0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
# vim: set fileencoding=utf-8 :
n = int(raw_input())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
diff = [0] * n

plus = 0
minus = 0

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

    if diff[i] < 0:
        plus += diff[i]
    elif 0 < diff[i]:
        minus += diff[i]

    # diff[i]がすべて偶数とわかったので、
    # 正の値の和/2 と、不の値の和が一致するかどうか判定する。一致したら"YES".
    # しないなら "NO"

if plus % 2 == 0:
    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()]

s = 0
d = 0
for i in range(N):
    s += b[i] - a[i]
    if a[i] < b[i]:
        d += (b[i] - a[i]) // 2

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

def f():
    req_a = 0
    req_b = 0
    for a,b in zip(A, B):
        if a > b:
            req_b += (a - b)
        else:
            req_a += (b - a) // 2
            if (b - a) & 1:
                req_b += 1
    return req_a >= req_b

print("Yes" if f() else "No")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(raw_input())
    a = map(int, raw_input().split())
    b = map(int, raw_input().split())

    sum_a = sum(a)
    sum_b = sum(b)

    delta = sum_b - sum_a

    if delta < 0:
        print 'No'
        return

    a_odd = len([ai for ai in a if ai%2==1])
    a_even = N - a_odd

    b_odd = len([bi for bi in b if bi%2==1])
    b_even = N - b_odd

    if delta % 2 == 0:
        if a_odd == b_odd:
            print 'Yes'
        else:
            print 'No'
    else:
        if a_odd == b_odd + 1 or a_odd == b_odd -1:
            print 'Yes'
        else:
            print 'No'
    
main()

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

def f():
    if sum(A) > sum(B): return False
    req_a = 0
    req_b = 0
    for a,b in zip(A, B):
        if a > b:
            req_b += (a - b)
        else:
            req_a += (b - a) // 2
            if (b - a) & 1:
                req_b += 1
    return req_a >= req_b

print("Yes" if f() else "No")

Submission status: Wrong Answer

Solution code:

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


    Flag = False
    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:

            lessa += b[i] - a[i]


    tmp = lessa -(biga*2)

    if tmp >0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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

d = 0
c1, c2 = 0, 0
for i in range(N):
    if a[i] > b[i]:
        d += (a[i] - b[i]) * 2
        c2 += 1
    elif a[i] < b[i]:
        d -= b[i] - a[i]

    if b[i] - a[i] == 1:
        c1 += 1
if d < 0:
    print('Yes')
elif d == 0 and c1 <= c2:
    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()]

d = 0
c1, c2 = 0, 0
for i in range(N):
    if a[i] > b[i]:
        d += (a[i] - b[i]) * 2
        c2 += 1
    elif a[i] < b[i]:
        d -= b[i] - a[i]

    if b[i] - a[i] == 1:
        c1 += 1
if d < 0:
    print('Yes')
elif d == 0 and c1 < c2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

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


    Flag = False
    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:

            lessa += b[i] - a[i]

    tmp = lessa -(biga*2)

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

nume = 0
deno = 0

for i in range(n):
    if a[i] > b[i]:
        nume += a[i] - b[i]
    else:
        deno += b[i] -a[i]

if nume*2 <= deno:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

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


    Flag = False
    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:

            lessa += b[i] - a[i]

        if (a[i]-b[i]) %2 == 1:
            Flag = True

    tmp = lessa -(biga*2)

    if tmp%2==0 and tmp >=0:
        if Flag == True and tmp == 0:
            print("No")
            exit()
        print("Yes")
    else:
        if Flag == True:
            print("Yes")
        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()))


    Flag = False
    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += b[i] - a[i]
            if (a[i]-b[i]) %2 == 1:
                Flag = True

    tmp = lessa -(biga*2)

    if tmp%2==0 and tmp >=0:
        if Flag == True and tmp == 0:
            print("No")
            exit()
        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()))


    Flag = False
    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += b[i] - a[i]
            if (a[i]-b[i]) %2 == 1:
                Flag = True

    tmp = lessa -(biga*2)

    if tmp%2==0 and tmp >=0:
        if Flag == True and tmp %4 == 0:
            print("No")
            exit()
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    sys.stdin.readline()
    a = list(map(int, sys.stdin.readline().split()))
    b = list(map(int, sys.stdin.readline().split()))
    N = len(a)

    w = []
    for i in range(N):
        if a[i] == b[i]:
            continue
        w.append((a[i], b[i]))

    cnt = 0
    while w:
        cnt += 1
        if cnt > 10000:
            print('No')
            return
        a_min_idx, a_diff, b_min_idx, b_diff = 0, b[0] - a[0], 0, a[0] - b[0]
        for i, (ai, bi) in enumerate(w):
            if ai < bi and bi - ai > a_diff:
                a_diff = bi - ai
                a_min_idx = i
            if bi < ai and ai - bi > b_diff:
                b_diff = ai - bi
                b_min_idx = i

        scale = max(1, min((w[a_min_idx][1] - w[a_min_idx][0]) // 2,
                           (w[b_min_idx][0] - w[b_min_idx][1])))
        w[a_min_idx] = (w[a_min_idx][0] + 2 * scale, w[a_min_idx][1])
        w[b_min_idx] = (w[b_min_idx][0], w[b_min_idx][1] + scale)
        cnt += scale - 1
        if w[a_min_idx][0] == w[a_min_idx][1]:
            del w[a_min_idx]
            if b_min_idx == a_min_idx:
                b_min_idx = -1
            elif a_min_idx < b_min_idx:
                b_min_idx -= 1
        if b_min_idx >= 0 and w[b_min_idx][0] == w[b_min_idx][1]:
            del w[b_min_idx]
    print('Yes')
        

main()

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(ai) for ai in input().split()]
b = [int(bi) for bi in input().split()]
a_count = 0
b_count = 0
a_buffer, b_buffer = [], []
for i in range(N):
    ai, bi = a[i], b[i]
    if ai > bi:
        diff = ai - bi
        a_count += diff * 2
    else:
        a_count += ai
        b_count += bi
        a_buffer.append(ai)
        b_buffer.append(bi)
if a_count == b_count and a_buffer == b_buffer:
    print('Yes')
elif a_count < b_count:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [int(ai) for ai in input().split()]
b = [int(bi) for bi in input().split()]
a_count = 0
b_count = 0
a_buffer, b_buffer = [], []
for i in range(N):
    ai, bi = a[i], b[i]
    if ai > bi:
        diff = ai - bi
        a_count += diff * 2
    else:
        a_count += ai
        b_count += bi
        a_buffer.append(ai)
        b_buffer.append(bi)
if a_count == b_count and b_buffer == b_buffer:
    print('Yes')
elif a_count < b_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()))

A_sum = sum(A)
B_sum = sum(B)

#print(A_sum, '-', B_sum)
if A_sum > B_sum:
    re = 'No'
else:
    if (A_sum - B_sum) % 2 == 0:
        re = 'No'
    else:
        re = 'Yes'
#    diff = []
#    for i in range(N):
#        diff.append(A[i] - B[i])

print(re)

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
A = sorted(map(int, raw_input().split()))
B = sorted(map(int, raw_input().split()))
ca = 0
cbe = 0
cbo = 0
for i in range(N):
  if A[i]>B[i]:
    ca += A[i]-B[i]
  elif A[i]<B[i]:
    cb = B[i]-A[i]
    cbe = cb // 2
    cbo = cb % 2
print "Yes" if cbe>=ca else "No"

Submission status: Wrong Answer

Solution code:

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


    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += b[i] - a[i]

    #print(lessa - (biga*2))

    tmp = lessa -(biga*2)

    if tmp%2==0 and tmp >=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()))


    biga = 0
    lessa = 0
    for i in range(3):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += b[i] - a[i]

    #print((lessa - (biga*2))%2==0)

    if (lessa - (biga*2))%2==0 :
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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

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

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

d1 = 0
d2 = 0
for i in range(N):
    if a[i] > b[i]:
        d1 += a[i] - b[i]
    elif a[i] < b[i]:
        d2 += b[i] - a[i]

if d1 * 2 <= d2:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
A = sorted(map(int, raw_input().split()))
B = sorted(map(int, raw_input().split()))
r = "Yes"
for i in range(N):
  if A[i]>B[i]:
    r = "No"
print r

Submission status: Wrong Answer

Solution code:
N = int(input())
a_ = [int(ai) for ai in input().split()]
b_ = [int(bi) for bi in input().split()]
a, b = [], []
for i in range(N):
    if a_[i] == b_[i]:
        continue
    a.append(a_[i])
    b.append(b_[i])

a_sum = sum(a)
b_sum = sum(b)
if a_sum <= b_sum:
    if N % 2 == 0 and a_sum % 2 == b_sum % 2:
        print('Yes')
        exit()
    if N % 2 == 1 and a_sum % 2 != b_sum % 2:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

a_sum = sum(a)
b_sum = sum(b)
if a_sum <= b_sum:
    if N % 2 == 0 and a_sum % 2 == b_sum % 2:
        print('Yes')
        exit()
    if N % 2 == 1 and a_sum % 2 != b_sum % 2:
        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()))
l = sum(B)-sum(A)
c = 0
for k in range(N):
    if A[k]>B[k]:
        c += A[k]-B[k]
    elif A[k]<B[k]:
        c += (B[k]-A[k])//2

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
l = sum(B)-sum(A)
c = 0
for k in range(N):
    if A[k]>B[k]:
        c += A[k]-B[k]
    elif A[k]<B[k]:
        c += (1+B[k]-A[k])//2

print("Yes" if l>c else "No")

Submission status: Wrong Answer

Solution code:
from math import ceil
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
l = sum(B)-sum(A)
c = 0
for k in range(N):
    if A[k]>B[k]:
        c += A[k]-B[k]
    elif A[k]<B[k]:
        c += ceil((B[k]-A[k])/2)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
l = sum(B)-sum(A)
c = 0
for k in range(N):
    if A[k]>B[k]:
        c += A[k]-B[k]
    elif A[k]<B[k]:
        c += (1+B[k]-A[k])//2

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

Submission status: Wrong Answer

Solution code:
# APC 001 B

N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))

for k in range(N):
    if A[k] > B[k]:
        print("No")
        exit(0)
print("Yes")

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]:
    minus += a[i]-b[i]
  elif a[i] < b[i]:
    plus += b[i] - a[i]
if minus*2 <= plus:
  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()))
a_t=sum(a)
b_t=sum(b)
cnt=0
for i in range(n):
    if a[i]<b[i]:
        cnt+=math.ceil((b[i]-a[i])/2)
    elif b[i]<a[i]:
        cnt+=(a[i]-b[i])
if cnt<=b_t-a_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()))
a_t=sum(a)
b_t=sum(b)
cnt=0
for i in range(n):
    if a[i]<b[i]:
        if (b[i]-a[i])%2==0:
            cnt+=(b[i]-a[i])//2
        else:
            cnt+=(b[i]-a[i])//2+1
    elif b[i]<a[i]:
        cnt+=(a[i]-b[i])
if cnt<=b_t-a_t:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

    p, m = 0, 0
    for i in range(n):
        if a[i] > b[i]:
            m += a[i] - b[i]
        else:
            p += b[i] - a[i]

    dif_sum = sum(b) - sum(a)
    if dif_sum == 0 and p == 0 and m == 0:
        print("Yes")
    elif dif_sum <= 0:
        print("No")
    elif dif_sum >= m and dif_sum >= p / 2:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def b_two_arrays(N, A, B):
    import math
    operation_times = 0
    for a, b in zip(A, B):
        if a >= b:
            operation_times += a - b
        else:
            operation_times += math.ceil((b - a) / 2)
    ans = 'Yes' if operation_times <= (sum(B) - sum(A)) else 'No'
    return ans

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
print(b_two_arrays(N, A, B))

Submission status: Wrong Answer

Solution code:
N = int(input())
list_A = list(map(int, input().split(' ')))
list_B = list(map(int, input().split(' ')))
SA = sum(list_A)
SB = sum(list_B)
diffA = 0
diffB = 0
for a, b in zip(list_A, list_B):
    if a > b:
        diffB += a - b
    elif b > a:
        diffA += (b - a) // 2 + 1
if diffA <= SB -SA and diffB <= SB - SA:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
list_A = list(map(int, input().split(' ')))
list_B = list(map(int, input().split(' ')))
diffA = 0
diffB = 0
for a, b in zip(list_A, list_B):
    if a > b:
        diffA += (a - b) * 2
    elif b > a:
        diffB += (b - a) // 2 + 1
if diffA <= diffB:
    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 = 0
for a,b in zip(A,B):
    diff = b - a
    if diff < 0:
        diff_sum += diff*2
    else:
        diff_sum += diff
        
if diff_sum>=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
num,A,B = 0,sum(a),sum(b)
for i in range(n): num+=max(0,a[i]-b[i])
if num>B-A: 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()]
num,A,B = 0,sum(a),sum(b)
for i in range(n): num = max(num,b[i]-a[i])
if num>B-A: print("No")
else: print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=[]
m2=0
p1=0
m1=0
for i in range(n):
  c.append(b[i]-a[i])
s=sum(c)
cou=0
for i in range(n):
  if(c[i]<0):
    cou+=-c[i]
  elif(c[i]>0):
    cou+=(c[i])//2+(c[i])%2
if(cou<=s):print("Yes")
else:print("No")

Submission status: Wrong Answer

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

limit = sum(b_l) - sum(a_l) 

pos = 0
neg = 0
for i in range(N):
    r = a_l[i] - b_l[i] 
    if r > 0:
        pos += r
    else:
        neg += r


if limit >= (math.ceil(abs(neg)/2) + pos):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

limit = sum(b_l) - sum(a_l) 

pos = 0
neg = 0
for i in range(N):
    r = a_l[i] - b_l[i] 
    if r > 0:
        pos += r
    else:
        neg += r


if 2*limit >= abs(neg) or limit >= pos:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

limit = sum(b_l) - sum(a_l)

pos = 0
neg = 0
for i in range(N):
    r = a_l[i] - b_l[i]
    if r > 0:
        pos += r
    else:
        neg += r


if limit > 0 and 2*limit >= abs(neg) and limit >= pos:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

limit = sum(b_l) - sum(a_l) 

pos = 0
neg = 0
for i in range(N):
    r = a_l[i] - b_l[i] 
    if r > 0:
        pos += r
    else:
        neg += r


if 2*limit >= abs(neg) and limit >= pos:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

diff = [bi - ai for (ai, bi) in zip(a, b)]
print(diff)
if sum(diff) < 0:
    print('No')
    exit()

sum_of_2minus = -sum(filter(lambda x: x < 0, diff))
capable_2x = sum(map(lambda y: int(y / 2), filter(lambda x: x > 1, diff)))
if capable_2x < sum_of_2minus:
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

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

diff = [bi - ai for (ai, bi) in zip(a, b)]
print(diff)
if sum(diff) < 0:
    print('No')
    exit()

sum_of_2minus = -sum(filter(lambda x: x < 0, diff))
capable_2x = sum(map(lambda y: int(y / 2), filter(lambda x: x > 1, diff)))
print(sum_of_2minus)
print(capable_2x)
if capable_2x < sum_of_2minus:
    print('No')
    exit()

print('Yes')