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

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

const int INF = 1001001001;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order - 1) ans *= base;
	return ans;
}

int gcd(int a, int b) {
	if (a < b) {
		int c = a;
		a = b;
		b = c;
	}
	if (b == 0) return a;
	return gcd (b, a % b);
}

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

	vector<int> rv, gv, bv;
	int r = 0, g = 0, b = 0;
	rep(i,n) {
		if (s.at(i) == 'R') {
			rv.push_back(i + 1);
			r++;
		}
		if (s.at(i) == 'G') {
			gv.push_back(i + 1);
			g++;
		}
		if (s.at(i) == 'B') {
			bv.push_back(i + 1);
			b++;
		}
	}
	if (r*g*b == 0) return 0;
	int cnt = 0, RGB;
	RGB = 'R' + 'G' + 'B';
	for (int i = 1; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (s.at(i - 1) == s.at(j - 1)) {
				continue;
			}
			int rem;
			rem = s.at(i - 1) + s.at(j - 1);
			if (RGB - rem == 'R') {
				vector<int> range = rv;
			}
			if (RGB - rem == 'G') {
				vector<int> range = gv;
			}
			if (RGB - rem == 'B') {
				vector<int> range = bv;
			}
			for (auto k : range) {
				if (j >= k) continue;
				if (2*j == (i + k)) continue;
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:39: error: 'range' was not declared in this scope
   65 |                         for (auto k : range) {
      |                                       ^~~~~
Language: C

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

int main() {
    int n,all,r_count=0,g_count=0,b_count=0;
    string s;
    cin>>n>>s;
    ll ans=0;
    rep(i,s.size()) {
        if (s[i]=='R') r_count++;
        else if(s[i]=='G') g_count++;
        else b_count++;
    }
    all=r_count*g_count*b_count;
    rep(i,n-2) {
        for (int j=i+1; j<n-1; j++) {
            int k=2*j-i;
            if (s[i]==s[j]||s[k]==s[i]||s[k]==s[j]||k>=n) continue;
            ans++;
        }
    }
    cout<<all-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>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    int N;
    cin >> N;
    string S;
    cin >> 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] == 'B'){
            B++;
        }
        else{
            G++;
        }
    }
    ll ans = R*B*G;
    for (int i = 0; i < N;i++)
    {
        for (int j = i+1; j < N;j++)
        {
            int k = 2 * j - i;
            if(k > N - 1){
                break;
            }
            if(S[i] != S[j] && S[j] != S[k] && S[i] != S[k]){
                ans--;
            }
        }
    }
    cout << ans << endl;
}


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

//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;

long long GCD(long long a, long long b) {
	if (a < b) {
		swap(a, b);
	}
	long long r = -1;
	while (r != 0) {
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}

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


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

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

ans = s.count("R") * s.count("G") * s.count("B")

for i in range(n-2):
    si = s[i]
    for j in range(i+1, i+(n-i-1)//2+1):
        sj = s[j]
        k = 2*j-i
        if k < n and s[k] != si and s[k] != sj and si != sj:
            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 <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
using namespace std;
 
int main () {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int c = 0;
  for (int i=1; i<n-1; 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] && (j-i)!=(k-j)){
          c ++;
        }
      }
    }
  }
  cout << c;
  return 0;
}

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

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

int main()
{
    int N;
    string S;

    cin >> N >> S;

    long long num_r = 0, num_g = 0, num_b = 0;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'R')
        {
            num_r++;
        }
        else if (S[i] == 'G')
        {
            num_g++;
        }
        else
        {
            num_b++;
        }
    }

    long long all = num_r * num_g * num_b;
    for (int j = 0; j < N; j++)
    {
        for (int i = 0; i < j; i++)
        {
            int d = j - i;
            if (j + d >= N || S[i] == S[j])
            {
                continue;
            }

            if (S[i] != S[j + d] && S[j] != S[j + d])
            {
                all--;
            }
        }
    }

    cout << all << 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++

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[i] == a[k]) continue;
      if (a[k] == a[j]) continue;
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
    3 |   string s;
      |   ^~~~~~
a.cc:4:3: error: 'cin' was not declared in this scope
    4 |   cin >> n >> s;
      |   ^~~
a.cc:4:15: error: 's' was not declared in this scope
    4 |   cin >> n >> s;
      |               ^
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> a(n);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> a(n);
      |          ^~~
a.cc:6:7: error: 'i' was not declared in this scope
    6 |   rep(i,n) {
      |       ^
a.cc:6:3: error: 'rep' was not declared in this scope
    6 |   rep(i,n) {
      |   ^~~
a.cc:11:10: error: 'll' was not declared in this scope
   11 |   vector<ll> cnt(3);
      |          ^~
a.cc:11:14: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |   vector<ll> cnt(3);
      |              ^~~
      |              int
a.cc:13:5: error: expected ';' before 'ans'
   13 |   ll ans = 1;
      |     ^~~~
      |     ;
a.cc:15:7: error: 'j' was not declared in this scope
   15 |   rep(j,n)rep(i,j) {
      |       ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout << ans << endl;
      |   ^~~~
a.cc:24:11: error: 'ans' was not declared in this scope
   24 |   cout << ans << endl;
      |           ^~~
a.cc:24:18: error: 'endl' was not declared in this scope
   24 |   cout << ans << endl;
      |                  ^~~~
Language: C

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

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main()
{
    /*
    int n;
    cin>>n;
    while(n)
    {
        if(n%10==7)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
        n=n/10;
    }
    cout<<"No"<<endl;
    */
    /*
    int n;
    cin>>n;
    ll total = 0;

    for(int i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        {
            total+=i;
        }
    }
    cout<<total<<endl;
    */
    /*
    int k;
    cin>>k;
    ll total = 0;
    for(int i=1;i<=k;i++)
    {
        for(int j=1;j<=k;j++)
        {
            for(int l=1;l<=k;l++)
            {
                total+=gcd(gcd(i,j),l);
            }
        }
    }
    cout<<total<<endl;
    */

    int n;
    cin>>n;
    string s;
    cin>>s;
    pair <int,char> p[n];
    map <int,char> mp;
    for(int i=0;i<n;i++)
    {
        p[i].first=i+1;
        p[i].second=s[i];
        mp[s[i]]++;
    }
    int r = mp['R'];
    int g = mp['G'];
    int b = mp['B'];
    
    int count=0;
    count+=r*g*b;
    for(int j=0;j<n;j++)
    {
        for(int i=0;i<j;i++)
        {
            int k = j + (j-i);
            if (k < n) 
            {
                if (s[i] == s[j]) continue;
                if (s[i] == s[k]) continue;
                if (s[k] == s[j]) continue;
                count--;
            }
        }
    }
    cout<<count<<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;

string s;
bool check(int a,int b,int c)
{
   char ch[3];
   ch[0] = s[a] ;
   ch[1] = s[b] ;
   ch[2] = s[c] ;
   sort(ch,ch+3);
   if(ch[0] == 'B' && ch[1] == 'G' && ch[2] == 'R')
      return true ;
   return false;
}

int main()
{
   int n;

   cin >> n >> s;
   int r = 0, g = 0, b = 0;
   for(int i =0; i < n; i++)
   {
      if(s[i] == 'R')
         r++;
      if(s[i] == 'G')
         g++;
      if(s[i] == 'B')
         b++;
   }
   int res = 0;
   for(int i = 0 ; i < n; i++)
   {
      for(int j = i+1; j < n; j++)
      {
         int k = (i+j)/2;
         if(k -i == j - k && check(i,j,k))
            res++;

      }
   }
   cout << b*r*g - res;
   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(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; string s; cin>>n>>s;
	vector<int>r,g; vector<bool>b(n+1,false);
	int B=0;
	for(int i=0;i<n;++i){
		if(s.at(i)=='R')r.emplace_back(i);
		else if(s.at(i)=='G')g.emplace_back(i);
		else ++B,b.at(i)=true;
	}
	int64_t ans=0;
	for(auto&R:r){
		for(auto&G:g){
			int left=min(R,G),right=max(R,G);
			int Bleft=left-abs(R-G),Bmid=(left+right)/2,Bright=right+abs(R-G);
			ans+=B;
			if(Bleft>=0&&b.at(Bleft))--ans;
			if(b.at(Bmid)&&Bmid-left==right-Bmid)--ans;
			if(Bright<n&&b.at(Bright))--ans;
		}
	}
	cout<<ans<<"\n"s;
}

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>
 
int main(){
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
  
  int N;
  scanf("%d",&N);
  std::string s;
  std::cin >> s;
  
  int c = 0;
  for(int i=0; i<N-2; i++){
	for(int j=i+1; j<N-1; j++){
      if(s[i] == s[j])
        continue;
      for(int k=j+1; k<N; k++){
        if(j-i==k-j || s[i]==s[k] || s[j]==s[k])
          continue;
        c++;
      }
    }
  }
  
  printf("%d", c);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'ios' has not been declared
    5 |   ios::sync_with_stdio(false);
      |   ^~~
a.cc:6:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |         cin.tie(nullptr);
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
Language: C

#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}


int main(){
   int n;
   string s;
   cin >> n >> s;
   vector<int> a(n);
   for(int i = 0; i < n; i++){
      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);
   for(int i = 0; i < n; i++) cnt[a[i]]++;
   ll ans = 1;
   for(int i = 0; i < 3; i++) ans *= cnt[i]; //(r,g,b)のパターン数

   for(int i = 0; i < n; i++){
      for(int j = i+1; j < n; j++){
         int k = j+(j-i);
         if(k < n){
            if(a[i] == a[j]) continue; //1つ目の条件は満たしているので考えない
            if(a[i] == a[k]) continue;
            if(a[j] == a[k]) continue;
            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;

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  string s; cin>>s;
  map<char,ll> m;
  rep(i,n){
    m[s[i]]++;
  }
  ll ans=m['R']*m['G']*m['B'];
  
  ll span=1;
  ll tmp=0;
  while(span<=n){
    rep(i,n){
      if(i+span*2>=n) break;
      if(s[i]!=s[i+span] && s[i+span]!=s[i+span*2] && s[i]!=s[i+span*2]){
        tmp++;
      }
    }
    span++;
  }
  cout<<ans-tmp<<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() {
  string str;
  int i,j,k,N,count=0;
  cin >> N >> str;
  
  for (i=0;i<N;i++){
    if(str.at(i)=='R'){
      for(j=0;i+j<N;j++){
        if(str.at(i+j)=='G'){
          for(k=0;i+j+k<N;k++){
            if(str.at(i+j+k)=='B')
             // cout << i << "," << i+j <<"," << i+j+k <<endl;
              if((j-i)!=(k-j))
                count++;
          }
        }
      }
    }
  }
  cout << count <<endl;

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

#include <cstdio>
#define INF 1e9
#define eps 1e-6
typedef long long ll;

int n;
char s[5010];
ll ans, sa, sb, sc;

int main(){

	scanf("%d %s", &n, s + 1);
	for(int i = 1; i <= n; i++){
		if(s[i] == 'R') sa++;
		if(s[i] == 'G') sb++;
		if(s[i] == 'B') sc++;
	}
	ans = sa * sb * sc;
	for(int i = 1; i <= n; i++)
		for(int j = 1; i - j >= 1 && i + j <= n; j++)
			if(s[i] != s[i - j] && s[i] != s[i + j] && s[i - j] != s[i + j])
				ans--;
	printf("%lld\n", ans);

	return 0;
}


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

#include <cstdio>
#define INF 1e9
#define eps 1e-6
typedef long long ll;

int n;
char s[5010];
ll ans, sa, sb, sc;

int main(){

	scanf("%d\n%s", &n, s + 1);
	for(int i = 1; i <= n; i++){
		if(s[i] == 'R') sa++;
		if(s[i] == 'G') sb++;
		if(s[i] == 'B') sc++;
	}
	ans = sa * sb * sc;
	for(int i = 1; i <= n; i++)
		for(int j = 1; i - j >= 1 && i + j <= n; j++)
			if(s[i] != s[i - j] && s[i] != s[i + j] && s[i - j] != s[i + j])
				ans--;
	printf("%lld\n", ans);

	return 0;
}


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

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

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

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

int main() {

	int n;
	string s; 
	cin >> n >> s;
	/*vector<vector<int> > hoge(6, vector<int>());
	//rgb,rbg,grb,gbr,brg,bgr
	vector<int> rafterg;
	vector<int> bafterg;
	int countr = 0, countb=0, countg = 0;
	rep(i,n) {
		if(s[i] == 'B') {
			countb++;
			hoge[1].pb(countr);
			hoge[3].pb(countg);
		}
		if(s[i] == 'R') {
			hoge[2].pb(countg);
			hoge[4].pb(countb);
			countr++;
		}
		if(s[i] == 'G') {
			countg++;
			hoge[0].pb(countr);
			hoge[5].pb(countb);
		}
			
	}
	countr = 0;
	countb=0;
	countg = 0;
	//rgb,rbg,grb,gbr,brg,bgr
	vector<vector<int> > fuga(6, vector<int>());
	for(int i=n-1; i>=0; i--) {
		if(s[i] == 'R') {
			countr++;
			fuga[2].pb(countb);
			fuga[4].pb(countg);
		}
		if(s[i] == 'G') {
			countg++;
			fuga[0].pb(countb);
			fuga[5].pb(countr);
		}
		if(s[i] == 'B') {
			countb++;
			fuga[1].pb(countg);
			fuga[3].pb(countr);
		}
		if(s[i] == 'G') bafterg.pb(countb);
	}
	rep(i,6) {
		reverse(fuga[i].begin(), fuga[i].end());
	}
	ll ans = 0;
	rep(i,6) {
		rep(j, fuga[i].size()) {
			ans += fuga[i][j] * hoge[i][j];
		}
	}
	/*rep(i, rbeforeg.size()) {
		ans += rbeforeg[i] * bafterg[i];
		cout << rbeforeg[i] << " " << bafterg[i] << endl;
	}*/
	
	//reverse(bafterg.begin(), bafterg.end());
	ll ans = 1;
	ll countr = 0, countg = 0, countb = 0;
	rep(i,n) {
		if(s[i] == 'R') countr++;
		if(s[i] == 'G') countg++;
		if(s[i] == 'B') countb++;
	}
	ans *= countr;
	ans *= countb;
	ans *= countg;
	for(int i=1;i <= (n-1)/2; i++) {
		rep(j,n) {
			if(j + 2*i >= n) continue;
			if(s[j] == 'R' && s[j+i] == 'G' && s[j+2*i] == 'B') ans--;
			if(s[j] == 'R' && s[j+i] == 'B' && s[j+2*i] == 'G') ans--;
			if(s[j] == 'B' && s[j+i] == 'R' && s[j+2*i] == 'G') ans--;
			if(s[j] == 'B' && s[j+i] == 'G' && s[j+2*i] == 'R') ans--;
			if(s[j] == 'G' && s[j+i] == 'B' && s[j+2*i] == 'R') ans--;
			if(s[j] == 'G' && s[j+i] == 'R' && s[j+2*i] == 'B') ans--;
		}
	}

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


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

#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
#define pi pair<int,int>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0) ; 
	cin.tie(0) ;
     int n ; 
     cin>> n ; 
     string s ;
     cin>> s;
     int a[s.length()+1] ;
     for(int i = 0; i < n; ++i){
		 if(s[i] == 'R')
		     a[i] = 1 ; 
		 else if(s[i] == 'G')
		   a[i] = 2 ;
		   else
		   a[i] = 3 ; 
	   }
	   int co1 = 0 , co2 = 0, co3 = 0;
	   int arr1[n] = {0} , arr2[n] = {0}  , arr3[n] = {0} ; 
	   memset(arr2 , 0 , sizeof arr2) ; 
	   memset(arr3 , 0 , sizeof arr3) ; 
	   memset(arr1 , 0 , sizeof arr1)  ;
	   ll ans =  0 ; 
	   for(int i = 0 ; i < n ; ++i){
		   if(a[i] == 1){
		   co1++;
		   arr1[i] = co1 ;
		   if(i > 0 ){ 
		   arr2[i] = arr2[i-1] ; 
		   arr3[i] = arr3[i-1] ; }
	      }
		  else if(a[i] == 2){
		   co2++ ;
		   arr2[i] = co2 ; 
		   if(i > 0 ){
		   arr1[i] = arr1[i-1] ; 
		   arr3[i] =arr3[i-1] ; }
	   }
		 else  if(a[i] == 3){
		   co3++ ;
		   arr3[i] = co3 ;
		   if(i > 0){
		   arr1[i] = arr1[i-1] ; 
		   arr2[i] = arr2[i-1] ; }
	   }
   }
  /* cout<<arr1[n-1]<<endl;
   cout<<arr2[n-1]<<endl;
   cout<<arr3[n-1]<<endl;
   */
   for(int i = 1; i < n -1; ++i){
	    if(a[i] == 1){
		
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 2 &&a[i+count] == 3) ||
			       (a[j] == 3 && a[i + count ]==2)) ans-- ; 
			   }
		int fno2 = arr2[i] ; 
		int sno2 = arr2[n-1]  - arr2[i] ; 
		int sno3 = arr3[n-1] - arr3[i] ; 
		int fno3 = arr3[i] ;
			ans = ans + fno2*sno3+
			        sno2*fno3 ; 
				}
	   else if(a[i] == 2){
		   
		   
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 1 &&a[i+count] == 3 )||
			       (a[j] == 3 && a[i + count] ==1)) ans-- ; 
			   }
		   int sno3 = arr3[n-1] - arr3[i] ; 
           int fno3 = arr3[i] ;
		   int fno1 = arr1[i] ; 
		   int sno1 = arr1[n-1] - arr1[i] ; 
		   ans = ans + fno1*sno3 + 
		              fno3 * sno1 ; 
				  }
	  else{
		  for(int j = i - 1 , count=1; j >=0 && i + count < n ; --j , count++ ) {
			   if((a[j] == 2 &&a[i+count] == 1) ||
			       (a[j] == 1 && a[i + count] ==2)) ans-- ; 
			   }
		  int fno1 = arr1[i] ; 
		   int sno1 = arr1[n-1] - arr1[i] ; 
		   int fno2 = arr2[i] ; 
		int sno2 = arr2[n-1]  - arr2[i] ; 
		
		   
		  ans = ans + fno1*sno2 +
		              fno2*sno1 ;
			  }
		  }
		   
 
  
  
  
  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<bits/stdc++.h>

using namespace std;
int n;
string s;
int dp[4005][3];
//0r 1g 2b
int main() {
	cin>>n>>s;
	for(int i=s.size()-1; i>=0; i--) {
		for(int j=0; j<3; j++)
			dp[i][j]=dp[i+1][j];
		if(s[i]=='R') dp[i][0]++;
		if(s[i]=='G') dp[i][1]++;
		if(s[i]=='B') dp[i][2]++;
	}
	long long ans=0;
	for(int i=0; i<n; i++)
		for(int j=i+1; j<n; j++) {
			if(s[i]=='R'&&s[j]=='G') {
				ans+=dp[j+1][2];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='B')
					ans--;
			}
			if(s[i]=='R'&&s[j]=='B') {
				ans+=dp[j+1][1];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='G')
					ans--;
			}
			if(s[i]=='B'&&s[j]=='R') {
				ans+=dp[j+1][1];
				if(j+j-i>=n) continue;
				if(s[j+(j-i)]=='G')
	

Compiler output:
a.cc: In function 'int main()':
a.cc:35:52: error: expected statement at end of input
   35 |                                 if(s[j+(j-i)]=='G')
      |                                                    ^
a.cc:35:52: error: expected '}' at end of input
a.cc:32:50: note: to match this '{'
   32 |                         if(s[i]=='B'&&s[j]=='R') {
      |                                                  ^
a.cc:35:52: error: expected '}' at end of input
   35 |                                 if(s[j+(j-i)]=='G')
      |                                                    ^
a.cc:19:42: note: to match this '{'
   19 |                 for(int j=i+1; j<n; j++) {
      |                                          ^
a.cc:35:52: error: expected '}' at end of input
   35 |                                 if(s[j+(j-i)]=='G')
      |                                                    ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
using ll = int64_t;
using v = vector<int>;

int main() {

  string S;
  int N;
  in(N);
  in(S);
  
  int rn=0, gn=0, bn=0;
  rep(i,N) {
    if (S.at(i)=='R') {
      rn++;
    }
    else if (S.at(i)=='G') {
      gn++;
    }
    else {
      bn++;
    }
  }
  ll ans = rn*gn*bn;
  ll hiku = 0;
  if(N<3) cout << ans << endl;
  else {
    for(int i = 0; i<N-2; i++) {
      for(int j = i+1; j<N-1; j++) {
        int k = 2*j-i;
        if(k>=N) continue;
        if(S.at(i)!=S.at(j) && S.at(i)!=S.at(k) && S.at(j)!=S.at(k)) {
          hiku++;
        }
      }
    }
    out(ans-hiku);
  }
}

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

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
using ll = int64_t;
using v = vector<int>;

int main() {

  string S;
  int N;
  in(N);
  in(S);
  
  int rn=0, gn=0, bn=0;
  rep(i,N) {
    if (S.at(i)=='R') {
      rn++;
    }
    else if (S.at(i)=='G') {
      gn++;
    }
    else {
      bn++;
    }
  }
  ll ans = rn*gn*bn;
  ll hiku = 0;
  if (N<3) out(0);
  else {
    for(int i = 0; i<N-2; i++) {
      for(int j = i+1; j<N-1; j++) {
        int k = 2*j-i;
        if(k>=N) continue;
        if(S.at(i)!=S.at(j) && S.at(i)!=S.at(k) && S.at(j)!=S.at(k)) {
          hiku++;
        }
      }
    }
    out(ans-hiku);
  }
}

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

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for (int i = 0; i<(n); i++)
#define in(n) cin >> (n)
#define out(ans) cout << (ans) << endl;
using ll = int64_t;
using v = vector<int>;

int main() {

  string S;
  int N;
  in(N);
  in(S);
  
  int rn=0, gn=0, bn=0;
  rep(i,N) {
    if (S.at(i)=='R') {
      rn++;
    }
    else if (S.at(i)=='G') {
      gn++;
    }
    else {
      bn++;
    }
  }
  ll ans = rn*gn*bn;
  ll hiku = 0;
  for(int i = 0; i<N-2; i++) {
    for(int j = i+1; j<N-1; j++) {
      int k = 2*j-i;
      if(S.at(i)!=S.at(j) && S.at(i)!=S.at(k) && S.at(j)!=S.at(k)) {
        hiku++;
      }
    }
  }
  out(ans-hiku);
}

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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
   long long n,ans=1;
  string s;
  cin>>n>>s;
  vector<int> co(3,0);
  rep(i,n){
    if(s.at(i)=='R')co[0]++;
    if(s.at(i)=='G')co[1]++;
    if(s.at(i)=='B')co[2]++;
  }
  rep(i,3)ans *=(co.at(i));
  rep(i,n)rep(j,i){
    int k=2*i-j;
    if(k<n){
      if(s.at(i)==s.at(j))continue;
      if(s.at(i)==s.at(k))continue;
      if(s.at(k)==s.at(j))continue;
      ans--;
    }
  }
  cout<<ans<<endl;
}


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

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  string s;
  cin>>s;
  long long int c=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(s[i]!=s[j] && s[i]!=s[k] && s[j] !=s[k] && (j-i==k-j)){
          c++;
        }
      }
    }
  }
  int r=0;
  int g=0;
  int b=0;
  for(int i=0;i<n;i++){
     if(s[i]=='R'){
       r++;
     }else if(s[i]=='G'){
       g++;
     }else{
       b++;
     }
  }
  cout<<r*g*b-c;

}


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<n;i++)
int main(){
   int n,ans=1;
  string s;
  cin>>n>>s;
  vector<int> co(3,0);
  rep(i,n){
    if(s.at(i)=="R")co[0]++;
    if(s.at(i)=="G")co[1]++;
    if(s.at(i)=="B")co[2]++;
  }
  rep(i,3)ans =(co.at(i));
  rep(i,n)rep(j,i){
    int k=2*i-j;
    if(k<n){
      if(s.at(i)==s.at(j))continue;
      if(s.at(i)==s.at(k))continue;
      if(s.at(k)==s.at(j))continue;
      ans--;
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |     if(s.at(i)=="R")co[0]++;
      |        ~~~~~~~^~~~~
a.cc:11:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |     if(s.at(i)=="G")co[1]++;
      |        ~~~~~~~^~~~~
a.cc:12:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |     if(s.at(i)=="B")co[2]++;
      |        ~~~~~~~^~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
int main()
{
  int N;
  string S;
  cin >> N >> S;
  int r=0,g=0,b=0;
  rep(i,N){
    char c = S.at(i);
    if(c=='R'){
      r++;
    }else if(c=='G'){
      g++;
    }else{
      b++;
    }
  }
  ll num = r * g * b;
  rep(i,N){
    for(int j=i+1;j<N;j++){
      int k = 2 * j - i;
      if(k<0||N<=k||k<=j)
        continue;
      if(S.at(i)!=S.at(j)&&S.at(j)!=S.at(k)&&S.at(k)!=S.at(i)){
        num--;
      }else{

      }
    }
  }
  cout << num << endl;
}

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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int n, i, j;
  string s;

  cin >> n >> s;

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

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

  int cnt = 0;

  for(i=1;i<n/2;i++){
    j = 0;
    while(2*i+j<n){
      if(s[j]!=s[j+i]&&s[j]!=s[j+2*i]&&s[j+i]!=s[j+2*i]){
        ++cnt;
      }
      j++;
    }
  }

  cout << r * g * b - cnt << 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;

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

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

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n;
	cin >> n;
	string s;
	cin >> s;

	int r = count(all(s),'R');
	int g = count(all(s),'G');
	int b = count(all(s),'B');
	ll ans = r * g * b;
	cerr << ans << endl;
	rep(i, n){
		rep(j, i){
			int k = 2*i - j;
			if(k < n){
				if(s[i] == s[j]) continue;
				if(s[i] == s[k]) continue;
				if(s[j] == s[k]) continue;
				ans--;
			}
		}
	}

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

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

#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>

using namespace std;

int main()
{
    int  n;
    string s;
    long long a[3] = {0};
    
    cin >> n;
    cin >> s;
    
    for (int i = 0;i < n;i++){
        if (s[i] == 'R'){
            a[0]++;
        }
        else if (s[i] == 'G'){
            a[1]++;
        }
        else {
            a[2]++;
        }
    }
    
    long long sum = 0;
    for (int i = 0;i <= n-3;i++){
        for (int j = 1;i+2*j < n;j++){
            if (s[i] != s[i+j] && s[i+j] != s[i+2*j] && s[i+2*j] != s[i]){
                sum++;
            }
        }
    }
    
    cout << a[0]*a[1]*a[2]-sum << endl;
    
    
    
}


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


int main(){
  int n;
  int i,j;
 // int count=0;
  char str[n];
  long long r=0,b=0,g=0;
  
  cin >> n;
  cout << endl;
  for(i=0;i<n;i++){
    cin >> str[i];
  }
for(i=0;i<n;i++){
  if(str[i]=='R'){
    r++;
  }if(str[i]=='G'){
    g++;
  }if(str[i]=='B'){
    b++;
  }
  }
  
  long long sum = r*g*b;
  for(i=0;i<n;i++){
    for(j=1;j<n;j++){
      if(j+j-i>=n){
        continue;
      }
      if(str[i]!=str[j] && str[i]!=str[i+j-1]){
        sum--;
      }
    }
  }
  cout << sum << endl;
}

      


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> n;
      |   ^~~
a.cc:10:3: error: 'cout' was not declared in this scope
   10 |   cout << endl;
      |   ^~~~
a.cc:10:11: error: 'endl' was not declared in this scope
   10 |   cout << endl;
      |           ^~~~
Language: C++

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

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define repa(a,i,x) for(int i=a;i<=x;i++)


int main(){
	int N;
	string S;
	cin >> N;
	cin >> S;
	
	int cnt=0;
	unsgined long int r=0,g=0,b=0;
	
	rep(i,N){
		if(S.at(i)=='R') r++;
		if(S.at(i)=='G') g++;
		if(S.at(i)=='B') b++;
	}
		
	
	repn(i,N){
		repa(i+1,j,N){
			int k=j+(j-i);
          	if(k>N)continue;
			if(S.at(i-1)!=S.at(j-1) && S.at(j-1)!=S.at(k-1) && S.at(k-1)!=S.at(i-1)) cnt++;
		}
	}
	
	
	cout << (r*g*b)-cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'unsgined' was not declared in this scope; did you mean 'unsigned'?
   16 |         unsgined long int r=0,g=0,b=0;
      |         ^~~~~~~~
      |         unsigned
a.cc:19:34: error: 'r' was not declared in this scope
   19 |                 if(S.at(i)=='R') r++;
      |                                  ^
a.cc:20:34: error: 'g' was not declared in this scope
   20 |                 if(S.at(i)=='G') g++;
      |                                  ^
a.cc:21:34: error: 'b' was not declared in this scope
   21 |                 if(S.at(i)=='B') b++;
      |                                  ^
a.cc:34:18: error: 'r' was not declared in this scope
   34 |         cout << (r*g*b)-cnt << endl;
      |                  ^
a.cc:34:20: error: 'g' was not declared in this scope
   34 |         cout << (r*g*b)-cnt << endl;
      |                    ^
a.cc:34:22: error: 'b' was not declared in this scope
   34 |         cout << (r*g*b)-cnt << endl;
      |                      ^
Language: C

#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(int i=0; i<n; i++)
#define loop(i, j, n) for(int i=j; i<n; i++)
using namespace std;
// }}} End Header

int main()
{
	int n, ans;
	int cnt[3]{};
	string s;
	cin >> n >> s;
 	rep(i,n){
		if(s[i] == 'R') cnt[0]++;
		if(s[i] == 'G') cnt[1]++;
		if(s[i] == 'B') cnt[2]++;
 	}
	ans = cnt[0] * cnt[1] * cnt[2];

	rep(i,n-1){
		loop(j, i+1, n){
			const int k = j+(j-i);
			if(k >= n) continue;
			if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) --ans;
		}
	}
	cout << ans <<endl;
	return 0;
}

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

#include <bits/stdc++.h>

#include <algorithm>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 1000000007;

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return (t * t) % mod;
    } else {
        return (modpow(m, n - 1) * m) % mod;
    }
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

signed main() {
    long long n, ans = 0;
    string s;
    cin >> n >> s;
    int sr = 0;
    int sg = 0;
    int sb = 0;
    REP(i, n) {
        if (s[i] == 'R') {
            sr++;
        }
        if (s[i] == 'G') {
            sg++;
        }
        if (s[i] == 'B') {
            sb++;
        }
    }
    REP(i, n) {
        int sr1 = 0;
        int sg1 = 0;
        int sb1 = 0;
        if (s[i] == 'R') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'G') {
                    sg1++;
                }
                if (s[j] == 'B') {
                    sb1++;
                }
            }
            ans += sg1 * (sb - sb1);
            ans += sb1 * (sg - sg1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
        if (s[i] == 'G') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'R') {
                    sr1++;
                }
                if (s[j] == 'B') {
                    sb1++;
                }
            }
            ans += sr1 * (sb - sb1);
            ans += sb1 * (sr - sr1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
        if (s[i] == 'B') {
            int ms = 0;
            for (int j = 0; j < i; j++) {
                if (s[j] == 'G') {
                    sg1++;
                }
                if (s[j] == 'R') {
                    sr1++;
                }
            }
            ans += sr1 * (sg - sg1);
            ans += sg1 * (sr - sr1);
            for (int j = 1; j <= i; j++) {
                if (i + j < n && (s[i + j] != s[i] && s[i - j] != s[i]) && (s[i + j] != s[i - j])) {
                    ms++;
                }
            }
            ans -= ms;
        }
    }
    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;
using ll = long long;

int main() {
  int n;string s;
  cin >> n >> s;
  int r = 0,g = 0,b = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'R') r++;
    else if(s[i] == 'G') g++;
    else b++;
  }
  int all = r*g*b;
  int sub = 0;
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      if(s[i] == s[j]) continue;
      int k = 2 * j - i;
      if (k >= n || s[k] == s[i] || s[k] == s[j]) continue;
      sub++;
    }
  }
  int ans = all - sub;
  cout << ans << endl;
  return 0;
}

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

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

vector<int> v;

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

    int r = 0, g = 0, b = 0;
    foreach(i, s){
        if(i == 'R'){
            r++;
        }else if(i == 'G'){
            g++;
        }else{
            b++;
        }
    }

    int rgb = r * g * b;

    int cnt = 0;
    int len = size(s);
    rep(i, len){
        FOR(j, i + 1, len){
            if(s[i] == s[j]){
                continue;
            }
            int k = 2 * j - i;

            if(k >= len || s[j] == s[k] || s[k] == s[i]){
                continue;
            }

            cnt++;
        }
    }

    println(rgb - cnt);
}


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

#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int main()
{
    fastio;
    int t,n,m,i,j,k,a,b,c;
    t=1;
    string str;
    while(t --> 0)
    {
        cin>>n;
      	cin>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;

        m=B.size();
        int ans=R.size()*G.size()*m;
        for(auto a:R)
        for(auto b:G)
        {
            if( (a+b)%2==0 and B[(a+b)/2] )
                ans--;
            if( B[2*a-b])
                ans--;
            if( B[2*b-a])
                ans--;
        }
        cout<<ans;
    }
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++


#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int main()
{
    fastio;
    int t,n,m,i,j,k,a,b,c;
    t=1;
    string str;
    while(t --> 0)
    {
        cin>>n;
      	cin>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;

        m=B.size();
        int ans=R.size()*G.size()*m;
        for(auto a:R)
        for(auto b:G)
        {
            if( (a+b)%2==0 and B[(a+b)/2] )
                ans--;
            if( B[2*a-b])
                ans--;
            if( B[2*b-a])
                ans--;
        }
        cout<<ans;
    }
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include <bits/stdc++.h>
#define MAX_N 200001
#define mod 1000000007
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
string s;
ll n;
ll rgbi[MAX_N][3], rgbk[MAX_N][3];

signed main(){
    cin >> n >> s;

    // set rgbi and rgbk
    rgbi[1][0] = rgbi[1][1] = rgbi[1][2] = 0;
    rgbk[1][0] = rgbk[1][1] = rgbk[1][2] = 0;
    // j = 1 (1 <= j <= n-2)
    if(s[0]=='R') rgbi[1][0]++;
    if(s[0]=='G') rgbi[1][1]++;
    if(s[0]=='B') rgbi[1][2]++;
    for(ll k=2; k<n; k++){
        if(s[k]=='R') rgbk[1][0]++;
        if(s[k]=='G') rgbk[1][1]++;
        if(s[k]=='B') rgbk[1][2]++;
    }
    // j > 1 (1 <= j <= n-2)
    for(ll j=2; j<=n-2; j++){
        rgbi[j][0] = rgbi[j-1][0];
        rgbi[j][1] = rgbi[j-1][1];
        rgbi[j][2] = rgbi[j-1][2];
        if(s[j-1]=='R') rgbi[j][0]++;
        if(s[j-1]=='G') rgbi[j][1]++;
        if(s[j-1]=='B') rgbi[j][2]++;

        rgbk[j][0] = rgbk[j-1][0];
        rgbk[j][1] = rgbk[j-1][1];
        rgbk[j][2] = rgbk[j-1][2];
        if(s[j]=='R') rgbk[j][0]--;
        if(s[j]=='G') rgbk[j][1]--;
        if(s[j]=='B') rgbk[j][2]--;
    }

    // for(ll j=1; j<=2; j++) cout << rgbi[j][0] << ' ' << rgbi[j][1] << ' ' << rgbi[j][2] << endl;
    // for(ll j=1; j<=2; j++) cout << rgbk[j][0] << ' ' << rgbk[j][1] << ' ' << rgbk[j][2] << endl;

    ll ret = 0;
    for(ll j=1; j<=n-2; j++){
        if(s[j] == 'R') ret += rgbi[j][1] * rgbk[j][2] + rgbi[j][2] * rgbk[j][1];
        if(s[j] == 'G') ret += rgbi[j][2] * rgbk[j][0] + rgbi[j][0] * rgbk[j][2];
        if(s[j] == 'B') ret += rgbi[j][0] * rgbk[j][1] + rgbi[j][1] * rgbk[j][0];
    }

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

    cout << ret << 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.