The submission I've made here compiles fine on my local machine (OCaml 4.13.1), and I'm not using any language features incompatiable with v4.02 (the version CodeForces uses). However, the executable generated by ocamlopt runs in a few milliseconds on my machine, whereas it TLE's on the third testcase here.
The command I used to compile was ocamlopt -o test 1681D.ml. If anyone has any ideas why this is happening, please do share.







