#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;
const ll mod = (int)1e9 + 7;

const int N = (int)2e4 + 100;
int a[N], lmin[N], rmin[N], left_less[N], right_less[N];
int t[4 * N];

int add(int v, int tl, int tr, int u) {
    if (tl == tr) {
        t[v]++;
    } else {
        int tm = (tl + tr) / 2;
        if (u <= tm)
            add(2 * v, tl, tm, u);
        else
            add(2 * v + 1, tm + 1, tr, u);
        t[v]++;
    }
}

int gets(int v, int tl, int tr, int l, int r) {
    if (l > r) {
        return 0;
    }
    if (tl == l && tr == r) {
        return t[v];
    }

    int tm = (tl + tr) / 2;
    return gets(2 * v, tl, tm, l, min(r, tm)) + gets(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);
}


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, k, q;
    cin >> n >> k >> q;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<pair<int, int>> b(n);
    for (int i = 0; i < n; ++i) {
        b[i] = {a[i], i};
    }

    sort(b.begin(), b.end());

    stack<pair<int, int>> st;
    for (int i = 0; i < n; ++i) {
        while (!st.empty() && st.top().first >= a[i]) {
            st.pop();
        }
        if (st.empty()) {
            lmin[i] = -1;
        } else {
            lmin[i] = st.top().second;
        }
        st.push({a[i], i});
    }

    while (!st.empty()) st.pop();

    for (int i = n - 1; i >= 0; --i) {
        while (!st.empty() && st.top().first >= a[i]) {
            st.pop();
        }
        if (st.empty()) {
            rmin[i] = n;
        } else {
            rmin[i] = st.top().second;
        }
        st.push({a[i], i});
    }

//    for (int i = 0; i < n; ++i) {
//        for (int j = 0; j < n; ++j) {
//            cout << i << " " << j << " " << a[i] - a[j] << '\n';
//        }
//    }

    int ans = inf;
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < 4 * n; ++i) {
            t[i] = 0;
        }
        int mnval = b[j].first;
        int last = -1;
        for (int i = 0; i < n; ++i) {
            if (a[i] < mnval) {
                last = i;
            } else {
                left_less[i] = last;
            }
        }
        last = n;
        for (int i = n - 1; i >= 0; --i) {
            if (a[i] < mnval) {
                last = i;
            } else {
                right_less[i] = last;
            }
        }

        set<int> not_del_left, not_del_right;
        int used = 0;
        int el, left, right;
        int pos = j;
        if (rmin[b[j].second] - lmin[b[j].second] - 1 < k) continue;
        while (used < q && pos < n) {
            el = b[pos].second;

            if (rmin[el] - lmin[el] - 1 - gets(1, 0, n - 1, lmin[el] + 1, rmin[el] - 1) >= k) {
                used++;
                add(1, 0, n - 1, el);
            } else {
                auto it = not_del_left.upper_bound(-el);
                int left_bad = -1;
                if (it != not_del_left.end()) {
                    left_bad = *it;
                }
                left = min(lmin[el], max(left_less[el], left_bad));
                it = not_del_right.upper_bound(el);
                int right_bad = n;
                if (it != not_del_right.end()) {
                    right_bad = *it;
                }
                right = max(rmin[el], min(right_less[el], right_bad));
                if (right - left - 1 - gets(1, 0, n - 1, left + 1, right - 1) >= k) {
                    used++;
                    add(1, 0, n - 1, el);
                } else {
                    not_del_left.insert(-el);
                    not_del_right.insert(el);
                }
            }
            pos++;
        }

        if (used == q) {
            ans = min(ans, b[pos - 1].first - b[j].first);
        }
    }

    cout << ans;


    return 0;
}

Measured memory_bytes: 512