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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
	string S;
	cin >> N >> S;
	string coln = "NNN";
	int memo[3] = {0};
	int cnt = 0;
	int m;
	
	for(int i = 0;i<N;i=i+m){
		char c;
		c = S.at(i);
		coln.at(0) = c;
		memo[0]=i;
		m = 1;
		
		for(int l = i+1;l<N;l++){
			c = S.at(l);
			if(c == coln.at(0){
				m++;
			}
			else{
				break;
			}
		}
		
		for(int j = i+1;j<N;j++){
			c = S.at(j);
			if(c != coln.at(0)){
				coln.at(1) = c;
				memo[1] = j;
				
				for(int k = j+1;k<N;k++){
					c = S.at(k);
					if(c != coln.at(0) && c != coln.at(1)){
						memo[2] = k;
						if(k-j > j-i){
							cnt = cnt + k -j;
						}
						else{
							cnt = cnt + k -j -1;
						}	
					}
				}
				
			}
		}
	
	
	}
	
	cout << cnt << endl;
 
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:43: error: expected ')' before '{' token
   22 |                         if(c == coln.at(0){
      |                           ~               ^
      |                                           )
a.cc:28:17: error: expected primary-expression before '}' token
   28 |                 }
      |                 ^
Language: C


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

int gcd(int x, int y){
  while (x % y != 0){
    int a=x;
    x=y;
    y=a%y;
  }
  return y;
}

int main() {
  int N;
  cin >> N;
  vector<char> V(N);
  for(int i=0;i<N;i++){
    cin >> V.at(i);
  }
  vector<int> R(0),G(0),B(0);
  for(int i=0;i<N;i++){
    if(V.at(i)=='R'){
      R.push_back(i);
    }
    else if(V.at(i)=='G'){
      G.push_back(i);
    }
    else {
      B.push_back(i);
    }
  }
  
  int sum=0;
  for(int i=0;i<R.size();i++){
    for(int j=0;j<G.size();j++){
      for(int k=0;k<B.size();k++){
        if(R.at(i)<G.at(j) && G.at(j)<B.at(k)){
          if(G.at(j)-R.at(i) != B.at(k)-G.at(j)){
            sum++;
          }
        }
      }
    }
  }
  cout << sum <<endl;
}
 

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

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

bool checkRGB(int a1, int a2, int b){
    bool check = false;
    int i, j, k;
    
    if(a2 < b){
        k = b;
        j = a2;
        i = a1;
    }
    else if(a1 < b)
        k = a2;
        j = b;
        i = a1;
    else{
        k = a2;
        j = a1;
        i = b;
    }
    
    if((j - i) != (k - j)) check = true;
    
    return check;
}
 
int main(void){
    int N, count, a1, a2;
    string S;
    vector<int> R, G, B;
    
    cin >> N;
    cin >> S;
    for(int i = 0; i < N; i++){
        if(S[i] == 'R') R.push_back(i);
        else if(S[i] == 'G') G.push_back(i);
        else if(S[i] == 'B') B.push_back(i);
    }

    count = 0;
    for(int i = 0; i < (int)R.size(); i++){
        for(int j = 0; j < (int)G.size(); j++){
            if(R[i] < G[j]){
                a1 = R[i];
                a2 = G[j];
            }
            else{
                a1 = G[j];
                a2 = R[i];
            }
            for(int k = 0; k < (int)B.size(); k++){
                if(checkRGB(a1, a2, B[k])) count++;
            }
        }
    }
    
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'bool checkRGB(int, int, int)':
a.cc:19:5: error: 'else' without a previous 'if'
   19 |     else{
      |     ^~~~
Language: Java

import java.util.*;

class Judge{
  boolean jud(String text,int a,int b,int c){
    if(b-a==c-b)
      return false;
    String str1,str2,str3;
    str1 = text.substring(a-1,a);
    str2 = text.substring(b-1,b);
    str3 = text.substring(c-1,c);
    if(!(str1.equals(str2))&&!(str2.equals(str3))&&!(str1.equals(str3)){
      return true;
    }
    else
      return false;
  }
}

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = 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,j,k))
            pair++;
        }
      }
    }
    System.out.println(pair);
  }
}

Compiler output:
Main.java:11: error: ')' expected
    if(!(str1.equals(str2))&&!(str2.equals(str3))&&!(str1.equals(str3)){
                                                                       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    string S;
    cin >> N;
    cin >> S;
    int cnt = 0;
    for (int i=0; i < N-2; i++) {
        string S_i = S[i];
        for (int j=i+1; j < N-1; j++) {
            string S_j = S[j];
            if ( S_i == S_j ) continue;
            for (int k=j+1; k < N; k++) {
                string S_k = S[k];
                if (S_k == S_i || S_k == S_j) continue;
                if ( j -i == k - j ) continue;
                cnt ++ ;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   11 |         string S_i = S[i];
      |                         ^
a.cc:13:29: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   13 |             string S_j = S[j];
      |                             ^
a.cc:16:33: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   16 |                 string S_k = S[k];
      |                                 ^
Language: C++

#include <bits/stdc++.h>

#define ll long long
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
using namespace std;
typedef pair<string, int> psi;
typedef pair<unsigned ll, pair<int, int> > piii;
typedef pair<pair<int, int>, int> piii2;
typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const ll MOD = 1e9+7;
 
using namespace std;
 
int main() {
    int n;
    cin >> n;
    string v;
    cin >> v;
 
    int sum[4][n+5];
    memset(sum, 0, sizeof sum);
    for(int i = 0; i < n; i++) {
        if(i) {
            sum[0][i] += sum[0][i-1];
            sum[1][i] += sum[1][i-1];
            sum[2][i] += sum[2][i-1];
        }
        if(v[i] == 'R') {
            v[i] = 0;
            sum[0][i]++;
        }
        if(v[i] == 'G') {
           v[i] = 1;
           sum[1][i]++;
        }
        if(v[i] == 'B'){
         v[i] = 2;
         sum[2][i]++;
        }
    }
 
    ll ans = 0;
    for(int i = 0; i < n; i++)
        for(int j = i+1; j < n-1; j++) {
            if(v[i] == v[j])
                continue;
            for(int k = 0; k < 3; k++) {
 
                if(k == v[i] or k == v[j])
                    continue;
 
                ans += sum[k][n-1]-sum[k][j];
 
 
 
                if(j+(j-i) < n && v[j+(j-i)] == k) 
                    ans--;
 
            }
 
 
        }
    cout << ans << endl;
}

Compiler output:
a.cc:9:9: error: 'tree' does not name a type
    9 | typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;
      |         ^~~~
Language: C++

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

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

    return 0;
}


Compiler output:
a.cc:39:5: error: redefinition of 'int main()'
   39 | int main(){
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main(){
      |     ^~~~
Language: Java

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

class Main {
    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        Main m = new Main();
        m.run();
    }

    private void run() {
        int n = sc.nextInt();
        AtomicInteger ans = new AtomicInteger();
        char[] s = sc.next().toCharArray();

//        List<Integer> r = new ArrayList<>();
//        List<Integer> g = new ArrayList<>();
//        List<Integer> b = new ArrayList<>();
//
//        for (int i = 0; i < n; i++) {
//            switch (s[i]) {
//                case 'R':
//                    r.add(i);
//                    break;
//                case 'G':
//                    g.add(i);
//                    break;
//                case 'B':
//                    b.add(i);
//                    break;
//            }
//
//        }
//
//        r.forEach(i -> {
//            g.forEach(j -> {
//                b.forEach(k -> {
//                    Integer[] a = {i, j, k};
//                    Arrays.sort(a);
//                    if (a[2] - a[1] == a[1] - a[0]) return;
////                    System.out.printf("%d %d %d", a[0], a[1], a[2]);
////                    System.out.println("");
//                    ans.getAndIncrement();
//                });
//            });
//        });

        int ans = 0;
        for (int i = 0; i < n - 2; i++) {
            for (int j = i + 1; j < n - 1; j++) {
                if (s[i] == s[j]) continue;
                for (int k = j + 1; k < n; k++) {
                    if (k - j == j - i) continue;
                    if (s[k] == s[j] || s[j] == s[i] || s[i] == s[k]) continue;
//                    System.out.printf("%d %d %d", i, j, k);
//                    System.out.println("");
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
}


Compiler output:
Main.java:49: error: variable ans is already defined in method run()
        int ans = 0;
            ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N;
	string S;
	cin >> N >> S;
	string coln = "NNN";
	int memo[3] = {0};
	int cnt = 0;
	
	for(int i = 0;i<N;i=i+m){
		char c;
		c = S.at(i);
		coln.at(0) = c;
		memo[0]=i;
		int m = 1;
		
		for(int l = i+1;l<N;l++){
			c = S.at(l);
			if(c == coln.at(0){
				m++
			}
			else{
				break
			}
		}
		
		for(int j = i+1;j<N;j++){
			c = S.at(j);
			if(c != coln.at(0)){
				coln.at(1) = c;
				memo[1] = j;
				
				for(int k = j+1;k<N;k++){
					c = S.at(k);
					if(c != coln.at(0) && c != coln.at(1)){
						memo[2] = k;
						if(k-j > j-i){
							cnt = cnt + k -j;
						}
						else{
							cnt = cnt + k -j -1;
						}	
					}
				}
				
			}
		}
	
	
	}
	
	cout << cnt << endl;
 
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: 'm' was not declared in this scope
   12 |         for(int i = 0;i<N;i=i+m){
      |                               ^
a.cc:21:43: error: expected ')' before '{' token
   21 |                         if(c == coln.at(0){
      |                           ~               ^
      |                                           )
a.cc:27:17: error: expected primary-expression before '}' token
   27 |                 }
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> red;
  vector<int> green;
  vector<int> blue;
  int count = 0;
  for(int i=0;i<n;i++){
    if(s.at(i)=="R"){
      red.push_back(i)
    }
    if(s.at(i)=="G"){
      green.push_back(i)
    }
    if(s.at(i)=="B"){
      blue.push_back(i)
    }
  }
  for(int i=0;i<red.size();i++){
    for(int j=0;j<green.size();j++){
      for(int k=0;k<blue.size();k++){
        if(green.at(j)-red.at(i)!=blue.at(k)-green.at(j)){
          count++;
        }
      }
    }
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     if(s.at(i)=="R"){
      |        ~~~~~~~^~~~~
a.cc:18:23: error: expected ';' before '}' token
   18 |       red.push_back(i)
      |                       ^
      |                       ;
   19 |     }
      |     ~                  
a.cc:20:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |     if(s.at(i)=="G"){
      |        ~~~~~~~^~~~~
a.cc:21:25: error: expected ';' before '}' token
   21 |       green.push_back(i)
      |                         ^
      |                         ;
   22 |     }
      |     ~                    
a.cc:23:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |     if(s.at(i)=="B"){
      |        ~~~~~~~^~~~~
a.cc:24:24: error: expected ';' before '}' token
   24 |       blue.push_back(i)
      |                        ^
      |                        ;
   25 |     }
      |     ~
Language: C++

#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  int n;
  string s;
  cin >>n;
  cin >>s;
  int r=0;
  int g=0;
  int b=0;
  int key=0;
  for(int i=0;i<n;i++){
    if(s[i]=='R'){
      r++;
    }
  }
  for(int i=0;i<n;i++){
    if(s[i]=='G'){
      g++;
    }
  }
  for(int i=0;i<n;i++){
    if(s[i]=='B'){
      b++;
    }
  }
  if(n<3||n-2*i<1){
    cout <<0<<endl;
  }else{
   for(int i=1;i<(n-1)/2+1;i++){
     for(int j=0;j<n-2*i;j++){
     if ( s[j]!=s[j+i]&&s[j]!=s[j+2*i]&&s[j+i]!=s[j+2*i]){
       key++;
      }
     }
   }
    cout <<r*g*b-key<<endl;
  }
}
   

Compiler output:
a.cc: In function 'int main()':
a.cc:40:15: error: 'i' was not declared in this scope
   40 |   if(n<3||n-2*i<1){
      |               ^
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 &&i+k!=2*j; k++){
            if(st.at(i)!=st.at(k)){
              if(st.at(k)!=st.at(j))
                cnt++;
            }
          
          }
        }
      }
      
    }
  }
  
    
    
  cout<<cnt<<"\n";
}

Compiler output:
a.cc:27:3: error: 'cout' does not name a type
   27 |   cout<<cnt<<"\n";
      |   ^~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (ll i=0; i<(n); i++)
typedef pair<int,int> P;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll INF=1001001001;
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; }
using namespace std;

int main(){
    int N; cin >> N;
    string S; cin >> S;
    
    ll ans=0;
    for (int i=0; i<N; i++){
        for (int j=i+1; j<N; j++){
            for (int k=j+1; k<N; k++){
                if (S[i]!=S[j] && S[i]!=S[k] && S[j]!=S[k]){
                    if (j-i!=k-j) 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

(let* ((n (read))
       (r nil)
       (g nil)
       (b nil))
  (loop :for k :in (concatenate 'list (read-line))
        :for j :from 1
        :do(cond ((char= #\R k) (push j r))
                 ((char= #\G k) (push j g))
                 ((char= #\B k) (push j b))))
  (defun f (xx yy zz)
    (loop :for x :in xx
          :sum (loop :for y :in yy
                     :sum (loop :for z :in zz
                                  :if (and (not (cond ((< x y z) (= (- x y) (- y z)))
                                                      ((< x z y) (= (- x z) (- z y)))
                                                      ((< y x z) (= (- y x) (- x z)))
                                                      ((< y z x) (= (- y z) (- z x)))
                                                      ((< z x y) (= (- z x) (- x y)))
                                                      ((< z y x) (= (- z y) (- y x))))))
                                 :count t))))
  (print (f r g b)))

Compiler output:
main.c:1:5: error: expected ')' before '*' token
    1 | (let* ((n (read))
      |     ^
      |     )
main.c:5:33: warning: missing terminating ' character
    5 |   (loop :for k :in (concatenate 'list (read-line))
      |                                 ^
main.c:5:33: error: missing terminating ' character
    5 |   (loop :for k :in (concatenate 'list (read-line))
      |                                 ^~~~~~~~~~~~~~~~~~
main.c:7:26: error: stray '#' in program
    7 |         :do(cond ((char= #\R k) (push j r))
      |                          ^
main.c:7:27: error: stray '\' in program
    7 |         :do(cond ((char= #\R k) (push j r))
      |                           ^
main.c:8:26: error: stray '#' in program
    8 |                  ((char= #\G k) (push j g))
      |                          ^
main.c:8:27: error: stray '\' in program
    8 |                  ((char= #\G k) (push j g))
      |                           ^
main.c:9:26: error: stray '#' in program
    9 |                  ((char= #\B k) (push j b))))
      |                          ^
main.c:9:27: error: stray '\' in program
    9 |                  ((char= #\B k) (push j b))))
      |                           ^
Language: C++

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

int main(){
    int  n;
    cin >> n;
    vector<char>s(n);
    for (int i = 0;i<n;i++){
        cin >> s.at(i);
    }
    int cnt = 0;
    for(int r = 0; r < n;r++){
        for(int g = r;g < n;g++){
            for(int b = g;b < n&&b<(2*g-i);b++){
                if(s.at(r) != s.at(g)&& s.at(g) != s.at(b)&& s.at(r) != s.at(b)){ 
                    if((b-g) != (g-r)){
                  cnt++;
                  }
                }
            }
        }
    }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:41: error: 'i' was not declared in this scope
   14 |             for(int b = g;b < n&&b<(2*g-i);b++){
      |                                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;

int		main(void){
	int n;
	string s;
	cin >> n;
	cin >> s;
	int i;
	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)
	{
		j = i + 1;
		while (j < n)
		{
			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++;
	}
	else
		cout << (ll)r * (ll)g * (ll)b - fix << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'else' without a previous 'if'
   46 |         else
      |         ^~~~
Language: C++

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

int main(){
  int n;
  int total==0;
  cin >> n;
  vector<char> s(n);
  for(int i=0;i<n;i++) cin >> s.at(i);
  for(int i=0;i<n-3;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(s.at(i)!=s.at(j)&&s.at(j)!=s.at(k)&&s.at(k)!=s.at(i)){
          if(j-i==k-j) break;
          else total+=1;
        }
      }
    }
  }
  cout << total << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected initializer before '==' token
    6 |   int total==0;
      |            ^~
a.cc:15:16: error: 'total' was not declared in this scope
   15 |           else total+=1;
      |                ^~~~~
a.cc:20:11: error: 'total' was not declared in this scope
   20 |   cout << total << endl;
      |           ^~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
const double PI = acos(-1);  // PI = 3.141593...

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


Compiler output:
a.cc:4:19: error: 'acos' was not declared in this scope
    4 | const double PI = acos(-1);  // PI = 3.141593...
      |                   ^~~~
Language: C++



#include<bits/stdc++.h>



#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

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

/*--- *n1≦*n2≦*n3となるように並べ替える ---*/
void sort3(int *n1, int *n2, int *n3)
{
    if (*n1 > *n2) swap(*n1, *n2);
    if (*n2 > *n3) swap(*n2, *n3);
    if (*n1 > *n2) swap(*n1, *n2);
}

int n;
string s;

int main()
{
    cin>>n>>s;
    ll sum=0;

    vec<int> r={};
    vec<int> g={};
    vec<int> b={};

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

    int tmp_i,tmp_j,tmp_k;    

    for(auto& i:r){
        for(auto& j:g){
            for(auto& k:b){
                tmp_i=i;
                tmp_j=j;
                tmp_k=k;
                sorte(&tmp_i,&tmp_j,&tmp_k);
                //cout<<s[tmp_i]<<" "<<s[tmp_j]<<" "<<s[tmp_k]<<endl;
                if(tmp_j-tmp_i!=tmp_k-tmp_j)sum++;
            }
        }
    }



    cout<<sum<<endl;


    return 0;

}




Compiler output:
a.cc: In function 'int main()':
a.cc:59:17: error: 'sorte' was not declared in this scope; did you mean 'sort3'?
   59 |                 sorte(&tmp_i,&tmp_j,&tmp_k);
      |                 ^~~~~
      |                 sort3
Language: C++

int main(void) {
	int N, count = 0;
	char S[4000];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> S[i];

	for (int i = 0; i < N; i++) {
		for (int j = i+1; j < N; j++) {
			for (int k = j+1; k < N; k++) {
				if ((S[i] != S[j]) && (S[j] != S[k]) && (S[i]) != S[k]) {
					if ((j - i)!=(k - j)) count++;
				}
			}
		}
	}
	cout << count << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope
    4 |         cin >> N;
      |         ^~~
a.cc:16:9: error: 'cout' was not declared in this scope; did you mean 'count'?
   16 |         cout << count << endl;
      |         ^~~~
      |         count
a.cc:16:26: error: 'endl' was not declared in this scope
   16 |         cout << count << endl;
      |                          ^~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e5 + 5;

int main()
{
    FAST
    int n;
    cin>>n;
    char arr[n+1];
    for(int i=0; i<n; i++)
        cin>>arr[i];
    ll ans=0;
    vector<ll> v[4];
    for(int i=0;i<n;i++)
        {
            if(arr[i]=='B')
                v[0].push_back(i);
            if(arr[i]=='R')
                v[1].push_back(i);
                if(arr[i]=='G')
                v[2].push_back(i);
        }
        ans=(ll)((ll)v[0].size()*(ll)v[1].size()*(ll)v[2].size());
    for(int i=0; i<n; i++)
    {
        for(int j=i; j<n; j++)
        {
            if(arr[i]==arr[j])
                continue;
            int seq[26]={0};
            seq[arr[i]-'A']=1;
            seq[arr[j]-'A']=1;
            int temp=0;
            if(!seq[1])
                temp=0;
            else if(!seq['R'-'A'])
                temp=1;
            else
                temp=2;
            int dif=j-i;
            auto it=lower_bound(v[temp].begin(),v[temp].end(),j+dif);
            if(*it==j+dif)
                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<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
const double PI = acos(-1);  // PI = 3.141593...

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


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

public class Main {
//public class App {

    public static void main(String[] args){
     //スキャン
     Scanner s = new Scanner(System.in);
       // 入力
       int n = Integer.parseInt(s.next());
        String text =s.next();

        HashSet<String> A = new HashSet<String>();
        int an = 0;
        for(int i = 3 ;i<=n;i++){
            String huge = text.substring(i-1,i);
            A.add(huge);
            for(int i2 =2; i2 < i;i2++){
                String huge2 = text.substring(i2-1,i2);
                if(! A.contains(huge2)){
                    A.add(huge2);
                    for(int i3 =1; i3 < i2;i3++){
                            if(! A.contains(text.substring(i3-1,i3))&&i-i2 != i2-i3){
                                an++;
                            }
                    }
                    A.remove(huge2);
                }
            }
            A.remove(huge);
        }
    System.out.println(an);
    }
}

Compiler output:
Main.java:6: error: cannot find symbol
     Scanner s = new Scanner(System.in);
     ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
     Scanner s = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
Main.java:11: error: cannot find symbol
        HashSet<String> A = new HashSet<String>();
        ^
  symbol:   class HashSet
  location: class Main
Main.java:11: error: cannot find symbol
        HashSet<String> A = new HashSet<String>();
                                ^
  symbol:   class HashSet
  location: class Main
4 errors
Language: C++

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

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

  cout << ans << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:23:23: error: expected '}' at end of input
   23 |   cout << ans << endl;
      |                       ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int m(char a,char b){
  if(a!='R'&&b!='B') return'G';
  if(a!='R'&&b!='G') return'B';
  if(a!='G'&&b!='B') return'R';
}
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++){
      if(s.at(i-1)==s.at(j-1))
        continue;
      for(int k=j+1;k<=N;k++){
        if(s.at(k-1)!=m(s.at(i-1),s.at(j-1)))&&
           j-i!=k-j)
          ans++;
      }
    }
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
   18 |         if(s.at(k-1)!=m(s.at(i-1),s.at(j-1)))&&
      |                                              ~~
   19 |            j-i!=k-j)
      |            ~^~
a.cc:19:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |         if(s.at(k-1)!=m(s.at(i-1),s.at(j-1)))&&
      |                                              ~~
   19 |            j-i!=k-j)
      |            ~~~^~~~~
a.cc:19:20: error: expected ';' before ')' token
   19 |            j-i!=k-j)
      |                    ^
      |                    ;
a.cc:19:12: error: label 'j' used but not defined
   19 |            j-i!=k-j)
      |            ^
a.cc: In function 'int m(char, char)':
a.cc:7:1: warning: control reaches end of non-void function [-Wreturn-type]
    7 | }
      | ^
Language: C++

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
 
int main(){
  int n,ans=0;
  scanf("%d",&n);
  char s[n];
  scanf("%s",s);
  
  for(int i=0;i<n-2;i++){
   for(int j=i+1;j<n-1;j++){
     if(s[i]!=s[j])goto loopend;
   }
     loopend: for(int k=j+1;k<n;k++){
       if(s[i]==s[j])break;
       if(s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j){
         ans += 1;
       }
     }
  }
  printf("%d",ans);
  return 0;
}

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

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

int main(){ 
  int N, t, r, g, b, C;
  cin >> N;
  string S;
  cin >> S;
  t = 0;
  r = 0;
  g = 0;
  b = 0;

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


  C = r * g * b;
  
  rep(i,N-2) {
    for (int j = i + 1; 2 * j < N + i; j++) {
      if (S[i] != S[j] && S[i] != S[2 * j - i] && S[j] != S[2 * j - i]) t++; 
    }
  }

  cout << C - t << 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

import sys
input = sys.stdin.readline
def main():
  n=int(input())
  s=str(input())
  r=[]
  g=[]
  b=[]
  for i in range(n):
    if s[i]=='R':
      r.append(i)
    elif s[i]=='G':
      g.append(i)
    else:
      b.append(i)
  ans=0
  for l in r:
    for m in g:
      for k in b:
        if abs(m-l)!=abs(k-m) and abs(k-l)!=abs(k-m) and abs(k-l)!=abs(l-m):
          ans+=1
  print(ans)
main()

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import sys
      | ^~~~~~
main.c:2:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'input'
    2 | input = sys.stdin.readline
      | ^~~~~
Language: C

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

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

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

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int l= sc.nextInt();
      	String s = sc.next();
      	//System.out.println(s);
		char[] c=s.toCharArray();
		int r=0;
		int g=0;
		int b=0;
		for(int i=0;i<l;i++){
			if(c[i]=='R'){
				r++;
			}
			if(c[i]=='G'){
				g++;
			}
			if(c[i]=='B'){
				b++;
			}
		}
		long t=0;
		for(int i=0;i<l;i++){
			for(int j=1;i+2*j<l;j++){
				if(c[i]!=c[i+j]){
				if(c[i+j]!=c[i+2*j]){
				if(c[i+2*j]!=c[i]){
				t++;
                }
                }
                }
//System.out.println(i);
//System.out.println(j);
			}
		}
		long sum=0;
		sum+=l*(l-1)*(l-2)/6;
		sum-=r*(g*(g-1)/2+b*(b-1)/2);
		sum-=g*(b*(b-1)/2+r*(r-1)/2);
		sum-=b*(r*(r-1)/2+g*(g-1)/2);
      	sum-=r*(r-1)*(r-2)/6;
      	sum-=g*(g-1)*(g-2)/6;
      	sum-=b*(b-1)*(b-2)/6;
      	//System.out.println(sum);
		sum-=t;
//System.out.println(sum);
System.out.println(r*g*b-t);
	}


Compiler output:
Main.java:49: error: reached end of file while parsing
	}
	 ^
1 error
Language: C

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long
 
int main(){
  int n,ans=0;
  scanf("%d",&n);
  char s[n];
  scanf("%s",s);
  
  for(int i=0;i<n-2;i++){
   for(int j=i+1;j<n-1;j++){
     if(s[i]!=s[j])goto loopend;
   }
     loopend for(int k=j+1;k<n;k++){
       if(s[i]==s[j])break;
       if(s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j){
         ans += 1;
       }
     }
  }
  printf("%d",ans);
  return 0;

Compiler output:
main.c: In function 'main':
main.c:17:6: error: 'loopend' undeclared (first use in this function)
   17 |      loopend for(int k=j+1;k<n;k++){
      |      ^~~~~~~
main.c:17:6: note: each undeclared identifier is reported only once for each function it appears in
main.c:17:13: error: expected ';' before 'for'
   17 |      loopend for(int k=j+1;k<n;k++){
      |             ^~~~
      |             ;
main.c:25:3: error: expected declaration or statement at end of input
   25 |   return 0;
      |   ^~~~~~
main.c:15:6: error: label 'loopend' used but not defined
   15 |      if(s[i]!=s[j])goto loopend;
      |      ^~
Language: C

#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;




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

    vector<int>R(n,0);
    vector<int>G(n,0);
    vector<int>B(n,0);
    ll r=0;
    ll g=0;
    ll b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            r++;
            R[i]=r;
            G[i]=g;
            B[i]=b;
        }
        if(s[i]=='G'){
            g++;
            R[i]=r;
            G[i]=g;
            B[i]=b;
        }
        if(s[i]=='B'){
            b++;
            R[i]=r;
            G[i]=g;
            B[i]=b;
        }
    }
    ll ans=0;

    // for(int i=0;i<n;i++){
    //     cout<<G[i]<<endl;
    // }


    for(ll j=1;j<n-1;j++){
        if(s[j]=='R'){
            ans+=(G[j-1] * (B[n-1]-B[j]));
            ans+=(B[j-1] * (G[n-1]-G[j]));
            for(ll i=1;i<=min(j,n-j-1);i++){
                if((s[j-i]=='B' && s[j+i]=='G') || (s[j-i]=='G' && s[j+i]=='B')){
                    ans--;
                }
            }
        }

        if(s[j]=='G'){
            ans+=(B[j-1] * (R[n-1]-R[j]));
            // cout<<ans<<endl;
            ans+=(R[j-1] * (B[n-1]-B[j]));
            // cout<<ans<<endl;
            for(ll i=1;i<=min(j,n-j-1);i++){
                if((s[j-i]=='B' && s[j+i]=='R') || (s[j-i]=='R' && s[j+i]=='B')){
                    ans--;
                }
            }
        }

        if(s[j]=='B'){
            ans+=(R[j-1] * (G[n-1]-G[j]));
            ans+=(G[j-1] * (R[n-1]-R[j]));
            for(ll i=1;i<=min(j,n-j-1);i++){
                if((s[j-i]=='G' && s[j+i]=='R') || (s[j-i]=='R' && s[j+i]=='G')){
                    ans--;
                }
            }
        }
        // cout<<"ans="<<ans<<endl;
    }

    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<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;

int main(){
    int N, sum;
    cin >> N;
    string rgb;
    cin >> rgb;
    for(int i=0; i<N; i++){
        for(int j=i; j<N; j++){
            for(int l=j; l<N; l++){
            if(j-i != l-j){
                if(rgb.at(i)!= rgb.at(j) && rgb.at(j)!= rgb.at(l) && rgb.at(j)!= rgb.at(l)){
                    sum += 1;
                }
            }
                
                
            }
        }
    }

    cout << sum << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> N;
      |     ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include<map>
  +++ |+#include <iostream>
    8 | using namespace std;
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << sum << endl;
      |     ^~~~
a.cc:29:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:20: error: 'endl' was not declared in this scope
   29 |     cout << sum << endl;
      |                    ^~~~
a.cc:8:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    7 | #include<map>
  +++ |+#include <ostream>
    8 | using namespace std;
Language: C++

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


int main() {
  int N;
  string str;
  cin >> N >> str;
  int sum = 0;
  
  
  if (n == 1){
    sum = 1;
  }
  
  else{
  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 ( str.at(i) != str.at(j)){
          if ( str.at(j) != str.at(k)){
            if (str.at(i) != str.at(k)){
              if( j-i != k-j ){
          sum++;
              }
            }
          }
        }
      }
    }
  }
  }
  
  cout << sum <<endl;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'n' was not declared in this scope
   12 |   if (n == 1){
      |       ^
Language: C++

// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define REP_AB(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define REP_IN(i, n, x) for (ll i = 0; i < n; i++)in>>x;
#define REP_OUT(i, n, x) for (ll i = 0; i < n; i++)out<<x<<endl;
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
#define endl '\n'
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll N;
    in >> N;
    string s;
    in >> s;
    ll ans=0;
    ll a=0,x=0,c=0;
    ll r[4000],g[4000],b[4000];
    
    REP(i,N){
        if(s[i]=='R'){
            r[a]=i;
            a++;
        }else if(s[i]=='G'){
            g[x]=i;
            x++;
        }else if(s[i]=='B'){
            b[c]=i;
            c++;
    }
    REP(i,a){
        REP(j,x){
            REP(n,c){
                if(r[i]-g[j] != b[n]-r[i] && g[j]-b[n] != r[i]-g[j] && b[n]-r[i] != g[j]-b[n]){
                    ans++;
                }
            }
        }
    }
    out << ans << endl;
}

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

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

int main(){
    int N;
    char S[N];
    cin >> N;
    for(int i=0;i<N;i++) cin >>S[i];
    long long count = 0;
    for(int i = 0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            if(S[j] ==S[i]) break;
            for(int k =j+1;k<N;k++){
                if((S[k]!=S[i])&&(S[k]!=S[j])&&((j-i) != (k-j))) 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 sum = 0;
  for(int i =0; i< N-2;i++){
    if(S.at(i) == S.at(j)){
      continue;
    }
    for(int j = i+1; j < N-1; j++){
      for(int k = j+1; k < N;k++){
        if(!((j-i) ==(k-j))){
          if(!(S.at(i) == S.at(j))){
            if(!(S.at(i) == S.at(k))){
              if(!(S.at(j) == S.at(k))){
                  sum += 1;
                }
              }
            }
          }
        }
      }
  }
  cout << sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:24: error: 'j' was not declared in this scope
   10 |     if(S.at(i) == S.at(j)){
      |                        ^
Language: Java

mport java.util.*; 
import java.lang.*; 
 
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		String S = scan.next();
		
		char a;
		char b;
		char c;
		
		int sum = 0; 
		
		if(N==1 || N==2){
			System.out.println("0");
		}

		if(N>=3){
		
			for(int i = 0; i<=N-3; i++){
				for(int j = i+1; j<=N-2; j++){
					for(int k = j+1; k<=N-1; k++){	
						if((j-i)!=(k-j)){
							 a = S.charAt(i);
							 b = S.charAt(j);
							 c = S.charAt(k);
							 
							 if( a!=b && b!=c && c!=a ){
							 	sum++;
							 }
						}
					}
				}
			}
			
			System.out.println(sum);
		}
	}
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*; 
^
Main.java:2: error: class, interface, enum, or record expected
import java.lang.*; 
^
2 errors
Language: C

#include <bits/stdc++.h>

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

using namespace std;

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

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

  ll res = 0;
  for (int i = 1; i <= n - 2; ++i) {
    for (int j = i + 1; j <= n - 1; ++j) {
      int ij = j - i;
      if (s[i - 1] == s[j - 1]) {
        continue;
      }
      for (int k = j + 1; k <= n; ++k) {
        int jk = k - j;
        if (ij == jk) {
          continue;
        }
        if (s[i - 1] == s[k - 1]) {
          continue;
        }
        if (s[j - 1] == s[k - 1]) {
          continue;
        }
        res++;
      }
    }
  }
  cout << res << 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"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

void Main()
{
  int N;
  string S;
  
  cin >> N >> S;
  
  long long count = 0;
  
  for(int i = 0; i < N - 3; i++){
    for(int j = 1; j < N - 2; j++){
      for(int k = 2; k < N - 1; k++){
        if((i < j && j < k) && (k - j != j - i)){
          if(S[i] != S[j] && S[j] != S[k] && S[k] != S[i])
            count++;
        }
      }
    }
  }
  
  printf("%lld", count);
	
	
}

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

Compiler output:
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
    2 | #include<boost/multi_array.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
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-j)/2; k++) {
      if (S[j] != S[j+k] && S[j+k] != S[j+k*2] && S[j+k*2] != S[j}) sum++;
    }
  }
  
  cout << r*g*b-sum << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:66: error: expected ']' before '}' token
   18 |       if (S[j] != S[j+k] && S[j+k] != S[j+k*2] && S[j+k*2] != S[j}) sum++;
      |                                                                  ^
      |                                                                  ]
a.cc:18:66: error: expected ')' before '}' token
   18 |       if (S[j] != S[j+k] && S[j+k] != S[j+k*2] && S[j+k*2] != S[j}) sum++;
      |          ~                                                       ^
      |                                                                  )
a.cc:18:66: error: expected primary-expression before '}' token
a.cc:18:67: error: expected primary-expression before ')' token
   18 |       if (S[j] != S[j+k] && S[j+k] != S[j+k*2] && S[j+k*2] != S[j}) sum++;
      |                                                                   ^
a.cc: At global scope:
a.cc:22:3: error: 'cout' does not name a type
   22 |   cout << r*g*b-sum << endl;
      |   ^~~~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: C

#include <stdio.h>

int aa(char c){
	if(c=='R'){
    	return 0;
    }else if(c=='G'){
    	return 1;
    }
  	return 2;
}

int main(void){
	char str[4001];
  	int flg[3]={-1,-1,-1};
  	int n,i,j,k;
  	int count=0;
  	scanf("%d",&n);
  	scanf("%s",str);
  	for(i=0;i<n-2;i++){
      	flg[aa(str[i])]=1;
    	for(j=i+1;j<n-1;j++){
          	if(flg[aa(str[j])]==1){continue;}
          	flg[aa(str[j])]==1
        	for(k=j+1;k<n;k++){
            	if(flg[aa(str[k])]==1||j-i==k-j){continue;}
              	count++;
            }
          	flg[aa(str[j])]==-1;
        }
      	flg[aa(str[i])]=-1;
    }
  	printf("%d\n",count);
}

Compiler output:
main.c: In function 'main':
main.c:23:35: error: expected ';' before 'for'
   23 |                 flg[aa(str[j])]==1
      |                                   ^
      |                                   ;
   24 |                 for(k=j+1;k<n;k++){
      |                 ~~~