CodeForces 1281 C. Cut and Paste

NoSuchKey