submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s071815771
p00018
C++
#include <iostream> #include <cstdlib> using namespace std; namespace sorting_five_numbers { class SortingFiveNumbers { private: //! データサイズ static const int Size = 5; //! 入力値 int dataList[Size]; public: /** * @brief コンストラクタ */ SortingFiveNumbers(int target[]) { memset(dataList, 0, Size); for (int i = 0; i < Size; i++) { dataList[i] = target[i]; } } /** * @fn int* createDescendingList() * @brief 降順にソートしたリストを生成する * @return int* ソート済みリスト */ int* createDescendingList(); }; class Control { private: //! データサイズ static const int Size = 5; public: /** * @fn bool executeEx() * @brief 5つの整数を読み込み、降順に整列し出力する * @return bool 入力値が範囲内ならtrueを、そうでなければfalseを返す */ bool executeEx(); private: /** * @fn void read(int target[]) * @brief 標準入力から読み込む * @param[out] target 入力データ */ void read(int target[]); /** * @fn void write(int target[]) * @brief 標準出力に書き込む * @param[in] target 出力データ */ void write(int target[]); /** * @fn bool check(int target[]) * @brief 入力データが範囲内か調べる * @param[in] target 調査対象 * @return bool 入力データが範囲内ならtrueを、そうでなければfalseを返す */ bool check(int target[]); }; } using namespace sorting_five_numbers; int* SortingFiveNumbers::createDescendingList() { for (int i = 0; i < Size - 1; i++) { int max = i; for (int j = i + 1; j < Size; j++) { if (dataList[max] < dataList[j]) { max = j; } } int t = dataList[i]; dataList[i] = dataList[max]; dataList[max] = t; } return dataList; } bool Control::executeEx() { int input[Size] = { 0 }; int* output = NULL; read(input); if (!check(input)) return false; SortingFiveNumbers list(input); output = list.createDescendingList(); write(output); return true; } void Control::read(int target[]) { for (int i = 0; i < Size; i++) cin >> target[i]; } void Control::write(int target[]) { for (int i = 0; i < Size; i++) { (i != Size) ? cout << target[i] << " " : cout << target[i] << endl; } } bool Control::check(int target[]) { static const int Min = -100000; static const int Max = 100000; for (int i = 0; i < Size; i++) { if (Min > target[i] || Max < target[i]) return false; } return true; } int main() { if (!Control().executeEx()) return 1; }
a.cc: In constructor 'sorting_five_numbers::SortingFiveNumbers::SortingFiveNumbers(int*)': a.cc:22:13: error: 'memset' was not declared in this scope 22 | memset(dataList, 0, Size); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <cstdlib> +++ |+#include <cstring> 3 |
s238950955
p00018
C++
require 'set' class PriorityQueue < SortedSet @@id = 0 def << obj add obj end def add obj super([obj,@@id]) @@id+=1 end def at idx super idx end def top self.min[0] end def pop self.delete(self.min) end end s = PriorityQueue.new input = gets.split(' ').map(&:to_i) for i in input s << i end arr = [] 5.times do arr << s.top s.pop end puts arr.reverse.join(' ')
a.cc:1:9: warning: multi-character character constant [-Wmultichar] 1 | require 'set' | ^~~~~ a.cc:4:3: error: stray '@' in program 4 | @@id = 0 | ^ a.cc:4:4: error: stray '@' in program 4 | @@id = 0 | ^ a.cc:11:16: error: stray '@' in program 11 | super([obj,@@id]) | ^ a.cc:11:17: error: stray '@' in program 11 | super([obj,@@id]) | ^ a.cc:12:5: error: stray '@' in program 12 | @@id+=1 | ^ a.cc:12:6: error: stray '@' in program 12 | @@id+=1 | ^ a.cc:1:1: error: 'require' does not name a type 1 | require 'set' | ^~~~~~~
s517114235
p00018
C++
#include <cstdio> #include <algorithm> #define SWAP(a,b) { a += b, b = a - b, a -= b; } using namespace std; int main() { int n[5]; for(int i=0;i<5;++i) scanf("%d",&n[i]); sort(n,n+5); for(int i=0;i<2;++i) { SWAP(n[i],n[4-i]); } for(int i=0;i<4;++i) printf("%d ",n[i]); printf("%d\n",n[4]); return 0 }
a.cc: In function 'int main()': a.cc:14:13: error: expected ';' before '}' token 14 | return 0 | ^ | ; 15 | } | ~
s107145610
p00018
C++
#include <iostream> #include <vector> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <math.h> typedef long long Int; #define REP(i,n) for(int i = 0 ; i < n ; ++i) using namespace std; int main(){ int n = 5; vector<int> aa; REP(i, n){ int a; cin >> a; aa.push_back(a); } sort(aa.begin(), aa.end()); int i(0); for (auto x : aa){ cout << x; if (i != 4){ cout << " "; } ++i; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 25 | sort(aa.begin(), aa.end()); | ^~~~ | sqrt
s299386243
p00018
C++
#include<cstdio> #include<algorithm> using namespace std; int main(){ int a[5],i,j,min,min_n; for(i=0:i<5;i++) scanf("%d",&a[i]); for(i=0;i<5;i++){ min=a[i]; min_n=i; for(j=i+1;j<5;j++){ if(min>a[j]){ min=a[j]; min_n=j; } swap(a[i],a[min]); printf( i<4 ? "%d " : "%d\n",a[i]); } return 0; }
a.cc: In function 'int main()': a.cc:9:10: error: expected ';' before ':' token 9 | for(i=0:i<5;i++) | ^ | ; a.cc:9:18: error: expected ';' before ')' token 9 | for(i=0:i<5;i++) | ^ | ; a.cc:23:2: error: expected '}' at end of input 23 | } | ^ a.cc:6:11: note: to match this '{' 6 | int main(){ | ^
s402640207
p00018
C++
#include<cstdio> #include<algorithm> using namespace std; int main(){ int a[5],i,j,min,min_n; for(i=0:i<5;i++) scanf("%d",&a[i]); for(i=0;i<5;i++){ min=a[i]; min_n=i; for(j=i+1;j<5;j++){ if(min>a[j]){ min=a[j]; min_n=j; } } swap(a[i],a[min]); printf( i<4 ? "%d " : "%d\n",a[i]); } return 0; }
a.cc: In function 'int main()': a.cc:9:10: error: expected ';' before ':' token 9 | for(i=0:i<5;i++) | ^ | ; a.cc:9:18: error: expected ';' before ')' token 9 | for(i=0:i<5;i++) | ^ | ;
s406854928
p00018
C++
#include<cstdio> #include<algorithm> using namespace std; int main(){ int a[5],i,j,min,min_n; for(i=0:i<5;i++) scanf("%d",&a[i]); for(i=0;i<5;i++){ min=a[i]; min_n=i; for(j=i+1;j<5;j++){ if(min<a[j]){ min=a[j]; min_n=j; } } swap(a[i],a[min]); printf( i<4 ? "%d " : "%d\n",a[i]); } return 0; }
a.cc: In function 'int main()': a.cc:9:10: error: expected ';' before ':' token 9 | for(i=0:i<5;i++) | ^ | ; a.cc:9:18: error: expected ';' before ')' token 9 | for(i=0:i<5;i++) | ^ | ;
s493814755
p00018
C++
#include<iostream> #include<algorithm> int main(){ int a[5]; for(int i=0;i<5;++i){ std::cin>>a[i]; } std::sort(a,a+5,greater<int>()); for(int i=0;i<5;++i){ std::cout<<a[i]<<' '; } return 0; }
a.cc: In function 'int main()': a.cc:8:25: error: 'greater' was not declared in this scope; did you mean 'std::greater'? 8 | std::sort(a,a+5,greater<int>()); | ^~~~~~~ | std::greater In file included from /usr/include/c++/14/string:49, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_function.h:353:12: note: 'std::greater' declared here 353 | struct greater; | ^~~~~~~ a.cc:8:33: error: expected primary-expression before 'int' 8 | std::sort(a,a+5,greater<int>()); | ^~~
s683091350
p00018
C++
#include <vector> #Include <algorithm> #include <cstdio> using namespace std; int main(){ vector<int> v(5); for(int i = 0; i < 5; i++){ scanf("%d",&v[i]); } sort(v.rbegin(), v.rend()); for(int i = 0; i < 5; i++){ printf("%d ", v[i]); } printf("\n"); return 0; }
a.cc:2:2: error: invalid preprocessing directive #Include; did you mean #include? 2 | #Include <algorithm> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort(v.rbegin(), v.rend()); | ^~~~ | short
s844311441
p00018
C++
#include<stdio.h> int main() { int n[6]={},x; for(int i=0;i<5;i++) scanf("%d ",&x); for(int i=0;i<5;i++) for(int j=4;j<i;j++) if(n[j]>n[j-1]){int t=n[j-1];n[j-1]=n[j];n[j]=t} for(int i=0;i<5;i++) {if(i>0)printf(" "); printf("%d",n[i]);} return 0; }
a.cc: In function 'int main()': a.cc:10:48: error: expected ';' before '}' token 10 | if(n[j]>n[j-1]){int t=n[j-1];n[j-1]=n[j];n[j]=t} | ^ | ;
s873191553
p00018
C++
#include<istream> using namespace std int main () { int i,j,s,w,a[5]; for(i=0;i<5;i++) cin >> a[i]; for(j=0;j<5;j++) { s = a[0]; for(i=1;i<5;i++) { if(s > a[i]) {w = a[i]; a[i] = s; s = w;} } } for(i=0;i<5;i++) { cout << a[i] if(i!=4) cout << " "; else cout << endl; } }
a.cc:2:20: error: expected ';' before 'int' 2 | using namespace std | ^ | ; 3 | 4 | int main () { | ~~~ a.cc: In function 'int main()': a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin >> a[i]; | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<istream> +++ |+#include <iostream> 2 | using namespace std a.cc:15:9: error: 'cout' was not declared in this scope 15 | cout << a[i] | ^~~~ a.cc:15:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:9: error: 'else' without a previous 'if' 17 | else cout << endl; | ^~~~
s691616832
p00018
C++
#include<iostream> using namespace std int main () { int i,j,s,w,a[5]; for(i=0;i<5;i++) cin >> a[i]; for(j=0;j<5;j++) { s = a[0]; for(i=1;i<5;i++) { if(s > a[i]) {w = a[i]; a[i] = s; s = w;} } } for(i=0;i<5;i++) { cout << a[i]; if(i!=4) cout << " "; else cout << endl; } }
a.cc:2:20: error: expected ';' before 'int' 2 | using namespace std | ^ | ; 3 | 4 | int main () { | ~~~
s046853322
p00018
C++
#include<iostream> using namespace std; int main () { int i,j,s,w,a[5]; for(i=0;i<5;i++) cin >> a[i]; t = 0; for(j=0;j<5;j++) { s = a[0]; for(i=1;i<5;i++) { if(s > a[i]) {w = a[i]; a[i] = s; s = w;a[t] = s;t = i;} } } for(i=0;i<5;i++) { cout << a[i]; if(i!=4) cout << " "; else cout << endl; } }
a.cc: In function 'int main()': a.cc:8:5: error: 't' was not declared in this scope 8 | t = 0; | ^
s522069762
p00018
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d,e; cin >> a >> b >> c >> d >> e; int r = 0; if(a < b){ r = a; a = b; b = r; } if(a < c){ r = a; a = c; c = r; } if(a < d){ r = a; a = d; d = r; } if(a < e){ r = a; a = e; e = r; } if(b < c){ r = b; b = c; c = r; } if(b < d){ r = b; b = d; d = r; } if(b < e){ r = b; b = e; e = r; } if(c < d){ r = c; c = d; d = r; } if(c < e){ r = c; c = e; e = r; } if(d < e){ r = d; d = e; e = r; } cout >> a >> b >> c >> d >> e >> endl; return 0; }
a.cc: In function 'int main()': a.cc:60:6: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 60 | cout >> a >> b >> c >> d >> e >> endl; | ~~~~ ^~ ~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:60:6: note: candidate: 'operator>>(int, int)' (built-in) 60 | cout >> a >> b >> c >> d >> e >> endl; | ~~~~~^~~~ a.cc:60:6: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 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/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:60:1: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:60:9: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:60:9: required from here 60 | cout >> a >> b >> c >> d >> e >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s919591831
p00018
C++
#include<iostream> using namespace std; int main() { int a, b, c, d, e, a[6], i, j; cin >> a >> b >> c >> d >> e; a[0] = a; a[1] = b; a[2] = c; a[3] = d; a[4] = e; for ( j = 0;j < 5; j++) { for ( i = 0;i < 5; i++) { if (a[i] >= a[i + 1])a[i + 1] = a[i]; } } cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:28: error: conflicting declaration 'int a [6]' 5 | int a, b, c, d, e, a[6], i, j; | ^ a.cc:5:13: note: previous declaration as 'int a' 5 | int a, b, c, d, e, a[6], i, j; | ^ a.cc:7:10: error: invalid types 'int[int]' for array subscript 7 | a[0] = a; | ^ a.cc:8:10: error: invalid types 'int[int]' for array subscript 8 | a[1] = b; | ^ a.cc:9:10: error: invalid types 'int[int]' for array subscript 9 | a[2] = c; | ^ a.cc:10:10: error: invalid types 'int[int]' for array subscript 10 | a[3] = d; | ^ a.cc:11:10: error: invalid types 'int[int]' for array subscript 11 | a[4] = e; | ^ a.cc:15:30: error: invalid types 'int[int]' for array subscript 15 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:15:38: error: invalid types 'int[int]' for array subscript 15 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:15:47: error: invalid types 'int[int]' for array subscript 15 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:15:58: error: invalid types 'int[int]' for array subscript 15 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:18:18: error: invalid types 'int[int]' for array subscript 18 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:18:32: error: invalid types 'int[int]' for array subscript 18 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:18:47: error: invalid types 'int[int]' for array subscript 18 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:18:62: error: invalid types 'int[int]' for array subscript 18 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:18:77: error: invalid types 'int[int]' for array subscript 18 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^
s181876619
p00018
C++
#include<iostream> using namespace std; int main() { int a, b, c, d, e, a[6], i, j; cin >> a >> b >> c >> d >> e; a[0] = a; a[1] = b; a[2] = c; a[3] = d; a[4] = e; for ( j = 0;j < 5; j++) { for ( i = 0;i < 5; i++) { if (a[i] >= a[i + 1])a[i + 1] = a[i]; } } cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:28: error: conflicting declaration 'int a [6]' 6 | int a, b, c, d, e, a[6], i, j; | ^ a.cc:6:13: note: previous declaration as 'int a' 6 | int a, b, c, d, e, a[6], i, j; | ^ a.cc:8:10: error: invalid types 'int[int]' for array subscript 8 | a[0] = a; | ^ a.cc:9:10: error: invalid types 'int[int]' for array subscript 9 | a[1] = b; | ^ a.cc:10:10: error: invalid types 'int[int]' for array subscript 10 | a[2] = c; | ^ a.cc:11:10: error: invalid types 'int[int]' for array subscript 11 | a[3] = d; | ^ a.cc:12:10: error: invalid types 'int[int]' for array subscript 12 | a[4] = e; | ^ a.cc:16:30: error: invalid types 'int[int]' for array subscript 16 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:16:38: error: invalid types 'int[int]' for array subscript 16 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:16:47: error: invalid types 'int[int]' for array subscript 16 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:16:58: error: invalid types 'int[int]' for array subscript 16 | if (a[i] >= a[i + 1])a[i + 1] = a[i]; | ^ a.cc:19:18: error: invalid types 'int[int]' for array subscript 19 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:19:32: error: invalid types 'int[int]' for array subscript 19 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:19:47: error: invalid types 'int[int]' for array subscript 19 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:19:62: error: invalid types 'int[int]' for array subscript 19 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^ a.cc:19:77: error: invalid types 'int[int]' for array subscript 19 | cout << a[0] << " " <<a[1] << " " << a[2] << " " << a[3] << " " << a[4] << endl; | ^
s417549309
p00018
C++
#include<iostream> using namespace std; int main(){ int num[5]; int M1 = 0, M2 = 0, M3= 0 , M4= 0 , M5 = 0; int I1 = 0, I2 = 0, I3= 0 , I4= 0 , I5 = 0 ; cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] ; for(int i=0 ; i < 5; i++){ if(M1 < nim[i]) { M1 = num[i]; I1 = i; } } for(int i=0 ; i < 5; i++){ if(i == I1 ) continue; if(M2 < nim[i]) { M2 = num[i]; I2 = i } } for(int i=0 ; i < 5; i++){ if(i == I1 || i == I2 ) continue; if(M3 < nim[i]) { M3 = num[i]; I3 = i } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == I3 ) continue; if(M4 < nim[i]) { M4 = num[i]; I4 = i } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == i3 || i == I4 ) continue; if(M5 < nim[i]) { M5 = num[i]; I5 = i } } cout << M1 << " " << M2 << " " << M3 << " " << M4 << " " << M5 << endl; return 0 ; }
a.cc: In function 'int main()': a.cc:11:9: error: 'nim' was not declared in this scope; did you mean 'num'? 11 | if(M1 < nim[i]) { | ^~~ | num a.cc:19:9: error: 'nim' was not declared in this scope; did you mean 'num'? 19 | if(M2 < nim[i]) { | ^~~ | num a.cc:21:7: error: expected ';' before '}' token 21 | I2 = i | ^ | ; 22 | } | ~ a.cc:27:9: error: 'nim' was not declared in this scope; did you mean 'num'? 27 | if(M3 < nim[i]) { | ^~~ | num a.cc:29:7: error: expected ';' before '}' token 29 | I3 = i | ^ | ; 30 | } | ~ a.cc:35:9: error: 'nim' was not declared in this scope; did you mean 'num'? 35 | if(M4 < nim[i]) { | ^~~ | num a.cc:37:7: error: expected ';' before '}' token 37 | I4 = i | ^ | ; 38 | } | ~ a.cc:42:32: error: 'i3' was not declared in this scope; did you mean 'I3'? 42 | if( i == I1 || i == I2 || i == i3 || i == I4 ) continue; | ^~ | I3 a.cc:43:9: error: 'nim' was not declared in this scope; did you mean 'num'? 43 | if(M5 < nim[i]) { | ^~~ | num a.cc:45:7: error: expected ';' before '}' token 45 | I5 = i | ^ | ; 46 | } | ~
s508267186
p00018
C++
#include<iostream> using namespace std; int main(){ int num[5]; int M1 = 0, M2 = 0, M3= 0 , M4= 0 , M5 = 0; int I1 = 0, I2 = 0, I3= 0 , I4= 0 , I5 = 0 ; cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] ; for(int i=0 ; i < 5; i++){ if(M1 < nim[i]) { M1 = num[i]; I1 = i; } } for(int i=0 ; i < 5; i++){ if(i == I1 ) continue; if(M2 < nim[i]) { M2 = num[i]; I2 = i; } } for(int i=0 ; i < 5; i++){ if(i == I1 || i == I2 ) continue; if(M3 < nim[i]) { M3 = num[i]; I3 = i; } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == I3 ) continue; if(M4 < nim[i]) { M4 = num[i]; I4 = i; } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == i3 || i == I4 ) continue; if(M5 < nim[i]) { M5 = num[i]; I5 = i; } } cout << M1 << " " << M2 << " " << M3 << " " << M4 << " " << M5 << endl; return 0 ; }
a.cc: In function 'int main()': a.cc:11:15: error: 'nim' was not declared in this scope; did you mean 'num'? 11 | if(M1 < nim[i]) { | ^~~ | num a.cc:19:17: error: 'nim' was not declared in this scope; did you mean 'num'? 19 | if(M2 < nim[i]) { | ^~~ | num a.cc:27:9: error: 'nim' was not declared in this scope; did you mean 'num'? 27 | if(M3 < nim[i]) { | ^~~ | num a.cc:35:9: error: 'nim' was not declared in this scope; did you mean 'num'? 35 | if(M4 < nim[i]) { | ^~~ | num a.cc:42:32: error: 'i3' was not declared in this scope; did you mean 'I3'? 42 | if( i == I1 || i == I2 || i == i3 || i == I4 ) continue; | ^~ | I3 a.cc:43:9: error: 'nim' was not declared in this scope; did you mean 'num'? 43 | if(M5 < nim[i]) { | ^~~ | num
s795654917
p00018
C++
#include<iostream> using namespace std; int main(){ int num[5]; int M1 = 0, M2 = 0, M3= 0 , M4= 0 , M5 = 0; int I1 = 0, I2 = 0, I3= 0 , I4= 0 , I5 = 0 ; cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] ; for(int i=0 ; i < 5; i++){ if(M1 < nim[i]) { M1 = num[i]; I1 = i; } } for(int i=0 ; i < 5; i++){ if(i == I1 ) continue; if(M2 < nim[i]) { M2 = num[i]; I2 = i; } } for(int i=0 ; i < 5; i++){ if(i == I1 || i == I2 ) continue; if(M3 < nim[i]) { M3 = num[i]; I3 = i; } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == I3 ) continue; if(M4 < nim[i]) { M4 = num[i]; I4 = i; } } for(int i=0 ; i < 5; i++){ if( i == I1 || i == I2 || i == I3 || i == I4 ) continue; if(M5 < nim[i]) { M5 = num[i]; I5 = i; } } cout << M1 << " " << M2 << " " << M3 << " " << M4 << " " << M5 << endl; return 0 ; }
a.cc: In function 'int main()': a.cc:11:15: error: 'nim' was not declared in this scope; did you mean 'num'? 11 | if(M1 < nim[i]) { | ^~~ | num a.cc:19:17: error: 'nim' was not declared in this scope; did you mean 'num'? 19 | if(M2 < nim[i]) { | ^~~ | num a.cc:27:9: error: 'nim' was not declared in this scope; did you mean 'num'? 27 | if(M3 < nim[i]) { | ^~~ | num a.cc:35:9: error: 'nim' was not declared in this scope; did you mean 'num'? 35 | if(M4 < nim[i]) { | ^~~ | num a.cc:43:9: error: 'nim' was not declared in this scope; did you mean 'num'? 43 | if(M5 < nim[i]) { | ^~~ | num
s116764121
p00018
C++
puts gets.split.map(&:to_i).sort * " "
a.cc:1:1: error: 'puts' does not name a type 1 | puts gets.split.map(&:to_i).sort * " " | ^~~~
s884066710
p00018
C++
puts gets.split.map(&:to_i).sort.reverse * " "
a.cc:1:1: error: 'puts' does not name a type 1 | puts gets.split.map(&:to_i).sort.reverse * " " | ^~~~
s204126763
p00018
C++
import std.stdio; import std.string; import std.math; import std.conv; import std.algorithm; import std.bigint; int[] a; void main(){ auto s = split(readln()); int temp; for(int i=0;i<5;i++){ a ~= to!int(s[i]);; } sort!("a > b")(a); writef("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]); }
a.cc:1:1: error: 'import' does not name a type 1 | import std.stdio; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import std.string; | ^~~~~~ 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 std.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 std.conv; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import std.algorithm; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import std.bigint; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:4: error: structured binding declaration cannot have type 'int' 8 | int[] a; | ^~ a.cc:8:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:8:4: error: empty structured binding declaration a.cc:8:7: error: expected initializer before 'a' 8 | int[] a; | ^ a.cc:10:1: error: '::main' must return 'int' 10 | void main(){ | ^~~~ a.cc: In function 'int main()': a.cc:12:20: error: 'readln' was not declared in this scope 12 | auto s = split(readln()); | ^~~~~~ a.cc:12:14: error: 'split' was not declared in this scope 12 | auto s = split(readln()); | ^~~~~ a.cc:15:9: error: 'a' was not declared in this scope 15 | a ~= to!int(s[i]);; | ^ a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'? 17 | sort!("a > b")(a); | ^~~~ | short a.cc:18:31: error: 'a' was not declared in this scope 18 | writef("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]); | ^ a.cc:18:5: error: 'writef' was not declared in this scope 18 | writef("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]); | ^~~~~~
s987395268
p00018
C++
#include<iostream> using namespace std; int main(){ int a[10]={},b=0; for(int i=0;i<5;i++) cin>>a[i]; for(int j=0;j<5;j++) for(int i=1;i<5;i++) if(a[i-1]<a[i]) swap(a[i-1],a[i]); for(int i=0;i<5;i++) cout<<a[i]<<' '; cout<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:7: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 13 | cout<endl; | ~~~~^~~~~ In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:13:8: note: couldn't deduce template parameter '_CharT' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:13:8: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s085760747
p00018
C++
#include<iostream> using namespace std; int main(){ int a[10]={},b=0; for(int i=0;i<5;i++) cin>>a[i]; for(int j=0;j<5;j++) for(int i=1;i<5;i++) if(a[i-1]<a[i]) swap(a[i-1],a[i]); for(int i=0;i<5;i++) cout<<a[i]<<' '; cout<endl; return 0; }
a.cc: In function 'int main()': a.cc:13:7: error: no match for 'operator<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 13 | cout<endl; | ~~~~^~~~~ In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:13:8: note: couldn't deduce template parameter '_CharT' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 13 | cout<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:13:8: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:13:8: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 13 | cout<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s322435274
p00018
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef complex<double> P; typedef pair<int,int> pii; #define REP(i,n) for(ll i=0;i<n;++i) #define REPR(i,n) for(ll i=1;i<n;++i) #define FOR(i,a,b) for(ll i=a;i<b;++i) #define DEBUG(x) cout<<#x<<": "<<x<<endl #define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl #define ALL(a) (a).begin(),(a).end() #define MOD (ll)(1e9+7) #define ADD(a,b) a=((a)+(b))%MOD #define FIX(a) ((a)%MOD+MOD)%MOD double dot(P a,P b){return real(conj(a)*b);}; double cross(P a,P b){return imag(conj(a)*b);}; int main(){ vi a(5); REP(i,5)cin>>a[i]; sort(a,a+5); reverse(a,a+5); cout<<a[0]; REPR(i,5)cout<<" "<<a[i]; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:28:11: error: no match for 'operator+' (operand types are 'vi' {aka 'std::vector<int>'} and 'int') 28 | sort(a,a+5); | ~^~ | | | | | int | vi {aka std::vector<int>} In file included from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 28 | sort(a,a+5); | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:28:12: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 28 | sort(a,a+5); | ^ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:28:12: note: 'vi' {aka 'std::vector<int>'} is not derived from 'const std::complex<_Tp>' 28 | sort(a,a+5); | ^ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const _Tp&)' 349 | operator+(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/14/complex:349:5: note: template argu
s006978039
p00018
C++
#include <iostream> using namespace std; int main(){ int a[5]; for(int i=0; i<5; i++){ cin >> a[i]; } sort(a, a+3); for(int m=4; 0<=m; m--){ cout << a[m] << " " << endl; } }
a.cc: In function 'int main()': a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a, a+3); | ^~~~ | short
s660262215
p00018
C++
#include <iomanip> #include <string> #include <stack> using namespace std; int main(){ priority_queue<int> q; for (int i = 0; i < 5; ++i) { int a; cin >> a; q.push(a); } for (int i = 0; i < 5; ++i) { cout << q.top(); if (i != 4) cout << ' '; q.pop(); } return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'priority_queue' was not declared in this scope 7 | priority_queue<int> q; | ^~~~~~~~~~~~~~ a.cc:4:1: note: 'std::priority_queue' is defined in header '<queue>'; this is probably fixable by adding '#include <queue>' 3 | #include <stack> +++ |+#include <queue> 4 | using namespace std; a.cc:7:24: error: expected primary-expression before 'int' 7 | priority_queue<int> q; | ^~~ a.cc:10:17: error: 'cin' was not declared in this scope 10 | cin >> a; | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <stack> +++ |+#include <iostream> 4 | using namespace std; a.cc:11:17: error: 'q' was not declared in this scope 11 | q.push(a); | ^ a.cc:14:17: error: 'cout' was not declared in this scope 14 | cout << q.top(); | ^~~~ a.cc:14:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:25: error: 'q' was not declared in this scope 14 | cout << q.top(); | ^
s591651856
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int a, b, c, d, e; vector<int> v; v.push_back(a); v.push_back(b); v.push_back(c); v.push_back(d); v.push_back(e); sort(v.begin(), v.end(), greater<int>); for (int i = 0; i < v.size(); ++i) { cout << v[i]; if (i < v.size() - 1) { cout << " "; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'vector' was not declared in this scope 6 | vector<int> v; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; a.cc:6:10: error: expected primary-expression before 'int' 6 | vector<int> v; | ^~~ a.cc:7:3: error: 'v' was not declared in this scope 7 | v.push_back(a); | ^ a.cc:12:40: error: expected primary-expression before ')' token 12 | sort(v.begin(), v.end(), greater<int>); | ^
s110249981
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int a, b, c, d, e; vector<int> v; scanf("%d %d %d %d %d", &a, &b, &c, &d, &e); v.push_back(a); v.push_back(b); v.push_back(c); v.push_back(d); v.push_back(e); sort(v.begin(), v.end(), greater<int>); for (int i = 0; i < v.size(); ++i) { cout << v[i]; if (i < v.size() - 1) { cout << " "; } } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'vector' was not declared in this scope 6 | vector<int> v; | ^~~~~~ a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 2 | #include <algorithm> +++ |+#include <vector> 3 | using namespace std; a.cc:6:10: error: expected primary-expression before 'int' 6 | vector<int> v; | ^~~ a.cc:8:3: error: 'v' was not declared in this scope 8 | v.push_back(a); | ^ a.cc:13:40: error: expected primary-expression before ')' token 13 | sort(v.begin(), v.end(), greater<int>); | ^
s489743627
p00018
C++
#include<iostream> #include<queue> #include<string> #include<stack> #include<cstdio> #include<algorithm> using namespace std; int main(void) { int a[5]; cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; sort(a,a+5); printf("%d %d %d %d %d", a[0],a[1],a[2],a[3],a[4]); }
a.cc: In function 'int main()': a.cc:14:6: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ~~~^~~~~~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:14:6: note: candidate: 'operator<<(int, int)' (built-in) 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ~~~^~~~~~ a.cc:14:6: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:14:3: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:14:11: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]': a.cc:14:11: required from here 14 | cin<<a[0]<<a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~
s281644500
p00018
C++
#include <iostream> using namespace std; int main(void){ // Here your code ! int a[5]; for(int i=0;i<5;i++){ cin>>a[i]; } sort(a,a+5); for(int i=4;i>0;i--){ cout<<a[i]<<" "; } cout<<a[0]; }
a.cc: In function 'int main()': a.cc:12:1: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a,a+5); | ^~~~ | short
s557893062
p00018
C++
#include <iostream> using namespace std; int main(void){ // Here your code ! int a[5]; for(int i=0;i<5;i++){ cin>>a[i]; } sort(a,a+5); for(int i=4;i>0;i--){ cout<<a[i]<<" "; } cout<<a[0]<<endl; }
a.cc: In function 'int main()': a.cc:12:1: error: 'sort' was not declared in this scope; did you mean 'short'? 12 | sort(a,a+5); | ^~~~ | short
s092518921
p00018
C++
??? #include <iostream> using namespace std; int main(){ int number[6] , i , j , ans[6] ; for( i=1 ; i<=5 ; i++ ) cin >> number[i] ; for( i=1 ; i<=5 ; i++ ){ for( j=i ; j<=5 ; j++ ){ if( number[i] < number[j] ) swap( number[i] , number[j] ); } ans[i] = number[i]; cout << ans[i] <<" "; } }
a.cc:1:5: error: stray '#' in program 1 | ??? #include <iostream> | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??? #include <iostream> | ^ a.cc: In function 'int main()': a.cc:6:17: error: 'cin' was not declared in this scope 6 | cin >> number[i] ; | ^~~ a.cc:10:33: error: 'swap' was not declared in this scope 10 | swap( number[i] , number[j] ); | ^~~~ a.cc:13:17: error: 'cout' was not declared in this scope 13 | cout << ans[i] <<" "; | ^~~~
s416085547
p00018
C++
??? #include <iostream> using namespace std; int main(){ int number[6] , i , j , ans[6] ; for( i=1 ; i<=5 ; i++ ) cin >> number[i] ; for( i=1 ; i<=5 ; i++ ){ for( j=i ; j<=5 ; j++ ){ if( number[i] < number[j] ) swap( number[i] , number[j] ); } ans[i] = number[i]; cout << ans[i] <<" "; } }
a.cc:1:5: error: stray '#' in program 1 | ??? #include <iostream> | ^ a.cc:1:1: error: expected unqualified-id before '?' token 1 | ??? #include <iostream> | ^ a.cc: In function 'int main()': a.cc:6:17: error: 'cin' was not declared in this scope 6 | cin >> number[i] ; | ^~~ a.cc:10:33: error: 'swap' was not declared in this scope 10 | swap( number[i] , number[j] ); | ^~~~ a.cc:13:17: error: 'cout' was not declared in this scope 13 | cout << ans[i] <<" "; | ^~~~
s400231165
p00018
C++
#include<iostream> #include<algorithm> #define FOR(i,n) for(int i = 0; i < n; i++) using namespace std; int main(){ int num[5]; FOR(i,5) cin >> num[i]; sort(num,num+5); FOR(i,5) cout >> num[i]; }
a.cc: In function 'int main()': a.cc:9:17: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 9 | FOR(i,5) cout >> num[i]; | ~~~~ ^~ ~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:9:17: note: candidate: 'operator>>(int, int)' (built-in) 9 | FOR(i,5) cout >> num[i]; | ~~~~~^~~~~~~~~ a.cc:9:17: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 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/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:9:12: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 9 | FOR(i,5) cout >> num[i]; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:9:25: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:9:25: required from here 9 | FOR(i,5) cout >> num[i]; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s908806935
p00018
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int num[5]; for(int i = 0; i = 4; i++) cin >> num[i]; sort(num,num+5); for(int i = 4; i = 0; i--) cout >> num[i] >> " " >> endl; }
a.cc: In function 'int main()': a.cc:10:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int') 10 | cout >> num[i] >> " " >> endl; | ~~~~ ^~ ~~~~~~ | | | | | int | std::ostream {aka std::basic_ostream<char>} a.cc:10:10: note: candidate: 'operator>>(int, int)' (built-in) 10 | cout >> num[i] >> " " >> endl; | ~~~~~^~~~~~~~~ a.cc:10:10: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 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/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:10:5: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 10 | cout >> num[i] >> " " >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:10:18: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = int&]': a.cc:10:18: required from here 10 | cout >> num[i] >> " " >> endl; | ^ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s521169112
p00018
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int num[5]; for(int i = 0; i < 5; i++) cin >> num[i]; sort(num, num + 5, greater<int>()); for(int i = 0; i < 5; i++) cout << num[i] << ((i!=4)?'':'\n'); }
a.cc:13:31: error: empty character constant 13 | cout << num[i] << ((i!=4)?'':'\n'); | ^~
s512233094
p00018
C++
#include<iostream> #include<algorithm> #define REP(i,n) for(int i = 0; i < n; i++) using namespace std; int main(){ int in[5]; REP(i,5) cin >> in[i]; sort(in.begin(), in.end(), greater<int>()); REP(i,4) cout << in[i] << " "; cout << in[4] << "\n"; }
a.cc: In function 'int main()': a.cc:8:11: error: request for member 'begin' in 'in', which is of non-class type 'int [5]' 8 | sort(in.begin(), in.end(), greater<int>()); | ^~~~~ a.cc:8:23: error: request for member 'end' in 'in', which is of non-class type 'int [5]' 8 | sort(in.begin(), in.end(), greater<int>()); | ^~~
s761970324
p00018
C++
#include <iostream> #include<math.h> using namespace std; int main() { int num[5]; for(int i=0; i<5; i++) { cin>>num[i]; } sort(num,num+5); for(int s=4; s>=0; s--) { cout<<num[s]<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 10 | sort(num,num+5); | ^~~~ | sqrt
s981724472
p00018
C++
#include <iostream> #include<math.h> using namespace std; int main() { int num[5]; for(int i=0; i<5; i++) { cin>>num[i]; } sort(num,num+5); for(int s=4; s>=0; s--) { cout<<num[s]<<" "; } return 0; }
a.cc: In function 'int main()': a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'? 10 | sort(num,num+5); | ^~~~ | sqrt
s930544048
p00018
C++
<?php // Here your code ! $inputs = trim(fgets(STDIN)); $values = explode(' ', $inputs); rsort($values); foreach ($values as $value) { echo $value . ' '; } ?>
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <?php | ^ a.cc:4:1: error: '$values' does not name a type 4 | $values = explode(' ', $inputs); | ^~~~~~~ a.cc:5:6: error: expected constructor, destructor, or type conversion before '(' token 5 | rsort($values); | ^ a.cc:7:9: error: expected constructor, destructor, or type conversion before '(' token 7 | foreach ($values as $value) { | ^ a.cc:10:1: error: expected unqualified-id before '?' token 10 | ?> | ^
s367603961
p00018
C++
#include<iostream> #include<vector> using namespace std; int main() { int a,i,j,change; for(int k=0;k<5;k++){ cin>>a; s.push_back(a); } for (i = 0; i < 4; i++) { for (j = 0; j < 4-i; j++) { if (s[j] < s[j + 1]) { change = s[j]; s[j] = s[j+1]; s[j+1] = change; } } } cout << s[0] << " " << s[1] << " " << s[2] << " " << s[3] << " " << s[4]; return 0; }
a.cc: In function 'int main()': a.cc:8:13: error: 's' was not declared in this scope 8 | s.push_back(a); | ^ a.cc:12:29: error: 's' was not declared in this scope 12 | if (s[j] < s[j + 1]) { | ^ a.cc:19:17: error: 's' was not declared in this scope 19 | cout << s[0] << " " << s[1] << " " << s[2] << " " << s[3] << " " << s[4]; | ^
s351965857
p00018
C++
#include <iostream> #include <vector> #define FOR(var, start, end) for(var = start; var < end; ++var) #define WHILE(var, end) while(var != end) #define SHOW_ALL(a, b, c) cout << a << endl; \ cout << b << endl; \ cout << c << endl; using namespace std; void BubbleSort(vector <int> &num) { int i, j, flag = 1; // set flag to 1 to start first pass int temp; // holding variable int numLength = num.size( ); for(i = 1; (i <= numLength) && flag; i++) { flag = 0; for (j=0; j < (numLength -1); j++) { if (num[j+1] > num[j]) // ascending order simply changes to < { temp = num[j]; // swap elements num[j] = num[j+1]; num[j+1] = temp; flag = 1; // indicates that a swap occurred. } } } return; //arrays are passed to functions by address; nothing is returned } int main() { int input; vector<int> input_array; while(cin >> input){ input_array.push_back(input); } BubbleSort(input_array); printf("%d %d %d %d %d", input_array[0],input_array[1],input_array[2],input_array[3],input_array[4]) }
a.cc: In function 'int main()': a.cc:43:105: error: expected ';' before '}' token 43 | printf("%d %d %d %d %d", input_array[0],input_array[1],input_array[2],input_array[3],input_array[4]) | ^ | ; ...... 46 | } | ~
s302408795
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int n[5]; for (int i = 0; i < 5; i++) { cin >> n[i]; } sort(n, n + 5); for (int i = 4; i >= 0; i--) { cout << n[i], << endl;; } }
a.cc: In function 'int main()': a.cc:13:19: error: expected primary-expression before '<<' token 13 | cout << n[i], << endl;; | ^~
s697063048
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main() { int n[5]; for (int i = 0; i < 5; i++) { cin >> n[i]; } sort(n, n + 5); for (int i = 4; i >= 0; i--) { cout << n[i], << endl; } }
a.cc: In function 'int main()': a.cc:13:19: error: expected primary-expression before '<<' token 13 | cout << n[i], << endl; | ^~
s285824456
p00018
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a[5]; for( int s = 0; s < 5; s++){ cin >> a[s] } sort( a, a + 5, greater<int>()); for(int i = 0; i < 5; i++){ cout << a[i]; } return 0; }
a.cc: In function 'int main()': a.cc:6:12: error: expected ';' before '}' token 6 | cin >> a[s] | ^ | ; 7 | } | ~
s404553811
p00018
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a[5]; for( int s = 0; s < 5; s++){ cin >> a[s] } sort( a, a + 5, greater<int>()); for(int i = 0; i < 5; i++){ cout << a[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:12: error: expected ';' before '}' token 6 | cin >> a[s] | ^ | ; 7 | } | ~
s985148471
p00018
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a[5]; for( i = 0; i < 5; i++){ cin >> a[i]; } sort( a, a + 5, greater<int>()); for(int s = 0; s < 5; s++){ cout << a[s] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:5:6: error: 'i' was not declared in this scope 5 | for( i = 0; i < 5; i++){ | ^
s901546748
p00018
C++
#include <bits/stdc++.h> using namespace std; int main(){ int a[5]; for(int S = 0; S < 5; S++){ cin >> a[S]; } sort(a, a + 5, greater<int>()); for(int i = 0; i < 5; i++){ if(i == 4){ cout << a[i]; } else cout << arr[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: 'arr' was not declared in this scope 14 | else cout << arr[i] << " "; | ^~~
s200814183
p00018
C++
#include <bits/stdc++.h> using namespace std; int main(){ int a,b[9],c[9],d[9],f[9]; string n[9]; while(1){ cin >> a >> endl; if(a == 0)break; for(int i = 0 ; i < a ; i++){ cin >> n[i] >> b[i] >> c[i] >> d[i]; f[i] = b[i]*3 + c[i]*0 + d[i]*1; } sort(f.begin(), f + a.end()){ for(int j = 0 ; j < a ; j++){ } for(int k = 0 ; k < a ; k++){ } } } return 0; }
a.cc: In function 'int main()': a.cc:8:26: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and '<unresolved overloaded function type>') 8 | cin >> a >> endl; | ~~~~~~~~~^~~~~~~ In file included from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 '<unresolved overloaded function type>' 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 argum
s292827636
p00018
C++
#include<bits/stdc++.h>; using namespace std; int main(){ int a[5]; for( s = 0; s < 5; s++){ cin >> a[s]; } sort( a, a + 5, greater<int>()); for(int i = 0; i < 5; i++){ if( i < 4 ){ cout << a[i] << " "; }else{ cout << a[i] << endl; } return 0; }
a.cc:1:24: warning: extra tokens at end of #include directive 1 | #include<bits/stdc++.h>; | ^ a.cc: In function 'int main()': a.cc:5:6: error: 's' was not declared in this scope 5 | for( s = 0; s < 5; s++){ | ^ a.cc:16:2: error: expected '}' at end of input 16 | } | ^ a.cc:3:11: note: to match this '{' 3 | int main(){ | ^
s026557097
p00018
C++
#include <bits/stdc++.h> using namespace std; int main(){ int a[5]; for(int i = 0; i < 5; i++){ cin >> a[i]; } sort(a, a + 5, greater<int>()); for(int i = 0; i < 5; i++){ if(i == 4){ cout << a[i]; } else cout << arr[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: 'arr' was not declared in this scope 14 | else cout << arr[i] << " "; | ^~~
s886092116
p00018
C++
#include<iostream> #include<algorithm> #include<vector> using namespace std; typedef long long ll; int main(){ vector<int> vc; int x; for(int i=0;i<5;i++){ cin >> x; vc.push_back(x); } rsort(vc.begin(),vc.end()); for(int i=0;i<vc.size();i++){ cout << vc[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:5: error: 'rsort' was not declared in this scope; did you mean 'qsort'? 13 | rsort(vc.begin(),vc.end()); | ^~~~~ | qsort
s478154685
p00018
C++
#include<bits/stdc++.h> using namespace std; int main() { int a[5]; for(int i=0;i<5;i++) cin>>a[i]; sort(a,a+5); reverse(a,a+b); for(int i=0;i<5;i++){ if(i) cout<<" "; cout<<a[i]; } }
a.cc: In function 'int main()': a.cc:8:13: error: 'b' was not declared in this scope 8 | reverse(a,a+b); | ^
s172770798
p00018
C++
#include <stdio.h> int main(void) { int a[5], i, j, t; for(i = 0; i < n; ++i) scanf("%d", &a[i]); for(i = 0; i < n; ++i) for(j = i + 1; j < n; ++j) if(a[i] < a[j]) t = a[i], a[i] = a[j], a[j] = t; for(i = 0; i < 4; ++i) printf("%d ", a[i]); printf("%d\n", a[4]); return 0; }
a.cc: In function 'int main()': a.cc:5:18: error: 'n' was not declared in this scope 5 | for(i = 0; i < n; ++i) scanf("%d", &a[i]); | ^ a.cc:6:18: error: 'n' was not declared in this scope 6 | for(i = 0; i < n; ++i) for(j = i + 1; j < n; ++j) if(a[i] < a[j]) t = a[i], a[i] = a[j], a[j] = t; | ^
s617303248
p00018
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n=0; vector<int> v; for(int i=0;i<5;i++) { cin>>n; v.push_back(n); } sort(v.begin(),v.end()); reverse(v.begin(),v.end()); for(int i=0;i<5;i++){ cout<<v[i]; if(i!=4) cout<<endl; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:2: error: expected '}' at end of input 22 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s848724332
p00018
C++
#include <stdio.h> void main () { int number[5]; int i,j,a,n; for (i =0;i<5;++i) scanf("%d",&number[i]); for (i=0; i<3;++i) { for (j=i+1; j<4;++j) { if (number[i]<number[j]) { a=number[i]; number[i]=number[j]; number[j]=a; } } } for(i= 0;i<6;++i) { printf("%d ", number[i]); } }
a.cc:2:5: error: '::main' must return 'int' 2 | void main () | ^~~~
s034186946
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[5]; for(int i=0;i<5;i++){ cin>>a[i]; } sort(a,a+5); reverse(t,t+5); cout<<a[0]; for(int j=1;j>=5;j++){ cout<<" "<<a[j]; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:17: error: 't' was not declared in this scope 10 | reverse(t,t+5); | ^
s989325448
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[5]; for(int i=0;i<5;i++){ cin>>a[i]; } sort(a,a+5); reverse(t,t+5); cout<<a[0]; for(int j=1;j<=5;j++){ cout<<" "<<a[j]; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:17: error: 't' was not declared in this scope 10 | reverse(t,t+5); | ^
s579345792
p00018
C++
#include<iostream> int main() { int n[5]; for (int i = 0; i < 5; i++) { std::cin >> n[i]; } for (int i = 0; i < 5; i++) { int max = INT_MIN, max_index = 0; for (int j = i; j < 5; j++) { if (max < n[j]) { max = n[j]; max_index = j; } } std::swap(n[i], n[max_index]); } for (int i = 0; i < 5; i++) { std::cout << n[i] << ' '; } std::cout << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:11:27: error: 'INT_MIN' was not declared in this scope 11 | int max = INT_MIN, max_index = 0; | ^~~~~~~ a.cc:2:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include<iostream> +++ |+#include <climits> 2 | int main() a.cc:17:33: error: 'max_index' was not declared in this scope 17 | max_index = j; | ^~~~~~~~~ a.cc:20:35: error: 'max_index' was not declared in this scope 20 | std::swap(n[i], n[max_index]); | ^~~~~~~~~
s088179517
p00018
C++
#include<numeric> #include<iostream> using namespace std; int main() { int a[5]; for(int i=0;i<5;i++) cin>>a[i]; sort(a,a+5,greater<int>()); for(int i=0;i<5;i++) cout<<(i?" ":"")<<a[i]; cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(a,a+5,greater<int>()); | ^~~~ | short
s134581998
p00018
C++
a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);}
a.cc:1:1: error: 'a' does not name a type 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:9: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^~~~ a.cc: In function 'int main()': a.cc:1:34: error: 'a' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:36: error: 'i' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:23: error: 'scanf' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^~~~~ a.cc:1:39: error: 'qsort' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^~~~~ a.cc:1:82: error: 'i' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:87: error: 'j' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:112: error: 'a' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^ a.cc:1:90: error: 'printf' was not declared in this scope 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a[],i,j;main(){while(~scanf("%d",a+i))qsort(a,++i,4,"YXZRPQ\213\0+\x2\303");for(;i--;)j=!printf(i?"%d ":"%d\n",a[i]);}
s659339692
p00018
C++
a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));}
a.cc:1:1: error: 'a' does not name a type 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^ a.cc:1:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^~~~ a.cc: In function 'int main()': a.cc:1:22: error: 'j' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^ a.cc:1:36: error: 'i' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^ a.cc:1:38: error: 'a' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^ a.cc:1:25: error: 'scanf' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^~~~~ a.cc:1:46: error: 'printf' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} a.cc:1:77: error: 'qsort' was not declared in this scope 1 | a[5],i,j;main(){for(;j=~scanf("%s",i+a)||i+!!printf(i--?"%s ":"%s\n",a+--i);qsort(a,++i,4,"YXZRPQ\213\0+\x2\303"));} | ^~~~~
s740657025
p00018
C++
*a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ?+\2\303");}
a.cc:1:3: error: expected constructor, destructor, or type conversion before '=' token 1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ?+\2\303");} | ^ a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token 1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ?+\2\303");} | ^
s173209903
p00018
C++
*a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ\213\0+\2テδ。");}
a.cc:1:3: error: expected constructor, destructor, or type conversion before '=' token 1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ\213\0+\2テδ。");} | ^ a.cc:1:11: error: expected constructor, destructor, or type conversion before '(' token 1 | *a=&a;main(i){*a=~scanf("%d",++a)?!printf(i?"%d\n":"%d ",*--a,main(0)):qsort(a-5,5,4,"YXZRPQ\213\0+\2テδ。");} | ^
s802177416
p00018
C++
import java.util.*; public class Main { void run() { Scanner sc = new Scanner(System.in); int[] num = new int [5]; for (int i=0;i<5;i++) { num[i] = sc.nextInt(); } Arrays.sort(num); for (int i=num.length-1;i>=0;i--) { System.out.print(num[i]); if (i != 0)System.out.print(" "); else System.out.println(); } } public static void main (String[] args) { new Main().run(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s196938577
p00018
C++
#include <iostream> #include <vector> #include <cstdio> using namespace std; int main() { vector<int> num(5); cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4]; sort(num.begin(), num.end()); printf("%d %d %d %d %d\n", num[0],num[1],num[2],num[3],num[4]); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(num.begin(), num.end()); | ^~~~ | short
s191501498
p00018
C++
include <iostream> #include <vector> #include <algorithm> #include <functional> using namespace std; int main() { vector<int> in(5); for (int i = 0; i < 5; ++i) cin >> in[i]; sort(in.begin(), in.end(), greater<int>()); cout << in[0]; for (int i = 1; i < in.size(); ++i) cout << " " << in[i]; cout << endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s643890967
p00018
C++
#include <iostream> using namespace std; int main() { int a[5]; for(int i=0;i<5;i++) cin >> a[i]; sort(a, a+5); cout << a[4]; for(int i = 3; i>=0; i-- ) cout << " " << a[i]; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:6:9: error: 'sort' was not declared in this scope; did you mean 'short'? 6 | sort(a, a+5); | ^~~~ | short
s828207046
p00018
C++
#include <iostream> #include <vector> using namespace std; int main() { int val; vector<int> is; for (int i = 0; i < 5 && scanf("%d", &val); i++) is.push_back(val); sort(is.begin(), is.end()); for (int i = is.size() - 1; i > 0; i--) cout << is[i] << " "; cout << is[0] << endl; }
a.cc: In function 'int main()': a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'short'? 13 | sort(is.begin(), is.end()); | ^~~~ | short
s097196493
p00018
C++
#include<iostream> using namespace std; int main(){ int a,b,c,d,e; int A,B,C,D,E; cin>>a>>b>>c>>d>>E; if(a>b){ A=a; B=b;} else{ A=b; B=a;} if(c<B){ C=c;} else{ C=B; if(c<A){ B=c;} else{ B=A; A=c;}} if(d<C){ D=d;} else{ D=C; if(d<B){ C=d;} else{ C=B; if(d<A){ B=d;} else{ B=A; A=d;}}} if(e<D){ E=e; else{ E=D; if(e<C){ D=e;} else{ D=C; if(e<B){ C=e;} else{ C=B; if(e<A){ B=e;} else{ B=A; A=e;}}}} cout<<A<<" "<<B<<" "<<C<<" "<<D<<" "<<E; }
a.cc: In function 'int main()': a.cc:38:1: error: expected '}' before 'else' 38 | else{ | ^~~~ a.cc:36:8: note: to match this '{' 36 | if(e<D){ | ^
s580237800
p00018
C++
#include<iostream> #include<algorithm> #include<functional> using namespace std; int main(){ int a[5]; for(int i=0;i<5;i++) cin>>a[i]; sort(a,a+5,greater<int>()); for(int i=0;i<5;i++) cout<<a[i]1; }
a.cc: In function 'int main()': a.cc:9:40: error: expected ';' before numeric constant 9 | for(int i=0;i<5;i++) cout<<a[i]1; | ^ | ;
s633381330
p00018
C++
#include<iostream> using namespace std; int main(){ int a[5]; int biggest[5]; cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; biggest[0]=a[0]; for(int i=1;i<5;i++){ for(int j=0;j<i;j++){ if(a[i]>biggest[j]){ for(int k=i;k>j;k--){ biggest[k]=biggest[k-1];} biggest[j]=a[i]; break;}}} for(int i=0;i<5;i++){ cout<<biggest[i]<<" ";}}
a.cc: In function 'int main()': a.cc:7:16: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int') 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ~~~~~~~~~~~~~~~^~~~~~ | | | | | int | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:7:16: note: candidate: 'operator<<(int, int)' (built-in) 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ~~~~~~~~~~~~~~~^~~~~~ a.cc:7:16: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:7:10: note: cannot convert '(& std::cin.std::basic_istream<char>::operator>>(a[0]))->std::basic_istream<char>::operator>>(a[1])' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ~~~~~~~~~^~~~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)' 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)' 671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)' 684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)' 689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed: a.cc:7:21: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 7 | cin>>a[0]>>a[1]<<a[2]<<a[3]<<a[4]; | ^ /usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)' 810 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed: /usr/include/c++/1
s768979333
p00018
C++
#include<iostream> using namespace std; int main(){ int a[5]; int biggest[5]; cin>>a[0]>>a[1]>>a[2]>>a[3]>>a[4]; biggest[0]=a[0]; for(int i=1;i<5;i++){ for(int j=0;j<i;j++){ if(a[i]>biggest[j]){ for(int k=i;k>j;k--){ biggest[k]=biggest[k-1];} biggest[j]=a[i]; break;}}} cout<<biggest[0]<<" "<<biggest[1]<<" "<<biggest[2]<<" "<<biggest[3]<<" "<<biggest[4]; }}
a.cc:17:2: error: expected declaration before '}' token 17 | }} | ^
s173022620
p00018
C++
#include <iostream> #include <string> using namespace std; int main(){ int a; int b[5]; int c; int d; int e; c=0; while(c<5){ b[c]=0; c=c+1; } c=0; while(c<5){ cin >>a; d=0; while(1){if(a>=b[d]){e=3; if(e>=d){while(e>=d){b[e+1]=b[e]; e=e-1;}} b[d]=a; break;} d=d+1; } c=c+1; } c=0; while(c<5){ cout << b[c] if(c<4){cout <<" "} c=c+1;} }
a.cc: In function 'int main()': a.cc:25:13: error: expected ';' before 'if' 25 | cout << b[c] | ^ | ; 26 | if(c<4){cout <<" "} | ~~
s374523859
p00018
C++
#include <iostream> #include <string> using namespace std; int main(){ int a; int b[5]; int c; int d; int e; c=0; while(c<5){ b[c]=0; c=c+1; } c=0; while(c<5){ cin >>a; d=0; while(1){if(a>=b[d]){e=3; if(e>=d){while(e>=d){b[e+1]=b[e]; e=e-1;}} b[d]=a; break;} d=d+1; } c=c+1; } c=0; while(c<5){ cout << b[c] if(c<4){cout <<" ";} c=c+1;} cout << endl; }
a.cc: In function 'int main()': a.cc:25:13: error: expected ';' before 'if' 25 | cout << b[c] | ^ | ; 26 | if(c<4){cout <<" ";} | ~~
s195570590
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[5]; for(int i=1;i<6;i++){ cin>>a[i]; } sort(a+1,a+6); for(int i=5;i>0;i--){ cout<<a[i]<<' '; } endl; }
a.cc: In function 'int main()': a.cc:14:13: error: statement cannot resolve address of overloaded function 14 | endl; | ^
s525768628
p00018
C++
#include <iostream> #include <algorithm> using namespace std; int main(){ int a[5]; for(int i=1;i<6;i++){ cin>>a[i]; } sort(a+1,a+6); for(int i=5;i>0;i--){ if(i==1)cout<<a[i]<<; else cout<<a[i]<<' '; } cout<<endl; }
a.cc: In function 'int main()': a.cc:12:37: error: expected primary-expression before ';' token 12 | if(i==1)cout<<a[i]<<; | ^
s074783385
p00018
C++
l = map(int, raw_input().strip().split(" ")); print " ".join(sorted(l, lambda x, y: y - x));
a.cc:1:1: error: 'l' does not name a type 1 | l = map(int, raw_input().strip().split(" ")); | ^ a.cc:2:1: error: 'print' does not name a type; did you mean 'int'? 2 | print " ".join(sorted(l, lambda x, y: y - x)); | ^~~~~ | int
s607467080
p00018
C++
#include <algorithm> #include <functional> using namespace std; int main() { int input[5]; for (int i = 0; i < 5; i++) cin >> input[i]; sort(input, input + 5, greater<int>()); for (int i = 0; i < 5; i++) cout << input[i] << " "; cout << '\b\n'; // cout << input[0] << " " << input[1] << " " << input[2] << " " << input[3]; // cout << " " << input[4] << endl; return 0; }
a.cc:17:13: warning: multi-character character constant [-Wmultichar] 17 | cout << '\b\n'; | ^~~~~~ a.cc: In function 'int main()': a.cc:11:9: error: 'cin' was not declared in this scope 11 | cin >> input[i]; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <functional> +++ |+#include <iostream> 3 | a.cc:16:9: error: 'cout' was not declared in this scope 16 | cout << input[i] << " "; | ^~~~ a.cc:16:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:17:5: error: 'cout' was not declared in this scope 17 | cout << '\b\n'; | ^~~~ a.cc:17:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s001497187
p00018
C++
#include <algorithm> #include <functional> using namespace std; int main() { int input[5]; for (int i = 0; i < 5; i++) cin >> input[i]; sort(input, input + 5, greater<int>()); for (int i = 0; i < 5; i++) if (i != 4) cout << input[i] << " "; cout << endl; // cout << input[0] << " " << input[1] << " " << input[2] << " " << input[3]; // cout << " " << input[4] << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:9: error: 'cin' was not declared in this scope 11 | cin >> input[i]; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <functional> +++ |+#include <iostream> 3 | a.cc:17:13: error: 'cout' was not declared in this scope 17 | cout << input[i] << " "; | ^~~~ a.cc:17:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << endl; | ^~~~ a.cc:18:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:18:13: error: 'endl' was not declared in this scope 18 | cout << endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <functional> +++ |+#include <ostream> 3 |
s156921443
p00018
C++
#include <iostream> #include <algorithm> #include <cstdio> #include <deque> #include <functional> using namespace std; int main(void) { int a,b,c,d,e; while(cin>>a>>b>>c>>d>>e) { deque<int> nums; nums.push_back(a); nums.push_back(b); nums.push_back(c); nums.push_back(d); nums.push_back(e); sort( nums.begin(), nums.end(), greater<int>() ); deque<int>::iterator it = nums.begin(); while( it != nums.end() ) { cout<<*it<<" "; ++it; } nums.clear; cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:22: error: invalid use of non-static member function 'void std::deque<_Tp, _Alloc>::clear() [with _Tp = int; _Alloc = std::allocator<int>]' 27 | nums.clear; | ~~~~~^~~~~ In file included from /usr/include/c++/14/deque:66, from a.cc:4: /usr/include/c++/14/bits/stl_deque.h:1835:7: note: declared here 1835 | clear() _GLIBCXX_NOEXCEPT | ^~~~~
s403784485
p00018
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n[5]; for(int i=0;i<5;i++) cin >> n[i]; sort(n,n+5greater<int>()); for(int i=0;i<5;i++){ if(i!=4) cout << n[i] << ' '; else cout << n[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:12: error: unable to find numeric literal operator 'operator""greater' 7 | sort(n,n+5greater<int>()); | ^~~~~~~~ a.cc:7:21: error: expected primary-expression before 'int' 7 | sort(n,n+5greater<int>()); | ^~~
s033561529
p00018
C++
#include<iostream> #include<vector> std::vector<int> qsort(std::vector<int> xs); int main(){ std::vector<int> vec(5); for(int i=0;i<5;i++){ std::cin>>vec[i]; } vec=qsort(vec); for(int i=4;i>-1;i--){ std::cout<<vec[i]; if(i!=0)std::cout<<" "; } std::cout<<std::endl; return 0; } std::vector<int> qsort(std::vector<int> xs){ if(xs.empty())return xs; else{ int x=xs[0]; std::vector<int> left; std::vector<int> right; for(int i=1;i<xs.size();i++){ if(x>xs[i])left.push_back(xs[i]); else if(x<=xs[i])right.push_back(xs[i]); }
a.cc: In function 'std::vector<int> qsort(std::vector<int>)': a.cc:31:18: error: expected '}' at end of input 31 | } | ^ a.cc:24:13: note: to match this '{' 24 | else{ | ^ a.cc:31:18: error: expected '}' at end of input 31 | } | ^ a.cc:21:44: note: to match this '{' 21 | std::vector<int> qsort(std::vector<int> xs){ | ^ a.cc:31:18: warning: control reaches end of non-void function [-Wreturn-type] 31 | } | ^
s470933993
p00018
C++
#include <iostream> using namespace std; int main(void){ int a[5]; for( int i = 0 ; i < 5 ; i++ ){ cin >> a[i]; } sort( a , a + 5 ); for( int i = 4 ; i >= 0 ; i-- ){ cout << a[i]; if( i != 0 )cout << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort( a , a + 5 ); | ^~~~ | short
s601534032
p00018
C++
#include <iostream> using namespace std; int main(void){ int a[5]; for( int i = 0 ; i < 5 ; i++ ){ cin >> a[i]; } sort( a , a + 5 ); for( int i = 4 ; i >= 0 ; i-- ){ cout << a[i]; if( i != 0 )cout << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'short'? 11 | sort( a , a + 5 ); | ^~~~ | short
s763149461
p00018
C++
x = sorted(map(int, raw_input().split()), reverse=True) for e in x: print e, print
a.cc:1:1: error: 'x' does not name a type 1 | x = sorted(map(int, raw_input().split()), reverse=True) | ^
s739325749
p00018
C++
#include <iostream> using namespace std; int main() { int a,b,c,d,e; cin>>a>>b>>c>>d>>e; int num[]={a,b,c,d,e}; for(int i=0;i<5;i++) for(int j=i+1;j<5;j++) if(num[i]<num[j]) swap(num[i],num[j]); a=num[0]; b=num[1]; c=num[2]; d=num[3]; e=num[4]; cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;<<" "<< }
a.cc: In function 'int main()': a.cc:17:55: error: expected primary-expression before '<<' token 17 | cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<endl;<<" "<< | ^~ a.cc:18:1: error: expected primary-expression before '}' token 18 | } | ^
s358956566
p00019
Java
def fact(a): if a == 0: return 1 return fact(a-1) * a print fact(input())
Main.java:1: error: unnamed classes are a preview feature and are disabled by default. def fact(a): ^ (use --enable-preview to enable unnamed classes) Main.java:1: error: <identifier> expected def fact(a): ^ Main.java:1: error: ';' expected def fact(a): ^ 3 errors
s432358576
p00019
Java
import java.io.* class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String str; while((str=br.readLine())!=null){ int x=Integer.parseInt(str); System.out.println(fact(x)); } } private static int fact(int x){ if(x==1)return 1; return x*fact(x-1); } }
Main.java:1: error: ';' expected import java.io.* ^ 1 error
s958693593
p00019
Java
import java.util.*; public class aop { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while(n>=1 && n<=10){ System.out.println(Math.pow(n,n)); n = sc.nextInt(); } } }
Main.java:2: error: class aop is public, should be declared in a file named aop.java public class aop { ^ 1 error
s927416429
p00019
Java
public class factorial{ public static void main(String args[]){ int n = Integer.parseInt(args[0]); int answer = 1; while (n != 0){ answer *= n; n--; } System.out.println(answer); } }
Main.java:1: error: class factorial is public, should be declared in a file named factorial.java public class factorial{ ^ 1 error
s486013137
p00019
Java
public class Factorial{ public static void main(String args[]){ int n = Integer.parseInt(args[0]); int answer = 1; while (n != 0){ answer *= n; n--; } System.out.println(answer); } }
Main.java:1: error: class Factorial is public, should be declared in a file named Factorial.java public class Factorial{ ^ 1 error
s411940719
p00019
Java
import java.util.*; public class Sort { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = 1; for(int i = sc.nextInt();i!=0;i--){ a *= i; } System.out.println(a); } }
Main.java:2: error: class Sort is public, should be declared in a file named Sort.java public class Sort { ^ 1 error
s432086241
p00019
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); long i = sc.nextLong(); Long a = 1; for(;i>0;i--){ a *= i; } System.out.println(a); } }
Main.java:6: error: incompatible types: int cannot be converted to Long Long a = 1; ^ 1 error
s945339035
p00019
Java
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int i = sc.nextLong(); long a = 1; for(;i>0;i--){ a *= i; } System.out.println(a); } }
Main.java:5: error: incompatible types: possible lossy conversion from long to int int i = sc.nextLong(); ^ 1 error
s455707562
p00019
Java
public class Fact { public static void main(String args[]) { for (int counter = 0; counter <= 10; counter++){ System.out.printf("%d! = %d\n", counter, factorial(counter)); } } public static long factorial(long number) { if (number <= 1) return 1; else return number * factorial(number - 1); } }
Main.java:1: error: class Fact is public, should be declared in a file named Fact.java public class Fact { ^ 1 error
s358520220
p00019
Java
import java.util.Scanner; public class Factorial{ public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.println("Enter the number:"); int num = scanner.nextInt(); int factorial = fact(num); System.out.println("Factorial of entered number is: "+factorial); } static int fact(int n) { int output; if(n==1){ return 1; } output = fact(n-1)* n; return output; } }
Main.java:2: error: class Factorial is public, should be declared in a file named Factorial.java public class Factorial{ ^ 1 error
s771754720
p00019
Java
package Factorial; import java.util.Scanner; public class Factorial { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int number = in.nextInt(); if (number <= 1 || number >= 20) { } else { System.out.println(factorial(number)); } } } public static int factorial(int num) { if (num <= 1) { return 1; } else { return num * factorial(num - 1); } } }
Main.java:5: error: class Factorial is public, should be declared in a file named Factorial.java public class Factorial { ^ 1 error
s023761299
p00019
Java
import java.util.Scanner; public class Factorial { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int number = in.nextInt(); if (number <= 1 || number >= 20) { } else { System.out.println(factorial(number)); } } } public static int factorial(int num) { if (num <= 1) { return 1; } else { return num * factorial(num - 1); } } }
Main.java:4: error: class Factorial is public, should be declared in a file named Factorial.java public class Factorial { ^ 1 error