solutions to CodeEval in C++