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

/* Akshat Sharma @akshat98 */
#include <iostream>
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp   make_pair
#define pb   push_back
#define F    first
#define S    second
#define ll   long long
#define MOD  1000000007
#define MAX  1000000001
#define vi   vector<int>
#define vl   vector<ll>
#define vpi  vector<pair<int,int> >
#define vpl  vector<pair<ll,ll> >
#define rep(i,a,b) for(i=a;i<b;i++)
#define reqp(i,a,b) for(i=a;i<=b;i++)
#define ren for(i=0;i<n;i++)
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;


int main()
{

	int i,j,k,l,n,test_case,m,r;
	test_case=1;
	//cin>>test_case;
	while(test_case--){
		cin>>n;
		string str;
		cin>>str;
		int ans=0;
		rep(i,1,n-2){
			for(j,1,i+1){
				if(i+j>=n)continue;
				if(str[i-j]==str[j]|| str[i-j]==str[j+i]|| str[j]==str[i+j]){
					;
				}else{
					ans++;
				}
			}
		}
		cout<<ans<<"\n";


	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:36: error: expected ';' before ')' token
   37 |                         for(j,1,i+1){
      |                                    ^
      |                                    ;
a.cc:45:17: error: expected primary-expression before '}' token
   45 |                 }
      |                 ^
a.cc:44:26: error: expected ';' before '}' token
   44 |                         }
      |                          ^
      |                          ;
   45 |                 }
      |                 ~         
a.cc:45:17: error: expected primary-expression before '}' token
   45 |                 }
      |                 ^
a.cc:44:26: error: expected ')' before '}' token
   44 |                         }
      |                          ^
      |                          )
   45 |                 }
      |                 ~         
a.cc:37:28: note: to match this '('
   37 |                         for(j,1,i+1){
      |                            ^
a.cc:45:17: error: expected primary-expression before '}' token
   45 |                 }
      |                 ^
Language: C

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

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

  int n;
  cin>>n;

  string s;
  cin>>s;
  long long ans=0;

  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
            string temp;
            temp.push_back(s[i]);
            temp.push_back(s[j]);
            temp.push_back(s[k]);
            if(s[i]!= s[j] && s[i]!=s[k] && s[j]!=s[k]){
              if(j-i!=k-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

#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define ll long long int
#define ld long double
#define FOR(i,a,b) for (auto i = (a); i != (b); i = (a)<(b)? i+1 : i-1)
#define pb push_back
#define mod 1000000007
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll su[n+1][3]={0};
    if(s[0]=='R')
            ++su[0][0];
        else if(s[0]=='B')
        ++su[0][1];
        else
            ++su[0][2];
    for(int x=1;x<n;x++)
    {    su[x][0]=su[x-1][0];
         su[x][1]=su[x-1][1];
         su[x][2]=su[x-1][2];
        if(s[x]=='R')
            ++su[x][0];
        else if(s[x]=='B')
        ++su[x][1];
        else
            ++su[x][2];
    }
    ll ans=su[n-1][1]*su[n-1][0]*su[n-1][2];
    for(int x=1;x<=n/2;x++)
    {
        for(int y=0;y<n;y++)
        {
            if(y+x<n && y+2*x<n)
            {
                if(s[y]!=s[x+y] && s[y]!=s[2*x+y] && s[y+x]!=s[y+2*x])
                    --ans;
            }
        }
    }
    cout<<ans;
 
}

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, r=0, g=0, b=0;
  long long count = 0;
  string S;
  cin >> N >> S;
  
  for(int i=0; i<N; i++){
    if(S.at(i) == 'R')
      r++;
    else if(S.at(i) == 'G')
      g++;
    else
      b++;
  }
  
  count = r * b * g;
  
  
  for (int i=0;i<N-1; i++){
    for(int j=0; j<N; j++){
      int k = i+2*j;
      if(k<N){
        if(S.at(i) != S.at(i+j) && S.at(i+j) != S.at(k) && S.at(k) != S.at(i))
          count--;
      }
    }
  }
  
  cout <

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

#include <iostream>
using namespace std;

int main(){
  long long int ans = 0;
  int n;
  char color[4001];
  int r = 0, g = 0, b = 0;
  cin >> n;
  if(n < 3){
    cout << 0 << '\n';
    return 0;
  }
  for(int i=1; i<=n; i++){
    cin >> color[i];
    if(color[i] == 'R'){
      r += 1;
    }else if(color[i] == 'G'){
      g += 1;
    }else{
      b += 1;
    }
  }
  if(rgb == 0){
    cout << 0 << '\n';
    return 0;
  }
  for(int i=1; i<=n-2; i++){
    if(color[i] == 'R'){
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }else if(color[i] == 'G'){
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }else{
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }
  }
  cout << r*g*b - ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:6: error: 'rgb' was not declared in this scope
   24 |   if(rgb == 0){
      |      ^~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  long long int ans = 0;
  int n;
  char color[4001];
  int r = 0, g = 0, b = 0;
  cin >> n;
  for(int i=1; i<=n; i++){
    cin >> color[i];
    if(color[i] == 'R'){
      r += 1;
    }else if(color[i] == 'G'){
      g += 1;
    }else{
      b += 1;
    }
  }
  if(rgb == 0){
    cout << 0 << '\n';
    return 0;
  }
  for(int i=1; i<=n-2; i++){
    if(color[i] == 'R'){
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }else if(color[i] == 'G'){
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }else{
      for(int j=i+1; j<=n-1; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }else if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                //break;
              }
            }
          }
        }
      }
    }
  }
  cout << r*g*b - ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:6: error: 'rgb' was not declared in this scope
   20 |   if(rgb == 0){
      |      ^~~
Language: C

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

int main () {
  int n;
  string s;
  cin >> n >> s;
  long long ans = 0;
  int r = 0, g = 0, b = 0;
  
  for(char c : s) {
    if (c == 'R') r++;
    if (c == 'G') g++;
    if (c == 'B') b++;
  }
  ans = r * g * b;
  
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n ; ++j) {
      if (i - j < 0 || i + j >= n) continue;
      if (s[i] != s[i+j] && s[i] != s[i-j] && s[i+j] != s[i-j]) 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>
using namespace std;

int main(){
  long long int ans = 0;
  int n;
  char color[4001];
  int r = 0, g = 0, b = 0;
  cin >> n;
  for(int i=1; i<=n; i++){
    cin >> color[i];
    if(color == 'R'){
      r += 1;
    }else if(color == 'G'){
      g += 1;
    }else{
      b += 1;
    }
  }
  for(int i=1; i<=n; i++){
    if(color[i] == 'R'){
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }
      }
    }else if(color[i] == 'G'){
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }
      }
    }else{
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }else if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
                break;
              }
            }
          }
        }
      }
    }
  }
  cout << r*g*b - ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |     if(color == 'R'){
      |        ~~~~~~^~~~~~
a.cc:14:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     }else if(color == 'G'){
      |              ~~~~~~^~~~~~
Language: C

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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define int long long
#define ll unsigned long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define inf 1000000000000000000
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
	std::ios::sync_with_stdio(false); \
	cin.tie(NULL);                    \
	cout.tie(NULL);

const int Maxn = 100001;
const ld pi = acos(-1);
const int mod = 998244353;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A)
{
	for (auto x : A)
		out << x << " ";
	return out;
}

int32_t main(){IOS
	int Q=1;	//cin>>Q;
	while(Q--){
		int n;	cin>>n;
		string s;	cin>>s;
		vector<vector<int> >A(n, vector<int> (3, 0));
		if(s[n-1] == 'R')	A[n-1][0]++;
		else if(s[n-1] == 'B') A[n-1][1]++;
		else    A[n-1][2]++;
		rf(i,n-2,0){
			fr(k, 0, 3)
				A[i][k] += A[i + 1][k];
			if(s[i] == 'R')	A[i][0]++;
			else if(s[i] == 'B') A[i][1]++;
			else    A[i][2]++;
		}
		int ans = 0;
		fr(i,0,n-2)	fr(j,i+1,n-1)
		if(s[i] != s[j]){
			if(j+j-i < n and s[j+j-i]!=s[j] and s[j+j-i]!=s[i])	ans--;
			bool red=false, blue=false, green=false;
			if(s[i] == 'R' or s[j] == 'R')	red=true;
			if(s[i] == 'B' or s[j] == 'B')	blue=true;
			if(s[i] == 'G' or s[j] == 'G')	green=true;
			if(!red)	ans += A[j+1][0];
			else if(!blue)	ans += A[j+1][1];
			else ans += A[j+1][2];
		}
		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>
using namespace std;

int main(){
  long long int ans = 0;
  int n;
  char color[4001];
  int r = 0, g = 0, b = 0;
  cin >> n;
  for(int i=1; i<=n; i++){
    cin >> color[i];
    if(color == 'R'){
      r += 1;
    }else if(color == 'G'){
      g += 1;
    }else{
      b += 1;
    }
  }
  for(int i=1; i<=n; i++){
    if(color[i] == 'R'){
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }
      }
    }else if(color[i] == 'G'){
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'B'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }else if(color[j] == 'B'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }
      }
    }else{
      for(int j=i+1; j<=n; j++){
        if(color[j] == 'G'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'R'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }else if(color[j] == 'R'){
          for(int k=j+1; k<=n; k++){
            if(color[k] == 'G'){
              if(j - i == k - j){
                ans += 1;
              }
            }
          }
        }
      }
    }
  }
  cout << r*g*b - ans << '\n';
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |     if(color == 'R'){
      |        ~~~~~~^~~~~~
a.cc:14:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     }else if(color == 'G'){
      |              ~~~~~~^~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
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;
}

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define F first
//#define S second

typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1000000;
const int minf = -1000000;
const ll lnf = 1e12;
const ll mlnf = -1e12;
const double e = 1e-10;

void debug_vector(vector<int>& v)
{
    int n = v.size();
    for (int i = 0; i < n; i++) {
        cout << v[i] << " ";
    }
    cout << endl;
}


//////////////////////
//// coding start ////
//////////////////////

// global variet


long long cal(long long a, long long b);
long long second_condition(int locate);

void solve();

int N;
string S;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}

long long cal(long long a, long long b){
    return a * (a - 1) * b / 2;
}


long long second_condition(int locate){
    int limit = min(locate, N-1 - locate);
    long long res = 0;
    for (int i = 1; i <= limit; i++){
        set<char> tmp;
        tmp.insert(S[locate]);
        tmp.insert(S[locate + i]);
        tmp.insert(S[locate - i]);
        if (tmp.size() == 3) res++;
    }
    return res;
}

void solve(){
    cin >> N;
    cin >> S;
    long long ans = N * (N-1) * (N-2) / 6;
    long long r, g, b;
    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++;
        }
    }
    for (int i = 1; i < N - 1; i++){
        ans -= second_condition(i);
    }

    ans -= cal(r, g);
    ans -= cal(g, r);
    ans -= cal(g, b);
    ans -= cal(b, g);
    ans -= cal(r, b);
    ans -= cal(b, r);
    ans -= r * (r-1) * (r-2) / 6;
    ans -= g * (g-1) * (g-2) / 6;
    ans -= b * (b-1) * (b-2) / 6;
    printf("%lld\n", ans);
}



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

# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
# define int long long
  
using namespace std;
  
const int N = 1e3 + 7;
const int INF = 1e18;
const int mod = 1e9 + 7; 

int R[N], G[N], B[N], n;

string s;

int check( int k, char c ) {

	if ( k >= n ) {
		return 0;
	}
	return ( s[k] == c );
}
  
int32_t main() {
    speed;
	cin >> n;
	cin >> s;

	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]++;
		}
		if ( s[i] == 'G' ) {
			G[i]++;
		}
		if ( s[i] == 'B' ) {
			B[i]++;
		}
	}
	int ans = 0;

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

			
			if ( s[i] == s[j] ) {
				continue;
			}
			int d = j - i;
			int k = j + d;

			if ( j + 1 >= n ) {
				continue;
			}
			if ( s[i] == 'R' && s[j] == 'G' ) {
				ans += B[j + 1];

				ans -= check( k, 'B' );
			}
			if ( s[i] == 'R' && s[j] == 'B' ) {
				ans += G[j + 1];

				ans -=  check( k, 'G' );
			}
			if ( s[i] == 'G' && s[j] == 'R' ) {
				ans += B[j + 1];

				ans -= check( k, 'B' );
			}
			if ( s[i] == 'G' && s[j] == 'B' ) {
				ans += R[j + 1];

				ans -= check( k, 'R' );
			}
			if ( s[i] == 'B' && s[j] == 'R' ) {
				ans += G[j + 1];

				ans -= check( k, 'G' );
			}
			if ( s[i] == 'B' && s[j] == 'G' ) {
				ans += R[j + 1];

				ans -= check( k, 'R' );
			}
			// for ( int k = j + 1; k < n; k++ ) {

			// 	if ( j - i == k - j || s[i] == s[j] || s[i] == s[k] || s[j] == s[k] ) {
			// 		continue;
			// 	}
			// 	ans++;
			// }
		}
	}
	cout << ans;
}

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

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(v) (v).begin(), (v).end()
#define Sort(x) sort(ALL(x))
#define Sort_rev(x) Sort(x);reverse(ALL(x))

template<typename V,typename T>
T find_num(V v, T num) {
    if ( find(ALL(v), num) == v.end() ) {
        return false;
    } else {
        return true;
    }
}

// π M_PI
// deg = rad*180/M_PI

ll func(std::vector<ll> R, std::vector<ll> G, std::vector<ll> B ) {
    ll ans = 0;
    rep(i, R.size()) {
        rep(j, G.size()) {
            rep(k, B.size()) {
                ll I = min(R[i], min(G[j], B[k]));
                ll K = max(R[i], max(G[j], B[k]));
                ll J = R[i]+G[j]+B[k]-I-K;
                if ( 2*J != I+K ) {
                    ans++;
                }
            }
        }
    }
    return ans;
}

ll func2( std::vector<ll> R, std::vector<ll> G, std::vector<ll> B ) {
    ll ans = 0;
    rep(i, R.size()) {
        rep(j, G.size()) {
            ll num = abs(R[i]-G[j])+max(R[i], G[j]);
            if ( find_num(B, num) ) {
                // cout << "num " << num << endl;
                ans++;
            }
        }
    }
    return ans;
}

int main() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    std::vector<ll> R, G, B;
    rep(i, s.length()) {
        if ( s[i] == 'R' ) {
            R.push_back(i+1);
            // cout << "r " << i+1 << endl;
        } else if ( s[i] == 'G' ) {
            G.push_back(i+1);
            // cout << "g " << i+1 << endl;
        } else {
            B.push_back(i+1);
            // cout << "b " << i+1 << endl;
        }
    }
    ll ans = 0;

    ans += R.size()*G.size()*B.size();
    ans -= func2(R, G, B);
    ans -= func2(R, B, G);
    ans -= func2(G, B, R);

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


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

#include<iostream>
using namespace std;

int main(){
    int n,ans=0;
    string s;
    scanf("%d",&n)
    cin >> s;
    /*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(s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j){
                    ans++;
                }
            }
        }
    }*/
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            if(s[i]==s[j]) continue;
            for(int k=0;k<j;k++){
                if(j-k!=i-j && s[k]!=s[i] && s[k]!=s[j]){
                    ans++;
                }
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: expected ';' before 'cin'
    7 |     scanf("%d",&n)
      |                   ^
      |                   ;
    8 |     cin >> s;
      |     ~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:24:3: error: expected ',' or ';' before 'cout'
   24 |   cout<<ans<<endl;
      |   ^~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main() {
    int n;
	string s;
	cin >> n >> s;
 
	long long r, g, b;
	r = count(s.begin(),s.end(),'R');
	g = count(s.begin(),s.end(),'G');
	b = count(s.begin(),s.end(),'B');
 
	long long ans = r * g * b;
	for(int i = 0; i < n - 2; i++){
		for(int j = i + 1; j < n - 1; j++){
			int k =2 * j - i;
			if(k >= n){
                break;
            }
			if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]){
                ans--;
            }
		}
	}
 
	cout << ans << endl;
}


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

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

int main () {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  int cntR = 0, cntG = 0, cntB = 0;
  
  for(int i=0; i < n; ++i) {
    if (s[i] == 'R') cntR++;
    if (s[i] == 'G') cntG++;
    if (s[i] == 'B') cntB++;
  }
  ans = cntR * cntG *cntB;
  
  for (int i = 0; i < n - 2; ++i) {
    for (int j = i+1; 2*j - i < n ; ++j) {
      if (s[i] != s[j] and s[j] != s[2*j-1] and s[2j-1] != s[i]) ans--;
    }
  }
  cout << ans;
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:20:50: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__complex__ int')
   20 |       if (s[i] != s[j] and s[j] != s[2*j-1] and s[2j-1] != s[i]) ans--;
      |                                                  ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
 1247 |       operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note:   no known conversion for argument 1 from '__complex__ int' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 1247 |       operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
      |                   ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
 1265 |       operator[](size_type __pos)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note:   no known conversion for argument 1 from '__complex__ int' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 1265 |       operator[](size_type __pos)
      |                  ~~~~~~~~~~^~~~~
Language: C++

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

int main () {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  int cntR = 0, cntG = 0, cntB = 0;
  
  for(int i=0; i < n; ++i) {
    if (s[i] == 'R') cntR++;
    if (s[i] == 'G') cntG++;
    if (s[i] == 'B') cntB++;
  }
  ans = cntR * cntG *cntB;
  
  for (int i = 0; i < n - 2; ++i) {
    for (int j = i+1; 2*j - i < n ; ++j) {
      if (s[j-d] != s[j] and s[j] != s[j+d] and s[j-d] != s[j+d]) ans--;
    }
  }
  cout << ans;
}
      


Compiler output:
a.cc: In function 'int main()':
a.cc:20:15: error: 'd' was not declared in this scope
   20 |       if (s[j-d] != s[j] and s[j] != s[j+d] and s[j-d] != s[j+d]) ans--;
      |               ^
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,count=0,r=0,b=0,g=0;
  cin>>N;
  vector<char> S(N);
  rep(i,N){cin>>S[i];}
  for(int i=1;i<=N;i++){
    for(int n=1;j<N;j++){
      
        int j=n+i,k=2*n+i;
          if((j-i)==(k-j)){
            if(!(S[i-1]==S[j-1])&&!(S[i-1]==S[k-1])&&!(S[j-1]==S[k-1])){
            count++;
            }
          
      }
    }
  }
  rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++;} else {g++;}}
 
  cout<<r*b*g-count<<endl;
}

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

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

int main() {
  int N;
  cin>>N;
  vector<char> S(N);
  for(int i=0; i<N; i++){
    cin>>S.at(i);
  }
  int64_t r;
  int64_t g;
  int64_t b;
  int64_t m;
  for(int i=0; i<N; i++){
    if(S.at(i)=='R'){
      r++;
    }
    else if(S.at(i)=='G'){
      g++;
    }
    else{
      b++
    }
  }
  m=r*g*b;
  int64_t count;
  for(int i=0; i<N; i++){
    for(int j=1; j<N-i; j++;){
      if(i;2*j>N){
        continue;
      }
      if(S.at(i)!=S.at(i+j) && S.at(i+j)!=S.at(i+2*j) && S.at(i+2*j)!=S.at(i)){
        count++;
      }
    }
  }
  cout<<m-count<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: expected ';' before '}' token
   23 |       b++
      |          ^
      |          ;
   24 |     }
      |     ~     
a.cc:29:28: error: expected ')' before ';' token
   29 |     for(int j=1; j<N-i; j++;){
      |        ~                   ^
      |                            )
a.cc:29:29: error: expected primary-expression before ')' token
   29 |     for(int j=1; j<N-i; j++;){
      |                             ^
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,count=0,r=0,b=0,g=0;
  cin>>N;
  vector<char> S(N);
  rep(i,N){cin>>S[i];}
  for(int i=1;i<=N;i++){
    for(int j=i+1;j<=N;j++){
      for(int k=j+1;k<=N;k++){
        
          if((j-i)==(k-j)){
            if(!(S[i-1]==S[j-1])&&!(S[i-1]==S[k-1])&&!(S[j-1]==S[k-1])){
            count++;
            }
          }
      }
    }
  }
  rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++;}; else {g++;}}
 
  cout<<r*b*g-count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:58: error: 'else' without a previous 'if'
   24 |   rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++;}; else {g++;}}
      |                                                          ^~~~
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,count=0,r=0,b=0,g=0;
  cin>>N;
  vector<char> S(N);
  rep(i,N){cin>>S[i];}
  for(int i=1;i<=N;i++){
    for(int j=i+1;j<=N;j++){
      for(int k=j+1;k<=N;k++){
        
          if((j-i)==(k-j)){
            if(!(S[i-1]==S[j-1])&&!(S[i-1]==S[k-1])&&!(S[j-1]==S[k-1])){
            count++;
            }
          }
      }
    }
  }
  rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++;}; else{g++;}}
 
  cout<<r*b*g-count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:58: error: 'else' without a previous 'if'
   24 |   rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++;}; else{g++;}}
      |                                                          ^~~~
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,count=0,r=0,b=0,g=0;
  cin>>N;
  vector<char> S(N);
  rep(i,N){cin>>S[i];}
  for(int i=1;i<=N;i++){
    for(int j=i+1;j<=N;j++){
      for(int k=j+1;k<=N;k++){
        
          if((j-i)==(k-j)){
            if(!(S[i-1]==S[j-1])&&!(S[i-1]==S[k-1])&&!(S[j-1]==S[k-1])){
            count++;
            }
          }
      }
    }
  }
  rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++}; else{g++}}
 
  cout<<r*b*g-count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:54: error: expected ';' before '}' token
   24 |   rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++}; else{g++}}
      |                                                      ^
      |                                                      ;
a.cc:24:57: error: 'else' without a previous 'if'
   24 |   rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++}; else{g++}}
      |                                                         ^~~~
a.cc:24:65: error: expected ';' before '}' token
   24 |   rep(i,N){if(S[i]=='R'){r++;} else if(S[i]=='B'){b++}; else{g++}}
      |                                                                 ^
      |                                                                 ;
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
void decimal(int x){cout<<fixed<<setprecision(x);}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
  ll n;
  string s;
  cin>>n>>s;
  ll r=0,g=0,b=0;
  rep(i,n){
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  ll p=r*g*b;
  REP(j,1,(n-1)/2+1){
    rep(i,n-j*2){
      bool f=true;
      if(s[i]==s[i+2*j]) f=false;
      if(s[i]==s[i+j]) f=false;
      if(s[i+j]==s[i+j*2]) f=false;
      if(f) p--;
      //cout<<i<<j<<endl;
      //cout<<i<<i+j<<i+2*j<<endl;
    }
  }
  if(p<0) out(0);
  else out(p);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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<algorithm>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;

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

 cin>>n>>s;

 rep(i,n){
     if(s.at(i)=='R')r++;
     if(s.at(i)=='G')g++;
     if(s.at(i)=='B')b++;
 }

  long long int sum=r*g*b;

for(int j=1;2*j<=n;j++){
    for(int i=0;i<n-2*j;i++){
        if(s.at(i)!=s.at(i+j)&&s.at(i+j)!=s.at(i+2*j)&&s.at(i+2*j)!=s.at(i)){sum--;}
    }
}

cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'string' was not declared in this scope
    7 |  string s;
      |  ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include<algorithm>
  +++ |+#include <string>
    2 | #define rep(i,n) for (int i=0;i<(n);++i)
a.cc:9:2: error: 'cin' was not declared in this scope
    9 |  cin>>n>>s;
      |  ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | #define rep(i,n) for (int i=0;i<(n);++i)
a.cc:9:10: error: 's' was not declared in this scope
    9 |  cin>>n>>s;
      |          ^
a.cc:25:1: error: 'cout' was not declared in this scope
   25 | cout<<sum<<endl;
      | ^~~~
a.cc:25:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:12: error: 'endl' was not declared in this scope
   25 | cout<<sum<<endl;
      |            ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 | #define rep(i,n) for (int i=0;i<(n);++i)
Language: C

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

int main(){
    int N; cin>>N;
    string S; cin>>S;
    int nR=0,nG=0,nB=0;
    for(int i=0;i<N;i++){
        if(S[i]=='R')nR++;
        else if(S[i]=='G')nG++;
        else nB++;
    }

    int ans=nR*nG*nB;
    for(int i=0;i<N;i++){
        for(int j=i+2;j<N;j+=2){
            int k=(i+j)/2;
            if(S[i]!=S[j]&&S[i]!=S[k]&&S[j]!=S[k])ans--;
        }
    }
    cout<<ans;
    return 0;
}

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

#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

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++;
		else if(s[i]=='G') g++;
		else b++;
	}
	ll ans = r*g*b;
	rep(i,n-2){
		REP(j,i+1,n-1){
			if(2*j-i >= n) break;
			if(s[i]!=s[j] && s[j]!=s[2*j-i] && s[i]!=s[2*j-i]) ans--;
		}
	}
	cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
void decimal(int x){cout<<fixed<<setprecision(x);}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve() {
  int n;
  string s;
  cin>>n>>s;
  int r=0,g=0,b=0;
  rep(i,n){
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  ll p=r*g*b;
  REP(j,1,(n-1)/2+1){
    rep(i,n-j*2){
      bool f=true;
      if(s[i]==s[i+2*j]) f=false;
      if(s[i]==s[i+j]) f=false;
      if(s[i+j]==s[i+j*2]) f=false;
      if(!f) p--;
      //cout<<i<<j<<endl;
      //cout<<i<<i+j<<i+2*j<<endl;
    }
  }
  if(p<0) out(0);
  else out(p);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
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++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    LL ans=r*g*b;
    set<char>st;
    for(LL j=0;j<n;j++)
    {
        for(LL i=j;i<n-j;i++)
        {
            st.clear();
            st.insert(s[i-j]);
            st.insert(s[i]);
            st.insert(s[i+j]);
            if(st.size()==3)
                ans--;

        }

    }
    cout<<ans;

}


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

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

	cin >> n >> s;
	int r=0;
	int g=0;
	int b=0;
	long long cnt;
	rep(i,n){
		if (s[i]=='R') r++;
		if (s[i]=='G') g++;
		if (s[i]=='B') b++;
	}
	cnt=r*g*b;
	if (cnt==0){
		cout <<cnt<<endl;
		return 0;
	}
	for(int i=1;i<=n/2;i++){
		for(int j=0;j<n-2;j++){
			if (j+2*i<n){
				if(s[j]!=s[j+i]&&s[j]!=s[j+i*2]&&s[j+i]!=s[j+i*2]){
					cnt--;
				}
			}
		}
	}
	cout <<cnt<<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++

for(int i = 0; i < n; i++){
        if(s[i]=='R'){
            a++;
        }else if(s[i]=='G'){
            b++;
        }else{
            c++;
        }
    }
    // ひとつめの条件をみたす
    int res = a*b*c;
 
    // ひとつめ満たすけど、ふたつめの条件をみたさないものは引く
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int k=j+j-i;
            if(k>=n) continue;
            if(s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i]){
                res--;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for(int i = 0; i < n; i++){
      | ^~~
a.cc:1:16: error: 'i' does not name a type
    1 | for(int i = 0; i < n; i++){
      |                ^
a.cc:1:23: error: 'i' does not name a type
    1 | for(int i = 0; i < n; i++){
      |                       ^
a.cc:11:15: error: 'a' was not declared in this scope
   11 |     int res = a*b*c;
      |               ^
a.cc:11:17: error: 'b' was not declared in this scope
   11 |     int res = a*b*c;
      |                 ^
a.cc:11:19: error: 'c' was not declared in this scope
   11 |     int res = a*b*c;
      |                   ^
a.cc:14:5: error: expected unqualified-id before 'for'
   14 |     for(int i = 0; i < n; i++){
      |     ^~~
a.cc:14:20: error: 'i' does not name a type
   14 |     for(int i = 0; i < n; i++){
      |                    ^
a.cc:14:27: error: 'i' does not name a type
   14 |     for(int i = 0; i < n; i++){
      |                           ^
a.cc:23:5: error: 'cout' does not name a type
   23 |     cout << res << endl;
      |     ^~~~
a.cc:24:5: error: expected unqualified-id before 'return'
   24 |     return 0;
      |     ^~~~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;
 
 
 
int main()
{
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    
    vector<int> r;
    vector<int> g;
    vector<int> b;
 
    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 if(S[i]=='B'){
            b.push_back(i+1);
        }
    }
 
    ans = r.size() * g.size() * b.size();
 
    for (int j=0;j<N;j++){
        for(int l=1;l<=N/2;l++){
            int i=j-l;
            int k=j+l;

            if(k>=N || i<0){
                continue;
            }
            if(S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]){
                // cout << i << " " << j << " " << k << endl;
                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.