Efficient way to remove duplicate strings after adding their key values
Avoid using namespace std;

Importing all names of a namespace is a bad habit to get into, and can cause surprise when names like begin and size are in the global namespace.  Get used to using the namespace prefix (std is intentionally very short), or importing just the names you need into the smallest reasonable scope.

The exceptions to this rule are namespaces explicitly intended to be imported wholesale, such as the std::literals namespaces.

Avoid preprocessor macros

If you want a shorter name for a type, it's much safer to write

using ull = unsigned long long;


Personally, I'd give it a name that reflects what I want to use it for, rather than what it (currently) is.

Improve naming

What's the significance of vec as a name?  It's confusingly similar to vector, but it's used as an element of a vector.  Similarly, its members s and e convey nothing - consider name and count, if that's what they represent.

Simplify the logic

It's a lot easier to accumulate counts if you introduce a std::map to hold the sums:

std::map&lt;std::string,ull&gt; accumulator;
for (auto const&amp; element: v)
    accumulator[element.s] += element.e;

// write them back into the vector
v.clear();
for (auto const&amp; element: accumulator)
    v.push_back(vec{element.first, element.second});