Solution (source code)

= Solution

For a bounded <volume> $V$ with piecewise smooth closed boundary $\partial V$, oriented by the outward <unit normal vector>, and a continuously differentiable <vector field> on a neighborhood of $\overline V$, the <divergence theorem> states
$$
\int_V\nabla\cdot F\,dV=\int_{\partial V}F\cdot n\,dS.
$$
For an oriented piecewise smooth <surface> $S$ with piecewise smooth boundary $C=\partial S$, and a continuously differentiable <vector field> on a neighborhood of $S$, <Stokes theorem> states
$$
\int_S(\nabla\times F)\cdot n\,dS=\oint_CF\cdot dr.
$$
The boundary orientation follows the right-hand rule relative to the chosen <normal vector>. Reversing that orientation reverses both sides of the latter identity.