A k-ary week
http://petr-mitrichev.blogspot.com/2017/02/a-k-ary-week.html
Codeforces Round 1137 Solution Discussion