BMO2 2016 Number Theory Problem Suppose that $p$ is a prime number and that there are different positive
integers $u$ and $v$ such that $p^2$ is the mean of $u^2$ and $v^2$. Prove that
$2p−u−v$ is a square or twice a square.
Can anyone find a proof. I can't really see any way to approach the problem.

Since $2p^2=u^2+v^2$, $u$ and $v$ must have the same parity and can therefore be defined as $u=x+y$ and $v=x-y$  ($x$ being the arithmetic mean of $u$ and $v$ and $y$ being half the difference between $u$ and $v$).
It follows that $2p^2=2x^2+2y^2$, which is a simple Pythagorean triple. So we can define $p=m^2+n^2$ and either $x=m^2-n^2$ and $y=2mn$ or $x=2mn$ and $y=m^2-n^2$.
In the first case, we can rewrite:
$2p-u-v=2p-x-y-x+y=2p-2x=2m²+2n²-2m²+2n²=4n²$ which is a square.
Otherwise,
$2p-u-v=2p-x-y-x+y=2p-2x=2m²+2n²-4mn=2(m-n)²$ which is twice a square.
