CF 103966G - Незваные гости

The problem statement is missing from your message, so I don’t have enough information to reconstruct the task or derive a correct solution.

CF 103966G - \u041d\u0435\u0437\u0432\u0430\u043d\u044b\u0435 \u0433\u043e\u0441\u0442\u0438

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

Solution

The problem statement is missing from your message, so I don’t have enough information to reconstruct the task or derive a correct solution.

“Codeforces 103966G - Незваные гости” isn’t something I can safely infer from title alone, and writing a full editorial without the actual rules, input/output definition, and constraints would risk inventing the wrong problem.

Paste the full statement (or at least the input format, output format, and constraints), and I’ll produce a complete Codeforces-style editorial in the format you specified.