Determine all pairs $(x, y)$ of positive integers that satisfy

$$
x+y+1 \mid 2 x y \quad \text{ and } \quad x+y-1 \mid x^{2}+y^{2}-1
$$
It holds that

$$
\left(x^{2}+y^{2}-1\right)-(x+y+1)(x+y-1)=\left(x^{2}+y^{2}-1\right)-\left(x^{2}+y^{2}+2xy-1\right)=-2xy.
$$

Since $x+y-1$ is a divisor of $x^{2}+y^{2}-1$ and obviously also of $(x+y+1)(x+y-1)$, we see that $x+y-1$ is a divisor of $2xy$. We know that $x+y+1$ is also a divisor of $2xy$. But the greatest common divisor (gcd) of $x+y-1$ and $x+y+1$ is 1 or 2, since the difference between the two numbers is 2. Therefore, $2xy$ is divisible by $(x+y-1)(x+y+1)$ (if the gcd is 1) or by $\frac{(x+y-1)(x+y+1)}{2}$ (if the gcd is 2). In both cases, $4xy$ is divisible by $(x+y-1)(x+y+1)$, and thus for some $k \geq 1$ it holds that:

$$
4xy = k(x+y-1)(x+y+1) = k\left(x^{2}+y^{2}+2xy-1\right) \geq k(4xy-1)
$$

where the last inequality holds because for all real numbers (and certainly for positive integers) $x$ and $y$, it holds that $x^{2}+y^{2} \geq 2xy$.
If $k \geq 2$, then $4xy \geq 2 \cdot (4xy-1)$, so $4xy \leq 2$. Contradiction, because $x$ and $y$ are positive and integers, so $4xy \geq 4$. We conclude that $k=1$ must hold, and thus $4xy = x^{2}+y^{2}+2xy-1$. This simplifies to $x^{2}+y^{2}-1-2xy=0$, which we can rewrite as $(x-y)^{2}=1$. Therefore, $x=y-1$ or $x=y+1$ must hold.
The possible pairs that satisfy this are thus $(x, x+1)$ with $x \geq 1$ and $(x, x-1)$ with $x \geq 2$. We check the first pair: $2x+2$ must be a divisor of $2x(x+1)$, and this is true; and $2x$ must be a divisor of $x^{2}+(x+1)^{2}-1=2x^{2}+2x$, and this is also true. Similarly, the second pair also satisfies the conditions. Therefore, the solutions are: all pairs $(x, x+1)$ with $x \geq 1$ and all pairs $(x, x-1)$ with $x \geq 2$.