{"problem":{"name":"Blocks on Grid","description":{"content":"We have a grid with $H$ horizontal rows and $W$ vertical columns. The square at the $i$\\-th row from the top and $j$\\-th column from the left has $A_{i, j}$ blocks stacked on it. At least how many blo","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc186_b"},"statements":[{"statement_type":"Markdown","content":"We have a grid with $H$ horizontal rows and $W$ vertical columns. The square at the $i$\\-th row from the top and $j$\\-th column from the left has $A_{i, j}$ blocks stacked on it.\nAt least how many blocks must be removed to make all squares have the same number of blocks?\n\n## Constraints\n\n*   $1 \\leq H,W \\leq 100$\n*   $0\\leq A_{i,j} \\leq 100$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$\n$A_{1,1}$ $A_{1,2}$ $\\ldots$ $A_{1,W}$\n$\\vdots$\n$A_{H,1}$ $A_{H,2}$ $\\ldots$ $A_{H,W}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc186_b","tags":[],"sample_group":[["2 3\n2 2 3\n3 2 2","2\n\nRemoving $1$ block from the top-right square and $1$ from the bottom-left square makes all squares have $2$ blocks."],["3 3\n99 99 99\n99 0 99\n99 99 99","792"],["3 2\n4 4\n4 4\n4 4","0"]],"created_at":"2026-03-03 11:01:14"}}