submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s000340648
p00502
C++
return 0; } return pointM;//自分の今までの派手さ絶対値の合計(今日ー昨日まで) } int main(void){ cin >> days; cin >> clothes; for(int i=0;i<days;i++){ cin >> temple[i]; } for(int i=0;i<clothes;i++){ cin >> clothD[i][0]; cin >> clothD[i][1]; cin >> clothD[i][2]; } for(int i=0;i<days;i++){ dayCanW[i]=0; for(int j=0;j<clothes;j++){ dayM[i][j]=0; } } /* for(int i=0;i<days;i++){ for(int j=0;j<clothes;j++){ if(temple[i]>clothD[j][0] && temple[i]<clothD[j][1]){ dayM[i][j]=1; dayCanW[i]+=1; } } } */ cout << bestCloth(0,0) << endl; return 0; }
a.cc:1:5: error: expected unqualified-id before 'return' 1 | return 0; | ^~~~~~ a.cc:2:3: error: expected declaration before '}' token 2 | } | ^ a.cc:3:3: error: expected unqualified-id before 'return' 3 | return pointM;//自分の今までの派手さ絶対値の合計(今日ー昨日まで) | ^~~~~~ a.cc:4:1: error: expected declaration before '}' token 4 | } | ^ a.cc: In function 'int main()': a.cc:10:3: error: 'cin' was not declared in this scope 10 | cin >> days; | ^~~ a.cc:10:10: error: 'days' was not declared in this scope 10 | cin >> days; | ^~~~ a.cc:11:10: error: 'clothes' was not declared in this scope 11 | cin >> clothes; | ^~~~~~~ a.cc:13:12: error: 'temple' was not declared in this scope 13 | cin >> temple[i]; | ^~~~~~ a.cc:16:12: error: 'clothD' was not declared in this scope 16 | cin >> clothD[i][0]; | ^~~~~~ a.cc:21:9: error: 'dayCanW' was not declared in this scope 21 | dayCanW[i]=0; | ^~~~~~~ a.cc:23:9: error: 'dayM' was not declared in this scope 23 | dayM[i][j]=0; | ^~~~ a.cc:36:3: error: 'cout' was not declared in this scope 36 | cout << bestCloth(0,0) << endl; | ^~~~ a.cc:36:11: error: 'bestCloth' was not declared in this scope 36 | cout << bestCloth(0,0) << endl; | ^~~~~~~~~ a.cc:36:29: error: 'endl' was not declared in this scope 36 | cout << bestCloth(0,0) << endl; | ^~~~
s562877824
p00502
C++
#include <cstdio> #include <cstdlib> #include <algorithm> using namespace std; int main() { int d,n; cin >> d >> n; int dp[205][105]; for(int i=0;i<205;i++)for(int j=0;j<205;j++)dp[i][j]=1e7; int temp[205]; int a[205],b[205],c[205]; for(int i=1;i<=d;i++) { cin >> temp[i]; } for(int i=1;i<=n;i++) { cin >> a[i]>> b[i] >> c[i]; if(a[i] <= temp[1] && temp[1] <= b[i]) { dp[1][c[i]]=min(dp[1][c[i]],0); } } for(int i=2;i<=d;i++) { for(int j=1;j<=n;j++) { if(a[j] <= temp[i] && temp[i] <= b[j]) { for(int k=0;k<=100;k++) dp[i][c[j]]=min(dp[i][c[j]],dp[i-1][k]+abs(k-c[j])); } } } int val=1e7; for(int k=0;k<=100;k++) val=min(val,dp[d][k]); cout << val << endl; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope 8 | cin >> d >> n; | ^~~ a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 3 | #include <algorithm> +++ |+#include <iostream> 4 | using namespace std; a.cc:37:9: error: 'cout' was not declared in this scope 37 | cout << val << endl; | ^~~~ a.cc:37:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:37:24: error: 'endl' was not declared in this scope 37 | cout << val << endl; | ^~~~ a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 3 | #include <algorithm> +++ |+#include <ostream> 4 | using namespace std;
s162759249
p00502
C++
#include<iostream> using namespace std; int calc_abso(a,b){ int abso; if(a>=b){ abso=a-b; }else if(a<b){ abso=b-a; } return ; } struct WEAR{ int min; //適す最高気温(下限) int max; //適す最高気温(上限) int looks; //派手さ }; int dp[256][256]={{0}}; //[日数][服の種] //値は派手さの絶対値の合計(一番大きいものを最終的に取るように) int main (void){ int D,N; WEAR status[256]; int tempe[256]; for(int i=0;i<D;i++){ cin >> tempe[i]; } for(int i=0;i<N;i++){ cin >> status[i].min >> status[i].mix >> status[i].looks; } for(int i=1;i<D;i++){ for(int j=0;j<N;j++){ if((status[j].min<tempe[j])&&(status[j].max>tempe[])){ //この服が今日適しているか? int MAX_tortal=-1; //前日の服と差の最大値 int MAX_num; for(int k=0;k<N;k++){ //前日の服 int THIS_tortal=calc_abso(status[N].looks , status[k].looks)+dp[i][k]; if(THIS_tortal+>MAX_tortal){ MAX_abso=THIS_tortal; MAX_num=k; } } dp[i][j]+=MAX_tortal; } } } int LAST_MAX_tortal=-1; for(int i=0;i<N;i++){ if(dp[D-1][i]>LAST_MAX_tortal){ LAST_MAX_tortal=dp[D-1][i]; } } cout << LAST_MAX_tortal << endl; return 0; }
a.cc:6:15: error: 'a' was not declared in this scope 6 | int calc_abso(a,b){ | ^ a.cc:6:17: error: 'b' was not declared in this scope 6 | int calc_abso(a,b){ | ^ a.cc:6:18: error: expression list treated as compound expression in initializer [-fpermissive] 6 | int calc_abso(a,b){ | ^ a.cc: In function 'int main()': a.cc:35:43: error: 'struct WEAR' has no member named 'mix'; did you mean 'min'? 35 | cin >> status[i].min >> status[i].mix >> status[i].looks; | ^~~ | min a.cc:40:63: error: expected primary-expression before ']' token 40 | if((status[j].min<tempe[j])&&(status[j].max>tempe[])){ //この服が今日適しているか? | ^ a.cc:44:50: error: 'calc_abso' cannot be used as a function 44 | int THIS_tortal=calc_abso(status[N].looks , status[k].looks)+dp[i][k]; | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:45:40: error: expected primary-expression before '>' token 45 | if(THIS_tortal+>MAX_tortal){ | ^ a.cc:46:29: error: 'MAX_abso' was not declared in this scope 46 | MAX_abso=THIS_tortal; | ^~~~~~~~
s747589223
p00502
C++
#include<iostream> #include<cmath> #include<algorithm> using namespace std; struct Tshirt{ int a; int b; int c; }; int solve(int,struct Tshirt,int); int d,n; int t[201]; int memo[210][210]; struct Tshirt data[201]; int main(){ cin >> d >> n; for(int i=1;i<=d;i++){ cin >> t[i]; } for(int i=1;i<=n;i++){ cin >> data[i].a; cin >> data[i].b; cin >> data[i].c; } int ans = 0; for(int i=1;i<=n;i++){ if(t[1] >= data[i].a && t[1] <= data[i].b){ int new_ans=0; new_ans = solve(2,data[i],i); if(ans < new_ans)ans = new_ans; } } cout << ans << endl; return 0; } int solve(int day,struct Tshirt a){ int rec = 0; if(memo[day][a.c] != 0)return memo[day][a.c]; if(day == d){ rec = 0; } for(int i=1;i<=n;i++){ int o; if(t[day] >= data[i].a && t[day] <= data[i].b){ o = abs(a.c-data[i].c); o += solve(day+1,data[i],i); rec = max(rec,o); } } memo[day][a.c] = rec; return rec; }
a.cc: In function 'int main()': a.cc:26:24: error: reference to 'data' is ambiguous 26 | cin >> data[i].a; | ^~~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:27:24: error: reference to 'data' is ambiguous 27 | cin >> data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:28:24: error: reference to 'data' is ambiguous 28 | cin >> data[i].c; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:32:28: error: reference to 'data' is ambiguous 32 | if(t[1] >= data[i].a && t[1] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:32:49: error: reference to 'data' is ambiguous 32 | if(t[1] >= data[i].a && t[1] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:34:43: error: reference to 'data' is ambiguous 34 | new_ans = solve(2,data[i],i); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc: In function 'int solve(int, Tshirt)': a.cc:50:30: error: reference to 'data' is ambiguous 50 | if(t[day] >= data[i].a && t[day] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:50:53: error: reference to 'data' is ambiguous 50 | if(t[day] >= data[i].a && t[day] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:51:37: error: reference to 'data' is ambiguous 51 | o = abs(a.c-data[i].c); | ^~~~ /usr/
s229524809
p00502
C++
#include<iostream> #include<cmath> #include<algorithm> using namespace std; struct Tshirt{ int a; int b; int c; }; int solve(int,struct Tshirt); int d,n; int t[201]; int memo[210][210]; struct Tshirt data[201]; int main(){ cin >> d >> n; for(int i=1;i<=d;i++){ cin >> t[i]; } for(int i=1;i<=n;i++){ cin >> data[i].a; cin >> data[i].b; cin >> data[i].c; } int ans = 0; for(int i=1;i<=n;i++){ if(t[1] >= data[i].a && t[1] <= data[i].b){ int new_ans=0; new_ans = solve(2,data[i],i); if(ans < new_ans)ans = new_ans; } } cout << ans << endl; return 0; } int solve(int day,struct Tshirt a){ int rec = 0; if(memo[day][a.c] != 0)return memo[day][a.c]; if(day == d){ rec = 0; } for(int i=1;i<=n;i++){ int o; if(t[day] >= data[i].a && t[day] <= data[i].b){ o = abs(a.c-data[i].c); o += solve(day+1,data[i],i); rec = max(rec,o); } } memo[day][a.c] = rec; return rec; }
a.cc: In function 'int main()': a.cc:26:24: error: reference to 'data' is ambiguous 26 | cin >> data[i].a; | ^~~~ In file included from /usr/include/c++/14/string:53, 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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:27:24: error: reference to 'data' is ambiguous 27 | cin >> data[i].b; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:28:24: error: reference to 'data' is ambiguous 28 | cin >> data[i].c; | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:32:28: error: reference to 'data' is ambiguous 32 | if(t[1] >= data[i].a && t[1] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:32:49: error: reference to 'data' is ambiguous 32 | if(t[1] >= data[i].a && t[1] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:34:43: error: reference to 'data' is ambiguous 34 | new_ans = solve(2,data[i],i); | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc: In function 'int solve(int, Tshirt)': a.cc:50:30: error: reference to 'data' is ambiguous 50 | if(t[day] >= data[i].a && t[day] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:50:53: error: reference to 'data' is ambiguous 50 | if(t[day] >= data[i].a && t[day] <= data[i].b){ | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:18:15: note: 'Tshirt data [201]' 18 | struct Tshirt data[201]; | ^~~~ a.cc:51:37: error: reference to 'data' is ambiguous 51 | o = abs(a.c-data[i].c); | ^~~~ /usr/
s798623401
p00503
C
#include<stdio.h> #include<stdlib.h> long long X[ 100 ][ 2 ] ,x[ 100 ] ; long long Y[ 100 ][ 2 ] ,y[ 100 ] ; long long Z[ 100 ][ 2 ] ,z[ 100 ] ; int i ,j ,k ,l ; void sort( long long *a ,int size ) { qsort( a ,size ,sizeof( long long ) ,[]( const void *a ,const void *b ){ return *( int* )a - *( int* )b ; } ) ; } int check() { if( X[ l ][ 0 ] > x[ i ] || X[ l ][ 1 ] < x[ i + 1 ] || Y[ l ][ 0 ] > y[ j ] || Y[ l ][ 1 ] < y[ j + 1 ] || Z[ l ][ 0 ] > z[ k ] || Z[ l ][ 1 ] < z[ k + 1 ] ) { return 1 ; } return 0 ; } int main( void ) { int N ,K ; scanf( "%d %d" ,&N ,&K ) ; N *= 2 ; --K ; int n = N - 1 ; for( i = 0 ; i < N ; ++i ) { scanf( "%lld %lld %lld" ,x + i ,y + i ,z + i ) ; X[ i / 2 ][ i % 2 ] = x[ i ] ; Y[ i / 2 ][ i % 2 ] = y[ i ] ; Z[ i / 2 ][ i % 2 ] = z[ i ] ; } sort( x ,N ) ; sort( y ,N ) ; sort( z ,N ) ; long long ans = 0 ; for( i = 0 ; i < n ; ++i ) { for( j = 0 ; j < n ; ++j ) { for( k = 0 ; k < n ; ++k ) { int cnt = 0 ; for( l = 0 ; l < N ; ++l ) { if( check() == 0 ) { ++cnt ; } } if( cnt > K ) { ans += ( x[ i + 1 ] - x[ i ] ) * ( y[ j + 1 ] - y[ j ] ) * ( z[ k + 1 ] - z[ k ] ) ; } } } } printf( "%lld\n" ,ans ) ; return 0 ; }
main.c: In function 'sort': main.c:13:46: error: expected expression before '[' token 13 | qsort( a ,size ,sizeof( long long ) ,[]( const void *a ,const void *b ){ return *( int* )a - *( int* )b ; } ) ; | ^ main.c:13:80: error: expected ')' before '{' token 13 | qsort( a ,size ,sizeof( long long ) ,[]( const void *a ,const void *b ){ return *( int* )a - *( int* )b ; } ) ; | ~ ^ | )
s938412386
p00503
C
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s945712184
p00503
C
#include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<algorithm> using namespace std; #define MAX(x,y) ((x>y)?x:y) int comp(const void *p,const void *q){ return *(int *)p-*(int *)q; } int x[105],y[105],d[105]; int sx[105],sy[105],sd[105]; int c[105][105][105]; int main(){ int i,j,k,l,n,K; int xn,yn,dn; long long ans; scanf("%d%d",&n,&K); for(i=0;i<n;i++)scanf("%d%d%d%d%d%d",&x[i*2],&y[i*2],&d[i*2],&x[i*2+1],&y[i*2+1],&d[i*2+1]); memcpy(sx,x,sizeof(int)*n*2); memcpy(sy,y,sizeof(int)*n*2); memcpy(sd,d,sizeof(int)*n*2); qsort(sx,n*2,sizeof(int),comp); qsort(sy,n*2,sizeof(int),comp); qsort(sd,n*2,sizeof(int),comp); xn=yn=dn=1; for(i=1;i<n*2;i++)if(sx[i]!=sx[i-1])sx[xn++]=sx[i]; for(i=1;i<n*2;i++)if(sy[i]!=sy[i-1])sy[yn++]=sy[i]; for(i=1;i<n*2;i++)if(sd[i]!=sd[i-1])sd[dn++]=sd[i]; /* for(i=0;i<xn;i++)printf("%3d ",sx[i]);printf("\n"); for(i=0;i<yn;i++)printf("%3d ",sy[i]);printf("\n"); for(i=0;i<dn;i++)printf("%3d ",sd[i]);printf("\n"); */ memset(c,0,sizeof(c)); for(i=0;i<n*2;i++){ x[i]=lower_bound(sx,sx+xn,x[i])-sx; y[i]=lower_bound(sy,sy+yn,y[i])-sy; d[i]=lower_bound(sd,sd+dn,d[i])-sd; //printf("%d %d %d\n",x[i],y[i],d[i]); if(i%2==1){ for(j=x[i-1];j<x[i];j++) for(k=y[i-1];k<y[i];k++) for(l=d[i-1];l<d[i];l++)c[j][k][l]++; } } ans=0; for(i=0;i<xn-1;i++)for(j=0;j<yn-1;j++)for(k=0;k<dn-1;k++){ if(c[i][j][k]>=K)ans+=(long long)(sx[i+1]-sx[i])* (long long)(sy[j+1]-sy[j])* (long long)(sd[k+1]-sd[k]); } printf("%lld\n",ans); return 0; }
main.c:1:9: fatal error: cstdio: No such file or directory 1 | #include<cstdio> | ^~~~~~~~ compilation terminated.
s676093954
p00503
C++
#include<iostream> #include<map> using namespace std; enum {X=0, Y=1, Z=2 }; void main(){ int K,N; int *data1[3], *data2[3]; cin >> N >> K; for(int x=0; x<3; x++){ data1[x] = new int[N]; data2[x] = new int[N]; } for(int n=0; n<N; n++){ cin >> data1[X][n] >> data1[Y][n] >> data1[Z][n] >> data2[X][n] >> data2[Y][n] >> data2[Z][n]; } map<int, char> gridmap[3]; int *gridstep[3]; char *grid; for(int x=0; x<3; x++){ for(int n=0; n<N; n++){ gridmap[x].insert(make_pair(data1[x][n], -1)); gridmap[x].insert(make_pair(data2[x][n], -1)); } } char gridnum[3] = {0,0,0}; for(int x=0; x<3; x++){ gridstep[x] = new int[gridmap[x].size()]; for(auto it = gridmap[x].begin(); it!=gridmap[x].end(); it++, gridnum[x]++){ gridstep[x][gridnum[x]] = it->first; it->second = gridnum[x]; } } int griddim = (gridnum[X]-1)*(gridnum[Y]-1)*(gridnum[Z]-1); grid = new char[griddim]; for(int a=0; a<griddim; a++)grid[a] = 0; for(int n=0; n<N; n++){ int xyz1[3], xyz2[3]; for(int x=0; x< 3; x++){ xyz1[x] = gridmap[x].find(data1[x][n])->second; xyz2[x] = gridmap[x].find(data2[x][n])->second; } for(int xn=xyz1[X]; xn<xyz2[X]; xn++){ for(int yn=xyz1[Y]; yn<xyz2[Y]; yn++){ for(int zn=xyz1[Z]; zn<xyz2[Z]; zn++){ grid[zn + (gridnum[2]-1)*(yn + (gridnum[1]-1)*xn)]++; } } } } long long value=0; for(int xn=0; xn< gridnum[X]-1; xn++){ for(int yn=0; yn< gridnum[Y]-1; yn++){ for(int zn=0; zn< gridnum[Z]-1; zn++){ if(grid[zn + (gridnum[2]-1)*(yn + (gridnum[1]-1)*xn)] >= K){ value += (long long)(gridstep[X][xn+1] -gridstep[X][xn])* (gridstep[Y][yn+1] -gridstep[Y][yn])* (gridstep[Z][zn+1] -gridstep[Z][zn]); } } } } cout << value << endl; for(int x=0; x<3; x++){ delete[] data1[x]; delete[] data2[x]; delete[] gridstep[x]; } delete[] grid; }
a.cc:7:1: error: '::main' must return 'int' 7 | void main(){ | ^~~~
s594760613
p00503
C++
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef __int64 LONG; LONG zip[3][200]; int M[3]; int a[50][6]; int N, K; int O[200][200][200]; int main() { scanf("%d %d", &N, &K); memset(zip, -1, sizeof(zip)); memset(M, 0, sizeof(M)); memset(a, 0, sizeof(a)); memset(O, 0, sizeof(O)); for (int i = 0; i < N; i++){ for (int j = 0; j < 6; j++){ scanf("%d", &a[i][j]); bool f = true; for (int k = 0; k < M[j % 3]; k++){ if (zip[j % 3][k] == a[i][j]){ f = false; break; } } if (f){ zip[j % 3][M[j % 3]] = a[i][j]; M[j % 3]++; } } } for (int i = 0; i < 3; i++){ sort(zip[i], zip[i] + M[i]); } for (int i = 0; i < N; i++){ for (int j = 0; j < 6; j++){ int l = 0; int r = M[j % 3] - 1; int m = (l + r) / 2; while (zip[j % 3][m] != a[i][j]){ if (zip[j % 3][m] < a[i][j]){ l = m + 1; } else { r = m - 1; } m = (l + r) / 2; } a[i][j] = m; } } for (int i = 0; i < N; i++){ for (int x = a[i][0]; x < a[i][3]; x++){ for (int y = a[i][1]; y < a[i][4]; y++){ for (int z = a[i][2]; z < a[i][5]; z++){ O[x][y][z]++; } } } } LONG sum = 0; for (int x = 0; x < 200; x++){ for (int y = 0; y < 200; y++){ for (int z = 0; z < 200; z++){ if (O[x][y][z] >= K){ sum += (zip[0][x + 1] - zip[0][x]) * (zip[1][y + 1] - zip[1][y]) * (zip[2][z + 1] - zip[2][z]); } } } } printf("%I64d\n", sum); return 0; }
a.cc:6:9: error: '__int64' does not name a type; did you mean '__int64_t'? 6 | typedef __int64 LONG; | ^~~~~~~ | __int64_t a.cc:8:1: error: 'LONG' does not name a type 8 | LONG zip[3][200]; | ^~~~ a.cc: In function 'int main()': a.cc:19:16: error: 'zip' was not declared in this scope 19 | memset(zip, -1, sizeof(zip)); | ^~~ a.cc:78:9: error: 'LONG' was not declared in this scope 78 | LONG sum = 0; | ^~~~ a.cc:84:41: error: 'sum' was not declared in this scope 84 | sum += (zip[0][x + 1] - zip[0][x]) * | ^~~ a.cc:92:27: error: 'sum' was not declared in this scope 92 | printf("%I64d\n", sum); | ^~~
s231782483
p00503
C++
#include<stdio.h> #include<math.h> #include<algorithm> #include<vector> using namespace std; #define MAX_N 50 #define rep(i,n) for(int i=0;i<n;i++) int W,H,D,N,K; int X1[MAX_N],X2[MAX_N],Y1[MAX_N],Y2[MAX_N],D1[MAX_N],D2[MAX_N]; vector<int> xl,yl,dl; int fld[MAX_N * 2][MAX_N*2][MAX_N*2]; int compress(int *x1,int *x2, int w,vector<int> *xs){ rep(i,N){ int tx1=x1[i], tx2=x2[i]; xs->push_back(tx1); xs->push_back(tx2); } sort(xs->begin(),xs->end()); xs->erase(unique(xs->begin(),xs->end()),xs->end()); rep(i,N){ x1[i] = find(xs->begin(),xs->end(),x1[i] )- xs->begin(); x2[i] = find(xs->begin(),xs->end(),x2[i] )- xs->begin(); } return xs->size(); } void solve(){ W=compress(X1,X2,W,&xl); H=compress(Y1,Y2,H,&yl); D=compress(D1,D2,D,&dl); memset(fld, 0, sizeof(fld)); rep(i,N){ for(int d=D1[i]; d<D2[i]; d++){ for(int y = Y1[i]; y<Y2[i];y++){ for(int x = X1[i]; x<X2[i];x++){ fld[d][y][x]++; } } } } long long int ans=0; rep(d,D){ rep(y,H){ rep(x,W){ if(fld[d][y][x]<K)continue; ans+=(xl[x+1]-xl[x])*(yl[y+1]-yl[y])*(dl[d+1]-dl[d]); } } } printf("%lld\n",ans); } int main(){ scanf("%d %d",&N,&K); W=H=D=1000000; rep(i,N){ //int x1,x2,y1,y2,d1,d2; scanf("%d %d %d %d %d %d",&X1[i],&Y1[i],&D1[i],&X2[i],&Y2[i],&D2[i]); } solve(); return 0; }
a.cc: In function 'void solve()': a.cc:39:9: error: 'memset' was not declared in this scope 39 | memset(fld, 0, sizeof(fld)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<vector> +++ |+#include <cstring> 5 |
s175485787
p00503
C++
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { Scanner sc = new Scanner(System.in); void run() { int N = sc.nextInt(); int K = sc.nextInt(); long[] xS = new long[N]; long[] yS = new long[N]; long[] zS = new long[N]; long[] xT = new long[N]; long[] yT = new long[N]; long[] zT = new long[N]; ArrayList<Long> X = new ArrayList<Long>(); ArrayList<Long> Y = new ArrayList<Long>(); ArrayList<Long> Z = new ArrayList<Long>(); for (int i = 0; i < N; i++) { xS[i] = sc.nextLong(); yS[i] = sc.nextLong(); zS[i] = sc.nextLong(); xT[i] = sc.nextLong(); yT[i] = sc.nextLong(); zT[i] = sc.nextLong(); X.add(xS[i]); X.add(xT[i]); Y.add(yS[i]); Y.add(yT[i]); Z.add(zS[i]); Z.add(zT[i]); } Collections.sort(X); Collections.sort(Y); Collections.sort(Z); long ans = 0; for (int i = 0; i < N * 2 - 1; i++) { for (int j = 0; j < N * 2 - 1; j++) { for (int k = 0; k < N * 2 - 1; k++) { int overlap = 0; // x,y,z???????????????????????¨???????????????????????? // ????????????????¢?????????????????????¬?????????????????? for (int l = 0; l < N; l++) { if (xS[l] <= X.get(i) && X.get(i + 1) <= xT[l] && yS[l] <= Y.get(j) && Y.get(j + 1) <= yT[l] && zS[l] <= Z.get(k) && Z.get(k + 1) <= zT[l]) { overlap++; } } if (overlap >= K) { ans += (X.get(i + 1) - X.get(i)) * (Y.get(j + 1) - Y.get(j)) * (Z.get(k + 1) - Z.get(k)); } } } } System.out.println(ans); } public static void main(String[] args) { new Main().run(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.ArrayList; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Collections; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s437851950
p00503
C++
#include <stdio.h> #include <vector> #include <algorithm> #include <assert.h> using namespace std; namespace { int n, k; int x1[50], yy[50], d1[50], x2[50], y2[50], d2[50]; int cx1[50], cy1[50], cd1[50], cx2[50], cy2[50], cd2[50]; int compd[123][123][123]; } //w1,w2???????????????????????§???????????§??????????????? vector<int> compress(int *w1, int *w2) { vector<int>ws; for (int i = 0; i < n; ++i) { ws.push_back(w1[i]); ws.push_back(w2[i]); } sort(ws.begin(), ws.end()); ws.erase(unique(ws.begin(), ws.end()), ws.end()); for (int i = 0; i < n; ++i) { w1[i] = find(ws.begin(), ws.end(), w1[i]) - ws.begin(); w2[i] = find(ws.begin(), ws.end(), w2[i]) - ws.begin(); } return ws; } int main() { scanf("%d %d", &n, &k); for (int i = 0; i < n; ++i) { scanf("%d %d %d %d %d %d", x1 + i, yy + i, d1 + i, x2 + i, y2 + i, d2 + i); } auto xsv = compress(x1, x2); auto ysv = compress(yy, y2); auto dsv = compress(d1, d2); int xs = xsv.size(); int ys = ysv.size(); int ds = dsv.size(); memset(compd, 0, sizeof(compd)); //??????????¨???? for (int i = 0;i < n;++i) { const int hash[8][3] = { {0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}, }; for (int p = 0; p < 8; ++p) { compd [hash[p][0] ? x1[i] : x2[i]] [hash[p][1] ? yy[i] : y2[i]] [hash[p][2] ? d1[i] : d2[i]] = (hash[p][0]^hash[p][1]^hash[p][2]) ? 1 : -1; } } //?´????????????¨??? for (int x = 0; x < xs; ++x) { for (int y = 0; y < ys; ++y) { for (int d = 1; d < ds; ++d) { compd[x][y][d] += compd[x][y][d - 1]; } } } for (int x = 0; x < xs; ++x) { for (int y = 1; y < ys; ++y) { for (int d = 0; d < ds; ++d) { compd[x][y][d] += compd[x][y - 1][d]; } } } for (int x = 1; x < xs; ++x) { for (int y = 0; y < ys; ++y) { for (int d = 0; d < ds; ++d) { compd[x][y][d] += compd[x - 1][y][d]; } } } long long ans = 0; for (int x = 0; x < xs; ++x) { for (int y = 0; y < ys; ++y) { for (int d = 0; d < ds; ++d) { assert(compd[x][y][d] >= 0); if (compd[x][y][d] >= k) { ans += (xsv[x + 1] - xsv[x]) * (ysv[y + 1] - ysv[y]) * (dsv[d + 1] - dsv[d]); } } } } printf("%lld",ans); return 0; }
a.cc: In function 'int main()': a.cc:52:9: error: 'memset' was not declared in this scope 52 | memset(compd, 0, sizeof(compd)); | ^~~~~~ a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <assert.h> +++ |+#include <cstring> 6 |
s997415673
p00503
C++
#include <cstdio> #include <algorithm> #include <vector> using namespace std; const int MAX_DIS = 1000000; int n, k; int x[2][51], y[2][51], z[2][51]; int lx[301], ly[301], lz[301]; int ocean[301][301][301]; long long int ans; int compress(int *start, int *end, int *lx){ vector<int> v; for(int i = 0; i < n; i++){ for(int j = -1; j <= 1; j++){ int x1 = start[i] + j, x2 = end[i] + j; if(0 <= x1 && x1 <= MAX_DIS) v.push_back(x1); if(0 <= x2 && x2 <= MAX_DIS) v.push_back(x2); } } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); for(int i = 0; i < n; i++){ start[i] = find(v.begin(), v.end(), start[i]) - v.begin(); end[i] = find(v.begin(), v.end(), end[i]) - v.begin(); } for(int i = 0; i < v.size(); i++) lx[i] = v[i]; return v.size(); } int main(){ scanf("%d%d", &n, &k); for(int i = 0; i < n; i++){ for(int j = 0; j < 2; j++){ scanf("%d%d%d", &x[j][i], &y[j][i], &z[j][i]); } } int w = compress(x[0], x[1], lx); int h = compress(y[0], y[1], ly); int d = compress(z[0], z[1], lz); for(int i = 0; i < n; i++){ for(int j = x[0][i]; j < x[1][i]; j++){ for(int l = y[0][i]; l < y[1][i]; l++){ for(int m = z[0][i]; m < z[1][i]; m++){ ocean[j][l][m]++; } } } } for(int i = 0; i < w - 1; i++){ for(int j = 0; j < h - 1; j++){ for(int l = 0; l < d - 1; l++){ if(ocean[i][j][l] >= k) ans += (lx[i + 1] - lx[i]) * g(ly[j + 1] - ly[j]) * (lz[l + 1] - lz[l]); } } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:66:50: error: 'g' was not declared in this scope 66 | ans += (lx[i + 1] - lx[i]) * g(ly[j + 1] - ly[j]) * (lz[l + 1] - lz[l]); | ^
s471644632
p00503
C++
#include <cstdio> #include <algorithm> #include <vector> using namespace std; const int MAX_DIS = 1000000; int n, k; int x[2][51], y[2][51], z[2][51]; int ocean[301][301][301]; long long int lx[301], ly[301], lz[301]; long long int ans; int compress(int *start, int *end, int *lx){ vector<int> v; for(int i = 0; i < n; i++){ for(int j = -1; j <= 1; j++){ int x1 = start[i] + j, x2 = end[i] + j; if(0 <= x1 && x1 <= MAX_DIS) v.push_back(x1); if(0 <= x2 && x2 <= MAX_DIS) v.push_back(x2); } } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); for(int i = 0; i < n; i++){ start[i] = find(v.begin(), v.end(), start[i]) - v.begin(); end[i] = find(v.begin(), v.end(), end[i]) - v.begin(); } for(int i = 0; i < v.size(); i++) lx[i] = v[i]; return v.size(); } int main(){ scanf("%d%d", &n, &k); for(int i = 0; i < n; i++){ for(int j = 0; j < 2; j++){ scanf("%d%d%d", &x[j][i], &y[j][i], &z[j][i]); } } int w = compress(x[0], x[1], lx); int h = compress(y[0], y[1], ly); int d = compress(z[0], z[1], lz); for(int i = 0; i < n; i++){ for(int j = x[0][i]; j < x[1][i]; j++){ for(int l = y[0][i]; l < y[1][i]; l++){ for(int m = z[0][i]; m < z[1][i]; m++){ ocean[j][l][m]++; } } } } for(int i = 0; i < w - 1; i++){ for(int j = 0; j < h - 1; j++){ for(int l = 0; l < d - 1; l++){ if(ocean[i][j][l] >= k) ans += (lx[i + 1] - lx[i]) * (ly[j + 1] - ly[j]) * (lz[l + 1] - lz[l]); } } } printf("%lld\n", ans); return 0; }
a.cc: In function 'int main()': a.cc:48:34: error: cannot convert 'long long int*' to 'int*' 48 | int w = compress(x[0], x[1], lx); | ^~ | | | long long int* a.cc:13:41: note: initializing argument 3 of 'int compress(int*, int*, int*)' 13 | int compress(int *start, int *end, int *lx){ | ~~~~~^~ a.cc:49:34: error: cannot convert 'long long int*' to 'int*' 49 | int h = compress(y[0], y[1], ly); | ^~ | | | long long int* a.cc:13:41: note: initializing argument 3 of 'int compress(int*, int*, int*)' 13 | int compress(int *start, int *end, int *lx){ | ~~~~~^~ a.cc:50:34: error: cannot convert 'long long int*' to 'int*' 50 | int d = compress(z[0], z[1], lz); | ^~ | | | long long int* a.cc:13:41: note: initializing argument 3 of 'int compress(int*, int*, int*)' 13 | int compress(int *start, int *end, int *lx){ | ~~~~~^~
s915304204
p00503
C++
#include <iostream> #include <string> #include <vector> #include <cstdio> #include <algorithm> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int num[200][200][200]; //x,y,z int main(void){ int n, k; cin >> n >> k; rep(x, 200)rep(y, 200)rep(z, 200) num[x][y][z] = 0; int x1, y1, z1, x2, y2, z2; for (int i = 0; i < n; ++i){ cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2; for (int x = x1; x < x2; ++x){ for (int y = y1; y < y2; ++y){ for (int z = z1; z < z2; ++z){ num[x][y][z]++;z } } } } int ans = 0; rep(x, 200)rep(y, 200)rep(z, 200){ if(num[x][y][z] == k) ans++; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:57: error: expected ';' before '}' token 19 | num[x][y][z]++;z | ^ | ; 20 | } | ~
s101134240
p00503
C++
#include <cstdio> #include <cstring> #include <map> #include <vector> using namespace std; typedef __int64 lint; int main() { int N, K; static int cube[128][128][128]; int x1[64], x2[64], y1[64], y2[64], z1[64], z2[64]; vector<int> xs, ys, zs; map<int, int> convx, convy, convz; map<int, int> motox, motoy, motoz; scanf("%d %d", &N, &K); for (int i = 0; i < N; i++){ scanf("%d %d %d %d %d %d", x1 + i, y1 + i, z1 + i, x2 + i, y2 + i, z2 + i); xs.push_back(x1[i]); xs.push_back(x2[i]); ys.push_back(y1[i]); ys.push_back(y2[i]); zs.push_back(z1[i]); zs.push_back(z2[i]); } sort(xs.begin(), xs.end()); sort(ys.begin(), ys.end()); sort(zs.begin(), zs.end()); /* int idx = 0; convx[xs[0]] = idx; motox[idx++] = xs[0]; */ for (int i = 1; i < 2 * N; i++){ if (xs[i] != xs[i - 1]){ convx[xs[i]] = idx; motox[idx++] = xs[i]; } } /* idx = 0; convy[ys[0]] = idx; motoy[idx++] = ys[0]; */ for (int i = 1; i < 2 * N; i++){ if (ys[i] != ys[i - 1]){ convy[ys[i]] = idx; motoy[idx++] = ys[i]; } } /* idx = 0; convz[zs[0]] = idx; motoz[idx++] = zs[0]; */ for (int i = 1; i < 2 * N; i++){ if (zs[i] != zs[i - 1]){ convz[zs[i]] = idx; motoz[idx++] = zs[i]; } } for (int i = 0; i < N; i++){ //printf("%d %d %d %d %d %d\n", convx[x1[i]], convy[y1[i]], convz[z1[i]], convx[x2[i]], convy[y2[i]], convz[z2[i]]); for (int x = convx[x1[i]]; x < convx[x2[i]]; x++){ for (int y = convy[y1[i]]; y < convy[y2[i]]; y++){ for (int z = convz[z1[i]]; z < convz[z2[i]]; z++){ cube[x][y][z]++; } } } } lint ans = 0; for (int i = 0; i < 128; i++){ for (int j = 0; j < 128; j++){ for (int k = 0; k < 128; k++){ /*if (cube[i][j][k] >= K){ printf("!!\n"); printf("motox[i + 1] = %d motox[i] = %d motoy[j + 1] = %d motoy[j] = %d motoz[k + 1] = %d motoz[k] = %d\n", motox[i + 1], motox[i], motoy[j + 1], motoy[j], motoz[k + 1], motoz[k]); }*/ ans += (cube[i][j][k] >= K ? (lint)(motox[i + 1] - motox[i]) * (motoy[j + 1] - motoy[j]) * (motoz[k + 1] - motoz[k]) : 0); } } } printf("%I64d\n", ans); return (0); }
a.cc:7:9: error: '__int64' does not name a type; did you mean '__int64_t'? 7 | typedef __int64 lint; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:27:9: error: 'sort' was not declared in this scope; did you mean 'short'? 27 | sort(xs.begin(), xs.end()); | ^~~~ | short a.cc:38:40: error: 'idx' was not declared in this scope 38 | convx[xs[i]] = idx; | ^~~ a.cc:50:40: error: 'idx' was not declared in this scope 50 | convy[ys[i]] = idx; | ^~~ a.cc:62:40: error: 'idx' was not declared in this scope 62 | convz[zs[i]] = idx; | ^~~ a.cc:78:9: error: 'lint' was not declared in this scope; did you mean 'int'? 78 | lint ans = 0; | ^~~~ | int a.cc:86:33: error: 'ans' was not declared in this scope 86 | ans += (cube[i][j][k] >= K ? (lint)(motox[i + 1] - motox[i]) * (motoy[j + 1] - motoy[j]) * (motoz[k + 1] - motoz[k]) : 0); | ^~~ a.cc:91:27: error: 'ans' was not declared in this scope 91 | printf("%I64d\n", ans); | ^~~
s746808456
p00503
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <set> #include <bitset> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int n, k; vector<int> xs, ys, zs; map<int, int> zipx, zipy, zipz;//<???, ??§??????> map<int, int> unzipx, unzipy, unzipz;//<??§??????, ???> int num[100][100][100];//???????¨?????????\?????? int main(void){ cin >> n >> k; int x1[51], x2[51], y1[51], y2[51], z1[51], z2[51];//?????????????????§?¨? rep(i, n){ cin >> x1[i] >> y1[i] >> z1[i]; cin >> x2[i] >> y2[i] >> z2[i]; xs.push_back(x1[i]); xs.push_back(x2[i]); ys.push_back(y1[i]); ys.push_back(y2[i]); zs.push_back(z1[i]); zs.push_back(z2[i]); } sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(), xs.end(), xs.end()));//???????¶???? sort(ys.begin(), ys.end()); ys.erase(unique(ys.begin(), ys.end(), ys.end())); sort(zs.begin(), zs.end()); zs.erase(unique(zs.begin(), zs.end(), zs.end())); rep(i, xs.size()){ zipx[i] = xs[i]; unzipx[xs[i]] = i; } rep(i, ys.size()){ zipy[i] = ys[i]; unzipy[ys[i]] = i; } rep(i, zs.size()){ zipz[i] = zs[i]; unzipz[zs[i]] = i; } memset(num, 0, sizeof(num)); for (int i = 0; i < n; ++i){ for (int x = unzipx[x1[i]]; x < unzipx[x2[i]]; ++x){ for (int y = unzipy[y1[i]]; y < unzipy[x2[i]]; ++y){ for (int z = unzipz[z1[i]]; z < unzipz[z2[i]]; ++z){ num[x][y][z]++; } } } } int ans = 0; rep(x, 100)rep(y, 100)rep(z, 100){ if(num[x][y][z] >= k) ans++; } cout << ans << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Iterator2 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Compare = __gnu_cxx::__normal_iterator<int*, std::vector<int> >]': /usr/include/c++/14/bits/stl_algo.h:869:20: required from '_ForwardIterator std::__unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _BinaryPredicate = __gnu_cxx::__ops::_Iter_comp_iter<__gnu_cxx::__normal_iterator<int*, vector<int> > >]' 869 | if (!__binary_pred(__dest, __first)) | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:933:27: required from '_FIter std::unique(_FIter, _FIter, _BinaryPredicate) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _BinaryPredicate = __gnu_cxx::__normal_iterator<int*, vector<int> >]' 933 | return std::__unique(__first, __last, | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 934 | __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:35:17: required from here 35 | xs.erase(unique(xs.begin(), xs.end(), xs.end()));//???????¶???? | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:30: error: no match for call to '(__gnu_cxx::__normal_iterator<int*, std::vector<int> >) (int&, int&)' 158 | { return bool(_M_comp(*__it1, *__it2)); } | ~~~~~~~^~~~~~~~~~~~~~~~
s987679336
p00503
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <set> #include <bitset> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int n, k; // vector<int> xs, ys, zs; map<int, int> zipx, zipy, zipz;//<???, ??§??????> map<int, int> unzipx, unzipy, unzipz;//<??§??????, ???> int num[100][100][100];//???????¨?????????\?????? int main(void){ cin >> n >> k; int x1[51], x2[51], y1[51], y2[51], z1[51], z2[51];//?????????????????§?¨? vector<int> xs, ys, zs; rep(i, n){ cin >> x1[i] >> y1[i] >> z1[i]; cin >> x2[i] >> y2[i] >> z2[i]; xs.push_back(x1[i]); xs.push_back(x2[i]); ys.push_back(y1[i]); ys.push_back(y2[i]); zs.push_back(z1[i]); zs.push_back(z2[i]); } sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(), xs.end(), xs.end()));//???????¶???? sort(ys.begin(), ys.end()); ys.erase(unique(ys.begin(), ys.end(), ys.end())); sort(zs.begin(), zs.end()); zs.erase(unique(zs.begin(), zs.end(), zs.end())); rep(i, xs.size()){ zipx[i] = xs[i]; unzipx[xs[i]] = i; } rep(i, ys.size()){ zipy[i] = ys[i]; unzipy[ys[i]] = i; } rep(i, zs.size()){ zipz[i] = zs[i]; unzipz[zs[i]] = i; } memset(num, 0, sizeof(num)); for (int i = 0; i < n; ++i){ for (int x = unzipx[x1[i]]; x < unzipx[x2[i]]; ++x){ for (int y = unzipy[y1[i]]; y < unzipy[x2[i]]; ++y){ for (int z = unzipz[z1[i]]; z < unzipz[z2[i]]; ++z){ num[x][y][z]++; } } } } int ans = 0; rep(x, 100)rep(y, 100)rep(z, 100){ if(num[x][y][z] >= k) ans++; } cout << ans << endl; return 0; }
In file included from /usr/include/c++/14/bits/stl_algobase.h:71, from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Iterator2 = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Compare = __gnu_cxx::__normal_iterator<int*, std::vector<int> >]': /usr/include/c++/14/bits/stl_algo.h:869:20: required from '_ForwardIterator std::__unique(_ForwardIterator, _ForwardIterator, _BinaryPredicate) [with _ForwardIterator = __gnu_cxx::__normal_iterator<int*, vector<int> >; _BinaryPredicate = __gnu_cxx::__ops::_Iter_comp_iter<__gnu_cxx::__normal_iterator<int*, vector<int> > >]' 869 | if (!__binary_pred(__dest, __first)) | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:933:27: required from '_FIter std::unique(_FIter, _FIter, _BinaryPredicate) [with _FIter = __gnu_cxx::__normal_iterator<int*, vector<int> >; _BinaryPredicate = __gnu_cxx::__normal_iterator<int*, vector<int> >]' 933 | return std::__unique(__first, __last, | ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 934 | __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:36:17: required from here 36 | xs.erase(unique(xs.begin(), xs.end(), xs.end()));//???????¶???? | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:158:30: error: no match for call to '(__gnu_cxx::__normal_iterator<int*, std::vector<int> >) (int&, int&)' 158 | { return bool(_M_comp(*__it1, *__it2)); } | ~~~~~~~^~~~~~~~~~~~~~~~
s027287976
p00503
C++
#include <iostream> #include <algorithm> #include <vector> #include <map> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) int n, k; vector<ll> xs, ys, zs; map<ll, ll> zipx, zipy, zipz;//<???, ??§??????> map<ll, ll> unzipx, unzipy, unzipz;//<??§??????, ???> int num[100][100][100];//???????¨?????????\?????? int main(void){ cin >> n >> k; ll x1[51], x2[51], y1[51], y2[51], z1[51], z2[51];//?????????????????§?¨? rep(i, n){ cin >> x1[i] >> y1[i] >> z1[i]; cin >> x2[i] >> y2[i] >> z2[i]; xs.push_back(x1[i]); xs.push_back(x2[i]); ys.push_back(y1[i]); ys.push_back(y2[i]); zs.push_back(z1[i]); zs.push_back(z2[i]); } sort(xs.begin(), xs.end()); xs.erase(unique(xs.begin(),xs.end()), xs.end());//???????¶???? sort(ys.begin(), ys.end()); ys.erase(unique(ys.begin(), ys.end()), ys.end()); sort(zs.begin(), zs.end()); zs.erase(unique(zs.begin(), zs.end()), zs.end()); rep(i, xs.size()){ zipx[i] = xs[i]; unzipx[xs[i]] = i; // printf("unzip[%d] = %d\n", xs[i], i); // printf("zip[%d] = %d\n", i, xs[i]); } rep(i, ys.size()){ zipy[i] = ys[i]; unzipy[ys[i]] = i; // printf("unzip[%d] = %d\n", ys[i], i); // printf("zip[%d] = %d\n", i, ys[i]); } rep(i, zs.size()){ zipz[i] = zs[i]; unzipz[zs[i]] = i; // printf("unzip[%d] = %d\n", zs[i], i); // printf("zip[%d] = %d\n", i, zs[i]); } memset(num, 0, sizeof(num)); for (int i = 0; i < n; ++i){ // printf("%d %d %d %d %d %d\n", unzipx[x1[i]], unzipy[y1[i]], unzipz[z1[i]], unzipx[x2[i]], unzipy[y2[i]], unzipz[z2[i]]); for (int x = unzipx[x1[i]]; x < unzipx[x2[i]]; ++x){ for (int y = unzipy[y1[i]]; y < unzipy[y2[i]]; ++y){ for (int z = unzipz[z1[i]]; z < unzipz[z2[i]]; ++z){ // printf("%d %d %d \n", x, y, z); num[x][y][z]++; } } } } ll ans = 0; rep(x, 100)rep(y, 100)rep(z, 100){ if(num[x][y][z] >= k){ // printf("%lld\n", zipx[x + 1] - zipx[x]); // printf("%lld\n", zipy[x + 1] - zipy[y]); // printf("%lld\n", zipz[x + 1] - zipz[z]); ans += ((zipx[x + 1] - zipx[x]) * (zipy[y + 1] - zipy[y]) * (zipz[z + 1] - zipz[z])); } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:51:9: error: 'memset' was not declared in this scope 51 | memset(num, 0, sizeof(num)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <map> +++ |+#include <cstring> 5 | using namespace std;
s207269268
p00503
C++
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int n, K; vector<int> v[6]; vector<int> w[3]; vector<int> u[3]; vector<long long int> d[3]; long long int ans; int main(){ scanf("%d %d", &n, &K); for(int i=0; i<n; i++){ for(int j=0; j<6; j++){ int t; scanf("%d", &t); v[j].push_back(t); w[j%3].push_back(t); } } for(int i=0; i<3; i++){ sort(w[i].begin(), w[i].end()); w[i].erase(unique(w[i].begin(), w[i].end()), w[i].end()); } /* for(int i=0; i<3; i++){ for(int j=0; j<w[i].size(); j++){ printf("%d\t", w[i][j]); } printf("\n"); } */ for(int i=0; i<n; i++){ for(int j=0; j<6; j++){ v[j][i] = find(w[j%3].begin(), w[j%3].end(), v[j][i]) - w[j%3].begin(); } } /* for(int i=0; i<n; i++){ for(int j=0; j<6; j++){ printf("%d\t", v[j][i]); } printf("\n"); } */ for(int i=0; i<3; i++){ for(int j=0; j<w[i].size()-1; j++){ d[i].push_back(w[i][j+1]-w[i][j]); } } /* for(int i=0; i<3; i++){ for(int j=0; j<d[i].size(); j++){ printf("%d\t", d[i][j]); } printf("\n"); } */ int u[w[0].size()][w[1].size()][w[2].size()]; memset(u, 0, sizeof(u)); for(int i=0; i<n; i++){ for(int j=v[0][i]; j<v[3][i]; j++){ for(int k=v[1][i]; k<v[4][i]; k++){ for(int l=v[2][i]; l<v[5][i]; l++){ u[j][k][l]++; } } } } for(int i=0; i<w[0].size(); i++){ for(int j=0; j<w[1].size(); j++){ for(int k=0; k<w[2].size(); k++){ if(u[i][j][k] >= K) ans += d[0][i] * d[1][j] * d[2][k]; } } } /* for(int i=0; i<3; i++) for(int j=0; j<w[i].size(); j++) u[i].push_back(0); for(int i=0; i<3; i++){ for(int j=0; j<n; j++){ for(int k=v[i][j]; k<v[i+3][j]; k++){ u[i][k]++; } } } for(int i=0; i<3; i++){ for(int j=0; j<u[i].size(); j++){ printf("%d\t", u[i][j]); } printf("\n"); } for(int i=0; i<u[0].size()-1; i++){ for(int j=0; j<u[1].size()-1; j++){ for(int k=0; k<u[2].size()-1; k++){ if(u[0][i] >= K && u[1][j] >= K && u[2][k] >= K){ ans += d[0][i] * d[1][j] * d[2][k]; printf("%d %d %d\n", i, j, k); } } } } */ printf("%lld\n", ans); }
a.cc: In function 'int main()': a.cc:62:9: error: 'memset' was not declared in this scope 62 | memset(u, 0, sizeof(u)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s791813518
p00503
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <iostream> #include <vector> #include <string> #include <sstream> #include <algorithm> #include <utility> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #include <functional> #define FI first #define SE second #define PB push_back #define MT make_tuple #defineint long long using namespace std; int N,K; int fld[105][105][105]; int X1[55],X2[55],Y1[55],Y2[55],Z1[55],Z2[55]; vector<int> X,Y,Z; vector<int> compress(int *x1,int *x2){ vector<int> xs; for(int i=0;i<N;++i){ xs.PB(x1[i]); xs.PB(x2[i]); } sort(xs.begin(),xs.end()); xs.erase(unique(xs.begin(),xs.end()),xs.end()); for(int i=0;i<N;++i){ x1[i]=lower_bound(xs.begin(),xs.end(),x1[i])-xs.begin(); x2[i]=lower_bound(xs.begin(),xs.end(),x2[i])-xs.begin(); } vector<int> length; for(int i=0;i<xs.size()-1;++i){ length.PB(xs[i+1]-xs[i]); } return length; } signed main(){ cin>>N>>K; for(int i=0;i<N;++i)cin>>X1[i]>>Y1[i]>>Z1[i]>>X2[i]>>Y2[i]>>Z2[i]; X=compress(X1,X2); Y=compress(Y1,Y2); Z=compress(Z1,Z2); for(int i=0;i<N;++i){ for(int x=X1[i];x<X2[i];++x){ for(int y=Y1[i];y<Y2[i];++y){ for(int z=Z1[i];z<Z2[i];++z){ fld[x][y][z]++; } } } } int ans=0; for(int x=0;x<X.size();++x){ for(int y=0;y<Y.size();++y){ for(int z=0;z<Z.size();++z){ if(fld[x][y][z]>=K)ans+=X[x]*Y[y]*Z[z]; } } } cout<<ans<<endl; }
a.cc:22:2: error: invalid preprocessing directive #defineint; did you mean #define? 22 | #defineint long long | ^~~~~~~~~ | define
s982858982
p00503
C++
#include<iostream> #define e(i,n) for(int i=0;i<n;i++) using namespace std;int n,q,p;long long x[110],y[110],z[110],a[110][2],b[110][2],c[110][2],s;int main(){cin>>n>>q;e(i,2*n){cin>>x[i]>>y[i]>>z[i];a[i/2][i%2]=x[i],b[i/2][i%2]=y[i],c[i/2][i%2]=z[i];}sort(x,x+n*2);sort(y,y+n*2);sort(z,z+n*2);s=0;e(i,n*2-1)e(j,n*2-1)e(k,n*2-1){p=0;e(t,n){bool o=1;e(r,2){if(a[t][0]>x[i+r]||x[i+r]>a[t][1])o=0;if(b[t][0]>y[j+r]||y[j+r]>b[t][1])o=0;if(c[t][0]>z[k+r]||z[k+r]>c[t][1])o=0;}if(o)p++;}if(p>=q)s+=(x[i+1]-x[i])*(y[j+1]-y[j])*(z[k+1]-z[k]);}cout<<s<<endl;return 0;}
a.cc: In function 'int main()': a.cc:3:198: error: 'sort' was not declared in this scope; did you mean 'short'? 3 | using namespace std;int n,q,p;long long x[110],y[110],z[110],a[110][2],b[110][2],c[110][2],s;int main(){cin>>n>>q;e(i,2*n){cin>>x[i]>>y[i]>>z[i];a[i/2][i%2]=x[i],b[i/2][i%2]=y[i],c[i/2][i%2]=z[i];}sort(x,x+n*2);sort(y,y+n*2);sort(z,z+n*2);s=0;e(i,n*2-1)e(j,n*2-1)e(k,n*2-1){p=0;e(t,n){bool o=1;e(r,2){if(a[t][0]>x[i+r]||x[i+r]>a[t][1])o=0;if(b[t][0]>y[j+r]||y[j+r]>b[t][1])o=0;if(c[t][0]>z[k+r]||z[k+r]>c[t][1])o=0;}if(o)p++;}if(p>=q)s+=(x[i+1]-x[i])*(y[j+1]-y[j])*(z[k+1]-z[k]);}cout<<s<<endl;return 0;} | ^~~~ | short
s617239249
p00503
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s825713203
p00504
C++
#include<iostream> #include<algorithm> class road{ public: int dp[1<<10][4]; int num; road(){ for(int i=0;i<(1<<10);++i){ for(int j=0;j<4;++j){ dp[i][j]=-1; } } } }; int N,M,K; road **map; int mx[]{1,0,-1,0},my[]{0,1,0,-1}; int search(int,int,int,int); using namespace std; int main(){ cin>>N>>M>>K; map=new road*[M+1]; for(int i=1;i<=M;++i){ map[i]=new road[N+1]; } char dummy; for(int i=1;i<=N;++i){ for(int j=1;j<=M;++j) { cin>>dummy; if(dummy=='#'){ map[j][i].num=-1; }else if(dummy=='.'){ map[j][i].num=0; }else{ map[j][i].num=dummy-'0'; } } } cout<<search(1,1,0,K)<<endl; return 0; } int search(int x,int y,int lo,int k){ if(y==0||x==0||y>N||x>M||map[x][y].num==-1)return INT32_MIN; if(x==M&&y==N&&k==0)return 0; if(map[x][y].dp[lo][k]>-1)return map[x][y].dp[lo][k]; int stock=0; int res=INT32_MIN; swap(stock,map[x][y].num); for(int i=0;i<2;++i){ res=max(search(x+mx[i],y+my[i],(lo>>2)+(i<<8),k),res); } if(k>0){ for(int i=2;i<4;++i) { res=max(res,search(x+mx[i],y+my[i],(lo>>2)+(i<<8),k-1)); } } map[x][y].dp[lo][k]=res+stock; swap(stock,map[x][y].num); return map[x][y].dp[lo][k]; }
a.cc: In function 'int search(int, int, int, int)': a.cc:43:55: error: 'INT32_MIN' was not declared in this scope 43 | if(y==0||x==0||y>N||x>M||map[x][y].num==-1)return INT32_MIN; | ^~~~~~~~~ a.cc:47:13: error: 'INT32_MIN' was not declared in this scope 47 | int res=INT32_MIN; | ^~~~~~~~~
s783093345
p00504
C++
#include<bits/stdc++.h> typedef long long int ll; typedef unsigned long long int ull; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000000001 using namespace std; enum Type{ East, South, West, North, }; struct Info{ void set(int arg_row,int arg_col,int arg_back_count,int arg_moved_count,int arg_sum,int arg_move_log){ row = arg_row; col = arg_col; back_count = arg_back_count; moved_count = arg_moved_count; sum = arg_sum; move_log = arg_move_log; } bool operator<(const struct Info &arg) const{ //総和の降順(PQ) return sum < arg.sum; } int row,col,back_count,moved_count,sum,move_log; }; int H,W,K; int POW[7]; int dp[50][50][4][4096]; //dp[row][col][Kの残数][moved_count][過去6回の移動ログ] = 最大値 char base_map[50][51]; bool rangeCheck(int row,int col){ if(row >= 0 && row <= H-1 && col >= 0 && col <= W-1)return true; else{ return false; } } int makeCode(Type move_log[6]){ int ret = 0; for(int i = 0; i < 6; i++){ ret += move_log[i]*POW[i]; } return ret; } bool is_num(int row,int col){ return base_map[row][col] >= '1' && base_map[row][col] <= '9'; //0の土産物屋はない } int main(){ for(int i = 0; i < 7; i++)POW[i] = pow(4,i); scanf("%d %d %d",&H,&W,&K); for(int row = 0; row < H; row++){ scanf("%s",base_map[row]); } for(int row = 0; row < H; row++){ for(int col = 0; col < W; col++){ for(int i = 0; i <= K; i++){ for(int count = 0; count <= 6; count++){ for(int state = 0; state < POW[6]; state++)dp[row][col][i][count][state] = -1; } } } } priority_queue<Info> Q; Info first; first.set(0,0,0,0,0,0); dp[0][0][0][0][0] = 0; int bit_mask = 4095; Q.push(first); int log_array[6],tmp_log; Info info; while(!Q.empty()){ info = Q.top(); Q.pop(); if(dp[info.row][info.col][info.back_count][info.move_log] > info.sum)continue; int result_E = 0,result_S = 0,result_W = 0,result_N = 0; bool visited_E = false,visited_S = false,visited_W = false,visited_N = false; //過去の移動ログから、訪問済のマス情報を特定する int tmp_row = info.row,tmp_col = info.col; tmp_log = info.move_log; //printf("tmp_log:%d\n",tmp_log); for(int i = 0; i < 6; i++){ log_array[i] = tmp_log & 3; //printf("array[%d]:%d\n",i,log_array[i]); tmp_log /= 4; } for(int i = 0; i < min(6,info.moved_count); i++){ switch(log_array[i]){ //ログを打ち消す方向に動く case 0: tmp_col--; break; case 1: tmp_row--; break; case 2: tmp_col++; break; case 3: tmp_row++; break; } if(tmp_row == info.row && tmp_col == info.col+1){ //右のマスと一致 visited_E = true; }else if(tmp_row == info.row+1 && tmp_col == info.col){ //下のマスと一致 visited_S = true; }else if(tmp_row == info.row && tmp_col == info.col-1){ //左のマスと一致 visited_W = true; }else if(tmp_row == info.row-1 && tmp_col == info.col){ //上のマスと一致 visited_N = true; } } //次の移動ログを作る //右へ if(rangeCheck(info.row,info.col+1) == true && base_map[info.row][info.col+1] != '#'){ if(visited_E == false && is_num(info.row,info.col+1) == true){ result_E += base_map[info.row][info.col+1]-'0'; } int next_code = ((info.move_log<<2)&bit_mask)|0; if(dp[info.row][info.col+1][info.back_count][next_code] < info.sum+result_E){ dp[info.row][info.col+1][info.back_count][next_code] = info.sum+result_E; Info next; next.set(info.row,info.col+1,info.back_count,info.moved_count+1,info.sum+result_E,next_code); Q.push(next); } } //下へ if(rangeCheck(info.row+1,info.col) == true && base_map[info.row+1][info.col] != '#'){ if(visited_S == false && is_num(info.row+1,info.col) == true){ result_S += base_map[info.row+1][info.col]-'0'; } int next_code = ((info.move_log<<2)&bit_mask)|1; if(dp[info.row+1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_S){ dp[info.row+1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_S; Info next; next.set(info.row+1,info.col,info.back_count,info.moved_count+1,info.sum+result_S,next_code); Q.push(next); } } if(info.back_count == K)continue; //左へ if(rangeCheck(info.row,info.col-1) == true && base_map[info.row][info.col-1] != '#'){ if(visited_W == false && is_num(info.row,info.col-1) == true){ result_W += base_map[info.row][info.col-1]-'0'; } int next_code = ((info.move_log<<2)&bit_mask)|2; if(dp[info.row][info.col-1][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_W){ dp[info.row][info.col-1][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_W; Info next; next.set(info.row,info.col-1,info.back_count+1,info.moved_count+1,info.sum+result_W,next_code); Q.push(next); } } //上へ if(rangeCheck(info.row-1,info.col) == true && base_map[info.row-1][info.col] != '#'){ if(visited_N == false && is_num(info.row-1,info.col) == true){ result_N += base_map[info.row-1][info.col]-'0'; } int next_code = ((info.move_log<<2)&bit_mask)|3; if(dp[info.row-1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_N){ dp[info.row-1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_N; Info next; next.set(info.row-1,info.col,info.back_count+1,info.moved_count+1,info.sum+result_N,next_code); Q.push(next); } } } int ans = 0; for(int state = 0; state < POW[6]; state++){ for(int count = 4; count <= 6; count++){ ans = max(ans,dp[H-1][W-1][K][state]); } } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:74:106: error: invalid types 'int[int]' for array subscript 74 | for(int state = 0; state < POW[6]; state++)dp[row][col][i][count][state] = -1; | ^ a.cc:84:23: error: invalid types 'int[int]' for array subscript 84 | dp[0][0][0][0][0] = 0; | ^ a.cc:163:96: error: invalid types 'int[int]' for array subscript 163 | if(dp[info.row+1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_S){ | ^ a.cc:164:101: error: invalid types 'int[int]' for array subscript 164 | dp[info.row+1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_S; | ^ a.cc:179:96: error: invalid types 'int[int]' for array subscript 179 | if(dp[info.row][info.col-1][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_W){ | ^ a.cc:180:101: error: invalid types 'int[int]' for array subscript 180 | dp[info.row][info.col-1][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_W; | ^ a.cc:193:96: error: invalid types 'int[int]' for array subscript 193 | if(dp[info.row-1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] < info.sum+result_N){ | ^ a.cc:194:101: error: invalid types 'int[int]' for array subscript 194 | dp[info.row-1][info.col][info.back_count][min(6,info.moved_count+1)][next_code] = info.sum+result_N; | ^
s923464174
p00504
C++
#include <iostream> #include <fstream> #include <sstream> #include <iomanip> #include <complex> #include <string> #include <vector> #include <list> #include <deque> #include <stack> #include <queue> #include <set> #include <map> #include <bitset> #include <functional> #include <utility> #include <algorithm> #include <numeric> #include <typeinfo> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <ctime> using namespace std; int h,w,K; string str; int fie[100][100]; short dp[51][51][4][1<<12+1]; int res=0; short dfs(int x,int y,int k,int bit,int pc){ int nx=x,ny=y; if(check[x][y][k][bit]!=-1)return dp[x][y][k][bit]; //11nx++,10nx--,01ny++,00ny--; int nbit=bit; if(nbit >>11 & 1)nbit-=1<<11; if(nbit >>10 & 1)nbit-=1<<10; nbit<<=2; short r=-20000; if(k>=1){ nbit+=2; x--; if(x>=0 && y>=0 && fie[x][y]!=-1){ r=max(r,dfs(x,y,k-1,nbit,pc+1)); } x++; y--; nbit-=2; if(x>=0 && y>=0 && fie[x][y]!=-1){ r=max(r,dfs(x,y,k-1,nbit,pc+1)); } y++; } nbit+=3; x++; if(x>=0 && y>=0 && fie[x][y]!=-1){ r=max(r,dfs(x,y,k,nbit,pc+1)); } x--; nbit-=2; y++; if(x>=0 && y>=0 && fie[x][y]!=-1){ r=max(r,dfs(x,y,k,nbit,pc+1)); } y--; int sum=0; bool f=false; for(int i=0;i<min(pc,6);i++){ if(bit >>i*2 & 1){ if(bit >>(i*2+1) & 1)nx--; else ny--; }else{ if(bit >>(i*2+1) & 1)nx++; else ny++; } if(nx==x && ny==y){ f=true; break; } } if(!f)sum+=fie[x][y]; if(r<0 && x==w-1 && y==h-1)r=0; check[x][y][k][bit]=true; return (dp[x][y][k][bit]=sum+r); } int main(void){ scanf("%d%d%d",&h,&w,&K); memset(fie,-1,sizeof(fie)); memset(dp,-1,sizeof(dp)); for(int i=0;i<h;i++){ cin >> str; for(int j=0;j<w;j++){ if(str[j]=='.')fie[j][i]=0; else if(str[j]=='#')fie[j][i]=-1; else fie[j][i]=str[j]-'0'; } } printf("%d\n",dfs(0,0,K,0,0)); return 0; }
a.cc: In function 'short int dfs(int, int, int, int, int)': a.cc:36:12: error: 'check' was not declared in this scope 36 | if(check[x][y][k][bit]!=-1)return dp[x][y][k][bit]; | ^~~~~ a.cc:89:9: error: 'check' was not declared in this scope 89 | check[x][y][k][bit]=true; | ^~~~~
s571986966
p00504
C++
// JOI 2012-2013 予選6 #include<algorithm> #include<map> #include<iostream> #include<vector> #include<utility> #include<cstring> typedef std::pair<int, int> P; const int INF = 1 << 30; int H, W, K; char field[50][51]; std::map<std::vector<P>, int> memo[51][51][4]; int rec( int x, int y, int k, std::vector<P>& visited ) { if( k < 0 ) return -INF; std::vector<P> p; for( int i = 0; i != visited.size(); ++i ) if( std::max( x - visited[i].first, 0 ) + std::max( y - visited[i].second, 0 ) <= k ) p.push_back( visited[i] ); std::sort( p.begin(), p.end() ); visited = p; if( memo[x][y][k].count( visited ) ) return memo[x][y][k][visited]; int ret = -INF; if( x == H - 1 && y == W - 1 ) ret = 0; static const int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 }; for( int d = 0; d != 4; ++d ) { int nx = x + dx[d], ny = y + dy[d]; int nk = d >= 2 ? k - 1 : k; if( nx < 0 || nx >= H || ny < 0 || ny >= W || field[nx][ny] == '#' ) continue; int val = 0; std::vector<P> nv = visited; if( !std::binary_search( visited.begin(), visited.end(), P( nx, ny ) ) ) { val = field[ny][nx] - '0'; nv.push_back( P( nx, ny ) ); } ret = std::max( ret, rec( nx, ny, nk, nv ) + val ); } return memo[x][y][k][visited] = ret; } int main() { std::cin >> H >> W >> K; for( int i = 0; i != H; ++i ) { for( int j = 0; j != W; ++j ) { std::cin >> field[i]; if( field[i][j] == '.' ) field[i][j] = '0'; } } std::cout << rec( 0, 0, K, std::vector<P>() ) << std::endl; return 0; }
a.cc: In function 'int main()': a.cc:75:41: error: cannot bind non-const lvalue reference of type 'std::vector<std::pair<int, int> >&' to an rvalue of type 'std::vector<std::pair<int, int> >' 75 | std::cout << rec( 0, 0, K, std::vector<P>() ) << std::endl; | ^~~~~~~~~~~ a.cc:17:47: note: initializing argument 4 of 'int rec(int, int, int, std::vector<std::pair<int, int> >&)' 17 | int rec( int x, int y, int k, std::vector<P>& visited ) | ~~~~~~~~~~~~~~~~^~~~~~~
s417179079
p00505
Java
import java.util.Scanner; public class T1 { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] len_list = new int[3]; int[] triangles = new int[3]; while (true) { for (int i = 0; i < 3; i++){ int len = sc.nextInt(); len_list[i] = len; } // 3辺の長さ int l1 = len_list[0]; int l2 = len_list[1]; int l3 = len_list[2]; // 存在しない場合出力 if (l1 + l2 < l3) { int t1 = triangles[0]; int t2 = triangles[1]; int t3 = triangles[2]; System.out.println(l1+l2+l3+" "+l1+" "+l2+" "+l3); } int s1 = l1 * l1 + l2 * l2; int s2 = l3 * l3; if (s1 > s2) { triangles[0]++; } else { if (s1 == s2) { triangles[1]++; } else { triangles[2]++; } } } } }
Main.java:3: error: class T1 is public, should be declared in a file named T1.java public class T1 { ^ 1 error
s162440945
p00505
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class Main3 { public static void main(String args[]) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String buf; try { int count[] = new int[4]; while (true) { buf = br.readLine(); StringTokenizer st = new StringTokenizer(buf, " "); ArrayList<Integer> e = new ArrayList<Integer>(); for (int i=0;i<3;i++) { e.add(Integer.parseInt(st.nextToken())); } Collections.sort(e); if (e.get(0)+e.get(1)<=e.get(2)) { System.out.println(count[0]+" "+count[1]+" "+count[2]+" "+count[3]); break; } int l = e.get(0)*e.get(0)+e.get(1)*e.get(1); int r = e.get(2)*e.get(2); if (l==r) { count[1]++; } else if (l>r) { count[2]++; } else { count[3]++; } count[0]++; } } catch (Exception e) { e.printStackTrace(); } } }
Main.java:7: error: class Main3 is public, should be declared in a file named Main3.java public class Main3 { ^ 1 error
s805029828
p00505
Java
import java.util.*; class Main{ public static void main(Stinrg[] args){ int over = 0; int count = 0; int under = 0; Scanner sc = new Scanner(System.in); while(true){ String[] str = sc.nextLine().split(" "); //put int sml = Integer.parseInt(str[0]); int mid = Integer.parseInt(str[1]); int lrg = Integer.parseInt(str[2]); //sort while(!(sml<=mid && mid<=lrg)){ if(sml>mid){ int i=sml; sml=mid; mid=i; } if(mid>lrg){ int i=mid; mid=lrg; lrg=i; } } if(lrg>(sml+mid)){ break; }else if(sml*sml + mid*mid==lrg*lrg){ count=+1; }else if(sml*sml+mid*mid<lrg*lrg){ over=+1; }else if(sml*sml+mid*mid>lrg*lrg){ under=+1; } } } }
Main.java:4: error: cannot find symbol public static void main(Stinrg[] args){ ^ symbol: class Stinrg location: class Main 1 error
s848863518
p00505
C
main(){ int a, b, c, s, flag, tri, right, acute, obtuse; tri = 0; right = 0; acute = 0; obtuse = 0; flag = 1; while(flag){ scanf("%d%d%d", &a, &b, &c); if(a >= b){ if(a >= c) {a = a;} else {s = a; a = c; c = s;} } else { if(b >= c) {s = a; a = b; b = s;} else {s = a; a = c; c = s;} } s = (b*b + c*c -a*a) / (2*b*c) if(s == 0) {tri++; right++;} else if(s > 0 && s < 1) {tri++; acute++} else if(s < 0 && s > -1) {tri++; obtuse++} else {flag = 0;} } printf ("%d %d %d %d\n", tri, right, acute, obtuse); return 0; }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){ main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:18:31: error: expected ';' before 'if' 18 | s = (b*b + c*c -a*a) / (2*b*c) | ^ | ; 19 | if(s == 0) {tri++; right++;} | ~~ main.c:25:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 25 | printf ("%d %d %d %d\n", tri, right, acute, obtuse); | ^~~~~~ main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:25:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf'
s224580453
p00505
C
main(){ int a, b, c, s, flag, tri, right, acute, obtuse; tri = 0; right = 0; acute = 0; obtuse = 0; flag = 1; while(flag){ scanf("%d%d%d", &a, &b, &c); if(a >= b){ if(a >= c) {a = a;} else {s = a; a = c; c = s;} } else { if(b >= c) {s = a; a = b; b = s;} else {s = a; a = c; c = s;} } s = (b*b + c*c -a*a) / (2*b*c) if(s == 0) {tri++; right++;} else if(s > 0 && s < 1) {tri++; acute++} else if(s < 0 && s > -1) {tri++; obtuse++} else {flag = 0;} } printf ("%d %d %d %d\n", tri, right, acute, obtuse); return 0; }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){ main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:18:31: error: expected ';' before 'if' 18 | s = (b*b + c*c -a*a) / (2*b*c) | ^ | ; 19 | if(s == 0) {tri++; right++;} | ~~ main.c:25:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 25 | printf ("%d %d %d %d\n", tri, right, acute, obtuse); | ^~~~~~ main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:25:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf'
s208340856
p00505
C
main(){ int a, b, c, s, flag, tri, right, acute, obtuse; tri = 0; right = 0; acute = 0; obtuse = 0; flag = 1; while(flag){ scanf("%d%d%d", &a, &b, &c); if(a >= b){ if(a >= c) {a = a;} else {s = a; a = c; c = s;} } else { if(b >= c) {s = a; a = b; b = s;} else {s = a; a = c; c = s;} } s = (b*b + c*c -a*a) / (2*b*c) if(s == 0) {tri++; right++;} else if(s > 0 && s < 1) {tri++; acute++;} else if(s < 0 && s > -1) {tri++; obtuse++;} else {flag = 0;} } printf ("%d %d %d %d\n", tri, right, acute, obtuse); return 0; }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main(){ main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | scanf("%d%d%d", &a, &b, &c); | ^~~~~ main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:18:31: error: expected ';' before 'if' 18 | s = (b*b + c*c -a*a) / (2*b*c) | ^ | ; 19 | if(s == 0) {tri++; right++;} | ~~ main.c:25:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 25 | printf ("%d %d %d %d\n", tri, right, acute, obtuse); | ^~~~~~ main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:25:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:25:1: note: include '<stdio.h>' or provide a declaration of 'printf'
s789368745
p00505
C
#include <stdio.h> int main(void) { int a, b, c, n, S = 0, A = 0, C = 0, D = 0; for (S = 0; ; ) { scanf("%d %d %d\n", &a, &b, &c); if (a < b) {t = a; a = b; b = t} if (a < c) {t = a; a = c; c = t} if (a > b + c) break; S++; if (a * a < b * b + c * c) A++; else if (a * a == b * b + c * c) C++; else if (a * a > b * b + c * c) D++; } printf("%d %d %d %d\n", S, A, C, D); }
main.c: In function 'main': main.c:9:29: error: 't' undeclared (first use in this function) 9 | if (a < b) {t = a; a = b; b = t} | ^ main.c:9:29: note: each undeclared identifier is reported only once for each function it appears in main.c:9:48: error: expected ';' before '}' token 9 | if (a < b) {t = a; a = b; b = t} | ^ | ; main.c:10:48: error: expected ';' before '}' token 10 | if (a < c) {t = a; a = c; c = t} | ^ | ;
s156103013
p00505
C
#include <stdio.h> int main(void) { int a, b, c, n, t, S = 0, A = 0, C = 0, D = 0; for (S = 0; ; ) { scanf("%d %d %d\n", &a, &b, &c); if (a < b) {t = a; a = b; b = t} if (a < c) {t = a; a = c; c = t} if (a > b + c) break; S++; if (a * a < b * b + c * c) A++; else if (a * a == b * b + c * c) C++; else if (a * a > b * b + c * c) D++; } printf("%d %d %d %d\n", S, A, C, D); }
main.c: In function 'main': main.c:9:48: error: expected ';' before '}' token 9 | if (a < b) {t = a; a = b; b = t} | ^ | ; main.c:10:48: error: expected ';' before '}' token 10 | if (a < c) {t = a; a = c; c = t} | ^ | ;
s401706314
p00505
C
#include <stdio.h> int main() { int a, b, c, t; int sa, sb, sc; sa = sb = sc = 0; while () { scanf("%d%d%d", &a, &b, &c); if (a + b <= c || b + c <= a || c + a <= b) break; if (c < a) t = c, c = a, a = t; if (c < b) t = c, c = b, b = t; t = a*a + b*b; if (c*c == t) sa++; else if (c*c < t) sb++; else sc++; } printf("%d %d %d %d\n", sa+sb+sc, sa, sb, sc); return 0; }
main.c: In function 'main': main.c:9:12: error: expected expression before ')' token 9 | while () { | ^
s294137278
p00505
C
#include <stdio.h> int main() { int a, b, c, t; int sa, sb, sc; sa = sb = sc = 0; while (i) { scanf("%d%d%d", &a, &b, &c); if (a + b <= c || b + c <= a || c + a <= b) break; if (c < a) t = c, c = a, a = t; if (c < b) t = c, c = b, b = t; t = a*a + b*b; if (c*c == t) sa++; else if (c*c < t) sb++; else sc++; } printf("%d %d %d %d\n", sa+sb+sc, sa, sb, sc); return 0; }
main.c: In function 'main': main.c:9:12: error: 'i' undeclared (first use in this function) 9 | while (i) { | ^ main.c:9:12: note: each undeclared identifier is reported only once for each function it appears in
s077167833
p00505
C
#include <stdio.h> int main() { int a, b, c, t; int sa, sb, sc; sa = sb = sc = 0; while (087) { scanf("%d%d%d", &a, &b, &c); if (a + b <= c || b + c <= a || c + a <= b) break; if (c < a) t = c, c = a, a = t; if (c < b) t = c, c = b, b = t; t = a*a + b*b; if (c*c == t) sa++; else if (c*c < t) sb++; else sc++; } printf("%d %d %d %d\n", sa+sb+sc, sa, sb, sc); return 0; }
main.c: In function 'main': main.c:9:12: error: invalid digit "8" in octal constant 9 | while (087) { | ^~~
s951182198
p00505
C
#include <stdio.h> int main() { int a, b, c, t; int sa, sb, sc; sa = sb = sc = 0; while { scanf("%d%d%d", &a, &b, &c); if (a + b <= c || b + c <= a || c + a <= b) break; if (c < a) t = c, c = a, a = t; if (c < b) t = c, c = b, b = t; t = a*a + b*b; if (c*c == t) sa++; else if (c*c < t) sb++; else sc++; } printf("%d %d %d %d\n", sa+sb+sc, sa, sb, sc); return 0; }
main.c: In function 'main': main.c:9:11: error: expected '(' before '{' token 9 | while { | ^ | (
s838888831
p00505
C
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main(){ int a[3],b,c,d,e; b=c=d=e=0; while(scanf("%d %d %d",&a[0],&a[1],&a[2])!=EOF){ sort(a,a+3); if(a[0]+a[1]<=a[2]){ cout << b << " " << c << " " << d << " " << e << endl; return 0; } b++; if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]) c++; if(a[0]*a[0]+a[1]*a[1]>a[2]*a[2]) d++; if(a[0]*a[0]+a[1]*a[1]<a[2]*a[2]) e++; } }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s985450251
p00505
C++
#include<cstdio> int main(void){ int a=0,b=0,c=0; int change=0; int right=0,obtuse=0,acute=0; int value=0,check=0,count=0; int flag=true; while(flag){ count++; scanf("%d%d%d",&a,&b,&c); if(c<a){ change=a; a=c; c=a; } if(c<b){ change=b; a=b; b=a; } check=a+b-c value=a*a+(b*b-c*c); if(check<=0){ break; } if(value==0){ right++; } else if(value<0){ obtuse++; } else{ acute++; } } printf("%d %d %d %d",count,right,obtuse,acute); return 0; }
a.cc: In function 'int main()': a.cc:22:20: error: expected ';' before 'value' 22 | check=a+b-c | ^ | ; 23 | value=a*a+(b*b-c*c); | ~~~~~
s675061857
p00505
C++
#include <bits/stdc++.h> typedef long long LL; using namespace std; int main(){ vector<int> a(3); int cnt[4] = {0, 0, 0, 0}; while (cin >> a[0] >> a[1] >> [2]) { if (a[0] + a[1] > a[2] && a[0] + a[2] > a[1] && a[1] + a[2] > a[0]) { cnt[0] ++; sort(a.begin(), a.end()); if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2]) cnt[1] ++; if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cnt[2] ++; if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2]) cnt[3] ++; } } cout << cnt[0]; cout << " " << cnt[1]; cout << " " << cnt[2]; cout << " " << cnt[3]; cout << endl; }
a.cc: In function 'int main()': a.cc:8:34: error: expected identifier before numeric constant 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc: In lambda function: a.cc:8:36: error: expected '{' before ')' token 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc: In function 'int main()': a.cc:8:30: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'main()::<lambda()>') 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~ ~~~ | | | main()::<lambda()> 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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'void (*)()' 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: after user-defined conversion: 'constexpr main()::<lambda()>::operator void (*)()() const' 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'short int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'short int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'short int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'short unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'short unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'short unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'long int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'long int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'long int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'long unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'long unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'long unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long long int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2
s560487834
p00505
C++
#include <bits/stdc++.h> typedef long long LL; using namespace std; int main(){ vector<int> a(3); int cnt[4] = {0, 0, 0, 0}; while (cin >> a[0] >> a[1] >> [2]) { if (a[0] + a[1] > a[2] && a[0] + a[2] > a[1] && a[1] + a[2] > a[0]) { cnt[0] ++; sort(a.begin(), a.end()); if (a[0] * a[0] + a[1] * a[1] > a[2] * a[2]) cnt[1] ++; if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) cnt[2] ++; if (a[0] * a[0] + a[1] * a[1] < a[2] * a[2]) cnt[3] ++; } } cout << cnt[0]; cout << " " << cnt[1]; cout << " " << cnt[2]; cout << " " << cnt[3]; cout << endl; }
a.cc: In function 'int main()': a.cc:8:34: error: expected identifier before numeric constant 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc: In lambda function: a.cc:8:36: error: expected '{' before ')' token 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc: In function 'int main()': a.cc:8:30: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'main()::<lambda()>') 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~ ~~~ | | | main()::<lambda()> 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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'void (*)()' 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: after user-defined conversion: 'constexpr main()::<lambda()>::operator void (*)()() const' 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ /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>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'short int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'short int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'short int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'short unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'short unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'short unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'short unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'long int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'long int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'long int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long unsigned int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^ a.cc:8:33: note: no known conversion from 'void (*)()' to 'long unsigned int' a.cc:8:33: error: invalid conversion from 'void (*)()' to 'long unsigned int' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ | | | void (*)() a.cc:8:33: error: conversion to non-const reference type 'long unsigned int&' from rvalue of type 'void (*)()' [-fpermissive] /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>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:8:33: error: invalid user-defined conversion from 'main()::<lambda()>' to 'long long int&' [-fpermissive] 8 | while (cin >> a[0] >> a[1] >> [2]) { | ^~~ a.cc:8:33: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match) 8 | while (cin >> a[0] >> a[1] >> [2
s880563024
p00505
C++
#include<iostream> using namespace std; int out[4] = {0}; int main() { int l[3]; while( cin >> l[0] >> l[1] >> l[2] ) { sort(l, l+3); if ( l[2] > l[0] + l[1] ) break; out[0]++; if ( l[2] * l[2] == l[0] * l[0] + l[1] * l[1] ) out[1]++; if ( l[2] * l[2] < l[0] * l[0] + l[1] * l[1] ) out[2]++; if ( l[2] * l[2] > l[0] * l[0] + l[1] * l[1] ) out[3]++; } cout << out[0] << " " << out[1] << " " << out[2] << " " << out[3] << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:1: error: 'sort' was not declared in this scope; did you mean 'short'? 9 | sort(l, l+3); | ^~~~ | short
s502933613
p00505
C++
#include<iostream> #include<vector> using namespace std; int Solve(int a,int b,int c){ if(c*c < a*a+b*b )return 1; if(c*c == a*a+b*b)return 0; else return 2; } int main(){ int sum[]={0,0,0}; vector< int > a(3); while(cin>>a[0]>>a[1]>>a[2]){ sort(a.begin(),a.end()); if(a[0]+a[1] > a[2]){ sum[ Solve(a[0],a[1],a[2]) ] ++; } else{ break; } } cout << sum[0]+sum[1]+sum[2] << ' ' << sum[0] << ' ' << sum[1] << ' ' << sum[2] << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'? 19 | sort(a.begin(),a.end()); | ^~~~ | short
s499338137
p00505
C++
#include <iostream> using namespace std; int main() { int a, b, c; int tri=0, sharp=0, obtuse=0, right=0; while(cin>>a>>b>>c) { int temp = max({a, b, c}); if(temp==b) { swap(a, b); } else if(temp==c) { swap(a, c); } if(a>=b+c) break; tri++; int d = b*b+c*c-a*a; if(d==0) right++; else if(d>0) sharp++; else obtuse++; } cout << tri << ' ' << right << ' ' << sharp << ' ' << obtuse << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:8:23: error: no matching function for call to 'max(<brace-enclosed initializer list>)' 8 | int temp = max({a, b, c}); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
s435175624
p00505
C++
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s805318532
p00505
C++
#input_f = "3 4 5\n2 1 2\n6 3 4\n1 1 1\n1 2 3" def t_check(a,b,c): if a + b > c: if b + c > a: if a + c > b: return True return False def f_check(a_, b_, c_): tmp = [] tmp.append(a_) tmp.append(b_) tmp.append(c_) sqrts = [] for i in range(3): sqrts.append(tmp[i]**2) m = max(sqrts) s = sum(sqrts) if m == (s - m): return(0) if m > (s - m): return(2) if m < (s - m): return(1) counter=[0,0,0] while(1): input_f = input() t = input_f.split("\n")[i].split() fn, sn, tn = int(t[0]),int(t[1]),int(t[2]) if t_check(fn,sn,tn): counter[f_check(fn,sn,tn)] += 1 else: break print(sum(counter),counter[0], counter[1], counter[2])
a.cc:1:2: error: invalid preprocessing directive #input_f 1 | #input_f = "3 4 5\n2 1 2\n6 3 4\n1 1 1\n1 2 3" | ^~~~~~~ a.cc:2:1: error: 'def' does not name a type 2 | def t_check(a,b,c): | ^~~
s675762924
p00505
C++
#include<bits/stdc++.h> #include <stdio.h> #include<iostream.h> #include<algorithm> using namespace std; int main() { int a,b,c,right,obtuse,acute,tri; cin >> a,b,c; right,obtuse,acute,tri = 0; int sides[3] = {a,b,c}; sort(sides[0],sides[2]); while (sides[2]<sides[0]+sides[1]) { if (sides[2]*sides[2] == sides[0]*sides[0]+sides[1]*sides[1]) { tri += 1; right += 1; } else if (sides[2]*sides[2] > sides[0]*sides[0]+sides[1]*sides[1]) { tri += 1; obtuse += 1; } else { tri += 1; acute += 1; } } { printf("%d %d %d %d",tri,right,obtuse,acute); } }
a.cc:3:9: fatal error: iostream.h: No such file or directory 3 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s789549109
p00505
C++
#include <iostream> #include<algorithm> intp[3] using namespace std; int main() { int a=0,b=0,c=0,d=0; while (~scanf("%d%d%d",p,p+1,p+2)) { std::sort(p,p+3); if(p[0]+p[1]<=p[2]) { printf("%d %d %d %d¥n",a,b,c,d); return 0; } a ++ if(p[0]*p[0]+p[1]*p[1]==p[2]*)p[2])b++; if(p[0]*p[0]+p[1]*p[1]>p[2]*)p[2])c++; if(p[0]*p[0]+p[1]*p[1]<p[2]*)p[2])d++; } }
a.cc:3:1: error: 'intp' does not name a type; did you mean 'int'? 3 | intp[3] | ^~~~ | int a.cc: In function 'int main()': a.cc:8:32: error: 'p' was not declared in this scope 8 | while (~scanf("%d%d%d",p,p+1,p+2)) | ^ a.cc:16:21: error: expected ';' before 'if' 16 | a ++ | ^ | ; 17 | if(p[0]*p[0]+p[1]*p[1]==p[2]*)p[2])b++; | ~~ a.cc:18:45: error: expected primary-expression before ')' token 18 | if(p[0]*p[0]+p[1]*p[1]>p[2]*)p[2])c++; | ^ a.cc:19:45: error: expected primary-expression before ')' token 19 | if(p[0]*p[0]+p[1]*p[1]<p[2]*)p[2])d++; | ^
s423118081
p00505
C++
#include <stdio.h> #include <iostream.h> const MAX = 10000; int a[MAX]; BOOL IsRightAngle(int a, int b, int c){ if(a*a == b*b + c*c) return TRUE; if(b*b == a*a + c*c) return TRUE; if(c*c == a*a + b*b) return TRUE; return FALSE; } BOOL IsOBTUSE(int a, int b, int c){ if(a*a > b*b + c*c) return TRUE; if(b*b > a*a + c*c) return TRUE; if(c*c > b*b + a*a) return TRUE; return FALSE; } BOOL IsTriangle(int a, int b, int c){ if(a+b > c) return TRUE; if(a+c > b) return TRUE; if(c+b > a) return TRUE; return FALSE; } void main(){ for(int i = 0; i<MAX; i++){ scanf( "%d" ,&a[i]): } int j = 0;] int tri = 0; int right = 0; int obtuse = 0; int acute = 0; for(;;){ if( !IsTriangle(a[j],a[j+1],a[j+2]) ){ break; } if( IsOBTUSE(a[j],a[j+1],a[j+2]) ){ obtuse++; tri++; } else if(IsRightAngle(a[j],a[j+1],a[j+2]) ){ right++; tri++; } else{ acute++; tri++; } j += 3; } printf("%d %d %d %d\n",tri,right,acute,obtuse); }
a.cc:2:10: fatal error: iostream.h: No such file or directory 2 | #include <iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s146280100
p00505
C++
#include <stdio.h> #include <iostream.h> const MAX = 10000; int a[MAX]; BOOL IsRightAngle(int a, int b, int c){ if(a*a == b*b + c*c) return TRUE; if(b*b == a*a + c*c) return TRUE; if(c*c == a*a + b*b) return TRUE; return FALSE; } BOOL IsOBTUSE(int a, int b, int c){ if(a*a > b*b + c*c) return TRUE; if(b*b > a*a + c*c) return TRUE; if(c*c > b*b + a*a) return TRUE; return FALSE; } BOOL IsTriangle(int a, int b, int c){ if(a+b > c) return TRUE; if(a+c > b) return TRUE; if(c+b > a) return TRUE; return FALSE; } void main(){ for(int i = 0; i<MAX; i++){ scanf( "%d" ,&a[i]): } int j = 0;] int tri = 0; int right = 0; int obtuse = 0; int acute = 0; for(;;){ if( !IsTriangle(a[j],a[j+1],a[j+2]) ){ break; } if( IsOBTUSE(a[j],a[j+1],a[j+2]) ){ obtuse++; tri++; } else if(IsRightAngle(a[j],a[j+1],a[j+2]) ){ right++; tri++; } else{ acute++; tri++; } j += 3; } printf("%d %d %d %d\n",tri,right,acute,obtuse); }
a.cc:2:10: fatal error: iostream.h: No such file or directory 2 | #include <iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s172065306
p00505
C++
#include <iostream> using namespace std; int main(){ int a,b,c; int s,c,e,d; s = c = e = d = 0; while(1){ cin >> a >> b >> c; if(a==0) break; s++; a=a*a; b=b*b; c=c*c; int hantei; if(a>b){ if(a>c){ hantei=a-b-c; }else{ hantei=c-a-b; } }else{ if(b>c){ hantei=b-a-c; }else{ hantei=c-a-b; } } if(hantei>0){ d++; }else if(hantei<0){ e++; }else{ c++; } } cout << s << " " << c << " " << e << " " << d << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:11: error: redeclaration of 'int c' 7 | int s,c,e,d; | ^ a.cc:6:13: note: 'int c' previously declared here 6 | int a,b,c; | ^
s844078044
p00505
C++
ans = [0 for i in range(4)] while True: sides = sorted([int(inp) for inp in input().split()]) if sides[2] >= sides[1] + sides[0]: print(ans[0], ans[1], ans[2], ans[3]) break if sides[2]**2 > sides[1]**2 + sides[0]**2: ans[3]+=1 elif sides[2]**2 == sides[1]**2 + sides[0]**2: ans[1]+=1 else: ans[2]+=1 ans[0]+=1
a.cc:1:1: error: 'ans' does not name a type 1 | ans = [0 for i in range(4)] | ^~~
s674598590
p00505
C++
#include<iostream> #include<cmath> #include<algorithm> using namespace std; int main() { int Length[3]; int Triangle[4] = {}; bool flag = 0; while( cin >> Length[0] >> Length[1] >> Length[2]) ) { sort(Length, Length+3); if( Length[0] + Length[1] <= Length[2] ) flag = 1; if(flag == 1) continue; if( pow(Length[0], 2) + pow(Length[1], 2) == pow(Length[2], 2) ) Triangle[1]++; else if( pow(Length[0], 2) + pow(Length[1], 2) < pow(Length[2], 2) ) Triangle[2]++; else Triangle[3]++; } Triangle[0] += ( Triangle[1] + Triangle[2] + Triangle[3] ); cout << Triangle[0] << " " << Triangle[1] << " " << Triangle[2] << " " << Triangle[3] << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:13:60: error: expected primary-expression before ')' token 13 | while( cin >> Length[0] >> Length[1] >> Length[2]) ) { | ^
s913818649
p00505
C++
#include <iostream> using namespace std; bool exist(int a,int b,int c){ bool flag=false; if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true; return flag; } int type_check(int a,int b,int c){ if(a*a+b*b==c*c)return 0; else if(c*c<b*b+a*a)return 1; else if(c*c>a*a+b*b)return 2; else return 3; } int main(){ //1:直角 2:鋭角 3: 鈍角 4:三角形 int c1=0,c2=0,c3=0,c4=0; int t_side[3]; while(true){ cin >> t_side[0]>>t_side[1]>>t_side[2]; sort(t_side, t_side + 3, greater<int>()); if(!exist(t_side[0],t_side[1],t_side[2]))break; switch(type_check(t_side[0],t_side[1],t_side[2])){ case 0: c1++; break; case 1: c2++; break; case 2: c3++; break; } c4++; } cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl; return 0; }
a.cc: In function 'int main()': a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'? 22 | sort(t_side, t_side + 3, greater<int>()); | ^~~~ | short
s406942531
p00505
C++
#include <iostream> using namespace std; bool exist(int a,int b,int c){ bool flag=false; if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true; return flag; } int type_check(int a,int b,int c){ if(a*a+b*b==c*c)return 0; else if(c*c<b*b+a*a)return 1; else if(c*c>a*a+b*b)return 2; else return 3; } int main(){ int c1=0,c2=0,c3=0,c4=0; int t_side[3]; while(true){ cin >> t_side[0]>>t_side[1]>>t_side[2]; sort(t_side, t_side + 3, greater<int>()); if(!exist(t_side[0],t_side[1],t_side[2]))break; switch(type_check(t_side[0],t_side[1],t_side[2])){ case 0: c1++; break; case 1: c2++; break; case 2: c3++; break; } c4++; } cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'sort' was not declared in this scope; did you mean 'short'? 21 | sort(t_side, t_side + 3, greater<int>()); | ^~~~ | short
s121133323
p00505
C++
#include <iostream> using namespace std; bool exist(int a,int b,int c){ bool flag=false; if(a>0&&b>0&&c>0&&a+b>c&&a+c>b&&c+b>a)flag=true; return flag; } int type_check(int a,int b,int c){ if(a*a==c*c+b*b)return 0; else if(a*a<b*b+c*c)return 1; else if(a*a>c*c+b*b)return 2; else return 3; } int main(){ int c1=0,c2=0,c3=0,c4=0; int t_side[3]; while(true){ cin >> t_side[0]>>t_side[1]>>t_side[2]; sort(t_side, t_side + 3, greater<int>()); if(!exist(t_side[0],t_side[1],t_side[2]))break; switch(type_check(t_side[0],t_side[1],t_side[2])){ case 0: c1++; break; case 1: c2++; break; case 2: c3++; break; } c4++; } cout <<c4<<" "<<c1<<" "<<c2<<" "<<c3<<endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'sort' was not declared in this scope; did you mean 'short'? 21 | sort(t_side, t_side + 3, greater<int>()); | ^~~~ | short
s273710737
p00505
C++
include <iostream> #include <algorithm> using namespace std; int main(){ int cyo=0; int don=0; int ei=0; int count=0; for(int i=0;i<100;i++){ int t[3]; cin>>t[0]>>t[1]>>t[2]; sort(t,t+3); if(t[0]+t[1]<=t[2])break; else { count++; t[0]=t[0]*t[0]; t[1]=t[1]*t[1]; t[2]=t[2]*t[2]; if(t[0]+t[1]==t[2])cyo++; if(t[0]+t[1]<t[2])ei++; if(t[0]+t[1]>t[2])don++; } } cout<<count<<" "<<cyo<<" "<<don<<" "<<ei<<endl; }
a.cc:1:1: error: 'include' does not name a type 1 | include <iostream> | ^~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
s930610620
p00505
C++
#include <stdio.h> #include <algorithm> int main(){ int inp[3], tyoku = 0, don = 0, ei = 0; for (int i = 0; i < 5; i++){ scanf("%d %d %d",&inp[0], &inp[1], &inp[2]); sort(inp, inp + 3); if(inp[0] + inp[1] > inp[2]){ int p = inp[0]*inp[0] + inp[1]*inp[1]; int q = inp[2]*inp[2]; if(p == q) tyoku++; else if(p < q) don++; else ei++; } } printf("%d %d %d %d¥n", tyoku +don +ei, tyoku,ei,don); return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'sort' was not declared in this scope; did you mean 'std::sort'? 8 | sort(inp, inp + 3); | ^~~~ | std::sort In file included from /usr/include/c++/14/algorithm:86, from a.cc:2: /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~
s333996424
p00505
C++
package main // 三角形の形は辺の長さで決まる. 順番に3つの正整数が与えられたとき, 辺の長さがそれらの値と一致する三角形が存在するかどうかを調べ, // 存在するなら鋭角三角形,直角三角形,鈍角三角形のいずれかを判定し, 次の入力へ進む. 三角形が存在しないとき, それまでに入力された, // 三角形,直角三角形,鋭角三角形,鈍角三角形の 個数を空白で区切って出力し, それ以降の入力は無視して終了する // 入力の中には必ず三角形が存在しないようなものがある と仮定してよい. 入力の行数は判らないが各行には3つの正整数が空白で区切って書かれている. // ただし,各整数は100 以下とする. // return // 三角形 直角三角形 鈍角三角形 鈍角三角形 import ( "os" "fmt" "bufio" ) var sc = bufio.NewScanner(os.Stdin) func max(a, b, c int) (int, int, int) { if a > b { if b > c { return a, b, c } else { return a, c, b } } else { if a > c { return b, a, c } else { return b, c, a } } } func find_trianges(a, b, c int) string { a, b, c = max(a, b, c) r := b*b + c*c if a*a > r { return "obtuse_triangle" } else if a*a < r { return "sharped_triangle" } else { return "right_triangle" } } func main() { s := bufio.NewScanner(os.Stdin) var t, r_t, s_t, o_t int = 0, 0, 0, 0 for s.Scan() { var a, b, c int fmt.Sscan(s.Text(), &a, &b, &c) a, b, c = max(a, b, c) if (a < b + c) { r := find_trianges(a, b, c) switch r { case "right_triangle": r_t++ case "sharped_triangle": s_t++ case "obtuse_triangle": o_t++ } t++ } else { break } } fmt.Println(t, r_t, s_t, o_t) }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~ a.cc:35:1: error: 'func' does not name a type 35 | func find_trianges(a, b, c int) string { | ^~~~ a.cc:47:1: error: 'func' does not name a type 47 | func main() { | ^~~~
s016786183
p00506
C
#include<stdio.h> int main() { int i,a[3],max,n,; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&a[i]); max=a[0]; if(max<a[1])max==a[1]; if(max<a[2]&&n==3)max=a[2]; for(i=0;i<max;i++){ if(n==2){ if(a[0]%i==0&&a[1]%i==0)printf("%d",i); } else if(n==3){ if(a[0]%i==0&&a[1]%i==0&&a[2]%i==0)printf("%d",i); } } return 0; }
main.c: In function 'main': main.c:4:20: error: expected identifier or '(' before ';' token 4 | int i,a[3],max,n,; | ^
s909046591
p00506
C++
#include <vector> #include <iostream> #include <algorithm> using namespace std; template <class Type> Type GCD(Type a, Type b) { if (a % b == 0) { return b; } if (b % a == 0) { return a; } if (a > b) { return gcd(b, a % b); } if (a < b) { return gcd(a, b % a); } return (Type)(-1); } template <class Type> Type GCD(vector<Type> v) { Type ret = v[0]; for (int i = 1; i < v.size(); i++) { ret = GCD(ret, v[i]); } return ret; } template <class Type> vector<Type> Divisors(Type n) { vector<int> c; for (Type i = 1; i * i <= n; i++) { if (n % c == 0) { c.push_back(i); if (i * i != n) { c.push_back(n / i); } } } sort(c.begin(), c.end()); return c; } int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<int> c = Divisors(GCD(v)); for (int i = 0; i < c.size(); i++) { cout << c[i] << endl; } return 0; }
a.cc: In instantiation of 'std::vector<Type> Divisors(Type) [with Type = int]': a.cc:57:26: required from here 57 | vector<int> c = Divisors(GCD(v)); | ~~~~~~~~^~~~~~~~ a.cc:36:23: error: no match for 'operator%' (operand types are 'int' and 'std::vector<int>') 36 | if (n % c == 0) { c.push_back(i); if (i * i != n) { c.push_back(n / i); } } | ~~^~~ a.cc: In instantiation of 'Type GCD(Type, Type) [with Type = int]': a.cc:24:12: required from 'Type GCD(std::vector<Type>) [with Type = int]' 24 | ret = GCD(ret, v[i]); | ~~~^~~~~~~~~~~ a.cc:57:30: required from here 57 | vector<int> c = Divisors(GCD(v)); | ~~~^~~ a.cc:12:32: error: 'gcd' was not declared in this scope 12 | if (a > b) { return gcd(b, a % b); } | ~~~^~~~~~~~~~ a.cc:13:32: error: 'gcd' was not declared in this scope 13 | if (a < b) { return gcd(a, b % a); } | ~~~^~~~~~~~~~
s983920281
p00506
C++
#include <vector> #include <iostream> #include <algorithm> using namespace std; template <class Type> Type GCD(Type a, Type b) { if (a % b == 0) { return b; } if (b % a == 0) { return a; } if (a > b) { return GCD(b, a % b); } if (a < b) { return GCD(a, b % a); } return (Type)(-1); } template <class Type> Type GCD(vector<Type> v) { Type ret = v[0]; for (int i = 1; i < v.size(); i++) { ret = GCD(ret, v[i]); } return ret; } template <class Type> vector<Type> Divisors(Type n) { vector<int> c; for (Type i = 1; i * i <= n; i++) { if (n % c == 0) { c.push_back(i); if (i * i != n) { c.push_back(n / i); } } } sort(c.begin(), c.end()); return c; } int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<int> c = Divisors(GCD(v)); for (int i = 0; i < c.size(); i++) { cout << c[i] << endl; } return 0; }
a.cc: In instantiation of 'std::vector<Type> Divisors(Type) [with Type = int]': a.cc:57:26: required from here 57 | vector<int> c = Divisors(GCD(v)); | ~~~~~~~~^~~~~~~~ a.cc:36:23: error: no match for 'operator%' (operand types are 'int' and 'std::vector<int>') 36 | if (n % c == 0) { c.push_back(i); if (i * i != n) { c.push_back(n / i); } } | ~~^~~
s880769923
p00506
C++
#include<iostream> using namespace std; int n, a[10000], p; void yakusuu(int p) { int cnt = 0; for (int i = 1; i <= p; i++) { if (p%i == 0) { if (cnt) { cout << ' '; } cout << i; } } cout << endl; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 1; i < n; i++) { p = __gcd(a[i - 1], a[i]); } yakusuu(); return 0; }
a.cc: In function 'int main()': a.cc:21:21: error: '__gcd' was not declared in this scope 21 | p = __gcd(a[i - 1], a[i]); | ^~~~~ a.cc:23:16: error: too few arguments to function 'void yakusuu(int)' 23 | yakusuu(); | ~~~~~~~^~ a.cc:5:6: note: declared here 5 | void yakusuu(int p) { | ^~~~~~~
s230379892
p00506
C++
#include<iostream> using namespace std; int n, a[10000], p; void yakusuu(int p) { int cnt = 0; for (int i = 1; i <= p; i++) { if (p%i == 0) { if (cnt) { cout << ' '; } cout << i; } } cout << endl; } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } p = a[0]; for (int i = 1; i < n; i++) { p = __gcd(p, a[i]); } yakusuu(p); return 0; }
a.cc: In function 'int main()': a.cc:22:21: error: '__gcd' was not declared in this scope 22 | p = __gcd(p, a[i]); | ^~~~~
s643119728
p00506
C++
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n) - 1; i >= 0; i--) #define sz(obj) ((int)(obj).size()) #define pf push_front #define pb push_back int main() { int n; cin >> n; int a[3] = {0}; REP(i, n) cin >> a[i]; if (n == 2){ FOR(i, 1, min(a[0], a[1]) + 1){ if (a[0] % i == 0 && a[1] % i == 0) cout << i << endl; } } else { FOR(i, 1, min(min(a[0], a[1]), a[2]) + 1){ if (a[0] % i == 0 && a[1] % i == 0 && a[2] % i == 0) cout << i << endl; } } }#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n) - 1; i >= 0; i--) #define sz(obj) ((int)(obj).size()) #define pf push_front #define pb push_back int main() { int n; cin >> n; int a[3] = {0}; REP(i, n) cin >> a[i]; if (n == 2){ FOR(i, 1, min(a[0], a[1]) + 1){ if (a[0] % i == 0 && a[1] % i == 0) cout << i << endl; } } else { FOR(i, 1, min(min(a[0], a[1]), a[2]) + 1){ if (a[0] % i == 0 && a[1] % i == 0 && a[2] % i == 0) cout << i << endl; } } }
a.cc:27:2: error: stray '#' in program 27 | }#include <bits/stdc++.h> | ^ a.cc:27:3: error: 'include' does not name a type 27 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:37:5: error: redefinition of 'int main()' 37 | int main() | ^~~~ a.cc:11:5: note: 'int main()' previously defined here 11 | int main() | ^~~~
s404566847
p00506
C++
#include "bits/stdc++.h" #include<unordered_map> #include<unordered_set> #pragma warning(disable:4996) using namespace std; using ld = long double; template<class T> using Table = vector<vector<T>>; const ld eps=1e-9; vector<long long int> divisor(long long int n) { vector<long long int> res; for (long long int i = 1; i * i <= n; ++i) { if (n % i == 0) { res.push_back(i); if (i * i != n) res.push_back(n / i); } } sort(begin(res), end(res)); return res; } long long int gcd(long long int l, long long int r) { if (l > r)return gcd(r, l); else { if (r%l) { return gcd(l, r%l); } else { return l; } } } int main() { int N; cin >> N; vector<long long int>ns(N); for (int i = 0; i < N; ++i) { cin >> ns[i]; } long long int a = gcd(ns[0], ns[1]; if (N == 3) { a = gcd(a, ns[2]); } auto v(divisor(a)); for (auto n : v) { cout << n << endl; } return 0; }
a.cc: In function 'int main()': a.cc:40:44: error: expected ')' before ';' token 40 | long long int a = gcd(ns[0], ns[1]; | ~ ^ | )
s708187864
p00506
C++
#include<iostream> using namespace std; int gcd(int a,int b){ if(a==0) return b; return gcd(b,a%b); } int main(){ int n,a,b,c; cin >> n; if(n == 2){ cin >> a >> b; cout << gcb(a,b) << endl; } else{ cin >> a >> b >> c; cout << gcb(a,gcb(b,c)) << endl; } return 0; }
a.cc: In function 'int main()': a.cc:18:15: error: 'gcb' was not declared in this scope; did you mean 'gcd'? 18 | cout << gcb(a,b) << endl; | ^~~ | gcd a.cc:22:21: error: 'gcb' was not declared in this scope; did you mean 'gcd'? 22 | cout << gcb(a,gcb(b,c)) << endl; | ^~~ | gcd a.cc:22:15: error: 'gcb' was not declared in this scope; did you mean 'gcd'? 22 | cout << gcb(a,gcb(b,c)) << endl; | ^~~ | gcd
s643500187
p00506
C++
#include <iostream> using namespace std; void sort(int *val, int n) { for (int i = n - 1; i > 0; i--) { for (int j = 0; j < i; j++) { if (val[i] < val[j]) swap(val[i], val[j]); } } } bool judge(int *val, int n, int num) { for (int i = 0; i < n; i++) { if (val[i] % num != 0) return false; } return true; } int main() { int n, i, k, harf, count; int val[3], div[10000]; cin >> n; for (i = 0; i < n; i++) cin >> val[i]; sort(val, n); harf = (int)sqrt(val[0]); div[0] = count = 1; for (i = 2; i < harf; i++) { if (val[0] % i == 0) div[count++] = i; } cout << 1 << endl; for (i = 1; i < count; i++) { if (judge(&val[1], n - 1, div[i])) cout << div[i] << endl; } for (i = count - 1; i >= 0; i--) { k = (int)(val[0] / div[i]); if (judge(&val[1], n - 1, k)) cout << k << endl; } return 0; }
a.cc: In function 'int main()': a.cc:29:21: error: 'sqrt' was not declared in this scope; did you mean 'sort'? 29 | harf = (int)sqrt(val[0]); | ^~~~ | sort
s957328845
p00506
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> #include <bitset> #include <cstring> #include <deque> #include <iomanip> #include <limits> #include <fstream> using namespace std; #define FOR(I,A,B) for(int I = (A); I < (B); ++I) #define CLR(mat) memset(mat, 0, sizeof(mat)) typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; map<int, int> MAP; FOR(i,0,n){ int a;cin>>a; for(int j = 1; j * j <= a; j++){ if(a % j == 0) { MAP[j]++; if(j != a / j) MAP[a/j]++; } } } for(int m : MAP){ if(m.second > 1) { cout << m.first << endl; } } }
a.cc: In function 'int main()': a.cc:40:15: error: cannot convert 'std::pair<const int, int>' to 'int' in initialization 40 | for(int m : MAP){ | ^~~ a.cc:41:12: error: request for member 'second' in 'm', which is of non-class type 'int' 41 | if(m.second > 1) { | ^~~~~~ a.cc:42:21: error: request for member 'first' in 'm', which is of non-class type 'int' 42 | cout << m.first << endl; | ^~~~~
s686430881
p00506
C++
#include<iostream> #include<algorithm> int main(void) { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } for(int i=1; i<=min; i++){ if(a[0]%i==0 && a[1]%i==0 && a[2]%i==0) cout<<i<<endl } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 22 | cout<<i<<endl | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:22:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 22 | cout<<i<<endl | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s142348361
p00506
C++
#include<iostream> #include<algorithm> int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } for(int i=1; i<=min; i++){ if(a[0]%i==0 && a[1]%i==0 && a[2]%i==0) cout<<i<<endl } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:22:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 22 | cout<<i<<endl | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:22:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 22 | cout<<i<<endl | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s073865497
p00506
C++
#include<iostream> #include<algorithm> int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } if(n==2){ a[2]=a[1]; } for(int i=1; i<=min; i++){ if(a[1]%i==0 && a[2]%i==0 && a[3]%i==0){ cout << i <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 25 | cout << i <<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 25 | cout << i <<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s539484758
p00506
C++
#include<iostream> #include<algorithm> int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } if(n==2){ a[2]=a[1]; } for(int i=1; i<=min; i++){ if((a[1]%i)==0 && (a[2]%i)==0 && (a[3]%i)==0){ cout << i <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 25 | cout << i <<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 25 | cout << i <<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s739590382
p00506
C++
#include<iostream> #include<algorithm> int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } if(n==2){ a[2]=a[1]; } for(int i=1; i<=min; i++){ if((a[0]%i)==0 && (a[1]%i)==0 && (a[2]%i)==0){ cout << i <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin>>n; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:25:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 25 | cout << i <<endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 25 | cout << i <<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~ a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s899213638
p00506
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } if(n==2){ a[2]=a[1]; } for(int i=1; i<=min; i++){ if((a[0]%i)==0 && (a[1]%i)==0 && (a[2]%i)==0){ cout << i <<endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:2: error: expected '}' at end of input 30 | } | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s097571480
p00506
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int n, a[3], min ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; } min=a[0]; for(int i=0; i<=n; i++){ if(min >= a[i]) min = a[i]; } } for(int i=1;i<=min;i++){ bool dotti=true; for(int j=0;j<n;j++){ if(a[j] % i != 0) dotti = false; } if(dotti == true) cout << i << endl; } return 0; }
a.cc:21:3: error: expected unqualified-id before 'for' 21 | for(int i=1;i<=min;i++){ | ^~~ a.cc:21:15: error: 'i' does not name a type 21 | for(int i=1;i<=min;i++){ | ^ a.cc:21:22: error: 'i' does not name a type 21 | for(int i=1;i<=min;i++){ | ^ a.cc:30:1: error: expected unqualified-id before 'return' 30 | return 0; | ^~~~~~ a.cc:31:1: error: expected declaration before '}' token 31 | } | ^
s484582892
p00506
C++
#include<iostream> #include<algorithm> using namespace std; int main() { int n, a[3], max=0 ; cin>>n; for(int i=0; i<=n; i++){ cin>>a[i]; if(max<=a[i]) max=a[i]; } } for(int i=1;i<=max;i++){ bool dotti=true; for(int j=0;j<n;j++){ if(a[j] % i != 0) dotti = false; } if(dotti == true) cout << i << endl; } return 0; }
a.cc:18:3: error: expected unqualified-id before 'for' 18 | for(int i=1;i<=max;i++){ | ^~~ a.cc:18:15: error: 'i' does not name a type 18 | for(int i=1;i<=max;i++){ | ^ a.cc:18:22: error: 'i' does not name a type 18 | for(int i=1;i<=max;i++){ | ^ a.cc:27:1: error: expected unqualified-id before 'return' 27 | return 0; | ^~~~~~ a.cc:28:1: error: expected declaration before '}' token 28 | } | ^
s866590445
p00506
C++
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <queue> #include <map> #include <set> #include <stack> #include <cstring> #define FOR(i, a, b) for(int i = (a); i < (b); i++) #define rep(i, n) for(int i = 0; i < (n); i++) #define MP make_pair #define X first #define Y second #define all(v) v.begin(), v.end() #define rev(v) v.rbegin(), v.rend() using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> P; const int INF = 1<<29; int gcd(int m, int n){ return (n==0?m:gcd(n, m%n)); } int main(){ int n, a, b; cin >> n >> a; rep(i, n-1){ cin >> b; a = gcd(a, b); } vector<int> ans; FOR(i, 1, sqrt(1.*a)+1){ if(a%i == 0){ ans.push_back(i); ans.push_back(a/i); } } sort(all(ans)); ans.erase(unique(all(ans)), ans.end()); rep(i, ans.size()){ cout << ans[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:40:19: error: 'sqrt' was not declared in this scope 40 | FOR(i, 1, sqrt(1.*a)+1){ | ^~~~ a.cc:11:44: note: in definition of macro 'FOR' 11 | #define FOR(i, a, b) for(int i = (a); i < (b); i++) | ^
s068196746
p00506
C++
#include<iostream> using namespace std; unsigned long long int i, num[3]; int n; int main(){ cin >> n; for(i=0;i<n;i++){ cin >> num[i]; } fin = max(num[0], num[1], num[2]); if(n==2){ for(i=0;i<fin;i++){ if(!(num[0]%i) && !(num[1]%i)){ cout << i << endl; } } } if(n==3){ for(i=0;i<fin;i++){ if(!(num[0]%i) && !(num[1]%i) && !(num[2]%i)){ cout << i << endl; } } } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: 'fin' was not declared in this scope 15 | fin = max(num[0], num[1], num[2]); | ^~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long unsigned int; _Compare = long long unsigned int]': a.cc:15:11: required from here 15 | fin = max(num[0], num[1], num[2]); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~
s895928182
p00506
C++
#include<algorithm> using namespace std; int main() { int n; for(;cin>>n;) { int data[n]; int dmax=0; for(int i=0;i<n;i++) { cin>>data[i]; dmax=max(dmax,data[i]); } for(int i=1;i<=dmax/2;i++) { bool flag=true; for(int j=0;j<n;j++) { if(data[j]%i!=0) { flag=false; break; } } if(flag) cout<<i<<endl; } } }
a.cc: In function 'int main()': a.cc:7:8: error: 'cin' was not declared in this scope 7 | for(;cin>>n;) | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include<algorithm> +++ |+#include <iostream> 2 | using namespace std; a.cc:28:13: error: 'cout' was not declared in this scope 28 | cout<<i<<endl; | ^~~~ a.cc:28:13: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:28:22: error: 'endl' was not declared in this scope 28 | cout<<i<<endl; | ^~~~ a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 1 | #include<algorithm> +++ |+#include <ostream> 2 | using namespace std;
s393110038
p00507
Java
import java.lang.reflect.Array; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n+1]; for(int i=1;i<=n;i++){ a[i] = sc.nextInt(); } LinkedList<Integer> ts = new LinkedList<Integer>(); for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==j)continue; String str = String.valueOf(a[i])+String.valueOf(a[j]); ts.add(Integer.parseInt(str)); } } ts.sort(); ts.pollFirst(); ts.pollFirst(); System.out.println(ts.pollFirst()); } }
Main.java:22: error: method sort in interface List<E> cannot be applied to given types; ts.sort(); ^ required: Comparator<? super Integer> found: no arguments reason: actual and formal argument lists differ in length where E is a type-variable: E extends Object declared in interface List 1 error
s479385066
p00507
Java
import java.util.Scanner public class Main{ public static void main(Strin[] args){ Scanner sc = new Scanner(System.in); int n = sc.next(); int min=Math.min(4, n); int[] list = new int[min]; for (int i = 0; i < min; i++) { list[I] = sc.nextInt(); } } }
Main.java:1: error: ';' expected import java.util.Scanner ^ 1 error
s023162674
p00507
Java
import java.util.Scanner; import public class Main{ public static void main(Strin[] args){ Scanner sc = new Scanner(System.in); int n = sc.next(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; for(i1 = 0; i1 < n2; i1++){ for(i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); } } } }
Main.java:2: error: <identifier> expected import ^ 1 error
s965742219
p00507
Java
import java.util.Scanner; public class Main{ public static void main(Strin[] args){ Scanner sc = new Scanner(System.in); int n = sc.next(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; for(i1 = 0; i1 < n2; i1++){ for(i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); } } } }
Main.java:4: error: cannot find symbol public static void main(Strin[] args){ ^ symbol: class Strin location: class Main Main.java:6: error: incompatible types: String cannot be converted to int int n = sc.next(); ^ Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:16: error: cannot find symbol String x1 = String.valueOf(list[i1]); ^ symbol: variable i1 location: class Main Main.java:17: error: cannot find symbol String x2 = String.valueOf(list[i2]); ^ symbol: variable i2 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable list3 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable i location: class Main 12 errors
s301406318
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.next(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; for(i1 = 0; i1 < n2; i1++){ for(i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); } } } }
Main.java:6: error: incompatible types: String cannot be converted to int int n = sc.next(); ^ Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:16: error: cannot find symbol String x1 = String.valueOf(list[i1]); ^ symbol: variable i1 location: class Main Main.java:17: error: cannot find symbol String x2 = String.valueOf(list[i2]); ^ symbol: variable i2 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable list3 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable i location: class Main 11 errors
s500696117
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; for(i1 = 0; i1 < n2; i1++){ for(i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); } } } }
Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:14: error: cannot find symbol for(i1 = 0; i1 < n2; i1++){ ^ symbol: variable i1 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:15: error: cannot find symbol for(i2 = 0; i2 < n2; i2++){ ^ symbol: variable i2 location: class Main Main.java:16: error: cannot find symbol String x1 = String.valueOf(list[i1]); ^ symbol: variable i1 location: class Main Main.java:17: error: cannot find symbol String x2 = String.valueOf(list[i2]); ^ symbol: variable i2 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable list3 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable i location: class Main 10 errors
s708494397
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); } } } }
Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable list3 location: class Main Main.java:18: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable i location: class Main 2 errors
s036623582
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); list3[i] = Integer.parseInt(x1 + x2); i ++; } } } }
Main.java:19: error: cannot find symbol list3[i] = Integer.parseInt(x1 + x2); ^ symbol: variable list3 location: class Main 1 error
s325523589
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); newX = x1 + x2; list3[i] = Integer.parseInt(newX); i ++; } } } }
Main.java:19: error: cannot find symbol newX = x1 + x2; ^ symbol: variable newX location: class Main Main.java:20: error: cannot find symbol list3[i] = Integer.parseInt(newX); ^ symbol: variable list3 location: class Main Main.java:20: error: cannot find symbol list3[i] = Integer.parseInt(newX); ^ symbol: variable newX location: class Main 3 errors
s470059222
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); newX = x1 + x2; list3[i] = Integer.parseInt(newX); i ++; } } } }
Main.java:19: error: cannot find symbol newX = x1 + x2; ^ symbol: variable newX location: class Main Main.java:20: error: cannot find symbol list3[i] = Integer.parseInt(newX); ^ symbol: variable list3 location: class Main Main.java:20: error: cannot find symbol list3[i] = Integer.parseInt(newX); ^ symbol: variable newX location: class Main 3 errors
s818246977
p00507
Java
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int n2 =Math.min(4, n); int[] list = new int[n2]; for (int i = 0; i < n2; i++) { list[i] = sc.nextInt(); } int n3 = n2 * (n2-1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); String newX = x1 + x2; list3[i] = Integer.parseInt(newX); i ++; } } } }
Main.java:20: error: cannot find symbol list3[i] = Integer.parseInt(newX); ^ symbol: variable list3 location: class Main 1 error
s911297634
p00507
Java
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の数 int n = sc.nextInt(); // 整数のリスト int[] list = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } // リストをソート Arrays.sort(list); // 始めの4つの要素だけ考えればいい int n2 = 4; if (n < 4){ n2 = n; } int n3 = n2 * (n2 - 1); int[] list2 = new int[n3]; int i = 0: for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); String newX = x1 + x2; list2[i] = newX; i ++: } } // 新たなリストをソート Arrays.sort(list2); System.out.println(list2[3]); } }
Main.java:23: error: ';' expected int i = 0: ^ Main.java:30: error: ';' expected i ++: ^ 2 errors
s955526927
p00507
Java
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の数 int n = sc.nextInt(); // 整数のリスト int[] list = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } // リストをソート Arrays.sort(list); // 始めの4つの要素だけ考えればいい int n2 = 4; if (n < 4){ n2 = n; } int n3 = n2 * (n2 - 1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); String newX = x1 + x2; list2[i] = newX; i ++: } } // 新たなリストをソート Arrays.sort(list2); System.out.println(list2[3]); } }
Main.java:30: error: ';' expected i ++: ^ 1 error
s198988686
p00507
Java
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の数 int n = sc.nextInt(); // 整数のリスト int[] list = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } // リストをソート Arrays.sort(list); // 始めの4つの要素だけ考えればいい int n2 = 4; if (n < 4){ n2 = n; } int n3 = n2 * (n2 - 1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); String newX = x1 + x2; list2[i] = newX; i ++; } } // 新たなリストをソート Arrays.sort(list2); System.out.println(list2[3]); } }
Main.java:29: error: incompatible types: String cannot be converted to int list2[i] = newX; ^ 1 error
s822393771
p00507
Java
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); // 整数の数 int n = sc.nextInt(); // 整数のリスト int[] list = new int[n]; for (int i = 0; i < n; i++) { list[i] = sc.nextInt(); } // リストをソート Arrays.sort(list); // 始めの4つの要素だけ考えればいい int n2 = 4; if (n < 4){ n2 = n; } int n3 = n2 * (n2 - 1); int[] list2 = new int[n3]; int i = 0; for(int i1 = 0; i1 < n2; i1++){ for(int i2 = 0; i2 < n2; i2++){ String x1 = String.valueOf(list[i1]); String x2 = String.valueOf(list[i2]); String newX = x1 + x2; list2[i] = Integer.parseInt(newX); i ++; } } // 新たなリストをソート Arrays.sort(list2); System.out.println(list2[3]); return 0; } }
Main.java:37: error: incompatible types: unexpected return value return 0; ^ 1 error
s062389742
p00507
C
#include <stdio.h> #include <stdlib.h> int main(void) { int n, a[10000], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } qsort(a, n, sizeof(int), cmp); printf("%d\n", a[1] *a[2]); }
main.c: In function 'main': main.c:12:30: error: 'cmp' undeclared (first use in this function) 12 | qsort(a, n, sizeof(int), cmp); | ^~~ main.c:12:30: note: each undeclared identifier is reported only once for each function it appears in
s355373987
p00507
C
#include <stdio.h> #include <stdlib.h> int cmp(void *p, void *q) { return *(int*)a - *(int*)b; } int main(void) { int n, a[10000], i; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d", &a[i]); } qsort(a, n, sizeof(int), cmp); printf("%d\n", a[1] *a[2]); }
main.c: In function 'cmp': main.c:6:19: error: 'a' undeclared (first use in this function) 6 | return *(int*)a - *(int*)b; | ^ main.c:6:19: note: each undeclared identifier is reported only once for each function it appears in main.c:6:30: error: 'b' undeclared (first use in this function) 6 | return *(int*)a - *(int*)b; | ^ main.c: In function 'main': main.c:17:30: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types] 17 | qsort(a, n, sizeof(int), cmp); | ^~~ | | | int (*)(void *, void *) In file included from main.c:2: /usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(void *, void *)' 971 | __compar_fn_t __compar) __nonnull ((1, 4)); | ~~~~~~~~~~~~~~^~~~~~~~