Problem:


Score : 200 points

Problem Statement

We have a grid with N rows and M columns of squares. Initially, all the squares are white.

There is a button attached to each row and each column.
When a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.
When a button attached to a column is pressed, the colors of all the squares in that column are inverted.

Takahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.

Constraints

1 \leq N,M \leq 1000

0 \leq K \leq NM

Input

Input is given from Standard Input in the following format:

N M K

Output

If Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.

Sample Input 1

2 2 2

Sample Output 1

Yes

Press the buttons in the order of the first row, the first column.

Sample Input 2

2 2 1

Sample Output 2

No

Sample Input 3

3 5 8

Sample Output 3

Yes

Press the buttons in the order of the first column, third column, second row, fifth column.

Sample Input 4

7 9 20

Sample Output 4

No



Sample input:
2 2 2


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
ans="No"
for i in range(n):
  if (2*i-n)==0:
    if k==m*n//2:
      ans="Yes"
  else:
    if (k-n*m+m*i)%(2*i-n)==0 and 0<(k-n*m+m*i)//(2*i-n)<m:
      ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
ans="No"
for i in range(n):
  if (2*i-n)==0:continue
  y=(k-n*m+m*i)/(2*i-n)
  if y==int(y) and 0<y<m:
      ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
ROW, COL, K = map(int, input().split())
for row in range(ROW):
    for col in range(COL):
        if row * (COL - col) + col * (ROW - row) == K:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/code-festival-2017-quala/tasks/code_festival_2017_quala_b

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

s = set()
for i in range(n + 1):
    for j in range(m + 1):
        t = i * m + j * n
        if t <= n * m:
            s.add(t)

if k in s:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

isok = False
for x in range(M+1):
    for y in range(N+1):
        if x*(M-y)+y*(N-x) == K:
            isok = True
            break

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

Submission status: Wrong Answer

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

# N*x + (M-x)*y == K
# x <= M, y <= N

if N==1 or M==1:
    print('Yes')
    exit()

isok = False
for x in range(M+1):
    if not isok:
        for y in range(N+1):
            if x*(M-y)+y*(N-x) == K:
                isok = True
                break

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

Submission status: Wrong Answer

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

# N*x + (M-x)*y == K
# x <= M, y <= N

isok = False
for x in range(M+1):
    if not isok:
        for y in range(N+1):
            if x*(M-y)+y*(N-x) == K:
                isok = True
                break

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

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, input().split())
  
for i in range(N):
  for j in range(M):
    if K == (N-i)*j + i*(M-j):
      print('Yes')
      exit()
      
print('No')

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
for i in range(a+1):
    for j in range(b+1):
        if (a-j)*i+(b-i)*j==c:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
for i in range(a+1):
    for j in range(b+1):
        if (a-i)*b+(b-j)*a==c:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
for i in range(a):
    for j in range(b):
        if (a-i)*b+(b-j)*a==c:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
for i in range(a):
    for j in range(b):
        if i*b+j*a==c:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-26 12:46:01 +0900
# LastModified: 2020-07-26 13:18:48 +0900
#


import os
import sys


def main():
    n, m, k = map(int, input().split())
    if n == 1 and m <= k:
        print("Yes")
        return
    elif n == 1 and m > k:
        print("No")
        return
    if m == 1 and  n <= k:
        print("Yes")
        return
    elif m == 1 and n > k:
        print("No")
        return

    for s in range(m+1):
        for t in range(n+1):
            if k == n*s+m*t-2*s*t:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-26 12:46:01 +0900
# LastModified: 2020-07-26 13:14:46 +0900
#


import os
import sys


def main():
    n, m, k = map(int, input().split())
    if n == 1 and m <= k:
        print("Yes")
        return
    elif n == 1 and m > k:
        print("No")
        return
    if m == 1 and  n <= k:
        print("Yes")
        return
    elif m == 1 and n > k:
        print("No")
        return

    for s in range(n+1):
        for t in range(m+1):
            if k == n*s-s*t+(m-s)*t:
                print("Yes")
                return
    print("No")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-26 12:46:01 +0900
# LastModified: 2020-07-26 13:06:37 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


def main():
    n, m, k = map(int, input().split())

    for s in range(n+1):
        for t in range(m+1):
            if k == n*s-s*t+(m-s)*t:
                print("Yes")
                return
    print("No")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-07-26 12:46:01 +0900
# LastModified: 2020-07-26 13:00:50 +0900
#


import os
import sys
import numpy as np
# import pandas as pd


def main():
    n, m, k = map(int, input().split())
    for s in range(n):
        for t in range(m):
            if k == n*s-s*t+(m-s)*t:
                print("Yes")
                return
    print("No")



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

N, M, K = map(int, sys.stdin.readline().split())

# 組み合わせは関係ないため、全探索可能
for i in range(N+1):
    tmp = i * M
    for j in range(M+1):
        tmp += (N - 2 * i) * j
        if tmp == K:
            print("Yes")
            sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
import sys

N, M, K = map(int, sys.stdin.readline().split())

# 組み合わせは関係ないため、全探索可能
for i in range(N):
    tmp = i * M
    for j in range(M):
        tmp += (N - 2 * i) * j
        if tmp == K:
            print("Yes")
            sys.exit()

print("No")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc061/tasks/abc061_c
import sys

def main():
    n, m, k = map(int, input().split())
    cnt = set()
    for x in range(n+1):
        for y in range(m+1):
            tmp = (m-x)*y + x*(n-y)
            if tmp not in cnt:
                cnt.add(tmp)

    if k in cnt:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m, k = map(int, input().split())
    OK = False
    for i in range(n+1):
        if i*n == k:
            OK = True
            continue
        else:
            if (m-2*i)==0:
                continue
            if (k - i*n)% (m-2*i) ==0 and m >= (k - i*n)/(m-2*i) and m >= (k - i*n)/(m-2*i)>=0:
                OK = True
    if OK:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m, k = map(int, input().split())
    OK = False
    for i in range(n+1):
        if (m-2*i)==0:
            if i*n == k:
                OK = True
            continue
        if (k - i*n)% (m-2*i) ==0 and m >= (k - i*n)// (m-2*i) and m >= (k - i*n)// (m-2*i)>=0:
            OK = True
    if OK:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m, k = map(int, input().split())
    OK = False
    for i in range(n+1):
        if (m-2*i)==0:
            if i*n == k:
                OK = True
            continue
        if (k - i*n)% (m-2*i) ==0 and m >= (k - i*n)// (m-2*i) >=0:
            OK = True
    if OK:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m, k = map(int, input().split())
    OK = False
    for i in range(n+1):
        if (m-2*i)==0:
            continue
        if (k - i*n)% (m-2*i) ==0 and m >= (k - i*n)// (m-2*i) >=0:
            OK = True
    if OK:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
if N==1 or M==1:
    flag = 1
else:
    flag = 0
    for i in range(N):
        for j in range(M):
            if M*i+N*j-2*i*j==K:
                flag = 1
                break
        if flag==1:break
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
flag = 0
for i in range(N):
    for j in range(M):
        if M*i+N*j-2*i*j==K:
            flag = 1
            break
    if flag==1:break
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
h,w,k = map(int,input().split())
for x in range(1,1001):
    for y in range(1,1001):
        if w*x + h*y - 2*x*y == k and 0<= x <= h and 0<= y <= w:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

# 行と列の組み合わせを全探索で試し、1回でも成立する場合は終了する
for i in range(n):
  for j in range(m):
    if i*(m-j) + j*(n-i) == k:
      print("Yes")
      exit()
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution 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 - i*j == k:
      print('Yes')
      exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
from copy import deepcopy
n, m, k = map(int, input().split())
A = np.zeros((n, m), dtype=int)
for i in range(n):
  A[i, :] += 1
  B = deepcopy(A)
  for j in range(m):
    B[:, j] += 1
    if np.sum(B % 2) == k:
      print('Yes')
      exit()
print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution 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')

Submission status: Wrong Answer

Solution 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 - n * m * 2 == K:
            print('Yes')
            exit()

print('No')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M,K=MI()
    flag=0
    
    for i in range(N):
        for j in range(M):
            temp=i*M+j*N-(i*j)*2
            if temp==K:
                flag=1
                break
            
            
    if flag:
        print("Yes")
    else:
        print("No")

main()

Submission status: Wrong Answer

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

for i in range(N+1):
    for j in range(M+1):
        if i*(N-j)+j*(M-i) == K:
            print('Yes')
            flag = 1
            break
        else:
            flag = 0
    if flag == 1:
        break
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

flag = False
for y in range(m+1):
    for x in range(n + 1):
        if m * y + n * x - 2 * x * y == k:
            flag = True
            break
print("Yes" if flag else "No")

Submission status: Wrong Answer

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

flag = False
for y in range(m+1):
    if n - 2 * y == 0:
        continue
        
    x = (k - m * y) / (n - 2 * y)
    
    if (k - m * y) % (n - 2 * y) == 0 and (0 <= x and x <= m):
        flag = True
        break
print("Yes" if flag else "No")

Submission status: Wrong Answer

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

flag = False
for y in range(m):
    if n - 2 * y == 0:
        continue
        
    x = (k - m * y) / (n - 2 * y)
    
    if (k - m * y) % (n - 2 * y) == 0 and (0 <= x and x <= m):
        flag = True
        break
print("Yes" if flag else "No")

Submission status: Wrong Answer

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

flag = False
for y in range(m):
    if n - 2 * y == 0:
        continue
        
    x = (k - m * y) / (n - 2 * y)
    
    if (k - m * y) % (n - 2 * y) == 0 and (0 <= x and x <= m):
        print(y, (k - m * y) / (n - 2 * y), (n - 2 * y), (k - m * y))
        flag = True
        break
print("Yes" if flag else "No")

Submission status: Wrong Answer

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

Submission status: Wrong Answer

Solution code:
from math import ceil,floor,comb,factorial,gcd,pow,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heappop,heappush
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

Submission status: Wrong Answer

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

for i in range(1, n + 1):
    for j in range(1, m + 1):
        if i * (m - j) + (n - i) * j == k:
            print('Yes')
            exit()
print('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 X(): return list(input())
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)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

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

print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys

if __name__ == "__main__":
    N, M, K = [int(x) for x in input().split(" ")]
    for x in range(0, N + 1):
        for y in range(x, M + 1):
            if x * M + (y - x) * N == K:
                print("Yes")
                sys.exit(0)
    print("No")

Submission status: Wrong Answer

Solution code:
from math import gcd

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

if gcd(gcd(n, m), k) == gcd(n, m):
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
from math import gcd

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

if gcd(gcd(n, m), k) == gcd(n, m):
    print('No')
else:
    ('Yes')

Submission status: Wrong Answer

Solution code:
from math import gcd

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

if gcd(n, m) == 1:
    print('Yes')
elif gcd(gcd(n, m), k) == 1:
    print('No')

Submission status: Wrong Answer

Solution 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')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env pypy

import sys
from typing import Any, Callable, Deque, Dict, List, Mapping, Optional, Sequence, Set, Tuple, TypeVar, Union
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)



def main():
    Num = Union[int, float]
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())


    def check(n, m, k):
        for i in range(n):
            for j in range(m):
                if i * j + (n - i) * (m - j) == k:
                    return True
        return False
    
    
    n, m, k = mi()
    print('Yes') if check(n, m, k) else print('No')
        


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M,K=map(int,input().split())
for i in range(N+1):
    for j in range(M+1):
        cnt=(N-j)*i+(M-i)*j
        if cnt==K:
            print("Yes")
            exit()
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M,K=map(int,input().split())
row=K//N
cnt=row*N
for i in range(M):
    if cnt==K:
        print("Yes")
        exit()
    else:
        cnt+=(M-row)-row
else:
    col=K//M
    cnt=col*M
    for j in range(N):
        if cnt==K:
            print("Yes")
            exit()
        else:
            cnt+=(N-col)-col
    else:
        print("No")

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
flag = False
for r in range(n+1):
    for c in range(m+1):
        if m*c + n*r - 2*c*r == k:
            flag = True
            break
    if flag:
        break
print('Yes' if flag else 'No')

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
for r in range(n+1):
    for c in range(m+1):
        if m*c + n*r - 2*c*r == k:
            print('Yes')
            break
    else:
        continue
    break
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import math

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

if k%n == 0 or k%m == 0:
    print("Yes")
    exit()

if n%2 == 0:
    print("Yes" if k%(n)==0 else "No")
else:
    x = n//2 + 1
    y = n//2
    a = (k-m*y)/(x-y)
    if 0<=a<=m and a.is_integer():
        print("Yes")
        exit()
    x = m//2 +1
    y = m//2
    a = (k-n*y)/(x-y)
    print("Yes" if 0<=a<=n and a.is_integer() else "No")

Submission status: Wrong Answer

Solution code:
import math

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

if k%n == 0 or k%m == 0:
    print("Yes")
    exit()

if n%2 == 0:
    print("Yes" if k%(n)==0 else "No")
else:
    x = n//2 + 1
    y = n//2
    a = (k-m*y)/(x-y)
    if 0 <= a and a.is_integer():
        print("Yes")
        exit()
    x = m//2 +1
    y = m//2
    a = (k-n*y)/(x-y)
    print("Yes" if 0<=a and a.is_integer() else "No")

Submission status: Wrong Answer

Solution code:
import math

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

if k%n == 0 or k%m == 0:
    print("Yes")
    exit()

if n%2 == 0:
    print("Yes" if k%(n)==0 else "No")
else:
    x = n//2 + 1
    y = n//2
    a = (k-m*y)/(x-y)
    print("Yes" if 0<=a and a.is_integer() else "No")

Submission status: Wrong Answer

Solution code:
def myAnswer(N: int, M: int, K: int) -> int:
   ans = set([0])
   for i in range(M):
      ans.add(N * (i + 1))
      ans.add(M - (i + 1) + (N - 1) * (i + 1))
   for i in range(N):
      ans.add(M * (i + 1))
      ans.add(N - (i + 1) + (M - 1) * (i + 1))
   print(ans)
   return "Yes" if K in ans else "No"

def modelAnswer(N,M,K):
   for k in range(1,N + 1):
      for l in range(1,M + 1):
         if k * (M - l) + l * (N - k) == K:
            return "Yes"
   return "No"
def main():
   N, M, K=map(int, input().split())
   print(modelAnswer(N, M, K))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

Solution code:
def myAnswer(N: int, M: int, K: int) -> int:
   ans = set([0])
   for i in range(M):
      ans.add(N * (i + 1))
      ans.add(M - (i + 1) + (N - 1) * (i + 1))

   for i in range(N):
      ans.add(M * (i + 1))
      ans.add(N - (i + 1) + (M - 1) * (i + 1))
   # print(ans)
   return "Yes" if K in ans else "No"

def modelAnswer():
   return
def main():
   N, M, K=map(int, input().split())
   print(myAnswer(N, M, K))
if __name__ == '__main__':
   main()

Submission status: Wrong Answer

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

can=[]
for i in range(n+1):
    for j in range(m+1):
        can.append(i*(n-j)+j*(m-i))


# can_m=[]
# can_n=[]

# for i in range(m+1):
#     can_m.append(i*n)
# for i in range(m+1):
#     p = can_m[i]
#     for j in range(1,m):
#         s = i*n - i*j + j*(m-i)
#         can_m.append(s)

# for i in range(n+1):
#     can_n.append(i*m)
# for i in range(n+1):
#     p = can_n[i]
#     for j in range(1,n):
#         s = i*m - i*j + j*(n-i)
#         can_n.append(s)

if (k in can): #or (k in can_n):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


can_m=[]
can_n=[]

for i in range(m+1):
    can_m.append(i*n)
for i in range(m+1):
    p = can_m[i]
    for j in range(1,m):
        s = i*n - i*j + j*(m-i)
        can_m.append(s)

# for i in range(n+1):
#     can_n.append(i*m)
# for i in range(n+1):
#     p = can_n[i]
#     for j in range(1,n):
#         s = i*m - i*j + j*(n-i)
#         can_n.append(s)

if (k in can_m): #or (k in can_n):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


can_m=[]
can_n=[]

for i in range(m+1):
    can_m.append(i*n)
for i in range(m+1):
    p = can_m[i]
    for j in range(1,m):
        s = i*n - i*j + j*(m-i)
        can_m.append(s)

for i in range(n+1):
    can_n.append(i*m)
for i in range(n+1):
    p = can_n[i]
    for j in range(1,n):
        s = i*m - i*j + j*(n-i)
        can_n.append(s)

if (k in can_m) or (k in can_n):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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


can_m=[]
can_n=[]

for i in range(1,m+1):
    can_m.append(i*n)

for i in range(len(can_m)):
    p = can_m[i]
    i=i+1
    for j in range(1,m+1):
        s = i*n - i*j + j*(m-i)
        can_m.append(s)

for i in range(1,n+1):
    can_n.append(i*m)

for i in range(len(can_n)):
    p = can_n[i]
    i=i+1
    for j in range(1,n+1):
        s = i*m - i*j + j*(n-i)
        can_n.append(s)

can_m.append(0)
can_n.append(0)
can_m=sorted(can_m)
can_n=sorted(can_n)

if (k in can_m) or (k in can_n):
    print('Yes')
else:
    print('No')