fork(1) download
  1. f xs = sum $ zipWith (-) (zipWith min (scanl1 max xs) (scanr1 max xs)) xs
  2. main = readLn >>= (print . f)
Success #stdin #stdout 0s 6348KB
stdin
[0, 5, 0, 1, 6000, 0, 2, 1, 0]
stdout
11