Here are today's problems. I'm pretty excited about tomorrow because of the edu round and the first codejam.
Apparently I attempted this at a contest one year ago and didn't solve. I still found it difficult today, I proved that we only needed to count the parity of the possible moves early on but had trouble representing it until I finally thought about using a stack and popping whenever a repeat appears.
It's not hard to see the sum is actually $$$a[n-1]-a$$$ minus $$$k-1$$$ sums of consecutive differences $$$a[i]-a[i-1]$$$ so we only need to maximize those, we calculate them all, sort and pick the $$$k-1$$$ largest.