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

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System; 
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq; 
using E = System.Linq.Enumerable; 
class Program {
    
    static void Main(string[] args) {
        
        var NMK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        
        var N = NMK[0];
        var M = NMK[1];
        var K = NMK[2];
        var res = "No";
        for(int i = 1;i <= N;i++){
            for(int j = 1;j <= M;j++){
                if(i*j+(N-i)*(M -j) == K){
                    res = "Yes";
                }
            }
        }
        Console.WriteLine(res);
     }
}
class Dijkstra { public int N { get; set; } public List<Edge>[] G { get; set; } public Dijkstra(int n) { this.N = n; this.G = new List<Edge>[N]; for (int i = 0; i < N; i++) { this.G[i] = new List<Edge>(); } } // a から b につながる辺を追加する
 public void Add(int a, int b, long cost = 1) { this.G[a].Add(new Edge(b, cost)); } // 単一始点の最短経路を求める 
 public long[] GetMinCost(int start) { // 最短経路(コスト)を格納しておく配列(すべての頂点の初期値をINFにしておく) 
 var cost = new long[N]; for (int i = 0; i < N; i++) cost[i] = long.MaxValue; cost[start] = 0; // 未確定の頂点を格納する優先度付きキュー(頂点とコストを格納) 
 var q = new PriorityQueue<P>(this.N, false); q.Enqueue(new P(start, 0)); // 未確定の頂点があればすべて確認する 
 while (q.Count > 0) { var p = q.Dequeue(); // すでに記録されているコストと異なる(より大きい)場合、無視する。 
 if (p.Cost != cost[p.A]) continue; // 取り出した頂点を確定する。
  // 確定した頂点から直接辺でつながる頂点をループ 
  foreach (var e in this.G[p.A]) {
       // すでに記録されているコストより小さいコストの場合
        if (cost[e.To] > p.Cost + e.Cost) { // コストを更新して、候補としてキューに入れる 
        cost[e.To] = p.Cost + e.Cost; q.Enqueue(new P(e.To, cost[e.To])); } } } return cost; } // 接続先の頂点とコストを格納する辺のデータ
         public struct Edge { public int To; public long Cost; public Edge(int to, long cost) { this.To = to; this.Cost = cost; } } // 頂点とその頂点までのコストを記録
          public struct P : IComparable<P> { public int A; public long Cost; public P(int a, long cost) { this.A = a; this.Cost = cost; } public int CompareTo(P other) { return this.Cost.CompareTo(other.Cost); } } }
             
class PriorityQueue<T> where T : IComparable<T> { public readonly T[] Array; public readonly bool Greater; public int Count { get; private set; } = 0; public PriorityQueue(int capacity, bool greater = true) { this.Array = new T[capacity]; this.Greater = greater; } public void Enqueue(T item) { this.Array[this.Count] = item; this.Count += 1; this.UpHeap(); } public T Dequeue() { // 先頭要素を末尾にして再構成
 this.Swap(0, this.Count - 1); this.Count -= 1; this.DownHeap(); return this.Array[this.Count]; } private void UpHeap() { var n = this.Count - 1; while (n != 0) { // 親要素の座標 
 var parent = (n - 1) / 2; if (this.Compare(this.Array[n], this.Array[parent]) > 0) { this.Swap(n, parent); n = parent; } else { break; } } } private void DownHeap() { var parent = 0; while (true) { var child = 2 * parent + 1; if (child > this.Count - 1) break; if (child < this.Count - 1 && this.Compare(this.Array[child], this.Array[child + 1]) < 0) { // 左より右の子のほうが大きい値の場合、右を入れ替え対象にする
  child += 1; } if (this.Compare(this.Array[parent], this.Array[child]) < 0) { this.Swap(parent, child); parent = child; } else { break; } } } private int Compare(T a, T b) { var c = a.CompareTo(b); if (!this.Greater) { c = -c; } return c; } private void Swap(int a, int b) { var tmp = this.Array[a]; this.Array[a] = this.Array[b]; this.Array[b] = tmp; } }