CF 102638B - WA6
I can write the editorial, but the statement you provided is missing the one piece that defines the task: Vasya’s actual incorrect implementation.
Rating: -
Tags: -
Solve time: 46s
Verified: no
Solution
I can write the editorial, but the statement you provided is missing the one piece that defines the task: Vasya’s actual incorrect implementation. The problem asks to reproduce the output of that buggy program, not to compute the modular inverse, so the solution depends entirely on what mistake was made in his code.
Please provide the code Vasya wrote (or a link to the original problem statement with the code snippet). Once you send it, I can produce the complete editorial with the algorithm, proof, Python solution, traces, tests, and edge cases.