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

alist = [a for a in map(int, input().split())]
blist = [b for b in map(int, input().split())]

for i in range(n-1):
    tempa = alist[i]
    tempb = blist[i]
    if alist[i] > blist[i]:
        alist[i+1] += 2 * (tempa - tempb)
        blist[i] += tempa - tempb
    elif alist[i] < blist[i]:
        if (blist[i] - alist[i]) % 2 == 0:
            # alist[i] += (blist[i] - alist[i])
            # blist[i+1] += (blist[i] - alist[i]) // 2
            alist[i] += tempb - tempa
            blist[i+1] += (tempb - tempa) // 2
        else:
            # alist[i] = blist[i] + 1
            # blist[i] = blist[i] + 1
            # alist[i+1] += 2
            # blist[i+1] += (blist[i] - alist[i]) // 2
            alist[i] = tempb + 1
            blist[i] = tempb + 1
            alist[i+1] += 2
            blist[i+1] += ((tempb - tempa) // 2) + 1
    # print(alist)
    # print(blist)
    # print()
    # while not (alist[i] == blist[i]):
    #     if alist[i] > blist[i]:
    #         alist[i+1] += 2
    #         blist[i] += 1
    #     elif alist[i] < blist[i]:
    #         alist[i] += 2
    #         blist[i+1] += 1

if alist[-1] == blist[-1]:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
if sum(a)>sum(b):
    print("No")
else:
    sb=0 #shortage
    dif=sum(b)-sum(a)
    for i in range(n):
        if a[i]>b[i]: sb+=a[i]-b[i]
    br=dif-sb
    if br<0: print("No")
    else: print("Yes")

Submission status: Wrong Answer

Solution code:
from queue import PriorityQueue


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

A_sum = sum(A)
B_sum = sum(B)
diff = B_sum - A_sum
if diff < 0:
    print("No")
    exit()

A.sort()
B.sort()

for a, b in zip(A, B):
    if a > b:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

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

sum_dif =  sum(B) - sum(A)

difference = list(np.array(B) - np.array(A))
manipulation_A = sum([math.ceil(d/2) + (d % 2) for d in difference if d > 0])
manipulation_B = sum([-d for d in difference if d < 0])

if sum_dif < manipulation_A + manipulation_B:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np

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

sum_dif =  sum(B) - sum(A)

difference = list(np.array(B) - np.array(A))
manipulation_A = sum([(d // 2) for d in difference if d > 0])
manipulation_B = sum([-d for d in difference if d < 0])

if sum_dif < manipulation_A + manipulation_B:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

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

sum_dif =  sum(B) - sum(A)

difference = list(np.array(A) - np.array(B))
man_required_A = sum([math.floor(- a/2) for a in difference if a < 0])
man_required_B = sum([b for b in difference if b > 0])

if sum_dif < man_required_A + man_required_B:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import numpy as np
import math

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

sum_dif =  sum(B) - sum(A)

difference = list(np.array(A) - np.array(B))
man_required_A = sum([math.ceil(- a/2) for a in difference if a < 0])
man_required_B = sum([b for b in difference if b > 0])

if sum_dif < man_required_A + man_required_B:
    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()))
p=0
for i in range(n):
    if a[i]<b[i]:
        p+=(b[i]-a[i])
    elif b[i]<a[i]:
        p-=(a[i]-b[i])
if p>=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()]

c = 0
for i in range(n):
    ai = a[i]
    bi = b[i]
    if ai < bi:
        c += (bi-ai)//2
    else:
        c += (ai-bi)
print('Yes' if n*2 >= c 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()]

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

Submission status: Wrong Answer

Solution code:


def func():
    n=int(input())
    A=[int(s) for s in input().split()]
    B=[int(s) for s in input().split()]
    two=0
    one=0
    for i in range(0,len(A)) :
        if A[i] > B[i] : 
            one+=A[i]-B[i]
        elif A[i] < B[i] :
            two+=(B[i]-A[i])//2
            one+=(B[i]-A[i])%2
    if two-one >= 0 :
        print("Yes")
    else :
        print("No")


func()

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ac, bc = 0, 0
for j in range(10):
    for i in range(N):
        if a[i] > b[i]:
            bc += a[i] - b[i]
            b[i] += bc
        elif a[i] < b[i]:
            ac += math.ceil((b[i] - a[i]) / 2)
            a[i] += ac * 2
if a == b and ac >= bc:
    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()))
ac, bc = 0, 0
for j in range(10):
    for i in range(N):
        if a[i] > b[i]:
            bc += a[i] - b[i]
            b[i] += bc
        elif a[i] < b[i]:
            ac += math.ceil((b[i] - a[i]) / 2)
            a[i] += ac * 2
if ac >= bc:
    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()))
an, bn = 0, 0
i = 0
while True:
    # print(a)
    # print(b)
    # print()
    temp = []
    for i in range(len(a)):
        if a[i] == b[i]:
            temp.append(i)
    for i in temp[::-1]:
        del a[i]
        del b[i]
    if a == b:
        print('Yes')
        quit()
    flag = 0
    for an in range(len(a)):
        for bn in range(len(b)):
            if a[an] < b[an] and a[bn] > b[bn]:
                a[an] += 2
                b[bn] += 1
                flag = 1
    if flag == 0:
        a[0] += 2
        b[0] += 1
    if sum(a) > sum(b):
        print('NO')
        quit()

Submission status: Wrong Answer

Solution code:
from sys import stdin
ans = 'Yes'
n= int(stdin.readline())
a = map(int,stdin.readline().split())
b = map(int,stdin.readline().split())
a.sort()
b.sort()
for i in xrange(n):
 if a[i] > b[i]:
  ans = 'No'
print ans

Submission status: Wrong Answer

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

if sum(a) > sum(b):
    print('NO')
else:
    for i in range(N):
        if a[i] - b[i] > sum(b) - sum(a):
            ans = 'No'
            break
        else :
            ans = 'Yes'
            continue
    print(ans)

Submission status: Wrong Answer

Solution code:

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

sumA = 0
sumB = 0
sumAB = 0

for i in range(n):
    sumA += A[i]
    sumB += B[i]

for i in range(n):
    if A[i] < B[i]:
        sumAB += int((A[i] - B[i]) / 2 + 0.5)

if sumAB <= sumB - sumA:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

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

sumA = 0
sumB = 0

for i in range(n):
    sumA = A[i] + sumA
    sumB = B[i] + sumB

if sumA < sumB or A ==B:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

sumA = 0
sumB = 0

for i in range(n):
    sumA = A[i] + sumA
    sumB = B[i] + sumB

if sumA <= sumB:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

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

sumA = 0
sumB = 0

for i in range(n):
    sumA = A[i] + sumA
    sumB = B[i] + sumB

if sumA < sumB:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
A = input().split()
B = input().split()

A_n = [int(i) for i in A]
B_n = [int(i) for i in B]

A_sum = 0
B_sum = 0
for i in range(N):
    A_sum += A_n[i]
    B_sum += B_n[i]

A_add = 0
B_add = 0
for i in range(N):
    if A_n[i] < B_n[i]:
        A_add += (B_n[i] - A_n[i]) // 2
    else:
        B_add += A_n[i] - B_n[i]

iter_num = B_sum - A_sum
if iter_num - max(A_add, B_add) > 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
A = input().split()
B = input().split()

A_n = [int(i) for i in A]
B_n = [int(i) for i in B]

A_sum = 0
B_sum = 0
for i in range(N):
    A_sum += A_n[i]
    B_sum += B_n[i]

A_add = 0
B_add = 0
for i in range(N):
    if A_n[i] < B_n[i]:
        A_add += (B_n[i] - A_n[i]) // 2
    else:
        B_add += A_n[i] - B_n[i]

iter_num = B_sum - A_sum
if iter_num - A_add >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
A = input().split()
B = input().split()

A_n = [int(i) for i in A]
B_n = [int(i) for i in B]

A_sum = 0
B_sum = 0
for i in range(N):
    A_sum += A_n[i]
    B_sum += B_n[i]

A_add = 0
B_add = 0
for i in range(N):
    if A_n[i] < B_n[i]:
        A_add += (B_n[i] - A_n[i]) // 2
    else:
        B_add += A_n[i] - B_n[i]

iter_num = B_sum - A_sum
if iter_num - max(A_add, B_add) >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
    print("Yes")
elif sum(a) >= sum(b):
    print("No")
else:
    x = 0
    y = 0
    for i in range(N):
        if a[i]-b[i] > 0:
            x += a[i]-b[i]
        elif b[i]-a[i] > 0:
            y += (b[i]-a[i])
    y = y//2
    if x <= y:
        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 a == b:
    print("Yes")
elif sum(a) >= sum(b):
    print("No")
else:
    x = 0
    y = 0
    for i in range(N):
        if a[i]-b[i] > 0:
            x += a[i]-b[i]
        elif b[i]-a[i] > 0:
            y += (b[i]-a[i])//2+1
    if y <= (sum(b)-sum(a)):
        print("Yes")
    else: 
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if a == b:
    print("Yes")
elif sum(a) >= sum(b):
    print("No")
else:
    x = 0
    y = 0
    for i in range(N):
        if a[i]-b[i] > 0:
            x += a[i]-b[i]
        elif b[i]-a[i] > 0:
            y += b[i]-a[i]
    if x >= y:
        if x <= (sum(b)-sum(a)):
            print("Yes")
        else: 
            print("No")
    else:
        if y <= (sum(b)-sum(a)):
            print("Yes")
        else: 
            print("No")

Submission status: Wrong Answer

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

#
dA = []
dB = []
e = 0
for i in range(N):
    if A[i]==B[i]:
        e += 1
    elif B[i]>A[i]:
        #if (B[i] - A[i])%2==1:
        #    print('No')
        #    exit()
        #else:
        dA.append((B[i] - A[i])/2)
    else:
        dB.append(A[i] - B[i])
a = sum(dA)
b = sum(dB)
#
if a==b:
    print('Yes')
    exit()
if a==0 or b==0 or a<b:
    print('No')
    exit()

for i in range(min(a, b)):
    if (a - i)==(b - i)*2:
        if e>0 or max(min(dA), min(dB))<=i:
            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()))

#
op = sum(B) - sum(A)
if op<0:
    print('No')

#
a = 0
b = 0
e = 0
for i in range(N):
    if A[i]==B[i]:
        e += 1
    elif A[i]>B[i]:
        a += 1
    else:
        b += 1

#
if max(a,b)<=op:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += diff[i]
	else:
		plusTotal += diff[i] // 2


print(plusTotal)

if plusTotal >= abs(minousTotal):
	print("No")
else:
	print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += diff[i]
	else:
		plusTotal += diff[i] // 2


print(plusTotal)

if plusTotal >= abs(minousTotal):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += diff[i]
	# elif diff[i] > 0:
	else:
		plusTotal += diff[i]


if plusTotal / 2 >= abs(minousTotal):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
diffNum = 0
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))

	if diff[i] < 0:
		minousTotal += diff[i]
	elif diff[i] > 0:
		plusTotal += diff[i]


if plusTotal  / 2>= abs(minousTotal):
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
diffNum = 0
diff = []
plusTotal = 0
minousTotal = 0

for i in range(0,n):
	diff.append((int(numbersB[i]) - int(numbersA[i])))

	if diff[i] < 0:
		minousTotal += diff[i]
	elif diff[i] > 0:
		plusTotal += diff[i]


if plusTotal  / 2> abs(minousTotal):
	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()))
sum_c = 0
for i in range(n):
    if (a[i] - b[i]) > 0:
        sum_c += (a[i]- b[i])
    else:
        sum_c += int (((b[i] - a[i]) / 2 ) + 0.5)
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum_c <= (sum_b - sum_a):
    print ('Yes')
else:
    print ('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum_c = 0
for i in range(n):
    if (a[i] - b[i]) > 0:
        sum_c += (a[i]- b[i])
    else:
        sum_c += (b[i] - a[i]) / 2
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum_c <= (sum_b - sum_a):
    print ('YES')
else:
    print ('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum = 0
for i in range(n):
    if (a[i] - b[i]) > 0:
        sum += (a[i]- b[i])
    else:
        sum += (b[i] - a[i]) 
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum <= (sum_b - sum_a):
    print ('YES')
else:
    print ('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum = 0
for i in range(n):
    if a[i] - b[i] > 0:
        sum += a[i]- b[i]
    else:
        sum += (b[i] - a[i]) 
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum <= sum_b - sum_a:
    print ('YES')
else:
    print ('NO')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sum = 0
for i in range(n):
    if a[i] - b[i] > 0:
        sum += a[i]- b[i]
    else:
        sum += (b[i] - a[i]) / 2
sum_a = 0
sum_b = 0
for i in range(n):
    sum_a += a.pop(0)
    sum_b += b.pop(0)
if sum <= sum_b - sum_a:
    print ('YES')
else:
    print ('NO')

Submission status: Wrong Answer

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

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

try_cnt=sum(b)-sum(a)

C={}
C[1]=try_cnt
C[2]=try_cnt

for i,j in zip(a,b):
	if i<j:
		C[2]-=(j-i)/2
		i=(j-i)/2
	if i>j:
		C[1]-=(i-j)


if C[1]>=0 and C[2]>=0 and C[1]==C[2]*2:
	print "Yes"
else:
	print "No"

Submission status: Wrong Answer

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

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

try_cnt=sum(b)-sum(a)

C={}
C[1]=try_cnt
C[2]=try_cnt


for i,j in zip(a,b):
	if i<j:
		C[2]-=(j-i)/2
		i=(j-i)/2
	if i>j:
		C[1]-=(i-j)		

if C[1]>=0 and C[2]>=0:
	print "Yes"
else:
	print "No"

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    factorA = []
    factorB = []
    for index in range(n):
        if a[index] > b[index]:
            factorB.append(a[index]-b[index])
        elif a[index] < b[index]:
            factorA.append(math.ceil((b[index]-a[index])/2))
        else:
            pass
    else:
        num = abs(sum(a)-sum(b))
        if num >= sum(factorA) and num >= sum(factorB):
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
sa = sum(a)
sb = sum(b)
print("Yes" if sa <= sb else "No")

Submission status: Wrong Answer

Solution code:
# aに2を足す
# b に 1を足す
# ijを選択する

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

a_list = []
b_list = []

for i, j in zip(a, b):
    if i > j:
        b_list.append(i - j)
    elif i < j:
        a_list.append((j - i) // 2)

if sum(b_list) >= sum(a_list):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# aに2を足す
# b に 1を足す
# ijを選択する

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

a_list = []
b_list = []

for i, j in zip(a, b):
    if i > j:
        b_list.append(i - j)
    elif i < j:
        a_list.append((j - i) / 2)

if sum(b_list) >= sum(a_list):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
def main():
    _ = input()
    a_list = map(int, input().split())
    b_list = map(int, input().split())
    diffs = map(lambda a, b: b - a, a_list, b_list)
    total = 0
    count = 0
    for diff in diffs:
        if diff > 0:
            count += (diff + 1) // 2
            total += diff % 2
        else:
            count += -diff
            total += diff
    if count <= total:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    _ = input()
    a_list = map(int, input().split())
    b_list = map(int, input().split())
    diffs = tuple(map(lambda a, b: b - a, a_list, b_list))
    ops_count = sum(diffs)
    count = 0
    for diff in diffs:
        if diff < 0:
            count += -diff
        else:
            count += diff // 2
    if count <= ops_count:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
import math

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

d = [ y - x for x, y in zip(A, B)]

q = [ x // 2 for x in d if x > 0]
r = [ -x for x in d if x < 0]

if sum(q) > sum(r):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def main():
    _ = input()
    a_list = map(int, input().split())
    b_list = map(int, input().split())
    diffs = map(lambda a, b: b - a, a_list, b_list)
    n_a = 0
    n_b = 0
    exist_zero = False
    equalable = False
    for diff in diffs:
        if diff > 0:
            if diff % 2 != 0 or diff == 1:
                print("No")
                return
            else:
                n_a += diff // 2
        elif diff < 0:
            n_b += -diff
        else:
            exist_zero = True

    if exist_zero:
        if n_a > n_b:
            equalable = True
        else:
            equalable = False
    else:
        if n_a == n_b:
            equalable = True
        else:
            equalable = False
    if equalable:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys                                         
import math                                        
                                                   
N = int(input())                                   
A = list(map(int, input().split()))                
B = list(map(int, input().split()))                
                                                   
r = 0                                              
q = 0                                              
                                                   
for x, y in zip(A,B):                              
    if  x > y:                                     
        r += x - y                                 
    elif x < y:                                    
        q += (y - x)//2                            
                                                   
if (sum(B) - sum(A)) > r and (sum(B) - sum(A)) > q:
    print("Yes")                                   
else:                                              
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import math

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

r = 0
q = 0

for x, y in zip(A,B):
    if  x > y:
        r += x - y
    elif x < y:
        q += math.ceil((y - x)/2)

if (sum(B) - sum(A)) > r and (sum(B) - sum(A)) > q:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys                                          
import math                                         
                                                    
N = int(input())                                    
A = list(map(int, input().split()))                 
B = list(map(int, input().split()))                 
                                                    
r = 0                                               
q = 0                                               
                                                    
for x, y in zip(A,B):                               
    if  x > y:                                      
        r += x - y                                  
    elif x < y:                                     
        q += math.ceil((y - x)/2)                   
                                                    
print("A:{0:d}".format(sum(A)))                     
print("B:{0:d}".format(sum(B)))                     
print("r:{0:d}".format(r))                          
print("q:{0:d}".format(q))                          
                                                    
if (sum(B) - sum(A)) > r and (sum(B) - sum(A)) > q: 
    print("Yes")                                    
else:                                               
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import math

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

r = 0
q = 0

for x, y in zip(A,B):
    if  x < y:
        r += y - x
    elif x > y:
        q += math.ceil((x - y)/2)

if sum(B) - sum(A) < r + q:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ds = [b[i] - a[i] for i in range(N)]
p = sum((x + 1) // 2 for x in ds if x > 0)
m = sum(-x for x in ds if x < 0)
print(('No', 'Yes')[sum(ds) >= 0 and p + m <= sum(ds)])

Submission status: Wrong Answer

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

    b_minus_a = [tmp_b - tmp_a for tmp_a, tmp_b in zip(a, b)]

    if 2 * -sum([_ for _ in b_minus_a if _ < 0]) <= sum([_ - 1 for _ in b_minus_a if _ > 1]):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ds = [b[i] - a[i] for i in range(N)]
np = sum((x + 1) // 2 for x in ds if x > 0)
nm = sum(-x for x in ds if x < 0)
print(('No', 'Yes')[np + nm <= sum(ds)])

Submission status: Wrong Answer

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

    b_minus_a = [tmp_b - tmp_a for tmp_a, tmp_b in zip(a, b)]

    if 2 * -sum([_ for _ in b_minus_a if _ < 0]) <= sum([_ for _ in b_minus_a if _ > 0]):
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import math
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ds = [b[i] - a[i] for i in range(N)]
p = sum(x for x in ds if x > 0)
m = sum(-x for x in ds if x < 0)
print(('No', 'Yes')[math.ceil(p / 2) + m <= sum(ds)])