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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

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

    string S;
    cin >> S;
    int sum = 0;

    vector<int> a(N);

    for (int i = 0; i < N; i++)
    {
        if (S[i] == 'R')
            a[i] = 0;
        if (S[i] == 'G')
            a[i] = 1;
        if (S[i] == 'B')
            a[i] = 2;
    }

    vector<int> cnt(3);
    for (int i = 0; i < N; i++)
    {
        cnt[a[i]]++;
    }

    long long ans = 1;
    for (int i = 0; i < 3; i++)
    {
        ans *= cnt[i];
        cout << cnt[i] << endl;
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = i + 1; j < N; j++)
        {
            int k = j + (j - i);
            if (k < N)
            {
                if (a[i] == a[j])
                    continue;
                if (a[i] == a[k])
                    continue;
                if (a[k] == a[j])
                    continue;
                ans--;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
vector<int> vr, vg, vb;
int main()
{
    string s;
    int n;
    long long ans = 0;
    cin >> n >> s;
    for (int i = 0; i < n;i++)
    {
        if(s[i]=='R')
            vr.push_back(i);
        else if(s[i]=='G')
            vg.push_back(i);
        else
            vb.push_back(i);
    }
 
    int r = vr.size(), g = vg.size(), b = vb.size();
    for (int i = 0; i < r;i++)
    {
        for (int j = 0; j < g;j++)
        {
          ans+=b;
            int dist = abs(vr[i] - vg[j]);
            int left = min(vr[i], vg[j]), right = max(vr[i], vg[j]);
			if(mi-d>=0&&s[mi-d]=='B') ans--;
			if(ma+d<n&&s[ma+d]=='B') ans--;
			if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
        }
    }
    cout << ans;
 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: 'mi' was not declared in this scope; did you mean 'i'?
   28 |                         if(mi-d>=0&&s[mi-d]=='B') ans--;
      |                            ^~
      |                            i
a.cc:28:31: error: 'd' was not declared in this scope
   28 |                         if(mi-d>=0&&s[mi-d]=='B') ans--;
      |                               ^
a.cc:29:28: error: 'ma' was not declared in this scope; did you mean 'fma'?
   29 |                         if(ma+d<n&&s[ma+d]=='B') ans--;
      |                            ^~
      |                            fma
a.cc:29:31: error: 'd' was not declared in this scope
   29 |                         if(ma+d<n&&s[ma+d]=='B') ans--;
      |                               ^
a.cc:30:50: error: 'mi' was not declared in this scope; did you mean 'i'?
   30 |                         if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
      |                                                  ^~
      |                                                  i
a.cc:30:53: error: 'd' was not declared in this scope
   30 |                         if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
      |                                                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
vector<int> vr, vg, vb;
int main()
{
    string s;
    int n;
    long long ans = 0;
    cin >> n >> s;
    for (int i = 0; i < n;i++)
    {
        if(s[i]=='R')
            vr.push_back(i);
        else if(s[i]=='G')
            vg.push_back(i);
        else
            vb.push_back(i);
    }
 
    int r = vr.size(), g = vg.size(), b = vb.size();
    ans = r * g * b;
    for (int i = 0; i < r;i++)
    {
        for (int j = 0; j < g;j++)
        {
            int dist = abs(vr[i] - vg[j]);
            int left = min(vr[i], vg[j]), right = max(vr[i], vg[j]);
			if(mi-d>=0&&s[mi-d]=='B') ans--;
			if(ma+d<n&&s[ma+d]=='B') ans--;
			if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
        }
    }
    cout << ans;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: 'mi' was not declared in this scope; did you mean 'i'?
   28 |                         if(mi-d>=0&&s[mi-d]=='B') ans--;
      |                            ^~
      |                            i
a.cc:28:31: error: 'd' was not declared in this scope
   28 |                         if(mi-d>=0&&s[mi-d]=='B') ans--;
      |                               ^
a.cc:29:28: error: 'ma' was not declared in this scope; did you mean 'fma'?
   29 |                         if(ma+d<n&&s[ma+d]=='B') ans--;
      |                            ^~
      |                            fma
a.cc:29:31: error: 'd' was not declared in this scope
   29 |                         if(ma+d<n&&s[ma+d]=='B') ans--;
      |                               ^
a.cc:30:50: error: 'mi' was not declared in this scope; did you mean 'i'?
   30 |                         if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
      |                                                  ^~
      |                                                  i
a.cc:30:53: error: 'd' was not declared in this scope
   30 |                         if((vr[i]+vg[j])%2==0&&s[mi+d/2]=='B') ans--;
      |                                                     ^
Language: C++

#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main(){
	int N;
	string S;
	cin>>N>>S;
	vector<long long> rgb(3,0);
	for(int i=0;i<N;i++){
		if(S[i]=='R') rgb[0]++;
		if(S[i]=='G') rgb[1]++;
		if(S[i]=='B') rgb[2]++;
	}
	long long ans=rgb[0]*lgb[1]*lgb[2];
	
	for(int j=0;j<N;j++){
		for(int i=0;i<j;i++){
			long long k=2*j-i;
			if(k>=N) continue;
			if(S[i]==S[j]||S[j]==S[k]||S[k]==S[i]) continue;
			ans--;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:30: error: 'lgb' was not declared in this scope; did you mean 'rgb'?
   17 |         long long ans=rgb[0]*lgb[1]*lgb[2];
      |                              ^~~
      |                              rgb
Language: C

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

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

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

#include <bits/stdc++.h>

using namespace std;

int main(void){
    // Your code here
    int N; string S;
    int i;
    long long r=0,g=0,b=0;
    long long x=0,y=0,z=0;

    cin >> N >> S;

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

    long long all = r*g*b;

    for(x=0;x<N-2;x++){
        for(y=x+1;y<N-1;y++){
            z=y*2-x
            if(z>N-1||S.at(x)==S.at(z)||S.at(y)==S.at(z)||S.at(x)==S.at(y))continue;
            all--;
        }
    }


    cout << all << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:20: error: expected ';' before 'if'
   24 |             z=y*2-x
      |                    ^
      |                    ;
   25 |             if(z>N-1||S.at(x)==S.at(z)||S.at(y)==S.at(z)||S.at(x)==S.at(y))continue;
      |             ~~
Language: C

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }

int main(){
    int N; cin >> N;
    vector<char> S(N);
    long long ans = 0;
    int r = 0;
    int  g = 0;
    int b = 0;
    long long dec = 0;

    for (int l = 0; l < N; l++)
    {
      cin >> S[l];
      if (S[l] == 'R') r++;
      if (S[l] == 'G') g++;
      if (S[l] == 'B') b++;
    }

    for (int i = 0; i < N-2; i++)
    {
      for (int j = i+1; j < N-1; j++)
      {
        int d = j-i;
        if ((S[i]!=S[j]) && (S[i]!=S[j+d]) && (S[j]!=S[j+d]) && (j+d < N)) dec++;
      }
    }

    ans = (r*g*b) - dec;
    
    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>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
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 long long INF = 1LL << 60;

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

    vector<ll> a(n);

    rep(i,n){
        if(s[i] == 'R') a[i] = 0;
        if(s[i] == 'G') a[i] = 1;
        if(s[i] == 'B') a[i] = 2;
    }

    vector<ll> cnt(3);
    rep(i,n) cnt[a[i]]++;
    ll ans  = 1;

    rep(i,3) ans*=cnt[i];
    rep(j,n)rep(i,j){
        int k = 2*j - 1;
        if(k<n){
            if(a[i] == a[j] || a[j] == a[k] || a[k] == a[i]) continue;
            ans--;
        }
    }

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

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

def main():
 
  import sys
  
  def input():
    return(sys.stdin.readline()[:-1])
  
  import collections
 
  N = int(input())
  S = list(input())
 
  CNT_S = collections.Counter(S)
 
  cnt_r = CNT_S['R']
  cnt_b = CNT_S['B']
  cnt_g = CNT_S['G']
 
  total = cnt_r * cnt_g * cnt_b
  subdu = 0
 
 
  for pos in range(N):
      for i in range(1, N):
 
          index_r = pos
          index_m = pos + i
          index_l = pos + 2 * i
 
          if (index_l < N and index_m < N and index_r < N):
              if (S[index_l] != S[index_m] and S[index_l] != S[index_r] and S[index_m] != S[index_r]):
                  subdu += 1
 
 
  ans = total - subdu
 
  print(ans)
  
if __name__ == '__main__':
    main()

Compiler output:
main.c:1:1: error: unknown type name 'def'
    1 | def main():
      | ^~~
main.c: In function 'main':
main.c:1:11: error: expected declaration specifiers before ':' token
    1 | def main():
      |           ^
main.c:39:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   39 | if __name__ == '__main__':
      |                ^~~~~~~~~~
Language: C

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

int main() {
  int n,count=0;
  cin >> n;
  string s;
  cin >> s;
  for(int i = 0; i<n;i++){
    for(int j=i+1;j<n;j++){
      for(int k=j+1;k<n;k++){
        if(k-j!=j-i){
          if(s[i]=='R'){
            if(s[j]=='G'&&s[k]=='B')count++;
            if(s[j]=='B'&&s[k]=='G')count++;
          }
          if(s[i]=='G'){
            if(s[j]=='R'&&s[k]=='B')count++;
            if(s[j]=='B'&&s[k]=='R')count++;
          }
          if(s[i]=='B'){
            if(s[j]=='R'&&s[k]=='G')count++;
            if(s[j]=='G'&&s[k]=='R')count++;
          }
        }
      }
    }
  }
  cout<<count<<endl;
}

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

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

typedef long long ll;

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


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

#include <bits/stdc++.h>
    using namespace std;
    typedef long long lint;
    typedef pair<int,int> pint;
    typedef vector<int> vint;
    #define rep(i, n) for(int i = 0; i < n; i++)
    #define rep2(i, m, n) for(int i = m; i < n; i++)
    #define rep3(elem, vec) for(auto elem: vec)
    #define SORT(V) sort((V).begin(),(V).end())
    #define RSORT(V) sort((V).rbegin(), (V).rend())
    #define COUT(N) cout<<fixed<<setprecision(N)
    lint gcd(int a,int b){return b?gcd(b,a%b):a;}
    lint lcm(int a,int b){return a*b/gcd(a,b);}
    lint comb(int a,int b){return b?comb(a-1,b-1)*a/b:1;}
    int dx[4] ={1,0,-1,0},dy[4] = {0,1,0,-1};
    int MOD = 1e9+7;

int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<char> v(N);
    rep(i,N)v[i] = S[i];
    int r = count(v.begin(),v.end(),'R');
    int g = count(v.begin(),v.end(),'G');
    int b = count(v.begin(),v.end(),'B');
    int ans=r*g*b;
    rep(j,N)rep(j,i)
        if(2*j-i<N)if(v[i]!=v[j]&&v[2*j-i]!=v[j]&&v[2*j-i]!=v[i])ans--;
    
    cout << ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'i' was not declared in this scope
   28 |     rep(j,N)rep(j,i)
      |                   ^
a.cc:6:42: note: in definition of macro 'rep'
    6 |     #define rep(i, n) for(int i = 0; i < n; i++)
      |                                          ^
Language: C

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int get_val(char a)
{
    if(a == 'R')return 0;
    if(a == 'G') return 1;
    return 2;
}
int rem_guy(int a, int b)
{
    int j;
    FOR0(j, 3) if(j != a && j != b) return j;
}
int main()
{
    she_told_me_dont_worry
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll i, j;
    ll pos[n+5][4] = {};
    FORD(i, n-1, 0)
    {
        pos[i][get_val(s[i])] = 1;
        if(i < n-1)
        FOR0(j, 3) pos[i][j] += pos[i+1][j];
    }
    ll ans = 0;
    FOR0(i, n)
    {
        FOR(j, i+1, n)
        {
            if(s[j] == s[i] || j == n-1) continue;
            int guy = rem_guy(get_val(s[i]), get_val(s[j]));
            int dif = j - i;
            ll cur = pos[j+1][guy];
            if( j+dif < n && get_val(s[j+dif]) == guy) cur--;
            ans += cur;
        }
    }
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\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

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();

      Map<Character, List<Integer>> freqMap = new HashMap<>();
      freqMap.put('R', new ArrayList<>());
      freqMap.put('G', new ArrayList<>());
      freqMap.put('B', new ArrayList<>());

      for(int i = 0; i < n; i++) {
        freqMap.get(s.charAt(i)).add(i);
      }
      long sum = (long)freqMap.get('R').size() * (long)freqMap.get('G').size() * (long)freqMap.get('B').size();

      for(int i = 0; i < n; i++) {
        char leftChar = s.charAt(i);
        for(int j = i + 1; j < n; j++) {
          char midChar = s.charAt(j);
          if(leftChar == midChar) continue;
          int k = j * 2 - i;
          if(k >= n) continue;
          char rightChar = s.charAt(k);
          if(rightChar != midChar && rightChar != leftChar)
            sum--;
        }
      }
      System.out.println(sum);
  }
}

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:2:1: error: unknown type name 'public'
    2 | public class Main {
      | ^~~~~~
main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main'
    2 | public class Main {
      |              ^~~~
Language: C

// Nguyen Anh Tu
#include <bits/stdc++.h>
#define FOR(x,a,b) for(int x=a;x<=b;x++)
#define FORD(x,a,b) for(int x=a;x>=b;x--)
#define maxn 4005
#define maxc 1000000007
#define MOD 1000000007
#define reset(x, y) memset(x,y,sizeof(x))
#define task ""
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long
#define bit(p,x) ((x>>p) & 1)
#define remain(a,b) (a+b >= MOD) ? (a+b - MOD) : (a+b)
using namespace std;
int k, n;
string s;
ll ans;
int d[maxn][maxn];
int main()
{
    ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
    if(fopen(task".inp", "r"))
    {
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    cin >> n >> s;
    s = ' ' + s;
    for(int i=1; i<=n; ++i)
    {
        d[i]['R'] = d[i-1]['R']+(s[i] == 'R');
        d[i]['G'] = d[i-1]['G']+(s[i] == 'G');
        d[i]['B'] = d[i-1]['B']+(s[i] == 'B');
    }
    int sum = 'R' + 'G' + 'B';
    for(int i=1; i<=n ;++i)
        for(int j=1; j<i; ++j)
        {
            if(s[i] != s[j])
            {
                int k = sum - s[i] - s[j];
                int x = i - j;
                x = j - x;
                if(s[x] == k) ans --;
                ans += d[j-1][k];
            }
        }
    cout << ans;
    return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
   int n;
   cin >> n;
   string s;
   cin >> s;
   ll zenntai = 1;
   for(int i=0;i<3;i++){
      ll che = 0;
      for(int j=0;j<n;j++){
         if(i==0){
            if(s.at(j)=='R')che++;
         }
         else if(i==1){ 
            if(s.at(j)=='B')che++;
         }
         else {
            if(s.at(j)=='G')che++;
         }
      }
      zenntai*=che;
   }
   ll hosyu = 0;
   for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
         int k= j+j-i;
         if(k>=n)continue;
         string che = "";
         che+=s.at(i);
         che+=s.at(j);
         che+=s.at(k);
         sort(che.begin(),che.end());
         if(che=="BGR")hosyu++;
      }
   }
   ll ans = zenntai - hosyu;
   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<cstdio>
#define ll long long int
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
int main()
{
	fastio;
	int n,i,j,k;
	scanf("%d",&n);
	char s[n+1];
	scanf("%s",s);
	int c=0;
	for ( i=1; i<=n; i++ )
	{
		for ( j=i+1; j<=n; j++ )
		{
			if ( s[i-1]!=s[j-1] )
			for ( k=j+1; k<=n; k++ )
			{
				if (s[i-1]!=s[k-1])
				if ( j-i != k-j )
				{
					if (s[j-1]!=s[k-1] )
					c++;
				}

			}
		}
	}
	printf("%d\n",c);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:3:16: error: 'ios_base' has not been declared
    3 | #define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
      |                ^~~~~~~~
a.cc:6:9: note: in expansion of macro 'fastio'
    6 |         fastio;
      |         ^~~~~~
a.cc:3:45: error: 'cin' was not declared in this scope
    3 | #define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
      |                                             ^~~
a.cc:6:9: note: in expansion of macro 'fastio'
    6 |         fastio;
      |         ^~~~~~
a.cc:3:59: error: 'cout' was not declared in this scope
    3 | #define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
      |                                                           ^~~~
a.cc:6:9: note: in expansion of macro 'fastio'
    6 |         fastio;
      |         ^~~~~~
Language: C++

#include <iostream>

using namespace std;

long main()
{
    long N;

    cin >> N;
    std::string S;

    cin >> S;

    long count =0;

    long r = 0;
    long g = 0;
    long b = 0;


    for (long p = 0;p<N;p++){

        if (S[p] == 'R'){

            r++;

            
        }
       

         if (S[p] == 'B'){

           g++;

            
      
        }

        if (S[p] == 'G'){
b++;

            
     


    }
    }


    long rgb =r*g*b;


    if(N>2){


    for (long i = 0;i<(N-2);i++){


        for(long j  = i+1; j<(N-1);j++){


            long k = 2*j -i;

            if(N > k){


                


                if(S[k] != S[i] && S[k] != S[j] && S[i] != S[j]){


                    count++;

                 }




            }
            


           

            
            
            




        }

          


    }
     cout << rgb-count <<endl;
    }
    else{

        cout << 0 <<endl;

     
    }


    


    return 0;




}

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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
const int INF = 1e8;

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

Compiler output:
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<algorithm>
#include<cstring>
using namespace std;
long long n,dp[4005][400],a[4005],b[4005],c[4005],res;
bool dpx[4005][400];
string s;
int main()
{
    cin>>n;
    cin>>s;
    s='#'+s;
    for (int i=1;i<=n;i++)
    {
        if (s[i]=='R') a[i]=a[i-1]+1;
        else a[i]=a[i-1];
        if (s[i]=='G') b[i]=b[i-1]+1;
        else b[i]=b[i-1];
        if (s[i]=='B') c[i]=c[i-1]+1;
        else c[i]=c[i-1];
    }
    for (int j=i+1;j<=n;j++)
    {
        if ((s[i]=='R'&&s[j]=='G')||(s[j]=='R'&&s[i]=='G'))
        {
            if (s[2*j-i]=='B') res=res+c[n]-c[j]-1;
            else res=res+c[n]-c[j];
        }
        if ((s[i]=='R'&&s[j]=='B')||(s[j]=='R'&&s[i]=='B'))
        {
            if (s[2*j-i]=='G') res=res+b[n]-b[j]-1;
            else res=res+b[n]-b[j];
        }
        if ((s[i]=='B'&&s[j]=='G')||(s[j]=='B'&&s[i]=='G'))
        {
            if (s[2*j-i]=='R') res=res+a[n]-a[j]-1;
            else res=res+a[n]-a[j];
        }
    }
    cout<<res;
}


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

#include <iostream>

using namespace std;

int main()
{
    int N;

    cin >> N;
    std::string S;

    cin >> S;

    int count =0;

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


    for (int p = 0;p<N;p++){

        if (S[p] == "R"){

            r++;

            
        }
       

         if (S[p] == "B"){

           g++;

            
      
        }

        if (S[p] == "G"){
b++;

            
     


    }
    }


    int rgb =r*g*b;


    for (int i = 0;i<N-2;i++){


        for(int j  = i+1; j<N-1;j++){


            if (S[i] != S[j]){


                if(S[j +(j-i)] != S[i] && S[j +(j-i)] != S[j]){


                    rgb -1;

                 }




            }


           

            
            
            




        }


    }


    cout << rgb <<endl;


    return 0;




}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   23 |         if (S[p] == "R"){
a.cc:31:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |          if (S[p] == "B"){
a.cc:39:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   39 |         if (S[p] == "G"){
Language: C

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

int main() {
  int n; cin >> n;
  string s; cin >> s;
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    if(s[i] == 'R') a[i] = 0;
    if(s[i] == 'G') a[i] = 1;
    if(s[i] == 'B') a[i] = 2;
  }
  vector<long long> cnt(3);
  for(int i = 0; i < n; i++) cnt[a[i]]++;
  long long ans = 1;
  for(int i = 0; i < 3; i++) ans *= cnt[i];
  for(int j = 0; j < n; j++) {
    for(int i = 0; i < j; i++) {
      int k = j + (j-i);
      if(k < n) {
        if(a[i] == a[j]) continue;
        if(a[i] == a[k]) continue;
        if(a[k] == a[j]) continue;
        ans--;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(ll i =(l);(i)<(r);(i)++)
using namespace std;
//TLE
int main(){
    ll n,ans=0;
    cin>>n;
    string s;
    cin>>s;
    rep(i,0,n-2){
        rep(j,i+1,n-1){
            rep(k,j+1,n){
                if((s[i]!=s[j]&&s[i]!=s[k]&&s[j]!=s[k])&&j-i!=k-j)ans++;
            }
        }
    }
    cout<<ans<<endl;
}

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

#include <bits/stdc++.h>

using namespace std;

int main(void){
    // Your code here
    int N; string S;
    int i;
    int r=0,g=0,b=0;
    int x,y,z;

    cin >> N >> S;

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

    int all = r*g*b;

    int sub = 0;

    for(x=0;x<=N-3;x++){
        for(y=x+1;y<=N-1;y++){
            if((x+y)%2==0){
                z = (x+y)/2;
                if(S.at(x)!=S.at(z)&&S.at(y)!=S.at(z)&&S.at(x)!=S.at(y))
                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 <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here
    int N; stirng S;
    int i;
    int r=0,g=0,b=0;
    int x,y,z;

    cin << N << S;

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

    int all = r*g*b;

    int sub = 0;

    for(x=0;x<N-3;x++){
        for(y=0;y<N-1;y++){
            if(x+y%2==0){
                z = (x+y)/2;
                if(S.at(x)==S.at(z)||S.at(y)==S.at(z)){

                }else{
                    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<algorithm>
#include<cstring>
using namespace std;
long long n,s;
string a;
int main()
{
    cin>>n;
    cin>>a;
    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)
        if ((a[i]!=a[j]&&a[j]!=a[k])&&(a[k]!=a[i])) s++;
    }
    cout<<s;
}


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

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

int main(){
  int N;
  string S;
  cin >> N >> S;
  vector<int> a(3);
  rep(i,N){
    if(S[i] == 'R') a[0]++;
    if(S[i] == 'G') a[1]++;
    if(S[i] == 'B') a[2]++;
  }
  ll ans = a[0]*a[1]*a[2];
  rep(i,N){
    for(int j = 1+i;j<N;j++){
    int k = 2*j - i;
    if(k<N){
      if(S[i] != S[j] && S[i] != S[k] && S[j] != S[k]) --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;
 
int main()
{
	int N;
	string S;
	cin >> N >> S;
	// 1つめの条件を満たす個数がrgb
	vector<int> a(N);
	rep(i, N) {
		if (S[i] =='R')
		{
			a[i] = 0;
		}
		if (S[i] == 'G')
		{
			a[i] = 1;
		}
		if (S[i] == 'B')
		{
			a[i] = 2;
		}
	}
	// それぞれの個数を集計する
	vector<ll> cnt(3);
	rep(i, N) {
		cnt[a[i]]++;
	}
	ll ans = 1;
	rep(i, 3) {
		ans *= cnt[i]; // rgbを求めている
	}
	rep(j, N)rep(i, j) {
		int k = j + (j - 1);
		if (k < N)
		{
			if (a[i] == a[j]) { continue; }
			if (a[j] == a[k]) { continue; }
			if (a[k] == a[i]) { continue; }
		}
		ans--;
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'i' was not declared in this scope
   11 |         rep(i, N) {
      |             ^
a.cc:11:9: error: 'rep' was not declared in this scope
   11 |         rep(i, N) {
      |         ^~~
a.cc:26:16: error: 'll' was not declared in this scope
   26 |         vector<ll> cnt(3);
      |                ^~
a.cc:26:18: error: template argument 1 is invalid
   26 |         vector<ll> cnt(3);
      |                  ^
a.cc:26:18: error: template argument 2 is invalid
a.cc:30:11: error: expected ';' before 'ans'
   30 |         ll ans = 1;
      |           ^~~~
      |           ;
a.cc:34:13: error: 'j' was not declared in this scope
   34 |         rep(j, N)rep(i, j) {
      |             ^
a.cc:44:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   44 |         cout << ans << endl;
      |                 ^~~
      |                 abs
Language: C++

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

int main()
{
	int N;
	string S;
	cin >> N >> S;
	// 1つめの条件を満たす個数がrgb
	vector<int> a(N);
	rep(i, N) {
		if (S[i] =='R')
		{
			a[i] = 0;
		}
		if (S[i] == 'G')
		{
			a[i] = 1;
		}
		if (S[i] == 'B')
		{
			a[i] = 2;
		}
	}
	// それぞれの個数を集計する
	vector<ll> cnt(3);
	rep(i, N) {
		cnt[a[i]]++;
	}
	ll ans = 1;
	rep(i, 3) {
		ans *= cnt[i]; // rgbを求めている
	}
	rep(j, N)rep(i, j) {
		int k = j + (j - 1);
		if (k < N)
		{
			if (a[i] == a[j]) { continue; }
			if (a[j] == a[k]) { continue; }
			if (a[k] == a[i]) { continue; }
		}
		ans--;
	}
	cout << ans << endl;
	return 0;
}

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

#include <bits/stdc++.h>

#define int long long

using namespace std;

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

    long long combinacoes = r * g * b;

    for (int i = 1; i <= (int)s.size(); i++)
    {
        for (int j = i+1; j <= (int)s.size(); j++)
        {
            if (s[i] == s[j])
                continue;

            int k = 2 * j - i;

            if (k > n)
                continue;

            if (s[k] == s[i] || s[k] == s[j])
                continue;

            //Nesse caso, encontramos um 'k' existente, menor que n, e s[k], s[i] e s[j] são todos diferentes. Log(i, j, k) é uma tripla que quebra o segundo caso mas é válido para o primeiro;

            combinacoes--;

        }
    }

    cout << combinacoes << endl;

    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;


int main(int argc, char const *argv[])
{
  ll N, res = 0; cin >> N;
  string S; cin >> S;
  vector<ll> R(N+1), G(N+1), B(N+1);

  R[0] = 0;
  G[0] = 0;
  B[0] = 0;
  REP(i, N) {
    R[i+1] = R[i] + (S[i] == 'R');
    G[i+1] = G[i] + (S[i] == 'G');
    B[i+1] = B[i] + (S[i] == 'B');
  }

  REP(i, N-2)
    RNG(j, i+1, N-1) {
      if (S[i] != S[j]) {
        if (S[i] != 'R' && S[j] != 'R') {
          res += (R[N] - R[j+1]);
          res -= (j+j-i < N) && S[j+j-i] == 'R';
        }
        if (S[i] != 'G' && S[j] != 'G') {
          res += (G[N] - G[j+1]);
          res -= (j+j-i < N) && S[j+j-i] == 'G';
        }
        if (S[i] != 'B' && S[j] != 'B') {
          res += (B[N] - B[j+1]);
          res -= (j+j-i < N) && S[j+j-i] == 'B';
        }
      }
    }

  cout << res << endl;
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here
    
    //memo
    //たぶんこれも、全探索でやっていく奴だと思われます。
    //始点と終点を設定し、始点と終点の間をカーソルを動かして探索していくぞ！
    //始点aを0からN-3まで動かしていき、道中でcをN-1まで伸ばす。
    
    //そののままやったらTLEだったので、文字列単純化作業をしてもう1回やってみる
    
    //変数宣言
    int N;//0~N-1番目
    string S;
    int a,b,c;//始点、終点、カーソル座標
    int count=0;//カウント変数
    
    //入力
    cin >> N >> S;
    
    //処理
    
   
    //Sという文字列に題意を適応させるプログラム
    for(a=0;a<=N-3;a++){
        for(c=a+2;c<=N-1;c++){
            if(S.at(a)==S.at(c))continue;
            
            for(b=a+1;b<=c-1;b++){
                if((S.at(a)!=S.at(b)&&S.at(b)!=S.at(c)&&S.at(c)!=S.at(a))&&b-a!=c-b){
                        count += 1;
                }
            }
        }
    }
    
    cout << count << endl;
}


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

#include <bits/stdc++.h>
#define fi first
#define se second
#define For(i, a, b) for (int i = (a); i <= (b); ++i)
#define Ford(i, a, b) for(int i = (a); i >=(b); --i)
#define endl '\n'
#define debug(a) cout << a << endl
using namespace std;
 
typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
 
const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;
 
const ll limit = 2e5 + 5;
const ll limit1 = 1e6 + 5;
const ll limit2 = 1e3 + 5;

ll test;
ll k, n;
string s;
ll res = 0, sum = 0, ans = 0, kd, hkd;


void FastIn(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

ll Solve(){
    For(i, 0, n - 1)
        For(j, i + 1, n - 1)
            For(h, j + 1, n - 1){
                if(s[i] != s[j] && s[j] != s[h] && s[i] != s[h] && j - i != h - j)
                    res++;
            }
    
    return res;
}

void ReadIn(){
    cin >> n;
    cin >> s;
    cout << Solve();
}
int main(){
    FastIn();
    ReadIn();
}
    

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)

int main(void){
    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 res = r*g*b;
    for(int i=0;i<N;++i){
        for(int j=i+1;j<N;++j){
            int k = 2*j - i;
            if(j<N){
                if(S[i]==S[j] || S[j]==S[k] || S[k]==S[i]){
                    res--;
                }
            }
        }
    }
    cout << res << endl;
}

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

#include<iostream>
using namespace std;

static const int MAX = 4000;

int main(){
    int n;
    char s[MAX];
    cin >> n;
    cin >> s;

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

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

    int ans = r*g*b - cnt;
    
    // for(i=0; i<n; i++){
    //     for(j=i+1; j<n; j++){
    //         for(k=j+1; k<n; k++){
    //             if(s[i]!=s[j] && s[j]!=s[k] && s[k]!=s[i] && j-i!=k-j) cnt++;
    //         }
    //     }
    // }

    cout << ans << endl;
}


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

#include "bits/stdc++.h"
#define lp(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using l = long;
using vi = vector<int>;
using vl = vector<l>;
using vll = vector<ll>;
using vvl = vector<vector<l>>;
using vvll = vector<vector<ll>>;
using pll = pair<ll, ll>;
using un = unsigned;

int n, res = 0;
string s;

void f(int cnt, int num, vi v)
{
	const int vs = v.size();
	if (vs == 3) return;
	else if (vs < 3) {
		for (int i = num; i < n; i++) {
			if (num < i) {
				vi tmp = v;
				tmp.push_back(i);
				f(cnt + 1, i, tmp);
				if (tmp.size() == 3 && s[tmp[0]] != s[tmp[1]]
					&& s[tmp[0]] != s[tmp[2]]
					&& s[tmp[1]] != s[tmp[2]]
					&& (tmp[1] - tmp[0] != tmp[2] - tmp[1])) {
					res++;
				}
			}
		}
	}
}

int main()
{
	cin >> n >> s;
	f(0, 0, vi(1, 0));
	cout << res;
}



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.Scanner;

public class Main2 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		int r=0,g=0,b=0;
		for(int i=0;i<S.length();i++) {
			if(S.charAt(i)=='R') {
				r++;
			}else if(S.charAt(i)=='G') {
				g++;
			}else {
				b++;
			}
		}
		long ans = r*g*b;
		for(int i=0;i<N;i++) {
			for(int j=i+1;j<N;i++) {
				int k = j+j-i;
				if(k<N&&S.charAt(i)!=S.charAt(j)&&
						S.charAt(j)!=S.charAt(k)&&S.charAt(i)!=S.charAt(k)) {
					ans--;
				}
			}
		}
		System.out.println(ans);
	}

}

Compiler output:
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
Language: C

#include <iostream>
#include <string>

using namespace std;

void func_A() {

    int n;
    cin >> n;

    while (n > 0) {
        if (n % 10 == 7) {
            cout << "Yes";
            return;
        }

        n /= 10;
    }

    cout << "No";
}

void func_B() {

    unsigned long long n;
    cin >> n;

    unsigned long long sum = 0;
    for (unsigned long long i = 1; i <= n; ++i) {
        if (i % 3 != 0 && i % 5 != 0) sum += i; 
    }

    cout << sum;
}

int gcd(int x, int y) {

    if (y == 0) return x;

    return gcd(y, x % y);
}

void func_C() {

    int k;
    cin >> k;

    int sum = 0;
    for (int a = 1; a <= k; ++a) {
        for (int b = 1; b <= k; ++b) {
            for (int c = 1; c <= k; ++c) {
                sum += gcd(gcd(a, b), c);
            }
        }
    }

    cout << sum;

}

void func_D() {

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

    int count = 0;

    for (int i = 0; i < n - 2; ++i) {
        for (int j = i + 1; j < n - 1; ++j) {
            if (s[i] == s[j]) continue;
            for (int k = j + 1; k < n; ++k) {
               // cout << "i:" << i << " j:" << j << " k:" << k << "\n";
                if (j - i == k - j) continue;
                if (s[j] != s[k] && s[k] != s[i]) ++count;
            }
        }
    }

    cout << count;
}

void func_Dfix() {
    
    int n;
    cin >> n;

    string s;
    cin >> s;

    /*
    まずは条件１を満たす組み合わせの総数を考える
    条件1はつまるところ'R'と'G'と'B'の組み合わせなので、
    (Rの総数)*(Gの総数)*(Bの総数)で求められる
    よって、文字列からRGBの数を求める
    */
    int num_r = 0;
    int num_g = 0;
    int num_b = 0;
    for (string temp = s; temp.empty() == 0; temp.erase(0, 1)) {
        if (temp[0] == 'R') ++num_r;
        else if (temp[0] == 'G') ++num_g;
        else if (temp[0] == 'B') ++num_b;
        else cout << "rgb以外を検出しました\n";
    }

    int ans = num_r * num_g * num_b;
    
    /*
    条件1を満たす組み合わせの総数を求めたので、
    条件２を満たさない組み合わせを引けば
    求めたい値が得られる
    条件２は　j-i != k - j
    すなわち　k != 2*j - i
    よってすべての(i,j)の組み合わせについて
    s[i],s[j],s[2*j-i] で条件１を満たすものを求める。
    （これが条件1を満たすが条件２を満たさない組み合わせ）

    k = 2 * j - i　を利用することによりO(N^2)で求めることができる
    */

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

    cout << ans;



}

void func_E(){


}

int main()
{
    //func_A();
    //func_B();
    //func_C();
    //func_D();
    func_Dfix();
    //func_E();
    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>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

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

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:51:89: error: expected ';' before 'RGB'
   51 |         min_char = min(rv.at(rv.size() - 1), gv.at(gv.size() - 1), bv.at(bv.size() - 1))
      |                                                                                         ^
      |                                                                                         ;
   52 |         RGB = 'R' + 'G' + 'B';
      |         ~~~                                                                              
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:51:16:   required from here
   51 |         min_char = min(rv.at(rv.size() - 1), gv.at(gv.size() - 1), bv.at(bv.size() - 1))
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~