Count all unique subsets with Sum S
A lot of your vector initialization can be handled by vector's constructor. Not only is that much shorter and less error prone, it's also more efficient since it lets the vector avoid resizing over and over again.

As an example:

std::vector&lt; std::vector&lt; std::pair&lt;int, int&gt; &gt; &gt; vecHash;

for(int i =0; i &lt; (size*size); i++)
{
    vecHash.push_back(std::vector&lt; std::pair&lt;int, int&gt; &gt; ());
}


This can be:

std::vector&lt; std::vector&lt; std::pair&lt;int, int&gt; &gt; &gt; vecHash(size*size);




if(vecHash[input3 - i].size() &gt; 0)


This should be if(!vecHash[input3 - i].empty()) as empty() reads clearer.



Your logic and your IO should be handled separately. You should add a function for printing solutions so your validCombo isn't doing quite so much. That will mean returning the solutions instead of the number of solutions, but that makes more sense anyway.

For small little programs like this it doesn't really matter, but for anything non-trivial, you want each function to only do one thing. That allows you to control and modify things in a much easier way. (Even though we're not talking about OOP, this is essentially the essence of the SRP.



count = solution.size();
std::cout &lt;&lt; "solution size = "  &lt;&lt; solutionSet.size();

// ...

return count;


Either use count consistently, or don't bother assigning it.

Also, declare variables as close to use as possible. It's confusing to try to figure out where in the world count came from when it's declared a few dozen lines up.