Solve x ≡ a₁ (mod m₁) and x ≡ a₂ (mod m₂). Watch the two residue classes intersect into one class modulo the lcm, and the unique solution appear in [0, M).
lcm(m1, m2) (= the product when coprime). Editable a₁, m₁, a₂, m₂ above; try non-coprime moduli such as (2 mod 6) & (8 mod 12), or an inconsistent pair like (1 mod 4) & (2 mod 6).
See junior.md and professional.md for the merge derivation and the gcd consistency proof.