submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s529278411
p04029
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; cout << n*(n+1)/2 << endl; return;
a.cc: In function 'int main()': a.cc:11:1: error: return-statement with no value, in function returning 'int' [-fpermissive] 11 | return; | ^~~~~~ a.cc:11:8: error: expected '}' at end of input 11 | return; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s513007699
p04030
Java
import java.util.*; import java.io.*; import java.math.*; public class Unhappy_hacking { public static void main(String[] args) { FastScanner I=new FastScanner(); Output O=new Output(); String s=I.next(); Stack<Character> cur=new Stack<Character>(); Stack<Character> ans=new Stack<Character>(); for(int i=0;i<s.length();i++) { if(s.charAt(i)=='1') cur.push('1'); else if(s.charAt(i)=='0') cur.push('0'); else if(s.charAt(i)=='B' && cur.size()>0) cur.pop(); } while(!cur.empty()) { ans.add(cur.pop()); } while(!ans.empty()) { O.p(ans.pop()); } System.out.println(); } static class FastScanner { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(""); String next() { while (!st.hasMoreTokens()) try { st=new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } return st.nextToken(); } int nextInt() {return Integer.parseInt(next());} long nextLong() {return Long.parseLong(next());}; } static class Output{ PrintWriter w=new PrintWriter(System.out); void pln(int x) {w.println(x); w.flush();} void pln(long x) {w.println(x); w.flush();} void pln(String x) {w.println(x); w.flush();} void pln(char x) {w.println(x); w.flush();} void pln(StringBuilder x) {w.println(x); w.flush();} void p(int x) {w.print(x);w.flush();} void p(long x) {w.print(x);w.flush();} void p(String x) {w.print(x);w.flush();} void p(char x) {w.print(x);w.flush();} void p(StringBuilder x) {w.print(x);w.flush();} } }
Main.java:4: error: class Unhappy_hacking is public, should be declared in a file named Unhappy_hacking.java public class Unhappy_hacking { ^ 1 error
s361144077
p04030
C++
s = str(input()) ans = [] for i in range(len(s)): if s[i] == "B": if len(ans) != 0: ans.pop() else : ans.append(s[i]) print(''.join(ans))
a.cc:7:7: error: empty character constant 7 | print(''.join(ans)) | ^~ a.cc:1:1: error: 's' does not name a type 1 | s = str(input()) | ^
s530819598
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for(int i=0;i<s.size()-1;i++){ if(s[i] == B){ s[i] = ""; if(i!=0){ s[i-1] = ''; } } } }
a.cc:11:16: error: empty character constant 11 | s[i-1] = ''; | ^~ a.cc: In function 'int main()': a.cc:8:16: error: 'B' was not declared in this scope 8 | if(s[i] == B){ | ^ a.cc:9:12: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 9 | s[i] = ""; | ^~ | | | const char*
s496805295
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for(int i=0;i<s.size()-1;i++){ if(s[i] == B){ s[i] = ''; if(i!=0){ s[i-1] = ''; } } } }
a.cc:9:12: error: empty character constant 9 | s[i] = ''; | ^~ a.cc:11:16: error: empty character constant 11 | s[i-1] = ''; | ^~ a.cc: In function 'int main()': a.cc:8:16: error: 'B' was not declared in this scope 8 | if(s[i] == B){ | ^
s232811242
p04030
Java
import java.util.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.next(); String ans = ""; for(int i = 0; i < s.length; i++){ if(s.charAt(i) == '0' || s.charAt(i) == '1'){ ans += s.charAt(i); }else{ ans.substring(0, ans.length() - 1); } } System.out.println(ans); } }
Main.java:9: error: cannot find symbol for(int i = 0; i < s.length; i++){ ^ symbol: variable length location: variable s of type String 1 error
s492731717
p04030
Java
import java.util.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.next(); String ans = ""; for(int i = 0; i < sa.length; i++){ if(s.charAt(i) == "0" || s.charAt(i) == "1"){ ans += s.charAt(i); }else{ ans.substring(0, ans.length() - 1); } } System.out.println(ans); } }
Main.java:9: error: cannot find symbol for(int i = 0; i < sa.length; i++){ ^ symbol: variable sa location: class Main Main.java:10: error: bad operand types for binary operator '==' if(s.charAt(i) == "0" || s.charAt(i) == "1"){ ^ first type: char second type: String Main.java:10: error: bad operand types for binary operator '==' if(s.charAt(i) == "0" || s.charAt(i) == "1"){ ^ first type: char second type: String 3 errors
s057069470
p04030
Java
import java.util.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.next(); String[] sa = s.split(""); String ans = ""; for(int i = 0; i < sa.length; i++){ if(sa[i] == "0" || sa[i] == "1"){ ans += sa[i]; }else{ ans.substring(0, end - 1); } } System.out.println(ans); } }
Main.java:14: error: cannot find symbol ans.substring(0, end - 1); ^ symbol: variable end location: class Main 1 error
s994343252
p04030
Java
import java.util.*; public class Main{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.next(); String[] sa = s.split(""); StringBuilder ans = new StringBuilder(); for(int i = 0; i < sa.length; i++){ if(sa[i] == '0' || sa[i] == '1'){ ans.append(sa[i]); }else{ ans.setLength(ans.length() - 1); } } System.out.println(ans); } }
Main.java:11: error: bad operand types for binary operator '==' if(sa[i] == '0' || sa[i] == '1'){ ^ first type: String second type: char Main.java:11: error: bad operand types for binary operator '==' if(sa[i] == '0' || sa[i] == '1'){ ^ first type: String second type: char 2 errors
s662340644
p04030
C++
// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2013 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional // permissions described in the GCC Runtime Library Exception, version // 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and // a copy of the GCC Runtime Library Exception along with this program; // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // <http://www.gnu.org/licenses/>. /** @file stdc++.h * This is an implementation file for a precompiled header. */ // 17.4.1.2 Headers // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #if __cplusplus >= 201103L #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #endif // C++ #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #if __cplusplus >= 201103L #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #endif /*全てのライブラリをインクルード*/ #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { string s; cin >> s;0 rep(i, 10) { if (s[i] == 'B') { if (i != 0) { s.erase(i - 1, 2); i -= 2; } else if (i == 0) { s.erase(i, 1); i = -1; } } } cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:127:15: error: expected ';' before 'for' 127 | cin >> s;0 | ^ | ; a.cc:128:9: error: 'i' was not declared in this scope 128 | rep(i, 10) | ^ a.cc:119:35: note: in definition of macro 'rep' 119 | #define rep(i, n) for (int i = 0; i < (n); ++i) | ^
s416992153
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(){ string in,out; cin>>in; for(int i=0;i<in.size();i++){ if(in.at(i)=="0"){ out.push_back(i); out.at(i)="0"; }else if(in.at(i)=="1"){ out.push_back(i); out.at(i)="1"; }else{ out.pull_back(i); } } cout<<out<<endl; }
a.cc: In function 'int main()': a.cc:7:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | if(in.at(i)=="0"){ | ~~~~~~~~^~~~~ a.cc:9:23: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 9 | out.at(i)="0"; | ^~~ | | | const char* a.cc:10:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | }else if(in.at(i)=="1"){ | ~~~~~~~~^~~~~ a.cc:12:23: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 12 | out.at(i)="1"; | ^~~ | | | const char* a.cc:14:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pull_back'; did you mean 'push_back'? 14 | out.pull_back(i); | ^~~~~~~~~ | push_back
s818023564
p04030
Java
import java.util.*; import java.util.stream.Collectors; /** * ABC043 B * * @date 2020.08.22 * @author 焼き鮭 <yaki-shake@up-tri.me> */ public class App { Scanner sc; public static void main(String[] args) { new App().execute(); } public void execute() { this.sc = new Scanner(System.in); String commands = this.sc.next(); String[] keys = commands.split(""); ArrayList<String> output = new ArrayList<String>(); for (String key : keys) { if (key.equals("B")) { if (0 < output.size()) { output.remove(output.size() - 1); } } else { output.add(key); } } System.out.println(output.stream().collect(Collectors.joining(""))); } }
Main.java:11: error: class App is public, should be declared in a file named App.java public class App { ^ 1 error
s088818856
p04030
Java
import java.util.*; import java.util.stream.Collectors; /** * ABC043 B * * @date 2020.08.22 * @author 焼き鮭 <yaki-shake@up-tri.me> */ public class B { Scanner sc; public static void main(String[] args) { new B().execute(); } public void execute() { this.sc = new Scanner(System.in); String commands = this.sc.next(); String[] keys = commands.split(""); ArrayList<String> output = new ArrayList<String>(); for (String key : keys) { if (key.equals("B")) { if (0 < output.size()) { output.remove(output.size() - 1); } } else { output.add(key); } } System.out.println(output.stream().collect(Collectors.joining(""))); } }
Main.java:11: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s238130764
p04030
C++
#include <stdio.h> int main() { int count = 0; char Zx[14], Yz[14] = {}; scanf("%s", &Zx); for (int u = 0; Zx[u] != '\0'; u++) { if (Zx[u] == '0') { Yz[count] = '0'; count++; } else if (Zx[u] == '1') { Yz[count] = '1'; count++; } else if (count != 0) { if (Xz[u] == 'B') { Yz[count - 1] = '0'; count -= 1; } } } Yz[count] = '\0'; printf("%s", Yz); return 0; }
a.cc: In function 'int main()': a.cc:18:17: error: 'Xz' was not declared in this scope; did you mean 'Yz'? 18 | if (Xz[u] == 'B') { | ^~ | Yz
s533671627
p04030
C++
#include <stdio.h> #include <string.h> int main() { char command[10+1]; scanf("%s",&command); int len = strlen(command); char output[len+1]; for (int i = 0, j = 0; i < len; i++,j++) { if (command[i] == '0') { output[j] = '0'; output[j+1] = '\0'; } else if (command[i] == '1') { output[j] = '1'; output[j+1] = '\0'; } else (command[i] == 'B') { if (output[j-1] != '\0') { output[--j] = '\0'; } } } printf("%s\n",output); return 0; }
a.cc: In function 'int main()': a.cc:20:41: error: expected ';' before '{' token 20 | else (command[i] == 'B') | ^ | ; 21 | { | ~
s280448579
p04030
C++
#include <stdio.h> int main(){ char a[20], char b[20]; scanf("%s",a); int counter=0; for (int i=0 ; a[i] != '\0';i++){ if(a[i] == '0'){ b[counter]='0'; counter++; } else if(a[i] == '1'){ b[counter]='1'; counter++; } else if(counter != 0){ if(a[i] == 'B'){ b[counter - 1]='\0'; counter=counter-2; } counter++; } } b[counter] = '\0'; printf("%s",b); return 0; }
a.cc: In function 'int main()': a.cc:4:1: error: expected unqualified-id before 'char' 4 | char b[20]; | ^~~~ a.cc:9:9: error: 'b' was not declared in this scope 9 | b[counter]='0'; | ^ a.cc:13:9: error: 'b' was not declared in this scope 13 | b[counter]='1'; | ^ a.cc:18:13: error: 'b' was not declared in this scope 18 | b[counter - 1]='\0'; | ^ a.cc:24:1: error: 'b' was not declared in this scope 24 | b[counter] = '\0'; | ^
s425234439
p04030
C++
#include <stdio.h> int main(){ char a[20],b[20]; scanf("%s",a); int counter=0; for (int i=0;a[i]!='\0';i++){ if(a[i]=='0'){ b[couter]='0'; counter++; } else if(a[i]=='1'){ b[counter]='1'; counter++; } else if(counter!=0){ if(a[i]=='B'){ b[counter-1]='\0'; counter=counter-2; } counter++; } } b[counter]='\0'; printf("%s",b); return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'couter' was not declared in this scope; did you mean 'counter'? 8 | b[couter]='0'; | ^~~~~~ | counter
s889909348
p04030
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; int main() { ios::sync_with_stdio(false); cin.tie(0); string s, f=""; cin >> s; int n = s.length(); for(int i=0; i<n; i++) { if(s[i] == 'B') { s[i] = '9'; s[i-1] = '9'; } } for(int i=0; i<n; i++) { if (s[i] != '9') { f+= s[i]; } } if(f.legth() > 0) { cout << f; } else { cout << "(empty)"; } return 0; }
a.cc: In function 'int main()': a.cc:25:14: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'legth'; did you mean 'length'? 25 | if(f.legth() > 0) { | ^~~~~ | length
s005016116
p04030
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll INF = 1e16; const ll mod = 1000000007; #define rep(i, n) for (int i = 0; i < (ll)(n); i++) int main() { string s; cin >> s; stack <ll> st; rep(i, s.size()) { if (s.at(i) == '0') st.push(0); else if (s.at(i) == '1') st.push(1); else s.pop(); } vector <ll> v; rep(i, st.size()) { v.push_back(st.top()); st.pop(); } rep(i, v.size()) cout << v.at(v.size()-1-i) << endl; }
a.cc: In function 'int main()': a.cc:14:16: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pop' 14 | else s.pop(); | ^~~
s415428455
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s;cin>>s;string v=""; for(int i=0;i<s.sise();i++){ if(s[i]=='0'||s[i]=='1')v.push_back(s[i]); else if(s[i]=='B'){ if(v.sise()==0)break; else v.erase(v.end()); } }cout<<v<<endl; }
a.cc: In function 'int main()': a.cc:6:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sise'; did you mean 'size'? 6 | for(int i=0;i<s.sise();i++){ | ^~~~ | size a.cc:9:12: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sise'; did you mean 'size'? 9 | if(v.sise()==0)break; | ^~~~ | size
s316151614
p04030
C++
vector<int> vec; int c = 0; rep(i, N) { if(str.at(i) == '0') { vec.push_back(0); c++; } if(str.at(i) == '1') { vec.push_back(1); c++; } if(str.at(i) == 'B') { if(c > 0) { c--; vec.pop_back(); } } } rep(i, vec.size()) { cout << vec.at(i); } }
a.cc:1:3: error: 'vector' does not name a type 1 | vector<int> vec; | ^~~~~~ a.cc:3:6: error: expected constructor, destructor, or type conversion before '(' token 3 | rep(i, N) { | ^ a.cc:19:6: error: expected constructor, destructor, or type conversion before '(' token 19 | rep(i, vec.size()) { | ^ a.cc:22:1: error: expected declaration before '}' token 22 | } | ^
s116681447
p04030
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { string str; cin >> str; int N = str.size(); vector<int> vec; rep(i, N) { if(str.at(i) == '0') { vec.push_back(0); } if(str.at(i) == '1') { vec.push_back(1); } if(str.at(i) == 'B') { vec.pop_back; } } rep(i, vec.size()) { cout << vec.at(i); } }
a.cc: In function 'int main()': a.cc:19:11: error: invalid use of non-static member function 'void std::vector<_Tp, _Alloc>::pop_back() [with _Tp = int; _Alloc = std::allocator<int>]' 19 | vec.pop_back; | ~~~~^~~~~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1324:7: note: declared here 1324 | pop_back() _GLIBCXX_NOEXCEPT | ^~~~~~~~
s023548245
p04030
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { string str; cin >> str; int N = str.size(); vector<int> vec; rep(i, N) { if(str.at(i) == '0') { vec.push_back(0); } if(str.at(i) == '1') { vec.puch_back(1); } if(str.at(i) == 'B') { vec.pop_beck; } } rep(i, vec.size()) { cout << vec.at(i); } }
a.cc: In function 'int main()': a.cc:16:11: error: 'class std::vector<int>' has no member named 'puch_back'; did you mean 'push_back'? 16 | vec.puch_back(1); | ^~~~~~~~~ | push_back a.cc:19:11: error: 'class std::vector<int>' has no member named 'pop_beck'; did you mean 'pop_back'? 19 | vec.pop_beck; | ^~~~~~~~ | pop_back
s130860972
p04030
C++
/* author : nishi5451 created: 12.08.2020 16:12:44 */ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef long long ll; int main(){ string s; cin >> s; vector<int> a; rep(i,s.size()){ if(s[i]=='0') a.push_back(0); else if(s[i]=='1') a.push_back(1); else if(s[i]=='B') a.pop_back(); } cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>') 21 | cout << a << endl; | ~~~~ ^~ ~ | | | | | std::vector<int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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:6: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) |
s194309305
p04030
Java
import java.util.*; public class Main { public static void main(String[] args) throws Exception{ Scanner scn = new Scanner(System.in); String s = scn.next(); String[] list = s.split(""); String ans = ""; if(s.length()==1){ ans = s; }else{ for(int i=1; i<s.length(); i++){ if(list[i].equals("B")){ list[i-1]="2"; list[i]="2"; } } if(list[0].equals("B")) list[0]=2; for(int i=0; i<s.length(); i++){ if(!(list[i].equals("2"))) ans+=list[i]; } } System.out.println(ans); } }
Main.java:18: error: incompatible types: int cannot be converted to String if(list[0].equals("B")) list[0]=2; ^ 1 error
s251847171
p04030
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; } int f(int n){ return (n*n+4)/8; } int main(){ deque<char> dq; string s; cin >> s; for(int i = 0; i < (int)s.size(); ++i){ if(s[i] == '0' || s[i] == '1'){ dq.push_back(s[i]); } else if(!st.empty()){ dq.pop_back(); } } for(auto e:dq)cout << e; cout << endl; }
a.cc: In function 'int main()': a.cc:49:16: error: 'st' was not declared in this scope; did you mean 's'? 49 | } else if(!st.empty()){ | ^~ | s
s410133451
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int S = s.size() - 1; string c = s.at(0) for (int i = 1; i < S; i++) { if (s.at(i) == '0') {c += '0';} else if (s.at(i) == '1') {c += '1';} else {c.at(i - 1) = ' ';} } cout << c << endl; }
a.cc: In function 'int main()': a.cc:7:18: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 7 | string c = s.at(0) | ~~~~^~~ a.cc:8:3: error: expected ',' or ';' before 'for' 8 | for (int i = 1; i < S; i++) { | ^~~ a.cc:8:19: error: 'i' was not declared in this scope 8 | for (int i = 1; i < S; i++) { | ^
s375894016
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S; cin>>S; queue<char>A; for(int i=0;i<S.size();i++){ if(S.at(i)=='0')A.push("0"); else if(S.at(i)=='1')A.push("1"); else if(!A.empty())A.pop(); } for(i:A){ cout<<A.front(); A.pop(); } cout<<endl; }
a.cc: In function 'int main()': a.cc:7:27: error: no matching function for call to 'push(const char [2])' 7 | if(S.at(i)=='0')A.push("0"); | ~~~~~~^~~~~ In file included from /usr/include/c++/14/queue:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157, from a.cc:1: /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >; value_type = char]' (near match) 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:7: note: conversion of argument 1 would be ill-formed: a.cc:7:28: error: invalid conversion from 'const char*' to 'std::queue<char>::value_type' {aka 'char'} [-fpermissive] 7 | if(S.at(i)=='0')A.push("0"); | ^~~ | | | const char* /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >; value_type = char]' (near match) 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: conversion of argument 1 would be ill-formed: a.cc:7:28: error: invalid conversion from 'const char*' to 'std::queue<char>::value_type' {aka 'char'} [-fpermissive] 7 | if(S.at(i)=='0')A.push("0"); | ^~~ | | | const char* a.cc:8:32: error: no matching function for call to 'push(const char [2])' 8 | else if(S.at(i)=='1')A.push("1"); | ~~~~~~^~~~~ /usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >; value_type = char]' (near match) 283 | push(const value_type& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:283:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid conversion from 'const char*' to 'std::queue<char>::value_type' {aka 'char'} [-fpermissive] 8 | else if(S.at(i)=='1')A.push("1"); | ^~~ | | | const char* /usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >; value_type = char]' (near match) 288 | push(value_type&& __x) | ^~~~ /usr/include/c++/14/bits/stl_queue.h:288:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid conversion from 'const char*' to 'std::queue<char>::value_type' {aka 'char'} [-fpermissive] 8 | else if(S.at(i)=='1')A.push("1"); | ^~~ | | | const char* a.cc:11:8: error: found ':' in nested-name-specifier, expected '::' 11 | for(i:A){ | ^ | :: a.cc:11:7: error: 'i' has not been declared 11 | for(i:A){ | ^ a.cc:16:1: error: expected primary-expression before '}' token 16 | } | ^ a.cc:15:14: error: expected ')' before '}' token 15 | cout<<endl; | ^ | ) 16 | } | ~ a.cc:11:6: note: to match this '(' 11 | for(i:A){ | ^ a.cc:16:1: error: expected primary-expression before '}' token 16 | } | ^
s893316500
p04030
C
#include <stdio.h> int main () { char str[15]; char modstr[15]; int length = 0; (scanf("%s", str); for (int i = 0; str[i] != '\0'; i++) { length++; } int j = 0; for (int i = 0; i < length; i++) { if (str[i] == '0') { modstr[j] = '0'; j++; } else if (str[i] == '1') { modstr[i] = '1'; j++; } else if (str[i] == 'B') { if (j != 0) { j--; modstr[j] = '\0'; } } } printf("%s", modstr); return 0; }
main.c: In function 'main': main.c:7:26: error: expected ')' before ';' token 7 | (scanf("%s", str); | ~ ^ | ) main.c:30:18: error: expected ';' before '}' token 30 | return 0; | ^ | ; 31 | } | ~
s187189750
p04030
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.nextLine(); Queue<String> q0 = new LinkedList<>(); Queue<String> q1 = new LinkedList<>(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == '0') { q0.add("0"); } else if (s.charAt(i) == '1') { q1.add("1"); } else { if (!q1.isEmpty()) { q1.remove(); } else if (q1.isEmpty() && (!q0.isEmpty())) { q0.remove(); } } } if (!q0.isEmpty()) { for (String a : q0) { System.out.print(a); } } if (!q1.isEmpty()) { for (String a : q1) { System.out.print(a); } } System.out.println(); } } }
Main.java:41: error: class, interface, enum, or record expected } ^ 1 error
s300939221
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S,ans; cin >> S; for (int i=0; i<S.size(); i++){ if (S[i] == 0){ ans += 0; } else if(S[i] == 1){ ans += 1; } else if( ans.erase(i); ans.erase(i-1); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:11: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 9 | ans += 0; | ~~~~^~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1377:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1377 | operator+=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1387:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1387 | operator+=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1397:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1397 | operator+=(_CharT __c) | ^~~~~~~~ a.cc:16:21: error: expected ')' before ';' token 16 | ans.erase(i-1); | ^ | ) a.cc:14:12: note: to match this '(' 14 | else if( | ^ a.cc:16:16: error: could not convert 'ans.std::__cxx11::basic_string<char>::erase(((std::__cxx11::basic_string<char>::size_type)(i - 1)), ((std::__cxx11::basic_string<char>::size_type)std::__cxx11::basic_string<char>::npos))' from 'std::__cxx11::basic_string<char>' to 'bool' 16 | ans.erase(i-1); | ~~~~~~~~~^~~~~ | | | std::__cxx11::basic_string<char>
s721910218
p04030
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.FileWriter; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.io.BufferedWriter; import java.io.FileReader; import java.io.File; import java.util.*; public class B { public static StringBuilder output = new StringBuilder(); public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.next().trim(); Solver solver = new Solver(); solver.solve(s); System.out.println(output.reverse()); } } class Solver { public void solve(String s) { String ans = ""; int count = 0; for (int i = s.length() - 1; i >= 0; i--) { if (s.charAt(i) == 'B') { count++; } else { if (count > 0) { count--; continue; } else { ans = ans.concat(Character.toString(s.charAt(i))); } } } B.output.append(ans); } }
Main.java:11: error: class B is public, should be declared in a file named B.java public class B { ^ 1 error
s293355117
p04030
C
/* ex9_1 fmuacshai */ # include<stdio.h> #include<stdlib.h> # define SIZE 20 //stackの定義 typedef struct{ int size; int count; char string[SIZE]; char *top; } stack; //データの追加 void push(stack *stk,char character){ if(stk->count>=stk->size){ printf("Error"); }else{ stk->top--; *(stk->top)=character; stk->count++; } } //データの取り出し void pop(stack *stk){ if(stk->count>=0){ stk->top++; stk->count--; } } //データの初期化 void initialize(stack *stk){ stk->size=SIZE; stk->count=0; stk->top=&(stk->string[SIZE]); } //データの出力 void output(stack *stk){ int i; stk->top+=stk->count; for(i=0;i<=stk->count;i++){ printf("%c",*(stk->top)); stk->top--; } printf("\n"); } int main(void){ int i; //stack stkの定義 stack stk; //入力で利用するinputを定義 char input[SIZE]; //データを初期化 initialize(&stk); //追加と消去をする for(i=0;input[i]!=`\0`;i++){ if(input=='0'||input=='1'){ push(&stk, input); }else{ pop(&stk); } } //出力 output(&stk); return 0; }
main.c: In function 'main': main.c:57:23: error: stray '`' in program 57 | for(i=0;input[i]!=`\0`;i++){ | ^ main.c:57:24: error: stray '\' in program 57 | for(i=0;input[i]!=`\0`;i++){ | ^ main.c:57:26: error: stray '`' in program 57 | for(i=0;input[i]!=`\0`;i++){ | ^ main.c:58:17: warning: comparison between pointer and integer 58 | if(input=='0'||input=='1'){ | ^~ main.c:58:29: warning: comparison between pointer and integer 58 | if(input=='0'||input=='1'){ | ^~ main.c:59:24: error: passing argument 2 of 'push' makes integer from pointer without a cast [-Wint-conversion] 59 | push(&stk, input); | ^~~~~ | | | char * main.c:15:27: note: expected 'char' but argument is of type 'char *' 15 | void push(stack *stk,char character){ | ~~~~~^~~~~~~~~
s980126063
p04030
C
/* ex9_1 takaoga */ #include<stdio.h> #include<stdlib.h> #define SIZE 10 typedef struct{ int size; int count; char data[SIZE]; char *top; } stack; void initialize_text(stack *text){ text->count = 0; text->size = SIZE; text->top = &(text->data[SIZE]); } void push(stack *text, char textcharacter){ if(text->count >= text->size){ printf("Error: stack overflow. (x=%lf)¥n", x); exit(1); }else{ text->top--; *(text->top) = textcharacter; text->count++; } } void pop(stack *text){ if(text->count <= 0){ printf("Error: stack overflow. (x=%lf)¥n", x); exit(1); }else{ text->top++; text->count--; } } void print_text(stack *text){ char *texttop; texttop = text->top; for(int i = 0 ; i < text->count ; i++){ printf("%c", *texttop++); } printf("\n"); } stack text; int main(void){ char inputtext[10],nowtext; initialize_stack(&text); scanf("%s",inputtext); nowtext = &inputtext[0]; while(*nowtext!=NULL){ if(*nowtext == '0' || *nowtext == '1'){ push(&text, *nowtext); }else if(*nowtext == 'B'){ if(*(nowtext-1) != NULL){ pop(&text); } } } print_text(&text); return 0; }
main.c: In function 'push': main.c:23:52: error: 'x' undeclared (first use in this function) 23 | printf("Error: stack overflow. (x=%lf)¥n", x); | ^ main.c:23:52: note: each undeclared identifier is reported only once for each function it appears in main.c: In function 'pop': main.c:34:52: error: 'x' undeclared (first use in this function) 34 | printf("Error: stack overflow. (x=%lf)¥n", x); | ^ main.c: In function 'main': main.c:55:5: error: implicit declaration of function 'initialize_stack'; did you mean 'initialize_text'? [-Wimplicit-function-declaration] 55 | initialize_stack(&text); | ^~~~~~~~~~~~~~~~ | initialize_text main.c:57:13: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion] 57 | nowtext = &inputtext[0]; | ^ main.c:58:11: error: invalid type argument of unary '*' (have 'int') 58 | while(*nowtext!=NULL){ | ^~~~~~~~ main.c:59:12: error: invalid type argument of unary '*' (have 'int') 59 | if(*nowtext == '0' || *nowtext == '1'){ | ^~~~~~~~ main.c:59:31: error: invalid type argument of unary '*' (have 'int') 59 | if(*nowtext == '0' || *nowtext == '1'){ | ^~~~~~~~ main.c:60:25: error: invalid type argument of unary '*' (have 'int') 60 | push(&text, *nowtext); | ^~~~~~~~ main.c:61:18: error: invalid type argument of unary '*' (have 'int') 61 | }else if(*nowtext == 'B'){ | ^~~~~~~~ main.c:62:16: error: invalid type argument of unary '*' (have 'int') 62 | if(*(nowtext-1) != NULL){ | ^~~~~~~~~~~~
s914601328
p04030
C
/* ex 9_1 hangan2020 */ #include <stdio.h> #include <stdlib.h> #define SIZE 11 typedef struct stack{ int size; int count; char data[SIZE]; char *top; } stack; void initialize_stack(stack *stk){ stk->count = 0; stk->size = SIZE; stk->top = &(stk->data[SIZE]); } void push(stack *stk, char elem){ if(stk->count >= stk->size){ fprintf(stderr, "Error: Stack overflow\n"); exit(1); } else{ stk->top--; *(stk->top) = elem; stk->count++; } } void pop(stack *stk){ //char latest; /*if(stk->count <= 0){ fprintf(stderr, "Error: Stack underflow\n"); exit(1); }*/ else{ //latest = *(stk->top); stk->top++; stk->count--; } } void print_stk(stack *stk){ char *p; p = stk->top; for(int i = 0; i < stk->count; i++){ printf("%c", *p); p++; } printf("\n"); } int main(void){ stack stk; char string[SIZE]; int i = 0; initialize_stack(&stk); scanf("%s", &string); while(string[i] != '\0'){ if(string[i] == 'B'){ if(stk.count != 0){ pop(&stk); } }else{ push(&stk, string[i]); } i++; } print_stk(&stk); return 0; }
main.c: In function 'pop': main.c:39:4: error: 'else' without a previous 'if' 39 | else{ | ^~~~
s797120489
p04030
C
/* ex 9_1 riverstone */ #include <stdio.h> #include <stdlib.h> //スタックに格納するデータの数 #define SIZE 20 //プロトタイプ宣言 typedef struct stack stack; void initialize_stack(stack *stk); void push(stack *stk, char elem); char pop(stack *stk); void print_stuck(stack *stk); //スタックの定義 typedef struct stack{ int size; int count; char data[SIZE]; char *top; } stack; int main(void){ int i=0; char string[SIZE]; stack stk; //スタックを初期化 initialize_stack(&stk); //入力を受け取る scanf("%s", string); //stringの中身を一文字ずつ見ていく for(i=0;i<strlen(string);i++){ //0か1ならスタックにプッシュする if(string[i]=='0' || string[i]=='1'){ push(&stk,string[i]); } //Bならスタックから一文字popする else if(string[i]=='B' && stk.count>0){ pop(&stk); } } //stackの中身を出力 print_stack(&stk); printf("\n"); return 0; } //スタックの初期化 void initialize_stack(stack *stk){ stk->count = 0; stk->size = SIZE; stk->top = &(stk->data[SIZE]); } //データの追加 void push(stack *stk, char elem){ if(stk->count >= stk->size){ fprintf(stderr, "Error: stack overflow. (x=%c)\n", elem); exit(1); } else{ stk->top--; *(stk->top) = elem; stk->count++; } } //データの取り出し char pop(stack *stk){ char latest; if(stk->count <= 0){ fprintf(stdout, "Error: stack underflow.\n"); exit(1); } else{ latest = *(stk->top); stk->top++; stk->count--; return latest; } } //出力 void print_stuck(stack *stk){ int i; for (i=0;i < stk->count;i++){ printf("%c",stk->data[SIZE-i-1]); } printf("\n"); }
main.c: In function 'main': main.c:36:15: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 36 | for(i=0;i<strlen(string);i++){ | ^~~~~~ main.c:6:1: note: include '<string.h>' or provide a declaration of 'strlen' 5 | #include <stdlib.h> +++ |+#include <string.h> 6 | //スタックに格納するデータの数 main.c:36:15: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 36 | for(i=0;i<strlen(string);i++){ | ^~~~~~ main.c:36:15: note: include '<string.h>' or provide a declaration of 'strlen' main.c:49:5: error: implicit declaration of function 'print_stack'; did you mean 'print_stuck'? [-Wimplicit-function-declaration] 49 | print_stack(&stk); | ^~~~~~~~~~~ | print_stuck
s229002942
p04030
C++
/* ex 9_1 series2 */ #include <stdio.h> #include <stdlib.h> #define SIZE 10 //条件 文字列を格納するスタックを定義、push,pop typedef struct stack { int size; int count; //現在格納されている文字数 char data[SIZE]; //データ内容そのもの char *top; //外部からのアクセス部はdata配列の一番後ろの番地のアドレスをさす } stack; void init_stack(stack *stk) { stk->count = 0; stk->size = SIZE; stk->top = &(stk->data[SIZE]); } void push(stack *stk, char data) { if (stk->count < stk->size) { //用意したstackの要領未満の時、入力文字をトップアドレスに追加する stk->top--; *(stk->top) = data; stk->count++; } } char pop(stack *stk) { char latest; if (stk->count > 0) { //文字が残っている時 latest = *(stk->top); stk->top++; stk->count--; return latest; } else { latest = '\0'; //文字が残っていない時null文字を返す } return latest; } void printout( stack stk) { // stackなので、再帰的に呼び出すことで正しい順にする。(直接呼び出すのは、stackとしての設計に反する) char out = pop(&stk); if (out) { // outがnull文字でない時 printout(stk); printf("%c", out); } } int main(void) { stack stk; init_stack(&stk); //stackの初期化 char inp = ' '; while (inp != '\n') { scanf("%c", &inp); if (inp == 'B') { //BackSpaceの時削除 pop(&stk); } else if (inp != '\n') { //最終文字でない時追加する push(&stk, inp); } } printout(stk); printf("\n"); return 0; }
a.cc:52:22: error: extended character   is not valid in an identifier 52 | init_stack(&stk); //stackの初期化 | ^ a.cc: In function 'int main()': a.cc:52:22: error: '\U00003000' was not declared in this scope 52 | init_stack(&stk); //stackの初期化 | ^~ a.cc:54:12: error: 'inp' was not declared in this scope; did you mean 'int'? 54 | while (inp != '\n') { | ^~~ | int
s448115736
p04030
C
/* ex9_1 YSK722 */ #include <stdio.h> #include <stdlib.h> //スタックに格納するデータの最大数 #define SIZE 11 //スタックの定義 typedef struct stack{ int size; int count; char data[SIZE]; char *top; } stack; //スタックの初期化 void initialize_stack(stack *stk){ stk->count = 0; stk->size = SIZE; stk->top = &(stk->data[SIZE]); } //データの追加 void push(stack *stk, char elem){ if (stk->count >= stk->size){ printf("Error: stack overflow. (x=%c)\n", elem); exit(1); } else{ stk->top--; *(stk->top) = elem; stk->count++; } } //データの取り出し char pop(stack *stk){ char latest; if (stk->count <= 0){ printf("Error: stack underflow.\n"); exit(1); } else{ latest = *(stk->top); stk->top++; stk->count--; return latest; } } int main(void){ stack stk; char text[SIZE], *ptr; int i = 0; scanf("%s", text); //スタックを初期化 initialize_stack(&stk); //スタックにデータを追加 for (i = 0; text[i] != '\0'; i++){ if (text[i] == 'B'){ pop(&stk); } else{ push(&stk, text[i]); } } ptr = stk->top; ptr += stk->count - 1; for (i = 0; i < stk->count; i++){ printf("%c", *ptr--); } printf("\n"); return 0; }
main.c: In function 'main': main.c:68:14: error: invalid type argument of '->' (have 'stack') 68 | ptr = stk->top; | ^~ main.c:69:15: error: invalid type argument of '->' (have 'stack') 69 | ptr += stk->count - 1; | ^~ main.c:70:24: error: invalid type argument of '->' (have 'stack') 70 | for (i = 0; i < stk->count; i++){ | ^~
s692093458
p04030
C++
#include<iostream> using namespace std; int main() { string s1,s2; cin>>s1; for(int i=0;i<n;i++) { if(s1[i]=='0'||s[i]=='1') s2.push_back(s[i]); if(s[i]=='B'){ s2.pop_back(); i=i-1;} } cout<<s2[s2.length()-1]; }
a.cc: In function 'int main()': a.cc:7:17: error: 'n' was not declared in this scope 7 | for(int i=0;i<n;i++) | ^ a.cc:9:20: error: 's' was not declared in this scope 9 | if(s1[i]=='0'||s[i]=='1') | ^ a.cc:11:8: error: 's' was not declared in this scope 11 | if(s[i]=='B'){ | ^
s790279178
p04030
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String S = sc.next(); String ans = ""; for(int i=0; i<S.length(); i++){ String str = String.valueOf(S.charAt(i)); if(str.equals("0")){ ans += "0"; }else if(str.equals("1")){ ans += "1"; }else { if(!(ans.isEmpty())){ ans = ans.subStrings(0, ans.length()-1); } } } System.out.println(ans); } }
Main.java:17: error: cannot find symbol ans = ans.subStrings(0, ans.length()-1); ^ symbol: method subStrings(int,int) location: variable ans of type String 1 error
s149424397
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { vector<char> a; string s; cin >> s; for ( char c:s ) { if ( c=='B'&&asize() ) a.pop_back(); else a.push_back(c); } for ( char c:a ) { cout << c; } return 0; }
a.cc: In function 'int main()': a.cc:9:18: error: 'asize' was not declared in this scope; did you mean 'dysize'? 9 | if ( c=='B'&&asize() ) a.pop_back(); | ^~~~~ | dysize
s447220238
p04030
C++
#include <algorithm> #include <bitset> #include <tuple> #include <cstdint> #include <cstdio> #include <cctype> #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <limits> #include <map> #include <memory> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ArraySizeOf(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i,n) for(int i=1;i<n;i++) #define int long long #define rev(i,n) for(int i=n-1;i>=0;i--) #define _GLIBCXX_DEBUG int INF = 1e9+7; unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1) { unsigned day; if(dow < dow1) dow += 7; day = dow - dow1; day += 7 * n - 6; return day; } unsigned DayToWeekNumber(unsigned day) { return (day - 1) / 7 + 1; } unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0) { return (dow0 + 35 + day - day0) % 7; } using namespace std; signed main(){ string S; cin>>S; queue <int>A; rep(i,S.size()){ if(S.at(i)=='0')A.push(0); else if(S.at(i)=='1')A.push(1); else A.pop(); } cout<<A<<endl; }
a.cc: In function 'int main()': a.cc:68:7: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::queue<long long int>') 68 | cout<<A<<endl; | ~~~~^~~ | | | | | std::queue<long long int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from a.cc:14: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::queue<long long int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) |
s004118921
p04030
C++
#include <algorithm> #include <bitset> #include <tuple> #include <cstdint> #include <cstdio> #include <cctype> #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <cassert> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <limits> #include <map> #include <memory> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define ArraySizeOf(array) (sizeof(array) / sizeof(array[0])) #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define REP(i,n) for(int i=1;i<n;i++) #define int long long #define rev(i,n) for(int i=n-1;i>=0;i--) #define _GLIBCXX_DEBUG int INF = 1e9+7; unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1) { unsigned day; if(dow < dow1) dow += 7; day = dow - dow1; day += 7 * n - 6; return day; } unsigned DayToWeekNumber(unsigned day) { return (day - 1) / 7 + 1; } unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0) { return (dow0 + 35 + day - day0) % 7; } using namespace std; signed main(){ string S; cin>>S; queue A; rep(i,S.size()){ if(S.at(i)=='0')A.push(0); else if(S.at(i)=='1')A.push(1); else A.pop(); } cout<<A<<endl; }
a.cc: In function 'int main()': a.cc:62:9: error: class template argument deduction failed: 62 | queue A; | ^ a.cc:62:9: error: no matching function for call to 'queue()' In file included from /usr/include/c++/14/queue:66, from a.cc:26: /usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(std::queue<_Tp, _Seq>&&, const _Alloc&)-> std::queue<_Tp, _Sequence>' 195 | queue(queue&& __q, const _Alloc& __a) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:195:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const std::queue<_Tp, _Seq>&, const _Alloc&)-> std::queue<_Tp, _Sequence>' 191 | queue(const queue& __q, const _Alloc& __a) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:191:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(_Sequence&&, const _Alloc&)-> std::queue<_Tp, _Sequence>' 187 | queue(_Sequence&& __c, const _Alloc& __a) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:187:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Sequence&, const _Alloc&)-> std::queue<_Tp, _Sequence>' 183 | queue(const _Sequence& __c, const _Alloc& __a) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:183:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate: 'template<class _Tp, class _Sequence, class _Alloc, class _Requires> queue(const _Alloc&)-> std::queue<_Tp, _Sequence>' 179 | queue(const _Alloc& __a) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:179:9: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate: 'template<class _Tp, class _Sequence> queue(_Sequence&&)-> std::queue<_Tp, _Sequence>' 174 | queue(_Sequence&& __c) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:174:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate: 'template<class _Tp, class _Sequence> queue(const _Sequence&)-> std::queue<_Tp, _Sequence>' 170 | queue(const _Sequence& __c) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:170:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:166:9: note: candidate: 'template<class _Tp, class _Sequence, class _Seq, class _Requires> queue()-> std::queue<_Tp, _Sequence>' 166 | queue() | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:166:9: note: template argument deduction/substitution failed: a.cc:62:9: note: couldn't deduce template parameter '_Tp' 62 | queue A; | ^ /usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate: 'template<class _Tp, class _Sequence> queue(std::queue<_Tp, _Sequence>)-> std::queue<_Tp, _Sequence>' 96 | class queue | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:96:11: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_queue.h:344:5: note: candidate: 'template<class _Container, class _Allocator, class> std::queue(_Container, _Allocator)-> queue<typename _Container::value_type, _Container>' 344 | queue(_Container, _Allocator) | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:344:5: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_queue.h:340:5: note: candidate: 'template<class _Container, class> std::queue(_Container)-> queue<typename _Container::value_type, _Container>' 340 | queue(_Container) -> queue<typename _Container::value_type, _Container>; | ^~~~~ /usr/include/c++/14/bits/stl_queue.h:340:5: note: candidate expects 1 argument, 0 provided
s972397217
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string e = ""; for(int i = 0; i < s.size(); i++) { if(s[i] == '0') { e.emplace_back('0'); } else if(s[i] == '1') { e.emplace_back('1'); } else if (s[i] == 'B' && e.size() > 0) { e.pop_back(); } } cout << e << endl; }
a.cc: In function 'int main()': a.cc:11:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back' 11 | e.emplace_back('0'); | ^~~~~~~~~~~~ a.cc:14:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back' 14 | e.emplace_back('1'); | ^~~~~~~~~~~~
s101178132
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string e = ""; for(int i = 0; i < s.size(); i++) { if(s[i] == '0') { e.push_back('0'); } else if(s[i] == '1') { e.emplace_back('1'); } else if (s[i] == 'B' && ans.size() > 0) { e.pop_back(); } } cout << e << endl; }
a.cc: In function 'int main()': a.cc:14:9: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'emplace_back' 14 | e.emplace_back('1'); | ^~~~~~~~~~~~ a.cc:16:29: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | else if (s[i] == 'B' && ans.size() > 0) { | ^~~ | abs
s661424007
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; vector<char> v; for (char c : s) { switch (c) { case '0': v.push_back('0'); break; case '1': v.push_back('1'); break; case 'B': if (v.size() != 0) v.pop_back(); break; } } string ans; for (char c : v) ans += c;
a.cc: In function 'int main()': a.cc:24:31: error: expected '}' at end of input 24 | for (char c : v) ans += c; | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s590858041
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { char s[1000000]; char v[1000000]; long long i=0; long long l=0; cin>>s; l=s.size(); for(i=0;i<l;i++) { if(s[i]=='0') { v.push('0'); l++; } else if(s[i]=='1') { v.push('1'); l++; } else if(s[i]=='B') { v.pop(); l--; } } cout<<v; return 0; }
a.cc: In function 'int main()': a.cc:11:6: error: request for member 'size' in 's', which is of non-class type 'char [1000000]' 11 | l=s.size(); | ^~~~ a.cc:16:9: error: request for member 'push' in 'v', which is of non-class type 'char [1000000]' 16 | v.push('0'); | ^~~~ a.cc:21:9: error: request for member 'push' in 'v', which is of non-class type 'char [1000000]' 21 | v.push('1'); | ^~~~ a.cc:26:9: error: request for member 'pop' in 'v', which is of non-class type 'char [1000000]' 26 | v.pop(); | ^~~
s480761173
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { char s[1000000]; char v[1000000]; long long i=0; long long l=0; cin>>s; l=s.size(); for(i=0;i<l;i++) { if(s[i]=='0') { v.push_back('0'); l++; } else if(s[i]=='1') { v.push_back('1'); l++; } else if(s[i]=='B') { v.pop_back(); l--; } } cout<<v; return 0; }
a.cc: In function 'int main()': a.cc:11:6: error: request for member 'size' in 's', which is of non-class type 'char [1000000]' 11 | l=s.size(); | ^~~~ a.cc:16:9: error: request for member 'push_back' in 'v', which is of non-class type 'char [1000000]' 16 | v.push_back('0'); | ^~~~~~~~~ a.cc:21:9: error: request for member 'push_back' in 'v', which is of non-class type 'char [1000000]' 21 | v.push_back('1'); | ^~~~~~~~~ a.cc:27:9: error: request for member 'pop_back' in 'v', which is of non-class type 'char [1000000]' 27 | v.pop_back(); | ^~~~~~~~
s152289378
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; int i=0; int l=0; while(cin>>s[i]) { l++; i++; } for(i=0;i<l;i++) { if(s[i]=="0") { s.push_back('0'); l++; } else if(s[i]=="1") { s.push_back('1'); l++; } else if(s[i]=="B") { s.pop_back(); l--; } } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:18:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 18 | if(s[i]=="0") a.cc:23:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 23 | else if(s[i]=="1") a.cc:28:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 28 | else if(s[i]=="B")
s086663613
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<string> s; int i=0; int l=0; while(cin>>s[i]) { l++; i++; } for(i=0;i<l;i++) { if(s[i]=="0") { s.push_back('0'); l++; } else if(s[i]=="1") { s.push_back('1'); l++; } else if(s[i]=="B") { s.pop_back(); l--; } } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:20:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(char)' 20 | s.push_back('0'); | ~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'char' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'char' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:25:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(char)' 25 | s.push_back('1'); | ~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'char' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'char' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:35:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 35 | cout<<s; | ~~~~^~~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic
s438213539
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<string> s; int i=0; int l=0; while(cin>>s[i]) { l++; i++; } for(i=0;i<l;i++) { if(s[i]=="0") { s.push_back(0); l++; } else if(s[i]=="1") { s.push_back(1); l++; } else if(s[i]=="B") { s.pop_back(); l--; } } for(i=0;i<l;i++) { cout<<s[i]; } return 0; }
a.cc: In function 'int main()': a.cc:25:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(int)' 25 | s.push_back(1); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~
s356967009
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<string> s; int i=0; int l=0; while(cin>>s[i]) { l++; i++; } for(i=0;i<l;i++) { if(s[i]=='0') { s.push_back('0'); l++; } else if(s[i]=='1') { s.push_back('1'); l++; } else if(s[i]=='B') { s.pop_back(); l--; } } for(i=0;i<l;i++) { cout<<s[i]; } return 0; }
a.cc: In function 'int main()': a.cc:18:12: error: no match for 'operator==' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} and 'char') 18 | if(s[i]=='0') In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:18:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:18:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:18:14: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | if(s[i]=='0') | ^~~ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 18 | if(s[i]=='0') | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h: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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 18 | if(s[i]=='0') | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if(s[i]=='0') | ^~~ /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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 18 | if(s[i]=='0') | ^~~ /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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if(s[i]=='0') | ^~~ /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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 18 | if(s[i]=='0') | ^~~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /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:18:14: note: '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 18 | if(s[i]=='0') | ^~~ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template
s924843509
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<int> s; int i=0; while(cin>>s[i]) { l++; i++; } int l=s.size(); for(i=0;i<l;i++) { if(s[i]==0) { s.push_back(0); } else if(s[i]==1) { s.push_back(1); } else if(s[i]=='B') { s.pop_back(); } } for(i=0;i<v.size();i++) { cout<<s[i]; } return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: 'l' was not declared in this scope 9 | l++; | ^ a.cc:29:13: error: 'v' was not declared in this scope 29 | for(i=0;i<v.size();i++) | ^
s159493849
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<int> s; int i; for(i=0;i!='\0';i++) { cin>>s[i]; } int l=s.size(); for(i=0;i<l;i++) { if(s[i]==0) { s.push_back(0); } else if(s[i]==1) { s.push_back(1); } else if(s[i]=='B') { s.pop_back(); } } for(i=0;i<v.size();i++) { cout<<s[i]; } return 0; }
a.cc: In function 'int main()': a.cc:28:13: error: 'v' was not declared in this scope 28 | for(i=0;i<v.size();i++) | ^
s756588199
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<int> s; for(i=0;i!='\0';i++) { cin>>s[i]; } int i; int l=s.size(); for(i=0;i<l;i++) { if(s[i]==0) { s.push_back(0); } else if(s[i]==1) { s.push_back(1); } else if(s[i]=='B') { s.pop_back(); } } return 0; }
a.cc: In function 'int main()': a.cc:6:7: error: 'i' was not declared in this scope 6 | for(i=0;i!='\0';i++) | ^
s305942362
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { vector<int> s; cin>>s; int i; int l=s.size(); for(i=0;i<l;i++) { if(s[i]==0) { s.push_back(0); } else if(s[i]==1) { s.push_back(1); } else if(s[i]=='B') { s.pop_back(); } } return 0; }
a.cc: In function 'int main()': a.cc:6:6: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 6 | cin>>s; | ~~~^~~ | | | | | std::vector<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>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' 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::vector<int>' 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::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:131:5: note:
s605846734
p04030
C++
#include <bits/stdc++.h> #define REP(i, n) for(i = 0; i < n ; i++){} #define REPN(i, n) for(i = n-1; i > -1 ; i--}{} #define MOD 1000000007 using namespace std; typedef unsigned int ll; typedef long long ull; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin) ; freopen("output.txt", "w", stdout) ; #endif ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL) ; string str; cin >> str; int n = str.size(); int i = n; int count = 0; for(i = n-1;i>-1;i--){ if((str[i]=='B')&(i!=0)){ if(str[i-1]!='B'){for(int j = 1; j <= count; j++)str[i-j]!='B';i-=j;} else count++; } } i = 0; for(i;i<n;i++){ if(str[i]!='B')cout << str[i]; } cout << endl; }
a.cc: In function 'int main()': a.cc:23:83: error: 'j' was not declared in this scope 23 | if(str[i-1]!='B'){for(int j = 1; j <= count; j++)str[i-j]!='B';i-=j;} | ^
s988122960
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { #include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ll long long #define ld long double #define pb push_back #define w(t) int t;cin>>t;while(t--) int solve() { string s; cin >> s; ll N = s.size(); string ans = ""; for(int i=0;i<N;i++) { if (s.at(i) == '0') { ans += '0'; } else if (s.at(i) == '1') { ans += '1'; } else if (ans.size() != 0) { ans.pop_back(); } } cout << ans << endl; } int main() { IOS; {solve();} return 0; } }
a.cc: In function 'int main()': a.cc:12:14: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 12 | int solve() | ^~ a.cc:12:14: note: remove parentheses to default-initialize a variable 12 | int solve() | ^~ | -- a.cc:12:14: note: or replace parentheses with braces to value-initialize a variable a.cc:13:5: error: a function-definition is not allowed here before '{' token 13 | { | ^ a.cc:38:13: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 38 | int main() | ^~ a.cc:38:13: note: remove parentheses to default-initialize a variable 38 | int main() | ^~ | -- a.cc:38:13: note: or replace parentheses with braces to value-initialize a variable a.cc:39:5: error: a function-definition is not allowed here before '{' token 39 | { | ^
s872675072
p04030
C++
#include<iostream> using namespace std; int main(){ string s,result=""; cin >> s; for(int i=0; i<s.length(); i++){ char c = s[i]; switch(c){ case '0': result += c; break; case '1': result += c; break; case 'B': if(result.length()>0){ result = result.substr(0, result.length()-1); } break; } } cout << result << '\n' }
a.cc: In function 'int main()': a.cc:23:27: error: expected ';' before '}' token 23 | cout << result << '\n' | ^ | ; 24 | } | ~
s596860055
p04030
C++
#include<iostream> using namespace std; int main(){ string s,result=""; cin >> s; for(int i=0; i<s.length(); i++){ char c = s[i]; switch(c){ case '0': result += c; break; case '1': result += c; break; case 'B': if(result.length()>0){ result = result.substr(0, result.length()-1); } break; } } cout << result << '\n' }
a.cc: In function 'int main()': a.cc:23:27: error: expected ';' before '}' token 23 | cout << result << '\n' | ^ | ; 24 | } | ~
s436327128
p04030
C++
#include<iostream> using namespace std; int main(){ string s,result=""; cin >> s; for(int i=0; i<s.length(); i++){ char c = s[i]; switch(c){ case '0': case '1': result += c; break; case 'B': if(result.length()>0){ result = result.substr(0, result.length()-1); } break; } } cout << result << '\n' }
a.cc: In function 'int main()': a.cc:21:27: error: expected ';' before '}' token 21 | cout << result << '\n' | ^ | ; 22 | } | ~
s734786783
p04030
C++
#include<iostream> using namespace std; int main(){ string s,result=""; cin >> s; for(int i=0; i<s.length(); i++){ char c = s[i]; switch(c){ case '0': case '1': result += c; break; case 'B': if(result.length()>0){ result = result.substr(0, result.length()-1); } break; } } cout << result << '\n' }
a.cc: In function 'int main()': a.cc:21:27: error: expected ';' before '}' token 21 | cout << result << '\n' | ^ | ; 22 | } | ~
s948713093
p04030
C++
#include<iostream> using namepace std; int main(){ string s, result =" "; cin >> s; for(int i = 0; i < s.length(); i++){ char c = s[i]; switch(c){ case'0': result += '0'; break; case'1': result += '1'; break; case'B': if(result.length() > 0){ result = result.substr(0, result.length() - 1); } } } cout << result << '\n'; }
a.cc:2:7: error: expected nested-name-specifier before 'namepace' 2 | using namepace std; | ^~~~~~~~ a.cc: In function 'int main()': a.cc:4:3: error: 'string' was not declared in this scope 4 | string s, result =" "; | ^~~~~~ a.cc:4:3: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | 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:5:10: error: 's' was not declared in this scope 5 | cin >> s; | ^ a.cc:10:9: error: 'result' was not declared in this scope 10 | result += '0'; | ^~~~~~ a.cc:22:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 22 | cout << result << '\n'; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:22:11: error: 'result' was not declared in this scope 22 | cout << result << '\n'; | ^~~~~~
s291633447
p04030
C++
#include <iostream> using namespace std; int main () { string A; string str; cin >> str; for (int i = 0; i < str.length(); i ++){ if (str[i] == '0'){ A[i] = '0'; } else if (str[i] == '1'){ A[i] = '1'; } else if (str[i] == 'B'){ A[i - 1] = ""; } cout << A; } }
a.cc: In function 'int main()': a.cc:14:18: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 14 | A[i - 1] = ""; | ^~ | | | const char*
s526033781
p04030
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod=1000000007; const int MAX_N = 1000; // n の最大値 // nCk を取得 double nCk(int n, int k) { double res=1.0; for(int i=0; i<n; i++){ res*=0.5;} for(int i=0; i<k; i++){ res*=(double)(n-i); res/=(double)(k-i); } return res;} int main() { string s; cin>>s; ll n=s.size(); string ans; char q; for(ll i=0; i<n; i++){ if(s.at(i)=='0'){ ans+='0';} else if(s.at(i)=='1'){ ans+='1';} else if(ans.size()==0){ continue;} else{ q=ans.at(ans.size()-1); ans-=q;}} cout<<ans<<endl;}
a.cc: In function 'int main()': a.cc:34:4: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 34 | ans-=q;}} | ~~~^~~
s151190326
p04030
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod=1000000007; const int MAX_N = 1000; // n の最大値 // nCk を取得 double nCk(int n, int k) { double res=1.0; for(int i=0; i<n; i++){ res*=0.5;} for(int i=0; i<k; i++){ res*=(double)(n-i); res/=(double)(k-i); } return res;} int main() { string s; cin>>s; ll n=s.size(); string ans; string q; for(ll i=0; i<n; i++){ if(s.at(i)=='0'){ ans+='0';} else if(s.at(i)=='1'){ ans+='1';} else if(ans.size()==0){ continue;} else{ q=ans.at(ans.size()-1); ans-=q;}} cout<<ans<<endl;} cout<<ca<<endl;}
a.cc: In function 'int main()': a.cc:34:4: 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>'}) 34 | ans-=q;}} | ~~~^~~ a.cc: At global scope: a.cc:36:1: error: 'cout' does not name a type 36 | cout<<ca<<endl;} | ^~~~ a.cc:36:16: error: expected declaration before '}' token 36 | cout<<ca<<endl;} | ^
s572388147
p04030
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<int>>; const ll mod=1000000007; const int MAX_N = 1000; // n の最大値 // nCk を取得 double nCk(int n, int k) { double res=1.0; for(int i=0; i<n; i++){ res*=0.5;} for(int i=0; i<k; i++){ res*=(double)(n-i); res/=(double)(k-i); } return res;} int main() { string s; cin>>s; ll n=s.size(); string ans; for(ll i=0; i<n; i++){ if(s.at(i)=='0'){ ans+='0';} else if(s.at(i)=='1'){ ans+='1';} else if(ans.size()==0){ continue;} else{ ans-=ans.at(ans.size()-1);}} cout<<ans<<endl;} cout<<ca<<endl;}
a.cc: In function 'int main()': a.cc:32:4: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}) 32 | ans-=ans.at(ans.size()-1);}} | ~~~^~~~~~~~~~~~~~~~~~~~~~ a.cc: At global scope: a.cc:34:1: error: 'cout' does not name a type 34 | cout<<ca<<endl;} | ^~~~ a.cc:34:16: error: expected declaration before '}' token 34 | cout<<ca<<endl;} | ^
s961260960
p04030
Java
import java.util.Scanner; public class UnhappyHacking { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scn = new Scanner(System.in); String s = scn.nextLine(); if (s.isEmpty()) { System.out.println(""); } else { String ans = ""; boolean check = true; for (int i = 0; i < s.length(); i++) { char ch1 = s.charAt(i); if (i > 0 && ch1 == 'B') { if (!ans.isEmpty()) ans = ans.substring(0, ans.length() - 1); if (ans.isEmpty()) { ans = ""; } } else { if (ch1 != 'B') ans += ch1; } } if (check) { System.out.println(ans); } } } }
Main.java:3: error: class UnhappyHacking is public, should be declared in a file named UnhappyHacking.java public class UnhappyHacking { ^ 1 error
s796556945
p04030
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; const long long INF=1e9+5; const string alp="abcdefghijklmnopqrstuvwxyg"; //26 const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYG"; typedef long long ll; int main() { string s; cin>>s; vector<char> vec; for(int i=0;i<s.size();i++){ if(s[i]=='0'){ vec.push_back('0'); } else if(s[i]=='1'){ vec.push_back('1'); } else{ if(!vec.empty()){ vec.pop(); } } } string ans; for(int i=0;i<vec.size();i++){ ans+=vec.at(i); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:23:13: error: 'class std::vector<char>' has no member named 'pop' 23 | vec.pop(); | ^~~
s242279824
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string S,T; cin >> S; for(int i=0;i<S.size();i++){ if(S.at(i)=='0'){ T.push_back('0'); } else if(S.at(i)=='1'){ T.push_back('1'); } else if(T.size()!=0){ T.pop_back(); } } cout << T << endl;
a.cc: In function 'int main()': a.cc:18:21: error: expected '}' at end of input 18 | cout << T << endl; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s151542101
p04030
C++
#include<iostream> #include<algorithm> #include<cmath> #include<vector> #include<map> #include<set> #include<string> #include<queue> #include<stack> #include<iomanip> #define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; #define debug(x) cout<<(#x)<<"="<<(x)<<", "; #define debug1(x) debug(x) cout<<'\n'; #define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n'; #define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n'; #define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n'; #define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n'; #define fcout cout<<fixed<<setprecision(15) #define repp(i,j,k) for(int i=j; i<k; ++i) #define rep(i,j) repp(i,0,j) #define rrep(i,j,k) for(int i=j; i>=k; --i) #define all(x) (x).begin(), (x).end() #define sort(x) sort(x.begin(), x.end()) #define lb(x,val) lower_bound(x.begin(), x.end(), val) #define ub(x,val) upper_bound(x.begin(), x.end(), val) #define pb(x) emplace_back(x); typedef long long int lli; typedef pair<int,int> pii; typedef pair<lli,lli> pll; typedef vector<int> vi; typedef vector<lli> vl; typedef tuple<int, int, lli> tiil; //const lli M=998244353ll; const lli M=1000000007ll; const double D=1.0; int main(){ fast_io string s; cin>>s; reverse(all(s)); int b=0; vector<string> p; rep(i,s.size()){ if(s[i]=='B') b++; else if(b>0) b--; else p.pb(s[i]); } reverse(all(p)); rep(i,p.size()){ cout<<p[i]; } return 0; }
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/c++allocator.h:33, from /usr/include/c++/14/bits/allocator.h:46, 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, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>]': /usr/include/c++/14/bits/alloc_traits.h:575:17: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]' 575 | __a.construct(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:117:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&]' 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:53:10: required from here 31 | #define pb(x) emplace_back(x); | ^ /usr/include/c++/14/bits/new_allocator.h:191:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(char&)' 191 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/move.h:37, from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>]' 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/bits/alloc_traits.h:575:17: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]' 575 | __a.construct(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:117:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&]' 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:53:10: required from here 31 | #define pb(x) emplace_back(x); | ^ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>]': /usr/include/c++/14/bits/alloc_traits.h:575:17: required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::__cxx11::basic_string<char>; _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; allocator_type = std::allocator<std::__cxx11::basic_string<char> >]' 575 | __a.construct(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:117:30: required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {char&}; _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&]' 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:53:10: required from here 31 | #define pb(x) emplace_back(x); | ^ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/new_allocator.h:191:11: note: cannot convert 'std::forward<char&>((* & __args#0))' (type 'char') to type 'const char*' 191 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Tr
s809117898
p04030
C++
#include <bits/stdc++.h> #include <math.h> #define rep(i,n) for (int i=0;i < (n); ++i) #define ALL(x) (x).begin(), (x).end() using namespace std; using ll = long long; int main() { stack<char> s; string S,ans=""; cin >> S; rep(i,S.size()){ if(S[i]=='B'&&ans.size()!=0){ ans.back() = ""; } else { ans += S[i]; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:26: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 14 | ans.back() = ""; | ^~ | | | const char*
s777786032
p04030
Java
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); String ans = ""; for (int i=0;i<str.length();i++) { char c = str.charAt(i); if (c=='0') ans = ans+'0'; else if (c=='1') ans = ans+'1'; else if (c=='B') { if (str.length()==0) continue; else str = str.substring(0,str.length()); } } System.out.print(res); } }
Main.java:2: error: class Solution is public, should be declared in a file named Solution.java public class Solution ^ Main.java:26: error: cannot find symbol System.out.print(res); ^ symbol: variable res location: class Solution 2 errors
s926176567
p04030
C++
#include <stdio.h> #include <cstring> char s[11]; char result[11]; int main() { scanf("%s",s); for (int i=0;i<strlen(s);i++) { char c = s[i]; if (c=='1') result[i] = '1'; else if (c=='0') result[i] = '0'; else i=max(0,i--); } printf("%s",result); } int max(int x, int y) { if (x>=y) return x else return y; }
a.cc: In function 'int main()': a.cc:18:27: error: 'max' was not declared in this scope 18 | i=max(0,i--); | ^~~ a.cc: In function 'int max(int, int)': a.cc:28:25: error: expected ';' before 'else' 28 | return x | ^ | ; 29 | else | ~~~~
s920984339
p04030
C++
#include <stdio.h> #include <cstring> char s[11]; char result[11]; int main() { scanf("%s",s); for (int i=0;i<strlen(s);i++) { char c = s[i]; if (c=='1') result[i] = '1'; else if (c=='0') result[i] = '0'; else i=max(0,i--); } printf("%s",result);
a.cc: In function 'int main()': a.cc:18:27: error: 'max' was not declared in this scope 18 | i=max(0,i--); | ^~~ a.cc:21:29: error: expected '}' at end of input 21 | printf("%s",result); | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s481913449
p04030
C++
using namespace std; int main() { string input; vector<int> output(0); cin >> input; for (int i = 0; i < input.size(); i++) { switch (input.at(i)) { case '0': output.push_back(0); break; case '1': output.push_back(1); break; case 'B': if (output.empty()); else output.pop_back(); break; } } for (int i : output) cout << i; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'string' was not declared in this scope 6 | string input; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | a.cc:7:9: error: 'vector' was not declared in this scope 7 | vector<int> output(0); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | a.cc:7:16: error: expected primary-expression before 'int' 7 | vector<int> output(0); | ^~~ a.cc:8:9: error: 'cin' was not declared in this scope 8 | cin >> input; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | a.cc:8:16: error: 'input' was not declared in this scope; did you mean 'int'? 8 | cin >> input; | ^~~~~ | int a.cc:13:33: error: 'output' was not declared in this scope 13 | case '0': output.push_back(0); break; | ^~~~~~ a.cc:19:22: error: 'output' was not declared in this scope 19 | for (int i : output) | ^~~~~~ a.cc:20:17: error: 'cout' was not declared in this scope 20 | cout << i; | ^~~~ a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s040156307
p04030
C++
using namespace std; int main() { string input; vector<int> output(0); cin >> input; for (int i = 0; i < input.size(); i++) { switch (input.at(i)) { case '0': output.push_back(0); break; case '1': output.push_back(1); break; case 'B': output.pop_back(); break; } } for (int i : output) cout << i; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'string' was not declared in this scope 6 | string input; | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | a.cc:7:9: error: 'vector' was not declared in this scope 7 | vector<int> output(0); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | a.cc:7:16: error: expected primary-expression before 'int' 7 | vector<int> output(0); | ^~~ a.cc:8:9: error: 'cin' was not declared in this scope 8 | cin >> input; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | a.cc:8:16: error: 'input' was not declared in this scope; did you mean 'int'? 8 | cin >> input; | ^~~~~ | int a.cc:13:33: error: 'output' was not declared in this scope 13 | case '0': output.push_back(0); break; | ^~~~~~ a.cc:18:22: error: 'output' was not declared in this scope 18 | for (int i : output) | ^~~~~~ a.cc:19:17: error: 'cout' was not declared in this scope 19 | cout << i; | ^~~~ a.cc:19:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s320686091
p04030
C++
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define int long long void solve() { string s; cin >> s; for(char c: s) { if(c == 'B') { ans = ans.substr(0, ans.length()-1); } else { ans += c; } } cout << ans << endl; } int32_t main() { IOS; solve(); return 0; }
a.cc: In function 'void solve()': a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans = ans.substr(0, ans.length()-1); | ^~~ | abs a.cc:16:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | ans += c; | ^~~ | abs a.cc:19:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 19 | cout << ans << endl; | ^~~ | abs
s556109393
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(s,at(i) == '1'){ S = S + '1'; } else{ S.erase(S.size()--); } } cout << S << endl; }
a.cc: In function 'int main()': a.cc:13:15: error: 'at' was not declared in this scope 13 | else if(s,at(i) == '1'){ | ^~ a.cc:18:21: error: lvalue required as decrement operand 18 | S.erase(S.size()--); | ~~~~~~^~
s359834604
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(s,at(i) == '1'){ S = S + '1'; } else{ S.erase(S.size()--) = ''; } } cout << S << endl; }
a.cc:18:29: error: empty character constant 18 | S.erase(S.size()--) = ''; | ^~ a.cc: In function 'int main()': a.cc:13:15: error: 'at' was not declared in this scope 13 | else if(s,at(i) == '1'){ | ^~ a.cc:18:21: error: lvalue required as decrement operand 18 | S.erase(S.size()--) = ''; | ~~~~~~^~
s743794504
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(s,at(i) == '1'){ S = S + '1'; } else{ S.at(S.size()--) = ''; } } cout << S << endl; }
a.cc:18:26: error: empty character constant 18 | S.at(S.size()--) = ''; | ^~ a.cc: In function 'int main()': a.cc:13:15: error: 'at' was not declared in this scope 13 | else if(s,at(i) == '1'){ | ^~ a.cc:18:18: error: lvalue required as decrement operand 18 | S.at(S.size()--) = ''; | ~~~~~~^~
s175172774
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(s,at(i) == '1'){ S = S + '1'; } else{ S.end() = ''; } } cout << S << endl; }
a.cc:18:17: error: empty character constant 18 | S.end() = ''; | ^~ a.cc: In function 'int main()': a.cc:13:15: error: 'at' was not declared in this scope 13 | else if(s,at(i) == '1'){ | ^~ a.cc:18:17: error: no match for 'operator=' (operand types are 'std::__cxx11::basic_string<char>::iterator' and 'char') 18 | S.end() = ''; | ^~ 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:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >& __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::operator=(const __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&)' 1038 | class __normal_iterator | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: no known conversion for argument 1 from 'char' to 'const __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&' /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >& __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::operator=(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&&)' /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: no known conversion for argument 1 from 'char' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&&'
s940129592
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(){ S = S + '1'; } else{ S.end() = ''; } } cout << S << endl; }
a.cc:18:17: error: empty character constant 18 | S.end() = ''; | ^~ a.cc: In function 'int main()': a.cc:13:13: error: expected primary-expression before ')' token 13 | else if(){ | ^ a.cc:18:17: error: no match for 'operator=' (operand types are 'std::__cxx11::basic_string<char>::iterator' and 'char') 18 | S.end() = ''; | ^~ 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:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >& __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::operator=(const __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&)' 1038 | class __normal_iterator | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: no known conversion for argument 1 from 'char' to 'const __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&' /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: candidate: 'constexpr __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >& __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::operator=(__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&&)' /usr/include/c++/14/bits/stl_iterator.h:1038:11: note: no known conversion for argument 1 from 'char' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >&&'
s110353824
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,S; cin >> s ; for(int i=0;i<s.size();i++){ if(s.at(i) == '0'){ S = S + '0'; } else if(){ S = S + '1'; } else{ S.end() == ''; } } cout << S << endl; }
a.cc:18:18: error: empty character constant 18 | S.end() == ''; | ^~ a.cc: In function 'int main()': a.cc:13:13: error: expected primary-expression before ')' token 13 | else if(){ | ^ a.cc:18:15: error: no match for 'operator==' (operand types are 'std::__cxx11::basic_string<char>::iterator' and 'char') 18 | S.end() == ''; | ~~~~~~~ ^~ ~~ | | | | | char | std::__cxx11::basic_string<char>::iterator In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:18:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:18:18: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::__cxx11::sub_match<_BiIter>' 18 | S.end() == ''; | ^~ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 18 | S.end() == ''; | ^~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h: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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::pair<_T1, _T2>' 18 | S.end() == ''; | ^~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>' 18 | S.end() == ''; | ^~ /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::reverse_iterator<_Iterator>' 18 | S.end() == ''; | ^~ /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::move_iterator<_IteratorL>' 18 | S.end() == ''; | ^~ /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::move_iterator<_IteratorL>' 18 | S.end() == ''; | ^~ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::fpos<_StateT>' 18 | S.end() == ''; | ^~ In file included from /usr/include/c++/14/string:43: /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:18:18: note: 'std::__cxx11::basic_string<char>::iterator' is not derived from 'const std::allocator<_CharT>' 18 | S.end() == ''; | ^~ 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/s
s843783478
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; vector<string>n; cin>>s; for(int i=1;i<=s.size();i++){ if(s[i]=='0'){ n.push_back('0'); } else if(s[i]=='1'){ n.push_back('1'); } else{ n.pop_back(); } } cout<<n<<endl; }
a.cc: In function 'int main()': a.cc:10:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(char)' 10 | n.push_back('0'); | ~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'char' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'char' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:13:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(char)' 13 | n.push_back('1'); | ~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'char' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'char' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:19:7: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 19 | cout<<n<<endl; | ~~~~^~~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ost
s288715847
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; vector<string>n; cin>>s; for(int i=1;i<=s.size();i++){ if(s[i]=='0'){ n.push_back("0"); } else if(s[i]=='1'){ n.push_back("1"); } else{ n.pop_back(); } } cout<<n<<endl; }
a.cc: In function 'int main()': a.cc:19:7: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 19 | cout<<n<<endl; | ~~~~^~~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostrea
s380010075
p04030
C++
#include<bits/stdc++.h> using namespace std; int main(){ string s; vector<string>n; cin>>s; for(int i=1;i<=s.size();i++){ if(s[i]=='0'){ n.push_back(0); } else if(s[i]=='1'){ n.push_back(1); } else{ n.pop_back(); } } cout<<n<<endl; }
a.cc: In function 'int main()': a.cc:13:18: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::push_back(int)' 13 | n.push_back(1); | ~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1283 | push_back(const value_type& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1283:35: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::__cxx11::basic_string<char> >::value_type&' {aka 'const std::__cxx11::basic_string<char>&'} 1283 | push_back(const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; value_type = std::__cxx11::basic_string<char>]' 1300 | push_back(value_type&& __x) | ^~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1300:30: note: no known conversion for argument 1 from 'int' to 'std::vector<std::__cxx11::basic_string<char> >::value_type&&' {aka 'std::__cxx11::basic_string<char>&&'} 1300 | push_back(value_type&& __x) | ~~~~~~~~~~~~~^~~ a.cc:19:7: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 19 | cout<<n<<endl; | ~~~~^~~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235
s061601204
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ string A, B; cin >> A; for (int i=0; i<10; i++){ if (A.at(i)=='0'){ B+="0"; } else if(A.at(i)=='1'){ B+="1"; } else if(A.at(i)=='B'){ if (B=="0"){ continue; } else { B-=B.at(i-1); } } } }
a.cc: In function 'int main()': a.cc:19:10: error: no match for 'operator-=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}) 19 | B-=B.at(i-1); | ~^~~~~~~~~~~
s708836682
p04030
C
# include "stdio.h" int main(){ char s[11],a[11]; scanf("%s",s); int c=0; for(i=0;i<11;i++) a[i]='\0'; for(int i=0;i<10;i++){ if(s[i]!='B'){ a[c]=s[i]; c++; }else{ if(c!=0) c--; a[c]='\0'; } } printf("%s\n",a); }
main.c: In function 'main': main.c:7:9: error: 'i' undeclared (first use in this function) 7 | for(i=0;i<11;i++) | ^ main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
s252994845
p04030
C++
#include<bits/stdc++.h> using namespace std; int main() { string a; cin>>a; for (int i=0;i<a.size();i++) { if(s[i]=='0') ans[i]='0'; else if(s[i]=='1') ans[i]='1'; else ans[i-1]=""; } for(i=0;i<s.size();i++) cout<<ans[i]; return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: 's' was not declared in this scope 9 | if(s[i]=='0') | ^ a.cc:10:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans[i]='0'; | ^~~ | abs a.cc:12:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans[i]='1'; | ^~~ | abs a.cc:14:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans[i-1]=""; | ^~~ | abs a.cc:16:13: error: 'i' was not declared in this scope 16 | for(i=0;i<s.size();i++) | ^ a.cc:16:19: error: 's' was not declared in this scope 16 | for(i=0;i<s.size();i++) | ^ a.cc:17:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | cout<<ans[i]; | ^~~ | abs
s117373247
p04030
C++
#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; string ans = ""; for (int i=0; i<s.length(); i++){ if (s[i] == '1'){ ans.push_back("1"); } else if (s[i] == '0'){ ans.push_back("0"); } else{ if (!s.empty()){ ans.pop_back(); } } } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:14:31: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 14 | ans.push_back("1"); | ^~~ | | | const char* In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1572:24: note: initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1572 | push_back(_CharT __c) | ~~~~~~~^~~ a.cc:17:23: error: invalid conversion from 'const char*' to 'char' [-fpermissive] 17 | ans.push_back("0"); | ^~~ | | | const char* /usr/include/c++/14/bits/basic_string.h:1572:24: note: initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1572 | push_back(_CharT __c) | ~~~~~~~^~~
s785475477
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string ans; for (int i = 0; i < s.size(); i++) { if (s[i] == '0') { ans.push_back('0'); } else if (s[i] == '1') { ans.push_back('1'); } else { if (ans.size != 0) { ans.pop_back(); } } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:19:33: 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 '()' ?) 19 | if (ans.size != 0) { | ~~~~^~~~ | ()
s125709569
p04030
C++
wakaranannda
a.cc:1:1: error: 'wakaranannda' does not name a type 1 | wakaranannda | ^~~~~~~~~~~~
s952561488
p04030
C++
#include <bits/stdc++.h> using namespace std; int main() { string s,t; cin >> s; for(int i=0;i<s.size();i++){ if(s.at(i)==B){ if(t!=""){ t.erace(-1); } }else{ t+=s.at(i); } } cout << t << endl; }
a.cc: In function 'int main()': a.cc:10:17: error: 'B' was not declared in this scope 10 | if(s.at(i)==B){ | ^ a.cc:12:11: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'erace'; did you mean 'erase'? 12 | t.erace(-1); | ^~~~~ | erase
s372370368
p04030
C++
#include<iostream> using namespace std; int main() { string commands; cin>>commands; string output=""; for(i=0;i<commands.length();i++) { if(commands[i]!='B') output.push_back(commands[i]); else output.pop_back(); } cout<<output; return 0; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<commands.length();i++) | ^
s424134204
p04030
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i=0;i<(n);i++) #define adrep(i,s,n) for (int i=(s);i<(n);i++) using namespace std; typedef long long ll; int main(){ string s; cin>>s; vector<int> v; rep(i,s.length()){ if(s[i]=='0')v.push_back(0); else if(s[i]=='1')v.push_back(1); else if(!v.empty())v.pop_back(); } cout<<v<<endl; }
a.cc: In function 'int main()': a.cc:22:7: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>') 22 | cout<<v<<endl; | ~~~~^~~ | | | | | std::vector<int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, 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/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/includ
s007074849
p04030
C++
#include <iostream> //#include <string> using namespace std; int main() { char str[10] = {0}; cin >> str; uint32_t i = 0; while (1) { switch (str[i]) { case '\0': printf("%s\n", str); return 0; case 'B': if (i == 0) { memmove(&str[i], &str[i + 1], 9); } else { memmove(&str[i - 1], &str[i + 1], 10 - i - 1); i--; } break; default: i++; break; } } return 0; // std::cout << "Hello World!\n"; }
a.cc: In function 'int main()': a.cc:11:9: error: 'uint32_t' was not declared in this scope 11 | uint32_t i = 0; | ^~~~~~~~ a.cc:2:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 1 | #include <iostream> +++ |+#include <cstdint> 2 | a.cc:14:29: error: 'i' was not declared in this scope 14 | switch (str[i]) { | ^ a.cc:21:33: error: 'memmove' was not declared in this scope 21 | memmove(&str[i], &str[i + 1], 9); | ^~~~~~~ a.cc:2:1: note: 'memmove' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | a.cc:24:33: error: 'memmove' was not declared in this scope 24 | memmove(&str[i - 1], &str[i + 1], 10 - i - 1); | ^~~~~~~ a.cc:24:33: note: 'memmove' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s522567296
p04030
C++
int main(int argc, const char * argv[]) { string stmp, stmp2; //vector<string> vs; /* while(true) { //char input = getchar(); char input; cin.get(input); if(input == '0') { //vs.push_back("0"); stmp.push_back('0'); } else if(input == '1') { stmp.push_back('1'); } else if(input == 'B') { stmp.pop_back(); } cout << "\r" << stmp; } */ cin >> stmp; for(int i = 0; i < stmp.size(); i++) { if(stmp[i] == 'B') { stmp2.pop_back(); } else { stmp2.push_back(stmp[i]); } } cout << stmp2 << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:3:5: error: 'string' was not declared in this scope 3 | string stmp, stmp2; | ^~~~~~ a.cc:29:5: error: 'cin' was not declared in this scope 29 | cin >> stmp; | ^~~ a.cc:29:12: error: 'stmp' was not declared in this scope 29 | cin >> stmp; | ^~~~ a.cc:34:13: error: 'stmp2' was not declared in this scope 34 | stmp2.pop_back(); | ^~~~~ a.cc:38:13: error: 'stmp2' was not declared in this scope 38 | stmp2.push_back(stmp[i]); | ^~~~~ a.cc:41:5: error: 'cout' was not declared in this scope 41 | cout << stmp2 << endl; | ^~~~ a.cc:41:13: error: 'stmp2' was not declared in this scope 41 | cout << stmp2 << endl; | ^~~~~ a.cc:41:22: error: 'endl' was not declared in this scope 41 | cout << stmp2 << endl; | ^~~~
s017549039
p04030
C++
#include <bits/stdc++.h> #define fi first #define se second #define rep(i,n) for(int i = 0; i < (n); ++i) #define rrep(i,n) for(int i = 1; i <= (n); ++i) #define drep(i,n) for(int i = (n)-1; i >= 0; --i) #define srep(i,s,t) for (int i = s; i < t; ++i) #define rng(a) a.begin(),a.end() #define rrng(a) a.rbegin(),a.rend() #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define limit(x,l,r) max(l,min(x,r)) #define lims(x,l,r) (x = max(l,min(x,r))) #define isin(x,l,r) ((l) <= (x) && (x) < (r)) #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define pcnt __builtin_popcountll #define uni(x) x.erase(unique(rng(x)),x.end()) #define show(x) cout<<#x<<" = "<<x<<endl; #define print(x)cout<<x<<endl; #define PQ(T) priority_queue<T,v(T),greater<T> > #define bn(x) ((1<<x)-1) #define dup(x,y) (((x)+(y)-1)/(y)) #define newline puts("") #define v(T) vector<T> #define vv(T) v(v(T)) using namespace std; typedef long long int ll; typedef unsigned uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef tuple<int,int,int> T; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<P> vp; typedef vector<T> vt; int main() { string s; cin >> s; string t = ""; rep(i,n){ if(s[i] =='B' && sz(t))t.pop_back(); else t.push_back(s[i]); } print(t); return 0; }
a.cc: In function 'int main()': a.cc:44:9: error: 'n' was not declared in this scope 44 | rep(i,n){ | ^ a.cc:4:38: note: in definition of macro 'rep' 4 | #define rep(i,n) for(int i = 0; i < (n); ++i) | ^
s771995905
p04030
C++
#include <iostream> #include<string> using namespace std; int main() { char a[100], b[100]; int n = 0; cin >> a; int s = strlen(a); for (int i = 0; i < s; i++) { if (a[i] == 'B') { n--; if (n < 0) n = 0; } else b[n++] = a[i]; } b[n] = '\0'; cout << b; }
a.cc: In function 'int main()': a.cc:9:17: error: 'strlen' was not declared in this scope 9 | int s = strlen(a); | ^~~~~~ 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>