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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   10 |             a = N.size(i);
      |                 ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   15 |             b = N.size(i);
      |                 ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
    9 |         if(N.at(i)="A"){
      |                    ^~~
      |                    |
      |                    const char*
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   10 |             a = N.size(i);
      |                 ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:20: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   14 |         if(N.at(i)="Z"){
      |                    ^~~
      |                    |
      |                    const char*
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   15 |             b = N.size(i);
      |                 ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |         if(N.at(i)=="A"){
      |            ~~~~~~~^~~~~
a.cc:10:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   10 |             a = N.size(i);
      |                 ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
a.cc:14:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |         if(N.at(i)=="Z"){
      |            ~~~~~~~^~~~~
a.cc:15:23: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   15 |             b = N.size(i);
      |                 ~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
Language: C++

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

int main(){
    int a,b,c;
    
    string N; 
    cin >> N; 
    for(int i=0; i < N.size();++i){
       if(N.at(i) == "A"){
        a = i;　　　　　
       }
       else if(N.at(i)=="Z"){
        b = i;
           for(int j=i+1;j<N.size();++j){
              if(N.at(j)=="Z"){
                  b=N.size(j);
              else{
                  break;
              }
              } 
           }
        }

       c=b-a; 
    }
    cout << c <<endl;
}

Compiler output:
a.cc:11:15: error: extended character 　 is not valid in an identifier
   11 |         a = i;　　　　　
      |               ^
a.cc:11:15: error: extended character 　 is not valid in an identifier
a.cc:11:15: error: extended character 　 is not valid in an identifier
a.cc:11:15: error: extended character 　 is not valid in an identifier
a.cc:11:15: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:10:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |        if(N.at(i) == "A"){
      |           ~~~~~~~~^~~~~~
a.cc:11:15: error: '\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
   11 |         a = i;　　　　　
      |               ^~~~~~~~~~
a.cc:13:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |        else if(N.at(i)=="Z"){
      |                ~~~~~~~^~~~~
a.cc:16:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   16 |               if(N.at(j)=="Z"){
      |                  ~~~~~~~^~~~~
a.cc:17:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   17 |                   b=N.size(j);
      |                     ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
a.cc:18:15: error: expected '}' before 'else'
   18 |               else{
      |               ^~~~
a.cc:16:31: note: to match this '{'
   16 |               if(N.at(j)=="Z"){
      |                               ^
a.cc: At global scope:
a.cc:27:5: error: 'cout' does not name a type
   27 |     cout << c <<endl;
      |     ^~~~
a.cc:28:1: error: expected declaration before '}' token
   28 | }
      | ^
Language: C++

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

int main(){
    int a,b,c;
    string N; 
    cin >> N; 
    for(int i=0; i < N.size() ;++i){
       if(N.at(i) == "A"){
        a=i;　　　　　
       }
       else if(N.at(i)=="Z"){
        b =i;
           for(int j=i+1;j<N.size();++j){
              if(N.at(j)=="Z"){
                  b=N.size(j);
              else{
                  break;
              }
              } 
           }
        }

       c=b-a; 
    }
    cout << c <<endl;
}

Compiler output:
a.cc:10:13: error: extended character 　 is not valid in an identifier
   10 |         a=i;　　　　　
      |             ^
a.cc:10:13: error: extended character 　 is not valid in an identifier
a.cc:10:13: error: extended character 　 is not valid in an identifier
a.cc:10:13: error: extended character 　 is not valid in an identifier
a.cc:10:13: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:9:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |        if(N.at(i) == "A"){
      |           ~~~~~~~~^~~~~~
a.cc:10:13: error: '\U00003000\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
   10 |         a=i;　　　　　
      |             ^~~~~~~~~~
a.cc:12:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |        else if(N.at(i)=="Z"){
      |                ~~~~~~~^~~~~
a.cc:15:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   15 |               if(N.at(j)=="Z"){
      |                  ~~~~~~~^~~~~
a.cc:16:27: error: no matching function for call to 'std::__cxx11::basic_string<char>::size(int&)'
   16 |                   b=N.size(j);
      |                     ~~~~~~^~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1076:7: note: candidate: '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]'
 1076 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:1076:7: note:   candidate expects 0 arguments, 1 provided
a.cc:17:15: error: expected '}' before 'else'
   17 |               else{
      |               ^~~~
a.cc:15:31: note: to match this '{'
   15 |               if(N.at(j)=="Z"){
      |                               ^
a.cc: At global scope:
a.cc:26:5: error: 'cout' does not name a type
   26 |     cout << c <<endl;
      |     ^~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: C++

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

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

  int count1,count2 = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str.at(i) == 'A') {
      count1=i+1;
      break;
    }
  }
  for(int i=str.size()-1;i>0;i--){
    if(str.at(i)=='Z'){
      count2=i+1;
      break;
    }
  }
  cout<<count2-count1+1<<endl;
}
      

  cout << count << endl;
}


Compiler output:
a.cc:25:3: error: 'cout' does not name a type
   25 |   cout << count << endl;
      |   ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

		
		if(S.at(i) == 'A'){
			
			flag = true;
			ans++;
			
		}else if(S.at(i) == 'Z' && flag == true){
			ans++;
			flag2 = true;
		}else if(S.at(i) != 'Z' && flag2 == true){
			flag = false;
			flag2 = false;			
			max_ans = max(max_ans , ans);
			ans = 0;
		}else if(flag == true){
			ans++;	
		}
	}
	
	max_ans =max(max_ans , ans);
	cout << max_ans << endl;
*/


}


Compiler output:
a.cc:2:17: error: expected unqualified-id before 'if'
    2 |                 if(S.at(i) == 'A'){
      |                 ^~
a.cc:7:18: error: expected unqualified-id before 'else'
    7 |                 }else if(S.at(i) == 'Z' && flag == true){
      |                  ^~~~
a.cc:10:18: error: expected unqualified-id before 'else'
   10 |                 }else if(S.at(i) != 'Z' && flag2 == true){
      |                  ^~~~
a.cc:15:18: error: expected unqualified-id before 'else'
   15 |                 }else if(flag == true){
      |                  ^~~~
a.cc:18:9: error: expected declaration before '}' token
   18 |         }
      |         ^
a.cc:20:9: error: 'max_ans' does not name a type
   20 |         max_ans =max(max_ans , ans);
      |         ^~~~~~~
a.cc:21:9: error: 'cout' does not name a type
   21 |         cout << max_ans << endl;
      |         ^~~~
a.cc:22:2: error: expected unqualified-id before '/' token
   22 | */
      |  ^
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

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

int main(){

string S;
cin >> S;

int min_x=S.size() , max_y = 0;

	for(int i = 0; i < S.size(); i++){ 
		if(S.at(i) == 'A'){
			min_x = min(min_x, i);	
		}else if(S.at(i) == 'Z'){
			max_y = (max_y, i);	
		}
	}
if(max_y > min_x){
cout << max_y - min_x + 1 << endl;
}
	
}
/*
int ans = 0, max_ans = 0;
bool flag = false, flag2 = false;

	for(int i = 0; i < S.size(); i++){ 
		
		if(S.at(i) == 'A'){
			
			flag = true;
			ans++;
			
		}else if(S.at(i) == 'Z' && flag == true){
			ans++;
			flag2 = true;
		}else if(S.at(i) != 'Z' && flag2 == true){
			flag = false;
			flag2 = false;			
			max_ans = max(max_ans , ans);
			ans = 0;
		}else if(flag == true){
			ans++;	
		}
	}
	
	max_ans =max(max_ans , ans);
	cout << max_ans << endl;
*/


}


Compiler output:
a.cc:52:1: error: expected declaration before '}' token
   52 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <string>
 
int main() {
  string S;
  cin>>S;
  int A,Z;
  for(int i=0 ; i<S.size() ; i++){
    if(S[i] =='A'){
      A=i+1;
      break;
    }
  }
  string sue=std::reverse(S.begin(), S.end());
  for(int i=0 ; i<sue.size() ; i++){
    if(sue[i] =='Z'){
      Z =S.size()-i;
      break;
    }
  }
  cout<<Z-A+1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   15 |   string sue=std::reverse(S.begin(), S.end());
      |              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  int A,Z;
  for(int i=0 ; i<S.size() ; i++){
    if(S[i] =='A'){
      A=i+1;
      break;
    }
  }
  string sue=std::reverse(S.begin(), S.end());
  for(int i=0 ; i<sue.size() ; i++){
    if(sue[i] =='Z'){
      Z =S.size()-i;
      break;
    }
  }
  cout<<Z-A+1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:26: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   14 |   string sue=std::reverse(S.begin(), S.end());
      |              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:24: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   14 |   string sue =  reverse(S.begin(), S.end());
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin>>S;
  int A,Z;
  for(int i=0 ; i<S.size() ; i++){
    if(S[i] =='A'){
      A=i+1;
      break
    }
  }
  string sue =	reverse(S.begin(), S.end());
  for(int i=0 ; i<sue.size() ; i++){
    if(sue[i] =='Z'){
      Z =N-i;
      break
    }
  }
  cout<<Z-A+1<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: expected ';' before '}' token
   11 |       break
      |            ^
      |            ;
   12 |     }
      |     ~       
a.cc:14:24: error: conversion from 'void' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   14 |   string sue =  reverse(S.begin(), S.end());
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~
a.cc:17:10: error: 'N' was not declared in this scope
   17 |       Z =N-i;
      |          ^
a.cc:18:12: error: expected ';' before '}' token
   18 |       break
      |            ^
      |            ;
   19 |     }
      |     ~
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:9:46: note: to match this '{'
    9 |         for (int i = 0; i < s.length(); i++) {
      |                                              ^
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
int main(){
char c;
int i=1; 
int l=100000;
int r=0;
while(cin>>c){
if(c=='A'&&i<l)l=i;
if(c=='Z'&&r<i)r=i;
I++;}
cout<<max(0,r-l+1)<<endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:1: error: 'I' was not declared in this scope
   12 | I++;}
      | ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: expected initializer before 'for'
    8 |   for(i=0;i<N;i++){
      |   ^~~
a.cc:8:18: error: expected ';' before ')' token
    8 |   for(i=0;i<N;i++){
      |                  ^
      |                  ;
a.cc:13:7: error: 'j' was not declared in this scope
   13 |   for(j=N-1;j>=0;j--){
      |       ^
a.cc:18:9: error: 'j' was not declared in this scope
   18 |   cout<<j-i+1<<endl;
      |         ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'N' was not declared in this scope
    6 |   N=s.size();
      |   ^
a.cc:17:9: error: 'j' was not declared in this scope
   17 |   cout<<j-i+1<<endl;
      |         ^
a.cc:17:11: error: 'i' was not declared in this scope
   17 |   cout<<j-i+1<<endl;
      |           ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'N' was not declared in this scope
    6 |   for(int i=0;i<N;i++){
      |                 ^
a.cc:11:13: error: 'N' was not declared in this scope
   11 |   for(int j=N-1;j>=0;j--){
      |             ^
a.cc:16:9: error: 'j' was not declared in this scope
   16 |   cout<<j-i+1<<endl;
      |         ^
a.cc:16:11: error: 'i' was not declared in this scope
   16 |   cout<<j-i+1<<endl;
      |           ^
Language: C++

#include<bits/stdc++>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<N;i++){
    if(s[i]=='A'){
      break;
    }
  }
  for(int j=N-1;j>=0;j--){
    if(s[j]=='Z'){
      break;
    }
  }
  cout<<j-i+1<<endl;
}

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

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected ';' before '<' token
    8 |   for(int i=0, i<s.length(); i++) {
      |                 ^
      |                 ;
a.cc:8:17: error: expected primary-expression before '<' token
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected ';' before '<' token
    8 |   for(int i=0, i<s.size(); i++) {
      |                 ^
      |                 ;
a.cc:8:17: error: expected primary-expression before '<' token
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: expected ';' before '<' token
    8 |   for(int i=0, i<s.length(); i++) {
      |                 ^
      |                 ;
a.cc:8:17: error: expected primary-expression before '<' token
Language: C++

#include <iostream>
#include <string>
#include<math.h>
using namespace std;

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

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected initializer before 'cin'
    8 |         cin >> s;
      |         ^~~
a.cc:10:17: error: 's' was not declared in this scope
   10 |         int z = s.size() - 1;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main () {
  string s;
  cin >> s;
  int countf = 0, countb = 0;
  
  for(char a: s) {
    if(a == 'A') break;
    else countf++;
  }
  for(int a = s.size() - 1; i != 0; i--) {
    if(s.at(i) == 'Z') break;
    else countb++;
  }
  cout << s.size() - countf - countb << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:29: error: 'i' was not declared in this scope
   12 |   for(int a = s.size() - 1; i != 0; i--) {
      |                             ^
Language: C++

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

int main() {
  string str;
  int begin,end;

  cin >> str;
  for(int i = 0;i < str.size();i++){
    if(str.at(i) == 'A'){
      begin = i;
      break;
    }
  }
  
  for(int i = str.size() - 1;i > 0;i--){
    if(str.at(i) == 'Z'){
      end = i;
      break;
    }

  cout << end - begin - 1 << endl;
}

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

#include <iostream>
using namespace std;

int main()
{
    char s[200005];
    cin >> s;
    int length = strlen(s);
    int begin, end;
    for(int i=0; i<length; i++){
        if(s[i]=='A'){
            begin=i+1;
            break;
        }
    }
    for(int i=length-1; i>=0; i--){
        if(s[i]=='Z'){
            end=i+1;
            break;
        }
    }
    cout << end-begin+1 << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:18: error: 'strlen' was not declared in this scope
    8 |     int length = strlen(s);
      |                  ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  char s[200100];
  cin >> s;

  cout << strrchr(s, 'Z') - strchr(s, 'A')  + 1 << endl;


  return 0;
}

#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  char s[200100];
  cin >> s;

  cout << strrchr(s, 'Z') - strchr(s, 'A')  + 1 << endl;


  return 0;
}



Compiler output:
a.cc:30:39: error: redefinition of 'template<class A, class B> bool chmax(A&, const B&)'
   30 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:8:39: note: 'template<class A, class B> bool chmax(A&, const B&)' previously declared here
    8 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:31:39: error: redefinition of 'template<class A, class B> bool chmin(A&, const B&)'
   31 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:9:39: note: 'template<class A, class B> bool chmin(A&, const B&)' previously declared here
    9 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
      |                                       ^~~~~
a.cc:32:15: error: redefinition of 'constexpr const int INF'
   32 | constexpr int INF = 0x3f3f3f3f;
      |               ^~~
a.cc:10:15: note: 'constexpr const int INF' previously defined here
   10 | constexpr int INF = 0x3f3f3f3f;
      |               ^~~
a.cc:34:8: error: redefinition of 'int main()'
   34 | signed main()
      |        ^~~~
a.cc:12:8: note: 'int main()' previously defined here
   12 | signed main()
      |        ^~~~
Language: C++

#include<bis/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  int a=s.find("A");
  int b=s.find("B");
  cout<<b-a+1;}

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

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

int main(){
  string s;
  int ans,a,z;
  bool flag = 0;
  cin >> s;
  for(int i=0;i<s.size(),i++){
    if(s[i] == "A" && flag == false){
      a = i;
      flag = ture;
    }
    if(s[i] == "Z") z = i;
  }
  ans = z-a+1;
  cout << ans << endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:9:29: error: expected ';' before ')' token
    9 |   for(int i=0;i<s.size(),i++){
      |                             ^
      |                             ;
a.cc:10:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   10 |     if(s[i] == "A" && flag == false){
a.cc:12:14: error: 'ture' was not declared in this scope
   12 |       flag = ture;
      |              ^~~~
a.cc:14:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   14 |     if(s[i] == "Z") z = i;
Language: C

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

int main(int argc, char const *argv[])
{
	int a,z;
	char S[200000];
	scanf("%s",S);
	for (int a = 0; strcmp(S[i],'A') != 0; ++a);
	for (int z = strlen(S); strcmp(S[i],'Z') != 0; --z);
	printf("%d\n",z - a);
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:34: error: 'i' undeclared (first use in this function)
   10 |         for (int a = 0; strcmp(S[i],'A') != 0; ++a);
      |                                  ^
main.c:10:34: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:37: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   10 |         for (int a = 0; strcmp(S[i],'A') != 0; ++a);
      |                                     ^~~
      |                                     |
      |                                     int
In file included from main.c:3:
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:11:45: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   11 |         for (int z = strlen(S); strcmp(S[i],'Z') != 0; --z);
      |                                             ^~~
      |                                             |
      |                                             int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:21:20: error: expected ';' before 'cout'
   21 |   ans = end - start
      |                    ^
      |                    ;
   22 |   cout << ans << endl;
      |   ~~~~
Language: C++

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

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


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

#include <cstdio>
char s[200005];
int main()
{
    int b,c;
    scanf("%s",s);
    int len=strlen(s);
    for(int i=0;i<len;i++)
    {
        if(s[i]=='A')
        {
            b=i;
            for (int j = i; j < len; j++)
            {
                if(s[j]=='Z')
                {
                    c=j;
                }
            }
        }
    }
    printf("%d\n",c-b+1 );
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:13: error: 'strlen' was not declared in this scope
    7 |     int len=strlen(s);
      |             ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <cstdio>
  +++ |+#include <cstring>
    2 | char s[200005];
Language: C++

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

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

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

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

int main() {
	string S;
	cin>>S;
	int N=S.size();
	int ans=0;
	int a=inf,b=0;
	rep(i,N){
		if(S[i]=='A')a = min(a,i);
		else if(S[i]=='Z')b =max(b,i);
	}
	ans=b-a+1;
	cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:17:25: error: expected '}' at end of input
   17 |         cout<<ans<<endl;
      |                         ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
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 N=S.size();
	int ans=0;
	int a=inf,b=0;
	rep(i,N){
		if(S[i]=='A')a = min(a,i);
		else if(S[i]=='Z')b =max(b,i);
	}
	ans=b-a+1;
	cout<<ans<<endl;


Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   10 |         int a=inf,b=0;
      |               ^~~
      |               ynf
a.cc:13:35: error: 'b' was not declared in this scope
   13 |                 else if(S[i]=='Z')b =max(b,i);
      |                                   ^
a.cc:15:13: error: 'b' was not declared in this scope
   15 |         ans=b-a+1;
      |             ^
a.cc:16:25: error: expected '}' at end of input
   16 |         cout<<ans<<endl;
      |                         ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C

#include<stdio.h.

int main(){
  char s[200001];
  int i = 0, len = 0, a[200000], j, k, count;
  
  scanf("%s", s);
  while(s[len]){
    if(s[len] = 'A'){
      a[i++] = len;
    }
    len++;
  }
  
  for (j = 0; j < i; j++){
    for (k = a[j]; k < len; k++){
      if(s[k] == 'Z'){
        count++;
      }
    }
  }
  
  printf("%d\n", count);
  
  return 0;
}

Compiler output:
main.c:1:18: error: missing terminating > character
    1 | #include<stdio.h.
      |                  ^
main.c:1:9: fatal error: stdio.h.: No such file or directory
    1 | #include<stdio.h.
      |         ^
compilation terminated.
Language: C++

#include<iostream>
using namespace std;

int main(){
  int a_i=0,z_i=0;
  string str;
  cin >> str;
  for(int i = 0;i < str.size();+;i){
    if(str[i]=='a'){
      a_i = i;
      break;
    }
  }
  for(int i = 0;i < str.size();+;i){
    if(str[i]=='z'){
      z_i = i;
    }
  }
  cout << a_i - z_i + 1<< endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:33: error: expected primary-expression before ';' token
    8 |   for(int i = 0;i < str.size();+;i){
      |                                 ^
a.cc:8:33: error: expected ')' before ';' token
    8 |   for(int i = 0;i < str.size();+;i){
      |      ~                          ^
      |                                 )
a.cc:8:34: error: 'i' was not declared in this scope
    8 |   for(int i = 0;i < str.size();+;i){
      |                                  ^
a.cc:14:33: error: expected primary-expression before ';' token
   14 |   for(int i = 0;i < str.size();+;i){
      |                                 ^
a.cc:14:33: error: expected ')' before ';' token
   14 |   for(int i = 0;i < str.size();+;i){
      |      ~                          ^
      |                                 )
a.cc:14:35: error: expected ';' before ')' token
   14 |   for(int i = 0;i < str.size();+;i){
      |                                   ^
      |                                   ;
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 'b' was not declared in this scope
   19 |     int c = b-a+1;
      |             ^
a.cc:19:15: error: 'a' was not declared in this scope
   19 |     int c = b-a+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: 'b' was not declared in this scope
   17 |     int c = b-a+1;
      |             ^
a.cc:17:15: error: 'a' was not declared in this scope
   17 |     int c = b-a+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'j' was not declared in this scope
   15 |     int c = j-i+1;
      |             ^
a.cc:15:15: error: 'i' was not declared in this scope
   15 |     int c = j-i+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'j' was not declared in this scope
   12 |     int c = j-i+1;
      |             ^
a.cc:12:15: error: 'i' was not declared in this scope
   12 |     int c = j-i+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'b' was not declared in this scope
   14 |     int c = b-a+1;
      |             ^
a.cc:14:15: error: 'a' was not declared in this scope
   14 |     int c = b-a+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:14:15: error: 'a' was not declared in this scope
   14 |     int c = b-a+1;
      |               ^
a.cc:16:2: error: expected '}' at end of input
   16 | }
      |  ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'b' was not declared in this scope
   12 |     int c = b-a+1;
      |             ^
a.cc:12:15: error: 'a' was not declared in this scope
   12 |     int c = b-a+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'y' was not declared in this scope
   12 |     int z = y-x+1;
      |             ^
a.cc:12:15: error: 'x' was not declared in this scope
   12 |     int z = y-x+1;
      |               ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'y' was not declared in this scope
   12 |     int z = y-x+1;
      |             ^
a.cc:12:15: error: 'x' was not declared in this scope
   12 |     int z = y-x+1;
      |               ^
Language: C++

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

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

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

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

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

Compiler output:
a.cc:3:1: error: 'use' does not name a type
    3 | use namespace std;
      | ^~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'string' was not declared in this scope
    6 |     string s;
      |     ^~~~~~
a.cc:6:5: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |     cin >> s;
      |     ^~~
      |     std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:12: error: 's' was not declared in this scope
    7 |     cin >> s;
      |            ^
a.cc:12:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   12 |     cout << y-x+1 << 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:12:13: error: 'y' was not declared in this scope
   12 |     cout << y-x+1 << endl;
      |             ^
a.cc:12:15: error: 'x' was not declared in this scope
   12 |     cout << y-x+1 << endl;
      |               ^
a.cc:12:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   12 |     cout << y-x+1 << 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 <iostream>
    #include <string>
    #include <bits/stdc++.h>
     
    using namespace std;
     
    int main(){
      string  s;
      cin >> s;
      int a = 0;
      int z = 0;
      
      for(int i = 0; i < s.length(); i++) {
        if(s.at(i) == 'A') a = i;
        break;
      }
      
      for(int i = s.length; i >= 0; i--) {
        if(s.at(i) == 'Z') z = i;
        break;
      }
      cout << z-a << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:18:21: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
   18 |       for(int i = s.length; i >= 0; i--) {
      |                     ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	string s;
	int n,i;
	i = 0;
	cin >> s;
	while (s[i] != "\0") {
		i++;
	}
	i--;
	int a, b;
	a = 0; b = i;
	while (s[a] != 'A') {
		a++;
	}
	while (s[b] != 'Z') {
		b--;
	}
	cout << b - a + 1 << endl;
	return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int pos1=0,pos2=0,len=s.size();
	len--;
	while(s[pos]!='A') pos1++;
	while(s[pos]!='Z') pos2--;
	int p=pos2-pos1+1;
	cout<<p;
	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: 'pos' was not declared in this scope; did you mean 'pos2'?
    8 |         while(s[pos]!='A') pos1++;
      |                 ^~~
      |                 pos2
a.cc:9:17: error: 'pos' was not declared in this scope; did you mean 'pos2'?
    9 |         while(s[pos]!='Z') pos2--;
      |                 ^~~
      |                 pos2
Language: C++

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

int main() {
  string S;
  cin >> S;
  int A, Z;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == 'A') {
      A = i;
      break;
    }
  }
  for (int i = S.length() - 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:14:36: error: expected primary-expression before '<' token
   14 |   for (int i = S.length() - 1; i = < 0; i--) {
      |                                    ^