Three problems from SPOJ, practice night