Solution (source code)

= Solution

Define
$$
y_i=
\begin{cases}
x_i,&s_i>0,\\
0,&s_i=0,
\end{cases}
\qquad
z_i=x_i-y_i.
$$
Then $\mathbf x=\mathbf y+\mathbf z$, the support of $\mathbf y$ lies in $P(\mathbf s)$, and the support of $\mathbf z$ is disjoint from $P(\mathbf s)$. Thus $\mathbf y\preceq\mathbf s$ and $\mathbf z\perp\mathbf s$.

For uniqueness, if $s_i>0$, orthogonality forces $z_i=0$, hence $y_i=x_i$. If $s_i=0$, the condition $\mathbf y\preceq\mathbf s$ forces $y_i=0$, hence $z_i=x_i$. Every coordinate is therefore forced, proving uniqueness.