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


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)


# return index
from bisect import bisect_right
def search(t, i):
    """
    t: list 探索元の数列
    i: int 探索する値
    """
    ix = bisect_right(t, i)
    if t[ix-1] != i:
        return False
    return True


if search(can_m, k) or search(can_n,k):
    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(m):
    p = can_m[i]
    i=i+1
    for j in range(1,m):
        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(n):
    p = can_n[i]
    i=i+1
    for j in range(1,n):
        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)

# return index
from bisect import bisect_right

def search(t, i):
    """
    t: list 探索元の数列
    i: int 探索する値
    """
    ix = bisect_right(t, i)
    if t[ix-1] != i:
        return False
    return True


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

Submission status: Wrong Answer

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

if n<=m:
    n,m=m,n
    
can=[]

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


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

for l in range(1,n+1):
    can.append(l*m)



can.append(0)
can=sorted(can)

# return index
from bisect import bisect_right

def search(t, i):
    """
    t: list 探索元の数列
    i: int 探索する値
    """
    ix = bisect_right(t, i)
    if t[ix-1] != i:
        return False
    return True


if search(can, k):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

can=[]

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


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

for l in range(1,n+1):
    can.append(l*m)

can.append(0)

can=sorted(can)

# return index
from bisect import bisect_right

def search(t, i):
    """
    t: list 探索元の数列
    i: int 探索する値
    """
    ix = bisect_right(t, i)
    if t[ix-1] != i:
        return False
    return True


if search(can, k):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N, M, K = MAP()

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

Submission status: Wrong Answer

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

print('No')

Submission status: Wrong Answer

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

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

print("No")

Submission status: Wrong Answer

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

for v in itertools.product([int(m/2), m-int(m/2)], repeat=n):
    if sum(v) == k: 
        print("Yes")
        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*j)+(n-i)*(m-j)==k:
      print('Yes')
      sys.exit()
print('No')

Submission status: Wrong Answer

Solution code:
h,w,k=map(int,input().split())
ans="No"
for i in range(h):
  for j in range(w):
    if i*j+(h-i)*(w-j) == k:
      ans="Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
H,W,target = map(int,input().split())
res = 'No'
for w in range(1,W+1):
    for h in range(1,H+1):
        num_black = w * h + (W-w)*(H-h)
        if num_black == target:
            res = 'Yes'
print(res)

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):
        black = (N*r)+(M*c)-(r*c*2)
        if black == K:
            print('Yes')
            exit(0)
print('No')

Submission status: Wrong Answer

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

if n*m%2 == 0:
    if k%2 == 0 and k >= min(n, m):
        ans = 1
    else:
        ans = 0
else:
    ans = 1

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

#同じ行、列で2回押すのはノーカウントにできる
#行、列で押した回数を独立にできる
#nのうちp、mのうちq押す
#p*m+q*n-p*q
cnt=0
for p in range(n):
    for q in range(m):
        if p*m+q*n-2*p*q==k:
            cnt+=1
if cnt>0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

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

def main(N, M, K):
    for i in range(0, N+1):
        for j in range(0, M+1):
            if N * (M - j) + M * (N - i) == K:
                return True
    return False

res = main(N, M, K)

if res == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:

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

def main(N, M, K):
    for i in range(1, N+1):
        for j in range(1, M+1):
            if N * (M - j) + M * (N - i) == K:
                return True
    return False

res = main(N, M, K)

if res == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Jun  2 22:08:10 2020

@author: NEC-PCuser
"""

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

Submission status: Wrong Answer

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

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

print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M, K = map(int,input().split())
jdg = 0
for L in range(1, N+1):
    for C in range(1, M+1):
        if (M-C)*L + (N-L)*C == K and jdg == 0:
            jdg += 1
            print("Yes")
            break
if jdg == 0 :
    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*n-2*i*j==k:
      print('Yes')
      quit()
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*n-i*j==k:
      print('Yes')
      quit()
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*n-i==k:
      print('Yes')
      quit()
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(1, n + 1):
    for j in range(1, m + 1):
        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):
    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())
flag=False
for n in range(N):
    for m in range(M):
        if (N-n)*m+(M-m)*n==K:
            flag=True
print("Yes" if flag else "No")

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def answer(n, m, k):
    YES = 'Yes'
    NO = 'No'
    if k%n == 0 or k%m == 0:
        return YES
    j = 1
    for i in range(m-1, 0, -1):
        a = (i + (n-1)*j)
        if k == a:
            return YES
        j += 1
    j = 1
    for i in range(n-1, 0, -1):
        a = (i + (m-1)*j)
        if k == a:
            return YES
        j += 1
    
    return NO

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

Submission status: Wrong Answer

Solution code:
def answer(n, m, k):
    YES = 'Yes'
    NO = 'No'
    if k%n == 0 or k%m == 0:
        return YES
    j = 1
    for i in range(m-1, 0, -1):
        a = (i + (n-1)*j)
        if k == a:
            return YES
        j += 1
    if (n-2)*2 + (m-2)*2 == k:
        return YES
    return NO

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

Submission status: Wrong Answer

Solution code:
def answer(n, m, k):
    YES = 'Yes'
    NO = 'No'
    if k%n == 0 or k%m == 0:
        return YES
    j = 1
    for i in range(m-1, 0, -1):
        if k == (i + (n-1)*j):
            return YES
        j += 1
    if (n-2)*2 + (m-2)*2 == k:
        return YES
    return NO

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

Submission status: Wrong Answer

Solution code:
def answer(n, m, k):
    YES = 'Yes'
    NO = 'No'
    if k%n == 0 or k%m == 0:
        return YES
    j = 1
    for i in range(m-1, 0, -1):
        if k == (i + (n-1)*j):
            return YES
        j += 1
    return NO

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

Submission status: Wrong Answer

Solution code:

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

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

Submission status: Wrong Answer

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

for i in range(M):
    for j in range(N):
        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):
        print(i, j, i * (m - j) + j * (n - i))
        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):
    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(m+1):
    for j in range(n+1):
        if i*(m-j) + j*(n-i) == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = [int(hoge) for hoge in input().split()]
ans = "No"
for n in range(N+1):
    for m in range(M+1):
        if m*(N-n) +n*(M-n)  == K:
            ans = "Yes"
print(ans)

Submission status: Wrong Answer

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

def solve():
    if K < min(N, M):
        return 'No'
    
    for i in range(N+1):
        for j in range(M+1):
            if i*M+j*N-i*j*2 == K:
                return 'Yes'
    
    return 'No'
            
print(solve())

Submission status: Wrong Answer

Solution code:
print('Later')

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 M*i + N*j - i*j == K:
            print('Yes')
            sys.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)+j*(n-1)==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)+j*(n-1):
      print("Yes")
      exit()
print("No")

Submission status: Wrong Answer

Solution code:
n,m,k = map(int, input().split())
ans = "No"
for a in range(m):
  for b in range(n):
    if a*(m-b)+b*(n-a)==k: ans = "Yes"
print(ans)

Submission status: Wrong Answer

Solution code:
n,m,k = map(int, input().split())
ans = "No"
for a in range(n):
  for b in range(m):
    if a*(m-b)+b*(n-a)==k: ans = "Yes"
print(ans)

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

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
ok = False
for i in range(n+1):
    for j in range(m+1):
        if k == (n*i + m*j) - 2*i*j:
            ok = True

if ok:
    print('Yes')
else:
    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*(n-j)+ j*(m-i) == k:
      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 n*m - (n-i)*(m-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*m - (n-i)*(m-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):

    if (n-2*i) != 0 and (k-m*i) % (n-2*i) == 0:
        j = (k - m * i) // (n - 2 * i)
        if m*i + (n-2*i)*j == k and j <= m:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

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

for i in range(n):

    if (n-2*i) != 0 and (k-m*i) % (n-2*i) == 0:
        j = (k - m * i) // (n - 2 * i)
        if m*i + (n-2*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):

    if (n-2*i) != 0 and (k-m*i) % (n-2*i) == 0:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
# これ必要か？？？？？？？？？？
# -> 意味不明だが必要らしい...
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
for p in range(n):
    for q in range(m):
        if p * (n - q) + q * (m - p) == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
# これ必要か？？？？？？？？？？
# -> 意味不明だが必要らしい...
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
for p in range(1, n + 1):
    for q in range(1, m + 1):
        if p * (n - q) + q * (m - p) == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
# これ必要か？？？？？？？？？？
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
# どう考えても下のやつでカバーできるだろこれ
for p in range(n + 1):
    for q in range(m + 1):
        if p * (n - q) + q * (m - p) == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
if n == 1 or m == 1:
    print("Yes")
    exit()
# これ必要か？？？？？？？？？？
if (n == 2 or m == 2) and k % 2 == 0:
    print("Yes")
    exit()
if k % n == 0 or k % m == 0:
    print("Yes")
    exit()
# どう考えても下のやつでカバーできるだろこれ
for p in range(n + 1):
    for q in range(m + 1):
        if p * (n - q) + q * (m - p) == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import sys
import itertools
import math
import random


def retsu(m):
    global cnt
    for i in range(N):
        A[i][m] = ~A[i][m]
        if A[i][m] == -1:
            cnt += 1
        else:
            cnt -= 1


def tate(n):
    global cnt
    for i in range(M):
        A[n][i] = ~A[n][i]
        if A[n][i] == -1:
            cnt += 1
        else:
            cnt -= 1


N, M, K = [int(x) for x in stdin.readline().rstrip().split()]
if K % N == 0 or K % M == 0:
    print('Yes')
    sys.exit()
A = [[0 for i in range(M)]for k in range(N)]
# global cnt
ans = {}
for k in range(10):
    cnt = 0
    A = [[0 for i in range(M)]for k in range(N)]
    for i in range(random.randint(0, 1000)):
        retsu(random.randint(0, M-1))
        tate(random.randint(0, N-1))
    ans[cnt] = ans.get(cnt, 0)+1
if K in ans.keys():
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

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

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

    print("NO")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

ans = False
for i in range(1, n + 1):
    if ans:
        break
    for j in range(1, m + 1):
        if i * (m - j) + (n - i) * j == k:
            ans = True
            break

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = 10 ** 15

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

h, w, k= map(int, input().split())

if k%h==0 or k%w==0:
    print('Yes')
    exit()

for i in range(1,w):
    if w-i*2 != 0:
        if (k-i*h) % (w-i*2) == 0 and 0<(k-i*h) // (w-i*2)<=h:
            print('Yes')
            exit()

for i in range(1,h):
    if h-i*2 != 0:
        if (k-i*w) % (h-i*2) == 0 and 0<(k-i*w) // (h-i*2)<=h:
            print('Yes')
            exit()

print('No')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

h, w, k= map(int, input().split())


if k%h==0 or k%w==0:
    print('Yes')
    exit()

if w!=2:
    for i in range(1,w):
        if (k-i*h) % (w-2) == 0 and (k-i*h)>0:
            print('Yes')
            exit()

if h!=2:
    for i in range(1,h):
        if (k-i*w) % (h-2) == 0 and (k-i*w)>0:
            print('Yes')
            exit()

print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M, K = map(int, input().split(' '))


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


print('No')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M, K = map(int, input().split(' '))


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


print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m,k = [int(x) for x in input().split()]

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

print(ans)

Submission status: Wrong Answer

Solution code:
n,m,k = [int(x) for x in input().split()]

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

print(ans)

Submission status: Wrong Answer

Solution code:
n,m,k = [int(x) for x in input().split()]

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

print(ans)

Submission status: Wrong Answer

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

# B - fLIP
def is_success(n, m, k):
	black = 0

	for i in range(m):
		black += n
	
		for j in range(n):
			if j > 0:
				if i == 0:
					black += m
				else:
					black += m - 1
	
			if black == k:	
				return True

	return False


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

if is_success(n, m, k) or is_success(m, n, k):
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
# B - fLIP
def is_success():
	n, m, k = map(int, input().split())
	black = 0

	for i in range(m):
		black += n
	
		for j in range(n):
			if j > 0:
				if i == 0:
					black += m
				else:
					black += m - 1
	
			if black == k:	
				return True

	return False


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

Submission status: Wrong Answer

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

# B - fLIP
n, m, k = map(int, input().split())
black = 0

for i in range(m):
	black += n
	
	for j in range(n):
		if j > 0:
			if i == 0:
				black += m
			else:
				black += m - 1
	
		if black == k:
			print('Yes')
			sys.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:
D = [int(_) for _ in input().split()]

def solve(D):
    N = D[0]
    M = D[1]
    K = D[2]
    
    for l in range(N+1):
        for k in range(M+1):
            if M * k + N * l - 2 * k * l == K:
                return "Yes"

    return "No"

print(solve(D))

Submission status: Wrong Answer

Solution code:
D = [int(_) for _ in input().split()]

def solve(D):
    N = D[0]
    M = D[1]
    K = D[2]
    
    for l in range(N):
        for k in range(M):
            if M * k + N *l - 2 * k * l == K:
                return "Yes"

    return "No"

print(solve(D))

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()
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 * (n - j) + j *(m - i) == k:
			print("Yes")
			break
	else:
		continue
	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 * (n - j) + j *(m - i) == k:
			print("Yes")
			break
	else:
		continue
	break
else:
	print("No")

Submission status: Wrong Answer

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

for h in range(n+1):
    for w in range(m+1):
        c = h*(n-w) + w*(m-h)
        if c==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*(m-j)+m*(n-i) == k:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
# CODE FESTIVAL 2017 予選 A: B – fLIP
N, M, K = [int(s) for s in input().split()]

canDo = 'No'

for n in range(N):
    for m in range(M):
        if n * (M - m) + m * (N - n) == K:
            canDo = 'Yes'
            break

print(canDo)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# 2020/04/28
# CODE FESTIVAL 2017 qual - B

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

# Calc
ans = 'No'
eflg = False
for i in range(n):
    for j in range(m):
        pt = i * (m - j) + j * (n - i)
        if pt == k:
            ans = 'Yes'
            eflg = True
            break
    if eflg:
        break

# Output
print(ans)

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*(M-m) + (N-n)*m:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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