Problem:
Entrance Examination The International Competitive Programming College (ICPC) is famous
for its research on competitive programming.
Applicants to the college are required to take its entrance examination. The successful applicants of the examination are chosen as follows.  The score of any successful applicant is higher than that of any unsuccessful applicant.  The number of successful applicants n must be between n min and n max , inclusive.
We choose n within the specified range that maximizes the gap. Here, the gap means the difference between the lowest score of
successful applicants and the highest score of unsuccessful applicants.  When two or more candidates for n make exactly the same gap, use the greatest n among them.  Let's see the first couple of examples given in Sample Input below.
In the first example, n min and n max are two and four, respectively, and there are five applicants whose scores are 100, 90, 82, 70, and 65.
For n of two, three and four, the gaps will be 8, 12, and 5, respectively.
We must choose three as n , because it maximizes the gap. In the second example, n min and n max are two and four, respectively, and there are five applicants whose scores are 100, 90, 80, 75, and 65.
For n of two, three and four, the gap will be 10, 5, and 10, 
respectively. Both two and four maximize the gap, and we must choose the
 greatest number, four. You are requested to write a program that computes the number of successful applicants that satisfies the conditions. Input The input consists of multiple datasets. Each dataset is formatted as follows.  m  n min  n max  P 1  P 2 ...  P m  The first line of a dataset contains three integers separated by single spaces. m represents the number of applicants, n min represents the minimum number of successful applicants, and n max represents the maximum number of successful applicants.
Each of the following m lines contains an integer P i , which represents the score of each applicant.
The scores are listed in descending order.
These numbers satisfy 0 < n min < n max < m ≤ 200, 0 ≤ P i ≤ 10000 (1 ≤ i ≤ m ) and P n min > P n max +1 . These ensure that there always exists an n satisfying the conditions. The end of the input is represented by a line containing three zeros separated by single spaces. Output For each dataset, output the number of successful applicants in a line. Sample Input 5 2 4
100
90
82
70
65
5 2 4
100
90
80
75
65
3 1 2
5000
4000
3000
4 2 3
10000
10000
8000
8000
4 2 3
10000
10000
10000
8000
5 2 3
100
80
68
60
45
0 0 0 Output for the Sample Input 3
4
2
2
3
2

Solution (Python):
def main():
    while True:
        m, nmin, nmax = [int(s) for s in input().strip().split(' ')]
        if m == 0:
            break

        plist = sorted((int(input().strip()) for _ in range(m)), reverse=True)
        ni = 0
        gap = 0
        for i in range(nmin-1, nmax):
            ngap = plist[i] - plist[i+1]
            if gap <= ngap:
                gap = ngap
                ni = i
        print(ni+1)

if __name__ == '__main__':
    main()

Solution (Python):
while True:
    num, mini, maxi = map(int, input().split())
    if num == 0: break
    scores = [ int(input()) for i in range(num) ]
    gap = 0
    ans = 0
    for i in range(mini, maxi + 1):
        gap = scores[i-1] - scores[i] if scores[i-1] - scores[i] >= gap else gap
        ans = i if scores[i - 1] - scores[i] >= gap else ans

    print(ans)

Solution (Python):
while 1:
    m,a,b = map(int, input().split())
    if m==0: break
    p = [int(input()) for i in range(m)]
    key = 0
    ans = 2
    for i in range(a,b+1):
        v = p[i-1]-p[i]
        if v >= key:
            ans = i
            key = v
    print(ans)

Solution (Python):

while 1:
    m,n_min,n_max=map(int,input().split())
    if m==0:
        break
    data=[]
    for i in range(m):
        data.append(int(input()))
    data=sorted(data,reverse=True)
    mx=(-1,-1)
    for i in range(n_min,n_max+1):
        if data[i-1]-data[i]>=mx[0]:
            mx=(data[i-1]-data[i],i)
    print(mx[1])