Language: C++

let () =
  Scanf.scanf "%d" @@ fun l ->
  let a = Array.init (l+1) @@ fun i ->
    if i = 0 then 0
    else Scanf.scanf " %d" ((+) 0)
  in

  let dp = Array.init 5 (fun _ -> Array.make (l+1) 0) in

  for i = 1 to l do
    dp.(0).(i) <- dp.(0).(i-1) + a.(i);
  done;

  for i = 1 to l do
    dp.(1).(i) <- min dp.(0).(i) @@
      dp.(1).(i-1) + if a.(i) = 0 then 2 else a.(i) mod 2;
  done;

  for i = 1 to l do
    dp.(2).(i) <- min dp.(1).(i) @@
      dp.(2).(i-1) + (a.(i) + 1) mod 2;
  done;

  for i = 1 to l do
    dp.(3).(i) <- min dp.(2).(i) @@
      dp.(3).(i-1) + if a.(i) = 0 then 2 else a.(i) mod 2;
  done;

  for i = 1 to l do
    dp.(4).(i) <- min dp.(3).(i) @@ dp.(4).(i-1) + a.(i);
  done;

  Printf.printf "%d\n" dp.(4).(l)



Compiler output:
a.cc:2:20: error: stray '@' in program
    2 |   Scanf.scanf "%d" @@ fun l ->
      |                    ^
a.cc:2:21: error: stray '@' in program
    2 |   Scanf.scanf "%d" @@ fun l ->
      |                     ^
a.cc:3:28: error: stray '@' in program
    3 |   let a = Array.init (l+1) @@ fun i ->
      |                            ^
a.cc:3:29: error: stray '@' in program
    3 |   let a = Array.init (l+1) @@ fun i ->
      |                             ^
a.cc:15:34: error: stray '@' in program
   15 |     dp.(1).(i) <- min dp.(0).(i) @@
      |                                  ^
a.cc:15:35: error: stray '@' in program
   15 |     dp.(1).(i) <- min dp.(0).(i) @@
      |                                   ^
a.cc:20:34: error: stray '@' in program
   20 |     dp.(2).(i) <- min dp.(1).(i) @@
      |                                  ^
a.cc:20:35: error: stray '@' in program
   20 |     dp.(2).(i) <- min dp.(1).(i) @@
      |                                   ^
a.cc:25:34: error: stray '@' in program
   25 |     dp.(3).(i) <- min dp.(2).(i) @@
      |                                  ^
a.cc:25:35: error: stray '@' in program
   25 |     dp.(3).(i) <- min dp.(2).(i) @@
      |                                   ^
a.cc:30:34: error: stray '@' in program
   30 |     dp.(4).(i) <- min dp.(3).(i) @@ dp.(4).(i-1) + a.(i);
      |                                  ^
a.cc:30:35: error: stray '@' in program
   30 |     dp.(4).(i) <- min dp.(3).(i) @@ dp.(4).(i-1) + a.(i);
      |                                   ^
a.cc:1:8: error: expected constructor, destructor, or type conversion before '=' token
    1 | let () =
      |        ^
a.cc:12:3: error: 'done' does not name a type
   12 |   done;
      |   ^~~~
a.cc:14:3: error: expected unqualified-id before 'for'
   14 |   for i = 1 to l do
      |   ^~~
a.cc:17:3: error: 'done' does not name a type
   17 |   done;
      |   ^~~~
a.cc:19:3: error: expected unqualified-id before 'for'
   19 |   for i = 1 to l do
      |   ^~~
a.cc:22:3: error: 'done' does not name a type
   22 |   done;
      |   ^~~~
a.cc:24:3: error: expected unqualified-id before 'for'
   24 |   for i = 1 to l do
      |   ^~~
a.cc:27:3: error: 'done' does not name a type
   27 |   done;
      |   ^~~~
a.cc:29:3: error: expected unqualified-id before 'for'
   29 |   for i = 1 to l do
      |   ^~~
a.cc:31:3: error: 'done' does not name a type
   31 |   done;
      |   ^~~~
a.cc:33:3: error: 'Printf' does not name a type
   33 |   Printf.printf "%d\n" dp.(4).(l)
      |   ^~~~~~