submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s386217054
p03827
C
#include <stdio.h> char s[101];//文字列// int main(void) { int i; int n;//文字数// int x = 0; int max = 0; scanf_s("%d", &n); for (i = 0; i <= n; i++) { scanf("%c", &s[i]); } for (i = 1; i <= n; i++) { if (s[i] == 'I') { x = x + 1; } else { x = x - 1; } if (x > max) { max = x; } ...
main.c: In function 'main': main.c:11:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 11 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s480608272
p03827
C++
#include <iostream> using namespace std; int main(){ int n, x = 0, ans = 0; string s; cin >> n >> s; for (int i = 0; i < n; i++) { if (s[i] == "I") { x++; } else { x--; } if (x > ans) ans = x; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if (s[i] == "I") {
s074746973
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int n, x=0, m=0; string s; cin >> n >> s; for(int i=0; i<n; i++){ if(s[i]=="I"){ x++; if(m<x)m=x; }else{ x--; } } cout << m << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if(s[i]=="I"){
s909164247
p03827
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0; i < n; i++) #define REPR(i, n) for(int i = n; i >= 0; i--) #define FOR(i, m, n) for(int i = m; i < n; i++) #define INF 2e9 #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; //const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; //const i...
a.cc: In function 'int main()': a.cc:24:35: error: expected ';' before 'x' 24 | else (s[i] == 'D') x--; | ^~ | ;
s501894700
p03827
C++
#include <iostream> #include <string> #include <cmath> using namespace std; int main() { int n; cin >> n; int x = 0; int res = 0; for (int i = 0; i < n; i++) { char s; cin >> s; if (s == 'I') x += 1; else (s == 'D') x -= 1; res = max(x, res); } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:20: error: expected ';' before 'x' 15 | else (s == 'D') x -= 1; | ^~ | ;
s356189798
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int a,i,array[101]; string s; cin>>a>>s; array[0]=0 for(i=1;i<a+1;i++){ if(s.at(i)=='D'){ array[i]=array[i-1]-1; }else{ array[i]=array[i-1]+1; } } sort(array,array+a); cout<<array[a]<<endl; }
a.cc: In function 'int main()': a.cc:8:13: error: expected ';' before 'for' 8 | array[0]=0 | ^ | ; 9 | for(i=1;i<a+1;i++){ | ~~~ a.cc:9:20: error: expected ';' before ')' token 9 | for(i=1;i<a+1;i++){ | ^ | ...
s794314399
p03827
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main(void){ int n,ma=0,x=0; string s; cin>>n>>s; for(int i=0;i<s.length;i++){ if(s[i]=='I'){ x++; ma=max(x,ma); }else{ x--; } } cout<<ma; return 0; }
a.cc: In function 'int main()': a.cc:9:21: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsi...
s908515986
p03827
C++
#include <bits/stdc++.h> using namespace std; string s; int main(){ cin>>s>>s; int cnt=0,ans=0; for(char c:s){ if(c=="I")cnt++; else cnt--; ans=max(ans,cnt); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(c=="I")cnt++; | ~^~~~~
s912293838
p03827
C++
#include<iostream> #include<string> int main() { /* // 整数の入力 int a; cin >> a; // スペース区切りの整数の入力 int b, c; cin >> b >> c; // 文字列の入力 string s; cin >> s; // 出力 cout << (a + b + c) << " " << s << endl; */ //23:23 int x = 0; string S; int N; cin >> N; cin >> S; int max = 0; for (int n = 0; n < N; n++)...
a.cc: In function 'int main()': a.cc:22:9: error: 'string' was not declared in this scope 22 | string S; | ^~~~~~ a.cc:22:9: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c+...
s430851207
p03827
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(){ char S[100]; int i,N,x=0,max=0; scanf("%s%s",&N,&S); for(i=0;i<"N";i++){ if(S[i]=="I"){ x+=1; if(x>max){ max=x; } } else{ x-=x; } printf("%d",max); } } }
a.cc: In function 'int main()': a.cc:7:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<"N";i++){ | ~^~~~ a.cc:8:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(S[i]=="I"){ | ~~~~^~~~~ a.cc: At glo...
s925594834
p03827
C++
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main(){ char S[100]; int i,N,x=0,max=0; scanf("%d%s",&N,&S); for(i=0;i<N;i++){ if(S[i]==I){ x+=1; if(x>max){ max=x; } } else{ x-=x; } printf("%d",max); } } }
a.cc: In function 'int main()': a.cc:8:13: error: 'I' was not declared in this scope 8 | if(S[i]==I){ | ^ a.cc: At global scope: a.cc:26:1: error: expected declaration before '}' token 26 | } | ^
s148763216
p03827
C++
#include <iostream> using namespace std; int main(void) { string num,mozi; int x,y = 0; cin >> num >> mozi; for(int i = 0;i <= num - 1;++i) { if(mozi[i] = "I") x = x + 1; else x = x - 1; if(y <= x) y = y + 1; } cout <...
a.cc: In function 'int main()': a.cc:10:28: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 10 | for(int i = 0;i <= num - 1;++i) | ~~~ ^ ~ | | | | | ...
s544888404
p03827
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include<cstdio> #include<bits/stdc++.h> using namespace std; using ll =long long; int main (void) { int N; cin >> N; int x=0,ans=0; while(n--){ char c = getchar(); x+= c == 'I'?1:-1; if (x>ans) ans=x; ...
a.cc: In function 'int main()': a.cc:15:9: error: 'n' was not declared in this scope 15 | while(n--){ | ^
s592596718
p03827
C
int a;int b;int c;int main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a---1;){ d[7-a]=='I'?++b:--b; b>c?c=b:c+=0; } printf("%d\n",c); }
main.c: In function 'main': main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | scanf("%d",&a); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | int a;int b;int c;int main(){ main.c:2:3: warni...
s558618605
p03827
C
a;b;c;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a---1;){ d[7-a]=='I'?++b:--b; b>c?c=b:c+=0; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:3: error: type defaults to 'int'...
s325705194
p03827
C
a;b;c;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;main(){ | ^ main.c:1:3: error: type defaults to 'int'...
s497823909
p03827
C
a;b;c;d;main(){ scanf("%d",&a); char d[a+1]; scanf("%c",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:3: error: type defaults to '...
s892488835
p03827
C
a;b;c;d;main(){ scanf("%d",&a); char d[a+1]; scanf("%s",d); for(;a--;){ d[7-a]=='I'?++b:--b; b>c?c=b:c=c; } printf("%d\n",c); }
main.c:1:1: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | a;b;c;d;main(){ | ^ main.c:1:3: error: type defaults to '...
s582644284
p03827
C++
// ------------------------------------ // Date:2018/ 2/28 // Problem:ABC 052 IncrementDecrement b.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto&& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1...
a.cc: In function 'int main()': a.cc:31:24: error: 'n' was not declared in this scope 31 | if (S[i] == 'I') ++n; | ^ a.cc:32:24: error: 'n' was not declared in this scope 32 | else --n; | ^ a.cc:33:15: error: 'n' was not declared in thi...
s014028858
p03827
C++
#include<iostream> using namespace std; int main(){ int n, ans = 0; cin >> n; n ^= n; string s; cin >> s; for(char c : s)ans = max(ans, c == 'I' ? ++n : --n); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:1: error: '\U0000ff5d' was not declared in this scope 10 | } | ^~ a.cc:10:3: error: expected '}' at end of input 10 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s671337556
p03827
C++
#include<iostream> using namespace std; int main(){ int n, ans = 0; cin >> n; n ^= n; string s; cin >> s; for(char c : s)ans = max(ans, c == 'I' ? ++n : --n); cout >> ans >> endl; return 0; }
a.cc: In function 'int main()': a.cc:8:8: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 8 | cout >> ans >> endl; | ~~~~ ^~ ~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:8:8: note: ca...
s239886577
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { int n, i, ans = 0, k = 0; string s; cin >> n >> s; for(i = 0; i < n; i++){ if(s[i] == 'I'){ k++; if(k > ans)ans = k; } else{ k--; } } cout << ans << endl;
a.cc: In function 'int main()': a.cc:23:23: error: expected '}' at end of input 23 | cout << ans << endl; | ^ a.cc:7:1: note: to match this '{' 7 | { | ^
s290696909
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s992922552
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s677063421
p03827
C++
n = int(input()) s = list(input()) for i in s: if i =="I": n += 1 else: n -= 1 print(n)
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s153298706
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++){ if(S[i]==I) X++; else X=X-1; } std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:8:11: error: 'I' was not declared in this scope 8 | if(S[i]==I) | ^
s844990699
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++;){ if(S[i]==I) X++; else X=X-1; } std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:7:20: error: expected ')' before ';' token 7 | for(int i=0;i<N;i++;){ | ~ ^ | ) a.cc:7:21: error: expected primary-expression before ')' token 7 | for(int i=0;i<N;i++;){ | ^
s748450719
p03827
C++
#include <iostream> #include <string> int main(){ int N,X=0; std::string S; std::cin >> N >> S; for(int i=0;i<N;i++;) if(S[i]==I) X++; else X=X-1; std::cout << X << std::endl; }
a.cc: In function 'int main()': a.cc:7:20: error: expected ')' before ';' token 7 | for(int i=0;i<N;i++;) | ~ ^ | ) a.cc:7:21: error: expected primary-expression before ')' token 7 | for(int i=0;i<N;i++;) | ^ a.cc:10:2: error: 'else' with...
s989923220
p03827
Java
public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); char[] letters = scanner.next().toCharArray(); int ans = 0; int count = 0; for (int i = 0; i < n; i++) { if (letters[i]=='I') { count++; }else { count--; } ...
Main.java:4: error: cannot find symbol Scanner scanner = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner scanner = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s293521899
p03827
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <numeric> #include <string> using namespace std; const double PI = acos(-1.0); const string alp = "abcdefghijklmnopqrstuvwxyz"; const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(...
a.cc: In function 'int main()': a.cc:22:13: error: invalid types 'int[int]' for array subscript 22 | if(n[i]=="I"){ | ^ a.cc:26:13: error: 'X' was not declared in this scope 26 | X--; | ^
s114848509
p03827
C++
#include <iostream> #include <algorithm> using namespace std; int ans[101],n;   int main(void){ char s[101]; cin>>n>>s; for(int i=1;i<=n;i++){ if(s[i-1]=='I')ans[i]=ans[i-1]+1; else ans[i]=ans[i-1]-1; } sort(ans,ans+n+1,greater<int>()); cout<<ans[0]<<endl; }
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^
s491177536
p03827
C++
#include <iostream> #include <algorithm> using namespace std; int ans[101],n;   int main(void){ char s[101]; cin>>n>>s; for(int i=1;i<=n;i++){ if(s[i-1]=='I')ans[i]=ans[i-1]+1; else ans[i]=ans[i-1]-1; } for(int i=0;i<n;i++)cout<<ans[i]<<' '; sort(ans,ans+n+1,greater<int>()); ...
a.cc:5:1: error: extended character   is not valid in an identifier 5 |   | ^ a.cc:5:1: error: '\U000000a0' does not name a type 5 |   | ^
s373207388
p03827
C++
def main(): n = int(input()) s = input() x, maxv = 0, 0 for c in s: if c == 'I': x += 1 elif c == 'D': x -= 1 if x > maxv: maxv = x print(maxv) if __name__ == "__main__": main()
a.cc:1:1: error: 'def' does not name a type 1 | def main(): | ^~~
s376307520
p03827
C
#include<stdio.h> int main() { int n,x=0,i,y,I,D; scanf("%d",&n); int a[n]; for(i=0,i<n,i++) { scanf("%d",&a[i]); y=a[i]; if(a[i]=I||a[i]=D) { if(a[i]=I) x=x+1; else x=x-1; } for(i=0,i<n-1,i+...
main.c: In function 'main': main.c:8:20: error: expected ';' before ')' token 8 | for(i=0,i<n,i++) | ^ | ; main.c:8:20: error: expected expression before ')' token main.c:12:24: error: lvalue required as left operand of assignment 12 | if(a[i]=I||a[i]...
s704303823
p03827
C
#include<stdio.h> int main() { int n,x=0,i,y; scanf("%d",&n); int a[n]; for(i=0,i<n,i++) { scanf("%d",&a[i]); y=a[i] if(a[i]=I||a[i]=D) { if(a[i]=I) x=x+1; else x=x-1 } for(i=0,i<n-1,i++) ...
main.c: In function 'main': main.c:8:20: error: expected ';' before ')' token 8 | for(i=0,i<n,i++) | ^ | ; main.c:8:20: error: expected expression before ')' token main.c:11:15: error: expected ';' before 'if' 11 | y=a[i] | ^ ...
s841579237
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max=0; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[i]=='I') {x++; } if(arr[i]=='D') {x--;} if(x>=max) {max=x;} } cout<<max; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'i' was not declared in this scope 14 | if(arr[i]=='I') | ^ a.cc:17:8: error: 'i' was not declared in this scope 17 | if(arr[i]=='D') | ^
s855710807
p03827
C
include<stdio.h> #include<string.h> int main() { int n,i,x=0,t=0; char st[100]; scanf("%d",&n); scanf("%s",st); for(i=0;i<n;i++) { if(st[i]=='I') x++; else if(st[i]=='D') x--; if(x>t) t=x; } printf("%d",t); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^ In file included from main.c:2: /usr/include/string.h:44:22: error: unknown type name 'size_t' 44 | size_t __n) __THROW __nonnull ((1, 2)); | ...
s581281154
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; int max=0; int z=1; int N; cin>>N; char str[N]; gets(str); for(int i=0;i<N;i++) { if(str[i]=='I') { x++; if(x>=max) { max=x;} else { z=1;} else if(str[i]=='D') x--; if(x>=...
a.cc: In function 'int main()': a.cc:8:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(str); | ^~~~ | getw a.cc:15:7: error: expected '}' before 'else' 15 | else if(str[i]=='D') | ^~~~ a.cc:11:9: note: to match this '{' 11 | {...
s901847269
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; int max=0; int z=1; int N; cin>>N; char str[N]; gets(str); for(int i=0;i<N;i++) { if(str[i]=='I') { x++; if(x>=max) { max=x;} else { z=1;} else if(str[i]=='D') x--; if(x>=...
a.cc: In function 'int main()': a.cc:8:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(str); | ^~~~ | getw a.cc:15:7: error: expected '}' before 'else' 15 | else if(str[i]=='D') | ^~~~ a.cc:11:9: note: to match this '{' 11 | {...
s834790566
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[j]=='I') {x++; s[j]=x;} if(arr[j]=='D') {x--; s[j]=x; } } for(j=0;j<N;j++) {max=s[0]; if(s[j]>s[j+1]) {max=s[j]; } } cout<<m...
a.cc: In function 'int main()': a.cc:21:5: error: 'j' was not declared in this scope 21 | for(j=0;j<N;j++) | ^
s419884411
p03827
C++
#include<iostream> #include<string> using std::strlen; int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc:3:12: error: 'strlen' has not been declared in 'std' 3 | using std::strlen; | ^~~~~~ a.cc: In function 'int main()': a.cc:10:3: error: 'strlen' was not declared in this scope 10 | N=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixab...
s010048115
p03827
C++
#include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100]; char ch; cin>>N; for(int i=0;i<N;i++) {cin>>ch; if(ch=='D'||ch=='I') arr[i]=ch; } for(int j=0;j<N;j++) { if(arr[i]=='I') #include<iostream> using namespace std; int main() { int arr[100],N,x=0,s[100],max; char ch; cin>>N; for(int i=0;i<N;i+...
a.cc: In function 'int main()': a.cc:13:10: error: 'i' was not declared in this scope 13 | { if(arr[i]=='I') | ^ a.cc:16:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 16 | int main() | ^~ a.cc:16:9: note: remove parentheses to default-init...
s687812764
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; using string::strlen; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: using-declaration for member at non-class scope 6 | using string::strlen; | ^~~~~~ a.cc:10:3: error: 'strlen' was not declared in this scope 10 | N=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is ...
s653019131
p03827
C++
#include<iostream> #include<string> using namespace std; int main() { int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>...
s331001017
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(i=0;i<N;i++) { if(a[i]=='I') {x++; if(x>l); l=x; } else if(a[i]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>...
s606499453
p03827
C++
#include<iostream> #include<string> int main() { using namespace std; int x=0,N,i,l=0; char a[100]; cin>>a; N=strlen(a); for(I=0;I<N;I++) { if(a[I]=='I') {x++; if(x>l); l=x; } else if(a[I]=='D') {x--; if(x>l) l=x; } } cout<<l; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'strlen' was not declared in this scope 9 | N=strlen(a); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>...
s707997268
p03827
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() { char S[1000];int x=0,N; cin>>N; cout<<endl; for(int j=0;j<N;j++) {cin>>S[j];} y=x; for(int i=0;i<N;i++) { if(S[i]=='I') {x+=1;} else if(S[i]=='D') {x-=1;} if(x>y) {y=x;} } cout<<y; return 0; }
a.cc: In function 'int main()': a.cc:15:1: error: 'y' was not declared in this scope 15 | y=x; | ^
s899588745
p03827
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() { char S[];int x=0,N; cin>>N; cout<<endl; for(int j=0;j<N;j++) {cin>>S[j];} y=x; for(int i=0;i<N;i++) { if(S[i]=='I') {x+=1;} else if(S[i]=='D') {x-=1;} if(x>y) {y=x;} } cout<<y; return 0; }
a.cc: In function 'int main()': a.cc:10:6: error: storage size of 'S' isn't known 10 | char S[];int x=0,N; | ^ a.cc:15:1: error: 'y' was not declared in this scope 15 | y=x; | ^
s348138908
p03827
Java
import java.io.*; import java.util.*; import java.lang.*; public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int a=sc.nextInt(); String b=sc.next(); int x=0; char c[]=b.toCharArray(); int f[]; ...
Main.java:24: error: variable f might not have been initialized f[d]=x; ^ Main.java:27: error: variable f might not have been initialized Arrays.sort(f); ^ 2 errors
s181161070
p03827
C++
#include <iostream> using namespace std; int main() { int a; string s; cin>>a; cin>>s; int x=0; int max1=0; for(i=0;s<=a;i++) { x++; } else { x--; } cout<< max(x,max1); return 0 ; }
a.cc: In function 'int main()': a.cc:12:13: error: 'i' was not declared in this scope 12 | for(i=0;s<=a;i++) | ^ a.cc:12:18: error: no match for 'operator<=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 12 | for(i=0;s<=a;i++) | ...
s069512408
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int max(int *arr, int n) { int max=arr[0]; for (int i=1;i<n;i++) { if (arr[i]>max) max=arr[i]; } return max; } int main() { char S[100]; int N, a[101]; a[0]=0; cin>>N; gets(S); for (int i=0; i<N;...
a.cc: In function 'int main()': a.cc:23:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 23 | gets(S); | ^~~~ | getw
s949376533
p03827
C++
#include<iostream> #include<stdio.h> using namespace std; int main() { int x=0; char str[10]; int max=1; int z=1; gets(str); for(int i=0;i<10;i++) { if(str[i]==I) { x++; if(x>=max) { max=x;} else { z=1;} } else if(str[i]==D) { x--; if(x>=max) ...
a.cc: In function 'int main()': a.cc:7:6: error: 'gets' was not declared in this scope; did you mean 'getw'? 7 | gets(str); | ^~~~ | getw a.cc:9:19: error: 'I' was not declared in this scope 9 | { if(str[i]==I) | ^ a.cc:14:23: error: 'D' was not declared i...
s922789141
p03827
C++
#include<iostream> #include<stdio.h> #include<conio.h> using namespace std; int main() { int x=0; char str[10]; int max=1; int z=1; gets(str); for(int i=0;i<10;i++) { if(str[i]==I) { x++; if(x>=max) { max=x;} else { z=1;} } else if(str[i]==D) { x--; ...
a.cc:3:9: fatal error: conio.h: No such file or directory 3 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s440415772
p03827
C
#include<stdio.h> int main() { int h,w; char a[100][100]; for(i=0;i<h;i++) for(j=0;j<w;j++); scanf("%c",a[i][j]); for(i=0;i<h+2;i++) { for(j=0;j<w+2;j++) { if(i==0||i==(h+1)||j==0||j==w+1) printf("#"); else printf("%c",a[i-1][j-1]) } } return 0; }
main.c: In function 'main': main.c:6:5: error: 'i' undeclared (first use in this function) 6 | for(i=0;i<h;i++) | ^ main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in main.c:7:5: error: 'j' undeclared (first use in this function) 7 | for(j=0;j<w;j++); ...
s812040874
p03827
C++
#include<iostream> #include<conio.h> #include<stdio.h> using namespace std; int max(int *arr, int n) { int max=arr[0]; for (int i=1;i<n;i++) { if (arr[i]>max) max=arr[i]; } return max; } int main() { char S[100]; int N, a[101]; a[0]=0; cin>>N; gets(S); ...
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s630470466
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); ...
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader 1 error
s821789035
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); ...
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader Main.java:15: error: variable x is already defined in method main(String[]) for (char x : ca) { ^ 2 errors
s481558570
p03827
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); ...
Main.java:13: error: cannot find symbol char[] ca = in.next().toCharArray(); ^ symbol: method next() location: variable in of type InputReader Main.java:15: error: variable x is already defined in method main(String[]) for (char x : ca) { ^ Main.java:17: error: incompatible...
s222272304
p03827
C++
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(); char[] ca = in.next().toCharArray(); ...
a.cc:3:1: error: 'import' does not name a type 3 | import java.io.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: ...
s399332404
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<a;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | ...
s201553805
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<b.size;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | ...
s674406309
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a>>b; for(int i=0;i<b.size;i++){ if(b[i]=="D"){ c--; } if(b[i]=="I"){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [100]' {aka 'std::__cxx11::basic_string<char> [100]'}) 8 | cin>>a>>b; | ~~~~~~^~~ | | ...
s368055259
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ | ~~~~^~~~~ | | | | | char | ...
s520239887
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c,; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'){ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:5:17: error: expected unqualified-id before ';' token 5 | int a,c,; | ^ a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ |...
s034379686
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int a,c,; string b[100]; c=0; cin>>a; for(int i=0;i<a;i++){ cin>>b[i]; if(b[i]=='D'){ c--; } if(b[i])=='I'{ c++; } cout<<c<<endl; } }
a.cc: In function 'int main()': a.cc:5:17: error: expected unqualified-id before ';' token 5 | int a,c,; | ^ a.cc:11:24: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char') 11 | if(b[i]=='D'){ |...
s249036565
p03827
C++
#include<iostream> #include<algorithm> #include<string> using namespace std; int main() { int N, i, max = 0; cin >> N >> S; string S; char I; int x[N+1]; x[0]=0; for (i = 0; i < N+1; i++) { if (S[i] = 'I') { x[i + 1] = x[i] + 1; } else { x[i + 1] = x[i] - 1; } if (x[i] > max) { max = x[...
a.cc: In function 'int main()': a.cc:8:17: error: 'S' was not declared in this scope 8 | cin >> N >> S; | ^
s432478014
p03827
Java
import java.util.*; public class IncrementDecrement { public static void main(String[] args) { Scanner sc1 = new Scanner(System.in); int n = sc1.nextInt(); String s = sc1.next(); String[] sArray = s.split(""); int ans = 0; int x = 0; for (int i = 0; i < n; i++) { if (sArray[i].equals("I")) { x = ...
Main.java:3: error: class IncrementDecrement is public, should be declared in a file named IncrementDecrement.java public class IncrementDecrement { ^ 1 error
s914308672
p03827
C++
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for (int i=0;i<(n);i++) int main(void) { int N; String S; cin >> N; cin >> S; int ans = 0; int cur = 0; REP(i,N) { if (S[i] == "I") cur++; else cur--; ans = max(ans, cur); } cout << ans << '\n'; }
a.cc: In function 'int main()': a.cc:7:3: error: 'String' was not declared in this scope 7 | String S; | ^~~~~~ a.cc:9:16: error: 'S' was not declared in this scope 9 | cin >> S; | ^
s025566054
p03827
Java
import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(input.readLine()); String S = input.readLine();...
Main.java:6: error: cannot find symbol BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:6: error: cannot find symbol BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); ...
s885633665
p03827
C++
#include<bits/stdc++.h> int N; char str[101]; int main() { scanf("%d", &N); scanf("%s", &str); int x = 0, ans = 0; for(int i=0;i<N;i++) { if(str[i]=='I') x++; else x--; ans = max(ans, x); } printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:14:15: error: 'max' was not declared in this scope; did you mean 'std::max'? 14 | ans = max(ans, x); | ^~~ | std::max In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14...
s008761734
p03827
Java
import java.util.*; public Main { public static void main(String[] args) { // TODO Auto-generated method stub int x=0; Scanner s=new Scanner(System.in); int N=s.nextInt(); String S=s.next(); int i=0; int y[]=new int[S.length()]; int max=0; for(i=0;i<S.length();i++){ if(S.charAt(i)=='I'){ ...
Main.java:4: error: class, interface, enum, or record expected public Main { ^ Main.java:6: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) Main.java:41: error: class, interface...
s596459709
p03827
C++
#include <cstdio> int main (){ int N 、k = 0 、x = 0 ; char S [ 100 ]; scanf ("%d" 、&N ); scanf ("%s" 、S ); for (int i = 0 ; i < N ; i ++){ if (S [ i ] == 'I' ){ x + = 1 ; if (k <= x ){ k = x ; }} } else { x - = 1 ; }} }} printf ("%d" 、k ); 0を返します。 }}
a.cc:3:7: error: extended character 、 is not valid in an identifier 3 | int N 、k = 0 、x = 0 ; | ^ a.cc:3:15: error: extended character 、 is not valid in an identifier 3 | int N 、k = 0 、x = 0 ; | ^ a.cc:5:15: error: extended character 、 is not valid in an identifier 5 | scanf ...
s293548019
p03827
C++
#include <stdio.h> int main(){ int N; int sum = 0; scanf("%d", &N); char s[N]; scanf("%s", s); for(int i=0; i<N; i++){ if(s[i]=="I") sum++; else sum--; } printf("%d", sum); return 0; }
a.cc: In function 'int main()': a.cc:11:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[i]=="I") sum++; | ~~~~^~~~~
s417430442
p03827
C++
#include <stdio.h> int main(){ int N; int sum = 0; scanf("%d", &N); char s[N]; scanf("%s", &s); for(int i=0; i<N; i++){ if(s[i]=="I") sum++; else sum--; } printf("%d", sum); return 0; }
a.cc: In function 'int main()': a.cc:11:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if(s[i]=="I") sum++; | ~~~~^~~~~
s037344336
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { int X = 0, max_v = 0; string S; cin >> N >> S; for (int i = 0; i < N; i++) { X = S[i] == 'I'? X + 1 : X - 1; max_v = X > max_v ? X : max_v; } cout << max_v; return 0; }
a.cc: In function 'int main()': a.cc:8:16: error: 'N' was not declared in this scope 8 | cin >> N >> S; | ^
s162727096
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int N, score=0, max=0; string str; cin >> N; cin >> str; for(int i=0; i<N; i++){ if(str[i] == 'I'){ score++; max = max(max, score); } else score--; } cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: 'max' cannot be used as a function 14 | max = max(max, score); | ~~~^~~~~~~~~~~~
s784526996
p03827
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; string s; cin >> s; int x = max = 0; for(int i = 0; i < n; i++){ if(s[i] = 'I'){ x++; if(x > max){ max = x; } }else{ x--; } } cout << max << endl; }
a.cc: In function 'int main()': a.cc:8:17: error: overloaded function with no contextual type information 8 | int x = max = 0; | ^ a.cc:12:12: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>' 12 | if(x > max){ | ...
s026265506
p03827
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> vec; vec.push_back(0); for(int i = 0; i < N; i++) { vec.push_back((S[i] == 'I') ? vec[i] + 1 : vec[i] - 1); } cout << *std::max_element(vec.begin(), vec.end()) << endl; return...
a.cc: In function 'int main()': a.cc:20:17: error: 'max_element' is not a member of 'std'; did you mean 'tuple_element'? 20 | cout << *std::max_element(vec.begin(), vec.end()) << endl; | ^~~~~~~~~~~ | tuple_element
s364426127
p03827
C++
#include <iostream> #include <vector> using namespace std; int main() { int N; string S; cin >> N >> S; vector<int> vec; vec.push_back(0); for(int i = 0; i < N; i++) { if(S[i] == 'I') { vec.push_back(vec[i] + 1); } else { vec.push_back(vec[i] - 1); } } cout << *max_element(...
a.cc: In function 'int main()': a.cc:24:12: error: 'max_element' was not declared in this scope 24 | cout << *max_element(vec.begin(), vec.end()) << endl; | ^~~~~~~~~~~
s648657963
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ int N; string S; cin >> N; cin >> S; int x = 0; int X[N]; for(int i=0; i<N; i++){ if(S[i] == 'I'){ x += 1; } else if(S[i] == 'D'){ x -= 1; } X[i] = x; } int max_x = 0; for(int i=0; i<N; i++){ ...
a.cc: In function 'int main()': a.cc:34:25: error: expected '}' at end of input 34 | cout << max_x << endl; | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s458231611
p03827
C++
package main import ( "fmt" ) func main() { var n, x, m int var s string fmt.Scan(&n, &s) for _, c := range s { // fmt.Println(c) if c == 'I' { x++ if x > m { m = x } } else { x-- } } fmt.Println(m) }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~
s871403035
p03827
C
//F #include<stdio.h> #include<conio.h> main() { int i, n; scanf("%d",&n); int max=0, x=0; char S[n], ch; scanf("%c",&ch); for(i=0; i<n; i++){ scanf("%c",&S[i]); } S[n]='\0'; for(i=0; i<n; i++) { if(S[i]=='I') { x++; } else { x--; } if(x>max) { max=x; } } printf("%d", max); return 0;...
main.c:3:9: fatal error: conio.h: No such file or directory 3 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s759211910
p03827
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(a) a.begin(), a.end() #define MS(m,v) memset(m,v,sizeof(m)) typedef long long ll; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; typedef pair<int,...
a.cc: In function 'int main()': a.cc:28:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 28 | if (i == "I") x++; | ~~^~~~~~
s776713322
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n)...
a.cc: In function 'int main()': a.cc:103:26: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)' 103 | MAX = max(x, max); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-l...
s944016907
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n)...
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in e...
s084153529
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n)...
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in e...
s185951640
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; #define REPS(i, a, n) for (int i = (a); i < (n); ++i) #define REP(i, n) REPS(i, 0, n) #define RREP(i, n) REPS(i, 1, n + 1) #define DEPS(i, a, n)...
a.cc: In function 'int main()': a.cc:10:23: error: expected ',' or ';' before 'for' 10 | #define REPS(i, a, n) for (int i = (a); i < (n); ++i) | ^~~ a.cc:11:19: note: in expansion of macro 'REPS' 11 | #define REP(i, n) REPS(i, 0, n) | ^~~~ a.cc:100:9: note: in e...
s340768546
p03827
C++
#include<iostream> using namespace std; int mainI(){ int N,cnt=0,max=0,i; cin>>N; char S[N+1]; for(i=0;i<N;i++){ cin>>S[i]; if(S[i]=='I')cnt++;else cnt--; if(max<cnt) max=cnt; } cout<<max<<endl; return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s511710792
p03827
C++
#include<stdio.h> using namespace std; int main(){ int x,Max;x=Max=0; int n;string s;cin>>n>>s; for(char c:s){ if(c=='I')x++; else x--; Max=max(Max,x); } cout<<Max<<endl; }
a.cc: In function 'int main()': a.cc:6:15: error: 'string' was not declared in this scope 6 | int n;string s;cin>>n>>s; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include<stdio.h> +++ |+#includ...
s021258114
p03827
C++
#include<cmath> using namespace std; int main() { long long m,n,i,a; string s; while(cin>>n) { cin>>s; a=0;m=0; for(i=0;i<n;i++) { if(s[i]=='I') a++; else a--; m=max(a,m); } cout<<m<<endl; } retu...
a.cc: In function 'int main()': a.cc:6:5: error: 'string' was not declared in this scope 6 | string s; | ^~~~~~ a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include<cmath> +++ |+#include <string> 2 | using namespac...
s922680285
p03827
C++
#include <iostream> #include <string> using namespace std; int main(){ int N, max = 0, count = 0; string S; cin >> N; cin >> S; for (int i = 0; i < N; ++i) { if(S[i] == 'I'){ count++; if(count > max) max = count; } else if(S[i] == 'D') count--; } cout << max; ...
a.cc: In function 'int main()': a.cc:24:3: error: 'retu' was not declared in this scope 24 | retu | ^~~~ a.cc:24:7: error: expected '}' at end of input 24 | retu | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s242458647
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; string s; int ans=0; cin>>n>>s; for(auto i:s){ if(i=='I') ++ans; else --ans; }
a.cc: In function 'int main()': a.cc:13:10: error: expected '}' at end of input 13 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s307319223
p03827
Java
import java.util.Scanner; public class Main { public static void main (String[ ] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String s = sc.next(); char[] ch = s.toCharArray(); int x = 0; int m = 0; for (int i = 0; i < n; i++) { if (ch[i] == 'I') { x++; m = Math.max(m...
Main.java:15: error: int cannot be dereferenced m = Math.max(m. x); ^ 1 error
s722457570
p03827
C++
#include <iostream> #include <string> using namespace std; int main() { string str; cin >> str; int32_t output{ 0 }, x{ 0 }; for(auto itr = str.cbegin(), itr != str.cend(); ++itr) { if(*itr == 'I') { ++x; } else { --x; } if(x > output) {...
a.cc: In function 'int main()': a.cc:12:37: error: expected ';' before '!=' token 12 | for(auto itr = str.cbegin(), itr != str.cend(); ++itr) { | ^~~ | ; a.cc:12:38: error: expected primary-expression before '!=' token 12 | ...
s104702102
p03827
C
#include <stdio.h> #include <stdlib.h> int main(){ int N; scanf("%d",&N); char s = calloc(N+1,sizeof(char)); scanf("%s",s); int i,x=0; int max = 0; for(i = 0; i < N; i++){ if(s[i]=='I'){ x++; }else if(s[i]=='D'){ x--; } if(x > max){ ...
main.c: In function 'main': main.c:6:14: error: initialization of 'char' from 'void *' makes integer from pointer without a cast [-Wint-conversion] 6 | char s = calloc(N+1,sizeof(char)); | ^~~~~~ main.c:11:13: error: subscripted value is neither array nor pointer nor vector 11 | if...
s991622590
p03827
C
#include <stdio.h> int main(){ int n; char s[1000]; int s[100]; int i; int x=1; int o=0; scanf("%d%s",&n,s); for(i=0;i<n;i++){ if(s[i]=='I'){ ++x;s[o]=x; o++; }else if(s[i]=='D'){ --x; s[o]=x; o++; } } printf("%d",x); return 0; }
main.c: In function 'main': main.c:5:5: error: conflicting types for 's'; have 'int[100]' 5 | int s[100]; | ^ main.c:4:6: note: previous declaration of 's' with type 'char[1000]' 4 | char s[1000]; | ^
s100858481
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ string s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] == "I"){ b = b + 1; } if(s[i] == "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(s[i] == "I"){ a.cc:16:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 16 | if(s[i] == "D"){
s476857102
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ char s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] == "I"){ b = b + 1; } if(s[i] == "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: request for member 'size' in 's', which is of non-class type 'char' 12 | for (int i = 0; i < s.size(); i++){ | ^~~~ a.cc:13:21: error: invalid types 'char[int]' for array subscript 13 | if(s[i] == "I"){ ...
s207843990
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ char s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] = "I"){ b = b + 1; } if(s[i] = "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:31: error: request for member 'size' in 's', which is of non-class type 'char' 12 | for (int i = 0; i < s.size(); i++){ | ^~~~ a.cc:13:21: error: invalid types 'char[int]' for array subscript 13 | if(s[i] = "I"){ ...
s081090519
p03827
C++
#include "iostream" #include <string> using namespace std; int main(){ string s; int a; int b = 0; int c = 0; cin >> a; cin >> s; for (int i = 0; i < s.size(); i++){ if(s[i] = "I"){ b = b + 1; } if(s[i] = "D"){ b = b - 1; } if(b > c){ c = b; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:27: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 13 | if(s[i] = "I"){ | ^~~ | | | ...