Solution (source code)

= Solution

For a random sample, write $g_j(x)=\prod_{i=1}^nf(x_i;\theta_j)$, $j=0,1$, for its joint <probability density functions>. Let $\varphi$ be any competing <statistical test> of level at most $\alpha$. Pointwise,
$$
(\varphi_* -\varphi)(g_1-kg_0)\geq0.
$$
Indeed, where $g_1>kg_0$, $\varphi_*=1\geq\varphi$; where $g_1<kg_0$, $\varphi_*=0\leq\varphi$, so both factors have the same sign. On the equality set the product is zero, regardless of randomization. Integrate over the joint sample space using its ordinary volume measure:
$$
\begin{aligned}
0&\leq\int(\varphi_* -\varphi)(g_1-kg_0)\,dx\\
&=\mathbb E_1\varphi_* -\mathbb E_1\varphi-k(\mathbb E_0\varphi_* -\mathbb E_0\varphi).
\end{aligned}
$$
Since $k\geq0$ and $\mathbb E_0\varphi_* =\alpha\geq\mathbb E_0\varphi$,
$$
\boxed{\mathbb E_1\varphi_* -\mathbb E_1\varphi\geq k(\alpha-\mathbb E_0\varphi)\geq0.}
$$
This proves maximal <power>. A continuous sample distribution does not itself guarantee that the equality set of the <likelihood ratio> has zero probability; allowing randomization there makes the proof valid in that case too.