Solution (source code)

= Solution

Write $f=X^2+bX+c$ and $g=X^2+BX+C$. Since their common square-free <discriminant> $d$ is congruent to zero or one modulo four, it must be one modulo four; thus $b,B$ are odd. It is not a rational square because a square-free integer square is only zero or one. Both <polynomials> are irreducible over $\mathbb Q$, and their roots generate the same <quadratic extension> $\mathbb Q(\sqrt d)$. Their integral roots are $(-b+\sqrt d)/2$ and $(-B+\sqrt d)/2$, respectively. Each generated order is
$$
\mathbb Z\left[\frac{1+\sqrt d}{2}\right]=\mathcal O_{\mathbb Q(\sqrt d)},
$$
the usual ring of integers for square-free $d\equiv1\pmod4$. This identifies both quotients with the same ring. Explicitly, if $\xi$ denotes the image of $X$ modulo $g$, send the image of $X$ modulo $f$ to $\xi+(B-b)/2$. Equal discriminants give $f(\xi+(B-b)/2)=g(\xi)=0$, and the opposite translation gives its inverse. \b[The two quotient rings are isomorphic.]