<s>[INST] How many ways to place plus and minus signs in front of numbers from 0 to 12 so that the sum is divisible by 5? This question is from an old NIMO contest.

Find the number of ways a series of + and − signs can be inserted between the numbers 0, 1, 2, · · ·, 12 such that the value of the resulting expression is divisible by 5.

A computer program seems to indicate that the answer is 816.
Approach: Reduce the problem to mod 5. There are three copies of 0,1,2 and two copies of 3,4. Now suppose there are exactly $x_i$ plus signs for copy $i$. We see that for the sum to be divisible by 5, we must have $\sum ix_i =$ 4 mod 5. Now I was planning to crunch it out or use generating functions, but it looks complicated.
Suggestions?
 [/INST] It does matter what we put in front of the $0,5,10$.  Of the $2^3\pm$ combinations you can do for those the result will have the same divisibility as any other.  So It suffices to solve for $1,2,3,4,6,7,8,9,11,12$ and multiply the result by $8$.
Consider $A_1 = \pm 1 \pm 2\pm 3\pm 4$ and $A_2=\pm 6\pm 7\pm 8 \pm 9$ and $B = \pm 11\pm 12$.  $B$ can never be divisible by $5$ but of the four values it can have it can be by divisible by $1,2,3$ or $4$ meaning $A_1 + A_2$ must be $\equiv -B\pmod 5$.
Going through the 16 possible values of $A_1$ (and equivalently $A_2$) There are $4$ that are congruent to $0$ $(\pm(1+4)\pm(2+3)$; $3$ that are congruent to $1$ (basically $-7+3$); $3$ that are congruent to $2$ ($6-4=1+2+3-4; 8-2=1-2+3+4;9-1=-1+2+3+4$; $3$ that are congruent to $3\equiv -2$ (symmetry; and $3$ that are congruent to $4$.
Okay:  If $B\equiv 1 \pmod 5$ (that is $-11+12$) we must have $A_1+A_2 \equiv 4$ so we must have $A_1,A_2\equiv (0,4),(1,3), (2,2)$ there are $4\times 3$ ways to do $(0,4)$ and $3\times 3$ ways to do $(1,3)$ or $(2,2)$. so there are $12 + 9+9=30$ ways to do that.
If $B \equiv 2 \pmod 5$ (that is $-11-12$) we must have $A_1+A_2\equiv 3$ so we must have $A_1,A_2 \equiv (0,3), (1,2),(4,4)$ and there are $4\times 3=12$ and $3\times 3$ and $3\times 3$ respectively to do that.  So there are $30$ ways.
By symmetry the some is true for $B\equiv 3,4\pmod 5$.
So there should by $8\times 4\times 30 = 960$ ways.
I don't know if I or you have an error (probably I do) but that is how I solved it.
</s>