Solution (source code)

= Solution

Let $R$ be the sum of the nonzero <quadratic residue>[quadratic residues]. Each has two square <root>[roots] by part (iii), so
$$
2R\equiv\sum_{x=1}^{p-1}x^2\equiv0\pmod p,
$$
where part (ii) applies because $p>3$ makes $p-1$ not divide $2$. Since $2$ is invertible modulo $p$, $R\equiv0$.

The sum of all nonzero classes is $p(p-1)/2\equiv0\pmod p$. Subtracting $R$ shows that the sum of <quadratic nonresidue>[quadratic nonresidues] is also zero. Consequently \b[both requested sums vanish modulo $p$].