#include <iostream>
#include <algorithm>
#include <numeric>
//#include <iterator>

int cw(int first, int second) {
	const int arr[] = {20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5};
    auto arr_end = std::cend(arr);
    auto f = std::find(std::cbegin(arr), arr_end, first);
    auto s = std::find(f, arr_end, second);
    if (s != arr_end) ++s;
    return std::accumulate(f, s, 0,
    	[](int a, int b){
    		int res = a + b;
    		std::cout << a << " + " << b << " = " << res << std::endl;
    		return res;
    	}
    );
}

int main() {
	int res = cw(18, 2);
	std::cout << "result = " << res;
	return 0;
}