Ruby solutions to Sphere Online Judge (SPOJ) problems