B4. Determine all integers $a$ for which $\frac{a}{1011-a}$ is an even integer.
Solution 1: Let $\frac{a}{1011-a}=2 k$ for some integer $k$ and substitute $a=1011-b$. We have
$$
2 k=\frac{a}{1011-a}=\frac{1011-b}{b}=\frac{1011}{b}-1 .
$$

We thus require that $\frac{1011}{b}$ be an odd integer. Since $1011=3 \times 337$, all factors of 1011 (positive and negative) are odd. We seek $b \in\{ \pm 1, \pm 3, \pm 337, \pm 1011\}$ which correspond to solutions $a \in\{1010,1012,1008,1014,674,1348,0,2022\}$, respectively.
In other words, integers $a$ for which $\frac{a}{1011-a}$ is an even integer from the set
$$
\{1011-b \text { such that } b \mid 1011\} \text {. }
$$

Solution 2: As in the previous solution, let $\frac{a}{1011-a}=2 k$. Rearranging, we have
$$
\frac{a}{1011-a}=2 k \Longleftrightarrow a+2 k a=2022 k \Longleftrightarrow a=\frac{2022 k}{1+2 k} .
$$

Now, note that $k$ and $1+2 k$ are relatively prime, so we must have $1+2 k \mid 2022$; that is, we seek odd divisors of 2022 . Since $2022=2 \times 1011=2 \times 3 \times 337$, these are $1+2 k= \pm 1, \pm 3, \pm 337$, or $\pm 1011$. Using equation (1),
$$
\begin{array}{l}
1+2 k=1 \Longrightarrow a=0, \\
1+2 k=3 \Longrightarrow a=674, \\
1+2 k=337 \Longrightarrow a=1008, \\
1+2 k=1011 \Longrightarrow a=1010, \\
1+2 k=-1 \Longrightarrow a=2022, \\
1+2 k=-3 \Longrightarrow a=1348, \\
1+2 k=-337 \Longrightarrow a=1014, \\
1+2 k=-1011 \Longrightarrow a=1012,
\end{array}
$$

Answer: $a \in\{1010,1012,1008,1014,674,1348,0,2022\}$