TITLE: On $\prod^{(p-1)/2}_{i,j=1\atop p\nmid 2i+j}(2i+j)$ and $\prod^{(p-1)/2}_{i,j=1\atop p\nmid 2i-j}(2i-j)$ modulo a prime $p>3$
QUESTION [7 upvotes]: QUESTION: Is my following conjecture true?
Conjecture. Let $p>3$ be a prime and let $h(-p)$ be the class number of the imaginary quadratic field $\mathbb Q(\sqrt{-p})$. Then
$$\frac{p-1}2!!\prod^{(p-1)/2}_{i,j=1\atop p\nmid 2i+j}(2i+j)\equiv
\begin{cases}(-1)^{(p-1)/4}\pmod p&\text{if}\ p\equiv 1\pmod4,
\\(-1)^{(h(-p)+1)/2}\pmod p&\text{if}\ p\equiv 3\pmod 4.\end{cases}$$ 
Also,
$$\frac{p-3}2!!\prod^{(p-1)/2}_{i,j=1\atop p\nmid 2i-j}(2i-j)\equiv
\begin{cases}1\pmod p&\text{if}\ p\equiv1\pmod4,\\(-1)^{(p-1+2h(-p))/4}\pmod p&\text{if}\ p\equiv3\pmod4.\end{cases}$$ 
I have checked the conjecture via a computer. It should be true in my opinion. Your comments are welcome!

REPLY [6 votes]: Here is a respectively short way to write down what we came up with Dmitry Krachun tonight. 
Denote $p=2m+1$. 
The idea is very simple: calculate the product $$\prod_{j\in\{s,s+1\}, 1\leqslant i\leqslant m,\atop p\nmid 2i+j} (2i+j).$$
Note that this is a product of all non-zero residues modulo $p$ except $s+1$, thus it equals $-1/(s+1)$. Now apply this observation for $s=1,3,\dots,m-1$ (if $m$ is even) and $s=2,4,\dots,m-1$ (if $m$ is odd) and multiply, you almost get your double product. 
Namely, if $m$ is even (so $p\equiv 1\pmod 4$) you get the whole double product, which appears to be congruent $\pmod p$ to $(-1)^{m/2}/m!!$ as conjectured. 
If $m$ is odd, you get that the double product is congruent $\pmod p$ to $\prod_{i=1}^{m-1} (1+2i)\cdot (-1)^{(m-1)/2}/m!!$ (the first product corresponds to the case $j=1$), and since the right hand side of your formula is just $m!$ by Mordell, we need only to prove that $\prod_{i=1}^{m-1} (1+2i)\cdot (-1)^{(m-1)/2}\equiv m!$, that is easy: write each $1+2i$ as $-2(m-i)$, you get $2^{m-1}(m-1)! (-1)^{(m-1)/2}$ in the left hand side and $m!=-(m-1)!/2$ in the right hand side, so we need $2^m (-1)^{(m+1)/2}\equiv 1$ which is clear as $2^m\equiv (-1)^{(p^2-1)/8}=(-1)^{(m+1)/2}$.