submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s348042362 | p03945 | C++ | #include<bits/stdc++.h>
using namespase std;
int main(){
int ans = 0;
string S;
cin >> S;
for(int i=1; i<S.length(); i++){
if(S[i]!=S[i-1]){
ans++;
}
}
cout << ans << endl;
return 0;
} | a.cc:2:7: error: expected nested-name-specifier before 'namespase'
2 | using namespase std;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
5 | string 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,
from a.cc:1:
/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:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> S;
| ^~~
| std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:6:10: error: 'S' was not declared in this scope
6 | cin >> S;
| ^
a.cc:14:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
14 | 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:14:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
14 | 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)
| ^~~~
|
s563690606 | p03945 | C++ | #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char n[];
int jsq=0,len;
scanf("%s",&n);
len=strlen(n);
for(int i=1;i<len;i++)
{
if(n[i]!=n[i+1])jsq++;
}
printf("%d",jsq);
} | a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'n' isn't known
6 | char n[];
| ^
|
s950978711 | p03945 | C++ | #include<cstdio>
#include<cstring>
using namespace std;
int main()
{
char n[];
int jsq=0,len;
scanf("%s",&n);
len=strlen(n);
for(int i=1;i<len;i++)
{
if(n[i]!=n[i+1])
jsq++;
}
printf("%d",jsq);
} | a.cc: In function 'int main()':
a.cc:6:10: error: storage size of 'n' isn't known
6 | char n[];
| ^
a.cc:10:17: error: 'i' was not declared in this scope
10 | for(int i=1;i<len;i++)
| ^
|
s137756584 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s361102150 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s884659687 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s661010338 | p03945 | C++ | #include<bits\stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
int ans = 0;
for(int i = 1;i < s.length();i++){
if(s[i] != s[i-1]) ans++;
}
cout << ans << endl;
} | a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory
1 | #include<bits\stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s928587664 | p03945 | C++ | #include<iostream>
#include<string.h>
using namespace std;
int main()
{
int i,n,sum=0;
char a[10010];
gets(a);
n=strlen(a);
for(i=0;i<n-1;i++)
{
if(a[i]!=a[i+1])sum++;
}
cout<<sum<<endl;
} | a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
8 | gets(a);
| ^~~~
| getw
|
s912485335 | p03945 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int count=0;
Scanner sc=new Scanner(System.in);
String s;
s=sc.nextLine();
for(int i=1;i<s.length();i++) {
if(s.charAt(i)!=s.charAt(i-1))count++;
}
System.out.println(count);
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s389755564 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main () {
string s;
int a,i,y,x,W,H,N,num=0;
cin >> s;
for (i=0;i<s.size()-1;i++)
if (s[i]!=s[i+1]) num++;
cout << num << endl;
return 0;
}#include <bits/stdc++.h>
using namespace std;
int main () {
string s;
int a,i,y,x,W,H,N,num=0;
cin >> s;
for (i=0;i<s.size()-1;i++)
if (s[i]!=s[i+1]) num++;
cout << num << endl;
return 0;
} | a.cc:15:2: error: stray '#' in program
15 | }#include <bits/stdc++.h>
| ^
a.cc:15:3: error: 'include' does not name a type
15 | }#include <bits/stdc++.h>
| ^~~~~~~
a.cc:20:5: error: redefinition of 'int main()'
20 | int main () {
| ^~~~
a.cc:6:5: note: 'int main()' previously defined here
6 | int main () {
| ^~~~
|
s142292055 | p03945 | C++ | #include <bits/stdc++.h>
int main(){
std::string s;
cin>>s;
long count=0;
for(int i=1; i<s.size(); i++){
if(s[i]!=s[i-1])
count++;
}
cout<<count;
} | a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
4 | cin>>s;
| ^~~
| 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:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<count;
| ^~~~
| std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
|
s499745148 | p03945 | Java | import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String s = sc.nextInt();
int len = s.length();
StringBuilder sb = new StringBuilder();
int left = 0;
while(left<len){
int right = left+1;
while(right<N&&s.charAt(right)==s.charAt(left)) right++;
sb.append(s.charAt(left));
left=right;
}
String res = sb.toString();
System.out.println(res.length()-1);
}
}
| Main.java:6: error: incompatible types: int cannot be converted to String
String s = sc.nextInt();
^
Main.java:12: error: cannot find symbol
while(right<N&&s.charAt(right)==s.charAt(left)) right++;
^
symbol: variable N
location: class Main
2 errors
|
s189456497 | p03945 | C++ | #include<bits/stdc++.h>
char s[100001];
int main()
{
gets(s);
int ans=0;
for(int i=1;i<strlen(s);i++)
if(s[i]!=s[i-1])
ans++;
cout<<ans<<endl;
} | a.cc: In function 'int main()':
a.cc:5:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
5 | gets(s);
| ^~~~
| getw
a.cc:10:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
10 | cout<<ans<<endl;
| ^~~~
| std::cout
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:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:10:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
10 | 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)
| ^~~~
|
s997866063 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
string a;
int ans;
int main()
{
cin>>a;
for(int s=1;s<a;s++)
{
if(a[s]!=a[s-1])ans++;
}
cout<<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:22: error: no match for 'operator<' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
8 | for(int s=1;s<a;s++)
| ~^~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| int
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:1143:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1143 | operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1143:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1224: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>&)'
1224 | operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1224:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1317: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>&)'
1317 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1317:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1391:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1391 | operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1391:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1485:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1485 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1485:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1560:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1560 | operator<(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1560:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/regex.h:1660:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator<(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1660 | operator<(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1660:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
448 | operator<(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
493 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1694 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1760 | operator<(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
673 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/string_view:680: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> >)'
680 | operator< (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/string_view:688: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>)'
688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/basic_string.h:3874: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>&)'
3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed:
a.cc:8:23: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
8 | for(int s=1;s<a;s++)
| ^
/usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const |
s827416766 | p03945 | C++ | #include <bits/stdc++.h>
//#include <Rem>
using namespace std;
string s;
int count=0;
int main()
{
cin>>s;
char k=s[0];
for(int i=1; i<s.length(); i++)
{
if(s[i]!=k) count++;
k=s[i];
}
printf("%d\n",count);
return 0;
} | a.cc: In function 'int main()':
a.cc:14:22: error: reference to 'count' is ambiguous
14 | if(s[i]!=k) count++;
| ^~~~~
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:6:5: note: 'int count'
6 | int count=0;
| ^~~~~
a.cc:17:19: error: reference to 'count' is ambiguous
17 | printf("%d\n",count);
| ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
| ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
4025 | count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
| ^~~~~
a.cc:6:5: note: 'int count'
6 | int count=0;
| ^~~~~
|
s948874042 | p03945 | C++ | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
char s,c;
iint ans;
int main()
{
cin>>s;
while (scanf("%c", &c) == 1)
{
if (c!='B'&&c!='W')
break;
if (c!=s)
{
ans++;
s=c;
}
}
cout<<ans<<endl;
return 0;
} | a.cc:22:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
22 | #pragma GCC optimize("-fwhole-program")
| ^
a.cc:29:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
29 | #pragma GCC optimize("-fstrict-overflow")
| ^
a.cc:31:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
31 | #pragma GCC optimize("-fcse-skip-blocks")
| ^
a.cc:45:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
45 | #pragma GCC optimize("-funsafe-loop-optimizations")
| ^
a.cc:60:1: error: 'iint' does not name a type; did you mean 'uint'?
60 | iint ans;
| ^~~~
| uint
a.cc:61:10: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
61 | int main()
| ^
a.cc:61:10: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:61:10: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:61:10: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
a.cc: In function 'int main()':
a.cc:70:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
70 | ans++;
| ^~~
| abs
a.cc:74:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
74 | cout<<ans<<endl;
| ^~~
| abs
|
s051647124 | p03945 | C++ | #pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <map>
#include <list>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int a,b;
sting s;
int main()
{
fast;
cin>>s;
for (int i=0;i<=s.size()-1;i++)
if (s[i]=='B')
a++;
else
b++;
if (a!=0 && b!=0)
cout<<abs(a-b)<<endl;
return 0;
} | a.cc:22:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
22 | #pragma GCC optimize("-fwhole-program")
| ^
a.cc:29:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
29 | #pragma GCC optimize("-fstrict-overflow")
| ^
a.cc:31:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
31 | #pragma GCC optimize("-fcse-skip-blocks")
| ^
a.cc:45:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
45 | #pragma GCC optimize("-funsafe-loop-optimizations")
| ^
a.cc:60:1: error: 'sting' does not name a type
60 | sting s;
| ^~~~~
a.cc:61:10: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
61 | int main()
| ^
a.cc:61:10: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
a.cc:61:10: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
a.cc:61:10: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
a.cc: In function 'int main()':
a.cc:64:14: error: 's' was not declared in this scope
64 | cin>>s;
| ^
|
s591470546 | p03945 | C++ | #include<cstdio>
char s[1e5+5];
int ans;
int main(){
scanf("%s",s);
for(int i=1;s[i];i++)
if(s[i]!=s[i-1])ans++;
printf("%d\n",ans);
} | a.cc:2:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
2 | char s[1e5+5];
| ~~~^~
a.cc:2:11: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int'
2 | char s[1e5+5];
| ~~~^~
| |
| double
a.cc:2:11: error: size of array 's' has non-integral type 'double'
|
s611908373 | p03945 | C | #include <stdio.h>int main() {
char s[100010];
int x = 0;
scanf("%s", s);
for (int i = 1; s[i] != '\0'; i++)
{
if (s[i - 1] != s[i]) {
x++;
}
}
printf("%d", x);
return 0;
} | main.c:1:19: warning: extra tokens at end of #include directive
1 | #include <stdio.h>int main() {
| ^~~
main.c:4:15: error: expected declaration specifiers or '...' before string constant
4 | scanf("%s", s);
| ^~~~
main.c:4:21: error: expected declaration specifiers or '...' before 's'
4 | scanf("%s", s);
| ^
main.c:5:9: error: expected identifier or '(' before 'for'
5 | for (int i = 1; s[i] != '\0'; i++)
| ^~~
main.c:5:27: error: 'i' undeclared here (not in a function)
5 | for (int i = 1; s[i] != '\0'; i++)
| ^
main.c:5:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!=' token
5 | for (int i = 1; s[i] != '\0'; i++)
| ^~
main.c:5:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
5 | for (int i = 1; s[i] != '\0'; i++)
| ^~
main.c:11:16: error: expected declaration specifiers or '...' before string constant
11 | printf("%d", x);
| ^~~~
main.c:11:22: error: expected declaration specifiers or '...' before 'x'
11 | printf("%d", x);
| ^
main.c:12:9: error: expected identifier or '(' before 'return'
12 | return 0;
| ^~~~~~
main.c:13:1: error: expected identifier or '(' before '}' token
13 | }
| ^
|
s390476035 | p03945 | C | #include<stdio.h>
#include<string.h>
#include<queue>
#include<algorithm>
using namespace std;
bool flag = true;
queue<char> que;
char fr, fr2;
void i_judge()
{
flag = true;
fr = que.front();
while(flag)
{
que.pop();
if(que.front() == fr)
flag = true;
else
flag = false;
}
}
int main()
{
char s[100005];
scanf("%s", &s);
int len = strlen(s);
for(int i = 0; i < len; i++)
que.push(s[i]);
int num = 0;
int cou = 10;
int ans = 0;
while(1)
{
fr2 = que.front();
i_judge();
if(!que.size())
break;
for(int i = 0; i < que.size(); i++)
{
if(que.front() == 'W')
{
que.push('B');
}
else if(que.front() == 'B')
{
que.push('W');
}
que.pop();
}
que.push(s[ans++]);
num++;
}
printf("%d\n", num);
return 0;
} | main.c:3:9: fatal error: queue: No such file or directory
3 | #include<queue>
| ^~~~~~~
compilation terminated.
|
s935736816 | p03945 | C | #include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
bool flag = true;
queue<char> que;
char fr, fr2;
void i_judge()
{
flag = true;
fr = que.front();
while(flag)
{
que.pop();
if(que.front() == fr)
flag = true;
else
flag = false;
}
}
int main()
{
char s[100005];
scanf("%s", &s);
int len = strlen(s);
for(int i = 0; i < len; i++)
que.push(s[i]);
int num = 0;
int cou = 10;
int ans = 0;
while(1)
{
fr2 = que.front();
i_judge();
if(!que.size())
break;
for(int i = 0; i < que.size(); i++)
{
if(que.front() == 'W')
{
que.push('B');
}
else if(que.front() == 'B')
{
que.push('W');
}
que.pop();
}
que.push(s[ans++]);
num++;
}
printf("%d\n", num);
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s481908116 | p03945 | C++ | #include<cstdio>
#include<cstring>
int main()
{
char a[10004];
gets(a);
int l=strlen(a);
int ant=0;
for(int i=1;i<l;i++)
{
if(a[i]!=a[i-1])
ant++;
}
printf("%d\n",ant);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(a);
| ^~~~
| getw
|
s498880110 | p03945 | Java | import java.util.Scanner;
public class ICPC_8_P4 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String game = sc.nextLine();
int reqMoves = 0;
if (game.length() > 1) {
for (int i = 0; i < game.length() - 1; i++) {
if (game.charAt(i) != game.charAt(i + 1)) {
reqMoves++;
}
}
}
System.out.println(reqMoves);
}
}
| Main.java:3: error: class ICPC_8_P4 is public, should be declared in a file named ICPC_8_P4.java
public class ICPC_8_P4 {
^
1 error
|
s182668530 | p03945 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
string s;
while (cin >> s) {
int n = s.length();
int cnt = 0;
for (int i = 1; i < n: ++i) {
if (s[i] != s[i-1]) ++cnt;
}
cout << cnt << "\n";
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:11:25: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
11 | for (int i = 1; i < n: ++i) {
| ^
a.cc:11:30: error: expected ';' before ':' token
11 | for (int i = 1; i < n: ++i) {
| ^
| ;
a.cc:15:5: error: expected primary-expression before '}' token
15 | }
| ^
a.cc:14:29: error: expected ')' before '}' token
14 | cout << cnt << "\n";
| ^
| )
15 | }
| ~
a.cc:11:13: note: to match this '('
11 | for (int i = 1; i < n: ++i) {
| ^
a.cc:15:5: error: expected primary-expression before '}' token
15 | }
| ^
|
s380435332 | p03945 | C++ | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String S = sc.next();
char[] c = S.toCharArray();
int N = S.length();
int cnt = 0;
for(int i = 0 ; i < N - 1 ; i++) {
if(c[i] != c[i + 1]) {
cnt++;
}
}
System.out.println(cnt);
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
3 | public class Main {
| ^~~~~~
|
s838323851 | p03945 | C++ | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
int i, j, k = 0, l, m, n;
using namespace std;
char S[100055], T[100055];
using namespace std;
int main() {
gets(S);
n = strlen(S);
for(i = 1; i < n; i++) {
if(S[i] != S[i-1]) ++l;
}
printf("%d\n", l);
} | a.cc: In function 'int main()':
a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
10 | gets(S);
| ^~~~
| getw
|
s584900072 | p03945 | C++ | #include<cstdio>
#include<cstring>
char s[100];
int ac,a,b,c,d;
int main(){
gets(s);
int len=strlen(s);
d=0; a=b=0;
for (int i=0; i<len; i++){
if (s[i]>='0'&&s[i]<='9'){
if (!d) a=a*10+s[i]-48;
else b=b*10+s[i]-48;
}
else if (s[i]=='+') c=1,d=1;
else if (s[i]=='-') c=-1,d=1;
}
printf("%d\n",a+c*b);
return 0;
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
6 | gets(s);
| ^~~~
| getw
|
s488639671 | p03945 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int res = 1;
bool flag;
cin >> s;
int len = s.size()
if (s[0] == 'B')
flag = 0;
else
flag = 1;
for (int i = 1; i < len; ++i)
{
if ((s[i] == 'B') && (!flag))
continue;
else if ((s[i] == 'W') && (flag))
continue;
else
{
res++;
flag = (s[i]=='B')?0:1;
}
}
return res - 1;
} | a.cc: In function 'int main()':
a.cc:10:9: error: expected ',' or ';' before 'if'
10 | if (s[0] == 'B')
| ^~
a.cc:12:9: error: 'else' without a previous 'if'
12 | else
| ^~~~
|
s828942962 | p03945 | C++ | #include <iostream>
int main()
{
string s;
cin>>s;
} | a.cc: In function 'int main()':
a.cc:4:11: error: 'string' was not declared in this scope
4 | string s;
| ^~~~~~
a.cc:4:11: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string'
77 | typedef basic_string<char> string;
| ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note: 'std::pmr::string'
76 | using string = basic_string<char>;
| ^~~~~~
a.cc:5:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
5 | cin>>s;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:5:6: error: 's' was not declared in this scope
5 | cin>>s;
| ^
|
s421272328 | p03945 | C++ | #include <bits/stdc++.h>
#define get_variable_name(x) #x
#define debug(x) cout << #x << " = " << x << endl
#define rep(i,n) for(int (i) = 0; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())
#define REVERSE(x) reverse( (x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define PW(x) (1LL<<(x))
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
template<class T,class U>
ostream& operator<<(ostream &os, const pair<T, U> &p) {
os << get_variable_name(p) << " = (" << p.first <<", " << p.second << ")";
return os;
}
template<class T>
ostream& operator <<(ostream& os, const vector<T> &v){
cout << get_variable_name(v) << " = [";
for(auto i : v)
os << " " << i;
os << " ]";
return os;
}
const int INF = 1e8;
int main() {
ios::sync_with_stdio(false);
string S;
cin >> s;
int ans = 0;
char prev = s[0];
for(int i = 1; i < s.size(); i++) {
ans += (prev != s[i]);
prev = s[i];
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:38:12: error: 's' was not declared in this scope
38 | cin >> s;
| ^
|
s722862657 | p03945 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <copy>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
if(!v.empty()) {
out << '[';
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
out << "\b\b]";
}
return out;
}
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
out << "[" << p.first << ", " << p.second << "]";
return out;
}
//---------
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
//CLion Standard Input
// ifstream in("/Users/ryo/Dropbox/competition/CompetionIDE/in.txt");
// cin.rdbuf(in.rdbuf());
string ss;
cin >> ss;
ll ans = 0;
rep(i, 1, ss.size()){
if(!(ss[i-1] == ss[i])) ans++;
}
cout << ans << endl;
return 0;
} | a.cc:14:10: fatal error: copy: No such file or directory
14 | #include <copy>
| ^~~~~~
compilation terminated.
|
s924172634 | p03945 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
if(!v.empty()) {
out << '[';
std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
out << "\b\b]";
}
return out;
}
template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
out << "[" << p.first << ", " << p.second << "]";
return out;
}
//---------
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
//CLion Standard Input
// ifstream in("/Users/ryo/Dropbox/competition/CompetionIDE/in.txt");
// cin.rdbuf(in.rdbuf());
string ss;
cin >> ss;
ll ans = 0;
rep(i, 1, ss.size()){
if(!(ss[i-1] == ss[i])) ans++;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)':
a.cc:26:44: error: 'ostream_iterator' is not a member of 'std'
26 | std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
| ^~~~~~~~~~~~~~~~
a.cc:14:1: note: 'std::ostream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>'
13 | #include <fstream>
+++ |+#include <iterator>
14 |
a.cc:26:62: error: expected primary-expression before '>' token
26 | std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
| ^
|
s788091772 | p03945 | C++ | // cpp_console.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string s;
char h;
int cnt = 0;
cin >> s;
if(s[0] == s[s.length ()- 1]){
h = s[0];
for(int i = 1; i < s.length(); ++i){
if(h == s[i]){
++cnt;
}
}
cnt = cnt * 2 - 1;
}else{
int b = 0;
for(int i = 0; i < s.length(); ++i){
if(s[i] == 'B'){
++b;
}
}
if(b >= (s.length() / 2)){
cnt = (s.length() - b) * 2 - 1;
}else{
cnt = b * 2 - 1;
}
}
cout << cnt << endl;
return 0;
}
| a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s699882429 | p03945 | Java | public class Main {
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
String board = scanner.next();
int stop = 0;
char last = board.charAt(0);
for (int i = 0; i < board.length(); i++) {
if (last != board.charAt(i)){
stop ++;
last = board.charAt(i);
}
}
System.out.println(stop);
}
}
| Main.java:4: error: cannot find symbol
Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:4: error: cannot find symbol
Scanner scanner = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s234957121 | p03945 | C++ | #include <string>
#include <iostream>
string osero;
char flag;
int answer = 0;
int main(){
cin >> osero;
flag = osero[0];
for (int i = 1; i < osero.size(); ++i){
if (osero[i] != flag){
answer++;
flag = osero[i];
}
}
printf("%d\n", answer);
return 0;
} | a.cc:4:1: error: 'string' does not name a type; did you mean 'stdin'?
4 | string osero;
| ^~~~~~
| stdin
a.cc: In function 'int main()':
a.cc:9:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
9 | cin >> osero;
| ^~~
| std::cin
In file included from a.cc:2:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:9:16: error: 'osero' was not declared in this scope
9 | cin >> osero;
| ^~~~~
|
s184507224 | p03945 | C++ | #include <iostream>
#include <string.h>
using namespace std;
int main() {
char s[100000];
size_t str=strlen(s);
scanf("%s",s);
int count=;0;
for(int i=0;i<str-1;i++){
for(j=i+1;j<str;j++){
if(s[i]!=s[j]){
count++;
}
}
}
cout<<count-1<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:9:19: error: expected primary-expression before ';' token
9 | int count=;0;
| ^
a.cc:11:21: error: 'j' was not declared in this scope
11 | for(j=i+1;j<str;j++){
| ^
|
s710618844 | p03945 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int x=0;
char s[100001];
cin >> s;
for(int i=1;i<strlen(s);i++)
{
if(s[i] != s[i-1])
{
x++;
}
}
cout << x;
} | a.cc: In function 'int main()':
a.cc:9:23: error: 'strlen' was not declared in this scope
9 | for(int i=1;i<strlen(s);i++)
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s955938131 | p03945 | C++ | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int x=0;
char s[100001];
cin >> s;
for(int i=1;i<strlen(s);i++)
{
if(s[i] != s[i-1])
{
x++;
}
}
cout << x;
} | a.cc: In function 'int main()':
a.cc:9:23: error: 'strlen' was not declared in this scope
9 | for(int i=1;i<strlen(s);i++)
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdlib.h>
+++ |+#include <cstring>
3 | using namespace std;
|
s786090311 | p03945 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
using namespace std;
int main() {
char S[100000];
scanf("%s", S);
int change = 0;
char c = S[0];
for (int i = 1; i < strlen(S); i++)
{
if (c != S[i]) change++;
c = S[i];
}
printf("%d\n", change);
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:25: error: 'strlen' was not declared in this scope
12 | for (int i = 1; i < strlen(S); i++)
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <string>
+++ |+#include <cstring>
4 | using namespace std;
|
s299106745 | p03945 | C++ | #include <iostream>
#include <string>
using namespace std;
int main()
{
char S[100000];
cin >> S;
int N = strlen(S);
int cnt = 0;
for (int i = 1; i < N; i++){
if (S[i] != S[i-1]) {
cnt++;
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:8:12: error: 'strlen' was not declared in this scope
8 | int N = strlen(S);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | #include <string>
|
s755756088 | p03945 | C++ | #include <iostream>
using namespace std;
int main()
{
char S[100000];
cin >> S;
int N = strlen(S);
int cnt = 0;
for (int i = 1; i < N; i++){
if (S[i] != S[i-1]) {
cnt++;
}
}
cout << cnt << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:7:12: error: 'strlen' was not declared in this scope
7 | int N = strlen(S);
| ^~~~~~
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;
|
s346078086 | p03945 | C++ | #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
char s[100000];
int max(int a,int b) {
return (a < b) ? b : a;
}
int min(int a, int b) {
return (a > b) ? b : a;
}
int main() {
cin >> s;
int mode;
int num = 0;
if (s[0] == 'B') {
mode = 1;
}
else {
mode = 2;
}
int len = strlen(s);
for (int i = 0; i < len;i++) {
if (s[i] == 'B') {
if (mode == 2) {
mode = 1;
num++;
}
}
else {
if (mode == 1) {
mode = 2;
num++;
}
}
}
printf("%d",num);
return 0;
} | a.cc: In function 'int main()':
a.cc:27:23: error: 'strlen' was not declared in this scope
27 | int len = strlen(s);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 |
|
s205630303 | p03945 | C++ | /#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main() {
string s;
cin >> s;
int cnt = 0;
char p;
rep(i, 0, s.length()) {
if (i == 0) p = s[i];
if (p != s[i]) {
cnt++;
p = s[i];
}
}
cout << cnt << endl;
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | /#include<bits/stdc++.h>
| ^
a.cc:1:1: error: expected unqualified-id before '/' token
1 | /#include<bits/stdc++.h>
| ^
a.cc: In function 'int main()':
a.cc:7:9: error: 'string' was not declared in this scope
7 | string s;
| ^~~~~~
a.cc:8:9: error: 'cin' was not declared in this scope
8 | cin >> s;
| ^~~
a.cc:8:16: error: 's' was not declared in this scope
8 | cin >> s;
| ^
a.cc:19:9: error: 'cout' was not declared in this scope
19 | cout << cnt << endl;
| ^~~~
a.cc:19:24: error: 'endl' was not declared in this scope
19 | cout << cnt << endl;
| ^~~~
|
s711561680 | p03945 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
String S = sc.next();
// スペース区切りの整数の入力
String sa[] = new String[S.length()];
int counter = 0;
for(int i=0; i<S.length(); i++){
sa[i] = S.charAt(i);
if(i > 1){
if(sa[i].equals(sa[i-1])){
}
else{
counter = counter + 1;
}
}
}
System.out.println(counter);
}
} | Main.java:11: error: incompatible types: char cannot be converted to String
sa[i] = S.charAt(i);
^
1 error
|
s547588408 | p03945 | Java | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// 整数の入力
String S = sc.nextInt();
// スペース区切りの整数の入力
String sa[] = new String[S.length];
int counter = 0;
for(int i=0; i<S.length; i++){
sa[i] = S.charAt(i);
if(i > 1){
if(sa[i].equals(sa[i-1])){
}
else{
counter = counter + 1;
}
}
}
System.out.println(counter);
}
} | Main.java:6: error: incompatible types: int cannot be converted to String
String S = sc.nextInt();
^
Main.java:8: error: cannot find symbol
String sa[] = new String[S.length];
^
symbol: variable length
location: variable S of type String
Main.java:10: error: cannot find symbol
for(int i=0; i<S.length; i++){
^
symbol: variable length
location: variable S of type String
Main.java:11: error: incompatible types: char cannot be converted to String
sa[i] = S.charAt(i);
^
4 errors
|
s497101649 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;
class Solution{
public:
int min_cost(const vector<int>& A){
map<int, int> freq;
for(int start = 0, i = start + 1; i <= A.size(); i ++)
if(i == A.size() || A[i] < A[i - 1]){
freq[A[i - 1] - A[start]] ++;
start = i;
i = start;
}
assert(freq.rbegin()->first > 0);
return freq.rbegin()->second;
}
};
int main() {
int N, T;
scanf("%d%d", &N, &T);
vector<int> A(N);
for(int i = 0 ; i < N; i ++) scanf("%d", &A[i]);
printf("%d\n", Solution().min_cost(A));
return 0;
}
| a.cc: In member function 'int Solution::min_cost(const std::vector<int>&)':
a.cc:22:9: error: 'assert' was not declared in this scope
22 | assert(freq.rbegin()->first > 0);
| ^~~~~~
a.cc:5:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
4 | #include <map>
+++ |+#include <cassert>
5 |
|
s201507358 | p03946 | C++ | /*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#include <functional>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define co(x) cout << x << '\n'
#define dbg(x) cerr << #x << " = " << x << '\n'
#define bitcount(x) (int)__builtin_popcount(x)
#define sz(x) (int)x.size()
#define all(a) a.begin(),a.end()
#define ff first
#define ss second
#define pii pair<int,int>
#define lcm(a,b) (a*b)/__gcd(a,b)
using namespace std;
inline void solve(){
map <int,int> cnt;
int n,t; cin>>n>>t;
int mn = INT_MAX, x, mx = 0 ;
for (int i=0;i<n;i++){
cin >> x ;
mn = min(mn,x);
cnt[x-mn]++;
mx = max(mx,x-mn);
}
if (mx == 0){
cout << 0 << endl;
return ;
}
cout << max(0LL,min(t/2LL,cnt[mx])) << endl ;
}
signed main()
{
int n=1; // cin>>n;
while (n--) solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:37:15: error: 'INT_MAX' was not declared in this scope
37 | int mn = INT_MAX, x, mx = 0 ;
| ^~~~~~~
a.cc:18:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
17 | #include <functional>
+++ |+#include <climits>
18 | #define mod 998244353
a.cc:39:16: error: 'x' was not declared in this scope
39 | cin >> x ;
| ^
a.cc:42:9: error: 'mx' was not declared in this scope; did you mean 'mn'?
42 | mx = max(mx,x-mn);
| ^~
| mn
a.cc:44:9: error: 'mx' was not declared in this scope; did you mean 'mn'?
44 | if (mx == 0){
| ^~
| mn
a.cc:48:35: error: 'mx' was not declared in this scope; did you mean 'mn'?
48 | cout << max(0LL,min(t/2LL,cnt[mx])) << endl ;
| ^~
| mn
|
s056606204 | p03946 | C++ | #pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
const int MAX_N = 100000;
int N, T;
int A[MAX_N];
map<int, int, greater<int>> mp;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N >> T;
int minc = INT_MAX;
for (int i = 0; i < N; i++) {
cin >> A[i];
minc = min(minc, A[i]);
int bft = A[i] - minc;
if (mp.count(bft)) {
mp[bft]++;
} else {
mp.insert(make_pair(bft, 1));
}
}
cout << mp.begin()->second << "\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:25:16: error: 'INT_MAX' was not declared in this scope
25 | int minc = INT_MAX;
| ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
8 | #include <queue>
+++ |+#include <climits>
9 |
|
s555437434 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX],mx[MAX];
int main()
{
FastRead
//freopen("output.txt", "w", stdout);
ll n,MX=0,t;
cin>>n>>t;
for(int i=0; i<n; i++)
cin>>arr[i];
mx[n-1]=arr[n-1];
for(int i=n-2; i>=0; i--)
mx[i]=max(mx[i+1],arr[i]);
map<ll,int>mp;
for(int i=0; i<n-1; i++)
{
if(arr[i]>=mx[i+1])
continue;
ll prof=mx[i+1]-arr[i];
prof*=(t/2);
mp[prof]++;
MX=max(MX,prof);
}
cout<<max(mp[MX],1ll)<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:14: error: no matching function for call to 'max(std::map<long long int, int>::mapped_type&, long long int)'
37 | cout<<max(mp[MX],1ll)<<endl;
| ~~~^~~~~~~~~~~~
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:37:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
37 | cout<<max(mp[MX],1ll)<<endl;
| ~~~^~~~~~~~~~~~
/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:37:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
37 | cout<<max(mp[MX],1ll)<<endl;
| ~~~^~~~~~~~~~~~
|
s661200896 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std ;
int n,t,sum,maxn,maxn1,ans,a[100001];
int main()
{
cin>>n>>t;
for(int i=1;i<=n;i++) cin>>a[i];
for(int i=n;i;i--)
{
maxn=max(a[i],maxn);
sum=max(maxn-a[i],sum);
}。
for(int i=n;i;i--)
{
maxn1=max(a[i],maxn1);
if(maxn1-a[i]==sum) ans++;
}
cout<<ans<<endl;
return 0;
} | a.cc:12:6: error: extended character 。 is not valid in an identifier
12 | }。
| ^
a.cc: In function 'int main()':
a.cc:12:6: error: '\U00003002' was not declared in this scope
12 | }。
| ^~
a.cc:13:17: error: 'i' was not declared in this scope
13 | for(int i=n;i;i--)
| ^
|
s770317828 | p03946 | C++ | あ | a.cc:1:1: error: '\U00003042' does not name a type
1 | あ
| ^~
|
s885876539 | p03946 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
ll n,t;cin>>n>>t;
vl a(n);
rep(i,n)cin>>a[i];
ll MIN=INF;
ll MAX=0;
vector<P>vec(n);
vl diff(n);
rep(i,n){
MIN=min(MIN,a[i]);
MAX=max(MAX,a[i]);
diff[i]=MAX-MIN;
vec[i]=MIN;
}
ll MINd=INF;
rep(i,n)MINd=min(MINd,diff[i]);
set<ll>S;
rep(i,n){
if(MINd==diff[i])S.insert(vec[i]);
}
cout<<S.size()<<endl;
} | a.cc: In function 'int main()':
a.cc:27:12: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} and 'll' {aka 'long long int'})
27 | vec[i]=MIN;
| ^~~
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,
from a.cc:2:
/usr/include/c++/14/bits/stl_pair.h:946:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, const _U1&>, std::is_assignable<_T2&, const _U2&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(const std::pair<_U1, _U2>&) [with _U2 = _U1; _T1 = long long int; _T2 = long long int]'
946 | operator=(const pair<_U1, _U2>& __p)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:946:9: note: template argument deduction/substitution failed:
a.cc:27:12: note: mismatched types 'const std::pair<_T1, _T2>' and 'll' {aka 'long long int'}
27 | vec[i]=MIN;
| ^~~
/usr/include/c++/14/bits/stl_pair.h:957:9: note: candidate: 'template<class _U1, class _U2> typename std::enable_if<std::__and_<std::is_assignable<_T1&, _U1&&>, std::is_assignable<_T2&, _U2&&> >::value, std::pair<_T1, _T2>&>::type std::pair<_T1, _T2>::operator=(std::pair<_U1, _U2>&&) [with _U2 = _U1; _T1 = long long int; _T2 = long long int]'
957 | operator=(pair<_U1, _U2>&& __p)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:957:9: note: template argument deduction/substitution failed:
a.cc:27:12: note: mismatched types 'std::pair<_T1, _T2>' and 'll' {aka 'long long int'}
27 | vec[i]=MIN;
| ^~~
/usr/include/c++/14/bits/stl_pair.h:921:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&>) [with _T1 = long long int; _T2 = long long int; std::__conditional_t<((bool)std::__and_<std::is_copy_assignable<_T1>, std::is_copy_assignable<_T2> >::value), const std::pair<_T1, _T2>&, const std::__nonesuch&> = const std::pair<long long int, long long int>&]'
921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:923:65: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::__conditional_t<true, const std::pair<long long int, long long int>&, const std::__nonesuch&>' {aka 'const std::pair<long long int, long long int>&'}
921 | operator=(__conditional_t<__and_<is_copy_assignable<_T1>,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
922 | is_copy_assignable<_T2>>::value,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
923 | const pair&, const __nonesuch&> __p)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_pair.h:931:7: note: candidate: 'std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&>) [with _T1 = long long int; _T2 = long long int; std::__conditional_t<((bool)std::__and_<std::is_move_assignable<_Tp>, std::is_move_assignable<_T2> >::value), std::pair<_T1, _T2>&&, std::__nonesuch&&> = std::pair<long long int, long long int>&&]'
931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:933:55: note: no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::__conditional_t<true, std::pair<long long int, long long int>&&, std::__nonesuch&&>' {aka 'std::pair<long long int, long long int>&&'}
931 | operator=(__conditional_t<__and_<is_move_assignable<_T1>,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
932 | is_move_assignable<_T2>>::value,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
933 | pair&&, __nonesuch&&> __p)
| ~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:33:30: error: no matching function for call to 'std::set<long long int>::insert(__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type&)'
33 | if(MINd==diff[i])S.insert(vec[i]);
| ~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/set:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158:
/usr/include/c++/14/bits/stl_set.h:568:9: note: candidate: 'template<class _InputIterator> void std::set<_Key, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>]'
568 | insert(_InputIterator __first, _InputIterator __last)
| ^~~~~~
/usr/include/c++/14/bits/stl_set.h:568:9: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:511:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<long long int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::rebind<long long int>; typename _Alloc::value_type = long long int; value_type = long long int]'
511 | insert(const value_type& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_set.h:511:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'const std::set<long long int>::value_type&' {aka 'const long long int&'}
511 | insert(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:520:7: note: candidate: 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(value_type&&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<long long int>; typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> = __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::rebind<long long int>; typename _Alloc::value_type = long long int; value_type = long long int]'
520 | insert(value_type&& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_set.h:520:27: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<long long int, long long int> >, std::pair<long long int, long long int> >::value_type' {aka 'std::pair<long long int, long long int>'} to 'std::set<long long int>::value_type&&' {aka 'long long int&&'}
520 | insert(value_type&& __x)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_set.h:548:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, const value_type&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; value_type = long long int]'
548 | insert(const_iterator __position, const value_type& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_set.h:548:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:553:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::insert(const_iterator, value_type&&) [with _Key = long long int; _Compare = std::less<long long int>; _Alloc = std::allocator<long long int>; iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; const_iterator = std::_Rb_tree<long long int, long long int, std::_Identity<long long int>, std::less<long long int>, std::allocator<long long int> >::const_iterator; value_type = long long int]'
553 | insert(const_iterator __position, value_type&& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_set.h:553:7: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_set.h:580:7: note: candidate: 'void std::set<_Ke |
s177019516 | p03946 | C++ | //#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
ll n,t;cin>>n>>t;
vl a(n);
rep(i,n)cin>>a[i];
ll MIN=INF;
ll MAX=0;
vector<P>vec(n);
vl diff(n);
rep(i,n){
MIN=min(MIN,a[i]);
MAX=max(MAX,a[i]);
diff[i]=MAX-MIN;
}
ll MINd=INF;
rep(i,n)MINd=min(MINd,diff[i]);
set<ll>S;
rep(i,n){
if(MINd==diff[i])S.insert(MIN[i]);
}
cout<<S.size()<<endl;
} | a.cc: In function 'int main()':
a.cc:32:34: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
32 | if(MINd==diff[i])S.insert(MIN[i]);
| ^
|
s231541768 | p03946 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define DEBUG 1
#define ll long long
#define REP(i, n) for (long long i = 0; i < (n); i++)
//10 100
//7 10 4 5 9 3 6 8 2 1
//高橋くんは、 4-9 か 3-8を行う
//どちらかわからないので、青木くんは9と8のコストを下げる
//右から見ていって、最大の差を求めればよい
//最大の差を求めた後は、
int main(){
int N,T;
cin >> N >> T;
vector <int> a(N);
REP(i,N)cin >> a[i];
vector <vector<pair<int,int>>> sa(N);
//(左から見ていって)現状の最小値
int be_min = MOD;
int sa_max = 0;
for(int i = 0; i < N; ++i)
{
if(be_min < a[i])continue;
be_min = a[i];
for(int j = i + 1; j < N; ++j)
{
if(sa_max > a[j] - a[i])continue;
sa_max = max(sa_max, a[j] - a[i]);
sa[i].push_back({a[j] - a[i], j});
}
}
vector <int> cost(N, 0);
for(int i = 0; i < N; ++i)
{
if(sa[i].size() == 0)continue;
sort(sa[i].rbegin(),sa[i].rend());
for(int j = 0; j < sa[i].size(); ++j)
{
if(sa_max == sa[i][j].first)cost[sa[i][j].second] = 1;
else
{
break;
}
}
}
int res = 0;
for(int i = 0; i < N; ++i)
{
if(cost[i] == 1)++res;
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:38:18: error: 'MOD' was not declared in this scope
38 | int be_min = MOD;
| ^~~
|
s395928789 | p03946 | C++ | #include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int nx[4]={0,1,-1,0};
int ny[4]={1,0,0,-1};
int main(){
ll n,t;
cin>>n>>t;
vll a(n);
rep(i,n) cin>>a[i];
vll b(n);
ll k=0;
for(int i=n-1;i>=0:i--){
k=max(k,a[i]);
b[i]=k-a[i];
}
ll ans=0;
sort(all(b));
ll cu=b[n-1];
for(int i=n-1;i>=0;i--){
if(b[i]!=cu) break;
ans++;
}
COUT(ans);
} | a.cc: In function 'int main()':
a.cc:47:17: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
47 | for(int i=n-1;i>=0:i--){
| ^
a.cc:47:21: error: expected ';' before ':' token
47 | for(int i=n-1;i>=0:i--){
| ^
| ;
a.cc:52:15: error: expected ')' before ';' token
52 | sort(all(b));
| ^
| )
a.cc:47:6: note: to match this '('
47 | for(int i=n-1;i>=0:i--){
| ^
a.cc:56:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
56 | ans++;
| ^~~
| abs
a.cc:58:8: error: 'ans' was not declared in this scope; did you mean 'abs'?
58 | COUT(ans);
| ^~~
a.cc:17:24: note: in definition of macro 'COUT'
17 | #define COUT(x) cout<<(x)<<endl
| ^
|
s134970308 | p03946 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next());
int[] b = new int[n]; Arrays.fill(b, 0);
int[] c = new int[n]; Arrays.fill(c, 0);
//PriorityQueue<Integer> alr = new PriorityQueue<Integer>();
try {
boolean[] bool = new boolean[1000000001]; Arrays.fill(bool, false);
} catch (Exception e) {
System.out.println(-1);
}
int count = 0; int max = 0; int dis = 0; int ans = 0;
for (int i = n-1; i >= 0; i--) {
if(max < a[i]) {
count = 1;
max = a[i];
}else if(max == a[i]){
count++;
}else {
b[i] = max;
c[i] = count;
dis = Math.max(max-a[i], dis);
}
}
for (int i = 0; i < n; i++) {
/*if(alr.isEmpty()) {
if(b[i]-a[i] == dis) {
alr.add(b[i]);
ans += c[i];
}
}else {
if((b[i]-a[i]==dis)&&!(alr.contains(b[i]))) {
alr.add(b[i]);
ans += c[i];
}
}*/
if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
bool[b[i]] = true;
ans += c[i];
}
}
System.out.println(ans);
sc.close();
}
} | Main.java:48: error: cannot find symbol
if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
^
symbol: variable bool
location: class Main
Main.java:49: error: cannot find symbol
bool[b[i]] = true;
^
symbol: variable bool
location: class Main
2 errors
|
s715923003 | p03946 | Java | import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int t = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) a[i] = Integer.parseInt(sc.next());
int[] b = new int[n]; Arrays.fill(b, 0);
int[] c = new int[n]; Arrays.fill(c, 0);
PriorityQueue<Integer> alr = new PriorityQueue<Integer>();
boolean[] bool = new boolean[1000000000]; Arrays.fill(bool, false);
int count = 0; int max = 0; int dis = 0; int ans = 0;
for (int i = n-1; i >= 0; i--) {
if(max < a[i]) {
count = 1;
max = a[i];
}else if(max == a[i]){
count++;
}else {
b[i] = max;
c[i] = count;
dis = Math.max(max-a[i], dis);
}
}
for (int i = 0; i < n; i++) {
/*if(alr.isEmpty()) {
if(b[i]-a[i] == dis) {
alr.add(b[i]);
ans += c[i];
}
}else {
if((b[i]-a[i]==dis)&&!(alr.contains(b[i]))) {
alr.add(b[i]);
ans += c[i];
}
}*/
if((b[i]-a[i]==dis)&&!(bool[b[i]])) {
bool[b[i]] = true;
ans += c[i];
}
}
System.out.println(ans);
sc.close();
} | Main.java:49: error: reached end of file while parsing
}
^
1 error
|
s772089009 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#define N 100005
using namespace std;
int n, t;
int a[N];
int main() {
cin>>n>>t;
for (int i = 0; i < n; ++i) {
cin>>a[i];
}
int minv = INT_MAX;
int maxv = 0;
for (int i = 0; i < n; ++i) {
if (i == 0) {
minv = min(minv, a[i]);
} else {
maxv = max(maxv, a[i] - minv);
minv = min(minv, a[i]);
}
}
int tot=0;
minv = INT_MAX;
for (int i = 0; i < n; ++i) {
if (i == 0) minv = min(minv, a[i]);
else {
if (a[i] - minv == maxv) {
tot++;
}
minv = min(minv, a[i]);
}
}
cout<<tot<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:14: error: 'INT_MAX' was not declared in this scope
14 | int minv = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <set>
+++ |+#include <climits>
5 | #define N 100005
|
s089468004 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(void){
int n,t,max=0,c=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2;i>=0;i--){
sort(b+i+1,b+i+2+c);
c++;
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
cout<<mc;
} | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s707548678 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,c=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2;i>=0;i--){
sort(b+i+1,b+i+2+c);
c++;
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
cout<<mc;
}
| a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s820993972 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
cout<<mc;
}
| a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s510379950 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
long int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
cout<<mc;
}
| a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s104016134 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
if(t<mc){
cout<<t;
}
else{
cout<<mc;
}
} | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s983780163 | p03946 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
int main(void){
int n,t,max=0,mc=1;
short short int a[100010],b[100010];
cin>>n>>t;
for(int i=0;i<n;i++){
cin>>a[i];
b[i]=a[i];
}
for(int i=n-2,c=0;i>=0;i--,c++){
sort(b+i+1,b+i+2+c);
if(max==b[n-1]-a[i]){
mc++;
}
if(max<b[n-1]-a[i]){
max=b[n-1]-a[i];
mc=1;
}
}
cout<<mc;
} | a.cc: In function 'int main()':
a.cc:6:11: error: duplicate 'short'
6 | short short int a[100010],b[100010];
| ^~~~~
| -----
|
s898932045 | p03946 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const ll INFLL = 1001001001001001001; // > 10^18
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
int main () {
int n,t; cin >>n>>t;
vector<int> a(n); rep(i,n) cin >> a[i];
vector<ll> profit(n);
ll mn = INFLL;
for (ll i = 0; i < n; i++) {
mn = min(mn, a[i]);
profit[i] = a[i] - mn;
}
sort(profit.begin(), profit.end(), greater<ll>());
ll ans = 1;
ll mp = profit[0];
for (ll i = 1; i < n; i++) {
if (profit[i] == mp) {
ans++;
} else {
break;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:33:17: error: no matching function for call to 'min(ll&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
33 | mn = min(mn, a[i]);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:33:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'})
33 | mn = min(mn, a[i]);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:33:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
33 | mn = min(mn, a[i]);
| ~~~^~~~~~~~~~
|
s629422314 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;
int main()
{
int n,t,min=1000000009;
cin>>n>>t;
vector<int> a(n),b(n);
std::map<int, int> mp;
for (int i = 0; i < n; ++i)
{
cin>>a[i];
b[i] = (min>a[i] ? 0:a[i]-min);
min=std::min(min,a[i]);
mp[b[i]]++;
}
sort(b.begin(), b.end());
cout<<mp[b.back();
} | a.cc: In function 'int main()':
a.cc:19:20: error: expected ']' before ';' token
19 | cout<<mp[b.back();
| ^
| ]
|
s564550193 | p03946 | C++ | N, T = map(int,input().split())
A = list(map(int,input().split()))
p = 0
ans = 1
for i in range(1, N):
if p == A[i] - A[i-1]:
ans += 1
elif p < A[i] - A[i-1]:
p = A[i] - A[i-1]
ans = 1
print(ans)
| a.cc:1:1: error: 'N' does not name a type
1 | N, T = map(int,input().split())
| ^
|
s537329939 | p03946 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n;
long long t;
long long a[n];
cin>>n>>t;
long long m[n],M[n];
REP(i,n){
cin>>a[i];
}
m[0]=a[0];
M[n-1]=0;
REP(i,n){
if(i>0){
if(a[i]<m[i-1]){
m[i]=a[i];
}
}
}
for(int i=n-1;i>=1;i--){
if(a[i]>M[i]){
M[i-1]=a[i];
}
}
long long dM=0;
REP(i,n){
dM = max(dM,M[i]-m[i]);
}
REP(i,n){
return 0;
}
| a.cc: In function 'int main()':
a.cc:117:2: error: expected '}' at end of input
117 | }
| ^
a.cc:86:11: note: to match this '{'
86 | int main(){
| ^
|
s293579122 | p03946 | C++ | #include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
long long inf=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
long long c=a%i_7;
if(c>=0)return c;
return c+i_7;
}
using namespace std;
bool prime(int n){
if(n==1){
return false;
}else if(n==2){
return true;
}else{
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
return false;
}
}
return true;
}
}
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
if(a%b==0){
return b;
}else{
return gcd(b,a%b);
}
}
long long lcm(long long x, long long y){
return (x/gcd(x,y))*y;
}
class UnionFind {
public:
//各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
vector<int> Parent;
//クラスを作るときは、Parentの値を全て-1にする。
//以下のようにすると全てバラバラの頂点として解釈できる。
UnionFind(int N) {
Parent = vector<int>(N, -1);
}
//Aがどのグループに属しているか調べる
int root(int A) {
if (Parent[A] < 0) return A;
return Parent[A] = root(Parent[A]);
}
//自分のいるグループの頂点数を調べる
int size(int A) {
return -Parent[root(A)];//先祖をrootで取っておきたい。
}
//AとBをくっ付ける
bool connect(int A, int B) {
//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
A = root(A);
B = root(B);
if (A == B) {
//すでにくっついてるからくっ付けない
return false;
}
//大きい方(A)に小さいほう(B)をくっ付けたい
//大小が逆だったらAとBをひっくり返す。
if (size(A) < size(B)) swap(A, B);
//Aのサイズを更新する
Parent[A] += Parent[B];
//Bの親をAに変更する
Parent[B] = A;
return true;
}
};
int main(){
int n;
long long t;
long long a[n];
cin>>n>>t;
long long Maximum=0;
long long m[n],M[n];
REP(i,n){
cin>>a[i];
if(i>0){
Maximum=max(Maximum,a[i]);
}
}
m[0]=a[0];
M[0]=Maximum;
M[n-1]=0;
REP(i,n){
if(i>0){
if(a[i]<m[i-1]){
m[i]=a[i];
}
}
}
for(int i=n-1;i>=1;i--){
if(a[i]>M[i]){
M[i-1]=a[i];
}
}
long long dM=0;
REP(i,n){
dM = max(dM,M[i]-m[i]);
}
REP(i,n){
return 0;
}
| a.cc: In function 'int main()':
a.cc:122:2: error: expected '}' at end of input
122 | }
| ^
a.cc:86:11: note: to match this '{'
86 | int main(){
| ^
|
s237252327 | p03946 | C++ | #include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long;
void Print(vector<ll> nums)
{
for (int i = 0; i < nums.size(); i++)
{
cout << nums[i] << " ";
}
cout << endl;
}
int main()
{
int n, t;
cin >> n >> t;
vector<ll> prices(n);
for (int i = 0; i < n; i++)
{
cin >> prices[i];
}
unordered_map<int, int> profits; // profit, cnt;
ll min = pow(10, 10);
ll min_index = 0;
ll current_profit = 0;
ll max_profit = -1LL * pow(10, 10);
ll last_max_profit_bottom_index = -1;
ll cnt = 0;
for (ll i = 0; i < n; i++)
{
ll price = prices[i];
if (min > price)
{
min = price;
min_index = i;
}
current_profit = price - min;
if (max_profit <= current_profit && ((i == n - 1) || prices[i + 1] <= prices[i]))
{
if (max_profit < current_profit)
{
cnt = 0;
}
max_profit = current_profit;
if (last_max_profit_bottom_index != min_index)
{
cnt++;
}
last_max_profit_bottom_index = min_index;
}
// Print({min, min_index, cnt, price, current_profit, max_profit, last_max_profit_bottom_index});
}
cout << cnt << endl;
} | a.cc: In function 'int main()':
a.cc:32:18: error: 'pow' was not declared in this scope
32 | ll min = pow(10, 10);
| ^~~
|
s782695446 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n,t,res=0;
vector <int> v;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> t;
v.push_back(t);
}
int lo = v[0],hi=v[0];
for(int i=1;i<n;i++)
{
if(v[i]<hi)
{
res++;
lo = v[i];
hi = v[i];
}
else
{
hi = v[i];
}
}
if(lo!=hi) res++;
cout << res << endl;
return 0;
}
| a.cc:3:21: error: extended character is not valid in an identifier
3 | using namespace std;
| ^
a.cc:3:21: error: '\U000000a0' does not name a type
3 | using namespace std;
| ^
|
s645912160 | p03946 | C++ | #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<hi) { res++; lo = v[i]; hi = v[i]; } else { hi = v[i]; } } if(lo!=hi) res++; cout << res << endl; return 0; }
| a.cc:1:26: warning: extra tokens at end of #include directive
1 | #include <bits/stdc++.h> using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n,t,res=0; vector <int> v; cin >> n; for(int i=0;i<n;i++) { cin >> t; v.push_back(t); } int lo = v[0],hi=v[0]; for(int i=1;i<n;i++) { if(v[i]<hi) { res++; lo = v[i]; hi = v[i]; } else { hi = v[i]; } } if(lo!=hi) res++; cout << res << endl; return 0; }
| ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s884984080 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int n,t,res=0;
vector <int> v;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> t;
v.push_back(t);
}
in lo = v[0],hi=v[0];
for(int i=1;i<n;i++)
{
if(v[i]<hi)
{
res++;
lo = v[i];
hi = v[i];
}
else
{
hi = v[i];
}
}
if(lo!=hi) res++;
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:20:5: error: 'in' was not declared in this scope; did you mean 'n'?
20 | in lo = v[0],hi=v[0];
| ^~
| n
a.cc:23:18: error: 'hi' was not declared in this scope; did you mean 'i'?
23 | if(v[i]<hi)
| ^~
| i
a.cc:26:15: error: 'lo' was not declared in this scope; did you mean 'log'?
26 | lo = v[i];
| ^~
| log
a.cc:35:6: error: 'lo' was not declared in this scope; did you mean 'log'?
35 | if(lo!=hi) res++;
| ^~
| log
a.cc:35:10: error: 'hi' was not declared in this scope
35 | if(lo!=hi) res++;
| ^~
|
s796833660 | p03946 | C++ | #pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;
int deco[1000];
void Sequence() {
int n,t;
cin >> n >> t;
ll row = INF;
ll rem = 0;
int rc = 0;
for (size_t i = 0; i < n; i++)
{
ll a;
cin >> a;
if (row > a) {
rc = 1;
}else if (row == a) {
rc++;
}
row = min(a, row);
if (i == 0) continue;
if (rem < a - row) {
rem = a - row;
}
}
cout << << endl;
}
int main() {
Sequence();
return 0;
}
| a.cc:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
a.cc: In function 'void Sequence()':
a.cc:49:18: error: expected primary-expression before '<<' token
49 | cout << << endl;
| ^~
|
s085529532 | p03946 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include<bits/stdc++.h>
#include <utility>
#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
ll N,T;
cin >> N >> T;
ll A[100010];
for(int i=1;i<=N;i++){
cin >> A[i];
}
ll ans=0;
ll min_v=A[1];
ll cost=0;
for(int i=2;i<=N;i++){
if(cost<A[i]-min_v){
cost=A[i]-min_v;
ans=1;
}else if(cost==max_v-min_v){
ans++;
}
min_v=min(min_v,A[i]);
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:50:20: error: 'max_v' was not declared in this scope
50 | }else if(cost==max_v-min_v){
| ^~~~~
|
s039901909 | p03946 | C++ | include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,p,q=0,ans=0;
bool x[1000000001]={0};
scanf("%d %d",&n,&t);
vector<int> a(n);
for (auto&e:a) scanf("%d",&e);
p=a[0];
for (int i=1;i<n;i++) {
p=min(p,a[i]);
q=max(q,a[i]-p);
}
p=a[0];
for (int i=1;i<n;i++) {
x[a[i]]=1;
if (a[i]-q>=0 && x[a[i]-q]==1) ans++;
if (a[i]+q<=1000000000 && x[a[i]+q]==1) ans++;
}
printf("%d\n",ans);
return 0;
}
| a.cc:1:1: error: 'include' does not name a type
1 | include<bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'scanf' was not declared in this scope
8 | scanf("%d %d",&n,&t);
| ^~~~~
a.cc:9:5: error: 'vector' was not declared in this scope
9 | vector<int> a(n);
| ^~~~~~
a.cc:9:12: error: expected primary-expression before 'int'
9 | vector<int> a(n);
| ^~~
a.cc:10:17: error: 'a' was not declared in this scope
10 | for (auto&e:a) scanf("%d",&e);
| ^
a.cc:11:7: error: 'a' was not declared in this scope
11 | p=a[0];
| ^
a.cc:13:11: error: 'min' was not declared in this scope; did you mean 'main'?
13 | p=min(p,a[i]);
| ^~~
| main
a.cc:14:11: error: 'max' was not declared in this scope
14 | q=max(q,a[i]-p);
| ^~~
a.cc:22:5: error: 'printf' was not declared in this scope
22 | printf("%d\n",ans);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | include<bits/stdc++.h>
|
s757763813 | p03946 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void)
{
int n, t;
cin >> n >> t;
vector<int> a(n);
vector<int> b(n);
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
{
int max = 0;
for (int j = i+1; j < n; j++)
{
if(a[j]-a[i] > max )
{
max = a[j] - a[i];
}
}
b[i] = max;
}
sort(b.begin(), b.end());
int s_max = b[n-1];
int counter = 1;
for (int i = n-2; i >= 0; i--)
{
if(s_max == b[i])
counter++;
else
break;
}
cout << counter << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:9: error: 'sort' was not declared in this scope; did you mean 'short'?
30 | sort(b.begin(), b.end());
| ^~~~
| short
|
s488285251 | p03946 | C++ |
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>
#define rep(i,b) for(int i=0;i<b;i++)
#define rrep(i,a,b) for(int i=a;i<=b;i++)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
//差が最大になる区間を全て1減らすと、maxをとった結果が1下がる。
//前処理で区間ごとの最大値(最小値)を配列にいれる(公式解説)
//i<jにしか興味がないので、逐次更新する。解説ブログ等
int main() {
//入力
int n, t;
cin >> n >> t;
vector<int> a(n);
for (auto& e : a) {
cin >> e;
}
//ループ前の変数の初期化
int max_diff = 0;
int min_cost = INT_MAX;
int cnt = 0;
//最小値の右しか関係ない。
//その時々の最小値との差だけ考えればいい。
//差が更新されたら、それ以前のカウントは意味がなくなるので
//1からやりなおせばいい。
//りんごの数は無制限なので、Tは実は使わくてもよい。
for (int i = 0; i < n; ++i) {
min_cost = min(min_cost, a[i]);
int diff = a[i] - min_cost;
if (max_diff < diff) {
cnt = 1;
max_diff = diff;
}
else if (diff == max_diff) {
++cnt;
}
}
cout << cnt << "\n";
}
| a.cc: In function 'int main()':
a.cc:41:24: error: 'INT_MAX' was not declared in this scope
41 | int min_cost = INT_MAX;
| ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include <iomanip>
+++ |+#include <climits>
16 |
|
s656470087 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;
int main()
{
int N, T;
cin >> N >> T;
vector< int64 > a(N);
for (int i = 0; i < N; ++i) cin >> a[i];
map< int64, int64 > mp;
int l = a[0];
for (int i = 0; i < N; ++i) {
if (i == N - 1) {
mp[a[i] - l]++;
} else if (a[i + 1] > a[i]) {
l = min(l, a[i]);
} else {
// debug(a[i]);
// debug(l);
mp[a[i] - l]++;
l = a[i + 1];
}
}
int64 mx = 0, ans = 0;
for (auto m : mp) {
if (m.first > mx) ans = m.second;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:14: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
18 | l = min(l, a[i]);
| ~~~^~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:18:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'})
18 | l = min(l, a[i]);
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:18:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
18 | l = min(l, a[i]);
| ~~~^~~~~~~~~
|
s890941475 | p03946 | C++ | //#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())
using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;
ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }
int
main(void){
ll n, t;
cin >> n >> t;
ll a[n];
ll a_min, a_min_prev;
int count = 0;
REP(i, n){
cin >> a[i];
}
ll diff_m=0LL;
ll temp_m;
a_min_prev = a[0];
FOR(i, 1, n) {
a_min = min(a_min_prev, a[i]);
temp_m = (a[i] - a_min[i-1]);
if(temp_m > diff_m) {
diff_m = temp_m;
count = 1;
}
else if (temp_m == diff_m) {
++count;
}
a_min_prev = a_min;
}
cout << count << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:56:27: error: invalid types 'll {aka long long int}[int]' for array subscript
56 | temp_m = (a[i] - a_min[i-1]);
| ^
|
s144615208 | p03946 | C++ | int main(void) {
int N,T;
scanf("%d %d",&N,&T);
int A,min=10000,ans=0,num=0;
for (int i = 0; i < N; i++) {
cin >> A;
min = std::min(min,A);
if (ans < A-min) {
ans = A - min;
num = 1;
}else if(ans == A-min){
num ++;
}
}
printf("%d\n",num);
}
| a.cc: In function 'int main()':
a.cc:3:3: error: 'scanf' was not declared in this scope
3 | scanf("%d %d",&N,&T);
| ^~~~~
a.cc:9:5: error: 'cin' was not declared in this scope; did you mean 'min'?
9 | cin >> A;
| ^~~
| min
a.cc:10:16: error: 'min' is not a member of 'std'
10 | min = std::min(min,A);
| ^~~
a.cc:18:3: error: 'printf' was not declared in this scope
18 | printf("%d\n",num);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main(void) {
|
s540289043 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, t, a[100010];
cin >> n >> t;
for (int i = 0; i < n; i++) cin >> a[i];
long long p[100010] = {}, mi = 1 << 30;
for (int i = 0; i < n; i++) {
mi = min(mi, a[i]);
p[i] = a[i] - mi;
}
sort(p, p + n);
reverse(p, p + n);
// for (int i = 0; i < n; i++) cerr << p[i] << endl;
int cnt = 0;
for (int i = 0; i < n && p[i] == p[0]; i++, cnt++);
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:17: error: no matching function for call to 'min(long long int&, int&)'
12 | mi = min(mi, a[i]);
| ~~~^~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:12:17: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
12 | mi = min(mi, a[i]);
| ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:12:17: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
12 | mi = min(mi, a[i]);
| ~~~^~~~~~~~~~
|
s241553421 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll ;
long long gcd(long long aaa,long long bbb) {
if(bbb==0) {
return aaa;
}
return gcd(bbb,aaa%bbb);
}
int main (){
ll N,T,M=0,ans=1,cmp=0,tmppp=0;
cin >> N >> T;
ll A[N],tmp,tmpp,mi[N],ma[N];
for(ll i = 0; i < N; i++) {
cin >> A[i];
if(i != 0) {
tmp = min(tmp,A[i]);
mi[i] = tmp;
}else {
tmp = A[i];
m[i] = tmp;
}
}
reverse(A,A+N);
tmp = 0;
for(ll i = 0; i < N; i++) {
tmp = max(tmp,A[i]);
ma[i] = tmp;
}
for(ll i = 0; i < N-1; i++) {
cmp = (ma[N-2-i]*(T/2))-(mi[i]*(T/2));
if (M == cmp) {
ans++;
if(mi[i] == tmppp) {
ans--;
}else {
tmppp = mi[i];
}
} else if (M < cmp) {
M = cmp;
ans = 1;
tmppp = mi[i];
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:13: error: 'm' was not declared in this scope
24 | m[i] = tmp;
| ^
|
s676856622 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
signed main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int N, T;
cin >> N >> T;
int a[N];
rep(i, N) cin >> a[i];
int MAXyen = 0;
int i = 0, j = 0;
while(i < N) {
if (j == N) {
MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
break;
}
if (a[i] <= a[j]) {
j++;
continue;
} else {
MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
i = j;
continue;
}
}
//dump(MAXyen);
i = 0, j = 0;
int ans = 0;
while(i < N) {
if (j == N) {
if (MAXyen == a[j-1] - a[i]) ans++;
break;
}
if (a[i] <= a[j]) {
j++;
continue;
} else {
if (MAXyen == a[j-1] - a[i]) ans++;
i = j;
continue;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:13: error: 'long long long' is too long for GCC
9 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:23:39: note: in expansion of macro 'll'
23 | MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
| ^~
a.cc:9:18: error: 'long long long' is too long for GCC
9 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:23:39: note: in expansion of macro 'll'
23 | MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
| ^~
a.cc:9:13: error: 'long long long' is too long for GCC
9 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:30:39: note: in expansion of macro 'll'
30 | MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
| ^~
a.cc:9:18: error: 'long long long' is too long for GCC
9 | #define int long long int
| ^~~~
a.cc:3:22: note: in expansion of macro 'int'
3 | #define ll long long int
| ^~~
a.cc:30:39: note: in expansion of macro 'll'
30 | MAXyen = max(MAXyen, max((ll)0, a[j-1] - a[i]));
| ^~
|
s523930087 | p03946 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x) cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int
signed main(void)
{
cin.tie(0);
ios::sync_with_stdio(false);
int N, T;
cin >> N >> T;
int a[N];
rep(i, N) cin >> a[i];
int MAXyen = 0;
int i = 0, j = 0;
while(i < N) {
if (j == N) {
MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
break;
}
if (a[i] <= a[j]) {
j++;
continue;
} else {
MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
i = j;
continue;
}
}
//dump(MAXyen);
i = 0, j = 0;
int ans = 0;
while(i < N) {
if (j == N) {
if (MAXyen == a[j-1] - a[i]) ans++;
break;
}
if (a[i] <= a[j]) {
j++;
continue;
} else {
if (MAXyen == a[j-1] - a[i]) ans++;
i = j;
continue;
}
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:23:37: error: no matching function for call to 'max(int, long long int)'
23 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
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:23:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
23 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
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:23:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
23 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
a.cc:30:37: error: no matching function for call to 'max(int, long long int)'
30 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
/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:30:37: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
30 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/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:30:37: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
30 | MAXyen = max(MAXyen, max(0, a[j-1] - a[i]));
| ~~~^~~~~~~~~~~~~~~~~~
|
s749521969 | p03946 | C++ | #include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;
int main(void)
{
int N, T;
cin >> N >> T;
vector<long long> A(N);
for(int i=0; i<N; i++)
cin >> A[i];
long long y = A[0];
vector<long long> b(N);
for(int i=0; i<N; i++)
{
y = min(y, A[i]);
b[i] = A[i] - y;
}
long long maxb = *max_element(b.begin(), b.end());
int ret = count(b.begin(), b.end(), maxb);
cout << ret << endl;
return 0;
}
long long maxb = *max_element(b.begin(), b.end());
int ret = count(b.begin(), b.end(), maxb);
cout << ret << endl;
return 0;
}
| a.cc:33:39: error: 'b' was not declared in this scope
33 | long long maxb = *max_element(b.begin(), b.end());
| ^
a.cc:33:50: error: 'b' was not declared in this scope
33 | long long maxb = *max_element(b.begin(), b.end());
| ^
a.cc:34:25: error: 'b' was not declared in this scope
34 | int ret = count(b.begin(), b.end(), maxb);
| ^
a.cc:34:36: error: 'b' was not declared in this scope
34 | int ret = count(b.begin(), b.end(), maxb);
| ^
a.cc:36:9: error: 'cout' does not name a type
36 | cout << ret << endl;
| ^~~~
a.cc:38:9: error: expected unqualified-id before 'return'
38 | return 0;
| ^~~~~~
a.cc:39:1: error: expected declaration before '}' token
39 | }
| ^
|
s616503803 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, T, tmp, i, dif = 0;
vector<int> difnum(N, 0);
vector<int> Ai;
cin >> N >> T;
for (i = 0; i < N; ++i)
{
cin >> tmp;
Ai.push_back(tmp);
}
for (i = 0; i < N; ++i)
{
for (int j = 0; j < N - i - 1; ++j)
{
if (Ai[j] - Ai[i] > dif)
{
dif = Ai[j] - Ai[i];
difnum[i] = 1;
}
if (Ai[j] - Ai[i] == dif)
if (!difnum[i])
difnum[i]++;
}
}
cout << difnum;
return 0;
} | a.cc: In function 'int main()':
a.cc:28:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
28 | cout << difnum;
| ~~~~ ^~ ~~~~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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 'std::vector<int>' 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)
| ^~~~~~~~
/usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::nullptr_t'
306 | operator<<(nullptr_t)
|
s928390910 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, T, tmp, i, dif = 0, difnum = 0;
vector<int> Ai;
cin >> N >> T;
for (i = 0; i < N; ++i)
{
cin >> tmp;
Ai.push_back(tmp);
}
for (i = 0; i < N; ++i)
{
for (int j = 0; j < N - i - 1; ++j)
{
if (Ai[j] - Ai[i] > dif)
{
dif = Ai[j] - Ai[i];
difnum = 1;
}
if (Ai[j] - Ai[i] == dif)
++difnum:
}
}
cout << difnum;
return 0;
} | a.cc: In function 'int main()':
a.cc:23:41: error: expected ';' before ':' token
23 | ++difnum:
| ^
| ;
|
s408189107 | p03946 | C++ | #include <iostream>
using namespace std;
int a[100000], b[100000], min, max = 0, n, t, c;
int main() {
cin >> n >> t;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
min = a[0];
for (int i = 0; i < n; i++) {
b[i] = a[i] - min;
if (b[i] < 0)min = a[i];
if (b[i] > max)max = b[i];
}
for (int i = 0; i < n; i++) {
if (b[i] == max)c++;
}
cout << c << endl;
} | a.cc: In function 'int main()':
a.cc:12:9: error: reference to 'min' is ambiguous
12 | min = a[0];
| ^~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:27: note: 'int min'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
a.cc:14:31: error: reference to 'min' is ambiguous
14 | b[i] = a[i] - min;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:27: note: 'int min'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
a.cc:15:30: error: reference to 'min' is ambiguous
15 | if (b[i] < 0)min = a[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:27: note: 'int min'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
a.cc:16:28: error: reference to 'max' is ambiguous
16 | if (b[i] > max)max = b[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:32: note: 'int max'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
a.cc:16:32: error: reference to 'max' is ambiguous
16 | if (b[i] > max)max = b[i];
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:32: note: 'int max'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
a.cc:20:29: error: reference to 'max' is ambiguous
20 | if (b[i] == max)c++;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:32: note: 'int max'
5 | int a[100000], b[100000], min, max = 0, n, t, c;
| ^~~
|
s688560796 | p03946 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,t,count=0,max=0;
int a[100000]={};
cin>>n>>t;
for(int i=0;i<n;i++)cin>>a[i];
int min=a[0];
for(int i=1;i<n;i++){
if(a[i]<min)min=a[i];
if(a[i-1]<a[i])
if(a[i]-min>max){
max=a[i]-min;
count=0;
}
else (a[i]-min==max)count++;
}
cout<<count<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:24: error: expected ';' before 'count'
16 | else (a[i]-min==max)count++;
| ^~~~~
| ;
|
s054497718 | p03946 | C++ | #include <iostream>
#include <array>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::max;
using std::max_element;
using std::count;
int main()
{
int N, T, maxProfit = 0;
cin >> N >> T;
vector<int> prices;
vector<int> maxProfits;
for(int i = 0; i < N; i++) {
int price;
cin >> price;
prices.push_back(price);
}
for(int i = 0; i < N - 1; i++) {
vector<int> profits;
// j starts from after i
for(int j = i + 1; j < N; j++) {
int profit = prices[j] - prices[i];
if(maxProfit <= profit) {
profits.push_back(profit);
}
}
if(profits.size() > 0) {
maxProfit = *max_element(profits.begin(), profits.end());
int cnt = count(profits.begin(), profits.end(), maxProfit);
for(int i = 0; i < cnt; i++) {
maxProfits.push_back(maxProfit);
}
}
}
cout << count(maxProfits.begin(), maxProfits.end(), *max_element(maxProfits.begin(), maxProfits.end())) << endl;
}
| a.cc:10:12: error: 'max_element' has not been declared in 'std'
10 | using std::max_element;
| ^~~~~~~~~~~
a.cc:11:12: error: 'count' has not been declared in 'std'
11 | using std::count;
| ^~~~~
a.cc: In function 'int main()':
a.cc:40:20: error: 'max_element' was not declared in this scope
40 | maxProfit = *max_element(profits.begin(), profits.end());
| ^~~~~~~~~~~
a.cc:42:17: error: 'count' was not declared in this scope; did you mean 'cout'?
42 | int cnt = count(profits.begin(), profits.end(), maxProfit);
| ^~~~~
| cout
a.cc:50:56: error: 'max_element' was not declared in this scope
50 | cout << count(maxProfits.begin(), maxProfits.end(), *max_element(maxProfits.begin(), maxProfits.end())) << endl;
| ^~~~~~~~~~~
a.cc:50:11: error: 'count' was not declared in this scope; did you mean 'cout'?
50 | cout << count(maxProfits.begin(), maxProfits.end(), *max_element(maxProfits.begin(), maxProfits.end())) << endl;
| ^~~~~
| cout
|
s339865698 | p03946 | C | #include <stdio.h>
int main(void){
int n,t,a[100000],i,j,max=-114514,ans=0;
scanf("%d %d",&n,&t);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
max=max>a[j]-a[i]?max:a[j]-a[i];
}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(a[j]-a[i]==max){
ans++;
}
}
}
printf("%d\n",ans);
return 0;
} | main.c: In function 'main':
main.c:21:1: error: expected declaration or statement at end of input
21 | }
| ^
|
s183429960 | p03946 | C++ | a | a.cc:1:1: error: 'a' does not name a type
1 | a
| ^
|
s826460334 | p03946 | C++ | #include <stdlib.h>
#include <iostream>
using namespace std;
int main(){
int n;
int t;
cin >> n >> t;
int *a = (int*)malloc(n * sizeof(int));
int *mina = (int*)malloc(n * sizeof(int));
int minv = INT_MAX;
for(int i = 0; i < n; i++){
cin >> a[i];
if(minv > a[i]) minv = a[i];
mina[i] = minv;
}
int this_dif = 0;
int max_dif = 0;
int dif_num = 0;
for(int i = 1; i < n; i++){
this_dif = a[i] - mina[i];
if(this_dif > max_dif){
max_dif = this_dif;
dif_num = 1;
}else if(this_dif == max_dif){
dif_num++;
}
}
cout << min(dif_num, t/2) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:20: error: 'INT_MAX' was not declared in this scope
13 | int minv = INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include <iostream>
+++ |+#include <climits>
3 | using namespace std;
|
s008175932 | p03946 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, T;
cin >> N >> T;
int mini;
cin >> mini;
int maxi=0;
vector<int> A(n);
A[0] = 0;
for (int i=1; i<N; i++) {
cin >> A[i];
if (mini > A[i]) mini = A[i];
A[i] -= mini;
if (maxi < A[i]) maxi = A[i];
}
int ans=0;
for (int i=0; i<N; i++) {
if (maxi == A[i]) ans++;
}
cout << ans << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:17: error: 'n' was not declared in this scope
12 | vector<int> A(n);
| ^
|
s967532667 | p03946 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
using li = long int;
#define MAX_N 10000
int n;
int a[MAX_N] = {0};
int diff[MAX_N] = {0};
int mins[MAX_N] = {0};
int t;
void solve(){
int tmp_min = a[0];
for(int i = 0; i < n - 1; i++){
mins[i] = min(tmp_min, a[i]);
tmp_min = mins[i];
}
diff[0] = 0;
li max_diff = 0;
for(int i = 1; i < n; i++){
diff[i] = a[i] - mins[i - 1];
max_diff = max(max_diff, diff[i]);
}
int count = 0;
for(int i = 1; i < n; i++){
if (diff[i] == max_diff) count++;
}
cout << count << endl;
return ;
}
int main(){
cin >> n >> t;
for(int i = 0; i < n; i++){
cin >> a[i];
}
solve();
return 0;
}
| a.cc: In function 'void solve()':
a.cc:26:23: error: no matching function for call to 'max(li&, int&)'
26 | max_diff = max(max_diff, diff[i]);
| ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:26:23: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
26 | max_diff = max(max_diff, diff[i]);
| ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/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:26:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long int'
26 | max_diff = max(max_diff, diff[i]);
| ~~~^~~~~~~~~~~~~~~~~~~
|
s769259185 | p03946 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdlib>
#define NMAX 100000
#define MMAX 10000
using namespace std;
vector<int > group[NMAX];
int main(){
int N,T,A[NMAX] = {},dif[NMAX] = {},most = 0,first,end = 0,num = 0,gr_num = 0;
cin >> N >> T;
for (int i = 0; i < N; ++i)
{
cin >> A[i];
if(i == 0){
first = A[i];
group[gr_num].push_back(A[i]);
}else if(first < A[i]){
group[gr_num].push_back(A[i]);
if(i == N-1){
sort(group[gr_num].begin(), group[gr_num].end());
dif[gr_num] = group[gr_num][group[gr_num].size()-1]-group[gr_num][0];
most = max(most,dif[gr_num]);
}
}else{
first = A[i];
sort(group[gr_num].begin(), group[gr_num].end());
dif[gr_num] = group[gr_num][group[gr_num].size()-1]-group[gr_num][0];
most = max(most,dif[gr_num]);
gr_num++;
group[gr_num].push_back(A[i]);
}
}
// for (int i = 0; i <= gr_num; ++i)
// {
// for (int j = 0; j < group[i].size(); ++j)
// {
// cout << group[i][j] << " ";
// }
// cout << dif[i];
// cout << "\n";
// }
for (int i = 0; i < N; ++i)
{
if(dif[i] == most){
num += /*dif_num[i]*/1;
// cout << dif_num[i] << "\n";
}
}
// cout << dif_num[N-1] << "\n";
cout << num << "\n";
return 0;
} | a.cc: In function 'int main()':
a.cc:22:33: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(group[gr_num].begin(), group[gr_num].end());
| ^~~~
| short
a.cc:28:25: error: 'sort' was not declared in this scope; did you mean 'short'?
28 | sort(group[gr_num].begin(), group[gr_num].end());
| ^~~~
| short
|
s292971749 | p03946 | C++ | // g++ temp.cpp
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
// 17.4.1.2 Headers
// C
//#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
#define INF INT_MAX/3
#define MAX_N 1000000000
void solve(){
int n,t;
int a[MAX_N+1];
rep(i,MAX_N+1) cin>>a[i];
int s=a[0];
repl(i,1,n){
if(0>a[i]-s){
s=a[i];
} else if(a[i]-s==l){
ans++;
} else if(a[i]-s>l){
l=a[i]-s;
ans=1;
}
}
cout<<ans<<endl;
}
int main(){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:147:23: error: 'l' was not declared in this scope
147 | } else if(a[i]-s==l){
| ^
a.cc:148:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
148 | ans++;
| ^~~
| abs
a.cc:151:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
151 | ans=1;
| ^~~
| abs
a.cc:154:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
154 | cout<<ans<<endl;
| ^~~
| abs
|
s347471146 | p03946 | C++ | //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>
using namespace std;
#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()
int main(){
int n,t;
cin >> n >> t;
vector<int> a(n), diff;
rep(i,n){
cin >> a[i];
}
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
int val = a[j] - a[i]
if(val >0) diff.push_back(a[j]-a[i]);
}
}
int counter = 1;
sort(ALL(diff), std::greater<int>());
int max = diff[0];
REP(i,1,diff.size()){
if(max == diff[i]) counter++;
else break;
}
if(t >= 2*counter) cout << counter << endl;
else cout << min(t, counter) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:25: error: expected ',' or ';' before 'if'
37 | if(val >0) diff.push_back(a[j]-a[i]);
| ^~
|
s885612449 | p03946 | C++ | //
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<complex>
using namespace std;
#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()
int main(){
int n,t;
cin >> n >> t;
vector<int> a(n), diff;
rep(i,n){
cin >> a[i];
}
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
int val = a[j] - a[i]
if(val) diff.push_back(a[j]-a[i]);
}
}
int counter = 1;
sort(ALL(diff), std::greater<int>());
int max = diff[0];
REP(i,1,diff.size()){
if(max == diff[i]) counter++;
else break;
}
if(t >= 2*counter) cout << counter << endl;
else cout << min(t, counter) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:25: error: expected ',' or ';' before 'if'
37 | if(val) diff.push_back(a[j]-a[i]);
| ^~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.