Check if can cut horizontally at r1 , at least one apple in matrix ( r , c ) -> r1 , C - 1
if ( preSum [ r ] - preSum [ r1 ] > 0 ) dp [ k ] [ r ] += dp [ k - 1 ] [ r1 ] ; } for ( let c1 = c + 1 ; c1 < C ; c1 ++ ) {