For each prime $p>5$, prove that there always exists an integer $a$ s.t the two following equations $$x^2+py+a=0\quad\text{and}\quad x^2+py+a+2=0$$ both have integer solutions.
Here are my thoughts for this problem:
$x^2+py+a=0\iff x^2+a\equiv 0\pmod{p}$ and $m^2+pn+a+2=0\iff m^2+a+2\equiv 0\pmod{p}.$
So if there exists an integer $a$ s.t $\left(\dfrac{-a}{p}\right)=\left(\dfrac{-a-2}{p}\right)=1$ then we finish.
But I don't know whether such $a$ exists. Could someone help me or have another way to deal with this problem? Thanks in advance!
You have made a good start on a valid approach. To prove an integer $a$ always exists, consider several special cases. For $a = -1$, since $\left(\frac{-a}{p}\right) = \left(\frac{1}{p}\right) = 1$ for all primes, check when $\left(\frac{-a-2}{p}\right) = \left(\frac{-1}{p}\right) = 1$. By $q = \pm 1$ and the first supplement, we have that $p \equiv 1 \pmod{4}$ works.
Thus, we have only $p \equiv 3\pmod{4}$ left, which can be handled with $p \equiv 3\pmod{8}$ and $p \equiv 7\pmod{8}$ separately. With $a = 0$ satisfying the first Legendre symbol, we need $\left(\frac{-a-2}{p}\right) = \left(\frac{-2}{p}\right) = 1$. By $q = \pm 2$ and the second supplement (also in Show that there exists $a \in \mathbb{Z}$ s.t $a^2 \equiv -2 \pmod p$.), we have $p \equiv 1, 3\pmod{8}$, so this covers the $p \equiv 3\pmod{8}$ case. With $a = -4$ satisfying the first value, then for $\left(\frac{-a-2}{p}\right) = \left(\frac{2}{p}\right) = 1$, by $q = \pm 2$ and the second supplement again, we have $p \equiv 1, 7\pmod{8}$, so this covers the remaining $p \equiv 7\pmod{8}$ case.
Note the table in Law of quadratic reciprocity also has these results. In addition, you could use quadratic reciprocity or other means to determine other sets of $a$ values which cover all of the odd primes $p$.