Solution (source code)

= Solution

Split the <factorial> at $h$, using $k=p-1-h$:
$$
(p-1)!=h!\prod_{j=h+1}^{p-1}j\equiv h!\prod_{t=1}^{k}(-t)=(-1)^k h!k!\pmod p.
$$
By <Wilson theorem>, this is $-1$. Therefore $h!k!\equiv(-1)^{k+1}\pmod p$. If the <prime number> $p$ is odd, then $h+k=p-1$ is even, so $(-1)^k=(-1)^h$ and
$$
\boxed{h!k!+(-1)^h\equiv0\pmod p.}
$$
For $p=2$, the signs $1$ and $-1$ are identical modulo $2$, and the two possibilities $(h,k)=(0,1),(1,0)$ also give the same result. The <empty product> convention $0!=1$ includes the endpoint cases. This is the <complementary factorial congruence>.