#include <stdio.h>

#include <stdlib.h>

#define N 3
 
// A utility function to swap x and y 
void swap(int* a, int* b) 
{ 
    int t = *a; 
    *a = *b; 
    *b = t; 
} 

// A utility function to partition and get pivot 
int partition (int arr[], int low, int high) 
{
    int pivot = arr[high];
    int i = (low - 1); 

    for (int j = low; j <= high- 1; j++) 
    {
        if (arr[j] < pivot) 
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
} 

// A utility function to perform quicksort on given range.