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

#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>  
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
string s;
ll* red=new ll[4001]();
ll* gre=new ll[4001]();
ll* blu=new ll[4001]();
void ltor(char a,ll n)
{
    ll cur=0;
    for(ll i=0;i<n;++i)
    {
        if(s[i]==a)
        {
            ++cur;
        }
            if(a=='R')
            {
                red[i]=cur;
            }
            else if(a=='G')
            {
                gre[i]=cur;
            }
            else
            {
                blu[i]=cur;
            }
    }
}
int main()
{
    ll n;
    cin>>n;
    cin>>s;
    ltor('R',n);
    ltor('G',n);
    ltor('B',n);
    ll ans=0;
    for(ll i=0;i<n;++i)
    {
        ll end=n-1;
        while(end>i+2)
        {
            if((s[i]=='R'&&s[end]=='B')||(s[i]=='B'&&s[end]=='R'c))
            {
                ans+=(gre[end]-gre[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='G')
                    {
                        --ans;
                    }
                }
            }
            else if((s[i]=='R'&&s[end]=='G')||(s[i]=='G'&&s[end]=='R'))
            {
                ans+=(blu[end]-blu[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='B')
                    {
                        --ans;
                    }
                }
            }
            else if((s[i]=='G'&&s[end]=='B')||(s[i]=='B'&&s[end]=='G'))
            {
                ans+=(red[end]-red[i]);
                if((end+i)%2==0)
                {
                    ll num=(end+i)/2;
                    if(s[num]=='R')
                    {
                        --ans;
                    }
                }
            }
            --end;
        }
    }
    cout<<ans<<endl;
}














Compiler output:
a.cc: In function 'int main()':
a.cc:55:62: error: unable to find character literal operator 'operator""c' with 'char' argument
   55 |             if((s[i]=='R'&&s[end]=='B')||(s[i]=='B'&&s[end]=='R'c))
      |                                                              ^~~~
Language: C++

int main(void){
    int N;
    long long int ans=0;
    scanf("%d",&N);
    std::string str;
    std::cin >> str ;
    //std::cout << str;
    for(int m=0;m<str.length();m++){
        char c=str[m];
        for(int x=m+1;x<str.length();x++){
            if(c!=str[x]){
                char cx= str[x];
                for(int y=x+1;y<str.length();y++){
                    if((c!=str[y])&&(cx!=str[y])){
                        if(x-m!=y-x)
                        ans++;
                    }
                }
            }
        }
    }
    printf("%lld",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'scanf' was not declared in this scope
    4 |     scanf("%d",&N);
      |     ^~~~~
a.cc:5:10: error: 'string' is not a member of 'std'
    5 |     std::string str;
      |          ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | int main(void){
a.cc:6:10: error: 'cin' is not a member of 'std'
    6 |     std::cin >> str ;
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | int main(void){
a.cc:6:17: error: 'str' was not declared in this scope; did you mean 'std'?
    6 |     std::cin >> str ;
      |                 ^~~
      |                 std
a.cc:22:5: error: 'printf' was not declared in this scope
   22 |     printf("%lld",ans);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int main(void){
Language: C

        #include <bits/stdc++.h>
        using namespace std;
        long long n,ans,pref[4001][3],vals[4001];
        string s;
         
        int main(){
            cin >> n >> s;
            for(int i = 0 ; i < n ; i += 1){
                if(s[i] == 'R'){
                    vals[i] = 0;
                }else if(s[i] == 'G'){
                    vals[i] = 1;
                }else{
                    vals[i] = 2;
                }
            }
            for(int i = n-1 ; i >= 0 ; i -= 1){
                for(int j = 0 ; j < 3 ; j += 1){
                    pref[i][j] = pref[i+1][j];
                }
                pref[i][vals[i]] += 1;
            }
            for(int i = 0 ; i+1 < n ; i += 1){
                for(int j = i+1 ; j < n ; j += 1){
                    if(vals[j] == vals[i]){
                        continue;
                    }
                    ans += pref[j][3-vals[i]-vals[j]];
                    if(2*j-i < n && vals[2*j-i] == 3-vals[i]-vals[j]){
                        ans -= 1;
                    }
                }
            }
            cout << ans << endl;
        }

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

//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

bool med3(int a, int b, int c) {
    int _min, _max;
    _min = _max = a;
    _min = min(_min,b);
    _min = min(_min,c);
    _max = max(_max,b);
    _max = max(_max,c);

    if(_min != a && _max != a) {
        return abs(b-a) != abs(c-a);
    }
    if(_min != b && _max != b) {
        return abs(a-b) != abs(c-b);
    }
    if(_min != c && _max != c){ 
        return abs(a-c) != abs(b-c);
    }

}
int main(void) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    vector<int> r, g, b;
    r.reserve(n);
    g.reserve(n);
    b.reserve(n);
    REP(i,n) {
        if(s[i]== 'R') {
            r.push_back(i);
        }else if(s[i]== 'G') {
            g.push_back(i);
        }else {
            b.push_back(i);
        }
    }
    ll ans = 0;
    for(int i : r)
    for(int j : g)
    for(int k : b) {
        if(med3(i,j,k)) ans++;
    }
    cout << ans << endl;

    return 0;
}

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 <bits/stdc++.h>
typedef long long ll;
#define MOD 1000000007
#define INF -99999999 
using namespace std;
 
int main(){
    int N;
    string S;
    cin >> N >> S;
    int R,G,B;
    R = G = B = 0;
    for (int i = 0; i < N; i++)
    {
        if(S[i] == 'R') R++;
        else if(S[i] == 'G') G++;
        else B++;
    }
    ll ans = R*G*B;
    for (int i = 0; i < N; i++)
    {
        for (int j = i+1; j < N; j++)
        {
            int k = 2*j-i;
            if(k >= N) break;
            if(S[i] != S[j] && S[i] != S[k] && S[k] != S[j]) ans -= 1;
        }
        
    }
    cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	//int cntr=0,cntg=0,cntb=0;
	vector<int> cntr,cntg,cntb;
	for (int i=0;i<n;i++){
		if (s[i]=='R') cntr.push_back(i);
		if (s[i]=='G') cntg.push_back(i);
		if (s[i]=='B') cntb.push_back(i);
	}
	long long res=0;
	for (int i=0;i<cntr.size();i++)
		for (int k=0;k<cntb.size();k++)
			for (int j=0;j<cntg.size();j++){
				vector<int> v;
				v.push_back(cntr[i]);
				v.push_back(cntb[k]);
				v.push_back(cntg[j]);
				sort(v.begin(),v.end());
				if (v[1]-v[0]!=v[2]-v[1])
					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 <iostream>
using namespace std;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int i, j, k, Ans = 0;
    for(i=0;i<n-2;i++){
        char I = s[i];
        for(j=i+1;j<n-1;j++){
            char J = s[j];
            if(J == I){
                continue;
            }
            for(k=j+1;k<n;k++){
                char K = s[k];
                if(K == I || K == J || (j-i == k-j)){
                    continue;
                }
                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;
typedef long long ll;
typedef vector<ll> vl ;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;

#define rep(i,N) for(int i=0; i < (int)N; i++)
#define all(v) (v).begin(),(v).end()

const int INF = 100000002;

vector<int> a, b, c;

int main(){
	int n; cin >> n;
	vector<char> s(n); 
	rep(i,n){
		cin >> s[i];
		if (s[i]=='R') a.push_back(i);
		else if(s[i]=='G') b.push_back(i);
		else c.push_back(i);
	} 
	ll ans = 0;
	for(auto x:a){
		for(auto y:b){
			for(auto z:c){
				if ((x+y) == 2*z || (y+z) = x*2 || (x+z) == 2*y){
					continue;
				}else{
					ans++;
				}
			}		
		}
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:50: error: lvalue required as left operand of assignment
   30 |                                 if ((x+y) == 2*z || (y+z) = x*2 || (x+z) == 2*y){
      |                                     ~~~~~~~~~~~~~^~~~~~~~
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;

    int R[n], G[n], B[n];
    int x=0, y=0, z=0;

    rep(i,n) {
        if (s[i] == "R"){
            R[x] = i;
            x++;
        } else if (s[i] == "G"){
            G[y] = i;
            y++;
        } else {
            B[z] = i;
            z++;
        }
    }

    int ans = 0;
    vector<int> tmp;
    rep(i,x){
        rep(j,y){
            rep(k,z){
                tmp[0] = R[i];
                tmp[1] = G[j];
                tmp[2] = B[k];
                sort(tmp.begin(), tmp.end());
                if (tmp[1]-tmp[0]==tmp[2]-tmp[1]) ans++;
            }
        }
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |         if (s[i] == "R"){
a.cc:20:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |         } else if (s[i] == "G"){
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n;
	string s;
	char c;
	long ans = 0;
	int i, j, k;
	int *r, *g, *b;

	cin >> n;
	cin >> s;
	r = new long[n+n];
	g = new long[n+n];
	b = new long[n+n];


	for (i = n + n - 1; i >= n; i--) {
		r[i] = g[i] = b[i] = 0;
	}

	for (i = n-1; i >= 0; i--) {
		r[i ] = r[i+1];
		g[i ] = g[i+1];
		b[i ] = b[i+1];
		if (s[i] == 'R') {
			r[i]++;
		}
		else if (s[i] == 'G') {
			g[i]++;
		}
		else {
			b[i]++;
		}
	}

	for (i = 0; i < n-2 ; i++) {
		for (j = i + 1; j < n-1; j++) {
			if (s[i] == s[j])continue;
			if (s[i] == 'R') {
				if (s[j] == 'G') {
					c = 'B';
					ans += b[j + 1];
				}
				else {
					c = 'G';
					ans += g[j + 1];
				}
			}
			else if (s[i] == 'G') {
				if (s[j] == 'B') {
					c = 'R';
					ans += r[j + 1];
				}
				else {
					c = 'B';
					ans += b[j + 1];
				}
			}
			else {
				if (s[j] == 'R') {
					c = 'G';
					ans += g[j + 1];
				}
				else {
					c = 'R';
					ans += r[j + 1];
				}
			}

			if (j + j - i < n) {
				if (s[j + j - i] == c) {
					ans--;
				}
			}

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




Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: cannot convert 'long int*' to 'int*' in assignment
   15 |         r = new long[n+n];
      |             ^~~~~~~~~~~~~
      |             |
      |             long int*
a.cc:16:13: error: cannot convert 'long int*' to 'int*' in assignment
   16 |         g = new long[n+n];
      |             ^~~~~~~~~~~~~
      |             |
      |             long int*
a.cc:17:13: error: cannot convert 'long int*' to 'int*' in assignment
   17 |         b = new long[n+n];
      |             ^~~~~~~~~~~~~
      |             |
      |             long int*
Language: C++

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


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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: expected ';' before 'cin'
   10 |     cin >> n
      |             ^
      |             ;
   11 |     cin >> s;
      |     ~~~
Language: C++

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

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




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

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

int main(void) {
    int n;
    string s;
    int ans;

    cin >> n >> s;

    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            for (l = j + 1; l < n; l++) {
                if (s.at(i) != s.at(j))
                    if (s.at(j) != s.at(l))
                        if (s.at(i) != s.at(l))
                            if ((j - i) != (l - j))
                                ans++;
            }
        }
    }

    cout << ans;

    return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(void) {
      | ~~~                 
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
   11 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:12:14: error: 'j' was not declared in this scope
   12 |         for (j = i + 1; j < n; j++) {
      |              ^
a.cc:13:18: error: 'l' was not declared in this scope
   13 |             for (l = j + 1; l < n; l++) {
      |                  ^
Language: C++

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

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




Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'String' was not declared in this scope
    7 |   String s;
      |   ^~~~~~
a.cc:8:15: error: 's' was not declared in this scope
    8 |   cin >> n >> s;
      |               ^
a.cc:25:2: error: expected '}' at end of input
   25 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C

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

int main(void){
    long long n,r,g,b;
    string s;
    cin >> n >> s;
    r = count(s.cbegin(), s.cend(), 'R');
    g = count(s.cbegin(), s.cend(), 'G');
    b = count(s.cbegin(), s.cend(), 'B');
    
    long long count = 0;
    for (long long i = 0; i < n; i++){
        for (long long j = i + 1; j <= (n+i-1)/2; j++){
            vector<char> se ={s.at(i), s.at(j), s.at(2*j-i)};
             int coun = 0;
            if(se.at(0)=='R'||se.at(1)=='R'||se.at(2)=='R') coun++;
            if(se.at(0)=='G'||se.at(1)=='G'||se.at(2)=='G') coun++;
            if(se.at(0)=='B'||se.at(1)=='B'||se.at(2)=='B') coun++;
            if(coun == 3) count++;
        }
    }
    long long ans;
    ans = r * g * b - count;
    printf("%lld\n",ans);
}

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

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
const double EPS = 1e-10;
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int n; cin >> n;
    string s; cin >> s;
    vector<vector<int>> sum(n,vector<int>(3));
    map<char,int> mp;
    mp['R'] = 0;
    mp['G'] = 1;
    mp['B'] = 2;
    sum[n-1][mp[s[n-1]]]++;
    for(int i = n-2; i >= 0; i--){
        rep(j,3) sum[i][j] = sum[i+1][j];
        sum[i][mp[s[i]]] = sum[i+1][mp[s[i]]]+1;
    }
    ll ans = 0;
    rep(i,n-2)repr(j,i+1,n-1){
        if(s[i] == s[j]) continue;
        int k = 3-mp[s[i]]-mp[s[j]];
        ans += sum[j+1][k];
        if(2*j-i < n && mp[s[j+j-i]] == k) ans--;
    }
    cout << ans << endl;
       
}


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

#include <bits/stdc++.h>
#include <set>
#include <map>
#include <queue>
#include <vector>
using namespace std;
typedef char chr;
typedef double  dbl;
typedef long long int lld;
#define FastIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
lld lowerIndex(lld arr[], lld n, lld x) 
{ 
    lld l = 0 , h = n - 1;
    while (l <= h) { 
        lld mid = (l+h)/2;
        if (arr[mid] >= x) 
            h = mid - 1; 
        else
            l = mid + 1; 
    } 
    return l; 
}
lld upperIndex(lld arr[], lld n, lld y)
{ 
    lld l = 0 , h = n - 1; 
    while (l <= h) { 
        lld mid = (l+h)/2; 
        if (arr[mid] <= y) 
            l = mid + 1; 
        else
            h = mid - 1; 
    } 
    return h; 
}
lld countInRange(lld arr[], lld n, lld x, lld y) 
{
    lld count = 0; 
    count = upperIndex(arr, n, y) - lowerIndex(arr, n, x) + 1; 
    return count; 
}
int main () {
    FastIO
    lld n, i;
    cin >> n;
    string s;
    cin >> s;
    lld j, k;
    lld R[n];
    lld G[n];
    lld B[n];
    lld a, b;
    lld c;
    a = 0;
    b = 0;
    c = 0;
    for(i = 0; i < n-0; i+=1){
    	if (s[i] == 'R'){
    		R[a] = i;
    		a++;
    	}
    	if (s[i] == 'G'){
    		G[b] = i;
    		b++;
    	}
    	if (s[i] == 'B'){
    		B[c] = i;
    		c++;
    	}
    }
    lld sum = 0;
    for(i = 0; i < n-2; i+=1){
    	for(k = i+2;k<n;k+=1){
    		if (s[i] != s[k]){
    			if (s[i] == 'R' && s[k] == 'G'){
    				sum+= countInRange(B,c,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'B'){
    					sum--;
    				}
    			}
    			if (s[i] == 'R' && s[k] == 'B'){
    				sum+= countInRange(G,b,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'G'){
    					sum--;
    				}
    			}
    			if (s[i] == 'G' && s[k] == 'R'){
    				sum+= countInRange(B,c,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'B'){
    					sum--;
    				}
    			}
    			if (s[i] == 'G' && s[k] == 'B'){
    				sum+= countInRange(R,a,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'R'){
    					sum--;
    				}
    			}
    			if (s[i] == 'B' && s[k] == 'G'){
    				sum+= countInRange(R,a,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'R'){
    					sum--;
    				}
    			}
    			if (s[i] == 'B' && s[k] == 'R'){
    				sum+= countInRange(G,b,i,k);
    				if ((i+k) % 2 == 0 && s[(i+k)/2] == 'G'){
    					sum--;
    				}
    			}
    		}
    	}
    }
    cout << sum << "\n";
    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(void) {
    int n;
    string s;
    int ans;

    cin >> n >> s;

    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            for (l = j + 1; l < n; l++) {
                if (s.at(i) != s.at(j))
                    if (s.at(j) != s.at(l))
                        if (s.at(i) != s.at(l))
                            if ((j - i) != (l - j))
                                ans++
            }
        }
    }

    cout << ans;

    return 0;
}

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(void) {
      | ~~~                 
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
   11 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:12:14: error: 'j' was not declared in this scope
   12 |         for (j = i + 1; j < n; j++) {
      |              ^
a.cc:13:18: error: 'l' was not declared in this scope
   13 |             for (l = j + 1; l < n; l++) {
      |                  ^
a.cc:18:38: error: expected ';' before '}' token
   18 |                                 ans++
      |                                      ^
      |                                      ;
   19 |             }
      |             ~
Language: C

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
ll a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	cin >> n >> s;
	vector<int> R, G, B;
	rep(i, n) {
		if (s[i] == 'R')R.push_back(i);
		else if (s[i] == 'G')G.push_back(i);
		else B.push_back(i);
	}
	int sum = 0;
	for (int i = 1; i <(n-3)/2+2 ; i++) {
		rep(j, n - 2 * i) {
			if (s[j] != s[j + i] && s[j + i * 2] != s[j] && s[j + i] != s[j + i * 2])
				sum++;
		}
	}
	cout << R.size() * G.size() * B.size() - sum << endl;	

	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
   long long int sum = 0;
  for(int i = 0; i < (double)N / 3; i++) {
     for(int j = N / 3; j < (double)2*(N / 3); j++) {
        for(int k = 2 *(N / 3) ; k < N; k++) {
           if(S[i] != S[j] && S[i] != S[k] && S[j] != S[k] && i < j && j < k) {
              if(j - i != k - j) { sum++; }
           }
        }
     }
  }
  cout << sum;
 return 0;

}


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

#include <bits/stdc++.h>
#include <string>
#include <stdio.h>
#include <cstdlib>

using namespace std;

int main() {
    int i , j , k ;
    int n;
    int cnt;
    char str[];
    cin >> n;
    cin >> str;
    for (i = 1; i <= (n-2); i++){
        for(j=1; j <= (n-1); j++){
            for (k = 1; k <= n; k++){
                if ((str[i] != str[j]) && (str[j] != str[k]) && (str[i] != str[k])){
                    if (j-i) != (k-j){
                        cnt = cnt +1;
                    }
                }
            }
        }
    }
    cout << cnt;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: storage size of 'str' isn't known
   12 |     char str[];
      |          ^~~
a.cc:19:30: error: expected primary-expression before '!=' token
   19 |                     if (j-i) != (k-j){
      |                              ^~
Language: Java


import java.util.HashMap;
import java.util.Scanner;

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

    public static void main(String[] args) {
        int n = sc.nextInt();
        String s = sc.next();

        int ans = 0;



        //0R, 1G, 2B
        boolean[] rgb = new boolean[3];

        for(int i = 0; i < s.length()-2; i++){
            for(int j = i+1; j < s.length()-1; j++){
                for(int k = j+1; k < s.length(); k++){
                    if(s.charAt(i)!=s.charAt(j)&&s.charAt(j)!=s.charAt(k)
                    &&s.charAt(i)!=s.charAt(k)){
                        if(j-i!=k-j){
                            ans++;
                        }
                    }
                }
            }
        }
        System.out.println(ans);


Compiler output:
Main.java:31: error: reached end of file while parsing
        System.out.println(ans);
                                ^
1 error
Language: C

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


Compiler output:
main.c: In function 'main':
main.c:4:8: error: conflicting types for 's'; have 'char[4000]'
    4 |   char s[4000];
      |        ^
main.c:3:19: note: previous definition of 's' with type 'int'
    3 |   int n,i,j,k,a,b,s=0;
      |                   ^
Language: C++

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

int main(void) {
    int n;
    string s;
    int ans;

    cin >> n >> s;

    for (i = 0; i < n; i++) {
        for (j = i + 1; j < n; j++) {
            for (l = j + 1; l < n; l++) {
                if (s.at(i) != s.at(j))
                    if (s.at(j) != s.at(l))
                        if (s.at(i) != s.at(l))
                            if ((j - i) != (l - j))
                                ans ++

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

Compiler output:
a.cc:2:20: error: expected ';' before 'int'
    2 | using namespace std
      |                    ^
      |                    ;
    3 | 
    4 | int main(void) {
      | ~~~                 
a.cc: In function 'int main()':
a.cc:11:10: error: 'i' was not declared in this scope
   11 |     for (i = 0; i < n; i++) {
      |          ^
a.cc:12:14: error: 'j' was not declared in this scope
   12 |         for (j = i + 1; j < n; j++) {
      |              ^
a.cc:13:18: error: 'l' was not declared in this scope
   13 |             for (l = j + 1; l < n; l++) {
      |                  ^
a.cc:18:39: error: expected ';' before 'cout'
   18 |                                 ans ++
      |                                       ^
      |                                       ;
   19 | 
   20 |                                 cout << ans
      |                                 ~~~~
Language: C

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

Compiler output:
main.c: In function 'main':
main.c:4:8: error: conflicting types for 's'; have 'char[4000]'
    4 |   char s[4000];
      |        ^
main.c:3:19: note: previous definition of 's' with type 'int'
    3 |   int n,i,j,k,a,b,s=0;
      |                   ^
Language: C

#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	
	ll cnt = 0;
	vector<ll> rgb(3);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R')
			rgb[0]++;
		else if (s[i] == 'G')
			rgb[1]++;
		else
			rgb[2]++;
	}
	cnt = rgb[0] * rgb[1] * rgb[2];

	if (n > 2) {
		for (int d = 1; d < n; d++) {
			for (int i = 0; i < n; i++) {
				if (i + 2 * d >= n) {
					break;
				}
				else
				{
					if ((s[i] != s[i + d]) && (s[i + d] != s[i + 2 * d]) && (s[i + 2 * d] != s[i])) {
						cnt--;
					}
				}
			}
		}
	}
	cout << cnt << endl;
	return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
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])break;
				if(c[i+j]==c[i+2*j])break;
				if(c[i+2*j]==c[i])break;
				t++;
			}
		}
		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);
	}

Compiler output:
Main.java:43: error: reached end of file while parsing
	}
	 ^
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++){
		char c;
		c = S.at(i);
		coln.at(0) = c;
		memo[0]=i;
		
		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++;
						}	
					}
				}
				
			}
		}
	
	
	}
	
	cout << cnt << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |                         if(c != coln.at[0]){
      |                                        ^
a.cc:26:56: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |                                         if(c != coln.at[0] && c != coln.at[1]){
      |                                                        ^
a.cc:26:75: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |                                         if(c != coln.at[0] && c != coln.at[1]){
      |                                                                           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define in freopen("in.txt","r",stdin)
//#define out freopen("out.txt","w",stdout) 
const int N=1e9+10;
ll n,m,i,j,k,t,l,r;
ll a,b,c,d;
char A,C,X,Y,Z;
ll ans,MAX,MIN,sum;
ll ax[2000500];
ll R[N]={0},G[N]={0},B[N]={0};
char cx[5000],str[5000];
ll dx[12];
ll bx[500];


int main()
{
    t=1;
    //scanf("%lld",&t);
    while(t--)
    {
        sum=0;
        scanf("%lld",&n);
        scanf("%s",str);
        for(i=0;i<n;i++)
        {
            if(str[i]=='R') R[i]=R[i-1]+1;
            else R[i]=R[i-1];
            if(str[i]=='G') G[i]=G[i-1]+1;
            else G[i]=G[i-1];
            if(str[i]=='B') B[i]=B[i-1]+1;
            else B[i]=B[i-1];
        }
        for(i=1;i<=n-2;i++)
        {
            if(str[i-1]=='G') sum+=(R[n]-R[i])*(B[n]-B[i]);
            if(str[i-1]=='R') sum+=(G[n]-G[i])*(B[n]-B[i]);
            if(str[i-1]=='B') sum+=(R[n]-R[i])*(G[n]-G[i]);
        }
        printf("%lld\n",sum);
    }
	return 0;
}

Compiler output:
/tmp/ccbI9lpD.o: in function `main':
a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `str' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `str' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x101): relocation truncated to fit: R_X86_64_PC32 against symbol `str' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x123): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x141): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x17b): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x18d): relocation truncated to fit: R_X86_64_PC32 against symbol `str' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x1af): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x1cd): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccbI9lpD.o
a.cc:(.text+0x1f4): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

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

int n, a[4010][20] = {0};
string s;
map<char, int> m;
long long ans = 0;
int main() {
    cin >> n >> s;
    m['R'] = 1;
    m['G'] = 2;
    m['B'] = 3;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= 3; j++) a[i][j] = a[i - 1][j];
        a[i][m[s[i - 1]]]++;
    }
    for(int i = 2; i < n; i++) {
        for(int j = 1; j < i; j++) {
            int c = 6 - m[s[i]] - m[s[j]];
            ans += a[j][c];
            if(2 * j - i > -1 && m[s[2 * j - i]] == c) ans--;
        }
    }
    cout << ans;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define mod 1000000007
#define f(i,a,b) for(ll i=a;i<b;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ii pair<ll,ll>
#define vii vector<ii>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define MAX 1e9
 
ll modpow(ll base, ll exp, ll modulus) {base %= modulus;ll result = 1;while (exp > 0) {if (exp & 1) result = (result * base) % modulus;base = (base * base) % modulus;exp >>= 1;}return result;}
const ld pi=acos(-1);

ll check(ll x,ll y,ll z){
    ll cnt=0;
    ll a[3]={x,y,z};
    sort(a,a+3);
    
    do{
        if(a[0]<a[1] && a[1]<a[2] && ((a[1]-a[0])!=(a[2]-a[1]))){cnt++;}
    }while(next_permutation(a,a+3));
    return cnt;
}
int main(){
    IOS;
    ll n;cin>>n;
    string s;cin>>s;
    vector<ll>a,b,c;
    f(i,0,s.size()){
        if(s[i]=='R')a.pb(i);
        else if(s[i]=='G')b.pb(i);
        else c.pb(i);
    }
    ll sum=0;
    f(i,0,a.size()){
        f(j,0,b.size()){
            f(k,0,c.size()){
                sum+=(check(a[i],b[j],c[k]));
            }
        }
    }
    cout<<sum;
    return 0;  
} 





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

#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define V vector<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int N;  cin >> N;
    string s;  cin >> s;

    int kp[3][4000];
    REP(i, 3)  REP(j, 4000)  kp[i][j] = 0;  //RGB
    if(s[0] == 'R')       kp[0][0]++;
    else if(s[0] == 'G')  kp[1][0]++;
    else if(s[0] == 'B')  kp[2][0]++;
    
    REP(i, N){
      kp[0][i] = kp[0][i - 1];
      kp[1][i] = kp[1][i - 1];
      kp[2][i] = kp[2][i - 1];
      if(s[i] == 'R')       kp[0][i]++;
      else if(s[i] == 'G')  kp[1][i]++;
      else if(s[i] == 'B')  kp[2][i]++;
      
    }


    ll ans = 0;
    for(int i = 1 ;  i < N-1 ; i++){
      if(s[i] == 'R')      ans += kp[1][i-1]*(kp[2][N-1]-kp[2][i]) + kp[2][i-1]*(kp[1][N-1]-kp[1][i]);
      else if(s[i] == 'G') ans += kp[0][i-1]*(kp[2][N-1]-kp[2][i]) + kp[2][i-1]*(kp[0][N-1]-kp[0][i]);
 	  else if(s[i] == 'B') ans += kp[0][i-1]*(kp[1][N-1]-kp[1][i]) + kp[1][i-1]*(kp[0][N-1]-kp[0][i]);
      
      for(int side = 1 ; side <= min(i, N-i-1) ; side++){
        if(s[i] != s[i-side] && s[i] != s[i+side] && s[i+side] != s[i-side])  ans--;
      }
    }

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


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

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

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


Compiler output:
a.cc:16:39: error: extended character 　 is not valid in an identifier
   16 |                 if (s.at(i) != s.at(j)　&& s.at(j) != s.at(k))
      |                                       ^
a.cc: In function 'int main()':
a.cc:16:39: error: expected ')' before '\U00003000'
   16 |                 if (s.at(i) != s.at(j)　&& s.at(j) != s.at(k))
      |                    ~                  ^~
      |                                       )
Language: C

#include <bits/stdc++.h>
#include <set>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  

void greatFirst(ll& a, ll& b)
{
  if(a < b)
  {
    ll tmp = a;
    a = b;
    b = tmp;
  }
}

ll gcd(ll a, ll b)
{
  greatFirst(a, b);
  
  while(a % b != 0)
  {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  
  return b;
}

int main()
{
  int n;
  string s;
  cin >> n >> s;
  
  vector<int> r, g, b;
  rep(i, n)
  {
    if(s[i] == 'R')
    {
      r.push_back(i);
    }
    else if(s[i] == 'G')
    {
      g.push_back(i);
    }
    else
    {
      b.push_back(i);
    }
  }
  
  if(r.size() == 0 || g.size() == 0 || b.size() == 0)
  {
    cout << 0 << endl;
    return 0;
  }
  
  ll out = 0;
  for(auto ri : r)
  {
    for(auto gi : g)
    {
      for(auto bi : b)
      {
        int sub1 = abs(ri - bi);
        int sub2 = abs(ri - gi);
        int sub3 = abs(bi - gi);
        if(sub1 == sub2 || sub2 == sub3 || sub1 == sub3)
        {
          out++;
        }
      }
    }
  }
  
  ll ans = r.size() * g.size() * b.size() - out;
  cout << fixed << 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;
	string S;
	cin >> N >> S;
	string coln = "NNN"
	int memo[3] = {0};
	int cnt = 0;
	
	for(int i = 0;i<N;i++){
		char c;
		c = N.at(i);
		coln.at(0) = c;
		memo[0]=i;
		
		for(int j = i+1;j<N;j++){
			c = N.at(j);
			if(c != coln.at[0]){
				coln.at(1) = c;
				memo[1] = j;
				
				for(int k = j+1;k<N;k++){
					c = N.at(k);
					if(c != coln.at[0] && c != coln.at[1]){
						memo[2] = k;
						if(k-j != j-i){
							cnt++;
						}	
					}
				}
				
			}
		}
	
	
	}
	
	cout << cnt << endl;


}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: expected ',' or ';' before 'int'
    9 |         int memo[3] = {0};
      |         ^~~
a.cc:14:23: error: request for member 'at' in 'N', which is of non-class type 'int'
   14 |                 c = N.at(i);
      |                       ^~
a.cc:16:17: error: 'memo' was not declared in this scope
   16 |                 memo[0]=i;
      |                 ^~~~
a.cc:19:31: error: request for member 'at' in 'N', which is of non-class type 'int'
   19 |                         c = N.at(j);
      |                               ^~
a.cc:20:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |                         if(c != coln.at[0]){
      |                                        ^
a.cc:25:47: error: request for member 'at' in 'N', which is of non-class type 'int'
   25 |                                         c = N.at(k);
      |                                               ^~
a.cc:26:56: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |                                         if(c != coln.at[0] && c != coln.at[1]){
      |                                                        ^
a.cc:26:75: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   26 |                                         if(c != coln.at[0] && c != coln.at[1]){
      |                                                                           ^
Language: C

#include <array>
#include <iostream>
#include <string>

int N;
std::string S;

std::array<int, 4005> sumR, sumG, sumB;

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

    sumR.fill(0);
    sumG.fill(0);
    sumB.fill(0);

    for (int i = 1; i <= N; ++i)
    {
        auto c = S[i - 1];

        sumR[i] = sumR[i - 1];
        sumG[i] = sumG[i - 1];
        sumB[i] = sumB[i - 1];

        if (c == 'R')
            sumR[i]++;
        else if (c == 'G')
            sumG[i]++;
        else if (c == 'B')
            sumB[i]++;
    }

    int ans = 0;
    for (int j = 2; j <= N - 1; ++j)
    {
        for (int k = j + 1; k <= N; ++k)
        {
            auto cj = S[j - 1];
            auto ck = S[k - 1];
            auto ieq = 2 * j - k - 1;
            if (cj == ck)
                continue;
            if ((cj == 'R' && ck == 'G') || (cj == 'G' && ck == 'R'))
            {
                ans += sumB[j - 1];
                if (ieq >= 0 && S[ieq] == 'B')
                {
                    ans--;
                }
            }
            else if ((cj == 'R' && ck == 'B') || (cj == 'B' && ck == 'R'))
            {
                ans += sumG[j - 1];
                if (ieq >= 0 && S[ieq] == 'G')
                {
                    ans--;
                }
            }
            else if ((cj == 'B' && ck == 'G') || (cj == 'G' && ck == 'B'))
            {
                ans += sumR[j - 1];
                if (ieq >= 0 && S[ieq] == 'R')
                {
                    ans--;
                }
            }
        }
    }

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


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

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

int main() 
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	
	short r[4000] ={};
	short g[4000] ={};
	short b[4000] ={};
	int nr = 0;
	int ng = 0;
	int nb = 0;
	
	for(int i = 0; i < N; i++){
		if(s[i] == 'R') r[nr++] = i;
		if(s[i] == 'G') g[ng++] = i;
		if(s[i] == 'B') b[nb++] = i;
	}
	
	long v = 0;
	for(int i = 0; i < nr; i++){
		short v0 = r[i];
		for(int j = 0; j < ng; j++){
			short v1 = g[j];
			short v_max1 = max(v0, v1);
			short v_min1 = min(v0, v2);
			
			for(int k = 0; k < nb; k++){
				short v2 = b[k];
				
				short v_max = max(v2, v_max1);
				short v_min = min(v2, v_min1);
				short v_mid = v0 + v1 + v2 - v_max - v_min;
				if(v_mid - v_min == v_max - v_mid) continue;
				v++;
			}
		}
	}
	cout << v;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:48: error: 'v2' was not declared in this scope; did you mean 'v1'?
   30 |                         short v_min1 = min(v0, v2);
      |                                                ^~
      |                                                v1