Codeforces Round #565 (Div. 3)--D. Recover it!--思维+欧拉筛

NoSuchKey