submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s789097783
p03658
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main(){ int N,K; cin >> N >> K; int stick[N]; rep(i,N){ cin >> stick[i]; } sort(stick.begin(),stick.end()); reverse(stick.begin(),stick.end()); int ans=0; rep(i,K){ ans += stick[i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:14: error: request for member 'begin' in 'stick', which is of non-class type 'int [N]' 12 | sort(stick.begin(),stick.end()); | ^~~~~ a.cc:12:28: error: request for member 'end' in 'stick', which is of non-class type 'int [N]' 12 | sort(stick.begin(),stick.end()); | ^~~ a.cc:13:17: error: request for member 'begin' in 'stick', which is of non-class type 'int [N]' 13 | reverse(stick.begin(),stick.end()); | ^~~~~ a.cc:13:31: error: request for member 'end' in 'stick', which is of non-class type 'int [N]' 13 | reverse(stick.begin(),stick.end()); | ^~~
s219688969
p03658
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);++i) using namespace std; int main(){ int N,K; cin >> N >> K; int stick[N]; rep(i,N){ cin >> stick[i]; } sort(stick.begin(),stick.end()); reverse(stick.begin(),stick.end()); int ans=0; rep(i,K){ ans += stick[i]; } cout << ans << endl; }
a.cc:3:3: error: expected unqualified-id before 'for' 3 | for(int i=0;i<(int)(n);++i) | ^~~ a.cc:3:15: error: 'i' does not name a type 3 | for(int i=0;i<(int)(n);++i) | ^ a.cc:3:26: error: expected unqualified-id before '++' token 3 | for(int i=0;i<(int)(n);++i) | ^~ a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> N >> K; | ^~~ | 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:11:18: error: 'i' was not declared in this scope 11 | cin >> stick[i]; | ^ a.cc:13:14: error: request for member 'begin' in 'stick', which is of non-class type 'int [N]' 13 | sort(stick.begin(),stick.end()); | ^~~~~ a.cc:13:28: error: request for member 'end' in 'stick', which is of non-class type 'int [N]' 13 | sort(stick.begin(),stick.end()); | ^~~ a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 13 | sort(stick.begin(),stick.end()); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ a.cc:14:17: error: request for member 'begin' in 'stick', which is of non-class type 'int [N]' 14 | reverse(stick.begin(),stick.end()); | ^~~~~ a.cc:14:31: error: request for member 'end' in 'stick', which is of non-class type 'int [N]' 14 | reverse(stick.begin(),stick.end()); | ^~~ a.cc:14:3: error: 'reverse' was not declared in this scope; did you mean 'std::reverse'? 14 | reverse(stick.begin(),stick.end()); | ^~~~~~~ | std::reverse /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: 'std::reverse' declared here 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~ a.cc:18:18: error: 'i' was not declared in this scope 18 | ans += stick[i]; | ^ a.cc:20:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 20 | 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:20:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 20 | 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) | ^~~~
s399507693
p03658
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(int)(n);++i) using namespace std; int main(){ int N,K; cin >> N >> K; int stick[N]; rep(i,N){ cin >> stick[i]; } sort(stick.rbegin(),stick.rend()); int ans=0; rep(i,K){ ans += stick[i]; } cout << ans << endl; }
a.cc:3:3: error: expected unqualified-id before 'for' 3 | for(int i=0;i<(int)(n);++i) | ^~~ a.cc:3:15: error: 'i' does not name a type 3 | for(int i=0;i<(int)(n);++i) | ^ a.cc:3:26: error: expected unqualified-id before '++' token 3 | for(int i=0;i<(int)(n);++i) | ^~ a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> N >> K; | ^~~ | 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:11:18: error: 'i' was not declared in this scope 11 | cin >> stick[i]; | ^ a.cc:13:14: error: request for member 'rbegin' in 'stick', which is of non-class type 'int [N]' 13 | sort(stick.rbegin(),stick.rend()); | ^~~~~~ a.cc:13:29: error: request for member 'rend' in 'stick', which is of non-class type 'int [N]' 13 | sort(stick.rbegin(),stick.rend()); | ^~~~ a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 13 | sort(stick.rbegin(),stick.rend()); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ a.cc:17:18: error: 'i' was not declared in this scope 17 | ans += stick[i]; | ^ a.cc:19:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 19 | 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:19:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 19 | 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) | ^~~~
s862751309
p03658
C++
#include <bits/stdc++.h> using namespace std; int ketasum(int n){ int sum = 0; while (n > 0){ sum += n % 10; n /= 10; } return sum; } int main(){ int n, k; cin >> n >> k; vector<int> l(n); for (int i = 0; i < n; i++) cin >> l[i]; sort(l.begin(), l.end(), greater); int ans = 0; for (int i = 0; i < k; i++){ ans += i; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:35: error: missing template arguments before ')' token 18 | sort(l.begin(), l.end(), greater); | ^
s683427200
p03658
C++
#include <bits/stdc++.h> using namespace std; int ketasum(int n){ int sum = 0; while (n > 0){ sum += n % 10; n /= 10; } return sum; } int main(){ int n, k; cin >> n >> k; vector<int> l(n); for (int i = 0; i < n; i++) cin >> l[i]; sort(l.begin(), l.end(), greater<int>); int ans = 0; for (int i = 0; i < k; i++){ ans += i; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:40: error: expected primary-expression before ')' token 18 | sort(l.begin(), l.end(), greater<int>); | ^
s924393275
p03658
C++
#include <iostream> using namespace std; int main(){ int N, K; cin >> N >> K; int L[100]; int sum = 0; for (int i = 0; i < N; i++){ cin >> L[i]; } sort(L, L + N, greater<int>()); for (int i = 0; i < K; i++){ sum += L[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(L, L + N, greater<int>()); | ^~~~ | short
s170598352
p03658
C++
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; int INF = 1000000009; int main() { int n,k; cin >>n >> k; vector<int> l(n); rep(i,n){ cin >> l[i]; } sort(l.rbegin(), l.rend()); rep(i,k-1){ l[0] += l[i + 1]; } cout << l[0] << endl; }
a.cc:18:5: error: extended character   is not valid in an identifier 18 | cout << l[0] << endl; | ^ a.cc: In function 'int main()': a.cc:18:5: error: 'cout\U00003000' was not declared in this scope 18 | cout << l[0] << endl; | ^~~~~~
s373610956
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i = 0; i < (n);i++) #define sz(x) int(x.size()) typedef long long ll; typedef pair<int,int> P; constexpr ll mod = 998244353; int main(){ int n, k; cin >> n << k; vector<int> a(n); rep(i,n) cin >> a[i]; sort(a.begin(), a.end(), greater<int>()); cout << accumulate(a.begin(), a.begin() + k, 0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:12: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 11 | cin >> n << k; | ~~~~~~~~ ^~ ~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:11:12: note: candidate: 'operator<<(int, int)' (built-in) 11 | cin >> n << k; | ~~~~~~~~~^~~~ a.cc:11:12: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to '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:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:11:7: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(n)' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte' 11 | cin >> n << k; | ~~~~^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 11 | cin >> n << k; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 11 | cin >> n << k; | ^ /
s652403625
p03658
C++
//#define _GLIBCXX_DEBUG #include<bits/stdc++.h> #define PI 3.14159265359 using namespace std; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) const int INF= 1e9+5; typedef long long ll; typedef vector<ll> vl; typedef vector<vector<ll> >vvl; typedef pair<ll,ll> P; typedef tuple<ll,ll,ll> T; const ll MOD=1000000007LL; string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int main(){ ll n,k;cin>>n>>k; vl a(n); rep(i,n)cin>>a[i]; sort(a.begin(),a.end()); reverse(a.begin(),a,end()); ll ans=0; rep(i,k)ans+=a; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:21:26: error: no matching function for call to 'end()' 21 | reverse(a.begin(),a,end()); | ~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided a.cc:23:14: error: no match for 'operator+=' (operand types are 'll' {aka 'long long int'} and 'vl' {aka 'std::vector<long long int>'}) 23 | rep(i,k)ans+=a; | ~~~^~~
s311406396
p03658
C++
#include <bits/stdc++.h> using namespace std; int main() { int N,K; int L[51]; cin >> N >> K; sort(L.begin(),L.end()); reverse(L.begin(),L.end()); int ans = 0; for (int i =0; i <K; i++) { ans += L[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:10: error: request for member 'begin' in 'L', which is of non-class type 'int [51]' 7 | sort(L.begin(),L.end()); | ^~~~~ a.cc:7:20: error: request for member 'end' in 'L', which is of non-class type 'int [51]' 7 | sort(L.begin(),L.end()); | ^~~ a.cc:8:13: error: request for member 'begin' in 'L', which is of non-class type 'int [51]' 8 | reverse(L.begin(),L.end()); | ^~~~~ a.cc:8:23: error: request for member 'end' in 'L', which is of non-class type 'int [51]' 8 | reverse(L.begin(),L.end()); | ^~~
s630662257
p03658
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) #define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++) #define memi cout << endl #define kono(n) cout << fixed << setprecision(n) #define all(c) (c).begin(), (c).end() #define pb push_back #define hina cout << ' ' #define in(n) cin >> n #define in2(n, m) cin >> n >> m #define in3(n, m, l) cin >> n >> m >> l #define out(n) cout << n const ll mei = (ll)1e9 + 7; int main(){ ll n, k, a; in2(n, k); vector<ll> c(n); rep(i, n) in(c[i]); sort(all(c)); reverse(all(c)); a = 0: rep(i, k) a = a + c[i]; out(a); memi; }
a.cc: In function 'int main()': a.cc:25:8: error: expected ';' before ':' token 25 | a = 0: | ^ | ; a.cc:26:7: error: 'i' was not declared in this scope 26 | rep(i, k) | ^ a.cc:4:33: note: in definition of macro 'rep' 4 | #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) | ^
s064379322
p03658
C++
#include <iostream> using namespace std; #include <bits/stdc++.h> int main() { int N, K, ans; ans = 0; cin >> N >> K; vector<int> rope(60); for(int i = 0; i < N; i++){ cin >> rope.at(i); } sort(rope.begin(),rope.end()); reverse(rope.begin(),rope.end()); for(int i = 0; i < K; i++){ asn += rope.at(i); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:16:5: error: 'asn' was not declared in this scope; did you mean 'ans'? 16 | asn += rope.at(i); | ^~~ | ans
s344803626
p03658
C++
#include <iostream> using namespace std; int main() { int N, K, ans; ans = 0; cin >> N >> K; vector<int> rope(60); for(int i = 0; i < N; i++){ cin >> rope.at(i); } sort(rope.begin(),rope.end()); reverse(rope.begin(),rope.end()); for(int i = 0; i < K; i++){ asn += rope.at(i); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:3: error: 'vector' was not declared in this scope 8 | vector<int> rope(60); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:8:10: error: expected primary-expression before 'int' 8 | vector<int> rope(60); | ^~~ a.cc:10:11: error: 'rope' was not declared in this scope 10 | cin >> rope.at(i); | ^~~~ a.cc:12:7: error: 'rope' was not declared in this scope 12 | sort(rope.begin(),rope.end()); | ^~~~ a.cc:12:2: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(rope.begin(),rope.end()); | ^~~~ | short a.cc:13:3: error: 'reverse' was not declared in this scope 13 | reverse(rope.begin(),rope.end()); | ^~~~~~~ a.cc:15:5: error: 'asn' was not declared in this scope; did you mean 'ans'? 15 | asn += rope.at(i); | ^~~ | ans
s574456980
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; vector<int> l(N); for(int i=0;i<N;i=i+1){ cin >> l.at(i); } sort(l.begin(),l.end()); reverse(l.begin,l.end()); int sum = 0; for(int i=0;i<K;i=i+1){ sum = sum + l.at(i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:12:10: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::vector<int>::iterator)' 12 | reverse(l.begin,l.end()); | ~~~~~~~^~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ^~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' 1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)' 249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last); | ^~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
s139301643
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; vector<int> l(N); for(int i=0;i<N;i=i+1){ cin >> l.at(i); } sort(l,l+N,greater<int>()); int sum = 0; for(int i=0;i<K;i=i+1){ sum = sum + l.at(i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:11:11: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 11 | sort(l,l+N,greater<int>()); | ~^~ | | | | | int | std::vector<int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 11 | sort(l,l+N,greater<int>()); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:11:12: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 11 | sort(l,l+N,greater<int>()); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:11:12: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' 11 | sort(l,l+N,greater<int>()); | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)' 349 | operato
s757647597
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K; int l[55]; int ans = 0; cin >> N >> K; for(int i = 0;i < N;i ++;)cin >>l[i]; sort(l,l + N,greater<int>()); for(int i = 0;i < K;i ++){ ans += l[i]; } cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:10:27: error: expected ')' before ';' token 10 | for(int i = 0;i < N;i ++;)cin >>l[i]; | ~ ^ | ) a.cc:10:28: error: expected primary-expression before ')' token 10 | for(int i = 0;i < N;i ++;)cin >>l[i]; | ^
s697781667
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K; int l[55]; int ans = 0; cin >> N >> K; for(int i = 0;i < N;i ++;)cin >>l[i]; sort(l,l + N,greater<int>()); for(int i = 0;i < K;i ++){ ans = l[i]; } cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:10:27: error: expected ')' before ';' token 10 | for(int i = 0;i < N;i ++;)cin >>l[i]; | ~ ^ | ) a.cc:10:28: error: expected primary-expression before ')' token 10 | for(int i = 0;i < N;i ++;)cin >>l[i]; | ^
s449852319
p03658
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int m = scanner.nextInt(); int n = scanner.nextInt(); // int[] arr = new int[m]; // for (int i = 0; i < m; i++) { // arr[i] = scanner.nextInt(); // } // Arrays.sort(arr); // reverse(arr); // int sum = 0; // for (int i = 0; i < n; i++) { // sum += arr[i]; // } ArrayList arrayList=new ArrayList(); for (int i = 0; i <m; i++) { arrayList.add(scanner.nextInt()); } Collections.sort(arrayList); Collections.reverse(arrayList); int sum=0; for (int i = 0; i <n; i++) { int arr= (int) arrayList.get(i); sum+=arr; } // System.out.println(sum); System.out.println(sum); }
Main.java:32: error: reached end of file while parsing } ^ 1 error
s911925091
p03658
C++
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int n,k,x[100001],s=0; cin>>n>>k; for(int i=1;i<=n;i++) cin>>x[i]; rsort(x+1,x+n+1); for(int i=1;i<=k;i++) s+=x[i]; cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'rsort' was not declared in this scope; did you mean 'qsort'? 10 | rsort(x+1,x+n+1); | ^~~~~ | qsort
s811307236
p03658
C++
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int n,k,x[100001],s=0; cin>>n>>k; for(int i=1;i<=n;i++) cin>>x[i]; rsort(x+1,x+n+1); for(int i=1;i<=k;i++) s+=x[i]; cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'rsort' was not declared in this scope; did you mean 'qsort'? 10 | rsort(x+1,x+n+1); | ^~~~~ | qsort
s524703998
p03658
C++
#include <iostream> #include <stdio.h> #include <vector> using namespace std; #define rep(i, n) for (int i=0; i<(n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) int main() { int n; int k; cin >> n >> k; vector<int> l(n); rep(i, n) cin >> l[i]; sort(l.begin(), l.end()); reverse(l.begin(), l.end()); int a = 0; rep(i, k) a += l[i]; cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(l.begin(), l.end()); | ^~~~ | short a.cc:16:9: error: 'reverse' was not declared in this scope 16 | reverse(l.begin(), l.end()); | ^~~~~~~
s714751971
p03658
C++
#include <iostream> #include <stdio.h> #include <vector> using namespace std; typedef long long = ll; #define rep(i, n) for (int i=0; i<(n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) int main() { int n; int k; cin >> n >> k; vector<int> l(n); rep(i, n) cin >> l[i]; sort(l.begin(), l.end()); reverse(l.begin(), l.end()); int a = 0; rep(i, k) a += l[i]; cout << a << endl; return 0; }
a.cc:5:19: error: expected unqualified-id before '=' token 5 | typedef long long = ll; | ^ a.cc: In function 'int main()': a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(l.begin(), l.end()); | ^~~~ | short a.cc:17:9: error: 'reverse' was not declared in this scope 17 | reverse(l.begin(), l.end()); | ^~~~~~~
s977587015
p03658
C++
#include <iostream> #include <stdio.h> #include <vector> using namespace std; using ll = long long; #define rep(i, n) for (int i=0; i<(n); i++) #define rep2(i, x, n) for (int i = x; i < (n); i++) int main() { int n; int k; cin >> n >> k; vector<int> l(n); rep(i, n) cin >> l[i]; sort(l.begin(), l.end()); reverse(l.begin(), l.end()); int a = 0; rep(i, k) a += l[i]; cout << a << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(l.begin(), l.end()); | ^~~~ | short a.cc:17:9: error: 'reverse' was not declared in this scope 17 | reverse(l.begin(), l.end()); | ^~~~~~~
s887708569
p03658
C++
//shara's here //私は大きな男の子 //SPEEEEEEEEEED IS KEEEEEEEEEEY //REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD #include <bits/stdc++.h> using namespace std; //fold typedef string s; typedef long long ll; typedef long double ld; const ll INF = 1e18 + 10; const ll MINF = -(1e18 + 10); #if defined(BANYANYA) #include "/home/xsharawi/Desktop/cpp/debug.hpp" #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else #define debug(x...) #endif #define pb push_back #define vl vector<ll> #define vll vector<vector<ll> > #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) //endfold int main(){ ll n,k,sum=0; cin>>n>>k; vl v(n); for(ll i=0;i<n;i++)cin>>v[i]; sort(v.begin(),v.end()); for(ll i=n-1;i>=0;i--){ sum+=v[i]; k--; if(k==0)break; } cout<<sum<<endl; return 0;} /* ███████████████████████████████████████████████████ ███████████████████████████████████████████████████ ██████████████████████████████████▀████████████████ ██████████████████████████████████░▀███████████████ ██████████████████████████████▌███░░░▀▀████████████ ██▀████████████████████▐██████░▐██░░░░░░▀▀█████████ ██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███ █▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███ █▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████ ██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████ ███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████ ███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████ ████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████ █████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████ ████████████████████████▄░░░░░░░░░░░░░░░▄░░████████ ██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████ ████████████████████████████████▄░░░░██▄███▀░░▀████ █████████████████████████████▀█████▄███▀▀▀░░▄▄░████ ████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█ ███████████████████████████▌░░░░░░░░░░░███████░░░▄█ ███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██ ███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀ ░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█ ▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███ ▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████ ▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀ */ //shara's here //私は大きな男の子 //SPEEEEEEEEEED IS KEEEEEEEEEEY //REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD #include <bits/stdc++.h> using namespace std; //fold typedef string s; typedef long long ll; typedef long double ld; const ll INF = 1e18 + 10; const ll MINF = -(1e18 + 10); #if defined(BANYANYA) #include "/home/xsharawi/Desktop/cpp/debug.hpp" #define debug(x...) cerr << "[" << #x << "] = ["; _print(x) #else #define debug(x...) #endif #define pb push_back #define vl vector<ll> #define vll vector<vector<ll> > #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) //endfold int main(){ ll n,k,sum=0; cin>>n>>k; vl v(n); for(ll i=0;i<n;i++)cin>>v[i]; sort(v.begin(),v.end()); for(ll i=n-1;i>=0;i--){ sum+=v[i]; k--; if(k==0)break; } cout<<sum<<endl; return 0;} /* ███████████████████████████████████████████████████ ███████████████████████████████████████████████████ ██████████████████████████████████▀████████████████ ██████████████████████████████████░▀███████████████ ██████████████████████████████▌███░░░▀▀████████████ ██▀████████████████████▐██████░▐██░░░░░░▀▀█████████ ██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███ █▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███ █▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████ ██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████ ███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████ ███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████ ████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████ █████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████ ████████████████████████▄░░░░░░░░░░░░░░░▄░░████████ ██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████ ████████████████████████████████▄░░░░██▄███▀░░▀████ █████████████████████████████▀█████▄███▀▀▀░░▄▄░████ ████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█ ███████████████████████████▌░░░░░░░░░░░███████░░░▄█ ███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██ ███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀ ░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█ ▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███ ▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████ ▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀ */
a.cc:119:10: error: redefinition of 'const ll INF' 119 | const ll INF = 1e18 + 10; | ^~~ a.cc:11:10: note: 'const ll INF' previously defined here 11 | const ll INF = 1e18 + 10; | ^~~ a.cc:120:10: error: redefinition of 'const ll MINF' 120 | const ll MINF = -(1e18 + 10); | ^~~~ a.cc:12:10: note: 'const ll MINF' previously defined here 12 | const ll MINF = -(1e18 + 10); | ^~~~ a.cc:132:5: error: redefinition of 'int main()' 132 | int main(){ | ^~~~ a.cc:24:5: note: 'int main()' previously defined here 24 | int main(){ | ^~~~
s432024088
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ // sengen int n,k; // nyuryoku cin >> n >> k; vector<int> l(n); for(int i=0;i<n;i++){ cin >> l.at(i); } // keisan sort(l,l + n,greater<int>()); int lenth=0; for(int i=0;i<k;i++){ lenth += l.at(i); } cout << lenth << endl; }
a.cc: In function 'int main()': a.cc:14:18: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 14 | sort(l,l + n,greater<int>()); | ~ ^ ~ | | | | | int | std::vector<int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 14 | sort(l,l + n,greater<int>()); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'const _CharT*' and 'std::vector<int>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'const _CharT*' and 'std::vector<int>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:14:20: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | sort(l,l + n,greater<int>()); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:14:20: note: 'std::vector<int>' is
s821333646
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K,S=0;cin>>N>>K;vector<int>l(N); cin(int i=0;i<N;i++)cin>>l.at(N); sort(l.begin(),l.end()); for(i=N-1;i<=N-K;i++)S+=l.at(i); cout<<S<<endl; }
a.cc: In function 'int main()': a.cc:5:7: error: expected primary-expression before 'int' 5 | cin(int i=0;i<N;i++)cin>>l.at(N); | ^~~ a.cc:5:15: error: 'i' was not declared in this scope 5 | cin(int i=0;i<N;i++)cin>>l.at(N); | ^
s763090368
p03658
C++
#include <bits/stdc++.h> using namespace std; using ll =long long; #define SORT(a) sort((a).begin(),(a).end()) #define rSORT(a) reverse((a).begin(),(a).end()) #define For(i, a, b) for(int i = (a) ; i < (b) ; ++i) #define rep(i, n) For(i, 0, n) #define debug(x) cerr << #x << " = " << (x) << endl; template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } void coY() {cout <<"Yes"<<endl;} void coN(){cout <<"No"<<endl;} const ll INF = 1LL << 60; const int mod = 1e9+7; //Write From this Line int main() { int n ,k cin >> n >>k vector<int> l(n); rep(i,n) cin >> l[i]; SORT(l); rSORT(l); ll ans = 0 ; rep(i,k) ans += l[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:9: error: expected initializer before 'cin' 21 | cin >> n >>k | ^~~ a.cc:23:25: error: 'l' was not declared in this scope 23 | rep(i,n) cin >> l[i]; | ^ a.cc:24:14: error: 'l' was not declared in this scope 24 | SORT(l); | ^ a.cc:5:23: note: in definition of macro 'SORT' 5 | #define SORT(a) sort((a).begin(),(a).end()) | ^ a.cc:27:15: error: 'k' was not declared in this scope 27 | rep(i,k) ans += l[i]; | ^ a.cc:7:48: note: in definition of macro 'For' 7 | #define For(i, a, b) for(int i = (a) ; i < (b) ; ++i) | ^ a.cc:27:9: note: in expansion of macro 'rep' 27 | rep(i,k) ans += l[i]; | ^~~
s558389514
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; vector<int> data(N); for(int i = 0; i < N; i++){ cin >> data.at(i); } sort(data.begin(), data.end()); reverse(data.begin(), data.end()); int sum = 0; for (int i = 0; i < K, i++){ sum += data.at(i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:14:29: error: expected ';' before ')' token 14 | for (int i = 0; i < K, i++){ | ^ | ;
s035209357
p03658
C++
#include<bits/stdc+.h> using namespace std; int main(){ int n,k,ans; cin>>n; vector<int>d(n); for(int i=0;i<n;i++){ cin>>d.at(i); } sort(d.begin(),d.end()); reverse(d.begin(),d.end()); for(int i=0;i<k;i++){ ans+=d.at(i); } cout<<ans<<endl; }
a.cc:1:9: fatal error: bits/stdc+.h: No such file or directory 1 | #include<bits/stdc+.h> | ^~~~~~~~~~~~~~ compilation terminated.
s109526516
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int l[n]; for(int i = 0; i < n; i++) cin >> l[i]; std::sort(l, l + n); std::reverse(l, (l + n)); int sum = 0; for(int i = 0; i < k ; i++) sum += l[i]; std::cout << sum << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:12:22: error: 'k' was not declared in this scope 12 | for(int i = 0; i < k ; i++) | ^
s042986136
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int l[n]; for(int i = 0; i < n; i++) cin >> l[i]; std::sort(l, l + n); std::reverse(std::begin(l), std::end(l + n)); int sum = 0; for(int i = 0; i < k ; i++) sum += l[i]; std::cout << sum << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:10:26: error: no matching function for call to 'begin(int [n])' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/initializer_list:88:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::begin(initializer_list<_Tp>)' 88 | begin(initializer_list<_Tp> __ils) noexcept | ^~~~~ /usr/include/c++/14/initializer_list:88:5: note: template argument deduction/substitution failed: a.cc:10:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int*' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:52:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(_Container&)' 52 | begin(_Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:52:5: note: template argument deduction/substitution failed: a.cc:10:26: note: variable-sized array type 'int [n]' is not a valid template argument 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:63:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.begin()) std::begin(const _Container&)' 63 | begin(const _Container& __cont) -> decltype(__cont.begin()) | ^~~~~ /usr/include/c++/14/bits/range_access.h:63:5: note: template argument deduction/substitution failed: a.cc:10:26: note: variable-sized array type 'int [n]' is not a valid template argument 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:95:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::begin(_Tp (&)[_Nm])' 95 | begin(_Tp (&__arr)[_Nm]) noexcept | ^~~~~ /usr/include/c++/14/bits/range_access.h:95:5: note: template argument deduction/substitution failed: a.cc:10:26: note: variable-sized array type 'long int' is not a valid template argument 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1227:5: note: candidate: 'template<class _Tp> _Tp* std::begin(valarray<_Tp>&)' 1227 | begin(valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1227:5: note: template argument deduction/substitution failed: a.cc:10:26: note: mismatched types 'std::valarray<_Tp>' and 'int [n]' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ /usr/include/c++/14/valarray:1238:5: note: candidate: 'template<class _Tp> const _Tp* std::begin(const valarray<_Tp>&)' 1238 | begin(const valarray<_Tp>& __va) noexcept | ^~~~~ /usr/include/c++/14/valarray:1238:5: note: template argument deduction/substitution failed: a.cc:10:26: note: mismatched types 'const std::valarray<_Tp>' and 'int [n]' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~~~^~~ a.cc:10:39: error: no matching function for call to 'end(int*)' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: template argument deduction/substitution failed: a.cc:10:39: note: mismatched types 'std::initializer_list<_Tp>' and 'int*' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&) [with _Container = int*]': a.cc:10:39: required from here 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/range_access.h:74:48: error: request for member 'end' in '__cont', which is of non-class type 'int*' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/range_access.h: In substitution of 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&) [with _Container = int*]': a.cc:10:39: required from here 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/range_access.h:85:54: error: request for member 'end' in '__cont', which is of non-class type 'int* const' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ~~~~~~~^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: template argument deduction/substitution failed: a.cc:10:39: note: mismatched types '_Tp [_Nm]' and 'int*' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: template argument deduction/substitution failed: a.cc:10:39: note: mismatched types 'std::valarray<_Tp>' and 'int*' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: template argument deduction/substitution failed: a.cc:10:39: note: mismatched types 'const std::valarray<_Tp>' and 'int*' 10 | std::reverse(std::begin(l), std::end(l + n)); | ~~~~~~~~^~~~~~~ a.cc:12:22: error: 'k' was not declared in this scope 12 | for(int i = 0; i < k ; i++) | ^
s898409013
p03658
C++
#include<iostream> #include<algorithm> #define rep(i,a,n) for(int i = a; i < n; i++) int main(){ int n, k; std::cin >> n >> k; int l[n]; rep(i,0,n) std::cin >> l[i]; std::sort(l, l + n); int sum = 0; for(int i = n - 1 ; i >= n-k-1; i--) sum += a[i]; std::cout << sum << std::endl; }
a.cc: In function 'int main()': a.cc:13:12: error: 'a' was not declared in this scope 13 | sum += a[i]; | ^
s337633154
p03658
Java
import java.util.Scanner; import java.util.Arrays; import java.util.Collections; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); //棒の全体数 int K = sc.nextInt(); //取る棒の本数 int[] rodList = new int[55]; int rodSum = 0; for(int i=0; i < N; i++){ rodList[i] = sc.nextInt(); } Arrays.sort(rodList, Collections.reverseOrder()); for(int i = 0; i < K; i++){ rodSum += rodList[i]; } System.out.println(rodSum); } }
Main.java:15: error: no suitable method found for sort(int[],Comparator<Object>) Arrays.sort(rodList, Collections.reverseOrder()); ^ method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable (inference variable T#1 has incompatible bounds equality constraints: int upper bounds: Object) method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable (cannot infer type-variable(s) T#2 (actual and formal argument lists differ in length)) where T#1,T#2 are type-variables: T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>) T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s381740813
p03658
C++
#include <iostream> using namespace std; int main() { int N, K; cin >> N >> K; int a[N]; for (int i=0; i < N; i++) cin >> a[i]; int lot_length=0; sort(a, a+N, greater<int>()); for(int i=0; i<K; i++){ lot_length += a[i]; } cout << lot_length << endl; }
a.cc: In function 'int main()': a.cc:12:1: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a, a+N, greater<int>()); | ^~~~ | short
s045732611
p03658
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); //棒の全体数 int K = sc.nextInt(); //取る棒の本数 int[] rodList = new int[55]; int rodSum = 0; for(i=0; i < N; i++){ rodList[i] = sc.nextInt(); } //降順ソート for(int j = 0; j < 55; j++){ for(int i = 54; i > j; i--){ if(rodList[i - 1] < rodList[i]){ int swap = rodList[i-1]; rodList[i-1] = rodList[i]; rodList[i] = swap; } } } for(int i = 0; i < K; i++){ rodSum += rodList[i]; } System.out.println(rodSum); } }
Main.java:9: error: cannot find symbol for(i=0; i < N; i++){ ^ symbol: variable i location: class Main Main.java:9: error: cannot find symbol for(i=0; i < N; i++){ ^ symbol: variable i location: class Main Main.java:9: error: cannot find symbol for(i=0; i < N; i++){ ^ symbol: variable i location: class Main Main.java:10: error: cannot find symbol rodList[i] = sc.nextInt(); ^ symbol: variable i location: class Main 4 errors
s693480537
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K,a; int l[55]; cin >>N >>K; for(int i=0;i<N;i ++)cin >> l[i]; sort(l,l+N,greater<int>()); for(int i=0;i<k;i ++){ a = l[i]; } cout <<a<<endl; }
a.cc: In function 'int main()': a.cc:11:17: error: 'k' was not declared in this scope 11 | for(int i=0;i<k;i ++){ | ^
s382969817
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K,a; int l[55]; cin << N <<K; for(int i=0;i<N;i ++)cin >> l[i]; sort(l,l+N,greater<int>()); for(int i=0;i<k;i ++){ a = l[i]; } cout <<a<<endl; }
a.cc: In function 'int main()': a.cc:6:7: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 6 | cin << N <<K; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:6:7: note: candidate: 'operator<<(int, int)' (built-in) 6 | cin << N <<K; | ~~~~^~~~ a.cc:6:7: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:6:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 6 | cin << N <<K; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:6:10: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 6 | cin << N <<K; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::o
s352467199
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K,a; int l[55] cin << N <<K; for(int i=0;i<N;i ++)cin >> l[i]; sort(l,l+N,greater<int>()); for(int i=0;i<k;i ++){ a = l[i]; } cout <<a<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: expected initializer before 'cin' 6 | cin << N <<K; | ^~~ a.cc:7:31: error: 'l' was not declared in this scope 7 | for(int i=0;i<N;i ++)cin >> l[i]; | ^ a.cc:9:8: error: 'l' was not declared in this scope 9 | sort(l,l+N,greater<int>()); | ^ a.cc:11:17: error: 'k' was not declared in this scope 11 | for(int i=0;i<k;i ++){ | ^
s452407729
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greter<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'greter' was not declared in this scope 10 | sort(a,a+n,greter<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,greter<int>()); | ^~~
s906569193
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,grater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'grater' was not declared in this scope 10 | sort(a,a+n,grater<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,grater<int>()); | ^~~
s783405040
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0,i=n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0,i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:18: error: expected ';' before ')' token 7 | for(i=0,i=n;i++){ | ^ | ; a.cc:11:18: error: expected ';' before ')' token 11 | for(i=0,i<k;i++){ | ^ | ;
s070914751
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc: In function 'int main()': a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:12: error: invalid conversion from 'int*' to 'int' [-fpermissive] 12 | ans=ans+a{i}; | ~~~^~ | | | int* a.cc:12:14: error: expected ';' before '{' token 12 | ans=ans+a{i}; | ^ | ; a.cc:16:4: error: expected '}' at end of input 16 | { | ~^ a.cc:16:4: error: expected '}' at end of input a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s164956247
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0 cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc: In function 'int main()': a.cc:6:3: error: expected ',' or ';' before 'cin' 6 | cin >> n >> k; | ^~~ a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:12: error: invalid conversion from 'int*' to 'int' [-fpermissive] 12 | ans=ans+a{i}; | ~~~^~ | | | int* a.cc:12:14: error: expected ';' before '{' token 12 | ans=ans+a{i}; | ^ | ; a.cc:16:4: error: expected '}' at end of input 16 | { | ~^ a.cc:16:4: error: expected '}' at end of input a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s116232102
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; fr(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,grater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: expected ')' before ';' token 7 | fr(i=0;i<n;i++){ | ~ ^ | ) a.cc:7:17: error: expected ';' before ')' token 7 | fr(i=0;i<n;i++){ | ^ | ; a.cc:10:14: error: 'grater' was not declared in this scope 10 | sort(a,a+n,grater<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,grater<int>()); | ^~~
s366357205
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[55],n,k,i,ans=0; cin >> n >>k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a[i] cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:15: error: expected ';' before 'cout' 12 | ans=ans+a[i] | ^ | ; 13 | cout << ans << endl; | ~~~~ a.cc:15:2: error: expected '}' at end of input 15 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s211227951
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a,[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc: In function 'int main()': a.cc:5:15: error: expected unqualified-id before '[' token 5 | int i,n,k,a,[55],ans=0; | ^ a.cc:8:13: error: invalid types 'int[int]' for array subscript 8 | cin >> a[i]; | ^ a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=ans+a{i}; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs a.cc:16:4: error: expected '}' at end of input 16 | { | ~^ a.cc:16:4: error: expected '}' at end of input a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s251066358
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[55],n,k,i,ans=0; cin >> n >>k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,geater<int>()); for(i=0;i<k;i++){ ans=ans+a[i] cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'geater' was not declared in this scope 10 | sort(a,a+n,geater<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,geater<int>()); | ^~~ a.cc:12:15: error: expected ';' before 'cout' 12 | ans=ans+a[i] | ^ | ; 13 | cout << ans << endl; | ~~~~ a.cc:15:2: error: expected '}' at end of input 15 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s672311848
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[55],n,k,i,ans=0; cin >> n >>k; for(i=0;i<n;i++){ cin = a[i]; } sort(a,a+n,geater<int>()); for(i=0;i<k;i++){ ans=ans+a[i] cin << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:14: error: no match for 'operator=' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | cin = a[i]; | ^ In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:718:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator=(std::basic_istream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]' 718 | operator=(basic_istream&& __rhs) | ^~~~~~~~ /usr/include/c++/14/istream:718:33: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>&&' 718 | operator=(basic_istream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ a.cc:10:14: error: 'geater' was not declared in this scope 10 | sort(a,a+n,geater<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,geater<int>()); | ^~~ a.cc:12:15: error: expected ';' before 'cin' 12 | ans=ans+a[i] | ^ | ; 13 | cin << ans << endl; | ~~~ a.cc:15:2: error: expected '}' at end of input 15 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s142529714
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int N,K,l[60]; cin >> N >> K; for(int i=0 ; i<N ; i++) cin >> l[i]; sort(l,l+N,greater<int>()); int total=0; for(int i=0 ; i < K ; i++) total += l[i]; cout << total; } #include <iostream> #include <algorithm> using namespace std; int main(){ int N,K,l[60]; cin >> N >> K; for(int i=0 ; i<N ; i++) cin >> l[i]; sort(l,l+N,greater<int>()); int ans=0; for(int i=0 ; i < K ; i++) ans += l[i]; cout << ans; }
a.cc:21:5: error: redefinition of 'int main()' 21 | int main(){ | ^~~~ a.cc:5:5: note: 'int main()' previously defined here 5 | int main(){ | ^~~~
s014446556
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greather<int>); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'greather' was not declared in this scope 10 | sort(a,a+n,greather<int>); | ^~~~~~~~ a.cc:10:23: error: expected primary-expression before 'int' 10 | sort(a,a+n,greather<int>); | ^~~
s520415182
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[55],n,k,i,ans=0; cin >> n >>k; for(i=0;i<n;i++){ cin = a[i] } sort(a,a+n,geater<int>()); for(i=0;i<k;i++){ ans=ans+a[i] cin << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:14: error: no match for 'operator=' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | cin = a[i] | ^ In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:718:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator=(std::basic_istream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]' 718 | operator=(basic_istream&& __rhs) | ^~~~~~~~ /usr/include/c++/14/istream:718:33: note: no known conversion for argument 1 from 'int' to 'std::basic_istream<char>&&' 718 | operator=(basic_istream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ a.cc:10:14: error: 'geater' was not declared in this scope 10 | sort(a,a+n,geater<int>()); | ^~~~~~ a.cc:10:21: error: expected primary-expression before 'int' 10 | sort(a,a+n,geater<int>()); | ^~~ a.cc:12:15: error: expected ';' before 'cin' 12 | ans=ans+a[i] | ^ | ; 13 | cin << ans << endl; | ~~~ a.cc:15:2: error: expected '}' at end of input 15 | } | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s515332329
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a,[55],ans=0 cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:15: error: expected unqualified-id before '[' token 5 | int i,n,k,a,[55],ans=0 | ^ a.cc:8:13: error: invalid types 'int[int]' for array subscript 8 | cin >> a[i]; | ^ a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=ans+a{i}; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs
s459879125
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greather<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:14: error: 'greather' was not declared in this scope 10 | sort(a,a+n,greather<int>()); | ^~~~~~~~ a.cc:10:23: error: expected primary-expression before 'int' 10 | sort(a,a+n,greather<int>()); | ^~~
s732479209
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a[55],n,k,i,ans=0; cin >> n >>k; for(i==0;i<n;i++){ cin == a[i] } sort(a,a+n,geater<int>()); for(i==0;i<k;i++){ ans=ans+a[i] cin << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: no match for 'operator==' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | cin == a[i] | ~~~ ^~ ~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:8:9: note: candidate: 'operator==(int, int)' (built-in) 8 | cin == a[i] | ~~~~^~~~~~~ a.cc:8:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cin == a[i] | ^ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cin == a[i] | ^ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | cin == a[i] | ^ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:8:15: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:8:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 8 | cin == a[i] | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:449:3: note: candidate: 'bool std::operator==(const error_code&, const error_code&)' 449 | operator==(const error_code& __lhs, const error_code&
s678456657
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a,i[55],ans=0; cin >> n >> k: for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: expected ';' before ':' token 6 | cin >> n >> k: | ^ | ; a.cc:7:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:15: error: lvalue required as increment operand 7 | for(i=0;i<n;i++){ | ^ a.cc:10:26: error: expected primary-expression before ')' token 10 | sort(a,a+n,greater<int>); | ^ a.cc:11:8: error: incompatible types in assignment of 'int' to 'int [55]' 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:15: error: lvalue required as increment operand 11 | for(i=0;i<k;i++){ | ^
s269435017
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greather<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:10:14: error: 'greather' was not declared in this scope 10 | sort(a,a+n,greather<int>()); | ^~~~~~~~ a.cc:10:23: error: expected primary-expression before 'int' 10 | sort(a,a+n,greather<int>()); | ^~~ a.cc:15:12: error: expected '}' at end of input 15 | return 0; | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s422159824
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a,[55],ans=0 cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc: In function 'int main()': a.cc:5:15: error: expected unqualified-id before '[' token 5 | int i,n,k,a,[55],ans=0 | ^ a.cc:8:13: error: invalid types 'int[int]' for array subscript 8 | cin >> a[i]; | ^ a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=ans+a{i}; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs a.cc:16:4: error: expected '}' at end of input 16 | { | ~^ a.cc:16:4: error: expected '}' at end of input a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s741900421
p03658
C++
#include<iostream> #include<algorithm using namespace std; int main(){ int i,n,k,a[55],ans=0; cin >> n >> k; for(i=0,i=n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0,i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc:2:19: error: missing terminating > character 2 | #include<algorithm | ^ a.cc: In function 'int main()': a.cc:7:18: error: expected ';' before ')' token 7 | for(i=0,i=n;i++){ | ^ | ; a.cc:11:18: error: expected ';' before ')' token 11 | for(i=0,i<k;i++){ | ^ | ;
s878805695
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a,N,K,l[60],ans=0; cin >> N >> K; for(int i=0 ; i<N ; i++) cin >> l[i]; sort(l,l+N,greater<int>()); for(int i=0 ; i<K ; i++){ ans=ans+a[i]; } cout<<ans<<endl; return 0;
a.cc: In function 'int main()': a.cc:10:12: error: invalid types 'int[int]' for array subscript 10 | ans=ans+a[i]; | ^ a.cc:13:13: error: expected '}' at end of input 13 | return 0; | ^ a.cc:4:12: note: to match this '{' 4 | int main(){ | ^
s425570234
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a[55],ans=0; cin >> n >> k; for(i=0,i=n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0,i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:7: error: 'i' was not declared in this scope 7 | for(i=0,i=n;i++){ | ^ a.cc:7:18: error: expected ';' before ')' token 7 | for(i=0,i=n;i++){ | ^ | ; a.cc:11:7: error: 'i' was not declared in this scope 11 | for(i=0,i<k;i++){ | ^ a.cc:11:18: error: expected ';' before ')' token 11 | for(i=0,i<k;i++){ | ^ | ;
s417400524
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int i,n,k,a,[55]; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc: In function 'int main()': a.cc:5:15: error: expected unqualified-id before '[' token 5 | int i,n,k,a,[55]; | ^ a.cc:8:13: error: invalid types 'int[int]' for array subscript 8 | cin >> a[i]; | ^ a.cc:10:9: error: expected ')' before ';' token 10 | sort(a;a+n,greater<int>()); | ~ ^ | ) a.cc:10:28: error: expected ';' before ')' token 10 | sort(a;a+n,greater<int>()); | ^ | ; a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=ans+a{i}; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs a.cc:16:4: error: expected '}' at end of input 16 | { | ~^ a.cc:16:4: error: expected '}' at end of input a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s446068789
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a,i[55]; cin >> n >> k: for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:16: error: expected ';' before ':' token 6 | cin >> n >> k: | ^ | ; a.cc:7:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:15: error: lvalue required as increment operand 7 | for(i=0;i<n;i++){ | ^ a.cc:10:26: error: expected primary-expression before ')' token 10 | sort(a,a+n,greater<int>); | ^ a.cc:11:8: error: incompatible types in assignment of 'int' to 'int [55]' 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:15: error: lvalue required as increment operand 11 | for(i=0;i<k;i++){ | ^ a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans=ans+a[i]; | ^~~ | abs a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs
s356955816
p03658
C++
#include<iostream> #include<algorithm> using namespace std, int main(){ int i,n,k,a,[55]; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc:3:20: error: expected ';' before ',' token 3 | using namespace std, | ^ | ; a.cc:3:20: error: expected unqualified-id before ',' token a.cc:4:1: error: expected unqualified-id before 'int' 4 | int main(){ | ^~~
s252322846
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int N,K,l[60]; cin >> N >> K; for(int i=0 ; i<N ; i++) cin >> l[i]; sort(l,l+N,greater<int>()); for(int i=0 ; i<K ; i++){ ans=ans+a[i]; } cout<<ans<<endl; return 0;
a.cc: In function 'int main()': a.cc:10:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 10 | ans=ans+a[i]; | ^~~ | abs a.cc:10:11: error: 'a' was not declared in this scope 10 | ans=ans+a[i]; | ^ a.cc:12:10: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | cout<<ans<<endl; | ^~~ | abs a.cc:13:13: error: expected '}' at end of input 13 | return 0; | ^ a.cc:4:12: note: to match this '{' 4 | int main(){ | ^
s872992509
p03658
C++
#include<iostream> using namespace std; int main(){ int n,k,a,i[55]; cin >> n >> k: for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:16: error: expected ';' before ':' token 5 | cin >> n >> k: | ^ | ; a.cc:6:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 6 | for(i=0;i<n;i++){ | ~^~ a.cc:6:15: error: lvalue required as increment operand 6 | for(i=0;i<n;i++){ | ^ a.cc:9:26: error: expected primary-expression before ')' token 9 | sort(a,a+n,greater<int>); | ^ a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(a,a+n,greater<int>); | ^~~~ | short a.cc:10:8: error: incompatible types in assignment of 'int' to 'int [55]' 10 | for(i=0;i<k;i++){ | ~^~ a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | for(i=0;i<k;i++){ | ~^~ a.cc:10:15: error: lvalue required as increment operand 10 | for(i=0;i<k;i++){ | ^ a.cc:11:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | ans=ans+a[i]; | ^~~ | abs a.cc:13:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | cout << ans << endl; | ^~~ | abs
s500165966
p03658
C++
#include<iostream> #include<algorithm> using namespace std, int main(){ int i,n,a,[55]; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a;a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a{i}; } cout << ans << endl; return 0; {
a.cc:3:20: error: expected ';' before ',' token 3 | using namespace std, | ^ | ; a.cc:3:20: error: expected unqualified-id before ',' token a.cc:4:1: error: expected unqualified-id before 'int' 4 | int main(){ | ^~~
s088744955
p03658
C++
#include<iostream> #include<algorithm using namespace std; int main(){ int n,k,a[55],ans=0; cin >> n >> k; for(i=0,i=n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0,i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc:2:19: error: missing terminating > character 2 | #include<algorithm | ^ a.cc: In function 'int main()': a.cc:7:7: error: 'i' was not declared in this scope 7 | for(i=0,i=n;i++){ | ^ a.cc:7:18: error: expected ';' before ')' token 7 | for(i=0,i=n;i++){ | ^ | ; a.cc:11:7: error: 'i' was not declared in this scope 11 | for(i=0,i<k;i++){ | ^ a.cc:11:18: error: expected ';' before ')' token 11 | for(i=0,i<k;i++){ | ^ | ;
s970437901
p03658
C++
#include <iostream> #include<algorithm> using namespace std; int main(){ int n,k,a[55]; cin >>n >>k; for(i=0,i<n,i++){ cin >>a[i]; } sort(a,a+n,grater<int>()); for(i=0,i<k,i++){ ans=ans+a[i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:7:11: error: 'i' was not declared in this scope 7 | for(i=0,i<n,i++){ | ^ a.cc:10:22: error: 'grater' was not declared in this scope 10 | sort(a,a+n,grater<int>()); | ^~~~~~ a.cc:10:29: error: expected primary-expression before 'int' 10 | sort(a,a+n,grater<int>()); | ^~~ a.cc:11:9: error: expected primary-expression before 'for' 11 | for(i=0,i<k,i++){ | ^~~ a.cc:10:37: error: expected ')' before 'for' 10 | sort(a,a+n,grater<int>()); | ^ | ) 11 | for(i=0,i<k,i++){ | ~~~ a.cc:7:10: note: to match this '(' 7 | for(i=0,i<n,i++){ | ^ a.cc:14:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | cout << ans << endl; | ^~~ | abs a.cc:15:1: error: expected primary-expression before '}' token 15 | } | ^ a.cc:14:23: error: expected ')' before '}' token 14 | cout << ans << endl; | ^ | ) 15 | } | ~ a.cc:11:12: note: to match this '(' 11 | for(i=0,i<k,i++){ | ^ a.cc:15:1: error: expected primary-expression before '}' token 15 | } | ^
s965202706
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a,i[55],ans; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:8: error: incompatible types in assignment of 'int' to 'int [55]' 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:15: error: lvalue required as increment operand 7 | for(i=0;i<n;i++){ | ^ a.cc:11:8: error: incompatible types in assignment of 'int' to 'int [55]' 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:15: error: lvalue required as increment operand 11 | for(i=0;i<k;i++){ | ^ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(a,a+n,greater<int>()); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71, 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: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = int; _Iterator2 = int; _Compare = std::greater<int>]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(a,a+n,greater<int>()); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:31: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:39: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(a,a+n,greater<int>()); | ~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _C
s790986897
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a[55],i,ans=0; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a[i] } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:15: error: expected ';' before '}' token 12 | ans=ans+a[i] | ^ | ; 13 | } | ~
s161614167
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a[55],ans; cin >> n >>k; for(int i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,greater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:7: error: 'i' was not declared in this scope 11 | for(i=0;i<k;i++){ | ^
s220175291
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n,k,a,i[55],ans; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,freater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:8: error: incompatible types in assignment of 'int' to 'int [55]' 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | for(i=0;i<n;i++){ | ~^~ a.cc:7:15: error: lvalue required as increment operand 7 | for(i=0;i<n;i++){ | ^ a.cc:10:14: error: 'freater' was not declared in this scope 10 | sort(a,a+n,freater<int>()); | ^~~~~~~ a.cc:10:22: error: expected primary-expression before 'int' 10 | sort(a,a+n,freater<int>()); | ^~~ a.cc:11:8: error: incompatible types in assignment of 'int' to 'int [55]' 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | for(i=0;i<k;i++){ | ~^~ a.cc:11:15: error: lvalue required as increment operand 11 | for(i=0;i<k;i++){ | ^
s725852393
p03658
C++
#include<iostream> using namespace std; int main(){ int n,k,a,i[55],ans; cin >> n >> k; for(i=0;i<n;i++){ cin >> a[i]; } sort(a,a+n,freater<int>()); for(i=0;i<k;i++){ ans=ans+a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:8: error: incompatible types in assignment of 'int' to 'int [55]' 6 | for(i=0;i<n;i++){ | ~^~ a.cc:6:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 6 | for(i=0;i<n;i++){ | ~^~ a.cc:6:15: error: lvalue required as increment operand 6 | for(i=0;i<n;i++){ | ^ a.cc:9:14: error: 'freater' was not declared in this scope 9 | sort(a,a+n,freater<int>()); | ^~~~~~~ a.cc:9:22: error: expected primary-expression before 'int' 9 | sort(a,a+n,freater<int>()); | ^~~ a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(a,a+n,freater<int>()); | ^~~~ | short a.cc:10:8: error: incompatible types in assignment of 'int' to 'int [55]' 10 | for(i=0;i<k;i++){ | ~^~ a.cc:10:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | for(i=0;i<k;i++){ | ~^~ a.cc:10:15: error: lvalue required as increment operand 10 | for(i=0;i<k;i++){ | ^
s619109177
p03658
C++
#include <iostream> using namespace std, int main(){ int << N,K,1[60]
a.cc:2:20: error: expected ';' before ',' token 2 | using namespace std, | ^ | ; a.cc:2:20: error: expected unqualified-id before ',' token a.cc:3:1: error: expected unqualified-id before 'int' 3 | int main(){ | ^~~
s318298188
p03658
C++
#include<bits/stdc++.h> using namespace std; int main() { int n, k; cin>>n>>k; int l[n]; for(int i = 0; i < n; i++) cin>>l[i]; sort(l, l+n, greater<int>()); int sum = 0; for(int i = 0; i < k; i++) s += l[i]; cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 's' was not declared in this scope 14 | s += l[i]; | ^
s223082780
p03658
C++
#include<iostream> using namespace std; int main(){ int n,k; cin >> n >> k; int l[60]; for(int i = 0; i < n; i++){ cin >> l[i]; } sort(l,l + n, greater<int>()); int sum = 0; for (int i = 0; i < k; i++){ sum += l[i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(l,l + n, greater<int>()); | ^~~~ | short
s375880386
p03658
C++
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for(int64_t i = 0; i < n; ++i) using namespace std; int main() { int n, k, s = 0; cin >> n >> k; vector<int> v(n); rep(i, n) cin >> v[i]; sort(v.bedin(), v.end()); reverse(v.begin(), v.end()); rep(i, k) s += v[i]; cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:10: error: 'class std::vector<int>' has no member named 'bedin'; did you mean 'begin'? 11 | sort(v.bedin(), v.end()); | ^~~~~ | begin
s619027151
p03658
C++
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for(int64_t i = 0; i < n; ++i) using namespace std; int main() { int n, k, s = 0; cin >> n >> k; vector<int> v(n); rep(i, n) cin >> v[i]; sort(v.bedin(), v.end()); reverse(v.begin(), v.end()); rep(i, k) s += v[i]; cout << s << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:10: error: 'class std::vector<int>' has no member named 'bedin'; did you mean 'begin'? 11 | sort(v.bedin(), v.end()); | ^~~~~ | begin
s332499251
p03658
C++
#include<bits/stdc++.h> #define f(i,s,n)for(register int i=s;i<=n;++i) #define f2(i,s,n)for(register int i=n;i>=s;--i) #define N 60 using namespace std; int a[N]; int main(){ ios::sync_with_stdio(false); long long n,sum=0; cin>>n; f(i,1,n){ cin>>a[i]; } sort(a+1,a+n+1); f(i,1,k){ sum+=a[i]; } cout<<sum<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:11:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 11 | f(i,1,n){ | ^ a.cc:2:34: note: in definition of macro 'f' 2 | #define f(i,s,n)for(register int i=s;i<=n;++i) | ^ a.cc:15:11: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 15 | f(i,1,k){ | ^ a.cc:2:34: note: in definition of macro 'f' 2 | #define f(i,s,n)for(register int i=s;i<=n;++i) | ^ a.cc:15:15: error: 'k' was not declared in this scope 15 | f(i,1,k){ | ^ a.cc:2:41: note: in definition of macro 'f' 2 | #define f(i,s,n)for(register int i=s;i<=n;++i) | ^
s676675382
p03658
C++
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい //for文のマクロ #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define big 1000000007 int main(){ int n;k; cin >>n>>k; vector<int> l(n); rep(i,n){ cin>>l[i]; } sort(l.begin(),l.end()); reverse(l.begin(),l.end()); //大きい順にソート int sum=0; rep(i,k){ sum+=l[i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:10:11: error: 'k' was not declared in this scope 10 | int n;k; | ^
s357091433
p03658
C++
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; bool cmp(int a,int b){ return a<b; } int main() { int a[10001]; int n,m; int ans=0; cin>>n>>m; for(int i=1;i<=n;i++)cin>>a[i]; sort(a+1,a+1+n,cmp); for(int i=1;i<=m;i++)ans=a[i]+ans; cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 16 | sort(a+1,a+1+n,cmp); | ^~~~ | sqrt
s325851494
p03658
Java
import java.util.Arrays; import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int k = sc.nextInt(); int n = sc.nextInt(); int[] l = new int[n]; int i; int leng = 0; for(i=0;i<n;i++){ l[i] = sc.nextInt(); } Arrays.sort(l, Collections.reverseOrder()); for(i=0;i<k;i++){ leng += l[i]; } System.out.println(leng); } }
Main.java:14: error: no suitable method found for sort(int[],Comparator<Object>) Arrays.sort(l, Collections.reverseOrder()); ^ method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable (inference variable T#1 has incompatible bounds equality constraints: int upper bounds: Object) method Arrays.<T#2>sort(T#2[],int,int,Comparator<? super T#2>) is not applicable (cannot infer type-variable(s) T#2 (actual and formal argument lists differ in length)) where T#1,T#2 are type-variables: T#1 extends Object declared in method <T#1>sort(T#1[],Comparator<? super T#1>) T#2 extends Object declared in method <T#2>sort(T#2[],int,int,Comparator<? super T#2>) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s332135484
p03658
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> #include <vector> #define rep(i,n) for(int i=0; i< int(n); i++) using namespace std; int main(){ int n,k; int a[60]; cin >> n >> k ; rep(i,n) cin >> a[i]; sort(a, a+n, greater<int>()); int ans = 0; rep(i,k) res += a[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:17:18: error: 'res' was not declared in this scope; did you mean 'rep'? 17 | rep(i,k) res += a[i]; | ^~~ | rep
s736534078
p03658
C++
#include <iostream> #include <algorithm> #include <string> #include <math.h> #include <vector> #define rep(i,n) for(int i=0; i< int(n); i++) using namespace std; int main(){ int n,k; int a[60]; cin >> n >> k ; rep(i,n) cin << a[i]; sort(a, a+n, greater<int>()); int ans = 0; rep(i,k) res += a[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:14:22: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | rep(i,n) cin << a[i]; | ~~~ ^~ ~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:22: note: candidate: 'operator<<(int, int)' (built-in) 14 | rep(i,n) cin << a[i]; | ~~~~^~~~~~~ a.cc:14:22: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:14:18: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 14 | rep(i,n) cin << a[i]; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:14:28: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:14:21: required from here 14 | rep(i,n) cin << a[i]; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ a.cc:17:18: error: 'res' was not de
s854544731
p03658
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, K; int l[]; int length = 0; scanf("d%d%",n,K); for (i=0; i<n; i++){ scanf("d%",l[i]); } sort(l[0],l[n]); for (int i = n-1; i< n -k; i--){ length += n; } cout >> length; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: storage size of 'l' isn't known 8 | int l[]; | ^ a.cc:11:10: error: 'i' was not declared in this scope 11 | for (i=0; i<n; i++){ | ^ a.cc:15:29: error: 'k' was not declared in this scope 15 | for (int i = n-1; i< n -k; i--){ | ^ a.cc:19:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 19 | cout >> length; | ~~~~ ^~ ~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:19:10: note: candidate: 'operator>>(int, int)' (built-in) 19 | cout >> length; | ~~~~~^~~~~~~~~ a.cc:19:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:19:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 19 | cout >> length; | ^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)' 1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ In file included from /usr/include/c++/14/istream:1109, 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/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:19:13: required from here 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/iomanip:177:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setfill<_CharT>)' 177 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:177:5: note: template argument deduction/substitution failed: a.cc:19:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 19 | cout >> length; | ^~~~~~ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _Ch
s222850818
p03658
C++
#include<bits/stdc++.h> using namespace std; //size_t f = string::npos //make pair int main(){ int n,k;cin >> n >> k; vector<int> arr[n + 5]; int ans = 0; for(int i = 0;i < n;i++){ int t;cin >> t; arr.push_back(t); } sort(arr.rbegin(), arr.rend()); for(int i = 0;i < k;i++){ ans += arr[i]; } cout << ans; }
a.cc: In function 'int main()': a.cc:12:17: error: request for member 'push_back' in 'arr', which is of non-class type 'std::vector<int> [(n + 5)]' 12 | arr.push_back(t); | ^~~~~~~~~ a.cc:14:16: error: request for member 'rbegin' in 'arr', which is of non-class type 'std::vector<int> [(n + 5)]' 14 | sort(arr.rbegin(), arr.rend()); | ^~~~~~ a.cc:14:30: error: request for member 'rend' in 'arr', which is of non-class type 'std::vector<int> [(n + 5)]' 14 | sort(arr.rbegin(), arr.rend()); | ^~~~ a.cc:16:17: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>') 16 | ans += arr[i]; | ~~~~^~~~~~~~~
s831166728
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,a[10001]; int main(){ cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n-1;i++) for(int j=i+1;j<=n;j++){ if(a[i]<a[j]) swap(a[i],a[j]); } for(int i=1;i<=k;i++) sum+=a[i]; cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: 'sum' was not declared in this scope 11 | for(int i=1;i<=k;i++) sum+=a[i]; | ^~~ a.cc:12:11: error: 'sum' was not declared in this scope 12 | cout<<sum<<endl; | ^~~
s226573195
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,a[10001]; int main(){ cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n-1;i++) for(int j=i+1;j<=n;j++){ if(a[i]<a[j]) swap(a[i],a[j]); } for(int i=1;i<=k;i++) sum+=a[i]; cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: 'sum' was not declared in this scope 11 | for(int i=1;i<=k;i++) sum+=a[i]; | ^~~ a.cc:12:11: error: 'sum' was not declared in this scope 12 | cout<<sum<<endl; | ^~~
s461636175
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,a[10212004],m,ans; bool cmp(int a,int b) return a>b; } int main(){ cin>>n>>m; for(int i=1;i<=n;i++){ cin>>a[i]; } sort(a+1,a+1+n,cmp); for(int i=1;i<=m;i++){ ans+=a[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'bool cmp(int, int)': a.cc:5:5: error: named return values are no longer supported 5 | return a>b; | ^~~~~~ a.cc:10:23: error: invalid types 'int[int]' for array subscript 10 | cin>>a[i]; | ^ a.cc:14:23: error: invalid types 'int[int]' for array subscript 14 | ans+=a[i]; | ^ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = bool (*)(int, int)]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:6: required from here 12 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = int; _Iterator2 = int; _Compare = bool (*)(int, int)]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = bool (*)(int, int)]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:6: required from here 12 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:31: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:39: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = bool (*)(int, int)]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:12:6: required from here 12 | sort(a+1,a+1+n,cmp); | ~~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<bool (*)(int, int)>]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compa
s539115579
p03658
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> typedef long long ll; using namespace std; int main(void){ int n,k; cin >> n >>k; int snake[60]; for(int i=0i<n;++i){ cin >> snake[i]; } int ans=0; std::sort(snake,snake+n); for(int i=0;i<k;i++){ ans += snake[i]; } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:13:15: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<' 13 | for(int i=0i<n;++i){ a.cc:13:21: error: expected ';' before ')' token 13 | for(int i=0i<n;++i){ | ^ | ;
s067786677
p03658
C++
#include <iostream> #include <string> #include <cmath> #include <vector> using namespace std; // define list namespace math{ const double PI = 3.14; const int INF = 1000000007; int GCM(int a,int b); //最大公約数 int LCM(int a,int b); //最小公倍数 int Pemu(int n,int r); //順列 int Comb(int n,int m); //組み合わせ int GCM(int a,int b){ if(a<b){ swap(a,b); } int r = a%b; while (r!=0) { a=b; b=r; r=a%b; } return b; } int LCM(int a,int b){ return a*(b/GCM(a,b)); } int Pemu(int n,int r){ int ans = n; for(int i=1;i<r;i++){ ans*=(ans-i); } return ans; } int Comb(int n,int m){ int a=n,b=m; for(int i=1;i<m;i++){ a *= (a-i); } for(int i=1;i<m;i++){ b *= (b-i); } return a/b; } } namespace SubLib{ #define int long long #define double long double #define incin(n) int (n); cin >> (n); #define incin2(a,b) int a,b; cin >> a >> b; #define rap(n,i) for(int (i) = 0;i<(n);(i)++) #define input(n,v) (v) = SubLib::Input((n),(v)) #define all(v) (v).begin(),(v).end() using intv = vector<int>; using strv = vector<string>; using charv = vector<char>; template <class T1> using pvec = vector<pair<T1,T1>>; template <typename T> vector<T> Input(int n,vector<T> v){ for(int i=0;i<n;i++){ cin >> v.at(i); } return v; } } using namespace math; using namespace SubLib; signed main(){ incin2(n,k); intv l(n); input(n,l); sort(l.begin(),l.end(),[](const int &a,const int &b){return a>b;}); int ans = 0; rap(k,i){ ans += l[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:87:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 87 | sort(l.begin(),l.end(),[](const int &a,const int &b){return a>b;}); | ^~~~ | sqrt
s778193867
p03658
C++
#include <iostream> #include <string> #include <cmath> #include <vector> using namespace std; // define list namespace math{ const double PI = 3.14; const int INF = 1000000007; int GCM(int a,int b); //最大公約数 int LCM(int a,int b); //最小公倍数 int Pemu(int n,int r); //順列 int Comb(int n,int m); //組み合わせ int GCM(int a,int b){ if(a<b){ swap(a,b); } int r = a%b; while (r!=0) { a=b; b=r; r=a%b; } return b; } int LCM(int a,int b){ return a*(b/GCM(a,b)); } int Pemu(int n,int r){ int ans = n; for(int i=1;i<r;i++){ ans*=(ans-i); } return ans; } int Comb(int n,int m){ int a=n,b=m; for(int i=1;i<m;i++){ a *= (a-i); } for(int i=1;i<m;i++){ b *= (b-i); } return a/b; } } namespace SubLib{ #define int long long #define double long double #define incin(n) int (n); cin >> (n); #define incin2(a,b) int a,b; cin >> a >> b; #define rap(n,i) for(int (i) = 0;i<(n);(i)++) #define input(n,v) (v) = SubLib::Input((n),(v)) #define all(v) (v).begin(),(v).end() using intv = vector<int>; using strv = vector<string>; using charv = vector<char>; template <class T1> using pvec = vector<pair<T1,T1>>; template <typename T> vector<T> Input(int n,vector<T> v){ for(int i=0;i<n;i++){ cin >> v.at(i); } return v; } } using namespace math; using namespace SubLib; signed main(){ incin2(n,k); intv l(n); input(n,l); sort(all(l)); reverse(all(l)); int ans = 0; rap(k,i){ ans += l[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:87:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 87 | sort(all(l)); | ^~~~ | sqrt a.cc:88:5: error: 'reverse' was not declared in this scope 88 | reverse(all(l)); | ^~~~~~~
s814902551
p03658
C++
#include <iostream> #include <string> #include <cmath> #include <vector> using namespace std; // define list namespace math{ const double PI = 3.14; const int INF = 1000000007; int GCM(int a,int b); //最大公約数 int LCM(int a,int b); //最小公倍数 int Pemu(int n,int r); //順列 int Comb(int n,int m); //組み合わせ int GCM(int a,int b){ if(a<b){ swap(a,b); } int r = a%b; while (r!=0) { a=b; b=r; r=a%b; } return b; } int LCM(int a,int b){ return a*(b/GCM(a,b)); } int Pemu(int n,int r){ int ans = n; for(int i=1;i<r;i++){ ans*=(ans-i); } return ans; } int Comb(int n,int m){ int a=n,b=m; for(int i=1;i<m;i++){ a *= (a-i); } for(int i=1;i<m;i++){ b *= (b-i); } return a/b; } } namespace SubLib{ #define int long long #define double long double #define incin(n) int (n); cin >> (n); #define incin2(a,b) int a,b; cin >> a >> b; #define rap(n,i) for(int (i) = 0;i<(n);(i)++) #define input(n,v) (v) = SubLib::Input((n),(v)) #define all(v) (v).begin(),(v).end() using intv = vector<int>; using strv = vector<string>; using charv = vector<char>; template <class T1> using pvec = vector<pair<T1,T1>>; template <typename T> vector<T> Input(int n,vector<T> v){ for(int i=0;i<n;i++){ cin >> v.at(i); } return v; } } using namespace math; using namespace SubLib; signed main(){ incin2(n,k); intv l(n); input(n,l); sort(all(l),[](const int &a,const int &b){return a>b;}); int ans = 0; rap(k,i){ ans += l[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:87:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 87 | sort(all(l),[](const int &a,const int &b){return a>b;}); | ^~~~ | sqrt
s305124051
p03658
C++
#include <iostream> using namespace std; int main(void) { int N, K, i, l[51], ans=0; cin >> N >> K; for(i=1; i<=N; i++){ cin >> l[i]; } sort(l+1, l+N+1); for(i=N-K+1; i<=N; i++){ ans += l[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(l+1, l+N+1); | ^~~~ | short
s400537691
p03658
C++
#include <iostream> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { int N, K; cin >> N >> K; vector<int> l(N); REP(i, N) cin >> l.at(i); sort(all(l)); reverse(all(l)); int sum = 0; REP(i, K) sum += l.at(i); cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(all(l)); | ^~~~ | short a.cc:13:3: error: 'reverse' was not declared in this scope 13 | reverse(all(l)); | ^~~~~~~
s019269887
p03658
C++
#include <bits/stdc++.h> #include <string> #include <math.h> #include <stdio.h> #include <stdlib.h> using namespace std; int my_abs(int num){ if (num > 0) return num; else return -num; } int main(){ int N,K; cin >> N >> K; vector<int> stick(N); for(int i = 0;i<n;i++){ cin >> stick.at(i); } sort(stick.begin(),stick.end()); reverse(stick.begin(),stick.end()); int ans = 0; for(int j = 0;j<K;j++){ ans = ans + stick.at(j); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:19:21: error: 'n' was not declared in this scope 19 | for(int i = 0;i<n;i++){ | ^
s821337040
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; vector<int>l(N); for (int i = 0; i < N; i++) { cin >> l[i]; } sort(l.begin(),l.end(),greater); int sum=0; for (int i = 0; i < K; i++) { sum+=l.at(i); } cout<<sum; }
a.cc: In function 'int main()': a.cc:11:35: error: missing template arguments before ')' token 11 | sort(l.begin(),l.end(),greater); | ^
s993058830
p03658
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int a,b; cin>>a>>b; int c[10000000]; for(int i=0;i<a;i++){ cin>>c[i]; } sort(a+1,a+n+1); for(int i=a-1;i>=b;i--){ int ans=0; ans+=c[i]; } return 0; }
a.cc: In function 'int main()': a.cc:12:16: error: 'n' was not declared in this scope 12 | sort(a+1,a+n+1); | ^
s413512451
p03658
C++
#include<stdio.h> #include<string.h> #include<stdlib.h> int ordem(const void*a, const void*b){ return strcmp(a,b); } int main(){ int n,k, total = 0,x; scanf("%d %d", &n, &k); int t[n]; for(int i=0; i<n; i++){ scanf("%d", &t[i]); } qsort(t, n, sizeof(t[0]), ordem); x = n - k; k += 1; for (int i = x ; i <= k ; i++){ total += t[i]; } printf("%d\n", total); return 0; }
a.cc: In function 'int ordem(const void*, const void*)': a.cc:6:19: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive] 6 | return strcmp(a,b); | ^ | | | const void* In file included from a.cc:2: /usr/include/string.h:156:32: note: initializing argument 1 of 'int strcmp(const char*, const char*)' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~ a.cc:6:21: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive] 6 | return strcmp(a,b); | ^ | | | const void* /usr/include/string.h:156:50: note: initializing argument 2 of 'int strcmp(const char*, const char*)' 156 | extern int strcmp (const char *__s1, const char *__s2) | ~~~~~~~~~~~~^~~~
s228164378
p03658
C++
#include<bits/stdc++.h> using namespace std; int main() { long long n,a[1001],second,frist; cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=k;i++){ frist+=a[i]; } cout<<frist<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:17: error: 'k' was not declared in this scope 6 | cin>>n>>k; | ^