Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
Xi = list(map(int,input().split()))

Xi.sort()

Li = [Xi[i] - Xi[i-1] for i in range(1,len(Xi))]
Li.sort()

if N == M:
    print(0)
else:
    for _ in range(N-1):
        Li.pop(-1)
print(sum(Li))


Fixed submission:
N,M = map(int,input().split())
Xi = list(map(int,input().split()))

Xi.sort()

Li = [Xi[i] - Xi[i-1] for i in range(1,len(Xi))]
Li.sort()

if N == M or N > M:
    print(0)
else:
    for _ in range(N-1):
        Li.pop(-1)
    print(sum(Li))
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
Ni = list(map(int,input().split()))

if K == 0:
    print(sum([0 ^ i for i in Ni]))
    exit()
    
max_K = 0

for i in range(K):
    c = sum([(i+1) ^ j for j in Ni])
    if max_K <= c:
        max_K = c
        
print(max_K)

Fixed submission:
N,K = map(int,input().split())
Ni = list(map(int,input().split()))
    
K_bit = format(K, 'b')
max_K = 0
max_bit = len(K_bit)

cnt_bit = 1 << (max_bit-1)

for i in range(max_bit):
    cnt = 0
    for j in Ni:
        if j & cnt_bit:
            cnt += 1
            
    if cnt*2 <= N and (max_K + cnt_bit) <= K: #1が半分より少なかったら，増えるのでビットを立てる
        max_K += cnt_bit
        
    cnt_bit >>= 1
    
ans = sum([max_K ^ j for j in Ni])
        
print(ans)
Buggy python submission (verdict: Runtime Error):
N_A_B = list(map(int, input()))

if N_A_B[2] - N_A_B[1] %2 == 0:
    print("Borys")
elif N_A_B[2] - N_A_B[1] %2 == 1:
    print("Alice")

Fixed submission:
N_A_B = list(map(int, input().split()))

if (N_A_B[2] - N_A_B[1]) %2 == 0:
    print("Alice")
elif (N_A_B[2] - N_A_B[1]) %2 == 1:
    print("Borys")
Buggy python submission (verdict: Runtime Error):
#sを最高のパターンにして，tを最悪のパターンにすればいい
#continueで強制的に次のループへ
s = list(input())
t = list(input())

s.sort()
t.sort()
t.reverse()

if len(s)  == len(t):
    pattern == -1
elif len(s) < len(t):
    length = len(s)
    pattern = 0
else:#sのほうが長い時 pattern = 1
    length = len(t)
    pattern = 1

if pattern == -1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
elif pattern == 0:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("Yes")
elif pattern == 1:
    for i in range(length):
        if s[i] == t[i]:
            continue
        elif s[i] < t[i]:
            print("Yes")
            quit()
        else:
            print("No")
            quit()
    print("No")
        
    



Fixed submission:
import math
N = list(map(int,input().split()))

print(math.ceil((N[0]+N[1])/2))

Buggy python submission (verdict: Runtime Error):
N = map(int, input().split())

print( int((N[0]+N[1])/2) )

Fixed submission:
import math
N = list(map(int,input().split()))

print(math.ceil((N[0]+N[1])/2))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

series = list(map(int, input().split()))

place = [0 for _ in range(1000000000)]
counter = 0
max = 0

for i in series:
    place[i] += 1
    if i > max:
        max = i
    
for j in range(len(place)):
    if place[j] > j:
        counter += place[j] - j
    elif j > place[j]:
        counter += place[j]
        
print(counter)

Fixed submission:
N = int(input())

series = list(map(int, input().split()))

place = {}
counter = 0

for i in series:
    if i not in place:
        place[i] = 0
    place[i] += 1
    
for j in place.keys():
    if place[j] > j:
        counter += place[j] - j
    elif j > place[j]:
        counter += place[j]
        
print(counter)

Buggy python submission (verdict: Runtime Error):
N = int(input())

series = list(map(int, input().split()))

place = [0 for _ in range(100000)]
counter = 0
max = 0

for i in series:
    place[i] += 1
    if i > max:
        max = i
    
for j in range(len(place)):
    if place[j] > j:
        counter += place[j] - j
    elif j > place[j]:
        counter += place[j]
        
print(counter)

Fixed submission:
N = int(input())

series = list(map(int, input().split()))

place = {}
counter = 0

for i in series:
    if i not in place:
        place[i] = 0
    place[i] += 1
    
for j in place.keys():
    if place[j] > j:
        counter += place[j] - j
    elif j > place[j]:
        counter += place[j]
        
print(counter)
Buggy python submission (verdict: Runtime Error):
#N個のボールを持ち，K個以下の整数にする
#順当に考えるならば，種類が少ないやつから変更していけばいい
#番号の列をリストで表現
#押し付けきれるとは限らない

counter = 0

condition = list(map(int, input().split()))
A_list = list(map(int, input().split()))

zero_line = [0 for _ in range(condition[0])]

for i in A_list:
    if zero_line[i] == 0:
        counter += 1
    zero_line[i] += 1

zero_line.sort()
zero_line.reverse()

if counter <= condition[1]:
    print(0)
else:
    print(sum(zero_line[counter-condition[1]+1 :counter]))

Fixed submission:
#N個のボールを持ち，K個以下の整数にする
#順当に考えるならば，種類が少ないやつから変更していけばいい
#番号の列をリストで表現
#押し付けきれるとは限らない

counter = 0

condition = list(map(int, input().split()))
A_list = list(map(int, input().split()))

zero_line = [0 for _ in range(200001)]

for i in A_list:
    if zero_line[i] == 0:
        counter += 1
    zero_line[i] += 1

zero_line.sort()
zero_line.reverse()

if counter <= condition[1]:
    print(0)
else:
    print(sum(zero_line[condition[1] :counter]))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n_shop = int(input())
i_schedule = []
i_benefit = []

max_profit = 0

#開店スケジュールを2進数→10進数に変換
for i in range(n_shop):
    i_schedule.append(int(input().replace(" ",""),2))
    
for i in range(n_shop):
    i_benefit.append(list(map(int,input().split())))
    max_profit += min(i_benefit[i])
    
#全パターンの開店スケジューるの作成
#一つ以上の時間帯で店は開店しなければならない

#schedule=[format(i, '010b') for i in range(1,1024)]
schedule = [i for  i in range(1,1024)]

#そこから一致数の計算→リストのcountメソッドを使う
for sch in schedule:
    anded = []
    for j in range(n_shop):
        anded.append(format(sch & i_schedule[j], "b").count("1"))     #一致スケジュールを2進数表記にして，1の数を計算
        
    profit = sum_benefit(anded)
    
    if max_profit <= profit:
        max_profit = profit
    
        
    

#最後に一致数から利益の計算
def sum_benefit(anded):
    summed= 0
    for shop in range(n_shop):
        sum += i_benefit[shop][anded[shop]]
    return summed

print(max_profit)




Fixed submission:
#標準入力はN,A,Bで与えられる
numbers =input().split()

for  i in range(len(numbers)):
    numbers[i] = int(numbers[i])

if numbers[0]*numbers[1] <= numbers[2]:
    print(numbers[0]*numbers[1])
else:
    print(numbers[2])

Buggy python submission (verdict: Runtime Error):
#標準入力はN,A,Bで与えられる
numbers = int(input()).split()

for  i in range(len(numbers)):
    numbers[i] = int(numbers[i])

if numbers[0]*numbers[1] <= numbers[2]:
    print(numbers[0]*numbers[1])
else:
    print(numbers[2])

Fixed submission:
#標準入力はN,A,Bで与えられる
numbers =input().split()

for  i in range(len(numbers)):
    numbers[i] = int(numbers[i])

if numbers[0]*numbers[1] <= numbers[2]:
    print(numbers[0]*numbers[1])
else:
    print(numbers[2])

Buggy python submission (verdict: Runtime Error):
#標準入力はN,A,Bで与えられる
numbers = raw_input().split()

for  i in range(len(numbers)):
    numbers[i] = int(numbers[i])

if numbers[0]*numbers[1] <= numbers[2]:
    print(numbers[0]*numbers[1])
else:
    print(numbers[2])

Fixed submission:
#標準入力はN,A,Bで与えられる
numbers =input().split()

for  i in range(len(numbers)):
    numbers[i] = int(numbers[i])

if numbers[0]*numbers[1] <= numbers[2]:
    print(numbers[0]*numbers[1])
else:
    print(numbers[2])
Buggy python submission (verdict: Runtime Error):
# -*- Coding: utf-8 -*-
n_shop = int(input())
i_schedule = []
i_benefit = []

max_profit = 0

#開店スケジュールを2進数→10進数に変換
for i in range(n_shop):
    i_schedule.append(int(input().replace(" ",""),2))
    
for i in range(n_shop):
    i_benefit.append(list(map(int,input().split())))
    max_profit += min(i_benefit[i])
    
#全パターンの開店スケジューるの作成
#一つ以上の時間帯で店は開店しなければならない

#schedule=[format(i, '010b') for i in range(1,1024)]
schedule = [i for  i in range(1,1024)]

#そこから一致数の計算→リストのcountメソッドを使う
for sch in schedule:
    anded = []
    for j in range(n_shop):
        anded.append(format(sch & i_schedule[j], "b").count("1"))     #一致スケジュールを2進数表記にして，1の数を計算
        
    profit = sum_benefit(anded)
    
    if max_profit <= profit:
        max_profit = profit
    
        
    

#最後に一致数から利益の計算
def sum_benefit(anded):
    summed= 0
    for shop in range(n_shop):
        sum += i_benefit[shop][anded[shop]]
    return summed

print(max_profit)




Fixed submission:
# -*- Coding: utf-8 -*-
def sum_benefit(anded):
    summed= 0
    for shop in range(n_shop):
        summed += i_benefit[shop][anded[shop]]
    return summed

n_shop = int(input())
i_schedule = []
i_benefit = []


max_profit = 0

#開店スケジュールを2進数→10進数に変換
for i in range(n_shop):
    i_schedule.append(int(input().replace(" ",""),2))
    
for i in range(n_shop):
    i_benefit.append(list(map(int,input().split())))
    max_profit += min(i_benefit[i])
    
#全パターンの開店スケジューるの作成
#一つ以上の時間帯で店は開店しなければならない

#schedule=[format(i, '010b') for i in range(1,1024)]
schedule = [i for  i in range(1,1024)]

#そこから一致数の計算→リストのcountメソッドを使う
for sch in schedule:
    anded = []
    for j in range(n_shop):
        anded.append(format(sch & i_schedule[j], "b").count("1"))     #一致スケジュールを2進数表記にして，1の数を計算
        
    profit = sum_benefit(anded)
    
    if max_profit <= profit:
        max_profit = profit
    

print(max_profit)
Buggy python submission (verdict: Runtime Error):
N = int(input())

ryuka = [0]*86
ryuka[0] = 2
ryuka[1] = 1

def culc_ryuka(N, ryuka):
    for i in range(2, N+1):
        ryuka[i] = ryuka[i-1]+ryuka[i-2]
        
    return ryuka

ryuka = culc_ryuka(N, ryuka)
print(ryuka[N])
    

Fixed submission:
N = int(input())

ryuka = [0]*87
ryuka[0] = 2
ryuka[1] = 1

def culc_ryuka(N, ryuka):
    for i in range(2, N+1):
        ryuka[i] = ryuka[i-1]+ryuka[i-2]
        
    return ryuka

ryuka = culc_ryuka(N, ryuka)
print(ryuka[N])
Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(i) for i in input().split()]
an = [int(i) for i in input().split()]

def xor(j):
  s = 0
  for i in an:
    s += int(bin(j ^ i), 2)
  return s

result = 0
for i in range(k+1):
  s = xor(i)
  if s > result:
    result = s
    
print(result)





Fixed submission:
n ,k = map(int, input().split())
an = list(map(int, input().split()))
result = 0
def keta(i):
  return len(bin(i)[2:])

for j in range(keta(k), 0, -1):
  cnt = 0
  b = 1 << j-1
  for a in an:
    if a & b != 0:
      cnt += 1
  
  if len(an) - cnt > cnt and k >= b:
    result += b
    k -= b
wanted = 0
for a in an:
  wanted += result ^ a
  
print(wanted)
Buggy python submission (verdict: Runtime Error):
n = input()

for i in range(n):
  print(bin(n))


Fixed submission:
n = input()
b_l = []
for i in range(8):
  b = bin(i)[2:]
  le = len(b)
  b_l.append((3 - le)*"0" + b)


    

s_l = [int(n[i]) for i in range(4)]
    
for b in b_l:
  ans = s_l[0]
  f = 0
  b_s_l = ["+" if b[i] == "0" else "-" for i in range(3)]
  for i in range(3):
    if b_s_l[i] == "+":
      ans += s_l[i+1]
    else:
      ans -= s_l[i+1]
  if ans == 7:
    print(str(s_l[0]) + b_s_l[0] + str(s_l[1]) + b_s_l[1] + str(s_l[2]) + 
          b_s_l[2] + str(s_l[3]) + "=7") 
    break
Buggy python submission (verdict: Runtime Error):
s = input()

if s[0]=='Y' and s[1]=='A' and s[2] == 'K' and s[3] == 'I':
    print("Yes")
else:
    print("No")


Fixed submission:
# coding: utf-8
import sys

s = input()

if len(s) < 4:
    print("No")
    sys.exit()
if s[0]=='Y' and s[1]=='A' and s[2] == 'K' and s[3] == 'I':
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = int(input())
W = int(input())
 
ANS = (N-(H-1))(N-(W-1))
 
print(ANS)

Fixed submission:
N = int(input())
H = int(input())
W = int(input())
 
ANS = (N-(H-1))*(N-(W-1))
 
print(ANS)
Buggy python submission (verdict: Runtime Error):
nm = [int(i) for i in input().split()]
points = sorted([int(i) for i in input().split()])
n, m = nm[0], nm[1]

if n >= m:
    print(0)
elif n == 1:
    print(max(points) - min(points))
else:
    list_diff = [points[i+1] - points[i] for i in range(m-1)]
    list_th = []
    for i in range(n-1):
        max_index = list_diff.index(max(list_diff))
        list_th.append(max_index)
        list_diff[max_index] = 0
        
    x = points[0]
    th = 0
    count = 0
    print(list_th)
    while x < points[-1]:
        if x == points[list_th[th]]:
            x = points[list_th[th]+1]
            th += 1
        else:
            x += 1
            count += 1
            if x == points[-1]:
                break
    print(count)

Fixed submission:
n, m = list(map(int, input().split()))
xxx = list(map(int, input().split()))
 
if n >= m:
    print(0)
    exit()
xxx.sort()
ddd = [b - a for a, b in zip(xxx, xxx[1:])]
ddd.sort()
print(sum(ddd[:m - n]))
Buggy python submission (verdict: Runtime Error):
num = [1, 9, 7, 4]
for i in a:
    if i not in a:
        print("NO")
        break
    else:
        num.remove(i)
        if len(num) == 0:
            print("YES")

Fixed submission:
a = [int(i) for i in input().split()] 
b = []
for i in a:
    if i in [2, 3, 5, 6, 8]:
        print("NO")
        break
    elif i in b:
        print("NO")
        break
    else:
        b.append(i)
        if len(b) == 4:
            print("YES")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())
    if len(set(s[0], s[1], s[2])) == 3:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())
    if len(set([s[0], s[1], s[2]])) == 3:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    s = list(map(str, input().split()))

    check = set()
    for i in range(n):
        check.append(s[i])

    if len(check) == 3:
        print("Three")
    else:
        print("Four")


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    s = list(map(str, input().split()))

    check = set()
    for i in range(n):
        check.add(s[i])

    if len(check) == 3:
        print("Three")
    else:
        print("Four")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())

    check = set()
    for i in range(s):
        check.add(s[i])

    if len(s) != len(s):
        print("no")
    else:
        print("yes")


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    s = str(input())
    check = set()

    for i in range(len(s)):
        check.add(s[i])

    if len(s) != len(check):
        print("no")
    else:
        print("yes")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    """Function."""
    a, b, c, d = map(str, input().split())
    print(max(a*b, c*d))


if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    a, b, c, d = map(int, input().split())
    print(max(a*b, c*d))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def check(string):
    if string[-5:] == "dream":
        new = string[:-5]
        return new

    if string[-7:] == "dreamer":
        new = string[:-7]
        return new

    if string[-5:] == "erase":
        new = string[:-5]
        return new

    if string[-6:] == "eraser":
        new = string[:-6]
        return new

    print("NO")


if __name__ == '__main__':
    s = str(input())

    while s:
        print(s)
        s = check(s)

    if s == "":
        print("YES")


Fixed submission:
# -*- coding: utf-8 -*-

def check(string):
    if string[-5:] == "dream":
        new = string[:-5]
        return new

    if string[-7:] == "dreamer":
        new = string[:-7]
        return new

    if string[-5:] == "erase":
        new = string[:-5]
        return new

    if string[-6:] == "eraser":
        new = string[:-6]
        return new

    print("NO")


if __name__ == '__main__':
    s = str(input())

    while s:
        s = check(s)

    if s == "":
        print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys, os
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
if os.environ.get("USER") == "shun":
    def debug(*args): print(*args, file=sys.stderr)
else:
    print("NO DEBUG", file=sys.stderr)
    def debug(*args): pass
def exit(): sys.exit(0)
import math


n, p = map(int, input().split())


primes = {}
q = 2
while p != 1:
    while p % q == 0:
        p = p // q
        if q in primes:
            primes[q] += 1
        else:
            primes[q] = 1
    q += 1


ans = 1
for q in primes:
    ans *= q**(primes[q] // n)
print(ans)


Fixed submission:
#!/usr/bin/env python3
import sys, os
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
if os.environ.get("USER") == "shun":
    def debug(*args): print(*args, file=sys.stderr)
else:
    print("NO DEBUG", file=sys.stderr)
    def debug(*args): pass
def exit(): sys.exit(0)
import math


n, p = map(int, input().split())


primes = {}
q = 2
while p != 1:
    if q**2 > p:
        primes[p] = 1
        break
    while p % q == 0:
        p = p // q
        if q in primes:
            primes[q] += 1
        else:
            primes[q] = 1
    q += 1


ans = 1
for q in primes:
    ans *= q**(primes[q] // n)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

a.sort()

count = 0

while a:
    k = a.pop(0)
    k_count = 1
    while (len(a) > 0) and (a[0] == k):
        a.pop(0)
        k_count += 1
    if k_count < k:
        count += k_count
    else:
        count += k_count - k
print(count)


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

a.sort()

count = 0

while a:
    k = a.pop(-1)
    k_count = 1
    while (len(a) > 0) and (a[-1] == k):
        a.pop(-1)
        k_count += 1
    if k_count < k:
        count += k_count
    else:
        count += k_count - k
print(count)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

s = input()

swox = "".join(list(filter("x".__ne__, list(s))))

# print(s, swox)
def is_palind(a):
    for i in range(len(a)//2):
        if a[i] != a[-i-1]:
            return False
    return True

if not is_palind(swox):
    print(-1)
    sys.exit(0)
#
l = 0
r = -1
count = 0
# print(s)
while True:
    # print(l, r+len(s))
    # print(s[l],s[r])
    if l == r+len(s):
        break
    if s[l] == "x" and s[r] == "x":
        l += 1
        r -= 1
    elif s[l] == "x":
        l += 1
        count += 1
    elif s[r] == "x":
        r -= 1
        count += 1
    else:
        l += 1
        r -= 1
print(count)


Fixed submission:
#!/usr/bin/env python3
import sys

s = input()

swox = "".join(list(filter("x".__ne__, list(s))))

# print(s, swox)
def is_palind(a):
    for i in range(len(a)//2):
        if a[i] != a[-i-1]:
            return False
    return True

if not is_palind(swox):
    print(-1)
    sys.exit(0)
#
l = 0
r = -1
count = 0
# print(s)
while True:
    # print(l, r+len(s))
    # print(s[l],s[r])
    if l >= r+len(s):
        break
    if s[l] == "x" and s[r] == "x":
        l += 1
        r -= 1
    elif s[l] == "x":
        l += 1
        count += 1
    elif s[r] == "x":
        r -= 1
        count += 1
    else:
        l += 1
        r -= 1
print(count)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

H, W = map(int, input().split())
a = ""
for i in range(H):
    a += input()

# count = {}
count_all = len(a)
count_4 = 0
count_2 = 0
count_1 = 0

for s in "abcdefghijklmnopqrstuvwxyz":
    # count[s] = a.count(s)
    c = a.count(s)
    count_4 += c//4
    c = c%4
    count_2 += c//2
    c = c%2
    count_1 += c

if W%2 == 1 and H%2 == 0:
    W, H = H, W

if W%2 == 0 and H%2 == 0:
    if count_4 < W*H//4:
        print("No")
    else:
        print("Yes")
elif W%2 == 0 and H%2 == 1:
    if count_4 < W*(H-1)//4:
        # print(count_4, W*(H-1)//4)
        sys.stderr.write((count_4, W*(H-1)//4))
        print("No")
    elif 2*(count_4 - W*(H-1)//4) + count_2 < W//2:
        print("No")
    else:
        print("Yes")
else:
    if count_4 < (W-1)*(H-1)//4:
        print("No")
    elif 2*(count_4 - (W-1)*(H-1)//4) + count_2 < (W+H-2)//2:
        print("No")
    else:
        print("Yes")


Fixed submission:
#!/usr/bin/env python3

H, W = map(int, input().split())
a = ""
for i in range(H):
    a += input()

# count = {}
count_all = len(a)
count_4 = 0
count_2 = 0
count_1 = 0

for s in "abcdefghijklmnopqrstuvwxyz":
    # count[s] = a.count(s)
    c = a.count(s)
    count_4 += c//4
    c = c%4
    count_2 += c//2
    c = c%2
    count_1 += c

if W%2 == 1 and H%2 == 0:
    W, H = H, W

if W%2 == 0 and H%2 == 0:
    if count_4 < W*H//4:
        print("No")
    else:
        print("Yes")
elif W%2 == 0 and H%2 == 1:
    if count_4 < W*(H-1)//4:
        # print(count_4, W*(H-1)//4)
        print("No")
    elif 2*(count_4 - W*(H-1)//4) + count_2 < W//2:
        print("No")
    else:
        print("Yes")
else:
    if count_4 < (W-1)*(H-1)//4:
        print("No")
    elif 2*(count_4 - (W-1)*(H-1)//4) + count_2 < (W+H-2)//2:
        print("No")
    else:
        print("Yes")