Codeforces Round #471 (Div. 2) F. Heaps(dp)

NoSuchKey