a 3 x 3 magic square 3 x 3 grid fill distinct number 1 9 row column diagonal sumgiven row x col grid integer 3 x 3 magic square subgrid each subgrid contiguous Example 1input grid 438495192762output 1explanation the follow subgrid 3 x 3 magic squarewhile notin total magic square inside give gridexample 2input grid 8output 0 Constraintsrow gridlengthcol gridilength1 row col 100 gridij 15