qyliang/CodeNanoFix huggingface dataset:
Buggy code:
# B - Two Arrays
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
sum_a=sum(a)
sum_b=sum(b)
a_cnt,b_cnt=0,0

for aa,bb in zip(a,b):
    if aa>bb:
        a_cnt+=aa-bb
    elif aa<bb:
        b_cnt+=((bb-aa)//2)*2

print('Yes') if a_cnt<=b_cnt else print('No')

Fixed code:
# B - Two Arrays
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
sum_a=sum(a)
sum_b=sum(b)

a_cnt,b_cnt=0,0

for aa,bb in zip(a,b):
    if aa>bb:
        a_cnt+=aa-bb
    elif aa<bb:
        b_cnt+=(bb-aa)//2

print('Yes') if a_cnt<=b_cnt else print('No')
Buggy code:
from sys import stdin
from math import ceil
def main():
	readline=stdin.readline
	N=int(readline())
	a=list(map(int,readline().split()))
	b=list(map(int,readline().split()))
	a.sort()
	b.sort()
	a_count=0
	s=sum(b)-sum(a)

	for i in range(N):
		if a[i]<b[i]:
			a_count+=ceil((b[i]-a[i])/2)

	if a_count<=s:
		print("Yes")
	else:
		print("No")

if __name__=="__main__":
	main()

Fixed code:
from sys import stdin
from math import ceil
def main():
	readline=stdin.readline
	N=int(readline())
	a=list(map(int,readline().split()))
	b=list(map(int,readline().split()))
	a_count=0
	s=sum(b)-sum(a)

	for i in range(N):
		if a[i]<b[i]:
			a_count+=ceil((b[i]-a[i])/2)

	if a_count<=s:
		print("Yes")
	else:
		print("No")

if __name__=="__main__":
	main()
Buggy code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = sum(b)-sum(a)
res=0
for i in range(n):
    res += (b[i]-a[i]+1)//2
if res > t:
  print('No')
else:
  print('Yes')

Fixed code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t = sum(b)-sum(a)
res=0
for i in range(n):
  if b[i]>a[i]:
    res += (b[i]-a[i]+1)//2
if res > t:
  print('No')
else:
  print('Yes')
Buggy code:
import math

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

total = sum(A) - sum(B)
cnt1, cnt2 = 0,0
for i in range(n):
    if A[i] < B[i]:
        cnt1 += math.ceil(A[i] - B[i] / 2)
    else:
        cnt2 += (A[i] - B[i])
if max(cnt1, cnt2) <= total:
    print('Yes')
else:
    print('No')

Fixed code:
import math

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
total = sum(B) - sum(A)
cnt1, cnt2 = 0,0

for i in range(n):
    if A[i] > B[i]:
        cnt1 += A[i] - B[i]
    elif A[i] < B[i]:
        cnt2 += math.ceil((B[i]-A[i])/2)

if max(cnt1, cnt2) <= total:
    print('Yes')
else:
    print('No')
Buggy 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])//2
if a<b:
  print('No')
else:
  print('Yes')

Fixed code:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
b = 0
for i in range(N):
    if A[i]>B[i]:b+=(A[i]-B[i])
for i in range(N):
    if A[i]<B[i]:
        c = (B[i]-A[i])//2
        if c<=b:b-=c
        elif c>b:b=0
print("No" if b else "Yes")
Buggy code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l1=LI()
  l2=LI()

  sm1=sum(l1)
  sm2=sum(l2)

  nm=sm2-sm1
  if nm<0:
    return 'No'

  nm1=0
  for i in range(n):
    a=l1[i]
    b=l2[i]

    if a<b:
      _a=(b-a+1)//2
      l1[i]+=_a*2
      nm1+=_a

nm2=0
  for i in range(n):
    a=l1[i]
    b=l2[i]

    if a>b:
      _a=a-b
      nm2+=_a

  # print(nm,nm2)
  if nm<max(nm1,nm2):
    return 'No'

  return 'Yes'

# main()
print(main())


Fixed code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l1=LI()
  l2=LI()

  sm1=sum(l1)
  sm2=sum(l2)

  nm=sm2-sm1
  if nm<0:
    return 'No'

  nm1=0
  for i in range(n):
    a=l1[i]
    b=l2[i]

    if a<b:
      _a=(b-a+1)//2
      l1[i]+=_a*2
      nm1+=_a

  nm2=0
  for i in range(n):
    a=l1[i]
    b=l2[i]

    if a>b:
      _a=a-b
      nm2+=_a

  # print(nm,nm2)
  if nm<max(nm1,nm2):
    return 'No'

  return 'Yes'

# main()
print(main())
Buggy code:
import math
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
    if a < b:
        cnt += math.ceil((b - a) / 2)

if 0 <= cnt:
    print("Yes")
else:
    print("No")

Fixed code:
import math
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
    if a < b:
        cnt += (b - a) // 2

if cnt < 0:
    print("No")
else:
    print("Yes")
Buggy code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))
b = list(map(int,stdin.readline().rstrip().split()))
A = sum(A);B = sum(B)
count = 0
total = B-A
for i,j in zip(a,b):
    if i < j:
        count += (j-i+1)//2
    else:
        count += i-j
if count <= total:
    print("Yes")
else:
    print("No")

Fixed code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int,stdin.readline().rstrip().split()))
b = list(map(int,stdin.readline().rstrip().split()))
A = sum(a);B = sum(b)
count_1 = 0
count_2 = 0
total = B-A
for i,j in zip(a,b):
    if i < j:
        count_1 += (j-i+1)//2
    else:
        count_2 += i-j
count = max(count_1,count_2)
if count <= total:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(a)>sum(b):
  print("No")
else:
  ca = 0
  cb = 0
  for i in range(n):
    if a[i]>b[i]:
      cb += a[i]-b[i]
    else:
      ca += (b[i]-a[i]+1)//2
      cb += (b[i]-a[i])%2
  if ca == cb:
    print("Yes")
  else:
    print("No")

Fixed code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
if sum(a)>sum(b):
  print("No")
else:
  ca = 0
  cb = 0
  for i in range(n):
    if a[i]>b[i]:
      cb += a[i]-b[i]
    else:
      ca += (b[i]-a[i]+1)//2
      cb += (b[i]-a[i])%2
  x = sum(b)-sum(a)
  if x >= ca and x >= cb and (x-ca)*2 == x-cb:
    print("Yes")
  else:
    print("No")
Buggy 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])

print (c)

mi = 0
pl = 0

for i in c:
    if i < 0:
        mi -= i // 2
    else:
        pl += i

if mi < pl:
    print ("No")
else:
    print ("Yes")

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

#print (c)

mi = 0
pl = 0

for i in c:
    if i < 0:
        mi += abs(i) // 2
    else:
        pl += i

if mi < pl:
    print ("No")
else:
    print ("Yes")
Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.sort()
b.sort()
cnt=0
for i in range(n):
    if a[i]<b[i]:
        cnt+=(b[i]-a[i])//2
    else:
        cnt-=a[i]-b[i]

if cnt<0:
    print("No")
else:
    print("Yes")


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

cnt=0
for i in range(n):
    if a[i]<b[i]:
        cnt+=(b[i]-a[i])//2
    else:
        cnt-=a[i]-b[i]

if cnt<0:
    print("No")
else:
    print("Yes")
Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a.sort()
b.sort()
cnt1=0
cnt2=0
ma=sum(b)-sum(a)
if ma<0:
    print("No")
    exit()

for i in range(n):
    if b[i]<=a[i]:
        cnt1+=a[i]-b[i]
    else:
        if (b[i]-a[i])%2==0:
            cnt2+=(b[i]-a[i]+1)//2
        else:
            cnt2+=(b[i]-a[i]+1)//2
            cnt1+=1
#print(cnt1,cnt2)
if cnt1>ma or cnt2>ma:
    print("No")
else:
    print("Yes" if (ma-cnt2)*2==ma-cnt1 else "No")


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

cnt1=0
cnt2=0
ma=sum(b)-sum(a)
if ma<0:
    print("No")
    exit()

for i in range(n):
    if b[i]<=a[i]:
        cnt1+=a[i]-b[i]
    else:
        if (b[i]-a[i])%2==0:
            cnt2+=(b[i]-a[i]+1)//2
        else:
            cnt2+=(b[i]-a[i]+1)//2
            cnt1+=1
#print(cnt1,cnt2)
if cnt1>ma or cnt2>ma:
    print("No")
else:
    print("Yes" if (ma-cnt2)*2==ma-cnt1 else "No")
Buggy code:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
x=[0,0]
for i in range(n):
    if a[i]>b[i]:
        x[0]+=2
    elif a[i]<b[i]:
        x[1]+=1
print(["Yes","No"][x[0]<=0])

Fixed code:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
x=0
for i in range(n):
    if a[i]>b[i]:
        x+=a[i]-b[i]
    elif a[i]<b[i]:
        x-=(b[i]-a[i])//2
print(["Yes","No"][x>0])
Buggy code:
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit+=(lb[i]-la[i])//2
if limit*2<must:
  print("No")
else:
  print("Yes")

Fixed code:
n=int(input())
la=list(map(int,input().split()))
lb=list(map(int,input().split()))
limit=0
must=0
for i in range(n):
  if la[i]>lb[i]:
    must+=la[i]-lb[i]
  elif la[i]==lb[i]:
    pass
  else:
    limit+=(lb[i]-la[i])//2
if limit<must:
  print("No")
else:
  print("Yes")
Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
a=sorted(a)
b=sorted(b)
count=0
for i in range(n):
    if a[i]<=b[i]:
        s=(b[i]-a[i])//2
        count+=s
    else:
        s=a[i]-b[i]
        count-=s
if count>=0:
    print("Yes")
else:
    print("No")

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

count=0
for i in range(n):
    if a[i]<=b[i]:
        s=(b[i]-a[i])//2
        count+=s
    else:
        s=a[i]-b[i]
        count-=s
if count>=0:
    print("Yes")
else:
    print("No")
Buggy 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
  else:
    cnt-=(b-a)//2
print('Yes' if cnt<=0 else 'NO')

Fixed 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
  else:
    cnt-=(b-a)//2
print('Yes' if cnt<=0 else 'No')
Buggy code:
# APC001B - Two Arrays
def main():
    N, *AB = map(int, open(0).read().split())
    A, B = AB[:N], AB[N:]
    cnt = 0
    for a, b in zip(A, B):
        if a > b:
            cnt += (b - a) // 2
        else:
            cnt -= a - b
    print("Yes" if cnt <= 0 else "No")


if __name__ == "__main__":
    main()

Fixed code:
# APC001B - Two Arrays
def main():
    N, *AB = map(int, open(0).read().split())
    A, B = AB[:N], AB[N:]
    cnt = 0
    for a, b in zip(A, B):
        if a > b:
            cnt += a - b
        else:
            cnt -= (b - a) // 2
    print("Yes" if cnt <= 0 else "No")


if __name__ == "__main__":
    main()
Buggy code:
N,*A=map(int,open(0).read().split());print("YNeos"[sum((b-a+1)//2for a,b in zip(A[:N],A[N:])if b>a)<(sum(A[:N])-sum(A[N:]))::2])

Fixed code:
N,*A=map(int,open(0).read().split());print("YNeos"[sum((b-a+1)//2for a,b in zip(A[:N],A[N:])if b>a)>sum(A[N:])-sum(A[:N])::2])
Buggy code:
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
A=sorted(A)
B=sorted(B)
x=sum(B)-sum(A)
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 x<cnt:
  print('No')
else:
  print('Yes')

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

if sum(A)>sum(B):
  print("No")
else:
  cnt=sum(B)-sum(A)
  for i in range(N):
    if A[i]<B[i]:
      cnt-=(B[i]-A[i])//2+(B[i]-A[i])%2
  print("Yes" if cnt>=0 else "No")
Buggy code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if sum(B)-sum(A)>count else "No")

Fixed code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for a,b in zip(A,B):
   if a>b:count -=a-b
   elif b>a:count +=(b-a)//2

print("Yes" if count>=0 else "No")
Buggy code:
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

ab=0
ba=0
d=sum(b)-sum(a)
for i in range(N):
    abtmp=max(b[i]-a[i],0)
    ab+=abtmp//2
    batmp=max(a[i]-b[i],0)
    ba+=batmp

if ab<=ba:
    ans="Yes"
else:
    ans="No"

if sum(a)>sum(b):
    ans="No"
print(ans)

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

ab=0
ba=0
if sum(a)>sum(b):
    ans="No"
else:
    for i in range(N):
        abtmp=max(a[i]-b[i],0)
        ab+=abtmp
        batmp=max(b[i]-a[i],0)
        ba+=batmp//2
    if ab>ba:
        ans="No"
    else:
        ans="Yes"

print(ans)
Buggy code:
import math

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

c = 0
d = 0
if sum(a) > sum(b):
    print('No')
else:
    for i in range(N):
        c += max(0, a[i]-b[i])
        d += max(0, math.ceil((b[i]-a[i])/2))
    if c > d:
        print('No')
    else:
        print('Yes')


Fixed code:
import math

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

c = 0
d = 0
if sum(a) > sum(b):
    print('No')
else:
    for i in range(N):
        c += max(0, a[i]-b[i])
        d += max(0, (b[i]-a[i])//2)
    if c > d:
        print('No')
    else:
        print('Yes')
Buggy code:
def solve(n, a, b):
    total = sum(b) - sum(a)
    num = 0
    for i in range(n):
        if a[i] > b[i]:
            num += a[i] - b[i]
        elif a[i] < b[i]:
            num += (b[i] - a[i] + 1) // 2
    return "Yes" if total > num else "No"

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

Fixed code:
def solve(n, a, b):
    total = sum(b) - sum(a)
    num1, num2 = 0, 0
    for i in range(n):
        if a[i] > b[i]:
            num1 += a[i] - b[i]
        elif a[i] < b[i]:
            num2 += (b[i] - a[i] + 1) // 2
    return "Yes" if (total >= num1) and (total >= num2) else "No"

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(solve(n, a, b))
Buggy code:
# APC001B - Two Arrays
def main():
    n = int(input())
    arr = [tuple(map(int, input().rstrip().split())) for _ in range(2)]
    cnt = 0
    for a, b in zip(arr[0], arr[1]):
        if a > b:
            cnt += a - b
        else:
            cnt -= (b - a) // 2
    print("Yes" if cnt >= 0 else "No")


if __name__ == "__main__":
    main()

Fixed code:
# APC001B - Two Arrays
def main():
    n = int(input())
    arr = [tuple(map(int, input().rstrip().split())) for _ in range(2)]
    cnt = 0
    for a, b in zip(arr[0], arr[1]):
        if a > b:
            cnt += a - b
        else:
            cnt -= (b - a) // 2
    print("Yes" if cnt <= 0 else "No")


if __name__ == "__main__":
    main()
Buggy code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
chance = sum(b)-sum(a)
for i in range(n):
    if a[i]<b[i]:
        chance -= (b[i]-a[i])//2

if chance < 0:
    print("No")
else:
    print("Yes")

Fixed code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
chance = sum(b)-sum(a)
for i in range(n):
    if a[i]<b[i]:
        chance -= (b[i]-a[i]+1)//2

if chance < 0:
    print("No")
else:
    print("Yes")
Buggy code:
x = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s= 0
t = 0
for i,j in zip(a,b):
    if i > j :
        s+=i-j
    if j > i :
        t+=(j - i)//2
if s==t:
    print("Yes")
else:
    print("No")


Fixed code:
x = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
s= 0
t = 0
for i,j in zip(a,b):
    if i > j :
        s+=i-j
    if j > i :
        t+=(j - i)//2+(j-i)%2
        s+= (j-i)%2
if s<=t:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

c = max(0, sum(B) - sum(A))
ca = 0
cb = 0

for a, b in zip(A, B):
    if a < b:
        ca += (b - a + 1) // 2
        cb += (b - a) % 2
    if a > b:
        cb += a - b

if c < max(ca + cb):
    print('No')
else:
    print('Yes')


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

cnt = sum(B)-sum(A)
ca = 0
cb = 0

for a,b in zip(A,B):
    if a > b:
        cb += a-b
    if b > a:
        if (b-a) % 2 == 0:
            ca += (b-a)//2
        else:
            ca += -(-(b-a)//2)
            cb += 1

if cnt >= max(ca,cb):
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
  if (lip[i]>0):
    sb+=lip[i]
sa2 = 0
for i in range(N):
  if (lip[i]<0):
    sa2=(-lip[i])//2
sas-=sb*2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (sa2>=sb):
    print ("Yes")
  else:
    print ("No")


Fixed code:
N = int(input())
lia=[int(it) for it in input().split()]
lib=[int(it) for it in input().split()]
lip=[lia[i]-lib[i] for i in range(N)]
sb = 0
for i in range(N):
  if (lip[i]>0):
    sb+=lip[i]
sa2 = 0
for i in range(N):
  if (lip[i]<0):
    sa2+=(-lip[i])//2
x = sum(lib)-sum(lia)
if (x<0):
  print ("No")
else:
  if (sa2>=sb):
    print ("Yes")
  else:
    print ("No")
Buggy code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a_b = 0
b_a = 0
for i in range(N):
    if A[i] > B[i]:
        a_b += A[i] - B[i]
        
    else
        b_a += (B[i] - A[i]) // 2

if a_b <= b_a
    print('Yes')
else:
    print('No')
        



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

a_b = 0
b_a = 0
for i in range(N):
    if A[i] > B[i]:
        a_b += A[i] - B[i]
        
    else:
        b_a += (B[i] - A[i]) // 2

if a_b <= b_a:
    print('Yes')
else:
    print('No')
Buggy 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")


Fixed 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 + 1) // 2
tmp = sum(b_list) - sum(a_list)
if a_cnt <= tmp and b_cnt <= tmp:
    print("Yes")
else:
    print("No")
Buggy 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')
        

Fixed 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])//2)*2
    else:
        N = N + a[i]-b[i]
       
P2 = P-2*N
        
if P2>=0:
    print('Yes')
else:
    print('No')
Buggy 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")

Fixed 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+=a[i]-b[i]
    else:
        k=b[i]-a[i]
        if k%2==1:
            d+=1
            c+=(k+1)//2
        else:
            c+=k//2
print("Yes" if c>=d else"No")
Buggy 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)

Fixed 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 or ca > M:
    ans = 'No'
print(ans)
Buggy 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")

Fixed code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = 0
for i in range(n):
    if a[i] < b[i]:
        x += (b[i] - a[i])//2
    else:
        x -= (a[i] - b[i])
if x < 0:
    print("No")
else:
    print("Yes")
Buggy code:
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
s,t=0,0
for i,j in zip(a,b):
    if i>j:t+=(i-j)//2
    else:s+=j-i
if s>=t:print('Yes')
else:print('No')

Fixed code:
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
s,t=0,0
for i,j in zip(a,b):
    if i>j:t+=i-j
    else:s+=(j-i)//2
if s>=t:print('Yes')
else:print('No')
Buggy code:
    def main():
        n = int(input())
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
     
     
        Flag = False
        biga = 0
        lessa = 0
        for i in range(3):
            if a[i] > b[i]:
                biga += a[i] - b[i]
            else:
     
                lessa += b[i] - a[i]
     
        tmp = lessa -(biga*2)
     
        if tmp >=0:
            print("Yes")
        else:
            print("No")
     
    if __name__ == "__main__":
        main()

Fixed code:

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


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

    tmp = lessa - biga

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

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

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

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

print("Yes" if 0<=c else "No")