Function to find the number of ways to cut the matrix into the K parts such that each part have atleast one filled cell
static int ways ( int [ , ] arr , int K ) { int R = arr . GetLength ( 0 ) ; int C = arr . GetLength ( 1 ) ; int [ , ] preSum = new int [ R , C ] ;