In terms of $a$
Suppose Andy collected $a$ balls. Then Roger collected $\frac 12 a$ and Maria collected $a-5$.
In total they collected $35$, so: $$\begin{align}&a + \tfrac 12 a + a - 5 = 35\\
\Rightarrow&\tfrac 52 a - 5 = 35\\
\Rightarrow&\tfrac 52 a = 40\\
\Rightarrow&a = 16\end{align}$$
In terms of $R$
Suppose Andy collected $A$ balls, Roger collected $R$ balls and Maria collected $M$ balls. Then $A=2R=M+5$.
In total they collected $35$ balls, so: $$A+R+M=35$$
Putting this in terms of $R$ gives: $$\begin{align}&2R+R+(2R-5)=35\\
\Rightarrow&5R=40\\
\Rightarrow&R=8\end{align}$$
Since Andy collected twice as many balls as Roger, he collected $2R=2\times8=16$ balls.