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

//#define _GLIBCXX_DEBUG
//#define _CRTDBG_MAP_ALLOC
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll LINF = 9187201950435737471;
const ll nLINF = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const int MAXN = 2e5 + 15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int BLOCK = 500;
const double PI = acos(-1);
//auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
auto seed = 194113341;
mt19937 rnd(seed);

bool is_equal(double a, double b) {
    return abs(a - b) <= EPS;
}


#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) ((_v) * (_v))
#define vi vector <int>
#define vii vector <pair <int, int> >
#define eb emplace_back
#define pb push_back
#define mod(x, m) ((x) % m + (x < 0 ? m: 0))


inline void IO() {
#if buyolitsez
    freopen("input.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
}

template <typename T>
istream& operator >> (istream& in, vector<T>& a) {
    for (auto& i : a)
        in >> i;
    return in;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T>& a) {
    for (auto& i : a) {
        out << i << " ";
    }
    return out;
}

template <typename T, typename D>
istream& operator >> (istream& in, pair<T, D>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T, typename D>
ostream& operator << (ostream& out, const pair<T, D>& a) {
    out << a.first << " " << a.second;
    return out;
}

#define int int64_t

int get(char x) {
    if (x == 'R') {
        return 0;
    }
    else if (x == 'G') {
        return 1;
    }
    return 2;
}
vector <int> pos[3];

inline void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; ++i) {
        pos[get(s[i])].eb(i);
    }
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            set <int> ost;
            ost.insert(0);
            ost.insert(1);
            ost.insert(2);
            ost.erase(get(s[i]));
            ost.erase(get(s[j]));
            if (sz(ost) != 1) {continue;}
            int need = *ost.begin();
            int less = lower_bound(all(pos[need]), j) - pos[need].begin();
            int c = sz(pos[need]) - less;
            int k = j + (j - i);
            if (k < n && get(s[k]) == need) {
                c--;
            }
            ans += c;
        }
    }
    cout << ans;
}

signed main() {
    IO();
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  const string str = "RGB";
  auto Get = [&](char c) {
    return find(str.begin(), str.end(), c) - str.begin();
  };
  int n;
  string s;
  cin >> n >> s;
  vector<vector<int>> sum(3, vector<int>(n, 0));
  for (int i = 0; i < n; i++) {
    int now = Get(s[i]);
    ++sum[now][i];
    if (i > 0) {
      sum[0][i] += sum[0][i - 1];
      sum[1][i] += sum[1][i - 1];
      sum[2][i] += sum[2][i - 1];
    }
  }
  auto Check = [&](char a, char b) {
    if (a == 'R' and b == 'G') return 'B';
    if (a == 'R' and b == 'B') return 'G';
    if (a == 'G' and b == 'R') return 'B';
    if (a == 'G' and b == 'B') return 'R';
    if (a == 'B' and b == 'R') return 'G';
    if (a == 'B' and b == 'G') return 'R';
  };
  int res = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        continue;
      }
      char rem = Check(s[i], s[j]);
      int idx = Get(rem);
      int temp = sum[idx][n - 1] - sum[idx][j];
      if (s[j + (j - i)] == rem) --temp;
      res += temp;
    }
  }
  cout << res << '\n';
  return 0;
}


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

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
string S;
ll ans;
ll r = 0;
ll g = 0;
ll b = 0;

int main(){
	
	cin>>N>>S;
	REP( i, N ){
		if( S[i] == 'R' ) r++;
		if( S[i] == 'G' ) g++;
		if( S[i] == 'B' ) b++;
	}
	
	ans = r*g*b;
	
	FOR( i, 1, N ){
		REP( j, N ){
			if( (j+2*i) >= N ) continue;
			if( (S[j] != S[j+i]) && (S[j+i] != S[j+2*i]) && (S[j+2*i] != S[j]) ) ans--;
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <set>
#include <map>

using namespace std;

typedef long long LL;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, ans = 0;
		cin >> n;
		if (n <= 0) return 0;
		string s;
		cin >> s;
		char charToIndex[256];
		const char chars[3] = { 'R', 'G', 'B' };
		vector<LL> counts[3];
		for (int i = 0; i < 3; ++i) {
			charToIndex[chars[i]] = i;
			counts[i].resize(n + 1);
			for (int j = n - 1; j >= 0; --j) {
				counts[i][j] = counts[i][j + 1] += (s[j] == chars[i]);
			}
		};
		for (LL i = 0; i < n - 2; ++i) {
			for (LL j = i + 1; j < n - 1; ++j) {
				if (s[i] != s[j]) {
					int k = 3 ^ charToIndex[s[i]] ^ charToIndex[s[j]];
					ans += counts[k][j + 1];
					if (2 * j - i < n && s[2 * j - i] == chars[k]) {
						--ans;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}


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


#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
using namespace std;

using ll = long long;
const int INF = 1001001001;

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

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

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

  ll count = r*g*b;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      int k = 2*j - i;
      if (k >= n || k <= j) continue;
      if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) {
        count--;
      }
    }
  }

  cout << count << endl;
}


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

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

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  string S;
  ll cnt = 0;
  cin >> N >> S;
  vector<int> v1;
  vector<int> v2;
  vector<int> v3;
  rep (i, N) {
    if (S[i] == 'R')
      v1.pb(i);
    if (S[i] == 'G')
      v2.pb(i);
    if (S[i] == 'B')
      v3.pb(i);
  }
  rep (i, v1.size()) {
    rep (j, v2.size()) {
      rep (k, v3.size()) {
        vector<int> v(3) = {i, j, k};
        sort(all(v));
        if (v[1]-v[0] != v[2]-v[1])
          cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:26: error: expected ',' or ';' before '=' token
   42 |         vector<int> v(3) = {i, j, k};
      |                          ^
Language: C

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

int main()
{
	ll n;
	string s;
	cin>>n>>s;
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			for(ll k=j+1;k<n;k++)
			{
				if((k-j != j-i)&&(s[i]!=s[j])&&(s[i]!=s[k])&&(s[k]!=s[j]))
				{
					ans++;
				}
			}
		}
	}
	cout<<ans<<"\n";
  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>
#define ll long long 
using namespace std;

int main()
{
	ll n;
	string s;
	cin>>n>>s;
	ll ans=0;
	for(ll i=0;i<n;i++)
	{
		for(ll j=i+1;j<n;j++)
		{
			for(ll k=j+1;k<n;k++)
			{
				if((k-j != j-i)&&(s[i]!=s[j])&&(s[i]!=s[k])&&(s[k]!=s[j]))
				{
					ans++;
				}
			}
		}
	}
	cout<<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>
#include <math.h>
using namespace std;


int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long r = 0;
  long long g = 0;
  long long b = 0;
  for(int i = 0; i < n; i++){
      if(s[i] == 'R'){r++;}
      else if(s[i] == 'G'){g++;}
      else if(s[i] == 'B'){b++;} 
  }
    long long cnt = 0;
    if(r == 0 || g == 0 || b == 0){
        cout << 0 << endl;
    }
    else{
        cnt = r * g * b;
        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]){
                    cnt--;
                }
            }
        }
        if(cnt < 0){cnt = 0;}
        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

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define LEN(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int n,i,j,k,m;
string s;
char c;
ll ans;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >>n >>s;
	for (i=0;i<n-2;j++) {
		for (j=i+1;j<n-1;j++) {
			if (s[i]==s[j]) continue;
			m=j-i;
			if (s[i]!='R' && s[j]!='R') c='R';
			if (s[i]!='G' && s[j]!='G') c='G';
			if (s[i]!='B' && s[j]!='B') c='B';
			for (k=j+1;k<n;k++) {
				if (s[k]==c && k-j==m) 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>
using namespace std;
typedef long long ll;
#define int ll

int cnt;
int r[4005],g[4005],g[4005];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin>>n>>s;
	
	for(int i=n-1; i>=0; i--)
	{
		if(s[i]=='R')
			r[i]=r[i+1]+1;
		else
			r[i]=r[i+1];
		if(s[i]=='G')
			g[i]=g[i+1]+1;
		else
			g[i]=g[i+1];
		if(s[i]=='B')
			b[i]=b[i+1]+1;
		else
			b[i]=b[i+1];
	}
	
	for(int i=0; i<n-2; i++)
	{
		for(int j=i+1; j<n-1; j++)
		{
			if(s[j]!=s[i])
			{
				char re;
				if(s[i]!='R' && s[j]!='R')
					re='R';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				else if(s[i]!='B' && s[j]!='B')
					re='B';
				if(re=='R')
					cnt+=r[j+1];
				else if(re=='G')
					cnt+=g[j+1];
				else if(re=='B')
					cnt+=b[j+1];
				if(2*j-i<n && s[2*j-i]==re)
					cnt--;
			}
		}
	}
	
	cout<<cnt<< endl;
	return 0;
}


Compiler output:
a.cc:7:21: error: redefinition of 'll g [4005]'
    7 | int r[4005],g[4005],g[4005];
      |                     ^
a.cc:7:13: note: 'll g [4005]' previously declared here
    7 | int r[4005],g[4005],g[4005];
      |             ^
a.cc: In function 'int main()':
a.cc:28:25: error: 'b' was not declared in this scope
   28 |                         b[i]=b[i+1]+1;
      |                         ^
a.cc:30:25: error: 'b' was not declared in this scope
   30 |                         b[i]=b[i+1];
      |                         ^
a.cc:51:46: error: 'b' was not declared in this scope
   51 |                                         cnt+=b[j+1];
      |                                              ^
Language: C

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

int cnt;
int a[4005][3];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin>>n>>s;
	
	for(int i=0; i<n; i++)
	{
		for(int j=i; j<n; j++)
		{
			if(s[j]=='R')
				a[i][0]++;
			else if(s[j]=='G')
				a[i][1]++;
			else if(s[j]=='B')
				a[i][2]++;
		}
	}
	
	for(int i=0; i<n-2; i++)
	{
		for(int j=i+1; j<n-1; j++)
		{
			if(s[j]!=s[i])
			{
				char re;
				if(s[i]!='R' && s[j]!='R')
					re='R';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				if(re=='R')
					cnt+=a[j+1][0];
				else if(re=='G')
					cnt+=a[j+1][1];
				else if(re=='B')
					cnt+=a[j+1][2];
				if(2*j-i<n && s[2*j-i]==re)
					cnt--;
			}
		}
	}
	
	cout<<cnt<< endl;
	return 0;
}


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

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

int cnt;
int a[4005][3];

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	string s;
	cin>>n>>s;
	
	for(int i=0; i<n; i++)
	{
		for(int j=i; j<n; j++)
		{
			if(s[j]=='R')
				a[i][0]++;
			else if(s[j]=='G')
				a[i][1]++;
			else if(s[j]=='B')
				a[i][2]++;
		}
	}
	
	for(int i=0; i<n-2; i++)
	{
		for(int j=i+1; j<n-1; j++)
		{
			if(s[j]!=a[i])
			{
				char re;
				if(s[i]!='R' && s[j]!='R')
					re='R';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				else if(s[i]!='G' && s[j]!='G')
					re='G';
				if(re=='R')
					cnt+=a[j+1][0];
				else if(re=='G')
					cnt+=a[j+1][1];
				else if(re=='B')
					cnt+=a[j+1][2];
				if(2*j-i<n && s[2*j-i]==re)
					cnt--;
			}
		}
	}
	
	cout<<cnt<< endl;
	return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool dfs(int id,vector<vector<int> >& g,vector<bool>& vis,int& e,int& o){
  vis[id]=true;
  for(int i=0;i<g[id].size();i++){
       if(!vis[g[id][i]]){
           int e1=0;
           int o1=0;
           bool is=dfs(g[id][i],g,vis,e1,o1);
           if(is)
              return true;
           if(e>0){
              if(e1>0){
                 return true;
              }
           }
           if(o>0){
             if(o1>0){
                return true;
             }
           }
           o+=e1;
           e+=o1;
       }
  }
  if((o==0)&&(e==0)){
       e++;
  }
  return false;
}
void dfs1(int id,vector<vector<int> >& g,vector<bool>& vis,vector<int>& p){
  vis[id]=true;
  for(int i=0;i<g[id].size();i++){
    if(!vis[g[id][i]]){
        p[g[id][i]]=id;
        dfs1(g[id][i],g,vis,p);
    }
  }
}
int main(){
FASTIO
int n;
cin>>n;
string s;
cin>>s;
vector<int> v1(n);
vector<int> v2(n);
vector<int> v3(n);
int l1=0,l2=0,l3=0;
for(int i=s.size()-1;i>=0;i--){
    if(s[i]=='R')
       l1++;
    if(s[i]=='G')
       l2++;
    if(s[i]=='B')
       l3++;
   v1[i]=l1;
   v2[i]=l2;
   v3[i]=l3;        
}
ll ans=0;
for(int i=0;i<n-2;i++){
  for(int j=i+1;j<n-1;j++){
       if(s[i]=='R'){
          if(s[j]=='G'){
             ans+=(ll)(v3[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='B'){
                 ans--;
               }
             }
          } 
          if(s[j]=='B'){
             ans+=(ll)(v2[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='G'){
                 ans--;
               }
             }
          }
       }
       if(s[i]=='G'){
          if(s[j]=='R'){
             ans+=(ll)(v3[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='B'){
                 ans--;
               }
             }
          }
          if(s[j]=='B'){
             ans+=(ll)(v1[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='R'){
                 ans--;
               }
             }
          }
       }
       if(s[i]=='B'){
          if(s[j]=='G'){
              ans+=(ll)(v1[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='R'){
                 ans--;
               }
             }
          }
          if(s[j]=='R'){
             ans+=(ll)(v2[j+1]);
             int j1=j+(j-i);
             if(j1<n){
               if(s[j1]=='G'){
                 ans--;
               }
             }
          }
       }
  }
}
cout<<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;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  
  unordered_map<char, set<int>> M;
  for(int i=0; i<n; i++)
    M[s[i]].insert(i);
  
  long long ans = M['R'].size() * M['G'].size() * M['B'].size();
  
  for(auto i: M['R']){
    for(auto j: M['G']{
      if((i+j) & 1) continue;
      if(M['B'].find((i+j)/2) != M['B'].end()) ans--;
    }
  }
        
  for(auto i: M['R']){
    for(auto j: M['B']{
      if((i+j) & 1) continue;
      if(M['G'].find((i+j)/2) != M['G'].end()) ans--;
    }
  }
  
  for(auto i: M['B']){
    for(auto j: M['G']{
      if((i+j) & 1) continue;
      if(M['R'].find((i+j)/2) != M['R'].end()) ans--;
    }
  }
        
   cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:23: error: expected ')' before '{' token
   17 |     for(auto j: M['G']{
      |        ~              ^
      |                       )
a.cc:24:23: error: expected ')' before '{' token
   24 |     for(auto j: M['B']{
      |        ~              ^
      |                       )
a.cc:31:23: error: expected ')' before '{' token
   31 |     for(auto j: M['G']{
      |        ~              ^
      |                       )
Language: C

#include <bits/stdc++.h>

typedef long long   ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    cin >> n >> s;
    int rs=0;
    int gs=0;
    int bs=0;
    for(int i = 0; i < n; i++) {
        if(s[i]=='R')      rs++;
        else if(s[i]=='G') gs++;
        else               bs++;
    }
    ll ans=rs*bs*gs;
//    cout << rs << " " << bs << " " << gs << "\n";
    for(int w = 1; 2*w < n; w++) {
        for(int m = w; m+w <n ; m++) {
//        cout << m << " " << w << "\n";
            if(s[m]!=s[m-w] && s[m]!=s[m+w] && s[m-w]!=s[m+w]) ans--;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

#include<iostream>
using namespce std;

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

    for (int i = 0;i<N;i++){
        if(S[i] == 'R'){
            R++;
        }
        if(S[i] == 'G'){
            G++;
        }
        if(S[i] == 'B'){
            B++;
        }
    }
    for(int i=1;i<N/2;i++){
        for(int j=0;j<N-2*i;j++){
            if(S[j]!=S[j+i] && S[j+i]!=S[j+2*i] && S[j+2*i]!=S[j]){
                NG++;
            }
        }
    }
    cout << R*G*B - NG << endl;

    return 0;

}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namespce'
    2 | using namespce std;
      |       ^~~~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'string' was not declared in this scope
    6 |     string S;
      |     ^~~~~~
a.cc:6:5: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |     cin >>N>>S;
      |     ^~~
      |     std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:14: error: 'S' was not declared in this scope
    7 |     cin >>N>>S;
      |              ^
a.cc:27:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |     cout << R*G*B - NG << endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:27: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |     cout << R*G*B - NG << endl;
      |                           ^~~~
      |                           std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'int'
   10 |   int k;
      |   ^~~
a.cc:13:3: error: 'b' was not declared in this scope
   13 |   b = count(s.begin(), s.end(), 'B');
      |   ^
a.cc:17:7: error: 'k' was not declared in this scope
   17 |       k = 2 * j - i;
      |       ^
Language: C

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
typedef long double ld;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1LL<<60;
const int inf = 1e5;
//typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
int main(){
  int N;  cin>>N;
  string s; cin>>s;
  int r=0,g=0,b=0;
  rep(i,0,N){
    if(s[i]=='R') r++;
    else if(s[i]=='G') g++;
    else b++;
  }
  ll all = r*g*b;
  ll cnt = 0;
  rep(i,0,N){
    rep(j,i+1,N){
      int k = 2*j-i;
      if(s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i] && k<N) cnt++;
    }
  }
  cout << all-cnt << endl;
  return 0;
}


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

#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>


int main(){

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

    cnt = r * g * b;

    //補集合の要素数を全体集合の要素数から引く（r * g * b）

    //jとjから等距離にある文字がすべて異なる
    for(int j = 1;j < n;j++){
        for(int diff = 1;diff < n;diff++){
            if(j-diff >= 0 && j + diff < n && s[j - diff] != s[j] && s[j] != s[j + diff] && s[j + diff] != s[j - diff]) cnt--;

        }
    }

    cout << cnt << endl;

    
    return 0;
}

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

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

int main() {
    int n;
    string s;
    cin>>n>>s;
    int r=0;
    int g=0;
    int b=0;
    rep(i,n){
        if(s[i]=='R') r++;
        if(s[i]=='G')g++;
        if(s[i]=='B')b++;
    }
    long long int ans =r*g*b;
    long long int ans2=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(s[i]==s[j]) continue;
            int k=j*2-i;
            if(k>=n||s[k]==s[i]||s[k]==s[j]) continue;
            ans2++;
            
        }
    }
    cout<<ans-ans2<<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;
#define rep(i,n) for(int i = 0; i < (n); i++)
using P = pair<int, int>;
using ll = long long;

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


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n; string s;
    cin >> n >> s;
    ll r = 0, g = 0, b = 0;
    for(auto c : s){
        if (c == 'R') r++;
        else if (c == 'G') g++;
        else b++;
    }

    ll all = r*b*g;
    ll sub = 0;
    for (int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(s.at(i) == s.at(j)) continue;
        
        int k = j*2 -i;
        if(k >= n || s.at(k) == s.at(i) || s.at(k) == s.at(j))continue;
        sub++;
    }
   
} cout << all - sub << 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 <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n;  cin >> n;
    vector<char> rgb(n);
    for(int i=0;i<n;i++) cin >> rgb[i];

    ll ans = 0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
                if(rgb[i]!=rgb[j] and rgb[j]!=rgb[k] and rgb[k]!=rgb[i] and (i+k)!=(2*j))
                    ans ++;
            }
        }
    }

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


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

#include<iostream>
using namespace std;

int main(){
  int N;
  char S[4000];
  int count = 0;
  int A[4000];

  cin >> N;
  cin >> S;

  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      if (S[i] != S[j]){
        A[i] = 
      }
    }
  }

  cout << count << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: expected primary-expression before '}' token
   17 |       }
      |       ^
Language: C

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n;cin>>n;
  string s;cin>>s;
  ll R=0,G=0,B=0;
  ll r[4000]={0},g[4000]={0},b[8000]={0};

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

  ll ng=0;

  rep(i,0,R){
    rep(j,0,G){
      ll ma=max(r[i],g[j]),mi=min(r[i],g[j]);
      ll dif=ma-mi;

      if(ma+dif<4000&&b[ma+dif]!=0)ng++;
      if(dif%2==0&&b[mi+dif/2]!=0)ng++;
      if(mi-dif>=0&&b[mi-dif]!=0)ng++;
    }
  }

  out(R*G*B-ng);

  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 rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n;
    cin >> n;
    string s;
    cin >> s;
    int count = 0;
    int r=0,g=0,b=0;
    rep(i,n){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }
    count = r*g*b;
    int ex=0;
    rep1(j,1,n){
        rep(i,n){
            if((i+j)>=n || (i+j*2)>=n) continue;
            if(s[i]!=s[i+j] && s[i+j]!=s[i+j*2] && s[i]!=s[i+j*2]) ex++;
        }
    }

    int ans = count-ex;

    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;

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(){
  ll n,R,G,B;
  string S;
  cin >> n;
  cin >> S;
  
  rep(i,n){
    if(S[i]=='R') R++;
    if(S[i]=='G') G++;
    if(S[i]=='B') B++;
  }
  
  ll kazu=0;
  rep(i,n-2){
    for(j=i+1; j<n-1; j++){
      ll k = j + (j-i);
      if(k<n){
        if(S[i]!=S[j] && S[j]!=S[k] && S[k]!=S[i]) kazu++
      }
    }
  }
  
  cout << R*G*B-kazu;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:9: error: 'j' was not declared in this scope
   23 |     for(j=i+1; j<n-1; j++){
      |         ^
a.cc:26:58: error: expected ';' before '}' token
   26 |         if(S[i]!=S[j] && S[j]!=S[k] && S[k]!=S[i]) kazu++
      |                                                          ^
      |                                                          ;
   27 |       }
      |       ~
Language: C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define _GLIBCXX_DEBUG
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define debug(x) cout << #x << " is " << x << endl

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

    int R;
    int G;
    int B;

    for (int i = 0; i < S.size(); i++)
    {
        if (S.at(i) == 'R')
        {
            R += 1;
        }
        else if (S.at(i) == 'G')
        {
            G += 1;
        }
        else
        {
            B += 1;
        }
    }

    ll ans = R * G * B;

    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 && S.at(i) != S.at(j) && S.at(j) != S.at(k) && S.at(k) != S.at(i))
            {
                ans -= 1;
            }
        }
    }

    cout << ans << endl;
}

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

#include <bits/stdc++.h>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void){
    int n; string s;
    cin>>n>>s;
    int r,g,b;r=g=b=0;
    rep(i,0,n){
        if(s[i]=='R')r++;
        else if(s[i]=='G')g++;
        else b++;
    }
    ll ans=r*g*b;
    rep(i,0,n){
        rep(j,i+1,n){
            int k=2*j-i;
            if(k<n&&s[i]!=s[j]&&s[j]!=s[k]&&s[k]!=s[i])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

N = int(input())
X = input()
ans = 0
r=0
g=0
b=0
G = []
R = []
B = []
for i in range(0,N):
    if(X[i] == 'G'):
        G.append(i)
        g+=1
for k in range(0,N):
    if(X[k] == 'R'):
        R.append(k)
        r+=1
for j in range(0,N):
    if(X[j] == 'B'):
        B.append(j)
        b+=1
ans = r*b*g
for i in G:
    for k in R:
        for j in B:
            if(i<k):
                if(k<j):
                    if(j-k == k-i):
                        ans -=1
                else:
                    if(i<j):
                        if(k-j == j-i):
                            ans -=1
                    else:
                        if(k-i == i-j):
                            ans -= 1
            else:
                if(i<j):
                    if(j-i == i-k):
                        ans -=1
                else:
                    if(k<j):
                        if(i-j == j-k):
                            ans -= 1
                    else:
                        if(i-k == k-j):
                            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

N = int(input())
S = input()

# 全探索
cnt = 0
for i in range(0, N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      # 条件1(全要素が異なる文字判定)
      if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
        # 条件2判定
        if j - i != k - j:
          cnt += 1

print(cnt)

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())
      |     ^~~
main.c:4:3: error: invalid preprocessing directive #\U00005168\U000063a2\U00007d22
    4 | # 全探索
      |   ^~~~~~
main.c:9:9: error: invalid preprocessing directive #\U00006761\U00004ef61
    9 |       # 条件1(全要素が異なる文字判定)
      |         ^~~~~
main.c:11:11: error: invalid preprocessing directive #\U00006761\U00004ef62\U00005224\U00005b9a
   11 |         # 条件2判定
      |           ^~~~~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 4e3 + 7;
int n;
char s[maxx];
int num[maxx];
vector <int> vec[maxx];
LL cnt[maxx];
bool vis[maxx];

LL chk(int a, int b, int c) {
	LL res = 0;
	for(int i = 0; i < vec[a].size(); i++) { //枚举首字母位置
		for(int j = 1; vec[a][i] + 2 * j <= n; j++) { //枚举间距
			if(num[vec[a][i] + j] == b && num[vec[a][i] + 2 * j] == c) res++;
		}
	}
	return res;
}

int main() {
	scanf("%d", &n);
	scanf("%s", s + 1);
	for(int i = 1; i <= n; i++) {
		if(s[i] == 'B') num[i] = 1;
		else if(s[i] == 'G') num[i] = 2;
		else if(s[i] == 'R') num[i] = 3;
	}
	for(int i = 1; i <= n; i++) {
		vec[num[i]].push_back(i);
		cnt[num[i]]++;
	}
	LL ans = cnt[1] * cnt[2] * cnt[3];
	ans -= chk(1, 2, 3) - chk(1, 3, 2) - chk(2, 1, 3);
	ans -= chk(2, 3, 1) - chk(3, 1, 2) - chk(3, 2, 1);
	printf("%lld\n", 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: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N=sc.nextInt();
    String S = sc.next();
    String s[] =S.split("",0);
    int t[] =new int[N];
    long w=0;int a=0;int b=0; int c=0;
    for(int i=0;i<N;i++){
      if(s[i].equals("R")){t[i]=1;b=b+1;}
      else if(s[i].equals("G")){t[i]=2;a=a+1;}
      else{t[i]=3;c=c+1;}}
    for(int k=1;k<N-1;k++){
      float l=(k+N)/2;
      for(int j=k+1;j<=p;j++){
        if(t[k-1]==t[j-1]){continue;}
          if(t[k-1]+t[j-1]+t[2*j-k-1]==6){
            w=w+1;}}}
    long z=a*b*c;
    System.out.println(z-w);
  }
}


Compiler output:
Main.java:16: error: cannot find symbol
      for(int j=k+1;j<=p;j++){
                       ^
  symbol:   variable p
  location: class Main
1 error
Language: C

import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String s = sc.next();
        sc.close();

        // 主処理
        int countR = s.replaceAll("[^R]", "").length();
        int countB = s.replaceAll("[^B]", "").length();
        int countG = s.replaceAll("[^G]", "").length();
        int all = countR * countB * countG;

        int countDel = 0;
        for (int i = 1; i < n - 1; i++) {
            int left = i - 1;
            int right = i + 1;
            while (0 <= left && right < s.length()) {
                if (s.charAt(left) != s.charAt(i) && s.charAt(right) != s.charAt(i)
                        && s.charAt(left) != s.charAt(right)) {
                    countDel++;
                }
                left--;
                right++;
            }

        }

        int result = all - countDel;

        // 出力
        System.out.println(result);
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.*;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.*;
      |            ^
main.c:3:1: error: unknown type name 'public'
    3 | public class Main {
      | ^~~~~~
main.c:3:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    3 | public class Main {
      |              ^~~~
Language: C

N = int(input())
S = input()

r, g, b = 0, 0, 0
for c in S:
  if c == "R": r += 1
  if c == "G": g += 1
  if c == "B": b += 1

total = r*g*b

for i in range(len(S)):
  for j in range(i+1, len(S)):
    if S[i] == S[j]: continue

    k = 2*j - i
    if k >= N: continue
    if len(set((S[i], S[k], S[j]))) == 3:
      total -= 1

print(total)

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

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmax(v) v.rbegin()->first
#define mapmin(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const int mod=1000000007;
const int mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n,r=0,g=0,b=0;
	string s,t="BGR";
	cin >> n >> s;
	rep(i,n){
		if(s[i]=='R') r++;
		if(s[i]=='G') g++;
		if(s[i]=='B') b++;
	}
	ll ans=r*g*b;
	rep(i,n-1){
		for(ll j=i+1;j<n;j++){
			if(j+(j-i)>=n) continue;
			string tmp="";
			tmp+=s[i];
			tmp+=s[j];
			tmp+=s[j+(j-i)];
			sort(all(tmp));
			if(tmp==t) ans--;
		}
	}
	cout << ans << endl;
	return 0;
}


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

#include <iostream>
using namespace std;

int main(){
  long long int ans = 0;
  int n;
  int m;
  char color[4001];
  int r = 0, g = 0, b = 0;
  cin >> n;
  if(n < 3){
    cout << 0 << '\n';
    return 0;
  }
  for(int i=1; i<=n; i++){
    cin >> color[i];
    if(color[i] == 'R'){
      r += 1;
    }else if(color[i] == 'G'){
      g += 1;
    }else{
      b += 1;
    }
  }
  if(r*g*b == 0){
    cout << 0 << '\n';
    return 0;
  }
  for(int i=1; i<=n-2; i++){
    m = (i + n) / 2; 
    for(int j=1; j<=m; j++){
      if(color[i] != color[j] && color[j + j - i] != color[j] && color[i] != color[j + j - i]){
        ans += 1;
      }
    }
  }
  cout << r*g*b - ans << '\n';
  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 a,k;
  string s;
  cin>>a>>s;
  long long color , l=0 r=0,g=0,b=0;
  for(int i=0;i<a;i++){
    if(s.at(i)=='R')r++;
    else if(s.at(i)=='G')g++;
    else b++;
  }
  color=r*g*b;
  for(int i=0;i<a;i++){
    for(int j=i+1;j<a;j++){
      k=2*j-i;
      if(k>=a || s.at(i)==s.at(k) || s.at(j)==s.at(k) || s.at(i)==s.at(j))continue;
      l++;      
    }
  }
  cout <<color - l<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: expected ',' or ';' before 'r'
    8 |   long long color , l=0 r=0,g=0,b=0;
      |                         ^
a.cc:10:21: error: 'r' was not declared in this scope
   10 |     if(s.at(i)=='R')r++;
      |                     ^
a.cc:11:26: error: 'g' was not declared in this scope
   11 |     else if(s.at(i)=='G')g++;
      |                          ^
a.cc:12:10: error: 'b' was not declared in this scope
   12 |     else b++;
      |          ^
a.cc:14:9: error: 'r' was not declared in this scope
   14 |   color=r*g*b;
      |         ^
a.cc:14:11: error: 'g' was not declared in this scope
   14 |   color=r*g*b;
      |           ^
a.cc:14:13: error: 'b' was not declared in this scope
   14 |   color=r*g*b;
      |             ^