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

#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli gcd(lli num1, lli num2){
    return num2 != 0 ? gcd(num2, num1 % num2) : num1;
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,R,X,Y,Z,W,H,sum=0,num=0,flag=0;string S,T;
  cin >> N >> S;
  DV(P,bool,3,N,0);
  DV(Q,lli,3,N,0);
  rep(i,0,N){
    if(i>0){
      Q[0][i]+=Q[0][i-1];
      Q[1][i]+=Q[1][i-1];
      Q[2][i]+=Q[2][i-1];
    }
    if(S[i]=='R'){
      P[0][i]=1;
      Q[0][i]++;
    }
    if(S[i]=='G'){
      P[1][i]=1;
      Q[1][i]++;
    }
    if(S[i]=='B'){
      P[2][i]=1;
      Q[2][i]++;
    }
  }
  rep(i,0,N-2)rep(j,i+1,N-1){
    if(P[0][i]&&P[1][j]||P[1][i]&&P[0][j]){
      sum+=Q[2][N-1]-Q[2][j];
      H=j-i;
      if(P[2][j+H])num++;
    }
    else if(P[1][i]&&P[2][j]||P[2][i]&&P[1][j]){
      sum+=Q[0][N-1]-Q[0][j];
      H=j-i;
      if(P[0][j+H])num++;
    }
    else if(P[0][i]&&P[2][j]||P[2][i]&&P[0][j]){
      sum+=Q[1][N-1]-Q[1][j];
      H=j-i;
      if(P[1][j+H])num++;
    }
  }
  Out(R*G*B-num);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:9: error: 'G' was not declared in this scope
   71 |   Out(R*G*B-num);
      |         ^
a.cc:12:24: note: in definition of macro 'Out'
   12 | #define Out(S) cout << S << endl
      |                        ^
Language: C++

clude<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    cin>>n;
    string s;
    cin>>s;
    map<char, int> mp;
    rep(i, n) mp[s[i]]++;
    ll ans = 1;
    int t=0;
    for(auto p : mp){
        ans*=p.second;
        t++;
    }
    if(t!=3) {
        cout<<0<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++){
        rep(j, n){
            int a, b, c;
            a=j;
            b=j+i;
            c=j+2*i;
            if(c>=n) continue;
            if(s[a]!=s[b] && s[b]!=s[c] && s[a]!=s[c]) ans--;
        } 
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude<bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin>>n;
      |     ^~~
a.cc:9:5: error: 'string' was not declared in this scope
    9 |     string s;
      |     ^~~~~~
a.cc:10:10: error: 's' was not declared in this scope
   10 |     cin>>s;
      |          ^
a.cc:11:5: error: 'map' was not declared in this scope
   11 |     map<char, int> mp;
      |     ^~~
a.cc:11:9: error: expected primary-expression before 'char'
   11 |     map<char, int> mp;
      |         ^~~~
a.cc:12:15: error: 'mp' was not declared in this scope
   12 |     rep(i, n) mp[s[i]]++;
      |               ^~
a.cc:15:18: error: 'mp' was not declared in this scope; did you mean 'p'?
   15 |     for(auto p : mp){
      |                  ^~
      |                  p
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout<<0<<endl;
      |         ^~~~
a.cc:20:18: error: 'endl' was not declared in this scope
   20 |         cout<<0<<endl;
      |                  ^~~~
a.cc:33:5: error: 'cout' was not declared in this scope
   33 |     cout<<ans<<endl;
      |     ^~~~
a.cc:33:16: error: 'endl' was not declared in this scope
   33 |     cout<<ans<<endl;
      |                ^~~~
Language: C

#include <iostream>
#include <vector>
#include<string>

using namespace std;

int main() {
	int N;
	string S;
	cin >> N >> S;
	int count = 0;
	for (int i = 0; i < N-2; i++) {
		for (int j = i+1; j < N-1 ; j++) {
			if (S.at(i) != S.at(j)) {
				string part = S.substr(2 * j - i + 1);
				for (int k = 1; k < (N - 2 * j + i - 1); k++) {
					if (S.at(i) != S.at(j) && S.at(i) != S.at(k) && S.at(k) != S.at(j)) {
						count++
					}
				}
			}
		}
	}
	cout << count << endl;
}

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

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

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

//long long
using ll = long long;

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

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

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

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

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


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

int ans = cnt1 * cnt2 * cnt3;

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:50:19: error: 'N' was not declared in this scope
   50 |     for(int i=0;i<N;i++){
      |                   ^
a.cc:51:12: error: 'S' was not declared in this scope
   51 |         if(S[i]=='R') cnt1++;
      |            ^
a.cc:52:12: error: 'S' was not declared in this scope
   52 |         if(S[i]=='G') cnt2++;
      |            ^
a.cc:53:12: error: 'S' was not declared in this scope
   53 |         if(S[i]=='B') cnt3++;
      |            ^
a.cc:56:5: error: conflicting declaration 'int ans'
   56 | int ans = cnt1 * cnt2 * cnt3;
      |     ^~~
a.cc:48:6: note: previous declaration as 'll ans'
   48 |   ll ans = 0;
      |      ^~~
Language: C

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

using namespace std;

int main() {
    map<char, int> m;
    m['R'] = 0;
    m['G'] = 1;
    m['B'] = 2;
    int N;
    string S;
    cin >> N >> S;
    vector<bool> rgb(3);
    int count = 0;
    for(int i = 0; i < N; i++) {
        if(S.at(i) == 'R') {
            rgb.at(0) = true;
            rgb.at(1) = false;
            rgb.at(2) = false;
        } else if(S.at(i) == 'G') {
            rgb.at(0) = false;
            rgb.at(1) = true;
            rgb.at(2) = false;
        } else if(S.at(i) == 'B') {
            rgb.at(0) = false;
            rgb.at(1) = false;
            rgb.at(2) = true;
        }
        for(int j = i + 1; j < N; j++) {
            if(rgb.at(m[S.at(j)]) == true) {
                continue;
            }
            rgb.at(m[S.at(j)]) = true;
            for(int k = j + 1; k < N; k++) {
                if(rgb.at(m[S.at(k)]) == false) {
                    if(k - j != j - i) {
                        count++;
                    }
                }
            }
            rgb.at(m[S.at(j)]) = false;
        }
    }
    cout << count << endl;
}

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

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

int main() {
int k;
  cin>>k
  
  string a;
  cin>>a;
  int m=0;
  for(int i=0;i<k;i++){for(int j=0;j<i;j++){for(int h=0;h<j&&h!=2*j-i;h++){
  if(a.at(i)!=a.at(j)&&a.at(h)!=a.at(j)&&a.at(i)!=a.at(h)){m++;}
  }}}

  cout<<m<<endl;
  
 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected ';' before 'string'
    7 |   cin>>k
      |         ^
      |         ;
    8 | 
    9 |   string a;
      |   ~~~~~~ 
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   cin>>a;
      |        ^
Language: C

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

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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:14:57: error: expected ')' before '{' token
   14 |           if ((S.at(i) != S.at(k) && S.at(j) != S.at(k)){
      |              ~                                          ^
      |                                                         )
a.cc:19:9: error: expected primary-expression before '}' token
   19 |         }
      |         ^
Language: C++

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

int main() {
  int n;
  string a;
  cin >> n >> a;
  int r=0;
  int g=0;
  int b=0;  
  for(int i=0;i<n;i++){  
  if(a.at(i)=='R'){
  r++;
  }
  else if(a.at(i)=='G'){
  g++;
  }
  else if(a.at(i)=='B'){
  b++;
  }  
  }
  int m=r*g*b;
  for(int i=1;i<n;i++){
    for(int j=1;j<min(i,n-i);j++){ 
    if(a.at(i)==a.at(i-j) || a.at(i)==a.at(i+j){
    m--;  
    }
    }
  }
  cout << m << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:48: error: expected ')' before '{' token
   25 |     if(a.at(i)==a.at(i-j) || a.at(i)==a.at(i+j){
      |       ~                                        ^
      |                                                )
a.cc:28:5: error: expected primary-expression before '}' token
   28 |     }
      |     ^
Language: Java

import java.util.*;

class Judge{
  boolean jud(char str1,char str2,char str3,int a,int b,int c){
    if(b-a==c-b)
      return false;
    if(a!=b&&a!=c&&b!=c){
      return true;
    }
    else
      return false;
  }
}

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    char s[n] = sc.next();
    int pair = 0;
    Judge judge = new Judge();
    for(int k=3;k<=n;k++){
      for(int j=2;j<k;j++){
        for(int i=1;i<j;i++){
          if(judge.jud(s[i],s[j],s[k],i,j,k))
            pair++;
        }
      }
    }
    System.out.println(pair);
  }
}

Compiler output:
Main.java:19: error: ']' expected
    char s[n] = sc.next();
           ^
Main.java:19: error: ';' expected
    char s[n] = sc.next();
            ^
2 errors
Language: C++

if (c3[0] == s[k]) {
						if (flag == 1) {
							count += 1;
						}
						else if ( num1 != (k - j)) {
							count += 1;
						}
						///*if ((j - i) != (k - j)) {
						//	coun*/t += 1;
						//}
					}

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'if'
    1 | if (c3[0] == s[k]) {
      | ^~
Language: C

#include<stdio.h>

int main() {
	int n, p = 0;
	char s[4001];
	scanf("%d", &n);
	scanf("%s", &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[j] != s[k] && s[k] != s[i]) {
					if (j - i != k - j) {
						p = p + 1;
					}
				}
			}
		}
	}
	printf("%d", p);

Compiler output:
main.c: In function 'main':
main.c:19:9: error: expected declaration or statement at end of input
   19 |         printf("%d", p);
      |         ^~~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
const int inf = 1 << 30;
const ll linf = 1e18;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N;
ll ans = 0;
string S;
set<int> R, G, B;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> S;
    for(int i = 0; i < N; i++){
        if(S[i] == 'R') R.insert(i);
        if(S[i] == 'G') G.insert(i);
        if(S[i] == 'B') B.insert(i);
    }
    for(auto u : R){
        for(auto v : G){
            int x = max(u, v);
            int y = min(u, v);
            ans += B.size();
            int d = x - y;
            if(B.find(x + d) != B.end()) ans--;
            if(d % 2 == 0 && B.find(y + (d / 2)) != B.end()) ans--;
            if(B.find(y - d) != B.end()) ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int r=0;
  int g=0;
  int b=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='R')
      r++
    if(S.at(i)=='G')
      g++
    if(S.at(i)=='B')
      b++
  }
  int y=0;
  for(int i=0;i<N;i++){
    int yey = (N-1-i)/2;
    for(int j=1;j<=yey;j++){
      if(S.at(i)==S.at(i+j))
        continue;
      if(S.at(i)==S.at(i+j+j))
        continue;
      if(S.at(i+j)==S.at(i+j+j))
        continue;
      y++;
    }
  }
  cout << r*g*b-y << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: expected ';' before 'if'
   13 |       r++
      |          ^
      |          ;
   14 |     if(S.at(i)=='G')
      |     ~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin>>N>>S;
  int count=0;
  for(int i=1;i<=N;++i) {
    for(int j=i+1;j<=N;++j) {
      for(int k=j+1;k<=N;++k) {
        if(j-i!=k-j) {
          if(S.at(i-1)!=S.at(j-1)&&S.at(i-1)!=S.at(k-1)&&S.at(j-1)!=S.at(k-1)) count++;

        }
      }
    }
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:17:4: error: expected '}' at end of input
   17 |   }
      |    ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

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

using ll=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  ll ans = 0;
  int cnt[n][3];
  int numR=1;
  int numG=1;
  int numB=1;
  rep(i,n){
    if(s[i] =='R') {
      cnt[i][0] += numR;
      numR++;
    }
    if(s[i] =='G') {
      cnt[i][1] += numG;
      numG++;
    }
    if(s[i] =='B') {
      cnt[i][2] += numB;
      numB++;
    }
  for(int i = 0; i<n; i++){
    for(int j = i+1; j<n; j++){
      char I = s[i];
      char J = s[j];
      if(I==J) continue;     
      int res = 0;
      bool judge = 0;
      if(2*j-i<n) judge = 1;
      
      if(I=='R'&&J=='G') {
        res = cnt[n-1][2]-cnt[j][2];
        if(judge) if(s[2*j-i]=='B') res--;
      }
      else if(I=='G'&&J=='R') {
        res = cnt[n-1][2]-cnt[j][2];
        if(judge) if(s[2*j-i]=='B') res--;
      }
      else if(I=='R'&&J=='B') {
        res = cnt[n-1][1]-cnt[j][1];
        if(judge) if(s[2*j-i]=='G') res--;
      }
      else if(I=='B'&&J=='R') {
        res = cnt[n-1][1]-cnt[j][1];
        if(judge) if(s[2*j-i]=='G') res--;
      }
      else if(I=='B'&&J=='G') {
        res = cnt[n-1][0]-cnt[j][0];
        if(judge) if(s[2*j-i]=='R') res--;
      }
      else if(I=='G'&&J=='B') {
        res = cnt[n-1][0]-cnt[j][0];
        if(judge) if(s[2*j-i]=='R') res--;
      }
      
      ans += res;
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:2: error: expected '}' at end of input
   71 | }
      |  ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: C

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    long long ans = 0;
    vector<int> red, green, blue;
    red.at(0) = 0;
    green.at(0) = 0;
    blue.at(0) = 0;
    for (int i = 1; i < n; i++)
    {
        if (s.at(i) == 'R')
        {
            red.at(i) = red.at(i - 1) + 1;
        }
        else if (s.at(i) == 'G')
        {
            green.at(i) = green.at(i - 1) + 1;
        }
        else
        {
            blue.at(i) = blue.at(i - 1) + 1;
        }
    }

    rep(i, n)
    {

        if (s.at(i) == 'R')
        {
            ans += blue.at(i) * (green.at(n - 1) - green.at(i)) + green.at(i) * (blue.at(n - 1) - blue.at(i));
            rep(j, i)
            {
                if (s.at(j) == 'G' && s.at(2 * i - j) == 'B')
                {
                    ans--;
                }
                if (s.at(j) == 'B' && s.at(2 * i - j) == 'G')
                {
                    ans--;
                }
            }
        }
        if (s.at(i) == 'G')
        {
            ans += blue.at(i) * (red.at(n - 1) - red.at(i)) + green.at(i) * (blue.at(n - 1) - blue.at(i));
            rep(j, i)
            {
                if (s.at(j) == 'R' && s.at(2 * i - j) == 'B')
                {
                    ans--;
                }
                if (s.at(j) == 'B' && s.at(2 * i - j) == 'R')
                {
                    ans--;
                }
            }
        }
        if (s.at(i) == 'B')
        {
            ans += green.at(i) * (red.at(n - 1) - red.at(i)) + green.at(i) * (red.at(n - 1) - red.at(i));
            rep(j, i)
            {
                if (s.at(j) == 'G' && s.at(2 * i - j) == 'R')
                {
                    ans--;
                }
                if (s.at(j) == 'R' && s.at(2 * i - j) == 'G')
                {
                    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 <iostream>
#include <algorithm>
#include<vector>
//----***やべーやつら***----
using namespace std;


//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)


//----***定数***----
#define MOD 1e9+7;
#define INF 1e9;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }




int main(){
  ll N;
  string S;
  cin>>N>>S;
  vector<ll> R_num(N),G_num(N),B_num(N);
  if(S.at(N-1)=='R')R_num[N-1]=1;
  if(S.at(N-1)=='G')G_num[N-1]=1;
  if(S.at(N-1)=='B')B_num[N-1]=1;
  RREP(i,N-1,-1){
    if(S.at(i)=='R'){
      R_num[i]=R_num[i+1]+1;
    }
    else{
      R_num[i]=R_num[i+1];
    }
    if(S.at(i)=='G'){
      G_num[i]=G_num[i+1]+1;
    }
    else{
      G_num[i]=G_num[i+1];
    }
    if(S.at(i)=='B'){
      B_num[i]=B_num[i+1]+1;
    }
    else{
      B_num[i]=B_num[i+1];
    }
  }
  ll ans=0;
  char target;
  REP(i,0,N-2)REP(j,i+1,N-1){
    if(S.at(i)==S.at(j))continue;
    if (S.at(i)=='R'&&S.at(j)=='B'){target='G';}
    else if (S.at(i)=='B'&&S.at(j)=='R'){target='G';}
    else if(S.at(i)=='R'&&S.at(j)=='G'){target='B';}
    else if(S.at(i)=='G'&&S.at(j)=='R'){target='B';}
    else if(S.at(i)=='G'&&S.at(j)=='B'){target='R';}
    else if(S.at(i)=='B'&&S.at(j)=='G'){target='R';}

      {
        if(target=='R'){
          ans+=R_num[j+1];
        }
        if(target=='B'){
          ans+=B_num[j+1];
        }
        if(target=='G'){
          ans+=G_num[j+1];
        }
      }
      if(2*j-i<N&&S.at(2*j-i)==target){
        ans--;
      }

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

}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:8: error: 'i' was not declared in this scope
   44 |   RREP(i,N-1,-1){
      |        ^
a.cc:44:3: error: 'RREP' was not declared in this scope; did you mean 'REP'?
   44 |   RREP(i,N-1,-1){
      |   ^~~~
      |   REP
Language: C++

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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int r=0;
  int g=0;
  int b=0;
  //RGBの数それぞれ数える
  
  for(int i=0; i<N; i++){
    if(S.at(i) == 'R'){
      r++;
    }
    if(S.at(i) == 'G'){
      g++;
    }
    if(S.at(i) == 'B'){
      b++;
    }
  }
  
  vector<int> R(r);
  vector<int> G(g);
  vector<int> B(b);
  
  int r=0;
  int g=0;
  int b=0;
  
  for(int i= 0; i<N; i++){
    if(S.at(i) == 'R'){
      R.at(r) = i;
      r++;
    }
    if(S.at(i) == 'G'){
      G.at(g) = i;
      g++;
    }
    if(S.at(i) == 'B'){
      B.at(b) = i;
      b++;
    }
  }
  //RGBの位置をそれぞれ格納完了
  
  //Bのダメ位置をメモ
  vector<int> NG_B(2*r*g);
  int ng_count = 0;
  
  map<string,int> ng;
  
  
  for(int i=0; i<r; i++){
    int tmp_r=R.at(i);
    for(int j=0; j<g; j++){
      int tmp_g=G.at(j);
      int m=max(tmp_r, tmp_g);
      int n=min(tmp_r, tmp_g);
      
      if((tmp_r+tmp_g)%2==0){
        //偶数
        //NG_B(ng_count)=(tmp_r+tmp_g)/2;
        string tmpg= to_string((tmp_r+tmp_g)/2);
        ng[tmpg]=(tmp_r+tmp_g)/2;
        ng_count++;
      }
      if(2*m-n <=N-1 && 2*n-m >= 0){
        string tmpg = to_string(2*m-n);
        ng[tmpg] = 2*m-n;
        ng_count++;
        string tmpg = to_string(2*n-m);
        ng[tmpg] = 2*n-m;
        ng_count++;
      }
      if(2*m-n <=N-1 && 2*n-m < 0){
        string tmpg = to_string(2*m-n);
        ng[tmpg] = 2*m-n;
        ng_count++;
      }
      if(2*m-n >N-1 && 2*n-m >= 0){
        string tmpg = to_string(2*n-m);
        ng[tmpg] = 2*n-m;
        ng_count++;
      }
      
      if(2*m-n >N-1 && 2*n-m < 0){
      }
    }
  }
  
  for(int i=0; i++
    
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:7: error: redeclaration of 'int r'
   30 |   int r=0;
      |       ^
a.cc:9:7: note: 'int r' previously declared here
    9 |   int r=0;
      |       ^
a.cc:31:7: error: redeclaration of 'int g'
   31 |   int g=0;
      |       ^
a.cc:10:7: note: 'int g' previously declared here
   10 |   int g=0;
      |       ^
a.cc:32:7: error: redeclaration of 'int b'
   32 |   int b=0;
      |       ^
a.cc:11:7: note: 'int b' previously declared here
   11 |   int b=0;
      |       ^
a.cc:75:16: error: redeclaration of 'std::string tmpg'
   75 |         string tmpg = to_string(2*n-m);
      |                ^~~~
a.cc:72:16: note: 'std::string tmpg' previously declared here
   72 |         string tmpg = to_string(2*m-n);
      |                ^~~~
a.cc:95:19: error: expected ';' before '}' token
   95 |   for(int i=0; i++
      |                   ^
      |                   ;
......
   98 | }
      | ~                  
a.cc:98:1: error: expected primary-expression before '}' token
   98 | }
      | ^
a.cc:95:19: error: expected ')' before '}' token
   95 |   for(int i=0; i++
      |      ~            ^
      |                   )
......
   98 | }
      | ~                  
a.cc:98:1: error: expected primary-expression before '}' token
   98 | }
      | ^
Language: C++

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

int main() {
  int n;
    string str;
    cin >> n >> str;
    int count = 0;
    vector<int> r,g,b;
    for(int i=0; i<n; i++){
        if(str.at(i) == 'R'){
            r.push_back(i+1);
        }else if(str.at(i) == 'G'){
            g.push_back(i+1);
        }else{
            b.push_back(i+1);
        }
    }
    
    for(int a=0; a<r.size(); a++){
        for(int c=0; c<g.size(); c++){
            for(int d=0; d<b.size(); d++){
                int aa = r.at(a), cc = g.at(c), dd = b.at(d);
                vector<int> v;
                v.push_back(aa);
                v.push_back(cc);
                v.push_back(dd);
                v.sort(v.begin(),v.end());
                if(v.at(0)+v.at(2) -v.at(1)*2 != 0){
                  count++
                }
            }
        }
    }
    
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'class std::vector<int>' has no member named 'sort'
   28 |                 v.sort(v.begin(),v.end());
      |                   ^~~~
a.cc:30:26: error: expected ';' before '}' token
   30 |                   count++
      |                          ^
      |                          ;
   31 |                 }
      |                 ~
Language: C++

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

int main(){
  string str;
  int count;count=0;
  int N,i,j,k;cin>>N;
  cin>>str;
  int ss[N];

  for(i=0;i<N;i++){
    if(str.at(i)=='R')ss[i]=1;
    if(str.at(i)=='G')ss[i]=2;
    if(str.at(i)=='B')ss[i]=3;
  }

  for(i=0;i<N-3;i++){
    for(j=i+1;j<N-1;j++){
      for(k=j+1;j<N;j++){
        if(ss[i]*ss[j]*ss[k]==6&&j-i!=k-j)count++;
      }
    }
  }
  printf("%d\n",count);
}

  return 0;
}

Compiler output:
a.cc:29:3: error: expected unqualified-id before 'return'
   29 |   return 0;
      |   ^~~~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> r,g,b;
  for(int i = 0; i < n; ++i){
    if(s[i] == 'R') r.push_back(i+1);
    else if(s[i] == 'G') g.push_back(i+1);
    else b.push_back(i+1);
  }
  long long ans = 0;
  int I, J, K;
  int A = r.size();
  int B = g.size();
  int C = b.size();
  for(int i = 0; i < A; ++i){
    for(int j = 0; j < B; ++j){
      for(int k = 0; k < C; ++k){ 
        I = min(r[i], min(g[j], b[k]));
        if(I == r[i]){
          J = min(g[j],b[k]);
          K = max(g[j],b[k]);
        }
        else if(I == g[j]){
          J = min(r[i],b[k]);
          K = max(r[i],b[k]);
        }
        else{
          J = min(g[j],r[i]);
          K = max(g[j],r[i]);
        }
        if(J - I != K - J){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc:1:3: error: 'cin' does not name a type
    1 |   cin.tie(0);
      |   ^~~
a.cc:2:3: error: 'ios' does not name a type
    2 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:4:3: error: 'cin' does not name a type
    4 |   cin >> n;
      |   ^~~
a.cc:5:3: error: 'string' does not name a type
    5 |   string s;
      |   ^~~~~~
a.cc:6:3: error: 'cin' does not name a type
    6 |   cin >> s;
      |   ^~~
a.cc:7:3: error: 'vector' does not name a type
    7 |   vector<int> r,g,b;
      |   ^~~~~~
a.cc:8:3: error: expected unqualified-id before 'for'
    8 |   for(int i = 0; i < n; ++i){
      |   ^~~
a.cc:8:18: error: 'i' does not name a type
    8 |   for(int i = 0; i < n; ++i){
      |                  ^
a.cc:8:25: error: expected unqualified-id before '++' token
    8 |   for(int i = 0; i < n; ++i){
      |                         ^~
a.cc:15:11: error: 'r' was not declared in this scope
   15 |   int A = r.size();
      |           ^
a.cc:16:11: error: 'g' was not declared in this scope
   16 |   int B = g.size();
      |           ^
a.cc:17:11: error: 'b' was not declared in this scope
   17 |   int C = b.size();
      |           ^
a.cc:18:3: error: expected unqualified-id before 'for'
   18 |   for(int i = 0; i < A; ++i){
      |   ^~~
a.cc:18:18: error: 'i' does not name a type
   18 |   for(int i = 0; i < A; ++i){
      |                  ^
a.cc:18:25: error: expected unqualified-id before '++' token
   18 |   for(int i = 0; i < A; ++i){
      |                         ^~
a.cc:40:3: error: 'cout' does not name a type
   40 |   cout << ans << endl;
      |   ^~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

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

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

    int ans=0;
    /*
    for (int i=1;i<=n-2;i++) {
        for (int j=i+1;j<=n-1;j++) {
            if (str[i-1] != str[j-1]) {
                for (int k=j+1;k<=n;k++) {
                    if (j-i != k-j && str[j-1] != str[k-1] && str[i-1] != str[k-1]) {
                        ans++;
                    }
                }
            }
        }
    }
    */
    vector<int> red(n);
    vector<int> green(n);
    vector<int> blue(n);
    int red_count=0;
    int green_count=0;
    int blue_count=0;
    rep(i,n) {
        if (str[i] == 'R') {
            red[red_count] = i;
            red_count++;
        } else if (str[i] == 'G') {
            green[green_count] = i;
            green_count++;
        } else {
            blue[blue_count] = i;
            blue_count++;
        }
    }
    int notcount = 0;
    rep(i,red_count) {
        rep(j,green_count) {
            int bignum = max(red[i],green[j])
            if (str[bignum - abs(red[i]-green[j])] == 'B') {
                notcount++;
            }
        }
    }

    
    
    cout << red_count*blue_count*green_count-notcount << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:13: error: expected ',' or ';' before 'if'
   50 |             if (str[bignum - abs(red[i]-green[j])] == 'B') {
      |             ^~
Language: C++

#include <iostream>
#include <string>
#include <cmath>


using namespace std;


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

Compiler output:
a.cc:26:5: error: 'cout' does not name a type
   26 |     cout << sum << endl;
      |     ^~~~
a.cc:28:5: error: expected unqualified-id before 'return'
   28 |     return 0;
      |     ^~~~~~
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C

#include <stdio.h>

int main(void) {

	int n, i, r = 0, g = 0, b = 0, ans = 0, frg = 0;
	int rn[4000], gn[4000], bn[4000];
	char s[4001];

	scanf("%d", &n);
	scanf("%s", s);

	for (i = 0; i < n; i++) {
		if (s[i] == 'R') {
			rn[r] = i;
			r++;
		}
		else if (s[i] == 'G') {
			gn[g] = i;
			g++;
		}
		else {
			bn[b] = i;
			b++;
		}
	}
	for (r = 0; frg == 0; r++)
		for (g = 0; frg == 0; g++)
			for (b = 0; frg == 0; b++) {
				if (gn[g] - rn[r] != b[n] - gn[g]) ans++;
			}

	printf("%d\n", ans);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:29:55: error: subscripted value is neither array nor pointer nor vector
   29 |                                 if (gn[g] - rn[r] != b[n] - gn[g]) ans++;
      |                                                       ^
Language: C

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


int main() {
  int N;cin>>N;
  string S;cin>>S;
  long r=0,g=0,b=0;
  for(int i=0;i<N;i++){
    if(S[i]=='R'){r++;}
    if(S[i]=='G'){g++;}
    if(S[i]=='B'){b++;}
  }
  long cnt=0;
  int kankaku=1;
  int s=0;
  while(true){
    if(s+kankaku*2>=N){
      s=0;kankaku++;
      if(kankaku*2>=N)break;
    }
    if(S[s]=='R'&&S[s+kankaku]=='G'&&S[s+kankaku*2]=='B')cnt++;
    if(S[s]=='R'&&S[s+kankaku]=='B'&&S[s+kankaku*2]=='G')cnt++;
    if(S[s]=='G'&&S[s+kankaku]=='R'&&S[s+kankaku*2]=='B')cnt++;
    if(S[s]=='G'&&S[s+kankaku]=='B'&&S[s+kankaku*2]=='R')cnt++;
    if(S[s]=='B'&&S[s+kankaku]=='R'&&S[s+kankaku*2]=='G')cnt++;
    if(S[s]=='B'&&S[s+kankaku]=='G'&&S[s+kankaku*2]=='R')cnt++;
  }
  cout<<cnt<<endl;
  cout<<r*g*b-cnt<<endl;
}

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

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


int main() {
 int n, count = 0;
  string rgb;
  cin >> n >> rgb;
  
  vector<bool> r(n, false), g(n, false), b(n, false);
  vector<int> rpos(1, 0), gpos(1, 0), bpos(1, 0);
  for(int i = 0; i < n; i++){
    if(rgb.at(i) == 'R'){
      r.at(i) = true;
      rpos.at(rpos.size() - 1) = i + 1;
      rpos.push_back(0);
    }
    else if(rgb.at(i) == 'G'){
      g.at(i) = true;
      gpos.at(gpos.size() - 1) = i + 1;
      gpos.push_back(0);
    }
    else{
      b.at(i) = true;
      bpos.at(bpos.size() - 1) = i + 1;
      bpos.push_back(0);
    }
  }
  
  for(int i = 0; i < n; i++){
    for(int j = i + 1; j < n; j++){
      for(int k = j + 1; k < n; k++){
        if(j - i != k - j){
          if((r.at(i) && g. at(j) && b.at(k))
            || (r.at(i) && g. at(k) && b.at(j)
               || (r.at(j) && g. at(i) && b.at(k)
                  || (r.at(j) && g. at(k) && b.at(i)
                     || (r.at(k) && g. at(j) && b.at(i)
                        || (r.at(k) && g. at(i) && b.at(j))
            count++;
        }
      }
    }
  }
  
  cout << count << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:60: error: expected ')' before 'count'
   39 |                         || (r.at(k) && g. at(i) && b.at(j))
      |                                                            ^
      |                                                            )
   40 |             count++;
      |             ~~~~~                                           
a.cc:38:25: note: to match this '('
   38 |                      || (r.at(k) && g. at(j) && b.at(i)
      |                         ^
a.cc:40:20: error: expected ')' before ';' token
   40 |             count++;
      |                    ^
      |                    )
a.cc:37:22: note: to match this '('
   37 |                   || (r.at(j) && g. at(k) && b.at(i)
      |                      ^
a.cc:40:20: error: expected ')' before ';' token
   40 |             count++;
      |                    ^
      |                    )
a.cc:36:19: note: to match this '('
   36 |                || (r.at(j) && g. at(i) && b.at(k)
      |                   ^
a.cc:40:20: error: expected ')' before ';' token
   40 |             count++;
      |                    ^
      |                    )
a.cc:35:16: note: to match this '('
   35 |             || (r.at(i) && g. at(k) && b.at(j)
      |                ^
a.cc:40:20: error: expected ')' before ';' token
   40 |             count++;
      |                    ^
      |                    )
a.cc:34:13: note: to match this '('
   34 |           if((r.at(i) && g. at(j) && b.at(k))
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  int ans=0;
  queue<int> a;
  for (int i=0;i<n;++i){
    if(s.at(i)=='R'){
      a.push(i);
    }
  }
  for (int i=0;i<n;++i){
    if(s.at(i)=='R') continue;
    for(int k=0;k<n;++k){
      if(s.at(k)!=s.at(i)&&s.at(k)!='R'||a.front()-i!=k-a.front()){
        ans+=1;
      }
      a.pop;
    }
  }

  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: invalid use of non-static member function 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   21 |       a.pop;
      |       ~~^~~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:316:7: note: declared here
  316 |       pop()
      |       ^~~
Language: C

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo;
ll x[10010],y[10010];
string s,str;
int main(){
  cin>>n>>s;
  int lr,lg,lb,rr,rg,rb;
  for(int i=0;i<n;i++){
    lr=0,lg=0,lb=0,rr=0,rg=0,rb=0;
    if(s[i]=='R'){
          lg=count(s.begin(), s.begin()+i, 'G');

          lb=count(s.begin(), s.begin()+i, 'B');
          rg=count(s.begin()+i-1, s.end(), 'G');

          rb=count(s.begin()+i-1, s.end(), 'B');
    }
        if(s[i]=='G'){
    lr=count(s.begin(), s.begin()+i, 'R');
          lb=count(s.begin(), s.begin()+i, 'B');
          rr=count(s.begin()+i-1, s.end(), 'R');
          rb=count(s.begin()+i-1, s.end(), 'B');
    }
        if(s[i]=='B'){
    lg=count(s.begin(), s.begin()+i, 'G');
          lr=count(s.begin(), s.begin()+i, 'R');
          rg=count(s.begin()+i-1, s.end(), 'G');
          rr=count(s.begin()+i-1, s.end(), 'R');
    }
    for(int j=1;j<n;j++){
      if(i-j>=0&&i+j<n){
        if(s[i]=='R'){
          if((!(s[i-j]=='G'&&s[i+j]=='B'))&&(!(s[i-j]=='B'&&s[i+j]=='G'))){
            ans--;
          }
        }
        if(s[i]=='G'){
          if((!(s[i-j]=='R'&&s[i+j]=='B'))&&(!(s[i-j]=='B'&&s[i+j]=='R'))){
            ans--;
          }
        }
        if(s[i]=='B'){
          if((!(s[i-j]=='G'&&s[i+j]=='R'))&&(!(s[i-j]=='B'&&s[i+j]=='R'))){
            ans--;
          }
        }
      }
    }
    if(s[i]=='R')ans+=(lg*rb+rg*lb);
    if(s[i]=='G')ans+=(lr*rb+rr*lb);
    if(s[i]=='B')ans+=(lg*rr+rg*lr);
  }
  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.
Language: C++

#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main() {
    int N, R = 0, G = 0, B = 0;
    long long wa = 0,s=0;
    char szBuf[10000] = { 'R' };
    cin >> N;
    cin >> szBuf;
    for (int x = 0; x < N; x++) {
        if (szBuf[x] == 'R')R++; 
        if (szBuf[x] == 'G')G++;
        if (szBuf[x] == 'B')B++;
    }
    wa =long long(long long(R) * long long(G) * long long(B));
    for (int x = 0; x < N; x++) {
        for (int y = x + 1; y < N; y++) {
            if (szBuf[x] == 'R' && szBuf[y] == 'G'&&szBuf[2 * y - x] == 'B')s++;
            if (szBuf[x] == 'R' && szBuf[y] == 'B'&&szBuf[2 * y - x] == 'G')s++;
            if (szBuf[x] == 'G' && szBuf[y] == 'B'&&szBuf[2 * y - x] == 'R')s++;
            if (szBuf[x] == 'G' && szBuf[y] == 'R'&&szBuf[2 * y - x] == 'B')s++;
            if (szBuf[x] == 'B' && szBuf[y] == 'R'&&szBuf[2 * y - x] == 'G')s++;
            if (szBuf[x] == 'B' && szBuf[y] == 'G'&&szBuf[2 * y - x] == 'R')s++;
        }
    }
    cout<<wa-s<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected primary-expression before 'long'
   19 |     wa =long long(long long(R) * long long(G) * long long(B));
      |         ^~~~
Language: C

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

bool judge(int i,int j,int k,string rgb){
    if(rgb.at(i) != rgb.at(j) && rgb.at(j) != rgb.at(k) && rgb.at(k) != rgb.at(i)){
        if((i + j + k) % 3 != 0){
            return true;
        }
    }
    return false;
}

int main() {
    int N;
    int count;
    cin >> N;
    bool flag =false;
    string rgb;
    cin >> rgb;
    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++){
                flag = judge(i,j,k,rgb);
                if(flag){
                    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;
  string S;
  cin >> N >> S;
  int ans = 0;
  char a, b;
  int c[N][N] = {};
  if(N ==1||N=2) {
    cout << 0;
    return 0;
  }
  for(int i=0;i<N-2;++i) {
    a = S[i];
    for(int j=i;j<N-1;++j) {
      if(a == S[j] || c[i][j] == 1) continue;
      b = S[j];
      for(int k=j;k<N;++k) {
        if((j-i)==(k-j)) continue;
        if(a==S[k]) continue;
        if(b==S[k]) {
        c[j][k] = 1;
        continue;
        }
      ++ans;
      }
    }
  }
  cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: lvalue required as left operand of assignment
   11 |   if(N ==1||N=2) {
      |      ~~~~~^~~
Language: C

#include <iostream>
#include <string>
#include <iomanip>
#include <numeric>
#include<vector>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<char> v;
  char x;
  vector<int> red;
  vector<int> green;
  vector<int> blue;
  for(int i=0;i<N;i++){
    cin >> x;
    v.push_back(x);
    if(x=='R'){
      red.push_back(i);
    }
    else if(x=='G'){
      green.push_back(i);
    }
    else{
      blue.push_back(i);
    }
  }
  int rcount=0;
  int bcount=0;
  vector<int> greenleft;
  vector<int> greenright;
  for(int i=0;i<N;i++){
    if(v[i]=='R'){
      rcount++;
    }
    else if(v[i]=='G'){
      greenleft.push_back(rcount);
    }
  }
  vector<int> greentmp;
  for(int i=N-1;i>=0;i--){
    if(v[i]=='B'){
      bcount++;
    }
    else if(v[i]=='G'){
      greentmp.push_back(bcount);
    }
  }
  for(int i=greentmp.size()-1;i>=0;i--){
    greenright.push_back(greentmp[i]);
  }
  int MAX=0;
  for(int i=0;i<green.size();i++){
    MAX+=greenleft[i]*greenright[i];
  }
  int nocount=0;
  for(int i=0;i<green.size();i++){
    for(int j=0;j<N/2+1;j++){
      if(v[green[i]-j]=='R'&&v[green[i]+j]=='B'){
        nocount++;
      }
      if(v[green[i]-j]!='R'&&v[green[i]+j]!='R'
         &&v[green[i]-j]!='G'&&v[green[i]+j]!='G'
        &&v[green[i]-j]!='B'&&v[green[i]+j]!='B'){
        break;
      }
    }
  }
  //cout << green[0] << nocount;
  int sum=MAX-nocount;
  cout << sum;
  cout << 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>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main(){
    int N;
    cin >> N;
    ll r = 0;
    ll g = 0;
    ll b = 0;
    string S;
    cin >> S;
    vl R(N), B(N), G(N);
    map<char , ll> map;

    for(int i=0; i<N; i++){
        map[S.at(i)] +=1;
        if(S.at(i) == 'R'){
            r++;
            R.at(i) += r;
            B.at(i) += b;
            G.at(i) += g;
        }
        else if(S.at(i) == 'B'){
            b++;
            R.at(i) += r;
            B.at(i) += b;
            G.at(i) += g;
        }
        else{
            g++;
            R.at(i) += r;
            B.at(i) += b;
            G.at(i) += g;
        }
    }
    if(N == 1 or N==2){
        cout << 0 << endl;
        return 0
    }

    ll c = 0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N-1; j++){
            if(S.at(i) == S.at(j)){
                continue;
            }
            else{
                if((S.at(i) == 'R' and S.at(j)== 'G') || (S.at(i) == 'G' and S.at(j)== 'R')){
                    c += map.at('B');
                    c -= B.at(j);
                    if(2*j-i < N){
                        if(S.at(2*j-i) == 'B'){
                            c--;
                        }
                    }
                }
                else if((S.at(i) == 'R' and S.at(j)== 'B') or (S.at(i) == 'B' and S.at(j)== 'R')){
                    c += map.at('G');
                    c -= G.at(j);
                    if(2*j-i < N){
                        if(S.at(2*j-i) == 'G'){
                            c--;
                        }
                    }
                }
                else{
                    c += map.at('R');
                    c -= R.at(j);
                    if(2*j-i < N){
                        if(S.at(2*j-i) == 'R'){
                            c--;
                        }
                    }
                }
            }
        }
    }

    cout << c << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:51:17: error: expected ';' before '}' token
   51 |         return 0
      |                 ^
      |                 ;
   52 |     }
      |     ~
Language: C++

#include <iostream>
#include <algorithm>
#include<vector>
//----***やべーやつら***----
using namespace std;


//----***型定義***----
using ll = long long;




int main(){
  ll N;
  string S;
  cin>>N>>S;
  vector<ll> R_num(N),G_num(N),B_num(N);
  if(S.at(N-1)=='R')R_num[N-1]=1;
  if(S.at(N-1)=='G')G_num[N-1]=1;
  if(S.at(N-1)=='B')B_num[N-1]=1;
  RREP(i,N-1,-1){
    if(S.at(i)=='R'){
      R_num[i]=R_num[i+1]+1;
    }
    else{
      R_num[i]=R_num[i+1];
    }
    if(S.at(i)=='G'){
      G_num[i]=G_num[i+1]+1;
    }
    else{
      G_num[i]=G_num[i+1];
    }
    if(S.at(i)=='B'){
      B_num[i]=B_num[i+1]+1;
    }
    else{
      B_num[i]=B_num[i+1];
    }
  }
  ll ans=0;
  char target;
  REP(i,0,N-2)REP(j,i+1,N-1){
    if(S.at(i)==S.at(j))continue;
    if (S.at(i)=='R'&&S.at(j)=='B'){target='G';}
    else if (S.at(i)=='B'&&S.at(j)=='R'){target='G';}
    else if(S.at(i)=='R'&&S.at(j)=='G'){target='B';}
    else if(S.at(i)=='G'&&S.at(j)=='R'){target='B';}
    else if(S.at(i)=='G'&&S.at(j)=='B'){target='R';}
    else if(S.at(i)=='B'&&S.at(j)=='G'){target='R';}

      {
        if(target=='R'){
          ans+=R_num[j+1];
        }
        if(target=='B'){
          ans+=B_num[j+1];
        }
        if(target=='G'){
          ans+=G_num[j+1];
        }
      }
      if(2*j-i<N&&S.at(2*j-i)==target){
        ans--;
      }

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

}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:8: error: 'i' was not declared in this scope
   22 |   RREP(i,N-1,-1){
      |        ^
a.cc:22:3: error: 'RREP' was not declared in this scope
   22 |   RREP(i,N-1,-1){
      |   ^~~~
a.cc:44:3: error: 'REP' was not declared in this scope
   44 |   REP(i,0,N-2)REP(j,i+1,N-1){
      |   ^~~
Language: C++

n = int(input())
s = str(input())
r = [0] * n
g = [0] * n
b = [0] * n
R = 0
G = 0
B = 0
for i in range(n-1, -1, -1):
  r[i] = R
  g[i] = G
  b[i] = B
  if s[i] == 'R':R+=1
  if s[i] == 'G':G+=1
  if s[i] == 'B':B+=1

ans = 0
for i in range(n-2):
  for j in range(i+1, n-1):
    if (s[i] == 'R' and s[j] == 'G') or (s[i] == 'G' and s[j] =='R'):
      ans += b[j]
      if 2*j - i < n:
        if s[2*j-i] == 'B': ans -= 1
    if (s[i] == 'G' and s[j] == 'B') or (s[i] == 'B' and s[j] =='G'):
      ans += r[j]
      if 2*j - i < n:
        if s[2*j-i] == 'R': ans -= 1
    if (s[i] == 'B' and s[j] == 'R') or (s[i]== 'R' and s[j] =='B'):
      ans += g[j]
      if 2*j -i < n:
        if s[2*j-i] == 'G': ans -= 1
print(ans)

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