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

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

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<int> a(n);
    rep(i,n){
        if(s[i]=='R') a[i] = 0;
        if(s[i]=='G') a[i] = 1;
        if(s[i]=='B') a[i] = 2;
    }
    vector<ll> cnt(3);
    rep(i,n) cnt[a[i]]++;
    ll ans = 1;
    rep(i,3) ans *= cnt[i];
    rep(j,n)rep(i,j){
        int k = j+(j-i);
        if(k<n){
            if(a[i]==a[j]) continue;
            if(a[i]==a[k]) continue;
            if(a[k]==a[j]) continue;
            ans --;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: 'll' was not declared in this scope
   15 |     vector<ll> cnt(3);
      |            ^~
a.cc:15:14: error: template argument 1 is invalid
   15 |     vector<ll> cnt(3);
      |              ^
a.cc:15:14: error: template argument 2 is invalid
a.cc:16:17: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   16 |     rep(i,n) cnt[a[i]]++;
      |                 ^
a.cc:17:7: error: expected ';' before 'ans'
   17 |     ll ans = 1;
      |       ^~~~
      |       ;
a.cc:18:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |     rep(i,3) ans *= cnt[i];
      |              ^~~
      |              abs
a.cc:18:24: error: invalid types 'int[int]' for array subscript
   18 |     rep(i,3) ans *= cnt[i];
      |                        ^
a.cc:25:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |             ans --;
      |             ^~~
      |             abs
a.cc:28:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

void Main()
{
	int n;
	string s;
	int r, b, g;
	int i, j, k, ans;

	cin >> n >> s;

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

	ans = r * b * g;
	for (i = 0;i < n;++i)
	{
		for (j = (i + 1);j < n;++j)
		{
			k = 2 * j - i;
			if ((k < n) && (k > j))
			{
				if ((s[i] != s[j]) && (s[j] != s[k]) && (s[k] != s[i]))
				{
					--ans;
				}
			}
		}
	}

	cout << ans << endl;
}


int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Compiler output:
a.cc: In function 'void Main()':
a.cc:4:9: error: 'string' was not declared in this scope
    4 |         string s;
      |         ^~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
    8 |         cin >> n >> s;
      |         ^~~
a.cc:8:21: error: 's' was not declared in this scope
    8 |         cin >> n >> s;
      |                     ^
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout << ans << endl;
      |         ^~~~
a.cc:34:24: error: 'endl' was not declared in this scope
   34 |         cout << ans << endl;
      |                        ^~~~
a.cc: In function 'int main()':
a.cc:40:14: error: 'cin' is not a member of 'std'
   40 |         std::cin.tie(nullptr);
      |              ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | void Main()
a.cc:41:14: error: 'std::ios_base' has not been declared
   41 |         std::ios_base::sync_with_stdio(false);
      |              ^~~~~~~~
a.cc:42:14: error: 'cout' is not a member of 'std'
   42 |         std::cout << std::fixed << std::setprecision(15);
      |              ^~~~
a.cc:42:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:42:27: error: 'fixed' is not a member of 'std'
   42 |         std::cout << std::fixed << std::setprecision(15);
      |                           ^~~~~
a.cc:1:1: note: 'std::fixed' is defined in header '<ios>'; this is probably fixable by adding '#include <ios>'
  +++ |+#include <ios>
    1 | void Main()
a.cc:42:41: error: 'setprecision' is not a member of 'std'
   42 |         std::cout << std::fixed << std::setprecision(15);
      |                                         ^~~~~~~~~~~~
a.cc:1:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
  +++ |+#include <iomanip>
    1 | void Main()
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int r=0,b=0,g=0;
  rep(i,n){
    if(s[i]=='R')
      r++;
    if(s[i]=='G')
      g++;
    if(s[i]=='B')
      b++;
  }
  ll ans=r*g*b;
  rep(i,j)rep(j,n){
      int k=2*j-i;
      if(k<n){
        if(s[i]==s[j]) continue;
        if(s[i]==s[k]) continue;
        if(s[j]==s[k]) continue;
        ans--;
      }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'j' was not declared in this scope
   33 |   rep(i,j)rep(j,n){
      |         ^
a.cc:3:38: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int r=0,b=0,g=0;
  rep(i,n){
    if(s[i]=='R')
      r++;
    if(s[i]=='G')
      g++;
    if(s[i]=='B')
      b++;
  }
  ll ans=r*g*b;
  rep(i,j){
    rep(j,n){
      int k=2*j-i;
      if(k<n){
        if(s[i]==s[j]) continue;
        if(s[i]==s[k]) continue;
        if(s[j]==s[k]) continue;
        ans--;
      }
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'j' was not declared in this scope
   33 |   rep(i,j){
      |         ^
a.cc:3:38: note: in definition of macro 'rep'
    3 | #define rep(i,n) for(int i=0;i<(int)(n);i++)
      |                                      ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  string S; cin >> S;
  
  unordered_map<int,int> R, G, B;
  rep(i, N) {
    if(S[i] == 'R') R[i]++;
    else if(S[i] == 'G') G[i]++;
    else if(S[i] == 'B') B[i]++;
  }

  int ans = R.size()*G.size()*B.size();
  
  for(auto r : R) for(auto g : G) {
    int a = r.first, b = g.first;
    if(a < b) swap(a, b);
      if(B[a+(a-b)] > 0) ans--;
      if(B[b-(a-b)] > 0) ans--;
      if((a-b)%2 == 0 && B[(a+b)/2] > 0) 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;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll ans;
  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++;
  }
  ans=r*g*b;
  rep(i,n-1){
    for(int j=i+1;j<n;j++){
      int k=2j-i;
       if(s[i]==s[j] ||s[j]==s[k]||s[i]==s[k]||k>=n)
         ans--;
    }
  }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:15: error: cannot convert '__complex__ int' to 'int' in initialization
   36 |       int k=2j-i;
      |             ~~^~
      |               |
      |               __complex__ int
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll ans;
  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++;
  }
  ans=r*g*b;
  rep(i,n-1){
    for(int j=i+1;j<n;j++){
       if(s[i]==s[j] ||s[j]==s[k]||s[i]==s[k]||k>=n)
         ans--;
    }
  }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:32: error: 'k' was not declared in this scope
   36 |        if(s[i]==s[j] ||s[j]==s[k]||s[i]==s[k]||k>=n)
      |                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll ans;
  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++;
  }
  ans=r*g*b;
  rep(i,n-1)
     for(int j=i+1;j<n;j++){
       if(s[i]==s[j] ||s[j]==s[k]||s[i]==s[k]||k>=n)
         ans--;
     }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:32: error: 'k' was not declared in this scope
   36 |        if(s[i]==s[j] ||s[j]==s[k]||s[i]==s[k]||k>=n)
      |                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll ans=n*(n-1)*(n-2)/6;
  rep(i,n-1){
    for(j=i+1;j<n;j++){
      int k;
      if(k==2j-i||s[i]==s[j]||s[i]==s[k]||s[j]==s[k]){
        ans--;
      }
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'j' was not declared in this scope
   25 |     for(j=i+1;j<n;j++){
      |         ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:18:17: note: to match this '{'
   18 | int main()      {
      |                 ^
Language: C++

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

int main() {
     int N; string S;
    cin >> N >> S;
    long  long r = 0 ,g = 0 ,b = 0 ;
     for ( auto c :S) {
         if (c == 'R' )++r;
         else  if (c == 'G' )++g;
         else ++b;
    }
    long  long all = r * g * b;
     long  long sub = 0 ;
     for ( int i = 0 ;i <N;++i) {
         for ( int j = i+ 1 ;j <N;++j) {
             if (S[i] == S[j]) continue ;
             int k = j* 2 -i;
             if (k >= N || S[k] == S[i] || S[k] == S [j]) continue ;
            ++sub;
        }
    }
    cout << all-sub << endl;
  return 0;
}
 ```

Compiler output:
a.cc:26:2: error: stray '`' in program
   26 |  ```
      |  ^
a.cc:26:3: error: stray '`' in program
   26 |  ```
      |   ^
a.cc:26:4: error: stray '`' in program
   26 |  ```
      |    ^
Language: C++

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

int main() {
     int N; string S;
    cin >> N >> S;
    long  long r = 0 ,g = 0 ,b = 0 ;
     for ( auto c :S) ​​(
         if (c == 'R' )++r;
         else  if (c == 'G' )++g;
         else ++b;
    }
    long  long all = r * g * b;
     long  long sub = 0 ;
     for ( int i = 0 ;i <N;++i) {
         for ( int j = i+ 1 ;j <N;++j) (
             if (S[i] == S[j]) continue ;
             int k = j* 2 -i;
             if (k >= N || S[k] == S[i] || S[k] == S [j]) continue ;
            ++sub;
        }
    }
    cout << all-sub << endl;
}
 ```

Compiler output:
a.cc:25:2: error: stray '`' in program
   25 |  ```
      |  ^
a.cc:25:3: error: stray '`' in program
   25 |  ```
      |   ^
a.cc:25:4: error: stray '`' in program
   25 |  ```
      |    ^
a.cc: In function 'int main()':
a.cc:9:10: error: expected primary-expression before 'if'
    9 |          if (c == 'R' )++r;
      |          ^~
a.cc:10:10: error: 'else' without a previous 'if'
   10 |          else  if (c == 'G' )++g;
      |          ^~~~
a.cc:10:20: error: 'c' was not declared in this scope
   10 |          else  if (c == 'G' )++g;
      |                    ^
a.cc: At global scope:
a.cc:13:22: error: 'r' was not declared in this scope
   13 |     long  long all = r * g * b;
      |                      ^
a.cc:13:26: error: 'g' was not declared in this scope
   13 |     long  long all = r * g * b;
      |                          ^
a.cc:13:30: error: 'b' was not declared in this scope
   13 |     long  long all = r * g * b;
      |                              ^
a.cc:15:6: error: expected unqualified-id before 'for'
   15 |      for ( int i = 0 ;i <N;++i) {
      |      ^~~
a.cc:15:23: error: 'i' does not name a type
   15 |      for ( int i = 0 ;i <N;++i) {
      |                       ^
a.cc:15:28: error: expected unqualified-id before '++' token
   15 |      for ( int i = 0 ;i <N;++i) {
      |                            ^~
a.cc:22:5: error: expected declaration before '}' token
   22 |     }
      |     ^
a.cc:23:5: error: 'cout' does not name a type
   23 |     cout << all-sub << endl;
      |     ^~~~
a.cc:24:1: error: expected declaration before '}' token
   24 | }
      | ^
Language: C

#include<stdio.h>
int main(void)
{
  int N,num=0,i,j,k;
  scanf("%d",&N);
  char S[N];
  scanf("%s",&S);
  for(i=1;i<=N;i++){
    for(j=i+1;j<=N;j++){
      for(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])
          num++;
      }
    }
  }
  printf("%d",num);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include<stdio.h>
int main(void)
{
  int N,num=0,i,j,k;
  scanf("%d",&N);
  char S[N];
  scanf("%s",&S);
  for(i=1;i<=N;i++){
    for(j=i+1;j<=N;j++){
      for(k=j+1;k<=N;k++){
        if((j-i)!=(k-j)&&(S[i-1]!=S[j-1]&&S[i-1]!=S[k-1]&&S[j-1]!=S[k-1]))
          num++;
        }
      }
    }
  }
  printf("%d",num);
  return 0;
}


Compiler output:
main.c:17:10: error: expected declaration specifiers or '...' before string constant
   17 |   printf("%d",num);
      |          ^~~~
main.c:17:15: error: unknown type name 'num'; did you mean 'enum'?
   17 |   printf("%d",num);
      |               ^~~
      |               enum
main.c:18:3: error: expected identifier or '(' before 'return'
   18 |   return 0;
      |   ^~~~~~
main.c:19:1: error: expected identifier or '(' before '}' token
   19 | }
      | ^
Language: C

#include <stdio.h>
int main(void)
{
	int num, i, j, k, flag;
	char s[4001] = { 0 };
	long long int rn = 0, gn = 0, bn = 0, ans = 0;
	scanf("%d", &num);
	scanf("%s", s);
	for (i = 0; i < num; i++) {
		if (s[i] == 'R')
			rn++;
		else if (s[i] == 'G')
			gn++;
		else if (s[i] == 'B')
			bn++;
	}
	ans = rn * gn * bn;
 
	for (i = 0; i < num; i++) {
        if(1+n*2>n)
          break;
		for (j = i + 1; j < num; j++) {
			if ((j - i)*2 > num)
				break;
			for (k = j + 1; k < num; k++) {
				if ((s[i] != s[j] && s[j] != s[k]) && s[i] != s[k])
					if (j - i == k - j)
						ans--;
            }
        }
    }
			printf("%lld\n", ans);
			return 0;
		}

Compiler output:
main.c: In function 'main':
main.c:20:14: error: 'n' undeclared (first use in this function); did you mean 'bn'?
   20 |         if(1+n*2>n)
      |              ^
      |              bn
main.c:20:14: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
int main()
{
  int n,i,j,k;
  int f=0;
  long sum=0;
  scanf("%d",&n);
  char s[n];
  scanf("%s",s);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
	f=0;
	if(s[i]!=s[j]) f=1;
	if(f==1){
        k=j*2-i;
	  if(s[k]!=s[i]&&s[k]!=s[j]){
	    sum=sum+1;
	  }
	}
    }
  }
  printf("%ld",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:30: error: expected ')' before '!' token
   16 |           if(s[k]!=s[i]&&s[k]!=s[j]){
      |             ~                ^
      |                              )
main.c:16:31: error: stray '\3' in program
   16 |           if(s[k]!=s[i]&&s[k]!<U+0003>=s[j]){
      |                               ^~~~~~~~
Language: C

#include <stdio.h>
int main()
{
  int n,i,j,k;
  int f=0;
  long sum=0;
  scanf("%d",&n);
  char s[n];
  scanf("%s",s);
  for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
	f=0;
	if(s[i]!=s[j]) f=1;
	if(f==1){
        k=j*2-i;
	  if(s[k]!=s[i]&&s[k]!=s[j]){
	    sum=sum+1;
	  }
	}
    }
  }
  printf("%d",sum);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:30: error: expected ')' before '!' token
   16 |           if(s[k]!=s[i]&&s[k]!=s[j]){
      |             ~                ^
      |                              )
main.c:16:31: error: stray '\3' in program
   16 |           if(s[k]!=s[i]&&s[k]!<U+0003>=s[j]){
      |                               ^~~~~~~~
Language: C

#include<stdio.h>
int main(void){
  int N,i,j,k,A=0;
  if((scanf("%d",&N)) == ){
    A++;
      A--;
  }
  char S[N];
  if((scanf("%s",S)) == 1){
    A++;
    A--;
  }
  for(i=0;i<N-2;i++)
    for(j=i+1;j<N-1;j++)
      for(k=j+1;k<N;k++){
        if(S[i] ==S[j])
          break;
        if(j-i!=k-j)
          if(S[i]!=S[j]&&S[i]!=S[k]&&S[j] != S[k])
            A++;
      }
  printf("%d",A);
}


Compiler output:
main.c: In function 'main':
main.c:4:26: error: expected expression before ')' token
    4 |   if((scanf("%d",&N)) == ){
      |                          ^
Language: C++

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

int main(){
  long int n, sum=0;
  char s[4001];
  
  cin >> n;
  cin >> s;
 
  for(int i=0; i < n-2; i++){
    for(int j=i+1; j<n-1; 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){
            sum ++;
          }
        }
      }
    }
  }
  
  cout << sum << endl;*/
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected primary-expression before '/' token
   23 |   cout << sum << endl;*/
      |                        ^
a.cc:25:3: error: expected primary-expression before 'return'
   25 |   return 0;
      |   ^~~~~~
Language: C++

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

int main(){
  long int n, sum=0;
  char s[4000];
  
  cin >> n;
  cin >> s;
 
  for(int i=0; i < n-2; i++){
    for(int j=i+1; j<n-1; 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){
            sum ++;
          }
        }
      }
    }
  }
  
  cout << sum << endl;*/
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:24: error: expected primary-expression before '/' token
   23 |   cout << sum << endl;*/
      |                        ^
a.cc:25:3: error: expected primary-expression before 'return'
   25 |   return 0;
      |   ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(false);
	cout.tie(false);
	long long n,b=0,g=0,r=0;
	string s;
	cin>>n>>s;
	for(long long i=0;i<s.length();i++)
	{
		if(s[i]=='B')	b++;
		if(s[i]=='G')	g++;
		if(s[i]=='R')	r++;
	}
	long long ct=b*g*r;
	//cout<<b<<" "<<g<<" "<<r<<" "<<b*g*r<<endl;
	for(long long i=0;i<n;i++)
	{
		for(long long j=i;j<n;j++)
		{
			long long pos=j+j-i;
			if(pos<n && s[pos]!=s[i] && s[i]!=s[j] && s[j]!=s[pos]) 	ct--;
		}
	}
	cout<<ct;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
    6 |         cin.tie(false);
      |         ~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  299 |       tie() const
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:311:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:7:17: error: no matching function for call to 'std::basic_ostream<char>::tie(bool)'
    7 |         cout.tie(false);
      |         ~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  299 |       tie() const
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:311:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define size_of_array(array) (sizeof(array)/sizeof(array[0]))
#define max 100005
using ll =long long;
using namespace std;
using Graph=vector<vector<int>>;

char s[4005];

bool isDiff(int i,int j,int k){
    if((s[i]!=s[j])&&(s[j]!=s[k])&&(s[k]!=s[i])){
        return true; 
    }else{ return false;
    }
}

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

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

    rep(i,n-2){
        for(int j=i+1;j<n-1;j++){
            int  k=2*j-i;
            if(j!=K&&k<n&&isDiff(i,j,k)){
                comb--;
            }
        }
    }
    cout<<comb<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:19: error: 'K' was not declared in this scope
   38 |             if(j!=K&&k<n&&isDiff(i,j,k)){
      |                   ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 
 
int main() {
    int n,ans=0;
    string S;
    cin >> n >> S;
    vector<int> a(n);
    rep(i,n) {
        if(S[i]=='R') a[i]=0;
        else if (S[i]=='G') a[i]=1;
        else a[i]=2;
    }
    vector<int> cnt(3);
    rep(i,n) {
        cnt[a[i]]++;
    }
    rep(i,cnt[0]){
        rep(j,cnt[1]){
            if (a[i+j]==2) ans--;
        }
    }
    ana += cnt[0]*cnt[1]*cnt[2];
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'ana' was not declared in this scope; did you mean 'ans'?
   28 |     ana += cnt[0]*cnt[1]*cnt[2];
      |     ^~~
      |     ans
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 
 
int main() {
    int n,ans=0;
    string S;
    cin >> n >> S;
    vector<int> a(n);
    rep(i,n) {
        if(S[i]=='R') a[i]=0;
        else if (S[i]=='G') a[i]=1;
        else a[i]=2;
    }
    vector<int> cnt(3);
    rep(i,n) {
        cnt[a[i]]++;
    }
    rep(i,cnt[0]){
        rep(j,cnt[1]){
            if (a[i+j]==2) ans--;
        }
    }
    ana += cnt[0]*cnt[1]*cnt[2];
    cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'ana' was not declared in this scope; did you mean 'ans'?
   28 |     ana += cnt[0]*cnt[1]*cnt[2];
      |     ^~~
      |     ans
a.cc:29:25: error: expected '}' at end of input
   29 |     cout << ans << endl;
      |                         ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
 
 
int main() {
    int n,ans=0;
    string S;
    cin >> n >> S;
    vector<int> a(n);
    rep(i,n) {
        if(S[i]=='R') a[i]=0;
        else if (S[i]=='G') a[i]=1;
        else a[i]=2;
    }
    vector<int> cnt(3);
    rep(i,n) {
        cnt[a[i]]++;
    }
    rep(i,cnt[0]){
        rep(j,cnt[1]){
            if (a[i+j]==2) ans--;
        }
    }
    anas += cnt[0]*cnt[1]*cnt[2];
    cout << ans <, endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:5: error: 'anas' was not declared in this scope; did you mean 'ans'?
   28 |     anas += cnt[0]*cnt[1]*cnt[2];
      |     ^~~~
      |     ans
a.cc:29:18: error: expected primary-expression before ',' token
   29 |     cout << ans <, endl;
      |                  ^
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 pii = pair<int,int>;

int main(){
    int n;
    string 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;
    rep(j,n)rep(i,j){
        int k = j + (j-1);
        if(s[i] == s[j])coutinue;
        if(s[i] == s[k])continue;
        if(s[j] == s[k])continue;
        ans--;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'coutinue' was not declared in this scope
   19 |         if(s[i] == s[j])coutinue;
      |                         ^~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>

using namespace std;

int main()
{
	int N;
	cin >> N;
	
	string S;
	cin >> S;
	
	int r = 0;
	int g = 0;
	int b = 0;
	for(int i = 0; i < N; i++){
		if(S.substr(i,1) == "R") r++;
		else if(S.substr(i,1) == "G") g++;
		else b++;
	}	

	int ans = r * g * b;
	for(int i = 1; i <= N; i++){
		for(int j = i + 1; j <= N; j++){
			if((S.substr(i - 1,1) != S.substr(j - 1,1)) && (S.substr(i - 1,1) != S.substr(k - 1,1)) && (S.substr(j - 1,1) != S.substr(k - 1,1))) ans--;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:103: error: 'k' was not declared in this scope
   29 |                         if((S.substr(i - 1,1) != S.substr(j - 1,1)) && (S.substr(i - 1,1) != S.substr(k - 1,1)) && (S.substr(j - 1,1) != S.substr(k - 1,1))) ans--;
      |                                                                                                       ^
Language: C++

#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	string S;
	cin >> S;

	vector<long long> count(3, 0);

	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'R')
		{
			count[0]++;
		}
		else if (S[i] == 'G')
		{
			count[1]++;
		}
		else if (S[i] == 'B')
		{
			count[2]++;
		}
	}

	long long not = 0;
	for (int i = 0; i < N; i++)
	{
		for (int d = 1; d < N; d++)
		{
			if (i + d * 2 < N)
			{
				if (S[i] != S[i + d] && S[i + d] != S[i + d * 2] && S[i] != S[i + d * 2]) not++;
			}
		}
	}

	cout << count[0] * count[1] * count[2] - not;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:19: error: expected unqualified-id before 'not' token
   45 |         long long not = 0;
      |                   ^~~
a.cc:52:112: error: expected primary-expression before ';' token
   52 |                                 if (S[i] != S[i + d] && S[i + d] != S[i + d * 2] && S[i] != S[i + d * 2]) not++;
      |                                                                                                                ^
a.cc:57:53: error: expected primary-expression before ';' token
   57 |         cout << count[0] * count[1] * count[2] - not;
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  ll N;
  string S;
  cin >> N >> S;
  int numR = count(S.begin(), S.end(), 'R');
  int numG = count(S.begin(), S.end(), 'G');
  int numB = count(S.begin(), S.end(), 'B');
  ll res = numR*numG*numB;
  for (ll i=0; i<N; i++) {
    for (ll j=i+1; j<N; j++) {
      if (j<2*j-i&&2*j-i<N) {
        ll k = 2*j-i;
        if (S[i]!=S[j]&&S[i]!=S[k]&&S[j]!=S[k]) res--;
      }
    }
  }
  cout << max(res, 0) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: no matching function for call to 'max(long long int&, int)'
   25 |   cout << max(res, 0) << endl;
      |           ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:25:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   25 |   cout << max(res, 0) << endl;
      |           ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:25:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   25 |   cout << max(res, 0) << endl;
      |           ~~~^~~~~~~~
Language: C

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

#define RED 0
#define GREEN 1
#define BLUE 2
#define MAX_N 4000

string s;
int R[MAX_N], G[MAX_N], B[MAX_N], S[MAX_N];
int N, cnt = 0, r = 0, g = 0, b = 0;

void solve(){
    for(int i = 2; i < N; i++){
        for(int j = 0; j < i - 1; j++){
            if(S[i] == S[j]) continue;
            if(S[i] + S[j] == 1){
                if((i - j) % 2 != 0) cnt += B[i - 1] - B[j];
                else cnt += B[i - 1] + B[(i + j) / 2 - 1] - B[(i + j) / 2] - B[j];
            }
            if(S[i] + S[j] == 2){
                if((i - j) % 2 != 0) cnt += G[i - 1] - G[j];
                else cnt += G[i - 1] + G[(i + j) / 2 - 1] - G[(i + j) / 2] - G[j];
            }
            if(S[i] + S[j] == 3){
                if((i - j) % 2 != 0) cnt += R[i - 1] - R[j];
                else cnt += R[i - 1] + R[(i + j) / 2 - 1] - R[(i + j) / 2] - R[j];
            }
        }
    }
    cout << cnt << endl;
    return;
}

int main(){
    cin >> N >> s;
    for (int i = 0; i < N; i++){
        if(s[i] == 'R') {
            r++;
            S[i] = RED;
        }
        if(s[i] == 'G') {
            g++;
            S[i] = GREEN;
        }
        if(s[i] == 'B') {
            b++;
            S[i] = BLUE;
        }
        R[i] = r;
        G[i] = g;
        B[i] = b;
    }
    solve();
}

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

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

int main(){
  int n;
  string s;
  long long count = 0;
  int i,j,k;
  for(i=0;i<=n-3;i++){
    for(j=i+1;j<=n-2;j++){
      for(k=j+1;k<=n-1;k++){
        if((s[i] != s[j]) && (s[i] != s[k]) && (s[j] != s[k]) && (j-i != k-j){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:78: error: expected ')' before '{' token
   18 |         if((s[i] != s[j]) && (s[i] != s[k]) && (s[j] != s[k]) && (j-i != k-j){
      |           ~                                                                  ^
      |                                                                              )
a.cc:21:7: error: expected primary-expression before '}' token
   21 |       }
      |       ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'm' was not declared in this scope
   26 |                 m--;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

signed main() {
	IOS;
	int size; cin>>size;
	string s; cin>>s;
	int ans=0;
	map<int,int> R_mp;
	map<int,int> G_mp;
	map<int,int> B_mp;
	int R_cnt=0;
	int G_cnt=0;
	int B_cnt=0;
	rep(i,size){
		if(s.at(i)=='R'){
			R_mp[R_cnt]=i;
			R_cnt++;
		}
		else if	(s.at(i)=='G'){
			G_mp[G_cnt]=i;
			G_cnt++;
		}
		else if(s.at(i)=='B'){
			B_mp[B_cnt]=i;
			B_cnt++;
		}
	}
	//cout<<R_mp.size()<<endl;
	//cout<<G_mp.size()<<endl;
	//cout<<B_mp.size()<<endl;
	int cnt=0;
	rep(i,R_mp.size()){
		rep(j,G_mp.size()){
			rep(k,B_mp.size()){
				//cnt++;
				int a=R_mp[i];
				int b=G_mp[j];
				int c=B_mp[k];
				if(a==b || b==c || a==c) continue;
				if(a-b==c-a) continue;
				if(a-c==b-a) continue;
				if(b-a==c-b) continue;
				if(b-c==a-b) continue;
				if(c-a==b-c) continue;
				if(c-b==a-c) continue;
				ans++;
			}
		}
	}
	cout<<ans<<;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:20: error: expected primary-expression before ';' token
   56 |         cout<<ans<<;
      |                    ^
Language: C++

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

#define int long long

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

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

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

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
string t;
int s[4][4005],a[4005];
int n,i,j,k;
int main()
{
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		if(t[i-1]=='R') a[i]=0;
		if(t[i-1]=='G') a[i]=1;
		if(t[i-1]=='B') a[i]=2;
    }
    for(int i=1;i<=n;i++)
    {
    	for(int j=0;j<3;j++) s[j][i]=s[j][i-1];
    	s[j][i]=s[j][i-1]+1;
	}
	for(int i=1;i<=n;i++)
	for(int j=i+1;j<=n;j++)
	{
		if(a[i]==a[j]) continue;
		ans+= s[3-a[i]-a[j]][n]-s[3-a[i]-a[j]][j];
		if(2*j-i<=n&&a[2*j-i]==3-a[i]) ans--;
	}
	cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 ans+= s[3-a[i]-a[j]][n]-s[3-a[i]-a[j]][j];
      |                 ^~~
      |                 abs
a.cc:28:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |         cout<<ans;
      |               ^~~
      |               abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  string s;
  cin>>s;
  set<int>Sr;
  set<int>Sg;
  set<int>Sb;
  for(int i=0;i<N;i++){
  if(s.at(i)=='R')
    Sr.insert(i);
    else if(s.at(i)=='G')
      Sg.insert(i);
    else
      Sb.insert(i);
  }int64_t ans=0;
  int b=Sb.size();
  for(auto p:Sr){
  for(auto q:Sg){
  int x=0;
    if(p%2==q%2){
    if(Sb.count((p+q)/2)
       x++;
       if(Sb.count(2*p-q))
       x++;
       if(Sb.count(2*q-p))
       x++;
    }else{
     if(Sb.count(2*p-q))
       x++;
       if(Sb.count(2*q-p))
       x++;
    }ans+=(b-x);
  
  }
  }cout<<ans<<endl;
   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:25: error: expected ';' before 'x'
   24 |     if(Sb.count((p+q)/2)
      |                         ^
      |                         ;
   25 |        x++;
      |        ~                 
a.cc:26:8: error: expected primary-expression before 'if'
   26 |        if(Sb.count(2*p-q))
      |        ^~
a.cc:25:12: error: expected ')' before 'if'
   25 |        x++;
      |            ^
      |            )
   26 |        if(Sb.count(2*p-q))
      |        ~~   
a.cc:24:7: note: to match this '('
   24 |     if(Sb.count((p+q)/2)
      |       ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

#define f(i,n) for(int i=0;i<n;i++)

signed main(){
	int n;
	string s;
	cin>>n;
	cin>>s;
	vector<int> r;
	vector<int> g;
	vector<int> b;
	char dum;
	for(int i=0;i<n;i++){
		dum = s[i];
		if(dum=='R')
			r.push_back(i+1);
		else if(dum=='G')
			g.push_back(i+1);
		else 
			b.push_back(i+1);
	}

	int ans =0;
	int fromR=0;
	int fromG=0;
	int fromB=0;


	for(int i=1;i<=n-2;i++){
		if(s[i-1]=='R'){
			for(int jj=fromG;jj<g.size();jj++){
				int j=g.get(jj)
				if(j>i){
					for(int k:b){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromG==jj;
				}
			}
			for(int jj=fromB;jj<b.size();jj++){
				int j=b.get(jj)
				if(j>i){
					for(int k:g){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromB=jj;
				}
			}
		}else if(s[i-1]=='G'){
			for(int jj=fromB;jj<b.size();jj++){
				int j=b.get(jj)
				if(j>i){
					for(int k:r){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromB=jj;
				}

			}
			for(int jj=fromR;jj<r.size();jj++){
				int j=r.get(jj)
				if(j>i){
					for(int k:b){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromR=jj;
				}
				
			}

		}else if(s[i-1]=='B'){
			for(int jj=fromR;jj<r.size();jj++){
				int j=r.get(jj)
				if(j>i){
					for(int k:g){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromR=jj;
				}

			}
			for(int jj=fromG;jj<g.size();jj++){
				int j=g.get(jj)
				if(j>i){
					for(int k:r){
						if(k>j){
							if(k!=2*j-i){
								ans++;
							}
						}
					}
				}else{
					fromG=jj;
				}
				
			}

		}
	}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:36:41: error: 'class std::vector<int>' has no member named 'get'
   36 |                                 int j=g.get(jj)
      |                                         ^~~
a.cc:50:41: error: 'class std::vector<int>' has no member named 'get'
   50 |                                 int j=b.get(jj)
      |                                         ^~~
a.cc:65:41: error: 'class std::vector<int>' has no member named 'get'
   65 |                                 int j=b.get(jj)
      |                                         ^~~
a.cc:80:41: error: 'class std::vector<int>' has no member named 'get'
   80 |                                 int j=r.get(jj)
      |                                         ^~~
a.cc:97:41: error: 'class std::vector<int>' has no member named 'get'
   97 |                                 int j=r.get(jj)
      |                                         ^~~
a.cc:112:41: error: 'class std::vector<int>' has no member named 'get'
  112 |                                 int j=g.get(jj)
      |                                         ^~~
Language: C++

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

int main(){
    long int n,count=0;
    string s;
    cin >> n >> s;
    for(long int i=0;i<j;i++)
    {
        for(long int j=0;j<k;j++)
        {
            for(long int k=0;k<n;k++)
            {
                else if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k]){
                    if(j-i != k - j)
                    {
                        count++;
                    }
                }
            }
        }
    }

    cout << count << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: 'j' was not declared in this scope
    9 |     for(long int i=0;i<j;i++)
      |                        ^
a.cc:11:28: error: 'k' was not declared in this scope
   11 |         for(long int j=0;j<k;j++)
      |                            ^
a.cc:15:17: error: 'else' without a previous 'if'
   15 |                 else if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k]){
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
ll n,a[4005],k,s[4][4005],ans;
string t;
int main(){
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		if(t[i-1]=='R') a[i]=0;
		if(t[i-1]=='G') a[i]=1;
		if(t[i-2]=='B') a[i]=2;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<3;j++) s[j][i]=s[j][i-1];
		s[a[i]][i]=s[a[i]][i-1]+1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(a[i]==a[j]) continue;
			ans+=s[3-a[i]-a[j]][n]-s[s-a[i]-a[j]][j];
			if(2*j-i<=n&&a[j*2-i]==3-a[i]-a[j]) ans--;
		}
	}
	cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:49: error: invalid types 'long long int [4][4005][long long int (*)[4005]]' for array subscript
   25 |                         ans+=s[3-a[i]-a[j]][n]-s[s-a[i]-a[j]][j];
      |                                                 ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
const int N=100005;
using namespace std;
ll n,a[4005],k,s[4][4005],ans;
string t;
int main(){
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		if(t[i-1]=='R') a[i]=0;
		if(t[i-1]=='G') a[i]=1;
		if(t[i-2]=='B') a[i]=2;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<3;j++) s[j][i]=s[j][i-1];
		s[a[i]][i]=s[a[i]][i-1]+1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(a[i]==a[j]) continue;
			ans+=s[3-a[i]-a[j]][n]-s[s-a[i]-a[j]][j];
			if(a[j*2-i]==3-3-a[i]-a[j]) ans--;
		}
	}
	cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:49: error: invalid types 'long long int [4][4005][long long int (*)[4005]]' for array subscript
   25 |                         ans+=s[3-a[i]-a[j]][n]-s[s-a[i]-a[j]][j];
      |                                                 ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define ll long long
string t;
int a[4005],s[5][4005],u[5];
int main()
{
	int n,ans;
	cin>>n>>t;
	for(int i=1;i<=n;i++)
	{
		if(t[i-1]=='R')a[i]=0;
		if(t[i-1]=='G')a[i]=1;
		if(t[i-1]=='B')a[i]=2;
	}
	for(int i=1;i<=n;i++) 
	{
		for(int j=0;j<3;j++)s[j][i]=s[j][i-1];
		s[a[i]][i]=s[a[i]][i-1]+1;
		s[a[i]][i]=s[a[i]][i-1]+1;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(a[i]==a[j])continue;
			memset(u,0,sizeof(u));
			u[a[i]]=1;u[a[j]]=1;
			int x;
			for(int k=0;k<3;k++)
			if(u[k]==0)x=k;
			ans+=s[x][n]-s[x][j];
			if(j-i+j<=n&&a[j-i+j]==x)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<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
string s;
ll ans; 
int main()
{
	cin>>n>>s;
	for(int i=n-1;i>=2;i--)
	{
		s[1]=s[i];
		for(int j=i-1;j>=1;j--)
		{
			s[2]=s[j];
			if(s[1]==s[2])continue;
			for(int l=0;l<=j-1;l++)
			if(s[l]!=s[1]&&s[l]!=s[2]&&s[l]!=(2*j-i))ans++;
		}
	}
	cout<<ans;
return 0;
}


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