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())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0
diff = []
plusTotal = 0
minousTotal = 0
diffTotal = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	if diff[i] < 0:
		minousTotal += 1
	elif diff[i] > 0:
		plusTotal += 1

# print(plusTotal)
if (sumA <= sumB) and (diffNum <= sumB - sumA) and minousTotal % 2 == 1 and plusTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

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):
    if a == b:
        print("Yes")
    else:
        print("No")
elif sum(a) > sum(b):
    print("No")
else:
    x = 0
    for i in range(N):
        if a[i] < b[i]:
            x += b[i]-a[i]
    if x/2 > (sum(b)-sum(a)):
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

  checked = True
  d = []
  e = 0
  for i in range(n):
    checked = checked and a[i] == b[i]
    d += [b[i] - a[i]]
    if d[i] < 0:
      e += -1 * d[i]

  if checked:
    return "Yes"

  if sum(d) <= 0:
    return "No"

  if sum(d) > e:
    return "Yes"
  else:
    return "No"

result = prob_b()
print(result)

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

li = [x-y for (x,y) in zip(a,b)]

s_p = 0
s_m = 0

for i in range(len(li)):
     if li[i] > 0:
       s_p += li[i]   
     elif li[i] < 0:
       s_m += li[i]
     elif li[i] == 0:
          pass

if (abs(s_p) + (abs(s_m) % 2)) <= N:
     print('Yes')
else:
     print('No')

Submission status: Wrong Answer

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

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
res=0
for i in range(len(a)):
  res+=a[i]-b[i]
if res<=0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

print(diffTotal)
if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
n = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b =  [int(i) for i in input().split()]
diff = sum(b) -sum(a)
if(sum(b) < sum(a)):
        print("No")
        sys.exit()
else:
        tmp = 0
        tmp2 = 0
        for i in range(0,len(a)):
                if(b[i] > a[i]):
                        tmp+=b[i] - a[i]
                if(a[i] > b[i]):
                        tmp2+=a[i] - b[i]
        if(tmp > 2*diff or tmp2 > diff):
                print("No")
        else:
                print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
n = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b =  [int(i) for i in input().split()]
diff = sum(b) -sum(a)
if(sum(b) < sum(a)):
        print("No")
        sys.exit()
else:
        tmp = 0
        for i in range(0,len(a)):
                if(b[i] > a[i]):
                        tmp+=b[i] - a[i]
        if(tmp > 2*diff):
                print("No")
        else:
                print("Yes")

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

suma = sumb = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]

if A == B:
    print("Yes")
else:
    if suma >= sumb:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
n = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b =  [int(i) for i in input().split()]
diff = sum(b) -sum(a)
if(diff < 0):
        print("No")
        sys.exit()
else:
        tmp = 0
        for i in range(0,len(a)):
                if(b[i] > a[i]):
                        tmp+=b[i] - a[i]
        if(tmp > 2*diff):
                print("No")
        else:
                print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))
    B = list(map(int, (input().split(' '))))

    a_sum = 0
    for x in A:
        a_sum += x
    b_sum = 0
    for x in B:
        b_sum += x
    if a_sum > b_sum:
        print('No')
        sys.exit()
    if (a_sum + N) < b_sum:
        print('No')
        sys.exit()
    a_plus = 0
    b_plus = 0
    a_plus_cnt = 0
    b_plus_cnt = 0
    A_list = []
    B_list = []
    for i in range(N):
        if A[i] < B[i]:
            a_plus += (B[i] - A[i])
            if A[i] < B[i] - 1:
                a_plus_cnt += ((B[i] - A[i]) // 2)
        elif A[i] > B[i]:
            b_plus += (A[i] - B[i])
            b_plus_cnt += (A[i] - B[i])
    if a_plus < b_plus * 2:
        print('No')
        sys.exit()
    if a_plus_cnt < b_plus_cnt:
        print('No')
        sys.exit()
#    if a_plus // 2 > N:
#        print('No')
#        sys.exit()
#    if a_plus_cnt != b_plus_cnt:
#        print('No')
#        sys.exit()
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0
diff = []
diffTotal = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

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

s = sorted(b[i] - a[i] for i in range(N))
plus = [x for x in s if x > 0]
minus = [x for x in s if x < 0]
while len(plus) > 0 and len(minus) > 0:
    m = min(len(plus), len(minus))
    for i in range(m):
        plus[-1 - i] += 2 * minus[i]
    s = sorted(plus + minus[m:])
    plus = [x for x in s if x > 0]
    minus = [x for x in s if x < 0]
print(('No', 'Yes')[sum(plus) + 2 * sum(minus) > 0])

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0
diff = []
diffTotal = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

print(diffTotal)
if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

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

suma = sumb = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]

if A == B:
    print("Yes")
else:
    if suma >= sumb:
        print("No")
    else:
        equal = True
        for i in range(1,N):
            if A[i] != A[i-1] or B[i] != B[i-1]:
                equal = False
        if equal:
            if abs(A[0] - B[0]) % 2 == 0:
                print("No")
            else:
                print("Yes")
        else:
            if abs(suma - sumb) % 2 == 0:
                print("No")
            else:
                print("Yes")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    if a == b:
        return print('Yes')
    print(
        sum(a),sum(b)
    )
    dif = sum(b) - sum(a)
    if dif <= 0:
        return print('No')
    d = [b[i]-a[i] for i in range(N)]
    print(sum(d))
    if sum(a) % 3 == 0 and sum(b) % 3:
        if sum(d) % 3 == 0:
            return print('Yes')
        else:
            return print('No')
    return print('Yes')


main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p, q = 0, 0
for i in range(n):
    if a[i] > b[i]:
        p += a[i] - b[i]
    elif a[i] < b[i]:
        q += b[i] - a[i]

if 2 * p <= q:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0
diff = []
diffTotal = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

# print(diff)
if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

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

s = sorted(b[i] - a[i] for i in range(N))
plus = [x for x in s if x > 0]
minus = [x for x in s if x < 0]
while len(plus) > 0 and len(minus) > 0:
    m = min(len(plus), len(minus))
    for i in range(m):
        plus[i] += 2 * minus[-i]
    del minus[len(minus) - m:]
    s = sorted(plus + minus)
    plus = [x for x in s if x > 0]
    minus = [x for x in s if x < 0]
print(('No', 'Yes')[sum(plus) + 2 * sum(minus) > 0])

Submission status: Wrong Answer

Solution code:
n = int(input())
numbersA = input().split()
numbersB = input().split()
sumA = 0
sumB = 0
diffNum = 0
diff = []
diffTotal = 0

for i in range(0,n):
	if numbersA[i] != numbersB[i]:
		diffNum += 1
	sumA += int(numbersA[i])
	sumB += int(numbersB[i])	
	diff.append((int(numbersB[i]) - int(numbersA[i])))
	diffTotal += diff[i]

print(diff)
if (sumA <= sumB) and (diffNum <= sumB - sumA) and diffTotal % 2 == 1:
	print("Yes")
else:
	print("No")

# 14 20
# 16 21 18 22 20 23 22 24 24 25 26 26

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))
    B = list(map(int, (input().split(' '))))

    a_sum = 0
    for x in A:
        a_sum += x
    b_sum = 0
    for x in B:
        b_sum += x
    if a_sum > b_sum:
        print('No')
        sys.exit()
    if (a_sum + N) < b_sum:
        print('No')
        sys.exit()
    a_plus = 0
    b_plus = 0
    a_plus_cnt = 0
    b_plus_cnt = 0
    for i in range(N):
        if A[i] < B[i]:
            a_plus += (B[i] - A[i])
            a_plus_cnt += 1
        elif A[i] > B[i]:
            b_plus += (A[i] - B[i])
            b_plus_cnt += 1
    if a_plus < b_plus * 2:
        print('No')
        sys.exit()
    if a_plus // 2 > N:
        print('No')
        sys.exit()
    if a_plus_cnt != b_plus_cnt:
        print('No')
        sys.exit()
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p, q = 0, 0
for i in range(n):
    if a[i] == b[i]:
        continue
    elif a[i] > b[i]:
        p += (a[i] - b[i]) * 2
    else:
        if (b[i] - a[i]) % 2 == 0:
            q += (b[i] - a[i]) // 2
        else:
            p += 2
            q += 1
            q += (b[i] - a[i]) // 2

if p <= q:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
alis = list(map(int,input().split()))
blis = list(map(int,input().split()))

sa = sum(alis)
sb = sum(blis)
dif = []
if sa > sb:
	print("No")
else:
	alis.sort()
	blis.sort()
	for a,b in zip(alis,blis):
		dif.append(a-b)
	anum = 0
	bnum = 0
	for i in range(N):
		if dif[i] < 0:
			anum -= dif[i]
		else:
			bnum += dif[i]
	if (anum / 2) <= (sb - sa) and bnum <= (sb -sa):
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = input()
ai = A.split()
B = input()
bi = B.split()
i = 0
a = []
b = []
for i in range(N):
    a.append(int(ai[i]))
    b.append(int(bi[i]))

i = 0
asum = 0
bsum = 0
for i in range(N):
    asum += a[i]
    bsum += b[i]

c = True
j = 0
if asum > bsum:
    print("No")
    c = False
elif asum == bsum:
    for j in range(N):
        if a[j] != b[j]:
            print("No")
            c = False
            break
    if c:
        print("Yes")
        c = False
else:
    k = 0
    Da = 0
    Db = 0
    d = bsum - asum 
    while Da < d and Db < d:
        dab = 0
        if a[k] < b[k]:
            dab = b[k] - a[k]
            if dab // 2 == 0:
                Da += 1
                a[k] += 2
            else:
                Da += dab // 2
                a[k] += (dab // 2) * 2 
        elif a[k] == b[k]:
            k += 1
        else:
            dab = a[k] - b[k]
            Db += dab
            b[k] += dab
        if k == N:
            break
if c:
    for j in range(N):
        if a[j] != b[j]:
            print("No")
            c = False
            break
    if c:
        if (N - Da) * 2 == (N - Db) * 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()))

s = [b[i] - a[i] for i in range(N)]
plus = [x for x in s if x > 0]
minus = [x for x in s if x < 0]
while len(plus) > 0 and len(minus) > 0:
    m = min(len(plus), len(minus))
    for i in range(m):
        plus[i] += 2 * minus[i]
    del minus[:m]
    s = plus + minus
    plus = [x for x in s if x > 0]
    minus = [x for x in s if x < 0]
print(('No', 'Yes')[sum(plus) + 2 * sum(minus) > 0])

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]

for n in range(N):
    cl[n] = al[n] - bl[n]

cp = 0
cm = 0
for c in cl:
    if c > 0:
        cp += c
    elif c < 0:
        cm += c
res = cp * 2 <= abs(cm)

if res:
    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 = []
for i in range(n):
    c.append(a[i] - b[i])
for i in range(n):
    if c[i] < 0 and c[i] % 2:
        c[i] = 2 * (c[i] // 2 + 1)
d = 0
for i in range(n):
    if c[i] < 0:
        d = d + abs(c[i])/2
    if c[i] > 0:
        d = d + c[i]
e = 0
for i in range(n):
    e = e - c[i]
if d > e:
    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, q = 0, 0
for i in range(n):
    if a[i] > b[i]:
        p += (a[i] - b[i]) * 2
    elif a[i] < b[i]:
        q += (b[i] - a[i]) // 2

if p == q:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]

for n in range(N):
    cl[n] = al[n] - bl[n]

cp = 0
cm = 0
for c in cl:
    if c > 0:
        cp += c
    elif c < 0:
        cm += c
res = cp <= abs(cm / 2)

if res:
    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, q = 0, 0
for i in range(n):
    if a[i] > b[i]:
        p += (a[i] - b[i]) * 2
    elif a[i] < b[i]:
        q += (b[i] - a[i]) // 2

if p <= q:
    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()))
    if a == b:
        return print('Yes')

    dif = sum(b) - sum(a)
    d = [b[i]-a[i] for i in range(N)]
    if dif <= 0:
        return print('No')
    if sum(d) % 3 == 0:
        return print('Yes')
    return print('Yes')


main()

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

s = [b[i] - a[i] for i in range(N)]
plus = [x for x in s if x > 0]
minus = [x for x in s if x < 0]
while len(plus) > 1 and len(minus) > 1:
    m = min(len(plus), len(minus))
    for i in range(m):
        plus[i] += 2 * minus[i]
    del minus[:m]
    s = plus + minus
    plus = [x for x in s if x > 0]
    minus = [x for x in s if x < 0]
print(('No', 'Yes')[sum(plus) + 2 * sum(minus) > 0])

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p, q = 0, 0
for i in range(n - 1):
    if a[i] > b[i]:
        p += (a[i] - b[i]) * 2
    elif a[i] < b[i]:
        q += (b[i] - a[i]) // 2

if p <= q:
    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()))

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

if a[n - 1] <= b[n - 1]:
    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()]

li = [x-y for (x,y) in zip(a,b)]

if abs(sum(li)) > N:
     print('No')
elif sum(li) > 0:
     print('No')
elif li.count(0) == len(li):
     print('Yes')
else:
     print('Yes')

Submission status: Wrong Answer

Solution code:
import math
import itertools
import heapq
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect, bisect_left, bisect_right
from collections import defaultdict, deque


# d = defaultdict(lambda: 0)
# setrecursionlimit(10**7)
# inf = float("inf")


##### stdin ####
def LM(t, r): return list(map(t, r))
def R(): return stdin.readline()
def RS(): return R().split()
def I(): return int(R())
def F(): return float(R())
def LI(): return LM(int,RS())
def LF(): return LM(float,RS())
def ONE_SL(): return list(input())
def ONE_IL(): return LM(int, ONE_SL())
def ALL_IL(): return LM(int,stdin)

##### tools #####
def ap(f): return f.append
def pll(li): print('\n'.join(LM(str,li)))
def pljoin(li, s): print(s.join(li))



##### main #####

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a


def main():
	n = I()
	a = LI()
	b = LI()

	pos = 0
	neg = 0

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

		if diff>0:
			pos += abs(diff)
		else:
			neg += abs(diff)

	if pos == neg == 0:
		print("Yes")
		exit()

	g = gcd(pos,neg)
	if 2*(pos/g) == neg/g:
		print("Yes")
	else:
		print("No")


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]
res = False

for n in range(N):
    cl[n] = al[n] - bl[n]

# if sum(cl) > 0:
#     res = False
# else:
cl = sorted(cl)
cp = 0
cm = 0
for c in cl:
    if c > 0:
        cp += c
    elif c < 0:
        cm += c
res = cp <= abs(cm / 2)

if res:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(i) for i in input().split()]
B=[int(j) for j in input().split()]
a=sum(A)
b=sum(B)
res=b-a
cnt=0
s=0
t=0

for i in range(N):
  if A[i]%2==0:
    s+=1
  if B[i]%2==0:
    t+=1
  if A[i]>B[i]:
    cnt+=(A[i]-B[i])
  elif A[i]<B[i] and (B[i]-A[i])%2==0:
    cnt+=(B[i]-A[i])/2
  elif A[i]<B[i] and (B[i]-A[i])%2==1:
    cnt+=(B[i]-A[i]+1)/2

if res<0:
  print("No")
elif res*2<cnt:
  print("No")
elif abs(s-t)>res:
  print("No")
elif (res-abs(s-t))%2==1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))
    B = list(map(int, (input().split(' '))))

    a_sum = 0
    for x in A:
        a_sum += x
    b_sum = 0
    for x in B:
        b_sum += x
    if a_sum > b_sum:
        print('No')
        sys.exit()
    if (a_sum + N) < b_sum:
        print('No')
        sys.exit()
    a_plus = 0
    b_plus = 0
    for i in range(N):
        if A[i] < B[i]:
            a_plus += (B[i] - A[i])
        else:
            b_plus += (A[i] - B[i])
    if a_plus <= b_plus * 2:
        print('No')
        sys.exit()
    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 - 1):
    if a[i] > b[i]:
        a[n - 1] += (a[i] - b[i]) * 2
    elif a[i] < b[i]:
        if (b[i] - a[i]) % 2 == 0:
            b[n - 1] += (b[i] - a[i]) // 2
        else:
            a[i] += 2
            b[i] += 1
            b[n - 1] += (b[i] - a[i]) // 2


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

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]
res = False

for n in range(N):
    cl[n] = al[n] - bl[n]

# if sum(cl) > 0:
#     res = False
# else:
    cl = sorted(cl)
    cp = 0
    cm = 0
    for c in cl:
        if c > 0:
            cp += c
        if c < 0:
            cm += c
    res = cp <= abs(cm/2)
    
if res:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]
res = False

for n in range(N):
    cl[n] = al[n] - bl[n]

if sum(cl) > 0:
    res = False
else:
    cl = sorted(cl)
    cp = 0
    cm = 0
    for c in cl:
        if c > 0:
            cp += c
        if c < 0:
            cm += c
    res = cp <= abs(cm/2)
    # print(cl)
    # if sum(cl) > 0:
    #     res = False
    #     break
    # elif cl[N - 1] <= 0:
    #     res = True
    #     break
    # cl[0] += 2
    # cl[N - 1] += -1

if res:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())						# 5
a = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)
b = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)

#print("a", a)
#print("b", b)


ans='Yes'
ans='No'


#for i in range(N):
#	if a[i]>b[i]:
#		ans='No'


count_x2 = 0		# 差が2の倍数の個数を数える
count_a = 0			# aが大きい数を数える
for i in range(N):
	j = (b[i]-a[i])//2
	if j > 0:
		count_x2 += j
	
	count_a += max(0, a[i]-b[i])


#print(count_x2)
#print(count_a)
if count_x2 >= count_a:
	ans="Yes"

print(ans)






# 4
# 1 1 3 6
# 5 5 5 5

# 5
# 1 1 3 6 7
# 5 5 5 5 8

#	2
#	3 6
#	5 5


#	2
#	2 6
#	5 5

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]
res = False

for n in range(N):
    cl[n] = al[n] - bl[n]

if sum(cl) > 0:
    res = False
else:
    cl = sorted(cl)
    cp = 0
    cm = 0
    for c in cl:
        if c > 0:
            cp += c
        if c < 0:
            cm += c
    res = cp < abs(cm/2)
    # print(cl)
    # if sum(cl) > 0:
    #     res = False
    #     break
    # elif cl[N - 1] <= 0:
    #     res = True
    #     break
    # cl[0] += 2
    # cl[N - 1] += -1

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

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))
    B = list(map(int, (input().split(' '))))

    a_sum = 0
    for x in A:
        a_sum += x
    b_sum = 0
    for x in B:
        b_sum += x
    if a_sum > b_sum:
        print('No')
        sys.exit()
    if (a_sum + N) < b_sum:
        print('No')
        sys.exit()
    a_plus = 0
    b_plus = 0
    for i in range(N):
        if A[i] < B[i]:
            a_plus += (B[i] - A[i])
        else:
            b_plus += (A[i] - B[i])
    if a_plus < b_plus * 2:
        print('No')
        sys.exit()
    print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

li = [x-y for (x,y) in zip(a,b)]


if sum(li) > 0:
     print('No')
elif li.count(0) == len(li):
     print('Yes')
elif abs(sum(li)) % 2 == 0:
     if abs(sum(li)) == N:
          print('Yes')
     else:
          print('No')
else:
     print('No')

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N = int(input())
    A = list(map(int, (input().split(' '))))
    B = list(map(int, (input().split(' '))))

    a_sum = 0
    for x in A:
        a_sum += x
    b_sum = 0
    for x in B:
        b_sum += x
    if a_sum > b_sum:
        print('No')
        sys.exit()
    if (a_sum + N) < b_sum:
        print('No')
        sys.exit()
    a_plus = 0
    b_plus = 0
    for i in range(N):
        if A[i] < B[i]:
            a_plus += (B[i] - A[i])
        else:
            b_plus += (A[i] - B[i])
    print(a_plus)
    print(b_plus)
    if a_plus < b_plus * 2:
        print('No')
        sys.exit()
    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]:
        continue
    elif a[i] > b[i]:
        a[n - 1] += (a[i] - b[i]) * 2
    else:
        if (b[i] - a[i]) % 2 == 0:
            b[n - 1] += (b[i] - a[i]) // 2
        else:
            a[i] += 2
            b[i] += 1
            b[n - 1] += (b[i] - a[i]) // 2


if a[n - 1] <= b[n - 1]:
    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()]

li = [x-y for (x,y) in zip(a,b)]


if sum(li) > 0:
     print('No')
elif li.count(0) == len(li):
     print('Yes')
elif abs(sum(li)) <= N:
     print('Yes')
else:
     print('No')

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
import math
N = int(input())
a = input().split(" ")
b = input().split(" ")

#a,b同じ配列か判定
for i in range(len(a)):

    if a[i] == b[i]:
        judge = True
    else:
        judge = False
if judge:
    print("Yes")
    sys.exit()

c =0
a = list(map(int,a))
b = list(map(int,b))
for i in range(N):
    temp = (a[i]-b[i])
    c += temp

if c>=0:
    print("No")
    sys.exit()

c_judge = abs(c)
while c_judge > 0:
    a_judge = True
    b_judge = True
    for i in range(N):
        if a[i] - b[i] < 0 and a_judge:
            a[i] = a[i]+2
            a_judge = False
        elif a[i] - b[i] >0 and b_judge:
            b[i] = b[i]+1
            b_judge = False
    c_judge -=1
set_c = set(a)-set(b)
if len(set_c) == 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()))
for i in range(n - 1):
    if a[i] == b[i]:
        continue
    elif a[i] > b[i]:
        a[n - 1] += (a[i] - b[i]) * 2
    else:
        if (b[i] - a[i]) % 2 == 0:
            b[n - 1] += (b[i] - a[i]) // 2
        else:
            a[i] += 2
            b[i] += 1
            b[n - 1] += (b[i] - a[i]) // 2


if a[n - 1] <= b[n - 1]:
    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()]

suma = sumb = 0
for i in range(N):
    suma += A[i]
    sumb += B[i]

if A == B:
    print("Yes")
else:
    if suma >= sumb or abs(suma - sumb) % 2 == 0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n - 1):
    if a[i] == b[i]:
        continue
    elif a[i] > b[i]:
        a[n - 1] += (a[i] - b[i]) * 2
    else:
        if (b[i] - a[i]) % 2 == 0:
            b[n - 1] += (b[i] - a[i]) // 2
        else:
            a[n - 1] += 2
            b[i] += 1
            b[n - 1] += (b[i] - a[i]) // 2


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

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
n = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b =  [int(i) for i in input().split()]
diff = sum(b) -sum(a)
if(diff < 0):
        print("No")
        sys.exit()
else:
        na = np.array(a)
        nb = np.array(b)
        for i in range(diff):
                na[np.argmin(na)] +=2
                nb[np.argmin(nb)] +=1
if(np.allclose(na,nb)):
        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()]


li = [x-y for (x,y) in zip(a,b)]
if sum(li) > 0:
     print('No')
elif sum(li) == 0:
     print('Yes')
elif abs(sum(li)) <= N:
     print('Yes')
else:
     print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))

cl = [0 for n in range(N)]
res = "No"

for n in range(N):
    cl[n] = al[n] - bl[n]

if sum(cl) > 0:
    print(res)
else:
    for c in cl:
        if c > 0:
            res = "No"
            break
        else:
            res = "Yes"

    print(res)