For this problem in yesterday’s SATURNALIA contest, the testcases are really weak!
A few of the wrong submissions.
Both of these don’t work for a simple testcase:
1 5 1 4 5
The first one outputs 7, while the second outputs 24. The actual answer is 9