Practice Contest
HARD
You can view the editorial here. Anton Lunyov provided an alternative explanation to this problem. You can view his version here.
Can be found here.