I am looking for a fast algorithm to find all integer solutions for the following system of linear equations ($c_1,\ldots,c_n \in \mathbb{Z}$ and $r\in \mathbb{N}$ ):
$x_1+x_2=c_1$
$x_3+x_4=c_2$
...
$x_{2n-1}+x_{2n}=c_n$
$|x_1|+|x_2|+\ldots+|x_{2n}|=r$
$x_1,\ldots,x_{2n} \in \mathbb{Z}$
Also can we find the number of solutions before solving the system?
The variables come in pairs, tied together only by the equation $ |x_1| + |x_2| + \ldots + |x_{2n}| = r$.
Let $|x_{2k-1}| + |x_{2k}| = r_k$. Given integers $r_k$ and $c_k$, consider the integer solutions to $$ \eqalign{ x_{2k-1} + x_{2k} &= c_k\cr |x_{2k-1}| + |x_{2k}| &= r_k\cr}$$ Of course we need $r_k \ge |c_k|$ and $r_k \equiv c_k \mod 2$ to have any hope. There are four cases, according to whether $x_{2k-1}$ and $x_k$ are positive or negative.
Next do some recursion with respect to $n$.