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

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

int main() {
    int N; cin >> N;
    string S; cin >> S;
    vector<int> r, g, b;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') r.push_back(i);
        else if (S[i] == 'G') g.push_back(i);
        else if (S[i] == 'B') b.push_back(i);
    }
    //vec[i]はポインタがi以上のbの要素の数
    vector<int> vecR(N), vecG(N), vecB(N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < b.size(); j++) {
            if (b[j] >= i) vecB[i]++;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < g.size(); j++) {
            if (g[j] >= i) vecG[i]++;
        }
    }
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < r.size(); j++) {
            if (r[j] >= i) vecR[i]++;
        }
    }


    ll cnt = 0;
    for (int i = 0; i < r.size(); i++) {
        for (int j = 0; j < g.size(); j++) {
            if (g[j] <= r[i]) continue;
            ll val = g[j]-r[i];
            cnt += vecB[g[j]+1];
            if (S[g[j]+val] == 'B') {
                cnt --;
            } 
        }
    }
    for (int i = 0; i < r.size(); i++) {
        for (int j = 0; j < b.size(); j++) {
            if (b[j] <= r[i]) continue;
            ll val = b[j]-r[i];
            cnt += vecG[b[j]+1];
            if (S[b[j]+val] == 'G') {
                cnt --;
            } 
        }
    }
    for (int i = 0; i < g.size(); i++) {
        for (int j = 0; j < r.size(); j++) {
            if (r[j] <= g[i]) continue;
            ll val = r[j]-g[i];
            cnt += vecB[r[j]+1];
            if (S[r[j]+val] == 'B') {
                cnt --;
            } 
        }
    }
    for (int i = 0; i < g.size(); i++) {
        for (int j = 0; j < b.size(); j++) {
            if (b[j] <= g[i]) continue;
            ll val = b[j]-g[i];
            cnt += vecR[b[j]+1];
            if (S[b[j]+val] == 'R') {
                cnt --;
            } 
        }
    }
    for (int i = 0; i < b.size(); i++) {
        for (int j = 0; j < r.size(); j++) {
            if (r[j] <= b[i]) continue;
            ll val = r[j]-b[i];
            cnt += vecG[r[j]+1];
            if (S[r[j]+val] == 'G') {
                cnt --;
            } 
        }
    }
    for (int i = 0; i < b.size(); i++) {
        for (int j = 0; j < g.size(); j++) {
            if (g[j] <= b[i]) continue;
            ll val = g[j]-b[i];
            cnt += vecR[g[j]+1];
            if (S[g[j]+val] == 'R') {
                cnt --;
            } 
        }
    }
    cout << cnt << 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

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

int main(){
	int n;
    string s;
	cin >> n>>s;
    vector<int>r,g,b;
    int kazu_r=0;
    int kazu_g=0;
    int kazu_b=0;
	for (int i = 0;i < n;i++) {
      if(s[i]=='R'){
        r.push_back(i);
        //cout<<"R"<<i<<endl;
        kazu_r++;
      }else if(s[i]=='G'){
        g.push_back(i);
        kazu_g++;
      }else{
        b.push_back(i);
        kazu_b++;
      }
	}
    //cout<<kazu_r<<" "<<kazu_g<<" "<<kazu_b<<endl;
	long long kotae = 0;
    int dai=0;
    int mid=0;
    int shou=0; 
	for (int i = 0;i <kazu_r;i++) {
	  for (int j = 0;j <kazu_g;j++) {
	    for (int k = 0;k <kazu_b;k++) {
          
          dai=max(r[i],max(g[j],b[k]));
          shou=min(r[i],min(g[j],b[k]));
          mid=r[i]+g[j]+b[k]-dai-shou;
          //cout<<dai<<" "<<mid<<" "<<shou<<endl;
          if(mid-shou!=dai-mid){
            kotae++;
          }
        }
      }
	}
	cout << kotae << 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

int main(void) {
  int n;
  string s;
  int ans;
  
  cin >> n >> s;
  
  for(i = 0; i < n; i ++){
    for(j = i + 1; j < n; j++){
      for(l = j + 1; l < n; l++){
        if(s.at(i) != s.at(j))
          if(s.at(j) != s.at(l))
             if(s.at(i) != s.at(l))
               if ((j - i) != (l - j))
                 ans ++
    
    cout << ans
	return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(void) {
      | ~~~                 
a.cc: In function 'int main()':
a.cc:11:7: error: 'i' was not declared in this scope
   11 |   for(i = 0; i < n; i ++){
      |       ^
a.cc:12:9: error: 'j' was not declared in this scope
   12 |     for(j = i + 1; j < n; j++){
      |         ^
a.cc:13:11: error: 'l' was not declared in this scope
   13 |       for(l = j + 1; l < n; l++){
      |           ^
a.cc:18:24: error: expected ';' before 'cout'
   18 |                  ans ++
      |                        ^
      |                        ;
   19 | 
   20 |     cout << ans
      |     ~~~~                
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:12:31: note: to match this '{'
   12 |     for(j = i + 1; j < n; j++){
      |                               ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:11:26: note: to match this '{'
   11 |   for(i = 0; i < n; i ++){
      |                          ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:4:16: note: to match this '{'
    4 | int main(void) {
      |                ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <limits.h>
using namespace std;


int main(){

    int N;
    string s;
    cin >> N;
    cin >> s;

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

    cout << num <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:79: error: expected primary-expression before ')' token
   19 |                 if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k] && j-i != k-j)){
      |                                                                               ^
Language: C

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

int main() {
  int N, a = 0;
  cin >> N;
  string str;
  cin >> str;
  for(int i = 2;i < N;i++){
    for(int j = 1;j < i;j++){
      for(int k = 0;k < j;k++){
        if(str.at(i) != str.at(j) && str.at(j) != str.at(k) && str.at(k) != str.at(i) && j-k != i-j){
          a++;
        }
      }
    }
  }
  cout << a <<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

#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define ll long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const ll MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
int rgb2num(char c) {
	if (c == 'R') {
		return 0;
	}
	else if (c == 'G') {
		return 1;
	}
	else if (c == 'B') {
		return 2;
	}
	else {
		return -1;
	}
}
int main() {
	int n;
	string str;
	cin >> n;
	cin >> str;
	if (n < 4) {
		cout << 0 << endl;
		return 0;
	}
	vector<VE> vec(3,VE(n,0));
	vec[rgb2num(str[n - 1])][n-1] = 1;
	REP(i, n-1) {
		int rgbnum = rgb2num(str[n - 2-i]);
		REP(k, 3) {
			if (rgbnum == k) {
				vec[k][n - 2 - i] = vec[k][n - 1 - i] + 1;
			}
			else {
				vec[k][n - 2 - i] = vec[k][n - 1 - i];
			}
		}
	}
	ll ans = 0;
	REP(i, n-2) {
		for (int j = i + 1; j < n - 1; ++j) {
			if (str[j] == str[i]) {
				continue;
			}
			ans += vec[3 - rgb2num(str[i]) - rgb2num(str[j])][j+1];
			if (2 * j - i < n) {
				if (str[2 * j - i] != str[i] && str[2 * j - i] != str[j]) {
					ans--;
				}
			}
		}

	}
	cout << ans << endl;
	return 0;
}


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

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

int main() {
  int N, a = 0;
  cin >> N;
  string str;
  cin >> str;
  for(int i = 2;i < N;i++){
    for(int j = 1;j < i;j++){
      for(int k = 0;k < j;k++){
        if(str.at(i) != str.at(j) && str.at(j) != str.at(k) && str.at(k) != str.at(i) && j-k != i-j){
          a++;
        }
      }
    }
  }
  cout << a <<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

#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    char arr[n];
    scanf("%s", arr);
    int ans = 0;
    for (int r = 0; r < n; r++)
    {
        for (int g = r; g < n; g++)
            if (arr[g] != arr[r])
                for (int b = g; b < n; b++)
                    if (arr[b] != arr[g] and arr[b] != arr[r] and g - r != b - g)
                        ans += 1;
    }
    printf("%d\n", ans);
}


Compiler output:
main.c: In function 'main':
main.c:14:41: error: expected ')' before 'and'
   14 |                     if (arr[b] != arr[g] and arr[b] != arr[r] and g - r != b - g)
      |                        ~                ^~~~
      |                                         )
Language: C

#include<iostream>
#include<map>

using namespace std;

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

    map<char, int> rgb_num;
    rgb_num['R'] = 0;
    rgb_num['G'] = 0;
    rgb_num['B'] = 0;
    for(int i = 0; i < n; i++) {
        rgb_num[s[i]]++;
    }

    int64_t ans = 0;
    int r_num = rgb_num['R'], g_num = rgb_num['G'], b_num = rgb_num['B'];
    map<char, int> through_rgb_num;
    through_rgb_num['R'] = 0;
    through_rgb_num['G'] = 0;
    through_rgb_num['B'] = 0;
    int through_r_num, through_g_num, through_b_num;
    for(int i = 0; i < n - 2; i++) {
        char si = s[i];
        rgb_num[si]--;
        through_r_num = r_num - rgb_num['R'];
        through_g_num = g_num - rgb_num['G'];
        through_b_num = b_num - rgb_num['B'];
        for(int j = i + 1; j < n - 1; j++) {
            char sj = s[j];
            if(sj == 'R')      through_r_num++;
            else if(sj == 'G') through_g_num++;
            else               through_b_num++;
            
            if(sj == si) continue;
            
            char sk;
            if((si == 'R' && sj == 'G') || (si == 'G' && sj == 'R'))       sk = 'B';
            else if ((si == 'G' && sj == 'B') || (si == 'B' && sj == 'G')) sk = 'R';
            else                                                           sk = 'G';

            if(sk == 'R')      ans += r_num - through_r_num;
            else if(sk == 'G') ans += g_num - through_g_num;
            else               ans += b_num - through_b_num;

            //cout << "sk: " << sk << ", ans: " << ans << endl;

            if(2 * j - i < n) {
                if(s[2 * j - i] == sk) ans--;
            }
        }
    }

    cout << ans << endl;

    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;
using ll = long long;

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

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;
V<V<int> > v;

ll f(int a, int b, int c) {
	ll ans = 0;
	REP(i, v[a].size()) {
		REP(j, v[b].size()) {
			if(v[a][i] > v[b][j]) break;
			REP(k, v[c].size()) {
				if(v[b][j] > v[c][k]) break;
				if(v[b][j]-v[a][i] == v[c][k]-v[b][j]) continue;
				// cout << v[a][i] << " " << v[b][j] << " " << v[c][k] << endl;
				ans += 1;
			}
		}
	}
	return ans;
}

int main() {
	ll n, ans = 0;
	string s;

	cin >> n;
	cin >> s;

	REP(i,3) {
		V<int> a;
		v.push_back(a);
	}

	FORD(i,n-1,0) {
		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);
		}
	}
	ans += f(0,1,2);
	ans += f(0,2,1);
	ans += f(1,0,2);
	ans += f(1,2,0);
	ans += f(2,0,1);
	ans += f(2,1,0);

	// REP(i,3) {
	// 	REP(j,v[i].size()) {
	// 		cout << v[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }

	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<iostream>

using namespace std;

int main() {
	int n;
	string s;
	int r=0, g=0, b=0;
	long long count;

	cin >> n >> s;
	for (int i = 0;i < n;i++) {
		switch (s[i])
		{
		case 'R':
			r++;
			break;
		case 'G':
			g++;
			break;
		case 'B':
			b++;
			break;
		default:
			break;
		}
	}
	count = r * g * b;
	for (int i = 0;i < n;i++) {
		for (int j = i + 1;2*j < (n+i);j++) {
			if (s[i] != s[j] && s[j] != s[2 * j - i] && s[i] != s[2 * j - i])count--;
		}
	}

	cout << count << "\n";
	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;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, start, end) for(int i = start; i < (int)(end); ++i)
int r[4000],g[4000],b[4000];
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int r_cnt, g_cnt, b_cnt;
    for(auto c: s){
       if(c == 'r') r[r_cnt++] = i;
       else if(c == 'g') g[g_cnt++] = i;
       else if(c == 'b') b[b_cnt++] = i;
    }
    long long ans = 0;
    rep(i,0,r_cnt){
        rep(j,0,g_cnt){
            rep(k,0,b_cnt){
                if(abs(r[i]-g[j]) == abs(b[k]-g[j]) || abs(r[i]-g[j]) == abs(b[k]-r[i]) || abs(r[i]-b[k]) == abs(b[k]-g[j])) continue;
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: 'i' was not declared in this scope
   16 |        if(c == 'r') r[r_cnt++] = i;
      |                                  ^
a.cc:17:39: error: 'i' was not declared in this scope
   17 |        else if(c == 'g') g[g_cnt++] = i;
      |                                       ^
a.cc:18:39: error: 'i' was not declared in this scope
   18 |        else if(c == 'b') b[b_cnt++] = i;
      |                                       ^
Language: C

#include <bits/stdc++.h> 

using namespace std;

typedef long long ll;

#define rep(i,p,q) for(ll i = p; i < q; i++)
#define repD(i,p,q) for(ll i = p; i > q; i--)

int main(void){
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> r = vector<ll>(n,0);
    vector<ll> g = vector<ll>(n,0);
    vector<ll> b = vector<ll>(n,0);
    repD(i,n-1,-1){
        if(i == n - 1){
             if(s[i] == 'R') r[i] = 1;
        }
        else {
            if(s[i] == 'R') r[i] = r[i+1] + 1;
            else r[i] = r[i+1];
        }
    }
    repD(i,n-1,-1){
        if(i == n - 1){
             if(s[i] == 'G') g[i] = 1;
        }
        else {
            if(s[i] == 'G') g[i] = g[i+1] + 1;
            else g[i] = g[i+1];
        }
    }
    repD(i,n-1,-1){
        if(i == n - 1){
             if(s[i] == 'B') b[i] = 1;
        }
        else {
            if(s[i] == 'B') b[i] = b[i+1] + 1;
            else b[i] = b[i+1];
        }
    }
    ll ans = 0;
    rep(i,0,n - 2){
        switch(s[i]){
            case 'R':
                rep(j,i+1,n-1){
                    if(s[j] == 'G'){
                        ans += b[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'B') ans--;
                    }
                    else if(s[j] == 'B'){
                        ans += g[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'G') ans--;
                    }
                }
            break;
            case 'G':
                rep(j,i+1,n-1){
                    if(s[j] == 'R'){
                        ans += b[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'B') ans--;
                    }
                    else if(s[j] == 'B'){
                        ans += r[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'R') ans--;
                    }
                }
            break;
            case 'B':
                rep(j,i+1,n-1){
                    if(s[j] == 'G'){
                        ans += r[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'R') ans--;
                    }
                    else if(s[j] == 'R'){
                        ans += g[j+1];
                        if(2 * j - i < n && s[2 * j - i] == 'G') ans--;
                    }
                }
            break;
        }
    }
    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

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i,j,k,g=0;
	string s;
	cin>>s;
	for(i=0;i<s.size();i++)if(s[i]=='R')for(j=0;j<s.size();j++)if(s[j]=='G')for(k=0;k<s.size();k++)if(s[k]=='B'&&j-i!=k-j)g++;
	cout<<g;
	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 <iostream>
#include <string>
using namespace std;


int main() {
    string s;
    int n, r = 0, g = 0, b = 0, count;
    cin >> n
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R')
            r++;
        if (s[i] == 'G')
            g++;
        if (s[i] == 'B')
            b++;
    }
    count = r * g * b;
    for (int i = 0; i < n; i++)
        for (int j = 1; i + 2 * j < n; j++)
            if (s[i] != s[i + j] && s[i] != s[i + 2 * j] && s[i + j] != s[i + 2 * j])
                count--;
    cout << count;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: expected ';' before 'cin'
    9 |     cin >> n
      |             ^
      |             ;
   10 |     cin >> s;
      |     ~~~
Language: C

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

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

    map<char, int> rgb_num;
    rgb_num['R'] = 0;
    rgb_num['G'] = 0;
    rgb_num['B'] = 0;
    for(int i = 0; i < n; i++) {
        rgb_num[s[i]]++;
    }

    int64_t ans = 0;
    int r_num = rgb_num['R'], g_num = rgb_num['G'], b_num = rgb_num['B'];
    map<char, int> through_rgb_num;
    through_rgb_num['R'] = 0;
    through_rgb_num['G'] = 0;
    through_rgb_num['B'] = 0;
    int through_r_num, through_g_num, through_b_num;
    for(int i = 0; i < n - 2; i++) {
        char si = s[i];
        rgb_num[si]--;
        through_r_num = r_num - rgb_num['R'];
        through_g_num = g_num - rgb_num['G'];
        through_b_num = b_num - rgb_num['B'];
        for(int j = i + 1; j < n - 1; j++) {
            char sj = s[j];
            if(sj == 'R')      through_r_num++;
            else if(sj == 'G') through_g_num++;
            else               through_b_num++;
            
            if(sj == si) continue;
            
            char sk;
            if((si == 'R' && sj == 'G') || (si == 'G' && sj == 'R'))       sk = 'B';
            else if ((si == 'G' && sj == 'B') || (si == 'B' && sj == 'G')) sk = 'R';
            else                                                           sk = 'G';

            if(sk == 'R')      ans += r_num - through_r_num;
            else if(sk == 'G') ans += g_num - through_g_num;
            else               ans += b_num - through_b_num;

            //cout << "sk: " << sk << ", ans: " << ans << endl;

            if(2 * j - i < n) {
                if(s[2 * j - i] == sk) ans--;
            }
        }
    }

    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 all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl 
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl 
#define no cout<<"no"<<endl
#define vec(a,y,x)  vector<vector<char>> a (y,vector<char>(x))
const vector<int> dx={1,0,-1,0};
const vector<int> dy={0,1,0,-1};

int main(){
  int n;
  string s;
  cin>>n;
  cin>>s;
  vector<int> R,G,B;
  rep(i,n){
    if(s.at(i)=='R') R.push_back(i);
    if(s.at(i)=='G') G.push_back(i);
    if(s.at(i)=='B') B.push_back(i);
  }
  int m=B.size();
  in ans=0;
  for(int i : R){
    for(int j : G){
      
      ans+=m;
      if((i+j)%2==0){
        if(find(all(B),(i+j)/2)!=B.end())
          ans--;
      }
      int J=max(i,j);
      int I=min(i,j);
      if(find(all(B),2*J-I)!=B.end()) ans--;
      if(find(all(B),J-2*I)!=B.end()) ans--;
    }
  }
  cout<<ans<<endl;
  //cout<<s.size()<<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;

int main() {
  int N;
  string S;
  cin >> N >> S;
  int64_t sum = 0;
  for (int i = 0; i < N; i++) {
    char tmp1 = S.at(i);
      for (int j = i + 1; j < N; j++) {
        if (S.at(j) != tmp1) {
          char tmp2 = S.at(j);
          for (int k = j + 1; k < N; k++) {
            if (S.at(k) != tmp1 && S.at(k) != tmp2 && j - i != k - j) {
              sum++;
            }
          }
        }
      }
  }
  cout << sum << 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: Java

import java.awt.*;
import java.util.*;
import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        int n=sc.nextInt();
        char s[]=sc.next().toCharArray();
        int sum[][]=new int[3][n+1];
        for (int i=n-1;i>=0;i--){
            sum[0][i]=sum[0][i+1]+(s[i]=='R'?1:0);
            sum[1][i]=sum[1][i+1]+(s[i]=='G'?1:0);
            sum[2][i]=sum[2][i+1]+(s[i]=='B'?1:0);
        }
        long ans=0;
        for (int i=0;i<n;i++){
            for (int j=i+1;j<n;j++){
                if (s[i]!=s[j]){
                    int k=2*j-i;
                    if ((s[i]=='B' && s[j]=='R') || (s[i]=='R' && s[j]=='B')){
                        if (k>=n){
                            ans+=sum[1][j+1];
                        }else if (s[k]=='G')ans+=sum[1][j+1]-1;
                        else ans+=sum[1][j+1];
                    }
                    if ((s[i]=='G' && s[j]=='R') || (s[i]=='R' && s[j]=='G')){
                        if (k>=n){
                            ans+=sum[2][j+1];
                        }else if (s[k]=='B')ans+=sum[2][j+1]-1;
                        else ans+=sum[2][j+1];
                    }
                    if ((s[i]=='B' && s[j]=='G') || (s[i]=='G' && s[j]=='B')){
                        if (k>=n){
                            ans+=sum[0][j+1];
                        }else if (s[k]=='R')ans+=sum[0][j+1]-1;
                        else ans+=sum[0][j+1];
                    }
                }
            }
        }
        System.out.println(ans);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Compiler output:
Main.java:5: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
1 error
Language: C

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<vector<int>> rgb(3);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'R') {
            rgb[0].push_back(i);
        } else if (s[i] == 'G') {
            rgb[1].push_back(i);
        } else {
            rgb[2].push_back(i);
        }
    }

    Int ans = 0;
    vector<int> t{0, 1, 2};
    do {
        for (auto e : rgb[t[0]]) {
            auto gitr = upper_bound(rgb[t[1]].begin(), rgb[t[1]].end(), e);
            for (; gitr != rgb[t[1]].end(); ++gitr) {
                auto bitr = upper_bound(rgb[t[2]].begin(), rgb[t[2]].end(), *gitr);
                while (bitr != rgb[t[2]].end()) {
                    if (*gitr - e != *bitr - *gitr) {
                        ans++;
                    }

                    ++bitr;
                }
            }

            auto gitr2 = upper_bound(rgb[t[1]].begin(), rgb[t[1]].end(), e);
            for (; gitr2 != rgb[t[1]].end(); ++gitr2) {
                auto bitr2 = upper_bound(rgb[t[2]].begin(), rgb[t[2]].end(), *gitr2);
                while (bitr2 != rgb[t[2]].end()) {
                    if (*gitr2 - e != *bitr2 - *gitr2) {
                        ans++;
                    }

                    ++bitr2;
                }
            }
        }

    } while (next_permutation(t.begin(), t.end()));

    cout << ans / 2 << endl;

    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;
int main(){
  int N,c=0;
  string S;
  cin>>N;
  cin>>S;
  for(int k=2;k<N && k>j;k++){
    for(int j=1;j<N && j>i;j++){
      for(int i=0;i<N;i++){
        if(i>=j || j>=k) continue;
        if(2*j==i+k) continue;
        if(S[i] == S[j] || S[k] == S[j] || S[i] == S[k]) continue;

        c++;
      }
    }
  }
  cout<<c<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: 'j' was not declared in this scope
    8 |   for(int k=2;k<N && k>j;k++){
      |                        ^
a.cc:9:26: error: 'i' was not declared in this scope
    9 |     for(int j=1;j<N && j>i;j++){
      |                          ^
Language: C


#include <iostream>
using namespace std;

int main(void) {
    long int N,c = 0,i,j,k;
    char S[4000];
    scanf("%ld",&N);
    
    scanf("%s",S);
    for (i=0;i<N;++i){
       for (j=1+i;j<N;++j){
       for (k=1+j;k<N;++k){
           if((j-i)!=(k-j)){
           if(S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]){
               c = c + 1;
           }
           }
       }
       }
    }
  cout << c << "\n"; 
  return 0;
}

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

N = $stdin.gets.to_i
S = []
CHAR = 0
COUNT = 1
INDEX = 2
prev = nil
$stdin.read(N).split(//).each_with_index do |s, i|
  if prev == s
    S[-1][COUNT] += 1
  else
    S.push([s, 1, i])
  end
end
SLen = S.length
#$stderr.puts S.to_s
def sub_count(pair1, pair2, pair3)
  sc = 0
  pair1[INDEX].upto(pair1[INDEX] + pair1[COUNT] - 1) do |i|
    pair2[INDEX].upto(pair2[INDEX] + pair2[COUNT] - 1) do |j|
      pair3[INDEX].upto(pair3[INDEX] + pair3[COUNT] - 1) do |k|
        if j - i != k - j
          #$stderr.puts [i, j, k].to_s
          sc += 1
        end
      end
    end
  end
  return sc
end
count = 0
0.upto(SLen - 3) do |pos1|
  pair1 = S[pos1]
  (pos1 + 1).upto(SLen - 2) do |pos2|
    pair2 = S[pos2]
    if pair1[CHAR] != pair2[CHAR]
      char3s = ['R', 'G', 'B']
      char3s.delete(pair1[CHAR])
      char3s.delete(pair2[CHAR])
      char3 = char3s[0]
      (pos2 + 1).upto(SLen - 1) do |pos3|
        pair3 = S[pos3]
        if pair3[CHAR] == char3
          count += sub_count(pair1, pair2, pair3)
        end
      end
    end
  end
end
puts count


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N = $stdin.gets.to_i
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: '$stdin' undeclared here (not in a function)
    1 | N = $stdin.gets.to_i
      |     ^~~~~~
main.c:2:1: error: expected ',' or ';' before 'S'
    2 | S = []
      | ^
main.c:15:2: error: invalid preprocessing directive #$stderr
   15 | #$stderr.puts S.to_s
      |  ^~~~~~~
main.c:22:12: error: invalid preprocessing directive #$stderr
   22 |           #$stderr.puts [i, j, k].to_s
      |            ^~~~~~~
main.c:31:1: error: invalid suffix "upto" on floating constant
   31 | 0.upto(SLen - 3) do |pos1|
      | ^~~~~~
Language: C

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


#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ; 
  string s ;
  cin >> n >> s ;
  
  vector<int> r ;
  vector<int> g ;
  vector<int> b ;
  rep(m,s.size()){
    if( s.at(m) == 'R')
      r.push_back(m+1);
     if( s.at(m) == 'B')
      b.push_back(m+1);
     if( s.at(m) == 'G')
      g.push_back(m+1);
  }
  
  intll ans = 0;
  rep(i,r.size()){
    rep(j,b.size()){
      rep(k,g.size()){
        vector<int> v(3) ;
        v.at(0) = b.at(j) ;
        v.at(1) = r.at(i) ;
        v.at(2) = g.at(k) ;
        sort(all(v));
        
        if(v.at(1) - v.at(0)  != v.at(2)-v.at(1) ) ans ++ ;
     
      }
    }
  }
  
  cout << ans ;

}


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;
using Graph = vector<vector<int>>;
 
typedef long long ll;
typedef long double ld;
 
#define REP(i,a,n) for(int (i)=(a); (i)<(int)(n); (i)++)
#define rep(i,n) REP(i,0,n)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;


int main(){
  int N; cin >> N;
  string S; cin >> S;
  
  vector<int> Rs;
  vector<int> Gs;
  vector<int> Bs;
  
  for(int i = 0; i < N; i++){
    if(S.at(i) == 'R') Rs.push_back(i);
    else if(S.at(i) == 'G') Gs.push_back(i);
    else Bs.push_back(i);
  }
  
  int NR = Rs.size();
  int NG = Gs.size();
  int NB = Bs.size();
  
  int res = 0;
   for(int i = 0; i < NR; i++){
     for(int j = 0; j < NG; j++){
       for(int k = 0; k < NB; k++){
        vector<int> temp;
        temp.push_back(Rs.at(i));
        temp.push_back(Gs.at(j));
        temp.push_back(Bs.at(k));
        sort(temp.begin(), temp.end());
        if((temp.at(2) - temp.at(1)) != (temp.at(1) - temp.at(0))) res++;
         //cout << temp.at(0) << " " << temp.at(1) << " " << temp.at(2) << endl;
      }
    }
  }
  
  cout << res << endl;
  //cout << S << 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

#include <stdio.h>
int main(void){
    // Your code here!
    int n, cnt = 0;
    char str[4000];
    scanf("%d", &n);
    scanf("%s", str);
 
    //printf("入力した文字列は：%s\n", str);
    //for(int i=0;i<n;i++)printf("%c ", str[i]);
    
    for(int i=0; i < n-2; i++){
        for(int j=i+1; j < n-1; j++){
            if(str[i] == str[j]) continue;
            for(int k=j+1; k < n; k++){
                if(j-i == k-j) continue;
                if(str[j] == str[k] continue;
                if(str[k] == str[i]) continue;
                cnt++;
            }
        }
    }
    printf("%d", cnt);
    
}


Compiler output:
main.c: In function 'main':
main.c:17:36: error: expected ')' before 'continue'
   17 |                 if(str[j] == str[k] continue;
      |                   ~                ^~~~~~~~~
      |                                    )
main.c:20:13: error: expected expression before '}' token
   20 |             }
      |             ^
Language: C

using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Trim();

        var t = s.Select(x => x == 'R' ? 0 : x == 'G' ? 1 : 2).ToArray();

        var sum = new int[3][];
        for (int i = 0; i < sum.Length; ++i)
        {
            sum[i] = new int[t.Length + 1];
        }
        for (int i = 0; i < t.Length; ++i)
        {
            for (int j = 0; j < sum.Length; ++j)
            {
                sum[j][i + 1] = sum[j][i];
            }
            ++sum[t[i]][i + 1];
        }

        var count = 0L;
        for (int i = 0; i < t.Length; ++i)
        {
            for (int j = i + 1; j < t.Length; ++j)
            if (s[i] != s[j])
            {
                // (0, 1) -> 2, (1, 2) -> 0, (2, 0) -> 1
                var c = sum.Length - (t[i] + t[j]);
                var k = j + (j - i);
                count += sum[c].Last() - sum[c][j + 1] - (k < t.Length && t[k] == c ? 1 : 0);
            }
        }

        Console.WriteLine(count);
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using System;
      | ^~~~~
main.c:2:1: error: unknown type name 'using'
    2 | using System.Linq;
      | ^~~~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | using System.Linq;
      |             ^
main.c:3:1: error: unknown type name 'using'
    3 | using System.Collections.Generic;
      | ^~~~~
main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | using System.Collections.Generic;
      |             ^
main.c:5:1: error: unknown type name 'using'
    5 | using E = System.Linq.Enumerable;
      | ^~~~~
main.c:5:17: error: request for member 'Linq' in something not a structure or union
    5 | using E = System.Linq.Enumerable;
      |                 ^
main.c:7:1: error: unknown type name 'public'
    7 | public class Program
      | ^~~~~~
main.c:7:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Program'
    7 | public class Program
      |              ^~~~~~~
Language: C

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rept(i,k,n) for(int i = (k); i < (int)(n); i++)

#define mod 1000000007
typedef long long ll;

int main() {
    int n;
    string s;
    cin>>n>>s;
    vector<vector<int>> rgb(3,vector<int>(n+1,0));
    for(int i=n-1;i>=0;i--){
        rgb[0][i]=rgb[0][i+1];rgb[1][i]=rgb[1][i+1];rgb[2][i]=rgb[2][i+1];
        if(s[i]=='R') rgb[0][i]++;
        if(s[i]=='G') rgb[1][i]++;
        if(s[i]=='B') rgb[2][i]++;
    }
    ll ans =0;
    map<char,int> mp;
    mp['R']=0;mp['G']=1;mp['B']=2;
    rep(i,n){
        rept(j,i+1,n-1){
            if(s[i]==s[j]) continue;
            int cl = 3-mp[s[i]]-mp[s[j]];
            ans+=rgb[cl][j+1];
            if(j*2-i<=n-1){
                if(mp[s[j*2-i]]==cl) 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;
 

int main() {
int N;
cin >> N;
string S;
cin >> S;
int ans = 0;
for(int i = 0; i < N; i++){
for(int j = i+1; j < N; j++){
for(int k = j+1; k < N; k++){
    int a, b, c;
if(S[i] == 'R') a = 1;
if(S[i] == 'G') a = 2;
if(S[i] == 'B') a = 3;

if(S[j] == 'R') b = 1;
if(S[j] == 'G') b = 2;
if(S[j] == 'B') b = 3;

if(S[k] == 'R') c = 1;
if(S[k] == 'G') c = 2;
if(S[k] == 'B') c = 3;


    if(i != j && i != k && j != k && j - i != k - j && a != b && a != c && b != c){
ans++;
    }
}
}    
}
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++

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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N;
  string S;
  cin >> N >> S;
  vector<int> R, G, B;
  for (int i = 0; i < N; ++i) {
      switch (S[i]) {
          case 'R': R.push_back(i); break;
          case 'G': G.push_back(i); break;
          case 'B': B.push_back(i); break;
      }
  }
  long long result = 0;
  for (int r : R) {
      for (int g : G) {
          for (int b : B) {
              array<int, 3> arr = {r, g, b};
              if (arr[0] > arr[1]) swap(arr[0], arr[1]);
              if (arr[0] > arr[2]) swap(arr[0], arr[2]);
              if (arr[1] > arr[2]) swap(arr[1], arr[2]);
              if (arr[1] - arr[0] != arr[2] - arr[1]) ++result;
          }
      }
  }
  cout << result << endl;
  return

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: expected primary-expression at end of input
   31 |   return
      |         ^
a.cc:31:9: error: expected ';' at end of input
   31 |   return
      |         ^
      |         ;
a.cc:31:9: error: expected '}' at end of input
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

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

int main(){
	int n;
	string s;
	long long ans = 0;

	cin >> n >> s;

	vector<int> r, g, b;
	for(int i=0; i<n; i++){
		if(s[i] == 'R'){
			r.push_back(i);
		}else if(s[i] == 'G'){
			g.push_back(i);
		}else{
			b.push_back(i);
		}
	}

	sort(r.begin(), r.end());
	sort(g.begin(), g.end());
	sort(b.begin(), b.end());

	for(int i=0; i<r.size(); i++){
		for(int j=0; j<g.size(); j++){
			int cnt = 0,  d = abs(r[i] - g[j]);
			int sm = min(r[i], g[j]), bi = max(r[i], g[j]);

			if((r[i]+g[j]) % 2 == 0){
				cnt += count(b.begin(), b.end(), (r[i]+g[j])/2);
			}

			if(- d + sm >= 0){
				cnt += count(b.begin(), b.end(), -d+sm);
			}

			if(count(b.begin(), b.end(), d+bi)){
				cnt += count(b.begin(), b.end(), d+bi);
			}

			ans += b.size() - cnt;
		}
	}

	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

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n; cin>>n;
	string c; cin>>c;
	c = '@'+c;
	map<char,int>mp={{'R',0},{'G',1},{'B',2}};//0-R, 1-G, 2-B;
	vector<vector<int>>pref(n+1,vector<int>(3,0)); 
	for(int i=1;i<=n;i++){
		pref[i]=pref[i-1];
		pref[i][mp[c[i]]]++;
	}
	long long res=0;
	for(int i=1;i<=n-2;i++){
		set<int>st;
		st.insert(mp[c[i]]);
		for(int j=i+1;j<=n-1;j++){
			if(st.count(mp[c[j]])) 
				continue;
			st.insert(mp[c[j]]);
			int target=3-mp[c[i]]-mp[c[j]];
			res+=pref[n][target]-pref[j][target];
			if(j+j-i<=n && mp[c[j+j-i]]==target)
				res--;
			st.erase(mp[c[j]]);
		}
		st.erase(mp[c[i]]);
	}
	cout<<res<<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
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple

int gcd(int a,int b)
{
    if(b>a) return gcd(b,a);
    if(b==0) return a;
    return gcd(b,a%b);
}

char C(char a, char b)
{
    bool f[3]={0};
    if(a=='R') f[0]++;
    else if(a=='G') f[1]++;
    else f[2]++;
    if(b=='R') f[0]++;
    else if(b=='G') f[1]++;
    else f[2]++;
    if(f[0]==0) return 'R';
    else if(f[1]==0) return 'G';
    else return 'B';
}

int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin>>n;
	string s; cin>>s;
	vector <int> r,b,g;
	for(int i=0;i<n;i++)
	{
	    if(s[i]=='R') r.pb(i);
	    else if(s[i]=='G') g.pb(i);
	    else b.pb(i);
	}
	int l1=r.size(), l2=g.size(), l3=b.size();
	ll ans = 0;
	for(int i=0;i<n-2;i++)
	{
	    for(int j=i+1;j<n-1;j++)
	    {
	        if(s[i]==s[j]) continue;
	        char c = C(s[i],s[j]);
	        int d=j-i;
	        if(c=='R')
	        {
	            auto it = lower_bound(r.begin(),r.end(),j);
	            ll pp = (ll)(it - r.begin());
	            pp = l1 - pp;
	            auto it1 = find(r.begin(),r.end(),j+d);
	            if(it1!=r.end()) pp--;
	            if(pp>0) ans+=pp;
	        }
	        if(c=='G')
	        {
	            auto it = lower_bound(g.begin(),g.end(),j);
	            ll pp = (ll)(it - g.begin());
	            pp = l2 - pp;
	            auto it1 = find(g.begin(),g.end(),j+d);
	            if(it1!=g.end()) pp--;
	            if(pp>0) ans+=pp;
	        }
	        if(c=='B')
	        {
	            auto it = lower_bound(b.begin(),b.end(),j);
	            ll pp = (ll)(it - b.begin());
	            pp = l3 - pp;
	            auto it1 = find(b.begin(),b.end(),j+d);
	            if(it1!=b.end()) pp--;
	            if(pp>0) ans+=pp;
	        }
	        
	    }
	}
	cout<<ans;
	
	
	return 0;
}


Compiler output:
a.cc: In function 'char C(char, char)':
a.cc:19:19: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   19 |     if(a=='R') f[0]++;
      |                ~~~^
a.cc:20:24: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   20 |     else if(a=='G') f[1]++;
      |                     ~~~^
a.cc:21:13: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   21 |     else f[2]++;
      |          ~~~^
a.cc:22:19: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   22 |     if(b=='R') f[0]++;
      |                ~~~^
a.cc:23:24: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   23 |     else if(b=='G') f[1]++;
      |                     ~~~^
a.cc:24:13: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   24 |     else f[2]++;
      |          ~~~^
Language: C

#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
ll n;
int main(){
    cin>>n;
    string s;
    cin>>s;
    int r=0,g=0,b=0;
    int ans=0;
    for(int i=s.size()-1;i>=0;i--){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else b++;
        //cout<<r<<" "<<g<<" "<<b<<endl;
        if(r>0 && g>0 && b>0){
            /*cout<<"kasan"<<endl;
            cout<<i<<endl;
            cout<<r<<" "<<g<<" "<<b<<endl;*/
            if(s[i]=='R'){
                ans+=g*b;
            }
            else if(s[i]=='G'){
                ans+=b*r;
            }
            else{
                ans+=r*g;
            }
        }
    }
    //cout<<ans<<endl;
    int out=0;
    for(int j=0;j<s.size();j++){
        for(int dis=1;dis<s.size()+10;dis++){
            int i = j-dis;
            int k = j+dis;
            if(i>=0 && k<s.size()){
                if(s[i]!=s[j] && s[i]!=s[k] && s[k]!=s[j]) out++;
            }
        }
    }
    //cout<<out<<endl;
    cout<<ans-out<<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

N = int(input())
S = input()

rn = [0]*(N+1)
gn = [0]*(N+1)
bn = [0]*(N+1)

for i in range(N):
    rn[i+1] = rn[i]
    gn[i+1] = gn[i]
    bn[i+1] = bn[i]
    if S[i]=="R":
        rn[i+1] = rn[i]+1
    if S[i]=="G":
        gn[i+1] = gn[i]+1
    if S[i]=="B":
        bn[i+1] = bn[i]+1
   
ans = 0
for i in range(N):
    a = S[i]
    rem = "RGB".replace(a,"")
    for j in range(N-i):
        if (S[j+i] == a):
            continue
        b = S[j+i]
        rem2 = rem.replace(b,"")
        if rem2 == "R":
            ans += rn[N]-rn[j+i+1]
        if rem2 == "G":
            ans += gn[N]-gn[j+i+1]
        if rem2 == "B":
            ans += bn[N]-bn[j+i+1]
        if 0 <= j*2+i <= N-1:
          if S[j*2+i] == rem2 :
              ans -=1
            
print(ans)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N = int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | N = int(input())
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){


    int x;
    scanf("%d",&x);
    getchar();
    char s[x];
    gets(s);
    int c=0;
    for (int i = 0; i <x- 2; i++)
    {
        for (int j = i + 1; j <x- 1; j++)
        {
            for (int k = j + 1; k <x; k++)
            {
                int m=j-i;
                int n=k-j;
                if(s[i]!=s[j] &&s[i]!=s[k] &&s[j]!=s[k]&& m!=n){
                    c++;
                }

            }
        }
    }
    cout<<c<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
   10 |     gets(s);
      |     ^~~~
      |     getw
Language: C++


int main() {
  int N;
  string S;
  cin >> N>>S;
  int A=0;
  for(int i=0; i<N-2; i++){
     for(int j=i+1; j<N-1; j++){
       if(S.at(i)==S.at(j))continue;
        for(int k=j+1; k<N; k++){
          if(S.at(k)==S.at(j)||S.at(i)==S.at(k)||j-i==k-j)continue;
          A++;
        }
     }
    
          
  }
 cout <<A;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'string' was not declared in this scope
    4 |   string S;
      |   ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >> N>>S;
      |   ^~~
a.cc:5:13: error: 'S' was not declared in this scope
    5 |   cin >> N>>S;
      |             ^
a.cc:18:2: error: 'cout' was not declared in this scope
   18 |  cout <<A;
      |  ^~~~
Language: C

#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
#include <set>
using namespace std;


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


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