codeforces; solve "Dreamoon and Stairs" from Round #272 (Div. 2)