Please check the code it give error

#include
#include
using namespace std;
int main() {
int i=0;
int j=0;
int k=0;
int n;
cin>>n;
int arr[n];
int arr1[n];
int ans[2*n];
for(int a=0;i<n;i++){
cin>>arr[i];
}
for(int a=0;i<n;i++){
cin>>arr1[i];
}
while(i<arr.size() && j< arr1.size()){
if(arr[i]<arr1[j]){
ans[k]=arr[i];
i++;
k++;
}
else
{
ans[k]=arr1[j];
j++;
k++;
}
}
int size=ans.size();
if(size%2==0)
cout<<ans[size];
else
cout<<ans[size+1];

return 0;

}

@sahudilip138 Please provide the code in IDE

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.