Groups
Category
Modular arithmetic is about working with remainders, but programming languages often return negative remainders, so always normalize with (a % MOD + MOD) % MOD.
Systematic debugging beats guesswork: always re-read the statement, re-check constraints, and verify the output format before touching code.