Why runtime error is coming?

Median of Sorted Arrays

We are given two sorted arrays of same size n. Find the median of an array formed after merging these two sorted arrays.

my code https://ide.codingblocks.com/s/59592

Brother there is no need of recursion here.
Please try solving the problem in O(n).

Hint: use 2 iterators on the 2 arrays until iterations on both of them combined reaches the medians’s location.

EXTRA SUGGESTION :
Instead of

cin >> z ;
a[i] = z ;

Just simply do

cin >> a[i] ;