Language: C++

#include <iostream>
#include <vector>
#include <map>

using namespace std;

int n;
long long id[4000];
 long long value[4000];
 long long number[4000];
map<long long,  long long> total;

int main() {
  while(true){
    cin >> n;
    if(n==0){
        return 0;
    }
    vector<long long> v;
    for (int i = 0; i < n; i++) {
        cin >> id[i] >> value[i] >> number[i];
        if(total.find(id[i])==total.end()){
          total.insert(make_pair(id[i], 0));
        }
        total[id[i]] += value[i] * number[i];
        // if (total[id[i]] > 1000000 && find(v.begin(), v.end(), id[i]) == v.end()) {
        //   v.push_back(id[i]);
        // }
    }
    if(!total.empty()) {
        map< long long,  long long>::iterator it = total.begin();
        while (it != total.end()) {
            if ((*it).second >= 1000000) {
                v.push_back((*it).first);
            }
            ++it;
        }
    }
    if (v.empty()) {
        cout << "NA" << endl;
    }
    // for (vector<long long>::iterator it = v.begin(); it != v.end(); ++it) {
    //     cout << *it << endl;
    // }
    vector<long long> used;
    for(int i=0; i<n;i++){
      if(std::find(v.begin(), v.end(), &(id[i])) != v.end() && std::find(used.begin(), used.end(), &(id[i])) == used.end()){
        cout << id[i] << endl;
        used.push_back(id[i]);
      }
    }
    v.clear();
    total.clear();
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:19: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, long long int*)'
   47 |       if(std::find(v.begin(), v.end(), &(id[i])) != v.end() && std::find(used.begin(), used.end(), &(id[i])) == used.end()){
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:47:19: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   47 |       if(std::find(v.begin(), v.end(), &(id[i])) != v.end() && std::find(used.begin(), used.end(), &(id[i])) == used.end()){
      |          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:47:73: error: no matching function for call to 'find(std::vector<long long int>::iterator, std::vector<long long int>::iterator, long long int*)'
   47 |       if(std::find(v.begin(), v.end(), &(id[i])) != v.end() && std::find(used.begin(), used.end(), &(id[i])) == used.end()){
      |                                                                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:47:73: note:   '__gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   47 |       if(std::find(v.begin(), v.end(), &(id[i])) != v.end() && std::find(used.begin(), used.end(), &(id[i])) == used.end()){
      |                                                                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~