cf Educational Codeforces Round 47 C. Annoying Present

NoSuchKey