//QuickSort
int partition(vector<int>& A,int low,int high){
int pivot=A[low];
while(low<high){
while(low<high && A[high]>=pivot) high--;
A[low]=A[high];
while(low<high && A[low]<=pivot) low++;
A[high]=A[low];
}
A[low]=pivot;
return low;
}
void QuickSort(vector<int>& A,int low,int high){
if(low<high){
int ioc=partition(A,low,high);
QuickSort(A,low,ioc-1);
QuickSort(A,ioc+1,high);
}
}
//Merge Sort
void Merge(vector<int>& A,int left,int right,vector<int> B){
if(left+1>=right) return;
int mid=(left+right)/2;
int i=left,j=mid,k=0;
while(i<mid && j<right){
if(B[i]<B[j]) A[k++]=B[i++];
else A[k++]=B[j++];
}
while(i<mid