Function to check if the given matrix satisfies the given condition or not
void checkGoodMatrix ( vector < vector < int > > mat ) { vector < int > P ; vector < int > S ; vector < int > MR ; vector < int > MC ;