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

import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	String ss = sc.next();
      	char[] s = ss.ToCharArray();
      	long ans = 0;
      	for(int i = 0; i < n-2 ; i++){
        	for(int j = i+1 ; j < n-1 ; j++){
              	if(s[i]==s[j]) continue;
              	for(int k = j+1 ; k < n ; k++){
                 	if(s[j]!=s[k] && s[k]!=s[i]  && j-i != k-j) ans++;
                }
            }
        }
      	System.out.println(ans);
    }
}

Compiler output:
Main.java:8: error: cannot find symbol
      	char[] s = ss.ToCharArray();
      	             ^
  symbol:   method ToCharArray()
  location: variable ss of type String
1 error
Language: C++

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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int a = 0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			for(k=j+1;k<n;k++)
			{
				if(s.at(i) != s.at(j)&&
				   s.at(j) != s.at(k)&&
				   s.at(i) != s.at(k))
				{
					if(j - i != k - j)
					{
						a++;
					}
				}
			}
		}
	}
	cout << a << endl;
	return 0;
}


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

#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <memory>
#include <numeric>
#include <type_traits>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
typedef long long ll;
 
 
int main() {
    int n; 
    cin >> n;
    string s;
    cin >> s;
    int res = 0;
    for (int i = 0; i < s.length()-2; i++){
      for (int j = i+1; j < s.length()-1; j++){
        for (int k = j+1; k < s.length(); k++){
          if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]){
            if (((j-i) != (k-j))) res += 1;
          }
        }
      }
    }
    if (n < 4) res = 0;
    cout << res << endl;
    return 0;
}

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

#include <iostream>
using namespace std;

int main(){
    int N;
    string S;
    int count = 0;
    cin >> N >> S;

    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            for (int k = 0; k < N; k++){
                if ((i < j) && (j < k)){
                    if ((c_i != c_j) and (c_i != c_k) and (c_j != c_k)){
                        if ((j-i) != (k-j)){
                            count += 1;
                        }
                    }
                }
            }
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: 'c_i' was not declared in this scope
   14 |                     if ((c_i != c_j) and (c_i != c_k) and (c_j != c_k)){
      |                          ^~~
a.cc:14:33: error: 'c_j' was not declared in this scope
   14 |                     if ((c_i != c_j) and (c_i != c_k) and (c_j != c_k)){
      |                                 ^~~
a.cc:14:50: error: 'c_k' was not declared in this scope
   14 |                     if ((c_i != c_j) and (c_i != c_k) and (c_j != c_k)){
      |                                                  ^~~
Language: C++

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

int main() {
  int N;
  string S;
  int num=0;
  char ch[N];
  cin >> N;
  cin >> S;
  str.copy(ch,N);
  
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(ch[i]!=ch[j] && ch[i]!=ch[k] && ch[j]!=ch[k])num+=1;
      }
    }
  }
  cout << num <<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |   str.copy(ch,N);
      |   ^~~
      |   std
Language: C++

#include<bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> R,G;
    vector<int> B(N,0);
    int Red=0;
  	int Green=0;
  	int Blue=0;
    for(int i=0; i<N; i++){
        if(S.at(i)=='R') {
            R.push_back(i);
            Red += 1;
            
        }
        if(S.at(i)=='G') {
            G.push_back(i);
            Green += 1;
        }
        if(S.at(i)=='B') {
            B.at(i)=1;
            Blue += 1;
        }
    }
   	ll error=0;
    for(int i=0; i<Red; i++){
        for(int j=0; j<Green; j++){
            int a=R.at(i);
            int b=G.at(j);
            if((a+b)%2==0){
                if(B.at((a+b)/2)==1) error++;
            }
            if(0<=2*b-a && 2*b-a<N){
                if(B.at(2*b-a)==1) error++;
            }
            if(0<=2*a-b && 2*a-b<N){
                if(B.at(2*a-b)==1) error++;
            }
        }
    }
    ll e=Red*Blue*Green;
    ll f=e-erroe;
    cout << f << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:12: error: 'erroe' was not declared in this scope; did you mean 'error'?
   52 |     ll f=e-erroe;
      |            ^~~~~
      |            error
Language: C++

#include "stdc++.h"
// #include <bits/stdc++.h>
using namespace std;
 
#define get(a) scanf("%lld", &a);
#define print(a) printf("%lld",a)
#define println(a) printf("%lld\n",a)
 
#define do(i,a) for(long long i = 0; i < a; i++)
#define loop() for(;;) 
#define done return 0
 
long long n,ans,
          R,G,B,
          lastR = -1, lastG = -1, lastB = -1, D;
 
bool r,g,b;
 
string s;
 
int main() {
    // printf("...\n");
    get(n);
    cin >> s;
    // n = 39;
    // s = "RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB";
    do(i,n) if (s[i]=='R') R++; else if (s[i]=='G') G++; else if (s[i]=='B') B++;
    
    ans = R * G * B;
    do(i,n/2+1) {
        for (long long j = 2*(i); j < n; j++) {
            r = 0;
            g = 0;
            b = 0;
            if (s[j]=='R' || s[j-i]=='R' || s[j-2*i]=='R') r = true;
            if (s[j]=='G' || s[j-i]=='G' || s[j-2*i]=='G') g = true;
            if (s[j]=='B' || s[j-i]=='B' || s[j-2*i]=='B') b = true;
            if (r && g && b) ans--;
        }
    }
 
    print(ans);
 
}

Compiler output:
a.cc:1:10: fatal error: stdc++.h: No such file or directory
    1 | #include "stdc++.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

int main()
{
	int N, i, j, k, count = 0;
	string str;
	cin >> N;
	vector<int> v(N);
	cin >> str;
	for (i = 0;i < N;++i)
		if (str[i] == 'R')
			v[i] = 1;
		else if (str[i] == 'G')
			v[i] = 2;
		else
			v[i] = 3;
	for (i = 0;i < N;++i)
		for (j = i+1;j < N;++j)
			for (k = j + 1;k < N;++k)
			{
				if (v[i] != 2 && v[i] + v[j] + v[k] == 6 && j-i!=k-j)
					count++;
			}
	cout << count;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'string' was not declared in this scope
    4 |         string str;
      |         ^~~~~~
a.cc:5:9: error: 'cin' was not declared in this scope
    5 |         cin >> N;
      |         ^~~
a.cc:6:9: error: 'vector' was not declared in this scope
    6 |         vector<int> v(N);
      |         ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
    6 |         vector<int> v(N);
      |                ^~~
a.cc:7:16: error: 'str' was not declared in this scope; did you mean 'std'?
    7 |         cin >> str;
      |                ^~~
      |                std
a.cc:10:25: error: 'v' was not declared in this scope
   10 |                         v[i] = 1;
      |                         ^
a.cc:12:25: error: 'v' was not declared in this scope
   12 |                         v[i] = 2;
      |                         ^
a.cc:14:25: error: 'v' was not declared in this scope
   14 |                         v[i] = 3;
      |                         ^
a.cc:19:37: error: 'v' was not declared in this scope
   19 |                                 if (v[i] != 2 && v[i] + v[j] + v[k] == 6 && j-i!=k-j)
      |                                     ^
a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   22 |         cout << count;
      |         ^~~~
      |         count
Language: C++

#include<bits/stdc++.h>
using namespace std;
int ans;
vector<int> vec[3];
int solve(int a, int b, int c){
    for(int i = 0; i < vec[a].size(); i++){
        auto temp = upper_bound(vec[b].begin(), vec[b].end(), vec[a][i]);
        for(temp != vec[b].end()){
            auto temp2 = upper_bound(vec[c].begin(), vec[c].end(), *temp);
            ans += vec[c].end() - temp2;
            if(binary_search(vec[c].begin(), vec[c].end(), *temp * 2 - vec[a][i])){
                ans--;
            }
            temp++;
        }
    }
}
int main(){
    int N;
    string s;
    cin >> N >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'R'){
            vec[0].push_back(i);
        }
        else if(s[i] == 'G'){
            vec[1].push_back(i);
        }
        else{
            vec[2].push_back(i);
        }
    }
    solve(0, 1, 2);
    solve(0, 2, 1);
    solve(1, 0, 2);
    solve(1, 2, 0);
    solve(2, 0, 1);
    solve(2, 1, 0);
    
    cout << ans << endl;

}

Compiler output:
a.cc: In function 'int solve(int, int, int)':
a.cc:8:33: error: expected ';' before ')' token
    8 |         for(temp != vec[b].end()){
      |                                 ^
      |                                 ;
a.cc:8:18: warning: ignoring return value of 'bool __gnu_cxx::operator!=(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&) [with _Iterator = int*; _Container = std::vector<int>]', declared with attribute 'nodiscard' [-Wunused-result]
    8 |         for(temp != vec[b].end()){
      |             ~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 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_iterator.h:1232:5: note: declared here
 1232 |     operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
      |     ^~~~~~~~
a.cc:16:5: error: expected primary-expression before '}' token
   16 |     }
      |     ^
a.cc:15:10: error: expected ';' before '}' token
   15 |         }
      |          ^
      |          ;
   16 |     }
      |     ~     
a.cc:16:5: error: expected primary-expression before '}' token
   16 |     }
      |     ^
a.cc:15:10: error: expected ')' before '}' token
   15 |         }
      |          ^
      |          )
   16 |     }
      |     ~     
a.cc:8:12: note: to match this '('
    8 |         for(temp != vec[b].end()){
      |            ^
a.cc:16:5: error: expected primary-expression before '}' token
   16 |     }
      |     ^
a.cc:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
   17 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう

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

int main() {
  int ans=0;
  int N=0;
  cin>>N;
  string s;
  cin>>s;
  char ci,cj,ck;
  for(int i=0;i<N;i++){
    ci=s[i];
    for(int j=i;j<N;j++){
      cj=s[j];
      if(j<=i){
        continue;}
      if(ci==cj)continue;
      if(ci=='R'){
        if(cj=='G')ck='B';
        else ck=='G';
      }
      else if(ci=='G'){
        if(cj=='R')ck='B';
        else ck=='R';
      }
      else if(ci=='B'){
        if(cj=='G')ck='R';
        else ck=='G';
      }
      for(int k=j;k<N+1;k++){
        if(s[k]=ck)ans++;
      }
    }
  }
  cout<<ans;
}

/*4000
RBRBGRBGGBBRRGBBRRRBGGBRBGBR
BGBRBBBGBBBRBRBGRBGGBBRRGBBR
RRBGGBRBGBRBGBRBBBGBBBRBRBGR
BGGBBRRGBBRRRBGGBRBGBRBGBRBB
BGBBBRBRBGRBGGBBRRGBBRRRBGGB
RBGBRBGBRBBBGBBBRBRBGRBGGBBR
RGBBRRRBGGBRBGBRBGBRBBBGBBBR
BRBGRBGGBBRRGBBRRRBGGBRBGBRB
GBRBBBGBBBRBRBGRBGGBBRRGBBRR
RRBGGBRBGBRBGBRBBBGBBBRBRBGR
BGGBBRRGBBRRRBGGBRBGBRBGBRBB
BGBBBRBRBGRBGGBBRRGBBRRRBGGB
RBGBRBGBRBBBGBBBRBRBGRBGGBBR
RGBBRRRBGGBRBGBRBGBRBBBGBBBR
BRBGRBGGBBRRGBBRRRBGGBRBGBRB
GBRBBBGBBBRBRBGRBGGBBRRGBBRR
RBGGBRBGBRBGBRBBBGBBBRBRBGRB
GGBBRRGBBRRRBGGBRBGBRBGBRBBB
GBBBRBRBGRBGGBBRRGBBRRRBGGBR
BGBRBGBRBBBGBBBRBRBGRBGGBBRR
GBBRRRBGGBRBGBRBGBRBBBGBBBRB
RBGRBGGBBRRGBBRRRBGGBRBGBRBG



Compiler output:
a.cc:41:1: error: unterminated comment
   41 | /*4000
      | ^
Language: Java

import java.util.*;
 
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	char[] s = sc.next().ToCharArray();
      	long ans = 0;
      	for(int i = 0; i < n-2 ; i++){
        	for(int j = i+1 ; j < n-1 ; j++){
              	if(s[i]==s[j]) continue;
              	for(int k = j+1 ; k < n ; k++){
                 	if(s[j]!=s[k] && s[k]!=s[i]  && j-i != k-j) ans++;
                }
            }
        }
      	System.out.println(ans);
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
      	char[] s = sc.next().ToCharArray();
      	                    ^
  symbol:   method ToCharArray()
  location: class String
1 error
Language: C++

int main(){
  int N;
  long long ans=0;
  cin>>N;
  vector<int> r(0),g(0),b(0);
  vector<char> c(N);
  
  for(int i=0;i<N;i++){
    cin>>c.at(i);
    if(c.at(i)=='R'){
      r.push_back(i+1);
    }else if(c.at(i)=='G'){
      g.push_back(i+1);
    }else{
      b.push_back(i+1);
    }
  }
  
  vector<int> a(3);
  for(int i=0;i<r.size();i++){for(int j=0;j<g.size();j++){for(int k=0;k<b.size();k++){
    a={r.at(i),g.at(j),b.at(k)};
    sort(a.begin(),a.end());
    if(a.at(1)-a.at(0)==a.at(2)-a.at(1)){continue;}
    ans++;
  }}}
  cout<<ans;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin>>N;
      |   ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> r(0),g(0),b(0);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> r(0),g(0),b(0);
      |          ^~~
a.cc:6:10: error: expected primary-expression before 'char'
    6 |   vector<char> c(N);
      |          ^~~~
a.cc:9:10: error: 'c' was not declared in this scope
    9 |     cin>>c.at(i);
      |          ^
a.cc:11:7: error: 'r' was not declared in this scope
   11 |       r.push_back(i+1);
      |       ^
a.cc:13:7: error: 'g' was not declared in this scope
   13 |       g.push_back(i+1);
      |       ^
a.cc:15:7: error: 'b' was not declared in this scope
   15 |       b.push_back(i+1);
      |       ^
a.cc:19:10: error: expected primary-expression before 'int'
   19 |   vector<int> a(3);
      |          ^~~
a.cc:20:17: error: 'r' was not declared in this scope
   20 |   for(int i=0;i<r.size();i++){for(int j=0;j<g.size();j++){for(int k=0;k<b.size();k++){
      |                 ^
a.cc:20:45: error: 'g' was not declared in this scope
   20 |   for(int i=0;i<r.size();i++){for(int j=0;j<g.size();j++){for(int k=0;k<b.size();k++){
      |                                             ^
a.cc:20:73: error: 'b' was not declared in this scope
   20 |   for(int i=0;i<r.size();i++){for(int j=0;j<g.size();j++){for(int k=0;k<b.size();k++){
      |                                                                         ^
a.cc:21:5: error: 'a' was not declared in this scope
   21 |     a={r.at(i),g.at(j),b.at(k)};
      |     ^
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |     sort(a.begin(),a.end());
      |     ^~~~
      |     short
a.cc:26:3: error: 'cout' was not declared in this scope
   26 |   cout<<ans;
      |   ^~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n;
    cin>>n;
    string ss;
    cin>>ss;
    set<ll>s;
    vector<ll>red,green,blue;
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        if(ss[i]=='R')
        {
            red.push_back(i);
        }

        else if(ss[i]=='G')
        {
            green.push_back(i);
        }
        else
        {
            blue.push_back(i);
        }
    }

    for(int i=0;i<red.size();i++)
    {
        for(int j=0;j<green.size();j++)
        {

            for(int k=0;k<blue.size();k++)
            {
                if(red[i]<green[j] && green[j]<blue[k] && green[j]-red[i] !=blue[k]-green[j])
                {
                    sum++;
                }
                else if(red[i]>green[j] && green[j]>blue[k] && green[j]-red[i] !=blue[k]-green[j])
                {
                    sum++;
                }
                else if(green[j]<red[i] && red[i]<blue[k] && green[j]-red[i] !=red[i]-blue[k])
                {
                    sum++;
                }
                else if(green[j]<blue[k] && blue[k]<red[i] && green[j]-blue[k]!=blue[k]-red[i]) {sum++;}
                  else if(green[j]>red[i] && red[i]>blue[k] && green[j]-red[i] !=red[i]-blue[k])
                {
                    sum++;
                }
                else if(green[j]>blue[k] && blue[k]>red[i] && green[j]-blue[k]!=blue[k]-red[i]) {sum++;}
        }
    }

    }

 cout<<sum<<"\n";
}


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() {
  long long N;
  string S;
  cin>>N>>S;
  queue <int> rr;
  queue <int> gg;
  queue <int> bb;
  long long rg=0;
  long long gr=0;
  long long rb=0;
  long long br=0;
  long long gb=0;
  long long bg=0;
  long long ans=0;
  cin>>rg>>gr>>rb>>br>>gb>>bg>>ans;
  
  for (int i = 0; i < N; i++) {
    if(S.at(i)=='R'){
      rr.push(i);
      gr+=gg.size();
      br+=bb.size();
      ans+=gb;
      ans+=bg;
        
      
        
    }
    else if(S.at(i)=='G'){
      gg.push(i);
      rg+=rr.size();
      bg+=bb.size();
      ans+=br;
      ans+=rb;
        
        
    }
    else{
      bb.push(i);
      rb+=rr.size();
      gb+=gg.size();
      ans+=gr;
      ans+=rg;
        
    }
  }
  for (int i = 1; i < N-1; i++) {
    for (int j = 1; j < min(N-i,i+1); j++) {
      if(S.at(i-j)!=S.at(i)&&S.at(i)!=S.at(i+j)&&S.at(i-j)!=S.at(i+j)){
        ans--;
        
      
 
}

    } 
}

 cout<<ans<<endl;


  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:50:28: error: no matching function for call to 'min(long long int, int)'
   50 |     for (int j = 1; j < min(N-i,i+1); j++) {
      |                         ~~~^~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:50:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   50 |     for (int j = 1; j < min(N-i,i+1); j++) {
      |                         ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:50:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   50 |     for (int j = 1; j < min(N-i,i+1); j++) {
      |                         ~~~^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    vector<int> R,G;
    vector<int> B(N,0);
    int Red=0;
  	int Green=0;
  	int Blue=0;
    for(int i=0; i<N; i++){
        if(S.at(i)=='R') {
            R.push_back(i);
            Red += 1;
            
        }
        if(S.at(i)=='G') {
            G.push_back(i);
            Green += 1;
        }
        if(S.at(i)=='B') {
            B.at(i)=1;
            Blue += 1;
        }
    }
    ll error=0;
    for(int i=0; i<R.size(); i++){
        for(int j=0; j<G.size(); j++){
            int a=R.at(i);
            int b=G.at(j);
            if((a+b)%2==0){
                if(B.at((a+b)/2)==1) error++;
            }
            if(0<=2*b-a && 2*b-a<N){
                if(B.at(2*b-a)==1) error++;
            }
            if(0<=2*a-b && 2*a-b<N){
                if(B.at(2*a-b)==1) error++;
            }
        }
    }
    ll e=Red*Blue*Green;
    ll f=e-erroe;
    cout << f << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:12: error: 'erroe' was not declared in this scope; did you mean 'error'?
   52 |     ll f=e-erroe;
      |            ^~~~~
      |            error
Language: C

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

int main() {
    int n; cin >> n;
    string s; cin >> s;
    vector<vector<int>> a(n,vector<int>(3,0));
    if(s[0] == 'R') a[0][0]++;
    else if(s[0] == 'G') a[0][1]++;
    else a[0][2]++;
    for(int i = 1; i < n; i++){
        a[i][0] = a[i-1][0];
        a[i][1] = a[i-1][1];
        a[i][2] = a[i-1][2];
        char si = s[i];
        if(si == 'R') a[i][0]++;
        else if(si == 'G') a[i][1]++;
        else a[i][2]++;
    }

    int64_t ans = 0;
    for(int i = 1; i < n; i++){
        int si;
        if(s[i] == 'R') si = 0;
        else if(s[i] == 'G') si = 1;
        else si = 2;
        for(int j = i+1; j < n; j++){
            int sj;
            if (s[j] == 'R') sj = 0;
            else if (s[j] == 'G') sj = 1;
            else sj = 2;
            if(si == sj) continue;
            int clr = 3-si-sj;
            ans += a[i-1][clr];
            int ng = 2*i-j;
            if(ng >= 0){
                if(clr == 0 && s[ng] == 'R'){
                    ans--;
                }
                if (clr == 1 && s[ng] == 'G'){
                    ans--;
                }
                if (clr == 2 && s[ng] == 'B'){
                    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;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll N;
  IN(N);
  string S;
  IN(S);

  ll R_count=0, G_count=0, B_count=0;
  REP(i,N){
    if(S[i]=='R') R_count++;
    else if(S[i]=='G') G_count++;
    else if(S[i]=='B') B_count++;
  }

  ll ans = R_count*G_count*B_count;

  REP(i,N){
    FOR(d,1,N){
      ll j = i+d;
      ll k = i+2*d;
      if(k>=N) continue;
      if(S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]) ans--;
    }
  }

  OUT(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.
Language: C++

#include <iostream>
#include <string>
#include <Vector>

using namespace std;

int main()
{
	int N, i, j, k, count = 0;
	string str;
	cin >> N;
	vector<int> v(N);
	cin >> str;
	for (i = 0;i < N;++i)
		if (str[i] == 'R')
			v[i] = 1;
		else if (str[i] == 'G')
			v[i] = 2;
		else
			v[i] = 3;
	for (i = 0;i < N;++i)
		for (j = i+1;j < N;++j)
			for (k = j + 1;k < N;++k)
			{
				if (v[i] + v[j] + v[k] == 6 && v[i] != v[j] && j-i!=k-j)
					count++;
			}
	cout << count;
	return 0;
}

Compiler output:
a.cc:3:10: fatal error: Vector: No such file or directory
    3 | #include <Vector>
      |          ^~~~~~~~
compilation terminated.
Language: C

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S;
ll dp[4040][8];


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	dp[0][0]=1;
	
	cin>>N>>S;
	
	FORR(c,S) {
		if(c=='R') c=0;
		if(c=='G') c=1;
		if(c=='B') c=2;
	}
	
	FOR(i,N) {
		FOR(j,8) {
			dp[i+1][j]+=dp[i][j];
			if((j&(1<<S[i]))==0) dp[i+1][j|(1<<S[i])]+=dp[i][j];
		}
	}
	ll ret=dp[N][7];
	FOR(i,N) {
		for(j=1;j<=N;j++) {
			x=i-j;
			y=i+j;
			if(x<0 || y>=N) break;
			if(S[i]!=S[x]&&S[i]!=S[y]&&S[x]!=S[y]) ret--;
		}
	}
	cout<<ret<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); 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 rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int n;
  	cin >>n;
  	string s;
  	cin >>s;
  long int cr=0,cg=0,cb=0,ans=0,count=0;
  
  rep(i,n){
   if(s[i]=='R'){cr++;}
   if(s[i]=='B'){cb++;}
	if(s[i]=='G'){cg++;}
  }
 
  for(long int d;d<=n/2;d++){
  	for(long int i=0;i+2*d<n;i++){
    long int j=i+d,k=i+2*d;
    if(s[i]!=s[j]&&s[k]!=s[j]&&s[i]!=s[k])
    	{count++;}
    }
  } 
  cout<<cb*cr*cg-count<<endl;
}

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

#include <iostream>
#include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int main()
{
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  string s;
  long long x = 0;
  int slen;
  cin >> slen >> s;
  vector<int> r;
  vector<int> g;
  vector<int> b;
  for (int i = 0; i <slen; ++i)
    if (s[i] == 'R')
      r.emplace_back(i)
    else if (s[i] == 'G')
      g.emplace_back(i);
  	else
      b.emplace_back(i);
  for (auto i: r)
  {
    for (auto j: b)
    {
      for (auto k: g)
      {
        int mx = max(max(i, j), k);
        int mn = min(min(i, j), k);
        int md = j+i+k-mx-mn;
        if (md-mn != mx-md)
          ++x;
      }
    }
  }
  
  
  cout <<x <<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: expected ';' before 'else'
   19 |       r.emplace_back(i)
      |                        ^
      |                        ;
   20 |     else if (s[i] == 'G')
      |     ~~~~
Language: C

from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin


def main2():
    res = 0
    n = int(input())
    s = str(input())
    for i in range(n):
        for j in range(i+1, n):
            if s[i] == s[j]:
                continue
            else:
                for k in range(j+1, n):
                    if s[i] == s[k] or s[j] == s[k]:
                        continue
                    if j - i == k - j:
                        continue
                    res += 1
    print(res)


def main():
    res = 0
    n = int(input())
    s = str(input())
    r = [i for i in range(n) if s[i] == "R"]
    g = [i for i in range(n) if s[i] == "G"]
    b = [i for i in range(n) if s[i] == "B"]

    for i in range(n):
        if s[i] == "R":
            res += sum(x > i for x in g) * sum(x > i for x in b)
        elif s[i] == "G":
            res += sum(x > i for x in r) * sum(x > i for x in b)
        elif s[i] == "B":
            res += sum(x > i for x in r) * sum(x > i for x in g)
        for j in range(i+1, n):
            k = (j-i)+j
            if k >= n:
                continue
            if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
                res -= 1
    print(res)


def input(): return stdin.readline().rstrip()


main()


Compiler output:
main.c:1:1: error: unknown type name 'from'
    1 | from collections import defaultdict, Counter
      | ^~~~
main.c:1:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    1 | from collections import defaultdict, Counter
      |                  ^~~~~~
main.c:1:18: error: unknown type name 'import'
Language: C++

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

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  long long int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(k=j+1;k<n;k++){
        if(((s[i]!=s[j]&&s[j]!=s[k])&&s[i]!=s[k])&&j-i!=k-j){
          ans-ans+1;
        }
      }
    }
    cout<<ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'k' was not declared in this scope
   13 |       for(k=j+1;k<n;k++){
      |           ^
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,ans;
  cin>>n;
  string str;
  cin>>str;
  ans=0;
  for(int i=1;i<=(n-2);i++){
    for(int j=i+1;j<=(n-1);j++){
      for(int k=j+1;k<=n;k++){
        if ((str.at(i-1) !=  str.at(j-1)) && (str.at(i-1) !=  str.at(k-1)) && (str.at(j-1) !=  str.at(k-1)) && (j-i)!=(k-j)) {
          ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
}
}

Compiler output:
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
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[i];
}

int count = 0;
for(int a = 0;a < n-2;a++){
	for(int b = a+1;b< n-1;b++){
	for(int c = b+1;a < n;c++){
	if((a+c)/2!=b&&(a+c)%2!=0&&s[a] != s[b]&&s[a] != s[c] &&s[b] == s[c]){
		count++;
	}
	}
	}
}

cout << count <<endl;
}

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


#include <bits/stdc++.h>
using namespace std;
 
int main()
{
  int N;
  cin >> N;
  string S;
  cin >> S;
  
  int count = 0;
 
  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.at(i) != S.at(j) && S.at(j) != S.at(k) && S.at(k) != S.at(i) && j-i != k-j)
        count ++;
    }
   }
  }
  cout << count << endl;
  
}

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

#include<stdio.h>
#include<stdlib.h>
#include<math.h>


int main(){

  int N;
  scanf("%d",&N);


  char A[N];
  scanf("%s",A);
  

  /*
  int A[N];
  int i;
  for(i=0;i<N;i++){
   scanf("%d",&A[i]);
   }
  */
  int i,j,k;
  long long int counter;
  counter =0;

for(k=3;k<=N;k++){
  for(j=2;j<k;j++){
    for(i=1;i<j;i++){
     if(j-i = k-j){
     }
     else if(A[i-1]=A[j-1] ){
     }
      else if(A[i-1] = A[k-1]){
      }
     else if(A[j-1] = A[k-1]){
     }
     else{
       counter +=1;
     }

     
     
     
    }
  }
}
printf("%lld",counter);






 return(0);
 }


Compiler output:
main.c: In function 'main':
main.c:30:13: error: lvalue required as left operand of assignment
   30 |      if(j-i = k-j){
      |             ^
Language: C

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

int z (int x,int y){
  if (x<y){
    return y-x;
  }
  else{
    return x - y;
  }
}

int main() {
  int N;
  string str;
  cin >> N >> str;
  int64_t sum = 0;
  
  vector<int> vec_R(0);
  vector<int> vec_G(0);
  vector<int> vec_B(0);
  
  for (int i = 0; i < N; i++){
    if (str.at(i) == 'R'){
      vec_R.push_back(i);
    }
    else if (str.at(i) == 'G'){
        vec_G.push_back(i);
    }
    else {
        vec_B.push_back(i);
    }
  }
  
  for (int i : vec_R){
    for (int j : vec_G){
      for (int k : vec_B){
        if ( z(i,j) != z(j,k) && z(j,k) != z(k,i) && z(i,j) != z(k,i)){
          sum++;
        }
      }
    }
  }
  
  cout << sum <<endl;
}




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

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

int main(){
  int n;
  long int count=0;
  cin>>n;
  char *str=new char[n];
  cin>>str;
  for(int i=0;i<strlen(str);i++){
    for(int j=i+1;j<strlen(str);j++){
    for(int k=j+1;k<strlen(str);k++){
      if(i<j&&j<k){
     if(str[i]!=str[j]&&str[i]!=str[k]&&str[j]!=str[k]){
       if((j-i)!=(k-j))
          count++;
     }
    }
  }
  }
  }
  cout<<count;
  delete[] str;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'strlen' was not declared in this scope
   11 |   for(int i=0;i<strlen(str);i++){
      |                 ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C++

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

typedef unsigned long long ull;

int ind(char ch)
{
    switch (ch) {
    case 'R':
        return 0;
    case 'G':
        return 1;
    case 'B':
        return 2;
    default:
        return 3;
    }
}

bool f(const string &s, int a, int b, int c)
{
    int t[3] = {0,0,0};
    t[ind(s[a])] = 1;
    t[ind(s[b])] = 1;
    t[ind(s[c])] = 1;
    return t[0] == 1 && t[1] == 1 && t[2] == 1;
}

int main()
{
    ios_base::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;

    vector<int> v[3];
    for (int i = 0; i < N; ++i) {
        v[ind(S[i])].push_back(i);
    }

    if (v[0].size() == 0 ||
        v[1].size() == 0 ||
        v[2].size() == 0) {
        cout << 0 << endl;
        return 0;
    }

    unsigned long long cnt = 0;

    for (int dist = 1; dist < N; ++dist) {
        for (int i = 0; i + (2*dist) < N; ++i) {
            if (f(S, i, i+dist, i+(2*dist))) {
                ++cnt;
            }
        }
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:56:6: error: expected '}' at end of input
   56 |     }
      |      ^
a.cc:30:1: note: to match this '{'
   30 | {
      | ^
Language: C

#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#include<iomanip>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const ll INF=1e18;

int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    
    ll ans=0;
    for(int i=0;i<n-3;i++)
    {
        map<char,int> c;

        for(int j=i+1;j<n;j++)
        {
            if(s[i]=='R')
            {
                if(s[j]=='G' && j-i>2)
                {
                    ans+=c['B'];
                    if((j-i)%2==0 && s[(i+j)/2]=='B')
                    {
                        ans--;
                    }
                    
                }
                else if(s[j]=='B' && j-i>2)
                {
                    ans+=c['G'];
                    if((j-i)%2==0 && s[(i+j)/2]=='G')
                    {
                        ans--;
                    }
                    
                }

            }
            else if(s[i]=='G')
            {
                if(s[j]=='R' && j-i>2)
                {
                    ans+=c['B'];
                    if((j-i)%2==0 && s[(i+j)/2]=='B')
                    {
                        ans--;
                    }
                    
                }
                else if(s[j]=='B' && j-i>2)
                {
                    ans+=c['R'];
                    if((j-i)%2==0 && s[(i+j)/2]=='R')
                    {
                        ans--;
                    }
                    
                }
                
            }
            else
            {
                if(s[j]=='G' && j-i>2)
                {
                    ans+=c['R'];
                    if((j-i)%2==0 && s[(i+j)/2]=='R')
                    {
                        ans--;
                    }
                    
                }
                else if(s[j]=='R' && j-i>2)
                {
                    ans+=c['G'];
                    if((j-i)%2==0 && s[(i+j)/2]=='G')
                    {
                        ans--;
                    }
                    
                }
                
            }
            c[s[j]]++;
            
            
        }
    }
    cout<<ans;
}

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

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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;

#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<(n);i++)
#define all(x) (x).begin(),(x).end()
constexpr auto INF = 500000000000000;
constexpr auto MOD = 1000000007;


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

	vi r = {}, g = {}, b = {};

	rep(i, n){
		if (s[i] == 'R')r.push_back(i);
		if (s[i] == 'G')g.push_back(i);
		if (s[i] == 'B')b.push_back(i);
	}
	ll ans=0;

	rep(i, r.size())rep(j, g.size()) {

		if (b.size() == 0)break;

		ans += b.size();

		if ((r[i] + g[j]) % 2 == 0 && s[(r[i] + g[j]) / 2] == 'B')ans--;
		
		int le = min(r[i], g[j]) - abs(r[i] - g[j]);
		int ri = max(r[i], g[j]) + abs(r[i] - g[j]);

		if (n - 1 >= le && le >= 0)if (s[le] == 'B') ans--;
		if (0 <= ri && ri <= n - 1)if (s[ri] == 'B') 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 ll long long
int main(){
  int n;
  string s;
  cin>>n>>s;
  vector<int> r,g,b;
  for(int i = 0; i<n; i++){
    if(s[i] == 'R')r.push_back(i);
    if(s[i] == 'G')g.push_back(i);
    if(s[i] == 'B')b.push_back(i);
  }
  ll ans = (r.size()*g.size()*b.size());
  for(auto it:r){
    for(auto itr:g){
        int z = max(it,itr);
        auto itrr = b.find(2*z-min(it,itr));
        if(itrr == b.end())continue;
        else if(*itrr>z)ans-=1;
    }
  }
  for(auto it:r){
    for(auto itr:b){
        int z = max(it,itr);
        auto itrr = g.find(2*z-min(it,itr));
        if(itrr == g.end())continue;
        else if(*itrr>z)ans-=1;
    }
  }
  for(auto it:b){
    for(auto itr:g){
        int z = max(it,itr);
        auto itrr = r.find(2*z-min(it,itr));
        if(itrr == r.end())continue;
        else if(*itrr>z)ans-=1;
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: 'class std::vector<int>' has no member named 'find'
   18 |         auto itrr = b.find(2*z-min(it,itr));
      |                       ^~~~
a.cc:26:23: error: 'class std::vector<int>' has no member named 'find'
   26 |         auto itrr = g.find(2*z-min(it,itr));
      |                       ^~~~
a.cc:34:23: error: 'class std::vector<int>' has no member named 'find'
   34 |         auto itrr = r.find(2*z-min(it,itr));
      |                       ^~~~
Language: C++

#include<iostream>
using namespace std;

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

    cout << r * b * c - exp << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'c' was not declared in this scope
   32 |     cout << r * b * c - exp << endl;
      |                     ^
Language: C++

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

int main(){
  int n;
  long int count=0;
  cin>>n;
  char *str=new char[n];
  cin>>str;
  for(int i=0;i<strlen(str);i++){
    for(int j=i+1;j<strlen(str);j++){
    for(int k=j+1;k<strlen(str);k++){
      if(i<j&&j<k){
     if(str[i]!=str[j]&&str[i]!=str[k]&&str[j]!=str[k]){
       if((j-i)!=(k-j))
          count++;
     }
    }
  }
  }
  }
  cout<<count;
  delete[] str;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: 'strlen' was not declared in this scope
   11 |   for(int i=0;i<strlen(str);i++){
      |                 ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: C

#include <bits/stdc++.h>

#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define FILL0(x) memset(x,0,sizeof(x))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 

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

    ll ans=0;
    vector<P> preans;
    for(int i=0; i<N-2; i++)
    {
        for(int j=i+1; j<N-1; j++)
        {
            if(S[i]!=S[j])
                preans.push_back(P(i, j));
        }
    }

for(ll cnt=0;cnt<preans.size(); cnt++)
{
    P ij = preans[cnt];
 
    int i=ij.first;
    int j=ij.second;
    
    for(int k=j+1; k<N; k++)
    {
        if(S[i]!=S[k]&&S[k]!=S[j])
            if((j-i)!=(k-j))
                ans++;
    }          
       
}
     

    cout << ans << endl;
    
 

 

 

    return 0;
}
 

//cout << setprecision(13);
//next_permutation();
//__gcd();
//reverse();
//set ,tuple ,pair;
//bitset
//vector.find



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

// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
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;}
// clang-format on

void solve(long long N, std::string S) {
  vector<int> r, g, b;
  ll ans = 0;
  for (ll i = 0; i < N - 2; ++i) {
    for (ll j = i + 1; j < N - 1; ++j) {
      if (S[i] == S[j])
        continue;
      for (ll k = j + 1; k < N; ++k) {
        if (S[j] == S[k] || S[i] == S[k])
          continue;
        if (k - j != j - i)
          ++ans;
      }
    }
  }
  ANS(ans);
}

// clang-format off
int main() {
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
  return 0;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:186:14: note: called from here
  186 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~