qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N, M, K = map(int, input().split())

colored = 0
flag = 0

for i in range(N + 1):
    for j in range(M + 1):
        colored = i * M + j * N - i * j
        if colored == K:
            flag = 1
            break
        else:
            pass

if flag == 0:
    print("No")
else:
    print("Yes")


Fixed code:
N,M,K=map(int,input().split())
flag=0
for i in range(N+1):
    for j in range(M+1):
        if i*(M-j)+(N-i)*j == K:
            flag=1
            print("Yes")
            break
    if flag==1:
        break
else:
    print("No")
Buggy code:
n,m,k=map(int,input().split())
ans=['Yes','No']
i=1
for a in range(n+1):
    for b in range(m+1):
        if k==a*m+b*n-a*b:
            i=0
print(ans[i])

Fixed code:
n,m,k=map(int,input().split())
ans=['Yes','No']
i=1
for a in range(n+1):
    for b in range(m+1):
        if k==a*m+b*n-2*a*b:
            i=0
print(ans[i])
Buggy code:
n,m,k=map(int,input().split())
s=set()
for i in range(n+1):
  for j in range(m+1):
    s.add(i*j)
if k in s:
  print("Yes")
else:
  print("No")


Fixed code:
n,m,k=map(int,input().split())
s=set()
for i in range(n+1):
  for j in range(m+1):
    s.add(i*(m-j)+(n-i)*j)
if k in s:
  print("Yes")
else:
  print("No")
Buggy code:
n,m,k=map(int,input().split())
t=False
for i in range(1,n+1):
    for j in range(1,m+1):
        if (n-i)*j+(m-j)*i==k:
            t=True
            print(i,j)
            break
print("Yes" if t else "No")

Fixed code:
n,m,k=map(int,input().split())
f=False
for i in range(n+1):
  for j in range(m+1):
    if i*(m-j)+j*(n-i)==k:
      f=True
if f:
  print('Yes')
else:
  print('No')
Buggy code:
n,m,k = map(int,input().split())
ans = 'No'
for i in range(m+1):
  for j in range(n+1):
    if i*n + j*m - i*j == k:
       ans = 'Yes'
print(ans)


Fixed code:
n,m,k = (int(i) for i in input().split())
ans = 'No'
for i in range(n+1):
  for j in range(m+1):
    if i*(m-j)+j*(n-i) == k:
      ans = 'Yes'
      break
print(ans)
Buggy code:
N, M, K = map(int, input().split())

for n in range(N + 1):
    for m in range(M + 1):
        if n * N + m * M - max(n, m) * 2 == K:
            print('Yes')
            exit()

print('No')

Fixed code:
N,M,K = map(int,input().split())

for n in range(N+1):
    for m in range(M+1):
        cnt = n*M + m*N - n*m*2
        if cnt == K:
            print('Yes')
            exit()
print('No')
Buggy code:
N,M,K = [int(i) for i in input().split()]

for i in range(0,N+1):
    for j in range(0,M+1):
        ans = i*M+j*N-i*j*2
        print(i,j,ans)
        if ans==K:
            print("Yes")
            exit()

print("No")

Fixed code:
P = input().split()
N = int(P[0])
M = int(P[1])
K = int(P[2])


for i in range(0,N+1):
    for j in range(0,M+1):
        if((M - j) * i + (N - i) * j == K):
            print("Yes")
            exit()
print("No")
Buggy code:
n,m,k = map(int,input().split())

for i in range(n+1):
    for j in range(m+1):
        a = n*j + m*i - i*j
        if a == k:
            print("Yes")
            exit()
print("No")

Fixed code:
n,m,k=map(int,input().split())
a='No'
for i in range(n+1):
  for j in range(m+1):
    if j*(n-i)+i*(m-j)==k:
      a='Yes'
      break
print(a)
Buggy code:
N, M, K = map(int, input().split())
ans = 0
for i in range(N):
    for j in range(M):
        if K == N * j + M * i - i * j:
            ans = 1
            break
if ans == 0:
    print("No")
else:
    print("Yes")


Fixed code:
N, M, K = map(int, input().split())
ans = -1
for i in range(N + 1):
    for j in range(M + 1):
        if K == M * i + N * j - i * j * 2:
            ans = 1
            break
if ans == 1:
    print("Yes")
else:
    print("No")
Buggy code:
n,m,k=map(int,input().split())
flag=False
if n==1 or m==1:
  print('Yes')
  else:
  for i in range(n):
    for j in range(m):
      if i*j + (n-i)*(m-j) + k == n*m:
        flag=True
  if flag:
    print('Yes')
  else:
    print('No')

Fixed code:
n,m,k = map(int,input().split())

flag = False

for i in range(0,n+1):
    for j in range(0,m+1):
        black = i*(m-j) + j*(n-i)

        if black == k:
            flag = True


if flag:
    print("Yes")
else:
    print("No")
Buggy code:
n,m,k = map(int,input().split())
for a in range(n+1):
  for b in range(m+1):
    if k = a*m+b*n-2*a*b:
      print('Yes')
      exit()
print('No')

Fixed code:
n, m, k = map(int, input().split())
for a in range(n+1):
    for b in range(m+1):
        if a*b + (n-a)*(m-b) == k:
            print("Yes")
            exit()
print("No")
Buggy code:
N, M, K = map(int, input().split())


for a in range(N+1):
    for b in range(M+1):
        if a * (N-1) + b * (M-1) == K:
            print('Yes')
            exit()


print('No')

Fixed code:
N, M, K = map(int, input().split())


for a in range(N+1):
    for b in range(M+1):
        if b * (N-a) + a * (M-b) == K:
            print('Yes')
            exit()


print('No')
Buggy code:
N,M,K = [int(i) for i in input().split()]

ans = 'No'
for j in range(N+1):
  for k in range(M+1):
    if j * (M - 2) + k * (N - 2) == K:
      ans = 'Yes'
print(ans)

Fixed code:
N,M,K = [int(i) for i in input().split()]

ans = 'No'
for j in range(N+1):
  for k in range(M+1):
    if j * (M - k) + k * (N - j) == K:
      ans = 'Yes'
print(ans)
Buggy code:
n, m, k = map(int, input().split())

for i in range(n + 1):
    for j in range(m + 1):
        if i * (m - j) + j * (n - i) == k:
            print('Yes')
            break
else:
    print('No')


Fixed code:
n,m,k=map(int,input().split())
end = 0
for i in range(0, n+1):
    for j in range(0, m+1):
        if m*i+n*j-2*(i*j)==k:
            print("Yes")
            end = 1
            break
    if end == 1:
        break
else:
    print("No")
Buggy code:
n, m, k = list(map(int, input().split()))
for i in range(m+1):
    for j in range(n+1):
        if (m * i) + (n * j) - i * j == k:
            print("Yes")
            exit()
print("No")

Fixed code:
n,m,k = list(map(int,input().split()))
ans = 'No'
for i in range(n+1):
    for j in range(m+1):
        if i * m + j * n - 2 * i * j == k:
            ans = 'Yes'

print(ans)
Buggy code:
n,m,k = map(int,input().split())
s = []
for i in range(n//2+1):
    for j in range(m//2+1):
        s.append(i*j)
        s.append(n*m-i*j)
if k in s:
    print("Yes")
else:
    print("No")

Fixed code:
n,m,k = map(int,input().split())
s = []
for i in range(n+1):
    for j in range(m+1):
        hoge = (i*j+(n-i)*(m-j))
        s.append(hoge)
        s.append(n*m-hoge)
if k in s:
    print("Yes")
else:
    print("No")
Buggy code:
N, M, K = map(int, input().split())

flag = False

for i in range(N):
    if flag:
        break
    for j in range(M):
        if flag:
            break
        if M*i+N*j-i*j==K:
            flag = True

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


Fixed code:
N, M, K = map(int, input().split())

flag = False

for i in range(N+1):
    for j in range(M+1):
        if flag:
            break
        if M*i+N*j-i*j*2==K:
            flag = True
    if flag:
        break

if flag:
    print("Yes")
else:
    print("No")
Buggy code:
n,m,k=map(int,input().split())
for i in range(n):
  for j in range(m):
    if i*m+j*n-i==k:
      print('Yes')
      quit()
print('No')

Fixed code:
n,m,k=map(int,input().split())
for i in range(n+1):
	for j in range(m+1):
		if i*m+j*n-2*i*j==k:
			print("Yes")
			quit()
print("No")
Buggy code:
N,M,K = map(int,input().strip().split())
def judge(N,M,K):
    if K > N * M or K < 0:
        return False
    for n in range(1, N + 1):
        for m in range(1, M + 1):
            if n * M + m * N - m * n == K:
                return True
    return False
if judge(N, M, K):
    print("Yes")
else:
    print("No")

Fixed code:
N,M,K = map(int,input().strip().split())
def judge(N,M,K):
    if K > N * M or K < 0:
        return False
    for n in range(0, N + 1):
        for m in range(0, M + 1):
            if n * M + m * N - 2*m * n == K:
                return True
    return False
if judge(N, M, K):
    print("Yes")
else:
    print("No")
Buggy code:
n,m,k = map(int,input().split())
flg = False
for i in range(n + 1):
    for j in range(m + 1):
        if i * (n - j) + j * (m - i) == k:
            flg = True
            break
        else:
            pass
print(flg)
if flg:
    print("Yes")
else:
    print("No")

Fixed code:
n,m,k = map(int,input().split())
flg = False
for i in range(n + 1):
    for j in range(m + 1):
        if m*i + n*j - i*j*2 == k:
            flg=True
if flg:
    print('Yes')
else:
    print("No")
Buggy code:
N,M,K= (int(i) for i in input().split())  
ok=0

for j in range(M):
 for i in range(N):
  if j*N+i*M-i*j==K :

       ok=1

if ok==0:
 print("No")
else:
 print("Yes")

Fixed code:
N,M,K= (int(i) for i in input().split())  
ok=0

for j in range(M+1):
 for i in range(N+1):
  if j*N+i*M-2*i*j==K :

       ok=1

if ok==0:
 print("No")
else:
 print("Yes")
Buggy code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n, m, k = read_int_list()

    if n <= m:
        for i in range(n + 1):
            if k == (n * n - i * n) + (i * (m - n)):
                print('Yes')

    if n > m:
        for i in range(m + 1):
            if k == (m * m - i * m) + (i * (n - m)):
                print('Yes')

    else:
        print('No')


main()


Fixed code:
import sys
import socket

hostname = socket.gethostname()

if hostname == 'F451C':
    sys.stdin = open('b1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n, m, k = read_int_list()

    for i in range(m + 1):
        for j in range(n + 1):
            if k == (m - i) * j + (n - j) * i:
                print('Yes')
                return

    print('No')


main()
Buggy code:
N,M,K=map(int,input().split())
isYes=False
for n in range(N+1):
    for m in range(M+1):
        if(N*m+M*n-2*n*m==K):
            print('Yes')
            isYes=True
if(not isYes):
    print('No')

Fixed code:
N,M,K=map(int,input().split())
isYes=False
for n in range(N+1):
    for m in range(M+1):
        if(N*m+M*n-2*n*m==K and not isYes):
            print('Yes')
            isYes=True
if(not isYes):
    print('No')
Buggy code:
n, m, k = map(int, input().split())
f = False
for i in range(n+1):
    for j in range(m+1):
        if i * m + j * n - i * j == k:
            f = True
if f:
    print("Yes")
else:
    print("No")


Fixed code:
n,m,c=map(int,input().split())
f=False
for i in range(n+1):
	for j in range(m+1):
		if(i*(m-j)+j*(n-i)==c):
			f=True
			break
print("Yes" if f else "No")
Buggy code:
def solution():
	n,m,k = map(int,input().split(' '))
	for i in range(0,m):
		for j in range(0,n):
			if i*n+j*m-i*j == k:
				return True

	return False



print('Yes' if solution() else 'No')

Fixed code:
def solution():
	n,m,k = map(int,input().split(' '))
	for i in range(0,m+1):
		for j in range(0,n+1):
			if i*n+j*m-2*i*j == k:
				return True

	return False



print('Yes' if solution() else 'No')
Buggy code:
N, M, K = map(int, input().split())

ans = "No"

for i in range(M+1):
    for j in range(N+1):
        if N*i+(M-i)*j == K:
            ans = "Yes"
            break
    if ans == "Yes":
        break

print(ans)


Fixed code:
N, M, K = map(int, input().split())

ans = "No"

for i in range(N+1):
    for j in range(M+1):
        b = i * M
        b -= i*j
        b += (N-i)*j
        if b == K:
            ans = "Yes"

print(ans)
Buggy code:
import numpy as np

n, m, k = map(int, input().split(" "))

flag = 0
for i in range(n + 1):
    for j in range(m + 1): 
        print(i * n - i * j + j * m - i * j)
        if(i * n - i * j + j * m - i * j == k):
            flag = 1

if(flag == 1):
    print("Yes")
else:
    print("No")

Fixed code:
import numpy as np

n, m, k = map(int, input().split(" "))

flag = 0
for i in range(n + 1):
    for j in range(m + 1):
        if(i * m - i * j + j * n - i * j == k):
            flag = 1
        if(n * m - (i * m - i * j + j * n - i * j) == k):
            flag = 1

if(flag == 1):
    print("Yes")
else:
    print("No")
Buggy code:
N, M, K = map(int, input().split())

flag = False
for n in range(M + 1):
    for m in range(N + 1):
        print(n * N + m * (M - n * 2), n, m)
        # if n * N + m * (M - n) == K:
        if n * N + m * (M - n * 2) == K:
            flag = True

if flag:
    print('Yes')
else:
    print('No')

Fixed code:
N, M, K = map(int, input().split())
 
flag = False
for n in range(M + 1):
    for m in range(N + 1):
        if n * N + m * (M - n * 2) == K:
            flag = True
 
if flag:
    print('Yes')
else:
    print('No')
Buggy code:
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if K == N*i + (M*(j-i)):
            print(i, j)
            exit()

print("No")


Fixed code:
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if N*j + M*i - 2*i*j == K:
            print('Yes')
            exit()

print('No')
Buggy code:
yes = "Yes"
no = "No"

N, M, K = map(int, input().split())

ans = no
for y in range(N+1):
    for x in range(M+1):
        if N*M - (N-y) * (M-x) == K:
            ans = yes
print(ans)


Fixed code:
yes = "Yes"
no = "No"

N, M, K = map(int, input().split())

ans = no
for y in range(N+1):
    for x in range(M+1):
        if N*M - (N-y) * (M-x) - x*y == K:
            ans = yes
            break
print(ans)
Buggy code:
from math import *


def main():
        n, m, k = map(int, input().split())
        for i in range(n+1):
                for j in range(m+1):
                        if i * m + j * n - i*j == k:
                                print('Yes')
                                return
        print('No')
        

if __name__ == '__main__':
        main()


Fixed code:
from math import *


def main():
        n, m, k = map(int, input().split())
        for i in range(n+1):
                for j in range(m+1):
                        if i * m + j * n - 2*i*j == k:
                                print('Yes')
                                return
        print('No')
        

if __name__ == '__main__':
        main()
Buggy code:
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if K == N*i + (N-i) * j:
            print(i, j)
            print("Yes")
            exit()

print("No")


Fixed code:
N, M, K = map(int, input().strip().split(" "))

for i in range(N+1):
    for j in range(M+1):
        if N*j + M*i -i*j*2 == K:
            print("Yes")
            exit(0)

print("No")
exit(0)
Buggy code:
N, M, K = map(int, input().split())

black = 0
for n in range(N+1):
    black += M*n
    for m in range(M+1):
        black -= n*m
        black += (N-n)*m
        if black==K:
            print('Yes')
            exit()

print('No')

Fixed code:
N ,M ,K = map(int, input().split())

for n in range(N+1):
    k = n * M
    for m in range(M+1):
        kk = k + ((N - n) - n) * m
        if kk == K:
            print('Yes')
            exit(0)
print('No')
Buggy code:
import sys
N, M, K = map(int, input().split())

for i in range(N+1):
    for j in range(M+1):
        if M*i + N*j - i*j == K:
            print('Yes')
            sys.exit()
print('No')

Fixed code:
import sys
N,M,K=map(int,input().split())
for i in range(N+1):
  for j in range(M+1):
    ans=i*M+j*N-2*i*j
    if ans==K:
      print("Yes")
      sys.exit()
print("No")
Buggy code:
n,m,k=map(int,input().split())
if n%k==0 or m%k==0:
    print("Yes")
    exit()
for i in range(1,n+1):
    for j in range(1,m+1):
        if m*i+n*j-2*(i*j)==k:
            print("Yes")
            exit()
print("No")   

Fixed code:
n, m, k = map(int, input().split())

for i in range(1+n):
    for j in range(1+m):
        if i*m + j*n - 2*i*j == k:
            print('Yes')
            exit(0)
print('No')
Buggy code:
n,m,k=map(int,input().split())
for i in range(n+1):
    for j in range(m+1):
        if k==i*j+(n-i)*(n-j):
            print('Yes')
            exit()
print('No')

Fixed code:
n,m,k = map(int, input().split())
for i in range(n+1):
    for j in range(m+1):
        if i*j + (n-i)*(m-j) == k:
            print('Yes')
            exit()
print('No')
Buggy code:
from collections import Counter

def solve():
    H, W = map(int, input().split())
    cnt = Counter()
    for _ in range(H):
        cnt.update(input())
    
    x = []
    for v in cnt.values():
        n = v%4
        if n:
            x.append(n)
    
    print(x)
    
    yes = "Yes"
    no = "No"

    c = (H&1)+(W&1)

    if c == 0:
        if x:
            return no
        return yes
    
    elif c == 1:
        if H&1:
            a = W
        else:
            a = H
        if sum(x) > a:
            return no
        for y in x:
            if y&1:
                return no
        return yes

    else:
        o = 0
        for y in x:
            if y&1:
                o += 1
        
        if o == 1:
            return yes
        
        return no

print(solve())

Fixed code:
from collections import Counter

def solve():
    H, W = map(int, input().split())
    cnt = Counter()
    for _ in range(H):
        cnt.update(input())
    
    x = []
    for v in cnt.values():
        n = v%4
        if n:
            x.append(n)
    
    yes = "Yes"
    no = "No"

    c = (H&1)+(W&1)

    if c == 0:
        if x:
            return no
        return yes
    
    elif c == 1:
        if H&1:
            a = W
        else:
            a = H
        if sum(x) > a:
            return no
        for y in x:
            if y&1:
                return no
        return yes

    else:
        if sum(x) > H+W-1:
            return no
        o = 0
        for y in x:
            if y&1:
                o += 1
        
        if o == 1:
            return yes
        
        return no

print(solve())
Buggy code:
from collections import Counter

H, W = map(int, input().split())
lis = []
for i in range(H):
    a = list(input())
    print(a)
    lis += a


lis = list(Counter(lis).values())



length = len(lis)

print(lis)

check_4 = 0
check_2 = 0
check_kisu = 0
for i in lis:
    if i % 4 == 0:
        check_4 += 1
    elif i % 2 == 0:
        check_2 += 1
    else:
        if check_kisu:
            print('No')
            exit()
        else:
            check_kisu = i

if (H % 2 == 0) & (W % 2 == 0):
    if (check_kisu != 0) | (check_2 != 0):
        print('No')
        exit()

elif (H % 2 == 1) & (W % 2 == 1):
    if H * W == check_kisu:
        print('Yes')
        exit()

    if (H + W - 1 < check_kisu + 2 * check_2) | ((H + W - 1 - check_kisu - 2 * check_2) % 4 != 0):
        print('No')
        exit()

elif H % 2 == 1:
    if (W < 2 * check_2) | ((W - 2 * check_2) % 4 != 0):
        print('No')
        exit()


elif W % 2 == 1:
    if (H < 2 * check_2) | ((H - 2 * check_2) % 4 != 0):
        print('No')
        exit()

print('Yes')


Fixed code:
from collections import Counter

H, W = map(int, input().split())
lis = []
for i in range(H):
    a = list(input())
    lis += a

lis = list(Counter(lis).values())
length = len(lis)

check_4 = 0
check_2 = 0
check_kisu = 0
for i in lis:
    if i % 4 == 0:
        check_4 += 1
    elif i % 2 == 0:
        check_2 += 1
    else:
        if check_kisu:
            print('No')
            exit()
        else:
            check_kisu = i % 4

if (H % 2 == 0) & (W % 2 == 0):
    if (check_kisu != 0) | (check_2 != 0):
        print('No')
        exit()

elif (H % 2 == 1) & (W % 2 == 1):
    if (H + W - 1 < check_kisu + 2 * check_2) | ((H + W - 1 - check_kisu - 2 * check_2) % 4 != 0):
        print('No')
        exit()

elif H % 2 == 1:
    if (W < 2 * check_2) | ((W - 2 * check_2) % 4 != 0):
        print('No')
        exit()


elif W % 2 == 1:
    if (H < 2 * check_2) | ((H - 2 * check_2) % 4 != 0):
        print('No')
        exit()

print('Yes')
Buggy code:
from collections import defaultdict
H,W = map(int,input().split())
d = defaultdict(int)
for _ in range(H):
    for c in list(input()):
        d[c] += 1
for i in range((H-1)//2+1):
    for j in range((W-1)//2+1):
        s = set([(x,y) for x,y in [(i,j),(i,W-1-j),(H-1-i,j),(H-1-i,W-1-j)] if 0<=x<H and 0<=y<W])
        f = True
        for k,_ in sorted(d.items(),key=lambda x:x[1]):
            if d[k] >= len(s):
                d[k] -= len(s)
                f = False
                for x,y in s:
                    test[x][y] = k
                break
        if f:
            print("No")
            exit(0)
print("Yes")

Fixed code:
from collections import defaultdict
H,W = map(int,input().split())
d = defaultdict(int)
for _ in range(H):
    for c in list(input()):
        d[c] += 1
for i in range((H-1)//2+1):
    for j in range((W-1)//2+1):
        s = set([(x,y) for x,y in [(i,j),(i,W-1-j),(H-1-i,j),(H-1-i,W-1-j)] if 0<=x<H and 0<=y<W])
        f = True
        for k,_ in sorted(d.items(),key=lambda x:x[1]):
            if d[k] >= len(s):
                d[k] -= len(s)
                f = False
                break
        if f:
            print("No")
            exit(0)
print("Yes")
Buggy code:
H, W = map(int,input().split())
S = []
for _ in range(H):
  S.append(input())

# check palindrome

def main():
  num1 = (H*W) % 2 
  num2 = (W % 2)*H//2 + (H % 2)*W//2
  num4 = ((H*W) - num1 - num2*2)//4
  #print(num1,num2,num4)
  d = {}
  for i in range(H):
    for j in range(W):
      ch = S[i][j]
      if ch in d:
        d[ch] += 1
      else:
        d[ch] = 1

  check1 = sum([val % 2 for key,val in d.items()])
  #print(check1)
  if check1 != num1:
    return False
  
  check4 = 0
  for key,val in d.items():
    if val >= 4:
      check4 += val // 4
      d[key] = val % 4
    
  #print(check4)
  if check4 != num4:
    return False
  
  check2 = sum([val//2 for key,val in d.items()])
  #print(check2)
  if check4 != num2:
    return False
      
  return True
      
  
ans = main()
if ans:
  print("Yes")
else:
  print("No")

Fixed code:
H, W = map(int,input().split())
S = []
for _ in range(H):
  S.append(input())

# check palindrome

def main():
  num1 = (H*W) % 2 
  num2 = (W % 2)*H//2 + (H % 2)*W//2
  num4 = ((H*W) - num1 - num2*2)//4
  #print(num1,num2,num4)
  d = {}
  for i in range(H):
    for j in range(W):
      ch = S[i][j]
      if ch in d:
        d[ch] += 1
      else:
        d[ch] = 1

  check1 = sum([val % 2 for key,val in d.items()])
  #print(check1)
  if check1 != num1:
    return False
  
  check4 = 0
  for key,val in d.items():
    if val >= 4:
      deduct = min(num4-check4,val//4)
      d[key] = val - deduct*4
      check4 += deduct
      
      if check4 == num4:
        break
    
  #print(check4)
  if check4 != num4:
    return False
  
  check2 = sum([val//2 for key,val in d.items()])
  #print(check2)
  if check2 != num2:
    return False
      
  return True
      
  
ans = main()
if ans:
  print("Yes")
else:
  print("No")