codility-lesson-6 in C&C++