import heapq

N, K, Q = [int(_) for _ in input().split()]

A = [int(_) for _ in input().split()]

sA = sorted(set(A))

A += [-1]

ans = float('inf')



for amin in sA:

    cand = []

    fr = 0

    to = -1

    for i in range(N + 1):

        a = A[i]

        if a >= amin:

            if fr == -1:

                fr = i

        elif a < amin and fr >= 0:

            cand += sorted(A[fr:i])[:max(0, i - fr - K + 1)]

            fr = -1

    if len(cand) < Q:

        break

    ans = min(ans, sorted(cand)[Q - 1] - amin)

print(ans)

import heapq

N, K, Q = [int(_) for _ in input().split()]

A = [int(_) for _ in input().split()]

sA = sorted(A)

A += [-1]

ans = float('inf')

for amin in sA:

    cand = []

    dp = []

    for i in range(N + 1):

        a = A[i]

        if a >= amin:

            heapq.heappush(dp, a)

        if len(dp) and a < amin:

            m = len(dp) - K + 1

            for _ in range(m):

                heapq.heappush(cand, heapq.heappop(dp))

            dp = []

    y = float('inf')

    if len(cand) < Q:

        break

    for _ in range(Q - 1):

        heapq.heappop(cand)

    ans = min(ans, heapq.heappop(cand) - amin)

print(ans)

import heapq

N, K, Q = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
sA = sorted(set(A))
A += [-1]
ans = float("inf")
for amin in sA:
    cand = []
    fr = 0
    to = -1
    for i in range(N + 1):
        a = A[i]
        if a >= amin:
            if fr == -1:
                fr = i
        elif a < amin and fr >= 0:
            cand += sorted(A[fr:i])[: max(0, i - fr - K + 1)]
            fr = -1
    if len(cand) < Q:
        break
    ans = min(ans, sorted(cand)[Q - 1] - amin)
print(ans)

import heapq

N, K, Q = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
sA = sorted(A)
A += [-1]
ans = float("inf")
for amin in sA:
    cand = []
    dp = []
    for i in range(N + 1):
        a = A[i]
        if a >= amin:
            heapq.heappush(dp, a)
        if len(dp) and a < amin:
            m = len(dp) - K + 1
            for _ in range(m):
                heapq.heappush(cand, heapq.heappop(dp))
            dp = []
    y = float("inf")
    if len(cand) < Q:
        break
    for _ in range(Q - 1):
        heapq.heappop(cand)
    ans = min(ans, heapq.heappop(cand) - amin)
print(ans)

-sA = sorted(set(A)) +sA = sorted(A) -    fr = 0 -    to = -1 +    dp = [] -            if fr == -1: -                fr = i -        elif a < amin and fr >= 0: -            cand += sorted(A[fr:i])[: max(0, i - fr - K + 1)] -            fr = -1 +            heapq.heappush(dp, a) +        if len(dp) and a < amin: +            m = len(dp) - K + 1 +            for _ in range(m): +                heapq.heappush(cand, heapq.heappop(dp)) +            dp = [] +    y = float("inf") -    ans = min(ans, sorted(cand)[Q - 1] - amin) +    for _ in range(Q - 1): +        heapq.heappop(cand) +    ans = min(ans, heapq.heappop(cand) - amin)