Solution (source code)

= Solution

The required harmonic <function> is
$$
u(z)=\frac2\pi\operatorname{Im}\log\!\left(\frac{f(z)-R}{f(z)+R}\right).
$$
On the upper and lower boundary its argument is respectively $\pi/2$ and $-\pi/2$, while at infinity the logarithm tends to $0$.