submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s416823093
p03673
C++
#include <iostream> #include <cmath> #include <string> #include <set> #include <vector> #include <map> #include <list> using namespace std; typedef pair<int, int> point; int main(void) { int n, r=1; cin >> n; list<int> b; for(int i=1; i<=n; i++) { int a; cin >> a; if(r) b.push_back(a); else b.push_front(a); r=1-r; } if(n%2==0) { for(auto x : b) cout << x << " "; }else { reverse(b.begin(), b.end()); for(auto x : b) cout << x << " "; } }
a.cc: In function 'int main()': a.cc:29:9: error: 'reverse' was not declared in this scope 29 | reverse(b.begin(), b.end()); | ^~~~~~~
s452359200
p03673
C++
#include <iostream> #include <cmath> #include <string> #include <set> #include <vector> #include <map> #include <list> using namespace std; typedef pair<int, int> point; int main(void) { int n, r=1; cin >> n; list<int> b; for(int i=1; i<=n; i++) { int a; cin >> a; if(r) b.push_back(a); else b.push_front(a); r=1-r; } if(n%2==0) { for(auto x : b) cout << x << " "; }else { std::reverse(b.begin(), b.end()); for(auto x : b) cout << x << " "; } }
a.cc: In function 'int main()': a.cc:29:14: error: 'reverse' is not a member of 'std' 29 | std::reverse(b.begin(), b.end()); | ^~~~~~~
s182081154
p03673
C++
#include<deque> #include<iostream> using namespace std; int main() { int n; cin >> n; deque<int> dq; for(int i = 1; i <= n; i++) { int a; cin >> a; if(i % 2 == 0) dq.push_front(a); else dq.push_back(a); } if(n % 2 != 0) reverse(dq.begin(), dq.end()); for(auto e : dq) { cout << e << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:20: error: 'reverse' was not declared in this scope 16 | if(n % 2 != 0) reverse(dq.begin(), dq.end()); | ^~~~~~~
s934697730
p03673
C++
#include<iostream> #include<algorithm> using namespace std; int main(){ int n; cin >> n; int a[200000]; for(int i=0;i<n;i++)[ if(i%2==0)cin>>a[(n+i)/2]; else cin>>a[(n-i)/2]; ] for(int i=0;i<n;i++)cout<<a[i]; }
a.cc: In function 'int main()': a.cc:10:9: error: expected identifier before 'if' 10 | if(i%2==0)cin>>a[(n+i)/2]; | ^~ a.cc:10:34: error: expected ']' before ';' token 10 | if(i%2==0)cin>>a[(n+i)/2]; | ^ | ] a.cc: In lambda function: a.cc:10:34: error: expected '{' before ';' token a.cc: In function 'int main()': a.cc:11:9: error: 'else' without a previous 'if' 11 | else cin>>a[(n-i)/2]; | ^~~~ a.cc:11:24: error: 'i' was not declared in this scope 11 | else cin>>a[(n-i)/2]; | ^ a.cc:12:5: error: expected primary-expression before ']' token 12 | ] | ^
s277373461
p03673
C++
#include <iostream> #include <vector> #include <deque> #include <utility> #include <limits> #include <boost/range/irange.hpp> #include <boost/range/adaptors.hpp> using namespace std; using namespace boost; using uint = unsigned int; using ll = long long int; using ull = unsigned long long int; int main() { bool direct{true}; uint n; deque<uint> d{}; cin >> n; for (auto &&i: irange(0U, n)){ uint a; cin >> a; if (direct)d.emplace_back(a); else d.emplace_front(a); direct=!direct; } if (direct){ for (auto &&i: irange(0U, d.size())){ cout << d.at(i); if (i != d.size()-1){ cout << " "; } } } else { for (auto &&i: irange(0U, d.size()) | adaptors::reversed) { cout << d.at(i); if (i != 0){ cout << " "; } } } return 0; }
a.cc:6:10: fatal error: boost/range/irange.hpp: No such file or directory 6 | #include <boost/range/irange.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s987464240
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main(void){ int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = n-1; i >= 0; i -= 2){ cout << a[i] << " "; } int k; if (i % 2 == 0) k = 0; else k = 1; for (int i = k; i < n; i += 2){ cout << a[i] << " "; } }
a.cc: In function 'int main()': a.cc:24:13: error: 'i' was not declared in this scope 24 | if (i % 2 == 0) | ^
s299739543
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main(void){ int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = n-1; i >= 0; i -= 2){ cout << a[i] << " "; } if (i % 2 == 0) k = 0; else k = 1; for (int i = k; i < n; i += 2){ cout << a[i] << " "; } }
a.cc: In function 'int main()': a.cc:23:13: error: 'i' was not declared in this scope 23 | if (i % 2 == 0) | ^ a.cc:24:17: error: 'k' was not declared in this scope 24 | k = 0; | ^ a.cc:26:17: error: 'k' was not declared in this scope 26 | k = 1; | ^ a.cc:28:22: error: 'k' was not declared in this scope 28 | for (int i = k; i < n; i += 2){ | ^
s423550055
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; int *pn,*pi,*pj,*pk,*pm,*pw,*pnow; pn=&n;pi=&i;pj=&j;pk=&k;pm=&m;pw=&w;pnow=&now; scanf("%d",pn); int a[n],b[n],b2[n]; int *pa,*pb,*pb2; pa=a;pb=b;pb2=b2; for(pi=0;pi<pn;pi++){ scanf("%d",pa[pi]); } for(pj=0;pj<pn;pj++){ pnow = pa[pj]; pb[pj] = pnow; pb2[pj] = pnow; /*逆向きに並べ替える必要あり。*/ pk = 0; pm = pj; while(pk<pj){ pb[pk] = pb2[pm]; pk++; pm = pm-1; } } for(pw=0;pw<pn;pw++){ printf("%d ",pb[pw]); } return 0; }
main.c: In function 'main': main.c:16:22: error: array subscript is not an integer 16 | scanf("%d",pa[pi]); | ^ main.c:20:18: error: array subscript is not an integer 20 | pnow = pa[pj]; | ^ main.c:21:11: error: array subscript is not an integer 21 | pb[pj] = pnow; | ^ main.c:22:12: error: array subscript is not an integer 22 | pb2[pj] = pnow; | ^ main.c:27:15: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:27:25: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:34:24: error: array subscript is not an integer 34 | printf("%d ",pb[pw]); | ^
s683124713
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; int *pn,*pi,*pj,*pk,*pm,*pw,*pnow; pn=&n;pi=&i;pj=&j;pk=&k;pm=&m;pw=&w;pnow=&now; scanf("%d",&pn); int a[n],b[n],b2[n]; int *pa,*pb,*pb2; pa=a;pb=b;pb2=b2; for(pi=0;pi<pn;pi++){ scanf("%d",&pa[pi]); } for(pj=0;pj<pn;pj++){ pnow = pa[j]; pb[j] = pnow; pb2[j] = pnow; /*逆向きに並べ替える必要あり。*/ pk = 0; pm = j; while(pk<pj){ pb[pk] = pb2[pm]; pk++; pm = pm-1; } } for(pw=0;pw<pn;pw++){ printf("%d ",pb[pw]); } return 0; }
main.c: In function 'main': main.c:16:23: error: array subscript is not an integer 16 | scanf("%d",&pa[pi]); | ^ main.c:20:14: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 20 | pnow = pa[j]; | ^ main.c:21:15: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 21 | pb[j] = pnow; | ^ main.c:22:16: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 22 | pb2[j] = pnow; | ^ main.c:25:12: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 25 | pm = j; | ^ main.c:27:15: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:27:25: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:34:24: error: array subscript is not an integer 34 | printf("%d ",pb[pw]); | ^
s890426359
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; int *pn,*pi,*pj,*pk,*pm,*pw,*pnow; pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; scanf("%d",&pn); int a[n],b[n],b2[n]; int *pa,*pb,*pb2; pa=a;pb=b;pb2=b2; for(pi=0;pi<pn;pi++){ scanf("%d",&pa[pi]); } for(pj=0;pj<pn;pj++){ pnow = pa[j]; pb[j] = pnow; pb2[j] = pnow; /*逆向きに並べ替える必要あり。*/ pk = 0; pm = j; while(pk<pj){ pb[pk] = pb2[pm]; pk++; pm = pm-1; } } for(pw=0;pw<pn;pw++){ printf("%d ",pb[pw]); } return 0; }
main.c: In function 'main': main.c:6:7: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:12: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:17: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:22: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:27: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:32: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:6:39: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 6 | pn=n;pi=i;pj=j;pk=k;pm=m;pw=w;pnow=now; | ^ main.c:16:23: error: array subscript is not an integer 16 | scanf("%d",&pa[pi]); | ^ main.c:20:14: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 20 | pnow = pa[j]; | ^ main.c:21:15: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 21 | pb[j] = pnow; | ^ main.c:22:16: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion] 22 | pb2[j] = pnow; | ^ main.c:25:12: error: assignment to 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion] 25 | pm = j; | ^ main.c:27:15: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:27:25: error: array subscript is not an integer 27 | pb[pk] = pb2[pm]; | ^ main.c:34:24: error: array subscript is not an integer 34 | printf("%d ",pb[pw]); | ^
s385954829
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; scanf("%d",&n); int a[n],b[n],b2[n]; int *pa,*pb,*pb2; pa=a;pb=b;pc=b2; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(j=0;j<n;j++){ now = pa[j]; pb[j] = now; pb2[j] = now; /*逆向きに並べ替える必要あり。*/ k = 0; m = j; while(k<j){ pb[k] = pb2[m]; k++; m = m-1; } } for(w=0;w<n;w++){ printf("%d ",b[w]); } return 0; }
main.c: In function 'main': main.c:11:15: error: 'pc' undeclared (first use in this function); did you mean 'pb'? 11 | pa=a;pb=b;pc=b2; | ^~ | pb main.c:11:15: note: each undeclared identifier is reported only once for each function it appears in
s225387408
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; scanf("%d",&n); int a[n],b[n],b2[n]; int *pa,*pb,*pb2; pa=a;pb=b;pc=c; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(j=0;j<n;j++){ now = pa[j]; pb[j] = now; pb2[j] = now; /*逆向きに並べ替える必要あり。*/ k = 0; m = j; while(k<j){ pb[k] = pb2[m]; k++; m = m-1; } } for(w=0;w<n;w++){ printf("%d ",pb[w]); } return 0; }
main.c: In function 'main': main.c:11:15: error: 'pc' undeclared (first use in this function); did you mean 'pb'? 11 | pa=a;pb=b;pc=c; | ^~ | pb main.c:11:15: note: each undeclared identifier is reported only once for each function it appears in main.c:11:18: error: 'c' undeclared (first use in this function) 11 | pa=a;pb=b;pc=c; | ^
s467653303
p03673
C
#include <stdio.h> int main(){ int n,i,j,k,m,w,now; scanf("%d",&n); int a[n],b[n],b2[n]; for(i=0;i<n;i++){ scanf("%d",&a[i]); } for(j=0;j<n;j++){ now = a[j]; b[j] = now; b2[j] = now; /*逆向きに並べ替える必要あり。*/ k = 0; m = j; while(k<j){ b[k] = b2[m] k++; m = m-1; } } for(w=0;w<n;w++){ printf("%d ",b[w]); } return 0; }
main.c: In function 'main': main.c:22:25: error: expected ';' before 'k' 22 | b[k] = b2[m] | ^ | ; 23 | k++; | ~
s682694981
p03673
C++
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <utility> #include <stack> #include <functional> #include <queue> #include <cmath> #include <set> #define rep(i,j,k) for(int i=j;i<k;i++) #define all(v) (v).begin(),(v).end() #define Sort(x) sort((x).begin(),(x).end()) #define fi first #define se second #define vi vector<int> #define INF 1000000000 #define MOD 1000000009 #define pb push_back #define mp make_pair typedef long long ll; typedef std::pair<int,int> pii; int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0}; using namespace std; int main(){ int n; cin>>n; vector<int> v(n); vector<int> ans; rep(i,0,n)cin>>v[i]; rep(i,0,n){ if(i%2==0)ans.insert(ans.begin(),v[i]); else ans.pb(v[i]); } if(i%2==0)reverse(all(ans)); rep(i,0,n){ if(i)cout<<" "; cout<<ans[i]; } cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:39:8: error: 'i' was not declared in this scope 39 | if(i%2==0)reverse(all(ans)); | ^
s107130665
p03673
C++
#include<iostream> using namespace std; const int size=999; int main() { int m,list1[size],list2[size]; cin>>m; for(int j=0;;j++) { cin>>list1[j]; if(getchar()=='\n') break; } for (int q=0;q<j+1;q++) list2[q]=list1[q]; for (int a=1;a<m+1;a++) { for (int w=0;w<a;w++) list1[w]=list2[a-1-w]; for(int e=0;e<a;e++) list2[e]=list1[e]; } for (int k=0;k<j+1;k++) cout<<list1[k]<<" "; cout<<endl; system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:7:21: error: reference to 'size' is ambiguous 7 | int m,list1[size],list2[size]; | ^~~~ 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:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:11: note: 'const int size' 4 | const int size=999; | ^~~~ a.cc:7:33: error: reference to 'size' is ambiguous 7 | int m,list1[size],list2[size]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:11: note: 'const int size' 4 | const int size=999; | ^~~~ a.cc:11:22: error: 'list1' was not declared in this scope 11 | cin>>list1[j]; | ^~~~~ a.cc:15:24: error: 'j' was not declared in this scope 15 | for (int q=0;q<j+1;q++) | ^ a.cc:16:17: error: 'list2' was not declared in this scope 16 | list2[q]=list1[q]; | ^~~~~ a.cc:16:26: error: 'list1' was not declared in this scope 16 | list2[q]=list1[q]; | ^~~~~ a.cc:20:25: error: 'list1' was not declared in this scope 20 | list1[w]=list2[a-1-w]; | ^~~~~ a.cc:20:34: error: 'list2' was not declared in this scope 20 | list1[w]=list2[a-1-w]; | ^~~~~ a.cc:22:21: error: 'list2' was not declared in this scope 22 | list2[e]=list1[e]; | ^~~~~ a.cc:22:30: error: 'list1' was not declared in this scope 22 | list2[e]=list1[e]; | ^~~~~ a.cc:24:24: error: 'j' was not declared in this scope 24 | for (int k=0;k<j+1;k++) | ^ a.cc:25:23: error: 'list1' was not declared in this scope 25 | cout<<list1[k]<<" "; | ^~~~~
s758600648
p03673
C++
#include<iostream> using namespace std; const int size=999; int main() { int m,list1[size],list2[size]; cin>>m; for(int j=0;;j++) { cin>>list1[j]; if(getchar()=='\n') break; } for (int q=0;q<j+1;q++) list2[q]=list1[q]; for (int a=1;a<m+1;a++) { for (int w=0;w<a;w++) list1[w]=list2[a-1-w]; for(int e=0;e<a;e++) list2[e]=list1[e]; } for (int k=0;k<j+1;k++) cout<<list1[k]<<" "; cout<<endl; system("pause"); return 0; }
a.cc: In function 'int main()': a.cc:7:21: error: reference to 'size' is ambiguous 7 | int m,list1[size],list2[size]; | ^~~~ 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:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:11: note: 'const int size' 4 | const int size=999; | ^~~~ a.cc:7:33: error: reference to 'size' is ambiguous 7 | int m,list1[size],list2[size]; | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:11: note: 'const int size' 4 | const int size=999; | ^~~~ a.cc:11:22: error: 'list1' was not declared in this scope 11 | cin>>list1[j]; | ^~~~~ a.cc:15:24: error: 'j' was not declared in this scope 15 | for (int q=0;q<j+1;q++) | ^ a.cc:16:17: error: 'list2' was not declared in this scope 16 | list2[q]=list1[q]; | ^~~~~ a.cc:16:26: error: 'list1' was not declared in this scope 16 | list2[q]=list1[q]; | ^~~~~ a.cc:20:25: error: 'list1' was not declared in this scope 20 | list1[w]=list2[a-1-w]; | ^~~~~ a.cc:20:34: error: 'list2' was not declared in this scope 20 | list1[w]=list2[a-1-w]; | ^~~~~ a.cc:22:21: error: 'list2' was not declared in this scope 22 | list2[e]=list1[e]; | ^~~~~ a.cc:22:30: error: 'list1' was not declared in this scope 22 | list2[e]=list1[e]; | ^~~~~ a.cc:24:24: error: 'j' was not declared in this scope 24 | for (int k=0;k<j+1;k++) | ^ a.cc:25:23: error: 'list1' was not declared in this scope 25 | cout<<list1[k]<<" "; | ^~~~~
s975850313
p03673
C++
#include<iostream> using namespace std; const int size=999; void swop(const int list[],int n); int main() { int m,list[size]; cin>>m; for(int j=0;;j++) { cin>>list[j]; if(getchar()=='\n') break; } for (int a=1;a<m+1;a++) swop(list,a); for (int k=0;k<j+1;k++) cout<<list[k]<<" "; cout<<endl; system("pause"); return 0; } void swop(const int list[],int n) { int temp,a,j; if(a==2) { temp=list[0]; list[0]=list[1]; list[1]=temp; } else if(a>2) { temp=list[a-1]; for (;a>1;a--) list[a-1]=list[a-2]; list[0]=temp; } }
a.cc: In function 'int main()': a.cc:9:20: error: reference to 'size' is ambiguous 9 | int m,list[size]; | ^~~~ 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:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ a.cc:4:11: note: 'const int size' 4 | const int size=999; | ^~~~ a.cc:13:22: error: 'list' was not declared in this scope 13 | cin>>list[j]; | ^~~~ a.cc:2:1: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>' 1 | #include<iostream> +++ |+#include <list> 2 | using namespace std; a.cc:18:22: error: 'list' was not declared in this scope 18 | swop(list,a); | ^~~~ a.cc:18:22: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>' a.cc:19:24: error: 'j' was not declared in this scope 19 | for (int k=0;k<j+1;k++) | ^ a.cc:20:23: error: 'list' was not declared in this scope 20 | cout<<list[k]<<" "; | ^~~~ a.cc:20:23: note: 'std::list' is defined in header '<list>'; this is probably fixable by adding '#include <list>' a.cc: In function 'void swop(const int*, int)': a.cc:32:24: error: assignment of read-only location '* list' 32 | list[0]=list[1]; | ~~~~~~~^~~~~~~~ a.cc:33:24: error: assignment of read-only location '*(list + 4)' 33 | list[1]=temp; | ~~~~~~~^~~~~ a.cc:39:34: error: assignment of read-only location '*(list + (((sizetype)(((long unsigned int)a) * 4)) + 18446744073709551612))' 39 | list[a-1]=list[a-2]; | ~~~~~~~~~^~~~~~~~~~ a.cc:40:24: error: assignment of read-only location '* list' 40 | list[0]=temp; | ~~~~~~~^~~~~
s866717313
p03673
C++
#include <iostream> using namespace std ; int reverse(int t[] , int m[],int e) {for (int i=0,j=e-1;j<e;i++,j--) m[j]=t[i]; } int main() { int N,i,t; cin>>N; int*a= new int [N]; int*b= new int [N]; for(i=0;i<N;i++) cin>>a[i]; for(i=0;i<N;i++) { b[i]=a[i]; reverse(a,b,i+1); for(t=0;t<i+1;t++) b[t]=a[t]; for(i=0;i<N;i++) cout<<b[i]<<" "; delete [] a; delete[] b; return 0; }
a.cc: In function 'int reverse(int*, int*, int)': a.cc:6:1: warning: no return statement in function returning non-void [-Wreturn-type] 6 | } | ^ a.cc: In function 'int main()': a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s579848899
p03673
C++
#include <iostream> using namespace std ; int reverse(int t[] , int m[],int e) {for (int i=0,j=e-1;j<e;i++,j--) m[j]=t[i]; } int main() { int N,i,t; cin>>N; int*a= new int [N]; int*b= new int [N]; for(i=0;i<N;i++) cin>>a[i]; for(i=0;i<N;i++) { b[i]=a[i]; reverse(a,b,i+1); for(t=0;t<i+1;t++) b[t]=a[t]; for(i=0;i<N;i++) cout<<b[i]<<" "; delete [] a; delete[] b; return 0; }
a.cc: In function 'int reverse(int*, int*, int)': a.cc:6:1: warning: no return statement in function returning non-void [-Wreturn-type] 6 | } | ^ a.cc: In function 'int main()': a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s557823310
p03673
C++
#include <iostream> using namespace std ; int reverse(int t[] , int m[],int e) {for (int i=0,j=e-1;j<e;i++,j--) m[j]=t[i]; } int main() { int N,i,t; cin>>N; int*a= new int [N]; int*b= new int [N]; for(i=0;i<N;i++) cin>>a[i]; for(i=0;i<N;i++) { b[i]=a[i]; reverse(a,b,i+1); for(t=0;t<i+1;t++) b[t]=a[t]; for(i=0;i<N;i++) cout<<b[i]<<" "; delete [] a; delete[] b; return 0; }
a.cc: In function 'int reverse(int*, int*, int)': a.cc:6:1: warning: no return statement in function returning non-void [-Wreturn-type] 6 | } | ^ a.cc: In function 'int main()': a.cc:27:2: error: expected '}' at end of input 27 | } | ^ a.cc:8:1: note: to match this '{' 8 | { | ^
s341398076
p03673
C
#include"stdio.h" int main(void) { int a[10],b[10],n,i,t=1; scan("%d\n",&n); for(i=1;i<=n;i++) { scan("%d",&a[i]); } if(n%2==0) { for(i=n;i>=2;i=i-2) b[t++]=a[i]; for(i=1;i<=n-1;i=i+2) b[t++]=a[i]; } else { for(i=n;i>=1;i=i-2) b[t++]=a[i]; for(i=2;i<=n-1;i=i+2) b[t++]=a[i]; } for(i=1;i<=n;i++) print("%d ",b[i]); }
main.c: In function 'main': main.c:5:5: error: implicit declaration of function 'scan'; did you mean 'scanf'? [-Wimplicit-function-declaration] 5 | scan("%d\n",&n); | ^~~~ | scanf main.c:25:5: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration] 25 | print("%d ",b[i]); | ^~~~~ | printf
s760457919
p03673
C
#include"stdio.h" int main(void) { int a[10],b[10],n,i,t=1; input(n); for(i=1;i<=n;i++) { input(a[i]); } if(n%2==0) { for(i=n;i>=2;i=i-2) b[t++]=a[i]; for(i=1;i<=n-1;i=i+2) b[t++]=a[i]; } else { for(i=n;i>=1;i=i-2) b[t++]=a[i]; for(i=2;i<=n-1;i=i+2) b[t++]=a[i]; } for(i=1;i<=n;i++) output(b[i]); }
main.c: In function 'main': main.c:5:5: error: implicit declaration of function 'input' [-Wimplicit-function-declaration] 5 | input(n); | ^~~~~ main.c:25:4: error: implicit declaration of function 'output' [-Wimplicit-function-declaration] 25 | output(b[i]); | ^~~~~~
s020413906
p03673
C
#include "stdio.h" #include "conio.h" #include "string.h" #include "stdlib.h" typedef struct _data{ int num; struct _data *next; }Data; typedef struct _List{ Data *head; Data *tail; }List; void data_input(List *plist); void linkedlist_back(List *plist,int _idx); void linkedlist_print(List *plist); int main() { int n=0,cnt=0,idx=0; List list; Data *po; list.head=list.tail=NULL; scanf("%d",&n); for(idx=0;idx<n;idx++){ data_input(&list); linkedlist_back(&list,idx+1); } linkedlist_print(&list); return 0; } void data_input(List *plist){ int number=0; scanf("%d",&number); Data *p; p=(Data *)malloc(sizeof(Data)); p->num=number; if(plist->head) { plist->tail->next=p; plist->tail=p; p->next=NULL; //free(p); }else { plist->head=p; plist->tail=p; p->next=NULL; //free(p); } } void linkedlist_back(List *plist,int _idx){ int data[_idx]; int i=0; Data *p; p=plist->head; if(_idx!=1){ for(i;i<_idx;i++){ data[i]=p->num; p=p->next; } p=plist->head; for(i=0;i<_idx;i++){ p->num=data[_idx-i-1]; p=p->next; } } } void linkedlist_print(List *plist){ Data *p; p=plist->head; for(;p;p=p->next){ printf("%d",p->num); if(p->next!=NULL) printf(" "); } }
main.c:2:10: fatal error: conio.h: No such file or directory 2 | #include "conio.h" | ^~~~~~~~~ compilation terminated.
s601041235
p03673
C++
#include<stdio.h> #include<stdlib.h> int main() { int *a, *b, n; scanf_s("%d", &n); a = (int *)malloc(n * sizeof(int)); for (int i = 0; i < n; i++) scanf_s("%d", &a[i]); b = (int *)malloc(n * sizeof(int)); if (n % 2 == 0)//n为偶数 { for (int i = 0; i < n / 2; i++) b[i] = a[n - 1 - 2 * i]; for (int i = 0; i < n / 2; i++) b[n / 2 + i] = a[2 * i]; } else//n为奇数 { for (int i = 0; i < n / 2 + 1; i++) b[i] = a[n - 1 - 2 * i]; for (int i = 0; i < n / 2; i++) b[n / 2 + 1 + i] = a[2 * i + 1]; } for (int i = 0; i < n; i++) printf("%d ", b[i]); printf("\n"); return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 7 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s548126299
p03673
C++
#include<stack> #include<queue> using namespace std; int main() { stack<int> q; queue<int> p; int n; int x; int i; int j; cin>>n; for(i=0;i<n;i++) { cin>>x; q.push(x); for(j=0;j<=i;j++) { p.push(q.top()); q.pop(); } for(j=0;j<=i;j++) { q.push(p.front()); p.pop(); } } for(j=0;j<n;j++) { p.push(q.top()); q.pop(); } for(j=0;j<n;j++) { q.push(p.front()); p.pop(); } for(i=0;i<n;i++) { cout<<q.top(); q.pop(); } }
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin>>n; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<queue> +++ |+#include <iostream> 3 | using namespace std; a.cc:40:12: error: 'cout' was not declared in this scope 40 | cout<<q.top(); | ^~~~ a.cc:40:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s230493905
p03673
C++
#include<iostream> using namespace std; int main() { int *b; b = new int[n]; int Head = 0, End = n-1,flag=1; for (int i = 0; i < n; i++) { if (flag) { b[Head] = a[i]; Head++; flag = 0; } else { b[End] = a[i]; End--; flag = 1; } } if (flag) { for (int i = 0; i < n; i++) cout << b[(Head+i)%n]<<" "; } else { for (int i = 0; i < n; i++) cout << b[(End - i+n) % n]<<" "; } }
a.cc: In function 'int main()': a.cc:7:21: error: 'n' was not declared in this scope 7 | b = new int[n]; | ^ a.cc:11:21: error: 'flag' was not declared in this scope 11 | if (flag) | ^~~~ a.cc:13:35: error: 'a' was not declared in this scope 13 | b[Head] = a[i]; | ^ a.cc:19:34: error: 'a' was not declared in this scope 19 | b[End] = a[i]; | ^ a.cc:24:13: error: 'flag' was not declared in this scope 24 | if (flag) | ^~~~
s797376403
p03673
C++
#include<iostream> using namespace std; int main() { //int n=6; //int *b, a[6] = {0,6,7,6,7,0}; int *b; b = new int[n]; int Head = 0, End = n-1,flag=1; for (int i = 0; i < n; i++) { if (flag) { b[Head] = a[i]; Head++; flag = 0; } else { b[End] = a[i]; End--; flag = 1; } } if (flag) { for (int i = 0; i < n; i++) cout << b[(Head+i)%n]; } else { for (int i = 0; i < n; i++) cout << b[(End - i+n) % n]; } //getchar(); }
a.cc: In function 'int main()': a.cc:9:21: error: 'n' was not declared in this scope 9 | b = new int[n]; | ^ a.cc:13:21: error: 'flag' was not declared in this scope 13 | if (flag) | ^~~~ a.cc:15:35: error: 'a' was not declared in this scope 15 | b[Head] = a[i]; | ^ a.cc:21:34: error: 'a' was not declared in this scope 21 | b[End] = a[i]; | ^ a.cc:26:13: error: 'flag' was not declared in this scope 26 | if (flag) | ^~~~
s490591010
p03673
C++
#include </bits/stdc++.h> using namespace std; vector<int> a; int main() { int n, num; cin >> n; while (n--) { scanf("%d", &num); a.push_back(num); reverse(a.begin(), a.end()); } for (int i = 0; i < a.size(); i++) { if (i == 0) cout << a.at(i); else cout << " " << a.at(i); } cout << endl; return 0; }
a.cc:1:10: fatal error: /bits/stdc++.h: No such file or directory 1 | #include </bits/stdc++.h> | ^~~~~~~~~~~~~~~~ compilation terminated.
s474166253
p03673
C
#include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d", &n); int *a = NULL,*b=NULL; b = (int *)malloc(sizeof(int)*n); a = (int *)malloc(sizeof(int)*n); int i,x,y; x = y = n / 2; for (i = 0; i < n; i++) { scanf("%d", &a[i]); if (n % 2 == 1) (i % 2 == 0)?b[x--] = a[i]:b[++y] = a[i]; else (i % 2 == 0)? b[x++] = a[i]:b[--y] = a[i]; } for (i = 0; i < n; i++) printf("%d ", b[i]); free(a); free(b); return 0; }
main.c: In function 'main': main.c:17:59: error: lvalue required as left operand of assignment 17 | (i % 2 == 0)?b[x--] = a[i]:b[++y] = a[i]; | ^ main.c:21:60: error: lvalue required as left operand of assignment 21 | (i % 2 == 0)? b[x++] = a[i]:b[--y] = a[i]; | ^
s097798286
p03673
C
#include<stdio.h> int main() { long long int n,i,j; scanf("%lld",&n); long long int b[n]={0}; long long int a[n]={0}; for(i=0;i<n;i++) { scanf("%lld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%lld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:28: error: variable-sized object may not be initialized except with an empty initializer 6 | long long int b[n]={0}; | ^ main.c:7:28: error: variable-sized object may not be initialized except with an empty initializer 7 | long long int a[n]={0}; | ^
s751747462
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^
s606091496
p03673
C
#include<stdio.h> int main() { long int n,i,j; scanf("%ld",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^
s415060983
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^
s456265596
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); int b[n]={0}; int a[n]={0}; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%d ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:18: error: variable-sized object may not be initialized except with an empty initializer 6 | int b[n]={0}; | ^ main.c:7:18: error: variable-sized object may not be initialized except with an empty initializer 7 | int a[n]={0}; | ^
s965002318
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++;) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^ main.c:12:45: error: expected ')' before ';' token 12 | for(i=n-1,j=0;i>=0;i=i-2,j++;) | ~ ^ | )
s473290649
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d\n",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^
s544037420
p03673
C++
#include<iostream> using namespace std; long int j[200000]; long int k[200000]; void main() { int i; cin >> i; for (int z=0; z < i; z++) { cin >> j[z]; k[z] = j[z]; for (int x = 0; x <(z + 1)/2; x++) { int a; a = k[x]; k[x] = k[z-x]; k[z - x] = a; } } for (int z=0; z < i; z++) { cout << k[z]<<" "; } }
a.cc:5:1: error: '::main' must return 'int' 5 | void main() | ^~~~
s550785370
p03673
C++
#include<iosream> using namespace std; int main() { long n,k; long long *a; int temp=1; cin>>n; k=n/2; a = new long long int[n]; if((n-2k)==0) { for(int i=0;i<n;i++){ if(temp==1) { cin>>a[k]; temp++; } else { if(temp%2==0) cin>>a[k-temp/2]; else cin>>a[k+temp/2]; temp++; } } } else { for(int i=0;i<n;i++){ if(temp==1) { cin>>a[k]; temp++; } else { if(temp%2==1) cin>>a[k-temp/2]; else cin>>a[k+temp/2]; temp++; } } } for(i=0;i<n;i++) cout<<a[i]<<' '; return 0; }
a.cc:1:9: fatal error: iosream: No such file or directory 1 | #include<iosream> | ^~~~~~~~~ compilation terminated.
s196079532
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++;) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^ main.c:12:45: error: expected ')' before ';' token 12 | for(i=n-1,j=0;i>=0;i=i-2,j++;) | ~ ^ | )
s291361441
p03673
C++
#include <iostream> #include <cstdio> #include <cstdlib> using namespace std; const int N = 20000; int n; int a[N],b[N]; void solve() { int len = 0; for (int i = n; i>= 1; i-=2) b[++len] = a[i]; for (int i = n-1,len = n; i >= 1; i-=2) b[len--] = a[i]; for (int i = 1; i <= n; i++) printf("%d ", b[i]); printf("\n"); } void init() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d", &a[i]); } int main() { init(); solve(); return 0; }
a.cc:7:15: error: unable to find numeric literal operator 'operator""\U0000ff1b' 7 | const int N = 20000; | ^~~~~~~ a.cc:10:7: error: size of array 'a' is not an integral constant-expression 10 | int a[N],b[N]; | ^ a.cc:10:12: error: size of array 'b' is not an integral constant-expression 10 | int a[N],b[N]; | ^ a.cc: In function 'void solve()': a.cc:15:22: error: 'n' was not declared in this scope 15 | for (int i = n; i>= 1; i-=2) | ^ a.cc:17:22: error: 'n' was not declared in this scope 17 | for (int i = n-1,len = n; i >= 1; i-=2) | ^ a.cc:19:30: error: 'n' was not declared in this scope 19 | for (int i = 1; i <= n; i++) | ^ a.cc: In function 'void init()': a.cc:26:22: error: 'n' was not declared in this scope 26 | scanf("%d", &n); | ^
s902409942
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^
s814087935
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); long int b[n]={0}; long int a[n]={0}; for(i=0;i<n;i++) { scanf("%ld",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++;) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%ld ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:23: error: variable-sized object may not be initialized except with an empty initializer 6 | long int b[n]={0}; | ^ main.c:7:23: error: variable-sized object may not be initialized except with an empty initializer 7 | long int a[n]={0}; | ^ main.c:12:45: error: expected ')' before ';' token 12 | for(i=n-1,j=0;i>=0;i=i-2,j++;) | ~ ^ | )
s661172978
p03673
C++
#include<iostream> using namespace std; int main() { int n; cin >> n; int a[100], b[100]; for (int i = 0; i < n; i++) cin >> a[i]; int temp; int count = 0; for (int k = 0; k < n; k++) { b[count] = a[k]; for (int x = 0; x <= count/2; x++) { temp = b[x]; b[x] = b[count-x]; b[count - x] = temp; } count++; } for (int m = 0; m < n; m++) cout << b[m] << " " ; system("pause"); }#include<iostream> using namespace std; int main() { int n; cin >> n; int a[100], b[100]; for (int i = 0; i < n; i++) cin >> a[i]; int temp; int count = 0; for (int k = 0; k < n; k++) { b[count] = a[k]; for (int x = 0; x <= count/2; x++) { temp = b[x]; b[x] = b[count-x]; b[count - x] = temp; } count++; } for (int m = 0; m < n; m++) cout << b[m] << " " ; }
a.cc:30:2: error: stray '#' in program 30 | }#include<iostream> | ^ a.cc:30:3: error: 'include' does not name a type 30 | }#include<iostream> | ^~~~~~~ a.cc:32:5: error: redefinition of 'int main()' 32 | int main() | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main() | ^~~~
s521203841
p03673
C
#include<stdio.h> #include<stdlib.h> int main() { int n; scanf_s("%d", &n); int *a, *b, *c; a = (int *)malloc(n*sizeof(int)); b = (int *)malloc(n*sizeof(int)); c = (int *)malloc(n*sizeof(int)); for (int i = 0; i < n; i++) { int count = 0; scanf_s("%d", &a[i]); b[i] = a[i]; for (int j = i; j >= 0; j--) { c[count] = b[j]; count++; } for (int j = 0; j <= i; j++) { b[j] = c[j]; } } for (int i = 0; i < n; i++) { printf("%d ", b[i]); } }
main.c: In function 'main': main.c:6:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 6 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s909692649
p03673
C
#include<stdio.h> int main() { int n,i,j; scanf("%d",&n); int b[n]={0}; int a[n]={0}; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=n-1,j=0;i>=0;i=i-2,j++) { b[j]=a[i]; if(i!=0) b[n-j-1]=a[i-1]; } for(i=0;i<n;i++) { printf("%d ",b[i]); } return 0; }
main.c: In function 'main': main.c:6:18: error: variable-sized object may not be initialized except with an empty initializer 6 | int b[n]={0}; | ^ main.c:7:18: error: variable-sized object may not be initialized except with an empty initializer 7 | int a[n]={0}; | ^
s970626804
p03673
C++
#include<stack> #include<queue> using namespace std; int main() { stack<int> q; queue<int> p; int n; int x; int i; int j; cin>>n; for(i=0;i<n;i++) { cin>>x; q.push(x); for(j=0;j<=i;j++) { p.push(q.top()); q.pop(); } for(j=0;j<=i;j++) { q.push(p.front()); p.pop(); } } for(j=0;j<n;j++) { p.push(q.top()); q.pop(); } for(j=0;j<n;j++) { q.push(p.front()); p.pop(); } for(i=0;i<n;i++) { cout<<q.top(); q.pop(); } }
a.cc: In function 'int main()': a.cc:12:5: error: 'cin' was not declared in this scope 12 | cin>>n; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<queue> +++ |+#include <iostream> 3 | using namespace std; a.cc:40:12: error: 'cout' was not declared in this scope 40 | cout<<q.top(); | ^~~~ a.cc:40:12: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s321617844
p03673
C++
#include<iostream> using namespace std; int main() { int n; while (cin >> n) { for (int i = 1; i <= n; ++i) { cin >> a[i]; } if (n & 1) { cout << a[n]; for (int i = n - 2; i >= 1; i -= 2) cout << " " << a[i]; for (int i = 2; i <= n - 1; i += 2) cout << " " << a[i]; cout << endl; } else { cout << a[n]; for (int i = n - 2; i >= 2; i -= 2) cout << " " << a[i]; for (int i = 1; i <= n - 1; i += 2) cout << " " << a[i]; cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:10:32: error: 'a' was not declared in this scope 10 | cin >> a[i]; | ^ a.cc:14:33: error: 'a' was not declared in this scope 14 | cout << a[n]; | ^ a.cc:23:33: error: 'a' was not declared in this scope 23 | cout << a[n]; | ^
s550347647
p03673
C++
#include<stdio.h> int n; void reverse(int *b, int s) { int t; for (int i = 0, j = s; i < j; i++, j--) { t = b[i]; b[i] = b[j]; b[j] = t; } } int main() { int *a,*b; scanf(" %d", &n); a = b = (int*)malloc(n * sizeof(int)); for (int i = 0; i < n; i++) scanf(" %d", &a[i]); for (int i = 0; i < n; i++) { b[i] = a[i]; reverse(b,i); } for (int i = 0; i < n; i++) { printf("%d", b[i]); if(i!=n-1) printf(" "); } return 0; }
a.cc: In function 'int main()': a.cc:15:23: error: 'malloc' was not declared in this scope 15 | a = b = (int*)malloc(n * sizeof(int)); | ^~~~~~ a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' 1 | #include<stdio.h> +++ |+#include <cstdlib> 2 | int n;
s478622593
p03673
C
#include<stdio.h> #include<algorithm> using namespace std; const int M=2e5+5; int main() { int n,a[M],b[M],i,j,k=0; scanf("%d",&n); for(i=0;i<=n-1;i++) scanf("%d",&a[i]); for(j=n-1;j>=0;j--) { for(i=j;i!=n;i++) b[i-1]=b[i]; b[n-1]=a[k]; k++; reverse(b+j,b+n); } for(i=0;i<n-1;i++) printf("%d ",b[i]); printf("%d",b[n-1]); return 0; }
main.c:2:9: fatal error: algorithm: No such file or directory 2 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s665682612
p03673
C
#include<stdio.h> #include<algorithm> using namespace std; const int M=2e5+5; int main() { int n,a[M],b[M],i,j,k=0; scanf("%d",&n); for(i=0;i<=n-1;i++) scanf("%d",&a[i]); for(j=n-1;j>=0;j--) { for(i=j;i!=n;i++) b[i-1]=b[i]; b[n-1]=a[k]; k++; reverse(b+j,b+n); } for(i=0;i<n-1;i++) printf("%d ",b[i]); printf("%d",b[n-1]); return 0; }
main.c:2:9: fatal error: algorithm: No such file or directory 2 | #include<algorithm> | ^~~~~~~~~~~ compilation terminated.
s083069031
p03673
C
#include <stdio.h> int main() { int a[200000], c,x, n, m = 0; while (1) { scanf("%d", &n); if (n >= 1 && n <= 200000) break; } int b[20000]; while (m<n) { x = 0; scanf("%d", &a[m]); if (a[m]>1000000000 || a[m]<0) { continue; } else { m++; } } } if (m / 2 == 1) { for (c = m - 1; c >= 0; c -= 2) { b[x] = a[c]; x++; } for (c = 1; c <= m; c += 2) { b[x] = a[c]; x++; } } else { for (c = m - 1; c >= 1; c -= 2) { b[x] = a[c]; x++; } for (c = 0; c <= m; c += 2) { b[x] = a[c]; x++; } for (m = 0; m<n - 1; m++) { printf("%d ", b[m]); } printf("%d", b[n - 1]); return 0; }
main.c:25:1: error: expected identifier or '(' before 'if' 25 | if (m / 2 == 1) | ^~ main.c:38:25: error: expected identifier or '(' before 'else' 38 | else | ^~~~
s725970213
p03673
C
#include <stdio.h> int main() { int a[200000], c,x, n, m = 0; while (1) { scanf("%d", &n); if (n >= 1 && n <= 200000) break; } int b[20000]; while (m<n) { x = 0; scanf("%d", &a[m]); if (a[m]>1000000000 || a[m]<0) { continue; } else { m++; if (m / 2 == 1) { for (c = m - 1; c >= 0; c -= 2) { b[x] = a[c]; x++; } for (c = 1; c <= m; c += 2) { b[x] = a[c]; x++; } } else { for (c = m - 1; c >= 1; c -= 2) { b[x] = a[c]; x++; } for (c = 0; c <= m; c += 2) { b[x] = a[c]; x++; } } } for (m = 0; m<n - 1; m++) { printf("%d ", b[m]); } printf("%d", b[n - 1]); return 0; }
main.c: In function 'main': main.c:55:1: error: expected declaration or statement at end of input 55 | } | ^
s999917263
p03673
C
#include <stdio.h> int main() { int a[200000], c,x, n, m = 0; while (1) { scanf("%d", &n); if (n >= 1 && n <= 200000) break; } int b[20000]; while (m<n) { x = 0; scanf("%d", &a[m]); if (a[m]>1000000000 || a[m]<0) { continue; } else { m++; if (m / 2 == 1) { for (c = m - 1; c >= 0; c -= 2) { b[x] = a[c]; x++; } for (c = 1; c <= m; c += 2) { b[x] = a[c]; x++; } } else { for (c = m - 1; c >= 1; c -= 2) { b[x] = a[c]; x++; } for (c = 0; c <= m; c += 2) { b[x] = a[c]; x++; } } for (m = 0; m<n - 1; m++) { printf("%d ", b[m]); } printf("%d", b[n - 1]); return 0; }
main.c: In function 'main': main.c:54:1: error: expected declaration or statement at end of input 54 | } | ^ main.c:54:1: error: expected declaration or statement at end of input
s120616753
p03673
C++
#include<cstdio> #include<iostream> using namespace std; int main() { int n; scanf_s("%d", &n); int *a = new int[n]; for (int i = 0; i<n; i++) { scanf_s("%d", a + i); } int nn = n / 2; if (n % 2 == 0) { for (int i = 0; i<nn; i++) { printf("%d ", a[n - 2 * i - 1]); } for (int i = 0; i<nn; i++) { printf("%d ", a[2 * i]); } } else { for (int i = 0; i<nn; i++) { printf("%d ", a[n - 2 * i - 1]); } printf("%d ", a[0]); for (int i = 0; i<nn; i++) { printf("%d ", a[2 * i + 1]); } } return 0; }
a.cc: In function 'int main()': a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 7 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s015276624
p03673
Java
public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = input.nextInt(); ArrayList<Integer> list = new ArrayList<>(); boolean flag = count%2==0?false:true; for(int i = 0; i < count; i++) { if(flag) { list.add(input.nextInt()); flag = !flag; } else { list.add(0,input.nextInt()); flag = !flag; } } if(flag) { for(int i=0; i < list.size(); i++) { System.out.print(list.get(i)+" "); } } else { for(int i=list.size()-1; i >= 0; i--) { System.out.print(list.get(i)+" "); } } } }
Main.java:4: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:4: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol ArrayList<Integer> list = new ArrayList<>(); ^ symbol: class ArrayList location: class Main Main.java:6: error: cannot find symbol ArrayList<Integer> list = new ArrayList<>(); ^ symbol: class ArrayList location: class Main 4 errors
s253842204
p03673
C
#include<stdio.h> int main() { int a[200000],c,t,n,m=0; while(1) { scanf("%d",&n); if(n>=1&&n<=200000) break; } int b[n]; while(m<n) { scanf("%d",&a[m]); if(a[m]>1000000000||a[m]<0) { continue; } else{ b[n-b-1]=a[m]; m++; } } printf("%d/n",n); for(b=n-1;b>=0;b--) {printf("%d ",a[b]);} return 0; }
main.c: In function 'main': main.c:20:4: error: invalid operands to binary - (have 'int' and 'int *') 20 | b[n-b-1]=a[m]; | ^ | | | int * main.c:25:6: error: assignment to expression with array type 25 | for(b=n-1;b>=0;b--) | ^ main.c:25:17: error: lvalue required as decrement operand 25 | for(b=n-1;b>=0;b--) | ^~ main.c:26:20: error: array subscript is not an integer 26 | {printf("%d ",a[b]);} | ^
s988830813
p03673
C
#include<stdio.h> int main() { int a[200000],c,t,n,m=0; while(1) { scanf("%d",&n); if(n>=1&&n<=200000) break; } int b[n]; while(m<n) { scanf("%d",&a[m]); if(a[m]>1000000000||a[m]<0) { continue; } else{ b[n-b-1]=a[b]; b++; } } printf("%d/n",n); for(m=n-1;m>=0;m--) {printf("%d ",b[m]);} return 0; }
main.c: In function 'main': main.c:20:4: error: invalid operands to binary - (have 'int' and 'int *') 20 | b[n-b-1]=a[b]; | ^ | | | int * main.c:20:11: error: array subscript is not an integer 20 | b[n-b-1]=a[b]; | ^ main.c:21:2: error: lvalue required as increment operand 21 | b++; | ^~
s907174974
p03673
C
#include<stdio.h> int main() { int a[200000],c,t,n,m=0; while(1) { scanf("%d",&n); if(n>=1&&n<=200000) break; } int b[n]; while(m<n) { scanf("%d",&a[m]); if(a[m]>1000000000||a[m]<0) { continue; } else{ b[n-b-1]=a[b]; b++; } } printf("%d/n",n); for(b=n-1;b>=0;b--) {printf("%d ",a[b]);} return 0; }
main.c: In function 'main': main.c:20:4: error: invalid operands to binary - (have 'int' and 'int *') 20 | b[n-b-1]=a[b]; | ^ | | | int * main.c:20:11: error: array subscript is not an integer 20 | b[n-b-1]=a[b]; | ^ main.c:21:2: error: lvalue required as increment operand 21 | b++; | ^~ main.c:25:6: error: assignment to expression with array type 25 | for(b=n-1;b>=0;b--) | ^ main.c:25:17: error: lvalue required as decrement operand 25 | for(b=n-1;b>=0;b--) | ^~ main.c:26:20: error: array subscript is not an integer 26 | {printf("%d ",a[b]);} | ^
s104417750
p03673
C
#include<stdio.h> int main() { int a[200000],c,t,n,b=0; while(1) { scanf("%d",&n); if(n>=1&&n<=200000) break; } while(b<n) { scanf("%d",&a[b]); if(a[b]>1000000000||a[b]<0) { continue; } else{ for(c=b;c>=0;c--) { t=a[c]; a[c]=a[b-c]; a[b-c]=t; } b++; } } printf("%d/n",n); for(b=0;b<n;b++) {printf("%d",a[b]);} renturn 0; }
main.c: In function 'main': main.c:31:5: error: 'renturn' undeclared (first use in this function) 31 | renturn 0; | ^~~~~~~ main.c:31:5: note: each undeclared identifier is reported only once for each function it appears in main.c:31:12: error: expected ';' before numeric constant 31 | renturn 0; | ^~ | ;
s407858958
p03673
C
#include<stdio,h> int main() { int a[200000],c,t,n,b=0; while(1) { scanf("%d",&n); if(n>=1&&n<=200000) break; } while(b<n) { scanf("%d",&a[b]); if(a[b]>1000000000||a[b]<0) { continue; } else{ for(c=b;c>=0;c--) { t=a[c]; a[c]=a[b-c]; a[b-c]=t; } b++; } } printf("%d/n",n); for(b=0;b<n;b++) {printf("%d",a[b]);} renturn 0; }
main.c:1:9: fatal error: stdio,h: No such file or directory 1 | #include<stdio,h> | ^~~~~~~~~ compilation terminated.
s699278809
p03673
C++
#include <iostream> #include <vector> #include <queue> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for(int i=0; i<n; ++i) cin >> a[i]; deque<int> b; for(int i=0; i<n; ++i){ if(i % 2 == 0) b.push_back(a[i]); else b.push_front(a[i]); } if(n % 2 != 0) reverse(b.begin(), b.end()); cout << b[0]; for(int i=1; i<n; ++i) cout << ' ' << b[i]; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:21:9: error: 'reverse' was not declared in this scope 21 | reverse(b.begin(), b.end()); | ^~~~~~~
s138998959
p03673
C
#include<stdio.h> int main() { int n,i,q;long a[200001]; while(~scanf("%d",&n)) { for(i=1;i<=n;i++) { scanf("%ld",&a[i]); } for(q=n;q>=1;q-=2) printf(q==1||q==2?"%ld":"%ld ",a[q]); for(n%2==0?q=1:q=2;q<n;q+=2) printf(q==n-1?" %ld\n":" %ld",a[q]); if(n==1) printf("\n"); } }
main.c: In function 'main': main.c:14:41: error: lvalue required as left operand of assignment 14 | for(n%2==0?q=1:q=2;q<n;q+=2) | ^
s529564176
p03673
Java
class Pushpush { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = input.nextInt(); int[] num = new int[count]; for(int i = 0; i < count; i++) { num[i] = input.nextInt(); } Stack<Integer> stack = new Stack<Integer>(); int[] res = new int[count]; res[0] = num[0]; for(int i = 1; i < count; i++) { stack.clear(); for(int j = 0; j < i; j++) { stack.push(res[j]); } stack.push(num[i]); for(int k = 0; k <= i; k++) { res[k] = stack.pop(); } } for(int i = 0; i < count; i++) { System.out.print(res[i] + " "); } } }
Main.java:4: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Pushpush Main.java:4: error: cannot find symbol Scanner input = new Scanner(System.in); ^ symbol: class Scanner location: class Pushpush Main.java:11: error: cannot find symbol Stack<Integer> stack = new Stack<Integer>(); ^ symbol: class Stack location: class Pushpush Main.java:11: error: cannot find symbol Stack<Integer> stack = new Stack<Integer>(); ^ symbol: class Stack location: class Pushpush 4 errors
s555477078
p03673
Java
import java.util.Scanner; import java.util.Stack; public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = input.nextInt(); int[] num = new int[count]; for(int i = 0; i < count; i++) { num[i] = input.nextInt(); } Stack<Integer> stack = new Stack<Integer>(); int[] res = new int[count]; res[0] = num[0]; for(int i = 1; i < count; i++) { stack.clear(); for(int j = 0; j < i; j++) { stack.push(res[j]); } stack.push(num[i]); for(int k = 0; k <= i; k++) { res[k] = stack.pop(); } } for(int i = 0; i < count; i++) { System.out.print(res[i] + " "); } }
Main.java:4: error: unnamed classes are a preview feature and are disabled by default. public static void main(String[] args) { ^ (use --enable-preview to enable unnamed classes) 1 error
s266411218
p03673
Java
import java.util.Scanner; import java.util.Stack; public class Pushpush { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = input.nextInt(); int[] num = new int[count]; for(int i = 0; i < count; i++) { num[i] = input.nextInt(); } Stack<Integer> stack = new Stack<Integer>(); int[] res = new int[count]; res[0] = num[0]; for(int i = 1; i < count; i++) { stack.clear(); for(int j = 0; j < i; j++) { stack.push(res[j]); } stack.push(num[i]); for(int k = 0; k <= i; k++) { res[k] = stack.pop(); } } for(int i = 0; i < count; i++) { System.out.print(res[i] + " "); } } }
Main.java:4: error: class Pushpush is public, should be declared in a file named Pushpush.java public class Pushpush { ^ 1 error
s058814948
p03673
Java
import java.util.Scanner; import java.util.Stack; public class Pushpush { public static void main(String[] args) { Scanner input = new Scanner(System.in); int count = input.nextInt(); int[] num = new int[count]; for(int i = 0; i < count; i++) { num[i] = input.nextInt(); } Stack<Integer> stack = new Stack<Integer>(); int[] res = new int[count]; res[0] = num[0]; for(int i = 1; i < count; i++) { stack.clear(); for(int j = 0; j < i; j++) { stack.push(res[j]); } stack.push(num[i]); for(int k = 0; k <= i; k++) { res[k] = stack.pop(); } } for(int i = 0; i < count; i++) { System.out.print(res[i] + " "); } }
Main.java:39: error: reached end of file while parsing } ^ 1 error
s323341448
p03673
C++
#include<bits/stdc++.h> #define rep(i,a,n) for (int i = a;i < n;i++) using namespace std; int main() { int a; deque<int> some; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (i % 2 == n % 2) { some.push_back(a); } else { some.push_front(a); } } for (int x:some) { cout << x << endl; }
a.cc: In function 'int main()': a.cc:19:2: error: expected '}' at end of input 19 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s859033726
p03673
C++
6 0 6 7 6 7 0
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 6 | ^
s264280501
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main(void) { int n; cin >> n; int x[200001]; vector <int> y; for (int i = 0; i < n; i++) { cin >> x[i]; } for (int i = 0; i < n; i++) { y.push_back(x[i]); reverse(y.begin(), y.end()); } for (int i = 0; i < n - 1; i++) cout << y[i] << " "; //printf("%\n", y[n - 1]); cout << y[n - 1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:17: error: 'reverse' was not declared in this scope 16 | reverse(y.begin(), y.end()); | ^~~~~~~
s381096551
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main(void) { int n; scanf("%d", &n); int x[200001]; vector <int> y; for (int i = 0; i < n; i++) { cin >> x[i]; } for (int i = 0; i < n; i++) { y.push_back(x[i]); reverse(y.begin(), y.end()); } for (int i = 0; i < n - 1; i++) cout << y[i] << " "; //printf("%\n", y[n - 1]); cout << y[n - 1] << endl; return 0;
a.cc: In function 'int main()': a.cc:16:17: error: 'reverse' was not declared in this scope 16 | reverse(y.begin(), y.end()); | ^~~~~~~ a.cc:22:18: error: expected '}' at end of input 22 | return 0; | ^ a.cc:6:16: note: to match this '{' 6 | int main(void) { | ^
s669341227
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main(void) { int n; scanf("%d", &n); int x[200001]; vector <int> y; for (int i = 0; i < n; i++) { cin >> x[i]; } for (int i = 0; i < n; i++) { y.push_back(x[i]); reverse(y.begin(), y.end()); } for (int i = 0; i < n - 1; i++) cout << y[i] << " "; //printf("%\n", y[n - 1]); cout << y[n - 1] << endl; return 0;
a.cc: In function 'int main()': a.cc:16:17: error: 'reverse' was not declared in this scope 16 | reverse(y.begin(), y.end()); | ^~~~~~~ a.cc:22:18: error: expected '}' at end of input 22 | return 0; | ^ a.cc:6:16: note: to match this '{' 6 | int main(void) { | ^
s961440271
p03673
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> using namespace std; int main(void) { int n; scanf("%d", &n); int x; vector <int> y; for (int i = 0; i < n; i++) { scanf("%d", &x); y.push_back(x); reverse(y.begin(), y.end()); } for (int i = 0; i < n - 1; i++) cout << y[i] << " "; //printf("%\n", y[n - 1]); cout << y[n - 1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:17: error: 'reverse' was not declared in this scope 15 | reverse(y.begin(), y.end()); | ^~~~~~~
s171966582
p03673
C++
#include <iostream> #include <vector> #include <string> using namespace std; int main() { int n; cin >> n; long long int x; vector <long long int> str; for (int i = 0; i < n; i++) { cin >> x; str.push_back(x); reverse(str.begin(), str.end()); } for (int i = 0; i < n - 1; i++) cout << str[i] << " "; cout << str[n - 1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:17: error: 'reverse' was not declared in this scope 14 | reverse(str.begin(), str.end()); | ^~~~~~~
s507570901
p03673
C++
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; long long int x; vector <long long int> str; for (int i = 0; i < n; i++) { cin >> x; str.push_back(x); reverse(str.begin(), str.end()); } for (int i = 0; i < n - 1; i++) cout << str[i] << " "; cout << str[n - 1] << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: 'reverse' was not declared in this scope 13 | reverse(str.begin(), str.end()); | ^~~~~~~
s798578024
p03673
C++
#include<iostream> #include<string> #include<vector> using namespace std; #define REP(i, n) for(int i=0; i<n; i++) int n; string s[200000]; int main(){ cin >> n; REP(i, n){ string t; cin >> t; s[i] = t; } string o = s[0]; for(int i=1; i<n; i++){ if(i%2==0){ o += " " + s[i]; } else { o = s[i] + " " + o; } } if(n!=1 && (n-1)%2==0) reverse(o.begin(), o.end()); cout << o << endl; }
a.cc: In function 'int main()': a.cc:28:28: error: 'reverse' was not declared in this scope 28 | if(n!=1 && (n-1)%2==0) reverse(o.begin(), o.end()); | ^~~~~~~
s292233132
p03673
C++
#include <iostream> #include <deque> using namespace std; int main(){ int n, a; deque<int> dp; cin >> n; for(int i = 0; i < n; i++){ cin >> a; if(i % 2 == (n-1) % 2) dp.push_front(a); else dp.push_back(a); } for(int i = 0; i < n; i++){ cout << v[i] << ((i == n-1) ? "\n" : " "); } return 0; }
a.cc: In function 'int main()': a.cc:17:13: error: 'v' was not declared in this scope 17 | cout << v[i] << ((i == n-1) ? "\n" : " "); | ^
s361668648
p03673
C++
#include<stdio.h> int array [512345]; int a [212345]; int main () { int n; scanf ("%d", &n); for (int i=0; i<n; ++i) scanf ("%d", &a[i]) ; int left =212345 , right = left +1; for (int i=0; i<n; ++i){ if(i%2 == (n -1) %2) { array [left - -]=a[i]; } else { array [ right ++]= a[i]; } } for (int i= left +1; i< right ; ++i) { printf ("%d␣",array [i]) ; } return 0; }
a.cc: In function 'int main()': a.cc:14:17: error: expected primary-expression before ']' token 14 | array [left - -]=a[i]; | ^
s661942141
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,a; deque<int>sort; cin >> n; for(int i = 0; i < n; i++){ cin >> a; if(i % 2 == n % 2){ sort.push_back(a); }else{ sort.push_front(a); } } cout << sort << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::deque<int>') 16 | cout << sort << endl; | ~~~~ ^~ ~~~~ | | | | | std::deque<int> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::deque<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::deque<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::deque<int>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::deque<int>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::deque<int>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::deque<int>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::deque<int>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::deque<int>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::deque<int>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::deque<int>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::deque<int>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::deque<int>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::deque<int>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::deque<int>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::deque<int>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::deque<int>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullptr_t]' 306 | operator<<(nullptr_t) | ^~~~~~~~ /usr/include/c++/14/ostream:306:18: note: no known conversion for argument 1 from 'std::deque<int>' to 'std::nullptr_t' 306 | operator<<(nullptr_t) | ^~~~~~~~~ /usr/include/c
s517950733
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,a; deque<int>sort; cin >> n; for(int i = 0; i < n; i++){ cin >> a; if(i % 2 == n % 2){ sort.push_back(a); }else{ sort.push_front(a); } } cout << x << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:11: error: 'x' was not declared in this scope 16 | cout << x << endl; | ^
s470132720
p03673
C++
#include <bits/stdc++.h> using namespace std; int main(){ int n,a; deque<int>sort; cin >> n; for(int i = 0; i < n; i++){ cin >> a; if(i % 2 == n % 2){ sort.push_back(a); }else{ sort.push_front(a); } } for(int x:some){ cout << x << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:13: error: 'some' was not declared in this scope 16 | for(int x:some){ | ^~~~
s629427369
p03673
C++
#include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <vector> #include <cstdlib> #include <iomanip> #include <cmath> #include <ctime> #include <map> #include <set> #include <queue> #include <stack> using namespace std; #define lowbit(x) (x&(-x)) #define max(x,y) (x>y?x:y) #define min(x,y) (x<y?x:y) #define MAX 100000000000000000 #define MOD 1000000007 #define pi acos(-1.0) #define ei exp(1) #define PI 3.141592653589793238462 #define INF 0x3f3f3f3f3f #define mem(a) (memset(a,0,sizeof(a))) typedef long long ll; ll gcd(ll a,ll b){ return b?gcd(b,a%b):a; } const int N=200005; const int mod=1e9+7; int a[N]; int main() { std::ios::sync_with_stdio(false); while(cin>>n){ for(int i=1;i<=n;++i){ cin>>a[i]; } if(n&1){ cout<<a[n]; for(int i=n-2;i>=1;i-=2) cout<<" "<<a[i]; for(int i=2;i<=n-1;i+=2) cout<<" "<<a[i]; cout<<endl; }else{ cout<<a[n]; for(int i=n-2;i>=2;i-=2) cout<<" "<<a[i]; for(int i=1;i<=n-1;i+=2) cout<<" "<<a[i]; cout<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:35:16: error: 'n' was not declared in this scope 35 | while(cin>>n){ | ^
s099817517
p03673
C++
#include <stdio.h> #include <iostream> #include <sstream> #include <algorithm> #define FOR(x, y, z) for(int x = (z); y; x++) #define rep(x, y) for(int x = 0; x < (y); x++) #define all(x) x.begin(), x.end() #define len(x) (sizeof(x) / sizeof(x[0])) #define split_str(str, sp_word) istringstream stream(str); string res; while(getline(stream,res,sp_word)) #define rem_space(x) x.erase(remove(all(x), ' '),x.end()) #define scl(x) fgets(x, sizeof x, stdin) #define down_queue(x) priority_queue<x> #define up_queue(x) priority_queue<x, vector<x>, greater<x>> using namespace std; int main(){ int N; scanf("%d",&N); getchar(); vector<int> ary; vector<int> anser; string line; getline(cin,line); split_str(line,' '){ anser.push_back(atoi(res.c_str())); reverse(all(anser)); } rep(i,N - 1) printf("%d ",anser[i]); printf("%d\n",anser[N - 1]); return 0; }
a.cc: In function 'int main()': a.cc:21:2: error: 'vector' was not declared in this scope 21 | vector<int> ary; | ^~~~~~ a.cc:5:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 4 | #include <algorithm> +++ |+#include <vector> 5 | #define FOR(x, y, z) for(int x = (z); y; x++) a.cc:21:9: error: expected primary-expression before 'int' 21 | vector<int> ary; | ^~~ a.cc:22:9: error: expected primary-expression before 'int' 22 | vector<int> anser; | ^~~ a.cc:27:4: error: 'anser' was not declared in this scope 27 | anser.push_back(atoi(res.c_str())); | ^~~~~ a.cc:31:28: error: 'anser' was not declared in this scope 31 | rep(i,N - 1) printf("%d ",anser[i]); | ^~~~~ a.cc:32:16: error: 'anser' was not declared in this scope 32 | printf("%d\n",anser[N - 1]); | ^~~~~
s610583738
p03673
Java
import java.util.ArrayDeque; import java.util.Iterator; import java.util.Scanner; // Java8 public class sample { static Scanner sc = new Scanner(System.in); public static void main(String[] args) throws Exception { new sample().run(); } void run() { int n = sc.nextInt(); ArrayDeque<Integer> deq = new ArrayDeque<>(n+1); for(int i=0; i<n; i++) { int a = sc.nextInt(); if((i&1)==0) { deq.offerLast(a); } else { deq.offerFirst(a); } } Iterator<Integer> itr = (n&1)==0 ? deq.iterator() : deq.descendingIterator(); System.out.print(itr.next()); while(itr.hasNext()) { System.out.print(" "); System.out.print(itr.next()); } System.out.println(); } }
Main.java:6: error: class sample is public, should be declared in a file named sample.java public class sample ^ 1 error
s351508211
p03673
Java
import java.util.Scanner; public class Main3 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); Scanner scan = new Scanner(System.in); String str = ""; String ans = ""; String temp = ""; for(int i = 0;i < n; i++){ str = str + scan.next(); } for(int i = 0;i < str.length(); i++){ ans = ans + str.charAt(i); for(int j = 1 ; j < ans.length()+1;j++){ temp = temp + ans.charAt(ans.length()-j); } ans = temp.substring(0, temp.length()); temp = ""; } System.out.println(ans); } }
Main.java:3: error: class Main3 is public, should be declared in a file named Main3.java public class Main3 { ^ 1 error
s657023472
p03673
C++
#include <stdio.h> #include<string.h> int a[200001]; int main(){ int n; scanf("%d", &n); int a[n]; for(int i=0; i < n; i++){ scanf("%d", &a[i]); } for(int i=n-1; i>=0, i-=2){ printf("%d", a[i]); } if(n%2! = 0){ for(int i=2; i <= n; i+=2){ printf("%d", a[i]); }else{ for(int i=1; i <= n; i+=2){ printf("%d", a[i]); } } } return 0; }
a.cc: In function 'int main()': a.cc:16:28: error: expected ';' before ')' token 16 | for(int i=n-1; i>=0, i-=2){ | ^ | ; a.cc:20:9: error: expected ')' before '!' token 20 | if(n%2! = 0){ | ~ ^ | ) a.cc:23:7: error: expected '}' before 'else' 23 | }else{ | ^~~~ a.cc:20:15: note: to match this '{' 20 | if(n%2! = 0){ | ^ a.cc: At global scope: a.cc:31:3: error: expected unqualified-id before 'return' 31 | return 0; | ^~~~~~ a.cc:33:1: error: expected declaration before '}' token 33 | } | ^
s890334047
p03673
C++
#include <iostream> #include <vector> #include <string> #include <limits.h> using namespace std; int main(void) { int N; cin >> N; vector<int> v; for (int i = 0; i < N; ++i) { cin >> v[i]; reverse(v.begin(), v.end()); } for (auto i : v) { cout << i << ' '; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:9: error: 'reverse' was not declared in this scope 19 | reverse(v.begin(), v.end()); | ^~~~~~~
s507067692
p03673
C
#include <stdio.h> int main(void) { int n,j; scanf("%d", &n); int a[n]; j =n; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); j = 0; while (j =! i) { a[j] = a[i-j]; j++; } } for (int c = 0; c < n; c++) { printf("%d ",a[c]); } return 0 } }
main.c: In function 'main': main.c:20:13: error: expected ';' before '}' token 20 | return 0 | ^ | ; ...... 23 | } | ~ main.c: At top level: main.c:29:5: error: expected identifier or '(' before '}' token 29 | } | ^
s817890047
p03673
C
#include <stdio.h> int a[200001]; int main(){ int n,i; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&a[i]); i=0; if(n>1){ for(i=n-1;i>=0;i-=2)printf("%d ",a[i]); i=(i==-1)?0:1; for(;i<n-2;i+=2)printf("%d ",a[i]); } printf("%d\n",a[i]); r
main.c: In function 'main': main.c:14:3: error: 'r' undeclared (first use in this function) 14 | r | ^ main.c:14:3: note: each undeclared identifier is reported only once for each function it appears in main.c:14:4: error: expected ';' at end of input 14 | r | ^ | ; main.c:14:3: error: expected declaration or statement at end of input 14 | r | ^
s310191998
p03673
C++
#include<iostream> #include<deque> using namespace std; int main(){ int a; deque<int>some; int n; for(int i=0;i<n;i++){ cin>>a; if(i%2==n%2){ some.push_back(a); } else{ some.push=back(a); } } for(int x:some){ cout<<x<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:30: error: 'class std::deque<int>' has no member named 'push' 14 | some.push=back(a); | ^~~~ a.cc:14:35: error: 'back' was not declared in this scope 14 | some.push=back(a); | ^~~~
s436701292
p03673
C++
> #include<vector> #include<algorithm> #include<string> #include<deque> using namespace std; int main() { int a; deque<int> b; int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (i % 2 == n % 2) { b.push_back(a); } else { b.push_front(a); } } for (int i : b) { cout << i << " "; } return 0; }
a.cc:1:1: error: expected unqualified-id before '>' token 1 | > | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/vector:62, from a.cc:2: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std' 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared 295 | template <typename _Tp, size_t = sizeof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std' 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared 984 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid 985 | struct __is_array_known_bounds<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std' 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std' 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std' 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std' 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope 1451 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 63 | #include <bits/version.h> +++ |+#include <cstddef> 64 | /usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid 1451 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared 1453 | template<typename _Tp, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope 1454 | struct extent<_Tp[_Size], 0> | ^~~~~ /usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid 1454 | struct extent<_Tp[_Size], 0> | ^ /usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope 1455 | : public integral_constant<size_t, _Size> { }; | ^~~~~ /usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid 1455 | : public integral_constant<size_t, _Size> { }; | ^ /usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid /usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared 1457 | template<typename _Tp, unsigned _Uint, size_t _Size> | ^~~~~~ /usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope 1458 | struct extent<_Tp[_Size], _Uint> | ^~~~~ /usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid 1458 | struct extent<_Tp[_Size], _Uint> | ^ /usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope 1463 | : public integral_constant<size_t, 0> { }; | ^~~~~~ /usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid 1463 | : public integral_constant<size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type 1857 | { static constexpr size_t __size = sizeof(_Tp); }; | ^~~~~~ /usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~~~~ /usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope 1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)> | ^~~ /usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp' 1860 | struct __select; | ^~~~~~~~ /usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared 1862 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^~~ /usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid 1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true> | ^ /usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared 1866 | template<size_t _Sz, typename _Uint, typename... _UInts> | ^~~~~~ /usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> | ^~~ /usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid 1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false> |
s127745630
p03673
C++
#include <bits/stdc++.h> using namespace std; list<int> ans; int n; int x; int main() { scanf("%d" , &n); bool flag = 0; if(n & 1) flag = 0; else flag = 1; for(int i = 1 ; i <= n ; ++i) { scanf("%d" , &x); if(flag) { ans.push_back(x); flag = !flag; //printf("flag1:%d" , flag); } else { ans.push_front(x); flag = !flag; //printf("flag2:%d" , flag); } } for(auto t:ans) { printf("%d " , t); }
a.cc: In function 'int main()': a.cc:36:10: error: expected '}' at end of input 36 | } | ^ a.cc:9:1: note: to match this '{' 9 | { | ^
s098720122
p03673
C++
#include <bits/stdc++.h> using namespace std; list<int> ans; int n; int x; int main() { scanf("%d" , &n); bool flag = 0; if(n & 1) flag = 0; else flag = 1; for(int i = 1 ; i <= n ; ++i) { scanf("%d" , &x); if(flag) { ans.push_back(x); flag = !flag; //printf("flag1:%d" , flag); } else { ans.push_front(x); flag = !flag; //printf("flag2:%d" , flag); } } for(auto t:ans) { printf("%d " , t); }
a.cc: In function 'int main()': a.cc:36:10: error: expected '}' at end of input 36 | } | ^ a.cc:9:1: note: to match this '{' 9 | { | ^
s117124366
p03673
C++
#include<cstdio> #include<iostream> using namespace std; int main(){ long long int i,j,a[200000],b[200000],temp[200000],n; cin>>n; for(i=0;i<n;i++) cin>>a[i]; i=0; while(1){ if(i==n)break b[i]=a[i]; for(j=0;j<=i;j++)temp[j]=b[j]; for(j=i;j>=0;j--)b[i-j]=temp[j]; i++; } for(i=0;i<n-1;i++) cout<<b[i]<<' '; cout<<b[n-1]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:30: error: expected ';' before 'b' 10 | if(i==n)break | ^ | ; 11 | b[i]=a[i]; | ~
s257740304
p03673
C++
//AtCoder Beginner Contest 066 C #include <iostream> #include <string> #include <deque> using namespace std; int main() { int n; cin >> n; int a[200010]; for (int i = 0; i < n; i++) { scanf_s("%d",&a[i]); } deque<int>que; int flag = 0; if (a[n-1] % 2 == 0) {//最後が偶数なら偶数はすべて前に挿入 flag = 1; } for (int i = 0; i < n;i++) { if (flag == 1) { if (a[i] % 2 == 0) que.push_front(a[i]);//偶数なら前に else que.push_back(a[i]);//奇数なら後ろに } else { if (a[i] % 2 != 0) que.push_front(a[i]);//奇数なら前に else que.push_back(a[i]);//偶数なら後ろに } } for (int i = 0; i < que.size();i++) { if (i == n - 1) cout << que[i] << endl; else cout << que[i] << " "; } return 0; }
a.cc: In function 'int main()': a.cc:16:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 16 | scanf_s("%d",&a[i]); | ^~~~~~~ | scanf
s267182122
p03673
C++
#include <bits/stdc++.h> //#ifdef MYDEBUG #define debug(x) cout<<#x<<": "<<x<<endl #define ifcin(x) std::ifstream cin(x) #else #define debug(x) #define ifcin(x) #endif #define ll long long #define esp 1e-14 #define all(x) x.begin(),x.end() #define rep(i,from,to) for(int i=from;i<to;++i) #define REP(i,from,to) for(int i=from;i<=to;++i) using namespace std; int n, a, b; const int MAX = 1000000001; vector<int> Y, T; void solve() { cin >> n; if (n % 2 == 0) { rep(i,0,n/2) { cin >> a >> b; Y.push_back(a); T.push_back(b); } for (int i = n / 2 - 1; i >= 0; --i) { cout << T[i] << " "; } for (int i = 0; i < n / 2 ; ++i) { if(i>0)cout<<" "; cout << Y[i] ; } cout<<endl; } else { rep(i,0,n/2-1) { cin >> a >> b; Y.push_back(a); T.push_back(b); } cin>>a; Y.push_back(a); for (int i = n / 2 + 1; i >= 0; --i) { cout << Y[i] << " "; } for (int i = 0; i < n / 2 ; ++i) { if(i>0)cout<<" "; cout << T[i]; } cout<<endl; } } int main() { solve(); return 0; }
a.cc:5:2: error: #else without #if 5 | #else | ^~~~ a.cc:6:9: warning: "debug" redefined 6 | #define debug(x) | ^~~~~ a.cc:3:9: note: this is the location of the previous definition 3 | #define debug(x) cout<<#x<<": "<<x<<endl | ^~~~~ a.cc:7:9: warning: "ifcin" redefined 7 | #define ifcin(x) | ^~~~~ a.cc:4:9: note: this is the location of the previous definition 4 | #define ifcin(x) std::ifstream cin(x) | ^~~~~ a.cc:8:2: error: #endif without #if 8 | #endif | ^~~~~
s619757431
p03673
C++
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> a, b; for (int i = 0; i < n; i++) { int stdin; cin >> stdin; a.push_back(stdin); } for (int i = 0; i < n; i++) { b.push_back(a[i]); reverse(b.begin(), b.end()); } for (int i = 0; i < n; i++) { cout << b[i] << " "; } cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:5: error: 'reverse' was not declared in this scope 17 | reverse(b.begin(), b.end()); | ^~~~~~~
s764536868
p03673
C++
import Data.Maybe import qualified Data.ByteString.Char8 as B main=putStrLn.unwords.map show.solve.map (fst.fromJust.B.readInt).B.words=<<B.getContents solve (n:as) |odd n=reverse a1s++a2s |otherwise=reverse a2s++a1s where (a1s,a2s)=(f odd&&&f even)as f g=map snd.filter (g.fst).zip [1..]
a.cc:8:33: error: too many decimal points in number 8 | f g=map snd.filter (g.fst).zip [1..] | ^~~ a.cc:1:1: error: 'import' does not name a type 1 | import Data.Maybe | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s375879703
p03673
C++
#include <iostream> #include <queue> #include <stack> #include <string> #include <set> #include <map> #include <cctype> #include <deque> #define rep(i,a,b) for(int i=a; i<b; i++) #define rrep(i,a,b) for(int i=a; i>=b; i--) using namespace std; int main(){ deque<int> dq; int n,a; cin>>n; rep(i,0,n){ cin>>a; if(i%2==1){ dq.push_back(a); }else{ dq.push_front(a); } } if(n%2==0){ reverse(dq.begin(),dq.end()); } rep(i,0,n){ if(i)cout<<" "; cout<<dq[i]; } cout<<endl; }
a.cc: In function 'int main()': a.cc:26:9: error: 'reverse' was not declared in this scope 26 | reverse(dq.begin(),dq.end()); | ^~~~~~~
s202065333
p03673
C++
#include <iostream> #include <queue> #include <stack> #include <string> #include <set> #include <map> #include <cctype> #include <deque> #define rep(i,a,b) for(int i=a; i<b; i++) #define rrep(i,a,b) for(int i=a; i>=b; i--) using namespace std; int main(){ deque<int> dq={}; int n,a; cin>>n; rep(i,0,n){ cin>>a; if(i%2==1){ dq.push_back(a); }else{ dq.push_front(a); } } if(n%2==0){ reverse(dq.begin(),dq.end()); } rep(i,0,n){ if(i)cout<<" "; cout<<dq[i]; } cout<<endl; }
a.cc: In function 'int main()': a.cc:27:9: error: 'reverse' was not declared in this scope 27 | reverse(dq.begin(),dq.end()); | ^~~~~~~
s359826780
p03673
C++
#include <stdio.h> #include <stdlib.h> int main() { int *S,*T; int i,n,j,t; scanf("%d",&n); S=malloc(sizeof(int)*n); T=malloc(sizeof(int)*n); for(i=0;i<n;i++) scanf("%d",&S[i]); for(i=0;i<n;i++){ T[i]=S[i]; for(j=0;j<((i+1)/2);j++){ t=T[j]; T[j]=T[i-j]; T[i-j]=t; } } for(i=0;i<n;i++) printf("%d ",T[i]); return 0; }
a.cc: In function 'int main()': a.cc:8:17: error: invalid conversion from 'void*' to 'int*' [-fpermissive] 8 | S=malloc(sizeof(int)*n); | ~~~~~~^~~~~~~~~~~~~~~ | | | void* a.cc:9:17: error: invalid conversion from 'void*' to 'int*' [-fpermissive] 9 | T=malloc(sizeof(int)*n); | ~~~~~~^~~~~~~~~~~~~~~ | | | void*