#include <stdio.h>
#include <stdlib.h>
#define XORSWAP(a, b) ((a)^=(b),(b)^=(a),(a)^=(b))
int partition(int v[], int left, int right){
int i, j, p;
p = v[left];
i = left;
j = right + 1;
while(i < j){
while(v[i] < p) i++;
while(v[j] > p) j--;
XORSWAP(v[i], v[j]);
}
XORSWAP(v[i], v[j]);
XORSWAP(v[left], v[j]);
return j;
}
void quicksort(int v[], int left, int right){
if(left < right){
int s = partition(v, left, right);
quicksort(v, left, s - 1);
quicksort(v, s + 1, right);
}
}
int main(){
int i;
int v[10] = {7, 3, 1, 2, 5, 10, 9, 7, 8, 6};
quicksort(v, 0, 9);
for(i = 0; i < 10; i++)
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCiNkZWZpbmUgWE9SU1dBUChhLCBiKQkoKGEpXj0oYiksKGIpXj0oYSksKGEpXj0oYikpCgppbnQgcGFydGl0aW9uKGludCB2W10sIGludCBsZWZ0LCBpbnQgcmlnaHQpewoJaW50IGksIGosIHA7CgoJcCA9IHZbbGVmdF07CglpID0gbGVmdDsKCWogPSByaWdodCArIDE7Cgl3aGlsZShpIDwgail7CgkJd2hpbGUodltpXSA8IHApIGkrKzsKCQl3aGlsZSh2W2pdID4gcCkgai0tOwoJCVhPUlNXQVAodltpXSwgdltqXSk7Cgl9CglYT1JTV0FQKHZbaV0sIHZbal0pOwoJWE9SU1dBUCh2W2xlZnRdLCB2W2pdKTsKCXJldHVybiBqOwp9Cgp2b2lkIHF1aWNrc29ydChpbnQgdltdLCBpbnQgbGVmdCwgaW50IHJpZ2h0KXsKCWlmKGxlZnQgPCByaWdodCl7CgkJaW50IHMgPSBwYXJ0aXRpb24odiwgbGVmdCwgcmlnaHQpOwoJCXF1aWNrc29ydCh2LCBsZWZ0LCBzIC0gMSk7CgkJcXVpY2tzb3J0KHYsIHMgKyAxLCByaWdodCk7Cgl9Cn0KCmludCBtYWluKCl7CglpbnQgaTsKCWludCB2WzEwXSA9IHs3LCAzLCAxLCAyLCA1LCAxMCwgOSwgNywgOCwgNn07CgkKCXF1aWNrc29ydCh2LCAwLCA5KTsKCWZvcihpID0gMDsgaSA8IDEwOyBpKyspCgkJcHJpbnRmKCIlZCAiLCB2W2ldKTsKCglzY2FuZigiJWQiLCAmaSk7Cn0=