Codeforces--C2. Good Numbers (hard version)

NoSuchKey