criyle/codenet-compile-errors huggingface dataset:
Language: C++

// Igorjan94, template version from 13 October 2017. C++17 version, modified 18 march 2020 (writeln<tuple>, whole->all) {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;

#define FOR(i, m, n) for (int i = m; i <  (int) (n); ++i)
#define ROF(i, m, n) for (int i = m; i >= (int) (n); --i)
#define forn(i, n)   for (int i = 0; i < (int) (n); ++i)
#define  fori1(n)    for (int i = 1; i < (int) (n); ++i)
#define  forj1(n)    for (int j = 1; j < (int) (n); ++j)
#define   fori(n)    for (int i = 0; i < (int) (n); ++i)
#define   forj(n)    for (int j = 0; j < (int) (n); ++j)
#define     SZ(a)    int(size(a))

typedef  pair<int, int>   pii;
typedef   vector<int>     vi;
typedef    long long      ll;

#define pb push_back
#define all(a) begin(a), end(a)
#define ints(a...) int a; readln(a)

//Igorjan
//}}}

void run()
{
    int n;
    string s;
    cin >> n >> s;
    vector<vector<int>> has(n + 1, {0, 0, 0});
    map<char, int> m = {{'R', 0}, {'G', 1}, {'B', 2}};
    ROF(i, n - 1, 0)
        has[i] = has[i + 1],
        has[i][m[s[i]]]++;
    ll ans = 0;
    fori(n)
        FOR(j, i + 1, n)
        if (s[i] != s[j])
        {
            ans += has[j][0] + has[j][1] + has[j][2] - has[j][m[s[i]]] - has[j][m[s[j]]];
            if (int k = j + (j - i); k < n && s[k] != s[i] && s[k] != s[j])
                ans--;
        }

    cout << ans << "\n";
}

//{{{
int main()
{
    ios_base::sync_with_stdio(false);
    run();
    cerr << fixed << setprecision(0) << "Execution time = " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:22: error: 'setprecision' was not declared in this scope
   57 |     cerr << fixed << setprecision(0) << "Execution time = " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
      |                      ^~~~~~~~~~~~
a.cc:6:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    5 | #include <map>
  +++ |+#include <iomanip>
    6 |
Language: C

//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const int N = 4005;

int n;
string str;
int cnt[N][26];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    cin>>n>>str;
    FOR(i,str.size()){
        cnt[i][str[i]-'A']++;
    }
    REV(i,n-1,0){
        FOR(j,26){
            cnt[i][j] += cnt[i+1][j];
        }
    }

    ll ans = 0;
    FOR(i,n){
        REP(j,i+1,n-1){
            if(str[i] == str[j])continue;
            int k = j + j-i;
            char ck = 'R';
            if(ck == str[i] || ck == str[j])ck = 'G';
            if(ck == str[i] || ck == str[j])ck = 'B';
            ans += cnt[j+1][ck-'A'];
            if(k < n && str[k] == ck)ans--;
        }
    }
    cout << ans << endl;

    return 0;
}


Compiler output:
main.c:5:10: fatal error: bits/stdc++.h: No such file or directory
    5 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int; // 多倍長整数（任意精度）

/*
 * 定数
 */
const long double PI = (acos(-1));
const long double EPS = 1e-10;
const long long INF = 1e18;

/*
 * データ変換 
 */
/* char -> int */
int ctoi(char c) { return (int)(c - '0'); }

/*
 * 数学的な計算
 */
/* 階乗 */
int factorial(int n){ int ret = 1; for(int i = 1; i < n + 1; ++i) { ret = ret * i; } return ret; }

/* 最大公約数 */
template <typename T>T gcd(T x, T y){ return x % y == 0 ? y : gcd(y, x % y); }

/* 最小公倍数 */
template <typename T>T lcm(T a, T b) { return a * b / gcd(a, b); }

/* n個の整数の最小公倍数 */
template <typename T>T lcm_n(vector<T> &numbers) { T l; l = numbers[0]; for(int i = 1; i < numbers.size(); ++i) { l = lcm(l, numbers[i]); } return l; }

/*
 * DP向け
 */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/*
 * グラフ
 */
class Graph {
   public:
    vector<vector<int>> G;
    vector<int> Trans;
    vector<int> inDeg;
    int numV;
 
    Graph(int numV) {
        this->numV = numV;
        inDeg.assign(numV, 0);
        Trans.assign(numV, 0);
        G.assign(numV, vector<int>());
    }
 
    int topologicalSort(int v, vector<int> &dp) {
        if (dp[v] != -1) {
            return dp[v];
        }
 
        int res = 0;
 
        for (auto to : G[v]) {
            chmax(res, topologicalSort(to, dp) + 1);
        }
 
        return dp[v] = res;
    }
};

int main(){
  string s;
  int N;
  cin >> N >> s;

  ll cnt = 0;

  for(int i = 0; i < N-2; ++i){
    for(int j = i+1; j<N-1; ++j){
      if(s[i] != s[j]){
        for(int k = j+1; k<N; ++k){
          if(s[i] != s[k] && s[j] != s[k] && j-i != k-j){
            ++cnt;
          }
        }
      }
    }
  }

  cout << cnt << endl;

  return 0;
}


Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
using namespace std;
char s[4010];
long long n,a,b,c,ans;
int main()
{
    int i,j;
    cin>>n;
    for(i=1;i<=n;i++) 
    {
        cin>>s[i];
        if(s[i]=='R') a++;
        if(s[i]=='G') b++;
        if(s[i]=='B') c++;
    }
    ans=a*b*c;
    for(i=1;i<=n;i++)
     for(j=1;i-j>0&&i+j<=n;j++)
      if(s[i]!=s[i-j]&&s[i-j]!=s[i+j]&&s[i]!=s[i+j]) 
       ans--;
    cout<<ans;
    cin>>i;
    return 0;
}
        
    


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)3e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

void solve() {
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<int> rsuff(n, 0), bsuff(n, 0), gsuff(n, 0);
    for(int i = n - 2; i >= 0; i--) {
        rsuff[i] = rsuff[i + 1];
        bsuff[i] = bsuff[i + 1];
        gsuff[i] = gsuff[i + 1];
        if(s[i + 1] == 'R') rsuff[i]++;
        else if(s[i + 1] == 'G') gsuff[i]++;
        else bsuff[i]++;
    }
    int ans = 0;
    f(i, n - 2) {
        for(int j = i + 1; j < n; j++){
            if(s[i] == s[j]) continue;
            char col = ('R' ^ 'G' ^ 'B' ^ s[i] ^ s[j]);
            if(col == 'R') {
                ans += rsuff[j];
                if(j + j - i < n && s[j + j - i] == 'R') ans--;
            }
            else if(col == 'B') {
                ans += bsuff[j];
                if(j + j - i < n && s[j + j - i] == 'B') ans--;
            }
            else {
                ans += gsuff[j];
                if(j + j - i < n && s[j + j - i] == 'G') ans--;
            }
        }
    }
    cout<<ans;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int t = 1;
    //cin>>t;
    while(t--) {
        solve();
    }
    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, ans;
  cin >> N;
  string S;
  cin >> S;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == "R") {
      for (int j = 0; j < N; j++) {
        if (S.at(j) == "G") {
          for (int k = 0; k < N; k++) {
            if (S.at(k) == "B") {
              if (j - i != k - j) {
                ans++;
              }
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}
                

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |     if (S.at(i) == "R") {
      |         ~~~~~~~~^~~~~~
a.cc:12:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |         if (S.at(j) == "G") {
      |             ~~~~~~~~^~~~~~
a.cc:14:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |             if (S.at(k) == "B") {
      |                 ~~~~~~~~^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define ALL(V) ((V).begin(),(V).end())
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
using namespace std;

int main(){
  ll N,cnt=0;
  string S;
  cin>>N>>S;
  
  ll A[N],cntr=0,cntg=0,cntb=0;
  REP(i,N){
    if(S.at(i)=='R'){
      A[i]=1;
      cntr++;
    }
    if(S.at(i)=='G'){
      A[i]=2;
      cntg++;
    }
    if(S.at(i)=='B'){
      A[i]=3;
      cntb++;
    }
  }
  
  for(int i=0; i<N-2; ++i){
    for(int j=i+1; j<N-1; ++j){
      int k=2*j-i
      if(k>=N) continue;
      
      if(A[i]+A[j]==3){
        if(A[k]==3) cnt++;
      }
      if(A[i]+A[j]==5){
        if(A[k]==1) cnt++;
      }
      if(A[i]+A[j]==4 && A[i]!=2){
        if(A[k]==2) cnt++;
      }
    }
  }
  
  
  cout<<cntr*cntg*cntb-cnt<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:7: error: expected ',' or ';' before 'if'
   69 |       if(k>=N) continue;
      |       ^~
Language: C

#include <bits/stdc++.h>

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int cnt[MAX];
char _s[MAX];
int s[MAX];
ll sol;
int n;

void solve(int poc){
	REP(i,300) cnt[i]=0;
	FOR(i,poc+1,n) cnt[s[i]]++;
	FOR(nx,poc+1,n){
		cnt[s[nx]]--;
		if (s[nx]==s[poc]) continue;
		sol+=cnt['R']+cnt['G']+cnt['B'];
		sol-=cnt[s[poc]];
		sol-=cnt[s[nx]];
		int d=nx + (nx-poc);
		if (d>=n) continue;
		if (s[d]!=s[poc] && s[d]!=s[nx]) sol--;
	}
}

int main(){
	scanf ("%*d");
	scanf ("%s",_s);
	n=strlen(_s);
	REP(i,n) s[i]=(int)_s[i];
	REP(i,n) solve(i);
	
	printf ("%lld\n",sol);
	return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

// Problem : D - RGB Triplets
// Contest : AtCoder - AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;

const int maxn=4000+10;
char s[maxn];

int id(char ch){
	if(ch=='R') return 1;
	if(ch=='G') return 2;
	return 3;
}

int sum[maxn][4];

int main()
{
	int n;
	cin>>n;
	scanf("%s",s+1);
	rep(i,1,n){
		rep(j,1,3) sum[i][j]=sum[i-1][j];
		++sum[i][id(s[i])];
	}

	ll ans=0;	
	rep(i,1,n){
		rep(j,i+2,n) if(s[i]!=s[j]){
			int v=1;
			for(;v<=3;++v){
				if(v!=id(s[i]) && v!=id(s[j])) break;
			}
			ans+=sum[j][v]-sum[i-1][v];
			if(((i+j)&1) == 0 && id(s[(i+j)/2]) == v) --ans;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
main.c:9:9: fatal error: cstdio: No such file or directory
    9 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second 
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
//#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
inline void out(int x){
	if(x>=10)out(x/10);
	putchar(x%10+'0');
}
int n,a[3][4040];
string s;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>s;
	a[0][0]=a[1][0]=a[2][0]=0;
	fo(i,0,n+1){
		a[0][i+1]=a[0][i]+(s[i]=='R');
		a[1][i+1]=a[1][i]+(s[i]=='G');
		a[2][i+1]=a[2][i]+(s[i]=='B');
	}
	ll ans=0;
	fo(i,0,n-2) fo(j,i+1,n-1) if(s[i]!=s[j]){
		if((s[i]=='R'&&s[j]=='G')||(s[i]=='G'&&s[j]=='R'))ans+=a[2][n]-a[2][j+1]-(s[2*j-i]=='B');
		else if((s[i]=='R'&&s[j]=='B')||(s[i]=='B'&&s[j]=='R'))ans+=a[1][n]-a[1][j+1]-(s[2*j-i]=='G');
		else ans+=a[0][n]-a[0][j+1]-(s[2*j-i]=='R');
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end() 
#define MOD 1000000007
#define N 100005
#define pll pair<ll,ll>
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));


void solve()
{ 
     ll n;
     cin >> n;
     string s;
     cin >> s;
     s = 'a' + s;
     ll pre[n+2][3];
     memset(pre,0,sizeof(pre));
     for(ll i=1;i<=n;i++)
     {
          if(s[i]=='R')     pre[i][0]++;
          if(s[i]=='G')     pre[i][1]++;
          if(s[i]=='B')     pre[i][2]++;
     }
     for(ll i=n-1;i>=0;i--) 
     {
          pre[i][0] += pre[i+1][0];
          pre[i][1] += pre[i+1][1];
          pre[i][2] += pre[i+1][2];
     }
     ll ans = 0;
     for(ll i=1;i<=n;i++)
     {
          for(ll j=i+1;j<=n;j++)
          {
               if(s[i]!=s[j])
               {
                    char c = 'R' + 'G' + 'B' - s[i] - s[j];
                    ll id;
                    if(c=='R')   id = 0;
                    if(c=='G')   id = 1;
                    if(c=='B')   id = 2;
                    ans += pre[j+1][id];
                    ll dif = j - i;
                    ll newi = j + dif;
                    if(newi<=n && s[newi]==c)   ans--;
               }
          }
     }
     cout<<ans;
}

int main()
{
     FAST;
     ll t = 1;
  ///   cin >> t;
     while(t--)
     {     
          solve();
     }
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N;
    string S;
    cin >> N >> S;

    vec r, g, b;
    Rep (i, N) {
        if (S[i] == 'R') {
            r.push_back(i);
        } else if (S[i] == 'B') {
            b.push_back(i);
        } else {
            g.push_back(i);
        }
    }

    ll ans = 0;
    Rep (i, N) {
        for (ll j = i+1; j < N; j++) {
            if (S[i] == S[j]) {
                continue;
            }
            if (S[i] == 'R' and S[j] == 'G' or S[i] == 'G' and S[j] == 'R') {
                ll tmp = b.end() - lower_bound(b.begin(), b.end(), j);
                if (2*j-i < N and S[2*j-i] == 'B') tmp--;
                ans += tmp;
            } else if (S[i] == 'G' and S[j] == 'B' or S[i] == 'B' and S[j] == 'G') {
                ll tmp = r.end() - lower_bound(r.begin(), r.end(), j);
                if (2*j-i < N and S[2*j-i] == 'R') tmp--;
                ans += tmp;
            } else {
                ll tmp = g.end() - lower_bound(g.begin(), g.end(), j);
                if (2*j-i < N and S[2*j-i] == 'G') tmp--;
                ans += tmp;
            }
        }
    }

    cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std; 

//int _; 

int n,ans=0,a[3];
string s;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	cin >> n >> s;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			for(int k=0;k<n;k++)
				if(s[i] == 'R' && s[j] == 'G' && s[k] == 'B') 
				{
					a[0]=i;
					a[1]=j;
					a[2]=k;
					sort(a,a+3);
					if(a[1]*2-a[0]-a[2])						
						ans++;
				}
	cout << ans << endl;
	return 0;
}



Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    ll n;
    string s;
    cin >> n >> s;
    ll a[3] = {0,0,0};
    for (int i = 0;i < n;++i) {
        if (s[i] == 'R') a[0]++;
        else if (s[i] == 'G') a[1]++;
        else a[2]++;
    }
    ll ans = a[0]*a[1]*a[2];
    for (int i = 1;i < n;++i) {
        for (int j = 0;j < n;++j) {
            if (j+i+i >= n) break;
            if (s[j] != s[j+i] && s[j+i] != s[j+i+i] && s[j] != s[j+i+i]) ans--;
        }
    }
    cout << ans << endl;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++);
#define ll long long
int main(){
	ll n,count=0;
	string s;
	cin >> n >> s;
	vector<int> r;
	vector<int> g;
	vector<int> b;
	rep(i,n){
		if(s[i]=='R')r.push_back(i);
		else if(s[i]=='G')g.push_back(i);
		else(s[i]=='B')b.push_back(i);
	}
	for(int i:r){
		for(int j:g){
			for(int k:b){
				if(j-i!=k-j&&k-j>0)count++;
			}
		}
	}
	cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:22: error: 'i' was not declared in this scope
   13 |                 if(s[i]=='R')r.push_back(i);
      |                      ^
Language: C

//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  int n;string s;cin>>n>>s;
  vector<int> R;
  vector<int> G;
  set<int> B;
  for(int i = 0; n > i; i++){
    if(s[i]=='R')R.push_back(i);
    else if(s[i]=='G')G.push_back(i);
    else B.insert(i);
  }
  long long ans = 0;
  for(int i = 0; R.size() > i; i++){
    for(int j = 0; G.size() > j; j++){
      int mn = min(R[i],G[j]);
      int mx = max(R[i],G[j]);
      ans += B.size();
      if(B.find(mx+mx-mn) != B.end())ans--;
      if(B.find(mn-(mx-mn)) != B.end())ans--;
      if(!((mx-mn)%2) && B.find((mx+mn)/2) != B.end())ans--;
    }
  }
  cout << ans << endl;
}

Compiler output:
main.c:5:10: fatal error: iostream: No such file or directory
    5 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 4010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, a[MAXN];
vector<int> f[3];
string s;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> s;
    s = " " + s;
    FOR(i,1,n)
        if (s[i] == 'R') a[i] = 0;
        else if (s[i] == 'G') a[i] = 1;
        else a[i] = 2;
    FOR(i,1,n) f[a[i]].push_back(i);
    ll res = 0;
    FOR(i,1,n)
        FOR(j,i+1,n) {
            if (a[i] == a[j]) continue;
            int l = j+1, val = 3 - a[i] - a[j], diff = j - i;
            int dau = 0, cuoi = SZ(f[val])-1;
            while (dau <= cuoi) {
                int mid = (dau + cuoi) >> 1;
                if (f[val][mid] >= l) cuoi = mid-1;
                else dau = mid+1;
            }
            if (dau >= 0 && dau < SZ(f[val])) {
                int num = SZ(f[val]) - dau;
                if (j + diff <= n && a[j + diff] == val) num--;
                res += num;
            }
        }
    cout << res;
    return 0;
}


Compiler output:
main.c:7:10: fatal error: bits/stdc++.h: No such file or directory
    7 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define lli long long int
#define llu long long unsigned int
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FOR(i,s,e) for(i=s; i<e; i++)
#define mod 998244353
#define F first
#define S second
#define plli pair<lli,lli>
#define pqlli priority_queue<lli>
#define test(t) cin>>t; while(t--)
using namespace std;
 
lli power(lli a, lli b, lli M = mod)
{
	lli result = 1;
    for (;;)
    {
        if (b & 1)
            result = (result*a)%M;
        b >>= 1;
        if (!b)
            break;
        a = (a*a)%M;
    }
    return result;
}

int main()
{
    IOS;
    lli n;
    cin>>n;
    string s;
    cin>>s;
    lli dp[3][n+1];
    memset(dp, 0, sizeof(dp));
    for(lli i = 1; i<n+1; i++)
    dp[0][i] = dp[0][i-1] + (s[i-1] == 'R'), dp[1][i] = dp[1][i-1] + (s[i-1] == 'G'), dp[2][i] = dp[2][i-1] + (s[i-1] == 'B');
	lli ans = 0;
    for(lli i = 0; i<n; i++)
    {
		for(lli k = i+3; k<n; k++)
		{
			if(s[i] != s[k])
			{
				if(s[i]!='R' and s[k]!='R')
				{
					ans += dp[0][k] - dp[0][i+1];
					if((k-i-1)%2 and (s[(k+i)/2] == 'R'))
					ans--;
				}
				else if(s[i]!='G' and s[k]!='G')
				{
					ans += dp[1][k] - dp[1][i+1];
					if((k-i-1)%2 and (s[(k+i)/2] == 'G'))
					ans--;
				}
				else
				{
					ans += dp[2][k] - dp[2][i+1];
					if((k-i-1)%2 and (s[(k+i)/2] == 'B'))
					ans--;
				}
			}
		}
	}
	cout<<ans<<endl;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n;
string s;
i64 a,b,c;
void solve(){
	cin >> n >> s;
	
	i64 ans = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'R') a++;
		if(s[i] == 'G') b++;
		if(s[i] == 'B') c++;
	}
	ans = a*b*c;
	for(int i = 1; i < n; i++){
		for(int j = 0; j < n; j++){
			if(j+i+i >= n) break;
			if(s[j] != s[j+i] && s[j] != s[j+i+i] && s[j+i] != s[j+i+i]){
				ans--;
			}
		}
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;

int cnt[3];
int pos[3][4000+1];

void solve(long long N, std::string S){
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') pos[0][cnt[0]++] = i;
        else if (S[i] == 'G') pos[1][cnt[1]++] = i;
        else pos[2][cnt[2]++] = i;
    }
    set<tuple<int, int, int>> res;
    for (int i = 0; i < cnt[0]; i++) {
        for (int j = 0; j < cnt[1]; j++) {
            for (int k = 0; k < cnt[2]; k++) {
                int tmp_min = min(pos[2][k], min(pos[0][i], pos[1][j]));
                int tmp_max = max(pos[2][k], max(pos[0][i], pos[1][j]));
                int middle = pos[2][k] + pos[1][j] + pos[0][i] - tmp_min - tmp_max;
                if (tmp_max - middle != middle - tmp_min && tmp_max > middle && tmp_min < middle) {
                    res.insert(make_tuple(tmp_min, middle, tmp_max));
                }
            }
        }
    }
    cout << res.size() << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=4009;
int main()
{
    int n,len;
    ll ans=0,sum[N][3];
    char a[N];
    map<char,int>ma;
    ma['R']=0,ma['G']=1,ma['B']=2;
    scanf("%d%s",&n,a+1);
    for(int i=1; i<=n; i++)
        for(int j=0; j<3; j++)
            sum[i][j]=sum[i-1][j]+(ma[a[i]]==j?1:0);
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<i; j++)
        {
            if(a[i]==a[j])
                continue;
            for(int k=0; k<3; k++)
                if(k!=ma[a[i]]&&k!=ma[a[j]])
                {
                    ans+=sum[j-1][k];
                    if(2*j-i>=1&&ma[a[2*j-i]]==k)
                        ans--;
                }
        }
    }
    printf("%lld",ans);
    return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
string s;
int r[4005],g[4005],b[4005];
ll ans;
int main(void){
    cin>>n>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='R'){
            r[i]=1;
        }else if(s[i]=='G'){
            g[i]=1;
        }else{
            b[i]=1;
        }
    }
    for(int i=s.size()-2;i>=0;i--){
        r[i]=r[i+1]+r[i];
        g[i]=g[i+1]+g[i];
        b[i]=b[i+1]+b[i];
    }
    for(int i=0;i<s.size()-1;i++){
        for(int j=i+1;j<s.size();j++){
            if((s[i]=='R'&&s[j]=='G')||(s[j]=='R'&&s[i]=='G')){
                if(j+j-i<s.size()){
                    if(s[j+j-i]=='B'){
                        ans+=b[j+1]-1;
                    }else{
                        ans+=b[j+1];
                    }
                }else{
                    ans+=b[j+1];
                }
            }else if((s[i]=='G'&&s[j]=='B')||(s[j]=='G'&&s[i]=='B')){
                if(j+j-i<s.size()){
                    if(s[j+j-i]=='R'){
                        ans+=r[j+1]-1;
                    }else{
                        ans+=r[j+1];
                    }
                }else{
                    ans+=r[j+1];
                }
            }else if((s[i]=='B'&&s[j]=='R')||(s[j]=='B'&&s[i]=='R')){
                if(j+j-i<s.size()){
                    if(s[j+j-i]=='G'){
                        ans+=g[j+1]-1;
                    }else{
                        ans+=g[j+1];
                    }
                }else{
                    ans+=g[j+1];
                }
            }
        }
    }
    cout<<ans<<endl;
	
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e4 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , ans , cnt[3] , A[MAXN] , C[MAXN][3][3];
string s;

int main() {
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

    cin >> n >> s;
    for(ll i = 0 ; i < n ; i++){
        if(s[i] == 'R') A[i] = 0;
        if(s[i] == 'G') A[i] = 1;
        if(s[i] == 'B') A[i] = 2;
        cnt[A[i]]++;
    }

    ans = cnt[0] * cnt[1] * cnt[2];
    for(ll i = 0 ; i < n ; i++){
        for(ll j = i + 1 ; j < n ; j++){
            ll k = j + (j - i);
            if(k >= n)  continue;
            if(A[i] != A[j] && A[j] != A[k] && A[i] != A[k])    ans--;
        }
    }
    cout << ans << endl;

    return 0;
}
/*

*/


Compiler output:
main.c:7:10: fatal error: bits/stdc++.h: No such file or directory
    7 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#ifndef LOCAL
#define endl '\n'
#endif

const int mod = 1e9 + 7;

int pwr(int a,int b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

const int N = 4005;
int pre[3][N];
string ss = "RGB";

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll ans = 0;
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j < 3; j++) {
			pre[j][i] = pre[j][i - 1] + (s[i - 1] == ss[j]);
		}
	}
	for(int i = 0; i < n; i++) {
		for(int j = i + 1; j < n; j++) {
			if(s[i] == s[j]) continue;
			char ch = s[i] ^ s[j] ^ 'R' ^ 'B' ^ 'G';
			int k;
			for(int l = 0; l < 3; l++) {
				if(ss[l] == ch) k = l;
			}
			ans += pre[k][n] - pre[k][j];
			int kk = i + (j - i) * 2;
			if(kk < n && s[kk] == ch) {
				ans--;
			}
		}
	}
	cout << ans;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	// cin >> t;
	t = 1;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include "bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
#define nmax 4005
#define inf
using namespace std;
int a[3][nmax];
int get(char c){
    if (c == 'R'){
        return 0;
    }
    if (c == 'G'){
        return 1;
    }
    return 2;
}
int oth(int a, int b){
    if (a > b){
        swap(a, b);
    }
    if (a == 0){
        if (b == 1){
            return 2;
        }
        return 1;
    }
    if (a == 1){
        if (b == 0){
            return 2;
        }
        return 0;
    }
    if (b == 1){
        return 0;
    }
    return 1;
}
char chh(int x){
    if (x == 0){
        return 'R';
    }
    if (x == 1){
        return 'G';
    }
    return 'B';
}
int main()
{
    int n;
    string s;
    cin>>n>>s;
    for (int i=n-1;i>=0;--i){
        for (int j=0;j<3;++j){
            a[j][i] = a[j][i+1];
        }
        int ind = get(s[i]);
        ++a[ind][i];
    }
    long long ans = 0;
    for (int i=0;i<n;++i){
        int ind1 = get(s[i]);
        for (int j=i+1;j<n-1;++j){
            int ind2 = get(s[j]);
            if (ind1 == ind2){
                continue;
            }
            int ot = oth(ind1, ind2);
            int add = a[ot][j+1];
            int diff = j - i;
            if (j + diff < n){
                if (chh(ot) == s[j+diff]){
                    --add;
                }
            }
            ans += add;
        }
    }
    cout<<ans<<'\n';
    return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

// Optimise
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "/home/shahraaz/bin/debug.h"
#else
#define db(...)
#endif

using ll = long long;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()

const int NAX = 2e5 + 5, MOD = 1000000007;

class Solution
{
private:
public:
    Solution() {}
    ~Solution() {}
    void solveCase()
    {
        int n;
        cin >> n;
        string str;
        cin >> str;
        auto get = [](char c) -> int {
            if (c == 'R')
                return 0;
            if (c == 'G')
                return 1;
            // if(c == 'B')
            return 2;
        };
        vector<vector<int>> poses(3);
        for (size_t i = 0; i < n; i++)
            poses[get(str[i])].pb(i);
        ll res = 0;
        for (size_t i = 0; i < n; i++)
        {
            for (size_t j = i + 1; j < n; j++)
            {
                if (get(str[i]) != get(str[j]))
                {
                    int nextClr = 3 - get(str[i]) - get(str[j]);
                    int cnt = upper_bound(all(poses[nextClr]), j) - poses[nextClr].begin();
                    int scare = j + (j - i);
                    auto it = lower_bound(all(poses[nextClr]), scare);
                    bool ss = false;
                    if (it != poses[nextClr].end())
                        if (*it == scare)
                            ss = true;
                    res += poses[nextClr].size() - cnt - ss;
                }
            }
        }

        cout << res << '\n';
    }
};

int32_t main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
    // cin >> t;
    Solution mySolver;
    for (int i = 1; i <= t; ++i)
    {
        mySolver.solveCase();
#ifdef LOCAL
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n;cin>>n;
    string s;cin>>s;
    ll r=0,g=0,b=0;
    rep(i,0,n-1){
        if(s[i]=='R'){
            r++;
        }else if(s[i]=='G'){
            g++;
        }else{
            b++;
        }
    }
    ll ans=r*g*b;
    rep(i,1,n){
        rep(j,0,n-1){
            if(j+2*i>=n){
                break;
            }
            if(s[j]!=s[j+i] && s[j+i]!=s[j+2*i] && s[j+2*i]!=s[j]){
                ans--;
            }
        }
    }
    cout<<ans<<endl;
    
    return 0;
}





Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

V#include<bits/stdc++.h>
 
#define ll long long 
#define mkp make_pair 
#define fi first 
#define se second
#define pb push_back 
#define pf push_front 
#define ppb pop_back 
#define ppf pop_front 

using namespace std ;
 
int z , o , ans ;
 
int main(){
 
	int n ;

	string s ;

	cin >> n >> s ;

	for( int i = 0 ; i < n - 2 ; i ++ ){

		for( int j = i + 1 ; j < n - 1 ; j ++ ){

			for( int u = j + 1 ; u < n ; u ++ ){

				if( s[i] != s[j] && s[i] != s[u] && s[j] != s[u] && j - i != u - j ){

					ans ++ ;

				}

			}

		}

	}

	cout << ans ;
 
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | V#include<bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'V' does not name a type
    1 | V#include<bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:20:9: error: 'string' was not declared in this scope
   20 |         string s ;
      |         ^~~~~~
a.cc:22:9: error: 'cin' was not declared in this scope
   22 |         cin >> n >> s ;
      |         ^~~
a.cc:22:21: error: 's' was not declared in this scope
   22 |         cin >> n >> s ;
      |                     ^
a.cc:42:9: error: 'cout' was not declared in this scope
   42 |         cout << ans ;
      |         ^~~~
Language: C

#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;

    vector<ll> cnt(3,0);
    for(int i=0; i<N; i++){
        if(S[i]=='R'){
            cnt[0]++;
        }else if(S[i]=='G'){
            cnt[1]++;
        }else{
            cnt[2]++;
        }
    }
    ll ans=cnt[0]*cnt[1]*cnt[2];

    for(int i=0; i<N; i++){
        for(int j=1; i+2*j<N; j++){
            if(S[i]!=S[i+j] && S[i+j]!=S[i+2*j] && S[i+2*j]!=S[i]){
                ans--;
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

// atcoder/abc162/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  std::cout.setf(std::ios_base::fixed);
  std::cout.precision(15);

  int n;
  str s;
  while (cin >> n >> s) {
    vec<int> r, g, b;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == 'R') r.push_back(i);
      if (s[i] == 'G') g.push_back(i);
      if (s[i] == 'B') b.push_back(i);
    }

    lli z = 0;
    const int sum = (int)'R' + (int)'G' + (int)'B';
    for (int i = 0; i < s.size(); ++i) {
      for (int j = i + 1; j < s.size(); ++j) {
        if (s[i] != s[j]) {
          const char c = sum - s[i] - s[j];
          if (c == 'R') {
            int x = r.end() - lower_bound(r.begin(), r.end(), j + 1);
            int y = binary_search(r.begin(), r.end(), j + abs(i - j));
            z += x - y;
          }
          if (c == 'G') {
            int x = g.end() - lower_bound(g.begin(), g.end(), j + 1);
            int y = binary_search(g.begin(), g.end(), j + abs(i - j));
            z += x - y;
          }
          if (c == 'B') {
            int x = b.end() - lower_bound(b.begin(), b.end(), j + 1);
            int y = binary_search(b.begin(), b.end(), j + abs(i - j));
            z += x - y;
          }
        }
      }
    }
    cout << z << endl;
  }

  return 0;
}


Compiler output:
main.c:5:10: fatal error: bits/stdc++.h: No such file or directory
    5 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int N; string S; cin>>N>>S;
	map<char,ll> ct;
	for (int i=0; i<N; i++)
		ct[S[i]]++;
	ll ret=1;
	for (auto it : ct)
		ret*=it.second;
	for (int i=0; i<N; i++)
		for (int j=i+1; 2*j-i<N; j++) {
			int k=2*j-i;
			if(S[i]!=S[j]&&S[j]!=S[k]&&S[i]!=S[k])
				ret--;
		}
	cout<<ret<<"\n";
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.