submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s582442396
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { int l,r; string s; cin >> s; for(int i=0, i<s.length(); i++) { if(s[i]=='A') { l=i; break; } } for(int i=s.length()-1; i>=0; i--) { if(s[i]=='Z') { r=i; break; } } cout << r-l+1 << endl; }
a.cc: In function 'int main()': a.cc:8:17: error: expected ';' before '<' token 8 | for(int i=0, i<s.length(); i++) { | ^ | ; a.cc:8:17: error: expected primary-expression before '<' token
s293033588
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { int l,r; string s; cin >> s; for(int i=0, i<s.size(); i++) { if(s[i]=='A') { l=i; return 0; } } for(int i=s.size()-1; i>=0; i--) { if(s[i]=='Z') { r=i; return 0; } } cout << r-l+1 << endl; }
a.cc: In function 'int main()': a.cc:8:17: error: expected ';' before '<' token 8 | for(int i=0, i<s.size(); i++) { | ^ | ; a.cc:8:17: error: expected primary-expression before '<' token
s785734383
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { int l,r; string s; cin >> s; for(int i=0, i<s.length(); i++) { if(s[i]=='A') { l=i; return 0; } } for(int i=s.length()-1; i>=0; i--) { if(s[i]=='Z') { r=i; return 0; } } cout << r-l+1 << endl; }
a.cc: In function 'int main()': a.cc:8:17: error: expected ';' before '<' token 8 | for(int i=0, i<s.length(); i++) { | ^ | ; a.cc:8:17: error: expected primary-expression before '<' token
s232072094
p03814
C++
#include <iostream> #include <string> #include<math.h> using namespace std; int main() { string s cin >> s; int a=0; int z = s.size() - 1; while (true) { if (s[a] == 'A') break; ++a; } while (true) { if (s[z] == 'Z')break; --z; } cout << z-a << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: expected initializer before 'cin' 8 | cin >> s; | ^~~ a.cc:10:17: error: 's' was not declared in this scope 10 | int z = s.size() - 1; | ^
s432727135
p03814
C++
#include <bits/stdc++.h> using namespace std; int main () { string s; cin >> s; int countf = 0, countb = 0; for(char a: s) { if(a == 'A') break; else countf++; } for(int a = s.size() - 1; i != 0; i--) { if(s.at(i) == 'Z') break; else countb++; } cout << s.size() - countf - countb << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:29: error: 'i' was not declared in this scope 12 | for(int a = s.size() - 1; i != 0; i--) { | ^
s306423098
p03814
C++
#include <bits/stdc++.h> #include <math.h> #include <string> using namespace std; int main() { string str; int begin,end; cin >> str; for(int i = 0;i < str.size();i++){ if(str.at(i) == 'A'){ begin = i; break; } } for(int i = str.size() - 1;i > 0;i--){ if(str.at(i) == 'Z'){ end = i; break; } cout << end - begin - 1 << endl; }
a.cc: In function 'int main()': a.cc:25:2: error: expected '}' at end of input 25 | } | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s072743743
p03814
C++
#include <iostream> using namespace std; int main() { char s[200005]; cin >> s; int length = strlen(s); int begin, end; for(int i=0; i<length; i++){ if(s[i]=='A'){ begin=i+1; break; } } for(int i=length-1; i>=0; i--){ if(s[i]=='Z'){ end=i+1; break; } } cout << end-begin+1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:18: error: 'strlen' was not declared in this scope 8 | int length = strlen(s); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s565914484
p03814
C++
HASFJGHOGAKZZFEGA
a.cc:1:1: error: 'HASFJGHOGAKZZFEGA' does not name a type 1 | HASFJGHOGAKZZFEGA | ^~~~~~~~~~~~~~~~~
s695390435
p03814
C++
#include "bits/stdc++.h" #define ALL(x) x.begin(), x.end() #define LEN(x) (int)x.size() #define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0) using namespace std; typedef int64_t i64; typedef pair<int,int> pii; template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;} template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;} constexpr int INF = 0x3f3f3f3f; signed main() { char s[200100]; cin >> s; cout << strrchr(s, 'Z') - strchr(s, 'A') + 1 << endl; return 0; } #include "bits/stdc++.h" #define ALL(x) x.begin(), x.end() #define LEN(x) (int)x.size() #define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0) using namespace std; typedef int64_t i64; typedef pair<int,int> pii; template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;} template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;} constexpr int INF = 0x3f3f3f3f; signed main() { char s[200100]; cin >> s; cout << strrchr(s, 'Z') - strchr(s, 'A') + 1 << endl; return 0; }
a.cc:30:39: error: redefinition of 'template<class A, class B> bool chmax(A&, const B&)' 30 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;} | ^~~~~ a.cc:8:39: note: 'template<class A, class B> bool chmax(A&, const B&)' previously declared here 8 | template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;} | ^~~~~ a.cc:31:39: error: redefinition of 'template<class A, class B> bool chmin(A&, const B&)' 31 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;} | ^~~~~ a.cc:9:39: note: 'template<class A, class B> bool chmin(A&, const B&)' previously declared here 9 | template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;} | ^~~~~ a.cc:32:15: error: redefinition of 'constexpr const int INF' 32 | constexpr int INF = 0x3f3f3f3f; | ^~~ a.cc:10:15: note: 'constexpr const int INF' previously defined here 10 | constexpr int INF = 0x3f3f3f3f; | ^~~ a.cc:34:8: error: redefinition of 'int main()' 34 | signed main() | ^~~~ a.cc:12:8: note: 'int main()' previously defined here 12 | signed main() | ^~~~
s447762033
p03814
C++
#include<bis/stdc++.h> using namespace std; int main(){ string s;cin>>s; int a=s.find("A"); int b=s.find("B"); cout<<b-a+1;}
a.cc:1:9: fatal error: bis/stdc++.h: No such file or directory 1 | #include<bis/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s839358429
p03814
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; int ans,a,z; bool flag = 0; cin >> s; for(int i=0;i<s.size(),i++){ if(s[i] == "A" && flag == false){ a = i; flag = ture; } if(s[i] == "Z") z = i; } ans = z-a+1; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:29: error: expected ';' before ')' token 9 | for(int i=0;i<s.size(),i++){ | ^ | ; a.cc:10:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(s[i] == "A" && flag == false){ a.cc:12:14: error: 'ture' was not declared in this scope 12 | flag = ture; | ^~~~ a.cc:14:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(s[i] == "Z") z = i;
s370511252
p03814
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char const *argv[]) { int a,z; char S[200000]; scanf("%s",S); for (int a = 0; strcmp(S[i],'A') != 0; ++a); for (int z = strlen(S); strcmp(S[i],'Z') != 0; --z); printf("%d\n",z - a); return 0; }
main.c: In function 'main': main.c:10:34: error: 'i' undeclared (first use in this function) 10 | for (int a = 0; strcmp(S[i],'A') != 0; ++a); | ^ main.c:10:34: note: each undeclared identifier is reported only once for each function it appears in main.c:10:37: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion] 10 | for (int a = 0; strcmp(S[i],'A') != 0; ++a); | ^~~ | | | int In file included from main.c:3: /usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ main.c:11:45: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion] 11 | for (int z = strlen(S); strcmp(S[i],'Z') != 0; --z); | ^~~ | | | int /usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~
s822884154
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int start, end; int N = s.size(); for(int i = 0; i < N; i++){ if(s[i] == 'A'){ start == i; break; } } for(int i = 0; i < N; i++){ if(s[i] == 'Z'){ end == i; } } int ans; ans = end - start cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:20: error: expected ';' before 'cout' 21 | ans = end - start | ^ | ; 22 | cout << ans << endl; | ~~~~
s293892570
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int start, end; int N = s.size(); for(int i = 0; i < N; i++){ if(s[i] == "A"){ start == i; } if(s[i] == "Z"){ end == i; } } int ans = end - start; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(s[i] == "A"){ a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(s[i] == "Z"){
s454529483
p03814
C++
#include <cstdio> char s[200005]; int main() { int b,c; scanf("%s",s); int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]=='A') { b=i; for (int j = i; j < len; j++) { if(s[j]=='Z') { c=j; } } } } printf("%d\n",c-b+1 ); return 0; }
a.cc: In function 'int main()': a.cc:7:13: error: 'strlen' was not declared in this scope 7 | int len=strlen(s); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <cstdio> +++ |+#include <cstring> 2 | char s[200005];
s828887113
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; int i,f,b,n=s.size(); for(i=0;i<n;i++){ if(s[i]=='A'){ f=i; break; } } for(i=0;i<n;i++){ if(s[n-1-i]=='Z'){ b=i;break;} cout<<b-f+1; }
a.cc: In function 'int main()': a.cc:17:2: error: expected '}' at end of input 17 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s529690303
p03814
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,N) for(int i=0;i<int(N);++i) const int inf = 1e9; int main() { string S; cin>>S; int N=S.size(); int ans=0; int a=inf,b=0; rep(i,N){ if(S[i]=='A')a = min(a,i); else if(S[i]=='Z')b =max(b,i); } ans=b-a+1; cout<<ans<<endl;
a.cc: In function 'int main()': a.cc:17:25: error: expected '}' at end of input 17 | cout<<ans<<endl; | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s935326041
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 ans=0; int a=inf,b=0; rep(i,N){ if(S[i]=='A')a = min(a,i); else if(S[i]=='Z')b =max(b,i); } ans=b-a+1; cout<<ans<<endl;
a.cc: In function 'int main()': a.cc:10:15: error: 'inf' was not declared in this scope; did you mean 'ynf'? 10 | int a=inf,b=0; | ^~~ | ynf a.cc:13:35: error: 'b' was not declared in this scope 13 | else if(S[i]=='Z')b =max(b,i); | ^ a.cc:15:13: error: 'b' was not declared in this scope 15 | ans=b-a+1; | ^ a.cc:16:25: error: expected '}' at end of input 16 | cout<<ans<<endl; | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s906284718
p03814
C
#include<stdio.h. int main(){ char s[200001]; int i = 0, len = 0, a[200000], j, k, count; scanf("%s", s); while(s[len]){ if(s[len] = 'A'){ a[i++] = len; } len++; } for (j = 0; j < i; j++){ for (k = a[j]; k < len; k++){ if(s[k] == 'Z'){ count++; } } } printf("%d\n", count); return 0; }
main.c:1:18: error: missing terminating > character 1 | #include<stdio.h. | ^ main.c:1:9: fatal error: stdio.h.: No such file or directory 1 | #include<stdio.h. | ^ compilation terminated.
s735242033
p03814
C++
#include<iostream> using namespace std; int main(){ int a_i=0,z_i=0; string str; cin >> str; for(int i = 0;i < str.size();+;i){ if(str[i]=='a'){ a_i = i; break; } } for(int i = 0;i < str.size();+;i){ if(str[i]=='z'){ z_i = i; } } cout << a_i - z_i + 1<< endl; }
a.cc: In function 'int main()': a.cc:8:33: error: expected primary-expression before ';' token 8 | for(int i = 0;i < str.size();+;i){ | ^ a.cc:8:33: error: expected ')' before ';' token 8 | for(int i = 0;i < str.size();+;i){ | ~ ^ | ) a.cc:8:34: error: 'i' was not declared in this scope 8 | for(int i = 0;i < str.size();+;i){ | ^ a.cc:14:33: error: expected primary-expression before ';' token 14 | for(int i = 0;i < str.size();+;i){ | ^ a.cc:14:33: error: expected ')' before ';' token 14 | for(int i = 0;i < str.size();+;i){ | ~ ^ | ) a.cc:14:35: error: expected ';' before ')' token 14 | for(int i = 0;i < str.size();+;i){ | ^ | ;
s911421686
p03814
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; cin >> s; for(int i = 0; i < s.size(); i++){ if("A" == s[i]){ for(int j = s.size() - 1; j > i; j--){ if("Z" == s[j]){ cout << j - i + 1; } } } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if("A" == s[i]){ a.cc:11:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if("Z" == s[j]){
s718567384
p03814
C++
#include<bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++) if (s[i]=='A'){ int a = i; break; } for (int j = 199999; j>=0; j--) if (s[j]=='Z'){ int b = j; break; } int c = b-a+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:19:13: error: 'b' was not declared in this scope 19 | int c = b-a+1; | ^ a.cc:19:15: error: 'a' was not declared in this scope 19 | int c = b-a+1; | ^
s781136333
p03814
C++
#include<bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++){ if (s[i]=='A') break; int a = i; } for (int j = 199999; j>=0; j--){ if (s[j]=='Z') break; int b = j; } int c = b-a+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:17:13: error: 'b' was not declared in this scope 17 | int c = b-a+1; | ^ a.cc:17:15: error: 'a' was not declared in this scope 17 | int c = b-a+1; | ^
s855120919
p03814
C++
#include<bits/stdc++.h> #include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++){ if (s[i]=='A') break; } for (int j = 199999; j>=0; j--){ if (s[j]=='Z') break; } int c = j-i+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:15:13: error: 'j' was not declared in this scope 15 | int c = j-i+1; | ^ a.cc:15:15: error: 'i' was not declared in this scope 15 | int c = j-i+1; | ^
s179528386
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++) if (s[i]=='A') break; for (int j = 199999; j>=0; j--) if (s[j]=='Z') break; int c = j-i+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'j' was not declared in this scope 12 | int c = j-i+1; | ^ a.cc:12:15: error: 'i' was not declared in this scope 12 | int c = j-i+1; | ^
s353665103
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++) if (s[i]=='A'){ int a = i; break;} for (int j = 199999; j>=0; j--) if (s[j]=='Z'){ int b = j; break;} int c = b-a+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:14:13: error: 'b' was not declared in this scope 14 | int c = b-a+1; | ^ a.cc:14:15: error: 'a' was not declared in this scope 14 | int c = b-a+1; | ^
s152300692
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i = 0; i<199999; i++) if (s[i]=='A'){ int a = i; break;} for (int j = 199999; j>=0; j--) if (s[j]=='Z'){ int b = j; break; int c = b-a+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:14:15: error: 'a' was not declared in this scope 14 | int c = b-a+1; | ^ a.cc:16:2: error: expected '}' at end of input 16 | } | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s091679902
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i =199999; i>=0; i--) if (s[i]=='A') int a = i; for (int j = 0; j<199999; j++) if (s[j]=='Z') int b = j; int c = b-a+1; cout << c << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'b' was not declared in this scope 12 | int c = b-a+1; | ^ a.cc:12:15: error: 'a' was not declared in this scope 12 | int c = b-a+1; | ^
s091763486
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i =199999; i>=0; i--) if (s[i]=='A') int x = i; for (int j = 0; j<199999; j++) if (s[j]=='Z') int y = j; int z = y-x+1; cout << z << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'y' was not declared in this scope 12 | int z = y-x+1; | ^ a.cc:12:15: error: 'x' was not declared in this scope 12 | int z = y-x+1; | ^
s564112757
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i =199999; i>=0; i--) if (s[i]='A') int x = i; for (int j = 0; j<199999; j++) if (s[j]='B') int y = j; int z = y-x+1; cout << z << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'y' was not declared in this scope 12 | int z = y-x+1; | ^ a.cc:12:15: error: 'x' was not declared in this scope 12 | int z = y-x+1; | ^
s047452350
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; for (int i =199999; i>=0; i--) if (s[i]='A') int x = i; for (int j = 0; j<199999; j++) if (s[j]='B') int y = j; cout << y-x+1 << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'y' was not declared in this scope 12 | cout << y-x+1 << endl; | ^ a.cc:12:15: error: 'x' was not declared in this scope 12 | cout << y-x+1 << endl; | ^
s590009120
p03814
C++
#include <iostream> #include <string> use namespace std; int main(){ string s; cin >> s; for (int i =199999; i>=0; i--) if (s[i]='A') int x = i; for (int j = 0; j<199999; j++) if (s[j]='B') int y = j; cout << y-x+1 << endl; }
a.cc:3:1: error: 'use' does not name a type 3 | use namespace std; | ^~~ a.cc: In function 'int main()': a.cc:6:5: error: 'string' was not declared in this scope 6 | string s; | ^~~~~~ a.cc:6:5: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:7:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin >> s; | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:7:12: error: 's' was not declared in this scope 7 | cin >> s; | ^ a.cc:12:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 12 | cout << y-x+1 << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:12:13: error: 'y' was not declared in this scope 12 | cout << y-x+1 << endl; | ^ a.cc:12:15: error: 'x' was not declared in this scope 12 | cout << y-x+1 << endl; | ^ a.cc:12:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 12 | cout << y-x+1 << endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s312924360
p03814
C++
#include <iostream> #include <string> #include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int a = 0; int z = 0; for(int i = 0; i < s.length(); i++) { if(s.at(i) == 'A') a = i; break; } for(int i = s.length; i >= 0; i--) { if(s.at(i) == 'Z') z = i; break; } cout << z-a << endl; }
a.cc: In function 'int main()': a.cc:18:21: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int' 18 | for(int i = s.length; i >= 0; i--) { | ^~~~~~
s810822230
p03814
C++
#include <iostream> using namespace std; int main() { string s; int n,i; i = 0; cin >> s; while (s[i] != "\0") { i++; } i--; int a, b; a = 0; b = i; while (s[a] != 'A') { a++; } while (s[b] != 'Z') { b--; } cout << b - a + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | while (s[i] != "\0") {
s459429274
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int pos1=0,pos2=0,len=s.size(); len--; while(s[pos]!='A') pos1++; while(s[pos]!='Z') pos2--; int p=pos2-pos1+1; cout<<p; return 0; }
a.cc: In function 'int main()': a.cc:8:17: error: 'pos' was not declared in this scope; did you mean 'pos2'? 8 | while(s[pos]!='A') pos1++; | ^~~ | pos2 a.cc:9:17: error: 'pos' was not declared in this scope; did you mean 'pos2'? 9 | while(s[pos]!='Z') pos2--; | ^~~ | pos2
s442835115
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; int A, Z; for (int i = 0; i < S.length(); i++) { if (S[i] == 'A') { A = i; break; } } for (int i = S.length() - 1; i = < 0; i--) { if (S[i] == 'Z') { Z = i; break; } } cout << Z - A + 1 << endl; }
a.cc: In function 'int main()': a.cc:14:36: error: expected primary-expression before '<' token 14 | for (int i = S.length() - 1; i = < 0; i--) { | ^
s303116431
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { stirng S; cin >> S; int A, Z; for (int i = 0; i < S.length(); i++) { if (S[i] == 'A') { A = i; break; } } for (int i = S.length() - 1; i = < 0; i--) { if (S[i] == 'Z') { Z = i; break; } } cout << Z - A + 1 << endl; }
a.cc: In function 'int main()': a.cc:5:3: error: 'stirng' was not declared in this scope 5 | stirng S; | ^~~~~~ a.cc:6:10: error: 'S' was not declared in this scope 6 | cin >> S; | ^ a.cc:14:36: error: expected primary-expression before '<' token 14 | for (int i = S.length() - 1; i = < 0; i--) { | ^
s758419942
p03814
C++
#include <string> #include <iostream> using namespace std; int main(){ string s,s2; cin>>s; s2=s; reverse(s2.begin(), s2.end()); int i=1; while (s[i]!='a') { i++; } int k=1; while (s2[k]!='z') { k++; } int ans=(int)s.length()-i-k; cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'reverse' was not declared in this scope 11 | reverse(s2.begin(), s2.end()); | ^~~~~~~
s782700093
p03814
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define all(x) (x).begin(),(x).end() #define m0(x) memset(x,0,sizeof(x)) int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1}; int main() { string s; cin >>s; int a = 300000, z = -1; for(int i = 0; i < s.size; i++) { if(s[i]=='A') a=min(a,i); else if(s[i]=='Z') z = max(z,i); } cout << z-a<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:26: 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 '()' ?) 21 | for(int i = 0; i < s.size; i++) | ~~^~~~ | ()
s785761817
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int a,z; int n=s.size(); for(int i=0;i<n;i++){ if(s.at(i)=='a'){a=i;} else if(s.at(i)=='z'){z=i;}} cout<<z-a+1<<endl; return 0; }
a.cc:1:1: error: '\U0000ff03include' does not name a type 1 | #include<bits/stdc++.h> | ^~~~~~~~~ a.cc: In function 'int main()': a.cc:4:3: error: 'string' was not declared in this scope 4 | string s; | ^~~~~~ a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin>>s; | ^~~ 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 11 | cout<<z-a+1<<endl; | ^~~~ a.cc:11:16: error: 'endl' was not declared in this scope 11 | cout<<z-a+1<<endl; | ^~~~
s430286444
p03814
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; cin>>s; int l=s.size(); int A=0,Z=0; for(int i=0;i<l;i++){ if(s[i]=='A'){ A=i; break; } } for(int i=l-1,i>=0;i--){ if(s[i]=='Z'){ Z=i; break; } } cout<<Z-A<<endl; }
a.cc: In function 'int main()': a.cc:15:18: error: expected ';' before '>=' token 15 | for(int i=l-1,i>=0;i--){ | ^~ | ; a.cc:15:18: error: expected primary-expression before '>=' token 15 | for(int i=l-1,i>=0;i--){ | ^~
s993053042
p03814
C++
#include <iostream> using namespace std; int main(){ string s; cin >> s; int startNum = s.find("A");, endNum = s.rfind("Z");; cout << s.substr(startNum, endNum); << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:30: error: expected primary-expression before ',' token 7 | int startNum = s.find("A");, endNum = s.rfind("Z");; | ^ a.cc:7:32: error: 'endNum' was not declared in this scope; did you mean 'enum'? 7 | int startNum = s.find("A");, endNum = s.rfind("Z");; | ^~~~~~ | enum a.cc:8:39: error: expected primary-expression before '<<' token 8 | cout << s.substr(startNum, endNum); << endl; | ^~
s811148791
p03814
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; cout << s.rfint('Z') - s.find('A') + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'rfint'; did you mean 'rfind'? 7 | cout << s.rfint('Z') - s.find('A') + 1 << endl; | ^~~~~ | rfind
s822176822
p03814
C++
#include<iostream> #include<climits> #include<math.h> #include<vector> #include<algorithm> #include<cstdio> #include<stdio.h> #include <string> #include <complex> #include <functional> using namespace std; typedef pair<int,int> P; double dat[100][100]; int dp[6][1010];//動的計画法 int prime[10000001]; char str[1010][1010]; vector<pair<int,int> > pc[100001]; int ABS(int a){return max(a,-a);} int main(){ string x; int s=0,e=0; cin>>x; for(int i=0;i<x.length();i++){ if(x[i]=='A'){ s=i; break; } } for(int i=s.length()-1;i>=0;i--){ if(x[i]=='Z'){ e=i; break; } } cout<<e-s+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:21: error: request for member 'length' in 's', which is of non-class type 'int' 29 | for(int i=s.length()-1;i>=0;i--){ | ^~~~~~
s685722034
p03814
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { string s; cin>>s; int a=0; for(int i=0;i<s.size();++i){ if(s[i]=='A'){ a=i; } break; } int z=0; reverse(s.begin(),s.end()) for(int i=0;i<s.size();++i){ if(s[i]=='Z'){ z=i; } break; } cout<<s.size()-a-z<<endl; }
a.cc: In function 'int main()': a.cc:20:29: error: expected ';' before 'for' 20 | reverse(s.begin(),s.end()) | ^ | ; 21 | for(int i=0;i<s.size();++i){ | ~~~ a.cc:21:15: error: 'i' was not declared in this scope 21 | for(int i=0;i<s.size();++i){ | ^
s359421883
p03814
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { string s; cin>>s; int a=0; for(int i=0;i<s.size();++i){ if(s[i]=='A') a=i; break; } int z=0; reverse(s.begin(),s.end()) for(int i=0;i<s.size();++i){ if(s[i]=='Z') z=i; break; } cout<<s.size()-a-z<<endl; }
a.cc: In function 'int main()': a.cc:19:29: error: expected ';' before 'for' 19 | reverse(s.begin(),s.end()) | ^ | ; 20 | for(int i=0;i<s.size();++i){ | ~~~ a.cc:20:15: error: 'i' was not declared in this scope 20 | for(int i=0;i<s.size();++i){ | ^
s400261515
p03814
C++
#include <bits/stdc++.h> using namespace std; int a; int b; int c = 0; int main() { string str; cin >> str; for(int i = 0; i < (int)str.size(); ++i){ char ch = str[i]; if(ch == "A" && c == 0){ a = i; c = 1; } if(ch == "Z" && c == 1){ b = i; } } cout << b - a + 1 << endl; }
a.cc: In function 'int main()': a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(ch == "A" && c == 0){ | ~~~^~~~~~ a.cc:17:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | if(ch == "Z" && c == 1){ | ~~~^~~~~~
s131692209
p03814
C++
#include <bits/stdc++.h> using namespace std; int a; int b; boolean c; int main() { string str; cin >> str; for(int i = 0; i < (int)str.size(); ++i){ char ch = str[i]; if(ch == "A" && c == false){ a = i; c = true; } if(ch == "Z" && c == true){ b = i; } } cout << b - a + 1 << endl; }
a.cc:6:1: error: 'boolean' does not name a type; did you mean 'bool'? 6 | boolean c; | ^~~~~~~ | bool a.cc: In function 'int main()': a.cc:13:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(ch == "A" && c == false){ | ~~~^~~~~~ a.cc:13:23: error: 'c' was not declared in this scope; did you mean 'ch'? 13 | if(ch == "A" && c == false){ | ^ | ch a.cc:17:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | if(ch == "Z" && c == true){ | ~~~^~~~~~ a.cc:17:23: error: 'c' was not declared in this scope; did you mean 'ch'? 17 | if(ch == "Z" && c == true){ | ^ | ch
s064383469
p03814
C++
#include <iostream> #include <stdio.h> #include <sstream> using namespace std; int main() { string s; cin >> s; int sp = -1,ep = -1; for (int i = 0;i < s.size(),i++) { if (s[i] == 'A'&&sp == -1) sp = i; if (s[s.size()-i] == 'Z' && ep == -1) ep = i; } cout << ep - sp + 1 << endl; }
a.cc: In function 'int main()': a.cc:10:40: error: expected ';' before ')' token 10 | for (int i = 0;i < s.size(),i++) { | ^ | ;
s369109875
p03814
C++
#include <iostream> #include <stdio.h> #include <sstream> using namespace std; int main() { string s; cin >> s;] int sp = -1,ep = -1; for (int i = 0;i < s.size(),i++) { if (s[i] == 'A'&&sp == -1) sp = i; if (s[s.size()-i] == 'Z' && ep == -1) ep = i; } cout << ep - sp + 1 << endl; }
a.cc: In function 'int main()': a.cc:8:18: error: expected primary-expression before ']' token 8 | cin >> s;] | ^ a.cc:10:40: error: expected ';' before ')' token 10 | for (int i = 0;i < s.size(),i++) { | ^ | ; a.cc:11:34: error: 'sp' was not declared in this scope; did you mean 's'? 11 | if (s[i] == 'A'&&sp == -1) sp = i; | ^~ | s a.cc:12:45: error: 'ep' was not declared in this scope 12 | if (s[s.size()-i] == 'Z' && ep == -1) ep = i; | ^~ a.cc:14:17: error: 'ep' was not declared in this scope 14 | cout << ep - sp + 1 << endl; | ^~ a.cc:14:22: error: 'sp' was not declared in this scope; did you mean 's'? 14 | cout << ep - sp + 1 << endl; | ^~ | s
s267627175
p03814
C++
#include<iostream> #include<string> using namespace std; int main() { char s[200005]; cin >> s; int len = strlen(s); int i; for (i = 0; i < len; i++) { if (s[i] == 'A') break; } int j; for (j = len - 1; j > i; j--) { if (s[j] == 'Z') break; } cout << j - i + 1<< endl; }
a.cc: In function 'int main()': a.cc:10:19: error: 'strlen' was not declared in this scope 10 | int len = strlen(s); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>
s562373625
p03814
C++
#include <bits/stdc++.n> using namespace std; int main () { int l,r; string s; cin>>s; for (int i = 0;i<s.size();i++) { if (s[i]=='A') { l==i; break; } } for (int i = 0; i < s.size(); ++i) { if (s[i]=='Z') r=i; } cout<<r-l+1<<endl; }
a.cc:1:10: fatal error: bits/stdc++.n: No such file or directory 1 | #include <bits/stdc++.n> | ^~~~~~~~~~~~~~~ compilation terminated.
s256083665
p03814
C++
#include <bits/stdc++.n> using namespace std; int main () { int l,r; string s; cin>>s; for (int i = 0;i<s.size();i++) { if (s[i]=='A') { i==i; break; } } for (int i = 0; i < s.size(); ++i) { if (s[i]=='Z') r=i; } cout<<r-l+1<<endl; }
a.cc:1:10: fatal error: bits/stdc++.n: No such file or directory 1 | #include <bits/stdc++.n> | ^~~~~~~~~~~~~~~ compilation terminated.
s467948809
p03814
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define FORR(i, m, n) for(int i = m;i >= n;i--) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); #define llong long long #define pb(a) push_back(a) #define INF 1000000000 using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int Digits(llong num){ int cnt = 0; while(num > 0){ num / 10; cnt++; } return cnt; } int main(){ cin.tie(0); ios::sync_with_stdio(false); string S; cin >> S; int len = S.size(); int A_i,Z_i; for(int i = 0; i < len; ++i){ if(S[i] == 'A') break; } A_i = i; for(int i = len -1; i > 0;i--){ if(S[i] == 'Z') break; } Z_i = i; cout << Z_i - A_i + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:39:11: error: 'i' was not declared in this scope 39 | A_i = i; | ^
s001061816
p03814
C++
#include <algorithm> #include <cassert> // #include <chrono> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <iostream> #include <map> #include <memory> #include <queue> // #include <random> #include <set> #include <stack> #include <string> #include <utility> #include <vector> /* unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 g1.seed(seed1); */ using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<pii, pii> ppiipii; typedef pair<int, ppiipii> pippiipii; typedef pair<int, pii> pipii; typedef pair<pii, int> ppiii; typedef pair<int, ppiii> pippiii; typedef pair<int, ll> pill; typedef pair<int, double> pid; typedef pair<string, string> pss; // note to self, the below two triggers someone typedef pair<ll, ll> pll; typedef pair<ll, int> plli; typedef long double ld; char buf[200005]; int main() { scanf("%s", buf); int a = 0; while(buf[a] != 'A') a++; int b = strlen(buf); while(buf[b-1] != 'Z') b--; printf("%d\n", b-a;) }
a.cc: In function 'int main()': a.cc:51:21: error: expected ')' before ';' token 51 | printf("%d\n", b-a;) | ~ ^ | ) a.cc:51:22: error: expected primary-expression before ')' token 51 | printf("%d\n", b-a;) | ^
s516513208
p03814
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int A,Z; int i=0; int Flag=0; int L=s.size(); for(int i=0;i<L;i++){ if(s[i]=='A' && Flag=0){ A=i; Flag=1; } if(s[i]=='Z')Z=i; } cout<<(Z-A)+1<<endl; }
a.cc: In function 'int main()': a.cc:13:18: error: lvalue required as left operand of assignment 13 | if(s[i]=='A' && Flag=0){
s335664996
p03814
C++
#include<iostream> #include<string> using namespace std; int main(int argc, char const *argv[]) { string s; int f,l; cin>>s; for(int i=0;i<s.length();i++){ if(s[i]=='A'){ f=i; break; } } for(int i=s.length-1;i>=0;i--){ if(s[i]=='Z'){ l=i; break; } } cout<<l-f+1; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:16:17: 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 '()' ?) 16 | for(int i=s.length-1;i>=0;i--){ | ~~^~~~~~ | ()
s759601753
p03814
Java
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); String a = sc.next(); int count = 0; int flag = 0; ArrayList<Integer> array = new ArrayList<Integer>(); String[] param = a.split(""); for (int i = 0; i < a.length(); i++) { if (param[i].equals("A")) { flag = i; break; } } for (int j = flag; j < a.length(); j++) { count++; if (param[j].equals("Z")) { array.add(count); } } Collections.sort(array); Collections.reverse(array); System.out.println(array.get(0)); } }
Main.java:5: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s715629264
p03814
C++
#include<stdio.h> int main(){ char a[200000]; int i=0,cnt=0,start=0,e=0,sum=0; scanf("%s",&a); while(a[i]!=0){ cnt+=1; i++; } for(i=cnt;i>0;i--){ if(a[i]=='Z'){ e=i; break; } for(i=0;i<200000;i++){ if(a[i]=='A'){ start=i; break; } } sum=(e-start)+1; printf("%d",sum); }
a.cc: In function 'int main()': a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:2:11: note: to match this '{' 2 | int main(){ | ^
s268851290
p03814
C++
#include <stdio.h> int main(void){ char a[200000]; int i=0,cnt=0,start=0,e=0,sum=0; scanf("%s",&a); while(a[i]!=0){ cnt+=1; i++; } for(i=cnt;i>0;i--){ if(a[i]=='Z'){ e=cnt; break; } for(i=0;i<200000;i++){ if(a[i]=='A'){ start=i; break; } } sum=(e-start)+1; printf("%d",sum); }
a.cc:1:1: error: '\U0000ff03include' does not name a type 1 | #include <stdio.h> | ^~~~~~~~~
s136745639
p03814
C++
#include <stdio.h> int main(void){ char a[200000]; int i=0,cnt=0,start=0,end=0,sum=0; scanf("%s",&a); while(a[i]!=0){ cnt+=1; i++; } for(i=cnt;i>0;i--){ if(a[i]=='Z'){ end=cnt; break; } for(i=0;i<200000;i++){ if(a[i]=='A'){ start=i; break; } } sum=(end-start)+1; printf("%d",sum); }
a.cc:1:1: error: '\U0000ff03include' does not name a type 1 | #include <stdio.h> | ^~~~~~~~~
s393599245
p03814
C++
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=int(a);i<int(b);++i) using namespace std; typedef long long ll; int INF = (1LL << 30) - 1; int MOD = 1e9+7; main(){ string S; cin >> S; int l,r; rep(i,0,S){ if(S[i] == 'A'){ l = i; break; } } for(int i = S.size()-1;i >= 0;i--){ if(S[i] == 'Z'){ r = i; break; } } cout << r - l + 1 << endl; }
a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:2:39: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int' 2 | #define rep(i,a,b) for(int i=int(a);i<int(b);++i) | ^~~~~~ a.cc:11:5: note: in expansion of macro 'rep' 11 | rep(i,0,S){ | ^~~
s666881251
p03814
C++
#include <iostream> #include <string> using namespace std; int main() { string s; int len = 0; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 'A') { for (int j = i; j < s.size(); j++) { if (s[j] == 'Z') { len = j - i + 1; } } break; } } cout << len << endl; cout << t << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:17: error: 't' was not declared in this scope 23 | cout << t << endl; | ^
s229579035
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ string a; cin>>a; int n=a.size(); int b; int c; for(int i=0;i<n;i++){ if(a[i]="A"){ b=i; break; } } for(int i=0;i<n;i++){ if(a[i]="Z"){ c=i; break; } } cout<<c-b+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 10 | if(a[i]="A"){ | ^~~ | | | const char* a.cc:16:13: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 16 | if(a[i]="Z"){ | ^~~ | | | const char*
s482936087
p03814
C++
#include <iostream> #include <algorithm> using namespace std; int main(void){ char buf[200010]; int hd, tl; hd = 200000; tl = 0; cin >> buf; for (char *p=buf; *p; p++){ if (*p=='A') hd = min(hd, (p-buf)); if (*p=='Z') tl = max(tl, (p-buf)); } cout << (tl-hd+1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:26: error: no matching function for call to 'min(int&, long int)' 10 | if (*p=='A') hd = min(hd, (p-buf)); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, 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, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, 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:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 10 | if (*p=='A') hd = min(hd, (p-buf)); | ~~~^~~~~~~~~~~~~ /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, from a.cc:2: /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:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 10 | if (*p=='A') hd = min(hd, (p-buf)); | ~~~^~~~~~~~~~~~~ a.cc:11:26: error: no matching function for call to 'max(int&, long int)' 11 | if (*p=='Z') tl = max(tl, (p-buf)); | ~~~^~~~~~~~~~~~~ /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:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long int') 11 | if (*p=='Z') tl = max(tl, (p-buf)); | ~~~^~~~~~~~~~~~~ /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:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 11 | if (*p=='Z') tl = max(tl, (p-buf)); | ~~~^~~~~~~~~~~~~
s776390055
p03814
C++
#include<bits/stdc++.h> #include<algorithm> #include<math.h> #include<set> #include<vector> #include<string> using namespace std; string S; cin>>S; int x,y; for (int i=0; i < S.size(); i++){ if(S[i]=='A') x = i; break; } for (int i=0; i < S.size(); i++){ if(S[i]=='Z') y = i; break; } cout<<y-x+1<<endl; }
a.cc:9:1: error: 'cin' does not name a type 9 | cin>>S; | ^~~ a.cc:11:1: error: expected unqualified-id before 'for' 11 | for (int i=0; i < S.size(); i++){ | ^~~ a.cc:11:15: error: 'i' does not name a type 11 | for (int i=0; i < S.size(); i++){ | ^ a.cc:11:29: error: 'i' does not name a type 11 | for (int i=0; i < S.size(); i++){ | ^ a.cc:16:1: error: expected unqualified-id before 'for' 16 | for (int i=0; i < S.size(); i++){ | ^~~ a.cc:16:15: error: 'i' does not name a type 16 | for (int i=0; i < S.size(); i++){ | ^ a.cc:16:29: error: 'i' does not name a type 16 | for (int i=0; i < S.size(); i++){ | ^ a.cc:21:1: error: 'cout' does not name a type 21 | cout<<y-x+1<<endl; | ^~~~ a.cc:22:1: error: expected declaration before '}' token 22 | } | ^
s127987232
p03814
C++
#include <iostream> #include <stdio.h> #include <string.h> #include<cstring> using namespace std; int main(){ string t; cin >> t; char* s = new char[t.size() +1 ]; std::char_traits<char>::copy(s, t.c_str(), t.size()+1); int z = 'Z'; int ans; ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:17:16: error: no matching function for call to 'strrchr(char&, char)' 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ~~~~~~~^~~~~~~~ In file included from a.cc:3: /usr/include/string.h:253:14: note: candidate: 'char* strrchr(char*, int)' (near match) 253 | extern char *strrchr (char *__s, int __c) | ^~~~~~~ /usr/include/string.h:253:14: note: conversion of argument 1 would be ill-formed: a.cc:17:17: error: invalid conversion from 'char' to 'char*' [-fpermissive] 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~ | | | char /usr/include/string.h:255:20: note: candidate: 'const char* strrchr(const char*, int)' (near match) 255 | extern const char *strrchr (const char *__s, int __c) | ^~~~~~~ /usr/include/string.h:255:20: note: conversion of argument 1 would be ill-formed: a.cc:17:17: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~ | | | char a.cc:17:33: error: no matching function for call to 'strchr(char&, char)' 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ~~~~~~^~~~~~~~ /usr/include/string.h:226:14: note: candidate: 'char* strchr(char*, int)' (near match) 226 | extern char *strchr (char *__s, int __c) | ^~~~~~ /usr/include/string.h:226:14: note: conversion of argument 1 would be ill-formed: a.cc:17:34: error: invalid conversion from 'char' to 'char*' [-fpermissive] 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~ | | | char /usr/include/string.h:228:20: note: candidate: 'const char* strchr(const char*, int)' (near match) 228 | extern const char *strchr (const char *__s, int __c) | ^~~~~~ /usr/include/string.h:228:20: note: conversion of argument 1 would be ill-formed: a.cc:17:34: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 17 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~ | | | char
s371082917
p03814
C++
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main(){ string s; cin >> s; int z = 'Z'; int ans; ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:13:17: error: no match for 'operator*' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 13 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~ a.cc:13:34: error: no match for 'operator*' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 13 | ans = strrchr(*s,'Z') - strchr(*s,'A') + 1; | ^~
s168337778
p03814
C++
#include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main(){ string *s; cin >> s; int z = 'Z'; int ans; ans = strrchr(s,'Z') - strchr(s,'A') + 1; cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:10:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}) 10 | 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/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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:10:10: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 10 | 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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(short int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(short unsigned int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(unsigned int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(long int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(long unsigned int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(long long int)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:10:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 10 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:10:10: error: cannot bind rvalue '(long long unsigned int)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:10:10: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 10 | 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*' {aka 'std::__cxx11::basic_string<char>*'} 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*' {aka 'std::__cxx11::basic_string<char>*'} 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*' {aka 'std::__cxx11::basic_string<char>*'} 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 conversion for argument 1 from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 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:1
s564393422
p03814
C++
#include<iostream> #include <stdio.h> #include<string> #include <cmath> #include <algorithm> #include <vector> #include <cstdint> #include <map> #define MOD 1000000007 using namespace std; typedef long long ll; int main(){ string s; int A=-1,Z; for(int i = 0; i < s.size() && A=-1; i++){ if(s[i] == 'A') A = i; } for(int i = A+1; i < s.size(); i++){ if(s[i] == 'Z') Z = i; } cout << Z - A + 1<< endl; return 0; }
a.cc: In function 'int main()': a.cc:17:29: error: lvalue required as left operand of assignment 17 | for(int i = 0; i < s.size() && A=-1; i++){ | ~~~~~~~~~~~~~^~~~
s716917703
p03814
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; int a; int z; for (int i = 0; i <s.size();i++){ if(s[i]=='A'){ a = i+1; break; } } for (int i = s.size(); i >0; i--) { if([i-1]=='Z'){ z = i; break; } } cout << z-a+1<< endl; return 0; }
a.cc: In function 'int main()': a.cc:16:14: error: expected ',' before '-' token 16 | if([i-1]=='Z'){ | ^ | , a.cc:16:14: error: expected identifier before '-' token a.cc: In lambda function: a.cc:16:17: error: expected '{' before '==' token 16 | if([i-1]=='Z'){ | ^~ a.cc: In function 'int main()': a.cc:16:17: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'char') 16 | if([i-1]=='Z'){ | ~~~~~^~~~~ | | | | | char | main()::<lambda()> In file included from /usr/include/c++/14/iosfwd:42, 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/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::fpos<_StateT>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/string:43, 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/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::allocator<_CharT>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::pair<_T1, _T2>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629: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> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/string_view:644: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>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:16:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755: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>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | if([i-1]=='Z'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:16:19: note: mismatched types 'const _CharT*' and 'main()::<lambda()>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::tuple<_UTypes ...>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'main()::<lambda()>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 16 | if([i-1]=='Z'){ | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:449:3: note: candidate: 'bool std::operator==(const error_code&, const error_code&)' 449 | operator==(const error_code& __lhs,
s760365402
p03814
C++
#include <iostream> using namespace std; int main() { int a, b, c; string s; cin >> s; a = s.find("A"); b = rfind("Z"); cout << a - b << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'rfind' was not declared in this scope; did you mean 'rewind'? 9 | b = rfind("Z"); | ^~~~~ | rewind
s953934873
p03814
C++
#include <iostream> using namespace std; int main() { int a, b, c; string s; cin >> s; a = s.find("A"); b = rfind("Z") cout << a - b << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'rfind' was not declared in this scope; did you mean 'rewind'? 9 | b = rfind("Z") | ^~~~~ | rewind
s444864565
p03814
C++
#include <string> using namespace std; int main() { int a, z, c = 0; string s; cin >> s; int S = s.size(); for (int i = 0; i < S; i++) { if (s[i] == 'A' && c == 0) { a = i; c++; } if (s[i] == 'Z') { z = i; } } int A = a+1, Z = z+1; cout << Z - A + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> s; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <string> +++ |+#include <iostream> 2 | using namespace std; a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << Z - A + 1 << endl; | ^~~~ a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:18:26: error: 'endl' was not declared in this scope 18 | cout << Z - A + 1 << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <string> +++ |+#include <ostream> 2 | using namespace std;
s835043567
p03814
C++
#include <string> using namespace std; int main() { int a, z, c = 0; string s; cin >> s; int S = s.size(); for (int i = 0; i < S; i++) { if (s[i] == 'A' && c == 0) { a = i; c++; } if (s[i] == 'Z') { z = i; } } int A = a+1, Z = z+1; cout << Z - A + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> s; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <string> +++ |+#include <iostream> 2 | using namespace std; a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << Z - A + 1 << endl; | ^~~~ a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:18:26: error: 'endl' was not declared in this scope 18 | cout << Z - A + 1 << endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include <string> +++ |+#include <ostream> 2 | using namespace std;
s184454322
p03814
C++
#include <bits/stdc++.h> #define INF (1<<30) #define INFLL (1ll<<60) #define EPS (1e-10) using namespace std; map <int,int> mp; typedef pair<int, int> P; typedef long long ll; static const int MAX=100000; static const int NMAX=100; int main(){ string s; cin>>s; int s1=-1,s2=-1; for(int i=0;i<s.size();i++){ if(s[i] =='A'&&s1==-1)s1=i; if(s[i]=='Z')s2=i; cout<<s1<<" "<<s2<<"\n"; } cout<<s2-s1+1<<"\n"; return 0;
a.cc: In function 'int main()': a.cc:23:14: error: expected '}' at end of input 23 | return 0; | ^ a.cc:12:11: note: to match this '{' 12 | int main(){ | ^
s150025459
p03814
C++
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _02_ABC081A { class Program { static void Main(string[] args) { int a = 0; int z = 0; bool check = false; string str; string s = Console.ReadLine(); //string[] str = Console.ReadLine().Split(' ');//2つ以上のスペース区切り入力の取得 //int b = int.Parse(str[0]); //数値で受け取りたい場合は変換する //int c = int.Parse(str[1]); for (int i = 0; i < s.Length; i++) { if (!check) { if (s[i] == 'A') { a = i; check = true; } } } for (int i = 0; i < s.Length; i++) { if (s[i] == 'Z') { z = i; } } str = s.Substring(a, z - a + 1); Console.WriteLine(str.Length); Console.Read(); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:3:7: error: expected nested-name-specifier before 'System' 3 | using System.Linq; | ^~~~~~ a.cc:4:7: error: expected nested-name-specifier before 'System' 4 | using System.Text; | ^~~~~~ a.cc:5:7: error: expected nested-name-specifier before 'System' 5 | using System.Threading.Tasks; | ^~~~~~ a.cc:11:26: error: 'string' has not been declared 11 | static void Main(string[] args) | ^~~~~~ a.cc:11:35: error: expected ',' or '...' before 'args' 11 | static void Main(string[] args) | ^~~~ a.cc:49:6: error: expected ';' after class definition 49 | } | ^ | ; a.cc: In static member function 'static void _02_ABC081A::Program::Main(int*)': a.cc:16:13: error: 'string' was not declared in this scope 16 | string str; | ^~~~~~ a.cc:18:20: error: expected ';' before 's' 18 | string s = Console.ReadLine(); | ^ a.cc:23:33: error: 's' was not declared in this scope 23 | for (int i = 0; i < s.Length; i++) | ^ a.cc:34:33: error: 's' was not declared in this scope 34 | for (int i = 0; i < s.Length; i++) | ^ a.cc:42:13: error: 'str' was not declared in this scope; did you mean 'std'? 42 | str = s.Substring(a, z - a + 1); | ^~~ | std a.cc:42:19: error: 's' was not declared in this scope 42 | str = s.Substring(a, z - a + 1); | ^ a.cc:44:13: error: 'Console' was not declared in this scope 44 | Console.WriteLine(str.Length); | ^~~~~~~
s266791071
p03814
C++
#include<bits/stdc++.h> using namespace std; string s,R,L; int main() { cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='A') { L=i; break; } } for(int i=s.size()-1;i>=0;i--) { if(s[i]=='Z') { R=i; break; } } if(L>R)swap(L,R); cout<<R-L+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 25 | cout<<R-L+1<<endl; | ~^~ | | | | | basic_string<[...]> | basic_string<[...]> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout<<R-L+1<<endl; | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^
s065333081
p03814
C++
#include<bits/stdc++.h> using namespace std; string s,R,L; int main() { cin>>s; for(int i=0;i<s.size();i++) { if(s[i]=='A') { L=i; break; } } for(int i=s.size()-1;i>=0;i--) { if(s[i]=='Z') { R=i; break; } } if(L>R)swap(L,R); cout<<R-L+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 25 | cout<<R-L+1<<endl; | ~^~ | | | | | basic_string<[...]> | basic_string<[...]> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 25 | cout<<R-L+1<<endl; | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:25:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 25 | cout<<R-L+1<<endl; | ^
s955350138
p03814
C++
#include<bits/stdc++.h> using namespace std; typedef long long int ll; ll cnt,x[1000],y[1000]; double maxn=-99999; inline double dist(ll ind1,ll ind2) { int xx=x[ind1]-x[ind2],yy=y[ind1]-y[ind2]; return sqrt(xx*xx+yy*yy); } int main() { cin>>cnt; for(register int i=0;i<cnt;i++) { cin>>x[i]>>y[i]; } for(register int i=0;i<cnt-1;i++) { for(register int j=i+1;j<cnt;j++) { maxn=max(maxn,dist(i,j)); } } printf("%.12lf\n \",maxn); }
a.cc:25:16: warning: missing terminating " character 25 | printf("%.12lf\n \",maxn); | ^ a.cc:25:16: error: missing terminating " character 25 | printf("%.12lf\n \",maxn); | ^~~~~~~~~~~~~~~~~~~ a.cc: In function 'int main()': a.cc:14:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 14 | for(register int i=0;i<cnt;i++) | ^ a.cc:18:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 18 | for(register int i=0;i<cnt-1;i++) | ^ a.cc:20:34: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 20 | for(register int j=i+1;j<cnt;j++) | ^ a.cc:26:1: error: expected primary-expression before '}' token 26 | } | ^
s314554225
p03814
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; for(int i=0;s[i]!='A';i++); for(int j=s.size();s[j]!='Z';j--); cout<<j-i+1; return 0; }
a.cc: In function 'int main()': a.cc:9:9: error: 'j' was not declared in this scope 9 | cout<<j-i+1; | ^ a.cc:9:11: error: 'i' was not declared in this scope 9 | cout<<j-i+1; | ^
s163728280
p03814
C++
#include<bits/stdc++.h> using namespace std; int main() { int i, j; cin>>s; for(i=0;s[i]!='A';i++){ for(j=s.size();s[j]!='Z';j--){ cout<<j-i+1; } } return 0; }
a.cc: In function 'int main()': a.cc:6:8: error: 's' was not declared in this scope 6 | cin>>s; | ^
s080017243
p03814
C++
#include<bits/stdc++.h> using namespace std; int j; string s; int main(){ cin>>s; for(int i=0;s[i];i++){ if (s[i]=='Z'){j=i} for(i=0;s[i]!='A';i++){ cin>>j-i+1; } } }
a.cc: In function 'int main()': a.cc:9:23: error: expected ';' before '}' token 9 | if (s[i]=='Z'){j=i} | ^ | ; a.cc:11:10: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 11 | cin>>j-i+1; | ~~~^~~~~~~ | | | | | int | 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:11:15: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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>]' (near match) 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed: a.cc:11:15: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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>]' (near match) 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed: a.cc:11:15: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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>]' (near match) 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed: a.cc:11:15: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'int' 11 | cin>>j-i+1; | ~~~^~ /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:11:15: error: invalid conversion from 'int' to 'void*' [-fpermissive] 11 | cin>>j-i+1; | ~~~^~ | | | int a.cc:11:15: error: cannot bind rvalue '(void*)((long int)((j - i) + 1))' to 'void*&' /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>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:11:15: error: invalid conversion from 'int' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 11 | cin>>j-i+1; | ~~~^~ | | | int /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>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:11:15: error: invalid conversion from 'int' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 11 | cin>>j-i+1; | ~~~^~ | | | int /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_ty
s292602378
p03814
Java
import java.util.*; import java.util.HashSet; import java.util.Set; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); String s=sc.next(); int a=0; int z=0; for(int i=0;i<s.length();i++){ if(s.charAt(i)=="A"){ a=i; } if(s.charAt(i)=="Z"){ z=i; } } System.out.println(z-a); } }
Main.java:11: error: bad operand types for binary operator '==' if(s.charAt(i)=="A"){ ^ first type: char second type: String Main.java:14: error: bad operand types for binary operator '==' if(s.charAt(i)=="Z"){ ^ first type: char second type: String 2 errors
s452424153
p03814
C++
#include <algorithm> #include <iostream> using namespace std; int main(){ string s; cin >> s; int i=0, j=0; a=2; for(i=0; i<s.size(); i++){ if(s[i]=='A'){ for(j=i+1; j<s.size(); j++){ if(s[j]=='Z'){ a = max(a,j-i+1); } } } } cout << a; }
a.cc: In function 'int main()': a.cc:8:23: error: 'a' was not declared in this scope 8 | int i=0, j=0; a=2; | ^
s088877390
p03814
C++
#include<iostream> #include<vector> #include<queue> #include<string> using namespace std; int main(void){ string s; cin>>s; int a,b; bool f=true; for(int i=0;i<s.size();i++){ if(s[i]=='A'&&f){ a=i; f=false; } if(s[i]=='Z'){ b=i; } } cout<<b-a+1<<endl; return 0; }#include<iostream> #include<vector> #include<queue> #include<string> using namespace std; int main(void){ string s; cin>>s; int a,b; bool f=true; for(int i=0;i<s.size();i++){ if(s[i]=='A'&&f){ a=i; f=false; } if(s[i]=='Z'){ b=i; } } cout<<b-a+1<<endl; return 0; }#include<iostream> #include<vector> #include<queue> #include<string> using namespace std; int main(void){ string s; cin>>s; int a,b; bool f=true; for(int i=0;i<s.size();i++){ if(s[i]=='A'&&f){ a=i; f=false; } if(s[i]=='Z'){ b=i; } } cout<<b-a+1<<endl; return 0; }
a.cc:22:2: error: stray '#' in program 22 | }#include<iostream> | ^ a.cc:43:2: error: stray '#' in program 43 | }#include<iostream> | ^ a.cc:22:3: error: 'include' does not name a type 22 | }#include<iostream> | ^~~~~~~ a.cc:27:5: error: redefinition of 'int main()' 27 | int main(void){ | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main(void){ | ^~~~ a.cc:43:3: error: 'include' does not name a type 43 | }#include<iostream> | ^~~~~~~ a.cc:48:5: error: redefinition of 'int main()' 48 | int main(void){ | ^~~~ a.cc:6:5: note: 'int main()' previously defined here 6 | int main(void){ | ^~~~
s152678420
p03814
C++
ZABCZ
a.cc:1:1: error: 'ZABCZ' does not name a type 1 | ZABCZ | ^~~~~
s586553808
p03814
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<ll, int> P; #define MOD (1000000007ll) #define l_ength size ll sq(ll x){ return x*x; } void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } bool isvowel(char c){ int i; string v="aeiou"; for(i = (v.size()-1); i>=0; --i){ if(c == v[i]){ return true; } } return false; } int main(void){ int s,l,r; string s; l = 0; r = s.length()-1; while(s[l]!='A'){ ++l; } while(s[r]!='Z'){ --r; } cout << (r-l+1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:16: error: conflicting declaration 'std::string s' 32 | string s; | ^ a.cc:31:13: note: previous declaration as 'int s' 31 | int s,l,r; | ^ a.cc:34:15: error: request for member 'length' in 's', which is of non-class type 'int' 34 | r = s.length()-1; | ^~~~~~ a.cc:35:16: error: invalid types 'int[int]' for array subscript 35 | while(s[l]!='A'){ | ^ a.cc:38:16: error: invalid types 'int[int]' for array subscript 38 | while(s[r]!='Z'){ | ^
s561815465
p03814
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<int(n);++i) int main(void){ string s; cin>>s; int n = s.size(); int l,r; rep(i,n){ if(s[i]=='A') l=i,break; } rep(i,n){ if(s[i]=='Z') r=i; } cout<<r-l+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: expected primary-expression before 'break' 11 | if(s[i]=='A') l=i,break; | ^~~~~
s378510161
p03814
C++
#include <bits/stdc++.h> #define INF 114514810 using namespace std; int main(void){ string s; int a = INF, z = -1; cin >> s; if (int i = 0; i < s.size(); i++) { if (s[i] == 'A') a = min(a, i); if (s[i] == 'Z') z = max(z, i); } cout << z - a + 1 << endl; }
a.cc: In function 'int main()': a.cc:9:32: error: expected ')' before ';' token 9 | if (int i = 0; i < s.size(); i++) { | ~ ^ | ) a.cc:9:34: error: 'i' was not declared in this scope 9 | if (int i = 0; i < s.size(); i++) { | ^
s673195752
p03814
C++
#include <bits/stdc++.h> #define INF 114514810 using namespace std; int main(void){ string s, a = INF, z = -1; cin >> s; if (int i = 0; i < s.size(); i++) { if (s[i] == 'A') a = min(a, i); if (s[i] == 'Z') z = max(z, i); } cout << z - a + 1 << endl; }
a.cc: In function 'int main()': a.cc:2:13: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 2 | #define INF 114514810 | ^~~~~~~~~ a.cc:6:19: note: in expansion of macro 'INF' 6 | string s, a = INF, z = -1; | ^~~ a.cc:6:28: error: conversion from 'int' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 6 | string s, a = INF, z = -1; | ^~ a.cc:8:32: error: expected ')' before ';' token 8 | if (int i = 0; i < s.size(); i++) { | ~ ^ | ) a.cc:8:34: error: 'i' was not declared in this scope 8 | if (int i = 0; i < s.size(); i++) { | ^ a.cc:12:15: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 12 | cout << z - a + 1 << endl; | ~ ^ ~ | | | | | basic_string<[...]> | basic_string<[...]> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | cout << z - a + 1 << endl; | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:12:17: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 12 | cout << z - a + 1 << endl; | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArr
s524422838
p03814
C++
S = input() a = S.find('A') z = S[::-1].find("Z") print(len(S[a:-(1+z)])+1)
a.cc:1:1: error: 'S' does not name a type 1 | S = input() | ^
s247213923
p03814
C++
s = input() while True: if s[0] != 'A': s = s[1:] continue if s[-1] != 'Z': s = s[:-1] continue break print(len(s))
a.cc:2:1: error: 's' does not name a type 2 | s = input() | ^
s158095330
p03814
C++
#include <bits/stdc++.h> // #include "bits/stdc++.h" #define pout(n) printf ("%d\n", n) #define rep(i,a,n) for (int i = a;i < n;i++) #define per(i,n,a) for (int i = n-1;i >= a;i--) typedef long long ll; using namespace std; int main (){ string s; int st,f; cin >> s; rep(i,0,s.length()){ if(s[i] == 'A'){ st = i; break; } } per(i,s.length(),0){ if(s[i] == 'Z'){ f = i; break; } } pout(f-s+1); return 0; }
a.cc: In function 'int main()': a.cc:29:9: error: no match for 'operator-' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 29 | pout(f-s+1); | ~^~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | int a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:370:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const complex<_Tp>&)' 370 | operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:370:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::complex<_Tp>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/complex:379:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&, const _Tp&)' 379 | operator-(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:379:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::complex<_Tp>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)' 388 | operator-(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed: a.cc:29:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)' 465 | operator-(const complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:29:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed: a.cc:29:10: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::valarray<_Tp>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1197 | _DEFINE_BINARY_OPERATOR(-, __minus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed: a.cc:29:10: note: mismatched types 'const std::valarray<_Tp>' and 'int' 29 | pout(f-s+1); | ^ a.cc:4:34: note: in definition of macro 'pout' 4 | #define pout(n) printf ("%d\n", n) | ^ /usr/include/c++
s496068075
p03814
C++
int main(void) { std::string s; int A = 0, Z = 0, X = 0; std::cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == 'A') { A = i + 1; break; } } for (int j = s.size() - 1; j > 0; j--) { if (s[j] == 'Z') { Z = j + 1; break; } } X = Z - A + 1; std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:3:14: error: 'string' is not a member of 'std' 3 | std::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 | int main(void) { a.cc:5:14: error: 'cin' is not a member of 'std' 5 | std::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 | int main(void) { a.cc:5:21: error: 's' was not declared in this scope 5 | std::cin >> s; | ^ a.cc:19:14: error: 'cout' is not a member of 'std' 19 | std::cout << X << std::endl; | ^~~~ a.cc:19:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:32: error: 'endl' is not a member of 'std' 19 | std::cout << X << std::endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | int main(void) {
s272530599
p03814
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; #define int long long int main() { string s; cin >> s; cout << (s.rfind('Z') - s.find('A') + 1) << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s642732625
p03814
C++
#include<bits/stdc++.h> int N,K; char S[200020] = {0}; int a,b; int main() { scanf("%s",S); N = strlen(S); for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i; reverse(S,S + N); for(int i = 0; i < N; i++)if(S[i] == 'A')b = i; printf("%d\n",a + b - N + 2); return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'? 12 | reverse(S,S + N); | ^~~~~~~ | std::reverse In file included from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~
s261824120
p03814
C++
#include<stdio.h> #include<string.h> #include<bits/stdc++.h> int N,K; char S[200020] = {0}; int a,b; int main() { scanf("%s",S); N = strlen(S); for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i; reverse(S,S + N); for(int i = 0; i < N; i++)if(S[i] == 'A')b = i; printf("%d\n",a + b - N + 2); return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'? 14 | reverse(S,S + N); | ^~~~~~~ | std::reverse In file included from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~
s638047517
p03814
C++
#include<stdio.h> #include<string.h> #include<algorithm> int N,K; char S[200020] = {0}; int a,b; int main() { scanf("%s",S); N = strlen(S); for(int i = 0; i < N; i++)if(S[i] == 'Z')a = i; reverse(S,S + N); for(int i = 0; i < N; i++)if(S[i] == 'A')b = i; printf("%d\n",a + b - N + 2); return 0; }
a.cc: In function 'int main()': a.cc:14:5: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'? 14 | reverse(S,S + N); | ^~~~~~~ | std::reverse In file included from /usr/include/c++/14/algorithm:86, from a.cc:3: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~
s932988455
p03814
C++
#include <cstdio> #include <cstring> int main(void) { char s[200001]; scanf("%s", s); int start, end; for(int i = 0; i < strlen(s); i++){ if(s[i] == 'Z') end = i; } for(int i = 0; i < strlen(s); i++){ if(s[i] == 'A') start = i, break; } printf("%d\n", end - start + 1); return 0; }
a.cc: In function 'int main()': a.cc:13:30: error: expected primary-expression before 'break' 13 | if(s[i] == 'A') start = i, break; | ^~~~~