Comments

Sadly misread C and wasted a lot of time.

I thought the lids could move one up or down :(

On AmirrzwM → Codeforces Global Round 23, 4 years ago
0

1 4 4 1 2 3 is a counter example, since your final array would be 5 4 8 13, which has one inversion. It is possible to get 0 inversions.