submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s737034126
p04047
C++
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> vec; for(int i = 0; i < 2*n; i ++) { int x; cin >> x; vec.push_back(x); } sort(vec.begin(), vec.end()); int sum = 0; for(int i = 0; i < 2*n; i +=2) sum += vec[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(vec.begin(), vec.end()); | ^~~~ | short
s995033348
p04047
C++
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> l; for (int i = 0; i< 2*n;i++) { int t; cin >> t; l.push_back(t); } sort(l.begin(), l.end()); int sum = 0; for (int i = 0; i< n; i++) { sum += l[2*i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(l.begin(), l.end()); | ^~~~ | short
s967857886
p04047
C++
//座標軸 glBegin(GL_LINES); glVertex2d(-1,0); glVertex2d(1,0); glVertex2d(-1.5/2,1); glVertex2d(-1.5/2,-1); glEnd(); //文字 PrintText(-0.8,0,"0"); Print(-1,0.5,"0.0000001"); Print(-1,-0.5,"0.0000001"); PrintText(-0.25,0,"1"); PrintText(0.25,0,"2"); PrintText(0.75,0,"3"); void PrintText(double w,double h,char str[]){ glRasterPos2d(w,h); for(int i=0;i< sizeof(str[i]);i++){ glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); } } void Print(double w ,double h , char str[]){ glRasterPos2d(w,h); for(int i=0;i< 10;i++){ glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); } }
a.cc:3:12: error: expected constructor, destructor, or type conversion before '(' token 3 | glBegin(GL_LINES); | ^ a.cc:4:15: error: expected constructor, destructor, or type conversion before '(' token 4 | glVertex2d(-1,0); | ^ a.cc:5:15: error: expected constructor, destructor, or type conversion before '(' token 5 | glVertex2d(1,0); | ^ a.cc:6:15: error: expected constructor, destructor, or type conversion before '(' token 6 | glVertex2d(-1.5/2,1); | ^ a.cc:7:15: error: expected constructor, destructor, or type conversion before '(' token 7 | glVertex2d(-1.5/2,-1); | ^ a.cc:8:12: error: expected constructor, destructor, or type conversion before ';' token 8 | glEnd(); | ^ a.cc:11:14: error: expected constructor, destructor, or type conversion before '(' token 11 | PrintText(-0.8,0,"0"); | ^ a.cc:12:10: error: expected constructor, destructor, or type conversion before '(' token 12 | Print(-1,0.5,"0.0000001"); | ^ a.cc:13:10: error: expected constructor, destructor, or type conversion before '(' token 13 | Print(-1,-0.5,"0.0000001"); | ^ a.cc:14:14: error: expected constructor, destructor, or type conversion before '(' token 14 | PrintText(-0.25,0,"1"); | ^ a.cc:15:14: error: expected constructor, destructor, or type conversion before '(' token 15 | PrintText(0.25,0,"2"); | ^ a.cc:16:14: error: expected constructor, destructor, or type conversion before '(' token 16 | PrintText(0.75,0,"3"); | ^ a.cc: In function 'void PrintText(double, double, char*)': a.cc:21:3: error: 'glRasterPos2d' was not declared in this scope 21 | glRasterPos2d(w,h); | ^~~~~~~~~~~~~ a.cc:23:25: error: 'GLUT_BITMAP_TIMES_ROMAN_24' was not declared in this scope 23 | glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:23:5: error: 'glutBitmapCharacter' was not declared in this scope 23 | glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); | ^~~~~~~~~~~~~~~~~~~ a.cc: In function 'void Print(double, double, char*)': a.cc:28:3: error: 'glRasterPos2d' was not declared in this scope 28 | glRasterPos2d(w,h); | ^~~~~~~~~~~~~ a.cc:30:25: error: 'GLUT_BITMAP_TIMES_ROMAN_24' was not declared in this scope 30 | glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:30:5: error: 'glutBitmapCharacter' was not declared in this scope 30 | glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,str[i]); | ^~~~~~~~~~~~~~~~~~~
s590113351
p04047
C++
#include <GL/glut.h> #include <stdio.h> #include <GL/glpng.h> #include <GL/gl.h> #include <stdlib.h> void Display(void); void Reshape(int, int); void Mouse(int, int, int, int); void Keyboard(unsigned char, int, int); // Added void PassiveMotion(int, int); void Motion(int, int); void Entry(int); void Timer(int); void PutSprite(int, int, int, pngInfo *); int XX,YY; GLuint img1, img2; pngInfo info1, info2; int main(int argc, char **argv) { glutInit(&argc, argv); glutInitWindowSize(320, 240); glutCreateWindow("Mouse Sample"); glutDisplayFunc(Display); glutKeyboardFunc(Keyboard); // Added glutReshapeFunc(Reshape); glutInitDisplayMode(GLUT_RGBA); glClearColor(0.0, 0.0, 1.0, 1.0); glutMouseFunc(Mouse); glutPassiveMotionFunc(PassiveMotion); glutMotionFunc(Motion); glutEntryFunc(Entry); // glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // PWG img1 = pngBind("sample1.png", PNG_NOMIPMAP, PNG_ALPHA, &info1, GL_CLAMP, GL_NEAREST, GL_NEAREST); glutDisplayFunc(Display); glutReshapeFunc (Reshape); glutTimerFunc(1000, Timer, 0); // glutMainLoop(); return(0); } // // void Display(void) { int x, y; //int w, h; glClear(GL_COLOR_BUFFER_BIT); //w = glutGet(GLUT_WINDOW_WIDTH); //h = glutGet(GLUT_WINDOW_HEIGHT); x = XX; y = YY; PutSprite(img1, x, y, &info1); /*x = random() % w; y = random() % h; PutSprite(img2, x, y, &info2); */ glFlush(); } // // // void Reshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluOrtho2D(0, w, 0, h); glScaled(1, -1, 1); glTranslated(0, -h, 0); } // // void Mouse(int b, int s, int x, int y) { if (b == GLUT_LEFT_BUTTON) { XX=x; YY=y; } if (b == GLUT_MIDDLE_BUTTON) { XX=x; YY=y; } if (b == GLUT_RIGHT_BUTTON) { XX=x; YY=y; } printf(" at (%d, %d) \n", x, y); } // // // void PassiveMotion(int x, int y) { printf("PassiveMotion : (x, y) = (%d, %d)\n", x, y); } // // void Motion(int x, int y) { printf("Motion : (x, y) = (%d, %d)\n", x, y); } // // void Entry(int s) { if (s == GLUT_ENTERED) printf("Entered\n"); if (s == GLUT_LEFT ) printf("Exited\n"); } // // Processing Key Input // void Keyboard(unsigned char key, int x, int y) { if ((key == 'q') || (key == 27)) { printf("Finished\n"); exit(0); } } void Timer(int t) { glutPostRedisplay(); glutTimerFunc(1000, Timer, 0); } void PutSprite(int num, int x, int y, pngInfo *info) { int w, h; // w = info->Width; h = info->Height; glPushMatrix(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, num); glColor4ub(255, 255, 255, 255); glBegin(GL_QUADS); glTexCoord2i(0, 0); glVertex2i(x, y); glTexCoord2i(0, 1); glVertex2i(x, y + h); glTexCoord2i(1, 1); glVertex2i(x + w, y + h); glTexCoord2i(1,0); glVertex2i(x + w, y); glEnd(); glDisable(GL_TEXTURE_2D); glPopMatrix(); }
a.cc:2:10: fatal error: GL/glut.h: No such file or directory 2 | #include <GL/glut.h> | ^~~~~~~~~~~ compilation terminated.
s483547245
p04047
C++
#include <algorithm> #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; int n, ans; vector<int> l; int main() { cin >> n; for (int i = 1; i <= 2 * n; ++i) { int a; cin >> a; l.push_back(a); } sort(l.begin(), l.end()); for (int i = 0; i < 2 * n; i += 2) { ans += l[i]; } cout << ans << endl; return 0; }
a.cc:9:1: error: 'vector' does not name a type 9 | vector<int> l; | ^~~~~~ a.cc: In function 'int main()': a.cc:15:9: error: 'l' was not declared in this scope 15 | l.push_back(a); | ^ a.cc:17:10: error: 'l' was not declared in this scope 17 | sort(l.begin(), l.end()); | ^
s312257116
p04047
C
#include<cstdio> #include<algorithm> using namespace std; #define Mod 1000000007 #define ll long long #define tc getchar() inline int read(void){ int a=0;static char c; while((c=tc)<'0'||c>'9'); while(c>='0'&&c<='9')a=a*10+c-'0',c=tc; return a; } ll fac[8005],inv[8005],n,f[4005][4005],x[200005],y[200005],ans,b[4005][4005]; inline ll C(ll n,ll m){ return (fac[n]*inv[m]%Mod)*inv[n-m]%Mod; } int main(){ int i,j; fac[0]=inv[0]=inv[1]=1; for(i=2;i<=8004;++i) inv[i]=(Mod-Mod/i)*inv[Mod%i]%Mod; for(i=1;i<=8004;++i) fac[i]=fac[i-1]*i%Mod,inv[i]=inv[i-1]*inv[i]%Mod; n=read(); for(i=1;i<=n;++i) x[i]=read(),y[i]=read(),++f[2001-x[i]][2001-y[i]],++b[2001+x[i]][2001+y[i]]; for(i=1;i<=4004;++i) for(j=1;j<=4004;++j){ f[i][j]=(f[i][j]+f[i-1][j]+f[i][j-1])%Mod; if(b[i][j])ans=(ans+b[i][j]*f[i][j]%Mod)%Mod; } for(i=1;i<=n;++i) ans=(((ans-C((x[i]+y[i])*2,x[i]*2)))%Mod+Mod)%Mod; printf("%d",ans*inv[2]%Mod); return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s664729673
p04047
C++
#include <iostream> using namespace std; int main(void){ int n; int tmp; int sum = 0; cin >> n; int a[200]={999}; for(int i=0;i<(2*n)-1;i++){ for(int j=i;j<(2*n);j++){ if(a[i]<a[j]){ tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } for(i=1;i<N;i++){ if(a[2*i]!=999) sum += a[2*i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:13: error: 'i' was not declared in this scope 19 | for(i=1;i<N;i++){ | ^ a.cc:19:19: error: 'N' was not declared in this scope 19 | for(i=1;i<N;i++){ | ^
s203237760
p04047
C++
#include <iostream> int main(void){ int n; int tmp; sum = 0; cin >> n; int a[200]={999}; for(int i=0;i<(2*n)-1;i++){ for(int j=i;j<(2*n);j++){ if(a[i]<a[j]){ tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } for(i=1;i<N;i++){ if(a[2*i]!=999) sum += a[2*i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:6:9: error: 'sum' was not declared in this scope 6 | sum = 0; | ^~~ a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | 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:18:13: error: 'i' was not declared in this scope 18 | for(i=1;i<N;i++){ | ^ a.cc:18:19: error: 'N' was not declared in this scope 18 | for(i=1;i<N;i++){ | ^ a.cc:21:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 21 | cout << sum << 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:21:24: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 21 | cout << sum << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s170461757
p04047
Java
import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class ProblemA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] skewers = new int[n * 2]; for (int i = 0; i < n * 2; i++) { skewers[i] = sc.nextInt(); } Arrays.sort(skewers); int sum = 0; for (int j = 0; j < n; j++) { sum += skewers[j * 2]; } System.out.println(sum); } }
Main.java:5: error: class ProblemA is public, should be declared in a file named ProblemA.java public class ProblemA { ^ 1 error
s670959305
p04047
Java
import java.io.IOException; import java.util.Arrays; import java.util.Scanner; public class ProblemA { public static void main(String[] args) { try { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] skewers = new int[n * 2]; for (int i = 0; i < n * 2; i++) { skewers[i] = sc.nextInt(); } Arrays.sort(skewers); int sum = 0; for (int j = 0; j < n; j++) { sum += skewers[j * 2]; } System.out.println(sum); } catch (IOException e) { e.printStackTrace(); } } }
Main.java:5: error: class ProblemA is public, should be declared in a file named ProblemA.java public class ProblemA { ^ 1 error
s850151326
p04047
C++
import java.util.Arrays; import java.util.Scanner; public class AtcoderAgc1A { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int [] values = new int[n * 2]; for (int i = 0; i < n * 2; i++) { values[i] = input.nextInt(); } Arrays.sort(values); int sum = 0; for (int i = 1; i < n * 2; i+=2) { sum += Math.min(values[i], values[i - 1]); } System.out.println(sum); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Arrays; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Scanner; | ^~~~~~ 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 AtcoderAgc1A { | ^~~~~~
s591237315
p04047
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> vec (N); for(int i = 0;i < N;i++){ cin >> vec.at(i); } sort(vec.begin(),vec.end()); int awnser = 0; for(int i = 0;i < N;i++){ awnser += max(vec.at(2i),vec.at(2i+1)); } cout << awnser << endl; }
a.cc: In function 'int main()': a.cc:14:37: error: no matching function for call to 'std::vector<int>::at(std::complex<double>)' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ~~~~~~^~~~ 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:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]' 1180 | at(size_type __n) | ^~ /usr/include/c++/14/bits/stl_vector.h:1180:20: note: no known conversion for argument 1 from 'std::complex<double>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1180 | at(size_type __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]' 1199 | at(size_type __n) const | ^~ /usr/include/c++/14/bits/stl_vector.h:1199:20: note: no known conversion for argument 1 from 'std::complex<double>' to 'std::vector<int>::size_type' {aka 'long unsigned int'} 1199 | at(size_type __n) const | ~~~~~~~~~~^~~ a.cc:14:51: error: no match for 'operator+' (operand types are 'std::complex<double>' and 'int') 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ~~^~ | | | | | int | std::complex<double> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:14:52: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:14:52: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:14:52: note: mismatched types 'const _CharT*' and 'std::complex<double>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:14:52: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:14:52: note: 'std::complex<double>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:14:52: note: mismatched types 'const _CharT*' and 'std::complex<double>' 14 | awnser += max(vec.at(2i),vec.at(2i+1)); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Al
s162306982
p04047
C++
#--- define function ---# def num_check(n, l): if 2 * n == len(l): return True else: return False #--- main ---# num = int(input()) l = input().split() list = [int(i) for i in l] if not num_check(num, list): print("Invalid numbers.") exit() list.sort() meet = 0 for i in range(num): num1 = int(list.pop(0)) list.pop(0) meet += num1 print(meet)
a.cc:1:2: error: invalid preprocessing directive #-- 1 | #--- define function ---# | ^~ a.cc:8:2: error: invalid preprocessing directive #-- 8 | #--- main ---# | ^~ a.cc:2:1: error: 'def' does not name a type 2 | def num_check(n, l): | ^~~
s214557909
p04047
C++
#include <iostream> #include <algorithm> #include <cmath> #include <limits> #include <vector> #include <cstdio> #include <bits/stdc++.h> #include <set> using namespace std; using ll =long long; int main (void) { int N; cin >> N; int a[N]; int b=0; int sum=0; for (int i=0; i<N; i++) { cin >> b; a[i]=b; } a.sort(); for (int i=0; i<N; i=i+2) { sum=a[i]+sum; } cout << sum; }
a.cc: In function 'int main()': a.cc:22:5: error: request for member 'sort' in 'a', which is of non-class type 'int [N]' 22 | a.sort(); | ^~~~
s733669136
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(l.begin(), l.end()); ll ans = 0; for (int i = 0; i < n; ++i) ans += l[2*i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'll' was not declared in this scope; did you mean 'l'? 9 | ll ans = 0; | ^~ | l a.cc:11:31: error: 'ans' was not declared in this scope; did you mean 'abs'? 11 | for (int i = 0; i < n; ++i) ans += l[2*i]; | ^~~ | abs a.cc:12:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | cout << ans << endl; | ^~~ | abs
s146490722
p04047
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class ACG001B { public static void main(String args[]) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Integer N = Integer.parseInt(br.readLine()); String L = br.readLine(); String[] Llist = L.split(" "); ArrayList<Integer> numList = new ArrayList<Integer>(); for(int i = 0; i < N*2; i++){ numList.add(Integer.parseInt(Llist[i])); } Collections.sort(numList, Collections.reverseOrder()); // 降順に並べて上から2つずつ取る // 低い方の値を採用して、全部足す Integer output = 0; for(int i = 0; i < N*2; i++){ if(i % 2 == 0){ continue; }else{ output += numList.get(i); } } System.out.println(output); } }
Main.java:6: error: class ACG001B is public, should be declared in a file named ACG001B.java public class ACG001B { ^ 1 error
s726228867
p04047
C
#include<iostream> #include<algorithm> using namespace std; int n; int l[120]={}; int main() { cin>>n; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); int anss=0; for(int i=1;i<=2*n;i++) if(i%2!=0) { anss+=l[i]; } cout<<anss<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s390995103
p04047
C
#include<bits/stdc++.h> using namespace std; int n; int l[120]={}; int main() { cin>>n; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); int ans=0; for(int i=1;i<=2*n;i++) if(i%2!=0) { ans+=l[i]; } cout<<ans<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s854228819
p04047
C
#include<bits/stdc++.h> using namespace std; int n,a[110],b[110],ans=0,minn,k; int main() { scanf("%d",&n); n*=2; for(int i=1;i<=n;i++)scanf("%d",&a[i]); for(int i=1;i<=n;i++) { minn=10000; k=0; for(int j=i+1;j<=n;j++) { if(abs(a[i]-a[j])<minn && a[i]!=10000 && a[j]!=10000) { minn=abs(a[i]-a[j]); k=j; } } if(a[i]!=10000 && a[k]!=10000) { ans+=min(a[i],a[k]); a[i]=10000; a[k]=10000; } } printf("%d",ans); return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s521677118
p04047
C++
7:51:08 九只羊 2018/4/19 7:51:08 #include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int l[120]={}; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); long long ans=0; for(int i=1;i<=2*n;) { ans+=l[i]; i+=2; } cout<<ans<<endl; return 0; }
a.cc:1:6: error: invalid digit "8" in octal constant 1 | 7:51:08 | ^~ a.cc:2:23: error: invalid digit "8" in octal constant 2 | 九只羊 2018/4/19 7:51:08 | ^~ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 7:51:08 | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; |
s244054685
p04047
C
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int l[120]={}; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); long long ans=0; for(int i=1;i<=2*n;) { ans+=l[i]; i+=2; } cout<<ans<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s845867014
p04047
C
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int l[120]={}; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); long long ans=0; for(int i=1;i<=2*n;) { ans+=l[i]; i+=2; } cout<<ans<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s427874857
p04047
C
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int l[120]={}; for(int i=1;i<=2*n;i++) { cin>>l[i]; } sort(l+1,l+2*n+1); long long ans=0; for(int i=1;i<=2*n;i+=2) ans+=l[i]; cout<<ans<<endl; return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s201350866
p04047
C
#include <bits/stdc++.h> using namespace std; const int N=1e4; int n,s; int a[N]; int main() { cin>>n; n*=2; for (int i=0;++i<=n;) cin>>a[i]; sort(a+1,a+n+1); for (int i=1;i<=n;i+=2) s+=a[i]; cout<<s; return 0; }
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory 1 | #include <bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s081578573
p04047
C
#include<bits/stdc++.h> using namespace std; int n,a[2001],sum=0; inline void init() { scanf("%d",&n); n*=2; for (int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+n+1); } inline void work() { for (int i=1;i<=n;i++) if (i%2==1) sum+=a[i]; } int main() { init(); work(); printf("%d\n",sum); return 0; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s236789967
p04047
C
#include<bits/stdc++.h> using namespace std; int main() { int n,a[220]={},ans=0; cin>>n; for(int i=1;i<=2*n;i++) cin>>a[i]; sort(a+1,a+2*n+1); for(int i=1;i<=2*n;i+=2) { ans+=a[i]; } cout<<ans; }
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory 1 | #include<bits/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s972518110
p04047
C++
#include <iostream> #include <string> #include <string.h> #include <map> #include <set> #include <vector> #include <stdio.h> #include <math.h> #include <algorithm> #include <queue> #include <cmath> #include <cstdio> using namespace std; int a[100]; int main(){ int n; cin>>n; for(int i=0;i<n;i++) cin>>a[i]; sort(a.begin().a.end()); int ans; for(int i=0;i<n;i+=2) ans+=min(a[i],a[i+1]); cout<<ans; system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:20:8: error: request for member 'begin' in 'a', which is of non-class type 'int [100]' 20 | sort(a.begin().a.end()); | ^~~~~
s536110669
p04047
C++
input(),print(sum(sorted(list(map(int,input().split())))[::2]))
a.cc:1:8: error: expected constructor, destructor, or type conversion before ',' token 1 | input(),print(sum(sorted(list(map(int,input().split())))[::2])) | ^ a.cc:1:14: error: expected constructor, destructor, or type conversion before '(' token 1 | input(),print(sum(sorted(list(map(int,input().split())))[::2])) | ^
s137897851
p04047
C++
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n; 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 cnt=0; for(int i=0; i<2*n; i+=2) cnt+=a[i]; System.out.println(cnt); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s886277148
p04047
C++
gets;p gets.split.map(&:to_i).sort.each_slice(2).map(&:min).inject :+
a.cc:1:1: error: 'gets' does not name a type 1 | gets;p gets.split.map(&:to_i).sort.each_slice(2).map(&:min).inject :+ | ^~~~ a.cc:1:6: error: 'p' does not name a type 1 | gets;p gets.split.map(&:to_i).sort.each_slice(2).map(&:min).inject :+ | ^
s824063457
p04047
C++
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int n,a[102],cnt=0,; int main() { scanf("%d",&n); for(int i=1;i<=2*n;i++) scanf("%d",&a[i]); sort(a+1,a+2*n+1); for(int i=1;i<=2*n-1;i+=2) cnt+=min(a[i],a[i+1]); printf("%d",cnt); return 0; }
a.cc:5:20: error: expected unqualified-id before ';' token 5 | int n,a[102],cnt=0,; | ^
s020054211
p04047
C++
v#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; #define int long long int dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; int N; int L[200]; signed main() { cin >> N; for (int i = 0; i < 2 * N; i++) { cin >> L[i]; } sort(L, L + 2 * N); int ans = 0; for (int i = 0; i < 2 * N; i += 2) { ans += L[i]; } cout << ans << endl; return 0; }
a.cc:1:2: error: stray '#' in program 1 | v#define _USE_MATH_DEFINES | ^ a.cc:1:1: error: 'v' does not name a type 1 | v#define _USE_MATH_DEFINES | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 |
s847408034
p04047
C++
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<cstring> #include<map> #include<set> #include<deque> #include<caserrt> using namespace std; #define sz(x) (int)(x.size()) #define fi(a,b) for(int i=a;i<b;++i) #define fj(a,b) for(int j=a;j<b;++j) #define fo(a,b) for(int o=a;o<b;++o) #define fdi(a,b) for(int i=a-1;i>=b;--i) #define fdj(a,b) for(int j=a-1;j>=b;--j) #define fdo(a,b) for(int o=a-1;o>=b;--o) #define pb push_back #define mp make_pair typedef pair<int, int> pii; typedef long long ll; ///////////////////////////////// int const N = 241; int n, l[N], ans; void solve(){ sort(l, l+n); fi(0, n){ ans += l[i]; ++i; } } int main(){ #ifdef _DEBUG freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif scanf("%d",&n); fi(0, n * 2) scanf("%d",&l[i]); solve(); printf("%d\n",ans); return 0; }
a.cc:9:9: fatal error: caserrt: No such file or directory 9 | #include<caserrt> | ^~~~~~~~~ compilation terminated.
s000583005
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector <int> x(2*n); for(int i = 0; i < 2*n;i++){ cin >> x[i]; }   sort(x.begin(),x.end()); int answer = 0; for(int i = 0;i < n;i++){ answer = x[2*i]; cout << answer << endl; return 0; } }
a.cc:16:1: error: extended character   is not valid in an identifier 16 |   sort(x.begin(),x.end()); | ^ a.cc: In function 'int main()': a.cc:16:1: error: '\U000000a0' was not declared in this scope 16 |   sort(x.begin(),x.end()); | ^
s247670468
p04047
C++
#include <bits/stdc++.h> int main(){ int n; cin >> n; vector<int> x(2*n); for(int i=0; i<2*n; ++i) cin >> x[i]; sort(x.begin(), x.end()); int ans = 0; for(int i=0; i<n; ++i) ans += x[2*i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:4:4: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 4 | 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:5:4: error: 'vector' was not declared in this scope 5 | vector<int> x(2*n); | ^~~~~~ a.cc:5:4: 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:5:11: error: expected primary-expression before 'int' 5 | vector<int> x(2*n); | ^~~ a.cc:7:11: error: 'x' was not declared in this scope 7 | cin >> x[i]; | ^ a.cc:8:9: error: 'x' was not declared in this scope 8 | sort(x.begin(), x.end()); | ^ a.cc:8:4: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 8 | sort(x.begin(), x.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:12:4: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 12 | 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:12:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 12 | 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) | ^~~~
s867695011
p04047
C++
1. using namespace std; 2.   3. int main() 4. { 5. int n; 6. cin >> n; 7. vector<int> x(2*n); 8. for(int i=0; i<2*n; ++i) 9. cin >> x[i]; 10.   11. sort(x.begin(), x.end()); 12. int ans = 0; 13. for(int i=0; i<n; ++i) 14. ans += x[2*i]; 15. cout << ans << endl; 16.   17. return 0; 18. }
a.cc:2:4: error: extended character   is not valid in an identifier 2 | 2.   | ^ a.cc:10:5: error: extended character   is not valid in an identifier 10 | 10.   | ^ a.cc:16:5: error: extended character   is not valid in an identifier 16 | 16.   | ^ a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1. using namespace std; | ^~ a.cc:2:1: error: expected unqualified-id before numeric constant 2 | 2.   | ^~
s602924013
p04047
C++
//InTheNameOfGod #include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i,j,k) for(int i=j;i<k;++i) #define rrep(i,j,k) for(int i=j;i>=k;i--) #define pb push_back #define lb(i) i&(-i); const int maxn =2e6+6; int n,a[maxn]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); cin>>n; rep(i,0,n)cin>>a[i]; sort(a,a+n)cin>>a[i]; int re=0; rep(i,0,n) { if(i%2==0)re+=a[i]; } cout<<re; return 0; }
a.cc: In function 'int main()': a.cc:16:16: error: expected ';' before 'cin' 16 | sort(a,a+n)cin>>a[i]; | ^~~ | ;
s889869038
p04047
C++
//InTheNameOfGod #include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i,j,k) for(int i=j;i<k;++i) #define rrep(i,j,k) for(int i=j;i>=k;i--) #define pb push_back #define lb(i) i&(-i); const int maxn =2e6+6; int n,a[maxn]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); cin>>n; rep(i,0,n)cin>>a[i]; sort(a,a+n); int re=0 rep(i,0,n) { if(i%2==0)re+=a[i]; } cout<<re; return 0; }
a.cc: In function 'int main()': a.cc:5:20: error: expected ',' or ';' before 'for' 5 | #define rep(i,j,k) for(int i=j;i<k;++i) | ^~~ a.cc:18:5: note: in expansion of macro 'rep' 18 | rep(i,0,n) | ^~~ a.cc:18:9: error: 'i' was not declared in this scope 18 | rep(i,0,n) | ^ a.cc:5:32: note: in definition of macro 'rep' 5 | #define rep(i,j,k) for(int i=j;i<k;++i) | ^
s629767438
p04047
C++
#include <iostream> #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]; int s=0; sort(a,a+2*n); for(int i=0;i<2*n;i+=2) s=(a[i]>a[i+1])?s+a[i+1]:s+a[i]); cout << s; }
a.cc: In function 'int main()': a.cc:14:40: error: expected ';' before ')' token 14 | s=(a[i]>a[i+1])?s+a[i+1]:s+a[i]); | ^ | ;
s511641046
p04047
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin >> n; int a[2n]; for(int i=0;i<2n;i++) cin>>a[i]; int s=0; sort(a,a+2n); for(int i=0;i<2n;i++) s=s+((a[i]>a[i+1])?a[i+1]:a[i]); cout << s; }
a.cc: In function 'int main()': a.cc:8:15: error: unable to find numeric literal operator 'operator""n' 8 | int a[2n]; | ^~ a.cc:9:23: error: unable to find numeric literal operator 'operator""n' 9 | for(int i=0;i<2n;i++) | ^~ a.cc:10:14: error: 'a' was not declared in this scope 10 | cin>>a[i]; | ^ a.cc:12:14: error: 'a' was not declared in this scope 12 | sort(a,a+2n); | ^ a.cc:12:18: error: unable to find numeric literal operator 'operator""n' 12 | sort(a,a+2n); | ^~ a.cc:13:23: error: unable to find numeric literal operator 'operator""n' 13 | for(int i=0;i<2n;i++) | ^~
s210247942
p04047
C++
include <iostream> #include <algoithm> using namespace std; int main() { int n; cin >> n; int a[2n]; for(int i=0;i<2n;i++) cin>>a[i]; int s=0; sort(a,a+2n); for(int i=0;i<2n;i++) s=s+((a[i]>a[i+1])?a[i+1]:a[i]); cout << s; }
a.cc:2:10: fatal error: algoithm: No such file or directory 2 | #include <algoithm> | ^~~~~~~~~~ compilation terminated.
s060257919
p04047
C++
#include <iostream> #include <algorithm> using namespace std; main() { int n; cin>> n; int a[2n]; for(int i=0;i<2n;i++) cin >> a[i]; sort (a,a+2n); int s=0; for(int i=0;i<2n;i+=2) { s=s+((a[i]>a[i+1])?a[i+1]:a[i]); } cout << s; }
a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~ a.cc: In function 'int main()': a.cc:8:11: error: unable to find numeric literal operator 'operator""n' 8 | int a[2n]; | ^~ a.cc:9:19: error: unable to find numeric literal operator 'operator""n' 9 | for(int i=0;i<2n;i++) | ^~ a.cc:10:8: error: 'a' was not declared in this scope 10 | cin >> a[i]; | ^ a.cc:11:7: error: 'a' was not declared in this scope 11 | sort (a,a+2n); | ^ a.cc:11:11: error: unable to find numeric literal operator 'operator""n' 11 | sort (a,a+2n); | ^~ a.cc:13:15: error: unable to find numeric literal operator 'operator""n' 13 | for(int i=0;i<2n;i+=2) | ^~
s274919694
p04047
C++
#include <iostream> using namespace std; int main() {
a.cc: In function 'int main()': a.cc:5:2: error: expected '}' at end of input 5 | { | ~^
s166529292
p04047
C++
#include <bits.stdc++.h> using namespace std; int n; int a[202]; int main() { 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:1:10: fatal error: bits.stdc++.h: No such file or directory 1 | #include <bits.stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s211703351
p04047
C++
#include<iostream> using namespace std; int main(){ int n; cin >> n; int l[2*n]; int i,j; for(i=0;i<2*n;i++){ cin >> l[i]; } for(i=0;i<2*n;i++){ for(j=0j<2*n-1-i;j++){ if(l[j]>l[j+1]){ int x=l[j]; l[j]=l[j+1]; l[j+1]=x; } } } int ans; for(i=0;i<n;i++){ ans +=l[i*2]; } cout << ans <<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:9: error: invalid operands of types '__complex__ int' and 'int' to binary 'operator<' 12 | for(j=0j<2*n-1-i;j++){ | ~~^~~~~~~~ | | | | | int | __complex__ int a.cc:12:21: error: expected ';' before ')' token 12 | for(j=0j<2*n-1-i;j++){ | ^ | ;
s834586013
p04047
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int N; int L[N]; for(int i = 0; i < 2*N; i++){ cin >> L[i]; } sort(L, L+2N); int sum = 0; for(int i = 0; i < N; i++){ sum += L[2*N]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:13: error: unable to find numeric literal operator 'operator""N' 12 | sort(L, L+2N); | ^~
s210716867
p04047
C++
#include <iostraem> #include <algorithm> using namespace std; int main(){ int N; int L[N]; for(int i = 0; i < 2*N; i++){ cin >> L[i]; } sort(L, L+2N); int sum = 0; for(int i = 0; i < N; i++){ sum += L[2*N]; } cout << sum << endl; return 0; }
a.cc:1:10: fatal error: iostraem: No such file or directory 1 | #include <iostraem> | ^~~~~~~~~~ compilation terminated.
s141310213
p04047
C++
#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; void solve(vector<int> &v) { sort(v.begin(),v.end()); // reverse(v.begin(), v.end()); int res = 0; for(size_t i = 0 ; i < v.size()-1 ; i+=2) { res += min(v[i],v[i+1]); } cout << res << endl; } int main(void) { int n; cin >> n; vector<int> v; while(n--) { int tmp; cin >> tmp; v.push_back(tmp); } // vector<int> v={1 ,3, 1, 2}; // vector<int> v2 = {100 ,1 ,2 ,3 ,14 ,15 ,58 ,58, 58 ,29}; solve(v2); return 0; }
a.cc: In function 'int main()': a.cc:32:15: error: 'v2' was not declared in this scope; did you mean 'v'? 32 | solve(v2); | ^~ | v
s676211997
p04047
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main_tmp(void) { int n; cin >> n; vector<int> v(n); int idx=0; while(n--) { cin >> v[idx++]; } sort(v.begin(),v.end()); reverse(v.begin(), v.end()); if(v.size() >= 2) { cout << v[1] << endl; }else { cout << v[0] << endl; } return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s001571395
p04047
C++
#include <iostream> #include <vector> using namespace std; int main(void) { int n; cin >> n; vector<int> v(n); int idx=0; while(n--) { cin >> v[idx++]; } sort(v.begin(),v.end()); reverse(v.begin(), v.end()); if(v.size() >= 1) { cout << v[1] << endl; }else { cout << v[0] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(v.begin(),v.end()); | ^~~~ | short a.cc:15:9: error: 'reverse' was not declared in this scope 15 | reverse(v.begin(), v.end()); | ^~~~~~~
s925131358
p04047
C++
#include <iostream> using namespace std; int main(void) { int n; cin >> n; vector<int> v(n); int idx=0; while(n--) { cin >> v[idx++]; } sort(v.begin(),v.end()); reverse(v.begin(), v.end()); if(v.size() >= 1) { cout << v[1] << endl; }else { cout << v[0] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'vector' was not declared in this scope 7 | vector<int> v(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include <iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:7:16: error: expected primary-expression before 'int' 7 | vector<int> v(n); | ^~~ a.cc:11:24: error: 'v' was not declared in this scope 11 | cin >> v[idx++]; | ^ a.cc:13:14: error: 'v' was not declared in this scope 13 | sort(v.begin(),v.end()); | ^ a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(v.begin(),v.end()); | ^~~~ | short a.cc:14:9: error: 'reverse' was not declared in this scope 14 | reverse(v.begin(), v.end()); | ^~~~~~~
s282379812
p04047
C++
n = input() a = sorted(map(int, raw_input().split())) print sum([a[2 * i] for i in xrange(n)])
a.cc:1:1: error: 'n' does not name a type 1 | n = input() | ^
s362182072
p04047
C++
#include <iostream> #include <vector> int main(int argc, char* argv[]) { int n; scanf("%d", &n); std::vector<int> input(2*n); for(int i = 0; i < input.size(); ++i){ scanf("%d", &input[i]); } sort(input.begin(), input.end()); int ans = 0; for(int i = 0; i < input.size(); i += 2){ ans += input[i]; } printf("answer : %d\n", ans); return 0; }
a.cc: In function 'int main(int, char**)': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(input.begin(), input.end()); | ^~~~ | short
s378896913
p04047
C++
#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<vector> #include<string> #include<iostream> #include<algorithm> #include<map> #include<iterator> #include<set> #include<stack> #include<queue> #include<fstream> #include<iomanip> #include <unordered_map> #include <unordered_set> #include <numeric> #include<cmath> #include<list> #include <sstream> #include<unordered_map> using namespace std; #define FOR(i,a,b) for(int i = (a); i < (b); i++) #define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--) #define ITER(it,a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++) #define FILL(a,value) memset(a, value, sizeof(a)) #define ALL(a) a.begin(),a.end() #define SZ(a) (int)a.size() #define PB push_back #define MP make_pair typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PII; const double PI = acos(-1.0); const int INF = 1000 * 1000 * 1000 + 7; const LL LINF = INF * (LL)INF; const int MAX = 5 * 1000 * 100 + 47; int P[MAX]; int ANS[MAX]; int M[MAX]; priority_queue<int> q; struct RMQ { int T[MAX * 4]; int n; int Max(int a, int b) { return P[a] > P[b] ? a : b; } void build(int v, int tl, int tr) { if (tl == tr) { T[v] = tl; return; } int tm = (tl + tr) / 2; build(2 * v, tl, tm); build(2 * v + 1, tm + 1, tr); T[v] = Max(T[2 * v], T[2 * v + 1]); } void init(int n) { this->n = n; build(1, 0, n - 1); } int get1(int v, int tl, int tr, int l, int r) { if (l > r) return n - 1; if (tl == l && tr == r) return T[v]; int tm = (tl + tr) / 2; int v1 = get1(2 * v, tl, tm, l, min(r, tm)); int v2 = get1(2 * v + 1, tm + 1, tr, max(l, tm + 1), r); return Max(v1, v2); } int get(int l, int r) { return get1(1, 0, n - 1, l, r); } void update(int v, int tl, int tr, int ind, int val) { if (tl == tr) { T[v] = tl; P[tl] = val; return; } int tm = (tl + tr) / 2; if (tm >= ind) { update(2 * v, tl, tm, ind, val); } else { update(2 * v + 1, tm + 1, tr, ind, val); } T[v] = Max(T[2 * v + 1], T[2 * v]); } void update(int ind, int val) { update(1, 0, n - 1, ind, val); } } R; int n, k; void upd(int block) { int l = block * k; int r = min((block + 1) * k - 1, n - 1); int ind = R.get(l, r); if (ind == M[block] || ind == n) return; int v = R.get(max(ind - k + 1, 0), min(ind + k - 1, n - 1)); if (v == ind) { q.push(ind); M[block] = ind; } } int main() { //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); ios::sync_with_stdio(false); cin.tie(0); cin >> n >> k; FOR(i, 0, n) { cin >> P[i]; P[i]--; } P[n] = -INF; R.init(n + 1); int sz = (n + k - 1) / k; FILL(M, -1); FOR(i, 0, sz) { upd(i); } int ind = n - 1; while (!q.empty()) { int pos = q.top(); q.pop(); ANS[pos] = ind; R.update(pos, -INF); int block = pos / k; upd(block); if (block) upd(block - 1); if (block + 1 != sz) upd(block + 1); ind--; } FOR(i, 0, n) cout << ANS[i] + 1 << "\n"; }
a.cc: In function 'int main()': a.cc:26:23: error: 'memset' was not declared in this scope 26 | #define FILL(a,value) memset(a, value, sizeof(a)) | ^~~~~~ a.cc:153:9: note: in expansion of macro 'FILL' 153 | FILL(M, -1); | ^~~~ a.cc:19:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 18 | #include<list> +++ |+#include <cstring> 19 | #include <sstream>
s465239723
p04047
C++
#include<iostream> using namespace std; int main(){count << 3; return 0;}
a.cc: In function 'int main()': a.cc:4:12: error: 'count' was not declared in this scope 4 | int main(){count << 3; return 0;} | ^~~~~
s721706968
p04047
Java
import java.util.Scanner; public class BBQ { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int[] L = new int[2*N]; int temp = 0, result = 0; for (int i = 0; i < 2*N; i++) { L[i] = scanner.nextInt(); } for (int i = 0; i < L.length; i++) { for (int j = i; j < L.length; j++) { if (L[i] > L[j]) { temp = L[i]; L[i] = L[j]; L[j] = temp; } } } for (int i = 0; i < L.length; i=i+2) { result += L[i]; } System.out.println(result); } }
Main.java:3: error: class BBQ is public, should be declared in a file named BBQ.java public class BBQ { ^ 1 error
s184665114
p04047
Java
import java.util.*; public class Main { public void main(String[] args) { Scanner sc = new Scanner(System.in); int maxCnt = sc.nextInt(); int[] arr = new int[maxCnt*1]; for (int i = 0; i < arr.length; i++) { arr[i] = sc.nextInt(); } sort(arr, 0, arr.length); int sum = 0; for(int i = 0; i < maxCnt * 2; i+=2) { sum += arr[i+1]; } System.out.println(sum); } private void sort(int[] arr, int start, int end) { if(start >= end) { return; } int originStart = start; int originEnd = end; int target = arr[start]; while(start < end) { while(start < end && target > arr[end]) { end--; } if(start < end) { int temp = arr[end]; arr[end] = arr[start]; arr[start] = temp; } while(start < end && arr[start] >= target) { start++; } if(start < end) { temp = arr[end]; arr[end] = arr[start]; arr[start] = temp; } } sort(arr, originStart, start - 1); sort(arr, end + 1, originEnd); } }
Main.java:46: error: cannot find symbol temp = arr[end]; ^ symbol: variable temp location: class Main Main.java:48: error: cannot find symbol arr[start] = temp; ^ symbol: variable temp location: class Main 2 errors
s040653895
p04047
Java
public void main(String[] args) { Scanner sc = new Scanner(System.in); int maxCnt = sc.nextInt(); int[] arr = new int[maxCnt*1]; for (int i = 0; i < arr.length; i++) { arr[i] = sc.nextInt(); } sort(arr, 0, arr.length); int sum = 0; for(int i = 0; i < maxCnt * 2; i+=2) { sum += arr[i+1]; } System.out.println(sum); } private void sort(int[] arr, int start, int end) { if(start >= end) { return; } int originStart = start; int originEnd = end; int target = arr[start]; while(start < end) { while(start < end && target > arr[end]) { end--; } int temp = arr[end]; arr[end] = arr[start]; arr[start] = temp; while(start < end && arr[start] >= target) { start++; } temp = arr[end]; arr[end] = arr[start]; arr[start] = temp; } sort(arr, originStart, start - 1); sort(arr, end + 1, originEnd); }
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. public void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s173234705
p04047
C++
#include<iostream> #include<cmath> #include<algorithm> #include<iomanip> #include<string> #include<vector> #include<cstdio> #include<cstring> #include<map> #include<set> #include<fstream> #include<sstream> #include<queue> #include<iterator> using namespace std; vector<int> g[2000]; int n,k; int dfs(int x,int pre,int d,int mx){ int ans=1; if(d!=mx){ for(int i=0;i<g[x].size();i++) if(g[x][i]!=pre)ans+=dfs(g[x][i],x,d+1,mx); } return ans; } int main(){ cin>>n>>k; for(int i=1;i<n;i++){ int a,b; cin>>a>>b; a--; b--; g[a].push_back(b); g[b].push_back(a); } int ans=0; if(k%2==0){ for(int i=0;i<n;i++) ans=max(ans,dfs(i,-1,0,k/2)); } else{ for(int i=0;i<n;i++) for(int j=0;j<g[i].size();j++) ans=max(ans,dfs(i,g[i][j],0,k/2)+dfs(g[i][j],i,0,k/2)); } cout<<n-ans<<endl; return 0; } #include<iostream> #include<cmath> #include<algorithm> #include<iomanip> #include<string> #include<vector> #include<cstdio> #include<cstring> #include<map> #include<set> #include<fstream> #include<sstream> #include<queue> #include<iterator> using namespace std; vector<int> g[2000]; int n,k; int dfs(int x,int pre,int d,int mx){ int ans=1; if(d!=mx){ for(int i=0;i<g[x].size();i++) if(g[x][i]!=pre)ans+=dfs(g[x][i],x,d+1,mx); } return ans; } int main(){ cin>>n>>k; for(int i=1;i<n;i++){ int a,b; cin>>a>>b; a--; b--; g[a].push_back(b); g[b].push_back(a); } int ans=0; if(k%2==0){ for(int i=0;i<n;i++) ans=max(ans,dfs(i,-1,0,k/2)); } else{ for(int i=0;i<n;i++) for(int j=0;j<g[i].size();j++) ans=max(ans,dfs(i,g[i][j],0,k/2)+dfs(g[i][j],i,0,k/2)); } cout<<n-ans<<endl; return 0; }
a.cc:68:13: error: redefinition of 'std::vector<int> g [2000]' 68 | vector<int> g[2000]; | ^ a.cc:16:13: note: 'std::vector<int> g [2000]' previously declared here 16 | vector<int> g[2000]; | ^ a.cc:69:5: error: redefinition of 'int n' 69 | int n,k; | ^ a.cc:17:5: note: 'int n' previously declared here 17 | int n,k; | ^ a.cc:69:7: error: redefinition of 'int k' 69 | int n,k; | ^ a.cc:17:7: note: 'int k' previously declared here 17 | int n,k; | ^ a.cc:70:5: error: redefinition of 'int dfs(int, int, int, int)' 70 | int dfs(int x,int pre,int d,int mx){ | ^~~ a.cc:18:5: note: 'int dfs(int, int, int, int)' previously defined here 18 | int dfs(int x,int pre,int d,int mx){ | ^~~ a.cc:80:5: error: redefinition of 'int main()' 80 | int main(){ | ^~~~ a.cc:28:5: note: 'int main()' previously defined here 28 | int main(){ | ^~~~
s772026084
p04047
C++
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <stdlib.h> #include <queue> #include <set> #include <string> #include <string.h> #include <cstring> #include <stdio.h> #include <fstream> #include <stack> #include <iomanip> //#include <conio.h> //#include <windows.h> //#include <time.h> #define rep(N) for(int i=0;i<N;i++) #define ll long long #define pii pair<int,int> #define For(I,N) for(int I=0;I<N;I++) #define rep(N) for(int i=0;i<N;i++) using namespace std; vector <int> vec[2005]; vector <pair<int,int> >num[2005]; bool visit[2005]; int leaf[2005]; int dist[2005][2005]; int n,k; vector <int> leave; void bfs(int x) { fill(visit,visit+n,0); queue <pair<int,int> >que; que.push(make_pair<int,int>(x,0)); while(!que.empty()) { int nx=que.front().first; int s=que.front().second; que.pop(); for(int i=0;i<vec[nx].size();i++) { if(visit[vec[nx][i]]) continue; visit[vec[nx][i]]=true; dist[x][vec[nx][i]]=s+1; que.push(make_pair<int,int>(vec[nx][i],s+1)); } } } int main() { // freopen("input.txt","r",stdin); cin>>n>>k; int x,y; rep(n-1) { cin>>x>>y; vec[--x].push_back(--y); vec[y].push_back(x); leaf[x]++; leaf[y]++; } rep(n) { bfs(i); } // rep(n) // { // dist[i][i]=0; // for(int j=0;j<n;j++) // { // cout<<dist[i][j]<<" "; // } // cout<<endl; // } int s=0,mini=0; bool ok[n]; fill(ok,ok+n,0); rep(n) { dist[i][i]=0; if(ok[i]) continue; for(int j=0;j<n;j++) { if(ok[j]==1) continue; if(dist[i][j]>k) ok[j]=1; } } rep(n) { s+=ok[i]; } cout<<s<<endl; return 0; }
a.cc: In function 'void bfs(int)': a.cc:36:37: error: cannot bind rvalue reference of type 'int&&' to lvalue of type 'int' 36 | que.push(make_pair<int,int>(x,0)); | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, 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_pair.h:1132:21: note: initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = int; typename decay<_Tp>::type = int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]' 1132 | make_pair(_T1&& __x, _T2&& __y) | ~~~~~~^~~ a.cc:47:52: error: cannot bind rvalue reference of type 'int&&' to lvalue of type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} 47 | que.push(make_pair<int,int>(vec[nx][i],s+1)); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1132:21: note: initializing argument 1 of 'constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&) [with _T1 = int; _T2 = int; typename __strip_reference_wrapper<typename decay<_Tp>::type>::__type = int; typename decay<_Tp>::type = int; typename __strip_reference_wrapper<typename decay<_Tp2>::type>::__type = int; typename decay<_Tp2>::type = int]' 1132 | make_pair(_T1&& __x, _T2&& __y) | ~~~~~~^~~
s528603438
p04047
C++
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <stdlib.h> #include <queue> #include <set> #include <string> #include <string.h> #include <cstring> #include <stdio.h> #include <fstream> #include <stack> #include <iomanip> //#include <conio.h> #include <windows.h> #include <time.h> #define rep(N) for(int i=0;i<N;i++) #define ll long long #define pii pair<int,int> #define For(I,N) for(int I=0;I<N;I++) #define rep(N) for(int i=0;i<N;i++) using namespace std; vector <int> vec[2005]; vector <pair<int,int> >num[2005]; bool visit[2005]; int leaf[2005]; int dist[2005][2005]; int n,k; vector <int> leave; void bfs(int x) { fill(visit,visit+n,0); queue <pair<int,int> >que; que.push(make_pair<int,int>(x,0)); while(!que.empty()) { int nx=que.front().first; int s=que.front().second; que.pop(); for(int i=0;i<vec[nx].size();i++) { if(visit[vec[nx][i]]) continue; visit[vec[nx][i]]=true; dist[x][vec[nx][i]]=s+1; que.push(make_pair<int,int>(vec[nx][i],s+1)); } } } int main() { // freopen("input.txt","r",stdin); cin>>n>>k; int x,y; rep(n-1) { cin>>x>>y; vec[--x].push_back(--y); vec[y].push_back(x); leaf[x]++; leaf[y]++; } rep(n) { bfs(i); } // rep(n) // { // dist[i][i]=0; // for(int j=0;j<n;j++) // { // cout<<dist[i][j]<<" "; // } // cout<<endl; // } int s=0,mini=0; bool ok[n]; fill(ok,ok+n,0); rep(n) { dist[i][i]=0; if(ok[i]) continue; for(int j=0;j<n;j++) { if(ok[j]==1) continue; if(dist[i][j]>k) ok[j]=1; } } rep(n) { s+=ok[i]; } cout<<s<<endl; return 0; }
a.cc:16:10: fatal error: windows.h: No such file or directory 16 | #include <windows.h> | ^~~~~~~~~~~ compilation terminated.
s440079820
p04047
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class AGC { public static void main (String[] args) {new AGC();} AGC() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int n = fs.nextInt(); int[] a = fs.nextIntArray(2 * n); Arrays.sort(a); int res = 0; for(int i = 0; i < 2 * n; i += 2) { res += a[i]; } out.println(res); out.close(); } void sort (int[] a) { int n = a.length; for(int i = 0; i < 1000; i++) { Random r = new Random(); int x = r.nextInt(n), y = r.nextInt(n); int temp = a[x]; a[x] = a[y]; a[y] = temp; } Arrays.sort(a); } class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); // br = new BufferedReader(new FileReader("testdata.out")); st = new StringTokenizer(""); } catch (Exception e){e.printStackTrace();} } public String next() { if (st.hasMoreTokens()) return st.nextToken(); try {st = new StringTokenizer(br.readLine());} catch (Exception e) {e.printStackTrace();} return st.nextToken(); } public int nextInt() {return Integer.parseInt(next());} public long nextLong() {return Long.parseLong(next());} public double nextDouble() {return Double.parseDouble(next());} public String nextLine() { String line = ""; try {line = br.readLine();} catch (Exception e) {e.printStackTrace();} return line; } public Integer[] nextIntegerArray(int n) { Integer[] a = new Integer[n]; for(int i = 0; i < n; i++) a[i] = nextInt(); return a; } public int[] nextIntArray(int n) { int[] a = new int[n]; for(int i = 0; i < n; i++) a[i] = nextInt(); return a; } public char[] nextCharArray() {return nextLine().toCharArray();} } }
Main.java:8: error: class AGC is public, should be declared in a file named AGC.java public class AGC { ^ 1 error
s586805497
p04047
C
#include<stdio.h> main() { int n,a[100],i.ans; scanf("%d",&n); i=0; while( scanf("%d ",&a[i]); printf("%d",ans); }
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int] 2 | main() | ^~~~ main.c: In function 'main': main.c:4:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 4 | int n,a[100],i.ans; | ^ main.c:6:1: error: 'i' undeclared (first use in this function) 6 | i=0; | ^ main.c:6:1: note: each undeclared identifier is reported only once for each function it appears in main.c:8:19: error: expected ')' before ';' token 8 | scanf("%d ",&a[i]); | ^ | ) main.c:7:6: note: to match this '(' 7 | while( | ^ main.c:10:1: error: expected expression before '}' token 10 | } | ^
s817383375
p04047
C
#include<stdio.h> int main(){ int n,temp; scanf("%d",&n); /* printf("n;%d",n); printf("\n"); printf("k;%d",k); printf("\n");*/ int i[n-1]; int max[k-1]; int count=0; int total=0; // for(int j=0;j<k;j++){ // max[j] = 0; // } for(int j=0;j<n;j++){ scanf("%d",&temp); i[j] = temp; } /* for(int j=0;j<n;j++){ printf("i[%d];%d",j,i[j]); printf("\n"); }*/ while(count != n){ for(int m=0;m<n;m++){ for(int l=0;l<n;l++){ if(max[m] < i[l]){ max[m] = i[l]; } } for(int q=0;q<n;q++){ if(max[m] == i[q]){ i[q] = 0; break; } } } count = count+1; } /* for(int j=0;j<k;j++){ printf("max[%d];%d",j,max[j]); printf("\n"); } printf("cou;%d",count); printf("\n");*/ for(int p=0;p<n;p++){ total = total + max[2*p+1]; } printf("%d",total); printf("\n"); }
main.c: In function 'main': main.c:13:13: error: 'k' undeclared (first use in this function) 13 | int max[k-1]; | ^ main.c:13:13: note: each undeclared identifier is reported only once for each function it appears in
s305908365
p04047
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class MysteriousLight { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int n = Integer.parseInt(s[0]); int x = Integer.parseInt(s[1]); if(x>n/2){x=n-x;} int result = (n-x); while(true){ int current = x; x=(n-x)%x; n = current; if(x == 0){break;} result += x; } result*=3; System.out.println(result); } }
Main.java:6: error: class MysteriousLight is public, should be declared in a file named MysteriousLight.java public class MysteriousLight { ^ 1 error
s777835417
p04047
Java
package main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class MysteriousLight { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] s = br.readLine().split(" "); int n = Integer.parseInt(s[0]); int x = Integer.parseInt(s[1]); int result = (n-x); while(true){ int current = x; x=(n-x)%x; n = current; if(x == 0){break;} result += x; } result*=3; System.out.println(result); } }
Main.java:7: error: class MysteriousLight is public, should be declared in a file named MysteriousLight.java public class MysteriousLight { ^ 1 error
s094903228
p04047
Java
package main; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; public class BBQEasy { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String[] s = br.readLine().split(" "); ArrayList<Integer> l = new ArrayList<Integer>(); for(int i =0;i <2*N;i++){ l.add(Integer.parseInt(s[i])); } Collections.sort(l); int result = 0; for(int i =0;i<2*N;i+=2){ result += l.get(i) > l.get(i+1)? l.get(i+1):l.get(i); } System.out.println(result); } }
Main.java:9: error: class BBQEasy is public, should be declared in a file named BBQEasy.java public class BBQEasy { ^ 1 error
s635598420
p04047
C++
#include <iostream> #include <algorithm> #include <string> int N_MAX = 1000; int N; using namespace std; int main(int argc, const char * argv[]) { int L[N_MAX]; int i; memset(L, 0, sizeof(L)); cin >> N; for(i = 0; i < 2*N; i++) { cin >> L[i]; } sort(L, L+2*N); int sum = 0; for(i = 0; i < N; i++) { sum += min(L[2*i],L[2*i+1]); } cout << sum << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:14:5: error: 'memset' was not declared in this scope 14 | memset(L, 0, sizeof(L)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <algorithm> +++ |+#include <cstring> 3 | #include <string>
s968776435
p04047
C++
213213
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 213213 | ^~~~~~
s501900016
p04047
C++
#include <iostream> #include <sstream> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> #define INF 999999999 #define llong long long #define pb(a) push_back(a) #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(int i = m;i < n;i++) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()); using namespace std; typedef pair<int, int> P; typedef pair<llong, llong> LP; typedef pair<int, P> PP; typedef pair<llong, LP> LPP; int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ int n=0; int l; vector<int> L; cin >> n; for(int i=0;i<2*n;i++){ cin >>l; L.pb(l);; } VSORT(L); int ans = 0; for(int i=0;i<2*n;i+=2){ ans += L[i]; } printf("%d \n",ans); return 0; }
a.cc: In function 'int main()': a.cc:19:18: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | #define VSORT(v) sort(v.begin(), v.end()); | ^~~~ a.cc:41:3: note: in expansion of macro 'VSORT' 41 | VSORT(L); | ^~~~~
s196662903
p04047
C++
#include <algorithm> sort(l,l+n*2); while(count < n*2){ ans += min(l[count],l[count+1]); count+=2; } cout << ans << "\n"; return 0; }
a.cc:2:9: error: expected constructor, destructor, or type conversion before '(' token 2 | sort(l,l+n*2); | ^ a.cc:4:5: error: expected unqualified-id before 'while' 4 | while(count < n*2){ | ^~~~~ a.cc:8:5: error: 'cout' does not name a type 8 | cout << ans << "\n"; | ^~~~ a.cc:9:5: error: expected unqualified-id before 'return' 9 | return 0; | ^~~~~~ a.cc:10:1: error: expected declaration before '}' token 10 | } | ^
s128059461
p04047
C++
#include <iostream> using namespace std; int main() { int n,count=0,ans; cin >> n; int l[n*2]; for(int i = 0; i < n*2; i++){ cin >> l[i]; } sort(l,l+n*2); while(count < n*2){ ans += min(l[count],l[count+1]); count+=2; } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(l,l+n*2); | ^~~~ | short
s308754508
p04047
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int arr[(2 * n) + 5]; for(int i = 1; i <= 2 * n; ++i) { cin >> arr[i]; } sort(arr + 1, arr + 1 + 2*n); int ans = 0; for(int i = 1; i <= n; ++i) { ans += arr[(2 * i) - 1]; /cout << arr[2 * i - 1]; } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:19:17: error: expected primary-expression before '/' token 19 | /cout << arr[2 * i - 1]; | ^
s894451742
p04047
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; const double pi = acos(-1); #define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++) #define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME #define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__) #define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__) template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;} template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;} int main() { // メインプログラムここから ll n; cin >> n; vector<11> L(2,n); rep(i,2*n) { cin >> L[i]; } sort (L.begin(), L.end()); ll ans = 0; rep(i, n) { ans += L[i*2]; } cout >> ans >> endl; // ここまで }
a.cc: In function 'int main()': a.cc:20:14: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Alloc> class std::vector' 20 | vector<11> L(2,n); | ^ a.cc:20:14: note: expected a type, got '11' a.cc:20:14: error: template argument 2 is invalid a.cc:20:21: error: expression list treated as compound expression in initializer [-fpermissive] 20 | vector<11> L(2,n); | ^ a.cc:22:17: error: invalid types 'int[ll {aka long long int}]' for array subscript 22 | cin >> L[i]; | ^ a.cc:24:13: error: request for member 'begin' in 'L', which is of non-class type 'int' 24 | sort (L.begin(), L.end()); | ^~~~~ a.cc:24:24: error: request for member 'end' in 'L', which is of non-class type 'int' 24 | sort (L.begin(), L.end()); | ^~~ a.cc:27:17: error: invalid types 'int[ll {aka long long int}]' for array subscript 27 | ans += L[i*2]; | ^ a.cc:29:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'll' {aka 'long long int'}) 29 | cout >> ans >> endl; | ~~~~ ^~ ~~~ | | | | | ll {aka long long int} | std::ostream {aka std::basic_ostream<char>} a.cc:29:10: note: candidate: 'operator>>(int, ll {aka long long int})' (built-in) 29 | cout >> ans >> endl; | ~~~~~^~~~~~ a.cc:29:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41, from a.cc:1: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:29:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 29 | cout >> ans >> endl; | ^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/bitset:1597:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, bitset<_Nb>&)' 1597 | operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) | ^~~~~~~~ /usr/include/c++/14/bitset:1597:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = long long int&]': a.cc:29:13: required from here 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: candidate: 'template<class _Tp, class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, complex<_Tp>&)' 509 | operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x) | ^~~~~~~~ /usr/include/c++/14/complex:509:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:143: /usr/include/c++/14/iomanip:76:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Resetiosflags)' 76 | operator>>(basic_istream<_CharT, _Traits>& __is, _Resetiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:76:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/iomanip:106:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setiosflags)' 106 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setiosflags __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:106:5: note: template argument deduction/substitution failed: a.cc:29:13: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 29 | cout >> ans >> endl; | ^~~ /usr/include/c++/14/iomanip:137:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _Setbase)' 137 | operator>>(basic_istream<_CharT, _Traits>& __is, _Setbase __f) | ^~~~~~~~ /usr/include/c++/14/iomanip:137:5: note: template argument deduction/substitution failed: a.cc:29:13: note:
s781290584
p04047
C++
#include <iostream> #include <cstdio> #include <vector> using namespace std; int main(void) { int n; scanf("%d", &n); n <<= 1; vector<int> a(n); for(int i = 0;i < n;i++) scanf("%d", &a[i]); sort(a.begin(), a.end()); int res = 0; for(int i = 0;i < n;i += 2) res += a[i]; printf("%d\n", res); }
a.cc: In function 'int main()': a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(a.begin(), a.end()); | ^~~~ | short
s821540665
p04047
C++
#include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <cmath> using namespace std; int n,l[105],ans; void work() { scanf("%d",&n),n*; for (int i=1; i<=n; i++) scanf("%d",&l[i]); sort(l+1,l+n+1); for (int i=1; i<=n; i+=2) ans+=l[i]; printf("%d",ans); } int main() { work(); return 0; }
a.cc: In function 'void work()': a.cc:13:26: error: expected primary-expression before ';' token 13 | scanf("%d",&n),n*; | ^
s305811854
p04047
C++
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cstdio> #include<cmath> #include<cstdlib> #include<ctime> #include<queue> #include<set> using namespace std; const int N=2e6; int gi() { int w=0;bool q=1;char c=getchar(); while ((c<'0'||c>'9') && c!='-') c=getchar(); if (c=='-') q=0,c=getchar(); while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar(); return q? w:-w; } int p[N]; int head[N],next[N],to[N],d[N],tot,ans[N]; struct cmp{ inline bool operator () (const int &a,const int &b) const { return p[a]<p[b]; } }; struct cmp2{ inline bool operator () (const int &a,const int &b) const { return a>b; } }; inline void link(int a,int b) { d[to[++tot]=b]++,next[tot]=head[a],head[a]=tot; } int main() { int n=gi(),m=gi(),i,k,t; for (i=1;i<=n;i++) p[i]=gi(); set<int,cmp>s;set<int>::iterator it; priority_queue<int,vector<int>,cmp2>q; for (i=1;i<=n;i++) { if (i>m) s.erase(i-m); it=s.insert(i).first; if (++it!=s.end()) link(i,*it); } s.clear(); for (i=n;i;i--) { if (i+m<=n) s.erase(i+m); it=s.insert(i).first; if (++it!=s.end()) link(i,*it); } for (i=1;i<=n;i++) if (!d[i]) q.push(i); for (t=1;t<=n;t++) { k=q.top();q.pop(); ans[k]=t; for (i=head[k];i;i=next[i]) if (!--d[to[i]]) q.push(to[i]); } for (i=1;i<=n;i++) printf("%d\n",ans[i]); return 0; }
a.cc: In function 'void link(int, int)': a.cc:24:50: error: reference to 'next' is ambiguous 24 | inline void link(int a,int b) { d[to[++tot]=b]++,next[tot]=head[a],head[a]=tot; } | ^~~~ In file included from /usr/include/c++/14/string:47, 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_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:21:13: note: 'int next [2000000]' 21 | int head[N],next[N],to[N],d[N],tot,ans[N]; | ^~~~ a.cc: In function 'int main()': a.cc:46:36: error: reference to 'next' is ambiguous 46 | for (i=head[k];i;i=next[i]) if (!--d[to[i]]) q.push(to[i]); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:21:13: note: 'int next [2000000]' 21 | int head[N],next[N],to[N],d[N],tot,ans[N]; | ^~~~
s602296858
p04047
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <cmath> #include <math.h> #include <string> #include <string.h> #include <stack> #include <queue> #include <vector> #include <utility> #include <set> #include <map> #include <stdlib.h> #include <iomanip> using namespace std; #define ll long long #define vvi vector< vector<int> > #define vi vector<int> #define All(X) X.begin(),X.end() #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define REP(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define pii pair<int,int> #define mp make_pair #define pi 3.14159265359 #define shosu(X) fixed << setprecision(X) ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } ll lcm(ll a, ll b) { return a / gcd(a, b)*b; } int main() { ll N; ll L[101]; cin >> N; ll sum = 0; REP(i, 2 * N) { cin >> L[i]; } sort(L[0], L[N - 1]); REP(i, N) { sum += L[i * 2]; } cout << sum; return 0; }
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 = long long 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 = long long 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 = long long 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 = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:42:6: required from here 42 | sort(L[0], L[N - 1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<long long 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 'long long int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'long long 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 = long long int; _Iterator2 = long long int]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long 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 = long long 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 = long long 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 = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:42:6: required from here 42 | sort(L[0], L[N - 1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'long long int') 45 | { return *__it1 < *__it2; } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'long long 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 = long long 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 = long long 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 = long long 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 = long long int; _Size = long long 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 = long long 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 = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:42:6: required from here 42 | sort(L[0], L[N - 1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = long long 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 = long long 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 = long long 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 = long long int; _Size = long long 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 = long long 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 = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:42:6: required from here 42 | sort(L[0], L[N - 1]); | ~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>'
s531605944
p04047
C++
/********************** * AGC001 -A *********************************/ #include <iostream> int main() { int skewer_num = 0, ans = 0; std::cin >> skewer_num; skewer_num *= 2; int skewer_array[200]; for (int i = 0; i < skewer_num; ++i) { std::cin >> skewer_array[i]; } std::sort(skewer_array,skewer_array+skewer_num); for (int i = 0; i < skewer_num / 2; ++i) { ans += skewer_array[2*i]; } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:13:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 13 | std::sort(skewer_array,skewer_array+skewer_num); | ^~~~ | qsort
s455774393
p04047
C++
/********************** * AGC001 -A *********************************/ #include <iostream> int main() { int skewer_num = 0, ans = 0; std::cin >> skewer_num; skewer_num *= 2; int skewer_array[skewer_num]; for (int i = 0; i < skewer_num; ++i) { std::cin >> skewer_array[i]; } std::sort(skewer_array,skewer_array + skewer_num); for (int i = 0; i < skewer_num / 2; ++i) { ans += skewer_array[2*i]; } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:14:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 14 | std::sort(skewer_array,skewer_array + skewer_num); | ^~~~ | qsort
s693008885
p04047
Java
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Tester { public static void main(String[] args) { Scanner in = new Scanner(System.in); List<Integer> list = new ArrayList<>(); in.nextInt(); while(in.hasNextInt()) { list.add(in.nextInt()); } Collections.sort(list, Collections.reverseOrder()); int ans = 0; for(int i = 0; i < list.size(); i++) { ans += list.get(i); i++; } System.out.println(ans); } }
Main.java:6: error: class Tester is public, should be declared in a file named Tester.java public class Tester { ^ 1 error
s421932171
p04047
C++
#include <iostream> #include <vector> using namespace std; int main() { int tmp, N, ans = 0; vector<int> L; cin >> N; for(int i=0;i<2*N;i++) { cin >> tmp; L.push_back(tmp); } sort(L.begin(), L.end()); for(int i=0;i<2*N;i+=2) { ans += L[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(L.begin(), L.end()); | ^~~~ | short
s380308479
p04047
C++
QAQ
a.cc:1:1: error: 'QAQ' does not name a type 1 | QAQ | ^~~
s549559561
p04047
C++
//AGC 006-A #define _USE_MATH_DEFINES #include <iostream> #include <cmath> #include <stdlib.h> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <numeric> #include <string> #include <map> #include <sstream> using namespace std; int main(){ int N, MeatNum = 0; vector<int> L[200]; cin >> N; for(int i = 0; i < 2*N; i++) cin >> L[i]; sort(L.begin(), L.end()); for(int i = 0; i < N; i++) MeatNum += L[2*i]; cout << MeatNum << endl; }
a.cc: In function 'int main()': a.cc:22:42: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 22 | for(int i = 0; i < 2*N; i++) cin >> L[i]; | ~~~ ^~ ~~~~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:4: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_
s170447836
p04047
C++
//AGC 006-A #define _USE_MATH_DEFINES #include <iostream> #include <cmath> #include <stdlib.h> #include <algorithm> #include <cstdio> #include <vector> #include <cstring> #include <numeric> #include <string> #include <map> #include <sstream> using namespace std; int main(){ int N, MeatNum = 0; vector<int> L[200]; cin >> N; for(int i = 0; i < 2*N; i++) cin >> L[i]; sort(L.begin(), L.end(), greater<int>()); for(int i = 0; i < N; i++) MeatNum += L[2*i+1]; cout << MeatNum << endl; }
a.cc: In function 'int main()': a.cc:22:42: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 22 | for(int i = 0; i < 2*N; i++) cin >> L[i]; | ~~~ ^~ ~~~~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:4: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_
s795618723
p04047
Java
import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.StringTokenizer; /** * Created by vikas.k on 25/12/16. */ public class A { public static void main(String[] args){ MyScanner sc = new MyScanner(); out = new PrintWriter(new BufferedOutputStream(System.out)); int n = sc.nextInt(); List<Integer> lst = new ArrayList<>(); for(int i=0;i<2*n;i++){ lst.add(sc.nextInt()); } Collections.sort(lst); int cnt = 0; for(int i=0;i<lst.size();i+=2){ cnt+= Math.min(lst.get(i),lst.get(i+1)); } out.println(cnt); out.close(); } public static PrintWriter out; private static class MyScanner{ BufferedReader bufferedReader; StringTokenizer stringTokenizer; private MyScanner(){ bufferedReader = new BufferedReader(new InputStreamReader(System.in)); } private String next(){ if(stringTokenizer == null || !stringTokenizer.hasMoreElements()){ try { stringTokenizer = new StringTokenizer(bufferedReader.readLine()); } catch (IOException e) { e.printStackTrace(); } } return stringTokenizer.nextToken(); } private int nextInt(){ return Integer.parseInt(next()); } private String nextLine(){ String ret= ""; try { ret= bufferedReader.readLine(); } catch (IOException e) { e.printStackTrace(); } return ret; } } }
Main.java:10: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s713692225
p04047
Java
import java.util.Scanner; import java.util.Arrays; public class AA{ public static void main(String[] args){ Scanner kbs=new Scanner(System.in); int kushi=kbs.nextInt(); int goukei=0; int[] nagasa=new int[2*kushi]; for(int i=0;i<2*kushi;i++){ nagasa[i]=kbs.nextInt(); } Arrays.sort(nagasa); for(int i=0;i<2*kushi;i+=2){ goukei+=nagasa[i]; } System.out.println(goukei); } }
Main.java:4: error: class AA is public, should be declared in a file named AA.java public class AA{ ^ 1 error
s362279768
p04047
C++
#include <iostream> int main(){;int n,ans=0;cin>>n;vector<Int> v(2*n);for(int i=0;i<2*n;++i){cin>>v[i];} sort(v.begin(),v.end());for(int i=1;i<2*n;i+=2){ans+=v[i];}cout<<ans<<endl;}
a.cc:1:21: warning: extra tokens at end of #include directive 1 | #include <iostream> int main(){;int n,ans=0;cin>>n;vector<Int> v(2*n);for(int i=0;i<2*n;++i){cin>>v[i];} sort(v.begin(),v.end());for(int i=1;i<2*n;i+=2){ans+=v[i];}cout<<ans<<endl;} | ^~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s858568345
p04047
C++
#include <iostream> #include<vector> using namespace std; int main(int argc, const char * argv[]) { int n = 0; int count = 0; vector<int> vec; cin >> n; int x = 0; // int i = 0; for (int j = 0; j< n*2 ; j++) { cin>>x; vec.push_back(x); } sort(vec.begin(),vec.end()); for (int i = 0; i < n*2 ; i = i+2 ) { if(vec[i] >= vec[i+1]) count += vec[i+1]; else count += vec[i]; } cout<<count<<endl; // return count; // insert code here... // std::cout << "Hello, World!\n"; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort(vec.begin(),vec.end()); | ^~~~ | short
s853537640
p04047
C++
#include<bits/stdc++.h> using namespace std; int main() { cin >> n; vector<int> vec; for(int i(0); i < n; i++) { int x; cin >> x; vec.push_back(x); } int ans(0); sort(vec.begin(), vec.end()); for(int i(0); i + 1 < (int)vec.size(); i += 2) { ans += min(vec[i], vec[i + 1]); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:4:16: error: 'n' was not declared in this scope; did you mean 'yn'? 4 | cin >> n; | ^ | yn
s208753421
p04047
C++
n = int(raw_input()) l = map(int, raw_input().split()) l.sort() sum = 0 for i in range(0, n, 2): sum += i print sum
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s180270918
p04047
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <cstdio> #include <queue> #include "math.h" #include <complex> #include <iomanip> #define ifor(i,a,b) for (int i=(a);i<(b);i++) #define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--) #define rep(i,n) for (int i=0;i<(n);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) using namespace std; typedef long double ld; typedef long long int lli; typedef complex <double> P; const double eps = 1e-11; int vex[4]={1,0,-1,0}; int vey[4]={0,1,0,-1}; int gcd(int a,int b){ if(a%b == 0)return b; return gcd(b,a%b); } int main(){ int N ,X; cin >> N >> X; cout << 3(N-gcd(N,X))<<endl; return 0 ; }
a.cc: In function 'int main()': a.cc:28:18: error: expression cannot be used as a function 28 | cout << 3(N-gcd(N,X))<<endl; | ~^~~~~~~~~~~~
s203963174
p04047
C++
#include<iostream> #include<vector> #include<cstdio> #include<algorithm> using namespace std; vector<int> edge[2010]; int dis[2010]; bool used[2010]; int n, k; int main() { int a, b,ma=100000; cin >> n >> k; for (int i = 0; i < n - 1; i++) { scanf("%d %d", &a, &b); a--; b--; edge[a].push_back(b); edge[b].push_back(a); } if (k % 2 == 0) { for (int i = 0; i < n; i++) { evencalc(i, i, 0); ma = min(ma, dis[i]); for (int i = 0; i < n; i++)used[i] = false; } cout << ma << endl; } else { for (int i = 0; i < n; i++) { if (edge[i].empty())continue; for (int j = 0; j < edge[i].size; j++) { ma = min(ma, oddcalc(i, edge[i][j])); } } cout << ma << endl; } } void evencalc(int t, int s, int count) { int r; if (count > (int)k / 2)dis[s]++; if (edge[t].empty())return; for (int i = 0; i < edge[t].size() && !used[edge[t][i]]; i++) { r = edge[t][i]; used[edge[t][i]] = true; evencalc(r, s, count+1); } } int oddcalc(int t,int s) { used[t] = used[s] = true; evencalc(t, t, 0); evencalc(s, s, 0); return dis[t]+ dis[s]; }
a.cc: In function 'int main()': a.cc:22:25: error: 'evencalc' was not declared in this scope 22 | evencalc(i, i, 0); | ^~~~~~~~ a.cc:31:53: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?) 31 | for (int j = 0; j < edge[i].size; j++) { | ~~~~~~~~^~~~ | () a.cc:32:46: error: 'oddcalc' was not declared in this scope 32 | ma = min(ma, oddcalc(i, edge[i][j])); | ^~~~~~~
s683931842
p04047
C++
include <iostream> #include <algorithm> #include<functional> using namespace std; int main(void) { // Here your code ! int a, size; int ans = 0; cin >> a; size = a * 2; int *b = new int[size]; for (int i = 0; i < size; i++) cin >> b[i]; sort(b, b + size,greater<int>()); for (int j = 1; j <size;j=j+2) ans = ans + b[j]; cout << ans << endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s197932274
p04047
C++
#include <iostream> using namespace std; #define MAX_N 100 int N; int L[2*MAX_N]; int main(){ cin >> N; for(int i=0; i<2*N; i++) cin >> L[i]; sort(L, L+2*N); int sol=0; for(int i=0; i<N; i++) sol+=L[2*i]; cout << sol << endl; }
a.cc: In function 'int main()': a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(L, L+2*N); | ^~~~ | short
s253542781
p04047
C++
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<vector> #include<queue> #include<map> #include<list> #include<map> #include<stack> #include<cstdlib> #define P(p) cout << (p) << endl; #define rep(i, n) for(int i = 0; i < n; i++) using namespace std; int main(){ int n,num,sum = 0; vector <int> v; cin >> n; for( int i = 0 ; i < n*2 ; i++ ){ cin >> num; v.push_back(num); } sort(v.begin(),v.end()); for( int i = 0 ; i < n*2 ; i+=2 ){ //cout << v[i] << endl; sum += v[i]; } P(sum); }
a.cc: In function 'int main()': a.cc:27:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 27 | sort(v.begin(),v.end()); | ^~~~ | sqrt
s707396321
p04047
C++
#include <iostream> using namespace std; int main(){ int n; cin >> n; n *= 2; int l[n]; for(int i = 0; i < n; i++){ cin >> l[i]; } sort(l, l + n); int total = 0; for(int i = 0; i < n; i += 2){ total += min(l[i], l[i + 1]); } cout << total << endl; }
a.cc: In function 'int main()': a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(l, l + n); | ^~~~ | short
s119644285
p04047
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner s = new Scanner(System.in); int n = s.nextInt(); int ans = 0; int[] a = new int[2*n]; for(int i=0;i<2*n;i++) a[i] = s.nextInt(); Arrays.sort(a); for(int i=0;i<2n;i+=2) ans += Math.min(a[i],a[i+1]); System.out.println(ans); } }
Main.java:13: error: ';' expected for(int i=0;i<2n;i+=2) ans += Math.min(a[i],a[i+1]); ^ Main.java:13: error: ')' expected for(int i=0;i<2n;i+=2) ans += Math.min(a[i],a[i+1]); ^ Main.java:13: error: ';' expected for(int i=0;i<2n;i+=2) ans += Math.min(a[i],a[i+1]); ^ 3 errors
s509969054
p04047
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; int l[101]; for(int i=0; i<2*n; i++) cin >> l[i]; sort(l, l+2*n); int ret = 0; for(int i=0; i<n; i++) ret += min(l[2*i], l[2*i+1]); cout << ret << endl; }
a.cc: In function 'int main()': a.cc:8:5: error: 'sort' was not declared in this scope; did you mean 'short'? 8 | sort(l, l+2*n); | ^~~~ | short
s150328060
p04047
C++
#include <iostream> using namespace std; int main() { int n, a[205], ans = 0; cin >> n; n *= 2; for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a+n); for (int i = 0; i < n; i += 2) ans += a[i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(a, a+n); | ^~~~ | short