solutions for problems on spoj, codeshef other sites