There are $n\geq 2$ copies of an integer $k>0$ written on the blackboard. A move consists of choosing an integer $m>0$ on the blackboard, and replacing it as well as one other integer on the blackboard (you can choose which one) by the integer $m-1$.
For example, if you have numbers $(3,0,1)$ on the blackboard, a move can change them to $(2,2,1)$ or $(2,0,2)$ or $(3,0,0)$ or $(0,0,0)$.
What is the maximum possible number $f(n,k)$ of moves you can perform? An asymptotic answer would be good enough (I think it could be $O(kn^2)$).
As @Alex noted, the following proves the local optimality of his and @Yong's algorithm in some measure. In fact the measure I use cannot prove global optimality on general states, since the score for $(5,5,1,0,0)$ is $56$ while that for $(5,4,4,4,4)$ is $58$. In two optimal steps each, the sequences reach $(5,4,4,0,0)$ and $(5,4,4,2,2)$ respectively, where it's easy to see that the second is at least two steps better.
Let $T$ be $k+1$. $a_i$'s. First observation, if we are picking $i$ and $j$, then we should always replace them by the bigger of $a_i-1$ and $a_j-1$. Write down the numbers in decreasing order and read them as an $(T+1)$ base expansion so that $a_i$ corresponds to $a_i(T+1)^i$. So then $j>i$.
Now after the operation, the $a_j-1$ that replaces $a_i$ moves to $j-1\ge i$, and everything in between is shifted to the right. Then the operation to be done is subtract $\delta \ge (T+1)^j - T\times(T+1)^k >0 $. Note that by construction, either $a_j-1 \ge a_i$ or $a_j = a_i$.
So first of all, the base $(T+1)$ number decreases. We can see what makes this decrease the smallest. We have the bounds $$(T+1)^{j-1} \leq \delta \le (T+1)^j$$
So for a given $i$, $j$ should be as low as possible.
If $a_i =0$, this means $j$ should be the smallest such that $a_j>0$, and then $i$ does not matter.
Otherwise, $j = i+1$, and then the same bounds tell us that $i$ should be as low as possible.
Some upper bounds are below.
First, starting from any state of the blackboard, we can make only finitely many moves. To see this, first note that in any move, we cannot increase the maximum. Now, we induct on number of terms on the board.
Note that once a maximal term occurs as $i$ or $j$ in a move $M(i,j)$ as in Ewan's comment and answer, it cannot get back to its original value again, since if $T$ is the maximum value, then every replacement is with at most $T-1$. Now, it is enough to show that the maximum has to decrease in a finite number of moves. Assume on the contrary that there is an infinite sequence of moves that preserves the maximum. Then, some maximal value not be used in a move at all. But by induction, there are only finitely many possible moves that can be made on the rest of the terms.
This also tells us that there cannot be any periodic set of states, so that the total possible number of states ($-1$) is an upper bound. The number of states is the number of non-increasing sequences of length $n$ where every term is $\le k$. This is given by $\binom{k+n}{k}-1$. A slightly better upper bound is below.
Now, suppose that for a multiset of size $n$, with maximum $T$, the maximum number of moves possible (over all such multisets) is $f(T,n)$. Obviously, $$f(T,2 ) = T$$. By the same argument as above, $$f(T,n+1) \le f(T,n)+f(T-1,n) +1 $$ By induction, $f(T,n) \le \binom{T+n-1}{T} - 1 \le (T+1)^n-1$ but this seems to have room for improvement.
@AlexRavsky's upper bound is much better for a fixed $k$, while this is better for a fixed $n$.
Here are some actual values for the $k,n$ defined in the problem, and the best of the two upper bounds above, $\binom{k+n-1}{n-1}-1$ and $n(2^k-1)$: