Codeforces Round 990 (Div. 1) B. Move Back at a Cost Hints: Move Back at a Cost Code: Move Back at a Cost