Verified Dynamic Programming with Σ-types in Lean

Solving a competitive programming problem and proving it correct with dependent types