add mercy solve in C++