Run time error?

#include
using namespace std;
#define ll long long
void merge(ll *a,ll s,ll e){
ll mid=(s+e)/2;
ll i=s;
ll j=mid+1;
ll k=s;
ll temp[1000000];
while(i<=mid && j<=e){
if(a[i]<=a[j]){
temp[k++]=a[i++];
}
else{
temp[k++]=a[j++];
}
}
while(i<=mid){
temp[k++]=a[i++];
}
while(j<=e){
temp[k++]=a[j++];
}
for(ll m=s;m<=e;m++){
a[m]=temp[m];
}
}
void mergesort(ll *a,ll s,ll e){
if(s>=e){
return;
}
ll mid =(s+e)/2;
mergesort(a,s,mid);
mergesort(a,mid+1,e);
merge(a,s,e);
}
int main() {
ll n;
cin>>n;
ll a[n];
for(ll i=0;i<n;i++){
cin>>a[i];
}
mergesort(a,0,n-1);
for(ll i=0;i<n;i++){
cout<<a[i]<<" ";
}
return 0;
}