submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s386217054
p03827
C
#include <stdio.h> char s[101];//文字列// int main(void) { int i; int n;//文字数// int x = 0; int max = 0; scanf_s("%d", &n); for (i = 0; i <= n; i++) { scanf("%c", &s[i]); } for (i = 1; i <= n; i++) { if (s[i] == 'I') { x = x + 1; } else { x = x - 1; } if (x > max) { max = x; } } printf("%d", max); return 0; }
main.c: In function 'main': main.c:11:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 11 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s480608272
p03827
C++
#include <iostream> using namespace std; int main(){ int n, x = 0, ans = 0; string s; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == "I") { x++; } else { x--; } if (x > ans) ans = x; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if (s[i] == "I") {
s074746973
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int n, x=0, m=0; string s; cin >> n >> s; for(int i=0; i<n; i++){ if(s[i]=="I"){ x++; if(m<x)m=x; }else{ x--; } } cout << m << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(s[i]=="I"){
s909164247
p03827
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; i++) #define REPR(i, n) for(int i = n; i >= 0; i--) #define FOR(i, m, n) for(int i = m; i < n; i++) #define INF 2e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; //const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; //const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int main() { int n; string s; cin >> n >> s; int x = 0; int max = 0; REP(i, n){ if (s[i] == 'I') x++; else (s[i] == 'D') x--; if (x > max) max = x; } cout << max << endl; }
a.cc: In function 'int main()': a.cc:24:35: error: expected ';' before 'x' 24 | else (s[i] == 'D') x--; | ^~ | ;
s501894700
p03827
C++
#include <iostream> #include <string> #include <cmath> using namespace std; int main() { int n; cin >> n; int x = 0; int res = 0; for (int i = 0; i < n; i++) { char s; cin >> s; if (s == 'I') x += 1; else (s == 'D') x -= 1; res = max(x, res); } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:20: error: expected ';' before 'x' 15 | else (s == 'D') x -= 1; | ^~ | ;
s356189798
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int a,i,array[101]; string s; cin>>a>>s; array[0]=0 for(i=1;i<a+1;i++){ if(s.at(i)=='D'){ array[i]=array[i-1]-1; }else{ array[i]=array[i-1]+1; } } sort(array,array+a); cout<<array[a]<<endl; }
a.cc: In function 'int main()': a.cc:8:13: error: expected ';' before 'for' 8 | array[0]=0 | ^ | ; 9 | for(i=1;i<a+1;i++){ | ~~~ a.cc:9:20: error: expected ';' before ')' token 9 | for(i=1;i<a+1;i++){ | ^ | ;
s794314399
p03827
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main(void){ int n,ma=0,x=0; string s; cin>>n>>s; for(int i=0;i<s.length;i++){ if(s[i]=='I'){ x++; ma=max(x,ma); }else{ x--; } } cout<<ma; return 0; }
a.cc: In function 'int main()': a.cc:9:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?) 9 | for(int i=0;i<s.length;i++){ | ~~^~~~~~ | ()
s908515986
p03827
C++
#include <bits/stdc++.h> using namespace std; string s; int main(){ cin>>s>>s; int cnt=0,ans=0; for(char c:s){ if(c=="I")cnt++; else cnt--; ans=max(ans,cnt); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(c=="I")cnt++; | ~^~~~~
s912293838
p03827
C++
#include<iostream> #include<string> int main() { /* // 整数の入力 int a; cin >> a; // スペース区切りの整数の入力 int b, c; cin >> b >> c; // 文字列の入力 string s; cin >> s; // 出力 cout << (a + b + c) << " " << s << endl; */ //23:23 int x = 0; string S; int N; cin >> N; cin >> S; int max = 0; for (int n = 0; n < N; n++) { if (S[n] == 'I') { x++; } if (S[n] == 'D') { x--; } if (max < x)max = x; } cout << max; return 0; }
a.cc: In function 'int main()': a.cc:22:9: error: 'string' was not declared in this scope 22 | string S; | ^~~~~~ a.cc:22:9: 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:24:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 24 | cin >> N; | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:25:16: error: 'S' was not declared in this scope 25 | cin >> S; | ^ a.cc:33:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 33 | cout << max; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s430851207
p03827
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(){ char S[100]; int i,N,x=0,max=0; scanf("%s%s",&N,&S); for(i=0;i<"N";i++){ if(S[i]=="I"){ x+=1; if(x>max){ max=x; } } else{ x-=x; } printf("%d",max); } } }
a.cc: In function 'int main()': a.cc:7:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<"N";i++){ | ~^~~~ a.cc:8:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(S[i]=="I"){ | ~~~~^~~~~ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s925594834
p03827
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(){ char S[100]; int i,N,x=0,max=0; scanf("%d%s",&N,&S); for(i=0;i<N;i++){ if(S[i]==I){ x+=1; if(x>max){ max=x; } } else{ x-=x; } printf("%d",max); } } }
a.cc: In function 'int main()': a.cc:8:13: error: 'I' was not declared in this scope 8 | if(S[i]==I){ | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s148763216
p03827
C++
#include <iostream> using namespace std; int main(void) { string num,mozi; int x,y = 0; cin >> num >> mozi; for(int i = 0;i <= num - 1;++i) { if(mozi[i] = "I") x = x + 1; else x = x - 1; if(y <= x) y = y + 1; } cout << y << endl; }
a.cc: In function 'int main()': a.cc:10:28: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 10 | for(int i = 0;i <= num - 1;++i) | ~~~ ^ ~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 618 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed: a.cc:10:30: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 10 | for(int i = 0;i <= num - 1;++i) | ^ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1790 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed: a.cc:10:30: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 10 | for(int i = 0;i <= num - 1;++i) | ^ a.cc:12:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 12 | if(mozi[i] = "I") | ^~~ | | | const char*
s544888404
p03827
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include<cstdio> #include<bits/stdc++.h> using namespace std; using ll =long long; int main (void) { int N; cin >> N; int x=0,ans=0; while(n--){ char c = getchar(); x+= c == 'I'?1:-1; if (x>ans) ans=x; } cout << ans; }
a.cc: In function 'int main()': a.cc:15:9: error: 'n' was not declared in this scope 15 | while(n--){ | ^
s592596718
p03827
C
int a;int b;int c;int main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a---1;){ d[7-a]=='I'?++b:--b; b>c?c=b:c+=0; } printf("%d\n",c); }
main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int a;int b;int c;int main(){ main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | scanf("%d",&a); | ^~~~~ main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:14: error: lvalue required as left operand of assignment 7 | b>c?c=b:c+=0; | ^~ main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 9 | printf("%d\n",c); | ^~~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s558618605
p03827
C
a;b;c;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a---1;){ d[7-a]=='I'?++b:--b; b>c?c=b:c+=0; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int] 1 | a;b;c;main(){ | ^~~~ main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a;b;c;main(){ main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | scanf("%d",&a); | ^~~~~ main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:14: error: lvalue required as left operand of assignment 7 | b>c?c=b:c+=0; | ^~ main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 9 | printf("%d\n",c); | ^~~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s325705194
p03827
C
a;b;c;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int] 1 | a;b;c;main(){ | ^~~~ main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a;b;c;main(){ main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | scanf("%d",&a); | ^~~~~ main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:14: error: lvalue required as left operand of assignment 7 | b>c?c=b:c=c; | ^ main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 9 | printf("%d\n",c); | ^~~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s497823909
p03827
C
a;b;c;d;main(){ scanf("%d",&a); char d[a+1]; scanf("%c",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:7: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:7: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:1:9: error: return type defaults to 'int' [-Wimplicit-int] 1 | a;b;c;d;main(){ | ^~~~ main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a;b;c;d;main(){ main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | scanf("%d",&a); | ^~~~~ main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:14: error: lvalue required as left operand of assignment 7 | b>c?c=b:c=c; | ^ main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 9 | printf("%d\n",c); | ^~~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s892488835
p03827
C
a;b;c;d;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:7: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:7: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:1:9: error: return type defaults to 'int' [-Wimplicit-int] 1 | a;b;c;d;main(){ | ^~~~ main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | a;b;c;d;main(){ main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | scanf("%d",&a); | ^~~~~ main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:7:14: error: lvalue required as left operand of assignment 7 | b>c?c=b:c=c; | ^ main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 9 | printf("%d\n",c); | ^~~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s582644284
p03827
C++
// ------------------------------------ // Date:2018/ 2/28 // Problem:ABC 052 IncrementDecrement b.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto&& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define debug(x) cerr << #x << ":" << x << endl typedef long long ll; static const int MOD = 1000000007; int main() { int N, ans; string S; cin >> N; ans = N; cin >> S; REP(i, S.size()) { if (S[i] == 'I') ++n; else --n; ans = max(n, ans); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:31:24: error: 'n' was not declared in this scope 31 | if (S[i] == 'I') ++n; | ^ a.cc:32:24: error: 'n' was not declared in this scope 32 | else --n; | ^ a.cc:33:15: error: 'n' was not declared in this scope 33 | ans = max(n, ans); | ^
s014028858
p03827
C++
#include<iostream> using namespace std; int main(){ int n, ans = 0; cin >> n; n ^= n; string s; cin >> s; for(char c : s)ans = max(ans, c == 'I' ? ++n : --n); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:1: error: '\U0000ff5d' was not declared in this scope 10 | } | ^~ a.cc:10:3: error: expected '}' at end of input 10 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s671337556
p03827
C++
#include<iostream> using namespace std; int main(){ int n, ans = 0; cin >> n; n ^= n; string s; cin >> s; for(char c : s)ans = max(ans, c == 'I' ? ++n : --n); cout >> ans >> endl; return 0; }
a.cc: In function 'int main()': a.cc:8:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 8 | cout >> ans >> endl; | ~~~~ ^~ ~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:8:8: note: candidate: 'operator>>(int, int)' (built-in) 8 | cout >> ans >> endl; | ~~~~~^~~~~~ a.cc:8:8: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:8:3: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 8 | cout >> ans >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:8:11: required from here 8 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ a.cc:10:1: error: '\U0000ff5d' was not declared in this scope 10 | } | ^~ a.cc:10:3: error: expected '}' at end of input 10 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s239886577
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { int n, i, ans = 0, k = 0; string s; cin >> n >> s; for(i = 0; i < n; i++){ if(s[i] == 'I'){ k++; if(k > ans)ans = k; } else{ k--; } } cout << ans << endl;
a.cc: In function 'int main()': a.cc:23:23: error: expected '}' at end of input 23 | cout << ans << endl; | ^ a.cc:7:1: note: to match this '{' 7 | { | ^
s290696909
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s992922552
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s677063421
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s153298706
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++){ if(S[i]==I) X++; else X=X-1; } std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:8:11: error: 'I' was not declared in this scope 8 | if(S[i]==I) | ^
s844990699
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++;){ if(S[i]==I) X++; else X=X-1; } std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:7:20: error: expected ')' before ';' token 7 | for(int i=0;i<N;i++;){ | ~ ^ | ) a.cc:7:21: error: expected primary-expression before ')' token 7 | for(int i=0;i<N;i++;){ | ^
s748450719
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++;) if(S[i]==I) X++; else X=X-1; std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:7:20: error: expected ')' before ';' token 7 | for(int i=0;i<N;i++;) | ~ ^ | ) a.cc:7:21: error: expected primary-expression before ')' token 7 | for(int i=0;i<N;i++;) | ^ a.cc:10:2: error: 'else' without a previous 'if' 10 | else | ^~~~
s989923220
p03827
Java
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); char[] letters = scanner.next().toCharArray(); int ans = 0; int count = 0; for (int i = 0; i < n; i++) { if (letters[i]=='I') { count++; }else { count--; } if (count>ans) { ans = count; } } System.out.println(ans); scanner.close(); } }
Main.java:4: error: cannot find symbol Scanner scanner = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner scanner = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s293521899
p03827
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <numeric> #include <string> using namespace std; const double PI = acos(-1.0); const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int main(void) { int n,m,x; string s; cin >> n >> s; m = x = 0; REP(i,n){ if(n[i]=="I"){ x++; if (x > m) m = x; } else { X--; } } cout << m; return 0; }
a.cc: In function 'int main()': a.cc:22:13: error: invalid types 'int[int]' for array subscript 22 | if(n[i]=="I"){ | ^ a.cc:26:13: error: 'X' was not declared in this scope 26 | X--; | ^
s114848509
p03827
C++
#include <iostream> #include <algorithm> using namespace std; int ans[101],n;   int main(void){ char s[101]; cin>>n>>s; for(int i=1;i<=n;i++){ if(s[i-1]=='I')ans[i]=ans[i-1]+1; else ans[i]=ans[i-1]-1; } sort(ans,ans+n+1,greater<int>()); cout<<ans[0]<<endl; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^
s491177536
p03827
C++
#include <iostream> #include <algorithm> using namespace std; int ans[101],n;   int main(void){ char s[101]; cin>>n>>s; for(int i=1;i<=n;i++){ if(s[i-1]=='I')ans[i]=ans[i-1]+1; else ans[i]=ans[i-1]-1; } for(int i=0;i<n;i++)cout<<ans[i]<<' '; sort(ans,ans+n+1,greater<int>()); cout<<ans[0]<<endl; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^
s373207388
p03827
C++
def main(): n = int(input()) s = input() x, maxv = 0, 0 for c in s: if c == 'I': x += 1 elif c == 'D': x -= 1 if x > maxv: maxv = x print(maxv) if __name__ == "__main__": main()
a.cc:1:1: error: 'def' does not name a type 1 | def main(): | ^~~
s376307520
p03827
C
#include<stdio.h> int main() { int n,x=0,i,y,I,D; scanf("%d",&n); int a[n]; for(i=0,i<n,i++) { scanf("%d",&a[i]); y=a[i]; if(a[i]=I||a[i]=D) { if(a[i]=I) x=x+1; else x=x-1; } for(i=0,i<n-1,i++) { if(a[i]>a[i+1]) { printf("%d",a[i]); } } } }
main.c: In function 'main': main.c:8:20: error: expected ';' before ')' token 8 | for(i=0,i<n,i++) | ^ | ; main.c:8:20: error: expected expression before ')' token main.c:12:24: error: lvalue required as left operand of assignment 12 | if(a[i]=I||a[i]=D) | ^ main.c:19:26: error: expected ';' before ')' token 19 | for(i=0,i<n-1,i++) | ^ | ; main.c:19:26: error: expected expression before ')' token
s704303823
p03827
C
#include<stdio.h> int main() { int n,x=0,i,y; scanf("%d",&n); int a[n]; for(i=0,i<n,i++) { scanf("%d",&a[i]); y=a[i] if(a[i]=I||a[i]=D) { if(a[i]=I) x=x+1; else x=x-1 } for(i=0,i<n-1,i++) { if(a[i]>a[i+1]) { } } } }
main.c: In function 'main': main.c:8:20: error: expected ';' before ')' token 8 | for(i=0,i<n,i++) | ^ | ; main.c:8:20: error: expected expression before ')' token main.c:11:15: error: expected ';' before 'if' 11 | y=a[i] | ^ | ; 12 | if(a[i]=I||a[i]=D) | ~~
s841579237
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max=0; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[i]=='I') {x++; } if(arr[i]=='D') {x--;} if(x>=max) {max=x;} } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'i' was not declared in this scope 14 | if(arr[i]=='I') | ^ a.cc:17:8: error: 'i' was not declared in this scope 17 | if(arr[i]=='D') | ^
s855710807
p03827
C
include<stdio.h> #include<string.h> int main() { int n,i,x=0,t=0; char st[100]; scanf("%d",&n); scanf("%s",st); for(i=0;i<n;i++) { if(st[i]=='I') x++; else if(st[i]=='D') x--; if(x>t) t=x; } printf("%d",t); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ In file included from main.c:2: /usr/include/string.h:44:22: error: unknown type name 'size_t' 44 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:34:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 33 | #include <stddef.h> +++ |+#include <stddef.h> 34 | /usr/include/string.h:47:56: error: unknown type name 'size_t' 47 | extern void *memmove (void *__dest, const void *__src, size_t __n) | ^~~~~~ /usr/include/string.h:47:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:55:32: error: unknown type name 'size_t' 55 | int __c, size_t __n) | ^~~~~~ /usr/include/string.h:55:32: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:61:42: error: unknown type name 'size_t' 61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/string.h:61:42: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:64:56: error: unknown type name 'size_t' 64 | extern int memcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:64:56: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:80:60: error: unknown type name 'size_t' 80 | extern int __memcmpeq (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:80:60: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:107:48: error: unknown type name 'size_t' 107 | extern void *memchr (const void *__s, int __c, size_t __n) | ^~~~~~ /usr/include/string.h:107:48: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:145:53: error: unknown type name 'size_t' 145 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:145:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:153:23: error: unknown type name 'size_t' 153 | size_t __n) __THROW __nonnull ((1, 2)); | ^~~~~~ /usr/include/string.h:153:23: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:159:57: error: unknown type name 'size_t' 159 | extern int strncmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/string.h:159:57: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:166:8: error: unknown type name 'size_t' 166 | extern size_t strxfrm (char *__restrict __dest, | ^~~~~~ /usr/include/string.h:166:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:167:54: error: unknown type name 'size_t' 167 | const char *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:167:54: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:8: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:179:59: error: unknown type name 'size_t' 179 | extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, | ^~~~~~ /usr/include/string.h:179:59: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:195:45: error: unknown type name 'size_t' 195 | extern char *strndup (const char *__string, size_t __n) | ^~~~~~ /usr/include/string.h:195:45: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:293:8: error: unknown type name 'size_t' 293 | extern size_t strcspn (const char *__s, const char *__reject) | ^~~~~~ /usr/include/string.h:293:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:297:8: error: unknown type name 'size_t' 297 | extern size_t strspn (const char *__s, const char *__accept) | ^~~~~~ /usr/include/string.h:297:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:389:46: error: unknown type name 'size_t' 389 | extern void *memmem (const void *__haystack, size_t __haystacklen, | ^~~~~~ /usr/include/string.h:389:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:390:44: error: unknown type name 'size_t' 390 | const void *__needle, size_t __needlelen) | ^~~~~~ /usr/include/string.h:390:44: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:398:55: error: unknown type name 'size_t' 398 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:398:55: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:401:53: error: unknown type name 'size_t' 401 | const void *__restrict __src, size_t __n) | ^~~~~~ /usr/include/string.h:401:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:407:8: error: unknown type name 'size_t' 407 | extern size_t strlen (const char *__s) | ^~~~~~ /usr/include/string.h:407:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:8: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:8: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:413:46: error: unknown type name 'size_t' 413 | extern size_t strnlen (const char *__string, size_t __maxlen) | ^~~~~~ /usr/include/string.h:413:46: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33, from /usr/include/string.h:26: /usr/include/string.h:432:12: error: unknown type name 'size_t' 432 | extern int __REDIRECT_NTH (strerror_r, | ^~~~~~~~~~~~~~ /usr/include/string.h:432:12: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' In file included from /usr/include/string.h:462: /usr/include/strings.h:34:54: error: unknown type name 'size_t' 34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:24:1: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' 23 | #include <stddef.h> +++ |+#include <stddef.h> 24 | /usr/include/strings.h:38:53: error: unknown type name 'size_t' 38 | extern void bcopy (const void *__src, void *__dest, size_t __n) | ^~~~~~ /usr/include/strings.h:38:53: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:42:31: error: unknown type name 'size_t' 42 | extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); | ^~~~~~ /usr/include/strings.h:42:31: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:120:61: error: unknown type name 'size_t' 120 | extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) | ^~~~~~ /usr/include/strings.h:120:61: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/strings.h:134:27: error: unknown type name 'size_t' 134 | size_t __n, locale_t __loc) | ^~~~~~ /usr/include/strings.h:134:27: note: 'size_t' is defined in header '<stddef.h>'; this is probably fixable by adding '#include <stddef.h>' /usr/include/string.h:466:40: error: unknown type name
s581281154
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; int max=0; int z=1; int N; cin>>N; char str[N]; gets(str); for(int i=0;i<N;i++) { if(str[i]=='I') { x++; if(x>=max) { max=x;} else { z=1;} else if(str[i]=='D') x--; if(x>=max) { max=x;} else { z=1;} else continue;} } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:8:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(str); | ^~~~ | getw a.cc:15:7: error: expected '}' before 'else' 15 | else if(str[i]=='D') | ^~~~ a.cc:11:9: note: to match this '{' 11 | { x++; | ^ a.cc:22:7: error: 'else' without a previous 'if' 22 | else | ^~~~ a.cc: At global scope: a.cc:25:1: error: 'cout' does not name a type 25 | cout<<max; | ^~~~ a.cc:26:1: error: expected unqualified-id before 'return' 26 | return 0; | ^~~~~~ a.cc:29:1: error: expected declaration before '}' token 29 | } | ^
s901847269
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; int max=0; int z=1; int N; cin>>N; char str[N]; gets(str); for(int i=0;i<N;i++) { if(str[i]=='I') { x++; if(x>=max) { max=x;} else { z=1;} else if(str[i]=='D') x--; if(x>=max) { max=x;} else { z=1;} else continue;} } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:8:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(str); | ^~~~ | getw a.cc:15:7: error: expected '}' before 'else' 15 | else if(str[i]=='D') | ^~~~ a.cc:11:9: note: to match this '{' 11 | { x++; | ^ a.cc:22:7: error: 'else' without a previous 'if' 22 | else | ^~~~ a.cc: At global scope: a.cc:25:1: error: 'cout' does not name a type 25 | cout<<max; | ^~~~ a.cc:26:1: error: expected unqualified-id before 'return' 26 | return 0; | ^~~~~~ a.cc:29:1: error: expected declaration before '}' token 29 | } | ^
s834790566
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[j]=='I') {x++; s[j]=x;} if(arr[j]=='D') {x--; s[j]=x; } } for(j=0;j<N;j++) {max=s[0]; if(s[j]>s[j+1]) {max=s[j]; } } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:21:5: error: 'j' was not declared in this scope 21 | for(j=0;j<N;j++) | ^
s419884411
p03827
C++
#include<iostream> #include<string> using std::strlen; int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc:3:12: error: 'strlen' has not been declared in 'std' 3 | using std::strlen; | ^~~~~~ a.cc: In function 'int main()': a.cc:10:3: error: 'strlen' was not declared in this scope 10 | N=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>
s010048115
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100]; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[i]=='I') #include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[i]=='I') {x++; s[i]=x;} if(arr[i]=='D') {x--; s[i]=x; } } for(j=0;j<N;j++) {max=s[0]; if(s[j]>s[j+1]) {max=s[j]; } } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:13:10: error: 'i' was not declared in this scope 13 | { if(arr[i]=='I') | ^ a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 16 | int main() | ^~ a.cc:16:9: note: remove parentheses to default-initialize a variable 16 | int main() | ^~ | -- a.cc:16:9: note: or replace parentheses with braces to value-initialize a variable a.cc:17:1: error: a function-definition is not allowed here before '{' token 17 | { int arr[100],N,x=0,s[100],max; | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:13:1: note: to match this '{' 13 | { if(arr[i]=='I') | ^ a.cc:42:2: error: expected '}' at end of input 42 | } | ^ a.cc:4:1: note: to match this '{' 4 | { int arr[100],N,x=0,s[100]; | ^
s687812764
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; using string::strlen; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: using-declaration for member at non-class scope 6 | using string::strlen; | ^~~~~~ a.cc:10:3: error: 'strlen' was not declared in this scope 10 | N=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>
s653019131
p03827
C++
#include<iostream> #include<string> using namespace std; int main() { int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=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>
s331001017
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=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>
s606499453
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(I=0;I<N;I++) { if(a[I]=='I') {x++; if(x>l); l=x; } else if(a[I]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=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> a.cc:10:5: error: 'I' was not declared in this scope 10 | for(I=0;I<N;I++) | ^
s707997268
p03827
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() { char S[1000];int x=0,N; cin>>N; cout<<endl; for(int j=0;j<N;j++) {cin>>S[j];} y=x; for(int i=0;i<N;i++) { if(S[i]=='I') {x+=1;} else if(S[i]=='D') {x-=1;} if(x>y) {y=x;} } cout<<y; return 0; }
a.cc: In function 'int main()': a.cc:15:1: error: 'y' was not declared in this scope 15 | y=x; | ^
s899588745
p03827
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() { char S[];int x=0,N; cin>>N; cout<<endl; for(int j=0;j<N;j++) {cin>>S[j];} y=x; for(int i=0;i<N;i++) { if(S[i]=='I') {x+=1;} else if(S[i]=='D') {x-=1;} if(x>y) {y=x;} } cout<<y; return 0; }
a.cc: In function 'int main()': a.cc:10:6: error: storage size of 'S' isn't known 10 | char S[];int x=0,N; | ^ a.cc:15:1: error: 'y' was not declared in this scope 15 | y=x; | ^
s348138908
p03827
Java
import java.io.*; import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); String b=sc.next(); int x=0; char c[]=b.toCharArray(); int f[]; for(int d=0;d<a;d++) { char r=b.charAt(d); if(r=='I') x++; else x--; f[d]=x; } Arrays.sort(f); int h=f[(b.length()-1)]; }}
Main.java:24: error: variable f might not have been initialized f[d]=x; ^ Main.java:27: error: variable f might not have been initialized Arrays.sort(f); ^ 2 errors
s181161070
p03827
C++
#include <iostream> using namespace std; int main() { int a; string s; cin>>a; cin>>s; int x=0; int max1=0; for(i=0;s<=a;i++) { x++; } else { x--; } cout<< max(x,max1); return 0 ; }
a.cc: In function 'int main()': a.cc:12:13: error: 'i' was not declared in this scope 12 | for(i=0;s<=a;i++) | ^ a.cc:12:18: error: no match for 'operator<=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 12 | for(i=0;s<=a;i++) | ~^~~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:469:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 469 | operator<=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:469:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 513 | operator<=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:513:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1704 | operator<=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1704:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1767 | operator<=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1767:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 12 | for(i=0;s<=a;i++) | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1064:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1064 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1064:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 12 | for(i=0;s<=a;i++) | ^ 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:717:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 717 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:717:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/string_view:724: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> >)' 724 | operator<=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:724:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/string_view:732:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 732 | operator<=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:732:5: note: template argument deduction/substitution failed: a.cc:12:20: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/basic_string.h:3956:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3956 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3956:5: note: template argument deduction/substitution failed: a.cc:12:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/basic_string.h:3970:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3970 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3970:5: note: template argument deduction/substitution failed: a.cc:12:20: note: mismatched types 'const _CharT*' and 'int' 12 | for(i=0;s<=a;i++) | ^ /usr/include/c++/14/bits/basic_string.h:3983:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3983 | operator<=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3983:5: note: template argument deduction/substitution failed: a.cc:12:20: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 12 | for(i=0;s<=a;i++) | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2625:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2625 | operator<=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2625:5: note: template argument deduction/substitution failed: a.cc:12:20: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 12 | for(i=0;s<=a;i++) | ^ a.cc:16:9: error: 'else' without a previous 'if' 16 | else | ^~~~
s069512408
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int max(int *arr, int n) { int max=arr[0]; for (int i=1;i<n;i++) { if (arr[i]>max) max=arr[i]; } return max; } int main() { char S[100]; int N, a[101]; a[0]=0; cin>>N; gets(S); for (int i=0; i<N; i++) { if (S[i]=='I') a[i+1]=a[i]+1; else if (S[i]=='D') a[i+1]=a[i]-1; } int R=max(a,N+1); cout<<R; return 0; }
a.cc: In function 'int main()': a.cc:23:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 23 | gets(S); | ^~~~ | getw
s949376533
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; char str[10]; int max=1; int z=1; gets(str); for(int i=0;i<10;i++) { if(str[i]==I) { x++; if(x>=max) { max=x;} else { z=1;} } else if(str[i]==D) { x--; if(x>=max) { max=x;} else { z=1;} } else z=1;} } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:7:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw a.cc:9:19: error: 'I' was not declared in this scope 9 | { if(str[i]==I) | ^ a.cc:14:23: error: 'D' was not declared in this scope 14 | else if(str[i]==D) | ^ a.cc: At global scope: a.cc:25:1: error: 'cout' does not name a type 25 | cout<<max; | ^~~~ a.cc:26:1: error: expected unqualified-id before 'return' 26 | return 0; | ^~~~~~ a.cc:29:1: error: expected declaration before '}' token 29 | } | ^
s922789141
p03827
C++
#include<iostream> #include<stdio.h> #include<conio.h> using namespace std; int main() { int x=0; char str[10]; int max=1; int z=1; gets(str); for(int i=0;i<10;i++) { if(str[i]==I) { x++; if(x>=max) { max=x;} else { z=1;} } else if(str[i]==D) { x--; if(x>=max) { max=x;} else { z=1;} } else z=1;} } cout<<max; return 0; }
a.cc:3:9: fatal error: conio.h: No such file or directory 3 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s440415772
p03827
C
#include<stdio.h> int main() { int h,w; char a[100][100]; for(i=0;i<h;i++) for(j=0;j<w;j++); scanf("%c",a[i][j]); for(i=0;i<h+2;i++) { for(j=0;j<w+2;j++) { if(i==0||i==(h+1)||j==0||j==w+1) printf("#"); else printf("%c",a[i-1][j-1]) } } return 0; }
main.c: In function 'main': main.c:6:5: error: 'i' undeclared (first use in this function) 6 | for(i=0;i<h;i++) | ^ main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in main.c:7:5: error: 'j' undeclared (first use in this function) 7 | for(j=0;j<w;j++); | ^ main.c:16:25: error: expected ';' before '}' token 16 | printf("%c",a[i-1][j-1]) | ^ | ; 17 | } | ~
s812040874
p03827
C++
#include<iostream> #include<conio.h> #include<stdio.h> using namespace std; int max(int *arr, int n) { int max=arr[0]; for (int i=1;i<n;i++) { if (arr[i]>max) max=arr[i]; } return max; } int main() { char S[100]; int N, a[101]; a[0]=0; cin>>N; gets(S); for (int i=0; i<N; i++) { if (S[i]=='I') a[i+1]=a[i]+1; else if (S[i]=='D') a[i+1]=a[i]-1; } int R=max(a,N+1); cout<<R; return 0; }
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s630470466
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); int x = 0; int mx=0; for (char y : ca) { switch (y) { case 'I': x++; break; case 'D': x--; break; } mx=Math.max(mx,x); } w.println(mx); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader 1 error
s821789035
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); int x = 0; for (char x : ca) { switch (x) { case 'I': x++; break; case 'D': x--; break; } } w.println(x); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader Main.java:15: error: variable x is already defined in method main(String[]) for (char x : ca) { ^ 2 errors
s481558570
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); int x = 0; for (char x : ca) { switch (x) { case "I": x++; break; case "D": x--; break; } } w.println(x); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader Main.java:15: error: variable x is already defined in method main(String[]) for (char x : ca) { ^ Main.java:17: error: incompatible types: String cannot be converted to char case "I": x++; ^ Main.java:19: error: incompatible types: String cannot be converted to char case "D": x--; ^ 4 errors
s222272304
p03827
C++
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); int x = 0; for (char x : ca) { switch (x) { case "I": x++; break; case "D": x--; break; } } w.println(x); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.math.BigInteger; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: expected unqualified-id before 'public' 7 | public class Main{ | ^~~~~~
s399332404
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<a;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | | | | std::string [100] {aka std::__cxx11::basic_string<char> [100]} | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short int)((std::string*)(& b))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short unsigned int)((std::string*)(& b))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(int)((std::string*)(& b))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(unsigned int)((std::string*)(& b))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long int)((std::string*)(& b))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long unsigned int)((std::string*)(& b))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long int)((std::string*)(& b))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& b))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | o
s201553805
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<b.size;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | | | | std::string [100] {aka std::__cxx11::basic_string<char> [100]} | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short int)((std::string*)(& b))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short unsigned int)((std::string*)(& b))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(int)((std::string*)(& b))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(unsigned int)((std::string*)(& b))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long int)((std::string*)(& b))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long unsigned int)((std::string*)(& b))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long int)((std::string*)(& b))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& b))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | o
s674406309
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<b.size;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | | | | std::string [100] {aka std::__cxx11::basic_string<char> [100]} | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short int)((std::string*)(& b))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(short unsigned int)((std::string*)(& b))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(int)((std::string*)(& b))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(unsigned int)((std::string*)(& b))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long int)((std::string*)(& b))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long unsigned int)((std::string*)(& b))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long int)((std::string*)(& b))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 8 | cin>>a>>b; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:17: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& b))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:8:17: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 8 | cin>>a>>b; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | o
s368055259
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ | ~~~~^~~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 11 | if(b[i]=='D'){ |
s520239887
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c,; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:5:17: error: expected unqualified-id before ';' token 5 | int a,c,; | ^ a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ | ~~~~^~~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'c
s034379686
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c,; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'{ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:5:17: error: expected unqualified-id before ';' token 5 | int a,c,; | ^ a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ | ~~~~^~~~~ | | | | | char | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ /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:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'char' 11 | if(b[i]=='D'){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:11:26: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 11 | if(b[i]=='D'){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:11:26: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'c
s249036565
p03827
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int main() { int N, i, max = 0; cin >> N >> S; string S; char I; int x[N+1]; x[0]=0; for (i = 0; i < N+1; i++) { if (S[i] = 'I') { x[i + 1] = x[i] + 1; } else { x[i + 1] = x[i] - 1; } if (x[i] > max) { max = x[i]; } } cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:17: error: 'S' was not declared in this scope 8 | cin >> N >> S; | ^
s432478014
p03827
Java
import java.util.*; public class IncrementDecrement { public static void main(String[] args) { Scanner sc1 = new Scanner(System.in); int n = sc1.nextInt(); String s = sc1.next(); String[] sArray = s.split(""); int ans = 0; int x = 0; for (int i = 0; i < n; i++) { if (sArray[i].equals("I")) { x = x + 1; } else { x = x - 1; } if (ans < x) { ans = x; } } System.out.println(ans); } }
Main.java:3: error: class IncrementDecrement is public, should be declared in a file named IncrementDecrement.java public class IncrementDecrement { ^ 1 error
s914308672
p03827
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for (int i=0;i<(n);i++) int main(void) { int N; String S; cin >> N; cin >> S; int ans = 0; int cur = 0; REP(i,N) { if (S[i] == "I") cur++; else cur--; ans = max(ans, cur); } cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:7:3: error: 'String' was not declared in this scope 7 | String S; | ^~~~~~ a.cc:9:16: error: 'S' was not declared in this scope 9 | cin >> S; | ^
s025566054
p03827
Java
import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(input.readLine()); String S = input.readLine(); int[] values = new int[N + 1]; int currentValue = 0; values[0] = currentValue; for (int i = 0; i < N; i++) { currentValue += incrementOrDecrement(S.charAt(i)); values[i + 1] = currentValue; } int answer = values[0]; for (int i = 0; i < N + 1; i++) { if (answer < values[i]) { answer = values[i]; } } System.out.println(answer); } private static int incrementOrDecrement(char operation) { if (operation == 'I') { return 1; } else { return -1; } } }
Main.java:6: error: cannot find symbol BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main 2 errors
s885633665
p03827
C++
#include<bits/stdc++.h> int N; char str[101]; int main() { scanf("%d", &N); scanf("%s", &str); int x = 0, ans = 0; for(int i=0;i<N;i++) { if(str[i]=='I') x++; else x--; ans = max(ans, x); } printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:14:15: error: 'max' was not declared in this scope; did you mean 'std::max'? 14 | ans = max(ans, x); | ^~~ | std::max In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~
s008761734
p03827
Java
import java.util.*; public Main { public static void main(String[] args) { // TODO Auto-generated method stub int x=0; Scanner s=new Scanner(System.in); int N=s.nextInt(); String S=s.next(); int i=0; int y[]=new int[S.length()]; int max=0; for(i=0;i<S.length();i++){ if(S.charAt(i)=='I'){ x++; y[i]=x; }else{ x--; y[i]=x; } } max=y[0]; for(i=0;i<S.length();i++){ if(max<y[i]){ max=y[i]; } } if(max<0){ max=0; } System.out.println(max); } }
Main.java:4: error: class, interface, enum, or record expected public Main { ^ Main.java:6: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) Main.java:41: error: class, interface, enum, or record expected } ^ 3 errors
s596459709
p03827
C++
#include <cstdio> int main (){ int N 、k = 0 、x = 0 ; char S [ 100 ]; scanf ("%d" 、&N ); scanf ("%s" 、S ); for (int i = 0 ; i < N ; i ++){ if (S [ i ] == 'I' ){ x + = 1 ; if (k <= x ){ k = x ; }} } else { x - = 1 ; }} }} printf ("%d" 、k ); 0を返します。 }}
a.cc:3:7: error: extended character 、 is not valid in an identifier 3 | int N 、k = 0 、x = 0 ; | ^ a.cc:3:15: error: extended character 、 is not valid in an identifier 3 | int N 、k = 0 、x = 0 ; | ^ a.cc:5:15: error: extended character 、 is not valid in an identifier 5 | scanf ("%d" 、&N ); | ^ a.cc:6:15: error: extended character 、 is not valid in an identifier 6 | scanf ("%s" 、S ); | ^ a.cc:17:16: error: extended character 、 is not valid in an identifier 17 | printf ("%d" 、k ); | ^ a.cc:18:1: error: extended character 。 is not valid in an identifier 18 | 0を返します。 | ^ a.cc:2:10: error: expected initializer before '\U0000ff08\U0000ff09' 2 | int main (){ | ^~~~ a.cc:16:1: error: expected declaration before '}' token 16 | }} | ^ a.cc:16:2: error: expected declaration before '}' token 16 | }} | ^ a.cc:17:1: error: 'printf' does not name a type 17 | printf ("%d" 、k ); | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include <cstdio> +++ |+#include <cstdio> 2 | int main (){ a.cc:18:1: error: expected unqualified-id before numeric constant 18 | 0を返します。 | ^~~~~~~~~~~~~ a.cc:19:1: error: expected declaration before '}' token 19 | }} | ^ a.cc:19:2: error: expected declaration before '}' token 19 | }} | ^
s293548019
p03827
C++
#include <stdio.h> int main(){ int N; int sum = 0; scanf("%d", &N); char s[N]; scanf("%s", s); for(int i=0; i<N; i++){ if(s[i]=="I") sum++; else sum--; } printf("%d", sum); return 0; }
a.cc: In function 'int main()': a.cc:11:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[i]=="I") sum++; | ~~~~^~~~~
s417430442
p03827
C++
#include <stdio.h> int main(){ int N; int sum = 0; scanf("%d", &N); char s[N]; scanf("%s", &s); for(int i=0; i<N; i++){ if(s[i]=="I") sum++; else sum--; } printf("%d", sum); return 0; }
a.cc: In function 'int main()': a.cc:11:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[i]=="I") sum++; | ~~~~^~~~~
s037344336
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { int X = 0, max_v = 0; string S; cin >> N >> S; for (int i = 0; i < N; i++) { X = S[i] == 'I'? X + 1 : X - 1; max_v = X > max_v ? X : max_v; } cout << max_v; return 0; }
a.cc: In function 'int main()': a.cc:8:16: error: 'N' was not declared in this scope 8 | cin >> N >> S; | ^
s162727096
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int N, score=0, max=0; string str; cin >> N; cin >> str; for(int i=0; i<N; i++){ if(str[i] == 'I'){ score++; max = max(max, score); } else score--; } cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: 'max' cannot be used as a function 14 | max = max(max, score); | ~~~^~~~~~~~~~~~
s784526996
p03827
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; string s; cin >> s; int x = max = 0; for(int i = 0; i < n; i++){ if(s[i] = 'I'){ x++; if(x > max){ max = x; } }else{ x--; } } cout << max << endl; }
a.cc: In function 'int main()': a.cc:8:17: error: overloaded function with no contextual type information 8 | int x = max = 0; | ^ a.cc:12:12: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>' 12 | if(x > max){ | ~~^~~~~ a.cc:13:15: error: overloaded function with no contextual type information 13 | max = x; | ^ a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 19 | cout << max << endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/iostream:41, 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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
s026265506
p03827
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> vec; vec.push_back(0); for(int i = 0; i < N; i++) { vec.push_back((S[i] == 'I') ? vec[i] + 1 : vec[i] - 1); } cout << *std::max_element(vec.begin(), vec.end()) << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:17: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'? 20 | cout << *std::max_element(vec.begin(), vec.end()) << endl; | ^~~~~~~~~~~ | tuple_element
s364426127
p03827
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> vec; vec.push_back(0); for(int i = 0; i < N; i++) { if(S[i] == 'I') { vec.push_back(vec[i] + 1); } else { vec.push_back(vec[i] - 1); } } cout << *max_element(vec.begin(), vec.end()) << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:12: error: 'max_element' was not declared in this scope 24 | cout << *max_element(vec.begin(), vec.end()) << endl; | ^~~~~~~~~~~
s648657963
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int N; string S; cin >> N; cin >> S; int x = 0; int X[N]; for(int i=0; i<N; i++){ if(S[i] == 'I'){ x += 1; } else if(S[i] == 'D'){ x -= 1; } X[i] = x; } int max_x = 0; for(int i=0; i<N; i++){ if(max_x < X[i]){ max_x = X[i]; } } cout << max_x << endl;
a.cc: In function 'int main()': a.cc:34:25: error: expected '}' at end of input 34 | cout << max_x << endl; | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s458231611
p03827
C++
package main import ( "fmt" ) func main() { var n, x, m int var s string fmt.Scan(&n, &s) for _, c := range s { // fmt.Println(c) if c == 'I' { x++ if x > m { m = x } } else { x-- } } fmt.Println(m) }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~
s871403035
p03827
C
//F #include<stdio.h> #include<conio.h> main() { int i, n; scanf("%d",&n); int max=0, x=0; char S[n], ch; scanf("%c",&ch); for(i=0; i<n; i++){ scanf("%c",&S[i]); } S[n]='\0'; for(i=0; i<n; i++) { if(S[i]=='I') { x++; } else { x--; } if(x>max) { max=x; } } printf("%d", max); return 0; }
main.c:3:9: fatal error: conio.h: No such file or directory 3 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s759211910
p03827
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(a) a.begin(), a.end() #define MS(m,v) memset(m,v,sizeof(m)) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int> pii; const int MOD = 1000000007; const int INF = MOD + 1; const ld EPS = 1e-12; template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); } template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); } /*--------------------template--------------------*/ int main() { cin.sync_with_stdio(false); cout << fixed << setprecision(10); int n; string s; cin >> n >> s; int ans = 0, x = 0; for (auto i : s) { if (i == "I") x++; else x--; chmax(ans, x); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:28:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 28 | if (i == "I") x++; | ~~^~~~~~
s776713322
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (int i = (a); i >= n; --i) #define DEP(i, n) DEPS(i, n, 0) #define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i]; #define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i]; #define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i]; #define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i]; #define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j]; #define string(x) string x; cin >> x; #define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); } #define all(v) (v).begin(), (v).end() #define rall(v) (v).begin(), (v).end(), std::greater<int>() #define len(v) (v).length() #define FIND(s, n) (s.find(n) != s.end()) #define SORT(a) sort(all(a)) static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); static const long long MOD = 1000000007; static const double PI=3.1415926535897932; static const int INF = 0x3f3f3f3f; static const int INFTY = (1 << 29); static const long long LINFTY = (1LL << 32); static const int dy4[]={0, 0, 1, -1}; static const int dx4[]={1, -1, 0, 0}; static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1}; static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int N, M, res; int G[100][100]; int c[100], m[100]; int dfs(int b, int n) { c[n] = 1; for (int i = 0; i < N; i++) { if (b == i || n == i) continue; if (G[n][i]) { if (c[i] == 1) return 0; if (!dfs(n, i)) return 0; } } return 1; } int isPrime(int x){ int i; if(x < 2) return 0; else if(x == 2) return 1; if( x%2 == 0) return 0; for(i = 3; i*i <= x; i += 2){ if(x%i == 0) return 0; } return 1; } const int pmax = 1000000; bool isPrime_table[pmax]; //const is necessary; void eratos(void){ int i, j; double sqrtmax=sqrt(pmax); REP(k, pmax) isPrime_table[k] = true; /* Initialization */ /* Sieve process */ isPrime_table[0] = false; isPrime_table[1] = false; /* 0 and 1 are not prime. */ for (i=2; i <= sqrtmax; i++){ if (isPrime_table[i]==true){ /* i is prime. */ for (j=i; i*j<pmax; j++){ isPrime_table[i*j] = false; /* multiples of i are not prime. */ } } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string s; cin >> s; int x = 0; int MAX = -100000000; REP(i, s.length()){ if(s[i]=='I') x++; else x--; MAX = max(x, max); } cout << MAX<< endl; }
a.cc: In function 'int main()': a.cc:103:26: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)' 103 | MAX = max(x, max); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:36: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&' 257 | max(const _Tp& __a, const _Tp& __b) | ~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:103:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 103 | MAX = max(x, max); | ~~~^~~~~~~~
s944016907
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (int i = (a); i >= n; --i) #define DEP(i, n) DEPS(i, n, 0) #define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i]; #define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i]; #define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i]; #define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i]; #define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j]; #define string(x) string x; cin >> x; #define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); } #define all(v) (v).begin(), (v).end() #define rall(v) (v).begin(), (v).end(), std::greater<int>() #define len(v) (v).length() #define FIND(s, n) (s.find(n) != s.end()) #define SORT(a) sort(all(a)) static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); static const long long MOD = 1000000007; static const double PI=3.1415926535897932; static const int INF = 0x3f3f3f3f; static const int INFTY = (1 << 29); static const long long LINFTY = (1LL << 32); static const int dy4[]={0, 0, 1, -1}; static const int dx4[]={1, -1, 0, 0}; static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1}; static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int N, M, res; int G[100][100]; int c[100], m[100]; int dfs(int b, int n) { c[n] = 1; for (int i = 0; i < N; i++) { if (b == i || n == i) continue; if (G[n][i]) { if (c[i] == 1) return 0; if (!dfs(n, i)) return 0; } } return 1; } int isPrime(int x){ int i; if(x < 2) return 0; else if(x == 2) return 1; if( x%2 == 0) return 0; for(i = 3; i*i <= x; i += 2){ if(x%i == 0) return 0; } return 1; } const int pmax = 1000000; bool isPrime_table[pmax]; //const is necessary; void eratos(void){ int i, j; double sqrtmax=sqrt(pmax); REP(k, pmax) isPrime_table[k] = true; /* Initialization */ /* Sieve process */ isPrime_table[0] = false; isPrime_table[1] = false; /* 0 and 1 are not prime. */ for (i=2; i <= sqrtmax; i++){ if (isPrime_table[i]==true){ /* i is prime. */ for (j=i; i*j<pmax; j++){ isPrime_table[i*j] = false; /* multiples of i are not prime. */ } } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string s; cin >> s; int x = 0; int MAX = -100000000 REP(i, s.length()){ if(s[i]=='I') x++; else x--; MAX = max(x, max); } cout << MAX<< endl; }
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~ a.cc:100:13: error: 'i' was not declared in this scope 100 | REP(i, s.length()){ | ^ a.cc:10:41: note: in definition of macro 'REPS' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~
s084153529
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (int i = (a); i >= n; --i) #define DEP(i, n) DEPS(i, n, 0) #define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i]; #define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i]; #define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i]; #define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i]; #define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j]; #define string(x) string x; cin >> x; #define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); } #define all(v) (v).begin(), (v).end() #define rall(v) (v).begin(), (v).end(), std::greater<int>() #define len(v) (v).length() #define FIND(s, n) (s.find(n) != s.end()) #define SORT(a) sort(all(a)) static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); static const long long MOD = 1000000007; static const double PI=3.1415926535897932; static const int INF = 0x3f3f3f3f; static const int INFTY = (1 << 29); static const long long LINFTY = (1LL << 32); static const int dy4[]={0, 0, 1, -1}; static const int dx4[]={1, -1, 0, 0}; static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1}; static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int N, M, res; int G[100][100]; int c[100], m[100]; int dfs(int b, int n) { c[n] = 1; for (int i = 0; i < N; i++) { if (b == i || n == i) continue; if (G[n][i]) { if (c[i] == 1) return 0; if (!dfs(n, i)) return 0; } } return 1; } int isPrime(int x){ int i; if(x < 2) return 0; else if(x == 2) return 1; if( x%2 == 0) return 0; for(i = 3; i*i <= x; i += 2){ if(x%i == 0) return 0; } return 1; } const int pmax = 1000000; bool isPrime_table[pmax]; //const is necessary; void eratos(void){ int i, j; double sqrtmax=sqrt(pmax); REP(k, pmax) isPrime_table[k] = true; /* Initialization */ /* Sieve process */ isPrime_table[0] = false; isPrime_table[1] = false; /* 0 and 1 are not prime. */ for (i=2; i <= sqrtmax; i++){ if (isPrime_table[i]==true){ /* i is prime. */ for (j=i; i*j<pmax; j++){ isPrime_table[i*j] = false; /* multiples of i are not prime. */ } } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string s; cin >> s; int x = 0; int MAX = -100000000 REP(i, s.length()){ if(s[i]=='I') x++; else x--; MAX = max(x, max); } cout << max<< endl; }
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~ a.cc:100:13: error: 'i' was not declared in this scope 100 | REP(i, s.length()){ | ^ a.cc:10:41: note: in definition of macro 'REPS' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~ a.cc:105:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 105 | cout << max<< endl; | ~~~~~^~~~~~ 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_typ
s185951640
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n) for (int i = (a); i >= n; --i) #define DEP(i, n) DEPS(i, n, 0) #define vint(v, n) vector<int> v(n); REP(i,n) cin >> v[i]; #define vvint(v, w, n) vector<int> v(n); vector<int> w(n); REP(i,n) cin >> v[i] >> w[i]; #define vlint(v, n) vector<ll int> v(n); REP(i,n) cin >> v[i]; #define vdouble(v, n) vector<double> v(n); REP(i,n) cin >> v[i]; #define vvdoube(v, n1, n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j]; #define string(x) string x; cin >> x; #define vstring(v, n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); } #define all(v) (v).begin(), (v).end() #define rall(v) (v).begin(), (v).end(), std::greater<int>() #define len(v) (v).length() #define FIND(s, n) (s.find(n) != s.end()) #define SORT(a) sort(all(a)) static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); static const long long MOD = 1000000007; static const double PI=3.1415926535897932; static const int INF = 0x3f3f3f3f; static const int INFTY = (1 << 29); static const long long LINFTY = (1LL << 32); static const int dy4[]={0, 0, 1, -1}; static const int dx4[]={1, -1, 0, 0}; static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1}; static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1}; int N, M, res; int G[100][100]; int c[100], m[100]; int dfs(int b, int n) { c[n] = 1; for (int i = 0; i < N; i++) { if (b == i || n == i) continue; if (G[n][i]) { if (c[i] == 1) return 0; if (!dfs(n, i)) return 0; } } return 1; } int isPrime(int x){ int i; if(x < 2) return 0; else if(x == 2) return 1; if( x%2 == 0) return 0; for(i = 3; i*i <= x; i += 2){ if(x%i == 0) return 0; } return 1; } const int pmax = 1000000; bool isPrime_table[pmax]; //const is necessary; void eratos(void){ int i, j; double sqrtmax=sqrt(pmax); REP(k, pmax) isPrime_table[k] = true; /* Initialization */ /* Sieve process */ isPrime_table[0] = false; isPrime_table[1] = false; /* 0 and 1 are not prime. */ for (i=2; i <= sqrtmax; i++){ if (isPrime_table[i]==true){ /* i is prime. */ for (j=i; i*j<pmax; j++){ isPrime_table[i*j] = false; /* multiples of i are not prime. */ } } } } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string s; cin >> s; int x = 0; int max = -100000000 REP(i, s.length()){ if(s[i]=='I') x++; else x--; max = max(x, max); } cout << max<< endl; }
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~ a.cc:100:13: error: 'i' was not declared in this scope 100 | REP(i, s.length()){ | ^ a.cc:10:41: note: in definition of macro 'REPS' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^ a.cc:100:9: note: in expansion of macro 'REP' 100 | REP(i, s.length()){ | ^~~
s340768546
p03827
C++
#include<iostream> using namespace std; int mainI(){ int N,cnt=0,max=0,i; cin>>N; char S[N+1]; for(i=0;i<N;i++){ cin>>S[i]; if(S[i]=='I')cnt++;else cnt--; if(max<cnt) max=cnt; } cout<<max<<endl; return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s511710792
p03827
C++
#include<stdio.h> using namespace std; int main(){ int x,Max;x=Max=0; int n;string s;cin>>n>>s; for(char c:s){ if(c=='I')x++; else x--; Max=max(Max,x); } cout<<Max<<endl; }
a.cc: In function 'int main()': a.cc:6:15: error: 'string' was not declared in this scope 6 | int n;string s;cin>>n>>s; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include<stdio.h> +++ |+#include <string> 2 | using namespace std; a.cc:6:24: error: 'cin' was not declared in this scope 6 | int n;string s;cin>>n>>s; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<stdio.h> +++ |+#include <iostream> 2 | using namespace std; a.cc:6:32: error: 's' was not declared in this scope 6 | int n;string s;cin>>n>>s; | ^ a.cc:10:21: error: 'max' was not declared in this scope; did you mean 'Max'? 10 | Max=max(Max,x); | ^~~ | Max a.cc:12:9: error: 'cout' was not declared in this scope 12 | cout<<Max<<endl; | ^~~~ a.cc:12:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:12:20: error: 'endl' was not declared in this scope 12 | cout<<Max<<endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<stdio.h> +++ |+#include <ostream> 2 | using namespace std;
s021258114
p03827
C++
#include<cmath> using namespace std; int main() { long long m,n,i,a; string s; while(cin>>n) { cin>>s; a=0;m=0; for(i=0;i<n;i++) { if(s[i]=='I') a++; else a--; m=max(a,m); } cout<<m<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'string' was not declared in this scope 6 | string s; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include<cmath> +++ |+#include <string> 2 | using namespace std; a.cc:7:11: error: 'cin' was not declared in this scope 7 | while(cin>>n) | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<cmath> +++ |+#include <iostream> 2 | using namespace std; a.cc:9:14: error: 's' was not declared in this scope 9 | cin>>s; | ^ a.cc:19:9: error: 'cout' was not declared in this scope 19 | cout<<m<<endl; | ^~~~ a.cc:19:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:18: error: 'endl' was not declared in this scope 19 | cout<<m<<endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<cmath> +++ |+#include <ostream> 2 | using namespace std;
s922680285
p03827
C++
#include <iostream> #include <string> using namespace std; int main(){ int N, max = 0, count = 0; string S; cin >> N; cin >> S; for (int i = 0; i < N; ++i) { if(S[i] == 'I'){ count++; if(count > max) max = count; } else if(S[i] == 'D') count--; } cout << max; retu
a.cc: In function 'int main()': a.cc:24:3: error: 'retu' was not declared in this scope 24 | retu | ^~~~ a.cc:24:7: error: expected '}' at end of input 24 | retu | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s242458647
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; string s; int ans=0; cin>>n>>s; for(auto i:s){ if(i=='I') ++ans; else --ans; }
a.cc: In function 'int main()': a.cc:13:10: error: expected '}' at end of input 13 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s307319223
p03827
Java
import java.util.Scanner; public class Main { public static void main (String[ ] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); char[] ch = s.toCharArray(); int x = 0; int m = 0; for (int i = 0; i < n; i++) { if (ch[i] == 'I') { x++; m = Math.max(m. x); } else if (ch[i] == 'D') { x--; } } System.out.println(m); } }
Main.java:15: error: int cannot be dereferenced m = Math.max(m. x); ^ 1 error
s722457570
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { string str; cin >> str; int32_t output{ 0 }, x{ 0 }; for(auto itr = str.cbegin(), itr != str.cend(); ++itr) { if(*itr == 'I') { ++x; } else { --x; } if(x > output) { output = x; } } cout << output << endl; }
a.cc: In function 'int main()': a.cc:12:37: error: expected ';' before '!=' token 12 | for(auto itr = str.cbegin(), itr != str.cend(); ++itr) { | ^~~ | ; a.cc:12:38: error: expected primary-expression before '!=' token 12 | for(auto itr = str.cbegin(), itr != str.cend(); ++itr) { | ^~
s104702102
p03827
C
#include <stdio.h> #include <stdlib.h> int main(){ int N; scanf("%d",&N); char s = calloc(N+1,sizeof(char)); scanf("%s",s); int i,x=0; int max = 0; for(i = 0; i < N; i++){ if(s[i]=='I'){ x++; }else if(s[i]=='D'){ x--; } if(x > max){ max = x; } } printf("%d",max); return 0; }
main.c: In function 'main': main.c:6:14: error: initialization of 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion] 6 | char s = calloc(N+1,sizeof(char)); | ^~~~~~ main.c:11:13: error: subscripted value is neither array nor pointer nor vector 11 | if(s[i]=='I'){ | ^ main.c:13:19: error: subscripted value is neither array nor pointer nor vector 13 | }else if(s[i]=='D'){ | ^
s991622590
p03827
C
#include <stdio.h> int main(){ int n; char s[1000]; int s[100]; int i; int x=1; int o=0; scanf("%d%s",&n,s); for(i=0;i<n;i++){ if(s[i]=='I'){ ++x;s[o]=x; o++; }else if(s[i]=='D'){ --x; s[o]=x; o++; } } printf("%d",x); return 0; }
main.c: In function 'main': main.c:5:5: error: conflicting types for 's'; have 'int[100]' 5 | int s[100]; | ^ main.c:4:6: note: previous declaration of 's' with type 'char[1000]' 4 | char s[1000]; | ^
s100858481
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ string s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] == "I"){ b = b + 1; } if(s[i] == "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(s[i] == "I"){ a.cc:16:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if(s[i] == "D"){
s476857102
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ char s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] == "I"){ b = b + 1; } if(s[i] == "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: request for member 'size' in 's', which is of non-class type 'char' 12 | for (int i = 0; i < s.size(); i++){ | ^~~~ a.cc:13:21: error: invalid types 'char[int]' for array subscript 13 | if(s[i] == "I"){ | ^ a.cc:16:21: error: invalid types 'char[int]' for array subscript 16 | if(s[i] == "D"){ | ^
s207843990
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ char s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] = "I"){ b = b + 1; } if(s[i] = "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: request for member 'size' in 's', which is of non-class type 'char' 12 | for (int i = 0; i < s.size(); i++){ | ^~~~ a.cc:13:21: error: invalid types 'char[int]' for array subscript 13 | if(s[i] = "I"){ | ^ a.cc:16:21: error: invalid types 'char[int]' for array subscript 16 | if(s[i] = "D"){ | ^
s081090519
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ string s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] = "I"){ b = b + 1; } if(s[i] = "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 13 | if(s[i] = "I"){ | ^~~ | | | const char* a.cc:16:27: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 16 | if(s[i] = "D"){ | ^~~ | | | const char*