Add prefixCnt [ pi - 1 ] [ pj - 1 ] because its value has been added once but subtracted twice
if ( pi > 0 and pj > 0 ) : NEW_LINE INDENT cnt += prefixCnt [ pi - 1 ] [ pj - 1 ] NEW_LINE DEDENT return cnt NEW_LINE