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 S = sc.next();
      
      // RGBリストを作成
      List<Integer> listR = new ArrayList<Integer>();
      List<Integer> listG = new ArrayList<Integer>();
      List<Integer> listB = new ArrayList<Integer>();
      for(int i = 0; i < N; i++){
        String color = strAt(S, i);
        if(color.equals("R")){
          listR.add(i);
        }else if(color.equals("G")){
          listG.add(i);
        }else{
          listB.add(i);
        }
      }
      
      // 各リストから1つ選択
      Long count = 0L;
      for(int i = 0; i < listR.size(); i++){
        for(int j = 0; j < listG.size(); j++){
          for(int k = 0; k < listB.size(); k++){
            int[] nums = new int[3];
            nums[0] = listR.get(i);
            nums[1] = listG.get(j);
            nums[2] = listB.get(k);
            nums = sort(nums);
            //System.out.println(nums[0] + " " + nums[1] + " " + nums[2]);
            if(isDiffInterbal(nums)){
              count++;
            }
          }
        }
      }
      
      // 出力
      System.out.println(count);
    }
    
    // 3数をソートする関数
    public static int[] sort(int[] nums){
      int[] result = new int[3];
      int n1 = nums[0];
      int n2 = nums[1];
      int n3 = nums[2];
      if(n1 < n2){
        if(n2 < n3){
          result[0] = n1;
          result[1] = n2;
          result[2] = n3;
        }else if(n1 < n3){
          result[0] = n1;
          result[1] = n3;
          result[2] = n2;
        }else{
          result[0] = n3;
          result[1] = n1;
          result[2] = n2;
        }
      }else{
        if(n1 < n3){
          result[0] = n2;
          result[1] = n1;
          result[2] = n3;
        }else if(n2 < n3){
          result[0] = n2;
          result[1] = n3;
          result[2] = n1;
        }else{
          result[0] = n3;
          result[1] = n2;
          result[2] = n1;
        }
      }
      
      return result;
    }
    
    // 3数の間隔が異なるか判定する関数(条件2)
    public static boolean isDiffInterbal(int[] nums){
      if(nums[1] - nums[0] == nums[2] - nums[1]){
        return false;
      }else{
        return true;
      }
    }
    

}

Compiler output:
Main.java:14: error: cannot find symbol
        String color = strAt(S, i);
                       ^
  symbol:   method strAt(String,int)
  location: class Main
1 error
Language: C

#include <iostream>
#include <string>

// data structure
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <vector>

#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char const *argv[]) {
  int n;
  string s;
  cin >> n;
  cin >> s;

  int count = 0;
  for (int k = 3; k < n; k++) {
    for (int j = 1; j < k; j++) {
      for (int i = 0; i < j; i++) {
        if (j - i == k - j)
          continue;
        if (s.at(i) != s.at(j) && s.at(i) != s.at(k) && s.at(j) != s.at(k))
          count++;
      }
    }
  }

  std::cout << count << std::endl;

  return 0;
}


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

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

int main() {
  int n,cnt=0;
  string st;
  cin>>n>>st;
  
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      if(st.at(i)!=st.at(j)){
        for(int k=j+1; k<n; k++){
        if(i+k!=2*j && st.at(i)!=st.at(k) && st.at(k)!=st.at(j))
          cnt++;
        }
      }
      
    }
  }
  
    
    
  cout<<cnt<<"\n";
}

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 <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

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

#include <stdio.h>
const int N=4010;
int r[N];
int g[N];
int b[N];
int main(){
    int n;
    char c;
    scanf("%d",&n);
    long long ans=0;
    int rr=0,gg=0,bb=0;
    for(int i=0;i<=n;i++){
        scanf("%c",&c);
        if(c=='R') r[rr++]=i;
        else if(c=='G') g[gg++]=i;
        else if(c=='B') b[bb++]=i;
    }
    
    for(int i=0;i<rr;i++){
        for(int j=0;j<gg;j++){
            for(int k=0;k<bb;k++){
                if(r[i]<g[j]&&g[j]<b[k]){
                    if(g[j]-r[i]!=b[k]-g[j]) ans++;
                }
                else if(r[i]<b[k]&&b[k]<g[j]){
                    if(b[k]-r[i]!=g[j]-b[k]) ans++;
                }
                else if(g[j]<r[i]&&r[i]<b[k]){
                    if(r[i]-g[j]!=b[k]-r[i]) ans++;
                }
                else if(g[j]<b[k]&&b[k]<r[i]){
                    if(b[k]-g[j]!=r[i]-b[k]) ans++;
                }
                else if(b[k]<r[i]&&r[i]<g[j]){
                    if(r[i]-b[k]!=g[j]-r[i]) ans++;
                }
                else if(b[k]<g[j]&&g[j]<r[i]){
                    if(g[j]-b[k]!=r[i]-g[j]) ans++;
                }
            }
        }
    }
    printf("%lld",ans);
    return 0;
}

Compiler output:
main.c:3:5: error: variably modified 'r' at file scope
    3 | int r[N];
      |     ^
main.c:4:5: error: variably modified 'g' at file scope
    4 | int g[N];
      |     ^
main.c:5:5: error: variably modified 'b' at file scope
    5 | int b[N];
      |     ^
Language: C++

#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
const int N = 4005;
const int inf = 0x3f3f3f3f;
vector<int>VR,VG,VB;
char a[N];
ll ans=0;
void fun(vector<int>VR,vector<int>VG,vector<int>VB)
{
    for(int i=0; i<VR.size(); i++)
    {
        int x=upper_bound(VG.begin(),VG.end(),VR[i])-VG.begin();
        if(x==VG.size())
            break;
        for(int j=x; j<VG.size(); j++)
        {
            int y=upper_bound(VB.begin(),VB.end(),VG[j])-VB.begin();
            if(y==VB.size())
                break;
            ans+=VB.size()-y;
            int id=2*VG[j]-VR[i];
            if(id<=VB.back()&&a[id]==a[VB[0]])
                ans--;
        }
    }
}
int main()
{
    int n;
    scanf("%d%s",&n,a);
    for(int i=0; i<n; i++)
        if(a[i]=='R')
            VR.push_back(i);
        else if(a[i]=='G')
            VG.push_back(i);
        else
            VB.push_back(i);
    fun(VR,VG,VB);
    fun(VR,VB,VG);
    fun(VG,VR,VB);
    fun(VG,VB,VR);
    fun(VB,VR,VG);
    fun(VB,VG,VR);
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc:14:1: error: 'll' does not name a type
   14 | ll ans=0;
      | ^~
a.cc: In function 'void fun(std::vector<int>, std::vector<int>, std::vector<int>)':
a.cc:27:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |             ans+=VB.size()-y;
      |             ^~~
      |             abs
a.cc: In function 'int main()':
a.cc:51:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C

#include<iostream>
#include<string>

using namespace std;

int main(){
    int n;
    string S;
    cin >> n;
    cin >> S;
    int r, g, b;
    r = b = g = 0;
    int all = n * (n - 1) * (n - 2) / 6;
    for (int i = 0; i < n; i++)
    {
        if(S[i]=='R')
        {
            r++;    
        }
        else if (S[i]=='G')
        {
            g++;
        }
        else if (S[i]=='B')
        {
            b++;
        }
    }
    all -= r * (r - 1) * (n - r) / 2;
    all -= g * (g - 1) * (n - g) / 2;
    all -= b * (b - 1) * (n - b) / 2;
    all -= r * (r - 1) * (r - 2) / 6;
    all -= g * (g - 1) * (g - 2) / 6;
    all -= b * (b - 1) * (b - 2) / 6;

    for (int i = 0; i < S.size() - 2; i++)
    {
        for (int j = i+1; j < S.size(); j++)
        {
            if (S[i] != S[j])
            {
                int a = j - i;
                int k = i + 2 * a;
                if (k >= S.size())
                {
                    continue;
                }
                else
                {
                    if (S[j] != S[k] && S[k] != S[i])
                    {
                        all--;
                    }
                }
                
            }
        }
        
    }
    cout << all << endl;
    return 0;
}

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

#include <iostream>
using namespace std;
#define int long long int
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
   int ans=0;
   int R=0,G=0,B=0,count=0;
    for(int i=0;i<N;i++)
    {
        if(S[i] == 'R') R++;
        if(S[i] == 'G') G++;
        if(S[i] == 'B') B++;
        for(int j=N-1;j>i+1;j--)
        {
            if((i+j)%2 ==0)
            {
                char temp = S[(i+j)/2];
                if(temp != S[j] && temp != S[i] && S[j] != S[i])
                    count++;
            }
        }
    }
    
    cout << R*G*B-count << endl;
 return 0;
}


Compiler output:
a.cc:3:23: error: '::main' must return 'int'
    3 | #define int long long int
      |                       ^~~
a.cc:4:1: note: in expansion of macro 'int'
    4 | int main() {
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    string str;
    cin>>str;
    long long int count=0;
    long long int r=0,g=0,b=0;
   
    
   for(int i=0;i<n;i++)
   {
       if(str[i]=='R')
       {
           r1.push_back(i);
           r++;
       }
       if(str[i]=='G')
       {
           g++;
           g1.push_back(i);
       }
       if(str[i]=='B')
       {
           b++;
           b1.push_back(i);
       }
   }
   count+=r*g*b;
   if(count==0)
   {
       cout<<"0";
   return 0;
   }
  
   for(int i=0;i<n;i++)
   {
        int len=1;
       int left=i-len;
       int right=i+len;
       while(left>=0&&right<n)
       {
           if(str[left]!=str[right]&&str[right]!=str[i]&&str[i]!=str[left])
           count--;
           len++;
            left=i-len;
       right=i+len;
           
       }
   }
   cout<<count;
   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: 'r1' was not declared in this scope; did you mean 'r'?
   17 |            r1.push_back(i);
      |            ^~
      |            r
a.cc:23:12: error: 'g1' was not declared in this scope; did you mean 'g'?
   23 |            g1.push_back(i);
      |            ^~
      |            g
a.cc:28:12: error: 'b1' was not declared in this scope; did you mean 'b'?
   28 |            b1.push_back(i);
      |            ^~
      |            b
Language: C++

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main()
{
 std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
  int n, s,ans = 0; 
  cin>>n;
  cin>>s;
  int i = 0, j = 1, k;
  for( i = 0; i<n; i++ )
  {
    for ( j = 1; j<n ; j++ )
    {
      if ( s[i]!=s[j] )
      {
        k = j+1;
        for ( k = j+1; k<n; k++ )
        {
          if ( s[i]!=s[k] && s[j]!=s[k] )
          {
            if (j-i != k-j)
              ans++;
          }
        }
          
      }
    }
  }
  cout<<ans;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: invalid types 'int[int]' for array subscript
   16 |       if ( s[i]!=s[j] )
      |             ^
a.cc:16:19: error: invalid types 'int[int]' for array subscript
   16 |       if ( s[i]!=s[j] )
      |                   ^
a.cc:21:17: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                 ^
a.cc:21:23: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                       ^
a.cc:21:31: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                               ^
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                                     ^
Language: C++

using ll = long long;
using p = pair<int, int>;

int		main(void){
	int n;
	string s;
	cin >> n;
	cin >> s;
	int i = 0;
	int j;

	int r = 0;
	int g = 0;
	int b = 0;

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

	int fix = 0;
	i = 0;
	while (i < n - 2)
	{
		j = i + 1;
		while (j < n - 1)
		{
			if (j + j - i < n)
			{
				if (s[i] != s[j] && s[i] != s[j + j - i] && s[j] != s[j + j - i])
					fix++;
			}
			j++;
		}
		i++;
	}
	if (r * g * b - fix < 0)
		cout << 0;
	else
		cout << r * g * b - fix << endl;
}


Compiler output:
a.cc:2:11: error: 'pair' does not name a type
    2 | using p = pair<int, int>;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string s;
      |         ^~~~~~
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
a.cc:8:16: error: 's' was not declared in this scope
    8 |         cin >> s;
      |                ^
a.cc:45:17: error: 'cout' was not declared in this scope
   45 |                 cout << 0;
      |                 ^~~~
a.cc:47:17: error: 'cout' was not declared in this scope
   47 |                 cout << r * g * b - fix << endl;
      |                 ^~~~
a.cc:47:44: error: 'endl' was not declared in this scope
   47 |                 cout << r * g * b - fix << endl;
      |                                            ^~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>

#define IO std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);

#define MOD 1000000007
#define ull unsigned long long int
#define ll  long long int
#define MAX 100005

using namespace std;
using namespace __gnu_pbds;

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

bool allCharactersSame(string s) {
    return (s.find_first_not_of(s[0]) == string::npos);
}

int main() {

    IO
    //freopen("entrada.txt", "r", stdin);


    int n, i, j, k;
    string s;

    int cont=0;

    cin >> n;
    cin >> s;

    if(allCharactersSame(s)) {
        cout << "0\n";
        break;
    }
    for(i=0; i<n-2; i++) {
        for(j=1; j<n-1; j++) {
            for(k=2; k<n; k++) {
                if(j-i!=k-j) {
                    if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && i<j && j<k) {
                        cont++;
                    }
                }
            }
        }
    }

    cout << cont << "\n";

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: break statement not within loop or switch
   41 |         break;
      |         ^~~~~
Language: C

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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int> resr(n + 1), resg(n + 1), resb(n + 1);
	rep(i, n) {
		if (s[i] == 'R') resr[i]++;
		if (s[i] == 'G') resg[i]++;
		if (s[i] == 'B') resb[i]++;
		resr[i + 1] += resr[i];
		resg[i + 1] += resg[i];
		resb[i + 1] += resb[i];
	}
	int ans = 0;
	rep(i, n - 2) {
		for (int j = i + 1; j < n - 1; ++j) {
			if (s[i] == 'R' && s[j] == 'G') {
				ans += resb[n] - resb[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'B') ans--;
			}
			if (s[i] == 'R' && s[j] == 'B') {
				ans += resg[n] - resg[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'G') ans--;
			}
			if (s[i] == 'G' && s[j] == 'R') {
				ans += resb[n] - resb[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'B') ans--;
			}
			if (s[i] == 'B' && s[j] == 'R') {
				ans += resg[n] - resg[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'G') ans--;
			}
			if (s[i] == 'B' && s[j] == 'G') {
				ans += resr[n] - resr[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'R') ans--;
			}
			if (s[i] == 'G' && s[j] == 'B') {
				ans += resr[n] - resr[j];
				int tmp = j + (j - i);
				if (j + (j - i) > n) continue;
				if (s[tmp] == 'R') ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

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


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

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

int main() {
  
  int N, r=0, g=0, b=0;
  string S;
  cin >> N >> S;
  for (int i = 0; i < N; i++){
    if (S[i] == 'R') r++;
    else if (S[i] == 'G') g++;
    else if (S[i] == 'B') b++;
  }
  
  int sum = 0;
  for (int j = 0; j < N-2; j++) {
    for (int k = 1; k <= (N-i)/2; k++) {
      if (S[j] != S[j+k] && S[j] != S[j+k*2]) sum++;
    }
  }
  
  cout << r*g*b-sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:29: error: 'i' was not declared in this scope
   17 |     for (int k = 1; k <= (N-i)/2; k++) {
      |                             ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
signed main(){
  int a;
  cin>>a;
  string b;
  cin>>b;
  int c=0,d=0,e=0;
  rep(i,a){
  if(b[i]=='R')
    c++;
  else if(b[i]=='G')
    d++;
  else
    e++;
  }int m=0;
  for(int i=1;i<=(a-1)/2;i++){
    for(int j=0;j<=a-1-2*i;j++){
      if(b[j]!=b[i+j]&&b[i+j]!=b[2*i+j]&&b[2*i+j]!=b[j])
         m++;
    }
    }
    cout<<c*d*e-m<<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(void){
    int a;
    cin>>a;
    string str;
    cin>>str;
    int count;
    int m;
    count=0;
    m=str.length();
    for (int i=0;i<m;i++){
      for (int j=i+1;j<m;j++){
        if (str.substr(i, 1)!=str.substr(j, 1)){
          for (int k=j+1;k<m;k++){
            if (str.substr(k, 1)!=str.substr(j, 1) && str.substr(k, 1)!=str.substr(i, 1) &&k-j!=j-i){
              count+=1;
            }
        }
      }
    }
    }
    cout<<count;

Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: expected '}' at end of input
   24 |     cout<<count;
      |                 ^
a.cc:4:15: note: to match this '{'
    4 | int main(void){
      |               ^
Language: C

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

int main(){

    long N;
    string S;
    cin >> N;
    cin >> S;

    long R[N],G[N],B[N];
    long rtmp,gtmp,btmp;

    long ans;
    ans=0;
    
    rtmp=0; gtmp=0; btmp=0;

    for(long i=0; i<N; i++){
        if( S[i]=='R' ){
            rtmp++;
        }else if( S[i]=='G' ){
            gtmp++;
        }else if( S[i]=='B' ){
            btmp++;
        }
        R[i]=rtmp;
        G[i]=gtmp;
        B[i]=btmp;
    }

    bool rflag, gflag, bflag;
    bool ijflag;

    for(long i=0; i<N-2; i++){
        for(long j=i+1; j<N-1; j++){

            rflag=false; gflag=false; bflag=false;
            ijflag=false;
            long isj=0;

            if( S[i]=='R' || S[j]=='R' ){
                rflag = true;
            }
            if( S[i]=='G' || S[j]=='G' ){
                gflag = true;
            }
            if( S[i]=='B' || S[j]=='B' ){
                bflag = true;
            }

            if( j+(j-i) <= N-1 ){
                ijflag = true;
                isj = j+(j-i);
            }

            if( rflag && gflag ){ // case B

                if(ijflag){
                    ans += B[isj-1] - B[j] + B[N-1] - B[isj];
                }else{
                    ans += B[N-1] - B[j];
                }
               
                //cout << "B: i j isj ans " << i << " " << j << " " << isj << " " << ans << endl;

            }else if( rflag && bflag ){ // case G

                //cout << "G: ans before " << ans << endl;
                //cout << "G: ijflag " << ijflag << endl;

                if(ijflag){
                    ans += G[isj-1] - G[j] + G[N-1] - G[isj];
                }else{
                    ans += G[N-1] - G[j];
                }

                //cout << "G: i j isj ans " << i << " " << j << " " << isj << " " << ans << endl;
                //cout << "G: ans after " << ans << endl;
                //cout << "G: G[N-1] G[j]  " << G[N-1] << " " << G[j] << endl;

            }else if( gflag && bflag ){ // case R

                if(ijflag){
                    ans += R[isj-1] - R[j] + R[N-1] - R[isj];
                }else{
                    ans += R[N-1] - R[j];
                }

                //cout << "R: i j isj ans " << i << " " << j << " " << isj << " " << ans << endl;

            }else{
                continue;
            }   

        }
    }

    cout << ans << endl;

    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  string s;cin>>s;
  int n=s.size();
  ll c=0LL,g=0LL;
  vector<int> a(n,0);
  rep(i,n){
    if(s[i]=='G')g++;
  }
  rep(i,n){
    if(s[i]!='R')continue;
    reps(j,i+1,n){
      if(s[j]=='B'){
        c+=a[j]-a[i];
        if(i%2==j%2&&s[(i+j)/2]=='G')c--;
      }
    }
  }
  cout<<c;
}
  }


Compiler output:
a.cc:29:3: error: expected declaration before '}' token
   29 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main()
{
 std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
  int n, s,ans = 0; 
  cin>>n;
  cin>>s;
  int i = 0, j = 1, k;
  for( i; i<n; i++ )
  {
    for ( j; j<n ; j++ )
    {
      if ( s[i]!=s[j] )
      {
        k = j+1;
        for ( k; k<n; k++ )
        {
          if ( s[i]!=s[k] && s[j]!=s[k] )
          {
            if (j-i != k-j)
              ans++;
          }
        }
          
      }
    }
  }
  cout<<ans;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: invalid types 'int[int]' for array subscript
   16 |       if ( s[i]!=s[j] )
      |             ^
a.cc:16:19: error: invalid types 'int[int]' for array subscript
   16 |       if ( s[i]!=s[j] )
      |                   ^
a.cc:21:17: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                 ^
a.cc:21:23: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                       ^
a.cc:21:31: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                               ^
a.cc:21:37: error: invalid types 'int[int]' for array subscript
   21 |           if ( s[i]!=s[k] && s[j]!=s[k] )
      |                                     ^
Language: C

#include<stdio.h>
#include <string.h>
#include<iostream>
using namespace std;
 
int main()
{
    int N;
  	int sum=0;
  	char *str;
  	int R_num=0,G_num=0,B_num=0;
	int R[4000], G[4000], B[4000];

  	cin>>N;
      
    //vector<char> vec(N);
  
  	cin>>str;
      
  	for (int i = 0; i < N; i++) {
      if(str[i]=='R'){
        R[R_num]=i;
        R_num++;
      }else if(str[i]=='G'){
        G[G_num]=i;
        G_num++;
      }else if(str[i]=='B'){
        B[B_num]=i;
        B_num++;
      }
  	}
 

  	for (int i = 0; i < R_num; i++) {
        	for (int j = 0; j < G_num; j++) {
                	for (int k = 0; k < B_num; k++) {
                    	int a=R[i],b=G[j],c=B[k];
                      	if(a<b){
                          	int temp;
                      		temp=a;
                      		a=b;
                      		b=temp;
                        }
                      	if(b<c){
                          	int temp;
                      		temp=c;
                      		c=b;
                      		b=temp;
                      		if(a<c){
                          		int temp;
                      			temp=a;
                      			a=c;
                      			c=temp;
                        	}        
                        }
                      if(a-b!=b-c)  
                        sum++;
                    }
            }
    }

  	cout<<sum<<endl;
  
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,c=0;
  string S;
  cin>>N;
  cin>>S;
  for(int k=0;i<N;k++){
    for(int j=0;j<N;j++){
      if(j>=k) break;
      for(int i=0;i<N;i++){
        if(i>=j) break;

        if(2*j==i+k) continue;
        if(S[i] == S[j] || S[k] == S[j] || S[i] == S[k]) continue;

        c++;
      }
    }
  }
  cout<<c<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'i' was not declared in this scope
    8 |   for(int k=0;i<N;k++){
      |               ^
Language: C++

#include <iostream>

using namespace std;
typedef long long ll;
char a[4005];
int R[4005];
int G[4005];
int B[4005];
int sR[4005];
int sG[4005];
int sB[4005];

int main() {
    scanf("%s", a + 1);
    int n = strlen(a + 1);
    for (int i = 1; i <= n; i++) {
        if (a[i] == 'R')R[i] = 1;
        else if (a[i] == 'G')G[i] = 1;
        else B[i] = 1;
    }
    for (int i = 1; i <= n; i++)sR[i] = sR[i - 1] + R[i], sG[i] = sG[i - 1] + G[i], sB[i] = sB[i - 1] + B[i];
    ll ans = 0;
    for (int i = 2; i < n; i++) {
        if (a[i] == 'R') {
            for (int j = 1; j < i; j++) {
                if (a[j] == 'G') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'B')ans--;
                    ans = ans + sB[n] - sB[i];
                }
                if (a[j] == 'B') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'G')ans--;
                    ans = ans + sG[n] - sG[i];
                }
            }
        } else if (a[i] == 'G') {
            for (int j = 1; j < i; j++) {
                if (a[j] == 'R') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'B')ans--;
                    ans = ans + sB[n] - sB[i];
                }
                if (a[j] == 'B') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'R')ans--;
                    ans = ans + sR[n] - sR[i];
                }
            }
        } else {
            for (int j = 1; j < i; j++) {
                if (a[j] == 'G') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'R')ans--;
                    ans = ans + sR[n] - sR[i];
                }
                if (a[j] == 'R') {
                    if (i + (i - j) <= n && a[i + (i - j)] == 'G')ans--;
                    ans = ans + sG[n] - sG[i];
                }
            }
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'strlen' was not declared in this scope
   15 |     int n = strlen(a + 1);
      |             ^~~~~~
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 |
Language: C

#include<iostream>
#include<string>
 using namespace std;
 
 int main()
 {
 	int n;
 	string s;
 	cin>>n>>s;
 	long long  c=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[i]=='R' && s[j]=='B' && s[k]=='G' && j-i!=k-j)
 					c++;
 				else if(s[i]=='R' && s[j]=='G' && s[k]=='B' && j-i!=k-j)
 					c++;
 				else if(s[i]=='B' && s[j]=='G' && s[k]=='R' && j-i!=k-j)
 					c++;
 				else if(s[i]=='B' && s[j]=='R' && s[k]=='G' && j-i!=k-j)
 					c++;
 				else if(s[i]=='G' && s[j]=='R' && s[k]=='B' && j-i!=k-j)
 					c++;
 				else if(s[i]=='G' && s[j]=='B' && s[k]=='R' && j-i!=k-j)
 					c++;
			 }
		 }
	 }
	 cout<<c<<endl;
 }

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

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

int main() {
	int n;
	string s;
	cin >> n >> s;
	int r = 0, g = 0, b = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R')
			r++;
		if (s[i] == 'G')
			g++;
		if (s[i] == 'B')
			b++;
	}
	long long ans = r * g * b;
	for (int i = 0; i < n - 2; i++) {
		for (int k = i + 2; k < n; k++) {
			if ((k + i) % 2 == 0 && s[i] != s[k] && s[i] != s[(k + i) / 2] && s[(k + i) / 2] != s[k])
				ans--;
		}
	}
	cout << ans << 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++){
            if ((j-i) => 0){
                for (int k = 0; k < N; k++){
                    if ((i < j) && (j < k)){
                        if ((S[i] != S[j]) and (S[i] != S[k]) and (S[j] != S[k])){
                            if ((j-i) != (k-j)){
                                count += 1;
                            }
                        }
                    }
                }
            }
        }
    }
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: expected primary-expression before '>' token
   12 |             if ((j-i) => 0){
      |                        ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int sum = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
          if (S[i] == S[j]) continue;
            for (int k > 2*j - i; k < N; k++) {
                if ((S[i] != S[k]) && (S[j] != S[k])) {
                 
                        sum++;
                    
                }
            }
        }
    }
 
    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: expected ';' before '>' token
   14 |             for (int k > 2*j - i; k < N; k++) {
      |                       ^~
      |                       ;
a.cc:14:24: error: expected primary-expression before '>' token
   14 |             for (int k > 2*j - i; k < N; k++) {
      |                        ^
a.cc:14:40: error: expected ')' before ';' token
   14 |             for (int k > 2*j - i; k < N; k++) {
      |                 ~                      ^
      |                                        )
a.cc:14:42: error: 'k' was not declared in this scope
   14 |             for (int k > 2*j - i; k < N; k++) {
      |                                          ^
Language: C++

#include<stdio.h>
#include <string.h>
#include<iostream>
using namespace std;
 
int main()
{
    int N;
  	int sum=0;
  	char *str;
  	int R_num=0,G_num=0,B_num=0;
	int R[4000], G[4000], B[4000];

  	cin>>N;
      
    //vector<char> vec(N);
  
  	cin>>str;
      
  	for (int i = 0; i < N; i++) {
      if(str[i]=='R'){
        R[R_mun]=i;
        R_num++;
      }else if(str[i]=='G'){
        G[G_mun]=i;
        G_num++;
      }else if(str[i]=='B'){
        B[B_mun]=i;
        B_num++;
      }
  	}
 

  	for (int i = 0; i < R_num; i++) {
        	for (int j = 0; j < G_num; j++) {
                	for (int k = 0; k < B_num; k++) {
                    	int a=R[i],b=G[j],c=B[k];
                      	if(a<b){
                          	int temp;
                      		temp=a;
                      		a=b;
                      		b=temp;
                        }
                      	if(b<c){
                          	int temp;
                      		temp=c;
                      		c=b;
                      		b=temp;
                      		if(a<c){
                          		int temp;
                      			temp=a;
                      			a=c;
                      			c=temp;
                        	}        
                        }
                      if(a-b!=b-c)  
                        sum++;
                    }
            }
    }

  
  	cout<<sum<<endl;
  
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'R_mun' was not declared in this scope
   22 |         R[R_mun]=i;
      |           ^~~~~
a.cc:25:11: error: 'G_mun' was not declared in this scope
   25 |         G[G_mun]=i;
      |           ^~~~~
a.cc:28:11: error: 'B_mun' was not declared in this scope
   28 |         B[B_mun]=i;
      |           ^~~~~
Language: C

#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>

using namespace std;

string s;

int main() {
  int n;
  cin >> n;
  cin >> s;
  int ans = 0;
  int a = 0;
  int b = 0;
  int c = 0;
  for(int i = 0; i < n; i++) {
    if(s[i] == 'R') {
      a++;
    }else if(s[i] == 'G') {
      b++;
    }else if(s[i] == 'B') {
      c++;
    }
  }
  ans = a*b*c;
  // i+k/2 == jのときの除外
  for(int i = 0; i < n; i++) {
    for(int k = n-1; k > i; k--) {
      if((i+k) % 2 == 0) {
        int j = (i+k)/2;
        if(s[i] == 'R' && s[j] == 'G' && s[k] == 'B') {
          ans--;
        }else if(s[i] == 'R' && s[j] == 'B' && s[k] == 'G') {
          ans--;
        }else if(s[i] == 'G' && s[j] == 'R' && s[k] == 'B') {
          ans--;
        }else if(s[i] == 'G' && s[j] == 'B' && s[k] == 'R') {
          ans--;
        }else if(s[i] == 'B' && s[j] == 'R' && s[k] == 'G') {
          ans--;
        }else if(s[i] == 'B' && s[j] == 'G' && s[k] == 'R') {
          ans--;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

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



int main() {
  
  int N,count=0,j,k;
  string S;
  
  cin >> N >> S;
  
  for(int i = 0;i < N;i++){
    j = i + 1;
    for(;j < N;j++){
      if(S.at(i) != S.at(j)){
        if(i + 1 == j){
          k = j + 2;
          for(;k < N;k++){
            if(S.at(i) != S.at(k) && S.at(j) != S.at(k)){
              count++;
            }
          }
        }else{
          k = j + 1;
          for(;k < N;k++){
            if(S.at(i) != S.at(k) && S.at(j) != S.at(k)){
              count++;
            }
          }
          

      }
    }
  }
  
  cout << count << endl;
  
  
  

}


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

#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>

using namespace std;

map <string,vector<int>> m;
map <int, string> r;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int num[3] = {0};

    for (int i = 0;i < n;i++){
        r[i] = s[i];
        if (s[i] == 'B'){
            m["B"].push_back(i);
            num[0]++;
        }
        else if (s[i] == 'R'){
            m["R"].push_back(i);
            num[1]++;
        }
        else if (s[i] == 'G'){
            m["G"].push_back(i);
            num[2]++;
        }
    }

    long long sum = 0;
    for (int i = 0;i < n-2;i++){
        for (int j = 1;i+2*j<n;j++){
            if (r[i] != r[i+j] && r[i+j] != r[i+2*j] && r[i+2*j] != r[i]){
                sum++;
            }
        }
    }
    long long seki = num[0]*num[1]*num[2];

    cout << seki-sum << endl;
}


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

def rgb(n,s):
    ans = 0
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                if j-i != k-j:
                    if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
                        ans += 1
    print(ans)

n = int(input())
s = input()
rgb(n, s)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def rgb(n,s):
      | ^~~
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 gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int main() {
    int N, R = 0, G = 0, B = 0;
    long long wa = 0;
    char szBuf[5000];
    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 = R * G * B;
    for (int x = 0; x < N-2; x++) {
        for (int y = x + 1; y < N-1; y++) {
            if (2 * y - x == N)break;
            if (szBuf[x] == 'R' && szBuf[y] == 'G'&&szBuf[2 * y - x] == 'B')wa--;
            if (szBuf[x] == 'R' && szBuf[y] == 'B'&&szBuf[2 * y - x] == 'G')wa--;
            if (szBuf[x] == 'G' && szBuf[y] == 'B'&&szBuf[2 * y - x] == 'R')wa--;
            if (szBuf[x] == 'G' && szBuf[y] == 'R'&&szBuf[2 * y - x] == 'B')wa--;
            if (szBuf[x] == 'B' && szBuf[y] == 'R'&&szBuf[2 * y - x] == 'G')wa--;
            if (szBuf[x] == 'B' && szBuf[y] == 'G'&&szBuf[2 * y - x] == 'R')wa--;
        }
    }if (wa < 0)wa = 0;
    cout<<wa<<endl;
    return 0;
}

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

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef long long ll;

int N;
string S;
int R=0,G=0,B=0;

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

    rep(i,N){
        if(S[i]=='R') R++;
        else if(S[i]=='G') G++;
        else B++;
    }

    int ans=R*G*B;
    rep(i,N){
        repn(j,N){
            if(i+j*2>=N) break;
            if(S[i]!=S[i+j] && S[i+j]!=S[i+j*2] && S[i+j*2]!=S[i]){
                ans--;
            }
        }
    }

    cout<<ans<<endl;
}

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

## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math
from math import gcd

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

r_list = []
g_list = []
b_list = []

for i in range(N):
    if(S[i] == 'R'):
        r_list.append(i)
    elif(S[i] == 'G'):
        g_list.append(i)
    else:
        b_list.append(i)

#print('r:{}, g:{}, b:{}'.format(r_list, g_list, b_list))

R_count = len(r_list)
G_count = len(g_list)
B_count = len(b_list)
#print(R_count * G_count * B_count)

b_num_list = [0 for i in range(N)]
for i in range(B_count):
    b_num_list[b_list[i]] += 1
#print('b_num_list:{}'.format(b_num_list))
    

counter = R_count * G_count * B_count
NG_list = []
for i in range(R_count):
    for j in range(G_count):
        r = r_list[i]
        g = g_list[j]
        hit_count = 0
        #if( (g+g-r) in b_list):
        #print('g+g+r:{}'.format(g+g-r))
        if(g+g-r >= 0 and g+g-r <= N-1): #and b_num_list[g+g-r] == 1)
            #print('b_num_list[g+g-r]:{}'.format(b_num_list[g+g-r]))
            if(b_num_list[g+g-r] == 1):
                hit_count += 1
        #if( (g+r)%2 == 0 and ((g+r)/2) in b_list ):
        if( (g+r)%2 == 0 and b_num_list[int((g+r)/2)] == 1):
            hit_count+=1
        #if( (r-g+r) in b_list):
        if(r+r-g >= 0 and r+r-g <= N-1 ):#and b_num_list[r+r-g] == 1):
            if(b_num_list[r+r-g] == 1):
                hit_count+=1
        counter -= hit_count
print(counter)
   


Compiler output:
main.c:1:1: error: stray '##' in program
    1 | ## coding: UTF-8
      | ^~
main.c:1:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    1 | ## coding: UTF-8
      |          ^
main.c:22:2: error: invalid preprocessing directive #print
   22 | #print('r:{}, g:{}, b:{}'.format(r_list, g_list, b_list))
      |  ^~~~~
main.c:27:2: error: invalid preprocessing directive #print
   27 | #print(R_count * G_count * B_count)
      |  ^~~~~
main.c:32:2: error: invalid preprocessing directive #print
   32 | #print('b_num_list:{}'.format(b_num_list))
      |  ^~~~~
main.c:42:22: error: missing binary operator before token "in"
   42 |         #if( (g+g-r) in b_list):
      |                      ^~
main.c:51: error: unterminated #if
   51 |         #if( (r-g+r) in b_list):
main.c:48: error: unterminated #if
   48 |         #if( (g+r)%2 == 0 and ((g+r)/2) in b_list ):
main.c:42: error: unterminated #if
   42 |         #if( (g+g-r) in b_list):
Language: C

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()


int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    map<char,int> mp;
    rep(i,n) mp[s.at(i)]++;
    
    long long ans = mp['R']*mp['G']*mp['B'];

    for(int i=0; i<=n-3; i++){
        for(int j=i+1; j<=n-2; j++){
            int k = j+(j-i);
            if(k>=n) break;
            if(s.at(i)!=s.at(j) && s.at(j)!=s.at(k) && s.at(k)!=s.at(i)) ans--;
        }
    }
    
    dunk(ans);
}



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

import java.util.Scanner;

public class test {
	
	public static void main(String args[]) {
		Scanner s = new Scanner(System.in);
		long num = s.nextLong();
		String str = s.next();
		
		int count = 0;
		for (long k = 0; k < num; k++) {
			for (long j = 0; j < k; j++) {
				for (long i = 0; i < j; i++) {
					int inti = (int)i;
					int intj = (int)j;
					int intk = (int)k;
					if ((j-i != k-j) && 
						(str.charAt(inti) != str.charAt(intj) && 
						 str.charAt(inti) != str.charAt(intk) && 
						 str.charAt(intk) != str.charAt(intj))
						) {
						count ++;
					}
					//System.out.println(String.valueOf(i)+String.valueOf(j)+String.valueOf(k));
				}
			}
		}
		
		System.out.println(count);
	}
}

Compiler output:
Main.java:3: error: class test is public, should be declared in a file named test.java
public class test {
       ^
1 error
Language: C

import strutils, algorithm, sequtils, random


proc naivesolve(N:int,S:string):int=
  for i in 0..<N:
    for j in (i+1)..<N:
      if S[i]!=S[j]:
        for k in (j+1)..<N:
          if S[i]!=S[k] and S[j]!=S[k] and (k-j) != (j-i):
            result+=1

    
  return result


proc solve(N:int,S:string):int=
  var
    r:seq[int]
    b:seq[int]
    g:seq[int]
  for i,c in S:
    if c=='R':
      r.add(i)
    elif c=='B':
      b.add(i)
    else:
      g.add(i)

  var tresult = r.len*b.len*g.len
  var minus = 0
  for i,c in S:
    for between in 1..N:
      if i+2*between>=N:
        break
      if S[i]!=S[i+between] and S[i]!=S[i+2*between] and S[i+between]!=S[i + 2*between]:
        minus+=1
  return tresult-minus


proc gentestcase(N:int):string=
  var ran = initRand(124)
  var r = ran.rand(N-3)
  var b = ran.rand(N-r)
  var g = N-r-b
  var S = @('R'.repeat(r) & 'B'.repeat(b) & 'G'.repeat(g))#.shuffle.mapIt($it).join()
  S.shuffle
  result = S.mapIt($it).join()
  return 

  
var
  N = stdin.readline().parseInt
  S = stdin.readline()


#echo S
#echo naivesolve(N,S)

echo solve(N,S)

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import strutils, algorithm, sequtils, random
      | ^~~~~~
main.c:4:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'proc'
    4 | proc naivesolve(N:int,S:string):int=
      | ^~~~
main.c:5:12: error: too many decimal points in number
    5 |   for i in 0..<N:
      |            ^~~
main.c:32:20: error: too many decimal points in number
   32 |     for between in 1..N:
      |                    ^~~~
main.c:45:11: error: stray '@' in program
   45 |   var S = @('R'.repeat(r) & 'B'.repeat(b) & 'G'.repeat(g))#.shuffle.mapIt($it).join()
      |           ^
main.c:45:59: error: stray '#' in program
   45 |   var S = @('R'.repeat(r) & 'B'.repeat(b) & 'G'.repeat(g))#.shuffle.mapIt($it).join()
      |                                                           ^
main.c:56:2: error: invalid preprocessing directive #echo
   56 | #echo S
      |  ^~~~
main.c:57:2: error: invalid preprocessing directive #echo
   57 | #echo naivesolve(N,S)
      |  ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<sstream>
#include<chrono>
#include<algorithm>
#include<functional>
#include<cstdlib>
#include<numeric>
#include<queue>
#include<stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main()
{
	int n;
	string str;
	cin >> n;
	cin >> str;
	int count(0);
	for (int i = 0; i < n - 2; i++)
		for (int j = i + 1; j < n - 1; j++) {
			if (str[i] == str[j])continue;
			for (int k = j + 1; k < n; k++)
			{
				if (j - i == k - j)continue;
				else if (str[i] != str[j] && str[i] != str[k] && str[j] != str[k])count++;
			}
		}

	std::cout << count << '\n';


Compiler output:
a.cc: In function 'int main()':
a.cc:32:36: error: expected '}' at end of input
   32 |         std::cout << count << '\n';
      |                                    ^
a.cc:16:1: note: to match this '{'
   16 | {
      | ^