def merge(lh,rh):
al = [0] * (len(lh) + len(rh))
i = 0
j = 0
k = 0
while i < len(lh) and j < len(rh):
if(lh[i] <= rh[j]):
al[k] = lh[i]
i+=1
k+=1
else:
al[k] = rh[j]
j+=1
k+=1
while i < len(lh):
al[k] = lh[i]
i+=1
k+=1
while j < len(rh):
al[k] = rh[j]
j+=1
k+=1
return al
def mergeSort(arr,l,r):
if(l == r):
nl = [arr[l]]
return nl
mid = int((l + r)/2);
lh = mergeSort(arr,l,mid)
rh = mergeSort(arr,mid+1,r)
ans = merge(lh,rh)
return ans
n = int(input())
str = input().split(" ")
list = [int(no) for no in str]
list = mergeSort(list,0,len(list) - 1)
for i in list:
print(i,end = " ")
Here is my code it passes all of my custom test cases but gives run time error after submission