submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s217238719
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,b,a[999999]; int main() { cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(int i=n5;i>=n-k+1;i--) { b+=a[i]; } cout<<b; return 0; }
a.cc: In function 'int main()': a.cc:9:15: error: 'n5' was not declared in this scope; did you mean 'n'? 9 | for(int i=n5;i>=n-k+1;i--) | ^~ | n
s405662107
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,b,a[999999]; int main() { cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(int i=n5;i>=n-k+1;i--) { b+=a[i]; } cout<<b; return 0; }
a.cc: In function 'int main()': a.cc:9:15: error: 'n5' was not declared in this scope; did you mean 'n'? 9 | for(int i=n5;i>=n-k+1;i--) | ^~ | n
s896146836
p03658
Java
import java.util.*; public class main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] data = new int[n]; int sum = 0; for(int i = 0;i<n;i++){ data[i] = sc.nextInt(); } Arrays.sort(data); for(int i = n-1;i>n-1-k;i--){ sum = sum + data[i]; } System.out.println(sum); } }
Main.java:2: error: class main is public, should be declared in a file named main.java public class main{ ^ 1 error
s091409091
p03658
C++
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int l[]=new int[n]; for(int i=0;i<n;i++){ l[i]=sc.nextInt(); } Arrays.sort(l); int total=0; for(int i=n-1;i>n-1-k;i--){ total+=l[i]; } System.out.println(total); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main{ | ^~~~~~
s549193263
p03658
C++
#include <iostream> using namespace std; long long a,b[55],c; int main() { cin>>a; for(int i=0;i<a;i++) cin>>b[i]; sort(b,b+a); for(int i=a-c;i<a;i++) c+=b[i]; cout<<c<<endl; return 0; }
a.cc: In function 'int main()': a.cc:9:5: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(b,b+a); | ^~~~ | short
s332067976
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,i; cin>>n>>k; int L[n] for(i=0;i<n;i++){ cin>>L[n]; } sort(L,L+n,greater<int>()); int sum=0; for(i=0;i<k;i++){ sum+=L[i]; } cout<<sum; }
a.cc: In function 'int main()': a.cc:8:3: error: expected initializer before 'for' 8 | for(i=0;i<n;i++){ | ^~~ a.cc:8:18: error: expected ';' before ')' token 8 | for(i=0;i<n;i++){ | ^ | ; a.cc:11:8: error: 'L' was not declared in this scope 11 | sort(L,L+n,greater<int>()); | ^
s947816323
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int m,n; cin>>m>>n; for(int i=1;i<=m;++i) cin>>a[i]; sort(a+1,a+1+m); int num=0; for(int i=1;i<=n;++i) { num+=a[i]; } cout<<num; return 0; }
a.cc: In function 'int main()': a.cc:9:14: error: 'a' was not declared in this scope 9 | cin>>a[i]; | ^ a.cc:10:14: error: 'a' was not declared in this scope 10 | sort(a+1,a+1+m); | ^
s969510637
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans; int a[10001]; int main(){ cin>>n>>k; for(re int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(re int i=n;i>=n-k;i--) ans+=a[i]; printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 're' was not declared in this scope 10 | for(re int i=1;i<=n;i++) | ^~ a.cc:10:20: error: 'i' was not declared in this scope 10 | for(re int i=1;i<=n;i++) | ^ a.cc:13:9: error: 're' was not declared in this scope 13 | for(re int i=n;i>=n-k;i--) | ^~ a.cc:13:20: error: 'i' was not declared in this scope 13 | for(re int i=n;i>=n-k;i--) | ^
s350446013
p03658
C++
#include<bits/stdc++.h> using namespace std; int n,k,ans; int a[10001]; int main(){ cin>>n>>k; for(re int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+n+1); for(re int i=n;i>=n-k;i--) ans+=a[i]; printf("%d",ans); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 're' was not declared in this scope 10 | for(re int i=1;i<=n;i++) | ^~ a.cc:10:20: error: 'i' was not declared in this scope 10 | for(re int i=1;i<=n;i++) | ^ a.cc:13:9: error: 're' was not declared in this scope 13 | for(re int i=n;i>=n-k;i--) | ^~ a.cc:13:20: error: 'i' was not declared in this scope 13 | for(re int i=n;i>=n-k;i--) | ^
s198351307
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i=0; i<(int)(n); i++) int main(){ int n,k; cin >> n >> k; vector<int> vecn(n); //vector<int> veck(k); rep(i,n)cin >> vecn.at(i); sort(vecn.begin(),vecn.end()); reverse(vecn.begin(),vecn.end()); ans = 0; rep(i,k)ans += vecn.at(i); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | ans = 0; | ^~~ | abs
s455169749
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i=0; i<(int)(n); i++) int main(){ int n,k; cin >> n >> k; vector<int> vecn(n); //vector<int> veck(k); rep(i,n)cin >> vecn.at(i); sort(vecn.begin(),vecn.end()); reverse(vecn.begin(),vecn.end()); ans = 0; rep(i,k)ans += vecn(i); cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:3: error: 'ans' was not declared in this scope; did you mean 'abs'? 13 | ans = 0; | ^~~ | abs a.cc:14:22: error: no match for call to '(std::vector<int>) (int&)' 14 | rep(i,k)ans += vecn(i); | ~~~~^~~
s920743343
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int i,j; int N,K; int sum=0; cin>>N>>K; vector<int> num(N); for(i=0;i<N;i++){ cin>>num.at(i) } sort(num.rbegin(),num.rend()); for(j=0;j<K;j++){ sum+=num.at(j); } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:11:23: error: expected ';' before '}' token 11 | cin>>num.at(i) | ^ | ; 12 | } | ~
s620855319
p03658
C++
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cstring> #include <cmath> #include <climits> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <array> #include <bitset> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <unordered_map> #include <unordered_set> using namespace std; #define io() ios_base::sync_with_stdio(false); cin.tie(nullptr) #define ll long long #define ull unsigned long long #define ui unsigned int #define us unsigned short #define fi first #define se second #define IN(i,l,r) (l<i&&i<r) #define LINR(i,l,r) (l<=i&&i<=r) #define LIN(i,l,r) (l<=i&&i<r) #define INR(i,l,r) (l<i&&i<=r) #define v(T) vector<T> #define p(T, N) pair<T, N> #define ii p(int, int) #define vi v(int) #define vii v(p(int, int)) #define vvi v(v(int)) #define vl v(long long) #define vll v(p(long long, long long)) #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() #define qsort(a) sort(all(a)) #define qsortd(a) sort(all(a), greater<>()) #define qsortf(a, f) sort(all(a), f) #define qsortsi(v) sort(v.begin(), v.end(), [](pair<int, int> aoeui, pair<int, int> boeui){return aoeui.se < boeui.se;}) #define pb(n) push_back(n) #define eb(n) emplace_back(n) #define pp(a, b) emplace_back(make_pair(a, b)) #define elif else if #define fori(i, n) for(ll i = 0; i < n; i++) #define foris(i, a, b) for(ll i = a; i < b; i++) #define forise(i, a, b) for(ll i = a; i <= b; i++) #define ford(i, n) for(ll i = n; i >= 0; i--) #define fords(i, a, b) for(ll i = a; i >= b; i--) #define fordse(i, a, b) for(ll i = a; i > b; i--) #define forr(i, a) for (auto &i: a) #define rev(a) reverse(a.begin(), a.end()) #define revf(a, b, c) (reverse(a.begin() + b, a.begin() + c)) #define digits(i) (int)((log(i)/(log(10))+1) #define umap unordered_map #define nl '\n' #define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout) const int mod = 1000000007; int N, K; vi arr; int main() { io(); cin >> N >> K; fori(i, N) { int a; cin >> a; arr.pb(a); } qsortd(a); int ret = 0; fori(i, K) { ret += arr[i]; } cout << ret; return 0; }
a.cc: In function 'int main()': a.cc:87:10: error: 'a' was not declared in this scope 87 | qsortd(a); | ^ a.cc:50:16: note: in definition of macro 'all' 50 | #define all(a) a.begin(), a.end() | ^ a.cc:87:3: note: in expansion of macro 'qsortd' 87 | qsortd(a); | ^~~~~~
s579172872
p03658
C++
#include<bits/stdc++.h> #include<bitset> using namespace std; #define M 1000000007 #define pb push_back #define f first #define s second #define rep(i, st, ed) for(int i=st; i<ed; i++) #define repn(i, st, ed) for(int i=st; i<=ed; i++) #define repb(i, ed, st) for(int i=ed; i>=st; i--) typedef long long ll; typedef unsigned long long int llt; typedef long double ld; const long double PI =3.141592653589793238463; const int N = 5e5 + 10; const ll INF = 1LL << 60; template<class T> void chmax(T &a,T b) { if (a<b) a=b;} template<class T> void chmin(T &a,T b) { if (a>b) a=b;} vector<int> g[N]; bool viss[N]; int vis[N]; // Normal DFS void dfs(int curr, int par) { for(auto x: g[curr]) if(x != par) dfs(x, curr); } // DFS with visiting status void dfs1(int curr, int par) { viss[curr] = 1; for(auto x: g[curr]) if(!viss[x]) dfs1(x, curr); } // DFS with strongly connected component void dfs2(int curr, int par, int num) { vis[curr] = num; for(auto x: g[curr]) if(vis[x] == 0) dfs2(x, curr, num); } // XOR from 0 to n ll fxor(ll n) { if(n < 0) return 0; if(n % 4 == 3) return 0; else if(n % 4 == 0) return n; else if(n % 4 == 1) return n^(n-1); else if(n%4 == 2) return n^(n-1)^(n-2); } // Power in logn with mod 1000000007 llt ppow(llt x, llt y) { llt res = 1; while(y > 0){ if(y&1) res = (res * x)%M; y = y >> 1; x = (x * x)%M; } return res; } // Factorial with dp llt factdp[N]; llt fact(llt x) { if(x == 0) return 1; if(x == 1) return 1; if(factdp[x] != 0) return factdp[x]; return factdp[x] = (x*fact(x-1))%M; } // Combination ll modcomb(ll n, ll r) { if(n < r) return 0; ll res = fact(n); (res *= ppow(fact(r), M-2)) %= M; (res *= ppow(fact(n-r), M-2)) %= M; return res; } // String return to base b string ansConv =""; void convert10tob(llt N, int b) { if (N == 0) return; int x = N % b; N /= b; if (x < 0) N += 1; convert10tob(N, b); ansConv += to_string(x); return; } // Convert string to num wiht base b llt convertstrtob(string a, int b) { llt aa = 0; llt mul = 1; for(int i=a.length()-1; i>=0; i--) { int curr = a[i] - '0'; aa += (curr * mul); mul *= b; } return aa; } // Union Find // Find() int parent[N], ran[N]; int find(int x) { if(parent[x]==x)return x; else return parent[x]=find(parent[x]); } // Union() void unite(int x,int y){ x=find(x); y=find(y); if(x==y)return; if(ran[x]<ran[y]) parent[x]=y; else{ parent[y]=x; if(ran[x]==ran[y])ran[x]++; } } // Main Code int main() { int n, k; cin>>n>>k; int arr[n]; rep(i, 0, n) cin>>arr[i]; sort(arr, arr+n, greater<int>()); int ans = 0; rep(i, 0, k) sum += arr[i]; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:159:15: error: 'sum' was not declared in this scope 159 | rep(i, 0, k) sum += arr[i]; | ^~~ a.cc: In function 'll fxor(ll)': a.cc:64:1: warning: control reaches end of non-void function [-Wreturn-type] 64 | } | ^
s675936087
p03658
C++
#include<bit/stdc++.h> using namespace std; main(){ int n,k; cin>>n>>k; long ans=0; vector<long>a(n); for(int i=0;i<n;++i)cin>>a[i]; sort(begin(a),end(a),greater<>()); for(int i=0;i<k;++i){ ans+=a[i]; } cout<<ans<<endl; }
a.cc:1:9: fatal error: bit/stdc++.h: No such file or directory 1 | #include<bit/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s270321840
p03658
C++
#include<bits/stdc++.h> using namespace std; int main() { int N,K,sum; vector<int> vec[N]; for (int i=0; i<N; i++){ cin >> vec.at(i); } sort (vec.begin(),vec.end()); reverse (vec.begin(),vec.end()); for (int i=0; i<K; i++){ sum += vec.at(i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:16: error: request for member 'at' in 'vec', which is of non-class type 'std::vector<int> [N]' 10 | cin >> vec.at(i); | ^~ a.cc:13:13: error: request for member 'begin' in 'vec', which is of non-class type 'std::vector<int> [N]' 13 | sort (vec.begin(),vec.end()); | ^~~~~ a.cc:13:25: error: request for member 'end' in 'vec', which is of non-class type 'std::vector<int> [N]' 13 | sort (vec.begin(),vec.end()); | ^~~ a.cc:14:16: error: request for member 'begin' in 'vec', which is of non-class type 'std::vector<int> [N]' 14 | reverse (vec.begin(),vec.end()); | ^~~~~ a.cc:14:28: error: request for member 'end' in 'vec', which is of non-class type 'std::vector<int> [N]' 14 | reverse (vec.begin(),vec.end()); | ^~~ a.cc:17:16: error: request for member 'at' in 'vec', which is of non-class type 'std::vector<int> [N]' 17 | sum += vec.at(i); | ^~
s083295817
p03658
C++
#include<bits/stdc++.h> using namespace std; int main() { int N,K,sum; vector<int> vec[N]; for (int i=0; i<N; i++){ cin >> vec[i]; } sort (vec.begin(),vec.end()); reverse (vec.begin(),vec.end()); for (int i=0; i<K; i++){ sum += vec[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 10 | cin >> vec[i]; | ~~~ ^~ ~~~~~~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /u
s127917463
p03658
C++
#include<iostream> #include<cstdio> using namespace std; int main() { int n,k,a[10001],sym=0; 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:22:9: error: 'sum' was not declared in this scope; did you mean 'sym'? 22 | sum+=a[i]; | ^~~ | sym a.cc:24:11: error: 'sum' was not declared in this scope; did you mean 'sym'? 24 | cout<<sum<<endl; | ^~~ | sym
s379768722
p03658
C++
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; int n,k,ans; int a[50+10]; int main() { cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); for(int i=n;i>=n-k+1;i--)a ans+=a[i]; cout<<ans<<"\n"; return 0; }
a.cc: In function 'int main()': a.cc:14:35: error: expected ';' before 'ans' 14 | for(int i=n;i>=n-k+1;i--)a | ^ | ; 15 | ans+=a[i]; | ~~~
s094733962
p03658
C
#include <stdio.h> int n; void merge_sort (int array[], int left, int right) { int i, j, k, mid; int work[n]; if (left < right) { mid = (left + right)/2; merge_sort(array, left, mid); merge_sort(array, mid+1, right); for (i = mid; i >= left; i--) { work[i] = array[i]; } for (j = mid+1; j <= right; j++) { work[right-(j-(mid+1))] = array[j]; } i = left; j = right; for (k = left; k <= right; k++) { if (work[i] < work[j]) { array[k] = work[i++]; } else { array[k] = work[j--]; } } } } int main(void){ int k; scanf("%d%d",&n,&k); int arr[n]; for(int i=0;i<n;i++)scanf("%d",&arr[i]); merge_sort(arr,0,n-1); int ans=0; for(int i=n-1;i>=n-k;i-=1){ ans+=arr[i]; } printf(“%d\n”,ans); }
main.c: In function 'main': main.c:31:8: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:31:9: error: expected expression before '%' token 31 | printf(“%d\n”,ans); | ^ main.c:31:11: error: stray '\' in program 31 | printf(“%d\n”,ans); | ^ main.c:31:13: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~
s125907663
p03658
C
#include <stdio.h> int n; void merge_sort (int array[], int left, int right) { int i, j, k, mid; int work[n]; if (left < right) { mid = (left + right)/2; merge_sort(array, left, mid); merge_sort(array, mid+1, right); for (i = mid; i >= left; i--) { work[i] = array[i]; } for (j = mid+1; j <= right; j++) { work[right-(j-(mid+1))] = array[j]; } i = left; j = right; for (k = left; k <= right; k++) { if (work[i] < work[j]) { array[k] = work[i++]; } else { array[k] = work[j--]; } } } } int main(void){ int k; scanf(“%d%d”,&n,&k); int arr[n]; for(int i=0;i<n;i++)scanf(“%d”,&arr[i]); merge_sort(arr,0,n-1); int ans=0 for(int i=n-1;i>=n-k;i-=1){ ans+=arr[i]; } printf(“%d\n”,ans); }
main.c: In function 'main': main.c:23:7: error: stray '\342' in program 23 | scanf(<U+201C>%d%d<U+201D>,&n,&k); | ^~~~~~~~ main.c:23:8: error: expected expression before '%' token 23 | scanf(“%d%d”,&n,&k); | ^ main.c:23:12: error: stray '\342' in program 23 | scanf(<U+201C>%d%d<U+201D>,&n,&k); | ^~~~~~~~ main.c:25:27: error: stray '\342' in program 25 | for(int i=0;i<n;i++)scanf(<U+201C>%d<U+201D>,&arr[i]); | ^~~~~~~~ main.c:25:28: error: expected expression before '%' token 25 | for(int i=0;i<n;i++)scanf(“%d”,&arr[i]); | ^ main.c:25:30: error: stray '\342' in program 25 | for(int i=0;i<n;i++)scanf(<U+201C>%d<U+201D>,&arr[i]); | ^~~~~~~~ main.c:28:1: error: expected ',' or ';' before 'for' 28 | for(int i=n-1;i>=n-k;i-=1){ | ^~~ main.c:28:15: error: 'i' undeclared (first use in this function) 28 | for(int i=n-1;i>=n-k;i-=1){ | ^ main.c:28:15: note: each undeclared identifier is reported only once for each function it appears in main.c:28:26: error: expected ';' before ')' token 28 | for(int i=n-1;i>=n-k;i-=1){ | ^ | ; main.c:28:26: error: expected statement before ')' token main.c:31:8: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~ main.c:31:9: error: expected expression before '%' token 31 | printf(“%d\n”,ans); | ^ main.c:31:11: error: stray '\' in program 31 | printf(“%d\n”,ans); | ^ main.c:31:13: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,ans); | ^~~~~~~~
s958232953
p03658
C++
#include <bits/stdc++.h> using namespace std; int main() { int a,b; cin >> a>>b; int c[100]; for (int i =0;i<a; i++) cin >> c[i]; sort(c,c+a); for(int i=a-1; i >a-1-b ; i--){ int d =0; d += c[i]; } cout << d << endl; return 0; }
a.cc: In function 'int main()': a.cc:18:14: error: 'd' was not declared in this scope 18 | cout << d << endl; | ^
s318474489
p03658
C++
#include<bits/stdc++.h> using namespace std; int l[100001] int main(){ int n,k,j,i; double s=0; cin>>n>>k; for(i=1;i<=n;i++){ cin>>l[i]; } sort(l+1,l+1+n) for(int i=1;j>=n-k+1;j--){ s=s+a[i]; } cout<<s<<endl; return 0; }
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s924804874
p03658
C++
#include<bits/stdc++.h> using namespace std; int l[100001] int main(){ int n,k,j; double s=0; cin>>n>>k; for(int i=1;i<=n;i++){ cin>>l[i]; } sort(l+1,l+1+n) for(j=1;j>=n-k+1;j--){ s=s+a[j]; } cout<<s<<endl; return 0; }
a.cc:4:1: error: expected initializer before 'int' 4 | int main(){ | ^~~
s718692929
p03658
C++
https://atcoder.jp/contests/abc067/tasks/abc067_b// https://atcoder.jp/contests/abc067/tasks/abc067_b #include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define REP(i, n) FOR(i, 0, n) #define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i) #define ALL(obj) (obj).begin(), (obj).end() #define ALLR(obj) (obj).rbegin(), (obj).rend() int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector<int> v(n); REP(i, n) cin >> v[i]; sort(ALLR(v)); int sum = 0; REP(i, 3) sum += v[i]; cout << sum << endl; return 0; }
a.cc:1:1: error: 'https' does not name a type 1 | https://atcoder.jp/contests/abc067/tasks/abc067_b// https://atcoder.jp/contests/abc067/tasks/abc067_b | ^~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | _
s610608267
p03658
C++
#include <iostream> #include <vector> 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()); reverse(l.begin(),l.end()); int ans=0; for(int i=0;i<k;i++){ ans+=l[i]; } cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(l.begin(),l.end()); | ^~~~ | short a.cc:15:3: error: 'reverse' was not declared in this scope 15 | reverse(l.begin(),l.end()); | ^~~~~~~
s665163920
p03658
C++
#include <iostream> #include <vector> 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()); reverse(l.begin(),l.end()); int ans=0; for(int i=0;i<k;i++){ ans+=l[i]; } cout << ans <<endl; }
a.cc: In function 'int main()': a.cc:14:3: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(l.begin(),l.end()); | ^~~~ | short a.cc:15:3: error: 'reverse' was not declared in this scope 15 | reverse(l.begin(),l.end()); | ^~~~~~~
s144019547
p03658
C++
#include <bits/stdc++.h> #include <cstdlib> // abs() for integer 絶対値求めやつ #include <cmath> // abs() for float, and fabs() #include <algorithm> #include <vector> #include <string> #define rep(i,n) for(int i = 0; i < (n);i++) #define sort(a) sort((a).begin(),(a).end()) #define rev(a) reverse((a).begin(),(a).end()) using namespace std; #define inf 2000000000 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; } #define che(a,string) cout<<"//"<<string <<"=="<<(a)<<"//" <<endl; int n,k; int main(){ cin >> n >> k ; int a[n]; rep(i,n){ cin>>a[i]; } sort(a,a+n); int ans = 0; int count = 0; for(int i = n-1; i>=0; i--){ count++; ans+=a[i]; if(count==k){ break; } } cout<<ans<<endl; }
a.cc:23:19: error: macro "sort" passed 2 arguments, but takes just 1 23 | sort(a,a+n); | ^ a.cc:8:9: note: macro "sort" defined here 8 | #define sort(a) sort((a).begin(),(a).end()) | ^~~~ a.cc: In function 'int main()': a.cc:23:20: error: statement cannot resolve address of overloaded function 23 | sort(a,a+n); | ^
s330869606
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) typedef long long ll; 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()) reverse(l.begin(), l.end()) int cnt = 0; for (int i = 0; i < K; i++){ cnt += l[i] } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:14:29: error: expected ';' before 'reverse' 14 | sort(l.begin(), l.end()) | ^ | ; 15 | reverse(l.begin(), l.end()) | ~~~~~~~ a.cc:18:9: error: 'cnt' was not declared in this scope; did you mean 'int'? 18 | cnt += l[i] | ^~~ | int a.cc:20:13: error: 'cnt' was not declared in this scope; did you mean 'int'? 20 | cout << cnt << endl; | ^~~ | int
s690962317
p03658
C++
#include <bits/stdc++.h> int main(void) { int n, k, l[100]; cin >> n >> k; rep(i, n) cin >> l[i]; sort(l, l + n); int ans = 0; rep(i, k) ans += l[n - 1 - i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | 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:6:7: error: 'i' was not declared in this scope 6 | rep(i, n) cin >> l[i]; | ^ a.cc:6:3: error: 'rep' was not declared in this scope 6 | rep(i, n) cin >> l[i]; | ^~~ a.cc:8:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 8 | sort(l, l + n); | ^~~~ | 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:13:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 13 | 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:13:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 13 | 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) | ^~~~
s665894314
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,i,j,k,sum=0; cin>>n>>k; int a[n+1]; for(i=1;i<=n;i++){ cin>>a[i]; } sort(a+1;a+n+1); for(i=n;i>=(n-k);i--){ sum+=a[i]; } cout<<a[i]; return 0; }
a.cc: In function 'int main()': a.cc:11:17: error: expected ')' before ';' token 11 | sort(a+1;a+n+1); | ~ ^ | ) a.cc:11:23: error: expected ';' before ')' token 11 | sort(a+1;a+n+1); | ^ | ;
s996576281
p03658
C++
#include<bits/stdc++.h> using namespace std; int a[10001]; int main(){ int ans=0; int n,k; cin>>n>>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } sort(a+1,a+1+n); for(int i=1;i<=k;i++) { ans=ans+a[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:17: error: expected primary-expression before '>' token 7 | cin>>n>>>k; | ^
s673426521
p03658
C++
#include<bits/stdc++.h> using namespace std; int a[10001]; int main(){ int ans=0; int n,k; cin>>n>>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } swap(a+1,a+1+n); for(int i=1;i<=k;i++) { ans=ans+a[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:7:17: error: expected primary-expression before '>' token 7 | cin>>n>>>k; | ^ a.cc:13:13: error: no matching function for call to 'swap(int*, int*)' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ 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, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:13:21: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*' 13 | swap(a+1,a+1+n); | ~~~^~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:13:21: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 13 | swap(a+1,a+1+n); | ~~~^~ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int*; _VTp = int*; _Mgr = _Manager_internal<int*>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, 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/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'int*' to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included 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/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types '_Tp [_Nm]' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*' 13 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ 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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' 2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) | ^~~~ /usr/include/c++/14/tuple:2805:5: note: template argument deduction/substitution failed: a.cc:13:13: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*' 13 |
s920090312
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int ans=0; int n,k; cin>>n>>>k; int a[10001]; for(int i=1;i<=n;i++) { cin>>a[i]; } swap(a+1,a+1+n); for(int i=1;i<=k;i++) { ans=ans+a[i]; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:6:17: error: expected primary-expression before '>' token 6 | cin>>n>>>k; | ^ a.cc:12:13: error: no matching function for call to 'swap(int*, int*)' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ 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, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/move.h:226:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = int*; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match) 226 | swap(_Tp& __a, _Tp& __b) | ^~~~ /usr/include/c++/14/bits/move.h:226:5: note: conversion of argument 2 would be ill-formed: a.cc:12:21: error: cannot bind non-const lvalue reference of type 'int*&' to an rvalue of type 'int*' 12 | swap(a+1,a+1+n); | ~~~^~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:77: /usr/include/c++/14/any:430:15: note: candidate: 'void std::swap(any&, any&)' (near match) 430 | inline void swap(any& __x, any& __y) noexcept { __x.swap(__y); } | ^~~~ /usr/include/c++/14/any:430:15: note: conversion of argument 2 would be ill-formed: a.cc:12:21: error: cannot bind non-const lvalue reference of type 'std::any&' to an rvalue of type 'std::any' 12 | swap(a+1,a+1+n); | ~~~^~ /usr/include/c++/14/any:191:7: note: after user-defined conversion: 'std::any::any(_Tp&&) [with _Tp = int*; _VTp = int*; _Mgr = _Manager_internal<int*>; typename std::enable_if<(is_copy_constructible_v<_VTp> && (! __is_in_place_type_v<_VTp>)), bool>::type <anonymous> = true]' 191 | any(_Tp&& __value) | ^~~ In file included from /usr/include/c++/14/exception:166, from /usr/include/c++/14/stdexcept:38, from /usr/include/c++/14/system_error:43, 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/bits/exception_ptr.h:229:5: note: candidate: 'void std::__exception_ptr::swap(exception_ptr&, exception_ptr&)' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ^~~~ /usr/include/c++/14/bits/exception_ptr.h:229:25: note: no known conversion for argument 1 from 'int*' to 'std::__exception_ptr::exception_ptr&' 229 | swap(exception_ptr& __lhs, exception_ptr& __rhs) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/14/future:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:176: /usr/include/c++/14/bits/std_thread.h:328:3: note: candidate: 'void std::swap(thread&, thread&)' 328 | swap(thread& __x, thread& __y) noexcept | ^~~~ /usr/include/c++/14/bits/std_thread.h:328:16: note: no known conversion for argument 1 from 'int*' to 'std::thread&' 328 | swap(thread& __x, thread& __y) noexcept | ~~~~~~~~^~~ In file included 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/sstream:1204:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringbuf<_CharT, _Traits, _Alloc>&, basic_stringbuf<_CharT, _Traits, _Alloc>&)' 1204 | swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1204:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1212:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_istringstream<_CharT, _Traits, _Allocator>&, basic_istringstream<_CharT, _Traits, _Allocator>&)' 1212 | swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1212:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_istringstream<_CharT, _Traits, _Allocator>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1219:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_ostringstream<_CharT, _Traits, _Allocator>&, basic_ostringstream<_CharT, _Traits, _Allocator>&)' 1219 | swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1219:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_ostringstream<_CharT, _Traits, _Allocator>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/sstream:1226:5: note: candidate: 'template<class _CharT, class _Traits, class _Allocator> void std::__cxx11::swap(basic_stringstream<_CharT, _Traits, _Allocator>&, basic_stringstream<_CharT, _Traits, _Allocator>&)' 1226 | swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, | ^~~~ /usr/include/c++/14/sstream:1226:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_stringstream<_CharT, _Traits, _Allocator>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181: /usr/include/c++/14/bits/regex.h:896:5: note: candidate: 'template<class _Ch_type, class _Rx_traits> void std::__cxx11::swap(basic_regex<_Ch_type, _Rx_traits>&, basic_regex<_Ch_type, _Rx_traits>&)' 896 | swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:896:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_regex<_Ch_type, _Rx_traits>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: candidate: 'template<class _Bi_iter, class _Alloc> void std::__cxx11::swap(match_results<_BiIter, _Alloc>&, match_results<_BiIter, _Alloc>&)' 2230 | swap(match_results<_Bi_iter, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/regex.h:2230:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::match_results<_BiIter, _Alloc>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/move.h:250:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<((bool)std::__is_swappable<_Tp>::value)> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])' 250 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /usr/include/c++/14/bits/move.h:250:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types '_Tp [_Nm]' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' 1089 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1089:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: candidate: 'template<class _T1, class _T2> typename std::enable_if<(! std::__and_<std::__is_swappable<_T1>, std::__is_swappable<_T2> >::value)>::type std::swap(pair<_T1, _T2>&, pair<_T1, _T2>&)' (deleted) 1106 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /usr/include/c++/14/bits/stl_pair.h:1106:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::pair<_T1, _T2>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:4039:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> void std::swap(__cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4039 | swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~ /usr/include/c++/14/bits/basic_string.h:4039:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int*' 12 | swap(a+1,a+1+n); | ~~~~^~~~~~~~~~~ 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:2805:5: note: candidate: 'template<class ... _Elements> typename std::enable_if<std::__and_<std::__is_swappable<_Elements>...>::value>::type std::swap(tuple<_UTypes ...>&, tuple<_UTypes ...>&)' 2805 | swap(tuple<_Elements...>& __x, tuple<_Elements...>& __y) | ^~~~ /usr/include/c++/14/tuple:2805:5: note: template argument deduction/substitution failed: a.cc:12:13: note: mismatched types 'std::tuple<_UTypes ...>' and 'int*' 12 |
s985633934
p03658
C++
#include <bis/stdc++.h> using namespace std; int main() { priority_queue<int> l; int n,k; cin >> n >> k; int ll; for(int i = 0;i < n;i++) { cin >> ll; l.push(ll); } int sum = 0; for(int i = 0;i < k;i++) { sum += l.top(); l.pop(); } cout << sum << endl; }
a.cc:1:10: fatal error: bis/stdc++.h: No such file or directory 1 | #include <bis/stdc++.h> | ^~~~~~~~~~~~~~ compilation terminated.
s695919460
p03658
C++
#include<iostream> 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++){ sum+=l[i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:6:3: error: 'sort' was not declared in this scope; did you mean 'short'? 6 | sort(l, l+n, greater<int>()); | ^~~~ | short
s408094656
p03658
C++
#include<bits/stdc++.h> #include<algorithm> #include<math.h> #include<iostream> using namespace std; long long int lcm(long long int a,long long int b){ long long int n; n=a*b/__gcd(a,b); return n; } using ll =long long int; #define ci(a) cin>>a #define co(a) cout<<a<<endl #define gcd(a,b) __gcd(a,b) #define vec vector<ll> #define for(i,a,b) for(int i=a;i<b;i++) #define sort(a,b) sort(a.begin(),b.end()) //gcd 最大公約数 //lcm 最小公倍数 //double 少数(変数) //string 文字列(変数) //sqrt 平方根 //ceil 天井関数 //floor 床関数 //abs 絶対値 //pow 累乗 //cbrt 立方根 //hypot 平方和の平方根 //(string-'0') 文字列を数字に変換 //vector<vector<int>> data(a,vector<b>(b)) a×b行列 //for(int i=0;i<a;i++) //for(int j=0;j<b;j++) //cin>>data.at(i).at(j) a×b行列の入力 //floor(log10(a)+1) aの10進法での桁数 int main() { ll a,b; ci(a>>b); vec c(a); for(i,0,a) ci(c[i]); sort(c,c); ll d=0; for(int i=a-1;i>a-1-b;i--) d+=c[i]; co(d); }
a.cc:44:28: error: macro "for" requires 3 arguments, but only 1 given 44 | for(int i=a-1;i>a-1-b;i--) | ^ a.cc:16:9: note: macro "for" defined here 16 | #define for(i,a,b) for(int i=a;i<b;i++) | ^~~ a.cc: In function 'int main()': a.cc:45:5: error: expected '(' before 'd' 45 | d+=c[i]; | ^ | ( a.cc:45:10: error: 'i' was not declared in this scope 45 | d+=c[i]; | ^ a.cc:47:3: error: expected primary-expression before '}' token 47 | } | ^ a.cc:46:9: error: expected ')' before '}' token 46 | co(d); | ^ | ) 47 | } | ~ a.cc:45:5: note: to match this '(' 45 | d+=c[i]; | ^ a.cc:47:3: error: expected primary-expression before '}' token 47 | } | ^
s148126399
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() int main() { cin.tie(0); ios::sync_with_stdio(false); // start int n, k, res = 0; cin >> n >> k; vector<int> l(n); rep(i, n) cin >> l.at(i); reverse(sort(all(l))); rep(i, k) res += l.at(i); cout << res << endl; // end return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: invalid use of void expression 17 | reverse(sort(all(l))); | ~~~~^~~~~~~~
s923146428
p03658
C++
#include <bits/stdc++.h> using namespace std; int main() { int N, K; int T = 0; cin >> N >> K; vector<int> S(N); cin >> S; sort(S.begin(), S.end()); reverse(S.begin(),S.end()); for(int i = 0; i < K; i++){ T = S.at(i) + T; } cout << T; }
a.cc: In function 'int main()': a.cc:9:5: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 9 | cin >> S; | ~~~ ^~ ~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:131:5: note: ca
s450813494
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int N,K;cin>>N>>K; int L[55]; for (int i=0;i<N;++i){ cin>>L[i]; } 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; }
a.cc: In function 'int main()': a.cc:11:10: error: request for member 'begin' in 'L', which is of non-class type 'int [55]' 11 | sort(L.begin(),L.end()); | ^~~~~ a.cc:11:20: error: request for member 'end' in 'L', which is of non-class type 'int [55]' 11 | sort(L.begin(),L.end()); | ^~~ a.cc:12:13: error: request for member 'begin' in 'L', which is of non-class type 'int [55]' 12 | reverse(L.begin(),L.end()); | ^~~~~ a.cc:12:23: error: request for member 'end' in 'L', which is of non-class type 'int [55]' 12 | reverse(L.begin(),L.end()); | ^~~
s105691651
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int N,K;cin>>N>>K; int L(50); for (int i=0;i<N;++i){ cin>>L[i]; } 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; }
a.cc: In function 'int main()': a.cc:9:11: error: invalid types 'int[int]' for array subscript 9 | cin>>L[i]; | ^ a.cc:11:10: error: request for member 'begin' in 'L', which is of non-class type 'int' 11 | sort(L.begin(),L.end()); | ^~~~~ a.cc:11:20: error: request for member 'end' in 'L', which is of non-class type 'int' 11 | sort(L.begin(),L.end()); | ^~~ a.cc:12:13: error: request for member 'begin' in 'L', which is of non-class type 'int' 12 | reverse(L.begin(),L.end()); | ^~~~~ a.cc:12:23: error: request for member 'end' in 'L', which is of non-class type 'int' 12 | reverse(L.begin(),L.end()); | ^~~ a.cc:15:11: error: invalid types 'int[int]' for array subscript 15 | ans+=L[i]; | ^
s771691514
p03658
Java
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] sticks = new int[n]; for (int i = 0; i < sticks.length; i++) { sticks[i] = sc.nextInt(); } Arrays.sort(sticks[i]); int res = 0; int pos = sticks.length - 1; while (k >= 0) { res += sticks[pos]; k--; pos--; } System.out.println(res); } }
Main.java:12: error: cannot find symbol Arrays.sort(sticks[i]); ^ symbol: variable i location: class Main Main.java:12: error: no suitable method found for sort(int) Arrays.sort(sticks[i]); ^ method Arrays.sort(int[]) is not applicable (argument mismatch; int cannot be converted to int[]) method Arrays.sort(long[]) is not applicable (argument mismatch; int cannot be converted to long[]) method Arrays.sort(short[]) is not applicable (argument mismatch; int cannot be converted to short[]) method Arrays.sort(char[]) is not applicable (argument mismatch; int cannot be converted to char[]) method Arrays.sort(byte[]) is not applicable (argument mismatch; int cannot be converted to byte[]) method Arrays.sort(float[]) is not applicable (argument mismatch; int cannot be converted to float[]) method Arrays.sort(double[]) is not applicable (argument mismatch; int cannot be converted to double[]) method Arrays.sort(Object[]) is not applicable (argument mismatch; int cannot be converted to Object[]) method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable (cannot infer type-variable(s) T#1 (actual and formal argument lists differ in length)) 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 2 errors
s422364243
p03658
C++
#include<bits/stdc++.h> #define rep(i,a,n) for(int i=a;i<n;i++) using namespace std; int main(){ int N,K; cin >>N>>K; vector<int> l(N); rep(i,0,N) cin >>l.at(i); l.sort(l.begin(),l.end(),greater<int>()); int ans = 0; rep(i,0,K) ans += l.at(i); cout <<ans<< endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'class std::vector<int>' has no member named 'sort' 12 | l.sort(l.begin(),l.end(),greater<int>()); | ^~~~
s870201262
p03658
C++
#include<iostream> #include<string> #include<vector> #include<cmath> #include<queue> #include<algorithm> using namespace std; #define ll long long int main(void){ int n,k; cin >> n >> k; vector<int>l(n); for(int i=0;i<n;i++) cin >> l[i]; sort(l.rbegin(),l.rend()); cout << accumulate(l.begin(),l.begin()+k,0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'accumulate' was not declared in this scope 17 | cout << accumulate(l.begin(),l.begin()+k,0) << endl; | ^~~~~~~~~~
s268127698
p03658
C++
#include<iostream> #include<string> #include<vector> #include<cmath> #include<queue> using namespace std; #define ll long long int main(void){ int n,k; cin >> n >> k; vector<int>l(n); for(int i=0;i<n;i++) cin >> l[i]; sort(l.rbegin(),l.rend()); cout << accumulate(l.begin(),l.begin()+k,0) << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 15 | sort(l.rbegin(),l.rend()); | ^~~~ | sqrt a.cc:16:17: error: 'accumulate' was not declared in this scope 16 | cout << accumulate(l.begin(),l.begin()+k,0) << endl; | ^~~~~~~~~~
s374488632
p03658
C++
#include<iostream> #include<string> #include <vector> #include<algorithm> #include<cmath> #include<iomanip> using namespace std; using vi = vector<int>; using vii = vector<vi>; using pii = pair<int, int>; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define vsort(v) sort(v.begin(), v.end()) #define rv(v) reverse(v.begin(), v.end()) #define ll long long const ll MOD = 1e9 + 7; int main() { int n, k; cin >> n >> k; vi l(n); rep(i, n) cin >> l[i]; vsort(l); rv(l); int sum = 0; rep(i, k) sum += a[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:25:26: error: 'a' was not declared in this scope 25 | rep(i, k) sum += a[i]; | ^
s566227527
p03658
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] l = new int[n]; int sum = 0; for(int i = 0;i < n;i++) l[i] = sc.nextInt(); arrays.sort(l); for(int i = n-1;i>=n-k;i--) sum += l[i]; System.out.println(sum); } }
Main.java:10: error: cannot find symbol arrays.sort(l); ^ symbol: variable arrays location: class Main 1 error
s853818980
p03658
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ int n, k; int sum = 0; cin >> n >> k; vector<int> v(n); for(int i = 0; i < n; i++) { int l; cin >> l; v[i] = l; } v.sort(v.begin(), v.end()); for(int i = n - 1; i >= (n-k); i--) { sum += v[i]; } cout << sum; return 0; }
a.cc: In function 'int main()': a.cc:16:11: error: 'class std::vector<int>' has no member named 'sort' 16 | v.sort(v.begin(), v.end()); | ^~~~
s316506849
p03658
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N, K; cin >> N >> K; vector<int> l(N); rep(i, N) cin >> l[i]; sort(l.begin(), l.end()); int sum = 0; rei(i, K) sum += l[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:12:13: error: 'i' was not declared in this scope 12 | rei(i, K) sum += l[i]; | ^ a.cc:12:9: error: 'rei' was not declared in this scope; did you mean 'rep'? 12 | rei(i, K) sum += l[i]; | ^~~ | rep
s942793608
p03658
C++
#include <iostream> using namespace std; int main(){ int N, K; cin >> N >> K; int a[50]; int ans = 0; for (int i = 0; i < N; i++) cin >> a[i]; sort (a, a + N, greater<int>()); for (int i = 0; i < K; i++) ans += a[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort (a, a + N, greater<int>()); | ^~~~ | short
s307873827
p03658
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N, K; cin >> N >> K; vector<int> V(N); for(int i = 0; i < N; i++){ cin >> V[i]; } sort(v.begin(), V.end()); int ans = 0; for(int i = 0; i < K; i++){ ans += V[N-1-i]; } cout << ans; }
a.cc: In function 'int main()': a.cc:17:8: error: 'v' was not declared in this scope 17 | sort(v.begin(), V.end()); | ^
s512055093
p03658
C++
#include <isotream> #include <vector> #include <algorithm> using namespace std; int main(){ int N, K; cin >> N >> K; vector<int> V(N); for(int i = 0; i < N; i++){ cin >> V[i]; } sort(v.begin(), V.end()); int ans = 0; for(int i = 0; i < K; i++){ ans += V[N-1-i]; } cout << ans; }
a.cc:1:10: fatal error: isotream: No such file or directory 1 | #include <isotream> | ^~~~~~~~~~ compilation terminated.
s254618849
p03658
C++
SnakeToy.cpp
a.cc:1:1: error: 'SnakeToy' does not name a type 1 | SnakeToy.cpp | ^~~~~~~~
s800377662
p03658
C++
#include<iostream> #include<algorithm> #include<map> map<int,int> a; using namespace std; int main() { int n,k; int sum=0; cin>>n>>k; for(int i=1;i<=n;i++) cin>>a[i]; sort(a+1,a+1+n); for(int i=1;i<=k;i++) sum+=a[i]; cout<<sum<<'\n'; return 0; }
a.cc:4:1: error: 'map' does not name a type 4 | map<int,int> a; | ^~~ a.cc: In function 'int main()': a.cc:11:32: error: 'a' was not declared in this scope 11 | for(int i=1;i<=n;i++) cin>>a[i]; | ^ a.cc:12:10: error: 'a' was not declared in this scope 12 | sort(a+1,a+1+n); | ^
s534471880
p03658
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<(int)(n);i++) #define fs first #define sc second typedef pair<ll, ll> l_l; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) 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:17:17: error: no match for call to '(std::vector<int>) (int&)' 17 | rep(i,n)cin>>l(i); | ~^~~
s088096731
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,ans=0; cin >> n >> k; int s[n]; rep(i,n) cin >> l[i]; sort(s.begin(),s.end()); reverse(s.begin(),s.end()); rep (i,k) ans+=l[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:21: error: 'l' was not declared in this scope 8 | rep(i,n) cin >> l[i]; | ^ a.cc:9:12: error: request for member 'begin' in 's', which is of non-class type 'int [n]' 9 | sort(s.begin(),s.end()); | ^~~~~ a.cc:9:22: error: request for member 'end' in 's', which is of non-class type 'int [n]' 9 | sort(s.begin(),s.end()); | ^~~ a.cc:10:15: error: request for member 'begin' in 's', which is of non-class type 'int [n]' 10 | reverse(s.begin(),s.end()); | ^~~~~ a.cc:10:25: error: request for member 'end' in 's', which is of non-class type 'int [n]' 10 | reverse(s.begin(),s.end()); | ^~~ a.cc:11:20: error: 'l' was not declared in this scope 11 | rep (i,k) ans+=l[i]; | ^
s410148559
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,ans=0; cin >> n >> k; int l[n]; rep(i,n) cin >> l[i]; sort(l.begin(),l.end()); reverse(l.begin(),l.end()); rep (i,k) ans+=l[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:9:12: error: request for member 'begin' in 'l', which is of non-class type 'int [n]' 9 | sort(l.begin(),l.end()); | ^~~~~ a.cc:9:22: error: request for member 'end' in 'l', which is of non-class type 'int [n]' 9 | sort(l.begin(),l.end()); | ^~~ a.cc:10:15: error: request for member 'begin' in 'l', which is of non-class type 'int [n]' 10 | reverse(l.begin(),l.end()); | ^~~~~ a.cc:10:25: error: request for member 'end' in 'l', which is of non-class type 'int [n]' 10 | reverse(l.begin(),l.end()); | ^~~
s834752636
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; vector<int> a(N); int sum = 0; for(int i = 0; i < N; i++) cin >> a[N]; sort(a.begin(),a.end(), greater<int>()); for(int i = 0; i < K; i++){ sum += a(i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:13: error: no match for call to '(std::vector<int>) (int&)' 13 | sum += a(i); | ~^~~
s971166076
p03658
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,k,ans = 0 cin >> n >> k; vector<int> l(n); for(int i = 0; i < n; i++){ cin >> l.at(i); } sort(l.begin(),l.end()); reverse(l.begin(),l.end()); for(int i = 0; i < k; i++){ ans += l.at(i); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:3: error: expected ',' or ';' before 'cin' 6 | cin >> n >> k; | ^~~
s355529221
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,s=0; cin>>n>>k; vector<int> l(n); for(int i=0;i<n;i++) cin>>v[i]; sort(l.begin(),l.end(),greater<int>()); for(int i=0;i<k;i++) s+=v[i]; cout<<s<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:31: error: 'v' was not declared in this scope 8 | for(int i=0;i<n;i++) cin>>v[i]; | ^ a.cc:10:29: error: 'v' was not declared in this scope 10 | for(int i=0;i<k;i++) s+=v[i]; | ^
s779873139
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n>>k; vector<int> a(n); for(int i=0;i<n;i++)cin>>a[i]; reverse(sort(a.begin(),a.end())); int sum=0; for(int i=0;i<k;i++){ sum += a[i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:8:15: error: invalid use of void expression 8 | reverse(sort(a.begin(),a.end())); | ~~~~^~~~~~~~~~~~~~~~~~~
s229738893
p03658
C++
#include <iostream> #include <string> #include <vector> int main() { unsigned int N, K; std::cin >> N >> K; std::vector<unsigned int> l(N); for (unsigned int i = 0; i < N; ++i) std::cin >> l[i]; sort(l.begin(), l.end()); reverse(l.begin(), l.end()); unsigned int res = 0; for (unsigned int i = 0; i < K; ++i) res += l[i]; std::cout << res << "\n"; 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(l.begin(), l.end()); | ^~~~ | short a.cc:13:3: error: 'reverse' was not declared in this scope 13 | reverse(l.begin(), l.end()); | ^~~~~~~
s312926003
p03658
C++
#include <iostream> #include <vector> 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>()); int len = 0; for (int i = 0; i < k; i++) { len += l[i]; } cout << len << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(l.begin(), l.end(), greater<int>()); | ^~~~ | short
s160876778
p03658
C++
#include <iostream> #include <cmath> using namespace std; int l[110]; int main(){ int N, K; cin >> N, K; for(i=0; i<N; ++i) cin >> l[i]; sort(l, l + N, greater<int>()); int sum; for(i=0; i<K; ++i){ sum += l[i] } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:7: error: 'i' was not declared in this scope 10 | for(i=0; i<N; ++i) cin >> l[i]; | ^ a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 11 | sort(l, l + N, greater<int>()); | ^~~~ | sqrt a.cc:13:7: error: 'i' was not declared in this scope 13 | for(i=0; i<K; ++i){ | ^
s666051839
p03658
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int n; int k; cin >> n >> k; int a[n]; for(int i=0;i<n;i++) { int x; cin >>x; a[i]=x; } sort(a,a+n,greater<int>()); //大きい順にソート  //何もなしだと小さい順 int total=0; for(int i=0;i<k;i++) { total+=a[i]; } cout << total << endl; return 0; }
a.cc:17:57: error: extended character   is not valid in an identifier 17 |  //何もなしだと小さい順 | ^ a.cc: In function 'int main()': a.cc:17:57: error: '\U00003000' was not declared in this scope 17 |  //何もなしだと小さい順 | ^~ a.cc:21:5: error: 'total' was not declared in this scope 21 | total+=a[i]; | ^~~~~ a.cc:23:11: error: 'total' was not declared in this scope 23 | cout << total << endl; | ^~~~~
s758645446
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.at(i); } sort(l.begin(),l.end()); int sum=0; for(int i=i.size()-1;i>l.size()-K;i++){ sum+=l.at(i); } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:15:15: error: request for member 'size' in 'i', which is of non-class type 'int' 15 | for(int i=i.size()-1;i>l.size()-K;i++){ | ^~~~
s706230701
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.at(i); } sort(l.begin(),l.end()); int sum=0: for(int i=i.size()-1;i>l.size()-k;i++){ sum+=l.at(i); } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:13:12: error: expected ',' or ';' before ':' token 13 | int sum=0: | ^ a.cc:15:24: error: 'i' was not declared in this scope 15 | for(int i=i.size()-1;i>l.size()-k;i++){ | ^ a.cc:15:35: error: 'k' was not declared in this scope 15 | for(int i=i.size()-1;i>l.size()-k;i++){ | ^
s791734967
p03658
C++
#incluide<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.at(i); } sort(l.begin(),l.end()); int sum=0: for(int i=i.size()-1;i>l.size()-k;i++){ sum+=l.at(i); } cout<<sum<<endl; }
a.cc:1:2: error: invalid preprocessing directive #incluide; did you mean #include? 1 | #incluide<bits/stdc++.h> | ^~~~~~~~ | include a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin>>N>>K; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #incluide<bits/stdc++.h> a.cc:6:3: error: 'vector' was not declared in this scope 6 | vector<int>l(N); | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | #incluide<bits/stdc++.h> a.cc:6:10: error: expected primary-expression before 'int' 6 | vector<int>l(N); | ^~~ a.cc:8:10: error: 'l' was not declared in this scope 8 | cin>>l.at(i); | ^ a.cc:11:8: error: 'l' was not declared in this scope 11 | sort(l.begin(),l.end()); | ^ a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(l.begin(),l.end()); | ^~~~ | short a.cc:13:12: error: expected ',' or ';' before ':' token 13 | int sum=0: | ^ a.cc:15:24: error: 'i' was not declared in this scope 15 | for(int i=i.size()-1;i>l.size()-k;i++){ | ^ a.cc:15:35: error: 'k' was not declared in this scope 15 | for(int i=i.size()-1;i>l.size()-k;i++){ | ^ a.cc:19:3: error: 'cout' was not declared in this scope 19 | cout<<sum<<endl; | ^~~~ a.cc:19:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:19:14: error: 'endl' was not declared in this scope 19 | cout<<sum<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #incluide<bits/stdc++.h>
s848433641
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin>>n >>k; int l[n]; cin>>l; sort(l,l+n); reverse(l,l+n); int ans=0; for(int i=0;i<k;i++){ ans+=l[i]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:6:16: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [n]') 6 | int l[n]; cin>>l; | ~~~^~~ | | | | | int [n] | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'int*' 6 | int l[n]; cin>>l; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'short int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(short int)((int*)(& l))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'short unsigned int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(short unsigned int)((int*)(& l))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(int)((int*)(& l))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'unsigned int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(unsigned int)((int*)(& l))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'long int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(long int)((int*)(& l))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'long unsigned int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(long unsigned int)((int*)(& l))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'long long int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(long long int)((int*)(& l))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: invalid conversion from 'int*' to 'long long unsigned int' [-fpermissive] 6 | int l[n]; cin>>l; | ^ | | | int* a.cc:6:18: error: cannot bind rvalue '(long long unsigned int)((int*)(& l))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:6:18: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 6 | int l[n]; cin>>l; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'int [n]' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'int [n]' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'int [n]' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'int [n]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'int [n]' to 'std::basic_istream<char>::__ios_type& (*)(std::basi
s291253075
p03658
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N,K;cin>>N>>K; vector <int> v(N); for(int a;a<N;++a) cin >> v[a]; sort(v.begin(),v.end(),[](int x, int y)->bool { return x>y; }); int ans=0; for (int i;i<K;++i){ans +=v[i] } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:33: error: expected ';' before '}' token 14 | for (int i;i<K;++i){ans +=v[i] } | ^~ | ;
s599001285
p03658
C++
#include <iostream> 2 #include <vector> 3 #include <algorithm> 4 5 using namespace std; 6 7 int main() { 8 int N, K; 9 cin >> N >> K; 10 vector<int> l(N); 11 for(int i = 0; i < N; i++) 12 cin >> l[i]; 13 14 sort(l.begin(), l.end(), greater<int>()); 15 16 int sum = 0; 17 18 for(int i = 0; i < K; i++) 19 sum += l[i]; 20 21 cout << sum << endl; 22 }
a.cc:2:5: error: stray '#' in program 2 | 2 #include <vector> | ^ a.cc:3:5: error: stray '#' in program 3 | 3 #include <algorithm> | ^ a.cc:2:3: error: expected unqualified-id before numeric constant 2 | 2 #include <vector> | ^ a.cc:6:3: error: expected unqualified-id before numeric constant 6 | 6 | ^
s984506182
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; vector<int> a(N) int ans=0; for(int i = 0; i < N; i++){ cin >> a.at(i); } sort(a.begin(),a.end()); reverse(a.begin(),a.end()); for(int i = 0; i < K; i++){ ans += a.at(i); } }
a.cc: In function 'int main()': a.cc:8:3: error: expected ',' or ';' before 'int' 8 | int ans=0; | ^~~ a.cc:15:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | ans += a.at(i); | ^~~ | abs
s416896758
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; int A[60]; for(int i=0;i>N;i++){ cin >> A[i]; } sort(A,A+N,greater<int>); int sum = 0; for(int i=0;i>K;i++){ sum += A[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:11:26: error: expected primary-expression before ')' token 11 | sort(A,A+N,greater<int>); | ^
s695395552
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; int A[N]; for(int i=0;i>N;i++)cin >> A[i]; sort(A,A+N,greater<int>()); int sum = 0; for(int j=0;j>K;j++){ sum += A[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:12:14: error: 'i' was not declared in this scope 12 | sum += A[i]; | ^
s688300995
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; int A[N]; for(i=0;i>N;i++)cin >> A[i]; sort(A,A+N,greater<int>()); int sum = 0; for(j=0;j>K;j++){ sum += A[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i>N;i++)cin >> A[i]; | ^ a.cc:11:7: error: 'j' was not declared in this scope 11 | for(j=0;j>K;j++){ | ^ a.cc:12:14: error: 'i' was not declared in this scope 12 | sum += A[i]; | ^
s388604065
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; int A[N]; for(i=0;i>N;i++)cin >> A[i]; sort(A,A+N,greater<int>()); int sum = 0; for(i=0;i>K;i++){ sum += A[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i>N;i++)cin >> A[i]; | ^ a.cc:11:7: error: 'i' was not declared in this scope 11 | for(i=0;i>K;i++){ | ^
s783954488
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.end(),l.begin()); int a=0; for(int i=0;i<K;i++){ a+=l[i]; } cout << a << endl; }
a.cc: In function 'int main()': a.cc:7:3: error: expected ',' or ';' before 'for' 7 | for(int i=0;i<N;i++){ | ^~~ a.cc:7:15: error: 'i' was not declared in this scope 7 | for(int i=0;i<N;i++){ | ^
s655646058
p03658
C++
#include <bits/stdc++.h> #define rep(i, n) for(ll i = 0; i < n; ++i) #define repR(i, n) for(ll i = n; i >= 0; ++i) #define FDS(i, n) for(ll i = 0; i < n; ++i) #define FDSR(i, n) for(ll i = n; i >= 0; ++i) #define FOR(i, m, n) for(ll i = m; i < n; ++i) #define FORR(i, m, n) for(ll i = m;i >= n;--i) #define VSORT(v) sort(v.begin(), v.end()); #define VREV(v) reverse(v.begin(), v.end()); #define INF 999999999 #define itn ll #define ednl endl using namespace std; typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell> Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;} template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;} int main(){ cin.tie(0);ios::sync_with_stdio(false); int N,K; cin>>N>>K; vector<int> l(N); FDS(i,N){ cin>>l[i]; } VSORT(l); VREV(l); ans=0; FDS(i,K){ ans+=l[i]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:28:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 28 | ans=0; | ^~~ | abs
s100959149
p03658
Java
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int K = Integer.parseInt(sc.next()); int[] a = new int[N]; for(int i = 0; i<N; i++) { a[i] = Integer.parseInt(sc.next()); } Arrays.sort(); int ans = 0; for(int i = 0; i<K; i++) { ans += a[a.length - 1 - i]; } System.out.println(ans); } }
Main.java:11: error: no suitable method found for sort(no arguments) Arrays.sort(); ^ method Arrays.<T#1>sort(T#1[],Comparator<? super T#1>) is not applicable (cannot infer type-variable(s) T#1 (actual and formal argument lists differ in length)) 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
s006457994
p03658
C++
#include <iostream> using namespace std; int main(){ int N, K; cin >> N >> K; int l[N]; for(int i; i < N; i++){ cin >> l[i]; } int sum; 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:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(l, l + N, greater<int>()); | ^~~~ | short
s305151564
p03658
C++
#include <bits/stdc++.h> using namespace std; const long long mod = pow(10, 9) + 7; const long long MOD = 998244353; const long long INF = 1LL << 60; const int inf = pow(10, 9) + 7; template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} int divCeil(int A, int B) {return (A + (B - 1)) / B;} long long divCeil(long long A, int B) {return (A + (B - 1)) / B;} long long divCeil(int A, long long B) {return (A + (B - 1)) / B;} long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;} int main() { int N, K; cin >> N >> K; vector<int> l(N); for (int i = 0; i < N; i++) cin >> l.at(i); sort(l.begin(), l.end(), greater<int>); int ans = 0; for (int i = 0; i < K; i++) ans += l.at(i); cout << ans << endl; }
a.cc: In function 'int main()': a.cc:21:40: error: expected primary-expression before ')' token 21 | sort(l.begin(), l.end(), greater<int>); | ^
s329460432
p03658
C++
#include <bits/stdc++.h> using namespace std; // 各桁の和を計算する関数 int main() { int N,K; cin >> N>>K; vector<int>vec(N); for (int i = 0; i < N; ++i) cin>>vec[i]; sort(vec.begin(),vec.end()) reverse(vec.begin(),vec.end()) int sum=0; for(int i=0;i<K;i++) sum+=vec[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:30: error: expected ';' before 'reverse' 13 | sort(vec.begin(),vec.end()) | ^ | ; 14 | reverse(vec.begin(),vec.end()) | ~~~~~~~ a.cc:17:5: error: 'sum' was not declared in this scope 17 | sum+=vec[i]; | ^~~ a.cc:19:11: error: 'sum' was not declared in this scope 19 | cout << sum << endl; | ^~~
s518228342
p03658
C++
#include <bits/stdc++.h> using namespace std; // 各桁の和を計算する関数 int main() { int N,K; cin >> N>>K; vector<int>vec(N); for (int i = 0; i < N; ++i) cin>>vec[i]; sort(vec.begin(),vec.end()); reverse(vec.begin(),vec.end); int sum=0; for(int i=0;i<K;i++) sum+=vec[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:14:10: error: no matching function for call to 'reverse(std::vector<int>::iterator, <unresolved overloaded function type>)' 14 | reverse(vec.begin(),vec.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:68: note: no known conversion for argument 2 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
s401023301
p03658
C++
#include <bits/stdc++.h> using namespace std; // 各桁の和を計算する関数 int main() { int N,K; cin >> N>>K; vector<int>vec(N); for (int i = 0; i < N; ++i) cin>>vec[i]; sort(vec.begin(),vec.end()) reverse(vec.begin(),vec.end) int sum=0; for(int i=0;i<K;i++) sum+=vec[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:30: error: expected ';' before 'reverse' 13 | sort(vec.begin(),vec.end()) | ^ | ; 14 | reverse(vec.begin(),vec.end) | ~~~~~~~ a.cc:17:5: error: 'sum' was not declared in this scope 17 | sum+=vec[i]; | ^~~ a.cc:19:11: error: 'sum' was not declared in this scope 19 | cout << sum << endl; | ^~~
s981636798
p03658
C++
#include <iostream> using namespace std; // 各桁の和を計算する関数 int main() { int N,K; cin >> N>>K; vector<int>vec(N); for (int i = 0; i < N; ++i) cin>>vec[i]; sort(l.begin(),l.end()) reverse(l.begin(),l.end) int sum=0; for(int i=0;i<K;i++) sum+=vec[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:3: error: 'vector' was not declared in this scope 10 | vector<int>vec(N); | ^~~~~~ 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:10:10: error: expected primary-expression before 'int' 10 | vector<int>vec(N); | ^~~ a.cc:12:10: error: 'vec' was not declared in this scope 12 | cin>>vec[i]; | ^~~ a.cc:13:8: error: 'l' was not declared in this scope 13 | sort(l.begin(),l.end()) | ^ a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(l.begin(),l.end()) | ^~~~ | short a.cc:17:5: error: 'sum' was not declared in this scope 17 | sum+=vec[i]; | ^~~ a.cc:17:10: error: 'vec' was not declared in this scope 17 | sum+=vec[i]; | ^~~ a.cc:19:11: error: 'sum' was not declared in this scope 19 | cout << sum << endl; | ^~~
s053079807
p03658
C++
#include <iostream> 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()) reverse(l.begin(),l.end) int sum=0; for(int i=0;i<K;i++) sum+=l[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:3: error: 'vector' was not declared in this scope 10 | vector<int>l(N); | ^~~~~~ 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:10:10: error: expected primary-expression before 'int' 10 | vector<int>l(N); | ^~~ a.cc:12:10: error: 'l' was not declared in this scope 12 | cin>>l[i]; | ^ a.cc:13:8: error: 'l' was not declared in this scope 13 | sort(l.begin(),l.end()) | ^ a.cc:13:3: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(l.begin(),l.end()) | ^~~~ | short a.cc:17:5: error: 'sum' was not declared in this scope 17 | sum+=l[i]; | ^~~ a.cc:19:11: error: 'sum' was not declared in this scope 19 | cout << sum << endl; | ^~~
s224772483
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.at(i); sort(l.begin(),l.end()); reverse(l.begin(),l.end()); int s=0; for(int i=0;i<K;i++) sum+=l.at(i); cout <<sum <<endl; }
a.cc: In function 'int main()': a.cc:14:5: error: 'sum' was not declared in this scope 14 | sum+=l.at(i); | ^~~ a.cc:15:10: error: 'sum' was not declared in this scope 15 | cout <<sum <<endl; | ^~~
s909057033
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.at(i); sort(l.begin(),l.end()); reverse(l.begin(),end()); int s=0; for(int i=0;i<K;i++) sum+=l.at(i); cout <<sum <<endl; }
a.cc: In function 'int main()': a.cc:11:24: error: no matching function for call to 'end()' 11 | reverse(l.begin(),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:1: /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:14:5: error: 'sum' was not declared in this scope 14 | sum+=l.at(i); | ^~~ a.cc:15:10: error: 'sum' was not declared in this scope 15 | cout <<sum <<endl; | ^~~
s182647958
p03658
C++
#include <iostream> using namespace std; int main(){ int N, K; cin >> N >> K; int l[55]; 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 << endl; }
a.cc: In function 'int main()': a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(l, l + N, greater<int>()); | ^~~~ | short
s262072401
p03658
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] l = new int[n]; int sum = 0; for(int i=0; i<n; i++){ l[i] = sc.nextInt(); } Arrays.sort(l,Comparator.reverseOrder()); for(int i=0; i<k; i++){ sum += l[i]; } System.out.println(sum); } }
Main.java:13: error: no suitable method found for sort(int[],Comparator<T#1>) Arrays.sort(l,Comparator.reverseOrder()); ^ method Arrays.<T#2>sort(T#2[],Comparator<? super T#2>) is not applicable (inference variable T#2 has incompatible bounds equality constraints: int upper bounds: Object) method Arrays.<T#3>sort(T#3[],int,int,Comparator<? super T#3>) is not applicable (cannot infer type-variable(s) T#3 (actual and formal argument lists differ in length)) where T#1,T#2,T#3 are type-variables: T#1 extends Comparable<? super T#1> T#2 extends Object declared in method <T#2>sort(T#2[],Comparator<? super T#2>) T#3 extends Object declared in method <T#3>sort(T#3[],int,int,Comparator<? super T#3>) Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s944576672
p03658
Java
import java.util.*; public class Main{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] l = new int[n]; int sum = 0; for(int i=0; i<n; i++){ l[i] = sc.nextInt(); } Arrays.sort(l,Comparator.reverseOrder()); for(int i=0; i<k; i++){ sum += l[i]; } System.out.println(sum); }
Main.java:18: error: reached end of file while parsing } ^ 1 error
s713294357
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.begin(),l.end()); reverse(l.begin(),l.end()); 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:10: error: request for member 'begin' in 'l', which is of non-class type 'int [n]' 10 | sort(l.begin(),l.end()); | ^~~~~ a.cc:10:20: error: request for member 'end' in 'l', which is of non-class type 'int [n]' 10 | sort(l.begin(),l.end()); | ^~~ a.cc:11:13: error: request for member 'begin' in 'l', which is of non-class type 'int [n]' 11 | reverse(l.begin(),l.end()); | ^~~~~ a.cc:11:23: error: request for member 'end' in 'l', which is of non-class type 'int [n]' 11 | reverse(l.begin(),l.end()); | ^~~
s548293531
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k; cin >> n,k; vector<int> l; for(i=0;i<n;i++) cin>>l[i]; sort(l.begin(),l.end()); reverse(l.begin(),l.end()); int sum = 0; for(i=0;i<k;i++) sum += l[i]; cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:7: error: 'i' was not declared in this scope 8 | for(i=0;i<n;i++) cin>>l[i]; | ^ a.cc:13:7: error: 'i' was not declared in this scope 13 | for(i=0;i<k;i++) sum += l[i]; | ^
s360179118
p03658
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K; cin >> N >> K; int a[N]; for (int i=0;i<N;i++){ cin >> a[i]; } sort(a,a+N); int s=0; for (int i=0;i<K;i++){ s+=a[N-1-i]; } cout >> s >> endl; }
a.cc: In function 'int main()': a.cc:16:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 16 | cout >> s >> endl; | ~~~~ ^~ ~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:16:10: note: candidate: 'operator>>(int, int)' (built-in) 16 | cout >> s >> endl; | ~~~~~^~~~ a.cc:16: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:16:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 16 | cout >> s >> endl; | ^~~~ 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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ 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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: required from here 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ 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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /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:16:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> s >> endl; | ^ /usr/include/c++/14/iomanip:207:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setprecision)' 207 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setprecision __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:207:5: note: template argument deduction/substitution failed: a.cc:16:13: note: 'std::ostream' {aka 'std:
s912904473
p03658
C++
#include <algorithm> #include <iostream> #include <vector> #define REP(i, n) for(int i = 0; i < n; i++) using namespace std; int main(){ int n,k; cin>>n>>k; vector<int> v(n); rep(i,n){ cin>>v[i]; } sort(v.rbegin(),v.rend()); int ans=0; REP(i, k){ ans+=v[i]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:13:9: error: 'i' was not declared in this scope 13 | rep(i,n){ | ^ a.cc:13:5: error: 'rep' was not declared in this scope 13 | rep(i,n){ | ^~~
s779554134
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,k,sum=0; vector<int> l((n); cin>>n>>k; for(int i=0;i<n;i++){ cin>>l[i]; } sort(l.begin(),l.end()); for(int i=0;i<k;i++){ sum+=l[n-1-i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:5:20: error: expected ')' before ';' token 5 | vector<int> l((n); | ~ ^ | )
s915494060
p03658
C++
#include<iostream> using namespace std; int main(){ int N,K,a[50],ans=0; cin>>N>>K; for(int i=0;i<N;++i)cin>>a[i]; sort(a,a+N); for(int i=N-1;i=N-K+1;--i)ans+=a[i]; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'sort' was not declared in this scope; did you mean 'short'? 8 | sort(a,a+N); | ^~~~ | short
s443072769
p03658
C
#include <stdio.h> int main(){ int a,b; scanf("%d %d",&a,&b); int l[n],max = 0; for(int i = 0;i < n;i++){ scanf("%d",&l[i]); } for(int i = 0;i + k <= n + 1;i++){ int ans = 0; for(int j = i;j < i + k;j++){ ans += l[j]; } if(max < ans){ max = ans; } } printf("%d\n",max); return 0; }
main.c: In function 'main': main.c:5:9: error: 'n' undeclared (first use in this function) 5 | int l[n],max = 0; | ^ main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in main.c:9:21: error: 'k' undeclared (first use in this function) 9 | for(int i = 0;i + k <= n + 1;i++){ | ^
s192785185
p03658
C++
#include <bits/stdc++.h> #include <math.h> using namespace std; #define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i]; int main(){ int N,K,l[60]; cin >> N >> K ; cinf(N,l) ; sort(l ,l+N,greater<int>) ; int ans ; 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 primary-expression before ')' token 10 | sort(l ,l+N,greater<int>) ; | ^
s422992694
p03658
C++
#include<bits/stdc++.h> using namespace std; int main(){ int l[60]; int n,k,l[i],ans=0;cin>>n>>k; for(int i=0;i<n;i++)cin>>l[i]; sort(l,l+n,greater<int>()); for(int j=0;j<k;j++){ ans+=l[j]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:5:13: error: 'i' was not declared in this scope 5 | int n,k,l[i],ans=0;cin>>n>>k; | ^