Optimization for merge sort

while running the below merge sort prog. it shows TLE on hacker blocks
what could be the possible optimization
It is the same code that prateek bhaiya taught us

#include
using namespace std;
void merge(int *arr,int s,int e){
int mid=(s+e)/2;
int i=s;
int j=mid+1;
int k=s;

int temp[1000000];
while(i<=mid&&j<=e){
 if(arr[i]<arr[j]){
     temp[k++]=arr[i++];
 }
 else
 {
     temp[k++]=arr[j++];
 }
    
}
while(i<=mid){
     temp[k++]=arr[i++];
}
 while(j<=e){
     temp[k++]=arr[j++];
}

for(int p=0;p<=e;p++){
    arr[p]=temp[p];
}

}

void mergesort(int *arr,int s,int e){
if(s>=e){
return;
}
int mid=(s+e)/2;
mergesort(arr,s,mid);
mergesort(arr,mid+1,e);
merge(arr,s,e);
}

int main() {
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}

mergesort(arr,0,n-1);



 for(int i=0;i<n;i++){
    cout<<arr[i]<<" ";
}


return 0;

}

Since constraints are very large, plz use long long int, instead of only int.
and also in line no 31, use
for(int p=s;p<=e;p++)