$\def\d{\mathrm{d}}$Determine the integral $$\oint_L \mathbf{A} \cdot \,\d\mathbf{r},$$ where $$\mathbf{A} = \mathbf{e}_x(x^2-a(y+z))+\mathbf{e}_y(y^2-az)+\mathbf{e}_z(z^2-a(x+y)),$$ and $L$ is the curve given by the intersection between the cylinder $$\begin{cases}(x-a)^2+y^2=a^2 \\z\geq0\end{cases}$$ and the sphere $$x^2+y^2+z^2=R^2, \quad (R^2>4a^2)$$ The orientation is such that at $x=0$ the tangent to the curve is parallel with $-\mathbf{e}_y$.
Attempted solution:
Let's apply Stokes' theorem. First, let me introduce a graphical representation of the problem.
The path $L$ will then, as seen from above, be the following: 
A simple calculation shows $\nabla \times \textbf{A} = (0,0,a)$. Here comes my problem...
Question
What surface am I looking to take a surface integral over? Is it the whole cylinder or just the "top"? How can I determine?
The surface can be ANY surface whose border is the curve $L$.
In this case, a possibility would be the part of the sphere inside the cylinder, which you can parametrize as follows: \begin{cases} x= x\\ y=y \quad \quad \quad \quad \quad \quad \text{with} \quad (x,y)\mid (x-a)^2+y^2\le a^2\\ z= \sqrt{R^2-x^2-y^2}\\ \end{cases}
Applying Stokes' theorem to finish the question yields \begin{align} \oint_L \textbf{A}\cdot d\textbf{r} = \iint_S \nabla\times \textbf{A}\cdot d\textbf{S} &= \iint_\limits{(x-a)^2+y^2\le a^2}\pmatrix{0\\0\\a}\cdot \pmatrix{1\\0\\\frac{-x}{\sqrt{R^2-x^2-y^2}}} \times \pmatrix{0\\1\\\frac{-y}{\sqrt{R^2-x^2-y^2}}}\; dA \\ &= \iint_\limits{(x-a)^2+y^2\le a^2}\pmatrix{0\\0\\a}\cdot \pmatrix{*\\*\\1}\; dA \\ &= \iint_\limits{(x-a)^2+y^2\le a^2}a\; dA = \pi a^3 \end{align}