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:
H, W, K = map(int, input().split())
for h in range(0, H+1):
  for w in range(0, W+1):
    if h*W + w*H - h*w == 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):
    a = m*i + n*j - 2*i*j
    if a == 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):
    a = n+m-2 +(m-2)*i + (n-2)*j
    if a == k:
      print('Yes')
      exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

for n in range(N+1):
    for m in range(M+1):
        if N*m + M*n == K:
            print("Yes")
            sys.exit()

print("No")

Submission status: Wrong Answer

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

def hantei(n,m,k):
    for i in range(1,n+1):
        for j in range(1,m+1):
            if i*m + j*(n-2*i)==k:
                return True
    return False

print("Yes" if hantei(n,m,k) else "No")

Submission status: Wrong Answer

Solution code:
# 03
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


N, M, K = LI()

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:
# 03
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


N, M, K = LI()
if K == 0:
    print('Yes')
    exit()

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:
import sys, math, re
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N, M, K = mi()

    for k in range(N):
        for l in range(M):
            if k*(M-l)+(N-k)*l == K:
                print('Yes')
                return

    print('No')


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
d1=k%n
d2=k%m
if d1==0 or d2==0:
  print('Yes')
elif d1==m or d2==n:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
d1=k%n
d2=k%m
if d1==0 and d2==0:
  print('Yes')
elif d1==m or d2==n:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
if n+m>=k:
  if (n+m)%2==k%2:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n, m, k = LI()
    for i in range(n):
        for j in range(m):
            if i*m + j*(n-2*i) == k:
                print("Yes")
                exit(0)
    else:
        print("No")
main()

Submission status: Wrong Answer

Solution code:
from sys import exit
N, M, K  = map(int, input().split())
for n in range(N):
    for m in range(M):
        if (N - n) * (M - m) + n * m == K:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write

  N,M,K=map(int,pin().split())
  for i in range(N+1):
    for j in range(M+1):
      if i*(M-j)+(M-i)*j==K:
        print("Yes")
        return
  print("No")
  return
main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = "No"

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

print(ans)

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 == i*(m-j) + j*(n-i):
            print("Yes")
            exit()

print("No")

Submission status: Wrong Answer

Solution code:
'''
Created on 2020/09/08

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M,K=map(int,pin().split())
  if K==0:
    print("Yes")
    return 
  if K%N==0:
    print("Yes")
    return 
  if K%M==0:
    print("Yes")
    return 
  if abs((M+N)-K)<=1:
    print("Yes")
    return 
  print("No")
  return 
main()

Submission status: Wrong Answer

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

N, M, K = mapint()

s = set()
for n in range(N+1):
    for m in range(M+1):
        s.add(n*M + m*N - n*m)
if K in s:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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):
        black = n * (m - j) + (n - i) * m
        if black == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m,k = map(int,input().split())
if k>n and k > m:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n,m,k = map(int,input().split())
if k%m%n and k%n%m:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n,m,k = map(int,input().split())
if k%m%n:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
import heapq


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

for k in range(N):
    for l in range(M):
        if k*(M-l) + l*(N-k) == K:
            print("Yes")
            exit(0)

print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    for i in range(1, N + 1):
        for j in range(1, M + 1):
            b = i * (M - j) + j * (N - i)

            if b == K:
                print("Yes")
                exit()

    print("No")

if __name__ == "__main__":
    main2()

Submission status: Wrong Answer

Solution code:
from collections import deque
n, m, k = map(int, input().split())
ans = []
for i in range(1, n + 1):
    for j in range(1, m + 1):
        cnt = (i * m) + (j * n) - 2 * (i * j)
        # print(i, j, cnt)
        ans.append(cnt)
if k in ans:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M, K = [int(x) for x in input().split()]

    if K % N == 0 or K % M == 0:
        print("Yes")
        return

    for i in range(1, N):
        if N - 1 - i <= 0:
            break
        if (K - M) % 3 == 0:
            print("Yes")
            return

    for i in range(1, M):
        if M - 1 - i <= 0:
            break
        if (K - N) % 3 == 0:
            print("Yes")
            return


    print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, m, k = map(int, input().split())

def is_able(n, m, k):
    res = defaultdict(bool)
    for i in range(1, n+1):
        for j in range(1, m+1):
            count = 0
            count += i*j
            count += (n-i)*(m-j)
            res[count] = True
    return res[k]


if is_able(n, m, k):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, K = MAP()

A = []
for i in range(N):
    for j in range(M):
        tmp = M * i + N * j - i * j * 2
        A.append(tmp)

if K in set(A):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, K = MAP()

A = []
for i in range(N):
    for j in range(M):
        tmp = M * i + N * j - i * j * 2
        if tmp not in A:
            A.append(tmp)

if K in A:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M, K = MAP()

    l = []
    for i in range(N):
        for j in range(M):
            l.append(M*i + N*j - i*j*2)

    print("Yes" if K in l else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M, K = MAP()

    A = [N * (i + 1) for i in range(M)]
    B = [M * (i + 1) for i in range(N)]
    C = [N + (M - 2)*i for i in range(N)]
    D = [M + (N - 2)*i for i in range(M)]

    print("Yes" if K in set([0] + A + B + C + D) else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M, K = MAP()

    A = [N * (i + 1) for i in range(M)]
    B = [M * (i + 1) for i in range(N)]
    C = [N + (M - 2)*i for i in range(N)]
    D = [M + (N - 2)*i for i in range(M)]

    print(set([0] + A + B + C + D))
    print("Yes" if K in set([0] + A + B + C + D) else "No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, M, K = MAP()

    A = [N * (i + 1) for i in range(M)]
    B = [M * (i + 1) for i in range(N)]
    C = [N + M - 2 + (M - 2)*i for i in range(N-1)]
    D = [N + M - 2 + (N - 2)*i for i in range(M-1)]

    print("Yes" if K in set([0] + A + B + C + D) else "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 i*m+j*n-i*j==k or i*m+j*n-i*j==n*m-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 i*m+j*n-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 i*j==k or (n*m-i*j)==k:
      print('Yes')
      exit()
      
print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
flg=0
for i in range(n):
  tmp=k-m*i
  if n==i*2 or tmp<0:
    pass
  elif tmp%(n-i*2)==0 and tmp//(n-i*2)<=m:
    flg=1
if flg==1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
flg=0
for i in range(n):
  tmp=k-n*i
  if m==i*2 or tmp<0:
    pass
  elif tmp%(m-i*2)==0 and tmp//(m-i*2)<=n:
    flg=1
if flg==1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
flg=0
for i in range(n):
  tmp=k-n*i
  if m>i*2 and tmp>=0:
    if tmp%(m-i*2)==0 and tmp//(m-i*2)<=n:
      flg=1
if flg==1:
  print('Yes')
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):
    if i*m+j*n-i*j==k:
      print("Yes")
      break
  else:
    continue
  break
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
flg=0
for i in range(n):
  tmp=k-n*i
  if m>i*2 and tmp>=0:
    if tmp%(m-i*2)==0:
      flg=1
  else:
    if tmp==0:
      flg=1
if flg==1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
flg=0
for i in range(n):
  tmp=k-n*i
  if m>i*2 and tmp>=0:
    if tmp%(m-i*2)==0:
      flg=1
if flg==1:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if k==0:
    print("Yes")
    sys.exit()

for i in range(n+1):
    black=i*m
    c=n-(2*i)
    for j in range(m+1):
        black += j*c
        if black==k:
            print("Yes")
            sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M, K = LI()

    ans = 'No'
    for i, j in itertools.product(range(N), range(M)):
        if i * j + (N - i) * (M - j) == K:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
# list(map(int, list(input()))) # スペースがない数字リストを読み込み
import math
import fractions
import sys
import bisect
import heapq  # 優先度付きキュー(最小値取り出し)
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


# a^n
def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod


# n*(n-1)*...*(l+1)*l
def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a

# Union Find
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# 約数生成
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n,m,k = lr()
for i in range(k//n):
    tmp = k - n*i
    if tmp % m == 0:
        print('Yes')
        sys.exit()
print('No')

Submission status: Wrong Answer

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

for i in range(n+1):
    for j in range(m+1):
        if i*(n-j)+(m-i)*j == k:
            print('Yes')
            sys.exit()
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 max(i*(n-j), 0)+max((n-i)*j, 0) == k:
            print('Yes')
            sys.exit()
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*(n-j)+(m-i)*j == k:
            print('Yes')
            sys.exit()
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*(m-j)+(n-i)*j == k:
            print('Yes')
            sys.exit()
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(n):
        if i*(n-j)+(m-i)*j == k:
            print('Yes')
            sys.exit()
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(n):
        if i*(m-j)+(n-i)*j == k:
            print('Yes')
            sys.exit()
print('No')

Submission status: Wrong Answer

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

for i in range(M + 1):
    for j in range(N + 1):
        # t = i * j + (N - i) * (M - j)
        # area = M * N - t
        area = (M - j) * i + (N - i) * j
        if area == K:
            flag = True

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

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, input().split())
if K == 0:
    print('Yes')
    exit()
flag = False

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, input().split())
flag = False
area = 0
for i in range(M):
    area += N
    if area == K:
        flag = True
area = 0
for i in range(N):
    area += M
    if area == K:
        flag = True
for i in range(1, M):
    for j in range(1, N):
        area = i * j + (N - i) * (M - j)
        if area == K:
            flag = True

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, input().split())
flag = False
now = 0
cnt = 0
for i in range(M):
    now += N
    cnt += 1
    if now >= K:
        break
if now == K:
    flag = True

for i in range(N):
    now -= cnt
    now += (M - cnt)
    if now <= K:
        break
if now == K:
    flag = True


for i in range(N):
    now += M
    cnt += 1
    if now >= K:
        break
if now == K:
    flag = True

for i in range(M):
    now -= cnt
    now += (N - cnt)
    if now <= K:
        break
if now == K:
    flag = True

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

Submission status: Wrong Answer

Solution code:
def solve():
    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) + j*(N-i) == K:
                print("Yes")
                return

    print("No")

solve()

Submission status: Wrong Answer

Solution code:
import math
N,M,K = map(int,input().split())
list = [0 for i in range(N*M+1)]
i = 0
while i < M:
    k=0
    list[N*i]=1
    while k < N:
        list[N*i+(M-2*i)*k]=1
        k+=1
    i+=1
j = 0
while j < N:
    l = 0
    list[M*j]=1
    while l < M:
        list[M*j+(N-2*j)*l]=1
        l+=1
    j+=1
if list[K] ==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N,M,K = map(int,input().split())
list = [0 for i in range(N*M+1)]
i = 0
while i < M:
    k=0
    list[N*i]=1
    while k < N:
        list[N*i+(M-2*i)*k]=1
        k+=1
    i+=1
j = 0
while j < N:
    l = 0
    list[M*j]=1
    while l < M:
        list[M*j+(N-2*j)]=1
        l+=1
    j+=1
if list[K] ==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import math
N,M,K = map(int,input().split())
list = [0 for i in range(N*M+1)]
i = 0
while i < M:
    list[N*i]=1
    list[N*i+(M-2*i)]=1
    i+=1
j = 0
while j < N:
    list[M*j]=1
    list[M*j+(N-2*j)]=1
    j+=1
if list[K] ==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

for row in range(N):
    for colum in range(M):
        black = row * M
        black -= row * colum
        black += (N - row) * colum
        if black == K:
            print("Yes")
            exit()

print("No")

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
ans="No"
for i in range(n+1):
  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)