undordered_set uses Hash Table with $O(1)$ time on average

IMPORTANT: All elements in set are distinct and have a count of either 0 or 1. If you want multiple counts, use a multiset. →Multiset

A set can be used mostly like a vector, but it is not possible to access the elements using the [] notation.

Using sets for search:
Since a set is a tree, you can do search in $O(gn)$ time. I actually needed this to solve: https://dmoj.ca/problem/ccc15s3. I passed 29/30 cases except one because of TLE…

you need to do something like

Multiset

The function erase removes all instances of an element from a multiset:

Often, only one instance should be removed, which can be done as follows: