solutions to some algorithmic problems from spoj/codechef