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

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

for a in range(n):
	if n-2*a == 0:
		continue
	b = ((k-a*m))/(n-2*a)
	if (b >= 0) and (b <= m) and (b%1 == 0):
		print("YES")
		sys.exit()

print("NO")

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M, K = (int(i) for i in input().split())
    ans = set()
    for i in range(N+1):
        for j in range(M+1):
            ans.add(N*i + max(0, (M-i))*j - i*j)
    if K in ans:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
ans = 'No'
flag = False
for x in range(M+1):
    if flag:
        break
    for y in range(N+1):
        if (M-y)*x+(N-x)*y == K:
            ans = 'Yes'
            flag = True
            break
print(ans)

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
ans = 'No'
flag = False
for x in range(M+1):
    if flag:
        break
    for y in range(N+1):
        if (M-y)*x+(M-x)*y == K:
            ans = 'Yes'
            flag = True
            break
print(ans)

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
if K%N == 0 or K%M == 0:
    print('Yes')
else:
    ans = 'No'
    i = 0
    while K - M*i >= 0:
        if (K-M*i)%N == 0:
            ans = 'Yes'
            break
        i+= 1
    print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import bisect
import collections
import itertools
import heapq
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return math.gcd #最大公約数
def lcm(a,b):return (a*b) // math.gcd(a,b) #最小公倍数
def iin(): return int(input()) #整数読み込み
def isn(): return input().split() #文字列読み込み
def imn(): return map(int, input().split()) #整数map取得
def iln(): return list(map(int, input().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def 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)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N,M,K = imn()

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

Submission status: Wrong Answer

Solution code:
# 横の回数をx, 縦の回数をyとすると k=x*(M-2)+y*(N-2)になればいい
# あとは例外 N or M==1のときはK<=N*Mからすべての値が可能
# N or M==2のときはすべての偶数が可能
# KがNorMで割り切れれば可能
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 y in range(1, n + 1):
    for x in range(1, m + 1):
        if k == x * (m - 2) + y * (n - 2):
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
flag = 0
if (N*M)%2==0 and K==(N*M)//2:
    flag = 1
else:
    y = 0
    while y<=N:
        if N-2*y!=0 and (K-M*y)%(N-2*y)==0 and M>=(K-M*y)//(N-2*y)>=0:
            print("x={},y={}".format((K-M*y)//(N-2*y),y))
            flag = 1
            break
        y += 1
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
flag = 0
if (N*M)%2==0 and K==(N*M)//2:
    flag = 1
else:
    y = 0
    while y<=N:
        if N-2*y!=0 and (K-M*y)%(N-2*y)==0 and (K-M*y)//(N-2*y)>=0:
            flag = 1
            break
        y += 1
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
flag = 0
if (N*M)%2==0 and K==(N*M)//2:
    flag = 1
else:
    y = 0
    while y<=N:
        if N-2*y>0 and (K-M*y)%(N-2*y)==0 and (K-M*y)//(N-2*y)>=0:
            x = (K-M*y)//(N-2*y)
            flag = 1
            break
        y += 1
if flag==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
flag = 0
y = 0
while y<=N:
    if N-2*y>0 and (K-M*y)%(N-2*y)==0 and (K-M*y)//(N-2*y)>=0:
        x = (K-M*y)//(N-2*y)
        flag = 1
        break
    elif N%2==0 and y==N//2 and K==M*y:
        flag = 1
        break
    y += 1
if flag==1:
    print("Yes")
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 and j:
            ans = i * m + j * n - (i * j * 2)
        elif i > 0 and j == 0:
            ans = i * m
        elif i == 0 and j > 0:
            ans = j * n
        else:
            ans = 0
        if ans == k:
            print('Yes')
            exit()

print('No')

Submission status: Wrong Answer

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

if K % M == 0 or K % N == 0:
    print('Yes')
    exit()

for i in range(N + 1):
    k = K - M * i
    n = N - 2 * i
    if n <= 0 or k < 0:
        continue
    if k % n == 0:
        print('Yes')
        exit()
else:
    print('No')

Submission status: Wrong Answer

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

if K % M == 0:
    print('Yes')
    exit()

for i in range(N + 1):
    k = K - M * i
    n = N - 2 * i
    if n == 0:
        print('Yes')
        exit()
    if n < 0 or k < 0:
        continue
    if k % n == 0:
        print('Yes')
        exit()
else:
    print('No')

Submission status: Wrong Answer

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

if K % M == 0:
    print('Yes')
    exit()

for i in range(N + 1):
    k = K - M * i
    n = N - 2 * i
    if n <= 0 or k < 0:
        continue
    if k % n == 0:
        print('Yes')
        exit()
else:
    print('No')

Submission status: Wrong Answer

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

if K % M == 0:
    print('Yes')
    exit()

for i in range(N + 1):
    k = K - M * i
    n = N - 2 * i
    if n <= 0 or k < 0:
        continue
    if k % n == 0:
        print('Yes')
        print(i, k // n)
        exit()
else:
    print('No')

Submission status: Wrong Answer

Solution code:
def main():
    N, M, K = list(map(int, input().split()))
    ans = False
    for i in range(N):
        for j in range(M):
            x = i * M + j * N - (i * j) * 2
            # print(i, j, x)
            if x == K:
               ans = True 
    if ans:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

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):
        tmp = i * (N - j) + j * (M - i)
        if tmp == K:
            ans = 'Yes'
            break

print(ans)

Submission status: Wrong Answer

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

print(ans)

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):
        tmp=(M-l)*k+(N-k)*l
        if tmp==K:
            print("Yes")
            exit()

print("No")

Submission status: Wrong Answer

Solution code:
N,M,K = map(int,input().split())
ans = False
for p in range(N+1):
    for q in range(M+1):
        if p*M+q*N - p*q == K or p*M+q*N - p*q == M*N-K:
            ans = True
if ans:print("Yes")
else:print("No")

Submission status: Wrong Answer

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

flg=False
for x in range(N):
    for y in range(M):
        temp = (N-y)*(M-x) + (x*y)
        if K==temp:
            flg=True
            break
if flg:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

flg=False
for x in range(N):
    for y in range(M):
        temp = (N-x)*(M-y) + (x*y)
        if K==temp:
            flg=True
            break
if flg:
    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):
        if i*n+j*m-2*i*j==k:
            print('Yes')
            exit()
print('No')

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    n, m, k = map(int, input().split())

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

print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m,k=[int(i) for i in input().split()]
if k%n==0 or k%m==0 or k%(n+m)==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, input().split())  # N行, M列, K個黒くしたい

flag = False

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

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

Submission status: Wrong Answer

Solution code:
#総当たりできる
n,m,k = map(int, input().split( ))

ans = set()
for i in range(n+1):
    for j in range(m+1):
        ans.add(i*j+(n-i)*(n-j))
if k in ans:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, K = map(int, input().split())
for h in range(H//2):
    w = (K-W*h)/(H-2*h)
    if int(w) == w and 0 <= w <= W:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, K = map(int, input().split())
for h in range(H//2+1):
    w = (K-W*h)/(H-2*h)
    if int(w) == w and 0 <= w <= W:
        print("Yes")
    exit()
print("No")

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, K = map(int, input().split())
if K % W == 0:
    print("Yes")
    exit()
else:
    for h in range(H//2+1):
        w = (K-W*h)/(H-2*h)
        if int(w) == w and 0 <= w <= W:
            print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

H, W, K = map(int, input().split())
if K % W == 0:
    print("Yes")
    exit()
else:
    for h in range(H//2):
        w = (K-W*h)/(H-2*h)
        if int(w) == w and 0 <= w <= W:
            print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
H,W,K=map(int,input().split())
for h in range(H+1):
  for w in range(W+1):
    if (W-w)*h+(H-h)*w==K:
      print("Yes")
      break
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n, m, k = map(int, input().split())
set_num = set([])
for n_i in range(n):
    for m_i in range(m):
        set_num.add((n_i * m) + (m_i * n) - ((n_i * m_i) * 2))
if k in set_num:
    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*(m-j)+(n-i)*j==k:
            break
    else:
        continue
    break
else:
    print('No')
    exit()
print('Yes')

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:
            break
    else:
        continue
    break
else:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
N,M,K = [int(x) for x in stdin.readline().rstrip().split()]
flag = False
for a in range(N+1):
    for b in range(M+1):
        if a*N + b*M - a*b == K:
            flag = True
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
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()
print("No")

Submission status: Wrong Answer

Solution code:
def resolve():
    n, m, k = map(int, input().split())
    for l in range(1, n + 1):
        for r in range(1, m + 1):
            black = l * m + r * n - 2 * r * l
            if black == k:
                print("Yes")
                return 0
    print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m,k = inpl()
bla = 0
for i in range(n+1):
    bla = i*m
    for j in range(m-1):
        if bla + (n-2*i) * j == k:
            print('Yes')
            quit()
print('No')

Submission status: Wrong Answer

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

for y in range(N+1):
    for t in range(M+1):
        if t*(M-y)+y*(N-t)==K:
            print "Yes"
            quit()
else:
    print "No"

Submission status: Wrong Answer

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


if K == 0 :
    print('Yes')
    exit()

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

Submission status: Wrong Answer

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


if K == 0 :
    print('Yes')
    exit()

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/
#
# lang: Python3 (3.4.3)

import math
import statistics
import numpy as np
import queue

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(0)
print('No')

Submission status: Wrong Answer

Solution code:
n,m,k = map(int,input().split())
a = set()
for i in range(n+1):
  for j in range(m+1):
    a.add(m*i+n*j-i*j)
print('YNeos'[k not in a::2])

Submission status: Wrong Answer

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

sum = 0

for a in range(0,n +1 ):  # 行の操作回数
  for b in range(0,m + 1): # 列の操作回数
    sum = ( n - b) * a + (m - a ) * b
    if sum == k:
 #     print(sum,"_",a,"_",b)
      print("Yes")
      exit()
 
print("No") #Yesが出ない時に出力

Submission status: Wrong Answer

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

sum = 0

for a in range(n +1 ):  # 行の操作回数
  for b in range(m + 1): # 列の操作回数
    sum = ( n - b) * a + (m - a ) * b
    if sum == k:
 #     print(sum,"_",a,"_",b)
      print("Yes")
      exit()
 
print("No") #Yesが出ない時に出力

Submission status: Wrong Answer

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

sum = 0

for a in range(n +1 ):  # 行の操作回数
  for b in range(m + 1): # 列の操作回数
    sum = ( n - b) * a + (m -a ) * b
    if sum == k:
 #     print(sum,"_",a,"_",b)
      print("Yes")
      break
  else: # sum == kが一致しないときは継続
    continue
  exit() # Yesが出たらプラグラム終了
 
print("No") #Yesが出ない時に出力

Submission status: Wrong Answer

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

sum = 0

for a in range(n):  # 行の操作回数
  for b in range(m): # 列の操作回数
    sum = ( n - b) * a + (m -a ) * b
    if sum == k:
 #     print(sum,"_",a,"_",b)
      print("Yes")
      break
  else: # sum == kが一致しないときは継続
    continue
  exit() # Yesが出たらプラグラム終了
 
print("No") #Yesが出ない時に出力

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
#cnt=nn**m+mm*n-mm*nn
for nn in range(n):
	for mm in range(m):
		if nn*m+mm*n-mm*nn==k:
			print("Yes")
			exit()
print("No")

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    N, M, K = map(int, input().split())

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

    print("No")

Submission status: Wrong Answer

Solution code:
if __name__ == "__main__":
    N, M, K = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
n,m,k=map(int,input().split())
import fractions
x=fractions.gcd(n,m)
if k%x==0:
	print("Yes")
else:
	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")
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):
        colors = i*m - i*j + j*abs(n-j)
        if colors == k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

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

OK = False

for a in range(N+1):
    for b in range(M+1):
        if(a*(N-b) + b*(M-a)==K):OK =True


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

Submission status: Wrong Answer

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

if K==0:
    print("Yes")
    exit()
if N==1 or M==1:
    print("Yes")
    exit()
for i in range(1,N+1):
    for j in range(1,M+1):
        if K==M*i+N*j-2*(i*j):
            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 i in range(1,N+1):
    for j in range(1,M+1):
        if K==M*i+N*j-2*(i*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 K==M*i+N*j-2*(i*j):
            print("Yes")
            exit()

print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print("No")

Submission status: Wrong Answer

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

if N * M == K:
    print('Yes')
    exit()

for i in range(N):
    for j in range(M):
        print('---')
        print('i：'+str(i))
        print('j：'+str(j))
        print('(N-i)*j：'+str((N-i)*j))
        print('(M-j)*i：'+str((M-j)*i))
        print('目標：'+str(K))
        print('合計：'+str((N-i)*j+(M-j)*i))
        if (N-i)*j+(M-j)*i == K:
            print('Yes')
            exit()
        elif (N-i)*j+(M-j)*i > K:
            break

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-i)*j+(M-j)*i == K:
            print('Yes')
            exit()
        elif (N-i)*j+(M-j)*i > K:
            break

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):
        tmp=N*j+M*i-2*i*j
        print(i,j,tmp)
        if tmp==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):
        tmp=N*j+M*i-i*j
        if tmp==k:
            print("Yes")
            exit()
print("No")

Submission status: Wrong Answer

Solution code:
def main():

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

    return "No"

if __name__ == '__main__':
    print(main())

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

Submission status: Wrong Answer

Solution code:
N,M,K=map(int,input().split());print(" YNeos"[K in[i*j+(N-i)*(M-j)for i in range(N)for j in range(M)]::2])

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())
black_pattern=[]

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

Submission status: Wrong Answer

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

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m,k = LI()
for i in range(n):
    for j in range(m):
        if j*(n-i) + i*(m-j) == k:
            print('Yes')
            quit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def solve():
    for i in range(n+1):
        for j in range(m+1):
            if i*(n-j) + j*(m-i) == k:
                return True
    return False
                
print("Yes" if solve() else "No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

grid = {}

grid[n] = True
tmp = n
for i in range(m):
    tmp = (tmp-1) + (m-1)
    grid[tmp] = True

grid[m] = True
tmp = m
for i in range(n):
    tmp = (tmp-1) + (n+1)
    grid[tmp] = True

ans = grid.get(k, False)
print("Yes" if ans == True else "No")

Submission status: Wrong Answer

Solution code:
def solve(w, h, k):
    for y in range(1, h+1):
        if h == 2*y:
            continue
        x = (k - y*w) // (h - 2*y)
        if not (1 <= x <= w):
            continue
        s = x * (h-y) + (w-x) * y
        if s == k:
            return "Yes"
    return "No"

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