submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s346042996 | p03827 | C | #include<stdio.h>
int main(){
int n=0;
scanf("%d", &n);
char s[101];
int a,b,max=0;
scanf("%s",s);
for(a=0; a<=n; a++){
if(s[a]=='I'){
b++;
}
else{
b--;
}
if(max<x){
max=x;
}
}
printf("%d\n",max);
return 0;
} | main.c: In function 'main':
main.c:15:16: error: 'x' undeclared (first use in this function)
15 | if(max<x){
| ^
main.c:15:16: note: each undeclared identifier is reported only once for each function it appears in
|
s633734046 | p03827 | C | #include<stdio.h>
int main(){
int n=0;
scanf("%d", &n);
char s[101];
int a,b,max=0;
scanf("%s",s);
for(a=0; a<=n; a++){
if(s[a]=='I')
b++;
else
b--;
if(max<x)
max=x;
}
printf("%d\n",max);
return 0;
} | main.c: In function 'main':
main.c:13:16: error: 'x' undeclared (first use in this function)
13 | if(max<x)
| ^
main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in
|
s001675135 | p03827 | C | #include<stdio.h>
int main(){
int n=0;
scanf("%d", &n);
char s[n+1];
int a,b,max=0;
scanf("%s",s);
for(a=0; a<=n; a++){
if(s[a]=='I')
b++;
else
b--;
if(max<x)
max=x;
}
printf("%d\n",max);
return 0;
}
| main.c: In function 'main':
main.c:13:16: error: 'x' undeclared (first use in this function)
13 | if(max<x)
| ^
main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in
|
s821069063 | p03827 | C | #include<stdio.h>
int main(){
int n=0;
scanf("%d", &n);
char s[n+1];
int a,b,max=0;
scanf("%s",s);
for(a=0; a<=n; a++){
if(s[a]=="I")
b++;
else
b--;
if(max<x)
max=x;
}
printf("%d\n",max);
return 0;
} | main.c: In function 'main':
main.c:9:16: warning: comparison between pointer and integer
9 | if(s[a]=="I")
| ^~
main.c:13:16: error: 'x' undeclared (first use in this function)
13 | if(max<x)
| ^
main.c:13:16: note: each undeclared identifier is reported only once for each function it appears in
|
s723745366 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c.at(i) == 'I'){
b++;
}else{
b--;
}
d = max(d,b)
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:17:19: error: expected ';' before '}' token
17 | d = max(d,b)
| ^
| ;
18 |
19 | }
| ~
|
s978886242 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c.at(i) == 'I'){
b++;
}else if{
b--;
}
if(d < b){
d = d + b;
}
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:13:13: error: expected '(' before '{' token
13 | }else if{
| ^
| (
|
s529239747 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c.at(i) == 'I'){
b++;
}else{
b--;
}
if(d < b){
d = d + b;
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:21:4: error: expected '}' at end of input
21 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s978978774 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c.at(i) == "I"){
b++;
}else{
b--;
}if(d < b){
d = b;
}
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:11:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(c.at(i) == "I"){
| ~~~~~~~~^~~~~~
|
s974005998 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c.at(i) = "I"){
b++;
}else{
b--;
}if(d < b){
d = b;
}
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:11:18: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
11 | if(c.at(i) = "I"){
| ^~~
| |
| const char*
|
s547104354 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c = 'I'){
b++;
}else{
b--;
}if(d < b){
d = b;
}
cout << d << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:10: error: could not convert 'c.std::__cxx11::basic_string<char>::operator=(73)' from 'std::__cxx11::basic_string<char>' to 'bool'
11 | if(c = 'I'){
| ~~^~~~~
| |
| std::__cxx11::basic_string<char>
|
s704211364 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin >> a;
string c;
cin >> c;
for(int i = 0; i < a; i++){
if(c = "I"){
b++;
}else{
b--;
}if(d < b){
d = b;
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:11:10: error: could not convert 'c.std::__cxx11::basic_string<char>::operator=(((const char*)"I"))' from 'std::__cxx11::basic_string<char>' to 'bool'
11 | if(c = "I"){
| ~~^~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:20:4: error: expected '}' at end of input
20 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s955438950 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int a, b, d = 0;
cin > a;
string c;
cin > c;
for(int i = 0; i < a; i++){
if(c = "I"){
b++;
}else{
b--;
}if(d < b){
d = b;
}
cout << d << endl;
}
| a.cc: In function 'int main()':
a.cc:6:7: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
6 | cin > a;
| ~~~ ^ ~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:6:7: note: candidate: 'operator>(int, int)' (built-in)
6 | cin > a;
| ~~~~^~~
a.cc:6:7: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > a;
| ^
/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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
6 | cin > a;
| ^
/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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > a;
| ^
/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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
6 | cin > a;
| ^
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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
6 | cin > a;
| ^
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:6:9: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > a;
| ^
/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:6:9: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
6 | cin > a;
| ^
/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:6:9: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
6 | cin > a;
| ^
/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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > a;
| ^
/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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
6 | cin > a;
| ^
/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:6:9: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>'
6 | cin > a;
| ^
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:6:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>'
6 | cin > a;
| ^
a.cc:8:7: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
8 | cin > c;
| ~~~ ^ ~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::istream {aka std::basic_istream<char>}
/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:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
8 | cin > c;
| ^
/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:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
8 | cin > c;
| ^
/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:9: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
8 | cin > c;
| ^
/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:9: note: 'std::istream' {ak |
s188623026 | p03827 | C++ | #include<iostring>
using namespace std;
int main() {
int a, b, d = 0;
cin > a;
string c;
cin > c;
for(int i = 0; i < a; i++){
if(c = "I"){
b++;
}else{
b--;
}if(d < b){
d = b;
}
cout << d << endl;
}
| a.cc:1:9: fatal error: iostring: No such file or directory
1 | #include<iostring>
| ^~~~~~~~~~
compilation terminated.
|
s512570060 | p03827 | C++ | #include <iostream>
using namespace std;
int main () {
int m = -1, cur = 0, n;
char c;
cin >> n;
for (register int i = 0; i < n; i++) {
if(cur>m) {
m = cur;
}
cin >> c;
if(c=='I') {
cur++;
}
else
cur--;
}
cout << cur>m?cur:m << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
9 | for (register int i = 0; i < n; i++) {
| ^
a.cc:20:16: error: no match for 'operator>' (operand types are 'std::basic_ostream<char>' and 'int')
20 | cout << cur>m?cur:m << endl;
| ~~~~~~~~~~~^~
| | |
| | int
| std::basic_ostream<char>
a.cc:20:16: note: candidate: 'operator>(int, int)' (built-in)
20 | cout << cur>m?cur:m << endl;
| ~~~~~~~~~~~^~
a.cc:20:16: 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
20 | cout << cur>m?cur:m << 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:20:17: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
20 | cout << cur>m?cur:m << 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:20:17: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
20 | cout << cur>m?cur:m << 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:20:17: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
20 | cout << cur>m?cur:m << endl;
| ^
a.cc:20:25: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
20 | cout << cur>m?cur:m << endl;
| ~~^~~~~~~
|
s720135865 | p03827 | C++ | #include <iostream>
using namespace std;
int main () {
int m = -1, cur = 0, n;
char c;
cin >> n;
for (register int i = 0; i < n; i++) {
if(cur>m) {
m = cur;
}
cin >> c;
if(c=='I') {
cur++;
}
else
cur--;
}
cout << max << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
9 | for (register int i = 0; i < n; i++) {
| ^
a.cc:20:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
20 | cout << max << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]'
306 | operator<<(nullptr_t)
| ^~~~~~~~
/u |
s656072822 | p03827 | C++ | #include <iostream>
using namespace std;
int main () {
int m = -1, cur = 0, n;
char c;
cin >> n
for (register int i = 0; i < n; i++) {
if(cur>m) {
m = cur;
}
cin >> c;
if(c=='I') {
cur++;
}
else
cur--;
}
cout << max << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:13: error: expected ';' before 'for'
8 | cin >> n
| ^
| ;
9 | for (register int i = 0; i < n; i++) {
| ~~~
a.cc:9:30: error: 'i' was not declared in this scope
9 | for (register int i = 0; i < n; i++) {
| ^
a.cc:20:10: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
20 | cout << max << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_tra |
s525427834 | p03827 | C++ | #include <iostream>
int main () {
int m = -1, cur = 0, n;
char c;
cin >> n
for (register int i = 0; i < n; i++) {
if(cur>m) {
m = cur;
}
cin >> c;
if(c=='I') {
cur++;
}
else
cur--;
}
cout << max << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> n
| ^~~
| std::cin
In file included 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:7:30: error: 'i' was not declared in this scope
7 | for (register int i = 0; i < n; i++) {
| ^
a.cc:18:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
18 | cout << max << endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:18:13: error: 'max' was not declared in this scope; did you mean 'std::max'?
18 | cout << max << endl;
| ^~~
| std::max
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:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
a.cc:18:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
18 | cout << max << endl;
| ^~~~
| std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s205150952 | p03827 | C++ | #include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int v = 0, c = 0;
int n;
cin >> n;
string s;
cin >> s;
for (char c : s)
{
if (c == 'I')
c++;
else
c--;
v = max(v, c);
}
cout << v;
}
| a.cc: In function 'int main()':
a.cc:25:16: error: no matching function for call to 'max(int&, char&)'
25 | v = max(v, c);
| ~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:25:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'char')
25 | v = max(v, c);
| ~~~^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:25:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
25 | v = max(v, c);
| ~~~^~~~~~
|
s240980325 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin>>a;
string s;
cin>>s;
int c=0;
for(int i=0;i+1<a;i++){
if(s.at(i)='I')
c++;
else
c--;
cout <<c;
} | a.cc: In function 'int main()':
a.cc:16:12: error: expected '}' at end of input
16 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s011982141 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin>>a;
string s;
cin>>s;
int c=0;
for(int i=0;i+1<a;i++){
if(s.at(i)='I')
c++;
else
c--;
}
cout <<c;
| a.cc: In function 'int main()':
a.cc:16:18: error: expected '}' at end of input
16 | cout <<c;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s300538903 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin>>a;
string s;
cin>>s;
int c=0;
for(int i=0;i+1<a;i++){
if(s.at(i)=I)
c++;
else
c--;
}
cout <<c;
| a.cc: In function 'int main()':
a.cc:11:20: error: 'I' was not declared in this scope
11 | if(s.at(i)=I)
| ^
a.cc:16:18: error: expected '}' at end of input
16 | cout <<c;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s932436787 | p03827 | Java | import java.util.Scanner;
public class B {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.next());
String S = sc.next();
int x = 0;
int M = 0;
for(int i = 0; i < N; i++){
if(S.charAt(i) == 'I'){
x++;
}else{
x--;
}
if(x > M) M = x;
}
System.out.println(M);
}
} | Main.java:3: error: class B is public, should be declared in a file named B.java
public class B {
^
1 error
|
s320817632 | p03827 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,cnt,ans;
char ck;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>ch;
if(ch=='I')
{
cnt++;
}
else
{
cnt--;
}
ans=max(ans,cnt);
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:10:14: error: 'ch' was not declared in this scope; did you mean 'ck'?
10 | cin>>ch;
| ^~
| ck
|
s678481915 | p03827 | C++ | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
ll S,N,pnt(0),ans(0);
cin>>N>>S;
for (int i(0);i<S.size();i++){
if (S[i]=='D')pnt-=1;
else pnt+=1;
ans=max(ans,pnt);
}
cout<<ans;
} | a.cc: In function 'int main()':
a.cc:8:23: error: request for member 'size' in 'S', which is of non-class type 'll' {aka 'long long int'}
8 | for (int i(0);i<S.size();i++){
| ^~~~
a.cc:9:12: error: invalid types 'll {aka long long int}[int]' for array subscript
9 | if (S[i]=='D')pnt-=1;
| ^
|
s734804371 | p03827 | C++ | #include<bits/srdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
string S;
cin>>S;
int sum=0;
int max=0;
for(int i=0;i<N;i++){
if(S.at(i)=='I'){
sum++;
if(sum>max){
max=sum;
}
}
else{
sum--;
}
}
cout<<max<<endl;
}
| a.cc:1:9: fatal error: bits/srdc++.h: No such file or directory
1 | #include<bits/srdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s142074067 | p03827 | C++ | #include <iostream>
using namespace std;
int main(){
int n;cin>>n;
string s;cin>> s;
int ret=0,ans=0;
for(auto&& u:s){
if(u=='I')ret++;
else(u=='D')ret--;
ans=max(ans,ret);
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:9:18: error: expected ';' before 'ret'
9 | else(u=='D')ret--;
| ^~~
| ;
|
s904864826 | p03827 | C++ | #include <iostream>
using namespace std;
int main(){
int n;cin>>n;
string s;cin s;
int ret=0,ans=0;
for(auto&& u:s){
if(u=='I')ret++;
else (u=='D')ret--;
ans=max(ans,ret);
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:5:21: error: expected ';' before 's'
5 | string s;cin s;
| ^~
| ;
a.cc:9:19: error: expected ';' before 'ret'
9 | else (u=='D')ret--;
| ^~~
| ;
|
s427788393 | p03827 | C++ | include <iostream>
using namespace std;
int main(){
int n;cin>>n;
string s;cin s;
int ret=0,ans=0;
for(auto&& u:s){
if(u=='I')ret++;
else (u=='D')ret--;
ans=max(ans,ret);
}
cout<<ans<<endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:4:15: error: 'cin' was not declared in this scope
4 | int n;cin>>n;
| ^~~
a.cc:5:9: error: 'string' was not declared in this scope
5 | string s;cin s;
| ^~~~~~
a.cc:5:21: error: expected ';' before 's'
5 | string s;cin s;
| ^~
| ;
a.cc:7:17: error: 's' was not declared in this scope
7 | for(auto&& u:s){
| ^
a.cc:10:10: error: 'max' was not declared in this scope
10 | ans=max(ans,ret);
| ^~~
a.cc:12:3: error: 'cout' was not declared in this scope
12 | cout<<ans<<endl;
| ^~~~
a.cc:12:14: error: 'endl' was not declared in this scope
12 | cout<<ans<<endl;
| ^~~~
|
s632585430 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<string> S;
for (int i=0;i<N;i++){
cin >> S.at(i);
}
int x=0;
int s=0;
for (int i=0;i<N;i++){
if (S.at(i)=="I"){
s+=1;
}
else {
s-=1;
}
x=max{x,s};
}
cout << x << endl;
}
}
| a.cc: In function 'int main()':
a.cc:19:7: error: cannot resolve overloaded function 'max' based on conversion to type 'int'
19 | x=max{x,s};
| ^~~
a.cc: At global scope:
a.cc:24:5: error: expected declaration before '}' token
24 | }
| ^
|
s779612149 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<string> S(N);
for (int i=0;i<N;i++){
cin >> S.at(i);
}
int x=0;
for (int i=0;i<N;i++){
int y=0;
int z=0;
if (S.at(i)=="I"){
int y +=1;
}
else{
int z +=1;
}
int s=y-z;
if (x>s){
x==x;
}
else{
x==s;
}
}
cout << x << endl;
}
| a.cc: In function 'int main()':
a.cc:15:13: error: expected initializer before '+=' token
15 | int y +=1;
| ^~
a.cc:18:13: error: expected initializer before '+=' token
18 | int z +=1;
| ^~
|
s634421371 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<string> S(N);
for (int i=0;i<N;i++){
cin >> S.at(i);
}
int x=0;
for (int i=0;i<N;i++){
int y=0;
int z=0;
if (S.at(i)=="I"){
int y+=1;
}
else{
int z+=1;
}
int s=y-z;
if (x>s){
x==x;
}
else{
x==s;
}
}
cout << x << endl;
}
| a.cc: In function 'int main()':
a.cc:15:12: error: expected initializer before '+=' token
15 | int y+=1;
| ^~
a.cc:18:12: error: expected initializer before '+=' token
18 | int z+=1;
| ^~
|
s778349013 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> S(N);
for (int i=0;i<N;i++){
cin >> S.at(i);
}
int x=0;
for (int i=0;i<N;i++){
int y=0;
int z=0;
if (S.at(i)=="I"){
int y+=1;
}
else{
int z+=1;
}
int s=y-z;
if (x>s){
x==x;
}
else{
x==s;
}
}
cout << x << endl;
}
| a.cc: In function 'int main()':
a.cc:14:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if (S.at(i)=="I"){
| ~~~~~~~^~~~~
a.cc:15:12: error: expected initializer before '+=' token
15 | int y+=1;
| ^~
a.cc:18:12: error: expected initializer before '+=' token
18 | int z+=1;
| ^~
|
s509916946 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> S(N);
for (int i=0;i<N;i++){
cin >> S.at(i);
}
int x=0;
for (int i=0;i<N;i++){
int I=0;
int D=0;
if (S.at(i)=="I"){
int I+=1;
}
else{
int D+=1;
}
int s=I-D;
if (x>s){
x==x;
}
else{
x==s;
}
}
cout << x << endl;
}
| a.cc: In function 'int main()':
a.cc:14:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if (S.at(i)=="I"){
| ~~~~~~~^~~~~
a.cc:15:12: error: expected initializer before '+=' token
15 | int I+=1;
| ^~
a.cc:18:12: error: expected initializer before '+=' token
18 | int D+=1;
| ^~
|
s446395100 | p03827 | C++ | #include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
using namespace std;
template <class T> using V = vector<T>;
using ll = long long;
using db = double;
using st = string;
using ch = char;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(ll)(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
ll sum(ll n) {
ll m=0;
FOR(i,0,20){
m+=n%10;
n/=10;
if(n==0){
break;
}
}
return m;
}
ll combi(ll n,ll m) {
ll ans=1;
rFOR(i,n,n-m){
ans*=i;
}
FOR(i,1,m+1){
ans/=i;
}
return ans;
}
ll lcm(ll a,ll b){
ll n;
n=a/gcd(a,b)*b;
return n;
}
/****************************************\
| Thank you for viewing my code:) |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka |
\****************************************/
signed main() {
ll a;
ci(a)
st s;
ci(s)
ll ans=0;
ll now=0;
FOR(i,0,n){
if(s[i]=='D'){
now--;
ans=M(ans,now);
}
else{
now++;
ans=M(ans,now);
}
}
co(ans)
} | a.cc: In function 'int main()':
a.cc:82:11: error: 'n' was not declared in this scope
82 | FOR(i,0,n){
| ^
a.cc:19:40: note: in definition of macro 'FOR'
19 | #define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
| ^
|
s327523019 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,x=0,maxv=0;
cin>>n;
string s;
cin>>s;
for(i=0;i<n;i++){
x+=(s[i]=='I'?1:-1);
maxv=max(maxv,x);
}
cout<<maxv<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
8 | for(i=0;i<n;i++){
| ^
|
s323499126 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,x=0,maxv=0;
cin>>n;
string s;
cin>>s;
for(i=0;i<n;i++){
x+=(s[i]=='I'?1;-1);
maxv=max(maxv,x);
}
cout<<maxv<<endl;
}
| a.cc: In function 'int main()':
a.cc:8:7: error: 'i' was not declared in this scope
8 | for(i=0;i<n;i++){
| ^
a.cc:9:20: error: expected ':' before ';' token
9 | x+=(s[i]=='I'?1;-1);
| ^
| :
a.cc:9:20: error: expected primary-expression before ';' token
a.cc:9:20: error: expected ')' before ';' token
9 | x+=(s[i]=='I'?1;-1);
| ~ ^
| )
a.cc:9:23: error: expected ';' before ')' token
9 | x+=(s[i]=='I'?1;-1);
| ^
| ;
|
s428891100 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<n;i++)
#define REPR(i, n) for(int i=n-1 ; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define INF 2e9
#define ll long long
int main(){
int x=0, max = 0, n;
string s;
cin>>n>>s;
while(auto v:s){
if(v=='I'){
x++;
}
else{
x--;
}
if(x>max){
max = x;
}
}
cout<<max<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: found ':' in nested-name-specifier, expected '::'
15 | while(auto v:s){
| ^
| ::
a.cc:15:16: error: 'v' has not been declared
15 | while(auto v:s){
| ^
a.cc:15:19: error: qualified-id in declaration before ')' token
15 | while(auto v:s){
| ^
a.cc:16:12: error: 'v' was not declared in this scope
16 | if(v=='I'){
| ^
|
s000733722 | p03827 | C++ | #include<iostream>
#include<string >
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int i=0;
int arr[n+1];
arr[0]=0;
for(int x=0; x<n; x++){
if(s.at(x)=='I'){
i++;
}
else{
i--;
}
arr[x+1]=i;
}
int ans=0;
for(int x=0; x<=n;x++){
if(arr[x]>ans){
ans=arr[x];
}
}
cout<<ans;
return 0;
}
#include<iostream>
#include<string >
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int i=0;
int arr[n+1];
arr[0]=0;
for(int x=0; x<n; x++){
if(s.at(x)=='I'){
i++;
}
else{
i--;
}
arr[x+1]=i;
}
int ans=0;
for(int x=0; x<=n;x++){
if(arr[x]>ans){
ans=arr[x];
}
}
cout<<ans;
return 0;
}
| a.cc:2:9: fatal error: string : No such file or directory
2 | #include<string >
| ^~~~~~~~~
compilation terminated.
|
s787768353 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,x=0,c=0;
cin >> n;
for(int i=0;i<n;i++){
char s;
cin >> s;
if(s=='I')
x++;
else
x--;
c = max(c,x)
}
cout << c << endl;
} | a.cc: In function 'int main()':
a.cc:14:17: error: expected ';' before '}' token
14 | c = max(c,x)
| ^
| ;
15 | }
| ~
|
s483037156 | p03827 | C++ | #include<bits.stdc++.h>
using namespace std;
int main()
{
int n, c = 0, ans = 0;
string s;
cin >> n >> s;
for(int i = 0; i < n; i++)
{
if(s[i] == 'I')c++;
else c--;
ans = max(ans, c);
}
printf("%d", ans);
return 0;
} | a.cc:1:9: fatal error: bits.stdc++.h: No such file or directory
1 | #include<bits.stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s248219383 | p03827 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <math.h>
typedef long long int ll;
using namespace std;
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
int main(){
int n; cin >>n;
string s; cin >>s;
int ans=0;
for(int i=0;i<n;i++){
if(s[i]=='I')ans++;
else ans--:
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:16:15: error: expected ';' before ':' token
16 | else ans--:
| ^
| ;
|
s520108833 | p03827 | C++ | #include<bits/stdc++.h>
using namespce std;
int main(){
int N;cin>>N;
string S;cin>>S;
int x=0,ans=0;
for(int i=0;i<S.size();i++){
if(S.at(i)=='I')x++;
else x--;
ans=max(x,ans);
}
cout<<ans<<endl;
} | a.cc:2:7: error: expected nested-name-specifier before 'namespce'
2 | using namespce std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
4 | int N;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:5:3: error: 'string' was not declared in this scope
5 | string S;cin>>S;
| ^~~~~~
a.cc:5:3: 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:5:17: error: 'S' was not declared in this scope
5 | string S;cin>>S;
| ^
a.cc:10:9: error: 'max' was not declared in this scope; did you mean 'std::max'?
10 | ans=max(x,ans);
| ^~~
| 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)
| ^~~
a.cc:12:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
12 | cout<<ans<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:12:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
12 | cout<<ans<<endl;
| ^~~~
| std::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:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s912795632 | p03827 | C++ | #include<bits/stdc++.h>
using namespce std;
int main(){
int N;cin>>N;
string S;cin>>S;
int x=0,ans=0;
for(int i=0;i<S.size();i++){
if(s.at(i)=='I')x++;
else x--;
ans=max(x,ans);
}
cout<<ans<<endl;
} | a.cc:2:7: error: expected nested-name-specifier before 'namespce'
2 | using namespce std;
| ^~~~~~~~
a.cc: In function 'int main()':
a.cc:4:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
4 | int N;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:5:3: error: 'string' was not declared in this scope
5 | string S;cin>>S;
| ^~~~~~
a.cc:5:3: 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:5:17: error: 'S' was not declared in this scope
5 | string S;cin>>S;
| ^
a.cc:8:8: error: 's' was not declared in this scope
8 | if(s.at(i)=='I')x++;
| ^
a.cc:10:9: error: 'max' was not declared in this scope; did you mean 'std::max'?
10 | ans=max(x,ans);
| ^~~
| 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)
| ^~~
a.cc:12:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
12 | cout<<ans<<endl;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:12:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
12 | cout<<ans<<endl;
| ^~~~
| std::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:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
744 | endl(basic_ostream<_CharT, _Traits>& __os)
| ^~~~
|
s789808237 | p03827 | C++ | #include <cmath>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int a,t,Max = -1,r,u,q,sb,dasf,dsdff,sadga,sasdfdfsdf;
char c[110];
int main() {
scanf("%d%s",&a,c);
for(int i = 0 ; i < a ; ++ i){
if(c[i] == 'I') {
t ++;
}
else t --;
Max = max(Max,t);
if(Max == -1) Max = 0;
printf("%d",Max);
return 0;
} | a.cc: In function 'int main()':
a.cc:19:2: error: expected '}' at end of input
19 | }
| ^
a.cc:8:12: note: to match this '{'
8 | int main() {
| ^
|
s435760201 | p03827 | C++ | #include <bits/stdc++.h>
#define cinf(n,x,y,z) for(int i=0;i<(n);i++) cin >> x[i]>>y[i]>>z[i];
typedef long long int ll;
using namespace std;
int main(){
int n; string s;
cin >>N >>s;
int ans=0;
int cnt=0;
for(int i=0;i<n;i++){
if(s[i]=='I')cnt++;
if(s[i]=='D')cnt--;
ans=max(ans,cnt);
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:8:15: error: 'N' was not declared in this scope
8 | cin >>N >>s;
| ^
|
s584797081 | p03827 | C++ | #include <bits/stdc++.h>
#define cinf(n,x,y,z) for(int i=0;i<(n);i++) cin >> x[i]>>y[i]>>z[i];
typedef long long int ll;
using namespace std;
int main(){
int n; string s;
cin >>N >>s;
int ans=0;
int cnt=0;
for(int i=0;i<n;i++){
if(s[i]=='I')cnt++;
if(s[i]=='D')cnt--;
chmax(ans,cnt);
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:8:15: error: 'N' was not declared in this scope
8 | cin >>N >>s;
| ^
a.cc:14:17: error: 'chmax' was not declared in this scope
14 | chmax(ans,cnt);
| ^~~~~
|
s619560811 | p03827 | C++ | #include<bits/std++.h>
using namespace std;
int i,n,num=0,m=0;
char a;
int main()
{
cin>>n;
for(i=0;i<n;i++){
cin>>a;
if(a=='I'){
num++;
}
else{
num--;
}
max(num,m);
}
cout<<num;
return 0;
} | a.cc:1:9: fatal error: bits/std++.h: No such file or directory
1 | #include<bits/std++.h>
| ^~~~~~~~~~~~~~
compilation terminated.
|
s523535791 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
int x = 0;
int ans = 0;
for(int i = 0; i < N; i++) {
if(S[i] == 'I') {
x++;
}
else {
x--;
}
ans = max (ans, x)
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:23: error: expected ';' before '}' token
18 | ans = max (ans, x)
| ^
| ;
19 | }
| ~
|
s975108050 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
int x = 0;
vector<int> X(N);
X[N] = 0;
for(int i = 0; i < N; i++) {
if(S[i] == "I") {
x++;
X[i] = x;
}
else {
x--;
X[i] = x;
}
}
sort(X.begin(), X.end());
cout << X[N] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(S[i] == "I") {
|
s828530657 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin S;
int x = 0;
vector<int> X(N);
X[N] = 0;
for(int i = 0; i < N; i++) {
if(S[i] == "I") {
X++;
X[i] = x;
}
else {
x--;
X[i] = x;
}
}
sort(X.begin(), X.end());
cout << X[N] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:6: error: expected ';' before 'S'
8 | cin S;
| ^~
| ;
a.cc:14:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
14 | if(S[i] == "I") {
a.cc:15:8: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
15 | X++;
| ~^~
|
s957584978 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
char S[N];
cin >> S;
int count = 0;
for (int i=0; i<N; i++){
if(S[i] == "I"){
count = count +1;
}
else{
count = count -1;
}
}
cout << count <<endl;
}
| a.cc: In function 'int main()':
a.cc:11:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if(S[i] == "I"){
| ~~~~~^~~~~~
|
s392713284 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
char S[N];
cin >> S;
int count = 0;
for (int i=0; i<N; i++){
if(S[i] = "I"){
count = count +1;
}
else{
count = count -1;
}
}
cout << count <<endl;
}
| a.cc: In function 'int main()':
a.cc:11:15: error: invalid conversion from 'const char*' to 'char' [-fpermissive]
11 | if(S[i] = "I"){
| ^~~
| |
| const char*
|
s581331993 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
char S[];
cin >> N;
cin >> S;
int count = 0;
for (int i=0; i<N; i++){
if(S[i] = "I"){
count = count +1;
}
else{
count = count -1;
}
}
cout << count <<endl;
}
| a.cc: In function 'int main()':
a.cc:6:8: error: storage size of 'S' isn't known
6 | char S[];
| ^
|
s283716186 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
char S;
cin >> N;
cin >> S;
int count = 0;
for (int i=0; i<N; i++){
if(S[i] = "I"){
count = count +1;
}
else{
count = count -1;
}
}
cout << count <<endl;
}
| a.cc: In function 'int main()':
a.cc:11:9: error: invalid types 'char[int]' for array subscript
11 | if(S[i] = "I"){
| ^
|
s957142655 | p03827 | Java | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
int cnt = 0;
int max = 0;
for(int i = 0; i < S; i++){
char c = S.charAt(i);
if(c == 'I'){
cnt++;
max = Math.max(max,cnt);
}else{
cnt--;
}
}
System.out.println(cnt);
}
} | Main.java:10: error: bad operand types for binary operator '<'
for(int i = 0; i < S; i++){
^
first type: int
second type: String
1 error
|
s717302208 | p03827 | Java | import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
String S = sc.next();
int cnt = 0;
int max = ;
for(int i = 0; i < S; i++){
char c = S.charAt(i);
if(c == 'I'){
cnt++;
max = Math.max(max,cnt);
}else{
cnt--;
}
}
System.out.println(cnt);
}
} | Main.java:9: error: illegal start of expression
int max = ;
^
1 error
|
s431905431 | p03827 | C++ | include<bits/stdc++.h>
using namespace std;
string a;
int ans,l,maxx=-1*0x7fffffff;
int main(){
cin>>l>>a;
for(int i=0;i<l;i++){
ans+=(a[i]=='I')?1:-1;
maxx=max(ans,maxx);
}
if(maxx==-1)maxx=0;
cout<<maxx<<endl;
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc:3:1: error: 'string' does not name a type
3 | string a;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
6 | cin>>l>>a;
| ^~~
a.cc:6:13: error: 'a' was not declared in this scope
6 | cin>>l>>a;
| ^
a.cc:9:14: error: 'max' was not declared in this scope; did you mean 'maxx'?
9 | maxx=max(ans,maxx);
| ^~~
| maxx
a.cc:12:5: error: 'cout' was not declared in this scope
12 | cout<<maxx<<endl;
| ^~~~
a.cc:12:17: error: 'endl' was not declared in this scope
12 | cout<<maxx<<endl;
| ^~~~
|
s811648097 | p03827 | C++ | #include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<memory>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
//#include<windows.h>
//#include<time.h>
#define r(a,b,c) for(int a=b;a<=c;++a)
#define INF 0x7fffffff
#define ll long long
using namespace std;
inline int read()
{
int a=0,b=1;
char c=getchar();
while(c<='0'||c>'9')
{
/*
if(c=='-')
{
b=-1;
}
*/
c=getchar();
}
while(c>='0'&&c<='9')
{
a=a*10+c-'0';
c=getchar();
}
return a*b;
}
void write(int n)
{
/*
if(n<0)
{
n=-n;
putchar('-');
}
*/
if(n>10)
{
write(n/10);
}
putchar(n%10+'0');
}
int a,t,Max = -1;
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
scanf("%d%s",&a,c);
for(int i = 0 ; i < a ; ++ i)
{
if(c[i] == 'I')
{
t ++;
}
else t --;
Max = max(Max,t);
}
printf("%d",Max);
return 0;
}
| a.cc: In function 'int main()':
a.cc:72:25: error: 'c' was not declared in this scope
72 | scanf("%d%s",&a,c);
| ^
|
s525046619 | p03827 | C++ | #include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<memory>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
//#include<windows.h>
//#include<time.h>
#define r(a,b,c) for(int a=b;a<=c;++a)
#define INF 0x7fffffff
#define ll long long
using namespace std;
inline int read()
{
int a=0,b=1;
char c=getchar();
while(c<='0'||c>'9')
{
/*
if(c=='-')
{
b=-1;
}
*/
c=getchar();
}
while(c>='0'&&c<='9')
{
a=a*10+c-'0';
c=getchar();
}
return a*b;
}
void write(int n)
{
/*
if(n<0)
{
n=-n;
putchar('-');
}
*/
if(n>10)
{
write(n/10);
}
putchar(n%10+'0');
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
scanf("%d%s",&a,c);
for(int i = 0 ; i < a ; ++ i)
{
if(c[i] == 'I')
{
t ++;
}
else t --;
Max = max(Max,t);
}
printf("%d",Max);
return 0;
}
| a.cc: In function 'int main()':
a.cc:72:23: error: 'a' was not declared in this scope
72 | scanf("%d%s",&a,c);
| ^
a.cc:72:25: error: 'c' was not declared in this scope
72 | scanf("%d%s",&a,c);
| ^
a.cc:77:25: error: 't' was not declared in this scope
77 | t ++;
| ^
a.cc:79:22: error: 't' was not declared in this scope
79 | else t --;
| ^
a.cc:80:17: error: 'Max' was not declared in this scope
80 | Max = max(Max,t);
| ^~~
a.cc:80:31: error: 't' was not declared in this scope
80 | Max = max(Max,t);
| ^
a.cc:82:21: error: 'Max' was not declared in this scope
82 | printf("%d",Max);
| ^~~
|
s515173681 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
int count = 0;
int answer = 0;
for(int i =0;i < N;i++) {
if(S.at(i) == 'I') {
count+=;
if(answer < count){
answer = count;
}
}
if(S.at(i) == 'D') {
count = count - 1;
}
cout << answer << endl;
} | a.cc: In function 'int main()':
a.cc:13:14: error: expected primary-expression before ';' token
13 | count+=;
| ^
a.cc:22:4: error: expected '}' at end of input
22 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s742647292 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
string S;
cin >> S;
int count = 0;
int answer = 0;
for(int i =0;i < N;i++) {
if(S.at(i) == 'I') {
count++;
if(answer < count){
answer = count;
}
}
if(S.at(i) == 'D') {
count--;
}
cout << answer << endl;
} | a.cc: In function 'int main()':
a.cc:22:4: error: expected '}' at end of input
22 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s469960118 | p03827 | C++ | #include<iostream>
using namespace std;
int main() {
int N;
string S;
int count = 0;
int answer = 0;
for(int i =0;i < N;i++) {
if(S.at(i) == 'I') {
count++;
if(answer < count){
answer = count;
}
}
if(S.at(i) == 'D') {
count--;
}
} | a.cc: In function 'int main()':
a.cc:19:4: error: expected '}' at end of input
19 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s836391387 | p03827 | C++ | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
// Increment Decrement.cpp
//
// Created by WinnieJt on 2019/3/21.
//
// Copyright © 2019 金天. All rights reserved.
#include<bits/stdc++.h>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
typedef double db;
typedef long long ll;
ll maxn=23333;
using namespace std;
char x[maxn];
ll n,pre,hig;
ll cmp(ll a,ll b)
{
if(a>=b) return a;
else return b;
}
int main(void)
{
ios::sync_with_stdio(false);
cin >> n;
for(ll i=0;i<n;i++) cin >> x[i];
for(ll i=0;i<n;i++)
{
if(x[i]=='I') pre++;
else if(x[i]=='D') pre--;
hig=cmp(hig,pre);
}
cout << hig << endl;
return 0;
}
| a.cc:51:8: error: size of array 'x' is not an integral constant-expression
51 | char x[maxn];
| ^~~~
|
s829525826 | p03827 | C++ | #include <cstdio>
#include <iostream>
using namespace std;
char s[110];
int n,pos,maxn;//pos存储当前高度,maxn存储最高高度
int main()
{
scanf("%d%s",&n,s+1);//读入字符串的长度和字符串
for(int i=1;i<=n;++i)
{
if(s[i]=='I') ++pos;//判断如果是‘I’,高度++
else --pos;//否则高度--
maxn=max(maxn,pos);//每次选取最大值
}
printf("%d\n",maxn);//输出答案
return 0;//完美结束
| a.cc: In function 'int main()':
a.cc:16:14: error: expected '}' at end of input
16 | return 0;//完美结束
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s663317229 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
using llong = long long;
using P = pair<llong, llong>;
#define BE(x) x.begin(), x.end()
const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;
int main(){
int N;
string S;
cin >> N >> S;
int ans = 0;
int sum = 0;
for(auto x : S){
if(S == 'I')
sum++;
else
sum--;
ans = max(ans, sum);
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:21:22: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
21 | if(S == 'I')
| ~ ^~ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'char'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
21 | if(S == 'I')
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
21 | if(S == 'I')
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
21 | if(S == 'I')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
21 | if(S == 'I')
| ^~~
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
21 | if(S == 'I')
| ^~~
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:21:25: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
21 | if(S == 'I')
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operat |
s924113952 | p03827 | Java | import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String po[]=sc.next().split("",0);
int x=0,y=0;
for(int i=0;i<n;i++){
y+=(po[i].equals("I"))?1:-1;
x=Math.max(x,y)
}
System.out.println(x);
}
}
| Main.java:10: error: ';' expected
x=Math.max(x,y)
^
1 error
|
s996975049 | p03827 | C++ | #include<bits/stdc++.h>
using namespace std;
int n;
long long z__,maxx;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
char a;
cin>>a;
if(a=='I')
z__++;
else
z__--;
if(z>maxx)
{
maxx=z;
}
}
cout<<maxx;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:20: error: 'z' was not declared in this scope
16 | if(z>maxx)
| ^
|
s378575708 | p03827 | C++ | #include<cstdio>
#include<string>
#include<cstring>
int main (){
char a[105];
int a,b,i,n;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%c",&a[i]);
if(a[i] == 'I'){
a=a+1;
}
b=n-a;
c=a-b;
if(c>=0) printf("%d",c);
else if(c<0) printf("0");
}
} | a.cc: In function 'int main()':
a.cc:6:13: error: conflicting declaration 'int a'
6 | int a,b,i,n;
| ^
a.cc:5:14: note: previous declaration as 'char a [105]'
5 | char a[105];
| ^
a.cc:11:18: error: incompatible types in assignment of 'char*' to 'char [105]'
11 | a=a+1;
| ~^~~~
a.cc:13:20: error: invalid operands of types 'int' and 'char [105]' to binary 'operator-'
13 | b=n-a;
| ~^~
| | |
| | char [105]
| int
a.cc:14:17: error: 'c' was not declared in this scope
14 | c=a-b;
| ^
|
s372051326 | p03827 | C | #include <stdio.h>
int main(){
int k,i,max=0,a=0;
scanf ("%d",&k);
char s;
scanf ("%s",s);
for (i=0;i<k;i++){
if (s[i]=='I'){
a++;
}
else if (s[i]=='D'){
a--;
}
if (max>a){
max=a;
}
}
printf ("%d",max);
return 0;
} | main.c: In function 'main':
main.c:8:6: error: subscripted value is neither array nor pointer nor vector
8 | if (s[i]=='I'){
| ^
main.c:11:11: error: subscripted value is neither array nor pointer nor vector
11 | else if (s[i]=='D'){
| ^
|
s448454448 | p03827 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
int x=0,xmax=0;
int n,i;
cin >> n;
string s;
cin >> s;
for(i=0;i<n;i++){
if(s[i]=="I")x++;else x--;
xmax=max(x,xmax);
}
cout << xmax;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
18 | if(s[i]=="I")x++;else x--;
|
s790011300 | p03827 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
int x=0,xmax=0;
int n;
cin >> n;
string s;
cin >> s;
for(i=0;i<n;i++){
if(s[i]=="I")x++;else x--;
xmax=max(x,xmax);
}
cout << xmax;
return 0;
}
| a.cc: In function 'int main()':
a.cc:17:9: error: 'i' was not declared in this scope
17 | for(i=0;i<n;i++){
| ^
|
s575905510 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,i,x=0,ans=0;
string s;
cin>>n>>s;
for(i=0;i<n;i++){
if(s[i]=='I')
x++;
else(s[i]=='D')
x--;
if(ans<x)
ans=x;
}
cout<<x;
} | a.cc: In function 'int main()':
a.cc:12:20: error: expected ';' before 'x'
12 | else(s[i]=='D')
| ^
| ;
13 | x--;
| ~
|
s527704930 | p03827 | C++ | #include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
int n,x=0,ans,bb=-10000;
string aa[1000];
cin>>n;
for(int i=0;i<n;i++){
cin>>aa[i];
if(aa[i]=='D')
x--;
else{
x++;
}
ans=max(x,bb);
if(x>bb)
bb=x;
}
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:13:13: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
13 | if(aa[i]=='D')
| ~~~~~^~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: mismatched types 'const _CharT*' and 'char'
13 | if(aa[i]=='D')
| ^~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46:
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)'
234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a,
| ^~~~~~~~
/usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed:
a.cc:13:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>'
13 | if(aa[i]=='D')
| ^~~
In file included from /usr/include/c++/14/functional:59,
from a.cc:3:
/usr/include/c++/14/bits/std_function.h:743:5: note: candidate: 'template<class _Res, class ... _Args> bool std::operator==(const function<_Res(_ArgTypes ...)>&, nullptr_t)'
743 | operator==(const function<_Res(_Args...)>& __f, nullptr_t) noexcept
|
s705897631 | p03827 | C++ | signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int x = 0, max = 0;
int n;
string s;
cin >>n>> s;
for (int i = 0; i < (int)s.length(); i++)
{
if (s[i] == 'I') {
x++;
}
else {
x--;
}
if (x > max) {
max = x;
}
}
cout << max << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:2:9: error: 'cin' was not declared in this scope
2 | cin.tie(0);
| ^~~
a.cc:3:9: error: 'ios' has not been declared
3 | ios::sync_with_stdio(false);
| ^~~
a.cc:7:9: error: 'string' was not declared in this scope
7 | string s;
| ^~~~~~
a.cc:8:19: error: 's' was not declared in this scope
8 | cin >>n>> s;
| ^
a.cc:24:9: error: 'cout' was not declared in this scope
24 | cout << max << endl;
| ^~~~
a.cc:24:24: error: 'endl' was not declared in this scope
24 | cout << max << endl;
| ^~~~
|
s105574568 | p03827 | C++ | #include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;
int main(void){
int n;
cin >> n;
string input;
cin >> input;
vector<int> value(n) = {0};
for(int i = 0; i < n; i++){
if(input[i] == 'I'){
value[i+1] = value[i]++;
} else {
value[i+1] = value[i]--;
}
}
sort(value.begin(), value.end(), greater<int>());
cout << value[0] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:29:24: error: expected ',' or ';' before '=' token
29 | vector<int> value(n) = {0};
| ^
|
s729542165 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000
typedef long long LL;
typedef long double LD;
int main(){
int n;
cin >> n;
int ans=0;
for(int i=0;i<n;i++){
cin >> c;
if(c=='I'){
x++;
}else{
x--;
}
ans=max(ans,x);
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:25:12: error: 'c' was not declared in this scope
25 | cin >> c;
| ^
a.cc:27:7: error: 'x' was not declared in this scope
27 | x++;
| ^
a.cc:29:7: error: 'x' was not declared in this scope
29 | x--;
| ^
a.cc:31:17: error: 'x' was not declared in this scope
31 | ans=max(ans,x);
| ^
a.cc:4:24: note: in definition of macro 'max'
4 | #define max(a,b) ((a)>(b)?(a):(b))
| ^
|
s234945835 | p03827 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
template < typename T >
void vprint(T &v){
REP(i, v.size()){
cout << v[i] << " ";
}
cout << endl;
}
int main(){
ll N;
string S;
cin >> N >> S;
ll x = 0;
ll res = -1;
REP(i, N){
x += (S[i]=='I'?+1;-1);
res = max(res, x);
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:31:35: error: expected ':' before ';' token
31 | x += (S[i]=='I'?+1;-1);
| ^
| :
a.cc:31:35: error: expected primary-expression before ';' token
a.cc:31:35: error: expected ')' before ';' token
31 | x += (S[i]=='I'?+1;-1);
| ~ ^
| )
a.cc:31:38: error: expected ';' before ')' token
31 | x += (S[i]=='I'?+1;-1);
| ^
| ;
|
s572221424 | p03827 | C++ | #include <iostream>
using namespace std;
int main() {
int n, x;
string s;
cin >> n >> s;
x = 0;
for (int i = 0; i < n; i ++) {
if (s[i] == "I") x ++;
if (s[i] == "D") x --;
}
cout << x << endl;
} | a.cc: In function 'int main()':
a.cc:11:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
11 | if (s[i] == "I") x ++;
a.cc:12:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
12 | if (s[i] == "D") x --;
|
s315932639 | p03827 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,now,ans;
char ch;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>u;
if(ch=='I')now++;
else
now--;
ans=max(ans,now);
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:14: error: 'u' was not declared in this scope
10 | cin>>u;
| ^
|
s053621359 | p03827 | C | #include<stdio.h>{
int main(){
int max=0,x=0,i,n;
char S[n];
scanf("%d",&n);
scanf("%s",S);
for(i=0;i<n;i++){
if(S[i]=='I'){
x++;
}
else{
x--;
}
if(x>max){
max=x;
}
printf("%d",max);
} | main.c:1:18: warning: extra tokens at end of #include directive
1 | #include<stdio.h>{
| ^
main.c: In function 'main':
main.c:19:9: error: expected declaration or statement at end of input
19 | }
| ^
|
s059682208 | p03827 | C | #include <stdio.h>
int main(void){
int N,a,b,i;
char S[N];
scanf("%d %s",&N,S);
a,b=0;
for(i=0;i<N;i++){
if(S[i]==I)
a++;
else a--;
if(a<b)
a=b;
}
printf("%d",b);
return 0;
}
| main.c: In function 'main':
main.c:8:13: error: 'I' undeclared (first use in this function)
8 | if(S[i]==I)
| ^
main.c:8:13: note: each undeclared identifier is reported only once for each function it appears in
|
s402926447 | p03827 | C++ | #include<iostream>
using namespace std;
int main(){
int n;cin>>n;
string s;cin>>s;
int max=0,x=0;
for(int i=0;i<n;i++){
if(s[i]=='I')x++;
if(s[i]=='D')x--;
max=max(max,x);
}
cout<<max<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:12: error: 'max' cannot be used as a function
11 | max=max(max,x);
| ~~~^~~~~~~
|
s103073810 | p03827 | C++ | #include<iostream>
using namespace std;
int main()
{ int t;
cin>>t;
string x;
char 'I','D';
getline(cin , x);
int z=0;
for(int y=0 ; y<t; y++)
{
if(x.at(y)=I){z=z+1;}
if(x.at(y)=D){z=z-1;}
}
cout<<z;
} | a.cc: In function 'int main()':
a.cc:8:6: error: expected unqualified-id before 'I'
8 | char 'I','D';
| ^~~
a.cc:13:20: error: 'I' was not declared in this scope
13 | if(x.at(y)=I){z=z+1;}
| ^
a.cc:14:20: error: 'D' was not declared in this scope
14 | if(x.at(y)=D){z=z-1;}
| ^
|
s757539448 | p03827 | C++ | #include<iostream>
using namespace std;
int main()
{ int t;
cin>>t;
string x;
getline(cin , x);
int z=0;
for(int y=0 ; y<t; y++)
{
if(x.at(y)=I){z=z+1;}
if(x.at(y)=D){z=z-1;}
}
cout<<z;
} | a.cc: In function 'int main()':
a.cc:12:20: error: 'I' was not declared in this scope
12 | if(x.at(y)=I){z=z+1;}
| ^
a.cc:13:20: error: 'D' was not declared in this scope
13 | if(x.at(y)=D){z=z-1;}
| ^
|
s086815384 | p03827 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main ()
{
int N;
int x=0;
cin>> N;
string str1("I") ;
string str2("D") ;
string newarr [N];
for (int i=0; i++ ; i<N)
{
cin>> newarr[i];
}
for (int i=0 ; i++ ; i<N)
{
if (newarr[i]= str1) {x++;}
if (newarr[i]= str2) {x=x-1 ;}
}
int max;
for (int i=0 ; i<N; i++)
if (int max = newarr[0]){cout<< newarr[0];}
if (int newarr[i]>newarr[0]){max= newarr[i];
cout<< max;}
}
} | a.cc: In function 'int main()':
a.cc:18:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(str1)' from 'std::__cxx11::basic_string<char>' to 'bool'
18 | if (newarr[i]= str1) {x++;}
| ~~~~~~~~~^~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:19:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(str2)' from 'std::__cxx11::basic_string<char>' to 'bool'
19 | if (newarr[i]= str2) {x=x-1 ;}
| ~~~~~~~~~^~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:23:27: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
23 | if (int max = newarr[0]){cout<< newarr[0];}
| ~~~~~~~~^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:24:20: error: 'i' was not declared in this scope
24 | if (int newarr[i]>newarr[0]){max= newarr[i];
| ^
a.cc:24:13: error: condition declares an array
24 | if (int newarr[i]>newarr[0]){max= newarr[i];
| ^~~~~~
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
29 | }
| ^
|
s003392982 | p03827 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
int N;
int x=0;
cin>> N;
string arr [2] = {I , D} ;
string newarr [N];
for (int i=0; i++ ; i<N)
{
cin>> newarr[i];
}
for (int i=0 ; i++ ; i<N)
{
if (newarr[i]= arr[0]) {x++;}
if (newarr[i]= arr[1]) {x=x-1 ;}
}
int max;
for (int i=0 ; i<N; i++)
if (int max = newarr[0]){cout<< newarr[0];}
if (int newarr[i]>newarr[0]){max= newarr[i];
cout<< max;}
}
| a.cc: In function 'int main()':
a.cc:9:23: error: 'I' was not declared in this scope
9 | string arr [2] = {I , D} ;
| ^
a.cc:9:27: error: 'D' was not declared in this scope
9 | string arr [2] = {I , D} ;
| ^
a.cc:17:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(arr[0])' from 'std::__cxx11::basic_string<char>' to 'bool'
17 | if (newarr[i]= arr[0]) {x++;}
| ~~~~~~~~~^~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:18:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(arr[1])' from 'std::__cxx11::basic_string<char>' to 'bool'
18 | if (newarr[i]= arr[1]) {x=x-1 ;}
| ~~~~~~~~~^~~~~~~~
| |
| std::__cxx11::basic_string<char>
a.cc:22:27: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
22 | if (int max = newarr[0]){cout<< newarr[0];}
| ~~~~~~~~^
| |
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:23:20: error: 'i' was not declared in this scope
23 | if (int newarr[i]>newarr[0]){max= newarr[i];
| ^
a.cc:23:13: error: condition declares an array
23 | if (int newarr[i]>newarr[0]){max= newarr[i];
| ^~~~~~
|
s601302486 | p03827 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int x=0;
int n;
string s;
int arr[s.length()];
for(int i=0;i<n;i++)
{
if (s.at(i)=='I'){ x=x+1;
arr[i]=x;}
else
{
x=x-1;
arr[i]=x;
}
for(int i=0;i<s.length()-1;i++)
{
if(arr[i+1]<=arr[i]) arr[i+1]=arr[i];
}
cout<<arr[s.length()];
} | a.cc: In function 'int main()':
a.cc:23:2: error: expected '}' at end of input
23 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s445701746 | p03827 | C++ | #include<iostream>
#include<cstring>
using namespace std;
int main()
{
int x=0,a[150],k;
char S[150];
cin>>N;
cin>>S;
a[0]=0;
for(int i=0; i<N; i++)
{
if(S[i]=='I')
x++;
else if(S[i]=='D')
x--;
a[i+1]=x;
}
k=a[0];
for (int i=1; i<N+1;i++)
{
if(k<a[i])
k=a[i];
}
cout<<k;
}
| a.cc: In function 'int main()':
a.cc:9:8: error: 'N' was not declared in this scope
9 | cin>>N;
| ^
|
s506078560 | p03827 | C | #include<stdio.h>
#include<string.h>
int main()
{
int x=0;
char arr[30];
int N;
N=strlen(arr);
int i,t;
for(i=0;i<=N-1;i++)
{
if(arr(i)==I)
x++;
else if(arr(i)==D)
x--;
if(x++>x || x-->x)
t=x;
}
return(t);
} | main.c: In function 'main':
main.c:12:12: error: called object 'arr' is not a function or function pointer
12 | if(arr(i)==I)
| ^~~
main.c:6:10: note: declared here
6 | char arr[30];
| ^~~
main.c:12:20: error: 'I' undeclared (first use in this function)
12 | if(arr(i)==I)
| ^
main.c:12:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:17: error: called object 'arr' is not a function or function pointer
14 | else if(arr(i)==D)
| ^~~
main.c:6:10: note: declared here
6 | char arr[30];
| ^~~
main.c:14:25: error: 'D' undeclared (first use in this function)
14 | else if(arr(i)==D)
| ^
|
s435941158 | p03827 | C++ | #include<iostream>
using namespace std;
int main()
{
int x=0,a[150],k;
char S[150];
cin>>S;
a[0]=0;
for(int i=0; i<strlen(S); i++)
{
if(S[i]=='I')
x++;
else if(S[i]=='D')
x--;
a[i]=x;
}
k=a[0];
for (int i=1; i<strlen(S);i++)
{
if(k<a[i])
k=a[i];
}
cout<<k;
}
| a.cc: In function 'int main()':
a.cc:10:18: error: 'strlen' was not declared in this scope
10 | for(int i=0; i<strlen(S); i++)
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:19:19: error: 'strlen' was not declared in this scope
19 | for (int i=1; i<strlen(S);i++)
| ^~~~~~
a.cc:19:19: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s260118863 | p03827 | C++ | #include <iostream>
#include <cmath>
#include<algorithm>
using namespace std;
int main()
{
int a;
string input;
cin<<a<<input;
int b=0;
array maxi[a];
for (int c=0;c<a;c++)
{
if(s[c]==I)
{
b=b+1;
}
else {
b=b-1;
}
maxi[c]=b;
}
sort (maxi,maxi+a);
cout << maxi[a-1];
}
| a.cc: In function 'int main()':
a.cc:12:8: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
12 | cin<<a<<input;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:12:8: note: candidate: 'operator<<(int, int)' (built-in)
12 | cin<<a<<input;
| ~~~^~~
a.cc:12:8: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:12:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
12 | cin<<a<<input;
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:12:10: required from here
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
a.cc:16:5: error: missing template argument list after 'std::array'; for deduction, template placeholder must be followed by a simple declarator-id
16 | array maxi[a];
| ^~~~~
| <>
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:99:12: note: 'template<class _Tp, long unsigned int _Nm> struct std::array' declared here
99 | struct array;
| ^~~~~
a.cc:20:12: error: 's' was not declared in this scope
20 | |
s943331523 | p03827 | C++ | #include <iostream>
#include <cmath>
#include<algorithm>
using namespace std;
int main()
{
int a;
string input;
cin<<a<<input;
int b=0;
array maxi[a];
for (int c=0;c<a;c++)
{
if(s[c]==I)
{
m=m+1;
}
else {
m=m-1;
}
maxi[c]=m;
}
sort (maxi,maxi+a);
cout << maxi[a-1];
}
| a.cc: In function 'int main()':
a.cc:12:8: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
12 | cin<<a<<input;
| ~~~^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:12:8: note: candidate: 'operator<<(int, int)' (built-in)
12 | cin<<a<<input;
| ~~~^~~
a.cc:12:8: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:12:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
12 | cin<<a<<input;
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:12:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:12:10: required from here
12 | cin<<a<<input;
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
a.cc:16:5: error: missing template argument list after 'std::array'; for deduction, template placeholder must be followed by a simple declarator-id
16 | array maxi[a];
| ^~~~~
| <>
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:99:12: note: 'template<class _Tp, long unsigned int _Nm> struct std::array' declared here
99 | struct array;
| ^~~~~
a.cc:20:12: error: 's' was not declared in this scope
20 | |
s376676975 | p03827 | Java | import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int N=in.nextInt();
String S=in.nextLine();
int x=max=0;
for (int i=0; i<N; i++)
{
char c=ScharAt(i);
if(c=='I')
x++;
else
x--;
if(x>max)
max=x;
}
System.out.println(max);
}
}
| Main.java:9: error: cannot find symbol
int x=max=0;
^
symbol: variable max
location: class Main
Main.java:12: error: cannot find symbol
char c=ScharAt(i);
^
symbol: method ScharAt(int)
location: class Main
Main.java:17: error: cannot find symbol
if(x>max)
^
symbol: variable max
location: class Main
Main.java:18: error: cannot find symbol
max=x;
^
symbol: variable max
location: class Main
Main.java:20: error: cannot find symbol
System.out.println(max);
^
symbol: variable max
location: class Main
5 errors
|
s791295059 | p03827 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string s;
int n;
cin>>n;
cin>>s;
int max=x,x=0;
for(int i=0;i<s.length();i++){
if(s[i]=='I')
x++;
else if(s[i]=='D')
x--;
if(max<x)
max=x;
}
cout<<max<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:10:17: error: 'x' was not declared in this scope
10 | int max=x,x=0;
| ^
|
s966820154 | p03827 | C++ | #include<bits/stdc++.h>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
int n; cin >> n;
string s[n]; cin >> s;
int ans = 0;
for(int i = 0; i < n; i++){
if(s[i] == "I") ans++;
else(s[i] == "D") ans--;
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:10:20: 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]'})
10 | string s[n]; 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/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:10:23: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}
10 | string s[n]; 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive]
10 | string s[n]; cin >> s;
| ^
| |
| std::string* {aka std::__cxx11::basic_string<char>*}
a.cc:10:23: 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:10:23: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
10 | string s[n]; 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 | oper |
s930701745 | p03827 | C++ | n = int(input())
s = input()
x = 0
alist = [0]
for i in range(n):
if s[i]=='I':
x += 1
else:
x -= 1
alist.append(x)
print(max(alist)) | a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s432540244 | p03827 | C++ | #include<stdio.h>
int main()
{
char s[n];
int i;
int n;
int x = 0;
int max;
max = x;
scanf("%d%d%d%c",&i,&n,&x,&s[i]);
for(i = 0; i <= n; i++)
{
if(s[i] == 'I')
printf("%d = x\n",x++);
if(s[i] == 'D')
printf("%d = x\n",x--);
}
printf("%d\n",max);
return 0;
} | a.cc: In function 'int main()':
a.cc:4:16: error: 'n' was not declared in this scope
4 | char s[n];
| ^
a.cc:10:36: error: 's' was not declared in this scope
10 | scanf("%d%d%d%c",&i,&n,&x,&s[i]);
| ^
|
s596475249 | p03827 | C | #include<cstdio>
main(){
int n,a = 0,x = 0;
char s[105];
scanf("%d",&n);
scanf("%s",s);
for(int i = 0;i < n ; i++){
if(s[i] == 'I'){
x = x + 1;
}
else if (s[i] == 'D'){
x = x - 1;
}
if(a >= x) continue;
else if (a < x){
a = x ;
}
}
printf("%d\n",a);
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s124400296 | p03827 | C++ | #include<cstdio>
#include<cmath>
#include<iostream>
typedef long long ll;
using namespace std;
char a[100000];
int main()
{
int x = 0, max = 0;
int N,i;
scanf("%d",&N);
scanf("%s",a);
N = strlen(a);
for(i = 0; i < N; i++)
{
if(a[i] == 'I')
{
x++;
max = max > x ? max : x;
}
if(a[i] == 'D')
{
x--;
}
}
printf("%d\n",max);
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:13: error: 'strlen' was not declared in this scope
14 | N = strlen(a);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<iostream>
+++ |+#include <cstring>
4 | typedef long long ll;
|
s562422550 | p03827 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,x,ans;
string s;
int main(){
cin>>n>>s;
for (int i=0;i<n;i++){
if (s[i]=="I") x++;
if (s[i]=="D") x--;
if (x>ans) ans=x;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | if (s[i]=="I") x++;
a.cc:9:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
9 | if (s[i]=="D") x--;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.