Solution (source code)

= Solution

Along a path avoiding the origin, polar coordinates give
$$
\mathbf F\cdot d\mathbf r=\frac{-y\,dx+x\,dy}{x^2+y^2}=d\theta,
$$
where the angle is followed continuously along the path. For a closed path its total change is an integer number of turns, so
$$
\boxed{\oint_C\mathbf F\cdot d\mathbf r=2\pi\operatorname{wind}(C,0).}
$$
For a simple counterclockwise loop, the value is $2\pi$ if the origin lies inside and zero if it lies outside. Clockwise orientation reverses the nonzero sign. The <winding number> formula also handles repeated or self-intersecting loops. A curve passing through the origin is outside the ordinary line integral's domain.