Solution (source code)

= Solution

Write $f=[a,b,c]$. Two integral binary quadratic forms $f$ and $g$ are equivalent if there is a matrix
$$
U=\begin{pmatrix}\alpha&\beta\\\gamma&\delta\end{pmatrix}\in\operatorname{SL}_2(\mathbb Z)
$$
such that
$$
g(x,y)=f(\alpha x+\beta y,\gamma x+\delta y).
$$
Equivalently, the group $\operatorname{SL}_2(\mathbb Z)$ acts on forms by integral unimodular changes of variables.