I have to write program which is solving linear congruences withe the same modulo. I have system of congruences like that(only 2 unknowns x and y): $$\begin{cases} a_1x+b_1y \equiv c_1\pmod n \\ a_2x+b_2y \equiv c_2\pmod n \\ \end{cases} $$
I'm using Cramer's rule now and it works when the modulus is prime, but when modulus is not prime, my program behaves incorrectly.
This is not as simple as it may look. For example, there may be multiple solutions for even a single equation ($2x\equiv 0 \pmod 4$ has 2 solutions$\pmod 4$, for example). This breaks the nice theory one knows from the reals. That it works for primes $p$ is due to the fact that the the numbers you are working with also form a field, just like the reals.
It seems you have to go the hard way and
Again, this is probably at least a few days work, not a few hours. Maybe somebody else has a better idea, though.