my solutions on spoj.com