Please help me with this question, i am not able to cler all the test cases

#include
#include
using namespace std;
int main()
{
int n;
cin>>n;
int a[2000],b[1000];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
cin>>b[i];
}
for(int i=0;i<n;i++)
{
a[i+n]=b[i];
}
sort(a,a+(2*n));
cout << a[n-1];

}