Is this dead..?
https://mirror.codeforces.com/contest/1102/problem/C?locale=en
Codeforces Round 1096 Solution Discussion