Solution (source code)

= Solution

Put $w=\sqrt Y$. The separated <first integral of a square-root reaction layer> gives a primitive $\Phi(Y)$ as defined in <3/solution>. One can verify it directly: above the plateau,
$$
\frac{d\Phi}{dY}=\left[\frac23(\sqrt Y-k)^2(2\sqrt Y+k)\right]^{-1/2},
$$
while below it the derivative has the opposite sign. Accordingly the increasing left profile uses $\Phi(L)=\Phi(0)-\xi$, and the increasing right profile uses $\Phi(R)=\xi$ after choosing its translation constant.

As $w\to k$, the logarithm dominates:
$$
\Phi(Y)=\sqrt{2k}\log|w-k|+O(1).
$$
Hence the left profile approaches from below with $|\sqrt L-k|\propto e^{-\xi/\sqrt{2k}}$, while the right profile approaches from above with $|\sqrt R-k|\propto e^{\xi/\sqrt{2k}}$ as $\xi\to-\infty$. These are precisely the required two plateau <matching conditions>. The absolute value in the logarithm is necessary to use the same real primitive on both sides.