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:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def sum_xor_bits(a, b):
    sum = 0
    for bita in a:
        for bitb in b:
            sum += bita ^ bitb
    return sum


def to_bit_list(n, bits):
    result = list()
    for bit in range(bits):
        result.append((n & (1 << bit)) >> bit)
    return result


def to_consecutive_ones(bits):
    result = 0
    for _ in range(bits):
        result <<= 1
        result += 1
    return result


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

    found = False
    for n in range(N + 1):
        for m in range(M + 1):
            n_bit_list = to_bit_list(n, N)
            m_bit_list = to_bit_list(m, M)
            if (sum_xor_bits(n_bit_list, m_bit_list) == K):
                found = True
                break

    if found:
        print("Yes")
    else:
        print("No")
    return


main()

Submission status: Wrong Answer

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

    ans = "No"
    for km in range(0, N + 1):
        for kn in range(0, M + 1):
            # print(M * kn + N * km - (km * kn))
            if M * kn + N * km - 2 * (km * kn) == K:
                ans = "Yes"

    print(ans)

Submission status: Wrong Answer

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


def judge(n, m, k):
    t = n * m
    d = n * m // 2
    return k % n == 0 or m % n == 0 or k == d or k == t - d


def main():
    n, m, k = (int(x) for x in input().split())
    print("Yes" if judge(n, m, k) else "No")


if __name__ == '__main__':
    main()

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):
        # print(i, j, i * N + j * M - 2 * i * j)
        if i * N + j * M - 2 * i * j == K or (N * M) - (i * N + j * M - 2 * i * j) == K:
            print('Yes')
            sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
s = []
if a[0] <= a[1]:
	small = a[0]
	big = a[1]
else:
	small = a[1]
	big = a[0]
s.append(a[0] * a[1] - 1)

for i in range(1,small + 1):
	s.append(s[i-1] + s[0] - (2 * i) * 2)
if a[2] in s:
	print('Yes')
else:
	print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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


def run():
    if is_0() or is_all():
        result_ok()
        return 0
    if is_ok():
        result_ok()
        return 0
    result_no()


def is_0():
    return K == 0


def is_all():
    return K == N * M


def is_ok():
    if N % 2 == 0:
        return K == N * M / 2
    else:
        a = N * M / 2
        return K >= a and K <= a + M


def result_ok():
    print("Yes")


def result_no():
    print("No")


if __name__ == '__main__':
    run()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
def get_ln_inputs():
    return input().split()


def get_ln_int_inputs():
    return list(map(int, get_ln_inputs()))


def sum_xor_bits(a, b):
    sum = 0
    for bita in a:
        for bitb in b:
            sum += bita ^ bitb
    return sum


def to_bit_list(n, bits):
    result = list()
    for bit in range(bits):
        result.append((n & (1 << bit)) >> bit)
    return result


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

    found = False
    for n in range((1 << N) - 1):
        for m in range((1 << M) - 1):
            n_bit_list = to_bit_list(n, N)
            m_bit_list = to_bit_list(m, M)
            if (sum_xor_bits(n_bit_list, m_bit_list) == K):
                found = True
                break

    if found:
        print("Yes")
    else:
        print("No")
    return


main()

Submission status: Wrong Answer

Solution code:
N, M, K = map(int, 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())

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

print('No')

Submission status: Wrong Answer

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

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

print('No')

Submission status: Wrong Answer

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

def search(n, m, k):
    flag = False
    for n_rows in range(n):
        if flag:
            break
        for n_cols in range(m):
            blacks = n_rows * m + n_cols * n - 2*n_rows * n_cols
            if blacks == k:
                flag = True
                break
    return flag
if search(n, m, k):
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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


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


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

Submission status: Wrong Answer

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

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

print 'No'

Submission status: Wrong Answer

Solution code:
print('Yes')

Submission status: Wrong Answer

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

count = 0
flag = False
while True:
    num = K - N * count
    count += 1
    if num < 0:
        break
    elif num % M == 0:
        flag = True
        break

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

Submission status: Wrong Answer

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

def f(N,M,K):
    for i in range(1,N):
        for j in range(1,M):
            if i*(M-j)+j*(N-i)==K:
                return "Yes"
    return "No"

print(f(N,M,K))

Submission status: Wrong Answer

Solution code:
yes = "Yes"
no = "No"

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

ans = no
for y in range(N+1):
    for x in range(M+1):
        if N*M - (N-y) * (M-x) == K:
            ans = yes
            break
print(ans)

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 - 2 * i * j == K:
            print('Yes')
            sys.exit()

print('No')

Submission status: Wrong Answer

Solution code:
#!usr/bim/python
#! -*- coding: utf-8 -*-

nmk = raw_input()
nmk = nmk.split()
n,m,k = map(int,nmk)

status = 0

for i in range(m):
    for j in range(n):
        if n*i + m*j - 2*i*j == k:
            status = 1
            break

if status == 0:
    print "No"
else:
    print "Yes"

Submission status: Wrong Answer

Solution code:
def solve(n, m, k):
    for i in range(n):
        for j in range(m):
            if i * j + (n - i) * (m - j) == k:
                return 'Yes'
    return 'No'


print(solve(*map(int, input().split())))

Submission status: Wrong Answer

Solution code:
from math import *


def main():
        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')
                                return
        print('No')
        

if __name__ == '__main__':
        main()

Submission status: Wrong Answer

Solution code:
yes = "Yes"
no = "No"

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

ans = no
for y in range(N+1):
    for x in range(M+1):
        if N*M - (N-y) * (M-x) == K:
            ans = yes
print(ans)

Submission status: Wrong Answer

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

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


print("Yes" if check() else "No")

Submission status: Wrong Answer

Solution code:
n,m,k=[int(x) for x in input().split()]
from itertools import product
from sys import exit
for i,j in product(range(n),range(m)):
    if i*m+j*(n-i)==k:
        print("Yes")
        exit()
print("No")

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
f=False
for i in range(0,c//a+1):
	for j in range(0,c//b+1):
		if((i*a+j*b==c) or (i*a+j*b==a*b-c)):
			f=True
			break
		#else:print("{}*{}+{}*{}={}".format(i,a,j,b,i*a+j*b))
print("Yes" if f else "No")

Submission status: Wrong Answer

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

def f():
    for i in range(N+1):
        for j in range(M+1):

            nn = j
            mm = i
            if mm*M + nn*N - mm*nn == K:
                return "Yes"
    return "No"

print f()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
f=False
for i in range(0,c//a+1):
	for j in range(0,c//b+1):
		if(i*a+j*b==c):
			f=True
			break
		#else:print("{}*{}+{}*{}={}".format(i,a,j,b,i*a+j*b))
print("Yes" if f else "No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# def makelist(n, m):
#     return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()

yes = "Yes"
no = "No"

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

ans = no
for y in range(N+1):
    for x in range(M+1):
        if y * x == K:
            ans = yes
print(ans)

Submission status: Wrong Answer

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

for i in xrange(n):
    for j in xrange(m):
        if i*n + j*m - 2*i*j == 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):
    for j in range(m):
        if i * (m - j) + j * (n - i) == k:
            ans = "Yes"
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
N,M,K=map(int,input().split())
a=gcd(N,M)
if K%a==0: print("Yes")
else: print("No")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import division, print_function
import sys


def main():
    n, m, k = map(int, sys.stdin.readline().strip().split(" "))
    print("Yes" if n * m % 2 == k % 2 else "No")


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

def is_able(n, m):
    res = [0]
    for i in range(1, n+1):
        for j in range(1, m+1):
            count = 0
            count += i*j
            count += (n-i)*(m-j)
            if count not in res:
                res.append(count)
    return res


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

Submission status: Time Limit Exceeded

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

A = [[0 for i in range(M)]for k in range(N)]
# global cnt
ans = {}
for k in range(1000):
    cnt = 0
    A = [[0 for i in range(M)]for k in range(N)]
    for i in range(random.randint(0, 30)):
        retsu(random.randint(0, M-1))
        tate(random.randint(0, N-1))
    ans[cnt] = ans.get(cnt, 0)+1

    cnt = 0
    A = [[0 for i in range(M)]for k in range(N)]
    for i in range(random.randint(0, 30)):
        # retsu(random.randint(0, M-1))
        tate(random.randint(0, N-1))
    ans[cnt] = ans.get(cnt, 0)+1

    cnt = 0
    A = [[0 for i in range(M)]for k in range(N)]
    for i in range(random.randint(0, 30)):
        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: Time Limit Exceeded

Solution code:
N,M,K = map(int, input().split())
field = [[0]*M for i in range(N)]
def reverse(x):
    if x == 0:
        return 1
    else:
        return 0
now = 0
for i in range(N+1):
    if N - 2 * i ==0:
        for j in range(M):
            field[i][j] = reverse(field[i][j])
            now = sum(map(sum,field))
    elif (K - now) % (N - 2 * i) == 0 and (K - now) / (N - 2 * i) <= M and  (K - now) / (N - 2 * i) >= 0:
        print("Yes")
        exit(0)
    elif i == N:
        print("No")
        exit(0)
    else:
        for j in range(M):
            field[i][j] = reverse(field[i][j])
            now = sum(map(sum,field))

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

inlist = input().split()
n = int(inlist[0])
m = int(inlist[1])
k = int(inlist[2])
mat = [[1 for i in range(m)] for j in range(n)]

def initialize(i, j, matrix):
    for k in range(i):
        for l in range(j):
            matrix[k][l] = 1
    return matrix

def sum_mat(i, j, matrix):
    sum = 0
    for k in range(i):
        for l in range(j):
            sum = sum + matrix[k][l]
    return sum

escape = False

for l in range(n + 1): #l = 0 -> n
    mat = initialize(n, m, mat)
    for i in range(l):
        for j in range(m):
            mat[i][j] = -mat[i][j]
    mat_save = mat
    for p in range(m + 1): # p = 0 -> m
        mat = mat_save
        for j in range(p):
            for i in range(n):
                mat[i][j] = -mat[i][j]
        sum = sum_mat(n, m, mat)
        if(sum == n * m - 2 * k):
            print("Yes")
            escape = True
            break;
        elif(l == n and p == m):
            print("No")
    if(escape):
        break;

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import sys
sys.setrecursionlimit(10 ** 9)

from collections import defaultdict

def ILI(): return list(map(int, input().split()))


N, M, K = ILI()

memo = defaultdict(lambda : None)

def solve(n_count=0, m_count=0, now=0):
    if n_count == N and m_count == M:
        ret_set = set()
        ret_set.add(now)
        return ret_set
    if n_count == N:
        if memo[(n_count, m_count, now)] is None:
            ret = solve(n_count, m_count + 1, now + (N - 2 * n_count))
            ret.add(now)
            memo[(n_count, m_count, now)] = ret
            return ret
        else:
            return memo[(n_count, m_count, now)]
    if m_count == M:
        if memo[(n_count, m_count, now)] is None:
            ret = solve(n_count + 1, m_count, now + (M - 2 * m_count))
            ret.add(now)
            memo[(n_count, m_count, now)] = ret
            return ret
        else:
            return memo[(n_count, m_count, now)]
    if memo[(n_count, m_count, now)] is None:
        ret_1 = solve(n_count + 1, m_count, now + (M - 2 * m_count))
        ret_2 = solve(n_count, m_count + 1, now + (N - 2 * n_count))
        ret = ret_1 | ret_2
        ret.add(now)
        memo[(n_count, m_count, now)] = ret
        return ret
    else:
        return memo[(n_count, m_count, now)]

can_draw = solve()

if K in can_draw:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
import sys
sys.setrecursionlimit(10 ** 9)

def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    N, M, K = ILI()
    return N, M, K


def solve(N, M, K):
    def draw(n_count=0, m_count=0, now=0):
        if n_count == N and m_count == M:
            ret_set = set()
            ret_set.add(now)
            return ret_set
        if n_count == N:
            ret = draw(n_count, m_count + 1, now + (N - 2 * n_count))
            ret.add(now)
            return ret
        if m_count == M:
            ret = draw(n_count + 1, m_count, now + (M - 2 * m_count))
            ret.add(now)
            return ret
        ret_1 = draw(n_count + 1, m_count, now + (M - 2 * m_count))
        ret_2 = draw(n_count, m_count + 1, now + (N - 2 * n_count))
        ret = ret_1 | ret_2
        ret.add(now)
        return ret

    can_draw = draw()
    if K in can_draw:
        ans = "Yes"
    else:
        ans = "No"
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
data = raw_input().split()
n, m, k = map(int, data)
prob = []
for i in range(n+1):
    for j in range(m+1):
        d = np.zeros([n, m])
        d[:i,:] = 1
        d[:, :j] += 1
        d %= 2
        prob.append(int(d.sum()))
if k in prob:
    print 'Yes'
else:
    print 'No'

Submission status: Accepted

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

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

Submission status: Accepted

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 - 2*h*w == K:
      print('Yes')
      exit()
print('No')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# B - fLIP
N, M, K = map(int, input().split())

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

print('No')

Submission status: Accepted

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

Submission status: Accepted

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

print("No")

Submission status: Accepted

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

for row in range(n+1):
    for col in range(m+1):
        if row * m + col * n - 2 * (row * col) == k:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

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

def hantei(n,m,k):
    for i in range(n+1):
        for j in range(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: Accepted

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

#import
#import math
#import numpy as np
N, M, K = map(int, input().split())

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

print("No")

Submission status: Accepted

Solution code:
N, M, K = map(int, input().split())
f = 0
for i in range(0, N+1):
  if N == 2 * i:
    if K == i * M:
      print("Yes")
      f = 1
      break
  elif (K - i * M) % (N - 2 * i) == 0 and 0 <= (K - i * M) // (N - 2 * i) <= M:
    print("Yes")
    f = 1
    break
if f == 0:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print('No')

Submission status: Accepted

Solution code:
def main():
    # n行分・m列分ボタンを押すと
    # n(M - m) + m(N - n) = nM + Nm - 2mn マスが黒くなる
    N, M, K = map(int, input().split())
    for n in range(N + 1):
        for m in range(M + 1):
            black = n * (M - m) + (N - n) * m
            if black == K:
                print('Yes')
                return
    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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+1):
        for l in range(M+1):
            if k*(M-l)+(N-k)*l == K:
                print('Yes')
                return

    print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

print(solve())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

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

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

Submission status: Accepted

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

Submission status: Accepted

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):
        unit = n-2*i

        if unit == 0:
            if k == i*m:
                print("Yes")
                break
        else:
            j = (k-i*m)//(n-2*i)
            jr = (k-i*m)%(n-2*i)

            if 0 <= j <= m and jr == 0:
                print("Yes")
                break
    else:
        print("No")
main()

Submission status: Accepted

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n,m,k = I()

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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)+(N-i)*j==K:
        print("Yes")
        return
  print("No")
  return
main()

Submission status: Accepted

Solution code:
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n,m,k=nii()

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

print('No')

Submission status: Accepted

Solution code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,M,K = MI()
a = sum(K == i*(M-j)+j*(N-i) for i in range(N+1) for j in range(M+1))
print('Yes' if a != 0 else 'No')

Submission status: Accepted

Solution code:
def main():
    N,M,K = map(int,input().split())
    if K == 0 or K == N*M:
        return ('Yes')
    ans_dict = {}
    ans_dict[K] = False
    for i in range(N):
        for j in range(M+1):
            ans_dict[i*M + (N-i-i)*j] = True
    if ans_dict[K] == True:
        return('Yes')
    else:
        return('No')

print(main())

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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*2)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,M,K = MI()

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

Submission status: Accepted

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

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