For the equation $x + y = A$, it's easy, when you notice that when iterating over all possible $x$, the number of solutions for $y$ is $0$ at the beginning, then increases by $1$, then stays constant, then decreases by $1$, and at the end $0$. This can be calculated in $O(1)$.
$l_1 < a < u_1$, $l_2 < b < u_2$, $l_3 < c < u_3$. I'm looking for a general answer for all $u_i$, $l_i$, $A$ ($i = 1, 2, 3$).
I assume this problem is just as easy, but it's hard to find the formula, since i have to think in $3$ dimensions instead of $2$.
example: $2 < x < 5$, $1 < y < 5$, $3 < z < 7$, $A = 11$, the answer is 5.