Language: C++

#include <algorithm>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using ll = long long;
using ld = long double;
void resolver();
inline void fast_io()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}
template <class T>
inline std::vector<T> read_vector()
{
    ll n;
    std::cin >> n;
    std::vector<T> ret(n);
    for (T &i : ret) {
        std::cin >> i;
    }
    return ret;
}
void t_case()
{
    ll t;
    std::cin >> t;
    while (t--) {
        resolver();
    }
}
void single_case()
{
    resolver();
}

int main(int argc, char *argv[])
{
    fast_io();
    // t_case();
    single_case();
}

void resolver()
{
    ll n;
    string s;
    vector<int> r;
    vector<int> g;
    vector<int> b;
    cin >> n >> s;
    ll num = 0;
    for (ll i = 0; i < n; i++) {
        if (s[i] == 'R')
            r.push_back(i + 1);
        if (s[i] == 'G')
            g.push_back(i + 1);
        if (s[i] == 'B')
            b.push_back(i + 1);
    }
    for (auto i : r)
        for (auto j : g)
            for (auto k : b) {
                if (2 * j == i + k)
                    continue;
                if (2 * k == i + j)
                    continue;
                if (2 * i == j + k)
                    continue;
                num++;
            }
    cout << num;
}


Compiler output:
a.cc: In function 'void resolver()':
a.cc:55:5: error: 'string' was not declared in this scope
   55 |     string s;
      |     ^~~~~~
a.cc:55:5: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:5:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:56:5: error: 'vector' was not declared in this scope
   56 |     vector<int> r;
      |     ^~~~~~
a.cc:56:5: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:12:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:56:12: error: expected primary-expression before 'int'
   56 |     vector<int> r;
      |            ^~~
a.cc:57:12: error: expected primary-expression before 'int'
   57 |     vector<int> g;
      |            ^~~
a.cc:58:12: error: expected primary-expression before 'int'
   58 |     vector<int> b;
      |            ^~~
a.cc:59:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   59 |     cin >> n >> s;
      |     ^~~
      |     std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:59:17: error: 's' was not declared in this scope
   59 |     cin >> n >> s;
      |                 ^
a.cc:63:13: error: 'r' was not declared in this scope
   63 |             r.push_back(i + 1);
      |             ^
a.cc:65:13: error: 'g' was not declared in this scope
   65 |             g.push_back(i + 1);
      |             ^
a.cc:67:13: error: 'b' was not declared in this scope
   67 |             b.push_back(i + 1);
      |             ^
a.cc:69:19: error: 'r' was not declared in this scope
   69 |     for (auto i : r)
      |                   ^
a.cc:70:23: error: 'g' was not declared in this scope
   70 |         for (auto j : g)
      |                       ^
a.cc:71:27: error: 'b' was not declared in this scope
   71 |             for (auto k : b) {
      |                           ^
a.cc:80:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   80 |     cout << num;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~