Codeforces Round #287 (Div. 2)B. Amr and Pins

NoSuchKey