C++ solutions for various problems from http://www.spoj.com