#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

template<class Val, class Cmp>
class SparseTableRMQ {
public:
    SparseTableRMQ() {
    }
    SparseTableRMQ(const vector<Val> &ar) : n((int)ar.size()), data(n) {
        for (int i = 0; i < n; ++i) data[i] = ar[i];
        table = buildRMQ();
    }

    int queryPos(int l, int r) {
        int k = lgInt(r - l - 1);
        int lid = table[l + n*k], rid = table[r + n*k - (1 << k)];
        return (cmp(data[lid], data[rid])) ? lid : rid;
    }

    int queryValue(int l, int r) {
        return data[queryPos(l, r)];
    }
private:
    int n;
    vector<Val> data;
    vector<int> table;
    Cmp cmp;
    int lgInt(int v) {
        static const unsigned b[] = { 0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000 };
        static const unsigned S[] = { 1, 2, 4, 8, 16 };
        int res = 0;
        for (int i = 4; i >= 0; i--) {
            if (v & b[i]) {
                v >>= S[i];
                res |= S[i];
            }
        }
        return res;
    }

    vector<int> buildRMQ() {
        int logn = 1;
        for (int k = 1; k < n; k *= 2) ++logn;
        vector<int> b(n*logn);
        for (int i = 0; i < n; ++i)b[i] = i;
        int cur = 0;
        for (int k = 1; k < n; k *= 2) {
            copy(b.begin() + cur, b.begin() + cur + n, b.begin() + cur + n);
            cur += n;
            for (int i = 0; i < n - k; ++i) {
                int idl = b[cur + i], idr = b[cur + i + k];
                if (cmp(data[idl], data[idr])) {
                    b[cur + i] = idl;
                } else {
                    b[cur + i] = idr;
                }
            }
        }
        return b;
    }
};
typedef SparseTableRMQ<int, less_equal<int>> RMinQ;
typedef SparseTableRMQ<int, greater_equal<int>> RMaxQ;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    const int INF = 1 << 30;
    int N, K, Q;
    cin >> N >> K >> Q;
    vi A(N), vis(N);
    each(a, A)cin >> a;
    A.push_back(-1);
    priority_queue<int, vector<int>, greater<int> > pq;
    int re = INF;
    rep(a, N - K + 1) {
        int mi = INF;
        FOR(b, a, a + K) {
            smin(mi, A[b]);
        }
        vi ps;
        FOR(b, a, a + K) {
            if (mi == A[b])ps.push_back(b);
        }
        each(b, ps)if (!vis[b]++) {
            vi B;
            rep(c, N+1) {
                if (A[c] >= mi) {
                    B.push_back(A[c]);
                } else {
                    if (sz(B) >= K) {
                        sort(all(B));
                        for (int d = 0; d + K <= sz(B); ++d) {
                            pq.push(B[d]);
                        }
                    }
                    B.clear();
                }
            }
            if (sz(pq) >= Q) {
                int ma = mi;
                rep(c, Q) {
                    ma = pq.top();
                    pq.pop();
                }
                smin(re, ma - mi);
            }
            while (sz(pq)) pq.pop();
        }
    }
    cout << re << endl;
}

Measured memory_bytes: 256