title: Why/Are unordered_map and unordered_set slower?
body: <p>I was solving a simple problem of finding unique elements in an array. I used a <code>std::unordered_map</code> to count unique elements but it gave <strong>Time Limit Exceeded</strong> in one test case. Then I used a <code>std::unordered_set</code> with the same result.</p>
  <p>PS: I used <code>std::unordered_map</code> and <code>std::unordered_set</code> because I read that these two are much much faster than <code>std::map</code> and <code>std::set</code> respectively.</p>
  <pre><code>#include&lt;bits/stdc++.h&gt;
  using namespace std;
  
  int main() {
      int n, a;
      cin &gt;&gt; n;
      unordered_set&lt;int&gt; s;
  
      for(int i = 0; i &lt; n; i++) {
          cin &gt;&gt; a;
          s.insert(a);
      }
      cout &lt;&lt; s.size();
  }
  </code></pre>
  <p>Test 7 exceeded the time limit.</p>
  <h3>My Question is:</h3>
  <p>If <code>std::unordered_map</code> and <code>std::unordered_set</code> are faster why did they give TLE?</p>