Result

AC

Duration

5161ms

Code [DL]

Require Import Io.System.All.
Require Import Io.All.
Require Import List.
Require Import ListString.All.
Require Import Ascii.

Import ListNotations.
Import C.Notations.

Definition solve(line: LString.t): ascii :=
  match line with
  | [_; x; y; _; z; _; _] =>
      if eqb x y then x else z
  | _ => "X"%char
  end.

Fixpoint doTimes(n: nat) : C.t System.effect unit :=
  match n with
  | 0 => ret tt
  | S m => 
      let! line := read_line in
      do! (match line with
          | Some s => log [solve s]
          | _ => ret tt
          end) in
      doTimes m
  end.

Definition main := Extraction.launch (fun _ => doTimes 32).

stdin

215 115
883 133
175 158
411 814
322 449
674 173
143 581
821 151
788 144
544 519
147 744
191 118
796 963
667 674
176 674
578 113
638 732
499 881
677 746
322 223
698 945
431 115
551 363
183 898
133 335
534 338
721 551
326 274
516 129
147 787
677 732
455 251

stdout

1
1
1
1
2
1
5
1
8
4
7
1
9
6
6
1
7
9
7
2
9
1
3
8
3
3
5
2
1
7
7
5

stderr

ocamlfind ocamldep -package io-system -modules main.ml > main.ml.depends
ocamlfind ocamldep -package io-system -modules main.mli > main.mli.depends
ocamlfind ocamlc -c -package io-system -o main.cmi main.mli
+ ocamlfind ocamlc -c -package io-system -o main.cmi main.mli
ocamlfind: [WARNING] Package `threads': Linking problems may arise because of the missing -thread or -vmthread switch
ocamlfind ocamlopt -c -package io-system -o main.cmx main.ml
+ ocamlfind ocamlopt -c -package io-system -o main.cmx main.ml
ocamlfind: [WARNING] Package `threads': Linking problems may arise because of the missing -thread or -vmthread switch
ocamlfind ocamlopt -linkpkg -package io-system main.cmx -o main.native
+ ocamlfind ocamlopt -linkpkg -package io-system main.cmx -o main.native
ocamlfind: [WARNING] Package `threads': Linking problems may arise because of the missing -thread or -vmthread switch

strace

10    execve("/bin/sh", ["/bin/sh", "/root/script", "/volume/CODE"], 0x7ffcda8f8bd0 /* 9 vars */) = 0
11    execve("/bin/cat", ["cat", "/volume/CODE", "/root/tail.v"], 0x562d963d4d60 /* 9 vars */) = 0
11    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
12    execve("/root/.opam/4.10.0/bin/coqc", ["coqc", "Main.v"], 0x562d963d4cb8 /* 10 vars */) = 0
12    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12, si_uid=0, si_status=0, si_utime=35, si_stime=31} ---
13    execve("/root/.opam/4.10.0/bin/ocamlbuild", ["ocamlbuild", "main.native", "-use-ocamlfind", "-package", "io-system"], 0x562d9772e100 /* 10 vars */) = 0
14    execve("/bin/sh", ["/bin/sh", "-c", "mkdir /tmp/_build"], 0x7ff4d5212800 /* 10 vars */) = 0
14    execve("/bin/mkdir", ["mkdir", "/tmp/_build"], 0x5578796b4cb0 /* 10 vars */) = 0
14    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=14, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
15    execve("/bin/sh", ["/bin/sh", "-c", "camlp4 -where 2>/dev/null"], 0x7ffd045d1ae8 /* 10 vars */) = 0
15    +++ exited with 127 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=15, si_uid=0, si_status=127, si_utime=0, si_stime=0} ---
16    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamldep -package io-s"...], 0x7ff4d5212860 /* 10 vars */) = 0
16    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamldep", "-package", "io-system", "-modules", "main.ml"], 0x55bea6220130 /* 10 vars */) = 0
17    execve("/root/.opam/4.10.0/bin/ocamldep.opt", ["ocamldep.opt", "-modules", "main.ml"], 0x7fff189d2230 /* 10 vars */) = 0
17    +++ exited with 0 +++
16    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=17, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
16    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=16, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
18    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamldep -package io-s"...], 0x7ff4d52128a0 /* 10 vars */) = 0
18    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamldep", "-package", "io-system", "-modules", "main.mli"], 0x55ef95c3c150 /* 10 vars */) = 0
19    execve("/root/.opam/4.10.0/bin/ocamldep.opt", ["ocamldep.opt", "-modules", "main.mli"], 0x7ffd5a6e06a0 /* 10 vars */) = 0
19    +++ exited with 0 +++
18    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=19, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
18    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
20    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamlc -where > /tmp/_"...], 0x7ff4d5212940 /* 10 vars */) = 0
20    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamlc", "-where"], 0x564df55f9028 /* 10 vars */) = 0
21    execve("/root/.opam/4.10.0/bin/ocamlc.opt", ["ocamlc.opt", "-where"], 0x7fff37597478 /* 10 vars */) = 0
21    +++ exited with 0 +++
20    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
20    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
22    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamlc -c -package io-"...], 0x7ff4d52128a0 /* 10 vars */) = 0
22    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamlc", "-c", "-package", "io-system", "-o", "main.cmi", "main.mli"], 0x56411a902138 /* 10 vars */) = 0
23    execve("/root/.opam/4.10.0/bin/ocamlc.opt", ["ocamlc.opt", "-c", "-o", "main.cmi", "-I", "/root/.opam/4.10.0/lib/bytes", "-I", "/root/.opam/4.10.0/lib/result", "-I", "/root/.opam/4.10.0/lib/seq", "-I", "/root/.opam/4.10.0/lib/lwt", "-I", "/root/.opam/4.10.0/lib/mmap", "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/lwt/unix", "-I", "/root/.opam/4.10.0/lib/num", "-I", "/root/.opam/4.10.0/lib/io-system", "main.mli"], 0x7ffef1b8ad40 /* 10 vars */) = 0
23    +++ exited with 0 +++
22    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=23, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
22    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=22, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
24    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamlopt -c -package i"...], 0x7ff4d52128a0 /* 10 vars */) = 0
24    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamlopt", "-c", "-package", "io-system", "-o", "main.cmx", "main.ml"], 0x556e0abfa130 /* 10 vars */) = 0
25    execve("/root/.opam/4.10.0/bin/ocamlopt.opt", ["ocamlopt.opt", "-c", "-o", "main.cmx", "-I", "/root/.opam/4.10.0/lib/bytes", "-I", "/root/.opam/4.10.0/lib/result", "-I", "/root/.opam/4.10.0/lib/seq", "-I", "/root/.opam/4.10.0/lib/lwt", "-I", "/root/.opam/4.10.0/lib/mmap", "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/lwt/unix", "-I", "/root/.opam/4.10.0/lib/num", "-I", "/root/.opam/4.10.0/lib/io-system", "main.ml"], 0x7ffc4ccdeb00 /* 10 vars */) = 0
26    execve("/bin/sh", ["sh", "-c", "as  -o 'main.o' '/tmp/camlasm73e"...], 0x7ffdb9152b28 /* 10 vars */) = 0
26    execve("/usr/bin/as", ["as", "-o", "main.o", "/tmp/camlasm73eff5.s"], 0x55aa4b730028 /* 10 vars */) = 0
26    +++ exited with 0 +++
25    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=26, si_uid=0, si_status=0, si_utime=0, si_stime=1} ---
25    +++ exited with 0 +++
24    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=25, si_uid=0, si_status=0, si_utime=2, si_stime=1} ---
24    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
27    execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind ocamlopt -linkpkg -pac"...], 0x7ff4d5212940 /* 10 vars */) = 0
27    execve("/root/.opam/4.10.0/bin/ocamlfind", ["ocamlfind", "ocamlopt", "-linkpkg", "-package", "io-system", "main.cmx", "-o", "main.native"], 0x55c8c9506160 /* 10 vars */) = 0
28    execve("/root/.opam/4.10.0/bin/ocamlopt.opt", ["ocamlopt.opt", "-o", "main.native", "-I", "/root/.opam/4.10.0/lib/bytes", "-I", "/root/.opam/4.10.0/lib/result", "-I", "/root/.opam/4.10.0/lib/seq", "-I", "/root/.opam/4.10.0/lib/lwt", "-I", "/root/.opam/4.10.0/lib/mmap", "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/ocplib-en"..., "-I", "/root/.opam/4.10.0/lib/lwt/unix", "-I", "/root/.opam/4.10.0/lib/num", "-I", "/root/.opam/4.10.0/lib/io-system", "/root/.opam/4.10.0/lib/result/re"..., "/root/.opam/4.10.0/lib/lwt/lwt.c"..., "/root/.opam/4.10.0/lib/ocaml/uni"..., "/root/.opam/4.10.0/lib/ocaml/big"..., "/root/.opam/4.10.0/lib/mmap/mmap"..., "/root/.opam/4.10.0/lib/ocplib-en"..., "/root/.opam/4.10.0/lib/ocplib-en"..., "/root/.opam/4.10.0/lib/lwt/unix/"..., "/root/.opam/4.10.0/lib/ocaml/num"..., ...], 0x7ffd589587f0 /* 10 vars */) = 0
29    execve("/bin/sh", ["sh", "-c", "as  -o '/tmp/camlstartup8563ba.o"...], 0x7ffd6d057970 /* 10 vars */) = 0
29    execve("/usr/bin/as", ["as", "-o", "/tmp/camlstartup8563ba.o", "/tmp/camlstartup747fba.s"], 0x55c9526d6028 /* 10 vars */) = 0
29    +++ exited with 0 +++
28    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=29, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
30    execve("/bin/sh", ["sh", "-c", "gcc -O2 -fno-strict-aliasing -fw"...], 0x7ffd6d057970 /* 10 vars */) = 0
30    execve("/usr/bin/gcc", ["gcc", "-O2", "-fno-strict-aliasing", "-fwrapv", "-Wall", "-fno-common", "-fno-tree-vrp", "-ffunction-sections", "-D_FILE_OFFSET_BITS=64", "-D_REENTRANT", "-DCAML_NAME_SPACE", "-Wl,-E", "-o", "main.native", "-L/root/.opam/4.10.0/lib/bytes", "-L/root/.opam/4.10.0/lib/result", "-L/root/.opam/4.10.0/lib/seq", "-L/root/.opam/4.10.0/lib/lwt", "-L/root/.opam/4.10.0/lib/mmap", "-L/root/.opam/4.10.0/lib/ocplib-"..., "-L/root/.opam/4.10.0/lib/ocplib-"..., "-L/root/.opam/4.10.0/lib/lwt/uni"..., "-L/root/.opam/4.10.0/lib/num", "-L/root/.opam/4.10.0/lib/io-syst"..., "-L/root/.opam/4.10.0/lib/ocaml", "/tmp/camlstartup8563ba.o", "/root/.opam/4.10.0/lib/ocaml/std"..., "main.o", "/root/.opam/4.10.0/lib/io-system"..., "/root/.opam/4.10.0/lib/ocaml/num"..., "/root/.opam/4.10.0/lib/lwt/unix/"..., "/root/.opam/4.10.0/lib/ocplib-en"..., ...], 0x55b94a5fbbb8 /* 10 vars */) = 0
31    execve("/usr/libexec/gcc/x86_64-alpine-linux-musl/9.3.0/collect2", ["/usr/libexec/gcc/x86_64-alpine-l"..., "-plugin", "/usr/libexec/gcc/x86_64-alpine-l"..., "-plugin-opt=/usr/libexec/gcc/x86"..., "-plugin-opt=-fresolution=/tmp/cc"..., "-plugin-opt=-pass-through=-lgcc", "-plugin-opt=-pass-through=-lgcc_"..., "-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc", "-plugin-opt=-pass-through=-lgcc_"..., "--eh-frame-hdr", "--hash-style=gnu", "-m", "elf_x86_64", "--as-needed", "-dynamic-linker", "/lib/ld-musl-x86_64.so.1", "-pie", "-z", "relro", "-z", "now", "-o", "main.native", "/usr/lib/gcc/x86_64-alpine-linux"..., "/usr/lib/gcc/x86_64-alpine-linux"..., "/usr/lib/gcc/x86_64-alpine-linux"..., "-L/root/.opam/4.10.0/lib/bytes", "-L/root/.opam/4.10.0/lib/result", "-L/root/.opam/4.10.0/lib/seq", "-L/root/.opam/4.10.0/lib/lwt", "-L/root/.opam/4.10.0/lib/mmap", ...], 0x87c060 /* 15 vars */) = 0
32    execve("/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld", ["/usr/lib/gcc/x86_64-alpine-linux"..., "-plugin", "/usr/libexec/gcc/x86_64-alpine-l"..., "-plugin-opt=/usr/libexec/gcc/x86"..., "-plugin-opt=-fresolution=/tmp/cc"..., "-plugin-opt=-pass-through=-lgcc", "-plugin-opt=-pass-through=-lgcc_"..., "-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc", "-plugin-opt=-pass-through=-lgcc_"..., "--eh-frame-hdr", "--hash-style=gnu", "-m", "elf_x86_64", "--as-needed", "-dynamic-linker", "/lib/ld-musl-x86_64.so.1", "-pie", "-z", "relro", "-z", "now", "-o", "main.native", "/usr/lib/gcc/x86_64-alpine-linux"..., "/usr/lib/gcc/x86_64-alpine-linux"..., "/usr/lib/gcc/x86_64-alpine-linux"..., "-L/root/.opam/4.10.0/lib/bytes", "-L/root/.opam/4.10.0/lib/result", "-L/root/.opam/4.10.0/lib/seq", "-L/root/.opam/4.10.0/lib/lwt", "-L/root/.opam/4.10.0/lib/mmap", ...], 0x7fff22bd2b48 /* 15 vars */) = 0
32    +++ exited with 0 +++
31    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=32, si_uid=0, si_status=0, si_utime=24, si_stime=40} ---
31    +++ exited with 0 +++
30    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=31, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
30    +++ exited with 0 +++
28    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=30, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
28    +++ exited with 0 +++
27    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=28, si_uid=0, si_status=0, si_utime=2, si_stime=10} ---
27    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=27, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
33    execve("/bin/sh", ["sh", "-c", "ln -sf /tmp/_build/main.native /"...], 0x7ffd045d1ae8 /* 10 vars */) = 0
33    execve("/bin/ln", ["ln", "-sf", "/tmp/_build/main.native", "/tmp"], 0x563aff689d60 /* 10 vars */) = 0
33    +++ exited with 0 +++
13    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=33, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
13    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=13, si_uid=0, si_status=0, si_utime=1, si_stime=0} ---
34    execve("/bin/cat", ["cat", "-"], 0x562d963d4d08 /* 10 vars */) = 0
35    execve("./main.native", ["./main.native"], 0x562d963d4cf0 /* 10 vars */) = 0
34    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=34, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
37    +++ exited with 0 +++
36    +++ exited with 0 +++
35    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=35, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
38    execve("/bin/rm", ["rm", "-rf", "/tmp/Main.glob", "/tmp/Main.v", "/tmp/Main.vo", "/tmp/Main.vok", "/tmp/Main.vos", "/tmp/_build", "/tmp/main.ml", "/tmp/main.mli", "/tmp/main.native"], 0x562d9772e148 /* 10 vars */) = 0
38    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=38, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
10    +++ exited with 0 +++