Solver to Vincit's safebetter challenge (https://github.com/aleksih/safebetter)