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

#include<stdio.h>
 
int main(void){
 
    long long int N,i,j,R_num = 0,G_num = 0,B_num = 0,ans = 0;
  	char s1[1],s2[1],s3[1];
    char S[4001];
    scanf("%d",&N);
    scanf("%s",S);
    for(i = 0;i < N;i++){
        if(S[i] == 'R') R_num++;
        else if(S[i] == 'G') G_num++;
        else if(S[i] == 'B') B_num++;
    }
    ans = R_num * G_num * B_num;
    for(i = 0;i < N;i++){
        for(j = 0;j < N;j++){
            if(i+j*2 >= N) break;
          	s1=S[i];
          	s2=S[i+j];
          	s3=S[i+j*2];
            if(s1!=s2 && s2!=s3 && s1!=s3) ans--;
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:19: error: assignment to expression with array type
   19 |                 s1=S[i];
      |                   ^
main.c:20:19: error: assignment to expression with array type
   20 |                 s2=S[i+j];
      |                   ^
main.c:21:19: error: assignment to expression with array type
   21 |                 s3=S[i+j*2];
      |                   ^
Language: C++

#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
using namespace std;
 
int main() {
    int n;
    int r,g,b;
    cin >> n;
    string s;
    cin >> s;
    r=0;g=0;b=0;
    for(int i = 0;i < n;i++){
        switch(s[i]){
            case 'R':
                r++;break;
            case 'G':
                g++;break;
            case 'B':
                b++;break;
        }
    }
    long long total = r*g*b;
    for(int i = 0;i < n;i++){
        for(int j = i;j < n;j++){
          	if (k >= n) break;
          	int k = 2*j - i;
            int a = s[i] + s[j] + s[k];
            if(a == ('R' + 'G' + 'B'))total--;
        }
    }
 
    cout << total << endl;
//--------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: 'k' was not declared in this scope
   27 |                 if (k >= n) break;
      |                     ^
Language: C

#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define rep(i,a,n) for (int i=a;i<n;i++)
#define MAXN 1000001 
using namespace std;
void solve() {
	ll n;
	cin>>n;
	string st;
	long long cntR = 0, cntG = 0, cntB = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i) == 'R')
      cntR++;
    else if (S.at(i) == 'G')
      cntG++;
    else
      cntB++;
  }
  long long cntFirst = cntR * cntG * cntB;
 
  long long cntSecond = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (S.at(i) == S.at(j)) 
	  	continue;
      int k = j * 2 - i;
      if (k >= N || S.at(k) == S.at(i) || S.at(k) == S.at(j)) 
	  	continue;
      
	  ++cntSecond;
    }
  }
 
  cout << cntFirst - cntSecond << endl;
}

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

	// ll t;
	// 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<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n)for(int i=1;i<=n;i++)

const ll INF = 1001001001;

int main(){
  int n;
  string s;
  cin>>n>>s;
  ll r=0; g=0;b=0;
  rep(i,n){
    if(s.at(i)=='R') r++;
    else if(s.at(i)=='G') g++;
    else b++;
  }

 ll sum1=r*g*b;
 ll sum2=0;
 rep(i,n){
   for(int j=i+1;i<=n-1){
     if(i-j<=0) continue;
     if(s.at(i)!=s.at(j) && s.at(j)==s.at(2*j-i) && s.at(i)==s.at(2*j-i){
       sum2++;
     }
   }
 }
 cout<<sum1-sum2<<endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'g' was not declared in this scope
   12 |   ll r=0; g=0;b=0;
      |           ^
a.cc:12:15: error: 'b' was not declared in this scope
   12 |   ll r=0; g=0;b=0;
      |               ^
a.cc:22:24: error: expected ';' before ')' token
   22 |    for(int j=i+1;i<=n-1){
      |                        ^
      |                        ;
a.cc:24:73: error: expected ')' before '{' token
   24 |      if(s.at(i)!=s.at(j) && s.at(j)==s.at(2*j-i) && s.at(i)==s.at(2*j-i){
      |        ~                                                                ^
      |                                                                         )
a.cc:27:4: error: expected primary-expression before '}' token
   27 |    }
      |    ^
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order - 1) ans *= base;
	return ans;
}

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

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

	vector<int> rv, gv, bv;
	int r = 0, g = 0, b = 0;
	rep(i,n) {
		if (s.at(i) == 'R') {
			rv.push_back(i + 1);
			r++;
		}
		if (s.at(i) == 'G') {
			gv.push_back(i + 1);
			g++;
		}
		if (s.at(i) == 'B') {
			bv.push_back(i + 1);
			b++;
		}
	}
	if (r*g*b == 0) return 0;
	int cnt = 0, RGB;
	RGB = 'R' + 'G' + 'B';
	for (int i = 1; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (s.at(i - 1) == s.at(j - 1)) {
				continue;
			}
			int rem;
			rem = s.at(i - 1) + s.at(j - 1);
			vector<int> range;
			if (RGB - rem == 'R') {
				range.resize(rv.size());
				copy(rv.begin(), rv.end(), range.begin());
			}
			if (RGB - rem == 'G') {
				range.resize(gv.size());
				copy(gv.begin(), gv.end(), range.begin());
			}
			if (RGB - rem == 'B') {
				range.resize(bv.size());
				copy(bv.begin(), bv.end(), range.begin());
			}
			for (auto k : range) {
				if (j >= k) continue;
				if (2*j == (i + k)) continue;
				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;
long long r[4002],g[4002],b[4002];
int main()
{
	int n;
	string s;
	cin>>n>>s;
	long long sum=0;
	for(int i=n-1;i>=0;i--)
	{
		r[i]=r[i+1];g[i]=g[i+1];b[i]=b[i+1];
		if(s[i]=='R') r[i]=r[i]+1;
		if(s[i]=='G') g[i]=g[i]+1;
		if(s[i]=='B') b[i]=b[i]+1;
//		cout<<i<<" "<<r[i]<<" "<<g[i]<<" "<<b[i]<<endl;
	}
	for(int i=0;i<n-2;i++)
	{
		for(int j=i+1;j<n-1;j++)
		{
			if(s[i]==s[j]) continue;
			
			if(s[i]=='R'&&s[j]=='G'||s[i]=='G'&&s[j]=='R')
		{
			sum+=b[j+1];
			if(s[2*j-i]=='B') sum--;
			
		}
		if(s[i]=='R'&&s[j]=='B'||s[i]=='B'&&s[j]=='R')
		{
			sum+=g[j+1];
			if(s[2*j-i]=='G') sum--;
		}
		if(s[i]=='B'&&s[j]=='G'||s[i]=='G'&&s[j]=='B')
		{
			sum+=r[j+1];
			if(s[2*j-i]=='R') sum--;
		}
	//	cout<<i<<" "<<j<<" "<<sum<<endl;
		}
		
	}
	cout<<sum;
	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 <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    long n;
    long r,g,b;
    cin >> n;
    string s;
    cin >> s;
    r=0;g=0;b=0;
    for(int i = 0;i < s.length();i++){
        switch(s[i]){
            case 'R':
                r++;break;
            case 'G':
                g++;break;
            case 'B':
                b++;break;
        }
    }
    long long total = r*g*b;
    long counter = 0;
    for(long i = 0;i < n;i++){
        for(long j = i + 1;j < n;j++){
            long a = s[i] + s[j] + s[k];
            if(a == ('R' + 'G' + 'B'))total--;
        }
    }

    cout << total << endl;
//--------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:38: error: 'k' was not declared in this scope
   28 |             long a = s[i] + s[j] + s[k];
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

signed main(){
	VAR(int, N);
	VAR(string, S);
	int 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++;
	}
	int ans = r * g * b;
	for(int i = 0;i < N;i++){
		for(int j = 1;;j++){
			if(i - j < 0 || i + j >= N) break;
			if(S[i] != S[i - j] && S[i - j] != S[i + j] && S[i] != S[i + j]) ans--;
		}
	}
	cout << ans << endl;
}


Compiler output:
a.cc:26:8: error: redefinition of 'int main()'
   26 | signed main(){
      |        ^~~~
a.cc:24:5: note: 'int main()' previously defined here
   24 | int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
      |     ^~~~
Language: C++

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

int main() {
    int n;
    int r,g,b;
    cin >> n;
    string s;
    cin >> s;
    r=0;g=0;b=0;
    for(int i = 0;i < n;i++){
        switch(s[i]){
            case 'R':
                r++;break;
            case 'G':
                g++;break;
            case 'B':
                b++;break;
        }
    }
    long total = r*g*b;
    long counter = 0;
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j< n;j++){
    if(S[i] == S[j]) continue;
 
    long long k = j*2-i;
    if(S[k] == S[i] || S[k] == S[j] || k >= n) continue;
    counter++;
        }
    }

    cout << total - counter << endl;
//--------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:8: error: 'S' was not declared in this scope
   28 |     if(S[i] == S[j]) continue;
      |        ^
a.cc:31:8: error: 'S' was not declared in this scope
   31 |     if(S[k] == S[i] || S[k] == S[j] || k >= n) continue;
      |        ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  char c;
  vector<unordered_set<int>> colors(3);
  for (int i = 0; i < n; ++i) {
    cin >> c;
    colors[c == 'R' ? 0 : c == 'G' ? 1 : 2].insert(i);
  }
  int ans(0);
  for (const int& i: colors[0]) {
    for (const int& j: colors[1]) {
      int d = abs(i - j), mn = min(i, j), mx = max(i, j);
      if (diff % 2 == 0 && colors[2].count(mn + diff / 2)) ans--;
      if (colors[2].count(mx + diff)) ans--;
      if (colors[2].count(mn - diff)) ans--;
      ans += (int) colors[k].size();
    }
  }
  cout << ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:11: error: 'diff' was not declared in this scope
   17 |       if (diff % 2 == 0 && colors[2].count(mn + diff / 2)) ans--;
      |           ^~~~
a.cc:18:32: error: 'diff' was not declared in this scope
   18 |       if (colors[2].count(mx + diff)) ans--;
      |                                ^~~~
a.cc:19:32: error: 'diff' was not declared in this scope
   19 |       if (colors[2].count(mn - diff)) ans--;
      |                                ^~~~
a.cc:20:27: error: 'k' was not declared in this scope
   20 |       ans += (int) colors[k].size();
      |                           ^
Language: C

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

int main() {
    int n;
    string s;
    cin >> n >> s;
    
    long long r = 0, g = 0, b = 0;
    for (const char &c : s) {
        r += (c == 'R');
        g += (c == 'G');
        b += (c == 'B');
    }
    
    long long ans = r * g * b;
    
    auto f = [&](int i, int j, int k) -> bool {
        return (s[i] != s[j] and s[j] != s[k] and s[k] != s[i]);
    };
    
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            const int d = j - i;
            if (j + d < n) ans -= f(i, j, j + d);
        }
    }
    
    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

#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	ll sum(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	ll c(0);
	int crr(0), cgg(0), cbb(0);
	rep(i, n) {
		if (s[i] == 'R') {
			++crr;
		}
		else if (s[i] == 'G') {
			++cgg;
		}
		else {
			++cbb;
		}
	}
	rep(i, n) {
		for(int j=i+1;j<n-1;++j){
			if (2*j-i < n) {
				if (s[i] != s[j] && s[j] != s[2*j-i] && s[2*j-i] != s[i]) {
					++c;
				}
			}
		}
		
	}
	cout << crr*cgg*cbb-c;
	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;
int main () {
    ios_base::sync_with_stdio(false);
    long long ans = 0;
    int N;
    string S;
    cin>>N>>S;
    int r = 0, g = 0, b = 0;
    for(int i=0;i<N;i++) {
        if (S[i] == 'R') r++;
        if (S[i] == 'G') g++;
        if (S[i] == 'B') b++;
    }
 
    int rgb = 0;
    for(int i=0;i<N;i++) {
        for(int j=0;j<N;j++) {
            int k = i + 2 * j;
            if (k >= N) break;
            if (S[i] != S[i + j] && S[i] != S[k] && S[i + j] != S[k]) rgb++;
        }
    }
    ans = (long long)r*g*b-rgb;
    cout<<ans<<"\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.
Language: C

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

int find(int u,int o,int* a,int x){
	
    if(o<=u+1){
      return 0;
    }

    int k = (u+o)/2;
    if(a[k] == x){return 1;}
    else if(a[k] <x){
        return find(k,o,a,x);
    }
    else {
        return find(u,k,a,x);
    }


}

int main(){
    int r[4000],g[4000],b[4000];
    int rlen = 0;
    int glen = 0;
    int blen = 0;
    int N;
    cin >> N;
    for(int i=1;i<=N;i++){
        char c;
        cin >> c;
        if(c=='R'){
            r[rlen]=i;
            rlen +=1;}
        else if(c=='G'){
            g[glen]=i;
            glen+=1;
        }
        else{
            b[blen] = i;
            blen +=1;
        }

    }
    if(rlen ==0 || glen == 0 || blen == 0){cout << 0 << endl;}
    else{
        long long int sum=0;
        for(int i=0;i<rlen;i++){
            for(int j=0;j<glen;j++){
                if( (r[i]+g[j])%2==0){
                    int x=(r[i]+g[j])/2;
                    if(find(-1,blen,&(b[0]),x)==1){sum+=1;}

                }

            }
        }
        for(int i=0;i<rlen;i++){
            for(int j=0;j<blen;j++){
                if( (r[i]+b[j])%2==0){
                    int x=(r[i]+b[j])/2;
                    if(find(-1,glen,&(g[0]),x)==1){sum+=1;}
                    
                }

            }
        }
        for(int i=0;i<blen;i++){
            for(int j=0;j<glen;j++){
                if( (b[i]+g[j])%2==0){
                    int x=(b[i]+g[j])/2;
                    if(find(-1,rlen,&(r[0]),x)==1){sum+=1;}
                    
                }

            }
        }
        cout << (long long int)rlen*glen*blen - sum << 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;
int a, b, c;
a = 0;
b = 0;
c = 0;
    for (auto c : S) {
        if (c == 'R') ++r;
        else if (c == 'G') ++g;
        else ++b;
    }
ans = a*b*c;
int hoge = 0;
for(int i = 0; i < N; ++i){
for(int j = i+1; j < N; ++j){
    if(S[i] == S[j]) continue;

    int k = j*2-i;
    if(S[k] == S[i] || S[k] == S[j] || k >= N) continue;
    hoge++;
}

}


cout << ans-hoge << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'r' was not declared in this scope
   16 |         if (c == 'R') ++r;
      |                         ^
a.cc:17:30: error: 'g' was not declared in this scope
   17 |         else if (c == 'G') ++g;
      |                              ^
Language: C++

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

int main() {
    int n;
    int r,g,b;
    cin >> n;
    string s;
    cin >> s;
    r=0;g=0;b=0;
    for(int i = 0;i < n;i++){
        switch(s[i]){
            case 'R':
                r++;break;
            case 'G':
                g++;break;
            case 'B':
                b++;break;
        }
    }
    long total = r*g*b;
    long counter = 0;
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j < n;j++){
            int a = s[i] + s[j];
            int k = 2*j - i;
            if(n <= k){continue;}
            a += s[k];
            if(a == ('R' + 'G' + 'B'){counter++;}
        }
    }
    cout << total - counter << endl;
//--------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:38: error: expected ')' before '{' token
   32 |             if(a == ('R' + 'G' + 'B'){counter++;}
      |               ~                      ^
      |                                      )
a.cc:33:9: error: expected primary-expression before '}' token
   33 |         }
      |         ^
Language: C++

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




int main(){

  ll N, r = 0, g = 0, b = 0;
  string S;
  cin >> N >> S;

  for(int i = 0; i < N; i++){
    if(s[i] == 'R') r++;
    if(s[i] == 'G') g++;
    if(s[i] == 'B') b++;
  }

  ll sum = 0;
  for(int j = 0; j < N - 2; j++){
    for(int k = 1; k <= (N - j - 1) / 2; k++){
      if(S[j] != S[j + k] && S[j] != S[j + k * 2] && S[j + k * 2] != S[j]) sum++;
    }
  }

  ll a = r * g * b - sum;
  cout << a << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'll' was not declared in this scope
    9 |   ll N, r = 0, g = 0, b = 0;
      |   ^~
a.cc:11:10: error: 'N' was not declared in this scope
   11 |   cin >> N >> S;
      |          ^
a.cc:14:8: error: 's' was not declared in this scope
   14 |     if(s[i] == 'R') r++;
      |        ^
a.cc:14:21: error: 'r' was not declared in this scope
   14 |     if(s[i] == 'R') r++;
      |                     ^
a.cc:15:8: error: 's' was not declared in this scope
   15 |     if(s[i] == 'G') g++;
      |        ^
a.cc:15:21: error: 'g' was not declared in this scope
   15 |     if(s[i] == 'G') g++;
      |                     ^
a.cc:16:8: error: 's' was not declared in this scope
   16 |     if(s[i] == 'B') b++;
      |        ^
a.cc:16:21: error: 'b' was not declared in this scope
   16 |     if(s[i] == 'B') b++;
      |                     ^
a.cc:19:5: error: expected ';' before 'sum'
   19 |   ll sum = 0;
      |     ^~~~
      |     ;
a.cc:22:76: error: 'sum' was not declared in this scope
   22 |       if(S[j] != S[j + k] && S[j] != S[j + k * 2] && S[j + k * 2] != S[j]) sum++;
      |                                                                            ^~~
a.cc:26:5: error: expected ';' before 'a'
   26 |   ll a = r * g * b - sum;
      |     ^~
      |     ;
a.cc:27:11: error: 'a' was not declared in this scope
   27 |   cout << a << endl;
      |           ^
Language: C

// https://atcoder.jp/contests/abc162/tasks/abc162_d
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    string s;
    cin >> s;
    set<int> tr, tg, tb;
    REP(i, N) {
        if (s[i] == 'R') {
            tr.insert(i);
        } else if (s[i] == 'G') {
            tg.insert(i);
        } else {
            tb.insert(i);
        }
    }
    int sum = 0;
    REP(i, N - 2) {
        FOR(j, i + 1, N - 1) {
            if (s[i] == s[j])
                continue;
            set<char> st;
            st.insert(s[i]);
            st.insert(s[j]);
            int t = 0;
            if (st.count('R') == 0) {
                t = distance(lower_bound(ALL(tr), j + 1), tr.end());
                if (tr.count(2 * j - i) > 0)
                    t--;
            } else if (st.count('G') == 0) {
                t = distance(lower_bound(ALL(tg), j + 1), tg.end());
                if (tg.count(2 * j - i) > 0)
                    t--;
            } else {
                t = distance(lower_bound(ALL(tb), j + 1), tb.end());
                if (tb.count(2 * j - i) > 0)
                    t--;
            }
            sum += t;
        }
    }

    cout << sum << 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>
#include <numeric>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;

//#define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif



int main() {
    int N; cin >> N;
    string S; cin >> S;
    int Rcount = 0, Gcount = 0, Bcount = 0;
    for(int i = 0; i < N; i++){
        char RGB = S[i];
        if(RGB == 'R'){
            Rcount ++;
        }
        else if(RGB == 'G'){
            Gcount ++;
        }
        else if(RGB == 'B'){
            Bcount ++;
        }
    }
    PRINT(Rcount)
    PRINT(Gcount)
    PRINT(Bcount)

    ll sum = Rcount*Gcount*Bcount;

    for(int i = 0; i < N; i++){
        for(int j = i; j < N; j++){
            if(-i+j*2 >= N) continue;
            char first = S[i];
            char second = S[j];
            char third = S[-i+j*2];
            if(first != second && second != third && third != first){
                sum --;
                // PRINT(first)
                // PRINT(second)
                // PRINT(third)
                PRINT(i)
                PRINT(j)
                PRINT(2*j-i)
            }
        }
    }
   cout << sum << 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 <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    int r = 0;
    int g = 0;
    int b = 0;
    rep(i,0,n-1){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }
    int ans = r*g*b;
    int j,k;

    rep(i,1,n){
        rep(d,1,n){
            j = i + d;
            k = j + d;
            if(k>n) break;
            if(s[i-1]!=s[j-1]&&s[i-1]!=s[k-1]&&s[j-1]!=s[k-1]) ans--;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

#include<stdio.h>

int main(void){

    int N,i,j,R_num = 0,G_num = 0,B_num = 0;
    long int ans;
    char S[4001];

    scanf("%d",&N);
    scanf("%s",S);
    
    for(i = 0;i < N;i++){
        if(S[i] == 'R') R_num++;
        else if(S[i] == 'G') G_num++;
        else if(S[i] == 'B') B_num++;
    }

    ans = R_num * G_num * B_num;

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

    printf("%ld\n",ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:76: error: expected ']' before ')' token
   22 |             if((S[i] != S[i+j]) && (S[i+j] != S[i+j+j]) && (S[i+j+j] != S[i)]) ans--;
      |                                                                            ^
      |                                                                            ]
main.c:22:77: error: expected ')' before ']' token
   22 |             if((S[i] != S[i+j]) && (S[i+j] != S[i+j+j]) && (S[i+j+j] != S[i)]) ans--;
      |               ~                                                             ^
      |                                                                             )
main.c:22:77: error: expected statement before ']' token
main.c:22:78: error: expected statement before ')' token
   22 |             if((S[i] != S[i+j]) && (S[i+j] != S[i+j+j]) && (S[i+j+j] != S[i)]) ans--;
      |                                                                              ^
Language: C++

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

int main() {
    int n;
    int r,g,b;
    cin >> n;
    string s;
    cin >> s;
    r=0;g=0;b=0;
    for(int i = 0;i < n;i++){
        switch(s[i]){
            case 'R':
                r++;break;
            case 'G':
                g++;break;
            case 'B':
                b++;break;
        }
    }
    long total = r*g*b;
    long counter = 0;
    for(int i = 0;i < n;i++){
        for(int j = i + 1;j < n;j++){
            if(s[i] == s[j])continue;
            int k = (j * 2) - i;
            if()
            if((n - 1)< k || s[k] == s[i] || s[k] == s[j])continue;
            counter++;
            
        }
    }
    cout << total - counter << endl;
//--------------------
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:16: error: expected primary-expression before ')' token
   30 |             if()
      |                ^
Language: C

#include "bits/stdc++.h"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<vin> vvin;
typedef vector<vvin> vvvin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<vd> vvd;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define SIZE(a) int((a).size())
vin r(1400),g(1400),b(1400);
int main(){
  ll n,ans=0,rh=0,gh=0,bh=0;
  cin>>n;
  rep(i,0,n){
    char x;cin>>x;
    if(x=='R'){r[rh]=i+1;rh++;}
    if(x=='G'){g[gh]=i+1;gh++;}
    if(x=='B'){b[bh]=i+1;bh++;}
  }
  vin rr(rh),gg(gh),bb(bh);
  rep(i,0,rh){rr[i]=r[i];}
  rep(i,0,gh){gg[i]=g[i];}
  rep(i,0,bh){bb[i]=b[i];}
  
  rep(i,0,gh){
    rep(j,0,bh){
      ll c,d,e;
      c=binary_search(rr.begin(),rr.end(),(gg[i]+bb[j])/2);
      if((gg[i]+bb[j])%2!=0){c=0;}
      d=binary_search(rr.begin(),rr.end(),2*gg[i]-bb[j]);
      e=binary_search(rr.begin(),rr.end(),2*bb[j]-gg[i]);
      ans+=rh-c-d-e;
    }
  }
  if(n<=2){cout<<0<<endl;}
  else{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;
#define rep(i, n)  for (uint64_t i = 0; i <  (uint64_t)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)

int main() {
  uint64_t Ans = 0;  // 回答：
  int N; cin >> N;  // 文字列数１～４０００
  string S; cin >> S; // 対象文字列

  if ( N<3 ){cout << 0 << endl; return 0;}
  // ①Ｒ・Ｇ・Ｂから、一つずつ選ぶ組の数を出す。
  // ②ポイント i から ポイント j の向こうに距離の等しいポイント k を選定し、
  // 　ＲＧＢ３色なら、①の数から引く。
  int R=0;  // Rの数
  int G=0;  // Rの数
  int B=0;  // Rの数
  rep(i,N){
    if(S.at(i)=='R'){R++;}
    if(S.at(i)=='G'){G++;}
    if(S.at(i)=='B'){B++;}
  }
  Ans = R*G*B;

  int wk_int=0;
  // rep(i,N-2){     // i の場所：０～Ｎ－３
  //   rep1(j,N){    // i から j までの距離：１～(N-i)/2 までで良いけど、端数処理が面倒
  //     wk_int = i+j+j;
  //     if( wk_int >= N ){break;}
  //     if( S.at(i)!=S.at(i+j) && S.at(i)!=S.at(i+j+j) && S.at(i+j)!=S.at(i+j+j) ) { Ans--; }
  //   }
  // }
  rep1(d,N){  // ２点間の距離：一定
    for(int i=0,j=d,k=2*d; k<n ; i++,j++,k++ ) {    // i の位置を１つずつずらす
      if(S[i]!=S[j]&&S[j]!=S[k]&&S[k]!=S[i]){ Ans--;}
    }
  }
  cout << Ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:30: error: 'n' was not declared in this scope
   34 |     for(int i=0,j=d,k=2*d; k<n ; i++,j++,k++ ) {    // i の位置を１つずつずらす
      |                              ^
Language: C

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1E9 + 7;
const int INF = 1 << 29;

int main() {
  int N;
  cin >> N;
  char S[N];
  int CountR = 0;
  int CountG = 0;
  int CountB = 0;
  rep(i, N) {
    cin >> S[i];
    if (S[i] == 'R') CountR++;
    if (S[i] == 'G') CountG++;
    if (S[i] == 'B') CountB++;
  };
  int ans = CountR * CountG * CountB;
  for (int i = 0; i < N - 2; i++) {
    int d = 1;
    while (i + 2 * d < N) {
      if ((S[i] != S[i + d]) && (S[i + d] != S[i + 2 * d]) &&
          (S[i + 2 * d] != S[i])) {
        ans--;
      }
      d++;
    }
  }
  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;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define MAXN 200 + 5
const long long INF = 1LL << 60;
const int inf = 1 << 30;

void printVec(std::vector<ll> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
 
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 main(){
  int n; cin >> n;
  string s;
  cin >> s;

  ll ans = 0;
  unordered_map<char, int> mp;
  vector<vector<int>> vv(3, vector<int> (n+1));
  vv[0][0] = 0;
  vv[1][0] = 0;
  vv[2][0] = 0;
  rep(i, 0, n){
    mp[s[i]]++;
    if(s[i] == 'R'){
      vv[0][i+1] = vv[0][i] + 1;
    }else{
      vv[0][i+1] = vv[0][i];
    }
    if(s[i] == 'G'){
      vv[1][i+1] = vv[1][i] + 1;
    }else{
      vv[1][i+1] = vv[1][i];
    }
    if(s[i] == 'B'){
      vv[2][i+1] = vv[2][i] + 1;
    }else{
      vv[2][i+1] = vv[2][i];
    }
  }
  long long ans = 0;
  rep(i, 0, n){
    rep(j, i+1, n){
      if (s[i] == s[j]) continue;

      if(s[i] != 'R' && s[j] != 'R'){
        ans += vv[0][n] - vv[0][j+1];
        if(s[2 * j - i] != 'R') ans--;
      }
      if(s[i] != 'G' && s[j] != 'G'){
        ans += vv[1][n] - vv[1][j+1];
        if(s[2 * j - i] != 'G') ans--;
      }
      if(s[i] != 'B' && s[j] != 'B'){
        ans += vv[2][n] - vv[2][j+1];
        if(s[2 * j - i] != 'B') ans--;
      }
    }
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: redeclaration of 'long long int ans'
   54 |   long long ans = 0;
      |             ^~~
a.cc:30:6: note: 'long long int ans' previously declared here
   30 |   ll ans = 0;
      |      ^~~
Language: C++

#include <iostream>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <algorithm>

typedef long long ll;

using namespace std;

ll main() {
  vector<ll> v,w;
  char c;
  ll k,nr=0,nb=0,ng=0,n,sum;
  cin>>n;
  while(scanf("%c",&c)!=EOF){
    if(c=='R'){v.push_back(1);nr++;}
    else if(c=='B'){v.push_back(2);nb++;}
    else if(c=='G'){v.push_back(3);ng++;}
  }
  w=v;
  sum=ng*nb*nr;
  if(sum==0){
    cout<<sum<<endl;
    return 0;
  }
  for(ll i=0;i<n-2;i++){
    for(ll j=i+1;j<n-1;j++){
      k=2*(j+1)-(i+1);
      if(k<=n){
        if(w[k-1]!=w[j]&&w[j]!=w[i]&&w[i]!=w[k-1])sum--;
      }
    }
  }
  if(sum<=0){
    cout<<0<<endl;
    return 0;
  }
  cout<<sum<<endl;
}


Compiler output:
a.cc:17:1: error: '::main' must return 'int'
   17 | ll main() {
      | ^~
Language: C

#include<stdio.h>

int main(void){

    int N,i,j,R_num = 0,G_num = 0,B_num = 0;
    long int ans;
    char S[4001];

    scanf("%d",&N);
    scanf("%s",S);
    
    for(i = 0;i < N;i++){
        if(S[i] == 'R') R_num++;
        else if(S[i] == 'G') G_num++;
        else if(S[i] == 'B') B_num++;
    }

    ans = R_num * G_num * B_num;

    for(i = 0;i < N;i++){
        for(j = 1;(i+j+j) < N;j++){
            if(S[i] == 'R' && S[i+j] == 'G' && S[i+j+j] == 'B') a+jns--;
            else if(S[i] == 'R' && S[i+j] == 'B' && S[i+j+j] == 'G') ans--;
            else if(S[i] == 'G' && S[i+j] == 'R' && S[i+j+j] == 'B') ans--;
            else if(S[i] == 'G' && S[i+j] == 'B' && S[i+j+j] == 'R') ans--;
            else if(S[i] == 'B' && S[i+j] == 'R' && S[i+j+j] == 'G') ans--;
            else if(S[i] == 'B' && S[i+j] == 'G' && S[i+j+j] == 'R') ans--;
        }
    }

    printf("%ld\n",ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:65: error: 'a' undeclared (first use in this function)
   22 |             if(S[i] == 'R' && S[i+j] == 'G' && S[i+j+j] == 'B') a+jns--;
      |                                                                 ^
main.c:22:65: note: each undeclared identifier is reported only once for each function it appears in
main.c:22:67: error: 'jns' undeclared (first use in this function); did you mean 'ans'?
   22 |             if(S[i] == 'R' && S[i+j] == 'G' && S[i+j+j] == 'B') a+jns--;
      |                                                                   ^~~
      |                                                                   ans
Language: C

#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define MAXN 200 + 5
const long long INF = 1LL << 60;
const int inf = 1 << 30;

void printVec(std::vector<ll> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
 
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 main(){
  int n; cin >> n;
  string s;
  cin >> s;

  ll ans = 0;
  unordered_map<char, int> mp;
  vector<vector<int>> vv(3, vector<int> (n+1));
  vv[0][0] = 0;
  vv[1][0] = 0;
  vv[2][0] = 0;
  rep(i, 0, n){
    mp[s[i]]++;
    if(s[i] == 'R'){
      vv[0][i+1] = vv[0][i] + 1;
    }else{
      vv[0][i+1] = vv[0][i];
    }
    if(s[i] == 'G'){
      vv[1][i+1] = vv[1][i] + 1;
    }else{
      vv[1][i+1] = vv[1][i];
    }
    if(s[i] == 'B'){
      vv[2][i+1] = vv[2][i] + 1;
    }else{
      vv[2][i+1] = vv[2][i];
    }
  }
  long long ans = 0;
  rep(i, 0, n){
    rep(j, i+1, n){
      if (s[i] == s[j]) continue;

      if(s[i] != 'R' && s[j] != 'R'){
        ans += vv[0][n] - vv[0][j+1];
        if(s[2 * j - i] != 'R') ans--;
      }
      if(s[i] != 'G' && s[j] != 'G'){
        ans += vv[1][n] - vv[1][j+1];
        if(s[2 * j - i] != 'G') ans--;
      }
      if(s[i] != 'B' && s[j] != 'B'){
        ans += vv[2][n] - vv[2][j+1];
        if(s[2 * j - i] != 'B') 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

//RGB Triplets

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

int main (){
    int N; cin >> N;
    string S; cin >> S;
    int a=0,b=0,c=0;
    for(int i=0;i<N;i++){
        if(S[i]=='R')a++;
        else if(S[i]=='G')b++;
        else c++;
    }
    long Ans = a * b * c;
    for(int i=0;i<N;i++){
        for(int j=1;j<min(i+1,N-i);j++){
            if(S[i-j]+S[i]+S[i+j]=='R'+'G'+'B')Ans--;
        }
    }
    cout << Ans << endl;
    return 0;
}

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

int a, b, c;
a = 0;
b = 0;
c = 0;
for(int i = 0; i < N; i++){
    if(S[i] =='R') a++;
    if(S[i] == 'G') b++;
    else c++;
}
ans = a*b*c;
int hoge = 0;
for(int i = 0; i < N; ++i){
for(int j = i+1; j < N; ++j){
    if(S[i] == S[j]) continue;

    int k = j*2 - i;
    if(S[k] == S[i] || S[k] == S[j] || k >= N) continue;
    hoge++;
}

}


cout << ans-hoge << endl;
}



Compiler output:
a.cc:2:1: error: 'a' does not name a type
    2 | a = 0;
      | ^
a.cc:3:1: error: 'b' does not name a type
    3 | b = 0;
      | ^
a.cc:4:1: error: 'c' does not name a type
    4 | c = 0;
      | ^
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for(int i = 0; i < N; i++){
      | ^~~
a.cc:5:16: error: 'i' does not name a type
    5 | for(int i = 0; i < N; i++){
      |                ^
a.cc:5:23: error: 'i' does not name a type
    5 | for(int i = 0; i < N; i++){
      |                       ^
a.cc:10:1: error: 'ans' does not name a type
   10 | ans = a*b*c;
      | ^~~
a.cc:12:1: error: expected unqualified-id before 'for'
   12 | for(int i = 0; i < N; ++i){
      | ^~~
a.cc:12:16: error: 'i' does not name a type
   12 | for(int i = 0; i < N; ++i){
      |                ^
a.cc:12:23: error: expected unqualified-id before '++' token
   12 | for(int i = 0; i < N; ++i){
      |                       ^~
a.cc:24:1: error: 'cout' does not name a type
   24 | cout << ans-hoge << endl;
      | ^~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define lli long long int
#define DBG false
using namespace std;

int main(){
	int N;
	string S;
	cin >> N >> S;
	long long r = 0, g = 0, b = 0;
	for(int i=0; i<N; i++){
		if (S[i] == 'R') r++;
		if (S[i] == 'G') g++;
		if (S[i] == 'B') b++;
	}
 
	long long sum = r * g * b;

    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            int k = j + (j - i);
            if(k >= n) break;
            if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) sum--;
        }
    }

    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: 'n' was not declared in this scope
   19 |     for(int i=0; i<n; i++){
      |                    ^
a.cc:23:16: error: 's' was not declared in this scope
   23 |             if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) sum--;
      |                ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T&a,T b){if(a>b){a=b;return 1;}return 0;}
using ll = long long;
using P = pair<int,int>;

ll n,m,sum;
string s,t;

int main() {
  cin >> n >> s;
  rep(i,n)rep(j,i){
    if(s[i]==s[j]) continue;
    rep(k,j){
    if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j) sum++;
    }
  }
  cout << sum << 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>
#define lli long long int
#define DBG false
using namespace std;
 
int main() {
	int N;
	string S;
	cin >> N >> S;
    int cr=0, cg=0, cb=0;
    lli sum = 0;

    for(int i=0; i<n; i++){
        if(S.at(i) == 'R') cr++;
        else if(S.at(i) == 'G') cg++;
        else if(S.at(i) == 'B') cb++;
    }
    sum = cr * cg * cb;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int k = (j - i) + j;
			if (k >= N) break;
			if (S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) sum--;
		}
	}
	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'n' was not declared in this scope
   13 |     for(int i=0; i<n; i++){
      |                    ^
Language: C++

#include <bits/stdc++.h>
#define lli long long int
#define DBG false
using namespace std;
 
int main() {
	int N;
	string S;
	cin >> N >> S;
    int n, cr=0, cg=0, cb=0;
    lli sum = 0;

    for(int i=0; i<n; i++){
        if(s.at(i) == 'R') cr++;
        else if(s.at(i) == 'G') cg++;
        else if(s.at(i) == 'B') cb++;
    }
    sum = cr * cg * cb;
    
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int k = (j - i) + j;
			if (k >= N) break;
			if (S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) sum--;
		}
	}
	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 's' was not declared in this scope
   14 |         if(s.at(i) == 'R') cr++;
      |            ^
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 < n; i++)
typedef long long ll;

int main() {
    int N; cin >> N;
    string S; cin >> S;
    map<char, int> m;
    for(int i = 0; i < N; i++){
        m[S[i]]++;
    }
    int sum = m['R'] * m['G'] * m['B'];
    int cnt = 0;
    for(int i = 0; i < N; i++){
        // indexの間隔を1ずつふやす
        for(int j = i + 1; j < N; j++){
            // 同じ文字だったらはじく
            if(S[i] == S[j]) continue;
            // 3文字目のindexを計算
            int k = j * 2 - i;
            // 範囲外または同じ文字ならはじく
            if(k >= N || S[k] == S[i] || S[k] == S[j]) continue;
            cnt++;
        }
    }
    cout << sum - 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>
#define lli long long int
#define DBG false
using namespace std;

int main() {
	int N;
	string S;
	cin >> N >> S;
	long long r = 0, g = 0, b = 0;
	rep(i, N) {
		if (S[i] == 'R') r++;
		if (S[i] == 'G') g++;
		if (S[i] == 'B') b++;
	}
	long long sum = r * g * b;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			int k = (j - i) + j;
			if (k >= N) break;
			if (S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) sum--;
		}
	}
	cout << sum << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         rep(i, N) {
      |             ^
a.cc:11:9: error: 'rep' was not declared in this scope
   11 |         rep(i, N) {
      |         ^~~
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>
#include <set>
#include <bitset>
#include <limits>

using namespace std;

#define ll long long

// int check(int i, int j, int k){
//     int flag = 1;
//     if(j-i == k-j){
//         flag = 0;
//     }else if(k-i == j-k){
//         flag = 0;
//     }else if(i-j == k-i){
//         flag = 0;
//     }else if(j-k == i-j){
//         flag = 0;
//     }else if(i-k == j-i){
//         flag = 0;
//     }else if(k-j == i-k){
//         flag = 0;
//     }

//     return flag;
// }

int main(void){
    int n;
    cin >> n;
    string s;
    cin >> s;
    cout << s.max_size() << endl;

    vector<int> r, g, b;

    r.reserve(n);
    g.reserve(n);
    b.reserve(n);

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

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

    ll ans = 0;
    for(int ri = 0;ri < (int)r.size();++ri){
        for(int gi = 0;gi < (int)g.size();++gi){
            ans += (ll)b.size();
            int i, j;
            if(r[ri] > g[gi]){
                i = g[gi];
                j = r[ri];
            }else{
                i = r[ri];
                j = g[gi];
            }

            if(binary_search(b.begin(), b.end(), 2*i-j)){
                ans -= 1LL;
            }
            if((i+j)%2 == 0){
                if(binary_search(b.begin(), b.end(), (i+j)/2)){
                    ans -= 1LL;
                }
            }
            if(binary_search(b.begin(), b.end(), 2*j-i)){
                ans -= 1LL;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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;


long long asize=0;
//vector<vector<int>> a(4000,vector<int>(3));
vector<vector<int>> a;

void recursive_comb(int *indexes, int s, int rest) {
  if (rest == 0) {
    a.push_back({indexes[0],indexes[1],indexes[2]});
    // a.at(asize).at(0)=indexes[0];
    // a.at(asize).at(1)=indexes[1];
    // a.at(asize).at(2)=indexes[2];
    asize++;
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1);
  }
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k);
}

int main(){
    int N,sum=0;
    string s;
    cin>>N>>s;
    if(N<=2) sum=0;
    else{
        foreach_comb(N, 3);
        // cout<<asize<<endl;
        for(int count=0;count<a.size();count++){
            int i=a.at(count).at(0);
            int j=a.at(count).at(1);
            int k=a.at(count).at(2);
            // cout<<i<<j<<k<<endl;
            if((j-i)==(k-j)) continue;
            if((s[i]!=s[j])&&(s[i]!=s[k])&&(s[j]!=s[k])) sum++;
        }
    }
    cout<<sum<<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

n = int(input())
s = input()
cnt = s.count('R')*s.count('G')*s.count('B')
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] != s[j]:
            if 2*j-i <= n-1:
                if s[2*j-i] not in(s[i],s[j]):
                    cnt -= 1
print(cnt)

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<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
using namespace std;
using ll =long long;

int main() {
	string S;
	ll N;
	ll sum=0;
	
	map<ll,ll> R,G,B;
	
	cin >>N>> S;
	for (int i = 0; i < N; i++) {
		for (int j = i; j < N; j++) {
			if (S[j] == 'R') {
				R[i] ++;
			}
			if (S[j] == 'G') {
				G[i]++;
			}
			if (S[j] == 'B') {
				B[i]++;
			}
		}
	}
	for (int i = 0; i < N-2; i++) {
		for (int j = i + 1; j < N-1; j++) {
			if (S[i] != S[j]) {
				if (S[i] != 'R' && S[j] != 'R') {
					if (j + j - i< N && S[j - i + j] == 'R') {
						if (R[j + 1] - 1 > 0) {
							sum += R[j + 1] - 1;
						}
					}
					else {
						
							sum += R[j + 1];
						
					}
				}
				if (S[i] != 'G' && S[j] != 'G') {
					if (j + j - i <N && S[j - i + j] == 'G') {
						if (G[j + 1] - 1 > 0) {
							sum += G[j + 1] - 1;
						}
					}
					else {

						sum += G[j+1];
					}
				}
				if (S[i] != 'B' && S[j] != 'B') {
					if (j+j-i<N&&S[j - i + j] == 'B') {
						if (B[j + 1] - 1 > 0) {
							sum += B[j + 1] - 1;
						}
					}
					else {

						sum += B[j+1];
					}
				}
			}
		}
	}
	cout << sum;
	
	
}

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