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

import java.util.Scanner;

public class ProblemC {
	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[] l = new int[Q];
		int[] r = new int[Q];
		for(int i = 0; i < Q; i++) {
			l[i] = sc.nextInt();
			r[i] = sc.nextInt();
		}
		sc.close();
		int[] a = new int[N + 1];
		for(int i = 1; i < N; i++) {
			if(S.charAt(i) == 'C' && S.charAt(i - i) == 'A') {
				a[i] += a[i - 1] + 1;
				continue;
			}
			a[i] = a[i - 1];
		}
		a[N] = a[N - 1];
		for(int i = 0; i < Q; i++) {
			System.out.println(a[r[i] - 1] - a[l[i] - 1]);
		}
//		for(int i = 0; i <= N; i++) {
//			System.out.println(i +" " + a[i]);
//		}
	}
}

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

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

#define LL long long

using namespace std;

int main(void){

    LL n, q, count = 0;
    string s;
  
    cin >> n >> q;
    cin >> s;

    LL list[n] = {0}

    for (LL i = 1; i < n; i++){
        if(s[i - 1] == 'A' && s[i] == 'C'){
            count++;
        }
        list[i] = count;
    }

    for (LL i = 0; i < q; i++){
        LL a, b;
        cin >> a >> b;
        cout << list[b - 1] - list[a - 1] << endl;
    }
    return 0;
}




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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: 'vector' was not declared in this scope
   10 |   vector<int> v(s.size()+1);
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <algorithm>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> v(s.size()+1);
      |          ^~~
a.cc:12:41: error: 'v' was not declared in this scope
   12 |     if (s[j-2] == 'A' && s[j-1] == 'C') v[j] = v[j-1]+1;
      |                                         ^
a.cc:13:10: error: 'v' was not declared in this scope
   13 |     else v[j] = v[j-1];
      |          ^
a.cc:19:13: error: 'v' was not declared in this scope
   19 |     cout << v[r]-v[l] << "\n";
      |             ^
Language: C

#include<stdio.h>
2. 
3.int main() {
4.	char str[100001];
5.	int acs[100000];
6.	int N, Q, i,init, end,ct=0,flag=0;
7.	scanf("%d %d", &N, &Q);
8.	scanf("%s", str);
9.	for (i = 0; i < N; i++) {
10.		if (str[i] == 'A') { flag = 1; }
11.		else { if (str[i] == 'C'&&flag == 1) { ct++; }flag = 0; }
12.		acs[i] = ct;
13.	}
14.	for (i = 0; i < Q; i++) {
15.		scanf("%d %d", &init, &end);
16.		printf("%d\n", acs[end-1] - acs[init-1]);
17.	}
18.	return 0;
19.}



Compiler output:
main.c:2:1: error: expected identifier or '(' before numeric constant
    2 | 2.
      | ^~
main.c:3:1: error: invalid suffix "int" on floating constant
    3 | 3.int main() {
      | ^~~~~
Language: C

#include<stdio.h>
2. 
3.int main() {
4.	char str[100001];
5.	int acs[100000];
6.	int N, Q, i,init, end,ct=0,flag=0;
7.	scanf("%d %d", &N, &Q);
8.	scanf("%s", str);
9.	for (i = 0; i < N; i++) {
10.		if (str[i] == 'A') { flag = 1; }
11.		else { if (str[i] == 'C'&&flag == 1) { ct++; }flag = 0; }
12.		acs[i] = ct;
13.	}
14.	for (i = 0; i < Q; i++) {
15.		scanf("%d %d", &init, &end);
16.		printf("%d\n", acs[end-1] - acs[init-1]);
17.	}
18.	return 0;
19.}

#include<stdio.h>

int main() {
	char str[100001];
	int acs[100000];
	int N, Q, i,init, end,ct=0,flag=0;
	scanf("%d %d", &N, &Q);
	scanf("%s", str);
	for (i = 0; i < N; i++) {
		if (str[i] == 'A') { flag = 1; }
		else { if (str[i] == 'C'&&flag == 1) { ct++; }flag = 0; }
		acs[i] = ct;
	}
	for (i = 0; i < Q; i++) {
		scanf("%d %d", &init, &end);
		printf("%d\n", acs[end-1] - acs[init-1]);
	}
	return 0;
}

提出情報

Compiler output:
main.c:2:1: error: expected identifier or '(' before numeric constant
    2 | 2.
      | ^~
main.c:3:1: error: invalid suffix "int" on floating constant
    3 | 3.int main() {
      | ^~~~~
main.c:41:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
   41 | 提出情報
      | ^~~~~~~~
Language: C++

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

int main(){
	
	cin >> N >> Q;
	cin >> S;
	vector<int> l(Q);
	vector<int> r(Q);
	for (int i = 0; i < Q; i++) {
		cin >> l.at(i) >> r.at(i);
	}
	
	int tmp = 0;
	if (S.size() > 1) {
		for (int i = 0; i < S.size(); i++) {
			AC.push_back(tmp);
			if (S.at(i) == 'A' && S.at(i + 1) == 'C') {
				tmp++;
			}
		}
	}

	for (int i = 0; i < Q; i++) {
		if (S.size() > 1) {
			cout << AC.at(r.at(i) - 1) - AC.at(l.at(i) - 1) << endl;
		}
		else {
			cout << 0 << endl;
		}
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: 'N' was not declared in this scope
    6 |         cin >> N >> Q;
      |                ^
a.cc:6:21: error: 'Q' was not declared in this scope
    6 |         cin >> N >> Q;
      |                     ^
a.cc:7:16: error: 'S' was not declared in this scope
    7 |         cin >> S;
      |                ^
a.cc:17:25: error: 'AC' was not declared in this scope
   17 |                         AC.push_back(tmp);
      |                         ^~
a.cc:26:33: error: 'AC' was not declared in this scope
   26 |                         cout << AC.at(r.at(i) - 1) - AC.at(l.at(i) - 1) << endl;
      |                                 ^~
Language: C++






N,Q = map(int,input().split())
S = []
for c in str(input()):
    S.append(c)

'''for i in range(Q):
    l, r = map(int, input().split())
    count = 0
    for i in range(len(S[int(l-1):int(r)])-1):
        if (S[int(l-1):int(r)][i] == "A"):
            if (S[int(l-1):int(r)][i+1] == "C"):
                count += 1
    print(count)'''

a = []
for i in range(N-1):
    if (S[i] == "A")and(S[i+1] == "C"):
        a.append(1)
    else:
        a.append(0)
print(a)
for i in range(Q):
    l, r = map(int, input().split())
    print(sum(a[l-1:r-1]))

        
    
            
        
    
    
    





Compiler output:
a.cc:11:1: error: empty character constant
   11 | '''for i in range(Q):
      | ^~
a.cc:11:3: warning: missing terminating ' character
   11 | '''for i in range(Q):
      |   ^
a.cc:11:3: error: missing terminating ' character
   11 | '''for i in range(Q):
      |   ^~~~~~~~~~~~~~~~~~~
a.cc:18:17: error: empty character constant
   18 |     print(count)'''
      |                 ^~
a.cc:18:19: warning: missing terminating ' character
   18 |     print(count)'''
      |                   ^
a.cc:18:19: error: missing terminating ' character
a.cc:6:1: error: 'N' does not name a type
    6 | N,Q = map(int,input().split())
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
    int n, q, l, r;
    string s;

    cin >> n >> q >> s;
    vector<int> data(n+1, 0);
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'A' && s[i] == 'C'){
            data[i] += 1;
        }
        data[i] += data[i-1]; 
    }
    data[n] += data[n-1]; 

    for(int i = 0; i < q; i++){
        scanf("%d%d", &l, &r);
        printf("%d", data[r-1] - data[l-1])
    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:44: error: expected ';' before '}' token
   22 |         printf("%d", data[r-1] - data[l-1])
      |                                            ^
      |                                            ;
   23 |     }
      |     ~
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N,Q;
  cin>>N>>Q;
  char S[N];
  int T[N];
  int L[Q],R[Q];
  for(int i=0; i<N; ++i) T[i]=0;
  for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
  for(int i=0; i<N-1; ++i){
    if(S[i]=='A' && S[i+1]=='C') S[i]='a';
  }
  for(int i=0; i<N; ++i){
    for(j=0; j<=i; ++j){
      if(S[j]=='a') T[i]+=1;
    }
  }
  for(int i=0; i<N; ++i){
    cout<<T[R[i]]-T[L[i]-1]<<endl;
  }
}


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

#include<iostream>
using namespace std;

int main(){
  int N,Q;
  cin>>N>>Q;
  char S[N];
  int T[N];
  int L[Q],R[Q];
  for(int i=0; i<N; ++i) T[i]=0;
  for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
  for(int i=0; i<N-1; ++i){
    if(S[i]='A' && S[i+1]='C') S[i]='a';
  }
  for(int i=0; i<N; ++i){
    for(j=0; j<=i; ++j){
      if(S[j]=='a') T[i]+=1;
    }
  }
  for(int i=0; i<N; ++i){
    cout<<T[R[i]]-T[L[i]-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: lvalue required as left operand of assignment
   13 |     if(S[i]='A' && S[i+1]='C') S[i]='a';
      |             ~~~~^~~~~~~~~
a.cc:16:9: error: 'j' was not declared in this scope
   16 |     for(j=0; j<=i; ++j){
      |         ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int N,Q;
  cin>>N>>Q;
  char S[N];
  int T[N];
  int L[i],R[i];
  for(int i=0; i<N; ++i) T[i]=0;
  for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
  for(int i=0; i<N-1; ++i){
    if(S[i]='A' && S[i+1]='C') S[i]='a';
  }
  for(int i=0; i<N; ++i){
    for(j=0; j<=i; ++j){
      if(S[j]=='a') T[i]+=1;
    }
  }
  for(int i=0; i<N; ++i){
    cout<<T[R[i]]-T[L[i]-1]<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'i' was not declared in this scope
    9 |   int L[i],R[i];
      |         ^
a.cc:11:31: error: 'L' was not declared in this scope
   11 |   for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
      |                               ^
a.cc:11:37: error: 'R' was not declared in this scope
   11 |   for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
      |                                     ^
a.cc:13:17: error: lvalue required as left operand of assignment
   13 |     if(S[i]='A' && S[i+1]='C') S[i]='a';
      |             ~~~~^~~~~~~~~
a.cc:16:9: error: 'j' was not declared in this scope
   16 |     for(j=0; j<=i; ++j){
      |         ^
a.cc:21:13: error: 'R' was not declared in this scope
   21 |     cout<<T[R[i]]-T[L[i]-1]<<endl;
      |             ^
a.cc:21:21: error: 'L' was not declared in this scope
   21 |     cout<<T[R[i]]-T[L[i]-1]<<endl;
      |                     ^
Language: C++

#include "builtin.hpp"
#include "main.hpp"

namespace __main__ {

str *const_0, *const_1;


list<__ss_int> *__6, *answer;
list<list<void *> *> *l_r;
list<void *> *length;
void *__2, *__3, *__4, *__5, *__7, *i, *n, *part_str, *string;
str *__name__;


static inline list<list<void *> *> *list_comp_0();

static inline list<list<void *> *> *list_comp_0() {
    void *__0, *__1, *i;

    list<list<void *> *> *__ss_result = new list<list<void *> *>();

    FAST_FOR(i,0,length->__getfast__(1),1,0,1)
        __ss_result->append((new list<void *>(map(1, __lambda1__, ()->split()))));
    END_FOR

    return __ss_result;
}

void __init() {
    const_0 = __char_cache[65];;
    const_1 = __char_cache[67];;

    __name__ = new str("__main__");

    length = (new list<void *>(map(1, __lambda0__, ()->split())));
    string = ;
    l_r = list_comp_0();
    answer = (new list<__ss_int>());

    FAST_FOR(i,0,length->__getfast__(1),1,2,3)
        part_str = string->__slice__();

        FAST_FOR(n,0,len(part_str),1,4,5)
            answer->append(0);
            if (__eq(part_str->__getfast__(), const_0)) {
                if (__ne(n, (len(part_str))->__sub__(1))) {
                    if (__eq(part_str->__getfast__(), const_1)) {
                        __6 = answer;
                        __7 = i;
                        __6->__setitem__(__7, ((__ss_int )(__6->__getfast__(__7))->__iadd__(1)));
                    }
                }
            }
        END_FOR

        print2(NULL,0,1, answer->__getfast__(i));
    END_FOR

}

} // module namespace

int main(int, char **) {
    __shedskin__::__init();
    __shedskin__::__start(__main__::__init);
}


Compiler output:
a.cc:1:10: fatal error: builtin.hpp: No such file or directory
    1 | #include "builtin.hpp"
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,q,l,r;
string s,ls,tmp;
  cin >> n >> q >> s;
  
for (int i=0;i<n-1;i++){
  tmp=s.substr(a,a+2)
  if (tmp=="AC")ls+="#";
  else ls+=".";
}
for (int que=0;que<q;que++):
  cin >> l >> r;
  tmp=ls.substr(l-1:r-1)
  print(replace(tmp.begin(),tmp.end(),".","").length())
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:16: error: 'a' was not declared in this scope
    9 |   tmp=s.substr(a,a+2)
      |                ^
a.cc:11:3: error: 'else' without a previous 'if'
   11 |   else ls+=".";
      |   ^~~~
a.cc:13:28: error: expected primary-expression before ':' token
   13 | for (int que=0;que<q;que++):
      |                            ^
a.cc:15:20: error: expected ')' before ':' token
   15 |   tmp=ls.substr(l-1:r-1)
      |                ~   ^
      |                    )
a.cc:15:25: error: expected ';' before 'print'
   15 |   tmp=ls.substr(l-1:r-1)
      |                         ^
      |                         ;
   16 |   print(replace(tmp.begin(),tmp.end(),".","").length())
      |   ~~~~~
Language: C++

#include<iostream>
using namespace std;

int main{
  int N,Q;
  cin>>N>>Q;
  char S[N];
  int T[N];
  int L[i],R[i];
  for(int i=0; i<N; ++i) T[i]=0;
  for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
  for(int i=0; i<N-1; ++i){
    if(S[i]='A' && S[i+1]='C') S[i]='a';
  }
  for(int i=0; i<N; ++i){
    for(j=0; j<=i; ++j){
      if(S[j]=='a') T[i]+=1;
    }
  }
  for(int i=0; i<N; ++i){
    cout<<T[R[i]]-T[L[i]-1]<<endl;
  }
}

Compiler output:
a.cc:4:5: error: cannot declare '::main' to be a global variable
    4 | int main{
      |     ^~~~
a.cc:5:3: error: expected primary-expression before 'int'
    5 |   int N,Q;
      |   ^~~
a.cc:5:3: error: expected '}' before 'int'
a.cc:4:9: note: to match this '{'
    4 | int main{
      |         ^
a.cc:6:3: error: 'cin' does not name a type
    6 |   cin>>N>>Q;
      |   ^~~
a.cc:7:10: error: 'N' was not declared in this scope
    7 |   char S[N];
      |          ^
a.cc:8:9: error: 'N' was not declared in this scope
    8 |   int T[N];
      |         ^
a.cc:9:9: error: 'i' was not declared in this scope
    9 |   int L[i],R[i];
      |         ^
a.cc:9:14: error: 'i' was not declared in this scope
    9 |   int L[i],R[i];
      |              ^
a.cc:10:3: error: expected unqualified-id before 'for'
   10 |   for(int i=0; i<N; ++i) T[i]=0;
      |   ^~~
a.cc:10:16: error: 'i' does not name a type
   10 |   for(int i=0; i<N; ++i) T[i]=0;
      |                ^
a.cc:10:21: error: expected unqualified-id before '++' token
   10 |   for(int i=0; i<N; ++i) T[i]=0;
      |                     ^~
a.cc:11:3: error: expected unqualified-id before 'for'
   11 |   for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
      |   ^~~
a.cc:11:16: error: 'i' does not name a type
   11 |   for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
      |                ^
a.cc:11:21: error: expected unqualified-id before '++' token
   11 |   for(int i=0; i<Q; ++i) cin>>L[i]>>R[i];
      |                     ^~
a.cc:12:3: error: expected unqualified-id before 'for'
   12 |   for(int i=0; i<N-1; ++i){
      |   ^~~
a.cc:12:16: error: 'i' does not name a type
   12 |   for(int i=0; i<N-1; ++i){
      |                ^
a.cc:12:23: error: expected unqualified-id before '++' token
   12 |   for(int i=0; i<N-1; ++i){
      |                       ^~
a.cc:15:3: error: expected unqualified-id before 'for'
   15 |   for(int i=0; i<N; ++i){
      |   ^~~
a.cc:15:16: error: 'i' does not name a type
   15 |   for(int i=0; i<N; ++i){
      |                ^
a.cc:15:21: error: expected unqualified-id before '++' token
   15 |   for(int i=0; i<N; ++i){
      |                     ^~
a.cc:20:3: error: expected unqualified-id before 'for'
   20 |   for(int i=0; i<N; ++i){
      |   ^~~
a.cc:20:16: error: 'i' does not name a type
   20 |   for(int i=0; i<N; ++i){
      |                ^
a.cc:20:21: error: expected unqualified-id before '++' token
   20 |   for(int i=0; i<N; ++i){
      |                     ^~
a.cc:23:1: error: expected declaration before '}' token
   23 | }
      | ^
Language: Java

N, Q = map(int, input().split())
2 S = input()
3 t = [0] * (N + 1)
4 for i in range(N):
5 t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
6 for i in range(Q):
7 l, r = map(int, input().split())
8 print(t[r-1] - t[l-1])

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
N, Q = map(int, input().split())
^
Main.java:5: error: unclosed character literal
5 t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
                                          ^
Main.java:5: error: unclosed character literal
5 t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
                                             ^
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int n,q,l,r;
string s,ls,tmp;
  cin >> n >> q >> s;
  
for (int i=0;i<n-1;i++){
  tmp=s[a:a+2]
  if (tmp=="AC")ls+="#";
  else ls+=".";
}
for (int que=0;que<q;i++):
  cin >> l >> r;
  tmp=ls[l-1:r-1]
  print(replace(tmp.begin(),tmp.end(),".","").length())
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:10: error: found ':' in nested-name-specifier, expected '::'
    9 |   tmp=s[a:a+2]
      |          ^
      |          ::
a.cc:9:9: error: 'a' has not been declared
    9 |   tmp=s[a:a+2]
      |         ^
a.cc:11:3: error: 'else' without a previous 'if'
   11 |   else ls+=".";
      |   ^~~~
a.cc:13:22: error: 'i' was not declared in this scope
   13 | for (int que=0;que<q;i++):
      |                      ^
a.cc:13:26: error: expected primary-expression before ':' token
   13 | for (int que=0;que<q;i++):
      |                          ^
a.cc:15:13: error: expected ']' before ':' token
   15 |   tmp=ls[l-1:r-1]
      |             ^
      |             ]
a.cc:15:13: error: expected ';' before ':' token
   15 |   tmp=ls[l-1:r-1]
      |             ^
      |             ;
Language: C++

#include <stdio.h>
using namespace std;
int main(){
int n,q,l,r;
string s,ls,tmp;
  cin >> n >> q >> s;
  
for (int i=0;i<n-1;i++){
  tmp=s[a:a+2]
  if (tmp=="AC")ls+="#";
  else ls+=".";
}
for (int que=0;que<q;i++):
  cin >> l >> r;
  tmp=ls[l-1:r-1]
  print(replace(tmp.begin(),tmp.end(),".","").length())
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:1: error: 'string' was not declared in this scope
    5 | string s,ls,tmp;
      | ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include <stdio.h>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> n >> q >> s;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <stdio.h>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:6:20: error: 's' was not declared in this scope
    6 |   cin >> n >> q >> s;
      |                    ^
a.cc:9:3: error: 'tmp' was not declared in this scope
    9 |   tmp=s[a:a+2]
      |   ^~~
a.cc:9:10: error: found ':' in nested-name-specifier, expected '::'
    9 |   tmp=s[a:a+2]
      |          ^
      |          ::
a.cc:9:9: error: 'a' has not been declared
    9 |   tmp=s[a:a+2]
      |         ^
a.cc:11:3: error: 'else' without a previous 'if'
   11 |   else ls+=".";
      |   ^~~~
a.cc:11:8: error: 'ls' was not declared in this scope; did you mean 'l'?
   11 |   else ls+=".";
      |        ^~
      |        l
a.cc:13:22: error: 'i' was not declared in this scope
   13 | for (int que=0;que<q;i++):
      |                      ^
a.cc:13:26: error: expected primary-expression before ':' token
   13 | for (int que=0;que<q;i++):
      |                          ^
a.cc:15:3: error: 'tmp' was not declared in this scope
   15 |   tmp=ls[l-1:r-1]
      |   ^~~
a.cc:15:7: error: 'ls' was not declared in this scope; did you mean 'l'?
   15 |   tmp=ls[l-1:r-1]
      |       ^~
      |       l
a.cc:15:13: error: expected ']' before ':' token
   15 |   tmp=ls[l-1:r-1]
      |             ^
      |             ]
Language: C++

#include <stdio>
using namespace std;
int main(){
int n,q,l,r;
string s,ls,tmp;
  cin >> n >> q >> s;
  
for (int i=0;i<n-1;i++){
  tmp=s[a:a+2]
  if (tmp=="AC")ls+="#";
  else ls+=".";
}
for (int que=0;que<q;i++):
  cin >> l >> r;
  tmp=ls[l-1:r-1]
  print(replace(tmp.begin(),tmp.end(),".","").length())
}


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

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        AC ac = new AC();
        int N = sc.nextInt();
        int Q = sc.nextInt();
        int answer = 0;
        int c;
        int d;
        String S = sc.next();
        int l[] = new int[Q];
        int r[] = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }
        for (int i = 0; i < Q; i++) {
            c = l[i]; 
            d = r[i];
            answer = AC.ans(c, d, S);
          System.out.println(answer);
        }
    }
    static class AC{
            int ans(int a, int b, String str){
                int count = 0;
                boolean f;
                for(int i = a - 1; i < b; i++){
                    if(str.charAt(i) == 'A'){
                        f = true;
                    }else if( i != a - 1 && f && str.charAt(i) == 'C'){
                        count++;
                    }else{
                        f = false;
                    }
                }
                return count;
            }
    }
}

Compiler output:
Main.java:22: error: non-static method ans(int,int,String) cannot be referenced from a static context
            answer = AC.ans(c, d, S);
                       ^
1 error
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        AC ac = new AC();
        int N = sc.nextInt();
        int Q = sc.nextInt();
        int answer = 0;
        int c;
        int d;
        String S = sc.next();
        int l[] = new int[Q];
        int r[] = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }
        for (int i = 0; i < Q; i++) {
            c = l[i]; 
            d = r[i];
            answer = AC.ans(c, d, S)
          System.out.println(answer);
        }
    }
    static class AC{
            int ans(int a, int b, String str){
                int count = 0;
                boolean f;
                for(int i = a - 1; i < b; i++){
                    if(str.charAt(i) == 'A'){
                        f = true;
                    }else if( i != a - 1 && f && str.charAt(i) == 'C'){
                        count++;
                    }else{
                        f = false;
                    }
                }
                return count;
            }
    }
}

Compiler output:
Main.java:22: error: ';' expected
            answer = AC.ans(c, d, S)
                                    ^
1 error
Language: C++

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

int main(){
  int N,Q;
  string S;
  cin >> N >> Q >> S;
  int l[N],r[N];
  for(int i=0;i<Q;i++){
    cin >> l[i] >> r[i];
  }
  
  string T[Q];
  for(int i=0;i<Q;i++){
    T[i]=S.substr(l[i]-1,r[i]-l[i]-2);
  }
  
  vector<int>vec(N/2-1);
  for(int i=0;i<N/2;i+=2){
    if(T.substr(i,2)=='AC'){
      vec[i]++;
    }
  }
  
  for(int i=0;i<vec.size();i++){
    cout << vec[i];
  }
}

Compiler output:
a.cc:20:23: warning: multi-character character constant [-Wmultichar]
   20 |     if(T.substr(i,2)=='AC'){
      |                       ^~~~
a.cc: In function 'int main()':
a.cc:20:10: error: request for member 'substr' in 'T', which is of non-class type 'std::string [Q]' {aka 'std::__cxx11::basic_string<char> [Q]'}
   20 |     if(T.substr(i,2)=='AC'){
      |          ^~~~~~
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        AC ac = new AC();
        int N = sc.nextInt();
        int Q = sc.nextInt();
        int answer = 0;
        int c;
        int d;
        String S = sc.next();
        int l[] = new int[Q];
        int r[] = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }
        for (int i = 0; i < Q; i++) {
            c = l[i]; 
            d = r[i];
            int answer = AC.ans(c, d, S);
          System.out.println(answer);
        }
    }
    static class AC{
            int ans(int a, int b, String str){
                int count = 0;
                boolean f;
                for(int i = a - 1; i < b; i++){
                    if(str.charAt(i) == 'A'){
                        f = true;
                    }else if( i != a - 1 && f && str.charAt(i) == 'C'){
                        count++;
                    }else{
                        f = false;
                    }
                }
                return count;
            }
    }
}

Compiler output:
Main.java:22: error: variable answer is already defined in method main(String[])
            int answer = AC.ans(c, d, S);
                ^
Main.java:22: error: non-static method ans(int,int,String) cannot be referenced from a static context
            int answer = AC.ans(c, d, S);
                           ^
2 errors
Language: C++

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

int main(){
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    int l[N], r[N];

    bool where[N];
    for (int i=0; i<N; i++) where[i] = false;
    for (int i=0; i<(N-1); i++){
        if (S.at(i) == 'A' && S.at(i+1) == 'C'){
            where[i] = true;
            i++;
        }
    }
    for (int i=0; i<Q; i++){
        cin >> l[i] >> r[i];
        l[i] -= 1;
        r[i] -= 1;
        int ans = 0;
        for (int j=l[i]; j<r[i]; j++){
            if (where[j] == true) {
            ans++;
            j++;
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        AC ac = new AC();
        int N = sc.nextInt();
        int Q = sc.nextInt();
        int answer = 0;
        int c;
        int d;
        String S = sc.next();
        int l[] = new int[Q];
        int r[] = new int[Q];
        for (int i = 0; i < Q; i++) {
            l[i] = sc.nextInt();
            r[i] = sc.nextInt();
        }
        for (int i = 0; i < Q; i++) {
            c = l[i]; 
            d = r[i];
            int answer = AC.ans(c, d, S)
          System.out.println(answer);
        }
    }
    static class AC{
            int ans(int a, int b, String str){
                int count = 0;
                boolean f;
                for(int i = a - 1; i < b; i++){
                    if(str.charAt(i) == 'A'){
                        f = true;
                    }else if( i != a - 1 && f && str.charAt(i) == 'C'){
                        count++;
                    }else{
                        f = false;
                    }
                }
                return count;
            }
    }
}

Compiler output:
Main.java:22: error: ';' expected
            int answer = AC.ans(c, d, S)
                                        ^
1 error
Language: Java

import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), q = sc.nextInt();
		String s = new Scanner(System.in).nextLine();
		for (int i = 0; i < q; i++) {
			Scanner an = new Scanner(System.in);
			int a = an.nextInt(), b = an.nextInt();
            String s2 = s.substring(a,b);
			System.out.println(s2.count("AC"));
		}
	}
}

Compiler output:
Main.java:11: error: cannot find symbol
			System.out.println(s2.count("AC"));
			                     ^
  symbol:   method count(String)
  location: variable s2 of type String
1 error
Language: C++

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

int main(){
    int N, Q;
    string S;
    cin >> N >> Q >> S;
    int l[N], r[N];

    bool where[N];
    for (int i=0; i<N; i++) where[i] = false;
    for (int i=0; i<(N-1); i++){
        if (S.at(i) == 'A' && S.at(i+1) == 'C'){
            where[i] = true;
            i++
        }
    }
    for (int i=0; i<Q; i++){
        cin >> l[i] >> r[i];
        l[i] -= 1;
        r[i] -= 1;
        int ans = 0;
        for (int j=l[i]; j<r[i]; j++){
            if (where[j] == true) {
            ans++;
            j++
        }
        cout << ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:16: error: expected ';' before '}' token
   15 |             i++
      |                ^
      |                ;
   16 |         }
      |         ~       
a.cc:26:16: error: expected ';' before '}' token
   26 |             j++
      |                ^
      |                ;
   27 |         }
      |         ~       
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: Java

import java.util.Scanner;

public class Main2 {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		String s = sc.next();

		int[] cnt = new int[n + 1];
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == 'A' && s.charAt(i + 1) == 'C') {
				cnt[i + 1] = cnt[i] + 1;
			} else {
				cnt[i + 1] = cnt[i];
			}
		}

		for (int i = 0; i < q; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			System.out.println(cnt[r - 1] - cnt[l - 1]);
		}
		sc.close();

	}
}


Compiler output:
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error
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[] l = new int[q];
    int[] r = new int[q];
    int[] ans = new int[q];
    String S[] = s.split("");
    boolean flag = false;
    int count = 0;
    String A = "A";
    String C = "C";
    for(int i = 0;i < q;i++){
      l[i] = sc.nextInt();
      r[i] = sc.nextInt();
    }
    int j = 0;
    int i = l[j];
    while(1){
      if(j == q){
        break;
      }
      else if(i == r[j]){
        System.out.println(ans);
        j++;
        i = l[j];
      }
      else if(S[i].equals(A)){
        flag = true;
        i++;
      }
      else if(S[i].equals(C) && flag){
        count++;
        flag = false;
        i++;
      }
      else{
        flag = false;
      }
    }
  }
  public static int check_length(int l,int r,String s){
    String S[] = s.split("");
    boolean flag = false;
    int count = 0;
    String A = "A";
    String C = "C";
    for(int i = l-1;i < r;i++){
      if(S[i].equals(A)){
        flag = true;
      }
      else if(S[i].equals(C) && flag){
        count++;
        flag = false;
      }
      else{
        flag = false;
      }
    }
    return count;
  }
}


Compiler output:
Main.java:23: error: incompatible types: int cannot be converted to boolean
    while(1){
          ^
1 error
Language: C++

x = input()
y = x.split()
y = [int (i) for i in y]
haha = input()

result   = 0
num    = y[1]
count = 0
length = y[0]
arr    = [0] * (length + 1)
arr[0] = 0

for i in range(length-1):
    if haha[i] == "A" and haha[i+1] == "C":
        arr[i+1] = count

        count +=1
    else:
        arr[i+1] = arr[i]

for i in range(num):
    hoho = input()
    xd = hoho.split()
    xd = [int (i) for i in xd]
    lqq = xd[0]
    rqq = xd[1]
    result = arr[rqq-1] - arr[lqq-1]

    print(result)

    result = 0


Compiler output:
a.cc:1:1: error: 'x' does not name a type
    1 | x = input()
      | ^
Language: C

#include<stdio.h>

int main(){
    int n,q;
    int l,r;
    int count=0;
scanf("%d ",&n);
scanf("%d\n",&q);
int x=0;
    float ac[n/2];
char s[n];
for(int j=0;j>n;j++){//文字列Sを取り込む
scanf("%c",&s[j]);
if(j==1){
if(s[j]=='C'&&s[j-1]'A'){
ac[x]=j-0.5;
x++;
}
}
}
scanf("\n");
for(int i=0;q>i;i++){//q問分繰り返す

scanf("%d ",&l);
scanf("%d\n",&r);
for(int d=0;d<n/2;d++){

if(ac[d]>r){
    goto yeah;
}else{
    if(ac[d]>l&&ac[d]<r){
    count++:
    }
}
//printf("%d",count);
//count=0;
}
if(false){
yeah :
printf("%d",count);
count=0;
}
}
}

Compiler output:
main.c: In function 'main':
main.c:15:21: error: expected ')' before 'A'
   15 | if(s[j]=='C'&&s[j-1]'A'){
      |   ~                 ^~~
      |                     )
main.c:32:12: error: expected ';' before ':' token
   32 |     count++:
      |            ^
      |            ;
main.c:38:4: error: 'false' undeclared (first use in this function)
   38 | if(false){
      |    ^~~~~
main.c:2:1: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | 
main.c:38:4: note: each undeclared identifier is reported only once for each function it appears in
   38 | if(false){
      |    ^~~~~
Language: Java

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 s=sc.next();
		char[] ch=s.toCharArray();
		for(int i=0;i<Q;i++){
			int counter=0;
			int a=sc.nextInt();
			int b=sc.nextInt();
			for(int j=a;j<b&&j<N;j++){
				if(ch[j-1]!='A')continue;
				if(ch[j]=='C')counter++;
			}
			ret[i]=counter;
		}
		for(int i=0;i<Q;i++)System.out.println(ret[i]);
		sc.close();
	}
}

Compiler output:
Main.java:19: error: cannot find symbol
			ret[i]=counter;
			^
  symbol:   variable ret
  location: class Main
Main.java:21: error: cannot find symbol
		for(int i=0;i<Q;i++)System.out.println(ret[i]);
		                                       ^
  symbol:   variable ret
  location: class Main
2 errors
Language: Java

public class Main {

	public static class Pair{
		// indexじゃない
		public int start;
		public int end;
		Pair(int s, int e){
			start = s;
			end = e;
		}
	}
	
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int Q = Integer.parseInt(sc.next());
		String sline = sc.next();
		int[] l = new int[Q];
		int[] r = new int[Q];
		for(int i=0; i<Q; i++){
			l[i] = Integer.parseInt(sc.next());
			r[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		String[] s = new String[N];
		for (int i=0; i<N; i++){
			s[i] = String.valueOf(sline.charAt(i));			
		}
		

		ArrayList<Pair> plist = new ArrayList<Pair>();
		int[] ans = new int[Q];
		for (int i=0; i<N-1; i++){
			if(s[i].equals("A") && s[i+1].equals("C")){
				Pair p = new Pair(i+1,i+2);
				plist.add(p);
				for(int j=0; j<Q; j++){
					if(p.start >= l[j] && p.end <= r[j]){
						ans[j]++;
					}
				}
			}
		}
		for(int i=0; i<Q; i++){
			System.out.println(ans[i]);
		}
		
	}

}

Compiler output:
Main.java:15: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:15: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:32: error: cannot find symbol
		ArrayList<Pair> plist = new ArrayList<Pair>();
		^
  symbol:   class ArrayList
  location: class Main
Main.java:32: error: cannot find symbol
		ArrayList<Pair> plist = new ArrayList<Pair>();
		                            ^
  symbol:   class ArrayList
  location: class Main
4 errors
Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner fc = new FastScanner(System.in);
		int num = fc.nextInt();
		int q = fc.nextInt();
		String str = fc.next();
		String subStr = "";
		PrintWriter out = new PrintWriter(System.out);
		for (int k = 0; k < q; k++) {
			subStr = str.substring(fc.nextInt() - 1, fc.nextInt());
			out.println((subStr.length() - subStr.replaceAll("AC", "").length()) / 2);
			out.flush();
		}
	}

	  static class FastScanner {
	        private BufferedReader reader = null;
	        private StringTokenizer tokenizer = null;

	        public FastScanner(InputStream in) {
	            reader = new BufferedReader(new InputStreamReader(in));
	            tokenizer = null;
	        }

	        public String next() {
	            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	                try {
	                    tokenizer = new StringTokenizer(reader.readLine());
	                } catch (IOException e) {
	                    throw new RuntimeException(e);
	                }
	            }
	            return tokenizer.nextToken();
	        }

	        public String nextLine() {
	            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	                try {
	                    return reader.readLine();
	                } catch (IOException e) {
	                    throw new RuntimeException(e);
	                }
	            }

	            return tokenizer.nextToken("\n");
	        }

	        public long nextLong() {
	            return Long.parseLong(next());
	        }

	        public int nextInt() {
	            return Integer.parseInt(next());
	        }

	        public double nextDouble() {
	             return Double.parseDouble(next());
	         }

	        public int[] nextIntArray(int n) {
	            int[] a = new int[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextInt();
	            return a;
	        }

	        public long[] nextLongArray(int n) {
	            long[] a = new long[n];
	            for (int i = 0; i < n; i++)
	                a[i] = nextLong();
	            return a;
	        }
	    }
	}

}

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

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> ac(S.length()-1);
  
  for(int i=0; i<S.length()-1; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='C'){
        ac.at(i) = 1;
        i += 1;
      }
    }
  }
  
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    
    vector<int> sub;
    sub = vector<int>(ac.begin()+l-1, ac.begin()+r);
    int count = 0;
    for(int j=0; j<sub.size(); j++){
      count += sub.at(j);
    }
    
    cout << count << endl;
}

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

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

int main(){

  int N,Q;

  cin >> N >> Q;

  string S; cin >> S;

  vector<pair<int,int>> v(Q);

  int a,b;

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

    cin >> a >> b;
    v[i] = make_pair(a,b);

  }

  vector<int> count(Q,0);

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

    for(int j = v[i].first;j < v[i].second - 1;j++){

      if(S.substr(j - 1,2) = "AC") count[i]++;

    }

    cout << count[i] << '\n';

  }




}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:28: error: could not convert 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int](((std::__cxx11::basic_string<char>::size_type)(j - 1)), 2).std::__cxx11::basic_string<char>::operator=(((const char*)"AC"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   32 |       if(S.substr(j - 1,2) = "AC") count[i]++;
      |          ~~~~~~~~~~~~~~~~~~^~~~~~
      |                            |
      |                            std::__cxx11::basic_string<char>
Language: C++

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> ac(S.length()-1);
  
  for(int i=0; i<S.length()-1; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='C'){
        ac.at(i) = 1;
        i += 1;
      }
    }
  }
  
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    
    vector<int> sub;
    sub = vector<int>(ac.begin()+l-1, ac.begin()+r);
    int count = 0;
    for(int j=0; j<sub.length(); j++){
      count += sub.at(j);
    }
    
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: 'class std::vector<int>' has no member named 'length'
   28 |     for(int j=0; j<sub.length(); j++){
      |                        ^~~~~~
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <stdio.h>

int main()
{
    int N,Q,l,r,n=0;
    char s[100005];
    scanf("%d%d",&N,&Q);
    getchar();
    gets(s);
    for(int i=1;i<=Q;i++){//共有Q组数据,当前为第i组
        scanf("%d%d",&l,&r);//printf("l=%d r=%d\n",l,r);

        for(n=0;l<=r;l++){
            if(s[l-1]=='A' && s[l]=='C' && l<r){
                n++;
                l++;
            }//printf("l=%d n=%d\n",l,n);
        }
        printf("%d\n",n);
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> ac(S.length()-1);
  
  for(int i=0; i<S.length()-1; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='C'){
        ac.at(i) = 1;
        i += 1;
      }
    }
  }
  
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    
    vector<int> sub;
    sub = vector(ac.begin()+l-1, ac.begin()+r);
    int count = 0;
    for(int j=0; j<sub.length(); j++){
      count += sub.at(j);
    }
    
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:24: error: 'class std::vector<int>' has no member named 'length'
   28 |     for(int j=0; j<sub.length(); j++){
      |                        ^~~~~~
a.cc:33:2: error: expected '}' at end of input
   33 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include<stdio.h>
int ACjudge(int,int,char*);
int main(void){
  int n,Q,l,r;
  char S[];
  scanf("%d %d",&n,&Q);
  scanf("%s",S);
  for(int i=0;i<Q;i++){
    scanf("%d %d",&l,&r);
    if(r<=n){
    	int j=ACjudge(l,r,&S[0]);
    	printf("%d\n",j);
  	}
  }
  return 0;
}
int ACjudge(int x,int y,char *z){
  z += x-1;
  int t=0;
  for(int k=0;k<y-x;k++){
    if(*z=='A' && *(z+1)=='C'){
      t++;
    }
    z++;
  }
  return t;
}

Compiler output:
main.c: In function 'main':
main.c:5:8: error: array size missing in 'S'
    5 |   char S[];
      |        ^
Language: C++

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


int solv(char *s, int l, int r)
{
	char *ss = s + l - 1;
	char *se = s + r;

	char lc = ' ';
	int ans  = 0;

	while (ss != se) {
		if (lc == 'A' && *ss == 'C') {
			++ans;
		}
		lc = *ss;
		ss++;
	}

	return ans;
}


int main() {
	int n, q;
	char *s = malloc(100003);

	scanf("%d %d", &n, &q);
	scanf(" %s", s);

	for (int i=0; i<q; i++) {
		int l, r;
		scanf("%d %d\n", &l, &r);
		printf("%d\n", solv(s, l, r));
	}

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:25: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   27 |         char *s = malloc(100003);
      |                   ~~~~~~^~~~~~~~
      |                         |
      |                         void*
Language: C++

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> ac(S.length()-1);
  
  for(int i=0; i<S.length()-1; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='C'){
        ac.at(i) = 1;
        i += 1;
      }
    }
  }
  
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    
    vector<int> sub = vector(ac.begin()+l-1, ac.begin()+r);
    int count = 0;
    for(int j=0; j<sub.length(); j++){
      count += sub.at(j);
    }
    
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: 'class std::vector<int>' has no member named 'length'
   27 |     for(int j=0; j<sub.length(); j++){
      |                        ^~~~~~
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

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

int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> ac(S.length()-1);
  
  for(int i=0; i<S.length()-1; i++){
    if(S.at(i)=='A'){
      if(S.at(i+1)=='C'){
        ac.at(i) = 1;
        i += 1;
      }
    }
  }
  
  for(int i=0; i<Q; i++){
    int l, r;
    cin >> l >> r;
    
    sub = vector(ac.begin()+l-1, ac.begin()+r);
    int count = 0;
    for(int j=0; j<sub.length(); j++){
      count += sub.at(j);
    }
    
    cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'sub' was not declared in this scope; did you mean 'fsub'?
   25 |     sub = vector(ac.begin()+l-1, ac.begin()+r);
      |     ^~~
      |     fsub
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<stdio.h>
int main()
{
    int N,Q,l,r,n=0;
    char s[100005];
    scanf("%d%d",&N,&Q);
    getchar();
    gets(s);
    for(int i=1;i<=Q;i++){//共有Q组数据,当前为第i组
        scanf("%d%d",&l,&r);//printf("l=%d r=%d\n",l,r);

        for(n=0;l<=r;l++){
            if(s[l-1]=='A' && s[l]=='C' && l<r){
                n++;
                l++;
            }//printf("l=%d n=%d\n",l,n);
        }
        printf("n=%d\n",n);
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |     gets(s);
      |     ^~~~
      |     getw
Language: C++

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

int main() {
  string s;
  int n, q, a, l, r, p;
  vector<int> vec;
  cin >> n >> q;
  cin >> s;

a = 0;
for (int i = 0 ; i < n ; i++){ 
 if (s.at(i) == 'A'){
 if (s.at(i+1) == 'C'){
 vec(a) = i;
 a = a+1;
}
}
} 
  
 for (int i = 0 ; i < q ; i++){
 cin >> l >> r;
 p = 0;
 for (int j =0; j <vec.size(); j++){
   if (vec(j) > r){
     break;
   }
   if (vec(j) < l){
   }
   else{
   p = p+1;
   }
 }
 cout << p << endl;
}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: no match for call to '(std::vector<int>) (int&)'
   15 |  vec(a) = i;
      |  ~~~^~~
a.cc:25:11: error: no match for call to '(std::vector<int>) (int&)'
   25 |    if (vec(j) > r){
      |        ~~~^~~
a.cc:28:11: error: no match for call to '(std::vector<int>) (int&)'
   28 |    if (vec(j) < l){
      |        ~~~^~~