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()))
sum_a= sum(a)
sum_b = sum(b)
if sum_a>sum_b:
  print("No")
  exit()
#num回操作を行うことができる.  
num = sum_b-sum_a
sa_a = 0
sa_b = 0
cou = 0
for j,k in zip(a,b):
  if j>k:
    sa_b += j-k
    cou += 1
  elif k>j:
    sa_a += k-j
if sa_a-(num-cou)-2*sum_b==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()))
sum_a= sum(a)
sum_b = sum(b)
if sum_a>sum_b:
  print("No")
  exit()
#num回操作を行うことができる.  
num = sum_b-sum_a
sa_a = 0
sa_b = 0
cou = 0
for j,k in zip(a,b):
  if j>k:
    sa_b += j-k
    cou += 1
  elif k>j:
    sa_a += k-j

if sa_a-(num-cou)-2*sum_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()))
maxC = 0
C = 0
for i in range(n):
    a, b = A[i], B[i]
    if a<b:
        C += (b-a)//2
    elif a>b:
        maxC += a-b
print('Yes' if C<=maxC else 'No')

Submission status: Wrong Answer

Solution code:
from math import ceil
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
maxC = sum(B)-sum(A)
C = 0
for i in range(n):
    a, b = A[i], B[i]
    if a<b:
        C += ceil((b-a)/2)
    elif a>b:
        C += a-b
print('Yes' if C<=maxC else 'No')

Submission status: Wrong Answer

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

cnt = sum(b) - sum(a)
ans = 0
for ai, bi in zip(a, b):
    ans += max(0, ai - bi, (bi - ai + 1) // 2)
print('Yes' if ans <= cnt else 'No')

Submission status: Wrong Answer

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

cnt = max(0, sum(b) - sum(a))
ans = 0
for ai, bi in zip(a, b):
    ans += max(0, ai - bi, (bi - ai + 1) // 2)
print('Yes' if ans <= cnt else 'No')

Submission status: Wrong Answer

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

sA = sum(A)
sB = sum(B)

if sB - sA == n:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10


N = INT()
a = LIST()
b = LIST()

A = 0
B = 0

for i in range(N):
	if a[i] < b[i]:
		A += b[i]-a[i]
	elif a[i] > b[i]:
		B += a[i] - b[i]

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

print(A, B)
"""
3
1 1 4
4 4 1
が誤例
"""

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
diff = sum(B) - sum(A)
score = 0
for a, b in zip(A, B):
    if a - b > 0:
        score += a - b
    else:
        score += (b - a - 1) // 2 * 2
print("Yes") if diff >= score else print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
score = 0
for a, b in zip(A, B):
    gain = b - a
    if gain > 0:
        score += gain
    else:
        score += gain * 2
print("Yes") if score >= 0 else print("No")

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()
b = LIST()

A = 0
B = 0

for i in range(N):
	if a[i] < b[i]:
		A += b[i]-a[i]
	elif a[i] > b[i]:
		B += a[i] - b[i]

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

"""
3
1 1 5
4 4 1
が誤例
"""

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()
b = LIST()

A = 0
B = 0

for i in range(N):
	if a[i] < b[i]:
		A += b[i]-a[i]
	elif a[i] > b[i]:
		B += a[i] - b[i]

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

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()
b = LIST()

A = 0
B = 0

for i in range(N):
	if a[i] > b[i]:
		B += a[i]-b[i]
	elif a[i] < b[i]:
		A += b[i]-a[i]

if 2*B <= A:
	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()))

operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0
z = 0
for i in range(n):
    x += b[i]-a[i]
    y += max(a[i]-b[i], 0)
    z += max(math.ceil((b[i]-a[i])/2), 0)
# print(x, y)
if x - y < 0 and x - z < 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0 # a>bの和

for i in range(n):
    x += b[i]-a[i]
    y += max(a[i]-b[i], 0)
    y += max(math.ceil((b[i]-a[i])/2), 0)
# print(x, y)
if x - y < 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()))

operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0 # a>bの和

for i in range(n):
    x += b[i]-a[i]
    y += max(a[i]-b[i], 0)
    y += max((b[i]-a[i])//2, 0)
# print(x, y)
if x - y < 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()))
cp = 0
cm = 0
for i in range(N):
    if A[i]>B[i]:
        cm += A[i]-B[i]
    elif B[i]>A[i]:
        cp += B[i]-A[i]
if cp//2>=cm:
    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()))

operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0 # a>bの和

for i in range(n):
    x += b[i]-a[i]
    y += max(a[i]-b[i], 0)
# print(x, y)
if x - y < 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
s = input()
if (len(s)+1)//2 == s.count('hi'):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

diff = sum(b) - sum(a)
if diff < 0:
    print("No")
    exit()

c = 0
for i in range(n):
    if a[i] < b[i]:
        c += b[i]-a[i]
if c%2 ==1:
    c +=1
c //=2
if c > diff:
    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()))
sa = sum(a)
sb = sum(b)
if sa > sb:
    print("No")
elif sa == sb:
    if sa==sb:
        print("Yes")
    else:
        print("No")
else:
    count = 0
    for i,j in zip(a,b):
        if j > i:
            count += (j-i+1)//2
    if count <= sb-sa:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

ca = 0
cb = 0
for i,j in zip(a,b):
    if i > j:
        cb += i-j
    else:
        ca += j-i
if ca > cb:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

k = sum(b) - sum(a)
m = [max(a[i], b[i]) for i in range(n)]
if k>=0 and sum(a)+2*k>=sum(m) and sum(b)+k>=sum(m):
    ans = "Yes"
else:
    ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    if sum(A) > sum(B):
        print('No')
        exit()
    
    cnt = 0
    for i in range(N):
        if B[i] > A[i]:
            cnt += (B[i] - A[i]) // 2
        else:
            cnt -= (A[i] - B[i])

    if cnt > 0:
        print('Yes')
    else:
        print('No')
    


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    pos = 0
    neg = 0
    for i in range(N):
        pos += max(a[i]-b[i],0)
        neg -= min(a[i]-b[i],0)
    # print(ans)
    if  neg >= pos*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()))

cnt = 0
for a, b in zip(A, B):
    if a > b:
        cnt += (a-b)*2
    else:
        cnt -= (b-a)

print("No" if cnt>0 else "Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
sa = sum(A)
sb = sum(B)
if sa>sb:
    print("No")
else:
    d1 = 0
    d2 = 0
    for i in range(N):
        if A[i]>B[i]:
            d1 += A[i]-B[i]
        elif B[i]>A[i]+1:
            d2 += B[i]-A[i]
    if d2>=2*d1:
        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()))
sa=sum(a)
sb=sum(b)
if sb<sa:
  print("No")
  exit(0)
husoku=0
for aa,bb in zip(a,b):
  if bb<aa:
    husoku+=aa-bb

sa+=2*husoku
sb+=husoku
if sa<sb:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
Bs = list(mapint())

ap = 0
bp = 0
for a, b in zip(As, Bs):
    if a>b:
        ap += a-b
    else:
        bp += b-a
if ap>bp/2:
    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()))
sa = sum(A)
sb = sum(B)
if sa>sb:
    print("No")
else:
    d = 0
    for i in range(N):
        if A[i]>B[i]:
            d += A[i]-B[i]
    if d<=sb-sa:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    n = getN()
    anums = getList()
    bnums = getList()
    if sum(anums) > sum(bnums):
        print("No")
        return

    pair = []
    for i, j in zip(anums, bnums):
        pair.append((i, j))

    pair.sort(key=lambda x:- x[0] + x[1])
    # print(pair)
    kosi = 0
    for a,b in pair:
        a += kosi
        if b >= a:
            print("Yes")
            return
        else:
            kosi = (a - b) * 2

    if kosi:
        print("No")
        return
    else:
        print("Yes")
        return


def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()

Submission status: Wrong Answer

Solution code:
import sys
# from collections import defaultdict, deque
# import math
# import copy
from bisect import bisect_left, bisect_right
# import heapq

# sys.setrecursionlimit(1000000)

# input aliases
input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 1000000007

def solve():
    n = getN()
    anums = getList()
    bnums = getList()
    if sum(anums) > sum(bnums):
        print("NO")
        return

    pair = []
    for i, j in zip(anums, bnums):
        pair.append((i, j))

    pair.sort(key=lambda x:- x[0] + x[1])
    # print(pair)
    kosi = 0
    for a,b in pair:
        a += kosi
        if b >= a:
            print("YES")
            return
        else:
            kosi = (a - b) * 2

    if kosi:
        print("NO")
        return
    else:
        print("YES")
        return


def main():
    n = getN()
    for _ in range(n):
        solve()
if __name__ == "__main__":
    # main()
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# input
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
b.sort()
for i in range(n):
    if a[i] > b[i]:
        print("No")
        exit()
print("Yes")

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

for i in range(N):
    if a[i] > b[i]:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

cnt_a, cnt_b = sum(a), sum(b)
ans = "No"
i = 0
cnt = 0
while cnt < cnt_b - cnt_a:
    if a[i % n] < b[i % n]:
        x = int((b[i % n] - a[i % n]) / 2 + 0.5)
        cnt += x
        a[i % n] += 2 * x
    else:
        x = a[i % n] - b[i % n]
        cnt += x
        b[i % n] += x
    i += 1
    
    if a == b:
        ans = "Yes"
        break

print(ans)

Submission status: Wrong Answer

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

cnt_a, cnt_b = 0, 0
for i in range(n):
    if a[i] < b[i]:
        cnt_b += b[i] - a[i]
    elif a[i] > b[i]:
        cnt_a += a[i] - b[i]
#print(cnt_a, cnt_b)
print("Yes" if cnt_b % 2 == 0 and (cnt_a < cnt_b or cnt_a == cnt_b == 0) else "No")

Submission status: Wrong Answer

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

cnt_a, cnt_b = 0, 0
for i in range(n):
    if a[i] < b[i]:
        cnt_b += b[i] - a[i]
    elif a[i] > b[i]:
        cnt_a += a[i] - b[i]

print("Yes" if cnt_b % 2 == 0 and cnt_a <= cnt_b else "No")

Submission status: Wrong Answer

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

cnt_a, cnt_b = 0, 0
for i in range(n):
    if a[i] < b[i]:
        cnt_b += b[i] - a[i]
    elif a[i] > b[i]:
        cnt_a += a[i] - b[i]

print("Yes" if cnt_a <= cnt_b and (cnt_a - cnt_b == 0 or (cnt_a - cnt_b) % 2 == 1) else "No")

Submission status: Wrong Answer

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

    suma = 0
    dab = 0
    dba = 0
    for i in range(n):
        suma += b[i]-a[i]
        if a[i] < b[i]:
            dab += math.ceil((b[i]-a[i])/2)
        else:
            dba += a[i]-b[i]
    if dab+dba > suma:
        print("No")
    else:
        print("Yes")
resolve()

Submission status: Wrong Answer

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

    suma = 0
    sumb = 0
    dab = 0
    dba = 0
    for i in range(n):
        suma += a[i]
        sumb += b[i]
        if a[i] > b[i]:
            dab += a[i]-b[i] #aが大きい
        else:
            dba += b[i]-a[i]  #bが大きい
    if suma > sumb or (suma + 2*dab) > (sumb + dab) or suma+math.ceil(dba/2)*2 > sumb + math.ceil(dba/2):
        print("No")
    else:
        print("Yes")


resolve()

Submission status: Wrong Answer

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

    suma = 0
    sumb = 0
    dab = 0
    dba = 0
    for i in range(n):
        suma += a[i]
        sumb += b[i]
        if a[i] > b[i]:
            dab += a[i]-b[i] #aが大きい
        else:
            dba += b[i]-a[i]  #bが大きい
    if suma > sumb or (suma + 2*dab) > (sumb + dab):
        print("No")
    else:
        print("Yes")
resolve()

Submission status: Wrong Answer

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

    suma = 0
    sumb = 0
    dab = 0
    dba = 0
    for i in range(n):
        suma += a[i]
        sumb += b[i]
        if a[i] > b[i]:
            dab += a[i]-b[i] #aが大きい
        else:
            dba += b[i]-a[i]  #bが大きい
    if suma > sumb or  math.ceil(dba/2) *2 + suma > dab+sumb:
        print("No")
    else:
        print("Yes")
resolve()

Submission status: Wrong Answer

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

    suma = 0
    sumb = 0
    dab = 0

    for i in range(n):
        suma += a[i]
        sumb += b[i]
        if a[i] > b[i]:
            dab += a[i]-b[i]
    if (dab*2+suma) >= sumb:
        print("No")
    else:
        print("Yes")
resolve()

Submission status: Wrong Answer

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

    suma = 0
    sumb = 0
    dab = 0

    for i in range(n):
        suma += a[i]
        sumb += b[i]
        if a[i] > b[i]:
            dab += a[i]-b[i]
    if (dab*2+suma) > sumb:
        print("No")
    else:
        print("Yes")
resolve()

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')
    exit()
else:
    cnt = sum(B)-sum(A)
a_tmp = 0
b_tmp = 0
for i in range(N):
    if A[i] == B[i]:
        continue
    if cnt == 0:
        print('No')
        exit()
    if A[i] > B[i]:
        b_tmp += A[i]-B[i]
    else:
        if (B[i]-A[i]) % 2 == 0:
            a_tmp += (B[i]-A[i]) // 2
        else:
            a_tmp += ((B[i]-A[i]) // 2)+1
            b_tmp += 1
if (cnt-a_tmp)*2 == cnt-b_tmp:
    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')
    exit()
else:
    cnt = sum(B)-sum(A)
a_tmp = 0
b_tmp = 0
for i in range(N):
    if A[i] == B[i]:
        continue
    if A[i] > B[i]:
        b_tmp += A[i]-B[i]
    else:
        if (B[i]-A[i]) % 2 == 0:
            a_tmp += (B[i]-A[i]) // 2
        else:
            a_tmp += ((B[i]-A[i]) // 2)+1
            b_tmp += 1
if (cnt-a_tmp)*2 == cnt-b_tmp:
    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')
    exit()
else:
    cnt = sum(B)-sum(A)
a_tmp = 0
b_tmp = 0
for i in range(N):
    if A[i] == B[i]:
        continue
    if A[i] > B[i]:
        b_tmp += A[i]-B[i]
    else:
        if (B[i]-A[i]) % 2 == 0:
            a_tmp += (B[i]-A[i]) // 2
        else:
            a_tmp += (B[i]-A[i] // 2)+1
            b_tmp += 1
if (cnt-a_tmp)*2 == cnt-b_tmp:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin python3
# -*- coding: utf-8 -*-

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

    ret = 'Yes'
    for i in range(N-1,-1,-1):
        if A[i]<=B[i]:
            continue
        else:
            ret = 'No'
    print(ret)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    plus2_cnt = 0
    neg_cnt = 0
    for i in range(N):
        diff = b[i] - a[i]
        if diff >= 0:
            plus2_cnt += diff // 2
        else:
            neg_cnt += 1
    
    if plus2_cnt >= neg_cnt:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

    plus2_cnt = 0
    neg_cnt = 0
    neg_amt = 0
    for i in range(N):
        diff = b[i] - a[i]
        if diff >= 0:
            plus2_cnt += diff // 2
        else:
            neg_cnt += 1
            neg_amt += abs(diff)
    
    if neg_amt <= plus2_cnt <= neg_amt + neg_cnt:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
def do():
    n = int(input())
    data = list(map(int, input().split()))
    datb = list(map(int, input().split()))
    sa = sum(data)
    sb = sum(datb)
    if sb < sa:
        print("No")
        return 0
    diffcnt = sb - sa
    cnt1 = 0
    cnt2 = 0
    import math
    for i in range(n):
        if data[i] > datb[i]:
            cnt1 += data[i] - datb[i]
        if data[i] < datb[i]:
            cnt2 += math.ceil((datb[i] - data[i]) / 2)
    if cnt1 <= diffcnt:
        print("Yes")
    else:
        print("No")
    #print(diffcnt, cnt1, cnt2)


do()

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

if all(a[i] <= b[i] for i in range(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()))
a.sort()
b.sort()
lia = []
lib = []

for i in range(n):
    if not(a[i] == b[i] or a[i] +1 == b[i]):
        lia.append(a[i])
        lib.append(b[i])

sum_a = sum(lia)
sum_b = sum(lib)

if sum_a > sum_b or (sum_b-sum_a)%2 !=0:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(b)-sum(a)
cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt1 += a[i]-b[i]
    if a[i] < b[i]:
        cnt2 += (b[i]-a[i]-1)//2+1
if cnt1 > num or cnt2 > num:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(b)-sum(a)
cnt1 = 0
cnt2 = 0
for i in range(N):
    if a[i] > b[i]:
        cnt1 += a[i]-b[i]
    if a[i] < b[i]:
        cnt2 += math.ceil((b[i]-a[i])/2)
if cnt1 > num or cnt2 > num:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(b)-sum(a)
cnt = 0
for i in range(N):
    if a[i] > b[i]:
        cnt += a[i]-b[i]
    if a[i] < b[i]:
        cnt += math.ceil((b[i]-a[i])/2)
if cnt > num:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(b)-sum(a)
cnt = 0
for i in range(N):
    if a[i] > b[i]:
        cnt += a[i]-b[i]
    if a[i] < b[i]:
        cnt += math.ceil((b[i]-a[i])/2)
print(cnt,num)
if cnt > num:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
num = sum(a)-sum(b)
cnt = 0
for i in range(N):
    if a[i] > b[i]:
        cnt += a[i]-b[i]
    if a[i] < b[i]:
        cnt += math.ceil((b[i]-a[i])/2)
if cnt > num:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

N = i()
a = l()
b = l()
if sum(a) >= sum(b):
    print('No')
    exit()
parity = 0
for i in range(N):
    parity = parity^abs(a[i]-b[i])%2
num = sum(a)-sum(b)
if num%2 == parity:
    print('Yes')
else:
    print('No')