Since usually there's no editorial for this contest (already on Gym), I wrote explanations to my team's (thank you leoanjos and gabmei) solutions during the official mirror/bracket that retired people can participate, they're available at https://github.com/tfg50/competitive-programming-tutorials/blob/main/ICPC/Latin%20america/2025%20Brazil%20First%20Phase/editorial.pdf. Solutions have been posted on the same repository. Feel free to share your opinions on the problems, ask questions, and perhaps comment on some of the alternative solutions that I didn't mention or explain.








Auto comment: topic has been updated by tfg (previous revision, new revision, compare).
Thanks for the editorial!
Could you clarify what you mean here:
I've seen the solution that claims there are at most sqrt different modulos (since their sum is N), so you can compare the ones with the same modulo and just check each pair of modulos. Not sure if you're saying the same thing.
Break
$$$x \equiv c_i \mod P_i$$$
into
$$$x \equiv (c_i \% d) \mod d$$$
for every d divisor of $$$P_i$$$. Then every $$$c_i \% d$$$ must be equal for congruences with the same d. You can iterate through divisors of $$$P_i$$$ by just iterating through every $$$x \in [1, P_i]$$$ since $$$\sum P_i \leq N$$$