submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s574904263
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { int n, x[2]; x[0] = 0; cin >> n; std::string s[n]; cin >> s; for(int i=1; i<=n; i++) { if(s[i] == 'I') { x[1] = x[0] - 1; } else { x[1] = x[0] + 1; } if(x[1] > x[0]) { x[1] = x[0]; } } cout << x[1] << endl; }
a.cc: In function 'int main()': a.cc:11:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'}) 11 | cin >> s; | ~~~ ^~ ~ | | | | | std::string [n] {aka std::__cxx11::basic_string<char> [n]} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 11 | cin >> s; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 11 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:11:12: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:11:12: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 11 | cin >> s; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} 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 [n]' {aka 'std::__cxx11::basic_string<char> [n]'} 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 [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::string [n]' {aka 'std::__cxx11::basic_string<char> [n]'} to 'std::basic_istream<char>::__istream_typ
s270163392
p03827
C++
#include <bits/stdc++.h> using namespace std; typedef long long unsigned ll; int main(){ int ret,tmp,n; char c; cin>>n; ret=tmp=0; while(n--){ c=getchar() if(c=='I') tmp++; else tmp--; ret = max(ret,tmp); } return ret; return 0; }
a.cc: In function 'int main()': a.cc:15:20: error: expected ';' before 'if' 15 | c=getchar() | ^ | ; 16 | if(c=='I') tmp++; | ~~ a.cc:17:9: error: 'else' without a previous 'if' 17 | else tmp--; | ^~~~
s351004018
p03827
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); String s = sc.next(); int ans = 0; int temp = 0; for (int i = 0; i<n; i++) { if(s.charAt(i) == "I") { temp++; } else { temp--; } if (ans<=temp) { ans=temp; } } System.out.println(ans); } }
Main.java:13: error: bad operand types for binary operator '==' if(s.charAt(i) == "I") { ^ first type: char second type: String 1 error
s103507941
p03827
C++
#include<bits/stdc++.h> using namespace std; int N; string s; int main() { cin>>N; cin>>s; int pos=0; for(int i=0;i<s.size();i++){ if(s[i]=='I') pos++; else pos--; } cout<<pos return 0; }
a.cc: In function 'int main()': a.cc:15:14: error: expected ';' before 'return' 15 | cout<<pos | ^ | ; 16 | 17 | return 0; | ~~~~~~
s860007638
p03827
C++
#include <bits/stdc++.h> #define maxn 1000000005 using namespace std; char id[maxn]; int sum[maxn]; int main() { int a; cin>>a; cin>>id; int m; sum[0]=0; for(int i=1;i<=a;i++) { if(a[i-1]='I') sum[i]=sum[i-1]+1; else sum[i]=sum[i-1]-1; } for(int i=0;i<=a;i++) { if(m<=sum[i]) { m=sum[i]; } } cout<<m; return 0; }
a.cc: In function 'int main()': a.cc:15:13: error: invalid types 'int[int]' for array subscript 15 | if(a[i-1]='I') | ^
s459314149
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; int x=0; int max=0; cin>>s; for(int i=0;s[i]!='\0';i++){ if(s[i]=='I') x++; else(s[i]=='D') x--; if(max<x) x=max; } cout<<x<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:18: error: expected ';' before 'x' 11 | else(s[i]=='D') x--; | ^~ | ;
s777636752
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; int x=0; int max=0; for(int i=0;s[i]!='\0';i++){ if(s[i]=='I') x++; else(s[i]=='D') x--; if(max<x) x=max; } cout<<x<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:18: error: expected ';' before 'x' 10 | else(s[i]=='D') x--; | ^~ | ;
s996046309
p03827
C++
#include<iostream> #include<iostream> using namespace std; int main(){ string s; int x=0; int max=0; for(int i=0;s[i]!='\0';i++){ if(s[i]=='I') x++; else(s[i]=='D') x--; if(max<x) x=max; } cout<<x<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:18: error: expected ';' before 'x' 10 | else(s[i]=='D') x--; | ^~ | ;
s818060898
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char s[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]=='I'){ y=x+1;} else(s[i]=='D'){ y=x-1;} if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:14:40: error: expected ';' before '{' token 14 | else(s[i]=='D'){ | ^ | ; main.c:18:41: error: 'else' without a previous 'if' 18 | else(y>x) | ^~~~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s713222126
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char s[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]=='I') y=x+1; else(s[i]=='D') y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:14:40: error: expected ';' before 'y' 14 | else(s[i]=='D') | ^ | ; 15 | y=x-1; | ~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s038648803
p03827
C++
#include<stdio.h> int main() { int x=0,N,i,y; char s[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]=='I') y=x+1; else(s[i]=='D') y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
a.cc: In function 'int main()': a.cc:14:40: error: expected ';' before 'y' 14 | else(s[i]=='D') | ^ | ; 15 | y=x-1; | ~ a.cc:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s161977418
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char s[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]==I) y=x+1; else(s[i]==D) y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:12:26: error: 'I' undeclared (first use in this function) 12 | if(s[i]==I) | ^ main.c:12:26: note: each undeclared identifier is reported only once for each function it appears in main.c:14:36: error: 'D' undeclared (first use in this function) 14 | else(s[i]==D) | ^ main.c:14:38: error: expected ';' before 'y' 14 | else(s[i]==D) | ^ | ; 15 | y=x-1; | ~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s865885576
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char s[105],I,D; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]=I) y=x+1; else(s[i]=D) y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:14:37: error: expected ';' before 'y' 14 | else(s[i]=D) | ^ | ; 15 | y=x-1; | ~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s857459315
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char s[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(s[i]=I) y=x+1; else(s[i]=D) y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:12:25: error: 'I' undeclared (first use in this function) 12 | if(s[i]=I) | ^ main.c:12:25: note: each undeclared identifier is reported only once for each function it appears in main.c:14:35: error: 'D' undeclared (first use in this function) 14 | else(s[i]=D) | ^ main.c:14:37: error: expected ';' before 'y' 14 | else(s[i]=D) | ^ | ; 15 | y=x-1; | ~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s264538061
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char S[105]; scanf("%d\n",N); for(i=0;i<105;i++){ scanf("%c",&s[i]); } for(i=0;i<105;i++) { if(S[i]=I) y=x+1; else(S[i]=D) y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:8:29: error: 's' undeclared (first use in this function) 8 | scanf("%c",&s[i]); | ^ main.c:8:29: note: each undeclared identifier is reported only once for each function it appears in main.c:12:25: error: 'I' undeclared (first use in this function) 12 | if(S[i]=I) | ^ main.c:14:35: error: 'D' undeclared (first use in this function) 14 | else(S[i]=D) | ^ main.c:14:37: error: expected ';' before 'y' 14 | else(S[i]=D) | ^ | ; 15 | y=x-1; | ~ main.c:18:50: error: expected ';' before 'x' 18 | else(y>x) | ^ | ; 19 | x=y;} | ~
s547829254
p03827
C
#include<stdio.h> int main() { int x=0,N,i,y; char S[105]; scanf("%d\n%c\n",N,S[105]); for(i=0;i<105;i++){ if(S[i]=I) y=x+1; else(S[i]=D) y=x-1; if(x>y) ; else(y>x) x=y;} return 0; }
main.c: In function 'main': main.c:8:25: error: 'I' undeclared (first use in this function) 8 | if(S[i]=I) | ^ main.c:8:25: note: each undeclared identifier is reported only once for each function it appears in main.c:10:35: error: 'D' undeclared (first use in this function) 10 | else(S[i]=D) | ^ main.c:10:37: error: expected ';' before 'y' 10 | else(S[i]=D) | ^ | ; 11 | y=x-1; | ~ main.c:14:50: error: expected ';' before 'x' 14 | else(y>x) | ^ | ; 15 | x=y;} | ~
s436556644
p03827
C++
#include <cstdio> #include <iostream> #include<algorithm> using namespace std; char s[110]; int n,pos,maxn; int main() { scanf("%d%s",&n,s+1); for(int i=1;i<=n;++i) { if(s[i]=='I') ++ans; else --ans; maxn=max(maxn,ans); } printf("%d\n",maxn); return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | if(s[i]=='I') ++ans; | ^~~ | abs a.cc:14:16: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | else --ans; | ^~~ | abs a.cc:15:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | maxn=max(maxn,ans); | ^~~ | abs
s652573329
p03827
C
#include<stdio.h> int main(){ int x,i,max; int S[N]; max=S[0] for(i=1;i<=N;i++){ if(S[i]=i) printf("x-1"); if else(S[i]=D) printf("x+1"); if(S[i]>max) printf("%d",S[i]");} return 0; }
main.c: In function 'main': main.c:4:9: error: 'N' undeclared (first use in this function) 4 | int S[N]; | ^ main.c:4:9: note: each undeclared identifier is reported only once for each function it appears in main.c:5:11: error: expected ';' before 'for' 5 | max=S[0] | ^ | ; 6 | for(i=1;i<=N;i++){ | ~~~ main.c:12:17: warning: missing terminating " character 12 | printf("%d",S[i]");} | ^ main.c:12:17: error: missing terminating " character 12 | printf("%d",S[i]");} | ^~~~ main.c:14:1: error: expected declaration or statement at end of input 14 | } | ^
s511275526
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int s,a[s+1],d=0; cn>>s; for(int j=1;j<=s;j++) { if(a[j]=i) d++; else d--; } cout<<d<<endl return 0; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cn' was not declared in this scope; did you mean 'yn'? 6 | cn>>s; | ^~ | yn a.cc:9:17: error: 'i' was not declared in this scope 9 | if(a[j]=i) | ^ a.cc:14:22: error: expected ';' before 'return' 14 | cout<<d<<endl | ^ | ; 15 | return 0; | ~~~~~~
s964700972
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,i,j,cnt=0,m=0; string s; cin>>n; cin>>s; for(i=0;i<s.size();i++){ if(s[i]=='I'){ cnt++; m=max(m,cnt) }else{ cnt--; } } cout<<m; }
a.cc: In function 'int main()': a.cc:12:19: error: expected ';' before '}' token 12 | m=max(m,cnt) | ^ | ; 13 | }else{ | ~
s392215312
p03827
C++
#include<bits/stdc++.h> using namespace std; int n,h,ans; int main() { cin>>n; for(int i=1;i<=n;++i) { char s;cin>>s; if(s[i]=='I')h++; if(s[i]=='D')h--; ans=max(ans,h); } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: invalid types 'char[int]' for array subscript 10 | if(s[i]=='I')h++; | ^ a.cc:11:13: error: invalid types 'char[int]' for array subscript 11 | if(s[i]=='D')h--; | ^
s671313972
p03827
C++
int a, ans = 0; cin >> a; char c; while(cin >> c) c == 'I' ? ans++ : ans--; cout << ans; }
a.cc:1:21: error: 'cin' does not name a type 1 | int a, ans = 0; cin >> a; | ^~~ a.cc:3:5: error: expected unqualified-id before 'while' 3 | while(cin >> c) | ^~~~~ a.cc:5:5: error: 'cout' does not name a type 5 | cout << ans; | ^~~~ a.cc:6:1: error: expected declaration before '}' token 6 | } | ^
s434413216
p03827
C++
#include<bits/stdc++.h> using namespace std; char l[105]; int main() { int a,b=0,i,j; cin>>a; for(i=1;i<=a;i++) { cin>>a[i]; if(a[i]=='I') b++; else b--; } cout<<b; }
a.cc: In function 'int main()': a.cc:10:15: error: invalid types 'int[int]' for array subscript 10 | cin>>a[i]; | ^ a.cc:11:13: error: invalid types 'int[int]' for array subscript 11 | if(a[i]=='I') | ^
s916684388
p03827
C++
x=0 res=0 n=int(input()) s=input() for i in range(n): if s[i]=='I':x+=1 else:x-=1 res=max(res,x) print(x)
a.cc:1:1: error: 'x' does not name a type 1 | x=0 | ^
s816963956
p03827
C++
# include <iostream> using namespace std; int main(void){ int N; int num[110]; int count, ans = 0; string S; cin >> N; cin >> S; for (int i = 0; i <N; i++){ char *c = S[i]; if (c == "I") count+= 1; if (c == "D") count-=1; ans = max(ans, count); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:18: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'char*' [-fpermissive] 13 | char *c = S[i]; | ^ | | | __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
s508308732
p03827
C++
# include <iostream> using namespace std; int main(void){ int N; int num[110]; int count, ans = 0; string S; cin >> N; cin >> S; for (int i = 0; i <N; i++){ char c = S[i]; if (c == "I") count+= 1; if (c == "D") count-=1; ans = max(ans, count); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if (c == "I") count+= 1; | ~~^~~~~~ a.cc:15:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 15 | if (c == "D") count-=1; | ~~^~~~~~
s059478501
p03827
C++
# include <iostream> using namespace std; int main(void){ int N; int num[110]; int count, ans = 0; string S; cin >> N; cin >> S; for (int i = 0; i <N; i++){ if (S[i] == "I") count+= 1; if (S[i] == "D") count-=1; ans = max(ans, count); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if (S[i] == "I") count+= 1; a.cc:14:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if (S[i] == "D") count-=1;
s722138298
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int ans,x; ans=0; for(int i=O;i<s.size();i++){ if(s.at(i)=='I'){ x++; if(ans<x){ ans=x; } } if(s.at(i)=='D'){ x--; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:9:13: error: 'O' was not declared in this scope 9 | for(int i=O;i<s.size();i++){ | ^
s347303409
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt = 0; vector<int> a(n); if(s.at(0) == 'I'){ a.at(0) = 1; } else { a.at(0) = -1; } for(int i=1;i<n;i++){ if(s.at(i) == 'I'){ a.at(i) = a.at(i-1) +1; } else { a.at(i) = a.at(i-1) -1; } } sort(a.begin(),a.end()); cout << a.(n-1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:26:13: error: expected unqualified-id before '(' token 26 | cout << a.(n-1) << endl; | ^
s536372379
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int cnt = 0; vector<int> a(n); if(s.at(i) == 'I'){ a.at(i) = 1; } else { a.at(i) = -1; } for(int i=1;i<n;i++){ if(s.at(i) == 'I'){ a.at(i) = a.at(i-1) +1; } else { a.at(i) = a.at(i-1) -1; } } sort(a.begin(),a.end()); cout << a.(n-1) << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:11: error: 'i' was not declared in this scope 11 | if(s.at(i) == 'I'){ | ^ a.cc:26:13: error: expected unqualified-id before '(' token 26 | cout << a.(n-1) << endl; | ^
s662415968
p03827
C++
N = int(input()) S = input() x = 0 ans = x for s in S: if s == "I": x += 1 else: x -= 1 ans = max(ans, x) print(ans)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s906718993
p03827
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) int main(){ int n; cin>>n; string s; cin <<s; int a=0; int b=0; for(int i=0;i<n;i++){ if(s[i]=='I'){ a++; }else{ a--; } b=max(a,b); } cout<<b; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 8 | cin <<s; | ~~~ ^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:8:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 8 | cin <<s; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
s803312750
p03827
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for(int i = 0; i < n; i++) int main(){ int n; cin>>n; string s; cin <<s; int a=0; int b=0; for(int i=0;i<n;i++){ if(s[i]=='I'){ a++; }else{ a--; } b=max(a,b) } cout<<b; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 8 | cin <<s; | ~~~ ^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:8:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 8 | cin <<s; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:8:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 8 | cin <<s; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
s137602811
p03827
C++
#include <iostream> using namespace std; int main() { int n,height=0,maxHeight=0; char c; cin>>n; for(int i=0;i<n;i++) { cin>>c; if(c == 'I') { height++; if(height>maxHeight) maxHeight=height; } else if(c == 'D') height--; } cout<<maxHeight<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:12: error: unable to find numeric literal operator 'operator""\U0000ff1b' 21 | return 0; | ^~~ a.cc:21:15: error: expected ';' before '}' token 21 | return 0; | ^ | ; 22 | } | ~
s958466628
p03827
C++
#include <iostream> using namespace std; int main() { int n,height=0,maxHeight=0; char c; cin>>n; for(int i=0;i<n;i++) { cin>>c; if(c == 'I') { height++; if(height>maxHeight) maxHeight=height; } else if(c == 'D') height--; } cout<<maxHeight<<endl; return ; }
a.cc: In function 'int main()': a.cc:21:5: error: return-statement with no value, in function returning 'int' [-fpermissive] 21 | return ; | ^~~~~~
s951685137
p03827
C++
#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<iomanip> using namespace std; int main() { int n; int max=-1; int hb=0; char a[101]; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]=='I') hb++; if(a[i]=='D') hb--; if(hb>max) max=hb; } cout<<max<<endl; return 0; }#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<iomanip> using namespace std; int main() { int n; int max=-1; int hb=0; char a[101]; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; if(a[i]=='I') hb++; if(a[i]=='D') hb--; if(hb>max) max=hb; } cout<<max<<endl; return 0; }
a.cc:23:2: error: stray '#' in program 23 | }#include<iostream> | ^ a.cc:23:3: error: 'include' does not name a type 23 | }#include<iostream> | ^~~~~~~ a.cc:29:5: error: redefinition of 'int main()' 29 | int main() | ^~~~ a.cc:7:5: note: 'int main()' previously defined here 7 | int main() | ^~~~
s185812563
p03827
C++
int main(){ int N; cin >> N; string S; cin >> S; int ans = 0; int sum = 0; for(int i = 0;i < N;i++){ if(S.at(i) == 'I'){ sum++; } else{ sum--; } ans = max(ans,sum); } cout << ans; }
a.cc: In function 'int main()': a.cc:4:5: error: 'cin' was not declared in this scope 4 | cin >> N; | ^~~ a.cc:5:5: error: 'string' was not declared in this scope 5 | string S; | ^~~~~~ a.cc:6:12: error: 'S' was not declared in this scope 6 | cin >> S; | ^ a.cc:16:15: error: 'max' was not declared in this scope 16 | ans = max(ans,sum); | ^~~ a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << ans; | ^~~~
s032587879
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { string S ; int N ,m ; int x=0; set<int > d; cin >> N>>S; for(int i =0 ; i<N; i++) { if (S[i]=='I') x++; if (S[i]=='D') x--; d.insert(x); } if (x<=0) cout << 0; else cout << (d.size());
a.cc: In function 'int main()': a.cc:25:24: error: expected '}' at end of input 25 | cout << (d.size()); | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s186810637
p03827
C++
#include<iostream> #include<algorithm> #include<cstdio> #include<fstream> #include<cstdlib> #include<iomanip> #include<string> #include<cstring> #include<cmath> #include<cfloat> using namespace std; int main() { int n; cin>>n; int hb=0,maxi=0; for(int i=0;i<n;i++) { char t; cin>>t; if(t=='I')hb++; else if(t=='D')hb--; maxi=max(maxi,hb); } cout<<maxi exit(0); }
a.cc: In function 'int main()': a.cc:26:15: error: expected ';' before 'exit' 26 | cout<<maxi | ^ | ; 27 | exit(0); | ~~~~
s290235822
p03827
C++
#include<bits/stdc++.h> using namespace std; char h[500]; int main() { int s=0,I,D,n; cin>>n; for(int i=0;i<n;i++) cin>>h[i]; for(int i=0;i<=n;i++) {if(h[i]=='I') s+=1; if(h[i]=='D') s-=1;} cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:16: error: unable to find numeric literal operator 'operator""\U0000ff1b' 12 | return 0; | ^~~ a.cc:12:19: error: expected ';' before '}' token 12 | return 0; | ^ | ; ...... 16 | } | ~
s890430038
p03827
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) #define sz(x) int(x.size()) using namespace std; typedef long long ll; using vl = vector<ll>; using vvl = vector<vl>; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } int main() { int N; cin >> N; string S; cin >> S; int ma = 0; int current = 0; REP(i, S.length()) { if(S[i] == 'I') { current++; ma = max(ma, current); } else { current--; } } cout << ma << emdl; return 0; }
a.cc: In function 'int main()': a.cc:51:19: error: 'emdl' was not declared in this scope 51 | cout << ma << emdl; | ^~~~
s652778991
p03827
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) #define sz(x) int(x.size()) using namespace std; typedef long long ll; using vl = vector<ll>; using vvl = vector<vl>; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } int main() { int N; cin >> N; string S; cin >> S; int ma = 0; int current = 0; REP(i, S.length()) { if(S[i] == 'I') { current++; ma = max(ma, curret); } else { curret--; } } cout << ma << emdl; return 0; }
a.cc: In function 'int main()': a.cc:46:26: error: 'curret' was not declared in this scope; did you mean 'current'? 46 | ma = max(ma, curret); | ^~~~~~ | current a.cc:48:13: error: 'curret' was not declared in this scope; did you mean 'current'? 48 | curret--; | ^~~~~~ | current a.cc:51:19: error: 'emdl' was not declared in this scope 51 | cout << ma << emdl; | ^~~~
s474673221
p03827
C++
#include <bits/stdc++.h> #define REP(i, n) for(ll i = 0; i < (ll)n; i++) #define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++) #define ALL(obj) (obj).begin(), (obj).end() #define INF (1ll << 60) #define sz(x) int(x.size()) using namespace std; typedef long long ll; using vl = vector<ll>; using vvl = vector<vl>; typedef double db; typedef string str; typedef pair<ll, ll> p; constexpr int MOD = 1000000007; using ll = long long; template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void print(const std::vector<int> &v) { std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; }); std::cout << std::endl; } int main() { int N; cin >> N; string S; cin >> S; int ma = 0; int curret = 0; REP(i, S.length()) { if(S[i] == 'I') { curren++; ma = max(ma, curret); } else { curret--; } } cout << ma << emdl; return 0; }
a.cc: In function 'int main()': a.cc:45:13: error: 'curren' was not declared in this scope; did you mean 'curret'? 45 | curren++; | ^~~~~~ | curret a.cc:51:19: error: 'emdl' was not declared in this scope 51 | cout << ma << emdl; | ^~~~
s473920584
p03827
C++
#include<bits/stdc++.h> using namespace std; string s; long long pos=0; long long maxn=0,n; int main() { scanf("%d%s",&n,s+1); for(int i=1;i<=n;++i) { if(s[i]=='I') ++pos; else --pos; maxn=max(maxn,pos); } printf("%d\n",maxn); return 0; }
a.cc: In function 'int main()': a.cc:8:27: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 8 | scanf("%d%s",&n,s+1); | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:8:28: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 8 | sc
s625029938
p03827
C++
#include<bits/stdc++.h> using namespace std; string s; long long pos=0; long long maxn=0; int main() { scanf("%d%s",&n,s+1); for(int i=1;i<=n;++i) { if(s[i]=='I') ++pos; else --pos; maxn=max(maxn,pos); } printf("%d\n",maxn); return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | scanf("%d%s",&n,s+1); | ^ | yn a.cc:8:27: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 8 | scanf("%d%s",&n,s+1); | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template
s870497313
p03827
C++
#include<bits/stdc++.h> using namespace std; string s; long long pos=0; long long maxn=0; int main() { scanf("%d%s",&n,s+1); for(int i=1;i<=n;++i) { if(s[i]=='I') ++pos; else --pos; maxn=max(maxn,pos); } printf("%d\n",maxn);/ return 0; }
a.cc: In function 'int main()': a.cc:8:24: error: 'n' was not declared in this scope; did you mean 'yn'? 8 | scanf("%d%s",&n,s+1); | ^ | yn a.cc:8:27: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 8 | scanf("%d%s",&n,s+1); | ~^~ | | | | | int | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:8:28: note: mismatched types 'const _CharT*' and 'int' 8 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:8:28: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 8 | scanf("%d%s",&n,s+1); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template
s291302702
p03827
C++
#include<bits/stdc++.h> using namespace std; string s; int main() { long long n,ans=0; cin>>n; for(int i=1;i<=n;i++){ cin>>s[i]; } int maxn=0; for(int i=1;i<=n;i++){ if(s[i]=='I'){ ans++; maxn=max(maxn,ans); } else if(s[i]=='D'){ ans--; } } cout<<maxn<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:15:33: error: no matching function for call to 'max(int&, long long int&)' 15 | maxn=max(maxn,ans); | ~~~^~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:15:33: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 15 | maxn=max(maxn,ans); | ~~~^~~~~~~~~~ /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:15:33: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 15 | maxn=max(maxn,ans); | ~~~^~~~~~~~~~
s767636790
p03827
C++
#include <iostream> using namespace std; int main() { int n,ans=-INT_MAX,t=0; char c[101]; cin>>n>>c; for(int i=0;i<n;i++) { if(c[i]=='I') t++; else t--; ans=max(ans,t); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:5:20: error: 'INT_MAX' was not declared in this scope 5 | int n,ans=-INT_MAX,t=0; | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include <iostream> +++ |+#include <climits> 2 | using namespace std; a.cc:10:31: error: 't' was not declared in this scope 10 | if(c[i]=='I') t++; | ^ a.cc:11:22: error: 't' was not declared in this scope 11 | else t--; | ^ a.cc:12:29: error: 't' was not declared in this scope 12 | ans=max(ans,t); | ^
s827349647
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int q=0,a,b,d; string c; cin>>a>>c; for(int i=0;i<a;i++){ if(a[i]=='D') b++; } d=a-b; if(d-b<=0) cout<<"0"; else cout<<d-b; cout<<"\n"; }
a.cc: In function 'int main()': a.cc:8:13: error: invalid types 'int[int]' for array subscript 8 | if(a[i]=='D') b++; | ^
s857076690
p03827
C++
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <algorithm> // sort #define REP(i, n) for (long long i = 0; i < (n); i++) typedef long long ll; static const ll MOD = 1000000007; static const ll INF = 1000000000000000000LL; using namespace std; int main(){ // std::ifstream in("input.txt"); // std::cin.rdbuf(in.rdbuf()); int n; cin >> n; string s; cin >> s; res = 0; int tmp = 0; REP(i,n) { if(s[i] == 'I') { ++tmp; } else { --tmp; } res = max(res,tmp); } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:5: error: 'res' was not declared in this scope 23 | res = 0; | ^~~
s348907622
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=0,max=0; char s[105]; scanf("%d",&n); scanf("%s",s); for(int i=0;i<n;i++){ if(s[i] == 'I'){ sum++ } else{ sum--; } if(sum > max){ max = sum; } } printf("%d",max); }
a.cc: In function 'int main()': a.cc:10:30: error: expected ';' before '}' token 10 | sum++ | ^ | ; 11 | } | ~
s903071494
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=0,max=0; char s[105]; scanf("%d",&n); scanf("%s",s); for(int i=0;i<n;i++){ if(s[i] == 'I'){ sum++'' } else{ sum--; } if(sum > max){ max = sum; } } printf("%d",max); }
a.cc:10:30: error: empty character constant 10 | sum++'' | ^~ a.cc: In function 'int main()': a.cc:10:30: error: expected ';' before '\x0' 10 | sum++'' | ^~ | ;
s201557773
p03827
C++
#include <iostream> #include <string> using namespace std; int main(){ int N; cin>>N; cin>>S; int ans=0; int tmp=0; for (int i=0;i<S.size();++i){ if (S[i]=='I'){ tmp+=1; } else tmp-=1; if (ans<tmp){ ans=tmp; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:7:8: error: 'S' was not declared in this scope 7 | cin>>S; | ^
s630816602
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; string s; cin >> s; int mx = 0; int tmp = 0; for(int i=0;i<s.size();i++){ if(s[i] == I) tmp++; else tmp--; mx = max(mx, tmp); } cout << mx << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:9:16: error: 'I' was not declared in this scope 9 | if(s[i] == I) tmp++; | ^
s529468254
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >>> n; string s; cin >> s; int mx = 0; int tmp = 0; for(int i=0;i<s.size();i++){ if(s[i] == 'I') tmp++; else tmp--; mx = max(mx, tmp); } cout << mx << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: expected primary-expression before '>' token 6 | int n; cin >>> n; string s; cin >> s; | ^
s668867277
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >>> n; string s; cin >> s; int mx = 0; int tmp = 0; for(int i=0;i<s.size();i++){ if(s[i] == I) tmp++; else tmp--; mx = max(mx, tmp); } cout << mx << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: expected primary-expression before '>' token 6 | int n; cin >>> n; string s; cin >> s; | ^ a.cc:9:16: error: 'I' was not declared in this scope 9 | if(s[i] == I) tmp++; | ^
s273013452
p03827
C++
#include<bits/stdc++.h> using namespace std; char s; long long int ans=0,ansn=0,n; int main(){ cin>>n for(int i=1;i<=n;i++) { cin>>s; if(s=='I') ansn++; else if(s=='D') ansn--; ans=max(ans,ansn); } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: expected ';' before 'for' 6 | cin>>n | ^ | ; 7 | for(int i=1;i<=n;i++) | ~~~ a.cc:7:17: error: 'i' was not declared in this scope 7 | for(int i=1;i<=n;i++) | ^
s710549402
p03827
C++
#include<cstdio> #include<cstdlib> #include<algorithm> #include<iostream> #include<queue> #include<vector> #include<bitset> #include<math.h> using namespace std; #define INF 110000000000 #define MOD 1000000007 typedef long long ll; typedef pair<int,int> P; int main(){ int N,x,ans=0; string s; cin>>N>>s; for(int i=0;i<N;i++){ if(S[i]=='I') x++; else x--; ans=max(ans,x); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:22:8: error: 'S' was not declared in this scope 22 | if(S[i]=='I') x++; | ^
s919096223
p03827
C++
#incude<bits/stdc++.h> using namespace std; int N; string S; int main () { cin >> N >> S; int count = 0, ans = 0; for (int i = 0; i < N; i++){ if (S[i] == 'I'){ count++; }else{ count--; } if (ans < count){ ans = count; } } cout << ans << endl; }
a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include? 1 | #incude<bits/stdc++.h> | ^~~~~~ | include a.cc:5:1: error: 'string' does not name a type 5 | string S; | ^~~~~~ a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope 8 | cin >> N >> S; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #incude<bits/stdc++.h> a.cc:8:15: error: 'S' was not declared in this scope 8 | cin >> N >> S; | ^ a.cc:22:3: error: 'cout' was not declared in this scope 22 | cout << ans << endl; | ^~~~ a.cc:22:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:22:18: error: 'endl' was not declared in this scope 22 | cout << ans << endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #incude<bits/stdc++.h>
s061586985
p03827
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.next(); int count = 0; int max = 0; for(int i = 0;i < s.length;i++){ if(s.substring(i,i+1).equals("I")){ count++; max = Math.max(max,count); }else{ count--; } } System.out.println(max); } }
Main.java:8: error: cannot find symbol for(int i = 0;i < s.length;i++){ ^ symbol: variable length location: variable s of type String 1 error
s553628576
p03827
C++
#include <iostream> #include <string> using namespace std; int main(void){ int x = 0; int N; string S; cin >> N >> S; int i = 1; while (S[N - i] == 'D') i++; for (; i <= N; i++){ if(S[N - i] == 'I') { x++; } else x--; } cout << x>0?x:0; }
a.cc: In function 'int main()': a.cc:17:14: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int') 17 | cout << x>0?x:0; | ~~~~~~~~~^~ | | | | | int | std::basic_ostream<char> a.cc:17:14: note: candidate: 'operator>(int, int)' (built-in) 17 | cout << x>0?x:0; | ~~~~~~~~~^~ a.cc:17:14: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int' 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:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 17 | cout << x>0?x:0; | ^ 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:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 17 | cout << x>0?x:0; | ^ 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:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:17:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 17 | cout << x>0?x:0; | ^ /usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3942 | operator>(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed: a.cc:17:15: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 17 | cout << x>0?x:0; | ^ 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:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2619 | operator>(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed: a.cc:17:15: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 17 | cout << x>0?x:0; | ^
s969966708
p03827
C++
#include <iostream> #include <cstdlib> #include <algorithm> #include <vector> #include <string> #include <cmath> #include <cassert> #include <functional> #include <string> #include <sstream> #include <cctype> using namespace std; int main(){ int N; cin >> N; strng S; cin >> S; int x = 0; int max = x; for(int i = 0; i < N; i++){ if(S[i] == 'I') x++; if(S[i] == 'D') x--; if(x > max) max = x; } cout << max << endl; }
a.cc: In function 'int main()': a.cc:16:3: error: 'strng' was not declared in this scope 16 | strng S; cin >> S; | ^~~~~ a.cc:16:19: error: 'S' was not declared in this scope 16 | strng S; cin >> S; | ^
s878032418
p03827
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N; string S; cin >> N >> S; int Xa = 0; int MaxX = Xa; rep(i, N){ if(S.at(i) == 'I'){ Xa++; MaxX = max(MaxX, Xa); } else { Xa--; } } cout << maxX << endl; }
a.cc: In function 'int main()': a.cc:19:17: error: 'maxX' was not declared in this scope; did you mean 'MaxX'? 19 | cout << maxX << endl; | ^~~~ | MaxX
s473096632
p03827
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N; string S; cin >> N >> S; int Xa = 0; int MaxX = Xa; rep(i, N){ if(S.at(i) == 'I'){ X++; MaxX = max(MaxX, Xa); } else { X--; } } cout << maxX << endl; }
a.cc: In function 'int main()': a.cc:13:25: error: 'X' was not declared in this scope 13 | X++; | ^ a.cc:16:25: error: 'X' was not declared in this scope 16 | X--; | ^ a.cc:19:17: error: 'maxX' was not declared in this scope; did you mean 'MaxX'? 19 | cout << maxX << endl; | ^~~~ | MaxX
s165378651
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; vector<string> s; cin >> n; cin >> s; int x = 0; int ans = 0; for(int i=0; i < n; i++){ if(s.at(i) == "I"){ x = x + 1; ans = max(ans,x); } else if(s.at(i) == "D"){ x = x - 1; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<std::__cxx11::basic_string<char> >') 8 | cin >> s; | ~~~ ^~ ~ | | | | | std::vector<std::__cxx11::basic_string<char> > | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = s
s053215145
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; string str; cin >> n; cin >> str; int x = 0; int ans = 0; for(int i=0; i < n; i++){ if(str.at(i) == "I"){ x = x + 1; ans = max(ans,x); } else if(str.at(i) == "D"){ x = x - 1; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 14 | if(str.at(i) == "I"){ | ~~~~~~~~~~^~~~~~ a.cc:17:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | } else if(str.at(i) == "D"){ | ~~~~~~~~~~^~~~~~
s552011447
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int x = 0; int ans = 0; vector<str> str; for(int i=0; i<n; i++){ if(str.at(i) == "I"){ x = x + 1; int ans = max(ans,x); } else if(str.at(i) == "D"){ x = x - 1; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:10: error: 'str' was not declared in this scope; did you mean 'std'? 12 | vector<str> str; | ^~~ | std a.cc:12:13: error: template argument 1 is invalid 12 | vector<str> str; | ^ a.cc:12:13: error: template argument 2 is invalid
s751544292
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; string s; cin >> n; cin >> s; int x = 0; int ans = 0; vector<str> str; for(int i=0; i<n; i++){ if(str.at(i) == "I"){ x = x + 1; int ans = max(ans,x); } else if(str.at(i) == "D"){ x = x - 1; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:10: error: 'str' was not declared in this scope; did you mean 'std'? 12 | vector<str> str; | ^~~ | std a.cc:12:13: error: template argument 1 is invalid 12 | vector<str> str; | ^ a.cc:12:13: error: template argument 2 is invalid a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s795377064
p03827
C++
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <cmath> #include <deque> #include <iterator> #include <map> #include <queue> #include <stack> #include <string> #include <tuple> #include <utility> #include <limits> #include <iomanip> using namespace std; using ll=long long; template<class T> using V = vector<T>; template<class T, class U> using P = pair<T, U>; using vll = V<ll>; using vvll = V<vll>; #define rep(i, k, n) for (ll i=k; i<(ll)n; ++i) #define REP(i, n) rep(i, 0, n) template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;} template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;} const ll MOD = 1000000007; const ll HIGHINF = (ll)1e18; int main() { ll n; cin >> n; string s; cin >> s; ll ans = 0, x = 0; REP(i, n) { if (s[i] == 'I') x++; else (s[i] == 'D') x--; chmax(ans, x); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:37:23: error: expected ';' before 'x' 37 | else (s[i] == 'D') x--; | ^~ | ;
s206389108
p03827
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int x=0 , max=0; for (int i=0 ; i<n ; i++){ if(s[i]=='I'){ x++; if(x>max) max=x; }else if (s[i]=='D'){ x--; } } cout << max<< endl; return 0; } #include <iostream> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int x=0 , max=0; for (int i=0 ; i<n ; i++){ if(s[i]=='I'){ x++; if(x>max) max=x; }else if (s[i]=='D'){ x--; } } cout << max<< endl; return 0; }
a.cc:29:5: error: redefinition of 'int main()' 29 | int main() | ^~~~ a.cc:5:5: note: 'int main()' previously defined here 5 | int main() | ^~~~
s819291146
p03827
C++
#include<iostream> using namespace std; int main() { int n,m,temp,x=0; char a[101]; int b[100]={0}; cin>>n; if((n>=1)&&(n<=100)) for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]=='I'){ ++x; b[i]=x;} else if(a[i]=='D'){ --x; b[i]=x;} else m=x; } for(int c=0;c<n-1;c++){ if(b[c]>b[c+1]) temp=b[c]; b[c]=b[c+1]; b[c+1]=temp; }} if(b[n-1>0]) cout<<b[n-1]; else cout<<"0"; return 0; }
a.cc:28:12: error: expected unqualified-id before 'if' 28 | if(b[n-1>0]) | ^~ a.cc:30:12: error: expected unqualified-id before 'else' 30 | else | ^~~~ a.cc:35:5: error: expected unqualified-id before 'return' 35 | return 0; | ^~~~~~ a.cc:36:1: error: expected declaration before '}' token 36 | } | ^
s160202790
p03827
C++
#include<iostream> using namespace std; int main() { int n,m,temp,x=0; char[101]; int b[100]={0}; cin>>n; if((n>=1)&&(n<=100)) for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]=='I'){ ++x; b[i]=x;} else if(a[i]=='D'){ --x; b[i]=x;} else m=x; } for(int c=0;c<n-1;c++){ if(b[c]>b[c+1]) temp=b[c]; b[c]=b[c+1]; b[c+1]=temp; }} if(b[n-1>0]) cout<<b[n-1]; else cout<<"0"; return 0; }
a.cc: In function 'int main()': a.cc:6:10: error: expected identifier before numeric constant 6 | char[101]; | ^~~ a.cc:6:10: error: expected ']' before numeric constant 6 | char[101]; | ^~~ | ] a.cc:6:9: error: structured binding declaration cannot have type 'char' 6 | char[101]; | ^ a.cc:6:9: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:6:9: error: empty structured binding declaration a.cc:6:14: error: expected initializer before ';' token 6 | char[101]; | ^ a.cc:11:14: error: 'a' was not declared in this scope 11 | cin>>a[i]; | ^ a.cc: At global scope: a.cc:28:12: error: expected unqualified-id before 'if' 28 | if(b[n-1>0]) | ^~ a.cc:30:12: error: expected unqualified-id before 'else' 30 | else | ^~~~ a.cc:35:5: error: expected unqualified-id before 'return' 35 | return 0; | ^~~~~~ a.cc:36:1: error: expected declaration before '}' token 36 | } | ^
s530935359
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,x = 0,maxi = 0; string s; cin >> n >> s; for(int i = 0; i < n; i++){ if(s.at(i) == 'I'){ x++; maxi = max(maxi,x); }else{ x--; } cout << maxi << endl; }
a.cc: In function 'int main()': a.cc:16:2: error: expected '}' at end of input 16 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s515336652
p03827
C++
#include<iostream> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main() { int ans=0; int sum=0; int N; string S; cin >> N >>S; rep(i,N) { if(S[i]=="I") { sum++; if(sum>ans) { ans=sum; } } else { sum--; } } cout << ans <<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(S[i]=="I")
s896372934
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ inr n=0,count=0,max=0; string s; cin>>n>>s; for(int j=0;j<n;j++){ if(s[j]=='I') count++; else count--; if(max>count) max=count; } cout<<max; }
a.cc: In function 'int main()': a.cc:4:9: error: 'inr' was not declared in this scope; did you mean 'int'? 4 | inr n=0,count=0,max=0; | ^~~ | int a.cc:6:14: error: 'n' was not declared in this scope 6 | cin>>n>>s; | ^ a.cc:9:25: error: no post-increment operator for type 9 | count++; | ^~ a.cc:11:25: error: no post-decrement operator for type 11 | count--; | ^~ a.cc:12:23: error: invalid operands of types '<unresolved overloaded function type>' and '<unresolved overloaded function type>' to binary 'operator>' 12 | if(max>count) | ~~~^~~~~~ a.cc:13:25: error: overloaded function with no contextual type information 13 | max=count; | ^~~~~ a.cc:15:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 15 | cout<<max; | ~~~~^~~~~ 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) |
s016105538
p03827
Java
public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int N = sc.nextInt(); String S = sc.next(); int res = 0; int count = 0; for(int i = 0; i < N; i++) { if('I' == S.charAt(i)) count++; else count--; res = Math.max(res, count); } System.out.println(res); } // Scanner Close } }
Main.java:4: error: cannot find symbol try (Scanner sc = new Scanner(System.in)) { ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol try (Scanner sc = new Scanner(System.in)) { ^ symbol: class Scanner location: class Main 2 errors
s925465302
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int n, I ,x=0 ,in=0; scanf("%d",&n); string s; cin>>s; for(int i=0 ;i<n;i++) if(s[i]=='I') { x++; I++; } else { x--; I+=0; } for( i=0 ;x<n;x++) int f=max(x,I-1); cout<<f; }**/
a.cc: In function 'int main()': a.cc:22:23: error: 'i' was not declared in this scope 22 | for( i=0 ;x<n;x++) | ^ a.cc:27:15: error: 'f' was not declared in this scope 27 | cout<<f; | ^ a.cc: At global scope: a.cc:29:4: error: expected unqualified-id before '/' token 29 | }**/ | ^
s982592235
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,max; string S; cin>>N>>S; int x=0; vector<int> a(N); for(int i=0;i<N;i++){ if(S.at(i)='I') x++; else x--; a.at(i)=x; } max=0; for(int i=0;i<N;i++){ if(max<a.at(i);) max=a.at(i); } cout<<max<<endl; }
a.cc: In function 'int main()': a.cc:14:20: error: expected primary-expression before ')' token 14 | if(max<a.at(i);) max=a.at(i); | ^
s526006962
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; string S; cin>>N>>S; int x=0; for(int i=0;i<N;i++){ if(S.at(i)='I') x++; else x--; } cout<<x<<endl;
a.cc: In function 'int main()': a.cc:11:17: error: expected '}' at end of input 11 | cout<<x<<endl; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s898027029
p03827
C++
(let ((n (read)) (s (read-line)) (ans 0) (ans-max 0)) (loop for i across s do (if (eq i #\D) (decf ans) (progn (incf ans) (setf ans-max (max ans ans-max))))) (princ ans-max))
a.cc:6:25: error: stray '#' in program 6 | do (if (eq i #\D) (decf ans) | ^ a.cc:6:26: error: stray '\' in program 6 | do (if (eq i #\D) (decf ans) | ^ a.cc:1:5: error: expected ')' before '(' token 1 | (let ((n (read)) | ~ ^~ | )
s848531948
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int a , b=0 , m=0; cin>>a; char s[a]; for(int i=0; i<=n ;i++){ cin>>s[i]; if(s[i]=='I'){ ++b; ++i; } else if (s[i]=='D'){ --b; ++i; } if (b>m) m=b; } cout<<m; return 0; }
a.cc: In function 'int main()': a.cc:8:21: error: 'n' was not declared in this scope 8 | for(int i=0; i<=n ;i++){ | ^
s881171867
p03827
C++
#include<iostream> using namespace std; int main() { int N,maxm,x=0; cin>>N; char S[N]; for(int i=0;i<N;i++){ cin>>S[i]; if(S[i]=='I') { x++;} else if(S[i]=='D') {x--;} if(x>=maxm) maxm=x; }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:4:1: note: to match this '{' 4 | { | ^
s725564546
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int a , b=0 , m=0; cin>>a; char s[a]; for(int i=0; i<=n ;){ cin>>s[i]; if(s[i]=='I'){ ++b; ++i; } else if (s[i]=='D'){ --b; ++i; } if (b>m) m=b; } cout<<m; return 0; }
a.cc: In function 'int main()': a.cc:8:21: error: 'n' was not declared in this scope 8 | for(int i=0; i<=n ;){ | ^
s671588068
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int x=0,Y=0,n; cin>>n; char s[n]; for(int i=0;i<n;i++) { scanf("%c",&s[i]); if(s[i]=='I'||s[i]=='D') { if(s[i]=='D') { x--; } if(s[i]=='I') { x++; } } } if(x>=0) { cout<<x; } else { cout<<"x=0" } ; return 0; }
a.cc: In function 'int main()': a.cc:33:28: error: expected ';' before '}' token 33 | cout<<"x=0" | ^ | ; 34 | } | ~
s546363336
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int a , w=0 , m=0; cin>>a; char s[a]; for(int i=0; i<=n ;){ cin>>s[i]; if(s[i]=='I'){ ++w; ++i; } else if (s[i]=='D'){ --w; ++i; } if (w>m) m=w; } cout<<m; return 0; }
a.cc: In function 'int main()': a.cc:8:21: error: 'n' was not declared in this scope 8 | for(int i=0; i<=n ;){ | ^
s551377959
p03827
C++
#include<bits\stdc++.h> using namespace std; int main(){ int n; int X=0; int MX=0; cin>>n; char s[n]; cin>>s; for(int i=0;i<n;i++){ if(s[i]=='I') X++; MX=max(X,MX); if(s[i]=='D') abs(X--); } cout<<MX; return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s054486535
p03827
C++
#include<iostream> using namespace std; int main(){ int n,x=0; cin>> n; if((n>=1)&&(n<=100)){ char a[n]; for(int i=0;i<n;i++){ cin>>a[i]; if(a[i]=='I') x++; else if x--; else break; }} cout<<++x; return 0; }
a.cc: In function 'int main()': a.cc:15:17: error: expected '(' before 'x' 15 | x--; | ^ | ( a.cc:16:17: error: 'else' without a previous 'if' 16 | else | ^~~~
s226072659
p03827
C++
ank (92:21:37) 3 Comments A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Time limit 2000 ms Memory limit 262144 kB H - Increment Decrement All Copyright Reserved © 2010-2019 Xu Han Server Time: 2019-07-16 12:52:00 UTC+2 #20490016 | Nermeenatalla's solution for [Problem H] Status Wrong Answer Length 224 Lang C++14 (GCC 5.3.0) Submitted 2019-07-16 12:48:46 Shared 3.0 / 10.0 Select Code #include <iostream> using namespace std; int main(){ int x,temp=0,N; string s; cin>>N>>s; for(int i=0; i<N;i++) { if(s[i]=='I') { x+=1; if(x>temp) { temp=x; } } if(s[i]=='D') { x-=1; if(x>temp) { temp=x; } }} cout<<temp; return 0; }
a.cc:36:24: error: extended character © is not valid in an identifier 36 | All Copyright Reserved © 2010-2019 Xu Han | ^ a.cc:39:11: error: "|" is not a valid filename 39 | #20490016 | Nermeenatalla's solution for [Problem H] | ^ a.cc:39:26: warning: missing terminating ' character 39 | #20490016 | Nermeenatalla's solution for [Problem H] | ^ a.cc:45:12: error: too many decimal points in number 45 | C++14 (GCC 5.3.0) | ^~~~~ a.cc:1:5: error: expected constructor, destructor, or type conversion before '(' token 1 | ank (92:21:37) | ^ 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:52: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t)
s834588852
p03827
C++
#include <iostream> using namespace std; int main(){ int s,k; cin>>k>>s; for(int x=0;x<=k;x++) { for(int y=0;y<=k;y++) { int z=s-(x+y); if((z>=0)&&(z<=k){ count ++; }}}} cout<<count; return 0; }
a.cc:1:21: warning: extra tokens at end of #include directive 1 | #include <iostream> using namespace std; int main(){ int s,k; cin>>k>>s; for(int x=0;x<=k;x++) { for(int y=0;y<=k;y++) { int z=s-(x+y); if((z>=0)&&(z<=k){ count ++; }}}} cout<<count; 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
s173269303
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() {int n;cin>>n;string s;cin>>s; int x=0,mx=0; for(int i=0;i<n;i++) {if(s[i]=='I') {x++; } mx=max(x,mx); } if(s[i]=='D') {x--; } cout<<mx; return 0; }
a.cc: In function 'int main()': a.cc:12:6: error: 'i' was not declared in this scope 12 | if(s[i]=='D') | ^
s482742282
p03827
C++
#include<iostream> using namespace std; int main(){ int N,x=0; cin>>N; string S; cin>>S; for(int i=0;i<=N;i++){ if(S =="I") x+=1; else x-=1; } if(x>x+1){ cout<<x; }
a.cc: In function 'int main()': a.cc:16:18: error: expected '}' at end of input 16 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s861966620
p03827
C++
using namespace std; int main() { int n , max , count=0; scanf("%d", &n) ; char c[n]; scanf("%s" , &c) ; for(int i=0; i<n-1 ; i++ ) { if (c[i]== 'I') { max=count; count++; if (max<count) max=count; } else{ count--; } } if(max>=0) printf("%d" , max); return 0; }
a.cc: In function 'int main()': a.cc:4:1: error: 'scanf' was not declared in this scope 4 | scanf("%d", &n) ; | ^~~~~ a.cc:26:1: error: 'printf' was not declared in this scope 26 | printf("%d" , max); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | using namespace std;
s681803426
p03827
C++
using namespace std; int main() { int n , max , count=0; scanf("%d", &n) ; char c[n]; scanf("%s" , &c) ; for(int i=0; i<n-1 ; i++ ) { if (c[i]== 'I') { max=count; count++; if (max<count) max=count; } else{ count--; } } if(max>=0) printf("%d" , max); else printf("0"); return 0; }
a.cc: In function 'int main()': a.cc:4:1: error: 'scanf' was not declared in this scope 4 | scanf("%d", &n) ; | ^~~~~ a.cc:26:1: error: 'printf' was not declared in this scope 26 | printf("%d" , max); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | using namespace std; a.cc:28:1: error: 'printf' was not declared in this scope 28 | printf("0"); | ^~~~~~ a.cc:28:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s240160522
p03827
C++
#include <iostream> #include "string.h" using namespace std; int main(){ long long n,cnt=1; string s; cin>>n>>s; for(int i=0; i<n; i++){ if((int)s[i]==73){ cnt++; } else if((int)s[i]==68){ cnt--; } } cout<<cnt<<" "<<i<<endl; }
a.cc: In function 'int main()': a.cc:16:17: error: 'i' was not declared in this scope 16 | cout<<cnt<<" "<<i<<endl; | ^
s178115463
p03827
C++
#include <stdio.h> #include<cmath> #include<iostream> using namespace std; int main() { int N; cin>>N; char s[N]; scanf("%s",&s); if(s[N]==1) { s[N]+=1; cout<<max(s[N]); } else if(s[N]==-1) { s[N]-=1; cout<<max(s[N]); } else cout<<0; return 0; } }
a.cc: In function 'int main()': a.cc:14:18: error: no matching function for call to 'max(char&)' 14 | cout<<max(s[N]); | ~~~^~~~~~ In file included from /usr/include/c++/14/bits/specfun.h:43, from /usr/include/c++/14/cmath:3906, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc:19:18: error: no matching function for call to 'max(char&)' 19 | cout<<max(s[N]); | ~~~^~~~~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided a.cc: At global scope: a.cc:31:1: error: expected declaration before '}' token 31 | } | ^
s216223956
p03827
C
#include<stdio.h> int main(){ int n=0,a=0,b=0,max=0; char s[101]; scanf("%d %s", &n, s); for(a=0; a<n; a++){ if(s[a]=='I') b++; else b--; if(max<x) max=x; } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:13:16: error: 'x' undeclared (first use in this function) 13 | if(max<x) | ^ main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in
s117953450
p03827
C
#include<stdio.h> int main(){ int n=0,a=0,b=0,max=0; char s[101]; scanf("%d %s", &n, s); for(a=0; a<n; a++){ if(s[a]=='I') b++; else b--; if(max<x){ max=x; } } printf("%d",max); return 0; }
main.c: In function 'main': main.c:13:12: error: 'x' undeclared (first use in this function) 13 | if(max<x){ | ^ main.c:13:12: note: each undeclared identifier is reported only once for each function it appears in
s496618317
p03827
C
#include<stdio.h> int main(){ int n=0,a=0,b=0,max=0; char s[101]; scanf("%d %s", &n, s); for(a=0; a<n; a++){ if(s[a]=='I'){ b++; } else{ b--; } if(max<x){ max=x; } } printf("%d",max); return 0; }
main.c: In function 'main': main.c:13:16: error: 'x' undeclared (first use in this function) 13 | if(max<x){ | ^ main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in
s161346546
p03827
C
#include<stdio.h> int main(){ int n=0,a=0,b=0,max=0; char s[101]; scanf("%d", &n); scanf("%s",s); for(a=0; a<=n; a++){ if(s[a]=='I'){ b++; } else{ b--; } if(max<x){ max=x; } } printf("%d",max); return 0; }
main.c: In function 'main': main.c:14:16: error: 'x' undeclared (first use in this function) 14 | if(max<x){ | ^ main.c:14:16: note: each undeclared identifier is reported only once for each function it appears in
s093229916
p03827
C
#include<stdio.h> int main(){ int n=0; scanf("%d", &n); char s[101]; int a=0,b,max=0; scanf("%s",s); for(a=0; a<=n; a++){ if(s[a]=='I'){ b++; } else{ b--; } if(max<x){ max=x; } } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:15:16: error: 'x' undeclared (first use in this function) 15 | if(max<x){ | ^ main.c:15:16: note: each undeclared identifier is reported only once for each function it appears in