Function to preprcess input mat [ N ] [ M ] . This function mainly fills dp [ N ] [ M ] such that dp [ i ] [ j ] stores sum of elements from ( 0 , 0 ) to ( i , j )
void preProcess ( vector < vector < int > > & mat , vector < vector < int > > & dp , int n , int m ) {