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

#include<stdio.h>
int main(){
  int c1,c2;
char s;
  scanf("%c",&s);
  for(int i=0;i<10;i++){
  if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
  while(true){
	int n;
    if(s[i+n]=='A'||s[i+n]=='T'||s[i+n]=='C'||s[i+n]=='G'){
	c2++;
    }else{
      break;
    }
  }
  }
    if(c1<c2)c1=c2;
  }
  printf("%d\n", c1);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:7: error: invalid types 'char[int]' for array subscript
    7 |   if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
      |       ^
a.cc:7:18: error: invalid types 'char[int]' for array subscript
    7 |   if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
      |                  ^
a.cc:7:29: error: invalid types 'char[int]' for array subscript
    7 |   if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
      |                             ^
a.cc:7:40: error: invalid types 'char[int]' for array subscript
    7 |   if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
      |                                        ^
a.cc:10:9: error: invalid types 'char[int]' for array subscript
   10 |     if(s[i+n]=='A'||s[i+n]=='T'||s[i+n]=='C'||s[i+n]=='G'){
      |         ^
a.cc:10:22: error: invalid types 'char[int]' for array subscript
   10 |     if(s[i+n]=='A'||s[i+n]=='T'||s[i+n]=='C'||s[i+n]=='G'){
      |                      ^
a.cc:10:35: error: invalid types 'char[int]' for array subscript
   10 |     if(s[i+n]=='A'||s[i+n]=='T'||s[i+n]=='C'||s[i+n]=='G'){
      |                                   ^
a.cc:10:48: error: invalid types 'char[int]' for array subscript
   10 |     if(s[i+n]=='A'||s[i+n]=='T'||s[i+n]=='C'||s[i+n]=='G'){
      |                                                ^
Language: C

#include<stdio.h>

int main(void){
    int i, count = 0, flg = 0, max = 0;
    char s[11];
    char a[] = "ATGC";

    scanf("%s", s);
    s[10] = '\0';

    for(i = 0;i < 10;i++){
        flg = 0;
        for(j = 0;j < 4;j++){
            if(s[i] == a[j]){
                count++;
                flg = 1;
                break;
            }
        }
        if(flg = 0){
            if(max < count){
                max = count;
                count = 0;
            }
        }
    }

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

}

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

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

int main()
{
   char a[20];int n,m,max=0,l=0,i;
   scanf("%s",a);
   m=strlen(a);
   for(n=0;n<m-1;n++)
   {
       if(a[n]=='A'||a[n]=='T'||a[n]=='C'||a[n]=='G')
       {
           l=1;
           for(i=n+1;i<m;i++)
           {
               if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')
                l++;
               else
                break;
           }
           if(l>max)
            max=l;
       }
   }
   printf("%d",max);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: 'strlen' was not declared in this scope
    8 |    m=strlen(a);
      |      ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stdlib.h>
  +++ |+#include <cstring>
    3 |
Language: C++

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

int main()
{
    char a[100000];
    int i,ans,sum=0,len;
    gets(a);
    ans=0;
    len=strlen(a);
    for(i=0; i<=len-1; i++)
    {
        if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')
        {
            ans++;
        }
        else
        {
            if(ans>sum)
            {
                sum=ans;
            }
            ans=0;
        }
    }
    cout<<sum;
    return 0;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] text = sc.next().toCharArray();
        final char[] ATCG_CHARS = { 'A', 'C', 'G', 'T' };

        int maxLength = 0;
        int currentLength = 0;
        for (char c : text) {
            if (Arrays.binarySearch(ATCG_CHARS, c) >= 0) {
                currentLength++;
            } else {
                maxLength = Math.max(currentLength, maxLength);
                currentLength = 0;
            }
        }
        System.out.println(Math.max(currentLength, maxLength));
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:11: error: cannot find symbol
            if (Arrays.binarySearch(ATCG_CHARS, c) >= 0) {
                ^
  symbol:   variable Arrays
  location: class Main
3 errors
Language: C++

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

int is_ACGT(char s){
  if(c=='T' || c=='A' || c=='C' || c=='G')
    return 1;
  else
    return 0;
}

int main() {
  string s;
  cin >> s;
  
  int max_count = 0;
  for(int i=0; i<s.length(); i++){
    int count = 0;
    if(is_ACGT(s.at(i))){
      count++;
      for(int j=i+1; j<s.length(); j++){
        if(is_ACGT(s.at(j)))
           count++;
      }
    }
    if(count > max_count)
       max_count = count;
  }
  count << max_count << endl;
}

Compiler output:
a.cc: In function 'int is_ACGT(char)':
a.cc:5:6: error: 'c' was not declared in this scope
    5 |   if(c=='T' || c=='A' || c=='C' || c=='G')
      |      ^
a.cc: In function 'int main()':
a.cc:28:9: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   28 |   count << max_count << endl;
      |   ~~~~~~^~~~~~~~~~~~
a.cc: In function 'int is_ACGT(char)':
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C

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

bool atcg(char a){
	if(a == 'A' || a == 'T' || a == 'C' || a == 'G' ) return true;
	else return false;
}


int main(){
	char s[10];
	int i ; 
	scanf("%s",s);
	//printf("%s\n",s);
	//printf("%d\n",strlen(s));
	int length = strlen(s);
	int count = 0;
	int flag;
	int max = 0;
	for(i=0;i<length;i++){
		if(atcg(s[i])){
			flag = 0;
		}else{
			flag = 1;
			if(max < count) max = count;
			count = 0;
			
		} 
		if(flag == 0) count++;
	}
	printf("%d\n",max);
	return 0;
}

Compiler output:
main.c:4:1: error: unknown type name 'bool'
    4 | bool atcg(char a){
      | ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    2 | #include<string.h>
  +++ |+#include <stdbool.h>
    3 | 
main.c: In function 'atcg':
main.c:5:66: error: 'true' undeclared (first use in this function)
    5 |         if(a == 'A' || a == 'T' || a == 'C' || a == 'G' ) return true;
      |                                                                  ^~~~
main.c:5:66: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:5:66: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:21: error: 'false' undeclared (first use in this function)
    6 |         else return false;
      |                     ^~~~~
main.c:6:21: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
Language: C++

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

int is_ACGT(char s){
  if(c=='T' || c=='A' || c=='C' || c=='G')
    return 1;
  else
    return 0;
}

int main() {
  string s;
  cin >> s;
  
  int max_count = 0;
  for(int i=0; i<s.length(); i++){
    int count = 0;
    if(is_ACGT(s.at(i)){
      count++;
      for(int j=i+1; j<s.length(); j++){
        if(is_ACGT(s.at(j))
           count++;
      }
    }
    if(count > max_count)
       max_count = count;
  }
  count << max_count << endl;
}

Compiler output:
a.cc: In function 'int is_ACGT(char)':
a.cc:5:6: error: 'c' was not declared in this scope
    5 |   if(c=='T' || c=='A' || c=='C' || c=='G')
      |      ^
a.cc: In function 'int main()':
a.cc:18:24: error: expected ';' before '{' token
   18 |     if(is_ACGT(s.at(i)){
      |                        ^
      |                        ;
a.cc:25:5: error: expected primary-expression before 'if'
   25 |     if(count > max_count)
      |     ^~
a.cc:24:6: error: expected ')' before 'if'
   24 |     }
      |      ^
      |      )
   25 |     if(count > max_count)
      |     ~~
a.cc:18:7: note: to match this '('
   18 |     if(is_ACGT(s.at(i)){
      |       ^
a.cc:28:9: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   28 |   count << max_count << endl;
      |   ~~~~~~^~~~~~~~~~~~
a.cc: In function 'int is_ACGT(char)':
a.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
    9 | }
      | ^
Language: C++

#include<bits/stdc++.h>//atcoder.112.2
using namespace std;
int main(){
	string s;
	int n,i,j=0,m=0;
	getline(cin,s);
	n=s.size();
	for(i=0;i<n;i++){
		if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
		if(s[i]!="A"&&s[i]!="T"&&s[i]!="C"&&s[i]!="G"){
			if(m<j)m=j;
			j=0;
		}
	}
	cout<<m;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:46: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:57: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:10:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |                 if(s[i]!="A"&&s[i]!="T"&&s[i]!="C"&&s[i]!="G"){
a.cc:10:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |                 if(s[i]!="A"&&s[i]!="T"&&s[i]!="C"&&s[i]!="G"){
a.cc:10:46: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |                 if(s[i]!="A"&&s[i]!="T"&&s[i]!="C"&&s[i]!="G"){
a.cc:10:57: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |                 if(s[i]!="A"&&s[i]!="T"&&s[i]!="C"&&s[i]!="G"){
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main ()
{
    int x[10000]={0},j=0;
    char s[10001];
    gets(s);
    for(int i=0; i<strlen(s); i++)
    {
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
            x[j]++;
            else
                j++;

    }
    int ma=-1;
    for(j=0;j<100;j++)
    {
        if(ma<x[j])
            ma=x[j];
    }
    printf("%d",ma);
}


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 <stdio.h>
#include <string.h>
int main()
{
	int n,i,j=0,flag=0;
	char a[1000];
	gets(a);
	n=strlen(a);
	for(i=0;i<n;i++)
	{
		if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')
		{
			j++;
			if(flag<j)
				flag=j;
		}
			
		if(a[i]!='A'&&a[i]!='T'&&a[i]!='C'&&a[i]!='G')
			j=0;
	}
	printf("%d\n",flag);
	return 0;
}

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

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

int main() {
  string s;
  cin >> s;
  int length = 0;
  int max_length = 0;
  bool is_acgt = false;

  for (int i = 0; i < s.length; i++) {
    char x = s[i];
    if (x == 'A' || x == 'C' || x == 'G' || x == 'T') {
      if (!is_acgt) {
        is_acgt = true;
        length = 1;
      } else {
        length++;
      }
    } else if (is_acgt) {
      is_acgt = false;
      max_length = max(max_length, length);
    }
  }

  cout << max_length << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:25: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   11 |   for (int i = 0; i < s.length; i++) {
      |                       ~~^~~~~~
      |                               ()
Language: C++

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

int main()
{
    char a[100000];
    int i,ans,sum=0;
    gets(a);
    ans=0;
    for(i=0; i<=strlen(a)-1; i++)
    {
        if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')
        {
            ans++;
        }
        else
        {
            if(ans>sum)
            {
                sum=ans;
            }
            ans=0;
        }
    }
    cout<<sum;
    return 0;
}


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

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

#define STR_LEN 4
int main()
{
    char input_str[10+1];
    char acgt_str[STR_LEN+1] = {"ACGT"};
    int i = 0;
    int str_len = 0;
    int max_acgt_length = 0;
    int now_acgt_length = 0;
    bool same_flg = false;

    // 入力
    scanf("%s", input_str);

    // 入力値チェック
    str_len = strlen(input_str);

    for( i = 0; i < str_len; i++ ) {
        same_flg = false;

        for( j = 0; j < STR_LEN; j++ ) {
            if( input_str[i] == acgt_str[j] ) {
                same_flg = true;
                break;
            }
        }

        //
        if( same_flg ) {
            // ACGTの長さを増やす
            now_acgt_length++; 
        }
        else {
            // 最高値チェック
            if( max_acgt_length < now_acgt_length ) {
                max_acgt_length = now_acgt_length;
            }
        }
    }

    // 値出力
    printf("%d", max_acgt_length);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: 'j' was not declared in this scope
   24 |         for( j = 0; j < STR_LEN; j++ ) {
      |              ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String[] s = S.split("");
		
		int max = 0;
		int last = -1;
		for(int i=0; i<s.length; i++){
			if(!s[i].equals("A") && !s[i].equals("T") && !s[i].equals("C") && !s[i].equals("G")){
				int length = i-last-1;
				if(length > max){
					max = length;
				}
				last = i;
			}
		}
		length = s.length-last-1;
		if(length > max){
			max = length;
		}
				
		System.out.println(max);
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
		length = s.length-last-1;
		^
  symbol:   variable length
  location: class Main
Main.java:21: error: cannot find symbol
		if(length > max){
		   ^
  symbol:   variable length
  location: class Main
Main.java:22: error: cannot find symbol
			max = length;
			      ^
  symbol:   variable length
  location: class Main
3 errors
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main ()
{
    int x[100]={0},j=0;
    char s[1001];
    gets(s);
    for(int i=0; i<strlen(s); i++)
    {
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
            x[j]++;
            else
                j++;

    }
    int ma=-1;
    for(j=0;j<100;j++)
    {
        if(ma<x[j])
            ma=x[j];
    }
    printf("%d",ma);
}


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()
{
	string S;
	string b;
	int len = 0;
	int maxlen = 0;
	cin >> S;

	for (int i = 0; i < S.length; ++i)
	{
		b = S.substr(i, 1);
	}
	if (b == "A" || b == "T" || b == "C" || b == "G")
	{
		++len;
	}
	else
	{
		if (len > maxlen)
		{
			maxlen = len;
		}
		len = 0;
	}
	cout << maxlen << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   12 |         for (int i = 0; i < S.length; ++i)
      |                             ~~^~~~~~
      |                                     ()
Language: C++

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

int main(){
  int S[11];
  int ans=0;
  char A[11];
  for(int i=0; i<11; ++i){
    A[i]='a';
    S[i]=0;
  }
  for(int i=1; ++i) cin>>A[i];
  for(int i=1; i<11; ++i){
    if(A[i]=='A') S[i]+=1;
    else if(A[i]=='T') S[i]+=1;
    else if(A[i]=='C') S[i]+=1;
    else if(A[i]=='G') S[i]+=1;
  }
  for(int i=10; i>1; --i){
    if(S[i-1]!=0) S[i-1]+=1;
  }
  for(int i=1; i<11; ++i){
    ans=max(ans,S[i]);
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected ';' before ')' token
   15 |   for(int i=1; ++i) cin>>A[i];
      |                   ^
      |                   ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string str;
  cin>>str;
  int count=0;
  int max=0;
  for(int i=0;i<str.length();i++)
  {
    if(str[i]=='A' || str[i]=='G' || str[i]=='C' || str[i]=='T')
    {
      count =1;
      int j=i;
      while(j<str.length() && (str[j]=='A' || str[j]=='G' || str[j]=='C' || str[j]=='T')
            {
              count++;
            }
        if(max<count) max=count;
     }
            
   }         
            cout<<max<<endl;
            return 0;
            
            }
            
            

Compiler output:
a.cc: In function 'int main()':
a.cc:15:89: error: expected ')' before '{' token
   15 |       while(j<str.length() && (str[j]=='A' || str[j]=='G' || str[j]=='C' || str[j]=='T')
      |            ~                                                                            ^
      |                                                                                         )
   16 |             {
      |             ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  string s;cin>>s;
  int ans=0;
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
      int c=0;
      for(int k=i;k<=j;k++){
        if(s[k]=='A'||s[k]=='T'||s[k]=='C'||s[k]=='G')continue;
        else{
          c=1;
          break;
        }
      }
      if(c==0)ans=max(ans,j-i+1);
    }
  }
  cout<<ans<<endl;
}

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

S = list(input())
count, max_num = 0, 0
for s in S:
	if s in ("A","T","G","C"):
		count += 1
	else:
		count = 0
	if max_num < count:
		max_num = count
print(max_num)

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

#include <stdio.h>
#include <string.h>
int main()
{
	int n,i,j=0,flag=0;
	char a[1000];
	gets(a);
	n=strlen(a);
	for(i=0;i<n;i++)
	{
		if(a[i]=='A'||a[i]=='T'||a[i]=='C'||a[i]=='G')
			j++;
		if(a[i]!='A'&&a[i]!='T'&&a[i]!='C'&&a[i]!='G')
		{
			if(flag<j)
				flag=j;
			j=0;
		}
	}
	printf("%d\n",flag);
	return 0;
}

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

#include<bits/stdc++.h>//atcoder.112.2
using namespace std;
int main(){
	string s;
	int n,i,j=0,m=0;
	getline(cin,s);
	n=s.size();
	for(i=0;i<n;i++){
		if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
		else{
			if(m<j)j=m;
			j=0;
		}
	}
	cout<<m;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:35: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:46: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
a.cc:9:57: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |                 if(s[i]=="A"||s[i]=="T"||s[i]=="C"||s[i]=="G")j++;
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
int main(){
    string n;
    cin >> n;
  
  	int i=0;
    int cnt=0;
  	int ans=0;
    while(i<n.size()){
      if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
        ++cnt;
      }
      else{
        if(ans<cnt) ans = cnt;
        cnt=0;
      }
    }
    cout << ans << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:10: error: 's' was not declared in this scope
   13 |       if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
      |          ^
Language: C++

#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main ()
{
    int x=0;
    char s[1001];
    gets(s);
    for(int i=0; i<strlen(s); i++)
    {
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')
            x++;
    }
    printf("%d",x);
}


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()
{
    char s[11];
    gets(s);
    int maxn=0,res=0;
    for(int i=0;s[i]!='\0';i++)
    {
        for(int j=i;s[j]!='\0';j++)
        {
            if(s[j]=='A'||s[j]=='T'||s[j]=='G'||s[j]=='C')
            {
                res++;
            }
            else
            {
                if(res>maxn)
                    maxn=res;
                res=0;
                break;
            }
        }
    }
    cout<<maxn;
    return 0;
}


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

#include <cstdio>
#include <string>
#include <set>

using namespace std;

char s[105];

int main()
{
  scanf("%s", s);

  set<char> S;
  S.insert('A');
  S.insert('T');
  S.insert('G');
  S.insert('C');

  int n = strlen(s), res = 0;
  for (int i = 0; i < n; ++i)
  {
    int j = i;
    while (j < n && S.find(s[j]) != S.end())
      j++;
    res = max(res, j - i);
  }

  printf("%d\n", res);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'strlen' was not declared in this scope
   19 |   int n = strlen(s), res = 0;
      |           ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <set>
  +++ |+#include <cstring>
    4 | 
a.cc:25:5: error: 'res' was not declared in this scope
   25 |     res = max(res, j - i);
      |     ^~~
a.cc:28:18: error: 'res' was not declared in this scope
   28 |   printf("%d\n", res);
      |                  ^~~
Language: C++

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

struct Fast { Fast() { std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

signed main() {
	string S;

	cin >> S;

	int maxnum = 0;
	int cur = 0;

	for (int i = 0; i < S.length; i++ ) {
		char c = S[i];
		if (c == 'A' | c == 'T' | c == 'C' | c == 'G']) {
			cur++;
			maxnum = max(maxnum, cur);
		}
		else {
			cur = 0;
		}
	}

	cout << maxnum << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   14 |         for (int i = 0; i < S.length; i++ ) {
      |                             ~~^~~~~~
      |                                     ()
a.cc:16:62: error: expected ')' before ']' token
   16 |                 if (c == 'A' | c == 'T' | c == 'C' | c == 'G']) {
      |                    ~                                         ^
      |                                                              )
a.cc:16:62: error: expected primary-expression before ']' token
Language: C++

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

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

main(){
  string s;
  cin >> s;
  int ans=0,l=0;
  for (int i=0;i<s.size();i++){
    if (s.at(i)=="A" || s.at(i)=="C" || s.at(i)=="G" || s.at(i)=="T"){
      l++;
    }
    else l=0;
    if (l>ans) ans=l;
  }
  cout << ans << endl;
}

Compiler output:
a.cc:42:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   42 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:47:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |     if (s.at(i)=="A" || s.at(i)=="C" || s.at(i)=="G" || s.at(i)=="T"){
      |         ~~~~~~~^~~~~
a.cc:47:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |     if (s.at(i)=="A" || s.at(i)=="C" || s.at(i)=="G" || s.at(i)=="T"){
      |                         ~~~~~~~^~~~~
a.cc:47:48: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |     if (s.at(i)=="A" || s.at(i)=="C" || s.at(i)=="G" || s.at(i)=="T"){
      |                                         ~~~~~~~^~~~~
a.cc:47:64: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   47 |     if (s.at(i)=="A" || s.at(i)=="C" || s.at(i)=="G" || s.at(i)=="T"){
      |                                                         ~~~~~~~^~~~~
Language: C++

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

int main(){
	string s;
	cin>>s;
	int MAX=0,acgt=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
			acgt++;
		}else{
			MAX=max(MAX,acgt);
			acgt=0;
		}
	}
	MAX=max(MAX,acgt;)
	cout<<MAX;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: expected ')' before ';' token
   16 |         MAX=max(MAX,acgt;)
      |                ~        ^
      |                         )
a.cc:16:26: error: expected primary-expression before ')' token
   16 |         MAX=max(MAX,acgt;)
      |                          ^
Language: C++

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

int main (){
  string s;
  cin>>s;
  int maxn = 0, int cur = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      ++cur;
    } else {
      if (cur > maxn) maxn = cur;
      cur = 0;
    }
  }
  cout<<maxn<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected unqualified-id before 'int'
    8 |   int maxn = 0, int cur = 0;
      |                 ^~~
a.cc:11:9: error: 'cur' was not declared in this scope
   11 |       ++cur;
      |         ^~~
a.cc:13:11: error: 'cur' was not declared in this scope
   13 |       if (cur > maxn) maxn = cur;
      |           ^~~
a.cc:14:7: error: 'cur' was not declared in this scope
   14 |       cur = 0;
      |       ^~~
Language: C++

#include "pch.h"
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<map>
#include<set>
#include<vector>
#include<queue>
using namespace std;
char A[100000];
int main() {
	cin >> A;
	int Max = 0;
	for (int i = 0,temp = 0; A[i] != '\0'; i++) {
		if (A[i] == 'A' || A[i] == 'C' || A[i] == 'G' || A[i] == 'T') {
			temp++;
			Max = max(Max, temp);
		}
		else {
			temp = 0;
		}
	}
	cout << Max << endl;
	return 0;
}

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

// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    string s; cin >> s;
    s += '#';
    int ans = 0, cons = 0;
    for(int i=0; i<N; i++) {
        string pat = "ATGC";
        if(pat.find(s[i]) != string::npos) {
            cons++;
        }
        else {
            ans = max(ans, cons);
            cons = 1;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    vector<int> l(q),r(q);
    rep(i,q) cin >> l[i] >> r[i];
    sum[0] = 0;
    for(int i=1; i<s.size(); 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;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: expected ',' or ';' before 'cout'
   26 |         cout << ans << endl;
      |         ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    vector<int> l(q),r(q);
    rep(i,q) cin >> l[i] >> r[i];
    sum[0] = 0;
    for(int i=1; i<s.size(); i++){
        if(s[i-1]=='A' && s[i]=='C') sum[i+1]=sum[i]+1; 
        else
        sum[i+1] = sum[i];
    }
    int ans;
    for(int i=0; i<q; i++){
        ans = sum[r[i]]-sum[l[i]]
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:34: error: expected ';' before '}' token
   26 |         ans = sum[r[i]]-sum[l[i]]
      |                                  ^
      |                                  ;
   27 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    vector<int> l(q),r(q);
    rep(i,q) cin >> l[i] >> r[i];
    sum[0] = 0;
    for(int i=1; i<s.size(); 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;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: expected ',' or ';' before '}' token
   27 |     }
      |     ^
a.cc:28:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define cans cout << ans << endl
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
typedef long long ll;


int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    vector<int> l(q),r(q);
    rep(i,q) cin >> l[i] >> r[i];
    sum[0] = 0;
    for(int i=1; i<s.size(); 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;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:6: error: 'else' without a previous 'if'
   21 |     }else{
      |      ^~~~
a.cc:22:13: error: 'i' was not declared in this scope
   22 |         sum[i+1] = sum[i];
      |             ^
a.cc:27:5: error: expected ',' or ';' before '}' token
   27 |     }
      |     ^
a.cc:28:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,Q;string S;cin>>N>>Q>>S;
  vector<int>V(N);
  int U=0;
  for(int X=0;X<N;X++){
    if(X!=0&&V[X]=='C'&&v[X-1]=='A'){
      U++;
    }
    V[X]=U;
  }
  for(int X=0;X<Q;X++){
    int A,B;cin>>A>>B;
    if(A!=1&&V[A-2]!=V[A-1]){
      cout<<V[B-1]-V[A-1]-1<<endl;
    }
    else{
      cout<<V[B-1]-V[A-1]<<endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:25: error: 'v' was not declared in this scope
    8 |     if(X!=0&&V[X]=='C'&&v[X-1]=='A'){
      |                         ^
Language: Java

import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;
 
public class Solution {
 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt(), Q = sc.nextInt();
    String S = sc.next();
    int A[] = new int[S.length() + 1];
    for (int i = 1; i < S.length(); i++)
    {
      if (S.charAt(i - 1) == 'A' && S.charAt(i) == 'C')
      {
        A[i] = 1;
      }
      else
      {
        A[i] = 0;
      }
    }
    int PSA[] = new int[S.length() + 1];
    for (int i = 1; i <= S.length(); i++)
    {
      PSA[i] = PSA[i - 1] + A[i];
    }
    for (int i = 0; i < Q; i++)
    {
      int l = sc.nextInt(), r = sc.nextInt();
      int result = PSA[r - 1] - PSA[l - 1];
      System.out.println(result);
    }
  }
}


Compiler output:
Main.java:5: error: class Solution is public, should be declared in a file named Solution.java
public class Solution {
       ^
1 error
Language: Java

vimport java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), Q = sc.nextInt();
		String S = sc.next();
		for (int i=0; i<Q; i++){
			int count = 0;
			int l = sc.nextInt(), r = sc.nextInt();
			String sub = S.substring(l-1, r);
			for (int j=0; j<sub.length()-1; j++){
				if (sub.charAt(j)=='A' && sub.charAt(j+1)=='C'){
					count++;
				}
			}
			System.out.println(count);
		}

	}

}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
vimport java.util.*;
^
1 error
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;
int main() {
int N, Q;cin >> N >> Q;
string S;cin >> S;
vector<pair<int, int>> range(Q);
vector<int> V;

rep(i, 0, Q)cin >> range[i].first >> range[i].second;

rep(i, 1, N){
if(S[i - 1] == 'A' && S[i] == 'C')V.push_back(i - 1);
}

for(auto x : range){
int l = 0, r  = V.size() - 1 a = r;

if(x.second - 1 <= V[l] || x.first - 1 >= V[a] + 1){
cout << 0 << endl;continue;}

    while(V[l] < x.first - 1){
    l++;
    }

    while(V[r] + 1 > x.second - 1){
    r--;
    }

cout <<  r - l + 1 << endl;

}


}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: expected ',' or ';' before 'a'
   20 | int l = 0, r  = V.size() - 1 a = r;
      |                              ^
a.cc:22:45: error: 'a' was not declared in this scope
   22 | if(x.second - 1 <= V[l] || x.first - 1 >= V[a] + 1){
      |                                             ^
Language: C++

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

int main(){
    long long N,Q;
    string S;
    vector<string> s{""};
    cin>>N>>Q;
    cin>>S;
    for (int i=0;i<S.size();i++){
        s.push_back(s[i]+S[i]);
    }
    for(int j=0;j<Q;j++) {
        long long l,r;
        cin>>l>>r;
        cout<<s[r].substr(l-1)<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin>>N>>Q;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <string>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:17:9: error: 'cout' was not declared in this scope
   17 |         cout<<s[r].substr(l-1)<<endl;
      |         ^~~~
a.cc:17:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:17:33: error: 'endl' was not declared in this scope
   17 |         cout<<s[r].substr(l-1)<<endl;
      |                                 ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <string>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

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

int main(){
  int n,q;
  string s;
  cin>>n>>q>>s;
  for(int i=0;i<q;i++){
    int l,r;
    cin>>l>>r;
    l--;
    r--;
    int count=0;
    for(j=l;j<=r-1;j++){
      if(s[j]=='A'&&s[j+1]=='C'){
        count++;
      }
    }
    cout<<count<<endl;
  }
}
      

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

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

int main(){
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    
    vector<int>l(q),r(q);
    rep(i,q)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:14:9: error: redeclaration of 'int n'
   14 |     int n=s.size();
      |         ^
a.cc:7:9: note: 'int n' previously declared here
    7 |     int n,q;
      |         ^
Language: C++

n, q = map(int, input().split())
s = input()
v = [0] * (n)

for i in range(1, n):
  if s[i - 1] == "A" and s[i] == "C":
    v[i] = 1 + v[i - 1]
  else:
    v[i] = v[i - 1]

for i in range(q):
  l, r = map(int, input().split())
  print(v[r - 1] - v[l - 1])

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

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());
        Integer Q = Integer.parseInt(scanner.next());
        String S = scanner.next();

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

            Integer l = Integer.parseInt(scanner.next()), r = Integer.parseInt(scanner.next());
            String tmp = S.substring(l-1,r);

            Integer fi = 0;
            Integer count = 0;

            while(true) {
                Integer ti = tmp.indexOf("AC", fi);
                if(ti >= 0) {
                    fi = ti + 1;
                } else break;
                count++;
            }
            System.out.println(count);
        }
    }
}

Compiler output:
Main.java:4: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());
        Integer Q = Integer.parseInt(scanner.next());
        String S = scanner.next();

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

            Integer l = Integer.parseInt(scanner.next()), r = Integer.parseInt(scanner.next());
            String tmp = S.substring(l-1,r);

            Integer fi = 0;
            Integer count = 0;

            while(true) {
                Integer ti = tmp.indexOf("AC", fi);
                if(ti >= 0) {
                    fi += ti + 1;
                } else break;
                count++;
            }
            System.out.println(count);
        }
    }


Compiler output:
Main.java:29: error: reached end of file while parsing
    }
     ^
1 error
Language: Java


import java.util.Scanner;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author HP
 */
public class Get_AC {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int count=0;
        int n=input.nextInt();
        int q=input.nextInt();
        System.out.flush();
        String s=input.next();
       
        int a[]=new int[q];
        int b[]=new int[q];
          
        for(int i=0;i<q;i++)
        {
            a[i]=input.nextInt();
            b[i]=input.nextInt();
        }
         char[] ch = new char[s.length()]; 
  
      
        for (int i = 0; i < s.length(); i++) { 
            ch[i] = s.charAt(i); 
        } 
  
        for(int i=0;i<q;i++)
        {
            for(int j=a[i];j<=b[i]-1;j++)
            {
                if(ch[j-1]=='A' && ch[j]=='C')
                {
                    count++;
                }
            }
             System.out.println(count);
             count=0;
        }
       
    }
}


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

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

int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    for(int i = 1;i < n;i++){
        sum(i+1) = sum(i);
        if(s[i-1] == 'A' && s[i] == 'C')sum[i+1]++;
    }
    rep(i,q){
        int l,r;
        cin >> l >> r;
        cout << sum[r] - sum[l] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: no match for call to '(std::vector<int>) (int)'
   14 |         sum(i+1) = sum(i);
      |         ~~~^~~~~
a.cc:14:23: error: no match for call to '(std::vector<int>) (int&)'
   14 |         sum(i+1) = sum(i);
      |                    ~~~^~~
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();
		int [] L = new int [n];
        int [] R = new int [n];
        String s = sc.next();
        int count = 0;
        L[0]=0;
        R[n-1]=0;
        for(int i=0;i<n;i++){if(s.substring(i,i+2).equals("AC"){count++;}
                            }	
        for(int i=1;i<n;i++){if(s.substring(i-1,i+1).equals("AC"){L[i]=L[i-1]+1;}
                                else{L[i]=L[i-1];}
                            }
        for(int i=n-2;i<=0;i++){if(s.substring(i,i+2).equals("AC"){R[i]=R[i+1]+1;}
                                else{R[i]=R[i-1];}
                            }                       
	    for(int i=0;i<q;i++){int l = sc.nextInt();
                             int r = sc.nextInt();
                             System.out.println(L[r-1]+R[l-1]-count);}
  }
}


Compiler output:
Main.java:13: error: ')' expected
        for(int i=0;i<n;i++){if(s.substring(i,i+2).equals("AC"){count++;}
                                                               ^
Main.java:15: error: ')' expected
        for(int i=1;i<n;i++){if(s.substring(i-1,i+1).equals("AC"){L[i]=L[i-1]+1;}
                                                                 ^
Main.java:18: error: ')' expected
        for(int i=n-2;i<=0;i++){if(s.substring(i,i+2).equals("AC"){R[i]=R[i+1]+1;}
                                                                  ^
3 errors
Language: C++

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

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

#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    ll N , Q ;
    cin >> N >> Q ;
    string S ;
    cin >> s ;
    vector<int> vec(N + 1);
    int cnt = 0;
    for(ll i = 0 ; i < N ; i++) {
        vec[i] = cnt;
        if (S[i] == 'A' && S[i + 1] == 'C') {
            cnt += 1;
        }
    }
    for(ll j = 0 ; j < Q ;j++) {
        int l, r;
        cin >> l >> r;
        cout << vec[r - 1] - vec[l - 1] << endl;
    }
    return 0 ;
}

 


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: 's' was not declared in this scope
   16 |     cin >> s ;
      |            ^
Language: C++

#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    ll N , Q ;
    cin >> N >> Q ;
    char s[N] ;
    cin >> s ;
    vector<int> vec(N + 1);
    int cnt = 0;
    for(ll i = 0 ; i < N ; i++) {
        vec[i] = cnt;
        if (S[i] == 'A' && S[i + 1] == 'C') {
            cnt += 1;
        }
    }
    for(ll j = 0 ; j < Q ;j++) {
        int l, r;
        cin >> l >> r;
        cout << vec[r - 1] - vec[l - 1] << endl;
    }
    return 0 ;
}

 


Compiler output:
a.cc: In function 'int main()':
a.cc:21:13: error: 'S' was not declared in this scope
   21 |         if (S[i] == 'A' && S[i + 1] == 'C') {
      |             ^