submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s842910432
p04047
C++
#include <iostream> using namespace std; int N; int L[200]; int main(){ int total; cin >> N; for(int i = 0; i < 2 * N; i++){ cin >> L[i]; } for(int i = 0; i < 2 * N; i += 2){ total += min_element(L, L + (2 * N)); L[i] = 1000; L[i + 1] = 1000; } cout << total; }
a.cc: In function 'int main()': a.cc:14:14: error: 'min_element' was not declared in this scope 14 | total += min_element(L, L + (2 * N)); | ^~~~~~~~~~~
s427124488
p04047
C++
#include <iostream> using namespace std; int N; int L[200]; int main(){ int total; cin >> N; for(int i = 0; i < 2 * N; i++){ cin >> L[i]; } for(int i = 0; i < 2N; i += 2){ total += min(L); L[i] = 1000; L[i + 1] = 1000; } cout << total; }
a.cc: In function 'int main()': a.cc:13:22: error: unable to find numeric literal operator 'operator""N' 13 | for(int i = 0; i < 2N; i += 2){ | ^~ a.cc:14:17: error: no matching function for call to 'min(int [200])' 14 | total += min(L); | ~~~^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided
s425421439
p04047
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int l[100],N,sum=0; int i,j; cin>>N; for(i=0;i<(2*N);i++) { cin>>l[i]; } for(i=0;i<(2*N);i++) { for(j=i+1;j<(2*N);j++) { if(l[i]<l[j]) { int temp; temp=l[i]; l[i]=l[j]; l[j]=temp; } } } for(i=0;i<(2*N);i++) { if(l[i]<l[++i]) { sum=sum+l[i]; } else { sum=sum+l[++i]; } i++; } return 0; } #include<iostream> using namespace std; int main() { int l[100],N,sum=0; int i,j; cin>>N; for(i=0;i<(2*N);i++) { cin>>l[i]; } for(i=0;i<(2*N);i++) { for(j=i+1;j<(2*N);j++) { if(l[i]<l[j]) { int temp; temp=l[i]; l[i]=l[j]; l[j]=temp; } } } for(i=0;i<(2*N);i++) { sum=sum+min(i,++i); } cout<<sum;
a.cc:48:5: error: redefinition of 'int main()' 48 | int main() | ^~~~ a.cc:4:5: note: 'int main()' previously defined here 4 | int main() | ^~~~ a.cc: In function 'int main()': a.cc:78:13: error: expected '}' at end of input 78 | cout<<sum; | ^ a.cc:49:1: note: to match this '{' 49 | { | ^
s970998021
p04047
C++
#include<iostream> using namespace std; int main() { int l[100],N,sum=0; int i,j; cin>>N; for(i=0;i<(2*N);i++) { cin>>l[i]; } for(i=0;i<(2*N);i++) { for(j=i+1;j<(2*N);j++) { if(l[i]<l[j]) { int temp; temp=l[i]; l[i]=l[j]; l[j]=temp; } } } for(i=0;i<(2*N);i++) { if(a[i]<a[++i]) { sum=sum+a[i]; } else { sum=sum+a[++i]; } i++; } return 0; }
a.cc: In function 'int main()': a.cc:31:10: error: 'a' was not declared in this scope 31 | if(a[i]<a[++i]) | ^
s721827742
p04047
C++
#include<iostream> int main() { int l[100],N,sum=0; int i,j; cin>>N; for(i=0;i<(2*N);i++) { cin>>l[i]; } for(i=0;i<(2*N);i++) { for(j=i+1;j<(2*N);j++) { if(l[i]<l[j]) { int temp; temp=l[i]; l[i]=l[j]; l[j]=temp; } } for(i=0;i<(2*N);i+2) { if(a[i]<a[++i]) { sum=sum+a[i]; } else { sum=sum+a[++i]; } } } return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin>>N; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:29:10: error: 'a' was not declared in this scope 29 | if(a[i]<a[++i]) | ^
s870270369
p04047
Java
import java.util.*; public class Solution { public static void main(String [] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int [] arr = new int[n]; for(int i = 0;i < n; i++) arr[i] = s.nextInt(); Arrays.sort(arr); int count = 0; for(int i = 0; i < n; i +=2) count += arr[i]; System.out.println(count); } }
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java public class Solution ^ 1 error
s480671972
p04047
Java
import java.util.*; public class Screw { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[2*n]; for(int i=0;i<2*n;i++) { a[i]=sc.nextInt(); } Arrays.sort(a); int t=0; for(int i=0;i<2*n;i+=2) { t+=Math.min(a[i],a[i+1]); } System.out.println(t); } }
Main.java:2: error: class Screw is public, should be declared in a file named Screw.java public class Screw { ^ 1 error
s863958975
p04047
Java
import java.util.*; public static void main(String[] args) { int x=0,s=0,m=1,p=0; Scanner in=new Scanner(System.in); int n=in.nextInt(); p=n*2; int []a=new int[p]; for(int i=0;i<p;i++){ a[i]=in.nextInt(); } for(int i=0;i<(p-1);i++){ for(int j=1+i;j<p;j++){ if(a[i]<a[j]){ int t =a[i]; a[i]=a[j]; a[j]=t; } } } for(int i=0;i<(p-1);i++){ for(int j=m;j<p;j++){ if(a[i]>a[j]||a[i]==a[j]){ x=a[j]; s=s+x; m=m+2; break; } } } System.out.println(s); }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s930615075
p04047
Java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication69; /** * * @author ASUS */ import java.util.*; public class JavaApplication69 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here int x=0; Scanner in=new Scanner(System.in); int n=in.nextInt(); int p=n*2; int []a=new int[p]; for(int i=0;i<p;i++){ a[i]=in.nextInt(); } for(int i=0;i<p-1;i++){ for(int j=1+i;j<p;j++){ if(a[i]<a[j]){ int t =a[i]; a[i]=a[j]; a[j]=t; } } } int s=0,m=1; for(int i=0;i<p-1;i++){ for(int j=m;j<p;j++){ if(a[i]>a[j]||a[i]==a[j]){ x=a[j]; s=s+x; m=m+2; break; } } } System.out.println(s ); } }
Main.java:13: error: class JavaApplication69 is public, should be declared in a file named JavaApplication69.java public class JavaApplication69 { ^ 1 error
s351247253
p04047
Java
package myjava1; import java.util. class MyJava1 { public static void main(String[] args) { int x=0,s=0,m=1,p=0; Scanner in=new Scanner(System.in); int n=in.nextInt(); p=n*2; int []a=new int[p]; for(int i=0;i<p;i++){ a[i]=in.nextInt(); } for(int i=0;i<(p-1);i++){ for(int j=1+i;j<p;j++){ if(a[i]<a[j]){ int t =a[i]; a[i]=a[j]; a[j]=t; } } } for(int i=0;i<(p-1);i++){ for(int j=m;j<p;j++){ if(a[i]>a[j]||a[i]==a[j]){ x=a[j]; s=s+x; m=m+2; break; } } } System.out.println(s); } }
Main.java:2: error: <identifier> expected import java.util. ^ 1 error
s520271275
p04047
Java
package myjava1; import java.util.*; public class MyJava1 { public static void main(String[] args) { int x=0,s=0,m=1,p=0; Scanner in=new Scanner(System.in); int n=in.nextInt(); p=n*2; int []a=new int[p]; for(int i=0;i<p;i++){ a[i]=in.nextInt(); } for(int i=0;i<(p-1);i++){ for(int j=1+i;j<p;j++){ if(a[i]<a[j]){ int t =a[i]; a[i]=a[j]; a[j]=t; } } } for(int i=0;i<(p-1);i++){ for(int j=m;j<p;j++){ if(a[i]>a[j]||a[i]==a[j]){ x=a[j]; s=s+x; m=m+2; break; } } } System.out.println(s); } }
Main.java:3: error: class MyJava1 is public, should be declared in a file named MyJava1.java public class MyJava1 { ^ 1 error
s787914885
p04047
Java
import java.util.*; public class MyJava{ public static void main(String[] args) { int x = 0, s = 0, m = 1;; Scanner in = new Scanner(System.in); int n = in.nextInt(); int p = n * 2; int[] a = new int[p]; for (int i = 0; i < p; i++) { a[i] = in.nextInt(); } for (int i = 0; i < p - 1; i++) { for (int j = 1 + i; j < p; j++) { if (a[i] < a[j]) { int t = a[i]; a[i] = a[j]; a[j] = t; } } } for (int i = 0; i < p - 1; i++) { for (int j = m; j < p; j++) { if (a[i] > a[j] || a[i] == a[j]) { x = a[j]; s = s + x; m = m + 2; break; } } } System.out.println(s); } }
Main.java:3: error: class MyJava is public, should be declared in a file named MyJava.java public class MyJava{ ^ 1 error
s414473443
p04047
Java
package myjava2; import java.util.*; public class MyJava2{ public static void main(String[] args) { int x = 0, s = 0, m = 1;; Scanner in = new Scanner(System.in); int n = in.nextInt(); int p = n * 2; int[] a = new int[p]; for (int i = 0; i < p; i++) { a[i] = in.nextInt(); } for (int i = 0; i < p - 1; i++) { for (int j = 1 + i; j < p; j++) { if (a[i] < a[j]) { int t = a[i]; a[i] = a[j]; a[j] = t; } } } for (int i = 0; i < p - 1; i++) { for (int j = m; j < p; j++) { if (a[i] > a[j] || a[i] == a[j]) { x = a[j]; s = s + x; m = m + 2; break; } } } System.out.println(s); } }
Main.java:5: error: class MyJava2 is public, should be declared in a file named MyJava2.java public class MyJava2{ ^ 1 error
s720387176
p04047
Java
package myjava; import java.util.*; public class MyJava{ public static void main(String[] args) { int x = 0, s = 0, m = 1;; Scanner in = new Scanner(System.in); int n = in.nextInt(); int p = n * 2; int[] a = new int[p]; for (int i = 0; i < p; i++) { a[i] = in.nextInt(); } for (int i = 0; i < p - 1; i++) { for (int j = 1 + i; j < p; j++) { if (a[i] < a[j]) { int t = a[i]; a[i] = a[j]; a[j] = t; } } } for (int i = 0; i < p - 1; i++) { for (int j = m; j < p; j++) { if (a[i] > a[j] || a[i] == a[j]) { x = a[j]; s = s + x; m = m + 2; break; } } } System.out.println(s); } }
Main.java:5: error: class MyJava is public, should be declared in a file named MyJava.java public class MyJava{ ^ 1 error
s840847810
p04047
Java
package myjava1; import java.util.*; public class MyJava1 { public static void main(String[] args) { int x=0,s=0,m=1,p=0; Scanner in=new Scanner(System.in); int n=new nextInt(); p=n*2; int []a=in.int[p]; for(int i=0;i<p;i++){ a[i]=in.nextInt(); } for(int i=0;i<(p-1);i++){ for(int j=1+i;j<p;j++){ if(a[i]<a[j]){ int t =a[i]; a[i]=a[j]; a[j]=t; } } } for(int i=0;i<(p-1);i++){ for(int j=m;j<p;j++){ if(a[i]>a[j]||a[i]==a[j]){ x=a[j]; s=s+x; m=m+2; break; } } } System.out.println(s); } }
Main.java:9: error: <identifier> expected int []a=in.int[p]; ^ Main.java:9: error: ']' expected int []a=in.int[p]; ^ Main.java:9: error: ';' expected int []a=in.int[p]; ^ 3 errors
s576060250
p04047
C++
#include <bits/stdc++.h> int n, L[205]; int main() { scanf("%d", &n); for(int i=1; i<=2*n; i++) scanf("%d", a+i); sort(a+1, a+2*n+1); int ans = 0; for(int i=1; i<=2*n; i+=2) ans += a[i]; printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:6:47: error: 'a' was not declared in this scope 6 | for(int i=1; i<=2*n; i++) scanf("%d", a+i); | ^ a.cc:7:14: error: 'a' was not declared in this scope 7 | sort(a+1, a+2*n+1); | ^ a.cc:7:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 7 | sort(a+1, a+2*n+1); | ^~~~ | 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, from a.cc:1: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~
s931660373
p04047
C++
#include<bits/stdc++.h> #include<math.h> using namespace std; int main(){ int n; int k; int s=0; cin >> n; vector<int>v(2*n); for(int i;i<2*n;i++){ cin >> v[i]; } for(int i;i<n;i++){ s+=v.min_element(0,v.size()); k=v.min_element(0,v.size()); v.erase(k); k=v.min_element(0,v.size()); v.erase(k); } cout << s; return 0; }
a.cc: In function 'int main()': a.cc:15:10: error: 'class std::vector<int>' has no member named 'min_element' 15 | s+=v.min_element(0,v.size()); | ^~~~~~~~~~~ a.cc:16:9: error: 'class std::vector<int>' has no member named 'min_element' 16 | k=v.min_element(0,v.size()); | ^~~~~~~~~~~ a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int&)' 17 | v.erase(k); | ~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided a.cc:18:10: error: 'class std::vector<int>' has no member named 'min_element' 18 | k=v.min_element(0,v.size()); | ^~~~~~~~~~~ a.cc:19:13: error: no matching function for call to 'std::vector<int>::erase(int&)' 19 | v.erase(k); | ~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
s021157282
p04047
C++
#include<bits/stdc++.h> #include<math.h> using namespace std; int main(){ int n; int *k; int s=0; cin >> n; vector<int>v(2*n); for(int i;i<2*n;i++){ cin >> v[i]; } for(int i;i<n;i++){ s+=v.min_element(0,v.size()); k=&(v.min_element(0,v.size())); v.erase(k); k=&(v.min_element(0,v.size())); v.erase(k); } cout << s; return 0; }
a.cc: In function 'int main()': a.cc:15:10: error: 'class std::vector<int>' has no member named 'min_element' 15 | s+=v.min_element(0,v.size()); | ^~~~~~~~~~~ a.cc:16:11: error: 'class std::vector<int>' has no member named 'min_element' 16 | k=&(v.min_element(0,v.size())); | ^~~~~~~~~~~ a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int*&)' 17 | v.erase(k); | ~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53, from a.cc:1: /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided a.cc:18:12: error: 'class std::vector<int>' has no member named 'min_element' 18 | k=&(v.min_element(0,v.size())); | ^~~~~~~~~~~ a.cc:19:13: error: no matching function for call to 'std::vector<int>::erase(int*&)' 19 | v.erase(k); | ~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
s438278735
p04047
C++
#include<bits/stdc++.h> #include<math.h> using namespace std; int main(){ int n; int *k; int s=0; cin >> n; vector<int>v(2*n); for(int i;i<2*n;i++){ cin >> v[i]; } for(int i;i<n;i++){ s+=min_element(0,v.size()); k=&(min_element(0,v.size())); v.erase(k); k=&(min_element(0,v.size())); v.erase(k); } cout << s; return 0; }
a.cc: In function 'int main()': a.cc:15:19: error: no matching function for call to 'min_element(int, std::vector<int>::size_type)' 15 | s+=min_element(0,v.size()); | ~~~~~~~~~~~^~~~~~~~~~~~ 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:5577:12: note: candidate: 'template<class _FIter> constexpr _FIter std::min_element(_FIter, _FIter)' 5577 | inline min_element(_ForwardIterator __first, _ForwardIterator __last) | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5577:12: note: template argument deduction/substitution failed: a.cc:15:19: note: deduced conflicting types for parameter '_FIter' ('int' and 'long unsigned int') 15 | s+=min_element(0,v.size()); | ~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate: 'template<class _FIter, class _Compare> constexpr _FIter std::min_element(_FIter, _FIter, _Compare)' 5602 | min_element(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare)' 516 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)' 520 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate expects 3 arguments, 2 provided a.cc:16:20: error: no matching function for call to 'min_element(int, std::vector<int>::size_type)' 16 | k=&(min_element(0,v.size())); | ~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5577:12: note: candidate: 'template<class _FIter> constexpr _FIter std::min_element(_FIter, _FIter)' 5577 | inline min_element(_ForwardIterator __first, _ForwardIterator __last) | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5577:12: note: template argument deduction/substitution failed: a.cc:16:20: note: deduced conflicting types for parameter '_FIter' ('int' and 'long unsigned int') 16 | k=&(min_element(0,v.size())); | ~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate: 'template<class _FIter, class _Compare> constexpr _FIter std::min_element(_FIter, _FIter, _Compare)' 5602 | min_element(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare)' 516 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)' 520 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate expects 3 arguments, 2 provided a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int*&)' 17 | v.erase(k); | ~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided a.cc:18:21: error: no matching function for call to 'min_element(int, std::vector<int>::size_type)' 18 | k=&(min_element(0,v.size())); | ~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5577:12: note: candidate: 'template<class _FIter> constexpr _FIter std::min_element(_FIter, _FIter)' 5577 | inline min_element(_ForwardIterator __first, _ForwardIterator __last) | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5577:12: note: template argument deduction/substitution failed: a.cc:18:21: note: deduced conflicting types for parameter '_FIter' ('int' and 'long unsigned int') 18 | k=&(min_element(0,v.size())); | ~~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate: 'template<class _FIter, class _Compare> constexpr _FIter std::min_element(_FIter, _FIter, _Compare)' 5602 | min_element(_ForwardIterator __first, _ForwardIterator __last, | ^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5602:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _Compare)' 516 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _Compare __comp); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:516:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::min_element(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)' 520 | min_element(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last); | ^~~~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:520:1: note: candidate expects 3 arguments, 2 provided a.cc:19:13: error: no matching function for call to 'std::vector<int>::erase(int*&)' 19 | v.erase(k); | ~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int*' to 'std::vector<int>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
s327007758
p04047
C++
#include<bits/stdc++.h> #include<math.h> using namespace std; int main(){ int n; int *k; int s=0; cin >> n; vector<int>v(2*n); for(int i;i<2*n;i++){ cin << v[i]; } for(int i;i<n;i++){ s+=min_element(0,v.size()); k=&(min_element(0,v.size())); v.erase(k); k=&(min_element(0,v.size())); v.erase(k); } cout << s; return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}) 12 | cin << v[i]; a.cc:12:9: note: candidate: 'operator<<(int, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int})' (built-in) a.cc:12:9: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:12:5: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 12 | cin << v[i]; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:12:15: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 12 | cin << v[i]; | ^ /usr/include/c++/14/ostrea
s594168662
p04047
C++
#include <algorithm> #include <iostream> #include <vector> int main() { std::vector<int> L; long long N; std::cin >> N; L.resize(2*N); for (int i = 0; i < 2*N; i++) std::cin >> L[i]; std::sort(L.begin(), L.end()); int sum = 0; for (int i = 0; i < N; i++) sum += std::min(L[2*i], L[2*i+1]); std::cout << sun << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:16:16: error: 'sun' was not declared in this scope; did you mean 'sum'? 16 | std::cout << sun << std::endl; | ^~~ | sum
s227443580
p04047
C++
#include <algorithm> #include <iostream> #include <vector> int main() { std::vector<int> L; long long N; std::cin >> N; L.resize(2*N); for (int i = 0; i < 2*N; i++) std::cin >> L[i]; std::srot(L.begin(), L.end()); int sum = 0; for (int i = 0; i < N; i++) sum += std::min(L[2*i], L[2*i+1]); std::cout << sun << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:12:8: error: 'srot' is not a member of 'std'; did you mean 'sort'? 12 | std::srot(L.begin(), L.end()); | ^~~~ | sort a.cc:16:16: error: 'sun' was not declared in this scope; did you mean 'sum'? 16 | std::cout << sun << std::endl; | ^~~ | sum
s269664777
p04047
C++
#include <algorithm> #include <iostream> #include <vector> int main() { std::vector L; long long N; std::cin >> N; L.resize(2*N); for (int i = 0; i < 2*N; i++) std::cin >> L[i]; std::srot(L.begin(), L.end()); int sum = 0; for (int i = 0; i < N; i++) { sum += std::min(L[2*i], L[2*i+1]); } std::cout << sun << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:6:15: error: class template argument deduction failed: 6 | std::vector L; | ^ a.cc:6:15: error: no matching function for call to 'vector()' In file included from /usr/include/c++/14/vector:66, from a.cc:3: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _Tp, class _Alloc, class _InputIterator, class> vector(_InputIterator, _InputIterator, const _Alloc&)-> std::vector<_Tp, _Alloc>' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::initializer_list<_Tp>, const _Alloc&)-> std::vector<_Tp, _Alloc>' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::false_type)-> std::vector<_Tp, _Alloc>' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&, const _Alloc&, std::true_type)-> std::vector<_Tp, _Alloc>' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&)-> std::vector<_Tp, _Alloc>' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>&&)-> std::vector<_Tp, _Alloc>' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const std::vector<_Tp, _Alloc>&)-> std::vector<_Tp, _Alloc>' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Tp&, const _Alloc&)-> std::vector<_Tp, _Alloc>' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 2 arguments, 0 provided /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'template<class _Tp, class _Alloc> vector(std::size_t, const _Alloc&)-> std::vector<_Tp, _Alloc>' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'template<class _Tp, class _Alloc> vector(const _Alloc&)-> std::vector<_Tp, _Alloc>' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'template<class _Tp, class _Alloc> vector()-> std::vector<_Tp, _Alloc>' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: template argument deduction/substitution failed: a.cc:6:15: note: couldn't deduce template parameter '_Tp' 6 | std::vector L; | ^ /usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate: 'template<class _Tp, class _Alloc> vector(std::vector<_Tp, _Alloc>)-> std::vector<_Tp, _Alloc>' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:428:11: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate: 'template<class _InputIterator, class _ValT, class _Allocator, class, class> std::vector(_InputIterator, _InputIterator, _Allocator)-> vector<_ValT, _Allocator>' 2033 | vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:2033:5: note: candidate expects 2 arguments, 0 provided a.cc:12:8: error: 'srot' is not a member of 'std'; did you mean 'sort'? 12 | std::srot(L.begin(), L.end()); | ^~~~ | sort a.cc:17:16: error: 'sun' was not declared in this scope; did you mean 'sum'? 17 | std::cout << sun << std::endl; | ^~~ | sum
s784884964
p04047
C++
#include<bits/stdc++.h> using namespace std; int arr[101] int main(){ int n;scanf("%d",&n); arr[n+1]; for(int i=1;i<=n;i++) scanf("%d",&arr[i]); int ans=0; for(int i=1;i<=n-1;i++)ans+=min(arr[i],arr[i+1]); printf("%d\n",ans); return 0; }
a.cc:5:1: error: expected initializer before 'int' 5 | int main(){ | ^~~
s064359307
p04047
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[2*n]; for(int i-0; i<2*n; i++){ cin >> a[i]; } sort(a,a+n); int i=0; int sum = 0; for(i=i; i<2*n; i+=2){ sum+=a[i]; } cout <<sum; return 0; }
a.cc: In function 'int main()': a.cc:7:12: error: expected ';' before '-' token 7 | for(int i-0; i<2*n; i++){ | ^ | ; a.cc:7:21: error: expected ')' before ';' token 7 | for(int i-0; i<2*n; i++){ | ~ ^ | ) a.cc:7:23: error: 'i' was not declared in this scope 7 | for(int i-0; i<2*n; i++){ | ^
s440976125
p04047
Java
import java.util.Arrays; import java.util.Scanner; public class BBQ_Easy { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[2 * n]; for (int i = 0; i < arr.length; i++) { arr[i] = sc.nextInt(); } sc.close(); Arrays.sort(arr); int sum = 0; for (int i = 0; i < arr.length; i += 2) { sum += arr[i]; } System.out.println(sum); } }
Main.java:4: error: class BBQ_Easy is public, should be declared in a file named BBQ_Easy.java public class BBQ_Easy { ^ 1 error
s283630901
p04047
C++
#include<bits/stdc++.h> using namespace std; int main() { int x; cin>>x; int a[x],s=0; for(int i=0;i<x;i++) cin>>a[i]; sort(a,a+x); for(int i=0;i<x;i++){ s=s+min(a[i],a[i+1]); i++: } cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:10:34: error: expected ';' before ':' token 10 | s=s+min(a[i],a[i+1]); i++: | ^ | ;
s193270975
p04047
C++
using System; namespace A { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var l = Console.ReadLine().Split(' '); var nums = new int[2*n]; var result = 0; for(int i = 0; i < 2*n; i++) { nums[i] = int.Parse(l[i]); } Array.Sort(nums); for (int i = 0; i < 2*n; i++) { if(i % 2 == 0) { result += nums[i]; } } Console.WriteLine(result); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:7:26: error: 'string' has not been declared 7 | static void Main(string[] args) | ^~~~~~ a.cc:7:35: error: expected ',' or '...' before 'args' 7 | static void Main(string[] args) | ^~~~ a.cc:27:6: error: expected ';' after class definition 27 | } | ^ | ; a.cc: In static member function 'static void A::Program::Main(int*)': a.cc:9:13: error: 'var' was not declared in this scope 9 | var n = int.Parse(Console.ReadLine()); | ^~~ a.cc:10:17: error: expected ';' before 'l' 10 | var l = Console.ReadLine().Split(' '); | ^ a.cc:11:17: error: expected ';' before 'nums' 11 | var nums = new int[2*n]; | ^~~~ a.cc:12:17: error: expected ';' before 'result' 12 | var result = 0; | ^~~~~~ a.cc:13:34: error: 'n' was not declared in this scope 13 | for(int i = 0; i < 2*n; i++) | ^ a.cc:15:17: error: 'nums' was not declared in this scope 15 | nums[i] = int.Parse(l[i]); | ^~~~ a.cc:15:27: error: expected primary-expression before 'int' 15 | nums[i] = int.Parse(l[i]); | ^~~ a.cc:17:13: error: 'Array' was not declared in this scope 17 | Array.Sort(nums); | ^~~~~ a.cc:17:24: error: 'nums' was not declared in this scope 17 | Array.Sort(nums); | ^~~~ a.cc:18:35: error: 'n' was not declared in this scope 18 | for (int i = 0; i < 2*n; i++) | ^ a.cc:22:21: error: 'result' was not declared in this scope 22 | result += nums[i]; | ^~~~~~ a.cc:25:13: error: 'Console' was not declared in this scope 25 | Console.WriteLine(result); | ^~~~~~~ a.cc:25:31: error: 'result' was not declared in this scope 25 | Console.WriteLine(result); | ^~~~~~
s151908693
p04047
C++
#include<stdio.h> int main(){ int i, j, tmp; /* 数値を格納する配列 */ int l[200]; /* 数値の総数を入力 */ int n; scanf("%d", &n); /* 配列に格納する数値を入力 */ for (i=0; i<2*n; ++i) scanf("%d", &l[i]); /* 数値を昇順にソート */ for (i=0; i<n; ++i) { for (j=i+1; j<n; ++j) { if (l[i] > l[j]) { tmp = l[i]; l[i] = l[j]; l[j] = tmp; } } } int sum=0; for(int i=1;i<N;i+2){ sum+=l[i]; } printf("%d\n",sum); return 0 }
a.cc: In function 'int main()': a.cc:28:19: error: 'N' was not declared in this scope 28 | for(int i=1;i<N;i+2){ | ^ a.cc:37:13: error: expected ';' before '}' token 37 | return 0 | ^ | ; 38 | } | ~
s761607111
p04047
C
#include<stdio.h> #include <stdlib.h> #include <string.h> int size(const void *x,const void *y); int main(){ int N; int L[100];// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",&tmp); tp = strtok(tmp, "\t"); L[i] = atoi(tp); For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){ L[i] = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j = 0 ; j<(i/2) ;j++){ if(L[2*j]<L[2*j +1]){ sum += L[2*j]; }else{ sum += L[2*j +1]; } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c: In function 'main': main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration] 18 | For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){ | ^~~ main.c:18:14: error: expected ')' before ';' token 18 | For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){ | ~ ^~ | ) main.c:18:48: error: expected ';' before '{' token 18 | For ( i = 1 ; tp = strtok(NULL, "\t") ; i++ ){ | ^ | ;
s088927009
p04047
C
#include<stdio.h> #include <stdlib.h> #include <string.h> int size(const void *x,const void *y); int main(){ int N; int L[100];// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",&tmp); tp = strtok(tmp, "\t"); L[i] = atoi(tp); For(i=1 ;tp = strtok(NULL, "\t");i++){ L[i] = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j=0;j<(i/2);j++){ if(L[2*j]<L[2*j +1] ){ sum += L[2*j]; }else{ sum += L[2*j +1]; } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c: In function 'main': main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration] 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^~~ main.c:18:10: error: expected ')' before ';' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ~ ^~ | ) main.c:18:40: error: expected ';' before '{' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^ | ;
s602054843
p04047
C
#include<stdio.h> #include <stdlib.h> #include <string.h> int size(const void *x,const void *y); int main(){ int N; int L[100];// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",tmp); tp = strtok(tmp, ","); L[i] = atoi(tp); For(i=1 ;tp = strtok(NULL, "\t");i++){ L[i] = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j=0;j<(i/2);j++){ if(L[2*j]<L[2*j +1] ){ sum += L[2*j]; }else{ sum += L[2*j +1]; } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c: In function 'main': main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration] 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^~~ main.c:18:10: error: expected ')' before ';' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ~ ^~ | ) main.c:18:40: error: expected ';' before '{' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^ | ;
s143257162
p04047
C
#include<stdio.h> #include <stdlib.h> #include <string.h> int size(const void *x,const void *y); int main(){ int N; int L[100];// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",tmp); tp = strtok(tmp, ",") L[i] = atoi(tp); For(i=1 ;tp = strtok(NULL, "\t");i++){ L[i] = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j=0;j<(i/2);j++){ if(L[2*j]<L[2*j +1] ){ sum += L[2*j]; }else{ sum += L[2*j +1]; } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c: In function 'main': main.c:16:24: error: expected ';' before 'L' 16 | tp = strtok(tmp, ",") | ^ | ; 17 | L[i] = atoi(tp); | ~ main.c:18:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration] 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^~~ main.c:18:10: error: expected ')' before ';' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ~ ^~ | ) main.c:18:40: error: expected ';' before '{' token 18 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^ | ;
s010278014
p04047
C
#include<stdio.h> #include <stdlib.h> int size(const void *x,const void *y); int main(){ int N; int L(100);// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",tmp); tp = strtok(tmp, ",") L(i) = atoi(tp); For(i=1 ;tp = strtok(NULL, "\t");i++){ L(i) = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j=0;j<(i/2);j++){ if(L(2*j)<L(2*j +1) ){ sum += L(2*j); }else{ sum += L(2*j +1); } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c: In function 'main': main.c:6:9: error: expected declaration specifiers or '...' before numeric constant 6 | int L(100);// 0 to 99 | ^~~ main.c:15:8: error: implicit declaration of function 'strtok'; did you mean 'strtoq'? [-Wimplicit-function-declaration] 15 | tp = strtok(tmp, ",") | ^~~~~~ | strtoq main.c:15:6: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 15 | tp = strtok(tmp, ",") | ^ main.c:15:24: error: expected ';' before 'L' 15 | tp = strtok(tmp, ",") | ^ | ; 16 | L(i) = atoi(tp); | ~ main.c:17:3: error: implicit declaration of function 'For' [-Wimplicit-function-declaration] 17 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^~~ main.c:17:10: error: expected ')' before ';' token 17 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ~ ^~ | ) main.c:17:40: error: expected ';' before '{' token 17 | For(i=1 ;tp = strtok(NULL, "\t");i++){ | ^ | ; main.c:25:8: error: implicit declaration of function 'L' [-Wimplicit-function-declaration] 25 | if(L(2*j)<L(2*j +1) ){ | ^
s523026306
p04047
C
#include<stdin.h> #include <stdlib.h> int size(const void *x,const void *y); int main(){ int N; int L(100);// 0 to 99 int i = 0; char tmp[512]; char *tp; int sum = 0; scanf("%d",&N); scanf("%s",tmp); tp = strtok(tmp, ",") L(i) = atoi(tp); For(i=1 ;tp = strtok(NULL, "\t");i++){ L(i) = atoi(tp); } //ソート qsort(L,i,sizeof(int),size); // for(int j=0;j<(i/2);j++){ if(L(2*j)<L(2*j +1) ){ sum += L(2*j); }else{ sum += L(2*j +1); } } return sum; } int size(const void *x,const void *y){ if(*(int *)x > *(int *)y){ return 1; }else if(*(int *)x < *(int *)y){ return -1; }else{ return 0; } }
main.c:1:9: fatal error: stdin.h: No such file or directory 1 | #include<stdin.h> | ^~~~~~~~~ compilation terminated.
s248238822
p04047
C++
#include<bits/stdc++.h> using namespace std; int n,a[207],i,s; int main(){ for(cin>>n,i=0;i<n*2;i++) cin>>a[i]; sort(a,a+2*n); for(i=0;I<2*n;i+=2) s+=a[i]; cout<<s; }
a.cc: In function 'int main()': a.cc:7:9: error: 'I' was not declared in this scope 7 | for(i=0;I<2*n;i+=2) s+=a[i]; | ^
s382349149
p04047
C++
#include<bits/stdc++.h> using namespace std; int a[10100],answer=0,n; int main() { cin>>n; for(int i=1;i<=2*n;i++) cin>>a[i]; sort(a+1,a+1+2*n); for(int i=1;i<=2*n;i+=2) answer+=a[i];。 cout<<answer<<endl; return 0; }
a.cc:13:20: error: extended character 。 is not valid in an identifier 13 | answer+=a[i];。 | ^ a.cc: In function 'int main()': a.cc:13:20: error: '\U00003002' was not declared in this scope 13 | answer+=a[i];。 | ^~
s604894086
p04047
C++
#include<bits/stdc++.h> using namespace std; int BBQ[10100],answer=0,n; int main() { cin>>n; for(int i=1;i<=2*n;i++) cin>>BBQ[i]; sort(BBQ+1,BBQ+1+2*n); for(int i=1;i<=2*n;i+=2) answer+=BBQ[i];。 cout<<answer<<endl; return 0; }
a.cc:13:22: error: extended character 。 is not valid in an identifier 13 | answer+=BBQ[i];。 | ^ a.cc: In function 'int main()': a.cc:13:22: error: '\U00003002' was not declared in this scope 13 | answer+=BBQ[i];。 | ^~
s147131050
p04047
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> l(2 * n,0); for(int i=0;i<2*n;i++) { cin >> l.at(i); } sort(l.begin(),l.end()); int sm = 0; for(int i=0;i<2*n;i++) { if(i % 2 == 0) { sm += l.at(i); } } cout << cnt << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:13: error: 'cnt' was not declared in this scope; did you mean 'int'? 21 | cout << cnt << endl; | ^~~ | int
s469064390
p04047
C++
#include <bits/stdc++.h> #define ll long long #define ld long double #define fi first #define se second #define pi 3.1415926535 #define mod1 1000000007 #define mod2 1000000009 #define mp make_pair #define no_of_digits(n) floor(log10(n)) + 1 #define lcm(a, b) (a/__gcd(a,b)*b) using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n]; for(int i = 0; i < 2*n; i++){ cin >> a[i]; } sort(a, a+n); ll sm = 0; for(int i = 1; i <2*n; i+= 2){ sm += a[i]+a[i-1]; } cout << am; return 0; }
a.cc: In function 'int main()': a.cc:35:11: error: 'am' was not declared in this scope; did you mean 'sm'? 35 | cout << am; | ^~ | sm
s420216192
p04047
Java
import java.util.*; import java.io.*; public class AtCoder3 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static int nextInt() throws IOException { return Integer.parseInt(br.readLine()); } public static int[] nextArr() throws IOException { String elements[] = br.readLine().split(" "); int arr[] = new int[elements.length]; for (int j = 0; j < elements.length; j++) arr[j] = Integer.parseInt(elements[j]); return arr; } public static void printArr(int arr[]) { for (int i = 0; i < arr.length; i++) System.out.print(arr); } public static String next() throws IOException { return br.readLine(); } public static void main(String[] args) throws IOException { int T = nextInt(); while (T-- > 0) { String line = next(); if (line.charAt(2) == line.charAt(3) && line.charAt(4) == line.charAt(4)) System.out.println("Yes"); else System.out.println("No"); } } }
Main.java:4: error: class AtCoder3 is public, should be declared in a file named AtCoder3.java public class AtCoder3 { ^ 1 error
s889360807
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; scanf("%d", &n); for(int i=0;i<2*n;i++) scanf("%d", &a[i]); sort(a, a+2*n); int ans = 0; for(int i=0;i<2*n;i+=2) ans += a[i]; printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:7:41: error: 'a' was not declared in this scope 7 | for(int i=0;i<2*n;i++) scanf("%d", &a[i]); | ^ a.cc:8:10: error: 'a' was not declared in this scope 8 | sort(a, a+2*n); | ^
s062914662
p04047
C++
N=input() print(sum(sorted(list(map(int,input().split())))[::2]))
a.cc:1:1: error: 'N' does not name a type 1 | N=input() | ^
s265208194
p04047
C++
#include <iostream> using namespace std; int main(){ int n; cin>>n; n*=2; int s[n]; for(int i=0; i<n; i++){cin>>s[i];} sort(s, s+n); int m=0; for(int i=0; i<n-1; i++){ m+=min(s[i], s[i+1]); } cout<<m; }
a.cc: In function 'int main()': a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(s, s+n); | ^~~~ | short
s538990675
p04047
C++
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); ArrayList<Integer> arr = new ArrayList<>(); for(int i=0;i<2*N;i++){ arr.add(sc.nextInt()); } Collections.sort(arr,Collections.reverseOrder()); int total_meals=0; for(int i=0;i<2*N;i+=2){ total_meals +=Math.min(arr.get(i), arr.get(i+1)); } System.out.println(total_meals); } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.util.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main { | ^~~~~~
s500530191
p04047
C++
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin >> n; long long a[2*n]; for(int i=0;i<2*n;i++){ cin >> a[i]; } sort(a,a+n); long long ans=0; for(int i=0;i<2*n;i=i+2){ ans=ans+min(a[i]+a[i+1]); } cout << ans; }
a.cc: In function 'int main()': a.cc:13:16: error: no matching function for call to 'min(long long int)' 13 | ans=ans+min(a[i]+a[i+1]); | ~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:13:16: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 13 | ans=ans+min(a[i]+a[i+1]); | ~~~^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s199303225
p04047
C++
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int a[2*n]; int sum=0; for(int i=0;i<2*n;i++) { cin>>arr[i]; } sort(a,a+(2*n)); for(int i=0;i<2*n;) { sum+=a[i]; i+=2; } cout<<sum<<'\n'; }
a.cc: In function 'int main()': a.cc:11:10: error: 'arr' was not declared in this scope 11 | cin>>arr[i]; | ^~~
s602789893
p04047
C++
fdsafd
a.cc:1:1: error: 'fdsafd' does not name a type 1 | fdsafd | ^~~~~~
s035135481
p04047
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; priority_queue <int> pq; for (int i = 0; i < 2*n; i++) { int a; cin >> a; pq.push(a); } int ans = 0; for (int i = 0; i < 2*n; i++) { if (i%2 = 1) { ans += pq.top(); } pq.pop(); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:15:10: error: lvalue required as left operand of assignment 15 | if (i%2 = 1) { | ~^~
s238219929
p04047
C++
#include <bits/stdc++.h> using namespace std; const int MAXN = 300 + 21; int a[MAXN]; long long ans; int main() { int n; cin >> n; for (int i = 0; i < 2 * n; i++) cin >> a[i]; sort(a, a + (2 * n)); for (int i = 0; i < * n; i++) { ans += a[i]; } cout << ans << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:13:24: error: invalid type argument of unary '*' (have 'int') 13 | for (int i = 0; i < * n; i++) { | ^~~
s105055108
p04047
C++
#include <bits/stdc++.h> using namesapce std; const int MAXN = 300 + 21; int a[MAXN]; long long ans; int main() { int n; cin >> n; for (int i = 0; i < 2 * n; i++) cin >> a[i]; sort(a, a + (2 * n)); for (int i = 0; i < * n; i++) { ans += a[i]; } cout << ans << '\n'; return 0; }
a.cc:2:7: error: expected nested-name-specifier before 'namesapce' 2 | using namesapce std; | ^~~~~~~~~ a.cc: In function 'int main()': a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 9 | cin >> n; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:12:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 12 | sort(a, a + (2 * 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:24: error: invalid type argument of unary '*' (have 'int') 13 | for (int i = 0; i < * n; i++) { | ^~~ a.cc:16:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout << ans << '\n'; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s745631406
p04047
C++
#include <iostream> using namespace std; int main() { cout << "1" << endl; return 0;w }
a.cc: In function 'int main()': a.cc:8:12: error: 'w' was not declared in this scope 8 | return 0;w | ^
s921743552
p04047
C++
n = int(input()) li = list(map(int, input().split())) li.sort() li1 = [] for i in range(2*n): if i%2==0: li1.append(li[i]) print(sum(li1))
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s641825570
p04047
C++
/***"In the name of Allah(swt), the most gracious, most merciful. Allah(swt) blesses with knowledge whom he wants."***/ /*Header file starts here*/ //#include<bits/stdc++.h> #include<vector> #include<list> #include<map> #include<set> #include<queue> #include<stack> #include<bitset> #include<algorithm> #include<iostream> #include<iomanip> #include<cstdio> #include<cmath> #include<cstdlib> #include<iterator> #include<cctype> #include<climits> #include<string> #include<sstream> #include<cstring> #include<ctime> /*Header file ends here*/ /*Macro starts here*/ #define fasterInOut ios::sync_with_stdio(false); cin.tie(0); #define fin(in) freopen("in.txt", "r", stdin) #define fout(out) freopen("out.txt", "w", stdout) #define pb push_back #define ll long long #define lld I64d//for CF submissions #define rh cout<<"Reached Here\n" #define inf LLONG_MAX #define neginf LLONG_MIN #define forit(it,s) for(__typeof((s).end()) it=(s).begin(); it!= (s).end(); it++) #define string_reverse(s) reverse(s.begin(), s.end())//Vector also can be reversed with this function #define memz(x) memset(x, 0, sizeof(x)); #define memneg(x) memset(x, -1, sizeof(x)); //Geometry & Maths #define gcd(a,b) __gcd(a,b) #define lcm(a, b) (a*b)/gcd(a, b) #define pi acos(-1.0) #define negmod(ans, x, m) ll y= (-1*x)%m; if(y== 0) ans= 0; else ans= m-y;//for negative mod only i.e. when x<0. Undefined when m<0 #define dis(x1, y1, x2, y2) sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) #define t_area(a, b, c, s) sqrt(s*(s-a)*(s-b)*(s-c))// s= (a+b+c)/2.0 #define t_angle(a, b, c) acos((a*a+b*b-c*c)/(2*a*b))// returns angle C in radian. a, b, c are anti-clockwise formatted and side a and b form angle C #define pointPos(x1, y1, x2, y2, x3, y3) ((x2-x1)*(y3-y1))-((x3-x1)*(y2-y1));/*returns NEGATIVE if the Point P3 is on the RIGHT side of the line P1P2, otherwise returns POSITIVE in case of LEFT and ZERO when the point is on the line*/ #define t_areaWithPoints(x1, y1, x2, y2, x3, y3) abs(0.5*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)));//returns the area of a triangle formed by P1, p2, p3 //Base Conversions #define toBin(bin, n) bin= bitset<8>(n).to_string()//returns a corresponding 8 bit Binary string 'bin' of integer 'n' #define toOct(oct, n, ch) /*char ch[100]*/sprintf(ch, "%o", n); oct= ch;//returns a string 'oct'(maximum 100 length): Octal represent of number 'n' #define toHex(hex, n, ch) /*char ch[100]*/sprintf(ch, "%x", n); hex= ch;//returns a string 'hex'(maximum 100 length): Hexadecimal represent of number 'n' #define intToString(s, n, itos) /*stringstream itos;*/ itos<<n; s= itos.str();//converts a number 'n' to a string 's' #define stringToint(n, s) stringstream stoi(s); stoi>>n;//converts a string 's' to a number 'n'---ONLY ONCE USABLE--- //Others #define substring(s1, s2) strstr(s1.c_str(), s2.c_str())//returns true if s1 contains s2 in O(n^2) complexity #define strCharRemove(s, c) s.erase(remove(s.begin(), s.end(), c), s.end());//Removes all character 'c' from the string 's' #define strLastCharRemove(s) s.erase(s.end()-1)//Removes last(position is given by s.end()-1) character form string 's' #define vectorEraseSingle(v, pos) v.erase(v.begin()+pos)//Erases an element from "pos' position in zero based index from the vector 'v' #define vectorEraseRange(v, spos, fpos) v.erase(v.begin()+spos, v.begin()+fpos)//Erases range inclusive spos' to EXCLUSIVE(without) 'fpos' from vector 'v' #define lowerBound(v, elem) (lower_bound(v.begin(), v.end(), elem))-v.begin();/*returns the lower bound of 'elem' in integer(ZERO BASED INDEX), where lower bound means the LEFTMOST index where there is any integer which is GREATER OR EQUAL to 'elem'.*/ #define upperBound(v, elem) (upper_bound(v.begin(), v.end(), elem))-v.begin();/*returns the upper bound of 'elem' in integer(ZERO BASED INDEX), where upper bound means the LEFTMOST index where there is any integer which is GREATER than 'elem'.*/ #define setLowerBound(st, elem) st.lower_bound(elem);/*returns the lower bound ITERATOR of 'elem' in the stl set 'st', where lower bound means the LEFTMOST index where there is any integer which is GREATER OR EQUAL to 'elem'.*/ #define setUpperBound(st, elem) st.upper_bound(elem);/*returns the upper bound ITERATOR of 'elem' in the stl set 'st', where upper bound means the LEFTMOST index where there is any integer which is GREATER than 'elem'.*/ #define clearPQ(pq, type) pq= priority_queue<type>()/*It clears a priority queue by redeclaration*/ #define minPQ(PQ_name, type) priority_queue<type, vector<type>, greater<type> > PQ_name;/*min priority queue with built in type i.e int or long long etc. */ #define sortArr(arr, sz) sort(arr+1, arr+(sz+1));/*Sorts an array from index 1 to index 'sz'*/ /*Macro ends here*/ /*Frequently used Function starts here*/ //Bit set /*ll Set(ll mask, ll pos){return mask = (mask OR ((ll)1<<pos));}*//*Sets pos'th bit HIGH of the mask and returns*//**Replace OR by Bitwise OR sign when using**/ bool check(ll mask, ll pos){return (bool)(mask & ((ll)1<<pos));}/*Checks if the pos'th bit is HIGH or not of the mask*/ /*Frequently used Function ends here*/ using namespace std; int main() { fre(""); ACCELERATE; int n; cin >> n; n *= 2; int a[N]; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); ll ans = 0; for (int i = 0; i < n; i += 2) { ans += a[i]; } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:88:1: error: 'fre' was not declared in this scope; did you mean 'free'? 88 | fre(""); | ^~~ | free a.cc:89:9: error: 'ACCELERATE' was not declared in this scope 89 | ACCELERATE; | ^~~~~~~~~~ a.cc:95:15: error: 'N' was not declared in this scope 95 | int a[N]; | ^ a.cc:96:44: error: 'a' was not declared in this scope 96 | for (int i = 0; i < n; i++) cin >> a[i]; | ^ a.cc:98:14: error: 'a' was not declared in this scope 98 | sort(a, a + n); | ^
s295188521
p04047
C++
#include <iostream> #include <algorithm> using namespace std; int n, arr[202], cvp=0; int main(){ cin>>n; for(int i=0;i<2*n;i++)cin>>arr[i]; sort(arr[0], arr[2*n -1]); for(int i=0;i<2*n;i+=2)cvp+=arr[i]; cout<<cvp; }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(arr[0], arr[2*n -1]); | ~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(arr[0], arr[2*n -1]); | ~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(arr[0], arr[2*n -1]); | ~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:10:7: required from here 10 | sort(arr[0], arr[2*n -1]); | ~~~~^~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 258 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 260 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:262:28: error: invalid type argument of unary '*' (have 'i
s940909521
p04047
C++
#include <iostream> #include <algorithm> using namespace std; int n, arr[202], cvp=0; int main(){ cin>>n; for(int i=0;i<2*n;i++)cin>>arr[i]; sort(arr); for(int i=0;i<2*n;i+=2)cvp+=arr[i]; cout<<cvp; }
a.cc: In function 'int main()': a.cc:10:7: error: no matching function for call to 'sort(int [202])' 10 | sort(arr); | ~~~~^~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 1 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 1 provided
s929072288
p04047
C
#include <cstdio> #include <vector> #include <algorithm> #define all(v) (v).begin(), (v).end() using namespace std; int main() { int no_of_skewers; scanf("%d", &no_of_skewers); vector <int> length(2*no_of_skewers); for(int i = 0; i < 2*no_of_skewers; i++) scanf("%d", &length[i]); sort(all(length)); int sum = 0; for(int i = 2*no_of_skewers - 2; i >= 0; i-= 2) sum += length[i]; printf("%d\n", sum); return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s547647126
p04047
C
#include <cstdio> #include <vector> #include <algorithm> #define all(v) (v).begin(), (v).end() using namespace std; int main() { int no_of_skewers; scanf("%d", &no_of_skewers); vector <int> length(2*no_of_skewers); for(int i = 0; i < 2*no_of_skewers; i++) scanf("%d", &length[i]); sort(all(length)); int sum = 0; for(int i = 2*no_of_skewers - 2; i >= 0; i-= 2) sum += length[i]; printf("%d\n", sum); return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s272400810
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector vec<int> vec(2*n); for(int i=0;i<2*n;i++){ cin >> vec.at(i); } sort(vec.begin(),vec.end()); int sum=0; for(int i=0;i<n;i++){ sum = sum + vec.at(1+2*i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:7:13: error: expected initializer before '<' token 7 | vector vec<int> vec(2*n); | ^ a.cc:9:12: error: 'vec' was not declared in this scope 9 | cin >> vec.at(i); | ^~~ a.cc:11:8: error: 'vec' was not declared in this scope 11 | sort(vec.begin(),vec.end()); | ^~~
s409322064
p04047
Java
import java.util.Arrays; import java.util.InputMismatchException; import java.util.Scanner; /* AtCoder AGC001-A * BBQ easy : Find the maximum sum */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int numOfSticks; int[] lenOfSticksArr; // get input try { numOfSticks = scanner.nextInt() << 1; // 2N // catch range error if (numOfSticks < 1 || numOfSticks > 100) { throw new InputRangeExceedException(); } lenOfSticksArr = new int[numOfSticks]; for (int i=0; i<numOfSticks; i++) { lenOfSticksArr[i] = scanner.nextInt(); // catch range error if (lenOfSticksArr[i] < 1 || lenOfSticksArr[i] > 100) { throw new InputRangeExceedException(); } } } catch (InputMismatchException | InputRangeExceedException e) { System.out.println("Found err on input"); System.exit(-1); return; } // -------------------------------------------- System.out.println(solve(lenOfSticksArr)); } /** * Solve function for AGC001A * * We can find the answer for this problem just using sort. * The BBQ can needs 2 sticks, and the max # of ingredient is a smaller length of sticks. * Namely we can make BBQ with A ingredients when length A is shorter than B. * For example, sticks that length 10 and 7, can make 1 BBQ with 7 ingredients cause 7 < 10. * In other words, we can solve this problem just using sorting, and just get the odd number of values. * * ex) 3 10 8 6 can ordered * 3 6 8 10, and we know that * 3<6 and 8<10 * so the answer is 3+8 = 11. * Of course, we can make the BBQ like 3 and 10, 8 and 6. but * if this will be 3<10 and 6<8, so the max number of ingredient is 3+6 = 9. * * @param arr the array of sticks * @return the maximum sum that we can stick ingredients */ static int solve(int[] arr) { // sort array in ascending order Arrays.sort(arr); // add odd number of values int sum = 0; for (int i=0; i<arr.length; i+=2) { sum += arr[i]; } return sum; } }
Main.java:20: error: cannot find symbol throw new InputRangeExceedException(); ^ symbol: class InputRangeExceedException location: class Main Main.java:29: error: cannot find symbol throw new InputRangeExceedException(); ^ symbol: class InputRangeExceedException location: class Main Main.java:33: error: cannot find symbol catch (InputMismatchException | InputRangeExceedException e) { ^ symbol: class InputRangeExceedException location: class Main 3 errors
s093078139
p04047
C++
/* Owner: dxxrk Problem: BBQ Easy Date: 20/11/2019 */ #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 3; const int M = 1e6 + 7; const long long MOD = 1e9 + 7; const long long INF = 1e18 + 9; const int SM = 1e3 + 8; const int logN = 20, BL = 400; const double EPS = 3e-16; int main(){ // freopen("ex.in", "r", stdin); // freopen("ex.out", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n; cin >> n; vector<int> a(n * 2, 0); for(auto &i : a) cin >> i; sort(a.begin(), a.end()); int ans = 0; for(int i = 0; i < n * 2; i += 2){ ans += min(a[i], a[i + 1]); } cout << ans return 0; }
a.cc: In function 'int main()': a.cc:34:20: error: expected ';' before 'return' 34 | cout << ans | ^ | ; 35 | return 0; | ~~~~~~
s729652995
p04047
C++
#include<cstdio> #include<cstring> int main(){ int a,b,c,d,i,j; char n[100][100]; char m[100]; while(~scanf("%d%d",&a,&b)) {getchar(); for(i=0;i<a;i++) {gets(n[i]); } for(i=0;i<a-1;i++) { if(strcmp(n[i],n[i+1])>0) { strcpy(m,n[i+1]);strcpy(n[i+1],n[i]);strcpy(n[i],m); } } for(i=0;i<a;i++) printf("%s",n[i]); } }
a.cc: In function 'int main()': a.cc:10:18: error: 'gets' was not declared in this scope; did you mean 'getw'? 10 | {gets(n[i]); | ^~~~ | getw
s352218874
p04047
C
#include<stdio.h> #include<algorithm> using namespace std; int main() { int n,i,t,sum=0; int a[210]={}; while(~scanf("%d",&n)){ t=2*n; for(i=0;i<2*n;i++){ scanf("%d",&a[i]); }sort(a,a+t); for(i=0;i<2*n;i+=2){ sum+=a[i]; }printf("%d\n",sum); sum=0; } }
main.c:2:9: fatal error: algorithm: No such file or directory 2 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s519474686
p04047
C++
#include <bits/stdc++.h> using namespace std; int n , x , y , z = 0; int main() { cin >> n; for (int i = 0 ; i < n ; i++){ cin >> x >> y; z+= min (x , y) } cout << z; }
a.cc: In function 'int main()': a.cc:13:32: error: expected ';' before '}' token 13 | z+= min (x , y) | ^ | ; 14 | } | ~
s785335570
p04047
C
#iclude <stdio.h> int main(){ int N; scanf("%d",&N); int L[2*N]; int i,j,tmp; for(i=0;i<2*N;i++) { scanf("%d",&L[i]); } for(i = 0 ; i < 2*N-1;i++) { for(j=2*N-1;j >i;j--) { if(L[j-1] > L[j]) { tmp = L[j-1]; L[j-1] = L[j]; L[j] = tmp; } } } int ans = 0; for(i = 0; i < 2*N;i+=2) { ans = ans+L[i]; } printf("%d",ans); return 0; }
main.c:1:2: error: invalid preprocessing directive #iclude; did you mean #include? 1 | #iclude <stdio.h> | ^~~~~~ | include main.c: In function 'main': main.c:5:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 5 | scanf("%d",&N); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #iclude <stdio.h> main.c:5:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | scanf("%d",&N); | ^~~~~ main.c:5:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:29:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 29 | printf("%d",ans); | ^~~~~~ main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:29:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:29:9: note: include '<stdio.h>' or provide a declaration of 'printf'
s336017283
p04047
Java
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; import java.util.Arrays; public class AGC001A { public static void main(String[] args) throws Exception { boolean local = System.getSecurityManager() == null; boolean async = false; Charset charset = Charset.forName("ascii"); FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset); Task task = new Task(io, new Debug(local)); if (async) { Thread t = new Thread(null, task, "dalt", 1 << 27); t.setPriority(Thread.MAX_PRIORITY); t.start(); t.join(); } else { task.run(); } if (local) { io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M"); } io.flush(); } public static class Task implements Runnable { final FastIO io; final Debug debug; int inf = (int) 1e8; long lInf = (long) 1e18; double dInf = 1e50; public Task(FastIO io, Debug debug) { this.io = io; this.debug = debug; } @Override public void run() { solve(); } public void solve() { int n = io.readInt(); int[] data = new int[n * 2]; for (int i = 0; i < n * 2; i++) { data[i] = io.readInt(); } Arrays.sort(data); int total = 0; for (int i = 0; i < n; i++) { total += data[i * 2]; } io.cache.append(total); } } public static class FastIO { public final StringBuilder cache = new StringBuilder(1 << 13); private final InputStream is; private final OutputStream os; private final Charset charset; private StringBuilder defaultStringBuf = new StringBuilder(1 << 13); private byte[] buf = new byte[1 << 13]; private int bufLen; private int bufOffset; private int next; public FastIO(InputStream is, OutputStream os, Charset charset) { this.is = is; this.os = os; this.charset = charset; } public FastIO(InputStream is, OutputStream os) { this(is, os, Charset.forName("ascii")); } private int read() { while (bufLen == bufOffset) { bufOffset = 0; try { bufLen = is.read(buf); } catch (IOException e) { throw new RuntimeException(e); } if (bufLen == -1) { return -1; } } return buf[bufOffset++]; } public void skipBlank() { while (next >= 0 && next <= 32) { next = read(); } } public int readInt() { int sign = 1; skipBlank(); if (next == '+' || next == '-') { sign = next == '+' ? 1 : -1; next = read(); } int val = 0; if (sign == 1) { while (next >= '0' && next <= '9') { val = val * 10 + next - '0'; next = read(); } } else { while (next >= '0' && next <= '9') { val = val * 10 - next + '0'; next = read(); } } return val; } public long readLong() { int sign = 1; skipBlank(); if (next == '+' || next == '-') { sign = next == '+' ? 1 : -1; next = read(); } long val = 0; if (sign == 1) { while (next >= '0' && next <= '9') { val = val * 10 + next - '0'; next = read(); } } else { while (next >= '0' && next <= '9') { val = val * 10 - next + '0'; next = read(); } } return val; } public double readDouble() { boolean sign = true; skipBlank(); if (next == '+' || next == '-') { sign = next == '+'; next = read(); } long val = 0; while (next >= '0' && next <= '9') { val = val * 10 + next - '0'; next = read(); } if (next != '.') { return sign ? val : -val; } next = read(); long radix = 1; long point = 0; while (next >= '0' && next <= '9') { point = point * 10 + next - '0'; radix = radix * 10; next = read(); } double result = val + (double) point / radix; return sign ? result : -result; } public String readString(StringBuilder builder) { skipBlank(); while (next > 32) { builder.append((char) next); next = read(); } return builder.toString(); } public String readString() { defaultStringBuf.setLength(0); return readString(defaultStringBuf); } public int readLine(char[] data, int offset) { int originalOffset = offset; while (next != -1 && next != '\n') { data[offset++] = (char) next; next = read(); } return offset - originalOffset; } public int readString(char[] data, int offset) { skipBlank(); int originalOffset = offset; while (next > 32) { data[offset++] = (char) next; next = read(); } return offset - originalOffset; } public int readString(byte[] data, int offset) { skipBlank(); int originalOffset = offset; while (next > 32) { data[offset++] = (byte) next; next = read(); } return offset - originalOffset; } public char readChar() { skipBlank(); char c = (char) next; next = read(); return c; } public void flush() throws IOException { os.write(cache.toString().getBytes(charset)); os.flush(); cache.setLength(0); } public boolean hasMore() { skipBlank(); return next != -1; } } public static class Debug { private boolean allowDebug; public Debug(boolean allowDebug) { this.allowDebug = allowDebug; } public void assertTrue(boolean flag) { if (!allowDebug) { return; } if (!flag) { fail(); } } public void fail() { throw new RuntimeException(); } public void assertFalse(boolean flag) { if (!allowDebug) { return; } if (flag) { fail(); } } private void outputName(String name) { System.out.print(name + " = "); } public void debug(String name, int x) { if (!allowDebug) { return; } outputName(name); System.out.println("" + x); } public void debug(String name, long x) { if (!allowDebug) { return; } outputName(name); System.out.println("" + x); } public void debug(String name, double x) { if (!allowDebug) { return; } outputName(name); System.out.println("" + x); } public void debug(String name, int[] x) { if (!allowDebug) { return; } outputName(name); System.out.println(Arrays.toString(x)); } public void debug(String name, long[] x) { if (!allowDebug) { return; } outputName(name); System.out.println(Arrays.toString(x)); } public void debug(String name, double[] x) { if (!allowDebug) { return; } outputName(name); System.out.println(Arrays.toString(x)); } public void debug(String name, Object x) { if (!allowDebug) { return; } outputName(name); System.out.println("" + x); } public void debug(String name, Object... x) { if (!allowDebug) { return; } outputName(name); System.out.println(Arrays.deepToString(x)); } } }
Main.java:9: error: class AGC001A is public, should be declared in a file named AGC001A.java public class AGC001A { ^ Main.java:11: warning: [removal] getSecurityManager() in System has been deprecated and marked for removal boolean local = System.getSecurityManager() == null; ^ 1 error 1 warning
s140776470
p04047
C++
#include <stdio.h> #define ll long long int #include <queue> #include <vector> #include <iostream> using namespace std; int main(){ ll n[200]; ll t[200]; priority_queue<ll>q; int total,x,s,y,diff,sum; scanf("%d",&total); for(ll i=0;i<2*total;i++){ if(q.size()>0) s=q.pop; scanf("%d",&x); q.push(x); y=q.pop; if(s>y){ diff=s-y; sum+=diff; }else{ diff=y-s; sum+=diff; } } cout<<sum; }
a.cc: In function 'int main()': a.cc:15:23: error: cannot convert 'std::priority_queue<long long int>::pop' from type 'void (std::priority_queue<long long int>::)()' to type 'int' 15 | if(q.size()>0) s=q.pop; | ^~~ a.cc:18:7: error: cannot convert 'std::priority_queue<long long int>::pop' from type 'void (std::priority_queue<long long int>::)()' to type 'int' 18 | y=q.pop; | ^~~
s239135664
p04047
C++
#include <bits/stdc++.h> int main(void) { int n, l[210]; std::cin >> n; for (int i = 0; i < n; i++) std::cin >> l[i]; sort(l, l + n); int ans = 0; for (int i = 0; i < n / 2; i++) ans += l[2 * i]; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': 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, from a.cc:1: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~
s667145721
p04047
C++
#include<bits/stdc++.h> int main() { int n; cin>>n; vector<int> ar(n); for(int i = 0; i<n; i++) cin>>ar[i]; sort(ar.begin(), ar.end()); int ans = 0; for(int i = 0; i<n; i+=2) ans += ar[i]; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:3:10: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 3 | int n; cin>>n; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:4:3: error: 'vector' was not declared in this scope 4 | vector<int> ar(n); | ^~~~~~ a.cc:4:3: note: suggested alternatives: In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/functional:64, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector' 428 | class vector : protected _Vector_base<_Tp, _Alloc> | ^~~~~~ /usr/include/c++/14/vector:93:13: note: 'std::pmr::vector' 93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>; | ^~~~~~ a.cc:4:10: error: expected primary-expression before 'int' 4 | vector<int> ar(n); | ^~~ a.cc:5:33: error: 'ar' was not declared in this scope 5 | for(int i = 0; i<n; i++) cin>>ar[i]; | ^~ a.cc:6:8: error: 'ar' was not declared in this scope 6 | sort(ar.begin(), ar.end()); | ^~ a.cc:6:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 6 | sort(ar.begin(), ar.end()); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ a.cc:9:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 9 | 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:9:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 9 | 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) | ^~~~
s395982371
p04047
C++
#include <iosteram> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N = 505; int n, a[N]; int main(){ cin >> n; int ans = 0; for (int i = 1; i <= n * 2; i++) cin >> a[i]; sort(a + 1, a + n + 1); for (int i = n * 2; i > 1; i -= 2) { ans += a[i - 1]; } cout << ans << endl; }
a.cc:1:10: fatal error: iosteram: No such file or directory 1 | #include <iosteram> | ^~~~~~~~~~ compilation terminated.
s089147169
p04047
C++
#include<iostream> using namespace std; int main(){ int n,ans=0; cin>>n; int l[n]; for(int i=0;i<n;i++) cin>>l[i]; sort(l,l+n); for(int i=0;i<n;i+=2) ans+=l[i]; cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:9:2: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(l,l+n); | ^~~~ | short
s920599604
p04047
C++
・#include <bits/stdc++.h> using namespace std; int main(void){ int N,sum=0; cin >> N; vector<int> vec(2*N); for(int i=0;i<2*N;i++){ cin >> vec.at(i); } sort(vec.begin(), vec.end()); reverse(vec.begin(), vec.end()); for(int i=0;i<2*N;i++){ if(i%2 == 1){ sum+=vec.at(i); } } cout << sum << endl; }
a.cc:1:3: error: stray '#' in program 1 | ・#include <bits/stdc++.h> | ^ a.cc:1:1: error: '\U000030fb' does not name a type 1 | ・#include <bits/stdc++.h> | ^~ a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> N; | ^~~ a.cc:7:3: error: 'vector' was not declared in this scope 7 | vector<int> vec(2*N); | ^~~~~~ a.cc:7:10: error: expected primary-expression before 'int' 7 | vector<int> vec(2*N); | ^~~ a.cc:9:12: error: 'vec' was not declared in this scope 9 | cin >> vec.at(i); | ^~~ a.cc:11:8: error: 'vec' was not declared in this scope 11 | sort(vec.begin(), vec.end()); | ^~~ a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(vec.begin(), vec.end()); | ^~~~ | short a.cc:12:3: error: 'reverse' was not declared in this scope 12 | reverse(vec.begin(), vec.end()); | ^~~~~~~ a.cc:18:3: error: 'cout' was not declared in this scope 18 | cout << sum << endl; | ^~~~ a.cc:18:18: error: 'endl' was not declared in this scope 18 | cout << sum << endl; | ^~~~
s006527718
p04047
C++
#include<vector> #include<iostream> using namespace std; int main() { int n; vector<int> data; cin >> n; data.resize(n*2); for (int i = 0; i < n*2; ++i) { cin >> data[i]; } sort(data.begin(), data.end()); int ans = 0; for (int i = 0; i < n*2; i+=2) { ans += data[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(data.begin(), data.end()); | ^~~~ | short
s712822404
p04047
C++
#include<bits/stdc++.h> using namespace std; int a[10001],n,ans; int main() { cin>>n; for(int i=1;i<=2*n;i++){ cin>a[i]; } sort(a+1,a+1+2*n); for(int i=1;i<=2*n;i+=2){ ans+=a[i]; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:8:12: error: no match for 'operator>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 8 | cin>a[i]; | ~~~^~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:8:12: note: candidate: 'operator>(int, int)' (built-in) 8 | cin>a[i]; | ~~~^~~~~ a.cc:8:12: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1176 | operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1176:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1236 | operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1236:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1329 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1329:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1403 | operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1403:5: note: template argument deduction/substitution failed: a.cc:8:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1497 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1497:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1573 | operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1573:5: note: template argument deduction/substitution failed: a.cc:8:16: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1673 | operator>(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1673:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 8 | cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 8 | cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 462 | operator>(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 507 | operator>(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1714 | operator>(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1774 | operator>(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | cin>a[i]; | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 695 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cin>a[i]; | ^ /usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 702 | operator> (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | cin>a[i]; | ^ /usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed: a.cc:8:16: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 8 | cin>a[i]; | ^ /usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed: a.cc:8:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
s326248490
p04047
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; n = 2*n; int l[1001]; for(int i = 0; i < n; i ++){ cin >> l[i]; } sort(l, l + n); long long ans = 0; for(int i = 0; i < n; i+=2){ ans += l[i]; // cout << l[i]; } cout << ans; }
a.cc: In function 'int main()': a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(l, l + n); | ^~~~ | short
s924365322
p04047
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> l(2*n); for(int i=0;i<2*n;i++){ cin >> l[i]; } sort(a.begin(),a.end()); int ans1=0,ans2=0; for(int i=0;i<n;i++){ if(i%2==0){ ans1+=l[i]; } else{ ans2+=l[i]; } } cout << min(ans1,ans2+l[0]-l[2*n-1]) << endl; }
a.cc: In function 'int main()': a.cc:10:8: error: 'a' was not declared in this scope 10 | sort(a.begin(),a.end()); | ^
s680592669
p04047
Java
import java.util.Arrays; import java.util.Scanner; import java.util.concurrent.atomic.AtomicInteger; /** * @author seki * */ public class EasyBbq { public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { scanner.hasNextInt(); final int n = scanner.nextInt(); int[] l = new int[n * 2]; for (int i = 0; i < l.length; i++) { l[i] = scanner.nextInt(); } final AtomicInteger index = new AtomicInteger(); int sum = Arrays.stream(l).sorted().filter(i -> index.incrementAndGet() % 2 == 1).sum(); System.out.println(sum); } } }
Main.java:9: error: class EasyBbq is public, should be declared in a file named EasyBbq.java public class EasyBbq { ^ 1 error
s121832039
p04047
C++
#include<iostream> #include<vector> using namespace std; int ans=0; int n; int main(){ cin>>n; vector<int> l(2*n); for(int i=0;i<2*n;i++)cin>>l[i]; sort(l.begin(),l.end()); for(int i=0;i<2*n;i+=2)ans+=min(l[i],l[i+1]); cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(l.begin(),l.end()); | ^~~~ | short
s140348328
p04047
C++
#include <cstdio> #include <vector> vector<int> right; int main() { int i,n; scanf("%d",&n); for(i=1; i<=2*n; i++) { int a; scanf("%d",&a); right.push_back(a) } right.sort(right.begin(),right.end()); int sum=0; for(i=0; i<2*n; i++) { if(i%2==0)sum+=right[i]; } printf("%d",sum); }
a.cc:3:1: error: 'vector' does not name a type 3 | vector<int> right; | ^~~~~~ a.cc: In function 'int main()': a.cc:12:9: error: 'right' was not declared in this scope 12 | right.push_back(a) | ^~~~~ a.cc:14:3: error: 'right' was not declared in this scope 14 | right.sort(right.begin(),right.end()); | ^~~~~
s041924611
p04047
C++
#include <iostream> using namespace std; int main(){ int N; int sum=0; cin >> N; int L[2*N]; for(int i=0; i<2*N; i++) cin >> L[i]; sort(L, L+2*N); for(int i=0; i < N; i++) sum += L[i*2]; cout << sum; }
a.cc: In function 'int main()': a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(L, L+2*N); | ^~~~ | short
s398698168
p04047
C
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #define FASTIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define F first #define S second #define PB push_back #define EB emplace_back #define endl "\n" #define gc getchar_unlocked typedef long long ll; typedef long double ld; const double PI=acos(-1.0); const int mod = 1000000007; int main() { FASTIO int n; cin>>n; int a[2*n],sum=0; for(int i=0;i<2*n;i++) cin>>a[i]; sort(a,a+2*n); for(int i=0;i<2*n;i++) { if(!(i&1)) sum+=a[i]; } cout<<sum; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s458178752
p04047
C
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #define FASTIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define F first #define S second #define PB push_back #define EB emplace_back #define endl "\n" #define gc getchar_unlocked typedef long long ll; typedef long double ld; const double PI=acos(-1.0); const int mod = 1000000007; int main() { FASTIO int n; cin>>n; int a[2*n],sum=0; for(int i=0;i<2*n;i++) cin>>a[i]; sort(a,a+2*n); for(int i=0;i<2*n;i++) { if(!(i&1)) sum+=a[i]; } cout<<sum<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s828873050
p04047
C++
#include <iostream> #include <vector> using namespace std; int main() { int n, *l; vector<int> v; scanf("%d", &n); l = new int[2*n]; for (int i = 0; i < 2*n; ++i) { scanf("%d", &l[i]); v.push_back(l[i]); } sort(v.begin(), v.end()); int cnt = 0; int total = 0; for (auto iter = v.begin(); iter < v.end(); iter++) { if ((cnt % 2) == 0) { total += *iter; } cnt++; } printf("%d\n", total); }
a.cc: In function 'int main()': a.cc:14:4: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(v.begin(), v.end()); | ^~~~ | short
s972525792
p04047
C++
#include <iostream> #include <bits/stdc++.h> using namespace std; int main() { int N;//No. of meals that can be prepared cin>>N; vector <int> v(2*N);//Set of length of all skewers for(int i=0;i<2*N;i++){ cin>>v.at(i); } sort(v.begin(),v.end()); int sum=0; for(int i=0;i<2*N;i+=2){ sum+=min_element(v.at(i),v.at(i+2)); } cout<<sum; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]': /usr/include/c++/14/bits/stl_algo.h:5562:12: required from 'constexpr _ForwardIterator std::__min_element(_ForwardIterator, _ForwardIterator, _Compare) [with _ForwardIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 5562 | if (__comp(__first, __result)) | ~~~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5586:43: required from 'constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = int]' 5586 | return _GLIBCXX_STD_A::__min_element(__first, __last, | ^ a.cc:19:25: required from here 19 | sum+=min_element(v.at(i),v.at(i+2)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int') 45 | { return *__it1 < *__it2; } | ^~~~~~
s696192028
p04047
C++
#include <bits/stdc++.h> #include <iostream> using namespace std; int main() { int N,WW=0; cin >> N; vector<int> L(2*N); for(int i=0;i<2*N){ cin >> L.at(i); } sort(L.begin(), L.end()); for(int i=0;i<2*N;i+=2){ WW+=L.at(i); } cout << WW << endl; }
a.cc: In function 'int main()': a.cc:9:20: error: expected ';' before ')' token 9 | for(int i=0;i<2*N){ | ^ | ;
s901797147
p04047
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void){ int n; int L[101]; int tmp, ans = 0; scanf("%d", &n); for(int i = 0; i < n*2; i++){ scanf("%d", &L[i]); } ; i +=2){ if(L[i] < L[i+1]){ ans += L[i]; }else{ ans += L[i+1]; } } printf("%d\n", ans); return 0; }
main.c: In function 'main': main.c:15:6: error: 'i' undeclared (first use in this function) 15 | ; i +=2){ | ^ main.c:15:6: note: each undeclared identifier is reported only once for each function it appears in main.c:15:11: error: expected ';' before ')' token 15 | ; i +=2){ | ^ | ; main.c:15:11: error: expected statement before ')' token
s005614127
p04047
C++
n, = [int(v) for v in input().split()] l = [int(v) for v in input().split()] l.sort() ans = 0 for i in range(n): ans += l[2 * i] print(ans)
a.cc:1:1: error: 'n' does not name a type 1 | n, = [int(v) for v in input().split()] | ^
s570912418
p04047
C++
n=int(input()) l=sorted(map(int,input().split())) ans=0 while len(l)>1: ans+=min(l.pop(),l.pop()) print(ans)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s685223034
p04047
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int n; cin >> n; vector<int>stick(n * 2,0); for(int i=0;i<n * 2;i++){ cin >> stick[i]; } sort(stick.begin(),stick.end()); int ans = 0; for(int i=0;i<N;i++){ ans += min(stick[i * 2],stick[i * 2 + 1]); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:17: error: 'N' was not declared in this scope 19 | for(int i=0;i<N;i++){ | ^
s739255038
p04047
C++
#include<bits/stdc++.h> using namespace std; int a[101],sn; int main() { cin>>n; for(int i=1;i<=n*2;i++)cin>>a[i]; sort(a+1,a+1+2*n); for(int i=1;i<=n*2;i+=2)s+=a[i]; cout<<s<<endl; }
a.cc: In function 'int main()': a.cc:6:6: error: 'n' was not declared in this scope; did you mean 'yn'? 6 | cin>>n; | ^ | yn a.cc:9:25: error: 's' was not declared in this scope 9 | for(int i=1;i<=n*2;i+=2)s+=a[i]; | ^ a.cc:10:7: error: 's' was not declared in this scope; did you mean 'sn'? 10 | cout<<s<<endl; | ^ | sn
s281939849
p04047
C++
#include<iostream> using namespace std; const int N=1e2+4; int a[N]; int main(){ int n; cin>>n; for(int i=0;i<2*n;++i) cin>>a[i]; sort(a,a+2*n); int ans=0; for(int i=0;i<2*n;i+=2){ ans+=a[i]; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(a,a+2*n); | ^~~~ | short
s622315583
p04047
C++
#include <bits/stdc++.h> using namespace std; int main() { int n, count = 0; cin >> n; int a[n]; for (int i = 0; i<n: i++) cin >> a[i]; for (int i= 0; i<n-1 i += 2) count += a[i]; cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:19: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions] 8 | for (int i = 0; i<n: i++) cin >> a[i]; | ^ a.cc:8:22: error: found ':' in nested-name-specifier, expected '::' 8 | for (int i = 0; i<n: i++) cin >> a[i]; | ^ | :: a.cc:8:21: error: 'n' is not a class, namespace, or enumeration 8 | for (int i = 0; i<n: i++) cin >> a[i]; | ^ a.cc:9:3: error: expected primary-expression before 'for' 9 | for (int i= 0; i<n-1 i += 2) count += a[i]; | ^~~ a.cc:8:41: error: expected ';' before 'for' 8 | for (int i = 0; i<n: i++) cin >> a[i]; | ^ | ; 9 | for (int i= 0; i<n-1 i += 2) count += a[i]; | ~~~ a.cc:9:3: error: expected primary-expression before 'for' 9 | for (int i= 0; i<n-1 i += 2) count += a[i]; | ^~~ a.cc:8:41: error: expected ')' before 'for' 8 | for (int i = 0; i<n: i++) cin >> a[i]; | ~ ^ | ) 9 | for (int i= 0; i<n-1 i += 2) count += a[i]; | ~~~ a.cc:9:23: error: expected ';' before 'i' 9 | for (int i= 0; i<n-1 i += 2) count += a[i]; | ^~ | ;
s575709847
p04047
C++
#include <algorithm> #include <iostream> using namespace std; int main() { int L[2*n] = {0} int n, ans=0, cin>>n; for( int i=0; i< 2*n; i++) { cin>> L[i]; } sort(L, L + 2*n); for( int i=0; i< 2*n; i+=2) { ans += L[i] } cout<<ans<</n return 0; }
a.cc: In function 'int main()': a.cc:7:11: error: 'n' was not declared in this scope 7 | int L[2*n] = {0} | ^ a.cc:13:11: error: 'L' was not declared in this scope 13 | cin>> L[i]; | ^ a.cc:15:8: error: 'L' was not declared in this scope 15 | sort(L, L + 2*n); | ^ a.cc:18:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 18 | ans += L[i] | ^~~ | abs a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | cout<<ans<</n | ^~~ | abs a.cc:20:14: error: expected primary-expression before '/' token 20 | cout<<ans<</n | ^
s621258382
p04047
C++
#include <bits/stdc++.h> using namespace std; int main() { int a[200],n; cin >> n; int i=0; for(i=0;i<n*2;i++)cin >> a[i]; sort(a,a+2*n); int sum=0; for(i=0;i<n)sum+=a[2*i]; return 0; }
a.cc: In function 'int main()': a.cc:11:14: error: expected ';' before ')' token 11 | for(i=0;i<n)sum+=a[2*i]; | ^ | ;
s564077653
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> L(2*N); vector<int> big(2*N); for(int i = 0; i < 2*N; i++){ cin >> L.at(i); } int biggest = 0; for(int j = 0; j < 2*N; j++){ for(int k = 0; k < 2*N; k++){ biggest = L.at(0); if(biggest < L.at(k)){ biggest = L.at(k); } } big.at(j) = biggest; for(int p = 0; p < 2*N; p++){ if(L.at(p) == big.at(j)){ L.erase(L.begin() + p); } } } int sum = 0; for(int l = 1; l < 2*N; l += 2){ sum += big[l] } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:37:18: error: expected ';' before '}' token 37 | sum += big[l] | ^ | ; 38 | } | ~
s919008581
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> L(2*N); vector<int> big(2*N); for(int i = 0; i < 2*N; i++){ cin >> L.at(i); } int biggest = 0; for(int j = 0; j < 2*N; j++){ for(int k = 0; k < 2*N; k++){ biggest = L.at(0); if biggest < L.at(k){ biggest = big.at(j); L.erase(L.begin() + k); } } } int sum = 0; for(int l = 1; l < 2*N; l += 2){ sum += big[l] } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:20:10: error: expected '(' before 'biggest' 20 | if biggest < L.at(k){ | ^~~~~~~ | ( a.cc:29:18: error: expected ';' before '}' token 29 | sum += big[l] | ^ | ; 30 | } | ~
s754763016
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vec<int> L(2*N); vec<int> big(2*N); for(int i = 0; i < 2*N; i++){ cin >> L.at(i); } int biggest = 0; for(int j = 0; j < 2*N; j++){ for(int k = 0; k < 2*N; k++){ biggest = L.at(0); if biggest < L.at(k){ biggest = big.at(j); L.erase(L.begin() + k); } } } int sum = 0; for(int l = 1; l < 2*N; l += 2){ sum += big[l] } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:8:3: error: 'vec' was not declared in this scope 8 | vec<int> L(2*N); | ^~~ a.cc:8:7: error: expected primary-expression before 'int' 8 | vec<int> L(2*N); | ^~~ a.cc:9:7: error: expected primary-expression before 'int' 9 | vec<int> big(2*N); | ^~~ a.cc:13:12: error: 'L' was not declared in this scope 13 | cin >> L.at(i); | ^ a.cc:19:17: error: 'L' was not declared in this scope 19 | biggest = L.at(0); | ^ a.cc:20:10: error: expected '(' before 'biggest' 20 | if biggest < L.at(k){ | ^~~~~~~ | ( a.cc:29:12: error: 'big' was not declared in this scope 29 | sum += big[l] | ^~~
s003654819
p04047
Java
package AtCorder.AtCorder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Hello world! * */ public class App { public static void main(String[] args) { String input = "5\n" + "100 1 2 3 14 15 58 58 58 29"; String[] str = input.split("\n"); int first = Integer.parseInt(str[0]); int result = 0; String[] arr = str[1].split(" "); List<String> second = new ArrayList<String>(); second.addAll(Arrays.asList(arr)); for (int i = 0; i < first; i++) { int a = Integer.parseInt(second.get(0)); int data = 5000000; int num = 1; for (int j = 1; j < second.size(); j++) { if (data > Integer.parseInt(second.get(j)) - a && Integer.parseInt(second.get(j))-a >= 0) { data = Integer.parseInt(second.get(j)) - a; num = j; } else if (data > a - Integer.parseInt(second.get(j)) && a - Integer.parseInt(second.get(j)) >= 0) { data = a - Integer.parseInt(second.get(j)); num = j; } } if (a < Integer.parseInt(second.get(num))) { result = result + a; } else { result = result + Integer.parseInt(second.get(num)); } second.remove(num); second.remove(0); } System.out.println(result); } }
Main.java:11: error: class App is public, should be declared in a file named App.java public class App { ^ 1 error
s525820612
p04047
Java
package AtCorder.AtCorder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Hello world! * */ public class App { public static void main(String[] args) { String input = "5\n" + "100 1 2 3 14 15 58 58 58 29"; String[] str = input.split("\n"); int first = Integer.parseInt(str[0]); int result = 0; String[] arr = str[1].split(" "); List<String> second = new ArrayList<String>(); second.addAll(Arrays.asList(arr)); for (int i = 0; i < first; i++) { int a = Integer.parseInt(second.get(0)); int data = 5000000; int num = 1; for (int j = 1; j < second.size(); j++) { if (data > Integer.parseInt(second.get(j)) - a && Integer.parseInt(second.get(j))-a >= 0) { data = Integer.parseInt(second.get(j)) - a; num = j; } else if (data > a - Integer.parseInt(second.get(j)) && a - Integer.parseInt(second.get(j)) >= 0) { data = a - Integer.parseInt(second.get(j)); num = j; } } if (a < Integer.parseInt(second.get(num))) { result = result + a; } else { result = result + Integer.parseInt(second.get(num)); } second.remove(num); second.remove(0); } System.out.println(result); } }
Main.java:11: error: class App is public, should be declared in a file named App.java public class App { ^ 1 error
s526461817
p04047
C++
#include<bits/stdc++.h> using namespace std; int main { int N; cin >> N; vector<int> vec(2N); for (int i = 0; i < 2N; i++) { cin >> vec.at(i); } sort(vec.begin(),vec.end()); int ans = 0; for (int i = 0; i < N; i++) { ans = ans + vec.at(2i); } cout << ans << endl; }
a.cc:3:5: error: cannot declare '::main' to be a global variable 3 | int main { | ^~~~ a.cc:4:3: error: expected primary-expression before 'int' 4 | int N; | ^~~ a.cc:4:3: error: expected '}' before 'int' a.cc:3:10: note: to match this '{' 3 | int main { | ^ a.cc:5:3: error: 'cin' does not name a type 5 | cin >> N; | ^~~ a.cc:6:19: error: unable to find numeric literal operator 'operator""N' 6 | vector<int> vec(2N); | ^~ a.cc:7:3: error: expected unqualified-id before 'for' 7 | for (int i = 0; i < 2N; i++) { | ^~~ a.cc:7:19: error: 'i' does not name a type 7 | for (int i = 0; i < 2N; i++) { | ^ a.cc:7:27: error: 'i' does not name a type 7 | for (int i = 0; i < 2N; i++) { | ^ a.cc:10:7: error: expected constructor, destructor, or type conversion before '(' token 10 | sort(vec.begin(),vec.end()); | ^ a.cc:12:3: error: expected unqualified-id before 'for' 12 | for (int i = 0; i < N; i++) { | ^~~ a.cc:12:19: error: 'i' does not name a type 12 | for (int i = 0; i < N; i++) { | ^ a.cc:12:26: error: 'i' does not name a type 12 | for (int i = 0; i < N; i++) { | ^ a.cc:15:3: error: 'cout' does not name a type 15 | cout << ans << endl; | ^~~~ a.cc:16:1: error: expected declaration before '}' token 16 | } | ^