Driver code
int main ( ) { n = 4 ; m = 4 ; X = 6 ; vector < vector < int > > grid = { { 3 , 2 , 6 , 1 } , { 1 , 9 , 2 , 4 } , { 4 , 1 , 3 , 9 } , { 3 , 8 , 2 , 1 } } ; int ans = maxSum ( grid ) ; cout << ( ans ) ; return 0 ; }