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

#include <bits/stdc++.h>
using namespace std;
constexpr long long MOD = 1000000007;
using ll = long long;
int main() {
ll n;
string s;
cin >> n >> s;
ll all=n*(n-1)*(n-2)/6;
for(ll i=1;i<n+1;i++){
    for(ll j=1;j<n+1;j++){
        if(i>=j)continue;
        if(2*j-i-1>=n)continue;
        if(s[i-1]==s[j-1]||s[j-1]==s[2*j-i-1]||s[i-1]==s[2*j-i-1])all++;
        }
    }
for(ll j=1;j<=n;j++){
    all-=min(n-j,j-1);
}
ll cntr=0;
ll cntg=0;
ll cntb=0;
for(ll i=0;i<n;i++){
    if(s[i]=='R')cntr++;
    else if(s[i]=='G')cntg++;
    else cntb++;
}
all-=3*cntr*(cntr-1)*(n-2)/6;
all-=3*cntg*(cntg-1)*(n-2)/6;
all-=3*cntb*(cntb-1)*(n-2)/6;
all+=2*((cntr*(cntr-1)*(cntr-2)/6)+(cntg*(cntg-1)*(cntg-2)/6)+(cntb*(cntb-1)*(cntb-2)/6));

cout << all << 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 <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <cmath>
using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18

int main()
{
    int N; cin >> N;
    string S; cin >> S;
    vector<int> posR, posG, posB;
    for (size_t i = 0; i<S.size(); i++) {
        if (S[i] == 'R')
            posR.push_back(i);
        else if (S[i] == 'G')
            posG.push_back(i);
        else
            posB.push_back(i);
    }

    int sum = 0;
    vector<int> rgb(3);
    for (auto i: posR) {
        rgb[0] = i;
        for (auto j: posG) {
            rgb[1] = j;
            for (auto k: posB) {
                rgb[2] = k;
                vector<int> rgbSort(rgb);
                sort(rgbSort.begin(), rgbSort.end());
                if ((rgbSort[1] - rgbSort[0]) == (rgbSort[2] - rgbSort[1])) continue;
                sum++;
            }
        }
    }
    cout << sum << endl;
}


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

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    /*R,G,Bそれぞれの数を数える*/
    vector<int> r(n),g(n),b(n);
    int rcount = 0,gcount = 0,bcount = 0;
    for(int i = 0;i < n;i++){
        switch(s.at(i)){
            case 'R':
            //r.at(rcount) = i;　//いらない
            rcount++;
            break;
            case 'G':
            //g.at(gcount) = i;　//いらない
            gcount++;
            break;
            case 'B':
            //b.at(bcount) = i;　//いらない
            bcount++;
            break;
        }
    }
    /*配列順の差が等しいとき、異なる文字が入ってるか調べる*/
    int rest = 0;
    for(int i = 1;i <= (n - 3)/2 + 1;i++){
        //cout << "差分" << i << endl;
        for(int j = 0;j + i*2< n;j++){
            //cout << j << " " << j + i << " " << j + i*2 << endl;
            if((s.at(j) != s.at(j + i))&&(s.at(j) != s.at(j + 2*i))&&(s.at(j + i) != s.at(j + i*2))){
                rest++;
            }
        }
    }
    //cout << "rest" << rest << endl;
    /**/
    int ans = bcount*rcount*gcount - rest;
    cout << ans << endl;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:44:14: error: expected '}' at end of input
   44 |     return 0;
      |              ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C

//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

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

	ll r=0, g=0, b=0;
	rep(i, N) {
		if (S[i] == 'R') r++;
		if (S[i] == 'G')g++;
		if (S[i] == 'B')b++;
	}

	ll ans = r * g * b;

	ll C = (N - 3) / 2;
	for (ll d = 0; d <= C; d++) {
		for (int s = 0; s <= N - 2 * d - 3; s++) {
			if (S[s] != S[s + d + 1] && S[s] != S[s + 2 * d + 2] && S[s + d + 1] != S[s + 2 * d + 2]) ans--;
		}
	}

	cout << ans << endl;
}

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

n = int(input())
s = list(input())

cnt=0
r = []
g = []
b = []
for i, x in enumerate(s):
    if x == "R":
        r.append(i)
    elif x == "G":
        g.append(i)
    else:
        b.append(i)


for i in r:
    for j in g:
        for k in b:
            l = [i,j,k]
            l.sort()
            if l[1]-l[0] != l[2]-l[1]:
                cnt += 1
print(cnt)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;

 
    
    
int main()
{
   int i,j,k,n,p,x=0;
   string s;
   cin>>n>>s;
   for ( i = 0; i < n; i++)
   {
     for (j = i+1; j < n; j++)
     {
       for ( k = j; k < n; k++)
       { p=2*j-i-k;
         if ((s[i]=!s[j])&&(s[i]=&s[k])||(s[j]==s[k])||(p!=0))
         {
             x=x; 
         }
         else
         {
           x=x+1;
         }
         
       }
     }
   }
   cout<<x<<endl;
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:34: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type*' {aka 'char*'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   20 |          if ((s[i]=!s[j])&&(s[i]=&s[k])||(s[j]==s[k])||(p!=0))
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
 
int main() {

int n;cin>>n;
 struct pair{char x; int y; }
  Data d[n]; 
  
  for( int k = 0; i < n; k++ ){
      d[k].y = i; // 1,2,3,...となるようにする 
      cin>>d[k].x;
}
  
  sort(all(d.x));
  int r=0,g=0,b=0;
  
  rep(j,n-1){
    if(a.at(i)==a.at(i+1)){b++;}
    else break;
  }
  {if(a.at(i)==a.at(i+1)){g++;}
    else break;}
  
  r=n-b-g;
  sort(all(d.y));
  int minus;
  
  rep(m,n){
  	REP(h,1,n){if(h<=m||d[m].x==d[h].x){h++;}  
      else if{REP(f,2,n){if(f<=h||d[h].x!=d[f].x){f++;}
        else if(h*2==m+f){minus++;}}}}}
  
  
  ll com=r*g*b;
  cout<<com-minus<<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 s;
  cin >> 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 < n ; ++j){
      if(i - j < 0 || i + j >=n) continue;
      if(s[i] != s[i + j] && s[i - j] != s[i] && s[i - j] != s[i + j]) ans--;
    }
  }
  cout << ans << endl;
}

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

#pragma GCC optimize("O3")
#pragma GCC target("avx512")

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

llong n;
char s[4096];

int main() {
    scanf("%lld %s", &n, s);

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

    return 0;
}


Compiler output:
cc1plus: error: attribute 'target' argument 'avx512' is unknown
cc1plus: error: attribute 'target' argument 'avx512' is unknown
Language: C

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int r=0;
  int g=0;
  int b=0;
  //RGBの数それぞれ数える
  
  for(int i=0; i<N; i++){
    if(S.at(i) == 'R'){
      r++;
    }
    if(S.at(i) == 'G'){
      g++;
    }
    if(S.at(i) == 'B'){
      b++;
    }
  }
  
  int onaji=0;
  for(int i=0; i<N; i++){
    for(int d=1; i+2*d<N; d++){
      if(S.at(i)!=S.at(i+d) && S.at(i)!=S.at(i+2*d) && S.at(i+d)!=S.at(i+2*d)){
        onaji++;
      }
    }
  }
  
  cout << r*g*b - onaji << 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<vector>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> r(n),g(n),b(n);
    int rcount = 0,gcount = 0,bcount = 0;
    for(int i = 0;i < n;i++){
        switch(s.at(i)){
            case 'R':
            rcount++;
            break;
            case 'G':
            gcount++;
            break;
            case 'B':
            bcount++;
            break;
        }
    }

    int rest = 0;
    for(int i = 1;i <= (n - 3)/2 + 1;i++){
        for(int j = 0;j + i*2<= (n-1);j++){
            if((s.at(j) != s.at(j + i))&&(s.at(j) != s.at(j + 2*i))&&(s.at(j + i) != s.at(j + i*2))){
                rest++;
            }
        }
    }
    int ans = bcount*rcount*gcount - rest;
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: expected '}' at end of input
   36 |     cout << ans << endl;
      |                         ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
#define rep(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
#define PI 3.14159265358979
typedef long long int ll;
const int inf=1001001001;
ll absc(ll a,ll b){return (a-b>0?a-b:b-a);
}
ll mini(ll a,ll b){return (a>b?b:a);}
ll gcd(ll a,ll b){
	if(a<b)swap(a,b);
	return (a%b?gcd(a%b,b):b);
}
int main()
{
    ll N,ans=0;
    string s;
    cin>>N;
    cin>>s;
    for(int i=0;i<N-3;i++)
    {
    	for(int j=i+1;j<N-1;j++)
    	{
    		for(int k=j+1;k<N;k++)
    		{
    			if(s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i]&&j-i!=k-j)++ans;
    		}
    	}
    }
    cout<<ans;
}


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

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> r(n),g(n),b(n);
    int rcount = 0,gcount = 0,bcount = 0;
    for(int i = 0;i < n;i++){
        switch(s.at(i)){
            case 'R':
            rcount++;
            break;
            case 'G':
            gcount++;
            break;
            case 'B':
            bcount++;
            break;
        }
    }

    int rest = 0;
    for(int i = 1;i <= (n - 3)/2 + 1;i++){
        for(int j = 0;j + i*2<= (n-1);j++){
            if((s.at(j) != s.at(j + i))&&(s.at(j) != s.at(j + 2*i))&&(s.at(j + i) != s.at(j + i*2))){
                rest++;
            }
        }
    }
    int ans = bcount*rcount*gcount - rest;
    cout << ans << endl;
    return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:37:14: error: expected '}' at end of input
   37 |     return 0;
      |              ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C

#include <iostream>
#include <string>
using namespace std;

int main() {
	int n = 0;
	cin >> n;
	char s[4000] = { 0 };
	cin >> s;
  	int sum = 0;
	int i, j, k;
	for (i = 0; i <= n - 3; i++)
		for (j = i + 1; j <= n - 3 + 1; j++)
			for (k = j + 1; k <= n - 3 + 2; k++) {
              	int cur = k + i;
				if (s[i] != s[j] && s[k] != s[j] && s[k] != s[i] && cur != 0) {
						sum++;
				}
			}
	cout << sum << 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;
int main(){
    int N,cnt=0;
    string S;
    cin >> N >> S;
    vector<int> r;
    vector<int> g;
    vector<int> b;
    for(int i = 0; i < N; i++){
        if(S.at(i)=='R'){
            r.push_back(i);
        }
        else if(S.at(i)=='G'){
            g.push_back(i);
        }
        else{
            b.push_back(i);
        }
    }
    for(int i = 1; i < N; i++){
        for(int j = 0; j < N; j++){
            if(j+2*i >= N){
                break;
            }
            if(S[j]!=S[j+i] && S[j]!=S[j+i+i] && S[j+i]!=S[j+i+i]){
                cnt++;
            }
        }
    }
    int ans = r.size() * g.size() * b.size() - cnt;
    cout << ans << endl;
}

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

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int answer = 0;
  for(int i = 0; i < N ; i++){
    for(int d = i + 1; j < N ; d++){
	  int j = d + i;
      int k = d + j;
      if(k >= N){
        break;
      }
      if(j - i != k - j){
        if((S.at(j) == 'G' && S.at(k) == 'B')||(S.at(j) == 'B' && S.at(k) == 'G')){
          answer++;
        }
      }
    }
  }
  cout << answer << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: 'j' was not declared in this scope
   11 |     for(int d = i + 1; j < N ; d++){
      |                        ^
Language: C++


int main() {
  int N;
  cin >> N;
  vector<char> V(N);
  for(int i=0;i<N;i++){
    cin >> V.at(i);
  }
  vector<int> R(0),G(0),B(0);
  for(int i=0;i<N;i++){
    if(V.at(i)=='R'){
      R.push_back(i);
    }
    else if(V.at(i)=='G'){
      G.push_back(i);
    }
    else {
      B.push_back(i);
    }
  }
  
  int sum=0;
  for(int i=0;i<R.size();i++){
    for(int j=0;j<G.size();j++){
      for(int k=0;k<B.size();k++){
          if(G.at(j)-R.at(i) != B.at(k)-G.at(j)){
            sum++;
          }
        
      }
    }
  }
  cout << sum <<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> N;
      |   ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<char> V(N);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'char'
    5 |   vector<char> V(N);
      |          ^~~~
a.cc:7:12: error: 'V' was not declared in this scope
    7 |     cin >> V.at(i);
      |            ^
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> R(0),G(0),B(0);
      |          ^~~
a.cc:11:8: error: 'V' was not declared in this scope
   11 |     if(V.at(i)=='R'){
      |        ^
a.cc:12:7: error: 'R' was not declared in this scope
   12 |       R.push_back(i);
      |       ^
a.cc:15:7: error: 'G' was not declared in this scope
   15 |       G.push_back(i);
      |       ^
a.cc:18:7: error: 'B' was not declared in this scope
   18 |       B.push_back(i);
      |       ^
a.cc:23:17: error: 'R' was not declared in this scope
   23 |   for(int i=0;i<R.size();i++){
      |                 ^
a.cc:24:19: error: 'G' was not declared in this scope
   24 |     for(int j=0;j<G.size();j++){
      |                   ^
a.cc:25:21: error: 'B' was not declared in this scope
   25 |       for(int k=0;k<B.size();k++){
      |                     ^
a.cc:33:3: error: 'cout' was not declared in this scope
   33 |   cout << sum <<endl;
      |   ^~~~
a.cc:33:17: error: 'endl' was not declared in this scope
   33 |   cout << sum <<endl;
      |                 ^~~~
Language: C++

#include <iostream>

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,avx512,fma")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    long long ret = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                ret += s[i] != s[j] & s[j] != s[k] & s[k] != s[i] & j - i != k - j;
            }
        }
    }
    printf("%lld", ret);
    return 0;
}

Compiler output:
cc1plus: error: attribute 'target' argument 'avx512' is unknown
cc1plus: error: attribute 'target' argument 'avx512' is unknown
Language: C

#include <stdio.h>
#include <math.h>
int main(){
  int n,count=0;
  int a=0,b=0,c=0;
  scanf("%d",&n);
  char s[n];
  int r[n],g[n],d[n];
  scanf("%s",&s);
  for(int i=0;i<n;i++){
    if(s[i]=='R'){
      r[a]=i;
      a++;
    }
    if(s[i]=='G'){
      g[b]=i;
      b++;
    }
    if(s[i]=='B'){
      d[c]=i;
      c++;
    }
  }
  
  int A,B,C,max,mid,min,buff;
  for(int i=a-1;i>=0;i--){
    for(int j=b-1;j>=0;j--){
      for(int k=c-1;k>=0;k--){
        A=r[i];
        B=g[j];
        C=d[k];
        
        max=A;
        mid=B;
        min=C;
        
        if(max<mid){
          buff=mid;
          mid=max;
          max=buff;
        }
        if(mid<min){
          buff=mid;
          mid=min;
          min=buff;
        }
        if(max<mid){
          buff=mid;
          mid=max;
          max=buff;
        }
        if(max-mid)!=mid-min)){
          count++;
        }
      }
    }
  }
  printf("%d",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:52:20: error: expected expression before '!=' token
   52 |         if(max-mid)!=mid-min)){
      |                    ^~
main.c:52:29: error: expected statement before ')' token
   52 |         if(max-mid)!=mid-min)){
      |                             ^
main.c:52:30: error: expected statement before ')' token
   52 |         if(max-mid)!=mid-min)){
      |                              ^
Language: C

#include <stdio.h>
#include <math.h>
int main(){
  int n,count=0;
  int a=0,b=0,c=0;
  scanf("%d",&n);
  char s[n];
  int r[n],g[n],d[n];
  scanf("%s",&s);
  for(int i=0;i<n;i++){
    if(s[i]=='R'){
      r[a]=i;
      a++;
    }
    if(s[i]=='G'){
      g[b]=i;
      b++;
    }
    if(s[i]=='B'){
      d[c]=i;
      c++;
    }
  }
  
  int A,B,C,max,mid,min,buff;
  for(int i=a-1;i>=0;i--){
    for(int j=b-1;j>=0;j--){
      for(int k=c-1;k>=0;k--){
        A=r[i];
        B=g[j];
        C=d[k];
        
        max=A;
        mid=B;
        min=C;
        
        if(max<mid){
          buff=mid;
          mid=max;
          max=buff;
        }
        if(mid<min){
          buff=mid;
          mid=min;
          min=buff;
        }
        if(max<mid){
          buff=mid;
          mid=max;
          max=buff;
        }
        if((max-mid)!=mid-min)){
          count++;
        }
      }
    }
  }
  printf("%d",count);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:52:31: error: expected statement before ')' token
   52 |         if((max-mid)!=mid-min)){
      |                               ^
Language: C++

#include <iostream>

using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target ("avx512")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    string s;
    cin >> n >> s;
    long long ret = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i] && j - i != k - j)ret++;
            }
        }
    }
    printf("%ld", ret);
    return 0;
}

Compiler output:
cc1plus: error: attribute 'target' argument 'avx512' is unknown
cc1plus: error: attribute 'target' argument 'avx512' is unknown
Language: C

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll res = 0;
    char a[3];
    a[0]='R';
    a[1]='G';
    a[2]='B';
    sort(a,a+3);
    do{
        vector<ll> r(4005,0);
        vector<ll> rg(4005,0);
        vector<ll> rgb(4005,0);
        for(int i=1;i<=n;i++){
            if(s[i-1]==a[0])r[i]=r[i-1]+1;
            else r[i]=r[i-1];
        }
        for(int i=1;i<=n;i++){
            if(s[i-1]==a[1])rg[i]=rg[i-1]+r[i-1];
            else rg[i]=rg[i-1];
        }
        for(int i=1;i<=n;i++){
            if(s[i-1]==a[2])rgb[i]=rgb[i-1]+rg[i-1];
            else rgb[i]=rgb[i-1];
        }
        ll ans = rgb[n];
        vector<int> rp;
        rep(i,n)if(s[i]==a[0])rp.push_back(i);
        rep(i,n){
            if(s[i]==a[1]){
                for(auto p:rp){
                    if(p>i)break;
                    else if(((2*i-p)<n)&&(s[2*i-p]==a[2]))ans--;
                }
        }
        res += ans;
    }while(next_permutation(a,a+3));
    cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:2: error: expected 'while' at end of input
   51 | }
      |  ^
a.cc:51:2: error: expected '(' at end of input
   51 | }
      |  ^
      |  (
a.cc:51:2: error: expected primary-expression at end of input
a.cc:51:2: error: expected ')' at end of input
   51 | }
      |  ^
      |  )
a.cc:51:2: error: expected ';' at end of input
   51 | }
      |  ^
      |  ;
a.cc:51:2: error: expected '}' at end of input
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n; string s;
    cin>>n>>s;
    int x=s.size();
    int sum=1;
    int r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R')r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    sum=r*g*b;
    for(int i=0; i<x-2; ++i){
        for(int j=i+1; j<x-1; ++j){
            int k=j*2-i;
            if(k>=x)continue;
            else{
                if(s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i]){
                    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>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    long long ans;
    long long rr=0,gg=0,bb=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else if(s[i]=='B') b++;
    }
    
    ans=r*g*b;
    for(int i=0;i<n-2;i++){
        int len=1;  //间隔长度+1
        while(i+len+len<n){
            if(s[i]!=s[len+i] && s[len+i]!=s[len+len+i] && s[i]!=s[len+len+i])
                ans--;
            len++;
        }
    }

    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:23: error: 'r' was not declared in this scope
   11 |         if(s[i]=='R') r++;
      |                       ^
a.cc:12:28: error: 'g' was not declared in this scope
   12 |         else if(s[i]=='G') g++;
      |                            ^
a.cc:13:28: error: 'b' was not declared in this scope
   13 |         else if(s[i]=='B') b++;
      |                            ^
a.cc:16:9: error: 'r' was not declared in this scope; did you mean 'rr'?
   16 |     ans=r*g*b;
      |         ^
      |         rr
a.cc:16:11: error: 'g' was not declared in this scope; did you mean 'gg'?
   16 |     ans=r*g*b;
      |           ^
      |           gg
a.cc:16:13: error: 'b' was not declared in this scope; did you mean 'bb'?
   16 |     ans=r*g*b;
      |             ^
      |             bb
Language: C

#include <bits/stdc++.h>

int main(){
        using namespace std;
        int n,sum,count=0;
        string s;
        vector<int> r, g, b;
        cin >> n >> s;
        for(int i=0; i<=n; i++) {
                switch(s[i]) {
                case 'R':
                        r.push_back(i+1);
                        break;
                case 'G':
                        g.push_back(i+1);
                        break;
                case 'B':
                        b.push_back(i+1);
                        break;
                default:
                        break;
                }
        }
        for(int i=0; i<(int)r.size(); i++) {
                for(int j=0; j<(int)g.size(); j++) {
                        for(int k=0; k<(int)b.size(); k++) {
                                sum=r[i]+g[j]+b[k];
                                if(3*r[i]==sum){
                                  continue;
                                } else
                                if(3*g[j]==sum){
                                  continue;
                                } else
                                if(3*b[k]==sum){
                                  continue;
                                }
                                count++;
                        }
                }
        }
        cout << count << 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;
  long long tmp = 0;
  if(n == 1){
    cout << 0;
    return 0;
  }
  if(n == 2){
    cout << 0;
    return 0;
  }
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j <= n; j++){
      if(2 * j - i >= n) continue;
      if(s.at(i) != s.at(j)){
        if(s.at(j) != s.at(2 * j - i)){
          if(s.at(i) != s.at(2 * j - i)) tmp++;
        }
      }
    }
  }
  int r=0, g=0, b=0;
  for(int i = 0; i < n; i++){
    if(s.at(i) == 'R'){
      r++;
    }else if(s.at(i) == 'G'){
      g++;
    }else{
      b++;
    }
  }
  long long out;
  out = long long(r) * g * b;
  if(out - tmp < 0){
    cout << 0;
    return 0;
  }
  cout << out - tmp;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:9: error: expected primary-expression before 'long'
   37 |   out = long long(r) * g * b;
      |         ^~~~
Language: C

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vec = vector<int>;

#define rep(i, n)  for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end(), greater<int>())
#define pout(n, a) cout << fixed << setprecision(n) << (a)
#define Cast(dig, n) static_cast<std::bitset<(dig)>>(n)

const int INF = 2147483647;
const ll  MOD = 1000000007;

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

    int r = 0, g = 0, b = 0;
    for(auto i : s) {
        if(i == 'R') r++;
        else if(i == 'G') g++;
        else b++;
    }

    int ans = r * g * b;

    for(int i = 0; i < n; ++i) {
        // 同間隔で条件を満たすなら除く
        for(int d = 0; d < n; ++d) {
            int j = i+d;
            int k = j+d;

            if(k >= n) break;

            if(s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) --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<iostream>
#include<vector>
#include<algorithm>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<n;i++)
#define int ll
using namespace std;
typedef long long ll;
int main(){
	int n;cin>>n;
  	string s;cin>>s;
  	if(n<4){cout<<0<<endl;return 0;}
  	int r=0,g=0,b=0;
	rep(i,n){
      if(s[i]=='R')r++;
      else if(s[i]=='G')g++;
      else if(s[i]=='B')b++;
    }
  ll sum=0;
  rep(i,n){
    rep(dif,n){
      if( (i+(dif+1)*2)>(n-1))break;
      if(s[i]!=s[i+(dif+1)] && s[i+(dif+1)]!=s[i+(dif+1)*2]&&s[i]!=s[i+(dif+1)*2])sum++;
    }
  }
  
  
  cout<<r*g*b-sum<<endl;
  
  return 0;
}


Compiler output:
a.cc:6:13: error: '::main' must return 'int'
    6 | #define int ll
      |             ^~
a.cc:9:1: note: in expansion of macro 'int'
    9 | int main(){
      | ^~~
Language: C

#include <bits/stdc++.h>

#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}

using namespace std;


int main() 
{	
	fast;
	ll n; cin>>n;
	string s; cin>>s;
	vector<ll>r,g,b;
	for(ll i = 0; i < s.size(); 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);
	} 
	ll ans = r.size() * g.size() * b.size();
//	for(auto &a : r) cout << a << " "; cout << endl;
//	for(auto &a : g) cout << a << " "; cout << endl;
//	for(auto &a : b) cout << a << " "; cout << endl;
	for(ll i = 0; i < r.size(); i++)
	{
		for(ll j = 0; j < g.size(); j++)
		{
			
			for(ll k = 0; k < b.size(); k++)
			{
				if(2*r[i]==g[j]+b[k] || 2*g[j]==r[i]+b[k] || 2*b[k]==r[i]+g[j])ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

n = gets.chomp.to_i
s = gets.chomp.split("")


ans = s.count("R")*s.count("G")*s.count("B")

1.step(n/2) do |dis|
    0.step(n - (dis*2)-1) do |i|
    if (s[i] != s[i + dis] && s[i + dis] != s[i +  dis*2] && s[i + dis*2] != s[i])
    ans -= 1 #等間隔のRGBだったらansを-1する
    end
    end
end
puts ans

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n = gets.chomp.to_i
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: 'gets' undeclared here (not in a function)
    1 | n = gets.chomp.to_i
      |     ^~~~
main.c:2:1: error: expected ',' or ';' before 's'
    2 | s = gets.chomp.split("")
      | ^
main.c:7:1: error: invalid suffix "step" on floating constant
    7 | 1.step(n/2) do |dis|
      | ^~~~~~
main.c:8:5: error: invalid suffix "step" on floating constant
    8 |     0.step(n - (dis*2)-1) do |i|
      |     ^~~~~~
main.c:10:14: error: stray '#' in program
   10 |     ans -= 1 #等間隔のRGBだったらansを-1する
      |              ^
main.c:10:40: error: invalid suffix "する" on integer constant
   10 |     ans -= 1 #等間隔のRGBだったらansを-1する
      |                                        ^~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define rep(i, c) for(int i = 1; i <= (int)c; i++)
#define ll long long
#define upd_max(maxer, updater) if (maxer < updater) maxer = updater;
#define upd_min(miner, updater) if (miner > updater) miner = updater;
const int inf = 1000000000; // 10^9

int main(){
    ll n, r = 0, g = 0, b = 0;
    char s[4100];
    ll ans = 0, cnt = 0;

    cin >> n;
    rep(i, n){
        cin >> s[i];
        if(s[i] == 'R') r++;
        else if(s[i] == 'G') g++;
        else if(s[i] == 'B') b++;
    }

    ans = r * g * b;

    rep(i, n){
        rep(j, (n - i)/2){
            if(s[i] != s[i + j] && s[i] != s[i + 2*j] && s[i + 2 * j] != s[i + j]) cnt++;
        }
    }

    ans -= cnt;

    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;
typedef long long int ll;
unsigned long long int ull;
vector<int>adj[200105];
int visited[200105];
//int b[1000000];
//ll cnt,n,d;
#define mod 1000000007

void solve()
{
 
 int  k;
 cin>>k;
 int y;
 ll sum=0,cnt=0;
 for(int i=1;i<=k;i++)
 {
    y=k/i;
    y--;
    cnt=0;
    cnt+=3*y*(y-1);
    cnt+=3*y+3*y
    sum+=cnt*i;
 }
 sum+=(k*(k+1))/2;
 cout<<sum;
}
int main()
{
//int t;cin>>t;while(t--)
  solve();
  return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:24:17: error: expected ';' before 'sum'
   24 |     cnt+=3*y+3*y
      |                 ^
      |                 ;
   25 |     sum+=cnt*i;
      |     ~~~
Language: C

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

R,G,B = 0,0,0

for i in range(0,N):
    char = S[i]
    if char == "R":
        R += 1
    elif char == "G":
        G += 1
    elif char == "B":
        B += 1

count = R * G * B

N2 = int(N/2 + 0.5)
for i in range(0,N):
    stri = S[i]
    for j in range(0, N2):
        j2 = 2 * j
        if i+j2 >= N:
            break
        strj = S[i+j]
        strk = S[i+j2]
        if stri != strj and strj != strk and stri != strk:
            count -= 1
print(count)

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;

const int MOD = 1000000007;
const int INF = 1000000000;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

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; }


int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll ans = 0;
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') cnt1++;
        if(s[i]=='G') cnt2++;
        if(s[i]=='B') cnt3++;
    }

ans = cnt1 * cnt2 * cnt3;

for(int i = 1; i <= n; i++){
  for(int j = 0; j< n; j++){
    if(j - i < 0 || j + i >= N) continue;
    if(s[j] != s[j - i] && s[j] != s[j + i] && s[j + i] != s[j - i]) ans--;
  }
}
  cout << ans << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:30: error: 'N' was not declared in this scope
   60 |     if(j - i < 0 || j + i >= N) continue;
      |                              ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <iterator>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	string S;
	cin >> N;
	cin >> S;
	int sum = 0;
	int c_r = 0;
	int c_g = 0;
	int c_b = 0;

	for(int i=0;i<N;i++){
		if(S.at(i)=='R') {
			c_r++;
		}else if(S.at(i)=='G'){
			c_g++;
		}else{
			c_b++;
		}
	}
	
	sum = c_r*c_g*c_b;
	
	int res = 0;
	for(int i=0;i<N;i++){
		for(int d=1;d<N/2+1;d++){
			if(i+2*d>=N){
				break;
			}
			if(S.at(i)!=S.at(i+d) && S.at(i+d)!=S.at(i+2*d) && S.at(i)!=S.at(i+2*d)){
				res++;
				//cout << i << " " << i+d << " " << i+2*d<<endl;
				//cout << S.at(i)<< " " << S.at(i+d) << " " << S.at(i+2*d)<<endl;
			}
		}		
	}

	cout << sum - res << endl;
	
}
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <iterator>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	string S;
	cin >> N;
	cin >> S;
	int sum = 0;
	int c_r = 0;
	int c_g = 0;
	int c_b = 0;

	for(int i=0;i<N;i++){
		if(S.at(i)=='R') {
			c_r++;
		}else if(S.at(i)=='G'){
			c_g++;
		}else{
			c_b++;
		}
	}
	
	sum = c_r*c_g*c_b;
	
	int res = 0;
	for(int i=0;i<N;i++){
		for(int d=1;d<N/2+1;d++){
			if(i+2*d>=N){
				break;
			}
			if(S.at(i)!=S.at(i+d) && S.at(i+d)!=S.at(i+2*d) && S.at(i)!=S.at(i+2*d)){
				res++;
				//cout << i << " " << i+d << " " << i+2*d<<endl;
				//cout << S.at(i)<< " " << S.at(i+d) << " " << S.at(i+2*d)<<endl;
			}
		}		
	}

	cout << sum - res << endl;
	
}


Compiler output:
a.cc:70:5: error: redefinition of 'long long int MOD'
   70 | int MOD = 1000000007;
      |     ^~~
a.cc:14:5: note: 'long long int MOD' previously defined here
   14 | int MOD = 1000000007;
      |     ^~~
a.cc:71:8: error: redefinition of 'int main()'
   71 | signed main()
      |        ^~~~
a.cc:15:8: note: 'int main()' previously defined here
   15 | signed main()
      |        ^~~~
Language: Java

import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {
	private static long slove(String p,long all){
        char m[]=p.toCharArray();
        for(int k=1;k<=p.length()/2;k++){
            for(int i=0;i<m.length;i++){
                if(i+2*k>=p.length())
                    break;
                else{
                    if(m[i]!=m[i+k]&&m[i+2*k]!=m[i+k]&&m[i]!=m[i+2*k]) {
                        all--;
                    }
                }
            }
        }
        return all;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int a=sc.nextInt();
        String p=sc.next();
        int countR=0;
        int countG=0;
        int countB=0;
        char m[]=p.toCharArray();
        for(int i=0;i<m.length;i++){
            if(m[i]=='R')
                countR++;
            if(m[i]=='G')
                countG++;
            if(m[i]=='B')
                countB++;
        }
        long all=countB*countG;
        all*=countR;
        System.out.println(D.slove(p,all));
    }
}



Compiler output:
Main.java:38: error: cannot find symbol
        System.out.println(D.slove(p,all));
                           ^
  symbol:   variable D
  location: class Main
1 error
Language: C

#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int color(char c){
	if(c == 'R') return 0;
	else if(c == 'G') return 1;
	else return 2;
}

vector<bool> flg(3,true);
int flg_check(){
	if(flg[0]) return 0;
	else if(flg[1]) return 1;
	else return 2;
}

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	// ここに処理を記述

	int N;
	cin >> N;

	ddvi C(3,vi(0));
	string S;
	cin >> S;
	REP(i,N){
		if(S[i] == 'R'){
			C[0].eb(i);
		}
		else if(S[i] == 'G'){
			C[1].eb(i);
		}
		else{
			C[2].eb(i);
		}
	}

	if(C[0].size() == 0 || C[1].size() == 0 || C[2].size() == 0){
		cout << "0" << "\n";
	}

	// すべての文字が異なり('R', 'G', 'B'が揃う)
	// その配置が等間隔でない
	ll ans = 0;

	// くそ雑魚回答
	/*
	REP(i,N-1){
		flg[color(S[i])] = false;
		FOR(j,i+2,N){
			flg[color(S[j])] = false;
			if(S[i] == S[j]) continue;
			// 残った色の配列についてにぶたんで上界下界を探索
			auto left = upper_bound(C[flg_check()].begin(), C[flg_check()].end(), i);
			int left_pos = distance(C[flg_check()].begin(), left);
			auto right = upper_bound(C[flg_check()].begin(), C[flg_check()].end(), j);
			int right_pos = distance(C[flg_check()].begin(), right);
			if(right_pos == 0) continue;

			// cout << "[" << i << "," << j << "]" << "\n";
			// cout << left_pos << "," << right_pos << "\n";
			if((i+j)%2 == 0 && S[(i+j)/2] != S[i] && S[(i+j)/2] != S[j]){
				// cout << "ouch!\n";
				ans -= 1;
			}

			ans += right_pos - left_pos;
			flg[color(S[j])] = true;
		}
		flg[color(S[i])] = true;
	}
	*/

	REP(i,C[0].size()){
		REP(j,C[1].size()){
			int big = max(C[0][i],C[1][j]);
			int small = min(C[0][i],C[1][j]);
			ans += C[2].size();

			// B---small---bigの場合
			if(small - (big - small) >= 0){
				if( binary_search(C[2].begin(), C[2].end(), small - (big - small)) ){
					ans -= 1;
				}
			}
			// small---B---bigの場合
			if((small + big) % 2 == 0){
				int mid = (small + big) / 2;
				if( binary_search(C[2].begin(), C[2].end(), mid) ){
					ans -= 1;
				}
			}
			// small---big---Bの場合
			if(big + (big - small) < N){
				if( binary_search(C[2].begin(), C[2].end(), big + (big - small)) ){
					ans -= 1;
				}
			}
		}
	}

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

clude <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;
 
int main()
{
  int N;
  string S;
  ll res = 0;
  cin >> N >> S;
 
  ll r=0, g=0, b=0;
  rep(i,N) {
    if(S[i]=='R') r++;
    if(S[i]=='G') g++;
    if(S[i]=='B') b++;
  }
  res = r * g * b;
 
  for(int i=0; i<N; i++) {
    for(int j=1; i+j*2<N; j++) {
      int pos1 = i;
      int pos2 = i + j;
      int pos3 = pos2 + j;
      if(S[pos1] != S[pos2] && S[pos2] != S[pos3] && S[pos3] != S[pos1]){
        res--;
      }
    }
  }
 
  cout << res << endl;
}

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude <bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:11:3: error: 'string' was not declared in this scope
   11 |   string S;
      |   ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | clude <bits/stdc++.h>
a.cc:13:3: error: 'cin' was not declared in this scope
   13 |   cin >> N >> S;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | clude <bits/stdc++.h>
a.cc:13:15: error: 'S' was not declared in this scope
   13 |   cin >> N >> S;
      |               ^
a.cc:34:3: error: 'cout' was not declared in this scope
   34 |   cout << res << endl;
      |   ^~~~
a.cc:34:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:34:18: error: 'endl' was not declared in this scope
   34 |   cout << res << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | clude <bits/stdc++.h>
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n;
 string s;
 cin>>n>>s;
 ll r=0,g=0,b=0;
 for(ll i=0;i<n;i++){
  if( s[i] == 'R' ){
   r++;
  }else if( s[i] == 'G' ){
   g++;
  }else{
   b++;
  }
 }
 ll ans = r*g*b;

 for(ll i=1;i<=n/2;i++){
  for(ll j=0;j<n;j++){
   if( 2*i+j<n ){
    if( s[j] == s[i+j] || s[j] == s[j+2*i] || s[i+j] == s[j+i*2] ){

    }else{
     ans--;
    }
   }else{
    break;
   }
  }
 }
 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;
 
int main() 
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	
	int r[4000] ={};
	int g[4000] ={};
	int b[4000] ={};
	int nr = 0;
	int ng = 0;
	int nb = 0;
	
	for(int i = 0; i < N; i++){
		char c = s[i];
		if(c == 'R') r[nr++] = i;
		if(c == 'G') g[ng++] = i;
		if(c == 'B') b[nb++] = i;
	}
	
	v = nr * ng * nb;
	unsigned int v = 0;
	for(int i = 0; i < nr; i++){
		int v0 = r[i];
		for(int j = 0; j < ng; j++){
			int v1 = g[j];
			int vmax0 = max(v1, v0);
			int vmin0 = v1 + v0 - vmax0;
			for(int k = 0; k < nb; k++){
				int v2 = b[k];
				
				int v_max = max(v2, vmax0);
				int v_min = min(v2, vmin0);
				if(2 * (v0 + v1 + v2)  == 3 * v_max + 3 * v_min) v--;
			}
		}
	}
	cout << v;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'v' was not declared in this scope
   25 |         v = nr * ng * nb;
      |         ^
Language: C

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

int main() {
	int n = 0;
	string s;
	cin >> n >> s;
	int count = 0;
	for(int i=0; i<n; ++i){
		for(int j=i+1; j<n; ++j){
			for(int k=j+1; k<n; ++k){
				if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]){
					if((j-i) != (k-j)){
						count += 1;
					}
				}
			}
		}
	}
	cout << count << 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;
using ll=long long;

int n;
ll ans,r,g,b;
string s;

int main(){
  cin>>n>>s;
  for(char c:s){
    if(c=='R')r++;
    if(c=='G')g++;
    if(c=='B')b++;
  }
  ans=r*g*b;
  rep(i,n){
    for(int j=1;i+j+j<n;j++){
      if((s[i]^s[i+j]^s[i+j+j])==('R'^'G'^'B'))res--;
    }
  }

  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   rep(i,n){
      |       ^
a.cc:17:3: error: 'rep' was not declared in this scope
   17 |   rep(i,n){
      |   ^~~