submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s448328480
p03814
Java
import java.util.*; import java.io.*; //A to Z String public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextLine(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:8: error: cannot find symbol String u = input.nextLine(); ^ symbol: variable input location: class Main 1 error
s290404579
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextLine(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextLine(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:15: error: illegal start of expression public class Main{ ^ Main.java:36: error: illegal start of type for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: > or ',' expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: ';' expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: <identifier> expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:41: error: <identifier> expected System.out.println(zPos - aPos + 1); ^ Main.java:41: error: <identifier> expected System.out.println(zPos - aPos + 1); ^ Main.java:43: error: class, interface, enum, or record expected } ^ 8 errors
s536459014
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.next(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:6: error: cannot find symbol String u = input.next(); ^ symbol: variable input location: class Main 1 error
s355487758
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextln(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:6: error: cannot find symbol String u = input.nextln(); ^ symbol: variable input location: class Main 1 error
s128821389
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextln(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; }public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.nextln(); int aPos = -1; int zPos = u.length(); for(int i = u.length() - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } } for(int j = aPos; j < u.length() - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:14: error: illegal start of expression }public class Main{ ^ Main.java:36: error: illegal start of type for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: > or ',' expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: ';' expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:36: error: <identifier> expected for(int j = aPos; j < u.length() - 1; j++){ ^ Main.java:41: error: <identifier> expected System.out.println(zPos - aPos + 1); ^ Main.java:41: error: <identifier> expected System.out.println(zPos - aPos + 1); ^ Main.java:43: error: class, interface, enum, or record expected } ^ 8 errors
s121156945
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.next(); int aPos = -1; int zPos = u.length; for(int i = u.length - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length - 1; j++){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:6: error: cannot find symbol String u = input.next(); ^ symbol: variable input location: class Main Main.java:8: error: cannot find symbol int zPos = u.length; ^ symbol: variable length location: variable u of type String Main.java:9: error: cannot find symbol for(int i = u.length - 1; i > 0; i--){ ^ symbol: variable length location: variable u of type String Main.java:15: error: cannot find symbol for(int j = aPos; j < u.length - 1; j++){ ^ symbol: variable length location: variable u of type String 4 errors
s172889420
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.next(); int aPos = -1; int zPos = u.length; for(int i = u.length - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length - 1){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:15: error: ';' expected for(int j = aPos; j < u.length - 1){ ^ 1 error
s702329130
p03814
Java
import java.util.* public class Main{ public static void main(String[] args){ Scanner inp = new Scanner(System.in); String u = input.next(); int aPos = -1; int zPos = u.length; for(int i = u.length - 1; i > 0; i--){ String chr = u.substring(i - 1,i); if(chr.equals("A")) aPos = i; } for(int j = aPos; j < u.length - 1){ String chr2 = u.substring(j,j+ 1); if(chr2.equals("Z")) zPos = j; } System.out.println(zPos - aPos + 1); } }
Main.java:1: error: ';' expected import java.util.* ^ Main.java:15: error: ';' expected for(int j = aPos; j < u.length - 1){ ^ 2 errors
s103597853
p03814
Java
import java.io.*; import java.util.*; public class Exp { // "Main" should be used for most online judges public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); int index = str.indexOf('A'); String ans = ""; for (int i = index; i < str.length(); i++ ) { if(str.charAt(i)=='Z') { System.out.print(str.charAt(i)); break; } else System.out.print(str.charAt(i)); } } }
Main.java:4: error: class Exp is public, should be declared in a file named Exp.java public class Exp { // "Main" should be used for most online judges ^ 1 error
s697663990
p03814
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); int maxL = 0; int start; for (int i = 0; i < s.length(); i++) { int L = 0; if (s.charAt(i) == 'A') { start = i; } if (s.charAt(i) == 'Z') { L = i - start; } if (L >= maxL) { maxL = L; } } System.out.println(maxL); } }
Main.java:22: error: variable start might not have been initialized L = i - start; ^ 1 error
s307003085
p03814
C++
#include <string> using namespace std; int main(){ string s; cin >> s; int l = -1, r = -1; 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 == -1 || r == -1 || r < l) cout << 0 << endl; else cout << r - l + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: 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:19:17: error: 'cout' was not declared in this scope 19 | cout << 0 << endl; | ^~~~ a.cc:19:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:30: error: 'endl' was not declared in this scope 19 | cout << 0 << 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; a.cc:21:17: error: 'cout' was not declared in this scope 21 | cout << r - l + 1 << endl; | ^~~~ a.cc:21:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:21:38: error: 'endl' was not declared in this scope 21 | cout << r - l + 1 << endl; | ^~~~ a.cc:21:38: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s474634382
p03814
C++
#include <iostream> #include <algorithm> #include <string> #include <cstdio> #include <cmath> #include <stack> #include <cstring> #include <vector> #include <set> #include <map> #include <queue> #include <numeric> #include <iomanip> int main() { std::string s; std::cin >> s; long long start = -1; long long ans = 0; for (size_t i = 0; i < s.length(); i++) { if (s[i] == 'A') { start = i; } else if (start != -1 && s[i] == 'Z') { ans = std::max(ans, i - start + 1); } else { start = -1; } } return 0; }
a.cc: In function 'int main()': a.cc:28:39: error: no matching function for call to 'max(long long int&, long long unsigned int)' 28 | ans = std::max(ans, i - start + 1); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~ 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: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:28:39: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int') 28 | ans = std::max(ans, i - start + 1); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /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:28:39: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 28 | ans = std::max(ans, i - start + 1); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
s380841106
p03814
C++
#include<bits/stdc++.h> using namespace std; int main(){ char ch[200010]; gets(ch); int len=strlen(ch); int ansa=0,ansb; for(int i=0;i<len;i++){ if(ch[i]=='A'){ if(ansa) continue; ansa=i; } if(!ansa) continue; if(ch[i]=='Z'){ ansb=i; } } cout<<ansb-ansa+1<<endl; }
a.cc: In function 'int main()': a.cc:5:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 5 | gets(ch); | ^~~~ | getw
s141085550
p03814
C
#include <stdio.h> #include <stdlib.h> int main(){ char s[200002]; int s; int i,j,k,max=0,count=0; while((c=getchar())!='\n'){ s[i]=c; i++; } for(j=0;j=i;j++){ if(s[i]='A'){ k=i; while(s[k]!='Z'){ count++; k++; } } if(max<count){ max=count; } } printf("%d\n",max); }
main.c: In function 'main': main.c:6:9: error: conflicting types for 's'; have 'int' 6 | int s; | ^ main.c:5:10: note: previous declaration of 's' with type 'char[200002]' 5 | char s[200002]; | ^ main.c:8:12: error: 'c' undeclared (first use in this function) 8 | while((c=getchar())!='\n'){ | ^ main.c:8:12: note: each undeclared identifier is reported only once for each function it appears in
s766939794
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; char AZ[] = { "A", "Z" }; int x, y; cin >> s; for (int i = 0; i < s.size(); i++){ if (s[i] == AZ[0]){ x = i; } } for (int j = 0; j < s.size(); j++){ if (s[j] == AZ[1]){ y = j; } } cout << y - x << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:32: error: too many initializers for 'char []' 6 | char AZ[] = { "A", "Z" }; | ^
s658520045
p03814
Java
import java.io.BufferedReader; import java.io.InputStream; import java.io.IOException; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader( new InputStream(System.in)); String s = br.readLine(); int idxA =0; for(int i=0; i<s.length(); i++){ if(s.charAt(i)=='A'){ idxA = i; break; } } int idxZ = s.length()-1; for(int j = s.length()-1; j>=0; j--){ if(s.charAt(j) =='Z'){ idxZ = j; break; } } System.out.println(idxZ - idxA + 1); } }
Main.java:8: error: InputStream is abstract; cannot be instantiated new InputStream(System.in)); ^ 1 error
s673476364
p03814
Java
import java.util.Scanner; public class B { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); char A[] = new char[200000]; A = sc.next().toCharArray(); int max=1; int count=0; boolean flag=false; for(int i=0;i<A.length;i++){ if(A[i]=='A'){ flag=true; } if(A[i]=='Z' && flag){ count++; if(max<count) max=count; } else if(flag){ count++; } } System.out.println(max); } }
Main.java:4: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s783097418
p03814
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; string a; int A,s,e; int main(void){ A=0; cin>>a; for(int i=0;i<a.size();i++){ if(a[i]=='A'){ s=i; break; } for(int i=0;i<a.size();i++){ if(a[i]=='Z'){ e=i; } } cout<<e-s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:2: error: expected '}' at end of input 26 | } | ^ a.cc:7:15: note: to match this '{' 7 | int main(void){ | ^
s789840704
p03814
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; string a; int A,s,e; int main(void){ A=0; cin>>a; for(int i=0;i<a.size();i++){ if(a[i]=='A'){ s=i; for(i=a.size();i>0();i--){ if(a[i]=='Z'){ e=i; break; } } } } cout<<e-s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:35: error: expression cannot be used as a function 13 | for(i=a.size();i>0();i--){ | ~^~
s546461663
p03814
C++
#include<stdio.h> #include<stdlib.h> #include<iostream> using namespace std; string a; int A,s,e; int main(void){ A=0; cin>>a; for(int i=0;i<a.size();i++){ if(a[i]=='A'){ s=i; for(i=a.size();i>0();i--){ if(a[i]=='Z'){ e=i; break; } } } cout<<e-s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:35: error: expression cannot be used as a function 13 | for(i=a.size();i>0();i--){ | ~^~ a.cc:25:2: error: expected '}' at end of input 25 | } | ^ a.cc:7:15: note: to match this '{' 7 | int main(void){ | ^
s148898406
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; int t,u; cin>>s; for(int i=0;i<s.size();i++){ if(s[i]=="A")i=t; if(s[i]=="Z")i=u; } cout<<u-t; return 0; }
a.cc: In function 'int main()': a.cc:12:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | if(s[i]=="A")i=t; a.cc:14:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(s[i]=="Z")i=u;
s994291985
p03814
C++
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <string> typedef long long ll; using namespace std; const ll INF = 1000000000000000000ll; const ll MOD = 1000000007ll; const double EPS = 1e-8; int main() { char S[2000000]; cin >> S; int a=0,z=0; bool af=0; for(int i=0;i<strlen(S);i++){ if(S[i]=='A'&&af==0){ a=i;af=1;}; if(S[i]=='Z') z=i; } cout << z-a+1<<endl; return 0; }
a.cc: In function 'int main()': a.cc:23:23: error: 'strlen' was not declared in this scope 23 | for(int i=0;i<strlen(S);i++){ | ^~~~~~ a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <vector> +++ |+#include <cstring> 5 | #include <string>
s576862483
p03814
Java
import java.util.Scanner; public class B_53{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String str = sc.next(); int s = -1; for(int i = 0; i < str.length(); i++){ if(str.charAt(i) == 'A'){ s = i; break; } } int t = -1; for(int i = str.length() - 1; i >= 0; i--){ if(str.charAt(i) == 'Z'){ t = i; break; } } System.out.println((t - s) + 1); } }
Main.java:3: error: class B_53 is public, should be declared in a file named B_53.java public class B_53{ ^ 1 error
s272581881
p03814
C++
import java.util.Scanner; public class Main { private static Scanner sc=new Scanner(System.in); private static String line=sc.next(); private static int start,end; public static void main(String[] args){ char[] c=line.toCharArray(); for(int i=0;i<=c.length-1;i++){ if(c[i]=='A') start=i; } for(int i=c.length-1;i>=0;i--){ if(c[i]=='Z') end=i; } int ans=end-start+1; System.out.println(ans); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s767695599
p03814
C++
#include<iostream> #include<algorithm> #include<climits> #include<cmath> #include<cstdio> #include<cstdlib> #include<ctime> #include<string> #include<cstring> #include<vector> #include<stack> #include<queue> #include<set> #include<map> #include<bitset> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> i_i; typedef pair<long long, int> ll_i; #define PI 3.141592653589793238462643383279 #define mod 1000000007LL #define rep(i, n) for(i = 0;i < n;++i) #define rep1(i, n) for(i = 1;i < n;++i) #define per(i, n) for(i = n - 1;i > -1;--i) #define int(x) int x; scanf("%d",&x) #define int2(x, y) int x, y; scanf("%d%d",&x, &y) #define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z) #define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z) #define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z) #define pri(x) cout << (x) << "\n" #define pri2(x, y) cout << (x) << " " << (y) << "\n" #define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n" #define pb push_back #define mp make_pair #define all(a) (a).begin(),(a).end() #define kabe puts("---------------------------") #define kara puts("") #define debug(x) cout << " --- " << (x) << "\n" #define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n" #define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n" #define X first #define Y second #define eps 0.0001 #define prid(x) printf("%.15lf\n", x) signed main(void){ int i, j; for(int testcase = 0;testcase >= 0;testcase++){ string s; cin >> s; rep(i, n)if(s[i] == 'A')break; per(j, n)if(s[j] == 'Z')break; pri(j - i + 1); /*/ //*/ break; } return 0; }
a.cc: In function 'int main()': a.cc:56:12: error: 'n' was not declared in this scope 56 | rep(i, n)if(s[i] == 'A')break; | ^ a.cc:26:33: note: in definition of macro 'rep' 26 | #define rep(i, n) for(i = 0;i < n;++i) | ^ a.cc:57:12: error: 'n' was not declared in this scope 57 | per(j, n)if(s[j] == 'Z')break; | ^ a.cc:28:27: note: in definition of macro 'per' 28 | #define per(i, n) for(i = n - 1;i > -1;--i) | ^
s823822221
p03814
C++
# coding: utf-8 words=input().rstrip() a=words.find("A") z=words.rfind("Z") print(z-a+1)
a.cc:1:3: error: invalid preprocessing directive #coding 1 | # coding: utf-8 | ^~~~~~ a.cc:3:1: error: 'words' does not name a type 3 | words=input().rstrip() | ^~~~~
s401827075
p03814
C
#include <string.h> #include<stdio.h> const int MAX_LEN = 200000; int main() { int x; char s[MAX_LEN]; printf("Input string s: "); fgets(s, MAX_LEN, stdin); int len = strlen(s); int index = 0, indexA; strcpy(s, strupr(s)); while(index < len) { if (s[index] == 'A') break; printf("%c,", s[index]) ; index++; } printf("String input: %s\n",s); indexA = index; index = len - 1; while(index > 0) { if (s[index] == 'Z') break; index--; } if(indexA > index || index == 0) printf("String input is error!: %d, index: %d", indexA, index); else printf("Result: %d", (index - indexA + 1)); return 0; }
main.c: In function 'main': main.c:12:20: error: implicit declaration of function 'strupr'; did you mean 'strstr'? [-Wimplicit-function-declaration] 12 | strcpy(s, strupr(s)); | ^~~~~~ | strstr main.c:12:20: error: passing argument 2 of 'strcpy' makes pointer from integer without a cast [-Wint-conversion] 12 | strcpy(s, strupr(s)); | ^~~~~~~~~ | | | int In file included from main.c:1: /usr/include/string.h:141:70: note: expected 'const char * restrict' but argument is of type 'int' 141 | extern char *strcpy (char *__restrict __dest, const char *__restrict __src) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s930984948
p03814
C++
#include <iostream> #include <string> using namespace std; int main() { string S; cin >> S; int a_index = z_index = -1, S_length = S.size(); for (int i = 0; i < S_length; i++) { if ( S[i] == "A" && a_index != -1) a_index = i; if ( S[S_length - i - 1] == "Z" && z_index != -1 ) z_index = S_length - i - 1; if ( a_index != -1 && z_index != -1) break; } cout << z_index - a_index + 1; return 0; }
a.cc: In function 'int main()': a.cc:9:15: error: 'z_index' was not declared in this scope; did you mean 'a_index'? 9 | int a_index = z_index = -1, S_length = S.size(); | ^~~~~~~ | a_index a.cc:11:21: error: 'S_length' was not declared in this scope 11 | for (int i = 0; i < S_length; i++) { | ^~~~~~~~ a.cc:13:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if ( S[i] == "A" && a_index != -1) a_index = i;
s020863948
p03814
C++
#include <iostream> #include <cstdio> #include <string> using namespace std; int main() { // your code goes here string x; cin >> x; int ans = x.find_last_of("Z") - x.find_first_of("A")+1; cout << ans; return 0;
a.cc: In function 'int main()': a.cc:12:18: error: expected '}' at end of input 12 | return 0; | ^ a.cc:6:12: note: to match this '{' 6 | int main() { | ^
s471165530
p03814
C++
#include<bits/stdc++.h> #define INF 1000010000 #define nl '\n' #define pb push_back #define ppb pop_back #define mp make_pair #define fi first #define se second #define pii pair<int,int> #define pdd pair<double,double> #define all(c) (c).begin(), (c).end() #define SORT(c) sort(all(c)) #define sz(c) (c).size() #define rep(i,n) for( int i = 0; i < n; ++i ) #define repi(i,n) for( int i = 1 ; i <= n; ++i ) #define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i ) #define repf(j,i,n) for( int j = i ; j < n ; ++j ) #define die(s) {std::cout << s << nl;} #define dier(s) {std::cout << s; return 0;} #define vi vector<int> typedef long long ll; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.precision(0); string s; cin >> s; int a = 0 , int z = sz(s) - 1; while(s[a] != 'A')++a; while(s[z] != 'Z')--z; die(z - a + 1); return 0; }
a.cc: In function 'int main()': a.cc:33:21: error: expected unqualified-id before 'int' 33 | int a = 0 , int z = sz(s) - 1; | ^~~ a.cc:35:17: error: 'z' was not declared in this scope 35 | while(s[z] != 'Z')--z; | ^ a.cc:36:13: error: 'z' was not declared in this scope 36 | die(z - a + 1); | ^ a.cc:19:30: note: in definition of macro 'die' 19 | #define die(s) {std::cout << s << nl;} | ^
s500965888
p03814
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int a = 0; int b = 0; for(int i = 0; i < s.length(); i++) { if(s.charAt(i) == 'A') { a = i; break; } } for(int i = s.length() - 1; i >= 0; i--) { if(s.charAt(i) == 'Z') { b = i; break; } } return b - a + 1; } }
Main.java:21: error: incompatible types: unexpected return value return b - a + 1; ^ 1 error
s028409052
p03814
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <cmath> #include <map> #include <fstream> #define rep(i,a,n) for(int i=a;i<n;i++) using namespace std; typedef long long ll; typedef pair<int, int> P; template <typename T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){ if(!v.empty()) { out << '['; std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", ")); out << "\b\b]"; } return out; } template <typename T1, typename T2> std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) { out << "[" << p.first << ", " << p.second << "]"; return out; } //--------- int main(){ cin.tie(0); ios::sync_with_stdio(false); //CLion Standard Input //-------------------------------------------------------------------------- // ifstream in("/Users/ryo/Dropbox/competition/CompetitiveProgramming/in.txt"); // cin.rdbuf(in.rdbuf()); //-------------------------------------------------------------------------- string s; cin >> s; int left = 0; while(s[left] != 'A'){ left++; } int right = s.size(); while(s[right] != 'Z'){ right--; } cout << right - left + 1 << endl; }
a.cc: In function 'std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)': a.cc:26:44: error: 'ostream_iterator' is not a member of 'std' 26 | std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", ")); | ^~~~~~~~~~~~~~~~ a.cc:14:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>' 13 | #include <fstream> +++ |+#include <iterator> 14 | a.cc:26:62: error: expected primary-expression before '>' token 26 | std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", ")); | ^
s956341671
p03814
Java
package AtCoder; import java.io.*; public class Main { public static void main(String[]args){ BufferedReader reader = new BufferedReader (new InputStreamReader (System.in)); String line; String [] array; array = line.split(""); int startNumber=0; int endNumber=0; int i; for (i=0; i<array.length; i++){ if (array[i].equals("A")){ startNumber = i; break; } } for (int j=i; j<array.length; j++){ if (array[j].equals("Z")){ endNumber = j; } } System.out.println(endNumber - startNumber + 1); } }
Main.java:11: error: variable line might not have been initialized array = line.split(""); ^ 1 error
s783561125
p03814
C
#include <stdio.h> int main(void) { char s[200000]; long a,i = 0; scanf("%s",s); while(1){ if(text[i] == "A"){ a = i; i = 200000; break; } else{i++;} } while(1){ if(text[i] == "Z"){ a = i - a + 1; break; } else{i--;}+ } printf("%d",a) return 0; }
main.c: In function 'main': main.c:9:20: error: 'text' undeclared (first use in this function) 9 | if(text[i] == "A"){ | ^~~~ main.c:9:20: note: each undeclared identifier is reported only once for each function it appears in main.c:22:9: error: expected expression before '}' token 22 | } | ^ main.c:23:23: error: expected ';' before 'return' 23 | printf("%d",a) | ^ | ; 24 | return 0; | ~~~~~~
s892834658
p03814
C++
#include<iostream> using namespace std; int main() { string str; int max; int s = -1; cin >> str; for(int i = str.size(); i != 0; --i){ char c = str[i]; if(c == 'a' && s == -1){ s = i; } if(c == 'z'){ max = i - s; } } cout >> max >> endl; }
a.cc: In function 'int main()': a.cc:18:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 18 | cout >> max >> endl; | ~~~~ ^~ ~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:18:10: note: candidate: 'operator>>(int, int)' (built-in) 18 | cout >> max >> endl; | ~~~~~^~~~~~ a.cc:18:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, 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/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 18 | cout >> max >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:18:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 18 | cout >> max >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:18:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:18:13: required from here 18 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s667701193
p03814
C++
#include<iostream> using namespace std; int main() { int max; int s = -1; cin >> str; for(int i = str.size(); i != 0; --i){ char c = str[i]; if(c == 'a' && s == -1){ s = i; } if(c == 'z'){ max = i - s; } } cout >> max >> endl; }
a.cc: In function 'int main()': a.cc:7:12: error: 'str' was not declared in this scope; did you mean 'std'? 7 | cin >> str; | ^~~ | std a.cc:17:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 17 | cout >> max >> endl; | ~~~~ ^~ ~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:17:10: note: candidate: 'operator>>(int, int)' (built-in) 17 | cout >> max >> endl; | ~~~~~^~~~~~ a.cc:17:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, 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/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> max >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:17:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 17 | cout >> max >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:17:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:17:13: required from here 17 | cout >> max >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s381134358
p03814
C
#include <stdio.h> int main(void){ char s[200000]; scanf("%s",s); int i,j,k,l; for(i=0;i<200000;i++){ if(s[i]=='A'){ j=i; break; } } for(k=j;k<2000000;k++){ if(s[k]=='Z'){ l=k; }else if(s[k]=='\n'){ break; } int length; length=l-j+1; printf("%d",length); return 0; }
main.c: In function 'main': main.c:22:1: error: expected declaration or statement at end of input 22 | } | ^
s910150872
p03814
C
#include <stdio.h> int main(void){ char s[200000]; scanf("%199999s",s); int i,j,k,l; for(i=0;i<200000;i++){ if(s[i]=='A'){ j=i; break; } } for(k=j;k<2000000;k++){ if(s[k]=='Z'){ l=k; } } int length; length=l-j+1; prinf(%d,length); return 0; }
main.c: In function 'main': main.c:19:5: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration] 19 | prinf(%d,length); | ^~~~~ | printf main.c:19:11: error: expected expression before '%' token 19 | prinf(%d,length); | ^
s162594423
p03814
C
#include <stdio.h> int main(void){ char s[200000]; scanf("%199999s",s); int i,j,k,l; for(i=0;i<200000;i++){ if(s[i]=="A"){ j=i; break; } } for(k=j;k<2000000;k++){ if(s[k]=="Z"){ l=k; } } int length; length=l-j+1; prinf(%d,length); return 0; }
main.c: In function 'main': main.c:7:16: warning: comparison between pointer and integer 7 | if(s[i]=="A"){ | ^~ main.c:13:16: warning: comparison between pointer and integer 13 | if(s[k]=="Z"){ | ^~ main.c:19:5: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration] 19 | prinf(%d,length); | ^~~~~ | printf main.c:19:11: error: expected expression before '%' token 19 | prinf(%d,length); | ^
s957529087
p03814
C
#include <stdio.h> int main(void){ char s[200000]; scanf("%199999s",s); int i,j,k,l; for(i=0;i<200000;i++){ if(s[i]==A){ j=i; break; } } for(k=j;k<2000000;k++){ if(s[k]==Z){ l=k; } } int length; length=l-j+1; prinf(%d,length); return 0; }
main.c: In function 'main': main.c:7:18: error: 'A' undeclared (first use in this function) 7 | if(s[i]==A){ | ^ main.c:7:18: note: each undeclared identifier is reported only once for each function it appears in main.c:13:18: error: 'Z' undeclared (first use in this function) 13 | if(s[k]==Z){ | ^ main.c:19:5: error: implicit declaration of function 'prinf'; did you mean 'printf'? [-Wimplicit-function-declaration] 19 | prinf(%d,length); | ^~~~~ | printf main.c:19:11: error: expected expression before '%' token 19 | prinf(%d,length); | ^
s541763983
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ int s; cin >> s; int a = s.find("a"); int z = s.rfind("z"); cout << z - a + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:19: error: request for member 'find' in 's', which is of non-class type 'int' 9 | int a = s.find("a"); | ^~~~ a.cc:10:19: error: request for member 'rfind' in 's', which is of non-class type 'int' 10 | int z = s.rfind("z"); | ^~~~~
s995691648
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ int s; cin >> s; int a = s.find(); int z = s.rfind(); cout << z - a + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:19: error: request for member 'find' in 's', which is of non-class type 'int' 9 | int a = s.find(); | ^~~~ a.cc:10:19: error: request for member 'rfind' in 's', which is of non-class type 'int' 10 | int z = s.rfind(); | ^~~~~
s304438364
p03814
C++
#include <iostream> #include <string> using namespace std; int main(){ int s; cin >> s; int a = str.find(); int z = str.rfind(); cout << z - a + 1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:17: error: 'str' was not declared in this scope; did you mean 'std'? 9 | int a = str.find(); | ^~~ | std
s258598119
p03814
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int a = -1, z; for (int i = 0; i < s.size(); i++) { if (a == -1 && s[i] == "A") { a = i; } if (s[i] == "Z") { z = i; } } cout << (z - a + 1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if (a == -1 && s[i] == "A") { a.cc:13:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (s[i] == "Z") {
s572628133
p03814
C
#include <stdio.h> #include <string.h> int main(void){ char s[200100]={"\0"}; scanf("%s",s); int loop1; int st=-1; int go=-1; for(loop1=0;loop1<200001;loop1++){ if(st==-1){ if(s[loop1]=="A"){ st=loop1; } } if(st!=-1){ if(s[loop1]=="Z"){ go==loop1; } } } int ans=go-st; print("%d\n",ans+1); return 0; }
main.c: In function 'main': main.c:11:36: warning: comparison between pointer and integer 11 | if(s[loop1]=="A"){ | ^~ main.c:16:36: warning: comparison between pointer and integer 16 | if(s[loop1]=="Z"){ | ^~ main.c:22:17: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration] 22 | print("%d\n",ans+1); | ^~~~~ | printf
s576099139
p03814
C++
# -*- coding: utf-8 -*- s = input() l = 1000000 r = 0 for i, c in enumerate(s): if c == "A": l = min(l, i) if c == "Z": r = i print(r - l + 1)
a.cc:1:3: error: invalid preprocessing directive #- 1 | # -*- coding: utf-8 -*- | ^ a.cc:2:1: error: 's' does not name a type 2 | s = input() | ^
s472725391
p03814
C++
# -*- coding: utf-8 -*- s = input() l = 1000000 r = 0 for i, c in enumerate(s): if c == "A": l = min(l, i) if c == "Z": r = i print(r - l + 1)
a.cc:1:3: error: invalid preprocessing directive #- 1 | # -*- coding: utf-8 -*- | ^ a.cc:2:1: error: 's' does not name a type 2 | s = input() | ^
s950726509
p03814
C++
s = input() l = 1000000 r = 0 for i, c in enumerate(s): if c == "A": l = min(l, i) if c == "Z": r = i print(r - l + 1)
a.cc:1:1: error: 's' does not name a type 1 | s = input() | ^
s964380668
p03814
C++
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> using namespace std; #define REP(i,n) for(int i=0; i<n; ++i) #define FOR(i,a,b) for(int i=a; i<=b; ++i) #define FORR(i,a,b) for (int i=a; i>=b; --i) #define ALL(c) (c).begin(), (c).end() typedef long long ll; typedef vector<int> VI; typedef vector<ll> VL; typedef vector<VI> VVI; typedef pair<int,int> P; typedef pair<ll,ll> PL; int main() { string s; cin >> s; int l, r; REP(i,s.length()) if (s[i] == 'A') l = i, break; REP(i,s.length()) if (s[i] == 'Z') r = i; cout << r-l+1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:47: error: expected primary-expression before 'break' 31 | REP(i,s.length()) if (s[i] == 'A') l = i, break; | ^~~~~
s000286035
p03814
C
#include <stdio.h> #include <string.h> int main(){ char str[200010]; int len,i,ans=0,flag=0; scanf("%s",str); len=strlen(str); for(i=0;i<len;i++){ if(str[i]=='A' && flag==0){ flag=1; } if(flag==1){ count++; if(str[i]=='Z'){ ans=count; } } } printf("%d\n",ans); return 0; }
main.c: In function 'main': main.c:18:7: error: 'count' undeclared (first use in this function) 18 | count++; | ^~~~~ main.c:18:7: note: each undeclared identifier is reported only once for each function it appears in
s809945518
p03814
C++
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- int mia=292020,miz=0; string S; void solve() { int i,j,k,l,r,x,y; string s; cin>>S; FOR(i,S.size()) { if(S[i]=='A') mia=min(mia); if(S[i]=='Z') miz=max(miz); } cout<<miz-mia+1<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:23:38: error: no matching function for call to 'min(int&)' 23 | if(S[i]=='A') mia=min(mia); | ~~~^~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /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, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:23:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 23 | if(S[i]=='A') mia=min(mia); | ~~~^~~~~ /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: candidate expects 2 arguments, 1 provided a.cc:24:38: error: no matching function for call to 'max(int&)' 24 | if(S[i]=='Z') miz=max(miz); | ~~~^~~~~ /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: candidate expects 2 arguments, 1 provided /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, 1 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: template argument deduction/substitution failed: a.cc:24:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 24 | if(S[i]=='Z') miz=max(miz); | ~~~^~~~~ /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: candidate expects 2 arguments, 1 provided
s818977185
p03814
C++
#include <stdio.h> int main(void) { int a,b=0,c=0,ans; char s[200000]; scanf("%s",&s); for(a=0;a<strlen(s);a++){ if(s[a]=='A'&&c==0){ c=1; } if(c==1){ b++; if(s[a]=='Z'){ ans=b; } } } printf("%d",ans); return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'strlen' was not declared in this scope 8 | for(a=0;a<strlen(s);a++){ | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <stdio.h> +++ |+#include <cstring> 2 |
s499223966
p03814
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { long memo1 = 114514810; int memo2 = 0; int ans = 0; string s; cin >> s; for (int i = 0; i < s.length(); i++) { if (s[i] == 'A') memo1 = min(memo1, i); } for (int j = 0; j < s.length(); j++) { if (s[j] == 'Z') memo2 = max(memo2, j); } ans = memo2 - memo1 + 1; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:45: error: no matching function for call to 'min(long int&, int&)' 13 | if (s[i] == 'A') memo1 = min(memo1, i); | ~~~^~~~~~~~~~ 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:13:45: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') 13 | if (s[i] == 'A') memo1 = min(memo1, i); | ~~~^~~~~~~~~~ /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:3: /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:13:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long int' 13 | if (s[i] == 'A') memo1 = min(memo1, i); | ~~~^~~~~~~~~~
s591019769
p03814
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int memo1 = 0; int memo2 = 0; int ans = 0; string s; cin >> s; for (int i = 0; i < s.length; i++) { if (s[i] == 'A') memo1 = max(memo1, i); } for (int j = 0; j < s.length; j++) { if (s[j] == 'Z') memo2 = max(memo2, j); } ans = memo2 - memo1 + 1; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 12 | for (int i = 0; i < s.length; i++) { | ~~^~~~~~ | () a.cc:15:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 15 | for (int j = 0; j < s.length; j++) { | ~~^~~~~~ | ()
s668774815
p03814
C++
int main() { string A; cin >> A; int a,z; for (int i = 0; i <= A.size(); i++) { if (A[i] == 'A') { a = i; } if (A[i] == 'Z') { z = i; } } cout << z - a+1 << endl; return 0; }
a.cc: In function 'int main()': a.cc:4:9: error: 'string' was not declared in this scope 4 | string A; | ^~~~~~ a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin >> A; | ^~~ a.cc:6:16: error: 'A' was not declared in this scope 6 | cin >> A; | ^ a.cc:19:9: error: 'cout' was not declared in this scope 19 | cout << z - a+1 << endl; | ^~~~ a.cc:19:28: error: 'endl' was not declared in this scope 19 | cout << z - a+1 << endl; | ^~~~
s811118892
p03814
C++
#include<stdio.h> #include<string.h> int main() { char s[200000]; scanf("%s",s); int i; while(s[i]!=A) { i++; if(i==strlen(s)) {printf("0"): return 0;} } int t=i; while(s[t]!=Z) { t++; if(t==strlen(s)&&s[t]!=Z) {printf("0"); return 0;} } printf("%d",t-i+1); return 0; }
a.cc: In function 'int main()': a.cc:8:15: error: 'A' was not declared in this scope 8 | while(s[i]!=A) | ^ a.cc:12:17: error: expected ';' before ':' token 12 | {printf("0"): | ^ | ; a.cc:16:15: error: 'Z' was not declared in this scope 16 | while(s[t]!=Z) | ^
s498107139
p03814
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); String s=sc.next(); String rev=new StringBuffer(s).reverse().toString(); int l=s.length(); int ctr=0; int fA=0; int fZ=0; while(fA==0){ if(s.charAt(ctr)=='A'){fA=ctr;ctr=0;break;} ctr++; } while(fZ==0){ if(rev==0){fZ=ctr;break;} ctr++; } System.out.println(l-fZ-fA); } }
Main.java:16: error: bad operand types for binary operator '==' if(rev==0){fZ=ctr;break;} ^ first type: String second type: int 1 error
s142138166
p03814
C++
#include<stdio.h> #include<string.h> int main(){ char ch[200000]; gets(ch); unsigned a, b; for(a = 0; ch[a] != 'A'; a++); for(b = strlen(ch); ch[b] != 'Z'; b--); printf("%d\n", b - a + 1); }
a.cc: In function 'int main()': a.cc:6:2: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | gets(ch); | ^~~~ | getw
s906789690
p03814
C++
#include<iostream> #include<string> using namespace std; int main() { int loop = 0; char s[200001]; int len; int front, back; front = back = 0; cin >> s; len = strlen(s); while (s[loop++] != 'A')front++; loop = len + 1; while (s[loop--] != 'Z')back++; cout << len - front - back + 2 << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:13:15: error: 'strlen' was not declared in this scope 13 | 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>
s361200704
p03814
C++
#include <iostream> #include <cstring> #include <cmath> #include <algorithm> #include <cstdio> #include <fstream> #include <map> #include <vector> #include <unordered_map> #include <unordered_set> #include <stack> #include <set> #include <queue> #include <list> using namespace std; char s[200010]; int main() { int n; gets(s); int len=strlen(s); int a=0,b=len-1; for(int i=0;i<len;++i) { if(s[i]=='A') { a=i; break; } } for(int i=len-1;i>=0;--i) { if(s[i]=='Z') { b=i; break; } } printf("%d",b-a+1); return 0; }
a.cc: In function 'int main()': a.cc:21:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 21 | gets(s); | ^~~~ | getw
s192443316
p03814
C++
#include<bits/stdc++.h> #define F first #define S second #define INF (1<<30) #define LINF (1LL<<60) using namespace std; typedef pair<long long,long long> P; long long a,b,c,d; string s,s2,s3; long long sum=0,ans=0,pos=0; long long n,m,h,w; main(){ cin>>s; n=s.size(); a=0; b=0; for(int i=0;i<n;i++){ if(s[i]=='A'){ a=i; break; } }
a.cc:12:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 12 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:22:4: error: expected '}' at end of input 22 | } | ^ a.cc:12:7: note: to match this '{' 12 | main(){ | ^
s730806762
p03815
C++
#include<bits/stdc++.h> using namespace std; int main(void) { long long x; cin >> x; cout << (2*x + 10)/11; << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:28: error: expected primary-expression before '<<' token 8 | cout << (2*x + 10)/11; << endl; | ^~
s825669453
p03815
C++
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> pi; typedef vector<int> vi; typedef vector<string> vs; typedef vector<pi> vpi; typedef vector<vi> vii; typedef map<int, int> mp; typedef multiset<int> mset; typedef long int int32; typedef unsigned long int uint32; typedef long long int int64; typedef unsigned long long int uint64; typedef vector<int64> vi64; #define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL) #define form(i,j,k,l) for(int i=j;i<int(k);i+=l) #define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l) #define rep(i, j) for(int i=0;i<int(j);i++) #define rrep(i, j) for(int i=int(j);i>=0;i--) #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define forc(it, l) for (auto it = l.begin(); it != l.end(); it++) #define IN(A, B, C) assert( B <= A && A <= C) #define mp(x,y) make_pair(x,y) #define pb(x) push_back(x) #define INF (int)1e9 #define INF64 (int64)1e18 #define EPS 1e-9 #define PI 3.1415926535897932384626433832795 #define MOD 1000000007 #define read(type) readInt<type>() #define F first #define S second const double pie = acos(-1.0); template <typename T> T Max(T x, T y) { return (x > y) ? x : y; } template <typename T> T Min(T x, T y) { return (x > y) ? y : x; } int gcd(int n1, int n2) { if (n2 != 0) return gcd(n2, n1 % n2); else return n1; } #define TRACE #ifdef TRACE #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__) template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...); } #else #define trace(...) #endif clock_t time_p = clock(); void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";} int main() { fast; long long int x; cin >> x; long long int r = 11; long long int ans = (long long int)2 * (x / r); long long int res = x % r; if(res==0) { cout<<ans; endl; } if (res <= 6) ans++; else ans = ans + 2; cout << ans; }
a.cc: In function 'int main()': a.cc:76:10: error: statement cannot resolve address of overloaded function 76 | endl; | ^
s144145358
p03815
C++
#include<bits/stdc++.h> using namespace std; #define debug(n) cerr << #n << ':' << n << endl; #define dline cerr << __LINE__ << endl; using ll = long long; using ull = unsigned long long; template<class T, class U> using P = pair<T,U>; template<class T> using Heap = priority_queue<T>; template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>; template<class T,class U> using umap = unordered_map<T,U>; template<class T> using uset = unordered_set<T>; template<class T> bool ChangeMax(T&a,const T&b){ if(a >= b) return false; a = b; return true; } template<class T> bool ChangeMin(T&a,const T&b){ if(a <= b) return false; a = b; return true; } template<class T, size_t N, class U> void Fill(T (&a)[N], const U&v){ fill((U*)a,(U*)(a+N),v); } template<class T> istream& operator >> (istream&is, vector<T>&v){ for(auto&e:v)is >> e; return is; } template<long long mod> class modint{ private: long long num; long long extgcd(long long a, long long b, long long&x, long long&y)const { long long d = a; if(b != 0){d = extgcd(b, a%b, y, x); y -= (a/b) * x;} else{x = 1; y = 0;} return d; } long long modinverse()const{ long long x, y; extgcd(num, mod, x, y); return (mod + x%mod)%mod; } public: modint():num(0){} modint(const long long x):num((x < 0?(x+mod):x)%mod ){} friend modint operator+(const modint&a, const modint&b) { return modint(a.num + b.num); } friend modint operator-(const modint&a, const modint&b) { return modint(a.num - b.num); } friend modint operator*(const modint&a, const modint&b) { return modint(a.num * b.num); } friend modint operator/(const modint&a, const modint&b) { return modint(a*b.modinverse()); } modint& operator+=(const modint&b) { return (*this) = (*this) + b; } modint& operator-=(const modint&b) { return (*this) = (*this) - b; } modint& operator*=(const modint&b) { return (*this) = (*this) * b; } modint& operator/=(const modint&b) { return (*this) = (*this) / b; } modint& operator++() { (*this)+=1; return (*this); } modint& operator--() { (*this)-=1; return (*this); } modint operator++(int){ modint tmp(*this); ++(*this); return tmp; } modint operator--(int){ modint tmp(*this); --(*this); return tmp; } modint pow(unsigned long long i){ if(i == 0) return 1; if(i & 1){ return (*this) * (this->pow(i-1)); } modint<mod>hpow = (this->pow(i>>1)); return hpow * hpow; } friend ostream& operator<<(ostream&os, const modint&a){ os << a.num; return os; } friend istream& operator>>(istream&is, modint&a){ long long x; is >> x; a = x; return is; } }; using mint = modint<1000000007>; int main(){ ll x; cin >> x; ans = 1; x -= 1; ans += (x / 11)*2; x %= 11; if(x > 0){ ans++; x -= 5; } if(x > 0){ ans++;; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:111:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 111 | ans = 1; | ^~~ | abs
s656505804
p03815
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0; i<(n); i++) using namespace std; using ll = long long; int main() { int x; cin >> x; ll ans; if(x<=6) ans = 1; else if(x<=11) ans = 2; else{ ans = (x/11)*2; x%11 <= 6 ? ans++ : ans+=2; if(x%11 == 0) ans--; } cout << ans << endl return 0; }
a.cc: In function 'int main()': a.cc:17:24: error: expected ';' before 'return' 17 | cout << ans << endl | ^ | ; 18 | return 0; | ~~~~~~
s208680454
p03815
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0; i<(n); i++) using namespace std; using ll = long long; int main() { int x; cin >> x; ll ans; if(x<=6) ans = 1; else if(x<=11) ans = 2; else{ ans = (x/11)*2; x%11 <= 6 ? ans++ : ans+=2; if(n%11 == 0) ans--; } cout << ans << endl return 0; }
a.cc: In function 'int main()': a.cc:15:12: error: 'n' was not declared in this scope 15 | if(n%11 == 0) ans--; | ^ a.cc:17:24: error: expected ';' before 'return' 17 | cout << ans << endl | ^ | ; 18 | return 0; | ~~~~~~
s828868197
p03815
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll x; cin >> x; ll ans = (x/11) * 2; if (x % 11 == 0) { continue; } else if (x % 11 <= 5) { ans += 1; } else { ans += 2; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: continue statement not within a loop 12 | continue; | ^~~~~~~~
s806092164
p03815
C++
#include <bits/stdc++.h> #include <math.h> #define ALL(a) a.begin(), a.end() #define rep(i, K, N) for(int i = K; i < N; i++) #define ll long long int using namespace std; int main() { ll K;cin >> x; if(x%11 <= 6)cout << (x/11)*2 + 1; else cout << (x/11)*2 + 2; }
a.cc: In function 'int main()': a.cc:8:13: error: 'x' was not declared in this scope 8 | ll K;cin >> x; | ^
s085269310
p03815
C
#include <stdio.h> int main(){ long x, z, y=0; scanf("%ld",&x); z=x; result+=(z/11)*2; z=z%11; if(7<=z){ result+=2; } else if(1<=z && z<7) { result+=1; } printf("%ld",y); }
main.c: In function 'main': main.c:8:3: error: 'result' undeclared (first use in this function) 8 | result+=(z/11)*2; | ^~~~~~ main.c:8:3: note: each undeclared identifier is reported only once for each function it appears in
s434328090
p03815
C
#include <stdio.h> int main(){ long x, z, y=0; scanf("%ld",&x); tmp=x; result+=(z/11)*2; z=z%11; if(7<=z){ result+=2; } else if(1<=z && z<7) { result+=1; } printf("%ld",y); }
main.c: In function 'main': main.c:6:3: error: 'tmp' undeclared (first use in this function) 6 | tmp=x; | ^~~ main.c:6:3: note: each undeclared identifier is reported only once for each function it appears in main.c:8:3: error: 'result' undeclared (first use in this function) 8 | result+=(z/11)*2; | ^~~~~~
s290957257
p03815
C++
#include<bits/stdc++.h> using namespace std; int main(){ int x; cin>>x; int ans=0;sum=0; while(true){ sum+=6; ans++; if(sum>=x){ break; } sum+=5; ans++; if(sum>=x){ break; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:6:13: error: 'sum' was not declared in this scope 6 | int ans=0;sum=0; | ^~~
s498065261
p03815
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); long x = Long.parseLong(sc.next()); long ans = (x / 11) * 2; if(x % 11 == 0) else if(x % 11 <= 6) ans++; else ans += 2; System.out.println(ans); } }
Main.java:9: error: 'else' without 'if' else if(x % 11 <= 6) ans++; ^ 1 error
s629830288
p03815
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i=0;i < n; ++i) using namespace std; const int INF = 2147483647; using ll = long long; int main() { ll x; cin >> x; ll a=0; ll ans; long double b =11; if(x %b>0 && x%b<=6) a=1; if(x % b == 0) ans = (x/b)*2-a; else ans = (x/b)*2+2-a; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:10: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 13 | if(x %b>0 && x%b<=6) a=1; | ~ ^~ | | | | | long double | ll {aka long long int} a.cc:13:19: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 13 | if(x %b>0 && x%b<=6) a=1; | ~^~ | | | | | long double | ll {aka long long int} a.cc:14:10: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 14 | if(x % b == 0) | ~ ^ ~ | | | | | long double | ll {aka long long int}
s132556485
p03815
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i=0;i < n; ++i) using namespace std; const int INF = 2147483647; using ll = long long; int main() { ll x; cin >> x; ll a=0; ll ans; long double b =11; if(x %b>0 && x%b<6) a=1; if(x % b == 0) ans = (x/b)*2-a; else ans = (x/b+1)*2-a; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:10: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 13 | if(x %b>0 && x%b<6) a=1; | ~ ^~ | | | | | long double | ll {aka long long int} a.cc:13:19: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 13 | if(x %b>0 && x%b<6) a=1; | ~^~ | | | | | long double | ll {aka long long int} a.cc:14:10: error: invalid operands of types 'll' {aka 'long long int'} and 'long double' to binary 'operator%' 14 | if(x % b == 0) | ~ ^ ~ | | | | | long double | ll {aka long long int}
s638016988
p03815
C++
#include<bits/stdc++.h> long long n,ans=0,x; int main(){ return std::cin>>x,n=std::ceil(n/11.0),ans=std::ceil(n/11.0)*2,std::cout<<ans-*(bool)(x*11-n>=5)<<std::endl,0; }
a.cc: In function 'int main()': a.cc:4:81: error: invalid type argument of unary '*' (have 'bool') 4 | return std::cin>>x,n=std::ceil(n/11.0),ans=std::ceil(n/11.0)*2,std::cout<<ans-*(bool)(x*11-n>=5)<<std::endl,0; | ^~~~~~~~~~~~~~~~~~
s671021081
p03815
C++
#include<bits/stdc++.h> int main(int n,int ans=0,int x){ return std::cin>>x,n=std::ceil(n/11.0),ans=std::ceil(n/11.0)*2,std::cout<<ans-(x*11-n>=5)<<std::endl,0; }
a.cc:2:5: warning: second argument of 'int main(int, int, int)' should be 'char **' [-Wmain] 2 | int main(int n,int ans=0,int x){ | ^~~~ a.cc:2:5: warning: third argument of 'int main(int, int, int)' should probably be 'char **' [-Wmain] a.cc:2:30: error: default argument missing for parameter 3 of 'int main(int, int, int)' 2 | int main(int n,int ans=0,int x){ | ~~~~^ a.cc:2:20: note: ...following parameter 2 which has a default argument 2 | int main(int n,int ans=0,int x){ | ~~~~^~~~~
s564227903
p03815
C++
#include<bits/stdc++.h> int main(long long n,long long ans=0,long long x){ return std::cin>>x,n=std::ceil(n/11.0),ans=std::ceil(n/11.0)*2,std::cout<<ans-(x*11-n>=5)<<std::endl,0; }
a.cc:2:5: warning: first argument of 'int main(long long int, long long int, long long int)' should be 'int' [-Wmain] 2 | int main(long long n,long long ans=0,long long x){ | ^~~~ a.cc:2:5: warning: second argument of 'int main(long long int, long long int, long long int)' should be 'char **' [-Wmain] a.cc:2:5: warning: third argument of 'int main(long long int, long long int, long long int)' should probably be 'char **' [-Wmain] a.cc:2:48: error: default argument missing for parameter 3 of 'int main(long long int, long long int, long long int)' 2 | int main(long long n,long long ans=0,long long x){ | ~~~~~~~~~~^ a.cc:2:32: note: ...following parameter 2 which has a default argument 2 | int main(long long n,long long ans=0,long long x){ | ~~~~~~~~~~^~~~~
s816813762
p03815
C++
#include<bit/stdc++.h> using namespace std; int main() { long long a; while(cin>>a) { long long mod=11,s=a/11*2; a%=1; if(a>=1&&a<=6)s++; if(a>=7&&a<=10)s+=2; cout<<s<<endl; } }
a.cc:1:9: fatal error: bit/stdc++.h: No such file or directory 1 | #include<bit/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s332638865
p03815
C++
#include<bit/stdc++.h> using namespace std; int main() { long long a; while(cin>>a) { long long mod=11,s=a/11*2; a%=1; if(a>=1&&a<=6)s++; if(a>=7&&a<=10)s+=2; cout<<s<<endl; } }
a.cc:1:9: fatal error: bit/stdc++.h: No such file or directory 1 | #include<bit/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s168083358
p03815
C++
#include<bit/stdc++.h> using namespace std; int main() { long long a; while(cin>>a) { long long mod=11,s=a/11*2; a%=1; if(a>=1&&a<=6)s++; if(a>=7&&a<=10)s+=2; cout<<s; } }
a.cc:1:9: fatal error: bit/stdc++.h: No such file or directory 1 | #include<bit/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s417677184
p03815
C++
#include <bits/stdc++.h> #define PI 3.141592653 #define rep(i,a,n) for(int i=a;i<(int)n;++i) #define SZ(x) ((int)(x).size()) //size() unsigned -> int #define descSort(a) sort(a.begin(),a.end(),std::greater<int>()) using namespace std; typedef long long ll; const ll INF = 1e9 + 7; ll gcd(ll x,ll y){ if(x%y==0)return y; return gcd(y,x%y); } int main(void){ ll n; cin>>n; ll ans=0,tmp=0; bool can=false; ll num=n/11; ans=2*num+2; ll tmp=11*(ans-1); if(tmp - 6 >= n || tmp - 5 >= n)cout<<ans-1<<endl; else cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:8: error: redeclaration of 'll tmp' 20 | ll tmp=11*(ans-1); | ^~~ a.cc:16:14: note: 'll tmp' previously declared here 16 | ll ans=0,tmp=0; | ^~~
s654990152
p03815
C++
#include <iostream> #include <string> #include <algorithm> #include <cmath> #include <vector> #include <numeric> #include <set> #include <cstdlib> #include <queue> #include <map> using namespace std; typedef long long llint; typedef long double ld; #define inf 1e18 #define mod 1000000007 priority_queue<llint,vector<llint>,greater<llint>> que; //priority_queue<llint> q; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } llint x; void solve(){ cin >> x; llint ans=x/11*2; if(x%11==0)ans+=0 else if(x%11>6)ans+=2; else ans++; cout << ans << endl; } int main(int argc, char *argv[]) { solve(); return 0; }
a.cc: In function 'void solve()': a.cc:28:20: error: expected ';' before 'else' 28 | if(x%11==0)ans+=0 | ^ | ; 29 | else if(x%11>6)ans+=2; | ~~~~
s539496395
p03815
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<char> vc; typedef vector<vector<int>> vvi; typedef vector<vector<string>> vvs; typedef vector<vector<char>> vvc; typedef vector<vector<bool>> vvb; typedef pair<int,int> P; #define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する #define rep(i, l, n) for (int i = l; i < (int)(n); i++) #define repn(i, l, n) for (int i = l; i <= (int)(n); i++) const int mod = 1000000007; int main(){ ll x; cin >> x; ll a = x / 11; ll b = x % 11; if(b <= 6){b = 1;}else{b = 2}; cout << a*2+b; }
a.cc: In function 'int main()': a.cc:24:33: error: expected ';' before '}' token 24 | if(b <= 6){b = 1;}else{b = 2}; | ^ | ;
s597008680
p03815
C++
// #include <bits/stdc++.h> using namespace std; int main(void) { long long x; cin>>x; long long ans = x /11; if(ans*11 == x){a cout<<ans*2<<endl; } else if(x-ans*11 > 6){ ans++; cout<<ans*2<<endl; } else{ ans = ans*2; ans++; cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:11:25: error: 'a' was not declared in this scope 11 | if(ans*11 == x){a | ^
s261257950
p03815
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ ll n;cin>>n;cout<<(ll)2*(n/11)+1+(n%11)/6; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 | ll n;cin>>n;cout<<(ll)2*(n/11)+1+(n%11)/6; | ^ a.cc: In function 'int main()': a.cc:5:1: error: 'll\U00003000n' was not declared in this scope 5 | ll n;cin>>n;cout<<(ll)2*(n/11)+1+(n%11)/6; | ^~~~~ a.cc:5:12: error: 'n' was not declared in this scope; did you mean 'yn'? 5 | ll n;cin>>n;cout<<(ll)2*(n/11)+1+(n%11)/6; | ^ | yn
s079788185
p03815
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <cstdio> #include <cmath> #include <tuple> #include <iomanip> #include <numeric> #include <unordered_map> #include <sstream> #include<limits.h> #include<list> #include <array> #include <complex> using namespace std; #define i64 long long #define int long long #define I32_MAX 2147483647 #define I64_MAX 9223372036854775807 #define INF I64_MAX/2 #define MOD 1000000007 #define MEM_SIZE 10000 // int DP[MEM_SIZE][MEM_SIZE] = {0}; // int GMEM[MEM_SIZE][MEM_SIZE] = {0}; template<typename T> void DEBUG(T e){std::cout << e << std::endl;} template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;} template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;} template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } } template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}} template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } void update(vector<int> & Segtree, int k, int a,int N) { k += N -1; Segtree[k] = a; while(k > 0) { k = (k-1)/2; Segtree[k] = min(Segtree[2*k+1],Segtree[2*k + 2]); } } int query(vector<int> & Segtree,int a, int b, int k, int l,int r) { // DEBUG(k); if(r <= a || b <= l) return 2147483647; if(a <= l && r <= b) return Segtree[k]; else { int vl = query(Segtree,a,b,k*2+1,l,(r+l)/2); int vr = query(Segtree,a,b,k*2+2,(l+r)/2,r); return min (vr,vl); } } void solve(void) { int X; cin>>X; if( X - 1 == 0) { cout<0<<endl; return; } // X--; int Y = X/11; X = X%11; if(X < 6) { cout<<2*Y + 1 <<endl; } else { cout<<2*Y + 2 <<endl; } return; } int32_t main(int32_t argc, const char *argv[]) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed; std::cout << std::setprecision(9); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:78:11: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 78 | cout<0<<endl; | ~^~~~~~
s321848024
p03815
C++
#include<stdio.h> #include<iostream> using namespace std; int main () { long long x; ans, k; cin >> x; ans += (x/11)*2; k = x%11; if (0<k && k<=6) { ans += 1; } else if (6<k){ ans += 2; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 7 | ans, k; | ^~~ | abs a.cc:7:10: error: 'k' was not declared in this scope 7 | ans, k; | ^
s718123741
p03815
C++
#include<iostream> using namespace std; int main () { long long x; ans, k; cin >> x; ans += (x/11)*2; k = x%11; if (k>0) { if (k<=6){ ans += 1; } else { ans += 2; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 6 | ans, k; | ^~~ | abs a.cc:6:10: error: 'k' was not declared in this scope 6 | ans, k; | ^
s236580212
p03815
C++
#include<iostream> using namespace std; int main () { long long x; ans, k; cin >> x; ans += (x/11)*2; k = x%11; if (k!=0) { if (0<k && k<=6){ ans += 1; } else { ans += 2; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 6 | ans, k; | ^~~ | abs a.cc:6:10: error: 'k' was not declared in this scope 6 | ans, k; | ^
s030480624
p03815
C++
#include<iostream> using namespace std; int main (){ long long x; ans=0,k=0; cin >> x; ans += (x/11)*2; k = x%11; if (k!=0) { if (0<k && k<=6){ ans += 1; } esle { ans += 2; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 6 | ans=0,k=0; | ^~~ | abs a.cc:6:11: error: 'k' was not declared in this scope 6 | ans=0,k=0; | ^ a.cc:16:9: error: 'esle' was not declared in this scope 16 | esle { | ^~~~
s168506238
p03815
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long x; cin>>x; long long ans=x/11; if(x%11==0){ cout<<2*ans<<endl; }else(x%11<=6){ cout<<2*ans+1<<endl; }else{ cout<<2*ans+2<<endl; } }
a.cc: In function 'int main()': a.cc:11:17: error: expected ';' before '{' token 11 | }else(x%11<=6){ | ^ | ; a.cc:13:4: error: 'else' without a previous 'if' 13 | }else{ | ^~~~
s055134504
p03815
C++
//#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++) #define all(x) (x).begin(),(x).end() #define MOD 1000000007LL #define INF (1LL<<60LL) #define int long long typedef long long ll; using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); ll x; cin >> x; ll ans = 0; ans = int(x / 11) * 2; x %= 11; if (0 < x) ans++; if (6 < x)ans++; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:13: error: expected primary-expression before 'long' 8 | #define int long long | ^~~~ a.cc:20:15: note: in expansion of macro 'int' 20 | ans = int(x / 11) * 2; | ^~~
s962004696
p03815
C++
//#define _CRT_SECURE_NO_WARNINGS #include "bits/stdc++.h" #define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++) #define all(x) (x).begin(),(x).end() #define MOD 1000000007LL #define INF (1LL<<60LL) #define int long long typedef long long ll; using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); ll x; cin >> x; ll ans = 0; ans = int(x / 11) * 2; x %= 11; if (0 < x) ans++; if (6 < x)ans++; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:13: error: expected primary-expression before 'long' 8 | #define int long long | ^~~~ a.cc:20:15: note: in expansion of macro 'int' 20 | ans = int(x / 11) * 2; | ^~~
s748250459
p03815
C++
import sys x = int(input()) a = (x // 11) * 2 if x % 11 == 0 : print(a) elif x%11 <= 6 : print(a+1) else : print(a+2)
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s321971190
p03815
C++
<?php $n = fgets(STDIN); $ans = floor($n / 11) * 2; $t = $n % 11; if($t > 6){ $ans+=2; } else if($t > 0){ $ans++; } echo $ans; ?>
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <?php | ^ a.cc:3:1: error: '$ans' does not name a type 3 | $ans = floor($n / 11) * 2; | ^~~~ a.cc:4:1: error: '$t' does not name a type 4 | $t = $n % 11; | ^~ a.cc:5:1: error: expected unqualified-id before 'if' 5 | if($t > 6){ | ^~ a.cc:8:1: error: expected unqualified-id before 'else' 8 | else if($t > 0){ | ^~~~ a.cc:11:1: error: 'echo' does not name a type 11 | echo $ans; | ^~~~ a.cc:13:1: error: expected unqualified-id before '?' token 13 | ?> | ^
s235987245
p03815
C++
int main(void) { LL x; cin >> x; LL ans = x/11*2; if((x-x/11*11) <= 6){ ans += 1; }else{ ans += 2; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:2:5: error: 'LL' was not declared in this scope 2 | LL x; | ^~ a.cc:3:5: error: 'cin' was not declared in this scope 3 | cin >> x; | ^~~ a.cc:3:12: error: 'x' was not declared in this scope 3 | cin >> x; | ^ a.cc:5:7: error: expected ';' before 'ans' 5 | LL ans = x/11*2; | ^~~~ | ; a.cc:8:9: error: 'ans' was not declared in this scope 8 | ans += 1; | ^~~ a.cc:10:9: error: 'ans' was not declared in this scope 10 | ans += 2; | ^~~ a.cc:13:5: error: 'cout' was not declared in this scope 13 | cout << ans << endl; | ^~~~ a.cc:13:13: error: 'ans' was not declared in this scope 13 | cout << ans << endl; | ^~~ a.cc:13:20: error: 'endl' was not declared in this scope 13 | cout << ans << endl; | ^~~~
s315145686
p03815
C++
#include <bits/stdc++.h> using namespace std; int main() { long long int n,count,ans; cin>>n; ans=2*(n/11); count=x%11; if(0<count && count<7){ ans+=1; }else if(7<=count){ ans+=2; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:8:9: error: 'x' was not declared in this scope 8 | count=x%11; | ^
s932228030
p03815
C++
#include <iostream> using namespace std; int main(){ unsigned long long int x; cin >> x; //6→5,5→6 unsigned long long int a, b; a = (x / 11) * 2; if(x % 11 <= 5) a += 1 else a += 2; b = (x / 11) * 2; if(x % 11 <= 6) b += 1; else b += 2; cout << min(a, b); }
a.cc: In function 'int main()': a.cc:12:25: error: expected ';' before 'else' 12 | if(x % 11 <= 5) a += 1 | ^ | ; 13 | else a += 2; | ~~~~
s917533850
p03815
C++
#include<bits/stdc++.h> int main(){long long N;cin>>N;long long a=N/11*2,b=N%11;if(1<=b and b<=6)a++;else a+=2; std::cout<<a<<std::endl;}
a.cc: In function 'int main()': a.cc:2:24: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 2 | int main(){long long N;cin>>N;long long a=N/11*2,b=N%11;if(1<=b and b<=6)a++;else a+=2; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~
s010104849
p03815
C++
#include <iostream> #include <cstring> #include <math.h> using namespace std; int main() { long long x; cin >> x; if (x <= 6) { cout << 1; } if (x <= 11) { cout << 2; } if (x > 11) { if (x % 11 == 0) { cout << (long long)(x / 11 * 2); } else { remainder = x / 11 int rest = x % 11; if (rest > 6) { cout << (long long)(remainder * 2) + 2); } else { cout << (long long)(remainder) + 1); } } } return 0; }
a.cc: In function 'int main()': a.cc:26:29: error: overloaded function with no contextual type information 26 | remainder = x / 11 | ^~ a.cc:28:17: error: 'rest' was not declared in this scope 28 | if (rest > 6) | ^~~~ a.cc:30:47: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator*' 30 | cout << (long long)(remainder * 2) + 2); | ~~~~~~~~~~^~~ a.cc:34:46: error: overloaded function with no contextual type information 34 | cout << (long long)(remainder) + 1); | ^