// Quicksort benchmark - sorting algorithm
fn quicksort(arr: Vec<i64>) -> Vec<i64> {
    if arr.len() <= 1 { return arr; }
    let pivot = arr[0];
    let rest: Vec<i64> = arr[1..].to_vec();
    let less: Vec<i64> = rest.iter().filter(|&&x| x < pivot).cloned().collect();
    let greater: Vec<i64> = rest.iter().filter(|&&x| x >= pivot).cloned().collect();
    let mut result = quicksort(less);
    result.push(pivot);
    result.extend(quicksort(greater));
    result
}

fn main() {
    let nums: Vec<i64> = (0..1000).map(|i| (i * 7 + 13) % 1000).collect();
    let sorted = quicksort(nums);
    println!("Sorted {} elements", sorted.len());
}
