Language: C++

#include <iostream>
#include <string>
#include <vector>
#define NMAX 4002
using namespace std;
int main(){
  int N,ans = 0;
  char S[NMAX];
  vector<int> v[3];
  cin >> N;
  for (int i = 0; i < N; ++i)
  {
    cin >> S[i];
    if(S[i] == 'R') v[0].push_back(i);
    else if(S[i] == 'G') v[1].push_back(i);
    else if(S[i] == 'B') v[2].push_back(i);
  }
  for (int i = 0; i < v[0].size(); ++i)
  {
    for (int j = 0; j < v[1].size(); ++j)
    {
      int num = 0;
      if(find(v[2].begin(), v[2].end(),v[0][i]*2-v[1][j]) != v[2].end()) num++;
      if(find(v[2].begin(), v[2].end(),v[1][j]*2-v[0][i]) != v[2].end()) num++;
      if(find(v[2].begin(), v[2].end(),(v[0][i]+v[1][j])/2) != v[2].end() && (v[0][i]+v[1][j])%2 == 0) num++;
      ans += v[2].size() - num;
    }
  }
  cout << ans << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   23 |       if(find(v[2].begin(), v[2].end(),v[0][i]*2-v[1][j]) != v[2].end()) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:23:14: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   23 |       if(find(v[2].begin(), v[2].end(),v[0][i]*2-v[1][j]) != v[2].end()) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:24:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   24 |       if(find(v[2].begin(), v[2].end(),v[1][j]*2-v[0][i]) != v[2].end()) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:24:14: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   24 |       if(find(v[2].begin(), v[2].end(),v[1][j]*2-v[0][i]) != v[2].end()) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:25:14: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type)'
   25 |       if(find(v[2].begin(), v[2].end(),(v[0][i]+v[1][j])/2) != v[2].end() && (v[0][i]+v[1][j])%2 == 0) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:25:14: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   25 |       if(find(v[2].begin(), v[2].end(),(v[0][i]+v[1][j])/2) != v[2].end() && (v[0][i]+v[1][j])%2 == 0) num++;
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~