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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'll' was not declared in this scope
    7 |         ll i,j,N,r=0,g=0,b=0,ans=0,st=1;
      |         ^~
a.cc:9:16: error: 'N' was not declared in this scope
    9 |         cin >> N >> S;
      |                ^
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=0;i<N;++i){
      |             ^
a.cc:11:33: error: 'r' was not declared in this scope
   11 |                 if(S[i]=='R') ++r;
      |                                 ^
a.cc:12:33: error: 'g' was not declared in this scope
   12 |                 if(S[i]=='G') ++g;
      |                                 ^
a.cc:13:33: error: 'b' was not declared in this scope
   13 |                 if(S[i]=='B') ++b;
      |                                 ^
a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         ans = r*g*b;
      |         ^~~
      |         abs
a.cc:15:15: error: 'r' was not declared in this scope
   15 |         ans = r*g*b;
      |               ^
a.cc:15:17: error: 'g' was not declared in this scope
   15 |         ans = r*g*b;
      |                 ^
a.cc:15:19: error: 'b' was not declared in this scope
   15 |         ans = r*g*b;
      |                   ^
a.cc:17:20: error: 'st' was not declared in this scope; did you mean 'std'?
   17 |                 if(st*2>=N) break;
      |                    ^~
      |                    std
a.cc:18:21: error: 'i' was not declared in this scope
   18 |                 for(i=0;i+st*2<N;++i){
      |                     ^
a.cc:18:27: error: 'st' was not declared in this scope; did you mean 'std'?
   18 |                 for(i=0;i+st*2<N;++i){
      |                           ^~
      |                           std
a.cc:21:19: error: 'st' was not declared in this scope; did you mean 'std'?
   21 |                 ++st;
      |                   ^~
      |                   std
Language: C++

#include <iostream>
using namespace std;

int main(void){
  int N;
  string S;
  cin >> N;
  cin >> S;
  
  int countR=0, countG=0, countB=0;
  char c;
  for (int i=0; i<N; i++){
    c = S[i];
    switch(c){
      case 'R':
        countR++;
        break;
      case 'G':
        countG++;
        break;
      case 'B':
        countB++;
        break;
      default:
        break;
    }
  }
  
  int ans = countR * countG * countB;
  
  int k=0;
  char c1, c2, c3;
  for (int i=0; i<N; i++){
    for (int j=i+1; j<N; j++){
      k=2j-i-1;
      if(k>=N){
        break;
      }
      
      c1=S[i], c2=S[j], c3=S[k];
      if ((c1-c2)*(c2-c3)*(c3-c1) != 0){
        ans--;
      }
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:13: error: cannot convert '__complex__ int' to 'int' in assignment
   35 |       k=2j-i-1;
      |         ~~~~^~
      |             |
      |             __complex__ int
Language: C

#include <stdio.h>                                                                         int main(void){
  int N,r=0,g=0,b=0,i,j;
  long res=0;
  char S[5000];
  scanf("%d%s",&N,S);
  for(i=0;i<N;i++){
    if(S[i]=='R') r++;
    if(S[i]=='G') g++;
    if(S[i]=='B') b++;
  }
  res=r*g;
  res*=b;
  for(i=0;i<N-2;i++){
    for(j=i+1;j<N-1;j++){
      int k=2*j-i;
      if(S[i]!=S[j]&&S[i]!=S[k]&&S[j]!=S[k]&&k<N){
        res--;
      }
    }
  }
  printf("%ld",res);
  return 0;
}
                                                                                           

Compiler output:
main.c:1:92: warning: extra tokens at end of #include directive
    1 | #include <stdio.h>                                                                         int main(void){
      |                                                                                            ^~~
main.c:5:9: error: expected declaration specifiers or '...' before string constant
    5 |   scanf("%d%s",&N,S);
      |         ^~~~~~
main.c:5:16: error: expected declaration specifiers or '...' before '&' token
    5 |   scanf("%d%s",&N,S);
      |                ^
main.c:5:19: error: expected declaration specifiers or '...' before 'S'
    5 |   scanf("%d%s",&N,S);
      |                   ^
main.c:6:3: error: expected identifier or '(' before 'for'
    6 |   for(i=0;i<N;i++){
      |   ^~~
main.c:6:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
    6 |   for(i=0;i<N;i++){
      |            ^
main.c:6:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    6 |   for(i=0;i<N;i++){
      |                ^~
main.c:11:3: warning: data definition has no type or storage class
   11 |   res=r*g;
      |   ^~~
main.c:11:3: error: type defaults to 'int' in declaration of 'res' [-Wimplicit-int]
main.c:11:3: error: conflicting types for 'res'; have 'int'
main.c:3:8: note: previous definition of 'res' with type 'long int'
    3 |   long res=0;
      |        ^~~
main.c:11:7: error: initializer element is not constant
   11 |   res=r*g;
      |       ^
main.c:12:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*=' token
   12 |   res*=b;
      |      ^~
main.c:13:3: error: expected identifier or '(' before 'for'
   13 |   for(i=0;i<N-2;i++){
      |   ^~~
main.c:13:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
   13 |   for(i=0;i<N-2;i++){
      |            ^
main.c:13:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
   13 |   for(i=0;i<N-2;i++){
      |                  ^~
main.c:21:10: error: expected declaration specifiers or '...' before string constant
   21 |   printf("%ld",res);
      |          ^~~~~
main.c:21:16: error: expected declaration specifiers or '...' before 'res'
   21 |   printf("%ld",res);
      |                ^~~
main.c:22:3: error: expected identifier or '(' before 'return'
   22 |   return 0;
      |   ^~~~~~
main.c:23:1: error: expected identifier or '(' before '}' token
   23 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,r,g,b,remove;
  remove=0;
  r=0;
  b=0;
  g=0;
  string s;
  cin >> n >> s;
  if(n<=3) cout <<'0';
  
  else{
  for(i=0;i<n;i++)
  {
  if(s.at(i)=='R') r++;
  if(s.at(i)=='G') g++;
  if(s.at(i)=='B') b++;
  }
    
  for(i=0;i<n-2;++i)
  {
    for(j=1;2*j<=(n-1-i);++j)
   {
   if(a
      s.at(i)!=s.at(i+j) && s.at(i)!=s.at(i+2*j) && s.at(i+j)!=s.at(i+2*j)) remove++;
   }   
  }
  cout << r*g*b-remove;
 }

return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: 'a' was not declared in this scope
   26 |    if(a
      |       ^
a.cc:26:8: error: expected ')' before 's'
   26 |    if(a
      |      ~ ^
      |        )
   27 |       s.at(i)!=s.at(i+j) && s.at(i)!=s.at(i+2*j) && s.at(i+j)!=s.at(i+2*j)) remove++;
      |       ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,r,g,b,remove;
  remove=0;
  r=0;
  b=0;
  g=0;
  stirng s;
  cin >> n >> s;
  if(n<=3) cout <<'0';
  
  else{
  for(i=0;i<n;i++)
  {
  if(s.at(i)=='R') r++;
  if(s.at(i)=='G') g++;
  if(s.at(i)=='B') b++;
  }
    
  for(i=0;i<n-2;++i)
  {
    for(j=1;2*j<=(n-1-i);++j)
   {
   if(a.at(i)!=a.at(i+j) && a.at(i)!=a.at(i+2*j) && a.at(i+j)!=a.at(i+2*j)) remove++;
   }   
  }
  cout << r*g*b-remove;
 }

return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'stirng' was not declared in this scope
   10 |   stirng s;
      |   ^~~~~~
a.cc:11:15: error: 's' was not declared in this scope
   11 |   cin >> n >> s;
      |               ^
a.cc:26:7: error: 'a' was not declared in this scope
   26 |    if(a.at(i)!=a.at(i+j) && a.at(i)!=a.at(i+2*j) && a.at(i+j)!=a.at(i+2*j)) remove++;
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j,r,g,b,remove;
  remove=0;
  r=0;
  b=0;
  g=0;
  stirng s;
  cin >> n >> s;
  if(n<=3) cout <<'0';
  
  else{
  for(i=0;i<n;i++)
  {
  if(s.at(i)=='R') r++;
  if(s.at(i)=='G') g++;
  if(s.at(i)=='B') b++;
  }
    
 　for(i=0;i<n-2;++i)
  {
   for(j=1;2*j<=(n-1-i);++j)
   {
   if(a.at(i)!=a.at(i+j) && a.at(i)!=a.at(i+2*j) && a.at(i+j)!=a.at(i+2*j)) remove++;
   }   
  }
  cout << r*g*b-remove;
 }

return 0;}

Compiler output:
a.cc:22:2: error: extended character 　 is not valid in an identifier
   22 |  　for(i=0;i<n-2;++i)
      |  ^
a.cc: In function 'int main()':
a.cc:10:3: error: 'stirng' was not declared in this scope
   10 |   stirng s;
      |   ^~~~~~
a.cc:11:15: error: 's' was not declared in this scope
   11 |   cin >> n >> s;
      |               ^
a.cc:22:11: error: expected ')' before ';' token
   22 |  　for(i=0;i<n-2;++i)
      |       ~   ^
      |           )
a.cc:22:21: error: expected ';' before ')' token
   22 |  　for(i=0;i<n-2;++i)
      |                     ^
      |                     ;
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		String s = scn.Next();
      	int r = 0;
      	int g = 0;
      	int b = 0;
      	for(int i=0; i<n; i++){
			if(s.charAt(i)=='R'){
				r++;
			}else if(s.charAt(i)=='G'){
				g++;
			}else{
				b++;
			}
		}
      	int ans = r*g*b;
		for(int i=0; i<n; i++){
			for(int j=i+1; j<n; j++){
				int k = 2*j - i;
				if(k>=n){
					continue;
				}
				char ci = s.charAt(i);
              	char cj = s.charAt(j);
              	char ck = s.charAt(k);
				if(ci != cj && cj != ck && ck != ci){
					ans--;
				}
			}
		}
		System.out.println(ans);
	}
}

Compiler output:
Main.java:7: error: cannot find symbol
		String s = scn.Next();
		              ^
  symbol:   method Next()
  location: variable scn of type Scanner
1 error
Language: C++

#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n ;
    string s ;
    cin >> n >> s ;
    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 ;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'a' was not declared in this scope
   16 |         if(s[i] == 'R') a[i] = 0 ;
      |                         ^
a.cc:17:25: error: 'a' was not declared in this scope
   17 |         if(s[i] == 'G') a[i] = 1 ;
      |                         ^
a.cc:18:25: error: 'a' was not declared in this scope
   18 |         if(s[i] == 'B') a[i] = 2 ;
      |                         ^
a.cc:21:18: error: 'a' was not declared in this scope
   21 |     rep(i,n) cnt[a[i]]++ ;
      |                  ^
a.cc:28:20: error: 'a' was not declared in this scope
   28 |                 if(a[i] == a[j]) continue ;
      |                    ^
a.cc:29:20: error: 'a' was not declared in this scope
   29 |                 if(a[i] == a[k]) continue ;
      |                    ^
a.cc:30:20: error: 'a' was not declared in this scope
   30 |                 if(a[k] == a[j]) continue ;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n ;
    string s ;
    cin >> n ;
    cin >> s ;
    vector<int> num (3) ;
    rep(i, n){
        if(s[i] == 'R') num[0]++ ;
        if(s[i] == 'G') num[1]++ ;
        if(s[i] == 'B') num[2]++ ;
    }
    int ans = num[0] * num[1] * num[2] ;
    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 ;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: 'a' was not declared in this scope
   27 |                 if(a[i] == a[j]) continue ;
      |                    ^
a.cc:28:20: error: 'a' was not declared in this scope
   28 |                 if(a[i] == a[k]) continue ;
      |                    ^
a.cc:29:20: error: 'a' was not declared in this scope
   29 |                 if(a[k] == a[j]) continue ;
      |                    ^
Language: C++

#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n ;
    string s ;
    cin >> n ;
    cin >> s ;
    vector<int> num (3) ;
    rep(i, n){
        if(s[i] == 'R') num[0]++ ;
        if(s[i] == 'G') num[1]++ ;
        if(s[i] == 'B') num[2]++ ;
    }
    int ng = 0 ;
    rep(i, n - 2){
        for(int j = i+1 ; j < n-1 ; j++){
            int k = j + (j - i) ; 
            if(k > n - 1){
                break ; 
            }
            else if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]){
                ng++ ;
            }
        }
    }
    cout << num[0]*num[1]*num[2] - ng << endl ;
}  #include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    int n ;
    string s ;
    cin >> n ;
    cin >> s ;
    vector<int> num (3) ;
    rep(i, n){
        if(s[i] == 'R') num[0]++ ;
        if(s[i] == 'G') num[1]++ ;
        if(s[i] == 'B') num[2]++ ;
    }
    int ng = 0 ;
    rep(i, n - 2){
        for(int j = i+1 ; j < n-1 ; j++){
            int k = j + (j - i) ; 
            if(k > n - 1){
                break ; 
            }
            else if(s[i] != s[j] && s[i] != s[k] && s[j] != s[k]){
                ng++ ;
            }
        }
    }
    cout << num[0]*num[1]*num[2] - ng << endl ;
}  

Compiler output:
a.cc:35:4: error: stray '#' in program
   35 | }  #include <bits/stdc++.h>
      |    ^
a.cc:35:5: error: 'include' does not name a type
   35 | }  #include <bits/stdc++.h>
      |     ^~~~~~~
a.cc:45:5: error: redefinition of 'int main()'
   45 | int main() {
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main() {
      |     ^~~~
Language: C++

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

using namespace std;
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 ans=r*g*b;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int k=2*j-i;
            if(k>=n)continue;
            if(S[i]==S[j] || S[j]==S[k]||S[k]==S[i])continue;
            ans--;
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:24: error: 'll' was not declared in this scope
    2 | #define rep(i, n) for (ll i = 0; i < (ll)n; i++)
      |                        ^~
a.cc:9:5: note: in expansion of macro 'rep'
    9 |     rep(i,n){
      |     ^~~
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i,n){
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (ll i = 0; i < (ll)n; i++)
      |                                  ^
a.cc:9:11: error: expected ';' before 'n'
    9 |     rep(i,n){
      |           ^
a.cc:2:42: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (ll i = 0; i < (ll)n; i++)
      |                                          ^
a.cc:2:43: error: expected ')' before ';' token
    2 | #define rep(i, n) for (ll i = 0; i < (ll)n; i++)
      |                       ~                   ^
a.cc:9:5: note: in expansion of macro 'rep'
    9 |     rep(i,n){
      |     ^~~
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     rep(i,n){
      |         ^
a.cc:2:45: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (ll i = 0; i < (ll)n; i++)
      |                                             ^
a.cc:14:5: error: 'll' was not declared in this scope
   14 |     ll ans=r*g*b;
      |     ^~
a.cc:20:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   20 |             ans--;
      |             ^~~
      |             abs
a.cc:23:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
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 ans=r*g*b;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int k=2*j-i;
            if(k>=n)continue;
            if(S[i]==S[j] || S[j]==S[k]||S[k]==S[i])continue;
            ans--;
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'i' was not declared in this scope
    7 |     rep(i,n){
      |         ^
a.cc:7:5: error: 'rep' was not declared in this scope
    7 |     rep(i,n){
      |     ^~~
a.cc:12:5: error: 'll' was not declared in this scope
   12 |     ll ans=r*g*b;
      |     ^~
a.cc:18:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |             ans--;
      |             ^~~
      |             abs
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: C++

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

int main() {
  int64_t N;
  string S;
  cin>>N>>S;
  int64_t r=0;
  int64_t g=0;
  int64_t b=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='R') r++;
    else if(S.at(i)=='G') g++;
    else b++;
  }
  int64_t moto=r*g*b;
  int64_t gen=0;
  for(int i=0;i<N;i++){
    int j=1;
    while(i+2*j<N){
      if(S.at(i)!=S.at(i+j)&&S.at(i)!=S.at(i+2*j)&&S.at(i+j)!=S.at(i+2*j)) gen++;
      j++;
    }
  }
  cout<<moto-gen<<endl;

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

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

using namespace std;

int main(){
  int64_t n;
  cin >> n;
  string s;
  cin >> s;
  int64_t r_count = count(s.begin(), s.end(), 'R');
  int64_t g_count = count(s.begin(), s.end(), 'G');
  int64_t b_count = count(s.begin(), s.end(), 'B');
  int duplicate = 0;
  for(int64_t i = 0; i < n; ++i){
    for(int64_t j = 1; i+j+j <= n-1; ++j){
      set<char> colors;
      if(i+j+j >= n)continue;
      colors.insert(s[i]);
      colors.insert(s[i+j]);
      colors.insert(s[i+j+j]);
      if(colors.size() == 3)duplicate++;
    }
  }
  cout << r_count*g_count*b_count - duplicate << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'count' was not declared in this scope; did you mean 'r_count'?
   13 |   int64_t r_count = count(s.begin(), s.end(), 'R');
      |                     ^~~~~
      |                     r_count
Language: C

#include<stdio.h>
int main()
{
  char s[4000];
  int n,i=1,j=2,k=3,sam=0;
  scanf("%d%s",&n,s);
  for(i=1;i<j;i++){
    for(j=i+1;j<k;j++){
      for(k=j+1;k<=n;k++){
        if((s[i-1]!=s[j-1])&&(s[j-1]!=s[k-1])&&(s[k-1]!=s[s-1])&&((j-i)!=(k-j)))
          sam++;
      }
    }
  }
  
}

Compiler output:
main.c: In function 'main':
main.c:10:58: error: array subscript is not an integer
   10 |         if((s[i-1]!=s[j-1])&&(s[j-1]!=s[k-1])&&(s[k-1]!=s[s-1])&&((j-i)!=(k-j)))
      |                                                          ^
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(void){
  int n;
  char s;
  int i,j,k;
  int total=0;
  scanf("%d",&n);
  s=(char)calloc(n,sizeof(char));
  scanf("%s",&s);
  for(i=1;i<=n;i++){
    for(j=i;j<=n;j++){
      for(j=j;j<=n;j++){
        if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      }
    }
  }
  printf("%d",total);
  free(s);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:9:5: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    9 |   s=(char)calloc(n,sizeof(char));
      |     ^
main.c:14:13: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |             ^
main.c:14:19: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |                   ^
main.c:14:27: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |                           ^
main.c:14:33: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |                                 ^
main.c:14:41: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |                                         ^
main.c:14:47: error: subscripted value is neither array nor pointer nor vector
   14 |         if(s[i]!=s[j] && s[i]!=s[k] && s[j]!=s[k] && j-i!=k-j)total++;
      |                                               ^
main.c:19:8: error: passing argument 1 of 'free' makes pointer from integer without a cast [-Wint-conversion]
   19 |   free(s);
      |        ^
      |        |
      |        char
In file included from main.c:2:
/usr/include/stdlib.h:687:25: note: expected 'void *' but argument is of type 'char'
  687 | extern void free (void *__ptr) __THROW;
      |                   ~~~~~~^~~~~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'g' was not declared in this scope
   10 |   ll r = 0; g = 0;
      |             ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected unqualified-id before 'long'
    7 |         long long int ans;
      |         ^~~~
a.cc:26:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |         ans = i;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){


string str;
 long long n;
 cin>>n>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;

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

 return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: 'i' was not declared in this scope
   26 |         for(i=0;i<n;i++)
      |             ^
a.cc:34:9: error: 'm' was not declared in this scope
   34 |         m=B.size();
      |         ^
Language: C++

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

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(i,m)
    rep(j,n)rep(i,j) {
        int k = j + (j-i);
        if (k < n) {
            if (a[i] == a[j]) continue;
            if (a[i] == a[k]) continue;
            if (a[k] == a[j]) continue;
            ans--;
        }
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:34: error: expected ';' before 'if'
   14 |         if (s[i] == 'R') a[i] = 0
      |                                  ^
      |                                  ;
   15 |         if (s[i] == 'G') a[i] = 1
      |         ~~                        
a.cc:23:11: error: 'm' was not declared in this scope
   23 |     rep(i,m)
      |           ^
a.cc:2:37: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i = 0; i<(n); i++)
      |                                     ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'll' was not declared in this scope
   10 |     ll ans = cnt['R'] * cnt['G'] * cnt['B'];
      |     ^~
a.cc:16:63: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |             if (s[i] != s[j] && s[i] != s[k] && s[j] != s[k]) ans--;
      |                                                               ^~~
      |                                                               abs
a.cc:19:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  vector<int> R, G, B;
  rep(i, N) {
    if (S.at(i) == 'R') R.push_back(i);
    if (S.at(i) == 'G') G.push_back(i);
    if (S.at(i) == 'B') B.push_back(i);
  }
  int cnt = 0;
  for (auto r : R) {
    for (auto g : G) {
      for (auto b : B) {
        int i, j, k;
        int x = max(r, g);
        int y = min(r, g);
        if (b < x) {
          i = b;
          j = x;
          k = y;
        } else if (y < b) {
          i = x;
          j = y;
          k = b;
        } else {
          i = x;
          j = b;
          k = y;
        }
        // vector<int> v = {r, g, b};
        // sort(v.begin(), v.end());
        // if (v.at(1) - v.at(0) != v.at(2) - v.at(1)) cnt++;
        if (j - i = k - j) cnt++;
      }
    }
  }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:15: error: lvalue required as left operand of assignment
   40 |         if (j - i = k - j) cnt++;
      |             ~~^~~
Language: C

#include<iostream>
#include<string>
using namespace std;
int main()
{
    char s[2000];
    long long n,i,j,k,total=0,red[2000]={0},green[2000]={0},blue[2000]={0},r=0,g=0,b=0,x,y;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>s[i];
        if(s[i]=='R')
        {
            r++;
            red[i]=red[i-1]+1;
            blue[i]=blue[i-1];
            green[i]=green[i-1];
        }
        else if(s[i]=='G')
        {
            g++;
            green[i]=green[i-1]+1;
            red[i]=red[i-1];
            blue[i]=blue[i-1];
        }
        else if(s[i]=='B')
        {
            b++;
            blue[i]=blue[i-1]+1;
            red[i]=red[i-1];
            green[i]=green[i-1];
        }
    }
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {          
            if((s[i]=='R'&&s[j]=='G')||(s[i]=='G'&&s[j]=='R'))
            {
                x=b-blue[j];
                y=(2*j)-i;
                if(s[y]=='B')
                {
                    x--;
                }
                total+=x;
            }
            else if((s[i]=='R'&&s[j]=='B')||(s[i]=='B'&&s[j]=='R'))
            {
                x=g-green[j];
                y=(2*j)-i;
                if(s[y]=='G')
                {
                    x--;
                }
                total+=x;
            }
            else if((s[i]=='B'&&s[j]=='G')||(s[i]=='G'&&s[j]=='B'))
            {
                x=r-red[j];
                y=(2*j)-i;
                if(s[y]=='R')
                {
                    x--;
                }
                total+=x;
            }
        }
    }
    cout<<total<<endl;
    return 0;
}

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

#include <bits/stdc++.h>

using namespace std;

void fastscan(int& N, set<int>& R_INDEX, set<int>& G_INDEX, set<int>& B_INDEX)
{
  char c;
  for (int i= 0; i < N; i++){
    getchar_unlocked(c);
    switch(c){
    case 'R':
      R_INDEX.insert(i);
      break;
    case 'G':
      G_INDEX.insert(i);
      break;
    case 'B':
      B_INDEX.insert(i);
      break;
    }
  }
}

void fastprint(long long int number) { 
  if (number == 0){
    putchar(48);
    return;
  }
  int length = 0;
  char num[40];
  while(number > 0){
    num[length] = number % 10 + 48;
    length++;
    number /= 10;
  }
  register int i;
  for(i = length - 1; i >= 0; i--)
    putchar_unlocked(num[i]);
}


long long int findsetnum(set<int>& R_INDEX, set<int>& G_INDEX, set<int>& B_INDEX)
{
  long long int sum = 0;
  int a, b, c;
  set<int>::iterator R_iter, G_iter;
  for (R_iter = R_INDEX.begin(); R_iter != R_INDEX.end(); R_iter++)
    for (G_iter = G_INDEX.begin(); G_iter != G_INDEX.end(); G_iter++){
      a = (B_INDEX.find(2 * (*G_iter) - *R_iter) == B_INDEX.end())? 0 : 1;
      b = (B_INDEX.find(2 * (*R_iter) - *G_iter) == B_INDEX.end())? 0 : 1;
      c = (B_INDEX.find((*G_iter + *R_iter) / 2) == B_INDEX.end() || (*G_iter + *R_iter) % 2 != 0)? 0 : 1;
      sum += (B_INDEX.size() - a - b - c);
    }
  return sum;
}

int main(void)
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  set<int> R_INDEX, G_INDEX, B_INDEX;
  fastscan(N, R_INDEX, G_INDEX, B_INDEX);
  fastprint(findsetnum(R_INDEX, G_INDEX, B_INDEX));
  return 0;
}


Compiler output:
a.cc: In function 'void fastscan(int&, std::set<int>&, std::set<int>&, std::set<int>&)':
a.cc:9:21: error: too many arguments to function 'int getchar_unlocked()'
    9 |     getchar_unlocked(c);
      |     ~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/cstdio:42,
                 from /usr/include/c++/14/ext/string_conversions.h:45,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/stdio.h:590:12: note: declared here
  590 | extern int getchar_unlocked (void);
      |            ^~~~~~~~~~~~~~~~
a.cc: In function 'void fastprint(long long int)':
a.cc:36:16: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   36 |   register int i;
      |                ^
Language: C++

#include <algorithm>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}


int main()
{
	int n;
	string s;
	cin >> n >> s;
	vector<vector<int> > cmap(n, vector<int>(3, 0));
	for (int i = (n-1); i >- 0; --i)
	{
		if (s[i] == 'R')
		{

		}
		else if (s[i] == '')
	}

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

	cout << ret << endl;
	return 0;
}

Compiler output:
a.cc:33:34: error: empty character constant
   33 |                 else if (s[i] == '')
      |                                  ^~
a.cc: In function 'int main()':
a.cc:34:9: error: expected primary-expression before '}' token
   34 |         }
      |         ^
Language: C++

// D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<string >
using namespace std;
int main()
{
    
    int n;
    int sum = 0;

    string s;

    cin >> n;
    cin >> s;

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

    cout << sum << endl;

    return 0;
}



Compiler output:
a.cc:5:9: fatal error: string : No such file or directory
    5 | #include<string >
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void){
    int N;
    string S;

    cin >> N;
    cin >> S;

    int count = 0;
    for(int i = 0;i < (int)S.size() - 2;i++){
        for(int j = i + 1; j< (int)S.size() - 1;j++) {
            for(int k = j + 1;k < (int)S.size();k++) {
                if(S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) {
                    if((j - i) != (k - j) {
                        count++;
                    }
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:42: error: expected ')' before '{' token
   17 |                     if((j - i) != (k - j) {
      |                       ~                  ^~
      |                                          )
a.cc:20:17: error: expected primary-expression before '}' token
   20 |                 }
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
// Time Complexity: O(N)
// Space Complexity: O(N)
int n;
   cin>>n;
   string s;
   cin>>s;
   if(n==1)
   {cout<<0<<endl;continue;}
   if(n==2)
    {cout<<0<<endl;continue;}

   int a[3]={0};
   for(int i=0;i<n;i++)
   {
       if(s[i]=='R')
        a[0]++;
       else if(s[i]=='G')
        a[1]++;
       else
        a[2]++;
   }
   ll s1=0;
   s1=a[0]*a[1]*a[2];
   for(int i=0;i<n;i++)
   {
       for(int j=1;j<=min(i,n-i-1);j++)
       {
           if(s[i]!=s[i-j] && s[i]!=s[i+j] && s[i-j]!=s[i+j])
           {
               s1--;
           }
       }
   }
   cout<<s1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:19: error: continue statement not within a loop
   11 |    {cout<<0<<endl;continue;}
      |                   ^~~~~~~~
a.cc:13:20: error: continue statement not within a loop
   13 |     {cout<<0<<endl;continue;}
      |                    ^~~~~~~~
a.cc:25:4: error: 'll' was not declared in this scope
   25 |    ll s1=0;
      |    ^~
a.cc:26:4: error: 's1' was not declared in this scope; did you mean 's'?
   26 |    s1=a[0]*a[1]*a[2];
      |    ^~
      |    s
Language: C++

// 6/17 振り返り
#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

    ll res = 0;

    ll r, g, b;
    r = g = b = 0;

    // for (int i = 0; i < N; i++) {
    //     for (int j = i + 1; j < N; j++) {
    //         for (int k = j + 1; k < N; k++) {
    //             if (j - i == k - j) continue;
    //             if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) res++;
    //         }
    //     }
    // }

    for (auto s : S) {
        if (s == 'R') r++;
        else if (s == 'G') g++;
        else b++;
    }

    res = r * g * b;
    // cout << res << endl;

    // for (int delta = 1; delta <= (N + 1) / 2; delta++) {
    //     for (int i = 0; i + 2 * delta < N; i++) {
    //         // cout << "here?" << endl;
    //         int j = i + delta;
    //         int k = j + delta;
    //         // printf("i, j, k = %d, %d, %d\n", i, j, k);
    //         if (S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) res--;
    //     }
    // }

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

    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll N;
      |     ^~
a.cc:10:12: error: 'N' was not declared in this scope
   10 |     cin >> N >> S;
      |            ^
a.cc:12:7: error: expected ';' before 'res'
   12 |     ll res = 0;
      |       ^~~~
      |       ;
a.cc:14:7: error: expected ';' before 'r'
   14 |     ll r, g, b;
      |       ^~
      |       ;
a.cc:15:5: error: 'r' was not declared in this scope
   15 |     r = g = b = 0;
      |     ^
a.cc:15:9: error: 'g' was not declared in this scope
   15 |     r = g = b = 0;
      |         ^
a.cc:15:13: error: 'b' was not declared in this scope
   15 |     r = g = b = 0;
      |             ^
a.cc:32:5: error: 'res' was not declared in this scope
   32 |     res = r * g * b;
      |     ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = Long Long;

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[j] == a[k]) continue;
			ans--;
		}
	}
}


Compiler output:
a.cc:6:12: error: 'Long' does not name a type; did you mean 'long'?
    6 | using ll = Long Long;
      |            ^~~~
      |            long
a.cc: In function 'int main()':
a.cc:12:23: error: 'n' was not declared in this scope
   12 |         vector<int> a(n);
      |                       ^
a.cc:14:20: error: 's' was not declared in this scope
   14 |                 if(s[i] == 'R') a[i] = 0;
      |                    ^
a.cc:15:20: error: 's' was not declared in this scope
   15 |                 if(s[i] == 'G') a[i] = 1;
      |                    ^
a.cc:16:20: error: 's' was not declared in this scope
   16 |                 if(s[i] == 'B') a[i] = 2;
      |                    ^
a.cc:18:16: error: 'll' was not declared in this scope
   18 |         vector<ll> cnt(3);
      |                ^~
a.cc:18:18: error: template argument 1 is invalid
   18 |         vector<ll> cnt(3);
      |                  ^
a.cc:18:18: error: template argument 2 is invalid
a.cc:19:21: error: invalid types 'int[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   19 |         rep(i,n) cnt[a[i]]++;
      |                     ^
a.cc:20:11: error: expected ';' before 'ans'
   20 |         ll ans = 1;
      |           ^~~~
      |           ;
a.cc:21:18: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |         rep(i,3) ans *= cnt[i];
      |                  ^~~
      |                  abs
a.cc:21:28: error: invalid types 'int[int]' for array subscript
   21 |         rep(i,3) ans *= cnt[i];
      |                            ^
a.cc:28:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                         ans--;
      |                         ^~~
      |                         abs
Language: C++

#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include <numeric>
#include <queue>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long ll;
typedef vector<vector<char>> field_t;
typedef unsigned long long ull;
typedef pair<ll, ll> point_t;

int main()
{
    
    string S;
    int N,ans,cnt;
    ans=0;
    cnt=0;
    cin >> N;
    vector<int> r,g;
    map<int,int> mp;
    cin >> S;
    rep(i,N){
        if(S.at(i)=='R'){
            r.push_back(i);
        }else{
            if(S.at(i)=='G'){
                g.push_back(i);
            }else{
                mp[i]++;
                cnt++;
            }
        }
    }
    rep(j,r.size()){
        rep(k,g.size()){
            int ret=cnt;
            int dy=abs(r[j]-g[k]);
            int ma=max(r[j],g[k]);
            int sum=r[j]+g[k]
            if(mp[ma+dy]){
                ret--;
            }
            int mi=min(r[j],g[k]);
            if(mp[mi-dy]){
                ret--;
            }
            if(mp[sum/2]&&sum%2==0){
                ret--;
            }
            ans+=ret;
        }
    }
    cout << ans <<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: error: expected ',' or ';' before 'if'
   44 |             if(mp[ma+dy]){
      |             ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
typedef long long ll;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:30:7: error: 'else' without a previous 'if'
   30 |       else if(s[j]!=s[k]&&s[k]!=s[i]){
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
typedef long long ll;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:29:7: error: 'k' was not declared in this scope
   29 |       k=2*j-i;
      |       ^
a.cc:30:7: error: 'else' without a previous 'if'
   30 |       else if(s[j]!=s[k]&&s[k]!=s[i]){
      |       ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
typedef long long ll;

int main() {
  ll N;
  cin>>N;
  string s;
  cin>>s;
  ll r=0,g=0,b=0;
  for(int i=0;i<N;i++){
    if(s[i]=='R'){
      r++;
    }
    else if(s[i]=='G'){
      g++;
    }
    else{
      b++;
    }
  }
  ll ans=rgb;
  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&&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:23:10: error: 'rgb' was not declared in this scope
   23 |   ll ans=rgb;
      |          ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
int main()	{
  int n;
  cin>>n;
  string s;
  cin>>s;
  int r,g,b;
  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){
    for(j=i+1;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:
a.cc: In function 'int main()':
a.cc:34:9: error: 'j' was not declared in this scope
   34 |     for(j=i+1;j<n;j++){
      |         ^
Language: C++

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

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

const double PI = acos(-1);
const int inf = 1001001001;
const int mod = (int)1e9+7;
//const ll inf = 1e15;
//const ll mod = 1e9+7;

int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};

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

    vector<int> a(n);
    REP(i, N) {
        if (S[i] == 'R') a[i] = 0;
        if (S[i] == 'G') a[i] = 1;
        if (S[i] == 'B') a[i] = 2;
    }
    vector<ll> cnt(3);
    REP(i,N) cnt[a[i]]++;

    ll ans = 1;
    REP(i, 3) ans *= cnt[i];
    REP (i, N) {
        FOR (j, i, N) {
            int k = 2 * j - i;
            if (k < N) {
                if (a[i] == a[j]) continue;
                if (a[j] == a[k]) continue;
                if (a[i] == a[k]) continue;
                ans--;
            }
        }
    }

    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:19: error: 'n' was not declared in this scope
   28 |     vector<int> a(n);
      |                   ^