codility-lesson-5 in C&C++