solutions to problems in spoj