Initialize DP table : dp [ i ] [ j ] [ j ] i : current position / index j : number of used elements k : number of unused elements
vector < vector < vector < int > > > dp ( 101 , vector < vector < int > > ( 101 , vector < int > ( 101 , -1 ) ) ) ; return calculate ( 0 , 0 , N , P , M , dp ) ; }