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

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

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main {
      |     ^~~~
a.cc:4:10: error: expected primary-expression before 'S'
    4 |   string S;
      |          ^
a.cc:4:10: error: expected '}' before 'S'
a.cc:3:10: note: to match this '{'
    3 | int main {
      |          ^
a.cc:6:3: error: reference to 'count' is ambiguous
    6 |   count = 0;
      |   ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:                 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
a.cc:5:10: note:                 'int count'
    5 |   int N, count;
      |          ^~~~~
a.cc:7:3: error: 'cin' does not name a type
    7 |   cin >> N, S;
      |   ^~~
a.cc:8:3: error: expected unqualified-id before 'for'
    8 |   for (i = 1; i < N - 2; i++) {
      |   ^~~
a.cc:8:15: error: 'i' does not name a type
    8 |   for (i = 1; i < N - 2; i++) {
      |               ^
a.cc:8:26: error: 'i' does not name a type
    8 |   for (i = 1; i < N - 2; i++) {
      |                          ^
a.cc:19:3: error: 'cout' does not name a type
   19 |   cout << count << endl;
      |   ^~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C

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

signed main(void)
{
	int n, cnt, sum;
	string s;
	map<char, int> mp;

	cin >> n >> s;
	sum = 1;
	rep(i, n) mp[s[i]]++;
	for(auto p : mp)
	{
		sum *= p.second; 
	}
	cnt = 0;
	rep(i, n)
	{
		for(int j = i + 1; j < n; j++)
		{
			int k = 2 * j - i;
			if (k >= n) continue;
			if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k])
				cnt++;
		}
	}
	cout << sum - cnt << 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

N = int(input())
S = list(input())
A = (S.count("R"))*(S.count("B"))*(S.count("G"))
for i in range(1,N):
    for j in range(i+1,N+1):
        if j < 2*j - i <= N:
            if S[i-1] != S[j-1] != S[2*j - i - 1] :
                A -= 1
print(A)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N = int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | N = int(input())
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,rgb[3]={},cond1,count=0;
  string s;
  cin >>n>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='R')
      rgb[0]+=1;
    else if(s[i]=='G')
      rgb[1]+=1;
    else
      rgb[2]+=1;
  }
  cond=rgb[0]*rgb[1]*rgb[2];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      k=2*j-i;
      if(s[i]!=s[j] && s[j]!=s[k] &&s[i]!=s[k]);
        cond--;
    }
  cout<<cond<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'cond' was not declared in this scope; did you mean 'cond1'?
   15 |   cond=rgb[0]*rgb[1]*rgb[2];
      |   ^~~~
      |   cond1
a.cc:18:7: error: 'k' was not declared in this scope
   18 |       k=2*j-i;
      |       ^
a.cc:22:20: error: expected '}' at end of input
   22 |   cout<<cond<<endl;
      |                    ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,rgb[3]={},cond1,count=0;
  string s;
  cin >>n>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='R')
      rgb[0]+=1;
    else if(s[i]=='G')
      rgb[1]+=1;
    else
      rgb[2]+=1;
  }
  cond=rgb[0]*rgb[1]*rgb[2];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      k=2*j-i;
      if(s[i]!=s[j] && s[j]!=s[k] &&s[i]!=s[k]);
        count++;
    }
  cout<<cond1-count<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: 'cond' was not declared in this scope; did you mean 'cond1'?
   15 |   cond=rgb[0]*rgb[1]*rgb[2];
      |   ^~~~
      |   cond1
a.cc:18:7: error: 'k' was not declared in this scope
   18 |       k=2*j-i;
      |       ^
Language: C

from numba import njit
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline

N = int(input())
S = np.array(list(read().rstrip()), np.int8)

R = np.sum(S == ord('R'))
B = np.sum(S == ord('B'))
G = np.sum(S == ord('G'))


@njit
def f(S):
    N = len(S)
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = j + j - i
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                ret += 1
    return ret


answer = R * B * G - f(S)
print(answer)


Compiler output:
main.c:1:1: error: unknown type name 'from'
    1 | from numba import njit
      | ^~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'import'
    1 | from numba import njit
      |            ^~~~~~
main.c:1:12: error: unknown type name 'import'
main.c:15:1: error: stray '@' in program
   15 | @njit
      | ^
Language: C

n = int(input())
s = input()

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

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n = int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
    1 | n = int(input())
      |     ^~~
Language: C

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

int main() {
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	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 (s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k])
					if (j-i != k-j) ++ans;
			}
		}
	}

	cout << ans << '\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>
#include<string>

using namespace std;

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

    ans = r*g*b;

    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            int k = 2*j -i;
            if(k>=n) break;
            if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) ans--;
        }
    }


    cout << ans << 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: C

#include<iostream>
#include<string>

using namespace std;

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

    ans = r*g*b;

    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            int k = 2*j -i;
            if(k>=n) break;
            if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) 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

//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Libraries ---------------------------------//

//------------------------------- Dubug Functions ---------------------------//

inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}

//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    seika s;
    cin >> n >> s;
    i64 ans = 0;
    for (int j = 1; j < n - 1; j++)
    {
        akari<int> lc(3), rc(3);
        for (int i = 0; i < j; i++)
        {
            if (s[i] == s[j])
            {
                continue;
            }
            if (s[i] == 'R')
            {
                lc[0]++;
            }
            if (s[i] == 'G')
            {
                lc[1]++;
            }
            if (s[i] == 'B')
            {
                lc[2]++;
            }
        }
        for (int k = j + 1; k < n; k++)
        {
            if (s[k] == s[j])
            {
                continue;
            }
            if (s[k] == 'R')
            {
                rc[0]++;
            }
            if (s[k] == 'G')
            {
                rc[1]++;
            }
            if (s[k] == 'B')
            {
                rc[2]++;
            }
        }
        for (int i = 0; i < 3; i++)
            for (int k = 0; k < 3; k++)
            {
                if (i == k)
                {
                    continue;
                }
                ans += i64(1) * lc[i] * rc[k];
            }
        for (int d = 1; j - d >= 0 && j + d < n; d++)
        {
            if (s[j - d] != s[j] && s[j] != s[j + d] && s[j - d] != s[j + d])
            {
                ans--;
            }
        }
    }
    cout << ans << endl;
}

int main()
{
    solve();
    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>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }

int main()
{
  ll N, R=0, G=0, B=0, mm=0;
  string S;
  cin >> N >> S;

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

  for(ll i=1; 3+2*(i-1) < N; ++i){
    for(ll j=0; j+2*i < N; ++j){
      if(S[j+0*i] != S[j+1*i] && S[j+0*i] != S[j+2*i] && S[j+1*i] != S[j+2*i]){
            ++mm;
      }
    }
  }

  cout << max((ll)0, R*G*B-mm) << "\n";
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;string s;
  cin>>n>>s;
  int a=0,b=0,c=0;
  rep(i,n){
    if(s[i]=='R')
      a++;
    if(s[i]=='G')
      b++;
    if(s[i]=='B')
      c++;
  }
  int sum1=a*b*c;
  int sum2=0;
  rep(i,n){
    for(j=i+1;j<n;j++){
      if(s[i]==s[j])
        continue;
      int k=2*j-i;
      if(s[i]==s[j]||s[j]==s[k]||s[k]==s[i]||k>=n)
        continue;
        sum2++;
    }
  }
  cout<<sum1-sum2<<endl;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;string s;
  cin>>n>>s;
  int a=0,b=0,c=0;
  rep(i,n){
    if(s[i]=='R')
      a++;
    if(s[i]=='G')
      b++;
    if(s[i]=='B')
      c++;
  }
  int sum1=a*b*c;
  int sum2=0;
  rep(i,n){
    for(j=i+1,j<n;j++){
      if(s[i]==s[j])
        continue;
      int k=2*j-i;
      if(s[i]==s[j]||s[j]==s[k]||s[k]==s[i]||k>=n)
        continue;
        sum2++;
    }
  }
  cout<<sum1-sum2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'j' was not declared in this scope
   30 |     for(j=i+1,j<n;j++){
      |         ^
a.cc:30:22: error: expected ';' before ')' token
   30 |     for(j=i+1,j<n;j++){
      |                      ^
      |                      ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;string s;
  cin>>n>>s;
  int a=0;b=0;c=0;
  rep(i,n){
    if(s[i]=='R')
      a++;
    if(s[i]=='G')
      b++;
    if(s[i]=='B')
      c++;
  }
  int sum1=a*b*c;
  int sum2=0;
  rep(i,n){
    rep(j,n){
      int k=2*j-i;
      if(s[i]==s[j]||s[j]==s[k]||s[k]==s[i]||k>=n)
        sum2++;
    }
  }
  cout<<sum1-sum2<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:11: error: 'b' was not declared in this scope
   18 |   int a=0;b=0;c=0;
      |           ^
a.cc:18:15: error: 'c' was not declared in this scope
   18 |   int a=0;b=0;c=0;
      |               ^
Language: C

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int>a(N);
    rep(i,N) {
        if(S[i]=='R') a[i] = 0;
        if(S[i]=='G') a[i] = 1;
        if(S[i]=='B') a[i] = 2;
    }
    vector<ll>cnt(3);
    rep(i,N) cnt[a[i]]++;
    ll ans = 1;
    rep(i,3) ans *= cnt[i];
    rep(j,N) {
        rep(i,j) {
            int k = j+j-i;
            if(k<N) {
                if(a[i] == a[j]) continue;
                if(a[j] == a[k]) continue;
                if(a[i] == a[k]) continue;
                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>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl
#define dv(name, value) cerr << (name) << " is " << (value) << endl
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl


void solve(long long N, std::string S){
  int cnt = 0;
  FOR(x, 0, N) {
    FOR(y, x+1, N) {
      FOR(z, y+1, N) {
        if (S.at(x) != S.at(y) and S.at(y) != S.at(z) and S.at(z) != S.at(x) and y-x != z-y){
          cnt += 1;
        }
      }
    }
  }
  cout << cnt << endl;
}

signed main(){
  long long N;
  scanf("%lld",&N);
  std::string S;
  std::cin >> S;
  solve(N, S);
}


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<stdio.h>

int main(void){
	int N;
	scanf("%d", &N);
	char S[N];
	scanf("%s", S);
	int r = 0, b = 0, g = 0, i,j,x=0;
	for (i = 0; i < N; i++) {
		if (S[i] == 'R') r++;
		else if (S[i] == 'B') b++;
		else if(S[i] == 'G') g++;
	}
	for (j = 1; j + j < N; j++) {
		for (i = 0; i + j + j < N; i++) {
			if (S[i] != S[i + j] && S[i + j] != S[i + j + j] && S[i + j + j] != S[i]) x++;
		}
	}
        long long y=r*B*g;
	printf("%d", y - x);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:23: error: 'B' undeclared (first use in this function)
   19 |         long long y=r*B*g;
      |                       ^
main.c:19:23: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define mset(s,_) memset(s,_,sizeof s)
#define fi first
#define se second
#define pb push_back

template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}

ll dp[4010][4];
ll a[4010][4010];
bool vis[4010];
map<char,int>mp;

char sol(char ch1,char ch2){
	if(ch1!='R'&&ch2!='R') return 'R';
	if(ch1!='G'&&ch2!='G') return 'G';
	 return 'B';
}

int main(){
	int n;
	char s[10010];
	mp['R']=1;
	mp['G']=2;
	mp['B']=3;
	cin>>n>>s+1;
	per(i,n,1){
	 rep(j,1,3)
		dp[i][j]=dp[i+1][j];
		dp[i][mp[s[i]]]+=1;
	}
	ll ans=0;
	rep(i,1,n-1){
		rep(j,i+1,n){
			if(s[i]==s[j]||j+1>n) continue;
			char ch=sol(s[i],s[j]);
			int cnt=dp[j+1][mp[ch]];
			if(j+j-i<=n&&s[j+j-i]==ch) cnt-=1;
			ans+=cnt;
	 }
 }
 cout<<ans<<'\n';
}



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

#include <iostream>
#include <vector>

int main(int argc, char **argv)
{
    unsigned int N;
    std::string S;
    std::cin >> N >> S;

    int r, g, b;
    for(unsigned int i = 0; i < N; i++){
        if(S.at(i) == 'R') r++;
        if(S.at(i) == 'G') g++;
        if(S.at(i) == 'B') b++;
    }
    
    int sum = r * g * b;

    for(unsigned int i = 0; i < N; i++){
        for(unsigned int j = i + 1; j < N; j++){
            unsigned int k = j + (j - i);
            if(k < N){
                if(S.at(i) != S.at(j) && S.at(i) != S.at(k) && S.at(j) != S.at(k)){
                    sum--;
                }
            }
        }
    }

    std::cout << sum << std::endl;
    
}


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

#include<iostream>
#include<string>
#include<vector>
#include <math.h>

#define LL long long
#define MOD 1000000007
#define rep(i,n) for(int i = 0;i < (n);i++)

using namespace std;

int main() {

    int N;
    string S;
    cin >> N >> S;

    int cnt[3] = {0};
    
    rep(i,N){
        if(S[i] == 'R') cnt[0]++;
        if(S[i] == 'G') cnt[1]++;
        if(S[i] == 'B') cnt[2]++;
    }

    LL ans = 1;
    rep(i,3)ans *= cnt[i]; 

     rep(i,N){
         for(int j = i+1;j < N;j++){
            int k = 2 * j - i;
            if(S[i] == S[j]) continue;
            if(S[j] == S[k]) continue;
            if(S[k] == S[i]) continue;
            if(k < N) ans--;
         }
     }
     cout << ans <<endl;

	return 0;
}








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

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

int main()
{
    int N;
    cin >> N;
    vector<char> S(N);
    int count_r = 0;
    int count_g = 0;
    int count_b = 0;

    for (int i = 0; i < N; i++)
    {
        cin >> S.at(i);
        if(S.at(i) == 'R') {count_r++;}
        if(S.at(i) == 'G') {count_g++;}
        if(S.at(i) == 'B') {count_b++;}
    }

    int64_t sum = count_r * count_g * count_b;

    
    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j + (j - i) < N; j++)
        {
            //jはiの一つ隣から探索
            int k = j + (j - i); //j+(j-i) = i+1+(i+1-i) = i+2 kはiの二つ隣から探索
            if(S.at(i) != S.at(j) && S.at(j) != S.at(k) && S.at(k) != S.at(i))
            {
                sum--;
            }
        }
        
    }

    cout << sum << endl;
}
*/

Compiler output:
a.cc:40:2: error: expected unqualified-id before '/' token
   40 | */
      |  ^
Language: C

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

int main() {
	long long n;
	string s;
	cin >> n;
	cin >> s;
	long long r, g, b;
	for (long long i = 0; i < n; ++i)
	{
		if (s[i] == 'R') r++;
		if (s[i] == 'G') g++;
		if (s[i] == 'B') b++;
	}
	long long dec = 0;
	for (long long i = 1; i < n/2; ++i) // 間隔
	{
		for (long long 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]) dec++;
		}
	}
	if (n%2 == 1)
	{
		if(s[1] == s[1 + n/2] && s[1] == s[n-1] && s[1 + n/2] == s[n-1]) dec++;
	}
	cout << r * g * b - dec << 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>
#define rep(i,n) for (int i=0; i< int (n); i++)
using namespace std;
typedef long long ll;

int main(){

int n; string s;
cin >> n >> s;
int r=0, g=0, b=0;
rep(i,n){
    if (s[i]=='R') r++;
    else if (s[i]=='G') g++;
    else (s[i]=='B') b++;
}
ll seki=r*g*b;

ll hiku=0;
//int i=0, j=0;

for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
        int k=2*j-i;
        if(k<n && s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k]) hiku++;
    }
}

cout << seki-hiku << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: expected ';' before 'b'
   14 |     else (s[i]=='B') b++;
      |                     ^~
      |                     ;
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: 'r' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |               ^
a.cc:26:17: error: 'g' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                 ^
a.cc:26:19: error: 'b' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                   ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:21:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |                 if(S[i]=="R")r++;
a.cc:22:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |                 if(S[i]=="G")g++;
a.cc:23:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |                 if(S[i]=="B")b++;
a.cc:26:15: error: 'r' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |               ^
a.cc:26:17: error: 'g' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                 ^
a.cc:26:19: error: 'b' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                   ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: cannot convert '__complex__ int' to 'int' in initialization
   15 |                         int k=2j-i;
      |                               ~~^~
      |                                 |
      |                                 __complex__ int
a.cc:21:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |                 if(S[i]=="R")r++;
a.cc:22:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   22 |                 if(S[i]=="G")g++;
a.cc:23:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |                 if(S[i]=="B")b++;
a.cc:26:15: error: 'r' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |               ^
a.cc:26:17: error: 'g' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                 ^
a.cc:26:19: error: 'b' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                   ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:15:33: error: cannot convert '__complex__ int' to 'int' in initialization
   15 |                         int k=2j-i;
      |                               ~~^~
      |                                 |
      |                                 __complex__ int
a.cc:19:13: error: 'i' was not declared in this scope
   19 |         for(i,N){
      |             ^
a.cc:26:15: error: 'r' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |               ^
a.cc:26:17: error: 'g' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                 ^
a.cc:26:19: error: 'b' was not declared in this scope
   26 |         cout<<r*g*b-count<<endl;
      |                   ^
a.cc:27:1: error: expected primary-expression before '}' token
   27 | }
      | ^
a.cc:26:33: error: expected ')' before '}' token
   26 |         cout<<r*g*b-count<<endl;
      |                                 ^
      |                                 )
   27 | }
      | ~                                
a.cc:19:12: note: to match this '('
   19 |         for(i,N){
      |            ^
a.cc:27:1: error: expected primary-expression before '}' token
   27 | }
      | ^
Language: C++

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

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


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

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, 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; }
template<class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }
template<class T>
inline T upper(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	ll r = 0, g = 0, b = 0;
	for (char c : s) {
		if (c == 'R') r++;
		else if (c == 'G') g++;
		else b++;
	}

	ll all = r * g * b;

	ll cnt = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			int k = 2 * j - i;

			if (k >= n || s[i] == s[j] || s[j] == s[k] || s[k] == s[i]) continue;
			//cout << i << " " << j << " " << k << endl;
			cnt++;
		}
	}

	cout << all - cnt << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main(){
    int n;
    string s;
    cin >> n >> s;

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

    for(int i = 0; i < n; i++){
        if(s[i]=='R'){
            r++;
        }else if(s[i]=='G'){
            g++;
        }else{
            b++;
        }
    }
    ll ans = r*g*b;
    // cout << ans << endl;

    ll ng=0;

    for(int j=0;j<n;j++){
		    for(int i=0;i<j;i++){
                ll k = 2*j-i;
                if((s[i]!=s[j])&&(s[j]!=s[k])&&(s[k]!=s[i])&&(k<n)){
                    ng++;
                }
            }
        }

    cout << ans - ng << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long int;
signed main(){
    int n;
    string s;
    cin >> n >> s;

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

    for(int i = 0; i < n; i++){
        if(s[i]=='R'){
            r++;
        }else if(s[i]=='G'){
            g++;
        }else{
            b++;
        }
    }
    int ans = r*g*b;
    // cout << ans << endl;

    int ng=0;

    for(int j=0;j<n;j++){
		    for(int i=0;i<j;i++){
                int k = 2*j-i;
                if((s[i]!=s[j])&&(s[j]!=s[k])&&(s[k]!=s[i])&&(k<n)){
                    ng++;
                }
            }
        }

    cout << ans - ng << endl;
}

Compiler output:
a.cc:3:19: error: declaration does not declare anything [-fpermissive]
    3 | typedef long long int;
      |                   ^~~
Language: C++

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define print(n) cout << n << endl

int main(){
    int N;
    string S;

    cin >> N >> S;

    int 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++;
    }

    ll ans = r*g*b;
    rep(i,N) rep(j,N){
        if(j<=i) continue;
        if(2*j-i<N){
            if(S[i] != S[j] && S[i] != S[2*j-i] && S[j] != S[2*j-i]) ans--;
        }   
    }
    if(ans<0) ans=0;
    print(ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string S;
      |     ^~~~~~
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> N >> S;
      |     ^~~
a.cc:10:17: error: 'S' was not declared in this scope
   10 |     cin >> N >> S;
      |                 ^
a.cc:4:18: error: 'cout' was not declared in this scope
    4 | #define print(n) cout << n << endl
      |                  ^~~~
a.cc:28:5: note: in expansion of macro 'print'
   28 |     print(ans);
      |     ^~~~~
a.cc:4:31: error: 'endl' was not declared in this scope
    4 | #define print(n) cout << n << endl
      |                               ^~~~
a.cc:28:5: note: in expansion of macro 'print'
   28 |     print(ans);
      |     ^~~~~
Language: C++

using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n); i > 0; i--)
#define print(n) cout << n << endl

int main(){
    int N;
    string S;

    cin >> N >> S;

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

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

    ll ans = r*g*b;
    rep(i,N) rep(j,N){
        if(j<=i) continue;
        if(2*j-i<N){
            if(S[i] != S[j] && S[i] != S[2*j-i] && S[j] != S[2*j-i]) ans--;
        }
        
    }
    print(ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string S;
      |     ^~~~~~
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> N >> S;
      |     ^~~
a.cc:10:17: error: 'S' was not declared in this scope
   10 |     cin >> N >> S;
      |                 ^
a.cc:4:18: error: 'cout' was not declared in this scope
    4 | #define print(n) cout << n << endl
      |                  ^~~~
a.cc:28:5: note: in expansion of macro 'print'
   28 |     print(ans);
      |     ^~~~~
a.cc:4:31: error: 'endl' was not declared in this scope
    4 | #define print(n) cout << n << endl
      |                               ^~~~
a.cc:28:5: note: in expansion of macro 'print'
   28 |     print(ans);
      |     ^~~~~
Language: C++

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> cnt(3);
    rep(i, N) {
        if (S[i] == 'R') cnt[0] += 1;
        if (S[i] == 'G') cnt[1] += 1;
        if (S[i] == 'B') cnt[2] += 1;
    }
    ll ans = cnt[0]*cnt[1]*cnt[2];
    FOR(i, 0, N - 2) FOR(j, i, N - 1) {
        int k = 2*j - i;
        if (k < N) {
            if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) ans -= 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
    3 |     string S;
      |     ^~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N >> S;
      |     ^~~
a.cc:4:17: error: 'S' was not declared in this scope
    4 |     cin >> N >> S;
      |                 ^
a.cc:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> cnt(3);
      |     ^~~~~~
a.cc:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> cnt(3);
      |            ^~~
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     rep(i, N) {
      |         ^
a.cc:6:5: error: 'rep' was not declared in this scope
    6 |     rep(i, N) {
      |     ^~~
a.cc:11:5: error: 'll' was not declared in this scope
   11 |     ll ans = cnt[0]*cnt[1]*cnt[2];
      |     ^~
a.cc:12:5: error: 'FOR' was not declared in this scope
   12 |     FOR(i, 0, N - 2) FOR(j, i, N - 1) {
      |     ^~~
a.cc:18:5: error: 'cout' was not declared in this scope
   18 |     cout << ans << endl;
      |     ^~~~
a.cc:18:13: error: 'ans' was not declared in this scope
   18 |     cout << ans << endl;
      |             ^~~
a.cc:18:20: error: 'endl' was not declared in this scope
   18 |     cout << ans << endl;
      |                    ^~~~
Language: C

n=int(input())
s=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)
b=set(b)
lb=len(b)
ans=0
for i in r:
    for j in g:
        x,y=min(i,j),max(i,j)
        ans_=lb
        if x-(y-x) in b:
            ans_-=1
        if y+(y-x) in b:
            ans_-=1
        if (x%2==y%2) and (y-x)//2+x in b:
            ans_-=1
        ans+=ans_
print(ans)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n=int(input())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: expected expression before 'int'
    1 | n=int(input())
      |   ^~~
Language: C

#include <iostream>
#include <cstring>
using namespace std;
int a,b,c;

int main(){
    int l;
    cin>>l;
    string x;
    long long ans=0;
    cin>>x;
    for(int i=0;i<l-2;i++){
        for(int j=i+1;j<l-1;j++){
            for(int k=j+1;k<l;k++){
                if(x[i]!=x[j]&&x[i]!=x[k]&&x[j]!=x[k]&&(j-i!=k-j)) 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: Java

public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
        String N = scan.nextLine();
        scan = new Scanner(System.in);
        String S= scan.nextLine();
        int n = Integer.parseInt(N);
        int cnt = 0;
		for (int i=1; i < n-1; i++)
			for (int j=i+1; j <  n; j++)
				for (int k=j+1; k < n+1; k++)
					if ((j-i) != (k-j)
						&& S.charAt(i-1)!=S.charAt(j-1)
						&& S.charAt(i-1)!=S.charAt(k-1)
						&& S.charAt(j-1)!=S.charAt(k-1)
						)
						cnt++;
		System.out.println(cnt);
	}

Compiler output:
Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
              ^
  (use --enable-preview to enable unnamed classes)
1 error
Language: C

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

#define ll long long int
#define mod 1000000007

#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;


int main()
{  
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    string s;
    cin>>n;
    cin>>s;
    //R..G..B
    //0..1..2
    vector<vector<int>> dp(n,vector<int>(3));
    for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			dp[i][j]=(i==0)?0:dp[i-1][j];
		}
		if(s[i]=='R')dp[i][0]++;
		else if(s[i]=='G')dp[i][1]++;
		else dp[i][2]++;
	}
	
    ll ans=0;
    
    for(int i=2;i<n;i++){
		for(int j=1;j<i;j++){
			int k=j-(i-j);
			if(s[j]=='G' && s[i]=='B'){
				ans+=dp[j-1][0];
				if(k>=0 && s[k]=='R')ans-=1;
			}
			if(s[j]=='B' && s[i]=='G'){
				ans+=dp[j-1][0];
				if(k>=0 && s[k]=='R')ans-=1;
			}
			if(s[j]=='R' && s[i]=='B'){
				ans+=dp[j-1][1];
				if(k>=0 && s[k]=='G')ans-=1;
			}
			if(s[j]=='B' && s[i]=='R'){
				ans+=dp[j-1][1];
				if(k>=0 && s[k]=='G')ans-=1;
			}
			if(s[j]=='G' && s[i]=='R'){
				ans+=dp[j-1][2];
				if(k>=0 && s[k]=='B')ans-=1;
			}
			if(s[j]=='R' && s[i]=='G'){
				ans+=dp[j-1][2];
				if(k>=0 && s[k]=='B')ans-=1;
			}
		}
	}
	cout<<ans<<"\n";
}
    



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

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

int main() {
  ll n,count=0;
  cin >> n;
  string s;
  cin >> s;
  int a[3][n];
  r(i,n){
    a[0][i]=0;
    a[1][i]=0;
    a[2][i]=0;
  }
  r(i,n){
    if(s[i]=='R')a[0][i]++;
    if(s[i]=='G')a[1][i]++;
    if(s[i]=='B')a[2][i]++;
    
    if(i){
      a[0][i]+=a[0][i-1];
      a[1][i]+=a[1][i-1];
      a[2][i]+=a[2][i-1];
    }
  }
  for(int i=0; i<n;i++){
    for(int j=i+1;j<n;j++){
      if(s[i]==s[j])continue;
      else{
        if(s[i]=='R'&&s[j]=='G'){
          count+=a[2][n-1]-a[2][j];
          if(j*2-i<n&&s[j*2-i]=='B')count--;
        }
        if(s[i]=='G'&&s[j]=='R'){
          count+=a[2][n-1]-a[2][j];
          if(j*2-i<n&&s[j*2-i]=='B')count--;
        }
        if(s[i]=='R'&&s[j]=='B'){
          count+=a[1][n-1]-a[1][j];
          if(j*2-i<n&&s[j*2-i]=='G')count--;
        }
        if(s[i]=='B'&&s[j]=='R'){
          count+=a[1][n-1]-a[1][j];
          if(j*2-i<n&&s[j*2-i]=='G')count--;
        }
        if(s[i]=='G'&&s[j]=='B'){
          count+=a[0][n-1]-a[0][j];
          if(j*2-i<n&&s[j*2-i]=='R')count--;
        }
        if(s[i]=='B'&&s[j]=='G'){
          count+=a[0][n-1]-a[0][j];
          if(j*2-i<n&&s[j*2-i]=='R')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 <iostream>
using namespace std;
 
    
    
int main(){
    string str;
    cin>>str;
    int n;
    n=str.length();

    for (int i = 0; i < (n-1)/2; i++)
    {
        if (str.at(i)!=str.at(n-i))
        {
          cout<<"No"<<endl;
          exit;   
        }
        
    }

    for (int i = 0; i < (n-1)/4; i++)
    {
        if (str.at(i)!=str.at((n-1)/2-i))
        {
            cout<<"No"<<endl;
            exit;
        }
        
    }

    for (int i = (n+1)/2; i < (3*n+3)/4; i++)
    {
        if (str.at(i)!=str.at(n-(n+1)/2))
        {
            cout<<"No"<<endl;
            exit;   
        }
        
    }


    cout<<"Yes"<<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;
vector<int> vr, vg, vb;
int main()
{
    string s;
    int n;
    long long ans = 0;
    cin >> n >> s;
    for (int i = 0; i < n;i++)
    {
        if(s[i]=='R')
            vr.push_back(i);
        else if(s[i]=='G')
            vg.push_back(i);
        else
            vb.push_back(i);
    }
 
    int r = vr.size(), g = vg.size(), b = vb.size();
    ans=1ll*r*g*b；
    for (int i = 0; i < r;i++)
    {
        for (int j = 0; j < g;j++)
        {
            int dist = abs(vr[i] - vg[j]);
            int left = min(vr[i], vg[j]), right = max(vr[i], vg[j]);
            if((dist%2==0)&&(s[left+dist/2]=='B'))
                ans--;
            if(left-dist>=0)
                ans = s[left - dist] == 'B' ? ans - 1 : ans;
            if(right+dist<n)
                ans = s[right + dist] == 'B' ? ans - 1 : ans;
        }
    }
    cout << ans;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:17: error: 'b\U0000ff1b' was not declared in this scope
   21 |     ans=1ll*r*g*b；
      |                 ^~~
a.cc:22:21: error: 'i' was not declared in this scope
   22 |     for (int i = 0; i < r;i++)
      |                     ^
Language: C++

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

typedef long long ll;

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

    ll ans = 0;
    int r = 0, g = 0, b = 0;
    for (int i = 0; i < size; ++i)
    {
        switch (S[i])
        {
        case 'R':
            ++r;
            break;
        case 'G':
            ++g;
            break;
        case 'B':
            ++b;
            break;
        default:
            break;
        }
    }
    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 && S[i] != S[j] && S[j] != S[k] && S[i] != S[k])
            {
                --ans;
            }
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<'
   14 |     for (int i = 0; i < size; ++i)
      |                     ~~^~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:42: error: 'k' was not declared in this scope
   23 |         if(s[j+j-i]!=s[j] && s[j+j-i]!=s[k]){
      |                                          ^
Language: C++

#include <iostream>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:23:42: error: 'k' was not declared in this scope
   23 |         if(s[j+j-i]!=s[j] && s[j+j-i]!=s[k]){
      |                                          ^
a.cc:27:8: error: expected '}' before 'else'
   27 |       }else{
      |        ^~~~
a.cc:22:21: note: to match this '{'
   22 |       if(s[j]!=s[i]){
      |                     ^