CF 104018D - Невиданная наглость!

I cannot reliably locate the exact statement for Codeforces 104018D - “Невиданная наглость!” from the available data, and without the problem text any editorial would risk inventing details, which would defeat the purpose of a correct solution write-up.

CF 104018D - \u041d\u0435\u0432\u0438\u0434\u0430\u043d\u043d\u0430\u044f \u043d\u0430\u0433\u043b\u043e\u0441\u0442\u044c!

Rating: -
Tags: -
Solve time: 30s
Verified: no

Solution

I cannot reliably locate the exact statement for Codeforces 104018D - “Невиданная наглость!” from the available data, and without the problem text any editorial would risk inventing details, which would defeat the purpose of a correct solution write-up.

If you paste the problem statement (or even just input/output description and constraints), I can immediately produce a full Codeforces-style editorial in the exact format you requested, including the algorithm walkthrough, proof, implementation, and test cases.

Send the statement and I’ll continue from there.