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

#include <iostream>
#include <string>

using namespace std;

int main() {
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  
  vector<int> sum(S.size()+1, 0);
  // 0 0 1 1 2 2 2 3 3
  for(int i = 1; i < S.size(); i++)
    sum[i+1] = sum[i] + (S[i-1] == 'A' && S[i] == 'C');
  
  while(Q--) {
    int l, r;
    cin >> l >> r;
    cout << sum[r] - sum[l-1];
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: 'vector' was not declared in this scope
   11 |   vector<int> sum(S.size()+1, 0);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:11:10: error: expected primary-expression before 'int'
   11 |   vector<int> sum(S.size()+1, 0);
      |          ^~~
a.cc:14:5: error: 'sum' was not declared in this scope
   14 |     sum[i+1] = sum[i] + (S[i-1] == 'A' && S[i] == 'C');
      |     ^~~
a.cc:19:13: error: 'sum' was not declared in this scope
   19 |     cout << sum[r] - sum[l-1];
      |             ^~~
Language: C++

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

int main() {
  int N,Q;
  std::string S;
  std::cin >> N >> Q >> S;
  std::vector<std::pair<int,int>> LR(Q);
  for(auto &:r;LR)
    std::cin >> lr.first >> lr.second;
  std::vector<long long> integral(N+1,0);
  for(int i=0;i<N-1;i++){
    integral[i+1] = integral[i];
    if(S.substr(i,2) == "AC")
      integral[i+1] ++;      
  }
  integral[N] = integral[N-1];
  for(auto &lr:LR){
    std::cout << integral[lr.second+1]-integral[lr.first] << std::endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: expected unqualified-id before ':' token
   11 |   for(auto &:r;LR)
      |             ^
a.cc:11:14: error: 'r' was not declared in this scope
   11 |   for(auto &:r;LR)
      |              ^
a.cc:11:15: error: expected ')' before ';' token
   11 |   for(auto &:r;LR)
      |      ~        ^
      |               )
a.cc:11:18: error: expected ';' before ')' token
   11 |   for(auto &:r;LR)
      |                  ^
      |                  ;
Language: C++

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

int main() {
  int N,Q;
  std::string S;
  std::cin >> N >> Q >> S;
  std::vector<std::pair<int,int>> LR(Q);
  for(auto &lr;LR)
    std::cin >> lr.first >> lr.second;
  std::vector<long long> integral(N+1,0);
  for(int i=0;i<N-1;i++){
    integral[i+1] = integral[i];
    if(S.substr(i,2) == "AC")
      integral[i+1] ++;      
  }
  integral[N] = integral[N-1];
  for(auto &lr:LR){
    std::cout << integral[lr.second+1]-integral[lr.first] << std::endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: declaration of 'auto& lr' has no initializer
   11 |   for(auto &lr;LR)
      |       ^~~~
a.cc:11:16: error: could not convert 'LR' from 'std::vector<std::pair<int, int> >' to 'bool'
   11 |   for(auto &lr;LR)
      |                ^~
      |                |
      |                std::vector<std::pair<int, int> >
a.cc:11:18: error: expected ';' before ')' token
   11 |   for(auto &lr;LR)
      |                  ^
      |                  ;
Language: C++

n,q=[int(i) for i in input().split()]
s=input()
AC=[0]*n
cnt=0
for i in range(1,n):
    if s[i-1:i+1]=="AC":
        cnt+=1
    AC[i]=cnt
for i in range(q):
    l,r=[int(j) for j in input().split()]
    print((AC[r-1]-AC[l-1]))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,q=[int(i) for i in input().split()]
      | ^
Language: C++

#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int N,Q;
  cin >> N >> Q;
  
  string s;
  cin >> s;
  
  vector<vector<int>>cut(Q,vector<int>(2,0));
  
  for(int i=0;i<Q;i++){
    cin >> cut[i][0];
    cin >> cut[i][1];
  }

  int n = s.length();
  
  for(int i=0;i<n-1;i++){
    if(s[i] == 'A' && s[i+1] == 'C'){
      s[i] = 'P';
      s[i+1] = 'P';
    }
  }
  int num = 0;
  for(int i=0;i<Q;i++){
    for(int j=cut[i][0]-1;j<=cut[i][1]-1;j++){
      if(s[j] == 'P')
        num++;
    }
    cout << num / 2 << endl;
    num = 0;
  }
return 0;
}

    


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: 'vector' was not declared in this scope
   13 |   vector<vector<int>>cut(Q,vector<int>(2,0));
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <iomanip>
  +++ |+#include <vector>
    4 | #include <ios>
a.cc:13:17: error: expected primary-expression before 'int'
   13 |   vector<vector<int>>cut(Q,vector<int>(2,0));
      |                 ^~~
a.cc:16:12: error: 'cut' was not declared in this scope
   16 |     cin >> cut[i][0];
      |            ^~~
a.cc:30:15: error: 'cut' was not declared in this scope
   30 |     for(int j=cut[i][0]-1;j<=cut[i][1]-1;j++){
      |               ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int N,Q;
  cin >> N >> Q;

  string word;
  cin >> word;

  word = word + 'P';

  vector<vector<int>>wordcut(Q,vector<int>(2,0));

  for(int i=0;i<Q;i++){
    cin >> wordcut[i][0];
    cin >> wordcut[i][1];
  }

  int ans = 0;

  for(int i=0;i<Q;i++){
    for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      if(word[j] == 'A' && word[j+1] == 'C'){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' in initialization
   26 |     for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int N,Q;
  cin >> N >> Q;
 
  string word;
  cin >> word;
 
  word = word + 'P';
 
  vector<vector<int>>wordcut(Q,vector<int>(2,0));
 
  for(int i=0;i<Q;i++){
    cin >> wordcut[i][0];
    cin >> wordcut[i][1];
  }
 
  int ans = 0;
 
  for(int i=0;i<Q;i++){
    for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      if(word[j] == 'A' && word[j+1] == 'C'){
        ans++;
      }
    }
  }
 
  cout << ans << endl;
 
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:24: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' in initialization
   26 |     for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  int N,Q;
  cin >> N >> Q;

  string word;
  cin >> word;

  word = word + 'P';

  vector<vector<int>>wordcut(Q,vector<int>(2,0);

  for(int i=0;i<Q;i++){
    cin >> wordcut[i][0];
    cin >> wordcut[i][1];
  }

  int ans = 0;

  for(int i=0;i<Q;i++){
    for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      if(word[j] == 'A' && word[j+1] == 'C'){
        ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

  
                            
  
                             
                             
                             
                             
                             
                     
                             
                             


Compiler output:
a.cc: In function 'int main()':
a.cc:16:48: error: expected ')' before ';' token
   16 |   vector<vector<int>>wordcut(Q,vector<int>(2,0);
      |                             ~                  ^
      |                                                )
a.cc:26:24: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'int' in initialization
   26 |     for(int j=wordcut[i];j<=wordcut[i][1] - 1;j++){
      |                        ^
Language: C

#include<stdio.h>
int Main(){
	int N,Q;
	scanf("%d %d",&N,&Q);
	char arr[N];

	scanf("%s",arr);	

	int arr2[Q][2];

	for(int i=0; i<Q; i++){
		scanf("%d %d",&arr2[i][0],&arr2[i][1]);
	}

	for(int i=0; i<Q; i++){
		int counter=0;
		for(int k=arr2[i][0]-1; k<arr2[i][1]-1; k++){
			if(arr[k]=='A' && arr[k+1]=='C'){
				counter++;
			}
		}
		printf("%d\n",counter);
	}

	return 0;
}


Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main{
  int n,q,i,j,k;
  string s;
  cin>>n>>q>>s;
  vector<char> c(n);
  vector<int> ac(n-1,0);
  for(j=0;j<n;j++){
    c[j]=s.at(j);
  }
  for(i=0;i<n-1;i++){
    if(c[i]=='A'&&c[i+1]=='C'){
      ac[i]=1;
    }
    else{continue;}
  }
  for(k=0;k<q;k++){
    int l,r,s,t;
    t=0;
    cin>>l>>r;
    for(s=l-1;s<r-1;s++){
      t+=ac[s];
    }
    cout>>t>>endl;
  }
}

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main{
      |     ^~~~
a.cc:4:3: error: expected primary-expression before 'int'
    4 |   int n,q,i,j,k;
      |   ^~~
a.cc:4:3: error: expected '}' before 'int'
a.cc:3:9: note: to match this '{'
    3 | int main{
      |         ^
a.cc:6:3: error: 'cin' does not name a type
    6 |   cin>>n>>q>>s;
      |   ^~~
a.cc:7:18: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   vector<char> c(n);
      |                  ^
      |                  yn
a.cc:8:18: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |   vector<int> ac(n-1,0);
      |                  ^
      |                  yn
a.cc:9:3: error: expected unqualified-id before 'for'
    9 |   for(j=0;j<n;j++){
      |   ^~~
a.cc:9:11: error: 'j' does not name a type
    9 |   for(j=0;j<n;j++){
      |           ^
a.cc:9:15: error: 'j' does not name a type
    9 |   for(j=0;j<n;j++){
      |               ^
a.cc:12:3: error: expected unqualified-id before 'for'
   12 |   for(i=0;i<n-1;i++){
      |   ^~~
a.cc:12:11: error: 'i' does not name a type
   12 |   for(i=0;i<n-1;i++){
      |           ^
a.cc:12:17: error: 'i' does not name a type
   12 |   for(i=0;i<n-1;i++){
      |                 ^
a.cc:18:3: error: expected unqualified-id before 'for'
   18 |   for(k=0;k<q;k++){
      |   ^~~
a.cc:18:11: error: 'k' does not name a type
   18 |   for(k=0;k<q;k++){
      |           ^
a.cc:18:15: error: 'k' does not name a type
   18 |   for(k=0;k<q;k++){
      |               ^
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

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

int main() {
	int N, Q;
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<vector<int>> data(2, vector<int>(Q,0));
	for (int i = 0; i < Q; i++) {
		cin >> data.at(i).at(0) >> data.at(i).at(1);
	}
	for (int i = 0; i < Q; i++) {
		for (int k = data.at(i).at(0); k < data.at(i).at(1) - 1; k++) {
			int AC = 0;
			if (S.at(data.at(i).at(0)) == 'A' && S.at(data.at(i).at(0) + 1) == 'B') {
				AC++;
			}
		}
		cout << AC << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: 'AC' was not declared in this scope
   20 |                 cout << AC << endl;
      |                         ^~
Language: Java

import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N =sc.nextInt();
        int Q = sc.nextInt();
        String S = sc.next();
        String str;
        char s1,s2;
        int[] count =new int[Q];
        int cnt,a,b;

        for(int i = 0;i < Q;i++){
            cnt = 0;
            a = sc.nextInt();
            b = sc.nextInt();
            str = S.substring(a-1,b);
            for(int j = 0;j < str.length()-1;j++){
                s1 = str.charAt(j);
                s2 = str.charAt(j+1);
                if(s1 == 'A' && s2 == 'C'){
                    cnt++;
                }
            }
            count[i] = cnt;
        }
        for(int i = 0;i < Q;i++){
            System.out.println(count[i]);
        }
    }

Compiler output:
Main.java:31: error: reached end of file while parsing
    }
     ^
1 error
Language: C++

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


int main(){
  int N,Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<int> l(Q),r(Q),csum(N+1,0);
  for(int i=0;i<Q;i++){
    cin >> l.at(i);
    cin >> r.at(i);
  }
  
  for(int i=1;i<N;i++){
    if(s.at(i)=='C' && s.at(i-1)=='A'){
      csum.at(i+1)=csum.at(i)+1;
    } else{
      csum.at(i+1)=csum.at(i);
    }
  }
  
  for(int i=0;i<Q;i++){
    //int lstring=s.at(l.at(i)-1),rstring=s.at(r.at(i)-1);
    if(s.at(l.at(i)-1)=='A' && s.at(l.at(i))=='T') count << csum.at(r.at(i))-csum.at(l.at(i)+1) << endl;
    else count << csum.at(r.at(i))-csum.at(l.at(i)) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:58: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to binary 'operator<<'
   28 |     if(s.at(l.at(i)-1)=='A' && s.at(l.at(i))=='T') count << csum.at(r.at(i))-csum.at(l.at(i)+1) << endl;
      |                                                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:16: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to binary 'operator<<'
   29 |     else count << csum.at(r.at(i))-csum.at(l.at(i)) << endl;
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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


int main(){
  int N,Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<int> l(Q),r(Q),csum(N+1,0);
  for(int i=0;i<Q;i++){
    cin >> l.at(i);
    cin >> r.at(i);
  }
  
  for(int i=1;i<N;i++){
    if(s.at(i)=='C' && s.at(i-1)=='A'){
      csum.at(i+1)=csum(i)+1;
    } else{
      csum.at(i+1)=csum(i);
    }
  }
  
  for(int i=0;i<Q;i++){
    //int lstring=s.at(l.at(i)-1),rstring=s.at(r.at(i)-1);
    if(s.at(l.at(i)-1)=='A' && s.at(l.at(i))=='T') count << csum.at(r.at(i))-csum.at(l.at(i)+1) << endl;
    else count << csum.at(r.at(i))-csum.at(l.at(i)) << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:24: error: no match for call to '(std::vector<int>) (int&)'
   20 |       csum.at(i+1)=csum(i)+1;
      |                    ~~~~^~~
a.cc:22:24: error: no match for call to '(std::vector<int>) (int&)'
   22 |       csum.at(i+1)=csum(i);
      |                    ~~~~^~~
a.cc:28:58: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to binary 'operator<<'
   28 |     if(s.at(l.at(i)-1)=='A' && s.at(l.at(i))=='T') count << csum.at(r.at(i))-csum.at(l.at(i)+1) << endl;
      |                                                    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:16: error: invalid operands of types '<unresolved overloaded function type>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to binary 'operator<<'
   29 |     else count << csum.at(r.at(i))-csum.at(l.at(i)) << endl;
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: Java

import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n1 = sc.nextInt();
    int n2 = sc.nextInt();
    int c1 = 0,c2 = 0;
    String s = sc.next();
    int count=0;
    boolean ac = false;
    for(int l = 0;l < n2;l++){
      c1 = sc.nextInt();
      c2 = sc.nextInt();
      for(int i = c1-1;i < c2-1;i++){
        if(s.charAt(i)=='A'&&s.charAt(i)=='C'){
          count++;
        }
      System.out.println(count);
      count = 0;
    }
  }
}

Compiler output:
Main.java:22: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
int main() {
  int n,q;
  cin >> n >> q;
  string str;
  cin >> str;
  vector<int> s(n+1,0);
  for(int i=0; i<n; i++) {
    if(s[i]=='A'&&s[i+1]=='C'&&i+1<n) {
      s[i+1]=s[i]+1;
    }
    else {
      s[i+1]=s[i];
    }
  }
  for(int i=0; i<q; i++) {
    int l,r;
    cin >> l >> r;
    cout << s[r-1]-s[l-1] << endl;
  }


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

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,q;
  cin >> n >> q;
  string str;
  cin >> str;
  vector<int> s(n+1,0);
  for(int i=0; i<n; i++) {
    if(s[i]=='A'&&s[i+1]=='C'&&i+1<n) {
      s[i+1]=s[i]+1;
    }
    else {
      s[i+1]=s[i];
    }
  }
  for(int i=0; i<q; i++) {
    int l,r;
    cin >> l >> r;
    cout << s[r-1]-s[l-1] << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<int> s(n+1,0);
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include<cmath>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> s(n+1,0);
      |          ^~~
a.cc:12:8: error: 's' was not declared in this scope
   12 |     if(s[i]=='A'&&s[i+1]=='C'&&i+1<n) {
      |        ^
a.cc:22:13: error: 's' was not declared in this scope
   22 |     cout << s[r-1]-s[l-1] << endl;
      |             ^
a.cc:23:4: error: expected '}' at end of input
   23 |   }
      |    ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C

#include <stdio.h>
#include <string.h>

int main(){
	int N,Q;
	char S[100001];
	int l[100000] = {};
	int r[100000] = {};
	int ans[100000] = {};
	scanf("%d %d",&N,&Q);
	scanf("%s",S);
	for(int i = 0; i < N; i++){
		scanf("%d %d",&l[i],&r[i]);
	}

	int temp = 0;

	while(temp < N){
		for(int i = l[temp] - 1; i < r[temp]; i ++){
			if(S[i] == 'A' && S[i +1] == 'C'){
				ans[temp] ++;
			}
		}
		temp ++;
	}

	
	for(int i = 0; i < n; i ++){
		printf("%d\n",ans[i]);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:28:28: error: 'n' undeclared (first use in this function)
   28 |         for(int i = 0; i < n; i ++){
      |                            ^
main.c:28:28: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <string>  
using namespace std;
 
int main(){
  int N,Q,sum;
  int l[Q],r[Q],a[N];
  char S[200000];
  scanf("%d,%d,%s",N,Q,S);
	for (int i==0;i<Q;i++){
    	scanf("%d %d",l[i],r[i]);
    }
  for (i ==0;i <N-1;i++){
  	if (S[i] + S[i+1] == "AC") a[i] ==1;
    else a[i] = 0;
  }
  for (i=0;i<Q;i++){
  	sum = 0;
    for (int j =l[i];j<r[i]-1;j++){
    	sum += a[j];
    }
    printf("%d\n",sum);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: expected ';' before '==' token
   10 |         for (int i==0;i<Q;i++){
      |                   ^~
      |                   ;
a.cc:10:19: error: expected primary-expression before '==' token
   10 |         for (int i==0;i<Q;i++){
      |                   ^~
a.cc:10:26: error: expected ')' before ';' token
   10 |         for (int i==0;i<Q;i++){
      |             ~            ^
      |                          )
a.cc:10:27: error: 'i' was not declared in this scope
   10 |         for (int i==0;i<Q;i++){
      |                           ^
Language: C++

#include <iostream>
#include <string>  
using namespace std;
 
int main(){
  int N,Q;
  int l[Q],r[Q],a[N];
  char S[200000];
  scanf("%d,%d,%s",N,Q,S);
	for (int i==0;i<Q;i++){
    	scanf("%d %d",l[i],r[i]);
    }
  for (i ==0;i <N-1;i++){
  	if (S[i] + S[i+1] == "AC") a[i] ==1;
    else a[i] = 0;
  }
  for (i=0;i<Q;i++){
  	sum = 0;
    for (int j =l[i];j<r[i]-1;j++){
    	sum += a[j];
    }
    printf("%d\n",sum);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: expected ';' before '==' token
   10 |         for (int i==0;i<Q;i++){
      |                   ^~
      |                   ;
a.cc:10:19: error: expected primary-expression before '==' token
   10 |         for (int i==0;i<Q;i++){
      |                   ^~
a.cc:10:26: error: expected ')' before ';' token
   10 |         for (int i==0;i<Q;i++){
      |             ~            ^
      |                          )
a.cc:10:27: error: 'i' was not declared in this scope
   10 |         for (int i==0;i<Q;i++){
      |                           ^
a.cc:18:9: error: 'sum' was not declared in this scope
   18 |         sum = 0;
      |         ^~~
Language: C

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int N,Q;
	scanf("%d %d",&N,&Q);
	getchar();

	char *S;
	S = (char *) malloc(sizeof(char) * (N+1));
	scanf("%s",S);

	char *t;
	t = (char *) calloc(N+1,sizeof(char));

	for ( int i = 0; i < N; i++ ) {
		if ( S[i] == 'A' && S[i+1] == 'C' ) {
			t[i+1] = t[i] +  1;
		} else {
			t[i+1] = t[i];
		}
	}

	int l,r;
	int *ans;
	ans = (int *) malloc(sizeof(int) * Q);
	for ( int i = 0; i < Q; i++ ) {
		scanf("%d %d",&l,&r);
		ans[i] = t[r-1] - t[l-1];
	}

	for ( int i = 0; i < Q; i++ ) {
		printf("%d\n",ans[i]);
	}

	free(S);
	free(t);
	free(ans);
	return 0;


Compiler output:
main.c: In function 'main':
main.c:40:9: error: expected declaration or statement at end of input
   40 |         return 0;
      |         ^~~~~~
Language: C

#include<stdio.h>

int kotae(char);

int main(){
  int n,q,i,j,l,r;
  scanf("%d%d",&n,&q);
  char s[n+1];
  scanf("%s",s);
  
  for(k=0;k<q;k++){
    scanf("%d%d",&l,&r);
    j=0;
    for(i=l-1;i<r;i++){
      if(s[i]=='A'&&s[i+1]=='C'){
        j++;
      }
    }
  printf("%d",j);
  }
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:7: error: 'k' undeclared (first use in this function)
   11 |   for(k=0;k<q;k++){
      |       ^
main.c:11:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

n , m = map(int , input().split())
s = str(input())

for _ in range(m):
    l , r = map(int ,input().split())
    st = s[l - 1:r]
    print(st.count("AC"))

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n , m = map(int , input().split())
      | ^
Language: C

#include <stdio.h>

int main(){
	int n,q,i,j,flag,count,l[100000],r[1000000];
	char s[100000];
	scanf("%d", &n);
	scanf("%d", &q);
	scanf("%s", s);
	for (i = 0; i < q; i++) {
		scanf_s("%d", &l[i]);
		scanf_s("%d", &r[i]);
	}
	for (i = 0; i < q; i++) {
		flag = 0;
		count = 0;
		for (j = l[i]; j < r[i]; j++) {
			if (flag == 0 && s[j] == 'A') flag = 1;
			else if (flag == 1 && s[j] == 'C') count++;
			else flag = 0;
		}
		printf("%d", count);
	}
}

Compiler output:
main.c: In function 'main':
main.c:10:17: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   10 |                 scanf_s("%d", &l[i]);
      |                 ^~~~~~~
      |                 scanf
Language: C++

n,q=map(int,input().split())
s=input()
l=[0]*q
r=[0]*q
c=[0]*q
for i in range(q):
    l[i],r[i]=map(int,input().split())
for i in range(q):
    for j in range(l[i],r[i]):
        if s[j-1]=='A' and s[j]=='C':
            c[i]+=1
for i in range(q):
    print(c[i])


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,q=map(int,input().split())
      | ^
Language: C++

ツボ
 n,q=map(int,input().split())
s=input()
l=[0]*q
r=[0]*q
c=[0]*q
for i in range(q):
    l[i],r[i]=map(int,input().split())
for i in range(q):
    for j in range(l[i],r[i]):
        if s[j-1]=='A' and s[j]=='C':
            c[i]+=1
for i in range(q):
    print(c[i])

Compiler output:
a.cc:1:1: error: '\U000030c4\U000030dc' does not name a type
    1 | ツボ
      | ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <math.h>

using namespace std;


vector<long> ans;


long check_start(long start,long end, long x,long y) {

	if (start == end) return start;
	if (end - start == 1) {
		if ((ans[start] >= x) && (ans[start] + 1 <= y)) return start;
		else return end;
	}
	long s = (start + end) / 2;

	if ((ans[s] >= x) && (ans[s] + 1 <= y)) {
		return check_start(start, s, x, y);
	}
	else {
		return check_start(s+1, end, x, y);
	}
}


long check_end(long start, long end, long x, long y) {

	if (start == end) return start;
	if (end - start == 1) {
		if ((ans[end] >= x) && (ans[end] + 1 <= y)) return end;
		else return start;
	}

	long s = (start + end) / 2;

	if ((ans[s] >= x) && (ans[s] + 1 <= y)) {
		return check_end(s, end, x, y);
	}
	else {
		return check_end(start, s-1, x, y);
	}
}

int main()
{
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	long answer;


	for (long i = 0; i < s.length() - 1; i++) {
		if (s.substr(i, 1) == "A") {
			if (s.substr(i + 1, 1) == "C") {
				i++; ans.push_back(i);
			}
		}
	}

	for (long i = 0; i < q; i++) {
		long x, y;
		cin >> x >> y;
		answer = check_end(0, ans.size() - 1, x, y) - check_start(0, ans.size() - 1, x, y) + 1;
		if (answer < 0) answer = 0;
		cout << answer << endl;
	}

	return 0;


Compiler output:
a.cc: In function 'int main()':
a.cc:73:18: error: expected '}' at end of input
   73 |         return 0;
      |                  ^
a.cc:49:1: note: to match this '{'
   49 | {
      | ^
Language: C++

function Main(input){
  
  var str = input.trim().split("\n");
  var nq = str[0].split(" ");
  var n = nq[0];
  var q = nq[1];
  var s = str[1];
  var lr = str;
  lr.splice(0,2);
  
  //console.log("l:"+lr[0].split(" ")[0]);
  //console.log("l:"+lr[0].split(" ")[1]);  
  
  var s = s.replace(/AC/g,"aC");
  
//console.log("S:"+s);  
  
  for(i=0;i<q;i++){
      var kaisu = 0;
    var tmps = s.substring(lr[i].split(" ")[0]-1,lr[i].split(" ")[1]);
    var kaisu = str_count(tmps,"a");
    console.log(kaisu);
    
  }//for end
  
  function str_count(all, part) {
    return (all.match(new RegExp(part, "g")) || []).length;
}
  
    
}//function end
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Compiler output:
a.cc:1:1: error: 'function' does not name a type; did you mean 'union'?
    1 | function Main(input){
      | ^~~~~~~~
      | union
a.cc:33:5: error: expected constructor, destructor, or type conversion before '(' token
   33 | Main(require("fs").readFileSync("/dev/stdin", "utf8"));
      |     ^
Language: C++

/*
  #問題：
  


  #分析：
  #オブジェクト：
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <initializer_list>
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


const unsigned int BIT_FLAG_0 = (1<<0);
const unsigned int BIT_FLAG_1 = (1<<1);
const unsigned int BIT_FLAG_2 = (1<<2);
const unsigned int BIT_FLAG_3 = (1<<3);
const unsigned int BIT_FLAG_4 = (1<<4);
const unsigned int BIT_FLAG_5 = (1<<5);
const unsigned int BIT_FLAG_6 = (1<<6);
const unsigned int BIT_FLAG_7 = (1<<7);


#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;

#define unless(x)   if(!(x))

int main(void){
  int N; cin>>N;                // Nは10^5以下．NはSの長さ．
  int Q; cin>>Q;                // Qも10^5以下．Qは質問の個数を表す．

  string S;                     // Sの長さはN．
  cin>>S;                       // 考察対象の文字列Sを読み込む．
  S=S+"#";

  
  // map<int,int> index_mp;
  vector<int> index_mp(100000,0);
  int now_x =0;
  // cerr<<"i: "<<0<<"  index_mp[i]: "<<index_mp[0]<<endl;
  FOR(i,1,N){
    if(S[i-1]=='A'&&S[i]=='C'){
      index_mp[i] = now_x+1;
      now_x=index_mp[i];    // now_xは「計算時退避用変数」
      
    }else{
      index_mp[i] = now_x;
    }
    // unless(i==N)  cerr<<"i: "<<i<<"  index_mp[i]: "<<index_mp[i]<<endl;
  }
  

  


  
  int left,right;
  FOR(i,0,Q){
    cin>>left>>right;
    left--; right--;
    cout<<index_mp[right]-index_mp[left]<<endl;
  }

  
  return 0;
}



Compiler output:
a.cc:68:10: fatal error: boost/multiprecision/cpp_dec_float.hpp: No such file or directory
   68 | #include <boost/multiprecision/cpp_dec_float.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int q = in.nextInt();
		String s = in.next();

		int[] t = new int[n/2];
		for(int i=0; i<n; i++) {
			String sub = s.substring(i);
			t[i+1] = t[i] + (sub.indexOf("AC")>=0 ? 1:0);
		}

		for(int j=0; j<q; j++) {
			int l= nextInt();
			int r= nextInt();
			System.out.println(t[r-1]-t[l-1]);
		}

	}
}


Compiler output:
Main.java:20: error: cannot find symbol
			int l= nextInt();
			       ^
  symbol:   method nextInt()
  location: class Main
Main.java:21: error: cannot find symbol
			int r= nextInt();
			       ^
  symbol:   method nextInt()
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int q = in.nextInt();
		String s = in.next();

		int[] t = new int[n/2];
		for(int i=0; i<n; i++) {
			String sub = s.substring(i);
			t[i+1] = t[i] + (s.IndexOf("AC")>=0 ? 1:0);
		}

		for(int j=0; j<q; j++) {
			int l= nextInt();
			int r= nextInt();
			System.out.println(t[r-1]-t[l-1]);
		}

	}
}


Compiler output:
Main.java:16: error: cannot find symbol
			t[i+1] = t[i] + (s.IndexOf("AC")>=0 ? 1:0);
			                  ^
  symbol:   method IndexOf(String)
  location: variable s of type String
Main.java:20: error: cannot find symbol
			int l= nextInt();
			       ^
  symbol:   method nextInt()
  location: class Main
Main.java:21: error: cannot find symbol
			int r= nextInt();
			       ^
  symbol:   method nextInt()
  location: class Main
3 errors
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int q = in.nextInt();
		String s = in.next();

		int[] t = new int[n/2];
		for(int i=0; i<n; i++) {
			String sub = s.substring(i);
			t[i+1] = t[i] + (s.IndexOf("AC")>=0 ? 1:0)
		}

		for(int j=0; j<q; j++) {
			int l= nextInt();
			int r= nextInt();
			System.out.println(t[r-1]-t[l-1]);
		}

	}
}

Compiler output:
Main.java:16: error: ';' expected
			t[i+1] = t[i] + (s.IndexOf("AC")>=0 ? 1:0)
			                                          ^
1 error
Language: C++

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

int main(){
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  for(int i = 0; i < Q; i++){
    cin >> l[i] >> r[i];
  }
  
  vector<int> v(N);
  int now = 0;
  for(int i = 1; i < N; i++){
    if(S[i-1] == 'A' && S[i] == 'C'){
      now++;
      v[i] = now;
    }else{
      v[i] = v[i - 1];
    }
  }
  
  for(int i = 0; i < Q; i++){
    cout << v[r[i] - 1] - v[l[i] - 1] << endl;
  }
  
  
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:12: error: 'l' was not declared in this scope
   10 |     cin >> l[i] >> r[i];
      |            ^
a.cc:10:20: error: 'r' was not declared in this scope
   10 |     cin >> l[i] >> r[i];
      |                    ^
a.cc:25:15: error: 'r' was not declared in this scope
   25 |     cout << v[r[i] - 1] - v[l[i] - 1] << endl;
      |               ^
a.cc:25:29: error: 'l' was not declared in this scope
   25 |     cout << v[r[i] - 1] - v[l[i] - 1] << endl;
      |                             ^
Language: Java

class GeTAC {
	@SuppressWarnings("resource")
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int q=sc.nextInt();
		char moji[]=new char[n+1];//ENTERを含めて考える！！
		int count[]=new int[q];
		int ask[][]=new int [q][2];
		for(int i=0;i<n;i++) {
			moji[i]=(char)System.in.read();
			if(moji[i]=='\n')
				break;
		}
		for(int i=0;i<q;i++) {
			ask[i][0]=sc.nextInt();
			ask[i][1]=sc.nextInt();
		}

		int z=0;
		for(int j=0;j<q;j++,z++)
		for(int i=ask[z][0]-1;i<ask[z][1]-1;i++) {
			if(moji[i]=='A') {
				if(moji[i+1]=='C') {
				count[j]++;
				}
			}
		}
		for(int i=0;i<q;i++) {
			System.out.println(count[i]);
		}

	}
	}

Compiler output:
Main.java:3: error: cannot find symbol
	public static void main(String[] args) throws IOException {
	                                              ^
  symbol:   class IOException
  location: class GeTAC
Main.java:4: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class GeTAC
Main.java:4: error: cannot find symbol
		Scanner sc=new Scanner(System.in);
		               ^
  symbol:   class Scanner
  location: class GeTAC
3 errors
Language: Java

import java.io.IOException;
import java.util.Scanner;
public class GeTAC {
	@SuppressWarnings("resource")
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int q=sc.nextInt();
		char moji[]=new char[n+1];//ENTERを含めて考える！！
		int count[]=new int[q];
		int ask[][]=new int [q][2];
		for(int i=0;i<n;i++) {
			moji[i]=(char)System.in.read();
			if(moji[i]=='\n')
				break;
		}
		for(int i=0;i<q;i++) {
			ask[i][0]=sc.nextInt();
			ask[i][1]=sc.nextInt();
		}

		int z=0;
		for(int j=0;j<q;j++,z++)
		for(int i=ask[z][0]-1;i<ask[z][1]-1;i++) {
			if(moji[i]=='A') {
				if(moji[i+1]=='C') {
				count[j]++;
				}
			}
		}
		for(int i=0;i<q;i++) {
			System.out.println(count[i]);
		}

	}
	}

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

#include <iostream>
#include <algorithm>
#include <queue>
#include <list>
#include <string>
#include <windows.h>
using namespace std;

int main()
{
	int N,Q,l,r;
    bool flag = false;
	cin >> N >> Q;
    string s;
    int aclis[50000];
    int acindex = 0;
    cin >> s;
	for(int i=0;i<N;i++){
        if(flag){
            if(s[i] == 'C') {
                aclis[acindex] = i;
                acindex++;
            }
        }else{
            flag = false;
        }
        if(s[i] == 'A') flag = true;
    }
    int index[50000];
    for(int i=0;i<Q;i++){
        cin >> l >> r;
        for(int j=0;j<acindex;j++){
            if(l <= aclis[j] && r >= (aclis[j] + 1)) index[i]++;
        }
    }
    for(int i=0;i<Q;i++) cout << index[i] << endl;
}

Compiler output:
a.cc:6:10: fatal error: windows.h: No such file or directory
    6 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
using namespace std;

int main()
{

  int n,q,i,j,ac=0;
  cin >> n >> q;
  char c[n];
  cin >> c;
  int mondai[q][2];
  for(i=0;i<q;i++)
  {
  cin >> mondai[i][0] >> mondai[i][1];
  }
  
    for(i=0;i<q;i++)
  {
      
    for(j=mondai[i][0]-1;j=mondai[i][1]-2;j++)
  {
      
  if((char[j]=='A')&&(char[j+1]=='C'))
  {
  ac++;
  }
  
  }
      
      cout << ac << endl;
      ac = 0;
  }
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:7: error: expected primary-expression before 'char'
   23 |   if((char[j]=='A')&&(char[j+1]=='C'))
      |       ^~~~
a.cc:23:7: error: expected ')' before 'char'
   23 |   if((char[j]=='A')&&(char[j+1]=='C'))
      |      ~^~~~
      |       )
a.cc:26:4: error: expected ')' before '}' token
   26 |   }
      |    ^
      |    )
   27 | 
   28 |   }
      |   ~ 
a.cc:23:5: note: to match this '('
   23 |   if((char[j]=='A')&&(char[j+1]=='C'))
      |     ^
a.cc:28:3: error: expected primary-expression before '}' token
   28 |   }
      |   ^
Language: C++

program main
integer(8)::n,q,i
integer(8),allocatable::a(:)=0,l(:),r(:)
character(len=100000)::s

read*,n,q
allocate(a(n),r(q),l(q))
read*,s

do i=1,q
read*,l(i),r(i)
enddo

do i=1,n
if(s(i:i+1)=="AC") a(i+1)=1
enddo

do i=1,q
print"(i0)" sum(a(l(i),r(i)))
enddo

end program main

Compiler output:
a.cc:1:1: error: 'program' does not name a type
    1 | program main
      | ^~~~~~~
Language: C++

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

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

    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++){
        cin >> l[i] >> r[i];
    }

    vector<int> sum(N + 1, 0)

    for (int i = 1; i < N; i++){
        if(S[i-1] == 'A' && S[i] == 'C'){
            sum[i+1] = sum[i] + 1;
        }else{
            sum[i+1] = sum[i];
        }
    }

    for (int i = 0; i < Q; i++){
        int ans = sum[r[i]]-sum[l[i]];
        cout << ans << endl;
    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected ',' or ';' before 'for'
   17 |     for (int i = 1; i < N; i++){
      |     ^~~
a.cc:17:21: error: 'i' was not declared in this scope
   17 |     for (int i = 1; i < N; i++){
      |                     ^
Language: C++

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

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

    vector<int> l(Q), r(Q);
    for (int i = 0; i < Q; i++){
        cin >> l[i] >> r[i];
    }

    int N = S.size();
    vector<int> sum(N + 1, 0)

    for (int i = 1; i < N; i++){
        if(S[i-1] == 'A' && S[i] == 'C'){
            sum[i+1] = sum[i] + 1;
        }else{
            sum[i+1] = sum[i];
        }
    }

    for (int i = 0; i < Q; i++){
        int ans = sum[r[i]]-sum[l[i]];
        cout << ans << endl;
    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: redeclaration of 'int N'
   15 |     int N = S.size();
      |         ^
a.cc:5:9: note: 'int N' previously declared here
    5 |     int N,Q;
      |         ^
a.cc:18:5: error: expected ',' or ';' before 'for'
   18 |     for (int i = 1; i < N; i++){
      |     ^~~
a.cc:18:21: error: 'i' was not declared in this scope
   18 |     for (int i = 1; i < N; i++){
      |                     ^
Language: C++

#include <iostrem>
#include <string>
using namespace std;

int main(){
    int N, Q;
    int occurence[N+1];
    string S;
    cin >> S;
    for(auto i=2;i<=N;++i){
        if(S.substr(i-2, 2)=="AC")
            occurence[i]=occurence[i-1]+1;
    }
    int answers[Q];
    for(auto i=0; i !=Q; ++i){
        size_t l, r;
        cin >> l >> r;
        answers[i] = occurence[r] - occurence[l];
    }
    for(auto i :answers)
        cout<<i<<endl;
}

Compiler output:
a.cc:1:10: fatal error: iostrem: No such file or directory
    1 | #include <iostrem>
      |          ^~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] $) {
        Scanner sc=new Scanner();
        int n = sc.nextInt(), q = sc.nextInt();
        String s = sc.next();
        int[] AC = new int[n + 1];
        for (int i = 1; i < n; i++) {
            if (s.charAt(i - 1) == 'A' && s.charAt(i) == 'C') {
                AC[i] = 1;
            }
        }
        for (int i = 1; i < n + 1; i++) {
            AC[i] += AC[i - 1];
        }
        for (int i = 0; i < q; i++) {
            int l = sc.nextInt(), r = sc.nextInt();
            int k = 0;
            if (r < n && s.charAt(r - 1) == 'A' && s.charAt(r) == 'C') k++;

            out.println(max(0, AC[r] - AC[l - 1] - k));
        }
        out.close();
    }
}


Compiler output:
Main.java:7: error: no suitable constructor found for Scanner(no arguments)
        Scanner sc=new Scanner();
                   ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
1 error
Language: C++

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

int main(){
	int N, Q, last;
  	vector<int> counts;
  	string S;
  	string ac = "AC";
  	last = 0
	cin >> N;
  	cin >> Q;
  	cin >> S;
  	while(true){
    	int num = (int)S.ac(ac, last);
      	if(num == -1){
          	break;
        } else {
        	counts.push_back(num);
          	last = num;
        }
    }
  	for(int i=0; i<Q; i++){
      	int l, r;
    	cin >> l;
      	cin >> r;
      	int some = 0;
      	for(auto j : counts){
        	if(l - 1 <= j){
              	some++;
            }else if(r - 1 <= j){
            	break;
            }
        }
      	cout << some << endl;
    }
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:17: error: expected ';' before 'cin'
   11 |         last = 0
      |                 ^
      |                 ;
   12 |         cin >> N;
      |         ~~~      
a.cc:16:26: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'ac'; did you mean 'at'?
   16 |         int num = (int)S.ac(ac, last);
      |                          ^~
      |                          at
Language: C++

#include <iostream>
#include <vector>
#include <string>
typedef long long int ll;
using namespace std;
#define rep(i,N) for(ll i=0;i<N;i++)
#define rep2(i,j,k) for(ll i=j; i<k;i++)

int main(){
    ll N,Q;
    string s;
    cin>>N>>Q>>s;
    vl l(Q),r(Q);
    rep(i,Q){
        cin>>l[i]>>r[i];
    }
    
    vl acc_sum(N);
    ll acc=0;
    rep2(i,1,N){
        if(s[i-1]=='A' && s[i]=='C'){
            acc++;
        }
        acc_sum[i]=acc;
    }
    
    rep(i,Q){
        cout<<acc_sum[r[i]-1]-acc_sum[l[i]-1]<<endl;
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'vl' was not declared in this scope; did you mean 'll'?
   13 |     vl l(Q),r(Q);
      |     ^~
      |     ll
a.cc:15:14: error: 'l' was not declared in this scope
   15 |         cin>>l[i]>>r[i];
      |              ^
a.cc:15:20: error: 'r' was not declared in this scope
   15 |         cin>>l[i]>>r[i];
      |                    ^
a.cc:18:7: error: expected ';' before 'acc_sum'
   18 |     vl acc_sum(N);
      |       ^~~~~~~~
      |       ;
a.cc:24:9: error: 'acc_sum' was not declared in this scope
   24 |         acc_sum[i]=acc;
      |         ^~~~~~~
a.cc:28:15: error: 'acc_sum' was not declared in this scope
   28 |         cout<<acc_sum[r[i]-1]-acc_sum[l[i]-1]<<endl;
      |               ^~~~~~~
a.cc:28:23: error: 'r' was not declared in this scope
   28 |         cout<<acc_sum[r[i]-1]-acc_sum[l[i]-1]<<endl;
      |                       ^
a.cc:28:39: error: 'l' was not declared in this scope
   28 |         cout<<acc_sum[r[i]-1]-acc_sum[l[i]-1]<<endl;
      |                                       ^
Language: Java

pac
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();
		int Q=sc.nextInt();
		String str=sc.next();
		String check="AC";

		int[] ans=new int[3];

		for(int q=0;q<Q;q++) {

			int start=sc.nextInt()-1;
			int end=sc.nextInt();

			String str2=str.substring(start, end);

			int count=0;
			int index=0;

			while(true) {

				index=str2.indexOf(check,index);

				if(index==-1) break;

				index++;
				count++;

			}

			ans[q]=count;

		}

		for(int q=0;q<Q;q++) System.out.println(ans[q]);

		sc.close();

	}

}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
pac
^
1 error
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;

int main(){
  int N,Q,l,r;
  int AC_count;
  string S = "";
  cin >> N >> Q;
  cin >> S;
  for(int loop=0; loop<Q; loop++){
    scanf("%d%d",&l,&r);
  	AC_count = 0;
  	for(int i=l-1; i<r-1; i++){
    	if(S[i]=='A'){
          if(S[i+1] == 'C' )
          AC_count++;
          i++
        }
    }
    printf("%d\n",AC_count);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: expected ';' before '}' token
   18 |           i++
      |              ^
      |              ;
   19 |         }
      |         ~
Language: Java

import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int Q = sc.nextInt();
    String S = sc.next();
    int[] ls = new int[Q];
    int[] rs = new int[Q];
    for (int i = 0; i < Q; i++) {
      ls[i] = sc.nextInt();
      rs[i] = sc.nextInt();
    }
    
    int[] ruisekiwa = new int[N];
    int ruiseki = 0;
    for (int i = 0; i < N-1; i++) {
      if (S.charAt(i) == 'A' && S.charAt(i+1) == 'C')
        ruiseki++;
      ruisekiwa[i] = ruiseki;
    }
    ruisekiwa[N-1] = ruiseki;
    
   
    for (int i = 0; i < Q; i++) {
      Acnum = ruisekiwa[rs[i]-1] - ruisekiwa[ls[i]];
      System.out.println(Acnum);
    }
    
  }
}


Compiler output:
Main.java:26: error: cannot find symbol
      Acnum = ruisekiwa[rs[i]-1] - ruisekiwa[ls[i]];
      ^
  symbol:   variable Acnum
  location: class Main
Main.java:27: error: cannot find symbol
      System.out.println(Acnum);
                         ^
  symbol:   variable Acnum
  location: class Main
2 errors