Codeforces Round 221, task D receives runtime error