<s>[INST] JBMO TST macedonia Number Theory 
Find all $x,y$ positive integers $$x + y^2 + (\gcd(x, y))^2 = xy \cdot
 \gcd(x, y)$$

I tried supposing $\gcd(x,y)=d$ and letting $x=ad$, $y=bd$ but didn't get anything the closest thing I think is usefull that $(b+1)^2+4a^2b$ is a perfect square. 
 [/INST] Your substitutions give the equation
$$ad+b^2d^2+d^2=abd^3$$
Modulo $bd^2-1$ we obtain $$ad+b+d^2\equiv ad.$$ Then $bd^2-1$ is a factor of $b+d^2$ and so $bd^2-1\le b+d^2$. Either $d=1$ or $d\ge2$ and $$b\le \frac {d^2+1}{d^2-1}=1+ \frac {2}{d^2-1}<2.$$

IF $b=1.$

Then $a+2d=ad^2$. Therefore $a|2d$ and $d|a$ and so $a=d$ or $2d$. Neither possibility gives a solution.

IF $d=1,b\ge2.$

Then $b-1$ is a factor of $b+1$. Therefore $b+1\ge2(b-1)$ and $b=2$ or $3$.
The solutions are $x=5,y=2$ and $x=5,y=3.$
</s>