<s>[INST] One Diophantine equation I wonder now that the following Diophantine equation:
$2(a^2+b^2+c^2+d^2)=(a+b+c+d)^2$
have only this formula describing his decision?
$a=-(k^2+2(p+s)k+p^2+ps+s^2)$
$b=2k^2+4(p+s)k+3p^2+3ps+2s^2$
$c=3k^2+4(p+s)k+2p^2+ps+2s^2$
$d=2k^2+4(p+s)k+2p^2+3ps+3s^2$
$k,p,s$ - what some integers.
By your question, I mean what that formula looks like this. Of course I know about the procedure of finding a solution, but I think that the formula would be better.
 [/INST] I don't think your formula exhaust all solutions of the Diophantine equation
$$2(a^2+b^2+c^2+d^2) = (a+b+c+d)^2\tag{*1}$$
Your equation can be rewritten as
$$(a+b+c+d)^2 = (-a+b-c+d)^2 + (-a+b+c-d)^2 + (-a-b+c+d)^2$$
This is the equation for a Pythagorean quadruple. The set of all Pythagorean quadruples can be parametrized
by 5 integers $\alpha,\beta,\gamma,\delta$ and $\lambda$:
$$\begin{cases}
\hphantom{-}a + b + c + d  &= \lambda (\alpha^2 + \beta^2 + \gamma^2 + \delta^2)\\
-a + b - c + d &= \lambda(\alpha^2+\beta^2 - \gamma^2 - \delta^2)\\
-a + b + c - d &= 2\lambda(\alpha\delta + \beta\gamma)\\
-a - b + c + d &= 2\lambda(\beta\delta - \alpha\gamma)
\end{cases}
$$
Using this, we see all solutions of $(*1)$ must have the form
$$
\begin{cases}
a &= \frac{\lambda}{2}
\left(\gamma^2 + \delta^2 + (\alpha-\beta)\gamma - (\alpha+\beta)\delta\right)\\
b &= \frac{\lambda}{2}
\left(\alpha^2 + \beta^2  + (\alpha+\beta)\gamma + (\alpha-\beta)\delta\right)\\
c &= \frac{\lambda}{2}
\left(\gamma^2 +\delta^2  - (\alpha-\beta)\gamma + (\alpha+\beta)\delta\right)\\
d &= \frac{\lambda}{2}
\left(\alpha^2+\beta^2   - (\alpha+\beta)\gamma - (\alpha-\beta)\delta\right)
\end{cases}\tag{*2}
$$
Furthermore, if one substitute any integers $\lambda, \alpha,\beta,\gamma,\delta$
into $(*2)$ and if the resulting $a, b, c, d$ are integers, then it will be a solution
of $(*1)$. It is not hard to check this happens when and only when 
$$\lambda(\alpha+\beta+\gamma+\delta)\quad\text{ is an even number }\tag{*3}$$ 

Conclusion
  - all solutions of $(*1)$ can be parametrized by $(*2)$ subject to the constraint $(*3)$.

The formula you have is a special case of above parametrization. It can be reproduced by
following substitutions:
$$\begin{cases}
\lambda &= 1\\
\alpha  &= s - p,\\
\beta   &= 2(s+p+k),\\
\gamma  &= k+p,\\
\delta  &= k+s.
\end{cases}$$
</s>