Resets dp values before computing derivatives