Analysis of a recursive algorithm, where running time strongly depends on input
In order to determine an upper bound on $T(x,i,y)$, consider instead the recurrence
$$ T'(x,i,y) = \begin{cases} 1 &amp; \text{if $x = 0$ or $y = 0$ or $i &gt; n$} \\ x + y + \max_{\substack{0 \leq a \leq x\\ 0 \leq b \leq y}} S'(x,i,y,a,b) &amp; \text{otherwise,} \end{cases} $$
where $S'$ is given by
$$ S'(x,i,y,a,b) = T'(x-a,i+1,b) + T'(x-a,i+1,y-b) + T'(a,i+1,y-b). $$
If you have more constraints on $a,b$, you should adjust the bounds in the definition of $T'$ accordingly.