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

#include <cstdio>

using namespace std;

int main()
{
    scanf("%d", &x);

    if (x < 1200) printf("ABC\n");
    else printf("ARC\n");

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'x' was not declared in this scope
    7 |     scanf("%d", &x);
      |                  ^
Language: C++

#include <iostream>
#include <algorithm>

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

void solveA() {
	int x; cin >> x;
	if (x < 1200) cout << "ABC" << endl;
	else cout << "ARC" << endl;
}
void solveB() {

}
void solveC() {

}
void solveD() {

}

int main() {
	solveA();
	return 0;
}

Compiler output:
a.cc: In function 'void solveA()':
a.cc:9:16: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |         int x; cin >> x;
      |                ^~~
      |                std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:10:23: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |         if (x < 1200) cout << "ABC" << endl;
      |                       ^~~~
      |                       std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:40: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   10 |         if (x < 1200) cout << "ABC" << endl;
      |                                        ^~~~
      |                                        std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:11:14: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |         else cout << "ARC" << endl;
      |              ^~~~
      |              std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:31: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |         else cout << "ARC" << endl;
      |                               ^~~~
      |                               std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
  int x;
  cin >> x;
  if(x < 1200){
    cout << ABC << endl;
  }else cout << ARC <<endl;
  return 0;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: 'ABC' was not declared in this scope
    9 |     cout << ABC << endl;
      |             ^~~
a.cc:10:17: error: 'ARC' was not declared in this scope
   10 |   }else cout << ARC <<endl;
      |                 ^~~
Language: Java

import com.sun.tools.corba.se.idl.StringGen;

import java.util.*;

/**
 * Created by Seiya on 2016/10/16.
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a, b, c;

        a = scanner.nextInt();

        if(a < 1200) {
            System.out.println("ABC");
        }else{
            System.out.println("ARC");
        }
    }








}




Compiler output:
Main.java:1: error: package com.sun.tools.corba.se.idl does not exist
import com.sun.tools.corba.se.idl.StringGen;
                                 ^
1 error
Language: C

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

int main(){
	int x;
	scanf("%d"&x);
	if(x<1200) printf("ABC\n");
	else printf("ARC\n");
	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:8:19: error: invalid operands to binary & (have 'char *' and 'int')
    8 |         scanf("%d"&x);
      |               ~~~~^
      |               |
      |               char *
Language: C++

#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
 
int main()
{
string s;  int x,y; cin>>s;
x=s.find("A");
y=s.rfind("Z");
cout<<y-x+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'cin' was not declared in this scope
    9 | string s;  int x,y; cin>>s;
      |                     ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <limits>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:12:1: error: 'cout' was not declared in this scope
   12 | cout<<y-x+1;
      | ^~~~
a.cc:12:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<string>
#include<iomanip>
#include <numeric>
#include <limits>
using namespace std;
 
int main()
{
string s;  int x,y; getline(cin,s);
for(int i=0;i<s.size();i++)
{
    if(s.at(i)=='A'){ x=i; break;}
}
for(int i=s.size()-1;i>x;i--)
{
    if(s.at(i)=='Z'){ y=i; break;}
}
cout<<y-x+1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: 'cin' was not declared in this scope
    9 | string s;  int x,y; getline(cin,s);
      |                             ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include <limits>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:18:1: error: 'cout' was not declared in this scope
   18 | cout<<y-x+1;
      | ^~~~
a.cc:18:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main () {
  string s;
  int index1, index2;
  cin >> s;
  
  for(i=0; i<s.size();i++){
    if(s[i]=='A'){
      index1=i;
      break;
    }
  }
    
  for(i=s.size()-1; i>-1;i--){
    if(s[i]=='Z'){
      index2=i;
      break;
    }
  }
  
  cout << index1-index2+1;
}



  
  cout << count;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |   for(i=0; i<s.size();i++){
      |       ^
a.cc:19:7: error: 'i' was not declared in this scope
   19 |   for(i=s.size()-1; i>-1;i--){
      |       ^
a.cc: At global scope:
a.cc:32:3: error: 'cout' does not name a type
   32 |   cout << count;
      |   ^~~~
a.cc:34:1: error: expected declaration before '}' token
   34 | }
      | ^
Language: C

#include <iostream>
#include <string>
using namespace std;
int main(void){
    string S;
    cin >> S;
    int l,r;
    l = r = -1;
    
    for(int i=0;i<S.size();i++){
        if(S[i] == 'A' && l == -1){
            l = i;
        }
        if(S[i] == 'Z'){
            r = i;
        }
    }
    int ans = r - l;
    
    cout << ans << endl;
    
}


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

#include<iostream>
using namespace std;

int main()
{
  string a;cin>>a;
  int c=0,d=0;
  int n=a.size();
  for(int i=n-1;.i>=0;i--)
  { 
    if(a[i]=='Z'){d=i;break;}
  }
  for(int i=0;.i<n;i++)
  { 
    if(a[i]=='A'){c=i;break;}
  }
  cout<<d-c+1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: expected primary-expression before '.' token
    9 |   for(int i=n-1;.i>=0;i--)
      |                 ^
a.cc:13:15: error: expected primary-expression before '.' token
   13 |   for(int i=0;.i<n;i++)
      |               ^
Language: C++

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

int main(){

string s;
  cin >> s;
  int a,b;
  for(int i=0;i<N;i++){
  if(s[i]=='A') a=i;
  if(s[N-1-i]=='Z') b=N-1-i;
  }
  cout << b-a+1 << endl;
}
  
    


}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'N' was not declared in this scope
    9 |   for(int i=0;i<N;i++){
      |                 ^
a.cc: At global scope:
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

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

int main(){

string s;
  cin >> s;
  
    
    bool x=false;
    for(int i=0;i<s.size();i++){
       int p=-1; 
       int count=0;
      if(s[i]=='A'){
        x=true;
        count++;
      }
      if(x) {
        count++;
      }
      if(s[i]=='Z' && x ){
        x=false;
        count++;
        if(p<count)p=count;
      }
    }
    cout << p << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:27:13: error: 'p' was not declared in this scope
   27 |     cout << p << endl;
      |             ^
Language: C++

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

int main(){

string s;
  cin >> s;
  
  int p=-1;  
    bool x=false;
    for(int i=0;i<s.size();i++){
       int count=0;
      if(s[i]=='A'){
        x=true;
        count++;
      }
      else if(x) {
        count++;
      }
      else if(s[i]=='Z'){
        x=false;
        count++;
        if(p<count)p=count;
      }
    cout << p << endl;
  }
     
   
 
    
    
    


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

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {

string s;
  cin>>s;
  ll max=0;
  ll count=0;
  for(ll i=0;i<s.size();i++) {
if(count==0&&S[i]=='A') {
count++;
}
    if(count>0) {
count++;
    }
    
    if(S[i]=='Z') {
max=count;
    }
  }
  
  cout<<max<<endl;
}
  
  

  
  
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: 'S' was not declared in this scope
   13 | if(count==0&&S[i]=='A') {
      |              ^
a.cc:20:8: error: 'S' was not declared in this scope
   20 |     if(S[i]=='Z') {
      |        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {

string s;
  cin>>s;
  ll max=0;
  ll count=0;
  for(ll i=0;i<S.size();i++) {
if(count==0&&S[i]=='A') {
count++;
}
    if(count>0) {
count++;
    }
    
    if(S[i]=='Z') {
max=count;
    }
  }
  
  cout<<max<<endl;
}
  
  

  
  
  
  
  


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

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

int main(){
  string s;
  cin >> s;
  int first_A = 0;
  int last_Z = s.size() - 1;
  for(int i = 0; i < s.size(); i++){
    if(s.(i) == 'A'){
      first_A = i;
      break;
    }
  }
  for(int i = s.size() - 1; i > 0; i--){
    if(s.(i) == 'Z'){
      last_Z = i;
      break;
    }
  }
  cout << last_Z - first_A + 1;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: expected unqualified-id before '(' token
   11 |     if(s.(i) == 'A'){
      |          ^
a.cc:17:10: error: expected unqualified-id before '(' token
   17 |     if(s.(i) == 'Z'){
      |          ^
Language: C++

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

#ifndef ONLINE_JUDGE
#  define LOG(x) (cerr <<">>>>>>"<< #x << " = " << (x) << endl)
#else
#  define LOG(x) ((void)0)
#endif


int main()
{
	
	string s;
	cin>>s;
	cout<<(max(0,s.find_last_of('Z')-s.find_first_of('A')))<<endl;
	
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: no matching function for call to 'max(int, std::__cxx11::basic_string<char>::size_type)'
   16 |         cout<<(max(0,s.find_last_of('Z')-s.find_first_of('A')))<<endl;
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:16:19: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'})
   16 |         cout<<(max(0,s.find_last_of('Z')-s.find_first_of('A')))<<endl;
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:16:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   16 |         cout<<(max(0,s.find_last_of('Z')-s.find_first_of('A')))<<endl;
      |                ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

int main() {
  string s;
  cin >> s;
  int a , b;
  for ( int i=0 ; i<s.size() ; i++){
    if ( s.at(i) == 'A'){
      a=i ;
      break ;
    }
  }
     for ( int i=0 ; i<s.size() ; i++){
    if ( s.at(i) == 'Z'){
      b=i ;
    }
     }
       cout << b-a+1 < <endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:24: error: expected primary-expression before '<' token
   19 |        cout << b-a+1 < <endl;
      |                        ^
Language: Java

import java.util.Scanner;

public class AToZString {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s=scan.nextLine();
		int c=-1,z=0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='A' && c==-1) {
				c=i;
			}
			if(s.charAt(i)=='Z') {
				z=i;
			}
		}
		System.out.println(z-c+1);
	}

}


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

import java.util.*;
 
public class Main{
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
    	String s = sc.next();
        int a;
        int z;
        for(int i = 0; i < s.length(); i++){
        	if(s.charAt(i) == 'A'){
            	a = i;
                break;
            }
        }
        for(int i = 0; i < s.length(); i++){
        	if(s.charAt(i) == 'Z'){
            	z = i + 1; 
            }
        }
        System.out.println(z - a);
	}
}

Compiler output:
Main.java:20: error: variable z might not have been initialized
        System.out.println(z - a);
                           ^
Main.java:20: error: variable a might not have been initialized
        System.out.println(z - a);
                               ^
2 errors
Language: Java

import java.util.*;
public class Main {
       public static void main(String[] args){
         Scanner sc = new Scanner(System.in);
         String s = sc.next();
         //Aが現れるのは何文字目？
         int a;
         for (a=0;a<s.length();a++) {
           if(s.charAt(i)=='A'){
             break;
           }
         }
         //Zが現れるのは何文字目？
         int z;
         for (z=s.length()-1;z>0;a--){
           if(s.charAt(i)=='Z'){
             break;
           }
         }
         System.out.println(z-a+1);
    }
}

Compiler output:
Main.java:9: error: cannot find symbol
           if(s.charAt(i)=='A'){
                       ^
  symbol:   variable i
  location: class Main
Main.java:16: error: cannot find symbol
           if(s.charAt(i)=='Z'){
                       ^
  symbol:   variable i
  location: class Main
2 errors
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
　	  String s = sc.next();    
      //Aが現れるのは何文字目？
       int a;
       for (a=0;a<s.length();a++) {
           if(s.charAt(i)=='A'){
             break;
           }
       }
       //Zが現れるのは何文字目？
       int z;
       for (z=s.length()-1;z>0;a--) {
           if(s.charAt(i)=='Z'){
             break;
           }
       }
      
      System.out.println(z-a+1);
    }
}

Compiler output:
Main.java:5: error: illegal character: '\u3000'
?	  String s = sc.next();    
^
1 error
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
　	  String str = sc.next();    
      //Aが現れるのは何文字目？
       int a;
       for (a=0;a<s.length();a++) {
           if(s.charAt(i)=='A'){
             break;
           }
       }
       //Zが現れるのは何文字目？
       int z;
       for (z=s.length()-1;z>0;a--) {
           if(s.charAt(i)=='Z'){
             break;
           }
       }
      
      System.out.println(z-a+1);
    }
}

Compiler output:
Main.java:5: error: illegal character: '\u3000'
?	  String str = sc.next();    
^
1 error
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        //値を取得
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String[] str = s.split("");
        int count = 0;
        int countStart = 0;
        
        //文字列を一文字ずつ取り出し、条件に合えばカウント
        //条件に合わないときは何もしない
        for (int i = 0; i < str.length; ++i){
            if (str[i].equals("A")){    //カウントの始まり
                countStart = 1;
            }
            if (start == 1){  //部分文字列のカウント
                ++count;
                if (str[i].equals("Z")){  //カウントの終わり
                    System.out.println(count);
                    break;	//Zにたどり着いた段階で、部分文字列の長さを表示して終了
                }
            }
        }
        
    }
}

Compiler output:
Main.java:18: error: cannot find symbol
            if (start == 1){  //??????????
                ^
  symbol:   variable start
  location: class Main
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;cin>>s;
  int a=0,z=0;
  for(int i=0;i<s.size();i++)if(s[i]=='A'){a=i;break;}
  for(int i=0;i<s.size();i++)if(s[i]=='Z')z=i;}
cout<<z-a+1;
}

Compiler output:
a.cc:8:1: error: 'cout' does not name a type
    8 | cout<<z-a+1;
      | ^~~~
a.cc:9:1: error: expected declaration before '}' token
    9 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
  string s;
  cin >> s;
 
  int count=0;
 
  if(s[i]=='A');cout<<i<<endl;
  if(s[i]=='Z');cout<<i<<endl;
     
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'i' was not declared in this scope
   10 |   if(s[i]=='A');cout<<i<<endl;
      |        ^
a.cc:10:23: error: 'i' was not declared in this scope
   10 |   if(s[i]=='A');cout<<i<<endl;
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
 
  int numa=0;
  int numz=0;
  int i=0;
  int j=s.size()-1;
  
  while(numa==0){
    if(s[i]=='a'){
      numa++;
    }
    i++;
  }
  
  while(numz==0){
    if(s[j]=='z'){
      nums++;
    }
    j--;
  }
  
  cout << j-i+1 << endl;
  
}

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

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

int main(){
    string s;
    cin>>s;
    int f,t;
    rep(i,s.size()){
        if(a[i]=='A'){
            f = i;
            break;
        }
    }
    per(i,s.size()){
        if(a[i]=='Z'){
            t = i;
            break;
        }
    }
    
    cout << t-f+1<< endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'a' was not declared in this scope
   14 |         if(a[i]=='A'){
      |            ^
a.cc:20:12: error: 'a' was not declared in this scope
   20 |         if(a[i]=='Z'){
      |            ^
Language: C++

#include <iostream>
using namespace std;
int main(void){
   string s;
   cin >> s;
   int a,z;
   for(int i = 0;i < n;i++){
         if(s[i] == 'A')a = i;
         break;
   }
   for(int i = s.size() - 1;i > 0;i--){
         if(s[i] == 'Z')z = i;
         break;
   }
   cout << z - a + 1 << endl;
}


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

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
  string s;
  cin >> s;
  int a,b;
  rep(i,s.size()){
    if(s.at(i)=='A'){
      a=i;
      break;
    }
  }
  for(int i=n;i>=0;i--){
    if(s.at(i)=='Z'){
      b=i;
      break;
    }
  }
  cout << b-a+1 << endl;
}

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

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
  string s;
  cin >> s;
  int a,b;
  rep(i,n){
    if(s.at(i)=='A'){
      a=i;
      break;
    }
  }
  for(int i=n;i>=0;i--){
    if(s.at(i)=='Z'){
      b=i;
      break;
    }
  }
  cout << b-a+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'n' was not declared in this scope
   12 |   rep(i,n){
      |         ^
a.cc:2:34: note: in definition of macro 'rep'
    2 | #define rep(i,n) for (int i=0;i<(n);i++)
      |                                  ^
a.cc:18:13: error: 'n' was not declared in this scope
   18 |   for(int i=n;i>=0;i--){
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int N=s.size();
  int a=0,b=0,kk=0;
  int cc=1<<30;
  for(int i=0;i<N,i++){
    if(s.at(i)=='A')a=i+1;
    if(cc>a)cc=a;
    if(s.at(i)=='Z')b=i+1;
    if(kk<b)kk=b;
  }
  cout << b-a+2 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:22: error: expected ';' before ')' token
    9 |   for(int i=0;i<N,i++){
      |                      ^
      |                      ;
Language: C++

#include<bits/stc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int N=s.size();
  int a=0,b=0,kk=0;
  int cc=1<<30;
  for(int i=0;i<N,i++){
    if(s.at(i)=='A')a=i+1;
    if(cc>a)cc=a;
    if(s.at(i)=='Z')b=i+1;
    if(kk<b)kk=b;
  }
  cout << b-a+2 << endl;
}


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

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  int a = 0;
  int z = 0;
  for(int i = 0;i < s.size();i++){
    if(s[i] == 'A'){
      a = i;
      break;
    }
  }
  for(int j = s.size() - 1;j >= 0;j--){
    if(s[i] == 'Z'){
      z = i;
      break;
    }
  }
  cout << z - a + 1 << endl;
}

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

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


int main(){

  string s;
  cin >> s;

  int first = -1;
  int last = -1;

  for(int i = 0; i < s.size(); ++i){
    if(s[i] == 'A'){
        first = i;
        break;
    }
  }

  reverse(s.begin(),s.end());

  for(int i = s.size - 1; i > 0; --i){
    if(s[i] == 'Z'){
        last = i;
        break;
    }
  }

  int ans = last - first;

  cout << ans << endl;


  return 0; 
}

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

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


int main(){

  string s;
  cin >> s;

  int first = -1;
  int last = -1;

  for(int i = 0; i < s.size(); ++i){
    if(s[i] == 'A'){
        first = i;
        break;
    }
  }

  s.reverse(s.begin(),s.end());

  for(int i = 0; i < s.size(); ++i){
    if(s[i] == 'Z'){
        last = i;
        break;
    }
  }

  int ans = last - first;

  cout << ans << endl;


  return 0; 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:5: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'reverse'; did you mean 'reserve'?
   20 |   s.reverse(s.begin(),s.end());
      |     ^~~~~~~
      |     reserve
Language: C++

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

int main() {
  string s;
  cin >> s;
  
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == 'A') {
      int x = i;
      break;
    }
  }
  
  for(int j = s.size() - 1; j > 0; j--) {
    if(s[j] == 'Z') {
      int y = j;
      break;
    }
  }
  
  cout << y - x + 1 << endl;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:22:11: error: 'y' was not declared in this scope
   22 |   cout << y - x + 1 << endl;
      |           ^
a.cc:22:15: error: 'x' was not declared in this scope
   22 |   cout << y - x + 1 << endl;
      |               ^
Language: C++

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

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

	int a = 0;
	int z = 0;
	rep(i,s.size()){
		if(s.at(i) == 'A'){
			a = i;
			break;
		}
	}
	rep(i, n){
		if(s.at(i) == 'Z')
			a = i;
	}

	cout << z-a << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: 'n' was not declared in this scope
   17 |         rep(i, n){
      |                ^
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
Language: C++

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

int main(){
  string s;
  while(cin >> str){
    int i = 0;
    for(i = 0; i < s.size(); i++)
      if(s[i] == 'A') break;
    int j = s.size() - 1;
    for(j = s.size() - 1; j >= 0; j--)
      if(s[j] == 'Z') break;
    cout << j - i + 1 << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:16: error: 'str' was not declared in this scope; did you mean 'std'?
    6 |   while(cin >> str){
      |                ^~~
      |                std
Language: C++

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    string s;
    cin >> s;
    int a, z;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'a') {a = i; continue;}
    }
    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i] == 'z') {z = i; continue;}
    }
    cout << z - a + 1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
    8 |     string s;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:9:5: error: 'cin' was not declared in this scope
    9 |     cin >> s;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:9:12: error: 's' was not declared in this scope
    9 |     cin >> s;
      |            ^
a.cc:17:5: error: 'cout' was not declared in this scope
   17 |     cout << z - a + 1;
      |     ^~~~
a.cc:17:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin>>s;
  int m;
  int l;
  for(int i=0;i<s.length();i++){
    if(s[i]=='A'){
         m=i;
         i=s.length();
    }
  }
  for(int i=s.length()-1;i>=m+1;i--)
  {
    if(s[i]=="Z"){
      l=i;
      i=s.length();
    }
  }
  cout<<l-m+1;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |     if(s[i]=="Z"){
Language: C++

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  string s;
  cin>>s;
  int m;
  int l;
  for(int i=0;i<s.length();i++){
    if(s[i]=='A'){
         m=i;
         i=s.length();
    }
  }
  for(int i=m+1;i<s.length();i++)
  {
    if(s[i]=="Z"){
      l=i;
      i=s.length();
    }
  }
  cout<<l-m+1;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |     if(s[i]=="Z"){
Language: C++

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

int main(){
  string s;
  
  int start = 0;
  int end = s.size()-1;
  
  while(true){
    if(s[start] == 'A') break;
    start++
  }
  
  while(true){
    if(s[end] == 'Z') break;
    end--;
  }
  
  
    
  
  cout << end - start +1  << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: expected ';' before '}' token
   12 |     start++
      |            ^
      |            ;
   13 |   }
      |   ~
Language: C++

#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  int N = s.size();
  int st = s.find("A");
  for(int i = 0;i < N; i++ ){
    if(s[i] == 'Z') ed = i;
  }
  cout << ed - st +1 << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'ed' was not declared in this scope
    9 |     if(s[i] == 'Z') ed = i;
      |                     ^~
a.cc:11:11: error: 'ed' was not declared in this scope
   11 |   cout << ed - st +1 << endl;
      |           ^~
Language: C++

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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    cin>>s[i];
  }
  if(s.at(i)=='A'){
    int i=F;
  }
  if(s.ar(i)=='Z'){
    int i=B;
  }
  cout<<B-F<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: 'i' was not declared in this scope
   10 |   if(s.at(i)=='A'){
      |           ^
a.cc:11:9: error: redeclaration of 'int i'
   11 |     int i=F;
      |         ^
a.cc:10:11: note: '<typeprefixerror>i' previously declared here
   10 |   if(s.at(i)=='A'){
      |           ^
a.cc:11:11: error: 'F' was not declared in this scope
   11 |     int i=F;
      |           ^
a.cc:13:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'ar'; did you mean 'at'?
   13 |   if(s.ar(i)=='Z'){
      |        ^~
      |        at
a.cc:13:11: error: 'i' was not declared in this scope
   13 |   if(s.ar(i)=='Z'){
      |           ^
a.cc:14:9: error: redeclaration of 'int i'
   14 |     int i=B;
      |         ^
a.cc:13:11: note: '<typeprefixerror>i' previously declared here
   13 |   if(s.ar(i)=='Z'){
      |           ^
a.cc:14:11: error: 'B' was not declared in this scope
   14 |     int i=B;
      |           ^
a.cc:16:9: error: 'B' was not declared in this scope
   16 |   cout<<B-F<<endl;
      |         ^
a.cc:16:11: error: 'F' was not declared in this scope
   16 |   cout<<B-F<<endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int i,j;
  for(i=0;i<s.size();i++){
    if(s.at(i)=='A'){
      break;
    }
  }
  for(j=s.size-1;j>=0;j--){
    if(s.at(j)=='Z'){
      break;
    }
  }
  cout << j-i+1;
}
  

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

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

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)
#define pv(x, n)    fr(iii, n) printf("%d%c", x[iii], " \n"[iii==n-1])
#define pvv(x, n)    frr(iii, n) printf("%d%c", x[iii], " \n"[iii==n])
#define vp(v)        pv(v, v.size()) 


#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()
#define otp(x) cout << x << endl;
#define rvr(x) int x; scanf("%d", &x)
#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f;

int main(){
    string s; cin >> s;
    int n = s.size();
    int a0 = -1, zf = -1;
    fr(i, n){
        if(s[i] == 'A' && a0 == -1) a0 = i;
        else if(s[i] == 'Z') zf = max(zf, i);
    }
    cout << zf - a0 + 1 << endl;

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

#define pb push_back
#define mp make_pair
#define fst first
#define snd second

#define fr(i,n) 	for(int i=0;i<n;i++)
#define frr(i,n)	for(int i=1;i<=n;i++)
#define pv(x, n)    fr(iii, n) printf("%d%c", x[iii], " \n"[iii==n-1])
#define pvv(x, n)    frr(iii, n) printf("%d%c", x[iii], " \n"[iii==n])
#define vp(v)        pv(v, v.size()) 


#define ms(x,i)	memset(x,i,sizeof(x))
#define dbg(x)	cout << #x << " = " << x << endl
#define all(x)	x.begin(),x.end()
#define otp(x) cout << x << endl;
#define rvr(x) int x; scanf("%d", &x)
#define gnl cout << endl
#define olar cout << "olar" << endl
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f;

int main(){
    string s; cin >> s;
    int n = s.size();
    int a0 = -1, zf = -1;
    fr(i, n){
        if(s[i] == 'A' && a0 == -1) a0 = i;
        else if(s[i] == 'Z') zf = max(zf, i);
    }
    cout << zf - a0 + 1 << endl;

}


Compiler output:
a.cc:77:11: error: redefinition of 'const int INF'
   77 | const int INF = 0x3f3f3f3f;
      |           ^~~
a.cc:32:11: note: 'const int INF' previously defined here
   32 | const int INF = 0x3f3f3f3f;
      |           ^~~
a.cc:78:10: error: redefinition of 'const ll llINF'
   78 | const ll llINF = 0x3f3f3f3f3f3f3f;
      |          ^~~~~
a.cc:33:10: note: 'const ll llINF' previously defined here
   33 | const ll llINF = 0x3f3f3f3f3f3f3f;
      |          ^~~~~
a.cc:80:5: error: redefinition of 'int main()'
   80 | int main(){
      |     ^~~~
a.cc:35:5: note: 'int main()' previously defined here
   35 | int main(){
      |     ^~~~
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdint>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  string s; cin >> s;
  int sum,count,ans;
  sum =  ans = 0;
  count = 1;
  rep(i,s.size()){
    if(s[i] == 'A'){
      while(s[i] != 'Z'){
        count ++;
        //cout << s[i] << endl;
        i++;
        //if(s[i+1] == 'Z'){
        //  count++;
        //}
        if(s.size() < i){
          break;
        }
      }
        if(s[i+1] == 'Z'){
          while(s[i+1] == 'Z'){
            count++;
            i++;
            if(s.size() < i){
          break;
        }
        }
      }
      ans = max(ans,count);
      count = 1;
    }
  cout << ans << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
  cin>>x;
  int N=s.size();
  int Min=0;
  int Max=N-1;
  for(int i=0;i<N;i++)
  if(s.at(i)=='A'){
  Min=i; break;
  }
  for(int i=N-1;0<i;i--)
    if(s.at(i)=='Z'){
    Max=i; break;
    }
  int ans=Max-Min+1;
  cout<<ans<<endl;
  
 
   return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<n;++i)
#define Sort(a) sort(a.begin(),a.end())
const int INF = 1e9+7;

int main(){
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s.at(i)=='A'){
      int cnt = 0;
      for(int j=i;j<s.size();++j){
        int t = 0;
        if(s.at(j)=='Z'){
          ++t;
          cnt = max(cnt,t);
        }else{
          ++t;
        }
      }
    }
  }
  cout << cnt << endl;
}

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

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

int main(){
  string S;
  cin >> S;
  for (int i = 0; i < S.size(); i++){
    if (S.at(i) == 'A'){
      int A = i;
      break;
    }
  }
  for (int i = S.size() - 1; i >= 0; i--){
    if (S.at(i) == 'Z'){
      int Z = i;
      break;
    }
  }
  cout << Z - A + 1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'Z' was not declared in this scope
   19 |   cout << Z - A + 1 << endl;
      |           ^
a.cc:19:15: error: 'A' was not declared in this scope
   19 |   cout << Z - A + 1 << endl;
      |               ^
Language: C++

#include<cstdio>
using namespace std;
const int MAXN = 200005;
char S[MAXN];

int main(){
  	scanf("%s", S);
  	int lastZ
    int firstA = -1;
  	for ( int i=0; S[i]; ++i ){
    	if ( S[i] == 'A' && firstA == -1 )
          	firstA = i;
      	if ( S[i] == 'Z' )
          	lastZ = i;
    }
  	printf("%d\n", lastZ - firstA + 1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: expected initializer before 'int'
    9 |     int firstA = -1;
      |     ^~~
a.cc:11:29: error: 'firstA' was not declared in this scope
   11 |         if ( S[i] == 'A' && firstA == -1 )
      |                             ^~~~~~
a.cc:14:17: error: 'lastZ' was not declared in this scope
   14 |                 lastZ = i;
      |                 ^~~~~
a.cc:16:24: error: 'lastZ' was not declared in this scope
   16 |         printf("%d\n", lastZ - firstA + 1);
      |                        ^~~~~
a.cc:16:32: error: 'firstA' was not declared in this scope
   16 |         printf("%d\n", lastZ - firstA + 1);
      |                                ^~~~~~
Language: C++

#include <string>
#include <iostream>
#include <vector>
using namespace std;
int main(){
  string s; cin >> s;
  vector<int> A,Z;
  for(int i=0;i<s.length();i++){
    if(s[i]='A') A.push_back(i);
    if(s[i]='Z') Z.push_back(i);
  }
  int z = *max_element(Z.begin(),Z.end());
  int a = *min_element(A.begin(),A.end());
  cout << (z-a)+1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: 'max_element' was not declared in this scope
   12 |   int z = *max_element(Z.begin(),Z.end());
      |            ^~~~~~~~~~~
a.cc:13:12: error: 'min_element' was not declared in this scope
   13 |   int a = *min_element(A.begin(),A.end());
      |            ^~~~~~~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
  string s;
  cin>>s;
  int ans1=1,ans2=s.size();
  int i=0;
  
  while(s[i]!='A'){
      ans1++;
    }
  i=0;
  while(s[s.size()-1-i]!='Z'){
      ans2--; 
    }
  }
  cout<<ans2-ans1+1<<endl;
}


Compiler output:
a.cc:18:3: error: 'cout' does not name a type
   18 |   cout<<ans2-ans1+1<<endl;
      |   ^~~~
a.cc:19:1: error: expected declaration before '}' token
   19 | }
      | ^
Language: C++

import java.util.*;
 
public class Main{
  public static void main(String[]args){
    Scanner sc =  new Scanner(System.in);
    String S = sc.nextLine();
    int a = S.indexOf("A");
    int z = S.lastIndexOf("Z");
    System.out.println(z-a+1);
  }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

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

int main() {
  string s;
  cin >> s;
  int start, end;
  for (int i=0; i<s.size(); i++) {
    if (s[i]=="Z") {
      start = i;
      break;
    }
  }
  for (int i=s.size()-1; i>0; i--) {
    if (s[i]=='Z') {
      end = i;
      break;
    }
  }
  cout << end - start << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if (s[i]=="Z") {
Language: C++

    #include <iostream>
    using namespace std;
     
    int main(){
      string s;
      cin >> s;
      int l = (int)s.length();
      
      loc_start = 0;
      loc_nd = 0;
      for(int i=0; i<l; i++){
        if( s[i] == 'A' ){
          loc_start = i;
          break
        }
      }
      for(int i=l-1; i>=0; i--){
        if( s[i] == 'Z' ){
          loc_end = i;
          break
        }
      }
      cout << loc_end - loc_start + 1 << endl;
      return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: 'loc_start' was not declared in this scope
    9 |       loc_start = 0;
      |       ^~~~~~~~~
a.cc:10:7: error: 'loc_nd' was not declared in this scope
   10 |       loc_nd = 0;
      |       ^~~~~~
a.cc:14:16: error: expected ';' before '}' token
   14 |           break
      |                ^
      |                ;
   15 |         }
      |         ~       
a.cc:19:11: error: 'loc_end' was not declared in this scope
   19 |           loc_end = i;
      |           ^~~~~~~
a.cc:20:16: error: expected ';' before '}' token
   20 |           break
      |                ^
      |                ;
   21 |         }
      |         ~       
a.cc:23:15: error: 'loc_end' was not declared in this scope
   23 |       cout << loc_end - loc_start + 1 << endl;
      |               ^~~~~~~
Language: C++

include <iostream>
using namespace std;

int main(){
  string s;
  cin >> s;
  int l = (int)s.length();
  
  loc_start = 0;
  loc_nd = 0;
  for(int i=0; i<l; i++){
    if( s[i] == 'A' ){
      loc_start = i;
      break
    }
  }
  for(int i=l-1; i>=0; i--){
    if( s[i] == 'Z' ){
      loc_end = i;
      break
    }
  }
  cout << loc_end - loc_start + 1 << endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string s;
      |   ^~~~~~
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> s;
      |   ^~~
a.cc:6:10: error: 's' was not declared in this scope
    6 |   cin >> s;
      |          ^
a.cc:9:3: error: 'loc_start' was not declared in this scope
    9 |   loc_start = 0;
      |   ^~~~~~~~~
a.cc:10:3: error: 'loc_nd' was not declared in this scope
   10 |   loc_nd = 0;
      |   ^~~~~~
a.cc:14:12: error: expected ';' before '}' token
   14 |       break
      |            ^
      |            ;
   15 |     }
      |     ~       
a.cc:19:7: error: 'loc_end' was not declared in this scope
   19 |       loc_end = i;
      |       ^~~~~~~
a.cc:20:12: error: expected ';' before '}' token
   20 |       break
      |            ^
      |            ;
   21 |     }
      |     ~       
a.cc:23:3: error: 'cout' was not declared in this scope
   23 |   cout << loc_end - loc_start + 1 << endl;
      |   ^~~~
a.cc:23:11: error: 'loc_end' was not declared in this scope
   23 |   cout << loc_end - loc_start + 1 << endl;
      |           ^~~~~~~
a.cc:23:38: error: 'endl' was not declared in this scope
   23 |   cout << loc_end - loc_start + 1 << endl;
      |                                      ^~~~
Language: C++

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

int main()
{
  string S;
  cin >> S;
  
  int A_ind = 0;
  int Z_ind = 0;
  
  for (int i = 0;i < S.size(); i++) {
    if(S.at(i) == 'A') {
      A_ind = i;
      break;
    }
  }
  for (int i = 0; i < S.size(); i++){
    if(S.at(S.size() -1 - i)  == 'Z') {
      Z_ind = S.size() - 1 - i;
      break;
    }
  }

  cout << Z_ind - A_ind + 1 << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:25:37: error: expected '}' at end of input
   25 |   cout << Z_ind - A_ind + 1 << endl;
      |                                     ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
  string s;
  cin >> s;
  int aplace;
  for(int i=0;i<s.size();i++){
    if(s.at(i) == 'A'){
      aplace = i;
      break;
    }
  }
  
  reverse(s.begin(),s.end());
  int zplace;  
  for(int i=0;i<s.size();i++){
    if(s.at(i) == 'Z'){
      zplace = s.size()-1-i;
      break;
    }
  }
  
  cout << zplace - aplace + 1 << endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: 'reverse' was not declared in this scope
   17 |   reverse(s.begin(),s.end());
      |   ^~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int a[200,000], z[200,000];
    int a_count = 0;
    int z_count = 0;
    //A,Zの位置を配列に記録
    for(int i = 0; i < s.length(); i++){
        if(s[i] == 'A'){
            a[a_count] = i;
            a_count ++;
        }else if(s[i] == 'Z'){
            z[z_count] = i;
            z_count ++;
        }
    }
    //(Zの位置)-(Aの位置) の値が最大になる時を探す
    int max = 0;
    for(int i = 0; i < a_count; i ++){
        for(int j = 0; j < z_count; j++){
            if(z[j] - a[i] > max){
                max = z[j] - a[i];
            }
        }
    }
    cout << max + 1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected ']' before ',' token
    7 |     int a[200,000], z[200,000];
      |              ^
      |              ]
a.cc:7:15: error: expected unqualified-id before numeric constant
    7 |     int a[200,000], z[200,000];
      |               ^~~
a.cc:13:13: error: 'a' was not declared in this scope
   13 |             a[a_count] = i;
      |             ^
a.cc:16:13: error: 'z' was not declared in this scope
   16 |             z[z_count] = i;
      |             ^
a.cc:24:16: error: 'z' was not declared in this scope
   24 |             if(z[j] - a[i] > max){
      |                ^
a.cc:24:23: error: 'a' was not declared in this scope
   24 |             if(z[j] - a[i] > max){
      |                       ^