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 include...
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]; ...
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...
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; ...
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; } } ...
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 stand...
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 ...
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; fo...
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++){ ...
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...
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(); } ...
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(); ...
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();...
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...
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...
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(); ...
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:...
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());...
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()); | ^~~~~...
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.si...
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())); | ...
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()))...
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...
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()))...
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_trait...
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]); st...
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]); st...
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; | ...
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]); } s...
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_vecto...
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: ...
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...
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++) ...
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...
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]) ...
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...
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++ ){ | ~ ...
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...
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++){ | ~ ^~ | ...
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")...
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++){ | ~ ^~ | ...
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");...
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-declarati...
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) = ato...
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, ",") ...
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) = ato...
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::...
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....
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(a...
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, ...
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 << e...
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/...
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...
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 scop...
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/inclu...
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 s...
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(al...
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(al...
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 | s...
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...
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(); ^...
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....
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++...
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...
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: no...
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() == nul...
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; ...
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; ...
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>::p...
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, ...
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/iostrea...
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 << ...
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: 've...
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...
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...
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(); ...
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.b...
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 do...
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 do...
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 = ...
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+...
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...
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);...
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){ | ^ ...
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],stic...
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...
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 | ...
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); | ...
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...
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...
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.a...
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); ...
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(...
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(...
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: erro...