cf 255 div2 C - dp , missed corner cases