0
#include<iostream>
#include<unordered_set>
using namespace std;
unordered_set<int> s;
int main()
{
  int n, k, val;
  cin >> n >> k;
  for (int i = 0; i < n; i++)
  {
    cin >> val;
    s.insert(val);
  }
  int ans = 0;
  for (unordered_set<int>::iterator it = s.begin(); it != s.end(); ++it)
    if (s.find(*it + k) != s.end()) ans++;
  cout << ans << endl;
  return 0;}

It just says

error: 'unordered_set' does not name a type

Am I missing anything? or is there some problem with the compiler?

4

0

Browse other questions tagged or ask your own question.