It means you are giving std::stoi() bad input, so it is throwing a std::invalid_argument exception that you are not catching.
std::stoi, std::stol, std::stoll:
terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
Exceptions
std::invalid_argument if no conversion could be performed
std::out_of_range if the converted value would fall out of the range of the result type or if the underlying function (std::strtol or std::strtoll) sets errno to ERANGE.
std::terminate
std::terminate() is called by the C++ runtime when exception handling fails for any of the following reasons:
1) an exception is thrown and not caught (it is implementation-defined whether any stack unwinding is done in this case)
You need to double-check your input string values that you are trying to convert to integers. They do not represent integers.