Minimizing the iterative sum of pairs of numbers in a list
I will assume that initially $y=0$, as this makes no difference in your problem.

Look at the very last two elements $a,b$ that you will apply your operation on:
The tuple is $([a,b], y$) and, at the next iteration, it will necessarily be $([a+b], $y+a+b$)$, since $a+b = \sum_{i=1}^n x_i$ is a constant, you only want to minimize $y$.

Notice that $a$  (resp. $b$) must have been obtained as a sum of some contiguous sequence of elements of your list starting from $x_1$ (resp. ending in $x_n$).

Calling $OPT[i,j]$ the minimum value of $y+z=z$ in your problem when the input instance consists of $([x_1, \dots, x_j], 0)$, we then obtain (for $n &gt; 1$):

$$
OPT[1,n] = \sum_{h=1}^n x_h + min_{h=1,\dots,n-1}  \left\{ OPT[1,h] + OPT[h+1,n] \right\}
$$

and, in general:

$$
OPT[i,j] = 
\begin{cases}
\sum_{h=i}^j x_h + min_{h=i,\dots,j-1}  \left\{ OPT[i,h] + OPT[h+1,j] \right\} &amp; \mbox{if } j-i&gt;0 \\
0 &amp; \mbox{if } j-i = 0
\end{cases}.
$$

There are $O(n^2)$ subproblems and each requires taking a minimum over $O(n)$ elements, so your problem can be solved in $O(n^3)$ time via dynamic programming.