submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s926441425
p03767
C++
10 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 10 | ^~
s392007084
p03767
C++
#include <bits/stdc++.h> using namespace std; /* REPmacro */ #define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i) #define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i) #define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i) /*alias*/ #define ALL(x) (x).begin(),(x).end() #define SZ(x) ((int)(x).size()) #define F first #define S second #define PB push_back #define MP make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define next asdnext #define prev asdprev /*using*/ using ll = long long; using ull = unsigned long long; using unsi = unsigned; using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>; using pii = pair<int, int>; using db = double; using plex = complex<double>; using vs = vector<string>; /*template*/ template<class T>inline bool amax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>inline bool amin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } /* func */ /*struct*/ struct aaa{ aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa; /* const */ const int INF = 1001001001; const ll LINF = 1001001001001001001ll; const int MOD = 1e9 + 7; //10^9 const db EPS = 1e-9; const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1}; //#define int ll //#define int long long signed main() { //まちがえとわかっていながら出す。昔これで悩んだから置いとく int n; cin >> n; vi v1(n); REP(i,3*n) cin >> v1[i]; sort(ALL(v1)); auto f,m,e; vector<tuple<int,int,int>> t; for(int i = 0; i < n; ++i){ f = v1[i]; t.PB(f,m,n); } int &o = get<0>(t); cout << o; return 0; }
a.cc: In function 'int main()': a.cc:71:3: error: declaration of 'auto f' has no initializer 71 | auto f,m,e; | ^~~~ a.cc:71:3: error: declaration of 'auto m' has no initializer a.cc:71:3: error: declaration of 'auto e' has no initializer a.cc:79:18: error: no matching function for call to 'get<0>(std::vector<std::tuple<int, int, int> >&)' 79 | int &o = get<0>(t); | ~~~~~~^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1250:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(pair<_Tp1, _Tp2>&)' 1250 | get(pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1250:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::pair<_Tp1, _Tp2>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(pair<_Tp1, _Tp2>&&)' 1255 | get(pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1255:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::pair<_Tp1, _Tp2>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type& std::get(const pair<_Tp1, _Tp2>&)' 1260 | get(const pair<_Tp1, _Tp2>& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1260:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::pair<_Tp1, _Tp2>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: candidate: 'template<long unsigned int _Int, class _Tp1, class _Tp2> constexpr const typename std::tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&& std::get(const pair<_Tp1, _Tp2>&&)' 1265 | get(const pair<_Tp1, _Tp2>&& __in) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1265:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::pair<_Tp1, _Tp2>' 79 | int &o = get<0>(t); | ~~~~~~^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/tuple:2445:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(tuple<_Elements ...>&)' 2445 | get(tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2445:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::tuple<_Elements ...>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/tuple:2451:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >& std::get(const tuple<_Elements ...>&)' 2451 | get(const tuple<_Elements...>& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2451:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::tuple<_Elements ...>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/tuple:2457:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(tuple<_Elements ...>&&)' 2457 | get(tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2457:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::tuple<_Elements ...>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/tuple:2466:5: note: candidate: 'template<long unsigned int __i, class ... _Elements> constexpr std::__tuple_element_t<__i, std::tuple<_Elements ...> >&& std::get(const tuple<_Elements ...>&&)' 2466 | get(const tuple<_Elements...>&& __t) noexcept | ^~~ /usr/include/c++/14/tuple:2466:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::tuple<_Elements ...>' 79 | int &o = get<0>(t); | ~~~~~~^~~ In file included from /usr/include/c++/14/functional:65, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53: /usr/include/c++/14/array:390:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp& std::get(array<_Tp, _Nm>&)' 390 | get(array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:390:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::array<_Tp, _Nm>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/array:399:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr _Tp&& std::get(array<_Tp, _Nm>&&)' 399 | get(array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:399:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'std::array<_Tp, _Nm>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/array:408:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp& std::get(const array<_Tp, _Nm>&)' 408 | get(const array<_Tp, _Nm>& __arr) noexcept | ^~~ /usr/include/c++/14/array:408:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::array<_Tp, _Nm>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/array:417:5: note: candidate: 'template<long unsigned int _Int, class _Tp, long unsigned int _Nm> constexpr const _Tp&& std::get(const array<_Tp, _Nm>&&)' 417 | get(const array<_Tp, _Nm>&& __arr) noexcept | ^~~ /usr/include/c++/14/array:417:5: note: template argument deduction/substitution failed: a.cc:79:18: note: 'std::vector<std::tuple<int, int, int> >' is not derived from 'const std::array<_Tp, _Nm>' 79 | int &o = get<0>(t); | ~~~~~~^~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 1272 | get(pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1272:5: note: template argument deduction/substitution failed: a.cc:79:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_T1, _T2>&)' 79 | int &o = get<0>(t); | ~~~~~~^~~ a.cc:79:18: note: expected a type, got '0' /usr/include/c++/14/bits/stl_pair.h:1277:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 1277 | get(const pair<_Tp, _Up>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1277:5: note: template argument deduction/substitution failed: a.cc:79:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr const _Tp& std::get(const pair<_T1, _T2>&)' 79 | int &o = get<0>(t); | ~~~~~~^~~ a.cc:79:18: note: expected a type, got '0' /usr/include/c++/14/bits/stl_pair.h:1282:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)' 1282 | get(pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1282:5: note: template argument deduction/substitution failed: a.cc:79:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr _Tp&& std::get(pair<_T1, _T2>&&)' 79 | int &o = get<0>(t); | ~~~~~~^~~ a.cc:79:18: note: expected a type, got '0' /usr/include/c++/14/bits/stl_pair.h:1287:5: note: candidate: 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)' 1287 | get(const pair<_Tp, _Up>&& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1287:5: note: template argument deduction/substitution failed: a.cc:79:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr const _Tp&& std::get(const pair<_T1, _T2>&&)' 79 | int &o = get<0>(t); | ~~~~~~^~~ a.cc:79:18: note: expected a type, got '0' /usr/include/c++/14/bits/stl_pair.h:1292:5: note: candidate: 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)' 1292 | get(pair<_Up, _Tp>& __p) noexcept | ^~~ /usr/include/c++/14/bits/stl_pair.h:1292:5: note: template argument deduction/substitution failed: a.cc:79:18: error: type/value mismatch at argument 1 in template parameter list for 'template<class _Tp, class _Up> constexpr _Tp& std::get(pair<_Up, _Tp>&)' 79 | int &o = get<0>(t);
s256276045
p03767
Java
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class A012 { public static void Main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); ArrayList<Long> list = new ArrayList<>(); for(int i = 0; i < 3 * N; i++) { list.add(scanner.nextLong()); } //どうソートする? Collections.sort(list, Collections.reverseOrder()); long sum = 0; for(int i = 0; i < N; i++) { sum += list.get(1 + (2 * i)); } System.out.println(sum); } }
Main.java:5: error: class A012 is public, should be declared in a file named A012.java public class A012 { ^ 1 error
s828087327
p03767
C++
#include <bits/stdc++.h> #include <math.h> #include <string> using namespace std; int main() { int N; cin >> N; vector<int> data(3 * N - 1); long counter = 0; for(int i = 0;i < 3*N;i++){ cin >> data[i]; } sort(str.begin(),str.end()); for(int i = N;i < 2 * N - 1;i++){ counter += data[i]; } cout << counter << endl; }
a.cc: In function 'int main()': a.cc:17:8: error: 'str' was not declared in this scope; did you mean 'std'? 17 | sort(str.begin(),str.end()); | ^~~ | std
s450370142
p03767
C++
#include <iostream> #include <algorithm> typedef long long ll; int main(){ int n; cin >> n; int k=3*n; ll a[k]; for(int i=0;i<k;i++){ cin >> a[i]; } sort(a,a+k); ll ans=0; for(int i=n;i<k;i+=2){ ans+=a[i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> n; | ^~~ | 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:14:3: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 14 | sort(a,a+k); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from a.cc:2: /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:19:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 19 | cout << ans << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:19:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 19 | cout << ans << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s312926466
p03767
C++
#include <iostream> #include <algorithm> using namespace std; int main() { __int64 N, a[100000], count = 0; cin >> N; for (int i = 0; i < 3 * N; i++) { cin >> a[i]; } sort(a, a + 3 * N, greater<int>()); for (int i = 0; i < N; i++) { count += a[i * 2 + 1]; } cout << count << endl; }
a.cc: In function 'int main()': a.cc:6:9: error: '__int64' was not declared in this scope; did you mean '__int64_t'? 6 | __int64 N, a[100000], count = 0; | ^~~~~~~ | __int64_t a.cc:7:16: error: 'N' was not declared in this scope 7 | cin >> N; | ^ a.cc:9:24: error: 'a' was not declared in this scope 9 | cin >> a[i]; | ^ a.cc:11:14: error: 'a' was not declared in this scope 11 | sort(a, a + 3 * N, greater<int>()); | ^ a.cc:15:14: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 15 | cout << count << endl; | ~~~~~^~~~~~~~ In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~
s366140225
p03767
C++
#inclue <bits/stdc++.h> using namespace std; int main(){ long long int n,ans=0; cin >> n; long long int a[3*n]; for (int i=0;i<3*n;i++)cin >> a[i]; sort(a,a+n); reverse(a,a+n); for (int i=0;i<n;i++)ans+=a[1+2*n]; cout << ans <<endl; }
a.cc:1:2: error: invalid preprocessing directive #inclue; did you mean #include? 1 | #inclue <bits/stdc++.h> | ^~~~~~ | include a.cc: In function 'int main()': a.cc:5:3: error: 'cin' was not declared in this scope 5 | cin >> n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #inclue <bits/stdc++.h> a.cc:8:3: error: 'sort' was not declared in this scope; did you mean 'short'? 8 | sort(a,a+n); | ^~~~ | short a.cc:9:3: error: 'reverse' was not declared in this scope 9 | reverse(a,a+n); | ^~~~~~~ a.cc:11:3: error: 'cout' was not declared in this scope 11 | cout << ans <<endl; | ^~~~ a.cc:11:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:11:17: error: 'endl' was not declared in this scope 11 | cout << ans <<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | #inclue <bits/stdc++.h>
s693640939
p03767
C++
n = int(input()) print(sum(sorted(list(map(int, input().split())), reverse=True)[1:n * 2:2]))
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s026243065
p03767
C++
#include <iostream> #include <algorithm> using namespace std; #define int long long int main(void) { int N; int a[100010]; cin >> N; for (int i = 0; i < 3*N; i++) cin >> a[i]; sort(a, a+3*N, greater<int>()); int sum = 0; for (int i = 1; i < 2*N; i += 2) { sum += a[i]; //cout << a[i] << endl; } cout << sum << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s185388439
p03767
C++
#include <iostream> #include <cmath> #include <string> #include <algorithm> using namespace std; #define MAX 1000000 typedef long long ll; int main() { int N; ll sum = 0; cin >> N; int a[MAX]; for(int i=0; i<3*N; ++i) cin >> a[i]; sort(a, a+N); for(int i=0; i<=N; ++i) {} sum += a[N*2-2*(i+1)]; cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: 'i' was not declared in this scope 21 | sum += a[N*2-2*(i+1)]; | ^
s350453819
p03767
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()); reverse(vec.begin(), vec.end()); int m=0; for(int i=1;i < 2* N;i +=2){ m +=vec.at(i)} cout << m << endl; }
a.cc: In function 'int main()': a.cc:9:21: error: expected ';' before '}' token 9 | cin >> vec.at(i)} | ^ | ; a.cc:14:18: error: expected ';' before '}' token 14 | m +=vec.at(i)} | ^ | ;
s131678814
p03767
C++
#include <iostream> #include <vector> int main() { int N; std::cin >> N; std::vector<long long> a(3 * N); for (int i = 0; i < 3 * N; i++) std::cin >> a[i]; std::sort(a.begin(), a.end()); long long ans = 0; for (int i = N; i < 3 * N; i += 2) ans += a[i]; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:11:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 11 | std::sort(a.begin(), a.end()); | ^~~~ | qsort
s820309426
p03767
C++
#include <iostream> int main() { int N; std::cin >> N; std::vector<long long> a(3 * N); for (int i = 0; i < 3 * N; i++) std::cin >> a[i]; std::sort(a.begin(), a.end()); long long ans = 0; for (int i = N; i < 3 * N; i += 2) ans += a[i]; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:7:8: error: 'vector' is not a member of 'std' 7 | std::vector<long long> a(3 * 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 | a.cc:7:15: error: expected primary-expression before 'long' 7 | std::vector<long long> a(3 * N); | ^~~~ a.cc:9:17: error: 'a' was not declared in this scope 9 | std::cin >> a[i]; | ^ a.cc:10:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 10 | std::sort(a.begin(), a.end()); | ^~~~ | qsort a.cc:10:13: error: 'a' was not declared in this scope 10 | std::sort(a.begin(), a.end()); | ^
s626803362
p03767
C++
#include <iostream> int main() { int N; cin >> N; std::vector<long long> a(3 * N); for (int i = 0; i < 3 * N; i++) std::cin >> a[i]; std::sort(a.begin(), a.end()); long long ans = 0; for (int i = N; i < 3 * N; i += 2) ans += a[i]; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> N; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:7:8: error: 'vector' is not a member of 'std' 7 | std::vector<long long> a(3 * 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 | a.cc:7:15: error: expected primary-expression before 'long' 7 | std::vector<long long> a(3 * N); | ^~~~ a.cc:9:17: error: 'a' was not declared in this scope 9 | std::cin >> a[i]; | ^ a.cc:10:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 10 | std::sort(a.begin(), a.end()); | ^~~~ | qsort a.cc:10:13: error: 'a' was not declared in this scope 10 | std::sort(a.begin(), a.end()); | ^
s789800682
p03767
C++
#include <iostream> int main() { int N; cin >> N; std::vector<ll> a(3 * N); for (int i = 0; i < 3 * N; i++) std::cin >> a[i]; std::sort(a.begin(), a.end()); long long ans = 0; for (int i = N; i < 3 * N; i += 2) ans += a[i]; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 6 | cin >> N; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:7:8: error: 'vector' is not a member of 'std' 7 | std::vector<ll> a(3 * 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 | a.cc:7:15: error: 'll' was not declared in this scope 7 | std::vector<ll> a(3 * N); | ^~ a.cc:7:19: error: 'a' was not declared in this scope 7 | std::vector<ll> a(3 * N); | ^ a.cc:10:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 10 | std::sort(a.begin(), a.end()); | ^~~~ | qsort
s787080921
p03767
C++
#include <bits/stdc++.h> using namespace std; int main() { long long N; cin >> N; vector<long long> a(3*N); for(int i=1;i<=3*N;i++){cin >> a[i];} sort(a.begin(), a.end()); long long s=0; for(long long i=3*N;i>=N+1;i--){ if(i%2==1){s+=a[i];} } cout <<
a.cc: In function 'int main()': a.cc:14:10: error: expected primary-expression at end of input 14 | cout << | ^ a.cc:14:10: error: expected '}' at end of input a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s078087086
p03767
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int N, A[3*N]; cin >> N; for (int i = 0; i < 3 * N; i++) { cin >> A[i]; } sort(A, A + 3 * N); long long ans=0; for (int i = N; i < 2 * N; i++) { ans+=A[i] } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:13:26: error: expected ';' before '}' token 13 | ans+=A[i] | ^ | ; 14 | } | ~
s364105384
p03767
C++
#include<iostream> #include<aldorithm> using namespace std; int main() { int N, A[3*N]; cin >> N; for (int i = 0; i < 3 * N; i++) { cin >> A[i]; } sort(A, A + 3 * N); long long ans=0; for (int i = N; i < 2 * N; i++) { ans+=A[i] } cout << ans << endl; }
a.cc:2:9: fatal error: aldorithm: No such file or directory 2 | #include<aldorithm> | ^~~~~~~~~~~ compilation terminated.
s701046268
p03767
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> using namespace std; int N; int a[1000000000]; int ans = 0; int main() { cin >> N; for (int i = 0; i < 3 * N; i++) cin >> a[i]; sort(a, a + 3*N, greater<>()); for (int i = N; i < 2*N; i++) ans += a[i]; cout << ans << endl; }
/tmp/ccNy1eAS.o: in function `main': a.cc:(.text+0xbe): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccNy1eAS.o a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccNy1eAS.o a.cc:(.text+0xdd): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccNy1eAS.o collect2: error: ld returned 1 exit status
s227456640
p03767
C++
#include <bits/stdc++.h> #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; typedef long long ll; const int MAXN = (int)1e5 + 5; bool comp(int a, int b){ return a >= b; } void solve() { ll n; ll a[10050000]; //855521 cin >> n; for(int i=1;i<=3*n;i++){ cin >> a[i]; } sort(a + 1, a + 3 * n + 1, comp); int cnt = n; ll res = 0; for(int i=2;i<=2 * n;i+=2){ res += a[i]; cout << res; } int main() { int tt = 1; while (tt--) { solve(); } return 0; }
a.cc: In function 'void solve()': a.cc:37:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 37 | int main() { | ^~ a.cc:37:9: note: remove parentheses to default-initialize a variable 37 | int main() { | ^~ | -- a.cc:37:9: note: or replace parentheses with braces to value-initialize a variable a.cc:37:12: error: a function-definition is not allowed here before '{' token 37 | int main() { | ^ a.cc:45:2: error: expected '}' at end of input 45 | } | ^ a.cc:21:14: note: to match this '{' 21 | void solve() { | ^
s888707666
p03767
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[100001]; int main() { ll n; scanf("%lld", &n ); for ( int i = 0; i < n * 3; ++i ) { scanf("%lld", &a[i] ); } sort( a.begin(), a.end(), greater<ll>() ); ll sum = 0; for ( int i = 1; i <= n * 2; i += 2 ) { sum += a[i]; } printf("%lld\n", sum ); return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: request for member 'begin' in 'a', which is of non-class type 'll [100001]' {aka 'long long int [100001]'} 17 | sort( a.begin(), a.end(), greater<ll>() ); | ^~~~~ a.cc:17:24: error: request for member 'end' in 'a', which is of non-class type 'll [100001]' {aka 'long long int [100001]'} 17 | sort( a.begin(), a.end(), greater<ll>() ); | ^~~
s547999129
p03767
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; public class main { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ArrayList<Integer> alist = new ArrayList<Integer>(); long answer = 0; for( String str:br.readLine().split(" ") ){ alist.add(Integer.parseInt(str)); } Collections.sort(alist, Comparator.reverseOrder()); for(int i=0;i<n;i++){ int num = (2*i)+1; answer += alist.get(num); } System.out.println(answer); } }
Main.java:7: error: class main is public, should be declared in a file named main.java public class main { ^ 1 error
s128688098
p03767
C++
#include <iostream> #include <vector> #include <alogirthm> using namespace std; int N; int main(){ cin >> N; vector<long long> v(3*N); for(int i=0;i<3*N;i++){ cin >> v[i]; } sort(v.begin(),v.end()); long long ans = 0; int count = 0,r = 3*N-1; while(count<N){ ans += v[r-1]; r -= 2; count++; } cout << ans << endl; }
a.cc:3:10: fatal error: alogirthm: No such file or directory 3 | #include <alogirthm> | ^~~~~~~~~~~ compilation terminated.
s971373014
p03767
C++
#include<bits/stdc++.h> using namespace std; #define ll long long ll sum = 0; ll a[3 * 123456]; bool cmd(ll x, ll y) { return x > y; } int n; inline void _read(int &x) { x = 0; char t = getchar(); while (!isdigit(t)) t = getchar(); while (isdigit(t)) { x = x * 10 + t - '0'; t = getchar(); } } int main() { _read(n); for (int i = 1; i <= 3 * n; i++) _read(a[i]); int i = 2; sort(a + 1, a + 1 + 3 * n, cmd); while (n--) { sum += a[i]; i += 2; } printf("%lld", sum); return 0; }
a.cc: In function 'int main()': a.cc:25:51: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long long int' 25 | for (int i = 1; i <= 3 * n; i++) _read(a[i]); | ~~~^ a.cc:11:24: note: initializing argument 1 of 'void _read(int&)' 11 | inline void _read(int &x) | ~~~~~^
s145765471
p03767
C++
#include <bits/stdc++.h> #define ll long long #define fi first #define sec second #define rep(i,a,n) for(int i=a;i<n;i++) #define per(i,a,n) for(int i=n-1;i>=a;i--) #define pb push_back #define pii pair<int,int> #define sit set<int>:: iterator #define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; const int MAXLOG=60; ll pw[MAXLOG]; int main(){ int n; cin>>n; pw[0]=1; rep(i,1,MAXLOG) pw[i]=pw[i-1]*2; int cnt=1; per(i,0,MAXLOG) if(pw[i]<=n){ rep(j,0,i+1) V.pb(cnt); cnt++; n-=pw[i]; } cout<<V.size()<<endl; for(auto tmp:V) cout<<tmp<<' '; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:26:17: error: 'V' was not declared in this scope 26 | V.pb(cnt); | ^ a.cc:30:11: error: 'V' was not declared in this scope 30 | cout<<V.size()<<endl; | ^
s701144739
p03767
C++
#include <iostream> using namespace std; int main() { int32_t n; cin >> n; int32_t a[3 * n]; for (int32_t i = 0; i < 3 * n; i++) { cin >> a[i]; } sort(a, a + 3 * n); int64_t answer = 0; for (int32_t i = 1; i <= n; i++) { answer += a[3 * n - 2 * i]; } cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a, a + 3 * n); | ^~~~ | short
s372609431
p03767
C++
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <map> #include <cmath> #include <queue> using namespace std; #define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++) #define FFOR(i,a,b) for(int (i)=(a);(i)>=(b);(i)--) #define rep(i,n) FOR(i,0,n-1) #define int long long #define MOD 998244353 #define MAXN 100005 #define P pair<int,int> int a[MAXN]; signed main(){ int n;cin >>n; int ans = 0; int cnt = 0; int pret = 0; rep(i,n) cin>>a[i]; sort(a,a+n); reverse(a,a+n); rep(i,n) ans += a[1+2*i] cout << ans << endl; }
a.cc: In function 'int main()': a.cc:31:33: error: expected ';' before 'cout' 31 | rep(i,n) ans += a[1+2*i] | ^ | ; ...... 35 | cout << ans << endl; | ~~~~
s783464753
p03767
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n; cin >> n; vector<int> a(3*n); for(int i=0;i<3*n;i++) cin >> a[i]; sort(a.begin(),b.begin()); cout << a[n] << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:18: error: 'b' was not declared in this scope 11 | sort(a.begin(),b.begin()); | ^
s145523989
p03767
C++
n = int(input()) a = sorted(list(map(int,input().split())),reverse=True) print(sum([a[i*2+1] for i in range(n)]))
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s656792009
p03767
C++
#include <iostream> #include <string> #include <vector> #define INC(i, a, b) for(int i = a; i < b; ++i) #define DEC(i, a, b) for(int i = a; i > b; --i) #define REP(i, n) INC(i, 0, n) typedef unsigned int uint; typedef unsigned long ul; typedef long long ll; typedef unsigned long long ull; void TFprint(bool b, std::string T, std::string F){ if(b){ std::cout << T << std::endl; }else{ std::cout << F << std::endl; } } int main(){ int n; std::cin >> n; std::vector<ull> a; ull temp; ull ans = 0; REP(i, 3 * n){ std::cin >> temp; a.push_back(temp); } std::sort(a.begin(), a.end(), std::greater<ull>()); REP(i, n){ //std::cout << a[2 * i + 1] << ' '; ans += a[2 * i + 1]; } std::cout << std::endl; std::cout << ans << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:32:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 32 | std::sort(a.begin(), a.end(), std::greater<ull>()); | ^~~~ | qsort
s742207002
p03767
C++
#include<cstdio> using namespace std; int N; int A[300005]; int main(){ scanf("%d", &N); for(int i=0;i<3*N;i++){ scanf("%d", &A[i]); } sort(A, A+3*N); long long tot = 0; for(int i=N;i<2*N;i++){ tot += (long long)A[i]; } printf("%lld\n", tot); return 0; }
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, A+3*N); | ^~~~ | short
s594579018
p03767
C++
#include <algorithm> #include <cmath> #include <iostream> #include <iomanip> #include <map> #include <string> #include <vector> #include <queue> #include <stack> #include <set> #include <list> #define INF 1000000000ll #define MOD 1000000007ll #define EPS 1e-10 #define REP(i,m) for(long long i=0; i<m; i++) #define FOR(i,n,m) for(long long i=n; i<m; i++) #define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; } #define ALL(v) v.begin(),v.end() #define pb push_back using namespace std; typedef long long int ll; typedef pair<ll, ll> P; typedef long double ld; using namespace std; int main(){ int n; cin >> n; ll a[n]; REP(i, n) cin >> a[i]; sort(a, a+n); ll ans = 0; for(i = 1; i <= 3 * n; i += 3) ans += a[i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:13: error: 'i' was not declared in this scope 32 | for(i = 1; i <= 3 * n; i += 3) ans += a[i]; | ^
s019804448
p03767
C++
#include <iostream> #include <string> using namespace std; int main(){ int N; int a[100000]; unsigned __int64 ans=0; int num; int i; int j; int c; int temp; cin>>N; for(i=0;i<N*3;i++){ cin>>a[i]; } for(i=0;i<N;i++){ num=i*3; for(j=0;j<2;j++){ for(c=0;c<2;c++){ if(a[num+c]>a[num+c+1]){ temp=a[num+c+1]; a[num+c+1]=a[num+c]; a[num+c]=temp; } } } } for(i=1;i<N*3;i=i+3){ ans=ans+a[i]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:8:19: error: expected initializer before 'ans' 8 | unsigned __int64 ans=0; | ^~~ a.cc:33:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 33 | ans=ans+a[i]; | ^~~ | abs a.cc:36:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 36 | cout<<ans; | ^~~ | abs
s770135963
p03767
C++
#include <iostream> #include <string> using namespace std; int main(){ int N; int a[100000]; unsigned __int64 ans=0; int num; int i; int j; int c; int temp; cin>>N; for(i=0;i<N*3;i++){ cin>>a[i]; } for(i=0;i<N;i++){ num=i*3; for(j=0;j<2;j++){ for(c=0;c<2;c++){ if(a[num+c]>a[num+c+1]){ temp=a[num+c+1]; a[num+c+1]=a[num+c]; a[num+c]=temp; } } } } for(i=1;i<N*3;i=i+3){ ans=ans+a[i]; } cout<<ans; }
a.cc: In function 'int main()': a.cc:8:19: error: expected initializer before 'ans' 8 | unsigned __int64 ans=0; | ^~~ a.cc:33:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 33 | ans=ans+a[i]; | ^~~ | abs a.cc:36:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 36 | cout<<ans; | ^~~ | abs
s410711990
p03767
C
// #include {{{ #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <forward_list> #include <functional> #include <iomanip> #include <iostream> #include <fstream> #include <sstream> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <tuple> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #ifdef DEBUG #include <fmt/format.h> #endif using namespace std; // }}} // type {{{ using s8 = int8_t; using u8 = uint8_t; using s16 = int16_t; using u16 = uint16_t; using s32 = int32_t; using u32 = uint32_t; using s64 = int64_t; using u64 = uint64_t; template<typename T> using max_heap = priority_queue<T, vector<T>, less<T>>; template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; // }}} // 適宜調整 //#define int s64 constexpr bool IOS_SYNCSTDIO = false; constexpr int IOS_PREC = 10; constexpr int INF = numeric_limits<int>::max(); constexpr double EPS = 1e-9; // util {{{ template<typename T> constexpr int sgn(T x) { return (x > T(0)) - (x < T(0)); } template<typename T> constexpr typename enable_if<is_signed<T>::value,T>::type modulo(T a, T b) { assert(b > 0); T r = a % b; return r >= 0 ? r : r+b; } template<typename T> constexpr T clamp(T x, T lo, T hi) { assert(lo <= hi); if(x < lo) return lo; else if(x > hi) return hi; else return x; } int sqrti(int x) { assert(x >= 0); return static_cast<int>(sqrt(x)); } s64 sqrtl(s64 x) { assert(x >= 0); return static_cast<s64>(sqrtl(x)); } template<typename T> bool max_update(T& xmax, const T& x) { if(x > xmax) { xmax = x; return true; } else { return false; } } template<typename T> bool min_update(T& xmin, const T& x) { if(x < xmin) { xmin = x; return true; } else { return false; } } template<typename T> constexpr int SIZE(const T& c) { return static_cast<int>(c.size()); } template<typename T, size_t N> constexpr int SIZE(const T (&)[N]) { return static_cast<int>(N); } ostream& FPRINT(ostream& out) { return out; } template<typename T, typename... TS> ostream& FPRINT(ostream& out, const T& x, const TS& ...args) { out << x; if(sizeof...(args)) out << ' '; return FPRINT(out, args...); } template<typename... TS> ostream& FPRINTLN(ostream& out, const TS& ...args) { FPRINT(out, args...); return out << '\n'; } template<typename InputIt> ostream& FPRINTSEQ(ostream& out, InputIt first, InputIt last) { for(InputIt it = first; it != last; ++it) { if(it != first) out << ' '; out << *it; } return out; } template<typename T, size_t N> ostream& FPRINTARRAY1(ostream& out, const T (&c)[N]) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T, size_t N1, size_t N2> ostream& FPRINTARRAY2(ostream& out, const T (&c)[N1][N2]) { out << '\n'; for(const auto& e : c) { FPRINTARRAY1(out, e) << '\n'; } return out; } template<typename... TS> ostream& PRINT(const TS& ...args) { return FPRINT(cout, args...); } template<typename... TS> ostream& PRINTLN(const TS& ...args) { return FPRINTLN(cout, args...); } template<typename InputIt> ostream& PRINTSEQ(InputIt first, InputIt last) { return FPRINTSEQ(cout, first, last); } template<typename T, size_t N> ostream& PRINTARRAY1(const T (&c)[N]) { return FPRINTARRAY1(cout, c); } template<typename T, size_t N1, size_t N2> ostream& PRINTARRAY2(const T (&c)[N1][N2]) { return FPRINTARRAY2(cout, c); } template<typename... TS> ostream& DPRINT(const TS& ...args) { return FPRINT(cerr, args...); } template<typename... TS> ostream& DPRINTLN(const TS& ...args) { return FPRINTLN(cerr, args...); } template<typename InputIt> ostream& DPRINTSEQ(InputIt first, InputIt last) { return FPRINTSEQ(cerr, first, last); } template<typename T, size_t N> ostream& DPRINTARRAY1(const T (&c)[N]) { return FPRINTARRAY1(cerr, c); } template<typename T, size_t N1, size_t N2> ostream& DPRINTARRAY2(const T (&c)[N1][N2]) { return FPRINTARRAY2(cerr, c); } template<typename T1, typename T2> ostream& operator<<(ostream& out, const pair<T1,T2>& p) { return out << '(' << p.first << ',' << p.second << ')'; } template<typename T> ostream& operator<<(ostream& out, const vector<T>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T> ostream& operator<<(ostream& out, const vector<vector<T>>& c) { out << '\n'; for(const auto& e : c) { out << e << '\n'; } return out; } template<typename T> ostream& operator<<(ostream& out, const deque<T>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T> ostream& operator<<(ostream& out, const list<T>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T> ostream& operator<<(ostream& out, const forward_list<T>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T> ostream& operator<<(ostream& out, const set<T>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename T> ostream& operator<<(ostream& out, const unordered_set<T>& c) { return out << set<T>(cbegin(c), cend(c)); } template<typename T, size_t N> ostream& operator<<(ostream& out, const array<T,N>& c) { return FPRINTSEQ(out, cbegin(c), cend(c)); } template<typename InputIt> ostream& FPRINTMAP(ostream& out, InputIt first, InputIt last) { out << "{\n"; for(auto it = first; it != last; ++it) { out << " " << it->first << " : " << it->second << '\n'; } out << "}\n"; return out; } template<typename InputIt> ostream& PRINTMAP(InputIt first, InputIt last) { return FPRINTMAP(cout, first, last); } template<typename InputIt> ostream& DPRINTMAP(InputIt first, InputIt last) { return FPRINTMAP(cerr, first, last); } template<typename K, typename V> ostream& operator<<(ostream& out, const map<K,V>& c) { return FPRINTMAP(out, cbegin(c), cend(c)); } template<typename K, typename V> ostream& operator<<(ostream& out, const unordered_map<K,V>& c) { return out << map<K,V>(cbegin(c), cend(c)); } template<typename T, typename C> ostream& operator<<(ostream& out, stack<T,C> c) { while(!c.empty()) { out << c.top(); c.pop(); if(!c.empty()) out << ' '; } return out; } template<typename T, typename C> ostream& operator<<(ostream& out, queue<T,C> c) { while(!c.empty()) { out << c.front(); c.pop(); if(!c.empty()) out << ' '; } return out; } template<typename T, typename Cont, typename Cmp> ostream& operator<<(ostream& out, priority_queue<T,Cont,Cmp> c) { while(!c.empty()) { out << c.top(); c.pop(); if(!c.empty()) out << ' '; } return out; } struct IosIni { IosIni() { cin.tie(nullptr); ios::sync_with_stdio(IOS_SYNCSTDIO); cout << fixed << setprecision(IOS_PREC); } } IOSINI; #define FOR(i, start, end) for(int i = (start); i < (end); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(f,cc,...) ([&](decltype((cc)) c) { return (f)(begin(c), end(c), ## __VA_ARGS__); })(cc) #define DBG(x) DPRINTLN('L', __LINE__, ':', #x, ':', (x)) // }}} s64 N; vector<s64> A; void solve() { s64 ans = 0; ALL(sort, A); int i = 0; int j = 3*N-1; REP(k, N) { ++i; --j; ans += A[j]; --j; } PRINTLN(ans); } signed main(signed /*argc*/, char** /*argv*/) { cin >> N; A.resize(3*N); REP(i, 3*N) { cin >> A[i]; } solve(); return 0; }
main.c:2:10: fatal error: algorithm: No such file or directory 2 | #include <algorithm> | ^~~~~~~~~~~ compilation terminated.
s231806467
p03767
C++
#include<bits\stdc++.h> using namespace std; typedef long long ll; int N; ll A[300030]; ll ans = 0; int main() { scanf("%d",&N); for(int i = 0; i < N * 3; i++) { scanf("%d",&A[i]); } sort(A,A + N * 3); for(int i = 0; i < N; i++)ans += A[i + N]; printf("%lld\n",ans); return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s963003803
p03767
Java
import java.util.*; import java.io.*; class ColorBall { static int [] c = new int [200010]; static int [] w = new int [200010]; static long [] fac = new long [200010]; static int mod = 1000000000 + 7; static long modpow(long b, int e) { if(e == 0) return 1; if((e & 1) == 1) return (modpow(b, e-1) * b) % mod; long m = modpow(b, e >> 1); return (m * m) % mod; } static long inverse(long x) { return modpow(x, mod - 2); } static class Dsu { int [] par; ArrayList <Integer> [] t; Dsu (int n) { par = new int [n + 5]; t = new ArrayList [n + 5]; for(int i = 0; i <= n; i++) { t[i] = new ArrayList <> (); par[i] = i; t[i].add(c[i]); } } void merge(int p, int q) { p = root(p); q = root(q); if(t[p].size() > t[q].size()) { int temp = p; p = q; q = temp; } if(p == q) return ; par[p] = q; for(Integer i : t[p]) { t[q].add(i); } t[p].clear(); } int root(int p) { if(par[p] == p) return p; else return par[p] = root(par[p]); } long size(int p) { TreeMap <Integer, Integer> s = new TreeMap <> (); for(Integer i : t[root(p)]) { if(s.containsKey(i)) { s.put(i, s.get(i) + 1); } else { s.put(i, 1); } } long ans = fac[ t[root(p)].size() ]; for(Map.Entry <Integer, Integer> i : s.entrySet()) { ans *= inverse( fac[i.getValue()] ); ans %= mod; } return ans; } } static ArrayList <Pair> [] g = new ArrayList [200010]; public static void main(String [] args) { Reader in = new Reader (); Writer out = new Writer (); int n = in.nextInt(); int x, y; x = in.nextInt(); y = in.nextInt(); for(int i = 0; i <= n; i++) { g[i] = new ArrayList <> (); } for(int i = 1; i <= n; i++) { c[i] = in.nextInt(); w[i] = in.nextInt(); g[c[i]].add(new Pair(w[i], i)); } for(int i = 1; i <= n; i++) { Collections.sort(g[i], new Pair()); } int first = -1; int second = -1; for(int i = 1; i <= n; i++) { if(first == -1 || w[first] > w[i]) { first = i; } } for(int i = 1; i <= n; i++) { if(c[i] == c[first]) continue; if(second == -1 || w[second] > w[i]) { second = i; } } Dsu t = new Dsu(n + 10); for(int i = 1; i <= n; i++) { if(g[i].isEmpty()) continue; int p = x - g[i].get(0).first; int q; if(c[first] == i) { if(second == -1) q = -1; else q = y - w[second]; } else { q = y - w[first]; } int low = -1; for(int j = 0; j < g[i].size(); j++) { if(g[i].get(j).first <= p || g[i].get(j).first <= q) { low = j; } } for(int j = 1; j <= low; j++) { t.merge(g[i].get(j-1).second, g[i].get(j).second); } if(c[first] == i && w[first] + g[i].get(0).first <= x) { t.merge(first, g[i].get(0).second); } else if (c[first] != i && w[first] + g[i].get(0).first <= y) { t.merge(first, g[i].get(0).second); } if(second != -1 && c[second] == i && w[second] + g[i].get(0).first <= x) { t.merge(second, g[i].get(0).second); } else if (second != -1 && c[second] != i && w[second] + g[i].get(0).first <= y) { t.merge(second, g[i].get(0).second); } } if(second != -1 && w[first] + w[second] <= y) { t.merge(first, second); } fac[0] = 1; for(int i = 1; i <= n; i++) { fac[i] = fac[i - 1] * i; fac[i] %= mod; } long ans = 1; TreeSet <Integer> ext = new TreeSet <> (); for(int i = 1; i <= n; i++) { if(!ext.contains(t.root(i))) { ext.add(t.root(i)); ans *= t.size(i); ans %= mod; } } System.out.println(ans); } static class Reader { private StringTokenizer a; private BufferedReader b; Reader () { a = null; b = new BufferedReader (new InputStreamReader (System.in)); } public String next () { while(a == null || !a.hasMoreTokens()) { try { a = new StringTokenizer (b.readLine()); } catch (IOException e) { e.printStackTrace(); } } return a.nextToken(); } public int nextInt() { return Integer.parseInt(this.next()); } public long nextLong () { return Long.parseLong(this.next()); } public double nextDouble () { return Double.parseDouble(this.next()); } public String nextLine() { try { return b.readLine(); } catch (IOException e) { e.printStackTrace(); } return ""; } } static class Writer { private PrintWriter a; private StringBuffer b; Writer () { a = new PrintWriter (System.out); b = new StringBuffer (""); } public void write (Object s) { b.append(s); } public void writeln(Object s) { b.append(s).append('\n'); } public void flush () { a.print(b); a.flush(); a.close(); } } static class Pair implements Comparator <Pair> { int first; int second; Pair (int a, int b) { this.first = a; this.second = b; } Pair (Pair a) { this.first = a.first; this.second = a.second; } Pair () {} public String toString () { return "[" + first + ", " + second + "]"; } public int compare (Pair a, Pair b) { if(a.first == b.first) { return a.second - b.second; } else { return a.first - b.first; } } } }
Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.
s298460773
p03767
C++
#include <cstdio> #include <cstring> #include <iostream> #include <set> #include <vector> using namespace std; #define DEBUG(X) cerr<<__LINE__<<" "<<#X<<": "<<X<<endl; #define REP(i,y) for(int i=0;i<(int)(y);i++) #define REPP(i,y) for(int i=1;i<=(int)(y);i++) #define sci(x) int x;scanf("%d",&x); #define scii(x, y) int x,y;scanf("%d%d",&x,&y); typedef long long ll; vector<int> v; void solve() { sci(N); REP(i,3*N) { sci(a); v.push_back(a); } sort(v.begin(), v.end()); ll sum=0; REP(i,N) { sum+=v[v.size()-2-i]; } printf("%lld\n",sum); } int main() { solve(); }
a.cc: In function 'void solve()': a.cc:22:3: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(v.begin(), v.end()); | ^~~~ | short
s068676176
p03767
C++
#include<stdio.h> #include<cstring> #include<cstdlib> #include<cmath> #include<iostream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<bitset> #include<utility> #include<functional> #include<iomanip> #include<sstream> #include<ctime> #include<cassert> using namespace std; #define y0 y0z #define y1 y1z #define yn ynz #define j0 j0z #define j1 j1z #define jn jnz #define tm tmz #define buli(x) (__builtin_popcountll(x)) #define bur0(x) (__builtin_ctzll(x)) #define bul2(x) (63-__builtin_clzll(x)) #define mp make_pair #define pb push_back #define fi first #define se second #define fil(a,b) memset((a),(b),sizeof(a)) #define cl(a) fil(a,0) #define siz(x) ((int)(x).size()) #define all(x) (x).begin(),(x).end() #define foreach(it,a) for(__typeof((a).begin()) it=(a).begin();it!=(a).end();it++) #define rep(i,a,b) for (int i=(a),_ed=(b);i<_ed;i++) #define per(i,a,b) for (int i=(b)-1,_ed=(a);i>=_ed;i--) #define forg(i,gu) for (int i=gu;~i;i=e[i].next) #define pw(x) ((ll(1))<<(x)) #define upmo(a,b) (((a)=((a)+(b))%mo)<0?(a)+=mo:(a)) #define mmo(a,b) (((a)=1ll*(a)*(b)%mo)<0?(a)+=mo:(a)) void getre(){int x=0;printf("%d\n",1/x);} void gettle(){int res=1;while(1)res<<=1;printf("%d\n",res);} typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<pii> vpii; template<typename T,typename S>inline bool upmin(T&a,const S&b){return a>b?a=b,1:0;} template<typename T,typename S>inline bool upmax(T&a,const S&b){return a<b?a=b,1:0;} template<typename N,typename PN>inline N flo(N a,PN b){return a>=0?a/b:-((-a-1)/b)-1;} template<typename N,typename PN>inline N cei(N a,PN b){return a>0?(a-1)/b+1:-(-a/b);} template<typename N>N gcd(N a,N b){return b?gcd(b,a%b):a;} template<typename N>inline int sgn(N a){return a>0?1:(a<0?-1:0);} #if ( ( _WIN32 || __WIN32__ ) && __cplusplus < 201103L) #define lld "%I64d" #else #define lld "%lld" #endif inline void gn(long long&x){ int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0'); while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg; } inline void gn(int&x){long long t;gn(t);x=t;} inline void gn(unsigned long long&x){long long t;gn(t);x=t;} inline void gn(double&x){double t;scanf("%lf",&t);x=t;} inline void gn(long double&x){double t;scanf("%lf",&t);x=t;} inline void gs(char *s){scanf("%s",s);} inline void gc(char &c){while((c=getchar())>126 || c<33);} inline void pc(char c){putchar(c);} #ifdef JCVB #define debug(...) fprintf(stderr, __VA_ARGS__) #else #define debug(...) #endif typedef long long ll; typedef double db; inline ll sqr(ll a){return a*a;} inline db sqrf(db a){return a*a;} const int inf=0x3f3f3f3f; //const ll inf=0x3f3f3f3f3f3f3f3fll; const db pi=3.14159265358979323846264338327950288L; const db eps=1e-6; const int mo=1e9+7; int qp(int a,ll b){int n=1;do{if(b&1)n=1ll*n*a%mo;a=1ll*a*a%mo;}while(b>>=1);return n;} int fa[211111]; int gf(int x){ return x==fa[x]?x:fa[x]=gf(fa[x]); } void un(int a,int b){ a=gf(a); b=gf(b); fa[a]=b; } const int N=222222; int fac[N]; int ifac[N]; int n; int co[N],we[N]; int X,Y; int cmin[N]; int mini=0,semi=0; vi lis[N]; int sz[N]; int main() { #ifdef JCVB //freopen("1.in","r",stdin); //freopen("1.out","w",stdout); int _time_jc=clock(); #endif fac[0]=1; rep(i,1,N)fac[i]=1ll*i*fac[i-1]%mo; rep(i,0,N)ifac[i]=qp(fac[i],mo-2); gn(n);gn(X);gn(Y); we[0]=inf; rep(i,1,n+1){ gn(co[i]); gn(we[i]); if(we[i]<we[cmin[co[i]]])cmin[co[i]]=i; } rep(i,1,n+1)if(cmin[i]!=0){ if(we[cmin[i]]<we[mini]){ semi=mini; mini=cmin[i]; }else if(we[cmin[i]]<we[semi]){ semi=cmin[i]; } } rep(i,1,n+1)fa[i]=i; rep(i,1,n+1){ if(we[i]+we[cmin[co[i]]]<=X) un(i,cmin[co[i]]); int tar=0; if(co[i]==co[mini]){ tar=mimi; }else{ tar=mini; } if(tar!=0 && we[tar]+we[i]<=Y)un(i,tar); } rep(i,1,n+1)lis[gf(i)].pb(co[i]); int res=1; rep(i,1,n+1)if(!lis[i].empty()){ rep(j,0,siz(lis[i]))sz[lis[i][j]]=0; rep(j,0,siz(lis[i]))sz[lis[i][j]]++; mmo(res,fac[siz(lis[i])]); rep(j,0,siz(lis[i])){ int t=lis[i][j]; mmo(res,ifac[sz[t]]); sz[t]=1; } } printf("%d\n",res); #ifdef JCVB debug("time: %d\n",int(clock()-_time_jc)); #endif return 0; }
a.cc: In function 'int main()': a.cc:139:29: error: 'mimi' was not declared in this scope; did you mean 'mini'? 139 | tar=mimi; | ^~~~ | mini
s234589285
p03767
Java
import java.util.Arrays; import java.util.Scanner; public class A12 { public static void main( String[] args ) { Scanner s = new Scanner( System.in ); int n = s.nextInt(); int[] strengths = new int[3*n]; for(int i = 0; i < 3*n; i++) { strengths[i] = s.nextInt(); } Arrays.sort( strengths ); int l = 0, r = 3*n - 1; long sum = 0; while(l < r) { sum += strengths[r-1]; r -= 2; l++; } System.out.println( sum ); s.close(); } }
Main.java:4: error: class A12 is public, should be declared in a file named A12.java public class A12 ^ 1 error
s209824927
p03767
C++
#include<bits/stdc++.h> #include<unordered_map> /* *▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ * ▀▀ ▀▀▀▀▀▀ ▀ ▀▀▀▀▀▀ ▀ ▀ * ▀ ▀ ▀ ▀ ▀ ▀ ▀ * ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ * ▀ ▀▀▀▀ ▀ ▀ ▀ ▀ ▀ *▀ ▀ ▀ ▀ ▀ ▀ *▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ */ using namespace std; void afify() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } #define ll long long #define ld long double #define loopi(i,intial,n) for(ll i=ll(intial);i<n;i++) #define loopj(j,intial,n) for(ll j=ll(intial);j<n;j++) #define min3(a,b,c) min(a,min(b,c)) #define max3(a,b,c) max(a,max(b,c)) #define all(v) v.begin(),v.end() /////////////////////////////////////// #define SCD(a) scanf("%d",&a) #define SCD2(a,b) scanf("%d %d",&a,&b) #define SCLL(a) scanf("%lld",&a) #define SCLL2(a,b) scanf("%lld %lld",&a,&b) #define PRD(a) printf("%d\n",a) #define PRLL(a) printf("%lld\n",a) /////////////////////////////////////// typedef vector <int> vi; typedef vector <ll> vll; typedef vector <vi> vvi; typedef vector <vll> vvll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vpll> vvpll; typedef vector<vpii> vvpii; typedef stringstream ss; const ll oo = (ll) 1e13; //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); //ifstream ifs("input.txt"); //ofstream ofs("output.txt"); int main() { afify(); ll n; cin>>n;ll sum=0; loopi(i,0,n){ ll a,b,c; cin>>a>>b>>c; ll x=max3(a,b,c); ll y=min3(a,b,c); ll mid=a+b+c-x-y; sum+=mid; } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:12: error: expected primary-expression before 'long' 20 | #define ll long long | ^~~~ a.cc:22:37: note: in expansion of macro 'll' 22 | #define loopi(i,intial,n) for(ll i=ll(intial);i<n;i++) | ^~ a.cc:57:4: note: in expansion of macro 'loopi' 57 | loopi(i,0,n){ | ^~~~~
s045066713
p03767
C++
#include<bits/stdc++.h> #include<unordered_map> /* *▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ * ▀▀ ▀▀▀▀▀▀ ▀ ▀▀▀▀▀▀ ▀ ▀ * ▀ ▀ ▀ ▀ ▀ ▀ ▀ * ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ * ▀ ▀▀▀▀ ▀ ▀ ▀ ▀ ▀ *▀ ▀ ▀ ▀ ▀ ▀ *▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ */ using namespace std; void afify() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } #define ll long long #define ld long double #define loopi(i,intial,n) for(ll i=ll(intial);i<n;i++) #define loopj(j,intial,n) for(ll j=ll(intial);j<n;j++) #define min3(a,b,c) min(a,min(b,c)) #define max3(a,b,c) max(a,max(b,c)) #define all(v) v.begin(),v.end() /////////////////////////////////////// #define SCD(a) scanf("%d",&a) #define SCD2(a,b) scanf("%d %d",&a,&b) #define SCLL(a) scanf("%lld",&a) #define SCLL2(a,b) scanf("%lld %lld",&a,&b) #define PRD(a) printf("%d\n",a) #define PRLL(a) printf("%lld\n",a) /////////////////////////////////////// typedef vector <int> vi; typedef vector <ll> vll; typedef vector <vi> vvi; typedef vector <vll> vvll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<pii> vpii; typedef vector<pll> vpll; typedef vector<vpll> vvpll; typedef vector<vpii> vvpii; typedef stringstream ss; const ll oo = (ll) 1e13; //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); //ifstream ifs("input.txt"); //ofstream ofs("output.txt"); int main() { afify(); ll n; cin>>n;ll sum=0; loopi(i,0,n){ ll a,b,c; cin>>a>>b>>c; ll x=max3(a,b,c); ll y=min3(a,b,c); ll mid=a+b+c-x-y; sum+=mid; } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:20:12: error: expected primary-expression before 'long' 20 | #define ll long long | ^~~~ a.cc:22:37: note: in expansion of macro 'll' 22 | #define loopi(i,intial,n) for(ll i=ll(intial);i<n;i++) | ^~ a.cc:57:4: note: in expansion of macro 'loopi' 57 | loopi(i,0,n){ | ^~~~~
s515123958
p03767
C++
n = int(raw_input()) ls = map(int, raw_input().split()) ls.sort() sum = 0 for i in range(n): sum += ls[n+i*2] print sum
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s605132955
p03767
Java
import java.math.BigInteger; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Solution { public Solution() { // TODO Auto-generated constructor stub } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); BigInteger[] a = new BigInteger[3*N]; for(int i = 0; i < 3*N; i++) a[i] = BigInteger.valueOf(sc.nextLong()); sc.close(); List<BigInteger> aList = Arrays.asList(a); Collections.sort(aList); System.out.println(aList); BigInteger sum = BigInteger.ZERO; for(int i = aList.size() - 2; i >= N; i -= 2) { sum = sum.add(aList.get(i)); System.out.println(aList.get(i)); System.out.println(sum); } System.out.println(sum); } }
Main.java:7: error: class Solution is public, should be declared in a file named Solution.java public class Solution { ^ 1 error
s537005689
p03767
C++
#include<iostream> #include<stack> using namespace std; static const int N = 100001; int n, m,q,color[N]; void dfs(int v,int d,int c) { color[v]=c; if(d==0) return; d--; for(int i=1;i<=n;i++){ if(M[v][i]==1||M[i][v]==1){ dfs(i,d,c); } } for(int i=1;i<=n;i++){ //ぬる } } int main() { int a,b,v[N],d[N],c[N],M[N]; cin >> n >>m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { M[i][j] = 0; } } for (int i = 0; i < m; i++) { cin >> a >> b; M[a][b]=M[b][a]=1; } cin>>q; for(int i=0;i<q;i++){ cin>>v[i]>>d[i]>>c[i]; } for (int i = 1; i <= n; i++) { color[i] = 0; } for(int i=q-1;i>0;i++){ dfs(v[i],d[i],c[i]); } for(int i=1;i<=n;i++){ cout<<color[i]<<endl; } return 0; }
a.cc: In function 'void dfs(int, int, int)': a.cc:13:8: error: 'M' was not declared in this scope 13 | if(M[v][i]==1||M[i][v]==1){ | ^ a.cc: In function 'int main()': a.cc:32:29: error: invalid types 'int[int]' for array subscript 32 | M[i][j] = 0; | ^ a.cc:38:9: error: invalid types 'int[int]' for array subscript 38 | M[a][b]=M[b][a]=1; | ^ a.cc:38:17: error: invalid types 'int[int]' for array subscript 38 | M[a][b]=M[b][a]=1; | ^
s532080541
p03767
C++
#include <bits/stdc++.h> using namespace std; int main () { // freopen("1.txt", "r", stdin); // freopen("2.txt", "w", stdout); int n; cin >> n; vector <long long> a(3 * n); for (int i = 0; i < 3 * n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); ll ans = 0; for (int i = 0, j = 3 * n - 2; i < n; i++, j -= 2) { ans += a[j]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:5: error: 'll' was not declared in this scope 21 | ll ans = 0; | ^~ a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | ans += a[j]; | ^~~ | abs a.cc:25:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | cout << ans << endl; | ^~~ | abs
s765014611
p03767
C++
#include <iostream> #include <algorithm> using namespace std int main(){ int a[1000000010]; int N; cin >> N; for (int i=0;i<N*3;i++){ cin >> a[i]; } sort(a,a+N*3); int sum=0; for (int i=0;i<N;i++){ sum += a[i*3+1]; } cout << sum <<endl; return 0; }
a.cc:4:20: error: expected ';' before 'int' 4 | using namespace std | ^ | ; 5 | 6 | int main(){ | ~~~
s829475471
p03767
C++
#include <iostream> #include <algorythm> using namespace std int main(){ int a[1000000010]; int N; cin >> N; for (int i=0;i<N*3;i++){ cin >> a[i]; } sort(a,a+N*3); int sum=0; for (int i=0;i<N;i++){ sum += a[i*3+1]; } cout << sum <<endl; return 0; }
a.cc:2:10: fatal error: algorythm: No such file or directory 2 | #include <algorythm> | ^~~~~~~~~~~ compilation terminated.
s841288112
p03767
C++
#include<iostream> #include<iomanip> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<cassert> #include<cstring> #include<bitset> #include<queue> typedef long long ll; using namespace std; int const N = 100 * 1000 + 16; int const M = 1000 * 1000 * 1000 + 7; int const inf = 1000 * 1000 * 1000; int n, m, k; int a[3*N]; int main() { cin.tie(0); cin.sync_with_stdio(0); cin >> n; copy_n(istream_iterator<int>(cin), 3 * n, a); sort(a, a+n); ll sum = 0; for(int i = 1; i < n + n + n; i += 3) sum += a[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:27:16: error: 'istream_iterator' was not declared in this scope 27 | copy_n(istream_iterator<int>(cin), 3 * n, a); | ^~~~~~~~~~~~~~~~ a.cc:11:1: note: 'std::istream_iterator' is defined in header '<iterator>'; this is probably fixable by adding '#include <iterator>' 10 | #include<queue> +++ |+#include <iterator> 11 | typedef long long ll; a.cc:27:33: error: expected primary-expression before 'int' 27 | copy_n(istream_iterator<int>(cin), 3 * n, a); | ^~~
s878006780
p03767
C++
#include <iostream> #include <algorithm> using namespace std; # define MAX_N # define MAX_W int solve(); int dp[MAX_N+1][MAX_W+1]; int main(void){ int n; cout << n; solve(); } int rec(int i,int j){ if(dp[i][j]>0){ return dp[i][j]; } int res; if(i == n){ res = 0; } else if(j < w[i]) { res = rec(i+1,j); } else { res = max(rec(i+1,j),rec(i,j-w[i])+v[i]); } return dp[i][j]; } void solve(){ memset(dp,-1,sizeof(dp)); printf("%d\n",rec(0,W)); }
a.cc: In function 'int rec(int, int)': a.cc:24:11: error: 'n' was not declared in this scope 24 | if(i == n){ | ^ a.cc:27:15: error: 'w' was not declared in this scope 27 | else if(j < w[i]) { | ^ a.cc:31:40: error: 'v' was not declared in this scope 31 | res = max(rec(i+1,j),rec(i,j-w[i])+v[i]); | ^ a.cc: At global scope: a.cc:36:6: error: ambiguating new declaration of 'void solve()' 36 | void solve(){ | ^~~~~ a.cc:9:5: note: old declaration 'int solve()' 9 | int solve(); | ^~~~~ a.cc: In function 'void solve()': a.cc:38:3: error: 'memset' was not declared in this scope 38 | memset(dp,-1,sizeof(dp)); | ^~~~~~ 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 | a.cc:39:23: error: 'W' was not declared in this scope 39 | printf("%d\n",rec(0,W)); | ^
s804903826
p03767
C++
#include <bits\stdc++.h> using namespace std; int main() { int n; cin >> n; int a[3*n]; for (int i=0; i<3*n; i++) { cin >> a[i]; } sort(a, a+3*n); long long sum=0; for (int i=n+1; i<2*n+1; i++) { sum += a[i]; } cout << sum << endl; }
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory 1 | #include <bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s972669438
p03767
C++
#include<bits/stdc++.h> int a[600010],n,s; int main() { scanf("%d",&n); for(int i=6*n;i;--i)scanf("%d",&a[i]); std::sort(a+1,a+6*n+1;++i); for(int i=1;i<=n;++i)s+=a[6*n-2*i+1]; printf("%d\n",s); return 0; }
a.cc: In function 'int main()': a.cc:7:26: error: expected ')' before ';' token 7 | std::sort(a+1,a+6*n+1;++i); | ~ ^ | ) a.cc:7:29: error: 'i' was not declared in this scope 7 | std::sort(a+1,a+6*n+1;++i); | ^
s593698886
p03767
C++
n = int(raw_input()) arr = sorted(map(int, raw_input().split())) print sum(map(lambda i: arr[n + 2 * i], range(n)))
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s306823213
p03767
C++
1
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 1 | ^
s359096273
p03767
C++
#include <bits/stdc++.h> using namespace std; typedef long long LL; const int nmax = 100010; const LL mod = 1000003; int N,M,c[nmax],lg[2005][2005],w,as[nmax]; vector<int>G[nmax]; void fct(int nod,,tata,int d,int cul){ if(d >= 0&&!c[nod])c[nod] = cul; if(!d) return; for(auto it: G[nod]) if(it != tata) fct(it,nod,d-1,cul); } int main(void){ int i,j,x,y,T,z,t,e,nod,dist,cul; // freopen("txt.in","r",stdin); // freopen("txt.out","w",stdout); ios::sync_with_stdio(false); cin >> N >> M; for(i = 1; i <= M; ++i){ cin >> x >> y; G[x].push_back(y); G[y].push_back(x); } cin >> T; for(i =1 ; i <= T; ++i) cin >> as[0] >> as[1] >> as[2]; while(T--) fct(as[T],as[1],as[2]); for(i = 1; i <= N; ++i) cout << c[i] << '\n'; return 0; }
a.cc:12:18: error: expected identifier before ',' token 12 | void fct(int nod,,tata,int d,int cul){ | ^ a.cc:12:19: error: 'tata' has not been declared 12 | void fct(int nod,,tata,int d,int cul){ | ^~~~ a.cc: In function 'void fct(int, int, int, int, int)': a.cc:17:13: error: 'tata' was not declared in this scope 17 | if(it != tata) | ^~~~ a.cc:18:8: error: too few arguments to function 'void fct(int, int, int, int, int)' 18 | fct(it,nod,d-1,cul); | ~~~^~~~~~~~~~~~~~~~ a.cc:12:6: note: declared here 12 | void fct(int nod,,tata,int d,int cul){ | ^~~ a.cc: In function 'int main()': a.cc:37:8: error: too few arguments to function 'void fct(int, int, int, int, int)' 37 | fct(as[T],as[1],as[2]); | ~~~^~~~~~~~~~~~~~~~~~~ a.cc:12:6: note: declared here 12 | void fct(int nod,,tata,int d,int cul){ | ^~~
s824239992
p03767
C++
d
a.cc:1:1: error: 'd' does not name a type 1 | d | ^
s234548758
p03767
C
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int64_t> array(3*N); for(int64_t i=0;i<3*N;i++) cin >> array[i]; sort(array.begin(), array.end()); int64_t ans = 0; for(int64_t i=N;i<3*N;i+=2) ans += array[i]; cout << ans << endl; return 0; }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s111319590
p03767
C++
#include <cstdio> #include <iostream> #include <vector> using namespace std; int main() { int N; cin >> N; vector<int64_t> array(3*N); for(int64_t i=0;i<3*N;i++) cin >> array[i]; sort(array.begin(), array.end()); int64_t ans = 0; for(int64_t i=N;i<3*N;i+=2) ans += array[i]; cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(array.begin(), array.end()); | ^~~~ | short
s735019832
p03767
C++
#include <algorithm> #include <stdio.h> #include <functional> using namespace std; int N, M, i; long long int r; template<typename ...> static inline int gc(void) { return getchar(); } static inline void read(int &x){int k=gc();x=0;for(;;k=gc()){if(isdigit(k)){x=k-48;break;}}for(;;){k=gc();if(!isdigit(k))break;x=x*10+k-48;}} int main(){ read(N); M = N; N <<= 1; M += N; ++N; vector<int> a(M); for(; i ^ M; ++i){ read(a[i]); } sort(a.begin(), a.end(), greater<int>()); for(i = 1; i ^ N; i += 2){ r += a[i]; } printf("%lld", r); return 0; }
a.cc: In function 'void read(int&)': a.cc:10:65: error: 'isdigit' was not declared in this scope 10 | static inline void read(int &x){int k=gc();x=0;for(;;k=gc()){if(isdigit(k)){x=k-48;break;}}for(;;){k=gc();if(!isdigit(k))break;x=x*10+k-48;}} | ^~~~~~~ a.cc:10:111: error: 'isdigit' was not declared in this scope 10 | static inline void read(int &x){int k=gc();x=0;for(;;k=gc()){if(isdigit(k)){x=k-48;break;}}for(;;){k=gc();if(!isdigit(k))break;x=x*10+k-48;}} | ^~~~~~~
s950301423
p03767
C++
#include <algorithm> #include <stdio.h> using namespace std; long long int N, M, a[114514], r; template<typename ...> static inline int gc(void) { return getchar(); } static inline void read(long long int &x){int k,m=0;x=0;for(;;){k=gc();if(k==45){m=1;break;}if(48<=k&&k<=57){x=k-48;break;}}for(;;){k=gc();if(k<48||k>57)break;x=x*10+k-48;}if(m)x=-x;} int main(){ read(N); M = N + (N << 1); for(int i = 0; i ^ M; ++i){ read(a[i]); } sort(a, a + N * 3, greater<long long int>()); N <<= 1; ++N; for(int i = 1; i ^ N; i += 2){ r += a[i]; } printf("%lld", r); return 0; }
a.cc: In function 'int main()': a.cc:16:24: error: 'greater' was not declared in this scope 16 | sort(a, a + N * 3, greater<long long int>()); | ^~~~~~~ a.cc:16:32: error: expected primary-expression before 'long' 16 | sort(a, a + N * 3, greater<long long int>()); | ^~~~
s145504411
p03767
C++
#include<iostream> #include<cmath> #include<cstdlib> #include<algorithm> using namespace std; bool cmp(int x,int y){ return x>y; } int main(){ int n; ll sum=0; long long a[1000005]; cin>>n; for(int i=0;i<3*n;i++)cin>>a[i]; sort(a,a+3*n,cmp); for(int i=1;i<=2*n;i+=2){ sum+=a[i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:11:1: error: 'll' was not declared in this scope 11 | ll sum=0; | ^~ a.cc:17:17: error: 'sum' was not declared in this scope 17 | sum+=a[i]; | ^~~ a.cc:19:15: error: 'sum' was not declared in this scope 19 | cout<<sum<<endl; | ^~~
s693960628
p03767
C++
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cstdint> using namespace std; int main() { int_least32_t n; cin >> n; vector<int_least32_t> v(3 * n); for(auto& x : v) { cin >> v; } sort(v.begin(), v.end()); int_least64_t sum{ accumulate(v.begin() + n, v.begin() + 2 * n, 0LL) }; cout << sum / n << endl; }
a.cc: In function 'int main()': a.cc:16:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 16 | cin >> v; | ~~~ ^~ ~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, 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
s437054326
p03767
C++
#include <cstdio> #include <algorithm> using namespace std; int main(){ int N; scanf("%d", &N); int a[3*N]; for (int i = 0; i < 3*N; i++){ scanf(" %d", &a[i]); } sort(a, a+3*N); int sum=0; for (int i = 0; i < N; i++){ sum += a[3*N-(2*i+1)-1]; } printf("%d\n", sum); return 0; } [ohwa
a.cc:25:1: error: expected unqualified-id before '[' token 25 | [ohwa | ^
s024171223
p03767
C++
n = input() x = [int(_) for _ in input().split()] x.sort() print(sum(x[n:n*2]))
a.cc:1:1: error: 'n' does not name a type 1 | n = input() | ^
s971931276
p03767
C++
#include <cstdio> #include <algorithm> #include <deque> #include <iostream> using namespace std; deque<int> A; long long n; int tol; void solve(long long n) { if (n==0ll) return; if (n%2ll==0ll) { solve(n-1ll); A.push_back(++tol); A.push_back(tol); } else { solve(n/2ll); A.front(++tol); A.push_back(tol); } } int main() { cin >> n; solve(n); cout << A.size() << endl; for (int i = 0; i < A.size(); ++i) cout << A[i] << " "; }
a.cc: In function 'void solve(long long int)': a.cc:18:24: error: no matching function for call to 'std::deque<int>::front(int&)' 18 | A.front(++tol); | ~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/deque:66, from a.cc:3: /usr/include/c++/14/bits/stl_deque.h:1444:7: note: candidate: 'std::deque<_Tp, _Alloc>::reference std::deque<_Tp, _Alloc>::front() [with _Tp = int; _Alloc = std::allocator<int>; reference = int&]' 1444 | front() _GLIBCXX_NOEXCEPT | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:1444:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/14/bits/stl_deque.h:1456:7: note: candidate: 'std::deque<_Tp, _Alloc>::const_reference std::deque<_Tp, _Alloc>::front() const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&]' 1456 | front() const _GLIBCXX_NOEXCEPT | ^~~~~ /usr/include/c++/14/bits/stl_deque.h:1456:7: note: candidate expects 0 arguments, 1 provided
s838470655
p03767
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; const int N = 1e5; typedef long long LL; int a[N * 3 + 5]; int main() { int n; scanf("%d",&n); for(int i = 1 ; i <= 3 * n ; i++) scanf("%d",&a[i]); sort(a + 1 , a + 1 + 3 * n ); LL sum1 = 0 , sum2 = 0; int cnt ; for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt++ ) sum1 += a[i]; for(int i = n + 1 ; i <= 2 * n ; i++) sum2 += a[i]; printf("%lld\n",max(sum1 , sum2)); return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: unable to find numeric literal operator 'operator""n' 21 | for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt++ ) sum1 += a[i]; | ^~
s838455563
p03767
C
#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin >> n; long a[3 * n]; for (int i = 0; i < n * 3; i++) { cin >> a[i]; } sort(a, a + (3 * n) ); long long count = 0; for (int i = 0; i < n; i++) { count += a[3 * n - 1 - (i * 2 + 1)] ; } cout << count << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s908582622
p03767
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; const int N = 1e5; typedef long long LL; int a[N * 3 + 5]; int main() { int n; scanf("%d",&n); for(int i = 1 ; i <= 3 * n ; i++) scanf("%d",&a[i]); sort(a + 1 , a + 1 + 3 * n ); LL sum1 = 0 , sum2 = 0; int cnt ; for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt-- ) sum1 += a[i]; for(int i = n + 1 ; i <= 2 * n ; i++) sum2 += a[i]; printf("%lld\n",max(sum1 , sum2)); return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: unable to find numeric literal operator 'operator""n' 21 | for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt-- ) sum1 += a[i]; | ^~
s259088858
p03767
C++
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; const int N = 1e5; typedef long long LL; int a[N * 3 + 5]; int main() { int n; scanf("%d",&n); for(int i = 1 ; i <= 3 * n ; i++) scanf("%d",&a[i]); sort(a + 1 , a + 1 + 3 * n ); LL sum1 = 0 , sum2 = 0; for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt-- ) sum1 += a[i]; for(int i = n + 1 ; i <= 2 * n ; i++) sum2 += a[i]; printf("%lld\n",max(sum1 , sum2)); return 0; }
a.cc: In function 'int main()': a.cc:20:21: error: unable to find numeric literal operator 'operator""n' 20 | for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt-- ) sum1 += a[i]; | ^~ a.cc:20:39: error: 'cnt' was not declared in this scope; did you mean 'int'? 20 | for(int i = 3n - 1 ,cnt = 1 ; cnt <= n ; i -= 2 , cnt-- ) sum1 += a[i]; | ^~~ | int
s174646840
p03767
C++
#include<iostream> #include<vector> using namespace std; int main(int argc, char const *argv[]) { int N; cin >> N; vector<int> a; for(int i=0;i<3*N;i++){ int ai; cin >> ai; a.push_back(ai); } sort(a.begin(),a.end()); long long int ans=0; for(int i=N;i<2*N;i++){ ans+=a[i]; cout << "added " << a[i] << endl; } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a.begin(),a.end()); | ^~~~ | short
s701095933
p03767
C++
//============================================================================ // Name : atcoder.cpp // Author : // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <iostream> #include <stdlib.h> /* abs */ #include <vector> #include <algorithm> #include <stdlib.h> using namespace std; int N; long long a[100001]; long long R=0; int main(){ cin>>N; for(int i=0;i<N*3;i++)cin>>a[i]; sort(N,N+N*3, greater<int>() ); int S=0; for(int i=N*3;i<0;i--){ if(i%2==1){ if(S<N){ R+=a[i]; S+=1; } if(S>N)break; } } cout<<R<<endl; return 0; }
In file included from /usr/include/c++/14/algorithm:61, from a.cc:12: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:22:6: required from here 22 | sort(N,N+N*3, greater<int>() ); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/exception_ptr.h:41, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:9: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = int; _Iterator2 = int; _Compare = std::greater<int>]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:22:6: required from here 22 | sort(N,N+N*3, greater<int>() ); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:31: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:39: error: invalid type argument of unary '*' (have 'int') 158 | { return bool(_M_comp(*__it1, *__it2)); } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:22:6: required from here 22 | sort(N,N+N*3, greater<int>() ); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<greater<int> >]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4805:18: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = int; _Compare = greater<int>]' 4805 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
s863980487
p03767
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define rep(i,n) for(i=0;i<n;i++) long long dp[50][50]; int in(void){ int i; scanf("%d",&i); return i; } long long llin(void){ long long i; scanf("%lld",&i); return i; } int cmp(const void *a,const void *b){ return *a-*b; } long long min(long long a,long long b){ return a<b?a:b; } long long max(long long a,long long b){ return a>b?a:b; } long long a[300000]; int main(void){ int i,n; long long ans=0; n=in(); rep(i,3*n){ a[i]=llin(); } qsort(a,3*n,sizeof(long long),cmp); for(i=n;i<2*n;i++){ ans+=a[i]; } printf("%lld\n",ans); return 0; }
main.c: In function 'cmp': main.c:18:16: warning: dereferencing 'void *' pointer 18 | return *a-*b; | ^~ main.c:18:19: warning: dereferencing 'void *' pointer 18 | return *a-*b; | ^~ main.c:18:16: error: void value not ignored as it ought to be 18 | return *a-*b; | ^~ main.c:18:19: error: void value not ignored as it ought to be 18 | return *a-*b; | ^~
s542977335
p03767
C++
#include <bits/stdc++.h> using namespace std; static const int MAXN = 3 * 1e5 + 10; typedef __int64 LL; int n; int data[MAXN] = {0}; int main() { scanf("%d" , &n); n *= 3; for(int i = 0 ; i < n ; ++i) scanf("%d" , data + i); sort(data , data + n); int l = 0 , r = n - 2; LL ans = 0; int pos = 0; n /= 3; while(pos < n) { ans += data[r]; r -= 2; ++pos; } printf("%I64d" , ans); }
a.cc:4:9: error: '__int64' does not name a type; did you mean '__int64_t'? 4 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:12:22: error: reference to 'data' is ambiguous 12 | scanf("%d" , data + i); | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [300010]' 6 | int data[MAXN] = {0}; | ^~~~ a.cc:13:10: error: reference to 'data' is ambiguous 13 | sort(data , data + n); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [300010]' 6 | int data[MAXN] = {0}; | ^~~~ a.cc:13:17: error: reference to 'data' is ambiguous 13 | sort(data , data + n); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [300010]' 6 | int data[MAXN] = {0}; | ^~~~ a.cc:15:5: error: 'LL' was not declared in this scope 15 | LL ans = 0; | ^~ a.cc:20:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | ans += data[r]; | ^~~ | abs a.cc:20:16: error: reference to 'data' is ambiguous 20 | ans += data[r]; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:6:5: note: 'int data [300010]' 6 | int data[MAXN] = {0}; | ^~~~ a.cc:24:22: error: 'ans' was not declared in this scope; did you mean 'abs'? 24 | printf("%I64d" , ans); | ^~~ | abs
s491397595
p03767
C++
#include <iostream> | 1 10 2 #include <algorithm> | 2 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000 3 #include <cmath> | 000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000 4 #include <sstream> | 00 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 5 #include <string> |~ 6 |~ 7 using namespace std; |~ 8 int main() |~ 9 { |~ 10 int n; |~ 11 cin >> n; |~ 12 int m = n * 3; |~ 13 long long a[m]; |~ 14 for(int i = 0; i < m; i++){ |~ 15 cin >> a[i]; |~ 16 } |~ 17 sort(a, a+m); |~ 18 |~ 19 long long ans = 0; |~ 20 for(int i = 0; i < n; i++){ |~ 21 ans += a[m-i*2-2]; |~ 22 } |~ 23 cout << ans << endl; |~ 24 }
a.cc:1:116: warning: extra tokens at end of #include directive 1 | #include <iostream> | 1 10 | ^ a.cc:2:5: error: stray '#' in program 2 | 2 #include <algorithm> | 2 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000 | ^ a.cc:3:5: error: stray '#' in program 3 | 3 #include <cmath> | 000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000 | ^ a.cc:4:5: error: stray '#' in program 4 | 4 #include <sstream> | 00 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 | ^ a.cc:5:5: error: stray '#' in program 5 | 5 #include <string> |~ | ^ a.cc:2:3: error: expected unqualified-id before numeric constant 2 | 2 #include <algorithm> | 2 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000 | ^ a.cc:7:120: error: expected unqualified-id before '|' token 7 | 7 using namespace std; |~ | ^
s369131700
p03767
C++
#include <iostream> using namespace std; int main(){ int m; cin >> m; int n = 3*m; long long int a[n]; for(int i = 0; i < n; i++){ cin >> a[i]; } // sort int max; long long int sum = 0; for(int i = 0; i < n-1; i++){ if(i >= m*2) break; flag swap = false; max = i; for(int j = i+1; j < n; j++){ if(a[max] < a[j]) { max = j; swap = true; } } // swap(&a, i, max); if(swap){ long long int tmp = a[i]; a[i] = a[max]; a[max] = tmp; } if(1 == i%2 && i < m*2) sum += a[i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:30:5: error: 'flag' was not declared in this scope 30 | flag swap = false; | ^~~~ a.cc:36:16: error: overloaded function with no contextual type information 36 | swap = true; | ^~~~ a.cc:41:12: error: cannot resolve overloaded function 'swap' based on conversion to type 'bool' 41 | if(swap){ | ^
s752380499
p03767
C++
#include <iostream> #include <iomanip> #include <cmath> #include <queue> #include <map> #include <cstdlib> #include <string> #include <functional> using namespace std; int main(void) { int n; vector <int>aaaa(300000); cin >> n; for (int i = 0; i < n * 3; ++i) { cin >> aaaa[i]; } long long int sum = 0; sort(aaaa.begin(), aaaa.end(), greater<int>()); for (int i = 0; i < n; ++i) { sum += aaaa[n + i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 20 | sort(aaaa.begin(), aaaa.end(), greater<int>()); | ^~~~ | sqrt
s335567488
p03767
Java
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Check2 { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars==-1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if(numChars <= 0) return -1; } return buf[curChar++]; } public String nextLine() { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } public int nextInt() { int c = read(); while(isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if(c<'0'||c>'9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; while (!isSpaceChar(c) && c != '.') { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } if (c == '.') { c = read(); double m = 1; while (!isSpaceChar(c)) { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); m /= 10; res += (c - '0') * m; c = read(); } } return res * sgn; } public String readString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public String next() { return readString(); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } public static void main(String args[]) throws Exception { InputReader in=new InputReader(System.in); PrintWriter w=new PrintWriter(System.out); int n=in.nextInt(); long a[]=new long[3*n]; for(int i=0;i<3*n;i++){ a[i]=in.nextLong(); } Arrays.sort(a); int v[]=new int[3*n]; int j=3*n-1; long s=0; for(int i=0;i<3*n;i++){ if(v[i]==1){ continue; } v[i]=1; v[j]=1; v[j-1]=1; j-=2; s=s+a[3*n-i-2]; //System.out.println(i+" "+s); } w.println(s); w.close(); } }
Main.java:8: error: class Check2 is public, should be declared in a file named Check2.java public class Check2 ^ 1 error
s302444616
p03767
Java
/** * Created by Karan Jobanputra on 01-04-2017. */ import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class AtCoderGroupContest { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) return -1; } return buf[curChar++]; } public String nextLine() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; while (!isSpaceChar(c) && c != '.') { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } if (c == '.') { c = read(); double m = 1; while (!isSpaceChar(c)) { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); m /= 10; res += (c - '0') * m; c = read(); } } return res * sgn; } public String readString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public String next() { return readString(); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } static class Node implements Comparable<Node> { int v; int w; Node(int v, int w) { this.v = v; this.w = w; } public int compareTo(Node node) { if (w == node.w) return Integer.compare(v, node.v); return (-1) * Integer.compare(w, node.w); } } public static void main(String args[]) throws Exception { InputReader sc = new InputReader(System.in); PrintWriter pw = new PrintWriter(System.out); int n = sc.nextInt(); ArrayList<Integer> arr = new ArrayList<>(3*n); for(int i=0;i<3*n;i++) { arr.add(sc.nextInt()); } Collections.sort(arr,Collections.reverseOrder()); long sum=0; for(int i=1;i<2*n;i+=2) { sum += arr.get(i); } pw.println(sum); pw.close(); } }
Main.java:13: error: class AtCoderGroupContest is public, should be declared in a file named AtCoderGroupContest.java public class AtCoderGroupContest { ^ 1 error
s924090413
p03767
C++
#include <bits/stdc++.h> using namespace std; long long sum=0; int n,st=1,V[100001]; int main() { cin>>n; n*=3; for(int i=1;i<=n;i++) f>>V[i]; sort(V+1,V+1+n); for(int i=n-1;i>=st;i-=2) sum+=V[i],st++; cout<<sum; }
a.cc: In function 'int main()': a.cc:11:27: error: 'f' was not declared in this scope 11 | for(int i=1;i<=n;i++) f>>V[i]; | ^
s142582536
p03767
C++
#include <iostream> #include <sstream> #include <numeric> #include <algorithm> #include <functional> #include <iterator> #include <bitset> #include <string> #include <list> #include <vector> #include <stack> #include <queue> #include <set> #include <map> typedef signed long long int slli; typedef unsigned long long int ulli; const slli MAX_SLLI = 0x7FFFFFFFFFFFFFFF; const slli MIN_SLLI = 0x8000000000000000; const ulli MAX_ULLI = 0xFFFFFFFFFFFFFFFF; const ulli MIN_ULLI = 0x0000000000000000; #define N_TIMES(i, n) for (ulli i = 0; i < n; ++i) #define N_TIMES_REV(i, n) for (slli i = n - 1; i >= 0; --i) #ifdef __DEBUG__ template<typename T> std::ostream& operator<<(std::ostream &os, const std::list<T> &list) { const std::string delim = ", "; typename std::list<T>::const_iterator itr = list.begin(); while (itr != list.end()) { os << *itr; ++itr; if(itr != list.end()) os << delim; } return os; } template<typename T> std::ostream& operator<<(std::ostream &os, const std::vector<T> &v) { const std::string delim = ", "; for (unsigned n = 0; n < v.size(); ++n) { os << v[n]; if((n + 1) < v.size()) os << delim; } return os; } #endif int main() { unsigned N; std::cin >> N; std::vector<ulli> a(3 * N); N_TIMES (n, 3 * N) { std::cin >> a[n]; } std::sort(a.begin(), a.end()); std::cerr << a << std::endl; ulli S = 0; N_TIMES (i, N) { S += a[(3 * N) - (2 * (i + 1))]; } std::cout << S << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:63:13: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<long long unsigned int>') 63 | std::cerr << a << std::endl; | ~~~~~~~~~ ^~ ~ | | | | | std::vector<long long unsigned int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::vector<long long unsigned int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversio
s883574812
p03767
Java
import java.util.Arrays; import java.util.Scanner; public class A { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int a[]=new int[3*n]; for(int i =0;i<n;i++){ a[3*i]=scan.nextInt(); a[3*i + 1]=scan.nextInt(); a[3*i + 2]=scan.nextInt(); } Arrays.sort(a); long strength=0; for(int i=0;i<n;i++){ strength+=a[3*n-2 -2*i]; } System.out.println(strength); } }
Main.java:4: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s895030137
p03767
C++
#include <iostream> #include <vector> #include "unordered_map" #include <cmath> #include <climits> using ull=unsigned long long; using namespace std; int main() { // freopen("/Users/balazskemenes/Documents/temp/practise/src/problems/input.txt","r",stdin); int N; cin >> N; int limit = N * 3; vector<ull> vec(limit); for(int i = 0; i < limit; ++i) { cin >> vec[i]; } sort(vec.begin(), vec.end(), [](int a, int b) {return a > b;}); int counter = 0; int subCounter = 0; ull sum = 0; for(int i = 0; i < limit; ++i) { if(subCounter == N) { break; } if(counter % 2 != 0) { sum += vec[i]; ++subCounter; } ++counter; } cout << sum; return 0; }
a.cc: In function 'int main()': a.cc:48:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 48 | sort(vec.begin(), vec.end(), [](int a, int b) {return a > b;}); | ^~~~ | sqrt
s138570615
p03767
C++
// UNNECESSARY // #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration // #include <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets // #include <fstream>//ifstream/ofstream // DATA STRUCTURES #include <array> #include <bitset> #include <list> #include <queue> #include <map> #include <set> #include <stack> #include <tuple> #include <valarray> #include <vector> // MISCELLANEOUS #include <algorithm>//min/max/sort(rand-access it)/merge #include <cassert> #include <climits>//INT_MAX/INT_MIN/ULLONG_MAX #include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc #include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort #include <iomanip>//setfill/setw/setprecision/fixed/scientific #include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific #include <iterator> #include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN #include <new> #include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline #include <utility>//pair typedef unsigned int ui; typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii; typedef std::pair<ll, int> plli; typedef std::pair<ull, int> puli; typedef std::pair<double, int> pdi; typedef std::pair<ll, ll> pllll; typedef std::pair<ull, ull> pulul; typedef std::pair<double, double> pdd; typedef std::tuple<int, int, int> ti3; typedef std::tuple<int, int, int, int> ti4; const bool debug = false; // -------------------------------------------------------------------------------------- // DECLARATIONS template <typename T> void read(size_t n, T* a); template <typename T> void read2(size_t n, size_t m, T** a); // IMPLEMENTATIONS template <typename T> void read(size_t n, T* a) { for (size_t i = 0; i < n; ++i) { std::cin >> a[i]; } } template <typename T> void read2(size_t n, size_t m, T** a) { for (size_t i = 0; i < n; ++i) { a[i] = new int[m]; for (size_t j = 0; j < m; ++j) { std::cin >> a[i][j]; } } } using namespace std; int main(void) { size_t n; cin >> n; n *= 3; vector<ull> a; read(n, a); sort(a.begin(), a.end()); vector<ull> b; for (size_t i = n/3; i < n; ++i) { b.push_back(a[i]); } ull total = 0UL; for (size_t i = 0; i < b.size(); ++i) { if (i%2 == 0) { total += b[i]; } } cout << total << '\n'; delete[] a; return 0; }
a.cc: In function 'int main()': a.cc:75:9: error: no matching function for call to 'read(size_t&, std::vector<long long unsigned int>&)' 75 | read(n, a); | ~~~~^~~~~~ a.cc:55:28: note: candidate: 'template<class T> void read(size_t, T*)' 55 | template <typename T> void read(size_t n, T* a) { | ^~~~ a.cc:55:28: note: template argument deduction/substitution failed: a.cc:75:9: note: mismatched types 'T*' and 'std::vector<long long unsigned int>' 75 | read(n, a); | ~~~~^~~~~~ a.cc:94:14: error: type 'class std::vector<long long unsigned int>' argument given to 'delete', expected pointer 94 | delete[] a; | ^
s502377287
p03767
C++
include<bits/stdc++.h> #define INF 1e9+7 #define ll long long #define F first #define S second #define N 300005 #define M 1000000009 #define mp make_pair #define ull unsigned long long #define sc(n) scanf("%d",&n) #define gcd __gcd #define pb push_back using namespace std; int a[N]; int main(){ ios_base::sync_with_stdio(0); int n,k; ll sum =0; cin>>n; for(int i=0;i<3*n;i++) cin>>a[i]; sort(a,a+3*n); for(int i=n;i<2*n;i++){ sum+=a[i]; } cout<<sum<<endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:16:9: error: 'ios_base' has not been declared 16 | ios_base::sync_with_stdio(0); | ^~~~~~~~ a.cc:19:9: error: 'cin' was not declared in this scope 19 | cin>>n; | ^~~ a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(a,a+3*n); | ^~~~ | short a.cc:26:9: error: 'cout' was not declared in this scope 26 | cout<<sum<<endl; | ^~~~ a.cc:26:20: error: 'endl' was not declared in this scope 26 | cout<<sum<<endl; | ^~~~
s971549376
p03767
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; long long X=0; cin >> N; int a[3*N]; for (int i=0;i<3*N;i++){ cin >> a[i]; } sort(a.rbegin(),a.rend()); for(int i=0;i<N;i++){ X+=a[i*2]; } cout << X << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:10: error: request for member 'rbegin' in 'a', which is of non-class type 'int [(N * 3)]' 12 | sort(a.rbegin(),a.rend()); | ^~~~~~ a.cc:12:21: error: request for member 'rend' in 'a', which is of non-class type 'int [(N * 3)]' 12 | sort(a.rbegin(),a.rend()); | ^~~~
s064268673
p03767
C
#include <iostream> #include <algorithm> using namespace std; int main() { int n; cin >> n; long a[3 * n]; for (int i = 0; i < n * 3; i++) { cin >> a[i]; } sort(a, a + (3 * n) ); long long count = 0; for (int i = 0; i < n; i++) { count += a[3 * n - 1 - (i * 2 + 1)] ; } cout << count << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s292951694
p03767
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int n; ll a[300010]; int main() { while(scanf("%d", &n)!=EOF){ for(int i=0; i<3*n; i++) scanf("%lld", &a[i]); sort(a, a+3*n); ll sum=0; for( sum += a[3*n-2-2*i]; } printf("%lld\n", sum); } return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: 'i' was not declared in this scope 14 | sum += a[3*n-2-2*i]; | ^ a.cc:15:9: error: expected primary-expression before '}' token 15 | } | ^ a.cc:14:33: error: expected ';' before '}' token 14 | sum += a[3*n-2-2*i]; | ^ | ; 15 | } | ~ a.cc:15:9: error: expected primary-expression before '}' token 15 | } | ^ a.cc:14:33: error: expected ')' before '}' token 14 | sum += a[3*n-2-2*i]; | ^ | ) 15 | } | ~ a.cc:13:12: note: to match this '(' 13 | for( | ^ a.cc:15:9: error: expected primary-expression before '}' token 15 | } | ^ a.cc:16:26: error: 'sum' was not declared in this scope 16 | printf("%lld\n", sum); | ^~~ a.cc: At global scope: a.cc:18:9: error: expected unqualified-id before 'return' 18 | return 0; | ^~~~~~ a.cc:19:1: error: expected declaration before '}' token 19 | } | ^
s780187235
p03767
C++
#include<bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> v(N); for (int i = 0; i < 3*N; i++) { sort(v.begin(), v.end()); long long ans = 0; for (int i = 0; i < N; i++) { ans += v[N-1+i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:2: error: expected '}' at end of input 16 | } | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s319421237
p03767
C++
#include<iostream> #include<cstdio> #include<vector> #include<string> #include<algorithm> using namespace std; int main() { int N; cin >> N; vector<int> a(3 * N); for (int i = 0; i < 3 * N; i++) cin >> a[i]; long long ans = 0; sort(a.begin(), a.end()); int index = 3 * N - 2; for (int i = 0; i < N; i++) { ans += a[index]; index -= 2; } cout << ans << endl;
a.cc: In function 'int main()': a.cc:21:29: error: expected '}' at end of input 21 | cout << ans << endl; | ^ a.cc:9:1: note: to match this '{' 9 | { | ^
s751208180
p03767
C++
#include <iostream> using namespace std; const int maxN = 1e5; int a[4 * maxN]; int main() { int n; ios_base::sync_with_stdio(0); cin >> n; for (int i = 0; i < 3 * n; i++) { cin >> a[i]; } sort(a, a + 3 * n); long long sum = 0; for (int i = n; i < 3 * n; i += 2) { sum += a[i]; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'? 15 | sort(a, a + 3 * n); | ^~~~ | short
s020338265
p03767
C++
#include <bits/stdc++.h> typedef long long LL; #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) using namespace std; int main(void) { int n; cin >> n; vector<int> a(n*3); REP(i,n*3) cin >> a[i]; SORT(a); LL answer = 0ll; REP(i,n) answer+=a[n+i*2] cout << answer << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:28: error: expected ';' before 'cout' 17 | REP(i,n) answer+=a[n+i*2] | ^ | ; 18 | cout << answer << endl; | ~~~~
s749135879
p03767
C++
#include <algorithm> using namespace std; const int MAXN = 3E5 + 10; int n; int a[MAXN]; int main(){ scanf("%d", &n); int n0 = n * 3; for (int i = 0; i < n0; ++i) scanf("%d", a + i); sort(a, a + n0); long long ans = 0; for (int i = 0; i < n; ++i) ans += a[n + (i << 1)]; printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'scanf' was not declared in this scope 11 | scanf("%d", &n); | ^~~~~ a.cc:19:9: error: 'printf' was not declared in this scope 19 | printf("%lld\n", ans); | ^~~~~~ a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 1 | #include <algorithm> +++ |+#include <cstdio> 2 |
s284887835
p03767
Java
import java.util.Scanner; import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Check2 { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars==-1) throw new InputMismatchException(); if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if(numChars <= 0) return -1; } return buf[curChar++]; } public String nextLine() { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } public int nextInt() { int c = read(); while(isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if(c<'0'||c>'9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public double nextDouble() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } double res = 0; while (!isSpaceChar(c) && c != '.') { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } if (c == '.') { c = read(); double m = 1; while (!isSpaceChar(c)) { if (c == 'e' || c == 'E') return res * Math.pow(10, nextInt()); if (c < '0' || c > '9') throw new InputMismatchException(); m /= 10; res += (c - '0') * m; c = read(); } } return res * sgn; } public String readString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public String next() { return readString(); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } public static void main(String args[]) throws Exception { InputReader sc=new InputReader(System.in); PrintWriter w=new PrintWriter(System.out); int n=sc.nextInt(); long arr[]=new long[n*3]; for(int i=0;i<3*n;i++) arr[i]=sc.nextLong(); Arrays.sort(arr); int front=0; int rear=3*n-1; long ans=0; while(front<rear) { ans+=arr[rear-1]; rear--; rear--; front++; } w.println(ans); w.close(); } }
Main.java:8: error: class Check2 is public, should be declared in a file named Check2.java public class Check2 ^ 1 error
s870340944
p03767
C++
#include <iostream> #include <cstdio> #include <vector> using namespace std; typedef long long int lli; int main(void) { lli n; scanf("%lld", &n); lli a[3*n]; for(lli i = 0;i < 3*n;i++) scanf("%lld", &a[i]); sort(a, a+3*n); lli res = 0; for(lli i = n;i < 2*n;i++) res += a[i]; printf("%lld\n", res); }
a.cc: In function 'int main()': a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'? 14 | sort(a, a+3*n); | ^~~~ | short
s940785046
p03767
C++
import java.io.*; import java.math.*; import java.util.*; import static java.util.Arrays.*; public class Main { private static final int mod = (int)924844033; final Random random = new Random(0); final IOFast io = new IOFast(); /// MAIN CODE public void run() throws IOException { // int TEST_CASE = Integer.parseInt(new String(io.nextLine()).trim()); int TEST_CASE = 1; while(TEST_CASE-- != 0) { int n = io.nextInt(); int[] a = io.nextIntArray(3*n); Arrays.sort(a); long sum = 0; for (int i = 0; i < n; i++) sum += a[i+n]; io.out.println(sum); } } /// TEMPLATE static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n%r); } static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n%r); } static <T> void swap(T[] x, int i, int j) { T t = x[i]; x[i] = x[j]; x[j] = t; } static void swap(int[] x, int i, int j) { int t = x[i]; x[i] = x[j]; x[j] = t; } void printArrayLn(int[] xs) { for(int i = 0; i < xs.length; i++) io.out.print(xs[i] + (i==xs.length-1?"\n":" ")); } void printArrayLn(long[] xs) { for(int i = 0; i < xs.length; i++) io.out.print(xs[i] + (i==xs.length-1?"\n":" ")); } static void dump(Object... o) { System.err.println(Arrays.deepToString(o)); } void main() throws IOException { // IOFast.setFileIO("rle-size.in", "rle-size.out"); try { run(); } catch (EndOfFileRuntimeException e) { } io.out.flush(); } public static void main(String[] args) throws IOException { new Main().main(); } static class EndOfFileRuntimeException extends RuntimeException { private static final long serialVersionUID = -8565341110209207657L; } static public class IOFast { private BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private PrintWriter out = new PrintWriter(System.out); void setFileIn(String ins) throws IOException { in.close(); in = new BufferedReader(new FileReader(ins)); } void setFileOut(String outs) throws IOException { out.flush(); out.close(); out = new PrintWriter(new FileWriter(outs)); } void setFileIO(String ins, String outs) throws IOException { setFileIn(ins); setFileOut(outs); } private static int pos, readLen; private static final char[] buffer = new char[1024 * 8]; private static char[] str = new char[500*8*2]; private static boolean[] isDigit = new boolean[256]; private static boolean[] isSpace = new boolean[256]; private static boolean[] isLineSep = new boolean[256]; static { for(int i = 0; i < 10; i++) { isDigit['0' + i] = true; } isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; } public int read() throws IOException { if(pos >= readLen) { pos = 0; readLen = in.read(buffer); if(readLen <= 0) { throw new EndOfFileRuntimeException(); } } return buffer[pos++]; } public int nextInt() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; int ret = 0; if(str[0] == '-') { i = 1; } for(; i < len; i++) ret = ret * 10 + str[i] - '0'; if(str[0] == '-') { ret = -ret; } return ret; } public long nextLong() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); int i = 0; long ret = 0; if(str[0] == '-') { i = 1; } for(; i < len; i++) ret = ret * 10 + str[i] - '0'; if(str[0] == '-') { ret = -ret; } return ret; } public char nextChar() throws IOException { while(true) { final int c = read(); if(!isSpace[c]) { return (char)c; } } } int reads(int len, boolean[] accept) throws IOException { try { while(true) { final int c = read(); if(accept[c]) { break; } if(str.length == len) { char[] rep = new char[str.length * 3 / 2]; System.arraycopy(str, 0, rep, 0, str.length); str = rep; } str[len++] = (char)c; } } catch(EndOfFileRuntimeException e) { ; } return len; } int reads(char[] cs, int len, boolean[] accept) throws IOException { try { while(true) { final int c = read(); if(accept[c]) { break; } cs[len++] = (char)c; } } catch(EndOfFileRuntimeException e) { ; } return len; } public char[] nextLine() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isLineSep); try { if(str[len-1] == '\r') { len--; read(); } } catch(EndOfFileRuntimeException e) { ; } return Arrays.copyOf(str, len); } public String nextString() throws IOException { return new String(next()); } public char[] next() throws IOException { int len = 0; str[len++] = nextChar(); len = reads(len, isSpace); return Arrays.copyOf(str, len); } // public int next(char[] cs) throws IOException { int len = 0; cs[len++] = nextChar(); len = reads(cs, len, isSpace); return len; } public double nextDouble() throws IOException { return Double.parseDouble(nextString()); } public long[] nextLongArray(final int n) throws IOException { final long[] res = new long[n]; for(int i = 0; i < n; i++) { res[i] = nextLong(); } return res; } public int[] nextIntArray(final int n) throws IOException { final int[] res = new int[n]; for(int i = 0; i < n; i++) { res[i] = nextInt(); } return res; } public int[][] nextIntArray2D(final int n, final int k) throws IOException { final int[][] res = new int[n][]; for(int i = 0; i < n; i++) { res[i] = nextIntArray(k); } return res; } public int[][] nextIntArray2DWithIndex(final int n, final int k) throws IOException { final int[][] res = new int[n][k+1]; for(int i = 0; i < n; i++) { for(int j = 0; j < k; j++) { res[i][j] = nextInt(); } res[i][k] = i; } return res; } public double[] nextDoubleArray(final int n) throws IOException { final double[] res = new double[n]; for(int i = 0; i < n; i++) { res[i] = nextDouble(); } return res; } } }
a.cc:2:1: error: 'import' does not name a type 2 | import java.io.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import static java.util.Arrays.*; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~
s662610899
p03768
Java
import utils.GraphUtils; import java.io.*; import java.util.*; /** * Created by Katushka on 11.03.2020. */ public class Main { static int[] readArray(int size, InputReader in) { int[] a = new int[size]; for (int i = 0; i < size; i++) { a[i] = in.nextInt(); } return a; } static long[] readLongArray(int size, InputReader in) { long[] a = new long[size]; for (int i = 0; i < size; i++) { a[i] = in.nextLong(); } return a; } static int binSearch(int[] list, int key) { int l = -1; int r = list.length; while (l < r - 1) { int m = (l + r) / 2; if (list[m] > key) { l = m; } else { r = m; } } return r; } public static void main(String[] args) throws FileNotFoundException { InputReader in = new InputReader(System.in); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); final int n = in.nextInt(); final int m = in.nextInt(); List<Integer>[] graph = new List[n]; for (int i = 0; i < n; i++) { graph[i] = new ArrayList<>(); } for (int i = 0; i < m; i++) { int u = in.nextInt() - 1; int v = in.nextInt() - 1; graph[u].add(v); graph[v].add(u); } final int q = in.nextInt(); int[] colors = new int[n]; for (int i = 0; i < q; i++) { int v = in.nextInt() - 1; int dist = in.nextInt(); int color = in.nextInt(); colorVertices(v, graph, n, dist, colors, color); } for (int color : colors) { out.println(color); } // out.println("Time:" + (System.currentTimeMillis() - startTime)); out.close(); } private static void colorVertices(int start, List<Integer>[] graph, int n, int maxDist, int[] colors, int newColor) { colors[start] = newColor; if (maxDist == 0) { return; } Queue<Integer> q = new LinkedList<>(); q.add(start); boolean[] visited = new boolean[n]; int[] distance = new int[n]; visited[start] = true; while (!q.isEmpty()) { int v = q.poll(); for (int i = 0; i < graph[v].size(); ++i) { int to = graph[v].get(i); if (!visited[to]) { visited[to] = true; distance[to] = distance[v] + 1; if (distance[to] <= maxDist) { colors[to] = newColor; } if (distance[to] < maxDist) { q.add(to); } } } } } private static String outputArray(Iterable<Integer> ans, Map<String, Integer> out) { StringBuilder str = new StringBuilder(); for (int an : ans) { str.append(an).append(' '); } String s = str.toString(); out.put(s, out.getOrDefault(s, 0) + 1); return s; } private static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); tokenizer = null; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { createTokenizer(); } return tokenizer.nextToken(); } private void createTokenizer() { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } public String nextWord() { return next(); } public String nextString() { try { return reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public char nextChar() { return next().charAt(0); } public int[] nextInts() { if (tokenizer == null || !tokenizer.hasMoreTokens()) { createTokenizer(); } List<Integer> res = new ArrayList<>(); while (tokenizer.hasMoreElements()) { res.add(Integer.parseInt(tokenizer.nextToken())); } int[] resArray = new int[res.size()]; for (int i = 0; i < res.size(); i++) { resArray[i] = res.get(i); } return resArray; } } }
Main.java:1: error: package utils does not exist import utils.GraphUtils; ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
s140893696
p03768
C++
#include <iostream> #include <vector> #define ll long long using namespace std; #define pb push_back const int N = 1e5 + 5; inline int read() { int x = 0; char ch = getchar(); for (; !isdigit(ch); ch = getchar()); for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0'; return x; } void W(int x) { if (x >= 10) W(x / 10); putchar(x % 10 + '0'); } vector<int> g[N]; int mx[N], n, col[N], Q, d[N], c[N], m, p[N]; void dfs(int x) { if (!col[x]) col[x] = c[Q]; for (int i : g[x]) if (mx[x] - 1 > mx[i]) mx[i] = mx[x] - 1, dfs(i); } int main() { memset(mx, -1, sizeof(mx)); n = read(), m = read(); for (int i = 1, uu, vv; i <= m; i++) uu = read(), vv = read(), g[uu].pb(vv), g[vv].pb(uu); Q = read(); for (int i = 1; i <= Q; i++) p[i] = read(), d[i] = read(), c[i] = read(); for (; Q; Q--) if (d[Q] > mx[p[Q]]) mx[p[Q]] = d[Q], dfs(p[Q]); for (int i = 1; i <= n; i++) W(col[i]), puts(""); return 0; }
a.cc: In function 'int main()': a.cc:26:5: error: 'memset' was not declared in this scope 26 | memset(mx, -1, sizeof(mx)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <vector> +++ |+#include <cstring> 3 | #define ll long long
s127565727
p03768
C++
.
a.cc:1:1: error: expected unqualified-id before '.' token 1 | . | ^
s518829910
p03768
C++
#include<iostream> #include<stdio.h> #include<math.h> #include<string> #include<string.h> #include<algorithm> #include<vector> using namespace std; #define ll long long const int maxn = 1e5+10; int n,m,q; vector <int> vec[maxn]; int ans[maxn]; int dp[maxn][11]; int x[maxn],y[maxn],z[maxn]; int vis[maxn]; void dfs(int u,int d,int c) { if(!ans[u]) ans[u]=z[c]; if(dp[u][d]) return ; dp[u][d]=1; if(vis[u]==c) return ; vis[u]=c; if(d==0) return ; for(auto v:vec[u]) dfs(v,d-1,c); } int main() { scanf("%d%d",&n,&m); int u,v; while(m--) { scanf("%d%d",&u,&v); vec[u].push_back(v); vec[v].push_back(u); } scanf("%d",&q); for(int i=1;i<=q;i++) scanf("%d%d%d",&x[i],&y[i],&z[i]); for(int i=q;i;i--) dfs(x[i],y[i],i),dfs2(x[i],y[i]); for(int i=1;i<=n;i++) printf("%d\n",ans[i]); return 0; }
a.cc: In function 'int main()': a.cc:41:45: error: 'dfs2' was not declared in this scope; did you mean 'dfs'? 41 | for(int i=q;i;i--) dfs(x[i],y[i],i),dfs2(x[i],y[i]); | ^~~~ | dfs
s310869627
p03768
C++
#pragma GCC optimize ("O3") #pragma GCC target ("avx") //#include<bits/stdc++.h> #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define Would #define you #define please const int cm = 1 << 17; char cn[cm], * ci = cn + cm, ct; inline char getcha() { if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; } return *ci++; } inline int getint() { int A = 0; if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0'; else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0'; return A; } const int dm = 1 << 20; char dn[dm], * di = dn; inline void putint(int X) { if (X == 0) { *di++ = '0'; *di++ = '\n'; return; } int keta = 0; char C[10]; while (X) { *(C + keta) = '0' + X % 10; X /= 10; keta++; } for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i)); *di++ = '\n'; } int E[200001], ne[200001]; int H[100001]; int kotae[100001]; char Vis[100001]; void sagasu(int P, char D, int C) { if (D == 0 && kotae[P] == 0) kotae[P] = C; else if (Vis[P] < D) { Vis[P] = D; if (kotae[P] == 0) kotae[P] = C; for (int p = H[P]; p; p = E[p].second) { sagasu(E[p].first, D - 1, C); } } } int main() { //cin.tie(0); //ios::sync_with_stdio(false); int N, M, Q; N = getint(); M = getint(); for (int i = 1; i < 2 * M;) { int a = getint(), b = getint(); E[i] = a; ne[i] = H[b]; H[b] = i++; E[i] = b; ne[i] = H[a]; H[a] = i++; } Q = getint(); int v[100000], d[100000], c[100000]; rep(i, Q) { v[i] = getint(); d[i] = getint(); c[i] = getint(); } for (int i = Q - 1; i >= 0; i--) { sagasu(v[i], d[i], c[i]); } rep1(i, N) { putint(kotae[i]); } fwrite_unlocked(dn, di - dn, 1, stdout); Would you please return 0; }
a.cc: In function 'void sagasu(int, char, int)': a.cc:62:48: error: request for member 'second' in 'E[p]', which is of non-class type 'int' 62 | for (int p = H[P]; p; p = E[p].second) { | ^~~~~~ a.cc:63:37: error: request for member 'first' in 'E[p]', which is of non-class type 'int' 63 | sagasu(E[p].first, D - 1, C); | ^~~~~