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 = list(map(int, input().split()))
B = list(map(int, input().split()))

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

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

Submission status: Wrong Answer

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

num = 0
diff = 0
for i in range(N):
    if A[i] != B[i]:
        num += 1
        
    diff += A[i] - B[i]
    
if diff == 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()))

num = 0
for i in range(N):
    if A[i] != B[i]:
        num += 1
        
    diff = A[i] - B[i]
    
if diff == num:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
A=LIST()
B=LIST()

cnt1=cnt2=0
for i in range(N):
    if A[i]>B[i]:
        # Bのが少ない合計*2(この分Aのどっかに足さないといけない)
        cnt1+=(A[i]-B[i])*2
    elif A[i]<B[i]:
        # Aのが少ない合計(この分で上記cnt1を受けきれるかどうか)
        # (こっちの合計が多い分には、同じ所でひたすら操作すれば帳尻が合うのでOK)
        cnt2+=B[i]-A[i]
if cnt1<=cnt2:
    Yes()
else:
    No()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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
if a==b:
    print("Yes")
else:
    for i in range(N):
        if a[i]>=b[i]:
            A+=a[i]-b[i]
        else:
            B+=b[i]-a[i]
    
    if (A*2)<=B:
        if sum(b)>=sum(a):
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        print("No")

Submission status: Wrong Answer

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

for i in range(N-1):
    if b[i]>=a[i]:
        b[i+1]+=(b[i]-a[i])//2
    else:
        a[i+1]+=(a[i]-b[i])*2

if a[N-1]<=b[N-1]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

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]

if (A*2)<=B:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    is_all_eq = True
    for i in range(N):
        if A[i]!= B[i]:
            is_all_eq =False
            break
    if is_all_eq == True:
        print "Yes"
        return

    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += (B[i] - A[i])/2 + (B[i] - A[i]) % 2



    if s_bigger_A  < s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    is_all_eq = True
    for i in range(N):
        if A[i]!= B[i]:
            is_all_eq =False
            break
    if is_all_eq == True:
        print "Yes"
        return

    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += (B[i] - A[i]) + (B[i] - A[i]) % 2



    if s_bigger_A  < s_bigger_B/2:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    is_all_eq = True
    for i in range(N):
        if A[i]!= B[i]:
            is_all_eq =False
            break
    if is_all_eq == True:
        print "Yes"
        return

    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += (B[i] - A[i]) + (B[i] - A[i]) % 2



    if 2 * s_bigger_A  < s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += (A[i] - B[i])/2 + (A[i] - B[i]) % 2
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  < s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += (A[i] - B[i])/2 + (A[i] - B[i]) % 2
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  <= s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i] + (A[i] - B[i]) % 2
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  <= s_bigger_B/ 2:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i] + (A[i] - B[i]) % 2
        else:
            s_bigger_B += B[i] - A[i]

    if 2 * s_bigger_A  <= s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(long(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(long(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += B[i] - A[i]

    if 2 * s_bigger_A  <= s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += B[i] - A[i]

    if 2 * s_bigger_A  <= s_bigger_B:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  < s_bigger_B/2:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0L
    s_bigger_B = 0L
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  <= s_bigger_B/2:
        print "Yes"
    else:
        print "No"


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    A = []
    for i in range(N):
        A.append(int(input_raw[i]))

    input_raw = read_func().strip().split()
    B = []
    for i in range(N):
        B.append(int(input_raw[i]))

    s_bigger_A = 0
    s_bigger_B = 0
    for i in range(N):
        if A[i]> B[i]:
            s_bigger_A += A[i] - B[i]
        else:
            s_bigger_B += B[i] - A[i]

    if s_bigger_A  <= s_bigger_B/2:
        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()))
count_a = 0
for i in range(n):
    count_a += max(0, -(-b[i] - a[i]) // 2)
if count_a <= 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()))
count_a = 0
count_b = 0
for i in range(n):
    count_a += max(0, b[i] - a[i])
    count_b += max(0, a[i] - b[i])
if sum(b) >= sum(a):
    if count_a // 2 >= count_b:
        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()))
count_a = 0
for i in range(n):
    count_a += max(0, b[i] - a[i])
if -(-count_a // 2) <= 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()))
count_a = 0
count_b = 0
for i in range(n):
    count_a += max(0, b[i] - a[i])
    count_b += max(0, a[i] - b[i])
if sum(b) >= sum(a):
    if count_a % 2 == 0:
        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()))

if sum(A)>sum(B):
    print("No")
else:
    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]
    if a*2>=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()))

if sum(A)>sum(B):
    print("No")
else:
    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]
    if a*2>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()))
ans = "No"
for i in range(N):
  if B[i] - A[i] > 0:
    if (B[i] - A[i]) % 2 == 0:
      flag = "Yes"
    else:
      break
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_cnt = 0
b_cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        a_cnt += a - b

    else:
        b_cnt += (b - a) // 2
tmp = sum(b_list) - sum(a_list)
if a_cnt <= tmp and b_cnt <= tmp:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        cnt += (a - b)

    else:
        cnt += ((b - a) // 2)

if cnt <= sum(b_list) - sum(a_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        cnt += a - b

    else:
        cnt += (b - a) // 2

if cnt <= sum(b_list) - sum(a_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_cnt = 0
b_cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        a_cnt += a - b

    else:
        b_cnt += (b - a) / 2

cnt = a_cnt + b_cnt
if cnt <= sum(b_list) - sum(a_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_cnt = 0
b_cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        a_cnt += a - b

    else:
        b_cnt += (b - a) // 2

cnt = a_cnt + b_cnt
if cnt < sum(b_list) - sum(a_list):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))

a_cnt = 0
b_cnt = 0

for i in range(N):
    a = a_list[i]
    b = b_list[i]

    if a == b:
        continue
    elif a > b:
        a_cnt += a - b

    else:
        b_cnt += (b - a) // 2

cnt = a_cnt + b_cnt
if cnt <= sum(b_list) - sum(a_list):
    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 = []
for i in range(N):
  diff.append(B[i] - A[i])
if sum(diff) == N:
  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 = []
for i in range(N):
  diff.append(B[i] - A[i])
if abs(sum(diff)) == N:
  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 = []
for i in range(N):
  diff.append(A[i] - B[i])
if abs(sum(diff)) == N:
  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()))

p = 0

for a,b in zip(A,B) :
    if a < b :
        p += b-a
    else :
        p -= (a-b)*2

if p >= 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()))
c=0
for i in range(n):
  if a[i]<b[i]:c+=((b[i]-a[i]+1)//2)
  elif a[i]>b[i]:c+=a[i]-b[i]
if c>sum(b)-sum(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 = list(map(lambda x, y: x-y, A, B))

C_neg = list(filter(lambda x: x < 0, C))
C_pos = list(filter(lambda x: x > 0, C))

pos_sum = sum(C_pos)
neg_sum = sum(C_neg)

if pos_sum <= abs(neg_sum)//2:
    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()))

C = list(map(lambda x, y: x-y, A, B))

C_neg = list(filter(lambda x: x < 0, C))
C_pos = list(filter(lambda x: x > 0, C))

pos_sum = sum(C_pos)
neg_sum = sum(C_neg)

if pos_sum < abs(neg_sum)//2:
    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(" ")))
pointA = 0
pointB = 0

for a, b in zip(A, B):
    if a == b:
        continue
    if a > b:
        pointA += 2 * (a-b)
    else:
        pointB += (b-a)//2
if pointA <= pointB:
    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(" ")))
pointA = 0
pointB = 0

for a, b in zip(A, B):
    if a == b:
        continue
    if a > b:
        pointA += 2 * (a-b)
    else:
        pointB += (b-a)//2
if pointA == pointB:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N2 = int(input())

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

P = 0
N = 0

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

Submission status: Wrong Answer

Solution code:
N2 = int(input())

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

a.sort()
b.sort()
a.reverse()
b.reverse()

P = 0
N = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

a.sort()
b.sort()
a.reverse()
b.reverse()

f = 1

for i in range(N):
    if a[i]>b[i]:
        f = -1
        
if f>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()))

S=0
for i in range(N):
    if A[i]-B[i]>0:
        S+=(A[i]-B[i])

if sum(B)-sum(A)<0:
    print("No")
elif (sum(B)-sum(A))<S:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = []
max_aplus = 0
min_aplus = 0
bplus = 0
for i,j in zip(a,b):
  if i > j:
    min_aplus += (i-j+1) //2
    max_aplus += i-j
  else:
    bplus += j-i
if bplus >= min_aplus and bplus <= max_aplus:
  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()))
c=0
d=0
for i in range(n):
    if b[i]<a[i]:
        d+=b[i]-a[i]
    else:
        k=b[i]-a[i]
        if k%2==1:
            d+=1
            c+=(k+1)//2
        else:
            c+=k//2
print("Yes" if d>=c else"No")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) > sum(b):
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
  if a[i] > b[i]:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
diff = 0
for i in range(N):
    x = A[i] - B[i]
    if x > 0:
        diff += 2 * x
    else:
        diff += x
if diff <= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
largeA = 0
largeB = 0
for i in range(N):
    x = A[i] - B[i]
    if x > 0:
        largeA += x
    elif x < 0:
        largeB += 2 * ((-x + 1) // 2)
if largeB - largeA * 2 >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(_) for _ in input().split()]
B = [int(_) for _ in input().split()]
largeA = 0
largeB = 0
for i in range(N):
    x = A[i] - B[i]
    if x > 0:
        largeA += x
    elif x < 0:
        largeB -= x
if largeB - largeA * 2 >= 0:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
B = inpl()
M = sum(B)-sum(A)
ans = 'Yes'
if M < 0:
    ans = 'No'
ca, cb = 0, 0
for i in range(N):
    dba = B[i] - A[i]
    if dba > 0:
        ca += -(-dba//2)
        cb += dba%2
    else:
        cb -= dba
if M != 2*ca-cb:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
B = inpl()
M = sum(B)-sum(A)
ans = 'Yes'
if M < 0:
    ans = 'No'
ca, cb = 0, 0
for i in range(N):
    if A[i] < B[i]:
        ca += -(A[i]-B[i])//2
        cb += (B[i]-A[i])%2
    else:
        cb += A[i] - B[i]
if M != 2*ca-cb:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
B = inpl()
M = sum(B)-sum(A)
ans = 'Yes'
if M < 0:
    ans = 'No'
ctr = 0
ca = 0
cb = 0
for i in range(N):
    if A[i] < B[i]:
        abdiv = -(A[i]-B[i])//2
        abmod = (B[i]-A[i])%2
        ca += abdiv
        cb += abmod
        
    else:
        cb += A[i] - B[i]
if M != 2*ca-cb or M < ca:
    ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
def inpl(): return [int(i) for i in input().split()]
N = int(input())
A = inpl()
B = inpl()
M = sum(B)-sum(A)
ans = 'Yes'
if M < 0:
    ans = 'No'
ctr = 0
for i in range(N):
    if A[i] < B[i]:
        ctr += -(A[i]-B[i])//2+(B[i]-A[i])%2
    else:
        ctr += A[i] - B[i]
if ctr-M:
    ans = 'No'
print(ans)