SPOJ problems solved in Lua