submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s844632588 | p03814 | 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;
}
| 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++) {
| ^
|
s776799412 | p03814 | 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;
} | 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'){
| ^
|
s487425796 | p03814 | 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;
}
| 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;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s299568897 | p03814 | 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;
} | a.cc: In function 'int main()':
a.cc:19:24: error: expected primary-expression before '<' token
19 | cout << b-a+1 < <endl;
| ^
|
s764914477 | p03814 | C++ | /*
author : nishi5451
created : 12.08.2020 22:17:17
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
int main(){
string s;
cin > s;
int first,last;
rep(i,int(s.size()))
if(s[i]=='A'){
first=i;
break;
}
rep(i,int(s.size()))
if(s[i]=='Z') last=i;
cout << last-first+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
14 | cin > s;
| ~~~ ^ ~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:6:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1329 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1497 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1673 | operator>(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
14 | cin > s;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
14 | cin > s;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
14 | cin > s;
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
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:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | cin > s;
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | cin > s;
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
14 | cin > s;
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::o |
s628598064 | p03814 | 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);
}
}
| Main.java:3: error: class AToZString is public, should be declared in a file named AToZString.java
public class AToZString {
^
1 error
|
s062070349 | p03814 | 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);
}
} | 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
|
s677643146 | p03814 | 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);
}
} | 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
|
s579709104 | p03814 | 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);
}
} | Main.java:5: error: illegal character: '\u3000'
? String s = sc.next();
^
1 error
|
s828412457 | p03814 | 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);
}
} | Main.java:5: error: illegal character: '\u3000'
? String str = sc.next();
^
1 error
|
s638837580 | p03814 | 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にたどり着いた段階で、部分文字列の長さを表示して終了
}
}
}
}
} | Main.java:18: error: cannot find symbol
if (start == 1){ //??????????
^
symbol: variable start
location: class Main
1 error
|
s130850664 | p03814 | C++ | Check corner cases.
N = 1
No def int long long for now.
Add something here.
*/
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef long double ld;
int mod = 1000000007;
ll dp[100005];
const ll INF = 1e18;
ll gcd(long long a,long long b){
if(b == 0)
return a;
else return gcd(b,a%b);
}
bool sortbyval(const pair<string, int> &a,
const pair<string, int> &b){
return (a.second < b.second);
}
int main(){
string s;
cin>>s;
int start=0,ends=-2;
for(int i=0;i<s.length();i++){
if(s[i] == 'A'){
start = i;
break; }
}
for(int i=0;i<s.length();i++){
if(s[i] == 'Z'){
if(i>ends)
ends = i; }
}
//cout<<start<<" "<<ends<<endl;
ends = ends+1;
cout<<ends-start<<endl;
return 0;
}
| a.cc:1:1: error: 'Check' does not name a type
1 | Check corner cases.
| ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:7:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| |
s125781830 | p03814 | 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;
} | 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 | }
| ^
|
s543636218 | p03814 | 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;
}
| 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;
| ^
|
s727126723 | p03814 | 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;
} | 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
|
s531849439 | p03814 | 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;
} | 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'){
| ^
|
s166740907 | p03814 | 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;
}
| 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++){
| ^
|
s752026557 | p03814 | C++ | int main(void){
string s;
cin >> s;
int b, e;
for(int i = 0; i < s.size(); i++){
if(s.at(i) == 'A'){
b = i;
break;
}
}
for(int i = s.size()-1; i>=0; i--){
if(s.at(i) == 'Z'){
e = i;
break;
}
}
cout << e-b+1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:2:3: error: 'string' was not declared in this scope
2 | string s;
| ^~~~~~
a.cc:3:3: error: 'cin' was not declared in this scope
3 | cin >> s;
| ^~~
a.cc:3:10: error: 's' was not declared in this scope
3 | cin >> s;
| ^
a.cc:17:3: error: 'cout' was not declared in this scope
17 | cout << e-b+1 << endl;
| ^~~~
a.cc:17:20: error: 'endl' was not declared in this scope
17 | cout << e-b+1 << endl;
| ^~~~
|
s608055158 | p03814 | 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;
} | 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--){
| ^
|
s933018475 | p03814 | 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;
} | 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--){
| ^
|
s925076554 | p03814 | 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;
}
| a.cc: In function 'int main()':
a.cc:9:22: error: expected ';' before ')' token
9 | for(int i=0;i<N,i++){
| ^
| ;
|
s215003205 | p03814 | 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;
}
| a.cc:1:9: fatal error: bits/stc++.h: No such file or directory
1 | #include<bits/stc++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s534791935 | p03814 | 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;
} | a.cc: In function 'int main()':
a.cc:24:10: error: 'i' was not declared in this scope
24 | if(s[i] == 'Z'){
| ^
|
s476602973 | p03814 | 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;
} | 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){
| ~~^~~~
| ()
|
s078965793 | p03814 | 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;
} | 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
|
s294889369 | p03814 | 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;
} | 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;
| ^
|
s087080694 | p03814 | 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;
} | 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++)
| ^
|
s132963169 | p03814 | 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;
} | 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
|
s954946199 | p03814 | 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;
} | 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>'
|
s123043378 | p03814 | 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;
} | 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"){
|
s690143150 | p03814 | 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;
} | 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"){
|
s953246114 | p03814 | 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;
} | a.cc: In function 'int main()':
a.cc:12:12: error: expected ';' before '}' token
12 | start++
| ^
| ;
13 | }
| ~
|
s002316794 | p03814 | 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;
} | 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;
| ^~
|
s433677836 | p03814 | 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;
} | 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;
| ^
|
s929448348 | p03814 | 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;
}
| 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--){
| ~~^~~~
| ()
|
s860212879 | p03814 | 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;
}
| 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(){
| ^~~~
|
s533635869 | p03814 | 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;
} | 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(){
| ^
|
s246393665 | p03814 | 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;
} | a.cc: In function 'int main()':
a.cc:5:8: error: 'x' was not declared in this scope
5 | cin>>x;
| ^
|
s455580268 | p03814 | 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;
} | 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
|
s491554831 | p03814 | 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;
} | 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;
| ^
|
s734003019 | p03814 | 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;
} | 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);
| ^~~~~~
|
s804017918 | p03814 | 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;
} | 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());
| ^~~~~~~~~~~
|
s534922915 | p03814 | 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;
}
| 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 | }
| ^
|
s713865404 | p03814 | 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);
}
} | 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{
| ^~~~~~
|
s357303864 | p03814 | 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;
} | 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") {
|
s436266770 | p03814 | 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;
} | 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;
| ^~~~~~~
|
s449325356 | p03814 | 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;
} | 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;
| ^~~~
|
s225004689 | p03814 | 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; | 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 | {
| ^
|
s617780820 | p03814 | 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;
}
| a.cc: In function 'int main()':
a.cc:17:3: error: 'reverse' was not declared in this scope
17 | reverse(s.begin(),s.end());
| ^~~~~~~
|
s440530917 | p03814 | 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;
} | 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){
| ^
|
s412791162 | p03814 | 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 beg,end;
for(int i = 0; i < n; i++){
if(s[i] == 'A'){
beg = i;
break;
}
}
for(int i = n-1; i >= 0; i--){
if(s[i] == 'Z'){
end = i;
break;
}
}
cout << end - beg << endl;
}
| a.cc: In function 'int main()':
a.cc:8:5: error: expected ',' or ';' before 'int'
8 | int beg,end;
| ^~~
a.cc:11:13: error: 'beg' was not declared in this scope
11 | beg = i;
| ^~~
a.cc:17:19: error: overloaded function with no contextual type information
17 | end = i;
| ^
a.cc:21:19: error: 'beg' was not declared in this scope
21 | cout << end - beg << endl;
| ^~~
|
s735117676 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int start = 0;
int end = s.size();
for (int i = 0; i < end; i++) {
if (S[i] == 'A') {
start = i;
break;
}
}
for (int i = end - 1; i >= 0; i--) {
if (S[i] == 'Z') {
end = i;
break;
}
}
int ans = end - start + 1;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:9: error: 'S' was not declared in this scope
9 | if (S[i] == 'A') {
| ^
a.cc:15:9: error: 'S' was not declared in this scope
15 | if (S[i] == 'Z') {
| ^
|
s213711275 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int start = 0;
int end = s.size();
for (int i = 0; i < end; i++) {
if (s[i] == 'A') {
start = i;
break;
}
}
for (int i = end - 1; i >= 0; i--) {
if (S[i] == 'Z') {
end = i;
break;
}
}
int ans = end - start + 1;
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'S' was not declared in this scope
15 | if (S[i] == 'Z') {
| ^
|
s924206375 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
string s; cin>>s;
int len = s.size();
int start = 0, end = 0;
int s_flag = 0;
for(int i = 0; i < len; i++){
if(s[i] == 'A' && s_flag == 0){
s_flag = 1;
start = i;
}
else if(s[i] == 'Z' && e_flag == 0){
end = i;
}
}
cout<<end+1-start<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:40: error: 'e_flag' was not declared in this scope; did you mean 's_flag'?
17 | else if(s[i] == 'Z' && e_flag == 0){
| ^~~~~~
| s_flag
|
s319023260 | p03814 | Java |
public class Sample{
String s;
public Sample(String str){
s = str;
}
public int searchA(){
return s.indexOf("A");
}
public int searchZ(){
return s.lastIndexOf("Z") + 1;
}
public static void main(String[] args){
Sample sample = new Sample(args[0]);
int start = sample.searchA();
int end = sample.searchZ();
System.out.println(end - start);
}
}
| Main.java:2: error: class Sample is public, should be declared in a file named Sample.java
public class Sample{
^
1 error
|
s223151653 | p03814 | Java |
public class Sample{
String s;
public Sample(String str){
s = str;
}
public int searchA(){
return s.indexOf("A");
}
public int searchZ(){
return s.lastIndexOf("Z") + 1;
}
public static void main(String[] args){
Sample sample = new Sample(args[0]);
int start = sample.searchA();
int end = sample.searchZ();
System.out.println(end - start);
}
}
| Main.java:2: error: class Sample is public, should be declared in a file named Sample.java
public class Sample{
^
1 error
|
s118064038 | p03814 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;
int main(){
string s;
cin>>s;
int a,b;
for(int i=0;i<n;i++){
if(s[i]=='A'){
a=i;
break;
}
}
for(int i=n-1;i>=0;i--){
if(s[i]=='Z'){
b=i;
break;
}
}
cout<<b-a+1<<endl;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'n' was not declared in this scope
15 | for(int i=0;i<n;i++){
| ^
a.cc:21:13: error: 'n' was not declared in this scope
21 | for(int i=n-1;i>=0;i--){
| ^
|
s682952116 | p03814 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;
int main(){
sring s;
cin>>s;
int a,b;
for(int i=0;i<n;i++){
if(s[i]=='A'){
a=i;
break;
}
}
for(int i=n-1;i>=0;i--){
if(s[i]=='Z'){
b=i;
break;
}
}
cout<<b-a+1<<endl;
} | a.cc: In function 'int main()':
a.cc:12:3: error: 'sring' was not declared in this scope
12 | sring s;
| ^~~~~
a.cc:13:8: error: 's' was not declared in this scope
13 | cin>>s;
| ^
a.cc:15:17: error: 'n' was not declared in this scope
15 | for(int i=0;i<n;i++){
| ^
a.cc:21:13: error: 'n' was not declared in this scope
21 | for(int i=n-1;i>=0;i--){
| ^
|
s526195719 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int an,zn;
an=-1;
zn=-1;
for(int i=0;i<s.size();i++){
if(s.at(i)=='A'){
an=i;
break;
}
}
for(int i=s.size-1;i>=0;i--){
if(s.at(i)=='Z'){
zn=i;
break;
}
}
cout << zn-an+1 << endl;
}
| a.cc: In function 'int main()':
a.cc:16:15: 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 '()' ?)
16 | for(int i=s.size-1;i>=0;i--){
| ~~^~~~
| ()
|
s237292514 | p03814 | C++ | #include<iostream>
using namespace std;
string s;
int main(){
int l,r;
cin>>s;
for(int i=0;i<s.size();i++)
if(s[i]=='A'){
l=i;
break;}
for(int i=0;i<s.size();i++)
if(a[i]=='Z'){
r=i;
break;}
cout<<r-l+1<<endl;} | a.cc: In function 'int main()':
a.cc:12:4: error: 'a' was not declared in this scope
12 | if(a[i]=='Z'){
| ^
|
s742962560 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int fst = -1,ed = -1;
for(int i = 0;i < s.size();i++)
{
if(s.at(i) == 'A' && fst == -1)
{
fst = i;
}
if(s.at(s.size() - i - 1) == 'Z' && ed == -1)
{
ed = s.size() - i
}
if(fst >= 0 && ed >= 0)
{
break;
}
}
cout << ed - fst << endl;
}
| a.cc: In function 'int main()':
a.cc:16:42: error: expected ';' before '}' token
16 | ed = s.size() - i
| ^
| ;
17 | }
| ~
|
s310340019 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a) //追加//
#define pp() pop_back() //削除//
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
signed main(){
string s;
cin>>s;
for(int i=0; i<s.size()-1; i++){
if(s[i]!='A')
s.size()--;
else
break;
}
for(int i=s.size()-1; i>0; i--){
if(s[i]!='Z')
s.size()--;
else
break;
}
cout<<s.size()<<endl;
}
| a.cc: In function 'int main()':
a.cc:29:13: error: lvalue required as decrement operand
29 | s.size()--;
| ~~~~~~^~
a.cc:35:13: error: lvalue required as decrement operand
35 | s.size()--;
| ~~~~~~^~
|
s548959589 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a) //追加//
#define pp() pop_back() //削除//
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
signed main(){
string s;
cin>>s;
for(int i=0; i<s.size()-1; i++){
if(s[i]!='A')
pp(s[i]);
else
break;
}
for(int i=s.size()-1; i>0; i--){
if(s[i]!='Z')
pp(s[i]);
else
break;
}
cout<<s.size()<<endl;
}
| a.cc:28:14: error: macro "pp" passed 1 arguments, but takes just 0
28 | pp(s[i]);
| ^
a.cc:14:9: note: macro "pp" defined here
14 | #define pp() pop_back() //削除//
| ^~
a.cc:34:14: error: macro "pp" passed 1 arguments, but takes just 0
34 | pp(s[i]);
| ^
a.cc:14:9: note: macro "pp" defined here
14 | #define pp() pop_back() //削除//
| ^~
a.cc: In function 'int main()':
a.cc:28:7: error: 'pp' was not declared in this scope
28 | pp(s[i]);
| ^~
a.cc:34:7: error: 'pp' was not declared in this scope
34 | pp(s[i]);
| ^~
|
s964319278 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
string s;
int farst, last;
cin >> s;
for(int i = 0;i < s.size();i++) {
if(s.at(i) == 'A')
farst = i;
}
for(int i = s.size - 1;i > 0;i--) {
if (s.at(i) == 'Z')
last = i;
}
cout << last - farst << endl;
} | a.cc: In function 'int main()':
a.cc:13: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 '()' ?)
13 | for(int i = s.size - 1;i > 0;i--) {
| ~~^~~~
| ()
|
s236519960 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void) {
string s;
int ans = 0;
cin >> s;
for(int i = 0;;i++) {
if(s.at(i) == 'a') {
for(int j = i;;j++) {
ans+++
if(s.at(j) == 'z') {
cout << ans << endl;
return 0;
}
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:9: error: expected primary-expression before 'if'
12 | if(s.at(j) == 'z') {
| ^~
|
s347943817 | p03814 | 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[i]=='A') {
a=i;
break;
}
}
for (int i=s.size-1;i>=0;i--){
if(s[i]=='Z') {
b=i;
break;
}
}
cout<<b-a+1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:18: 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 '()' ?)
14 | for (int i=s.size-1;i>=0;i--){
| ~~^~~~
| ()
|
s297495764 | p03814 | C++ | #include <iostream>
using namespace std;
int main(void){
string s;
int start, gool;
cin >> s;
for(int i = 0; i < s.size(); i++){
if(s[i] == 'A') start = i;
break;
}
for(int i = s.size(); j >= 0; j--){
if(s[j] == 'Z') gool = j;
break;
}
cout << gool - start + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:14:27: error: 'j' was not declared in this scope
14 | for(int i = s.size(); j >= 0; j--){
| ^
|
s274170318 | p03814 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
string s;
int main() {
cin>>s;
int i = 0;
int j = s.size()-1;
while(i < n && s[i] != 'A') i++;
while(j >= 0 && s[j] != 'Z') j--;
cout<<j-i+1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:13: error: 'n' was not declared in this scope
12 | while(i < n && s[i] != 'A') i++;
| ^
|
s372056444 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int maxLength = 0;
cin >> s;
while(true) {
if ( s[i] == 'A' && maxLength == 0 ) {
maxLength = 1;
}
else if (s[i] == 'Z') {
maxLength++;
break;
}
else {
maxLength++;
}
}
cout << maxLength << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:24: error: 'i' was not declared in this scope
14 | if ( s[i] == 'A' && maxLength == 0 ) {
| ^
|
s550664248 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[200099];
cin >> s;
int a_position = 0;
int z_position = 0;
for (int i = 0; i < strlen(s); i++) {
if (s.at(i)=='A') {
a_position = i;
break;
}
}
for (int i = strlen(s)-1; a_position < i; i--) {
if (s.at(i)=='Z') {
z_position = i;
break;
}
}
cout << z_position-a_position+1 << endl;
} | a.cc: In function 'int main()':
a.cc:11:11: error: request for member 'at' in 's', which is of non-class type 'char [200099]'
11 | if (s.at(i)=='A') {
| ^~
a.cc:18:11: error: request for member 'at' in 's', which is of non-class type 'char [200099]'
18 | if (s.at(i)=='Z') {
| ^~
|
s714675518 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
char s[200099];
cin >> s;
int a_position = 0;
int z_position = 0;
for (int i = 0; i < s.size(); i++) {
if (s.at(i)=='A') {
a_position = i;
break;
}
}
for (int i = s.size()-1; a_position < i; i--) {
if (s.at(i)=='Z') {
z_position = i;
break;
}
}
cout << z_position-a_position+1 << endl;
} | a.cc: In function 'int main()':
a.cc:10:25: error: request for member 'size' in 's', which is of non-class type 'char [200099]'
10 | for (int i = 0; i < s.size(); i++) {
| ^~~~
a.cc:11:11: error: request for member 'at' in 's', which is of non-class type 'char [200099]'
11 | if (s.at(i)=='A') {
| ^~
a.cc:17:18: error: request for member 'size' in 's', which is of non-class type 'char [200099]'
17 | for (int i = s.size()-1; a_position < i; i--) {
| ^~~~
a.cc:18:11: error: request for member 'at' in 's', which is of non-class type 'char [200099]'
18 | if (s.at(i)=='Z') {
| ^~
|
s110568341 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s[200099];
cin >> s;
int a_position = 0;
int z_position = 0;
for (int i = 0; i < s.size(); i++) {
if (s.at(i)=='A') {
a_position = i;
break;
}
}
for (int i = s.size()-1; a_position < i; i--) {
if (s.at(i)=='Z') {
z_position = i;
break;
}
}
cout << z_position-a_position+1 << endl;
} | a.cc: In function 'int main()':
a.cc:6:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [200099]' {aka 'std::__cxx11::basic_string<char> [200099]'})
6 | cin >> s;
| ~~~ ^~ ~
| | |
| | std::string [200099] {aka std::__cxx11::basic_string<char> [200099]}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}
6 | cin >> s;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive]
6 | cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:6:10: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:6:10: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
6 | cin >> s;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [200099]' {aka 'std::__cxx11::basic_string<char> [200099]'} to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [200099]' {aka 'std::__cxx11::basic_string<char> [200099]'} to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [200099]' {aka 'std::__cxx11::basic_string<char> [200099]'} to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known co |
s979357578 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
string a;
int n,m,s;
cin>>a;
for(int i=0;i<s.size();i++)
if(a[i]=='a')
{
n=i;
break;
}
for(int i=a.size()-1;i>=0;i++)
if(a[i]=='z')
{
m=i;
break;
}
s=m-n+1;
if(s>0)
cout<<s<<endl;
else
cout<<"0";
return 0;
} | a.cc: In function 'int main()':
a.cc:8:25: error: request for member 'size' in 's', which is of non-class type 'int'
8 | for(int i=0;i<s.size();i++)
| ^~~~
|
s449354538 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int max;
string s;
cin >> s;
for(int i=0; i<s.size(); i++){
int count=0;
if(s.at(i) == 'A'){
while(s.at(i) == 'Z'){
count++;
i++;
}
}
if(count>max){
max = count;
}
}
cout << max << endl;
retun 0;
}
| a.cc: In function 'int main()':
a.cc:21:3: error: 'retun' was not declared in this scope
21 | retun 0;
| ^~~~~
|
s203872340 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
string s;cin>>s;
int ans=0;
rep(i,s.size()){
if(s[i]=="A"){
int tmp=1;
repi(j,i+1,s.size()){
tmp++;
if(s[j]=="Z")ans=max(ans,tmp);
}
}
}
cout<<ans<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="A"){
a.cc:14:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(s[j]=="Z")ans=max(ans,tmp);
|
s294772008 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
string s;cin>>s;
int ans=0;
rep(i,s.size()){
if(s[i]=="A"){
int tmp=1;
repi(j,i+1,s.size()){
tmp++;
if(s[j]=="Z")break;
}
ans=max(ans,tmp);
}
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
10 | if(s[i]=="A"){
a.cc:14:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(s[j]=="Z")break;
|
s984269783 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int a=300000, z=0;
for(int i=0; i<s.size; i++){
if(s[i] == 'A') a = min(s[i],a);
if(s[i] == 'Z') z = max(s[i],z);
}
cout << z - a + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:9:20: 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 '()' ?)
9 | for(int i=0; i<s.size; i++){
| ~~^~~~
| ()
a.cc:10:32: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&, int&)'
10 | if(s[i] == 'A') a = min(s[i],a);
| ~~~^~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:10:32: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'int')
10 | if(s[i] == 'A') a = min(s[i],a);
| ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:10:32: note: mismatched types 'std::initializer_list<_Tp>' and 'char'
10 | if(s[i] == 'A') a = min(s[i],a);
| ~~~^~~~~~~~
a.cc:11:28: error: no matching function for call to 'max(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&, int&)'
11 | if(s[i] == 'Z') z = max(s[i],z);
| ~~~^~~~~~~~
/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:11:28: note: deduced conflicting types for parameter 'const _Tp' ('char' and 'int')
11 | if(s[i] == 'Z') z = max(s[i],z);
| ~~~^~~~~~~~
/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
/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:11:28: note: mismatched types 'std::initializer_list<_Tp>' and 'char'
11 | if(s[i] == 'Z') z = max(s[i],z);
| ~~~^~~~~~~~
|
s328474171 | p03814 | C++ | //#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;
#define FAST ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
typedef long long int ll;
int main()
{
FAST;
string str;
cin >> str;
int maxLen = 0;
int a = 0;
int b = str.size()-1;
while(str[a] != 'A')
a++;
while(str[b] != 'Z')
b--;
cout << b-a+1;
return 0;
}//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;
#define FAST ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
typedef long long int ll;
int main()
{
FAST;
string str;
cin >> str;
int maxLen = 0;
int a = 0;
int b = str.size()-1;
while(str[a] != 'A')
a++;
while(str[b] != 'Z')
b--;
cout << b-a+1;
return 0;
} | a.cc:47:5: error: redefinition of 'int main()'
47 | int main()
| ^~~~
a.cc:16:5: note: 'int main()' previously defined here
16 | int main()
| ^~~~
|
s036493668 | p03814 | C++ | #include<bits/stdc++.h>
int main(){
string s;
int a=0,b;
cin>>s;
size_t size=s.length();
for(int i=0;i<size;i++){
if(s[i]=='A') a=i+1;
if(s[i]=='Z' && a!=0) b=i+1;
}
cout<<b-a<<"\n";
return(0);
} | a.cc: In function 'int main()':
a.cc:3:3: error: 'string' was not declared in this scope
3 | string s;
| ^~~~~~
a.cc:3:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
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/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>s;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:8: error: 's' was not declared in this scope
5 | cin>>s;
| ^
a.cc:11:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
11 | cout<<b-a<<"\n";
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s806675472 | p03814 | C++ |
int main() {
string s;
int index1 = 0;
int res;
int index2 = 0;
int flag = 0;
cin >> s;
for (int i = 0; i < s.size(); i++){
if(s[i] == 'A' && flag == 0) {
index1 = i;
flag = 1;
}
if(s[i] == 'Z' && flag == 1) {
index2 = i;
break;
}
}
res = index2 - index1 + 1;
cout << res << endl;
}
| a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
3 | string s;
| ^~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin >> s;
| ^~~
a.cc:8:12: error: 's' was not declared in this scope
8 | cin >> s;
| ^
a.cc:20:5: error: 'cout' was not declared in this scope
20 | cout << res << endl;
| ^~~~
a.cc:20:20: error: 'endl' was not declared in this scope
20 | cout << res << endl;
| ^~~~
|
s271661365 | p03814 | C++ |
int main() {
string s;
int index1;
int res;
int index2;
int flag = 0;
cin >> s;
for (int i = 0; i < s.size(); i++){
if(s[i] == 'A' && flag == 0) {
index1 = i;
flag = 1;
}
if(s[i] == 'Z' && flag == 1) {
index2 = i;
flag = 2;
}
}
res = index2 - index1 + 1;
cout << res << endl;
} | a.cc: In function 'int main()':
a.cc:4:5: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:9:5: error: 'cin' was not declared in this scope
9 | cin >> s;
| ^~~
a.cc:9:12: error: 's' was not declared in this scope
9 | cin >> s;
| ^
a.cc:21:5: error: 'cout' was not declared in this scope
21 | cout << res << endl;
| ^~~~
a.cc:21:20: error: 'endl' was not declared in this scope
21 | cout << res << endl;
| ^~~~
|
s777251426 | p03814 | C++ | #include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;
void Main()
{
string s;
cin >> s;
int left, right;
rep(i,s.size()){
if(s[i] == 'A'){
left = i;
break;
}
}
rep3rev(j,s.size()-1,0){
if(s[i] == 'Z'){
right = j;
break;
}
}
cout << right - left + 1 << endl;
return;
}
int main()
{
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << fixed << setprecision(15);
Main();
return 0;
} | a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
2 | #include<boost/multi_array.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s522219413 | p03814 | 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[i] == 'A');
a = i;
break;
}
}
for(int i = a; i < s.size(); i ++){
if(s[i] == 'A'){
b = i;
break;
}
}
cout << b - a + 1 << endl;
}
| a.cc:16:3: error: expected unqualified-id before 'for'
16 | for(int i = a; i < s.size(); i ++){
| ^~~
a.cc:16:18: error: 'i' does not name a type
16 | for(int i = a; i < s.size(); i ++){
| ^
a.cc:16:32: error: 'i' does not name a type
16 | for(int i = a; i < s.size(); i ++){
| ^
a.cc:22:3: error: 'cout' does not name a type
22 | cout << b - a + 1 << endl;
| ^~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s647827990 | p03814 | 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[i] == 'A');
a = i;
break;
}
}
for(int i = a; i < s.size(); i ++){
if(s[i] == 'A');
b = i;
break;
}
}
cout << b - a + 1 << endl;
}
| a.cc:16:3: error: expected unqualified-id before 'for'
16 | for(int i = a; i < s.size(); i ++){
| ^~~
a.cc:16:18: error: 'i' does not name a type
16 | for(int i = a; i < s.size(); i ++){
| ^
a.cc:16:32: error: 'i' does not name a type
16 | for(int i = a; i < s.size(); i ++){
| ^
a.cc:21:3: error: expected declaration before '}' token
21 | }
| ^
a.cc:22:3: error: 'cout' does not name a type
22 | cout << b - a + 1 << endl;
| ^~~~
a.cc:23:1: error: expected declaration before '}' token
23 | }
| ^
|
s162316133 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 0; i < s.size(); i ++){
int count = 0;
if(s[i] == 'A'){
while(true){
int a = i;
count++;
a++;
if(s[a] == 'Z'){
if(ans< count) ans = count;
break;
}
else if(a == s.size()-1){
break;
}
}
}
}
cout << ans << ensl;
}
| a.cc: In function 'int main()':
a.cc:25:18: error: 'ensl' was not declared in this scope
25 | cout << ans << ensl;
| ^~~~
|
s030857123 | p03814 | C++ | #define DBG 0 //submit 0
#define ll long long
#if DBG
#include <algorithm>
#include <array>
#include <ctime>
#include <cstdlib>
#include <string>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <cmath>
#include <queue>
#include <numeric>
#else
#include <bits/stdc++.h>
#endif
using namespace std;
int main(){
int idxa,idxb;
string s;
cin >> s;
for(int i=0;i<s.size();i++){
if(s[i]=='A'){
idxa=i;
break;
}
}
for(int i=0;i<s.size();i++){
if(s[s.size()-i-1]=='Z'){
idxb=i;
break;
}
}
ans = idxb-idxa+1;;
//cout << (flag ? "Yes" : "No") << endl;
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:39:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
39 | ans = idxb-idxa+1;;
| ^~~
| abs
|
s261672458 | p03814 | 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 pa, pz;
rep(i,n){if(s.at(i)=='A');pa=i;break;}
reverse(s.begin(),s.end());
rep(i,n){if(s.at(i)=='Z');pz=i;break;}
cout << s.size()-pa-pz << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: 'n' was not declared in this scope
9 | rep(i,n){if(s.at(i)=='A');pa=i;break;}
| ^
a.cc:3:41: note: in definition of macro 'rep'
3 | #define rep(i, n) for (int i=0; i<(int)(n); i++)
| ^
a.cc:11:9: error: 'n' was not declared in this scope
11 | rep(i,n){if(s.at(i)=='Z');pz=i;break;}
| ^
a.cc:3:41: note: in definition of macro 'rep'
3 | #define rep(i, n) for (int i=0; i<(int)(n); i++)
| ^
|
s905931812 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
string s;
int max = 0;
int ans = 0;
bool flag = false;
cin >> s;
for (int i = 0; i < s.size(); i++) {
if (s.at(i) == 'A') {
flag = true;
}
if (flag) {
max++;
}
if (s.at(i) == 'Z') {
flag = false;
}
ans = max(ans, max);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:21:18: error: 'max' cannot be used as a function
21 | ans = max(ans, max);
| ~~~^~~~~~~~~~
|
s402994122 | p03814 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
string s;
cin >> s;
int start, end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:12:18: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
12 | for (int i = s.length-1; i>=start;i--){
| ~~^~~~~~
| ()
|
s046795057 | p03814 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
string s;
cin >> s;
int start end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:8:13: error: expected initializer before 'end'
8 | int start end;
| ^~~
a.cc:10:22: error: 'start' was not declared in this scope
10 | if (s[i] == 'A') start = i; break;
| ^~~~~
a.cc:12:18: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
12 | for (int i = s.length-1; i>=start;i--){
| ~~^~~~~~
| ()
a.cc:12:31: error: 'start' was not declared in this scope
12 | for (int i = s.length-1; i>=start;i--){
| ^~~~~
a.cc:15:22: error: overloaded function with no contextual type information
15 | cout << (long long)end -start + 1 << endl;
| ^~~
a.cc:15:27: error: 'start' was not declared in this scope
15 | cout << (long long)end -start + 1 << endl;
| ^~~~~
|
s326348924 | p03814 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(void){
string s;
cin >> s >> endl;
int start end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc: In function 'int main()':
a.cc:7:11: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>' and '<unresolved overloaded function type>')
7 | cin >> s >> endl;
| ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
In file included from /usr/incl |
s505146165 | p03814 | C++ | #include <iostream>
#include <string>
using namepsace std;
int main(void){
string s;
cin >> s >> endl;
int start end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc:3:7: error: expected nested-name-specifier before 'namepsace'
3 | using namepsace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:2: error: 'string' was not declared in this scope
6 | string s;
| ^~~~~~
a.cc:6:2: 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:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
7 | cin >> s >> endl;
| ^~~
| 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:9: error: 's' was not declared in this scope
7 | cin >> s >> endl;
| ^
a.cc:7:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
7 | cin >> s >> endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:8:13: error: expected initializer before 'end'
8 | int start end;
| ^~~
a.cc:10:22: error: 'start' was not declared in this scope
10 | if (s[i] == 'A') start = i; break;
| ^~~~~
a.cc:12:31: error: 'start' was not declared in this scope
12 | for (int i = s.length-1; i>=start;i--){
| ^~~~~
a.cc:15:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
15 | cout << (long long)end -start + 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:15:22: error: 'end' was not declared in this scope; did you mean 'std::end'?
15 | cout << (long long)end -start + 1 << endl;
| ^~~
| std::end
In file included from /usr/include/c++/14/string:53:
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:15:27: error: 'start' was not declared in this scope
15 | cout << (long long)end -start + 1 << endl;
| ^~~~~
|
s201463673 | p03814 | C++ | #include <iostream>
using namepsace std;
int main(void){
string s;
cin >> s >> endl;
int start end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc:2:7: error: expected nested-name-specifier before 'namepsace'
2 | using namepsace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:4:2: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:4:2: 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:5:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin >> s >> endl;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:9: error: 's' was not declared in this scope
5 | cin >> s >> endl;
| ^
a.cc:5:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
5 | cin >> s >> endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:6:13: error: expected initializer before 'end'
6 | int start end;
| ^~~
a.cc:8:22: error: 'start' was not declared in this scope
8 | if (s[i] == 'A') start = i; break;
| ^~~~~
a.cc:10:31: error: 'start' was not declared in this scope
10 | for (int i = s.length-1; i>=start;i--){
| ^~~~~
a.cc:13:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
13 | cout << (long long)end -start + 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:13:22: error: 'end' was not declared in this scope; did you mean 'std::end'?
13 | cout << (long long)end -start + 1 << endl;
| ^~~
| std::end
In file included from /usr/include/c++/14/string:53:
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:13:27: error: 'start' was not declared in this scope
13 | cout << (long long)end -start + 1 << endl;
| ^~~~~
|
s744477538 | p03814 | C++ | # include <iostream>
#include <string>
using namepsace std;
int main(void){
string s;
cin >> s >> endl;
int start end;
for (int i = 0; i<s.length();i++){
if (s[i] == 'A') start = i; break;
}
for (int i = s.length-1; i>=start;i--){
if (s[i] == 'Z') start = i; break;
}
cout << (long long)end -start + 1 << endl;
} | a.cc:3:7: error: expected nested-name-specifier before 'namepsace'
3 | using namepsace std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:2: error: 'string' was not declared in this scope
5 | string s;
| ^~~~~~
a.cc:5:2: 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:6:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> s >> endl;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:9: error: 's' was not declared in this scope
6 | cin >> s >> endl;
| ^
a.cc:6:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
6 | cin >> s >> endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
a.cc:7:13: error: expected initializer before 'end'
7 | int start end;
| ^~~
a.cc:9:22: error: 'start' was not declared in this scope
9 | if (s[i] == 'A') start = i; break;
| ^~~~~
a.cc:11:31: error: 'start' was not declared in this scope
11 | for (int i = s.length-1; i>=start;i--){
| ^~~~~
a.cc:14:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
14 | cout << (long long)end -start + 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:14:22: error: 'end' was not declared in this scope; did you mean 'std::end'?
14 | cout << (long long)end -start + 1 << endl;
| ^~~
| std::end
In file included from /usr/include/c++/14/string:53:
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:14:27: error: 'start' was not declared in this scope
14 | cout << (long long)end -start + 1 << endl;
| ^~~~~
|
s317305195 | p03814 | C++ | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7
char S[300000];
int A[300000], Z[300000];
int main() {
scanf("%s", S);
int inA = 0;
int inZ = 0;
for (int i = 0; i < strlen(S); i++) {
if (S[i] == 'A') {
A[inA] = i;
inA++;
}
else if (S[i] == 'Z') {
Z[inZ] = i;
inZ++;
}
}
int ans = 0;
for (int i = 0; i < inA; i++) {
for (int j = 0; j < inZ; j++) {
if (Z[j] > A[i]) {
ans = max(Z[j] - A[i] + 1, ans);
}
}
printf("%d", ans);
}
| a.cc: In function 'int main()':
a.cc:59:2: error: expected '}' at end of input
59 | }
| ^
a.cc:23:12: note: to match this '{'
23 | int main() {
| ^
|
s599585154 | p03814 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
for (int i = 0; i < s.size(); i++){
for (int j = s.size(); j > i; j--){
if (i == 'A' && j == 'Z'){
int k = j - i + 1;
}
}
}
cout << k << endl;
} | a.cc: In function 'int main()':
a.cc:15:11: error: 'k' was not declared in this scope
15 | cout << k << endl;
| ^
|
s194814369 | p03814 | C++ | S = input()
first = 0
last = 0
for i in range(0, len(S)):
if S[i] == 'A':
first = i
break
for i in range(len(S)-1, -1, -1):
if S[i] == 'Z':
last = i
break
print(last - first + 1) | a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s491554685 | p03814 | C++ | #include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<map>
using namespace std;
int main()
{
string s;
int a, b;
a = b = 0;
cin >> s;
for (int i = 0;i < s.length();i++)
{
if (a == 0 && s[i] == 'A')
{
a = i;
break;
}
}
for (int i = s.length()-1;i >=0;i--)
{
if (b == 0 && s[i] == 'Z')
{
b = i;
break;
}
}
cout << b - a+1; | a.cc: In function 'int main()':
a.cc:33:25: error: expected '}' at end of input
33 | cout << b - a+1;
| ^
a.cc:11:1: note: to match this '{'
11 | {
| ^
|
s994660044 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int a=0;
for(int i=0; i < s.size(); i++){
if(s[i] == "A"){
int b=0;
for(int j=s.at(i); j < s.size(); j++){
b++;
if(s.at[i] == "Z"){
if(a < b) b=a;
break;
}
}
}
}
cout << a << endl;
} | a.cc:8:12: error: extended character is not valid in an identifier
8 | if(s[i] == "A"){
| ^
a.cc:8:16: error: extended character is not valid in an identifier
8 | if(s[i] == "A"){
| ^
a.cc:12:19: error: extended character is not valid in an identifier
12 | if(s.at[i] == "Z"){
| ^
a.cc:12:23: error: extended character is not valid in an identifier
12 | if(s.at[i] == "Z"){
| ^
a.cc: In function 'int main()':
a.cc:8:12: error: expected ')' before '\U00003000'
8 | if(s[i] == "A"){
| ~ ^~
| )
a.cc:12:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
12 | if(s.at[i] == "Z"){
| ^
a.cc:12:19: error: expected ')' before '\U00003000'
12 | if(s.at[i] == "Z"){
| ~ ^~
| )
|
s715149174 | p03814 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int a=0;
for(int i=0; i < s.size(); i++){
if(s.at(i) == "A"){
int b=0;
for(int j=s.at(i); j < s.size(); j++){
b++;
if(s.at(i) == "Z"){
if(a < b) b=a;
break;
}
}
}
}
cout << a << endl;
} | a.cc:8:15: error: extended character is not valid in an identifier
8 | if(s.at(i) == "A"){
| ^
a.cc:8:19: error: extended character is not valid in an identifier
8 | if(s.at(i) == "A"){
| ^
a.cc:12:19: error: extended character is not valid in an identifier
12 | if(s.at(i) == "Z"){
| ^
a.cc:12:23: error: extended character is not valid in an identifier
12 | if(s.at(i) == "Z"){
| ^
a.cc: In function 'int main()':
a.cc:8:15: error: expected ')' before '\U00003000'
8 | if(s.at(i) == "A"){
| ~ ^~
| )
a.cc:12:19: error: expected ')' before '\U00003000'
12 | if(s.at(i) == "Z"){
| ~ ^~
| )
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.