submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s417706628
p03826
C++
#include<iostream> using namespace std; int main() { int a,b,c,d; cin >> a,b,c,d; e = a * b; f = c * d; if (e => f ) g = e; else g = f; cout << g; return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'e' was not declared in this scope 8 | e = a * b; | ^ a.cc:9:5: error: 'f' was not declared in this scope 9 | f = c * d; | ^ a.cc:10:12: error: expected primary-expression before '>' token 10 | if (e => f ) | ^ a.cc:11:5: error: 'g' was not declared in this scope 11 | g = e; | ^ a.cc:12:10: error: 'g' was not declared in this scope 12 | else g = f; | ^ a.cc:13:13: error: 'g' was not declared in this scope 13 | cout << g; | ^
s755974875
p03826
C++
#include<stdio.h> int main() { int a, b, c, d; scanf_s("%d %d %d %d",&a, &b, &c, &d); if (a < 1 || a>10 * 10 * 10 * 10) { printf("Error"); } if (b < 1 || b>10 * 10 * 10 * 10) { printf("Error"); } if (c < 1 || c>10 * 10 * 10 * 10) { printf("Error"); } if (d < 1 || d>10 * 10 * 10 * 10) { printf("Error"); } int x1; int x2; x1 = a*b; x2 = c*d; if (x1 > x2) { printf("%d", x1); } if (x1 < x2) { printf("%d", x2); } if (x1 == x2) { printf("%d", x1); } }
a.cc: In function 'int main()': a.cc:4:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 4 | scanf_s("%d %d %d %d",&a, &b, &c, &d); | ^~~~~~~ | scanf
s362159340
p03826
C++
data = list(map(int, input().split())) a, b, c, d = data print(max(a*b, c*d))
a.cc:1:1: error: 'data' does not name a type 1 | data = list(map(int, input().split())) | ^~~~
s642512312
p03826
C++
a, b, c, d = map(int, input().split()) if a*b >= c*d: print(a*b) else: print(c*d)
a.cc:1:1: error: 'a' does not name a type 1 | a, b, c, d = map(int, input().split()) | ^
s212614592
p03826
C++
#include <iostream> using namespace std; int main(void){ int a,b,c,d; cin>>a>>b>>c>>d; cout<<a*b>c*d?a*b:c*d<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:10: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int') 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ~~~~~~~~~^~~~ | | | | | int | std::basic_ostream<char> a.cc:8:10: note: candidate: 'operator>(int, int)' (built-in) 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ~~~~~~~~~^~~~ a.cc:8:10: 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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ 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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ 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:8:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ /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:8:13: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ 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:8:13: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ^ a.cc:8:22: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 8 | cout<<a*b>c*d?a*b:c*d<<endl; | ~~~^~~~~~
s496684647
p03826
Java
import java.util.Scanner; //ABC052 public class TwoRectangles { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = sc.nextLong(), b = sc.nextLong(); long c = sc.nextLong(), d = sc.nextLong(); System.out.println(Math.max(a * b, c * d)); } }
Main.java:6: error: class TwoRectangles is public, should be declared in a file named TwoRectangles.java public class TwoRectangles { ^ 1 error
s048775599
p03826
C
#include <stdio.h> int main(){ int a[len]; char k[len]; int i; int y; int temp; int h; int a; int b; int c; int d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a*b>=c*d){ printf("%d",a*b); } else if(a*b<=c*d){ printf("%d",c*d); } return 0; }
main.c: In function 'main': main.c:4:7: error: 'len' undeclared (first use in this function) 4 | int a[len]; | ^~~ main.c:4:7: note: each undeclared identifier is reported only once for each function it appears in
s805303984
p03826
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scan=new Scanner(); int a=scan.nextInt(); int b=scan.nextInt(); int c=scan.nextInt(); int d=scan.nextInt(); System.out.println(Math.max(a*b,c*d)); } }
Main.java:4: error: no suitable constructor found for Scanner(no arguments) Scanner scan=new Scanner(); ^ constructor Scanner.Scanner(Readable,Pattern) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Readable) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(InputStream,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(File,CharsetDecoder) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(Path,Charset) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable (actual and formal argument lists differ in length) constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable (actual and formal argument lists differ in length) 1 error
s566044588
p03826
C++
include <iostream> using namespace std; int main(){ int a, b, c, d, e, f; cin << a << b << c << d; e = a*b; f = c*d; if(e >= f){ cout << e << endl; } else{ cout << f << endl; } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ a.cc: In function 'int main()': a.cc:6:9: error: 'cin' was not declared in this scope 6 | cin << a << b << c << d; | ^~~ a.cc:10:17: error: 'cout' was not declared in this scope 10 | cout << e << endl; | ^~~~ a.cc:10:30: error: 'endl' was not declared in this scope 10 | cout << e << endl; | ^~~~ a.cc:13:17: error: 'cout' was not declared in this scope 13 | cout << f << endl; | ^~~~ a.cc:13:30: error: 'endl' was not declared in this scope 13 | cout << f << endl; | ^~~~
s761667475
p03826
C++
#include<bits/stdc++.h> #define pb push_back #define ppb pop_back #define mp make_pair #define all(x) (x).begin(),(x).end() #define sz(x) (int)(x).size() #define ll long long #define bit __builtin_popcountll #define sqr(x) (x) * (x) #define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++) #define debug(x) cout << #x <<" = " << x << endl #define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i) #define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first <<" " << v[i].second << endl; #define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl; using namespace std; typedef pair<int, int> pii; const double eps = 1e-9; const double pi = acos(-1.0); const int INF = 1000000000; const int dx[4] = {0, 0, 1, -1}; const int dy[4] = {1, -1, 0, 0}; const int N = 100001; int a[N]; int a,b,c,d; int main() { ios_base::sync_with_stdio(0); cin >> a >> b >> c >> d; if (a * b >= c * d) cout << a * b << endl; else cout << c * d << endl; return 0; }
a.cc:30:5: error: conflicting declaration 'int a' 30 | int a,b,c,d; | ^ a.cc:29:5: note: previous declaration as 'int a [100001]' 29 | int a[N]; | ^ a.cc: In function 'int main()': a.cc:33:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [100001]') 33 | cin >> a >> b >> c >> d; | ~~~ ^~ ~ | | | | | int [100001] | 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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:33:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*' 33 | cin >> a >> b >> c >> d; | ^ /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:33:16: error: invalid conversion from 'int*' to 'short int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(short int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(short unsigned int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(unsigned int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'long int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(long int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(long unsigned int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'long long int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(long long int)((int*)(& a))' 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:33:16: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive] 33 | cin >> a >> b >> c >> d; | ^ | | | int* a.cc:33:16: error: cannot bind rvalue '(long long unsigned int)((int*)(& a))' 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:33:16: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 33 | cin >> a >> b >> c >> d; | ^ /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 'int [100001]' 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 'int [100001]' 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 'int [100001]' 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 'int [100001]' 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>; __ist
s751983675
p03826
C++
#include<string> #include<iostream> #include<algorithm> #include<set> #include<math.h> #include<vector> #include<sstream> #include<queue> #include<functional> #include<bitset> #include<cstdio> #include<iomanip> using namespace std; #define REP(i,n) for(int i=0;i < n; i++) #define RREP(i,n) for(int i=n-1;i >=0; i--) #define p(a) (a) * (a) #define p2(a,b) p((a) - (b)) #define MAX 100002 int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a*b == c*d) { cout << a*b << endl; } else if (a*b > c*d) { cout << a*b << endl; } else { cout << c*d << endl; } return 0; }#include<string> #include<iostream> #include<algorithm> #include<set> #include<math.h> #include<vector> #include<sstream> #include<queue> #include<functional> #include<bitset> #include<cstdio> #include<iomanip> using namespace std; #define REP(i,n) for(int i=0;i < n; i++) #define RREP(i,n) for(int i=n-1;i >=0; i--) #define p(a) (a) * (a) #define p2(a,b) p((a) - (b)) #define MAX 100002 int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (a*b == c*d) { cout << a*b << endl; } else if (a*b > c*d) { cout << a*b << endl; } else { cout << c*d << endl; } return 0; }
a.cc:34:2: error: stray '#' in program 34 | }#include<string> | ^ a.cc:34:3: error: 'include' does not name a type 34 | }#include<string> | ^~~~~~~ a.cc:54:5: error: redefinition of 'int main()' 54 | int main() { | ^~~~ a.cc:21:5: note: 'int main()' previously defined here 21 | int main() { | ^~~~
s330379256
p03826
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cnt = 0; String str = ""; int N1 = Integer.parseInt(sc.next()); int N2 = Integer.parseInt(sc.next()); int W1 = Integer.parseInt(sc.next()); int W2 = Integer.parseInt(sc.next()); System.out.print(Math.max(N1N2,W1*W2)); System.out.println(); } }
Main.java:21: error: cannot find symbol System.out.print(Math.max(N1N2,W1*W2)); ^ symbol: variable N1N2 location: class Main 1 error
s206688156
p03826
C++
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cnt = 0; String str = ""; int N1 = Integer.parseInt(sc.next()); int N2 = Integer.parseInt(sc.next()); int W1 = Integer.parseInt(sc.next()); int W2 = Integer.parseInt(sc.next()); System.out.print(Math.max(N1N2,W1*W2)); System.out.println(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s800223838
p03827
C++
#include<bits/stdc++.h> int main(){ int n; cin >> n; string s; cin >> s; int ans = 0; int maxans = 0; for(int i = 0; i < n; i++){ if(s[i] == 'I') ans ++; else ans--; maxans = max(ans,maxans); } return 0; }
a.cc: In function 'int main()': a.cc:5:2: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | cin >> n; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:6:2: error: 'string' was not declared in this scope 6 | string s; | ^~~~~~ a.cc:6:2: note: suggested alternatives: In file included from /usr/include/c++/14/string:41, 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/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:7:9: error: 's' was not declared in this scope 7 | cin >> s; | ^ a.cc:13:14: error: 'max' was not declared in this scope; did you mean 'std::max'? 13 | maxans = max(ans,maxans); | ^~~ | std::max In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~
s003749359
p03827
Java
import java.util.*; public class Main4 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); String st=sc.nextLine(); int x=0; int ans=0; for(int i=0;i<n;i++) { if(st.charAt(i)=='I') x++; else x--; ans=Math.max(ans, x); } System.out.println(ans); } }
Main.java:3: error: class Main4 is public, should be declared in a file named Main4.java public class Main4 { ^ 1 error
s828556980
p03827
C++
#include <iostream> #include <String> using namespace std; int main() { int n,ans,sum; string s; cin>>n>>s; for(int i=0;i<n;i++) { if(s[i]=='I') { ans++; } else if(s[i]=='D') { ans++; } sum=max(sum,ans); } cout<<sum; return 0; }
a.cc:2:10: fatal error: String: No such file or directory 2 | #include <String> | ^~~~~~~~ compilation terminated.
s750752618
p03827
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int x=0; string s cin>>s; int t[n]; for(int j=0;j<n;j++){ if(s[j]=='I'){ x++; t[j]=x; continue; } x--; t[j]=x; } int m=t[0]; for(int p=0;p<n;p++){ for(int q=p+1;q<n;q++){ if (t[q]>t[p]){ m=t[q]; } } } cout<<m; }
a.cc: In function 'int main()': a.cc:9:9: error: expected initializer before 'cin' 9 | cin>>s; | ^~~ a.cc:12:20: error: 's' was not declared in this scope 12 | if(s[j]=='I'){ | ^
s645418361
p03827
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int x=0; int s[n],t[n]; for(int i=0;i<n;i++){ cin>>s[i]; } for(int j=0;j<n;j++){ if(s[j]=='I'){ x++; t[j]=x; continue; } x--; t[j]=x; } int m=t[0]; for(int p=0;p<n;p++){ for(int q=p+1;q<n;q++){ if t[q]>t[p]{ m=t[q]; } } } cout<<m; }
a.cc: In function 'int main()': a.cc:24:28: error: expected '(' before 't' 24 | if t[q]>t[p]{ | ^ | (
s707838618
p03827
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int x=0; int s[n],t[n]; for(int i=0;i<n;i++){ cin>>s[i]; } for(int j=0;j<n;j++){ if(s[j]=='I'){ x++; t[j]=x; continue; } x--; t[j]=x; } cout<<t.max(); }
a.cc: In function 'int main()': a.cc:21:17: error: request for member 'max' in 't', which is of non-class type 'int [n]' 21 | cout<<t.max(); | ^~~
s734362246
p03827
C++
#include <iostream> using namespace std; int main() { int n; cin>>n; int x=0; int s[n],t[n]; for(int i=0;i<n;i++){ cin>>s[i]; } for(int j=0;j<n;j++){ if(s[j]=='I'){ x++; t[j]==x; continue; } x--; t[j]==x; } cout<<t.max(); }
a.cc: In function 'int main()': a.cc:21:17: error: request for member 'max' in 't', which is of non-class type 'int [n]' 21 | cout<<t.max(); | ^~~
s720658454
p03827
C++
#include <iostream> using namespace std; int main() { int n; int x=0; int s[n],t[n]; for(int i=0;i<n;i++){ cin>>s[i]; } for(int j=0;j<n;j++){ if(s[j]=="i"){ x++; t[j]==x; continue; } x--; t[j]==x; } cout<<t.max(); }
a.cc: In function 'int main()': a.cc:12:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | if(s[j]=="i"){ | ~~~~^~~~~ a.cc:20:17: error: request for member 'max' in 't', which is of non-class type 'int [n]' 20 | cout<<t.max(); | ^~~
s956943973
p03827
C++
#include <iostream> using namespace std; int main(){ int x,n,biggest; string s[n]; cin >> n; cin >> s; for(int i=0;i<=n;i++){ if(s[i]=='I'){ x++; x=biggest; }else{ x--; } }cout<< biggest; }
a.cc: In function 'int main()': a.cc:8:5: 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]'}) 8 | 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:8:8: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 8 | cin >> 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 8 | cin >> s; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:8:8: 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:8:8: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 8 | 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_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) |
s819269322
p03827
C++
#include<iostream> using namespace std; int main(){ int Q; cin >> Q; string str; int x = 0; while(cin >> str){ for(int i = 0; i < str.length(); i++){ if(str[i] == 'I'){ x += 1; }else{ x -= 1; } } cout << x; } } v
a.cc:19:1: error: 'v' does not name a type 19 | v | ^
s643057094
p03827
C++
#include<iostream> using namespace std; int main(){ int x=0, maxX=0; int N; string S; cin >> N >> S; for(int i=0; i<N; i++){ if(S[i] == 'I'){ x++; }else { x--; } maxX = x > maxX ? x : maxX; } cout << maxX << '\n' }
a.cc: In function 'int main()': a.cc:17:25: error: expected ';' before '}' token 17 | cout << maxX << '\n' | ^ | ; 18 | } | ~
s623910492
p03827
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int n,x=0,max=0; cin>>n; string s; cin>>s; rep(i, n){ if(s[i]=='I') x++; if(max<x) max=x; else if(s[i]=='D') x--; } cout<<max<<endl; } ~
a.cc:22:2: error: expected class-name at end of input 22 | ~ | ^
s592208220
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll =long long; #define all(v) v.begin(),v.end() int main() { ll N; cin>>N; string S; cin>>S; ll ans=0; ll max=0; for(ll i=0;i<N;i++) { if(S[i]=='I') { ans++; } if(S[i]=='D') { ans--; } max=max(ans,max); } cout<<max<<endl; }
a.cc: In function 'int main()': a.cc:20:12: error: 'max' cannot be used as a function 20 | max=max(ans,max); | ~~~^~~~~~~~~
s597100674
p03827
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> s; int ans = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'I') ++sum; else --sum; ans = max(ans, sum); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:15: error: 'sum' was not declared in this scope 16 | ++sum; | ^~~ a.cc:18:15: error: 'sum' was not declared in this scope 18 | --sum; | ^~~ a.cc:19:24: error: 'sum' was not declared in this scope 19 | ans = max(ans, sum); | ^~~
s692279484
p03827
C++
#include<iostream> #include<string> using namespace std; bool chmax(int& a, int b){ if (a < b){ a = b; return true; } else return false; } int main(){ string s; cin >> s; int score=0, ans=0; for (int i=0; i<s.length(); i++){ if (s[i] == 'I') score++; else if (s[i] == 'D') score--; chmax(ans, score); } cout << ans << ensl; return 0; }
a.cc: In function 'int main()': a.cc:21:20: error: 'ensl' was not declared in this scope 21 | cout << ans << ensl; | ^~~~
s106445455
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int,int>; #define rep(i,s,n) for(int i = s; i < (int)(n); i++) int main() { int n; string s; cin >> n >> s; int x = 0,ans = 0; rep(i,0,s){ if(s[i] == 'I') x++; else x--; ans = max(ans,x); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:5:39: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int' 5 | #define rep(i,s,n) for(int i = s; i < (int)(n); i++) | ^~~~~~~~ a.cc:12:3: note: in expansion of macro 'rep' 12 | rep(i,0,s){ | ^~~
s949990430
p03827
C++
/* author : nishi5451 created : 12.08.2020 22:15:41 */ #include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) typedef long long ll; int main(){ int n; string s; cin >> n >> s; int now = 0; int mx = 0; rep(i,n){ if(s[i]=='I') now++; else if(s[i]=='D') now--; mx = max(now,mx); } coiut << mx << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:5: error: 'coiut' was not declared in this scope 23 | coiut << mx << endl; | ^~~~~
s066050955
p03827
C++
#include <stdio.h> int main(){ int test; scanf("%d", &test); char word[test]; int x = 0; int max = 0; for(int i = 0; i < n; i++){ scanf("%c", &word[i]); if(str[i] == 'D'){ x--; }else{ x++; } if(x > max){ max = x; } } printf("%d\n", max); return 0; }
a.cc: In function 'int main()': a.cc:9:24: error: 'n' was not declared in this scope 9 | for(int i = 0; i < n; i++){ | ^ a.cc:11:12: error: 'str' was not declared in this scope; did you mean 'std'? 11 | if(str[i] == 'D'){ | ^~~ | std
s913574749
p03827
C
#include <bits/stdc++.h> int main() { int x=0,N; scanf("%d",&N); char s[N+1]; scanf("%s",&s); int max=0; for(int i=0;i<N;i++){ if(s[i]=='I'){ x++; }else{ x--; } if(max<x){ max=x; } } printf("%d\n",max); return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s353746065
p03827
C++
#include <bits/stdc++.h> using namespace std; #define endl "\n" #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); typedef long long ll; typedef vector<int> vi;; typedef vector<ll> vll; #define l() length() #define sz() size() #define b() begin() #define e() end() #define all(x) x.begin(), x.end() #define pb(i) push_back(i) #define PB() pop_back() typedef pair<int, int> pii; typedef pair<ll,ll> pll; #define mp make_pair #define Fi first #define Se second const int maxx=1e6+9; // Happy Coding! // 1 way is to find compute all the sorted permutations and find the // positions of the current permutation. int _find(string &str){ int x=0; int ans=0; for(const char &ch : str){ if(ch=='I'){ x++; } else{ x--; } // cout<<x<<" "; ans=max(ans,x); }
a.cc: In function 'int _find(std::string&)': a.cc:46:6: error: expected '}' at end of input 46 | } | ^ a.cc:34:23: note: to match this '{' 34 | int _find(string &str){ | ^ a.cc:46:6: warning: no return statement in function returning non-void [-Wreturn-type] 46 | } | ^
s185750716
p03827
C++
#include<bits.stdc++.h> using namespace std; int main(){ int N; cin>>N; int A=0; int Ans=0; string S; cin>>S; for(int i=0; i<N; i++){ if(S.at(i)=='I') A++; else A--; Ans=max(Ans,A); } cout<<Ans<<endl; }
a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory 1 | #include<bits.stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s036743777
p03827
C++
#include<bits/stdc++.h> using namespace std; template <typename T> using vec = vector<T>; int main() { int n; cin >> n; char c; int x,M; for (int i = 0; i < n; i++) { cin >> c; if (c=='I') { x++; } else { x--; } M = max(x.M); } cout << M << endl; }
a.cc: In function 'int main()': a.cc:22:19: error: request for member 'M' in 'x', which is of non-class type 'int' 22 | M = max(x.M); | ^
s027771267
p03827
C++
n=int(input()) s=input() t=0 m=0 for x in s: if x=='I': t+=1 else: t-=1 m = max(m, t) print(max(m, 0))
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s674631103
p03827
C++
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define leadinz zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1)); using namespace __gnu_pbds; using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; string text="abcdefghijklmnopqrstuvwxyz"; const int maxn=1e6+7; // .--------------. // | Try First One| // '--------------' // | .--------------. // | | | // V V | // .--------------. | // | AC. |<---. | // '--------------' | | // (True)| |(False) | | // .--------' | | | // | V | | // | .--------------. | | // | | Try Again |----' | // | '--------------' | // | | // | .--------------. | // '->| Try Next One |-------' // '--------------' ll bin_pow(ll a,ll b,ll m) { ll res=1; a%=m; while(b>0){ if(b&1)res=res*a%m; b>>=1; a=a*a%m; } return res; } bool miller_rabin(ll d,ll n) { ll a=2+rand()%(n-4); ll x=bin_pow(a,d,n); if(x==1 || x==n-1)return true; while(d!=n-1){ x=(x*x)%n; d*=2; if(x==1)return false; if(x==n-1)return true; } return false; } bool prime(ll n,ll k) { if(n==1 || n==4)return false; if(n<=3)return true; ll d=n-1; while(d%2==0)d/=2; for(int i=0;i<k;i++){ if(!miller_rabin(d,n))return false; } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; string s; cin>>n>>s; int cnt=0; mx=0; for(auto x: s){ if(x=='I')cnt++; if(x=='D')cnt--; mx=max(mx,cnt); } cout<<mx<<endl; }
a.cc: In function 'int main()': a.cc:74:5: error: 'mx' was not declared in this scope 74 | mx=0; | ^~
s724879617
p03827
C++
#include <iostream> #include <vector> using namespace std; int main(void){ int n; string s; cin >> n; cin >> s; int t = 0; int ans = 0; for(int i = 0;i < n;i++{ switch(s[i]){ case 'I': t++; ans = max(ans,t); break; case 'D': t--; break; default: break; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:28: error: expected ')' before '{' token 13 | for(int i = 0;i < n;i++{ | ~ ^ | )
s227465887
p03827
C++
#include <iostream> #include <vector> using namespace std; int main(void){ int n; string s; cin >> n; cin >> s; int t = 0; int ans = 0; for(int i = 0;i < n;i++{ switch(s[i]){ case 'I': t++; ans = max(ans,t); break; case 'D': t--; break; default: break; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:28: error: expected ')' before '{' token 13 | for(int i = 0;i < n;i++{ | ~ ^ | )
s634689058
p03827
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int n,x=0,ans=0; string s; cin>>n>>s; for(auto i:s){ if(i=='I'){ x++; }else{ x--; } ans=max(ans,x); } cout<<"ans"<<endl;
a.cc: In function 'int main()': a.cc:17:21: error: expected '}' at end of input 17 | cout<<"ans"<<endl; | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s097943971
p03827
C++
import sys import math import bisect def main(): n = int(input()) max_val = 0 val = 0 for c in input(): if c == 'I': val += 1 elif c == 'D': val -= 1 max_val = max(max_val, val) print(max_val) if __name__ == "__main__": main()
a.cc:1:1: error: 'import' does not name a type 1 | import sys | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s450186646
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,nu=0,x=0; string s; cin>>n>>s; for(int i=0;i<n;i++){ if(s[i]=='I'){ nu++; } else if(s[i]=='D'){ nu--; } if(nu>x){ x=nu; } cout<<x<<endl; }
a.cc: In function 'int main()': a.cc:21:2: error: expected '}' at end of input 21 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s914637501
p03827
C++
#include <iostream> #include <string> #include <cmath> #include <algorithm> using namespace std; int main(){ int a,b,state,n; cin>>n; char data; cin>>data; b=0; a=0; state=0; for(int i=0;i<n;i++){ if(data[i]=='I')a+=1; else if(data[i]=='D')a-=1; if(a>b){ b=a; state=i+1; } } cout<<state; }
a.cc: In function 'int main()': a.cc:16:12: error: invalid types 'char[int]' for array subscript 16 | if(data[i]=='I')a+=1; | ^ a.cc:17:17: error: invalid types 'char[int]' for array subscript 17 | else if(data[i]=='D')a-=1; | ^
s150060628
p03827
C++
#include <iostream> #include <string> #include <cmath> #include <algorithm> using namespace std; int main(){ int a,b,state; cin>>a; char data; cin>>data; b=0; a=0; state=0; for(int i=0;i<sizeof(data)/sizeof(*data);i++){ if(data[i]=='I')a+=1; else if(data[i]=='D')a-=1; if(a>b){ b=a; state=i+1; } } cout<<state; }
a.cc: In function 'int main()': a.cc:15:37: error: invalid type argument of unary '*' (have 'char') 15 | for(int i=0;i<sizeof(data)/sizeof(*data);i++){ | ^~~~~ a.cc:16:12: error: invalid types 'char[int]' for array subscript 16 | if(data[i]=='I')a+=1; | ^ a.cc:17:17: error: invalid types 'char[int]' for array subscript 17 | else if(data[i]=='D')a-=1; | ^
s717832676
p03827
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll size, ans = ans_tmp = 0; string s; cin >> size >> s; for(int i = 0; i < size(); i++){ if(s[i] == 'I'){ ans_tmp++; ans = max(ans, ans_tmp); }else{ ans_tmp--; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:20: error: 'ans_tmp' was not declared in this scope 7 | ll size, ans = ans_tmp = 0; | ^~~~~~~ a.cc:11:28: error: 'size' cannot be used as a function 11 | for(int i = 0; i < size(); i++){ | ~~~~^~
s832018723
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x=0,cnt[105],val=-1000000; string s; cin>>n; cin>>s; for(int i=0;i<n;i++){ if(s[i]=='I') x++; else x--; cnt[i]=x; } cnt[n]=0; for(int i=0;i<=n;i++) val=max(val,cnt[i]); cout<<val<<endl; return 0;
a.cc: In function 'int main()': a.cc:16:18: error: expected '}' at end of input 16 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s805299462
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,x=0,cnt[105],val=-1000000; string s; cin>>n; cin>>s; for(int i=0;i<n;i++){ if(s[i]=='I') x++; else x--; cnt[i]=x; } cnt[n]=0; for(int i=0;i<=n;i++) val=max(val,cnt[i]); cout<<val<<endl; return 0;
a.cc: In function 'int main()': a.cc:16:18: error: expected '}' at end of input 16 | return 0; | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s555661839
p03827
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); for (int i = 0; i < n; i++) { cin >> vec.at(i); } return vec; } void output(vector<int> vec) { for (int i = 0; i < vec.size(); i++) { cout << vec[i] << " "; } return; } vector<vector<int>> input(int n, int m) { vector<vector<int>> table(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> table. at(i).at(j); } } return table; } void output(vector<vector<int>> table) { for (int i = 0; i < table.size(); i++) { for (int j = 0; j < table.at(0).size(); j++) { cout << table.at(i).at(j) << " "; } cout << endl; } } long long perm(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long perm = 1; for (int i = n; i > n - r; i--) { perm *= i; } return perm; } long long comb(int n, int r) { if (n < r) { cout << "error" << endl; return 0; } long long comb = perm(n,r); for (int i = r; i > 0; i--) { comb /= i; } return comb; } long long homo(int n, int r) { return comb(n + r - 1, n - 1); } long long fact(int n) { long long fact = 1; for (int i = n; i > 0; i--) { fact *= i; } return fact; } int gcd(int a, int b) { if (a % b == 0) { return(b); } else { return(gcd(b, a % b)); } } int lcm(int a, int b) { return a * b / gcd(a, b); } int main() { int n; string s; cin >> n >> s; int ans=0,x=0; 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:90:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 90 | if(s[i]=="I"){
s145490414
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, count=0; cin >> n; string s; cin >> s; for (char c: s){ if ( c == "I") count++; else count--; maxc = max(maxc,count); }
a.cc: In function 'int main()': a.cc:11:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | if ( c == "I") count++; | ~~^~~~~~ a.cc:13:17: error: 'maxc' was not declared in this scope 13 | maxc = max(maxc,count); | ^~~~ a.cc:14:2: error: expected '}' at end of input 14 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s323995843
p03827
C
#include <bits/stdc++.h> #define ll long long #define ld long double #define COIN const int #define ite iterator #define PII pair<int,int> #define PSI pair<string,int> #define PIS pair<int,string> #define REP(i,n) for((i)=0;(i)<(int)(n);(i)++) #define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--) #define ALL(c) (c).begin(), (c).end() #define sz(s) (s).size() #define CLEAR(x) memset(x,0,sizeof x); #define MP make_pair #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define X first #define Y second #define VI vector<int> #define VS vector<string> #define VII vector<PII> #define VVI vector<VI> #define PIII 3.1415926 #define PI 3.14 /*****************************************************************************/ using namespace std; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); string s; int n; ll ans=0,mx=0; cin >>n >>s; for (int i=0;i<n;i++) { if (s[i]=='I') ans++; else ans--; mx=max(mx,ans); } cout <<mx; return 0; } /****************************************************************************** ******************************************************************************/
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s582435135
p03827
C++
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() #define debug(v) \ cout << #v << ":"; \ for (auto x : v) \ { \ cout << x << ' '; \ } \ cout << endl; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } //cout<<fixed<<setprecision(15);有効数字15桁 //-std=c++14 //-std=gnu++17 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; string s; cin>>n>>s; int x=0; int ans=0; rep(i,n){ if(s[i]=='I')x++; else x--; chmax(ans,x) } cout<<ans<<"\n"; }
a.cc: In function 'int main()': a.cc:61:21: error: expected ';' before '}' token 61 | chmax(ans,x) | ^ | ; 62 | } | ~
s412236317
p03827
C++
//#include <tourist> #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p; const int INF = 1e9; const ll LINF = ll(1e18); const int MOD = 1000000007; const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0}; const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; #define yes cout << "Yes" << endl #define YES cout << "YES" << endl #define no cout << "No" << endl #define NO cout << "NO" << endl #define rep(i, n) for (int i = 0; i < n; i++) #define ALL(v) v.begin(), v.end() #define debug(v) \ cout << #v << ":"; \ for (auto x : v) \ { \ cout << x << ' '; \ } \ cout << endl; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } //cout<<fixed<<setprecision(15);有効数字15桁 //-std=c++14 //-std=gnu++17 ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b) * b; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; string s; cin>>n>>s; int x=0; int ans=0; rep(i,n){ if(s[i]=='I')x++; else x--; chmax(ans,0) } cout<<ans<<"\n"; }
a.cc: In function 'int main()': a.cc:61:21: error: expected ';' before '}' token 61 | chmax(ans,0) | ^ | ; 62 | } | ~
s626676919
p03827
C++
#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "unordered_set" #include "iomanip" #include "cmath" #include "random" #include "bitset" #include "cstdio" #include "numeric" #include "cassert" #include "ctime" using namespace std; using ll = long long; #define rep(i,n) for(int i = 0; i < n; i++) int main() { int n; cin >> n; string s; cin >> s; int x = 0; set<int> st; st.insert(0); rep(i, n) { if (s[i] == 'D') x--; else x++; st.insert(x); } cout << *rbegin(st) << endl; re
a.cc: In function 'int main()': a.cc:40:1: error: 're' was not declared in this scope; did you mean 'rep'? 40 | re | ^~ | rep a.cc:40:3: error: expected '}' at end of input 40 | re | ^ a.cc:26:12: note: to match this '{' 26 | int main() { | ^
s042068351
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ string s,ans=0,max=0; int n; cin>>n; cin>>s; for(int i=0;i<n;i++){ if(s[i]=='I') { ans++; if(ans>max) max=ans; }else ans--; } cout<<max<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:10: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 11 | ans++; | ~~~^~ a.cc:13:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive] 13 | }else ans--; | ~~~^~
s108801779
p03827
C++
#include<iostream> #include<string> using namespace std; int main(){ string s,ans,max=0; int n; cin>>n; cin>>s; for(int i=0;i<n;i++){ if(a[i]=='I') { ans++; if(ans>max) max=ans; }else ans--; } cout<<max<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:8: error: 'a' was not declared in this scope 10 | if(a[i]=='I') { | ^ a.cc:11:10: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 11 | ans++; | ~~~^~ a.cc:13:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive] 13 | }else ans--; | ~~~^~
s118883821
p03827
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; int main() { long long N,Q,a,b,count=0; string S; cin>>N>>S; int k=0; for (int i=0; i<N; i++){ if(S.at(i)=='I'){ count++;} else{ count--;} k=max(k,count);} cout<<k<<endl;}
a.cc: In function 'int main()': a.cc:15:8: error: no matching function for call to 'max(int&, long long int&)' 15 | k=max(k,count);} | ~~~^~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:15:8: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 15 | k=max(k,count);} | ~~~^~~~~~~~~ /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
s493184817
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(false); int n; cin>>n; string s; cin>>s; if(s[0]=='I'){ a[0]=1; }else{ a[0]=-1; } for(int i=1;i<n;i++){ if(s[i]=='I'){ a[i]=a[i-1]+1; }else{ a[i]=a[i-1]-1; } } sort(a,a+n); if(a[n-1]>=0){ cout<<a[n-1]; }else{ cout<<0; } }
a.cc: In function 'int main()': a.cc:12:5: error: 'a' was not declared in this scope 12 | a[0]=1; | ^ a.cc:14:5: error: 'a' was not declared in this scope 14 | a[0]=-1; | ^ a.cc:18:7: error: 'a' was not declared in this scope 18 | a[i]=a[i-1]+1; | ^ a.cc:20:8: error: 'a' was not declared in this scope 20 | a[i]=a[i-1]-1; | ^ a.cc:23:8: error: 'a' was not declared in this scope 23 | sort(a,a+n); | ^
s798048508
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n string s; cin >> n >> s; int x = 0; int ans = 0; for(char c:s){ if(c=='I') x++; else x--; ans = max(ans,x); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'string' 6 | string s; | ^~~~~~ a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'? 7 | cin >> n >> s; | ^ | yn a.cc:7:15: error: 's' was not declared in this scope 7 | cin >> n >> s; | ^
s391454419
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string s; cin >> s; int i,j; for(j=0;j<n;j++){ int x=0; for(i=0;i<j;i++){ if(s.at(i)=='I'){ x++; } if(s.at(i)=='D'){ x--; } x=max(0,x); } } cout << x; }
a.cc: In function 'int main()': a.cc:21:11: error: 'x' was not declared in this scope 21 | cout << x; | ^
s700331271
p03827
C++
#include<bits/stdc++.h> using namespace std; #define ft ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define pi pair<int,int> #define pb push_back #define F first #define S second const int N=2e5+3; //string s,p; //vector<int>v; //map<int,int>mp; int main() { ft ll t,i,j,n,m=-1,l=0,r; cin>>s; for(char c:s) { (c=='I')? l++:l--; m=max(m,l); } cout<<m<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:18:10: error: 's' was not declared in this scope 18 | cin>>s; | ^
s333236211
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; string s; cin >> s; int ans=0; int count=0; for (int i=0;i<n;++i){ if (s[i]==I){ count++; } if (s[i]==D){ count--; } ans=max(ans,count); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:15: error: 'I' was not declared in this scope 13 | if (s[i]==I){ | ^ a.cc:16:15: error: 'D' was not declared in this scope 16 | if (s[i]==D){ | ^
s178418005
p03827
C++
#include<bits/stdc++.h> using namespace std; #define int long long int main() { int n; cin>>n; int ans=0; int maxn=-100; while(n--) { char x; cin>>x; if(x=='I')ans++; else if(x=='D') ans--; maxn=max(maxn,ans); } cout<<maxn<<endl; return 0; }
cc1plus: error: '::main' must return 'int'
s300581857
p03827
C++
#include<bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(long long i=(l);i<(r);++i) #define REP(i,n) FOR(i,0,n) #define int long long signed main(){ string S; cin>>S; int x=0; int ans=0; REP(i,S.size()){ if(S[i]=='I')x++; if(S{i}=='D')x--; ans=max(ans,x); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:13: error: expected ')' before '{' token 14 | if(S{i}=='D')x--; | ~ ^ | ) a.cc:14:12: error: could not convert 'S' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 14 | if(S{i}=='D')x--; | ^ | | | std::string {aka std::__cxx11::basic_string<char>}
s417913970
p03827
C++
#include<bits/stdc++.h> using namespace std; #define FOR(i,l,r) for(long long i=(l);i<(r);++i) #define REP(i,n) FOR(i,0,n) #define int long long signed main(){ string S; cin>>S; int x=0; int ans=0; REP(i,S.size()){ if(S[i]=='I')x++; if(S{i}=='D')x--; ans=max(ans,x); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:13: error: expected ')' before '{' token 14 | if(S{i}=='D')x--; | ~ ^ | ) a.cc:14:12: error: could not convert 'S' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 14 | if(S{i}=='D')x--; | ^ | | | std::string {aka std::__cxx11::basic_string<char>}
s249779912
p03827
C++
#include <bits/stdc++.h> using namespace std; /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/ struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_; #define FOR(i, begin, end) for(int i=(begin);i<(end);i++) #define REP(i, n) FOR(i,0,n) #define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--) #define IREP(i, n) IFOR(i,0,n) #define Sort(v) sort(v.begin(), v.end()) #define Reverse(v) reverse(v.begin(), v.end()) #define all(v) v.begin(),v.end() #define SZ(v) ((int)v.size()) #define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x)) #define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x)) #define Max(a, b) a = max(a, b) #define Min(a, b) a = min(a, b) #define bit(n) (1LL<<(n)) #define bit_exist(x, n) ((x >> n) & 1) #define debug(x) cout << #x << "=" << x << endl; #define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; } #define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} } #define Return(ans) { cout << (ans) << endl; return 0; } #define pb push_back #define f first #define s second #define int long long #define INF 1000000000000000000 template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; } template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; } template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; } template<typename T> void Out(T x) { cout << x << endl; } template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); } using vec = vector<int>; using mat = vector<vec>; using Pii = pair<int, int>; using PiP = pair<int, Pii>; using PPi = pair<Pii, int>; using bools = vector<bool>; using pairs = vector<Pii>; //int dx[4] = {1,0,-1,0}; //int dy[4] = {0,1,0,-1}; //char d[4] = {'D','R','U','L'}; const int mod = 1000000007; //const int mod = 998244353; //#define Add(x, y) x = (x + (y)) % mod //#define Mult(x, y) x = (x * (y)) % mod #include <bits/stdc++.h> using namespace std; signed main(){ int N; string S; cin>>N>>S; vector<int> ans(N); int A=0; REP(i,N){ if(S[i]=='I'){ A ++ ; ans[i] = A; } else{ A --; ans[i] = A; } } Sort(ans); Reverse(ans); cout<<max(int 0,ans[0])<<endl; }
a.cc: In function 'int main()': a.cc:31:13: error: expected primary-expression before 'long' 31 | #define int long long | ^~~~ a.cc:76:15: note: in expansion of macro 'int' 76 | cout<<max(int 0,ans[0])<<endl; | ^~~
s754227624
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int n, i, x = 0, prev = INT_MIN, maxi; cin>>n; string s; cin>>s; for (i = 0; i < n; i++) { if (s[i] == 'I') x++; else x--; maxi = max(x, prev); prev = a[i]; } cout<<maxi; }
a.cc: In function 'int main()': a.cc:16:24: error: 'a' was not declared in this scope 16 | prev = a[i]; | ^
s436353756
p03827
C++
#include<bits/stdc++.h> using namespace std; int main() { int n, i, x = 0, prev = INT_MIN, max; cin>>n; string s; cin>>s; for (i = 0; i < n; i++) { if (s[i] == 'I') x++; else x--; max = max(x, prev); } cout<<max; }
a.cc: In function 'int main()': a.cc:15:26: error: 'max' cannot be used as a function 15 | max = max(x, prev); | ~~~^~~~~~~~~
s355411129
p03827
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (ll i = 0; i < n; i++) #define INF 9223372036854775807 #define all(x) (x).begin(), (x).end() int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, x = 0, ans = 0; string s; cin >> n >> s; REP(i, n) { if (s[i] == 'I') { x++; } else { x--; } ans = max(ans, x); } cout << ans << "\n"; }#include <bits/stdc++.h> using namespace std; using ll = long long; #define REP(i, n) for (ll i = 0; i < n; i++) #define INF 9223372036854775807 #define all(x) (x).begin(), (x).end() int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, x = 0, ans = 0; string s; cin >> n >> s; REP(i, n) { if (s[i] == 'I') { x++; } else { x--; } ans = max(ans, x); } cout << ans << "\n"; }
a.cc:29:2: error: stray '#' in program 29 | }#include <bits/stdc++.h> | ^ a.cc:29:3: error: 'include' does not name a type 29 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:38:5: error: redefinition of 'int main()' 38 | int main() { | ^~~~ a.cc:10:5: note: 'int main()' previously defined here 10 | int main() { | ^~~~
s777903333
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s(n); cin >> s; int x = 0, max = 0; for (int i=0; i<n; i++) { if (s.at(i) == 'I') { x++; if (x > max) { max = x; } } else { x--; } } cout << max << endl; }
a.cc: In function 'int main()': a.cc:8:13: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int&)' 8 | string s(n); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:8:12: note: cannot convert 'n' (type 'int') to type 'const char*' 8 | string s(n); | ^ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:540:34: note: no known conversion for argument 1 from 'int' to 'const std::allocator<char>&' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:527:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::ch
s557778950
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,a,X=0; cin >> N; string S(N); cin S; for(int i=0;i<N;i++){ if(S.at(i)=='I') X++; else X--; a=max(a,X) } cout << a << endl; }
a.cc: In function 'int main()': a.cc:7:13: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int&)' 7 | string S(N); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:7:12: note: cannot convert 'N' (type 'int') to type 'const char*' 7 | string S(N); | ^ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:540:34: note: no known conversion for argument 1 from 'int' to 'const std::allocator<char>&' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:527:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::ch
s877681166
p03827
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const int INF= 1e9+5; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main(){ ll x=0; ll n;cin>>n; string s;cin>>s; ll MAX=0; rep(i,n){ if(s[i]=='I')x++; if(s[i]=='D')x--; MAX=max(MAX,x); } cout<<MAX<<endl }
a.cc: In function 'int main()': a.cc:27:18: error: expected ';' before '}' token 27 | cout<<MAX<<endl | ^ | ; 28 | } | ~
s357504504
p03827
C++
int main(){ int n; string s; cin>>n; cin>>s; int ans=0; int now=0; for(int i=0;i<s.size();i++){ if(s[i]=='I'){ now++;} else{ now--; } ans=max(ans,now); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:4:1: error: 'string' was not declared in this scope 4 | string s; | ^~~~~~ a.cc:5:1: error: 'cin' was not declared in this scope 5 | cin>>n; | ^~~ a.cc:6:6: error: 's' was not declared in this scope 6 | cin>>s; | ^ a.cc:15:13: error: 'max' was not declared in this scope 15 | ans=max(ans,now); | ^~~ a.cc:18:1: error: 'cout' was not declared in this scope 18 | cout<<ans<<endl; | ^~~~ a.cc:18:12: error: 'endl' was not declared in this scope 18 | cout<<ans<<endl; | ^~~~
s426397231
p03827
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i < n; i++) typedef long long ll; using namespace std; int mod = 1000000007; int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); int ans = 0; int N; cin >> N; string S; cin >> S; int ans = 0, pos = 0; rep(i, N){ if(S[i] == 'I') pos++; else pos--; ans = max(ans, pos); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: redeclaration of 'int ans' 15 | int ans = 0, pos = 0; | ^~~ a.cc:12:9: note: 'int ans' previously declared here 12 | int ans = 0; | ^~~
s884572792
p03827
C++
#include <bits/stdc++.h> using namespace std; int main () { int MAX = 0 , sum = 0 , n; char s; cin >> n; while(n--){ cin >> s; s == 'I' ? (sum++) : (sum--); MAX = max (MAX , sum); } cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 12 | cout << max << endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
s097478989
p03827
C++
#include"bits/stdc++.h" using namespace std; int main() { int N, S; cin >> N >> S; int x = 0; int record = 0; for (int i = 0;i < N;++i) { if (S[i] == 'I') { x += 1; } else { x -= 1; } if (x > record) { record = x; } } cout << record << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:22: error: invalid types 'int[int]' for array subscript 10 | if (S[i] == 'I') { | ^
s983593191
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; string S; cin >> N >> S; int ans = 0; int count = 0; for (int i = 0; i < N; i++) { if (S[i] == 'I') { count++; } else if (S[i] == 'D') { count--+ } ans = max(ans,count); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: expected primary-expression before '}' token 15 | } | ^
s347792890
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s(n); cin >> s; int x=0; int y=0; for(int i=0;i<n;i++){ if(s.at(i)=='I'){ x++; } else{ x--; } y = max(y,x); } cout << y << endl; }
a.cc: In function 'int main()': a.cc:7:13: error: no matching function for call to 'std::__cxx11::basic_string<char>::basic_string(int&)' 7 | string s(n); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:800:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 800 | basic_string(const _Tp& __t, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:800:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = int; _Res = void; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:797:30: required from here 797 | template<typename _Tp, typename = _If_sv<_Tp, void>> | ^~~~~~~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, void>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate: 'template<class _Tp, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Tp&, size_type, size_type, const _Alloc&) [with <template-parameter-2-2> = _Tp; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 788 | basic_string(const _Tp& __t, size_type __pos, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:788:9: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(_InputIterator, _InputIterator, const _Alloc&) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 765 | basic_string(_InputIterator __beg, _InputIterator __end, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:765:9: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(size_type, _CharT, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 669 | basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:669:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:646:7: note: candidate: 'template<class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 646 | basic_string(const _CharT* __s, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:646:7: note: template argument deduction/substitution failed: a.cc:7:12: note: cannot convert 'n' (type 'int') to type 'const char*' 7 | string s(n); | ^ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 721 | basic_string(basic_string&& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:721:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 716 | basic_string(const basic_string& __str, const _Alloc& __a) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:716:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:711:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::initializer_list<_Tp>, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:711:45: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<char>' 711 | basic_string(initializer_list<_CharT> __l, const _Alloc& __a = _Alloc()) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:682:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 682 | basic_string(basic_string&& __str) noexcept | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:682:35: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>&&' 682 | basic_string(basic_string&& __str) noexcept | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 624 | basic_string(const _CharT* __s, size_type __n, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:624:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 604 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:604:7: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 586 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:586:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' 569 | basic_string(const basic_string& __str, size_type __pos, | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/basic_string.h:552:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 552 | basic_string(const basic_string& __str) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:552:40: note: no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&' 552 | basic_string(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:540:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:540:34: note: no known conversion for argument 1 from 'int' to 'const std::allocator<char>&' 540 | basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:527:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::ch
s231163596
p03827
C++
#include<iostream> using namespace std ; int main(){ int n ; cin >> n ; char c ; int ans = x = 0 ; for(int i=0;i<n;i++){ cin >> c ; if(c=='I'){ if(ans==x) ans = x = x+1 ; else x++ ; }else x-- ; } cout << ans << endl ; }
a.cc: In function 'int main()': a.cc:7:19: error: 'x' was not declared in this scope 7 | int ans = x = 0 ; | ^
s034989270
p03827
C++
#include<iostream> using namespace std; int main(){ int unko,x=0; string aho; cin>>unko>>aho; for(int i;i<aho.size();i++){ if(aho[i]=="I") x++; else x--; unko=max(unko,x); } cout<<unko<<endl; }
a.cc: In function 'int main()': a.cc:8:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 8 | if(aho[i]=="I")
s898062626
p03827
C++
#include<iostream> using namespace std; int main(){ int unko; string aho; cin>>unko>>aho; for(int i;i<size(aho);i++){ unko=max(unko,aho.at(i)); } cout<<unko<<endl; }
a.cc: In function 'int main()': a.cc:8:13: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)' 8 | unko=max(unko,aho.at(i)); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: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:8:13: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}) 8 | unko=max(unko,aho.at(i)); | ~~~^~~~~~~~~~~~~~~~ /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
s487729728
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,s; cin >> n >> s; int count=0; int ans=0; for(int i=0;i<n;i++){ if(s.at(i)=='I'){ count++; } else{ count--; } ans=max(ans,count); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:14: error: request for member 'at' in 's', which is of non-class type 'int' 10 | if(s.at(i)=='I'){ | ^~
s356717180
p03827
Java
import java.util.*; public class Main{ public static void main(String[] arg){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); String S = sc.next(); char I = 'I'; int ans = 0; int maxAns = 0; char[]list = S.toCharArray(); for(int i = 0; i < N; i++){ // char A = list[i]; if(list[i] == I){ ans +=1; if(maxAns<ans){ maxAns = ans; } }else{ ans -=1; } } System.out.println(maxAns); }
Main.java:25: error: reached end of file while parsing } ^ 1 error
s238405730
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; string s; cin >> n >> s; int x=0;int max=0; for(int i=0;i<n;++i){ if(s[i]='I') ++x; else if(s[i]='D') --y; if(max<=x) max=x; } cout << max << endl; }
a.cc: In function 'int main()': a.cc:10:29: error: 'y' was not declared in this scope 10 | else if(s[i]='D') --y; | ^
s283461396
p03827
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; string S; int ans; cin >> N >> S; for(int i = 0;i < N;i ++){ if(S.at(i) == "I"){ ans ++; }else if(S.at(i) == "D"){ ans --; } } cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:13:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | if(S.at(i) == "I"){ | ~~~~~~~~^~~~~~ a.cc:17:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 17 | }else if(S.at(i) == "D"){ | ~~~~~~~~^~~~~~
s211662383
p03827
C++
#include<iostream> #include<fstream> #include<algorithm> #include<cstdio> #include<cmath> #include<string> #include<cstring> using namespace std; long long n,h,da=0; string st; int main() { cin>>n; cin>>st; for(int i=0;i<st.size();i++) { if(st[i]=='I')h++; else h--; if(h>da)da=h; 高度。 } cout<<da<<endl; return 0; }
a.cc:21:9: error: extended character 。 is not valid in an identifier 21 | 高度。 | ^ a.cc: In function 'int main()': a.cc:21:9: error: '\U00009ad8\U00005ea6\U00003002' was not declared in this scope 21 | 高度。 | ^~~~~~
s741549775
p03827
C++
#include<bits/stdc++.h> #include<conio.h> using namespace std; int getint(void) { int a; scanf("%d",&a); return a; } int main(void) { char p;int n=getint(),sum=0,maxn=0; for(int i=1;i<=n;i++) { p=getch(); if(p=='I') sum++; else sum--; maxn=max(maxn,sum); } printf("%d",maxn); return 0; }
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s637666551
p03827
C++
#include<bits/stdc++.h> #include<conio.h> using namespace std; int getint(void) { int a; scanf("%d",&a); return a; } int main(void) { char p;int n=getint(),sum=0,maxn=0; for(int i=1;i<=n;i++) { p=getch(); if(p=='I') sum++; else sum--; maxn=max(maxn,sum); } printf("%d",maxn); return 0; }
a.cc:2:9: fatal error: conio.h: No such file or directory 2 | #include<conio.h> | ^~~~~~~~~ compilation terminated.
s573134201
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N string S; cin>>N>>S; int x=0; int a=0; for(int i=0;i<N;i++){ if(S.at(i)=='I'){ x++; a=max(a,x); }else{ x--; } } cout<<a<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'string' 6 | string S; | ^~~~~~ a.cc:7:8: error: 'N' was not declared in this scope 7 | cin>>N>>S; | ^ a.cc:7:11: error: 'S' was not declared in this scope 7 | cin>>N>>S; | ^
s159363443
p03827
C++
#include<bits/stdc++.h> using namespace std; int n,max,ma; char m; int main(){ cin>>n; for(int i=1;i<=n;i++) { cin>>m; if(m=='I') max++; else ans--; if(ans>ma) max=ma; } cout<<ma<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:20: error: reference to 'max' is ambiguous 9 | if(m=='I') max++; | ^~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ In file included from /usr/include/c++/14/algorithm:60: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:3:7: note: 'int max' 3 | int n,max,ma; | ^~~ a.cc:10:14: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | else ans--; | ^~~ | abs a.cc:11:12: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | if(ans>ma) max=ma; | ^~~ | abs a.cc:11:20: error: reference to 'max' is ambiguous 11 | if(ans>ma) max=ma; | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ a.cc:3:7: note: 'int max' 3 | int n,max,ma; | ^~~
s713978649
p03827
Java
import java.util.*; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String s=sc.next(); int max=0; int x=0; if(s.length==n){ for(int i=0;i<n;i++) { if(s.charAt(i)=='I'){ x++; } else { x--; } } if(max<x++){ max=x++; } System.out.println(max); } } }
Main.java:10: error: cannot find symbol if(s.length==n){ ^ symbol: variable length location: variable s of type String 1 error
s183182293
p03827
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,x=0,Xmax=0; string S; cin>>N>>S; for(int i=0; i<N; i++){ if(S.at(i)=='I'){x++;} else if(S.at(i)=='D'){x--:} if(Xmax<x){Xmax=x;} } cout<<Xmax<<endl; }
a.cc: In function 'int main()': a.cc:12:30: error: expected ';' before ':' token 12 | else if(S.at(i)=='D'){x--:} | ^ | ;
s748158125
p03827
C++
#include<bits/stdc++.h> using namespace std; int max(int a,int b) { return a>b?a:b; } int main() { long long n,a[1000001],y,z=-100000; string s; cin>>n for(register int i=0;i<n;i++) { if(a[i]=='I') y++; else y--; z=max(y,z); } cout<<z<<endl; exit(0); }
a.cc: In function 'int main()': a.cc:11:11: error: expected ';' before 'for' 11 | cin>>n | ^ | ; 12 | for(register int i=0;i<n;i++) | ~~~ a.cc:12:26: error: 'i' was not declared in this scope 12 | for(register int i=0;i<n;i++) | ^
s711943152
p03827
C++
N = int(input()) S = input() num = 0 ans = 0 for s in S: if s == 'I': num += 1 else: num -= 1 ans = max(ans, num) print(ans)
a.cc:2:1: error: 'N' does not name a type 2 | N = int(input()) | ^
s873117764
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, sum=0,m=0; string s; cin >> n >> s; for(int i=0; i<n; i++){ if(s[i]=='I') sum++; else sum--; m = max(m, sum); } cout << max << endl; }
a.cc: In function 'int main()': a.cc:14:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 14 | cout << max << endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::n
s223711834
p03827
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n, sum=0,m=0; string s; cin >> n >> s; for(int i=0; i<n; i==){ if(s[i]=='I') sum++; else sum--; m = max(m, sum); } cout << max << endl; }
a.cc: In function 'int main()': a.cc:9:24: error: expected primary-expression before ')' token 9 | for(int i=0; i<n; i==){ | ^ a.cc:14:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 14 | cout << max << endl; | ~~~~~^~~~~~ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nu
s095992866
p03827
C++
#include<bits/stdc++.h> using namespace std; using ll=long long; void solve(){ int n; string s; cin>>n>>s; int maxi=0; int cnt=0; for(auto e:s){ if(e=='I'){ cnt++ maxi=max(maxi, cnt); }else{ cnt--; } } cout<<maxi<<endl; } signed main(){ //while(1) solve(); }
a.cc: In function 'void solve()': a.cc:14:30: error: expected ';' before 'maxi' 14 | cnt++ | ^ | ; 15 | maxi=max(maxi, cnt); | ~~~~
s439646446
p03827
C++
#include<bits/stdc++.h> using namespace std; int n,t=0,maxn=0; string s; int main() { scanf("%d%s",&n,s+1); for(int i=0;i<n;i++) { if(s[i]=='I') ++t; else --t; maxn=max(maxn,t); } cout<<maxn<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:22: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 7 | 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:7:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 7 | 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:7:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'int' 7 | 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:7:23: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'int' 7 | 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:7:23: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 7 | 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:7:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 7 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const comple
s997838222
p03827
C++
#include<bits/stdc++.h> using namespace std; int n,t=0,m=0; string s; int main() { scanf("%d%s",&n,s+1); for(int i=0;i<n;i++) { if(s[i]=='I') ++t; else --t; m=max(m,t); } cout<<m<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:22: error: no match for 'operator+' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 7 | 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:7:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 7 | 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:7:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'int' 7 | 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:7:23: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 7 | 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:7:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 7 | 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:7:23: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 7 | 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:7:23: note: mismatched types 'const _CharT*' and 'int' 7 | 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:7:23: note: deduced conflicting types for parameter '_CharT' ('char' and 'int') 7 | 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:7:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::complex<_Tp>' 7 | scanf("%d%s",&n,s+1); | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const comple
s314191191
p03827
C++
#include<bits/stdc++.h> using namespace std; int n,t=0,m=0; string s; int main() { cin>>n; for(int i=0;i<n;i++) { cin>>s[i]; if(s[i]=='I') ++t; else --t; m=max(m,pos); } cout<<m<<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: 'pos' was not declared in this scope; did you mean 'pow'? 13 | m=max(m,pos); | ^~~ | pow
s489364339
p03827
C++
#include<cstdio> using namespace std; int n; char s; int main() { scanf("%d", &n); int ans = 0; int maxn = -1e9; for(int i = 0; i < n; i++) { scanf("%c", &s); if(s[i] == 'I') ans += 1; if(s[i] == 'D') ans -= 1; if(maxn < ans) maxn = ans; } printf("%d\n", maxn); return 0; }
a.cc: In function 'int main()': a.cc:13:21: error: invalid types 'char[int]' for array subscript 13 | if(s[i] == 'I') ans += 1; | ^ a.cc:14:21: error: invalid types 'char[int]' for array subscript 14 | if(s[i] == 'D') ans -= 1; | ^