Codeforces Round #553 (Div. 2)D. Stas and the Queue at the Buffet

NoSuchKey