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

#include<iostream>
using namespace std;

int main(void)
{
  int N;
  cin >> N;
  char S[N];
    
  for(int i=0;i<N;i++)
  {   
    cin >> S[i];
  }
  
  int num=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-1 != k-j
        )
        {
          num++;
        }
      }
    }
  }
  cout << num;
  
  return 0; 
}

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   
   long int n;
   string s;

   cin>>n>>s;

   long int ans = 0;

   vector<long int> red, green, blue;
   ordered_set os,os1,os2,os3;


   for(long int i = 0; i < n; i++){
    if(s[i] == 'R'){
      red.push_back(i);
      os1.insert(i);
    }
    else if(s[i] == 'B'){
      blue.push_back(i);
      os2.insert(i);
    }
    else{
      green.push_back(i);
      os3.insert(i);
    }
   }

   if(red.size() < blue.size() && red.size() < green.size()){
      auto copy = red;
      auto copy2 = green;
      green = copy;
      red = copy2;
      os = os1;
   }

   else if(blue.size() < red.size() && blue.size() < green.size()){
      auto copy = blue;
      auto copy2 = green;
      green = copy;
      blue = copy2;
      os = os2;
   }
   else{
    os = os3;
   }





   for(long int i = 0; i < red.size(); i++){
    for(long int j = 0; j < blue.size(); j++){
      long int totalGreen = green.size();
      long int dis = red[i]  - blue[j];
      long int onePossibleValue = min(red[i],blue[j]) - dis;
      if(os.find(onePossibleValue) != os.end())
        totalGreen--;

      long int secondPossibleValue = max(red[i],blue[j]) + dis;      
      if(os.find(onePossibleValue) != os.end())
        totalGreen--;

      long int middleValue = (red[i] + blue[j]) / 2;
      if(os.find(middleValue) != os.end())
        totalGreen--;

      ans += totalGreen;
    }
   }

   cout<<ans;

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

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007
ll fact[50];
#define eps 1e-9
#define INF 1e18
ll power(ll a,ll b,ll c){
  ll ans=1;
  while(b){
    if(b&1){
      ans=ans*a%c;
    }
    a=a*a%c;
    b=b/2;
  }
  return ans;
}
ll ncr(ll n,ll r){
    if(r>n)return 0;
    if(r==n)return 1;
    ll z=fact[n];
    z=z*power(fact[r],mod-2,mod)%mod;
    z=z*power(fact[n-r],mod-2,mod)%mod;
    return z;
}
ll min(ll a,ll b){return a<b?a:b;}
ll max(ll a,ll b){return a>b?a:b;}
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}

int main() {
   ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   int n; cin>>n;
   string s; cin>>s;
   ll dp[n+1][3];
   memset(dp,0,sizeof(dp));
   map<char,int> m;
   m['R']=0;
   m['G']=1;
   m['B']=2;
   dp[1][m[s[0]]]=1;
   for(int i=1;i<n;++i){
    for(int j=0;j<3;j++)dp[i+1][j]=dp[i][j];
    dp[i+1][m[s[i]]]++;
   }
   ll ans=0;
   for(int i=0;i<n;++i){
    for(int j=i+1;j<n;j++){
        if(s[i]==s[j])continue;
        if(m[s[j]]!=0&&m[s[i]]!=0){ans=ans+dp[n][0]-dp[j+1][0];
            int x=j-i;
            if(j+x<n&&m[s[j+x]]==0)ans--;
        }
        if(m[s[j]]!=1&&m[s[i]]!=1){ans=ans+dp[n][1]-dp[j+1][1];
            int x=j-i;
            if(j+x<n&&m[s[j+x]]==1)ans--;
        }
        if(m[s[j]]!=2&&m[s[i]]!=2){ans=ans+dp[n][2]-dp[j+1][2];
            int x=j-i;
            if(j+x<n&&m[s[j+x]]==2)ans--;
        }
        }

   }
   cout<<ans;
}


Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:4:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::__cxx11::basic_string<char>::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = char]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:186:14: note: called from here
  186 |       struct _Alloc_hider : allocator_type // TODO check __is_final
      |              ^~~~~~~~~~~~
Language: C

#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}
 
#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e4 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	read(n);
	string s;
	cin >> s;
	
	int cnt[n + 10][3] = {};
	FORD (i, n - 1, 0)
	{
	    FOR (j, 0, 2) cnt[i][j] = cnt[i + 1][j];
	    if (s[i] == 'R') cnt[i][0]++;
	    if (s[i] == 'G') cnt[i][1]++;
	    if (s[i] == 'B') cnt[i][2]++;
	}
	
	int ans = 0;
	FOR (i, 0, n - 1)
	{
	    FOR (j, i + 1, n - 1)
	    {
	        if (s[i] == s[j]) continue;
	        char ch = 'R' + 'G' + 'B' - s[i] - s[j];
	        
	        if (ch == 'R') ans += cnt[j + 1][0];
	        if (ch == 'G') ans += cnt[j + 1][1];
	        if (ch == 'B') ans += cnt[j + 1][2];
	        
	        if (2*j - i < n && s[2*j - i] == ch) ans--;
	        //cout << i << " " << j << ": " << ans << " " << 2*j - i << " " << ch <<  " " << s[2*j - i] << endl;
	    }
	}
	
    cout << ans;
}



























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

#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>

#define FOR_LT(i, beg, end) for (int i = (int)(beg); i < (int)(end); i++)
#define FOR_LE(i, beg, end) for (int i = (int)(beg); i <= (int)(end); i++)
#define FOR_DW(i, beg, end) for (int i = (int)(beg); (int)(end) <= i; i--)
#define REP(n)              for (int repeat_index = 0; repeat_index < (int)n; repeat_index++)


using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int n; cin >> n;
	string s; cin >> s;

	vector<int> rs(n);
	vector<int> gs(n);
	vector<int> bs(n);

	{
		int rc = 0;
		int gc = 0;
		int bc = 0;
		FOR_DW(i, n - 1, 0) {
			if (s[i] == 'R') rc++;
			if (s[i] == 'G') gc++;
			if (s[i] == 'B') bc++;

			rs[i] = rc;
			gs[i] = gc;
			bs[i] = bc;
		}
	}

	int64_t ans = 0;
	FOR_LT(i, 0, n) {
		FOR_LT(j, i + 1, n - 1) {
			if (s[i] == s[j]) continue;

			bool ss[256] = {};
			ss[s[i]] = true;
			ss[s[j]] = true;

			char r = ' ';
			if (!ss['R']) {
				r = 'R';
			}
			if (!ss['G']) {
				r = 'G';
			}
			if (!ss['B']) {
				r = 'B';
			}

			vector<int>& rems = (r == 'R' ? rs : r == 'G' ? gs : bs);
			ans += rems[j + 1];
			int k = j + (j - i);
			if (k < n && s[k] == r) ans--;
		}
	}
	cout << ans << endl;

	return 0;
}

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

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

using namespace std;

typedef long long int ll;
 
template<class T> inline bool chmax(T& a,T b){ if(a<b){ a=b; return true;} return false; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){ a=b; return true;} return false; }
 
typedef pair<int,int> pair;

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

    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(j-i!=k-j){
                    bool A=s[i]!=s[j];
                    bool B=s[i]!=s[k];
                    bool C=s[j]!=s[k];
                    if((A && B) && C){
                        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 <typeinfo>
#include <cstring>
#include <utility>
#include <vector>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;


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

    string s;
    cin >> s;

    unsigned int numR = 0;
    unsigned int numG = 0;
    unsigned int numB = 0;

    for (int i = 0; i < N; i++) {
        if (s[i] == 'R') numR++;
        else if (s[i] == 'G') numG++;
        else if (s[i] == 'B') numB++;
    }

    unsigned int comp = 0;
    for (unsigned int j = 1; j < N - 1; j++) {
        unsigned int maxD = min(j, N - j - 1);
        for (unsigned int d = 1; d <= maxD; d++) {
            unsigned int i = j - d;
            unsigned int k = j + d;
            if (s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) comp++;
        }
    }

    cout << numR * numG * numB - comp << 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;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int n;
string s;

ll search(char s1, char s2, char s3, vint ls) {
    ll res = 0;
    rep(i, n) {
        if (s[i] != s1) continue;
        srep(j, i+1, n) {
            if (s[j] != s2) continue;
            res += ls[n]-ls[j+1];
            if (s[j+j-i] == s3) res--;
        }
    }
    return res;
}

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

    vint r(n+1, 0);
    vint g(n+1, 0);
    vint b(n+1, 0);
    rep(i, n) if (s[i] == 'R') r[i+1]++;
    rep(i, n) r[i+1] += r[i];
    rep(i, n) if (s[i] == 'G') g[i+1]++;
    rep(i, n) g[i+1] += g[i];
    rep(i, n) if (s[i] == 'B') b[i+1]++;
    rep(i, n) b[i+1] += b[i];

    ll ans = 0;
    ans += search('R', 'G', 'B', b);
    ans += search('R', 'B', 'G', g);
    ans += search('G', 'R', 'B', b);
    ans += search('G', 'B', 'R', r);
    ans += search('B', 'R', 'G', g);
    ans += search('B', 'G', 'R', r);

    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>
#include<tr1/unordered_map>
using namespace std;
typedef long long ll;
#define pb push_back
const ll INF=1e18;
const int inf=0x3f3f3f3f;
const int M=4444;
void py(){
    cout<<"Yes"<<'\n';
}
void pn(){
    cout<<"No"<<'\n';
}
char s[4444];
int r[M],g[M],b[M],sufb[M],sufr[M],sufg[M];
int main(){
    int n;
    scanf("%d%s",&n,s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='R')
            r[i]=1;
        else if(s[i]=='G')
            g[i]=1;
        else
            b[i]=1;
    for(int i=n;i>=1;i--)
        sufb[i]=sufb[i+1]+b[i],sufr[i]=sufr[i+1]+r[i],sufg[i]=sufg[i+1]+g[i];
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(s[i]=='G'){
            for(int j=i+1;j<=n;j++){
                if(s[j]=='G')
                    continue;
                if(s[j]=='R'){///grb
                    ans+=sufb[j+1];
                    if(j+(j-i)<=n){
                        ans-=b[j+(j-i)];
                    }
                }
                else{///gbr
                    ans+=sufr[j+1];
                    if(j+(j-i)<=n){
                        ans-=r[j+(j-i)];
                    }
                }

            }
        }
        else if(s[i]=='B'){
            for(int j=i+1;j<=n;j++){
                if(s[j]=='B')
                    continue;
                if(s[j]=='R'){///brg
                    ans+=sufg[j+1];
                    if(j+(j-i)<=n){
                        ans-=g[j+(j-i)];
                    }
                }
                else{///bgr
                    ans+=sufr[j+1];
                    if(j+(j-i)<=n){
                        ans-=r[j+(j-i)];
                    }
                }

            }
        }
        else{
            for(int j=i+1;j<=n;j++){
                if(s[j]=='R')
                    continue;
                if(s[j]=='G'){///rgb
                    ans+=sufb[j+1];
                    if(j+(j-i)<=n){
                        ans-=b[j+(j-i)];
                    }
                }
                else{///rbg
                    ans+=sufg[j+1];
                    if(j+(j-i)<=n){
                        ans-=g[j+(j-i)];
                    }
                }

            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define f first
#define s second
typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;
typedef vector<piii> viii;

const int MAXN = 500100, MAXK = 30;
const ll MOD = 998244353;
const int INF = 1e8;
const ld PI = asin(1) * 2;

void setIO () {
    FAST_IO;
}

void setIO (string s) {
    setIO();
 	freopen((s+".in").c_str(),"r",stdin);
	freopen((s+".out").c_str(),"w",stdout);
}

int n;
string s;
int a[MAXN];

ll pref[MAXN][3];

int main() {
	setIO();

    cin >> n >> s;
    ll ans = 0;
    FOR(i, 1, n) {
        if (s[i-1] == 'R') a[i] = 0;
        else if (s[i-1] == 'G') a[i] = 1;
        else a[i] = 2;
    }

    FOR(i, 1, n) {
        FOR(k, 0, 2) pref[i][k] = pref[i-1][k];
        pref[i][a[i]]++;
    }

    FOR(i, 1, n) FOR(k, i+2, n) {
        if (a[i] == a[k]) continue;
        int j = 0;
        while (a[i] == j || a[k] == j) {j++;}
        ans += pref[k-1][j]-pref[i][j];
        int mid = (k+i)/2;
        if ((k+i)%2 == 1) continue;
        if (a[mid] == j) ans--;
    }

    cout << ans;

	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 all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0,(i##_len)=(n);(i)<(i##_len);(i)++)
#define rep2(i,a,b) for(ll (i)=(a),(i##_len)=(b);(i)<=(i##_len);(i++))
#define Yes(n) cout<<((n)?"Yes\n":"No\n")
#define pb push_back
using namespace std;
using ll = long long;

template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}
vector<string> split(const string&s,char d){vector<string>r;stringstream ss(s);string k;while(getline(ss,k,d))if(!k.empty())r.pb(k);return r;}

// Template ends here

void solve(ll N, string S){
    ll cnt = 0;
    char x, y, z;
    rep(i, N - 2) {
        x = S.at(i);
        rep2(j, i + 1, N - 2) {
            if (S.at(j) == x) continue;
            y = S.at(j);
            rep2(k, j + 1, N - 1) {
                if (S.at(k) == x || S.at(k) == y) continue;
                if (k - j == j - i) continue;
                cnt++;
            }
        }
    }
    cout << cnt << "\n";
}

int main() {
    ll N;
    scanf("%lld",&N);
    string S;
    cin >> S;
    solve(N, S);
    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 rep(i,a,b) for(i=a;i<b;i++)
    #define pb push_back
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define root sqrtl
    #define vi vector < ll  int >
    #define CLR(a) memset((a),0,sizeof(a))
    #define mp make_pair
    #define hell 1000000007
    using namespace std;
    ll mod=hell;
 ll pr( ll x , ll y)
{
    ll ans=1;
    if(y==0) return ans;
    while(y>1)
    {
        if(y&1) ans*=x;
        x*=x;
        y/=2;
        x%=mod;
        ans%=mod;
    }
    ans*=x;
    ans%=mod;
    return ans;
}
ll fact( ll n)
{
    ll ans=1,i;
    rep(i,1,n+1)
    {
        ans*=i;
        ans%=mod;
    }
    return ans;
}
ll in(ll x) { return  pr(x,mod-2);}

bool prime[1000500];
vector < ll > v;
void pre()
{
    int n=1000000,i,j,p;
    memset(prime,true,sizeof(prime));
    prime[0]=prime[1]=false;
    for(i=2;i*i<=n;i++)
    {
        if(prime[i])
        {
            for(p=2*i;p<=n;p+=i) prime[p]=false;
        }
    }
  rep(i,0,1000000) if(prime[i]) v.pb(i);

}

ll inv(ll n)
{
    return pr(n,mod-2);
}


int cnt[26][4001];
void solve( )
{
 ll i,j=1,k,n,m=0,f,s1=0,x=1e13,c=1,y=0,a=0,b=0,d,p;

 cin>>n;
 string s;
 cin>>s;
for(i=n-1;i>=0;i--)
{
    for(j=0;j<26;j++)
    {
        cnt[j][i]=cnt[j][i+1];
    }
    cnt[s[i]-'A'][i]++;
}


for(i=0;i<n-2;i++)
{
    for(j=i+1;j<n-1;j++)
    {
        if(s[i]!=s[j])
        {
            y+=cnt['R'+'B'+'G'-s[i]-s[j]-'A'][j+1];
            d=j-i;
            if(j+d<n and s[j+d]!=s[i] and s[j+d]!=s[j]) y--;
            //cout<<y<<endl;
        }
    }
}
 cout<<y;


}
    signed main()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        int t=1;
        //cin>>t;
        while(t--)
        solve();
    }


Compiler output:
main.c:1:13: 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 (ll i = 0; i < (n); ++i)
#define fin(ans) cout << (ans) << endl;
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

//Yes, Noと表示後終了
void fYn(bool a)
{
  if (a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  exit(0);
}

ll gcd(ll a, ll b)
{
  return b ? gcd(b, a % b) : a;
}

//実行部
void Main()
{
  ll n; str s;
  cin >> n >> s;
  ll ans = 0;
  for(ll i = 0;i < (n - 2);i++)
  {
    for(ll j = i + 1;j < (n - 1);j++)
    {
      for(ll k = j + 1;k < n;k++)
      {
        if(j - i == k  - j) continue;
        else
        {
          if(s[j] != s[i]&&s[j] !=s[k]&&s[i] != s[k]) ans++;
        }
      }
    }
  }
  fin(ans)
  return;
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/

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

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

Compiler output:
a.cc:19:14: warning: missing terminating ' character
   19 |     if(s[i]!='R)continue;
      |              ^
a.cc:19:14: error: missing terminating ' character
   19 |     if(s[i]!='R)continue;
      |              ^~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:9:21: error: expected primary-expression before 'for'
    9 | #define reps(i,m,n) for(int i=(m);i<(n);i++)
      |                     ^~~
a.cc:20:5: note: in expansion of macro 'reps'
   20 |     reps(j,i+1,n){
      |     ^~~~
a.cc:19:14: error: expected ')' before 'for'
   19 |     if(s[i]!='R)continue;
      |       ~      ^
      |              )
a.cc:20:10: error: 'j' was not declared in this scope
   20 |     reps(j,i+1,n){
      |          ^
a.cc:9:35: note: in definition of macro 'reps'
    9 | #define reps(i,m,n) for(int i=(m);i<(n);i++)
      |                                   ^
a.cc: At global scope:
a.cc:29:3: error: expected declaration before '}' token
   29 |   }
      |   ^
Language: C

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

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

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

  int64_t sum = r*g*b;

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

  cout<<sum-out<<endl;

  return 0;
}

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

/*
 * @Author: Kaizyn
 * @Date: 2020-04-12 20:18:14
 * @LastEditTime: 2020-04-12 20:22:46
 */
#include <bits/stdc++.h>

// #define DEBUG

using namespace std;

const int N = 4e3+7;
const int MOD = 998244353;
const int INF = 0x3f3f3f3f;
const double eps = 1e-7;
const double PI = acos(-1);
typedef pair<int, int> pii;

int n;
char s[N];

inline void solve()
{
    cin >> n >> (s+1);
    int r = 0, g = 0, b = 0;
    for (int i = 1; i <= n; ++i) {
        if (s[i] == 'R') ++r;
        if (s[i] == 'G') ++g;
        if (s[i] == 'B') ++b;
    }
    long long res = 1ll*r*g*b;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; i+j+j <= n; ++j) {
            if (s[i] != s[i+j] && s[i] != s[i+j+j] && s[i+j] != s[i+j+j]) --res;
        }
    }
    cout << res << endl;
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int testcase = 1;
    // cin >> testcase;
    for (int i = 1; i <= testcase; ++i) {
        solve();
    }
    return 0;
}

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

#include <bits/stdc++.h>
#include <iomanip>
#define ll long long
using namespace std;

int main() {
  ll N, cnt = 0;
  cin >> N;
  string S;
  cin >> S;
  for(ll i = 0; i < N - 2; i++) {
    for(ll j = i + 1; j < N - 1; j++) {
      for(ll k = j + 1; k < N; k++) {
        if((S.at(i) != S.at(j)) && (S.at(j) != S.at(k)) && (S.at(k) != S.at(i)) && (j - i != k - j)) cnt++;
      }
    }
  }
  cout << 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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define int long long
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio 
    int n ; 
    cin >> n ;
    string s ;
    cin >> s ;
    int R = 0 , G = 0, B = 0 ;
    for(char &c : s){
        if ( c == 'R' ) R++ ;
        else if ( c == 'B' ) B++ ;
        else G++ ;
    }
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        for(int j = 1; j <= n; j++){
            int before = i - j ; 
            int after = i + j ;
            if ( before < 0 || after >= n ) break ;
            set<int> ss ; 
            ss.insert(s[i]) ;
            ss.insert(s[before]) ;
            ss.insert(s[after]) ;
            if ( ss.size() == 3 ) ans++ ;
        }
    }
    debug() << imie(ans) ;
    int curR = 0 , curB = 0 , curG = 0 ;
    int total = 0 ;
    for(int i = 0; i < n; i++){
        if ( s[i] == 'R' ){
            int beforeB = curB ;
            int afterG = G - curG ;
            total += beforeB * afterG ;
            int beforeG = curG ;
            int afterB = B - curB ;
            total += beforeG * afterB ;
            curR++ ;
        }
        else if ( s[i] == 'B' ){
            int beforeR = curR ;
            int afterG = G - curG ;
            total += beforeR * afterG ;
            int beforeG = curG ;
            int afterR = R - curR ;
            total += beforeG * afterR ;
            curB++ ;
        }
        else{
            int beforeR = curR ;
            int afterB = B - curB ;
            total += beforeR * afterB ;
            int beforeB = curB ;
            int afterR = R - curR ;
            total += beforeB * afterR ;
            curG++ ;
        }
    }
    cout << total - ans << endl;
    return 0 ; 
}

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

#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n+1;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
#define stringc(s) string s; cin >> s;
using namespace std;
int main() {
  intc(n);
  stringc(s);
  ll a=0;
  r1(i, n-2) {
    for(int j=i+1; j<n-1; j++) {
      for(int k=j+1; k<n; k++)  {
        if(s.at(i)!=s.at(j) && s.at(i)!=s.at(k) && s.at(j)!=s.at(k) && j-i!=k-j) a++;
      }
    }
  }
  cout << a << end;
}

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 lli;
int main()
{
	int a; cin >> a;
	string str; cin >> str;
	lli arr[a + 50], suf[3][a + 50], now;
	memset(suf, 0, sizeof(suf));
	for(int i=a - 1; i >= 0; i--)
	{
		if(str[i] == 'R') arr[i] = 0;
		else if(str[i] == 'G') arr[i] = 1;
		else				   arr[i] = 2;
		for(int j=0; j<3; j++)
			suf[j][i] = suf[j][i + 1];
		suf[arr[i]][i] ++;
	}
	lli ans = 0;
	for(int i=0; i<a; i++)
	{
		for(int j=i + 1; j < a; j++)
		{
			if(arr[i] == arr[j]) continue;
			if(arr[i] + arr[j] == 1) 			now = 2;
			else if(arr[i] + arr[j] == 2) 		now = 1;
			else								now = 0;
			ans += suf[now][j + 1];
			if(j + (j - i) < a)
			{
				if(arr[j + (j - i)] == now)
					ans --;
			}
		}
	}
	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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

const int inf = 1e9;

int main(){
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll t = 0;
  for(int i = 0; i < n ; ++i){
    for(int j = i + 1; j < n; ++j){
      for(int k = j + 1; k < n; ++k){
	//int y = n - i + 1;
	//int r = n - j + 1;
	//int p = n - k + 1;
	if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k] && j - i != k - j)t++;
	//if(s[y] != s[r] && s[y] != s[p] && s[r] != s[p] && y - r != r - p)t++;
      }	   
    }
  }
  cout<<t<<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 <string>

const int MAXN = 4001;

int r[MAXN], g[MAXN], b[MAXN];

int64_t solve(int n, const std::string& s) {
  r[n] = g[MAXN] = b[MAXN] = 0;
  for (int i = n - 1; i >= 0; --i) {
    r[i] = r[i + 1];
    g[i] = g[i + 1];
    b[i] = b[i + 1];
    if (s[i] == 'R') ++r[i];
    else if (s[i] == 'G') ++g[i];
    else ++b[i];
  }

  int64_t ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (s[i] == s[j]) continue;
      int *p;
      char ch = 'R';
      if (s[i] != 'R' && s[j] != 'R') p = r, ch = 'R';
      else if (s[i] != 'G' && s[j] != 'G') p = g, ch = 'G';
      else p = b, ch = 'B';
      ans += p[j + 1];
      if (j + j - i < n && s[j + j - i] == ch) --ans;
    }
  }
  return ans;
}

int main() {
  int n;
  std::string s;
  std::cin >> n >> s;
  std::cout << solve(n, s) << std::endl;
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

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


}

/*



 */



Compiler output:
a.cc: In function 'int main()':
a.cc:39:36: error: expected ';' before ')' token
   39 |         for(int j=1;j<=min(i,n-i+1)){
      |                                    ^
      |                                    ;
Language: C

#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,p[maxn],x[maxn][10],ans;
char s[maxn];

int main()
{
	n=read(); scanf("%s",s+1);
	for(int i=n;i>=1;i--)
	{
		rep(j,1,3) x[i][j]=x[i+1][j];
		if(s[i]=='R') p[i]=1,x[i][1]++;
		if(s[i]=='G') p[i]=2,x[i][2]++;
		if(s[i]=='B') p[i]=3,x[i][3]++;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			//cout<<i<<" "<<j<<endl;
			if(s[i]==s[j]) continue;
			int t=j+(j-i),q=6-p[i]-p[j];
			if(p[t]==q) ans+=x[j+1][q]-1;
			else ans+=x[j+1][q];
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
ll lr[4010], rr[4010], lg[4010], rg[4010], lb[4010], rb[4010];
int main() {
  ll n;
  char s[4010];
  ll ans = 0LL;
  scanf("%lld", &n);
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    lr[i + 1] = lr[i];
    lg[i + 1] = lg[i];
    lb[i + 1] = lb[i];
    if (s[i] == 'R') {
      lr[i + 1]++;
    }
    if (s[i] == 'G') {
      lg[i + 1]++;
    }
    if (s[i] == 'B') {
      lb[i + 1]++;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    rr[i] = rr[i + 1];
    rg[i] = rg[i + 1];
    rb[i] = rb[i + 1];
    if (s[i] == 'R') {
      rr[i]++;
    }
    if (s[i] == 'G') {
      rg[i]++;
    }
    if (s[i] == 'B') {
      rb[i]++;
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 1; i + j < n - 1; j++) {
      if (s[i] == 'R') {
        if (s[i + j] == 'G') {
          ans += rb[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'B') {
            ans--;
          }
        }
        if (s[i + j] == 'B') {
          ans += rg[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'G') {
            ans--;
          }
        }
      } else if (s[i] == 'G') {
        if (s[i + j] == 'R') {
          ans += rb[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'B') {
            ans--;
          }
        }
        if (s[i + j] == 'B') {
          ans += rr[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'R') {
            ans--;
          }
        }
      } else if (s[i] == 'B') {
        if (s[i + j] == 'G') {
          ans += rr[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'R') {
            ans--;
          }
        }
        if (s[i + j] == 'R') {
          ans += rg[i + j];
          if (i + 2 * j < n && s[i + 2 * j] == 'G') {
            ans--;
          }
        }
      }
    }
  }
  printf("%lld\n", ans);
}

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

#include<bits/stdc++.h>
#define int           long long
#define pb            push_back
#define ppb           pop_back
#define si            set <int>
#define endl          '\n'
#define fr            first
#define sc            second     
#define rep(i,a,b)    for(int  i=a;i<b;i++)
#define repr(i,a,b)      for(int i=b-1;i>=a;i--)
#define trav(it,v)      for(auto it=v.begin();it!=v.end();it++)
#define all(v)        v.begin(),v.end()
#define srt(v)        sort(all(v))
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define bs            binary_search
#define sp(n)         setprecision(n)
#define spl           " "
#define arr(a,n)      rep(i,0,n) cin>>a[i]
#define mod           998244353
#define MAXN          1000000000000000000

using namespace std;

bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 


//int dx[4]={0,0,1,-1};
//int dy[4]={1,-1,0,0};
// vector<int>adj[100001];
// int vis[100001]={0};
// vector<int>v1;

void solve()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    set<int>st2;
    vector<int>v1;
    vector<int>v2;
    rep(i,0,n)
    {
        if(s[i]=='R')
            v1.pb(i);
        else if(s[i]=='G')
            st2.insert(i);
        else v2.pb(i);
    }
    int ans=0,a,b,c;
    rep(i,0,v1.size())
    {
        rep(j,0,v2.size())
        {
            if(v1[i]>v2[j])
            {
                a=(2*v2[j])-v1[i];
                b=(2*v1[i])-v2[j];
                if((v1[i]+v2[j])%2==0)
                c=(v1[i]+v2[j])/2;
            else c=-1;
            }
            else
            {
                a=(2*v1[i])-v2[j];
                b=(2*v2[j])-v1[i];
                if((v1[i]+v2[j])%2==0)
                c=(v1[i]+v2[j])/2;
            else c=-1;
            }
            int sum=st2.size();
            if(a>=0 && a<n)
            {
                if(st2.find(a)!=st2.end())
                    sum--;
            }
            if(b>=0 && b<n)
            {
                if(st2.find(b)!=st2.end())
                    sum--;
            }
            if(c>=0 && c<n)
            {
                if(st2.find(c)!=st2.end())
                    sum--;
            }
            ans+=sum;
        }
    }
    cout<<ans;

}   
    


signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
}

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;
typedef long long int ll;
// ll mod=1000000007;
 
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    cout.tie(NULL);
    ll t,i,j,k,temp,temp2,n,m,x,y,sum=0;
    cin >> t;
    string s;
    cin >> s;
    for(i=0;i<t-2;i++){
        for(j=i+1;j<t-1;j++){
            for(k=j+1;k<t;k++){
                if(j-i!=k-j&& s[i]!=s[j] && s[j]!=s[k]&&s[i]!=s[k]) 
                sum++;
            }
        }
    }
    cout << sum;
}

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 <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  string s;
  cin>>s;
  ll sr=0,sg=0,sb=0;
  rep(i,n) {
    if(s[i]=='R')sr++;
    if(s[i]=='G')sg++;
    if(s[i]=='B')sb++;
  }
  ll x=0;
  repeat(j,1,n-1) {
    repeat(d,1,n) {
      int i=j-d;
      int k=j+d;
      if(i<0||n<=k)
	break;
      if(s[i]!=s[j]&&s[i]!=s[k]&&s[j]!=s[k]) {
	x++;
      }
    }
  }
  cout << sr*sg*sb-x << endl;
  return 0;
}


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

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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* na, Arg1&& arg1, Args&&... args) {
  const char* c = strchr(na + 1, ',');
  cerr.write(na, c - na) << " : " << arg1 << " , ";
  __f(c + 1, args...);
}
#define endl "\n"
#define all(v) v.begin(), v.end()
#define UNIQUE(v) sort(all(v)),v.erase(unique(all(v)),v.end())
typedef long long LL;
typedef pair <int,int> pii;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int mod = 1e9 + 7;
const int inf = 1e9;
const LL INF = 1e18;
const int N = 4e3 + 5;

int a[ N ];
int sum[ N ][ 5 ];
int n;

int get_sum(int l, int r, int id) {
  if (l > r) return 0;
  r = min(r, n);
  return sum[r][id] - sum[l - 1][id];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("input.txt", "r", stdin);
  #endif // LOCAL
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    int id = 0;
    if (s[i] == 'R') id = 1;
    if (s[i] == 'G') id = 2;
    if (s[i] == 'B') id = 3;
    a[i + 1] = id;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 3; j++) {
      sum[i][j] += sum[i - 1][j] + (a[i] == j);
    }
  }
  LL ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (a[i] == a[j]) continue;
      int id = 6 - a[i] - a[j];
      int d = j - i;
      int idx = j + d;
      ans += get_sum(j + 1, idx - 1, id) + get_sum(idx + 1, n, id);
    }
  }
  cout << ans << endl;
  return 0;
}



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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin >> n;
    string s;cin >> s;
    vector<vector<int>> a(3,vector<int>(n));
    int x=0,y=0,z=0;
    vector<int> c(n);
    for(int i=n-1;i>=0;i--){
        if(s[i]=='R'){
            x++;
            c[i]=0;
        }
        else if(s[i]=='G'){
            y++;
            c[i]=1;
        }
        else{
            z++;
            c[i]=2;
        }
        a[0][i]=x;
        a[1][i]=y;
        a[2][i]=z;
    }
    ll ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            int p=j-i;
            if(c[i]==c[j]){
                continue;
            }
            if(j+p<n){
                if(c[i]==c[j+p]||c[j]==c[j+p]){
                    ans+=a[3-c[i]-c[j]][j+1];
                }
                else{
                    ans+=a[3-c[i]-c[j]][j+1]-1;
                }
            }
            else{
                ans+=a[3-c[i]-c[j]][j+1];
            }
        }
    }
    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>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long LL;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int cR = 0, cG = 0, cB = 0;
  REP(i, N) {
    if(S[i] == 'R') cR++;
    if(S[i] == 'G') cG++;
    if(S[i] == 'B') cB++;
  }
  int ret = cR * cG * cB;
  for(int i=1; i<N-1; ++i) {
    for(int j=i-1; j>=0 && i*2-j < N; --j) {
      if(S[i] != S[j]  && S[i] != S[i*2-j] && S[j] != S[i*2-j]) ret--;
    }
  }
  cout << ret << endl;
}

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