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):



while True:
	m, nmin, nmax = map(int, input().split())
	if m == 0: break
	p = [int(input()) for i in range(m)]
	gap = 0
	for i in range(nmax-1, nmin-2, -1):
		d = p[i]-p[i+1]
		if d > gap: gap, ans = d, i
	print(ans+1)

Solution (Python):
anslist = []

while True:
    m, nmin, mmax = map(int, input().split())
    if m == 0 and nmin == 0 and mmax == 0:
        break
    p = [int(input()) for i in range(m)]
    p.sort()

    ans = 0
    line = 0
    for i in range(m - mmax, m - nmin + 1):
        if ans < p[i] - p[i - 1]:
            ans = p[i] - p[i - 1]
            line = i
    
    anslist.append(m - line)

for i in anslist:
    print(i)

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if m == 0 and n_min == 0 and n_max == 0:
        break
    P = [int(input()) for _ in range(m)]
    ans = [0, 0]
    for i in range(n_min, n_max+1):
        
        ans[0] = max(P[i - 1] - P[i], ans[0])
        if ans[0] == P[i - 1] - P[i]:
            ans[1] = i
    print(ans[1])

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

while True:
    m,nmin,nmax = inpl()
    if m == 0:
        break
    else:
        pp = [int(input()) for _ in range(m)]
        pp.sort(reverse=True)
        ans = 0
        ansgap = -1
        for n in range(nmin,nmax+1):
            gap = pp[n-1] - pp[n]
            if ansgap <= gap:
                ansgap = gap
                ans = n

        print(ans)

Solution (Python):







while True :

  m, nmin, nmax = map(int,input().split())
  
  if m == 0:
    break
  else:
    
    n = [int(input()) for i in range(m)]
    
    gap = 0
    cnt = 0
    
    for i in range(nmax, nmin-1,-1) :
      
      if (abs(n[i]- n[i-1])) > gap :
        
        gap =  abs(n[i] - n[i-1])
        cnt = i
        
        
        
    
    print(cnt)

Solution (Python):
import sys
anslist = []
while True:
    m, nmin, nmax = [int(i) for i in input().split()]
    if m == 0:
        for i in anslist:
            print(i)
        sys.exit()
    p = [int(input()) for i in range(m)]
    ansnum = 0
    ans = 0
    for i in range(nmin-1,nmax):
        if ansnum <= p[i]-p[i+1] and not p[i]-p[i+1]==0:
            ans = i
            ansnum = p[i]-p[i+1]
    anslist.append(ans+1)

Solution (Python):
while True:
    m,nMin,nMax=map(int,raw_input().split())
    if m==0: break
    p=[]
    for _ in xrange(m):
        p.append(int(raw_input()))
    maxN=0
    maxD=0
    for i in xrange(nMin-1,nMax):
        if maxD <= p[i]-p[i+1]:
            maxD = p[i]-p[i+1]
            maxN = i+1
    print maxN

Solution (Python):
while True:
    m,mn,mx = map(int,input().split())
    if m==0: break
    l = [int(input()) for _ in range(m)]
    r = []
    for i in range(mn,mx+1):
        r += [l[i-1]-l[i]]
    print(max([i+mn for i,x in enumerate(r) if x==max(r)]))

Solution (Python):
while True:
    m,mn,mx = map(int,raw_input().split())
    if m==0: break
    l = [int(input()) for _ in range(m)]
    r = []
    for i in range(mn,mx+1):
        r += [l[i-1]-l[i]]
    print max([i+mn for i,x in enumerate(r) if x==max(r)])

Solution (Python):
while True:
    sa_max = 0
    Sa = []
    num = 0
    Poi_lis = []
    m,nmin,nmax = map(int,input().split())
    if [m,nmin,nmax] == [0,0,0]:
        break
    for i in range(m):
        Poi_lis.append(int(input()))
        if nmin + 1 <= i + 1 <= nmax + 1:
            Sa.append(Poi_lis[i - 1] - Poi_lis[i])
    Sa_r = Sa[::-1]
    
    cou = Sa_r.index(max(Sa_r))
    print(nmin + len(Sa) - cou - 1)

Solution (Python):
while 1:
    m, n1, n2 = map(int, raw_input().split())
    if m==0:
        break
    P = [int(raw_input()) for i in xrange(m)]
    P.sort()
    m = 0
    idx = -1
    for i in xrange(n2, n1-1, -1):
        v = P[-i] - P[-i-1]
        if m < v:
            m = v
            idx = i
    print idx

Solution (Python):



while True:
    (m, nmin, nmax) = map(int, raw_input().split())
    if m == 0:
        break

    scores = []
    for i in range(m):
        scores.append(int(raw_input()))
    
    submax = 0
    for i in range(nmin, nmax+1):
        subtmp = scores[i-1] - scores[i]
        if subtmp >= submax:
            ans = i
            submax = subtmp

    print ans

Solution (Python):
while 1:
    a,b,c=map(int,input().split())
    if a==0:break
    d=[int(input()) for i in range(a)]
    e=0
    for i in range(b,c+1):
        if d[i-1]-d[i]>=e:
            e=d[i-1]-d[i]
            f=i
    print(f)

Solution (Python):
while 1:
    m,nn,nx= map(int,input().split())
    if m==0: break
    s=[int(input()) for _ in range(m)]
    v=k=0
    for i in range(nn-1,nx):
        t=s[i]-s[i+1]
        if v<=t:
            k,v=i+1,t
    print(k)

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if m == n_min == n_max == 0:
        break
    prev = int(input())
    diff = [0] * m
    mx = 0

    for i in range(1, m):
        now = int(input())
        diff[i] = prev - now
        prev = now

    ans = 0
    for i in range(n_min, n_max + 1):
        if mx <= diff[i]:
            ans = i
            mx = diff[i]

    print(ans)

Solution (Python):

def solver():
    m, nmin, nmax = map(int, input().split())
    if m == 0 and nmin == 0 and nmax == 0:
        return None
    p = [int(input()) for _ in range(m)]
    ans = 0
    maxdelta = 0
    for a in range(nmin, nmax+1):
        delta = p[a-1] - p[a]
        if delta >= maxdelta:
            maxdelta = delta
            ans = a
    return ans

outputs = []
while True:
    ans = solver()
    if ans == None:
        break
    outputs.append(ans)
print('\n'.join(map(str, outputs)))

Solution (Python):
def solve():
    m, mn, mx = map(int, input().split())
    if m == 0 and mn == 0 and mx == 0:
        return False

    p = [int(input()) for x in range(m)]

    result, ans = 0, 0

    for i in range(mn, mx + 1):
        if p[i - 1] - p[i] >= result:
            result = p[i - 1] - p[i]
            ans = i
    print(ans)
    return True

while solve(): pass

Solution (Python):
if __name__ == "__main__":
    while 1:
        m,nmin,nmax = list(map(int,input().strip().split()))
        if m == nmin == nmax ==0:break
        points = []
        for _ in range(m):points.append(int(input()))
        ans = 0
        diff = 0
        for i in range(nmin,nmax+1):
            if diff < points[i-1] - points[i]:
                ans = i
                diff = points[i-1] - points[i]
            elif diff == points[i-1] -points[i] and i > ans :ans =i
        print(ans)

Solution (Python):
from collections import Counter
while True:
    M,NMIN,NMAX = map(int,input().split())
    if M == 0: break
    src = [int(input()) for i in range(M)]
    ctr = Counter(src)
    ctr = list(ctr.items())
    ctr.sort(reverse=True)
    
    n = passed = maxgap = 0
    for (s1,n1),(s2,n2) in zip(ctr, ctr[1:]):
        n += n1
        if n < NMIN: continue
        if n > NMAX: break
        gap = s1-s2
        if gap >= maxgap:
            maxgap = gap
            passed = n
    print(passed)

Solution (Python):


while True:
	m,a,b = map(int, raw_input().split(' '))
	if m == 0:
		break
	P = [int(raw_input()) for i in range(0,m)]
	x,ans = -1,0
	for i in range(a,b+1):
		sub = P[i-1] - P[i]
		if x < sub:
			x = sub
		if x == sub:
			ans = i
	print ans

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if m == 0:
        break
    p = [int(input()) for _ in range(m)]
    ans = tmp = 0
    for i in range(n_min, n_max+1):
        hoge = p[i-1] - p[i]
        if tmp <= hoge:
            tmp = hoge
            ans = i
    print(ans)

Solution (Python):
while True:
    m, n_min, n_max = map(int, raw_input().split())

    if m == 0 and n_min == 0 and n_max == 0:
        break

    P = [int(raw_input()) for _ in range(m)]

    ans, t = 0, 0

    for i in range(n_min, n_max+1):
        if t <= P[i-1] - P[i]:
            ans = i
            t = P[i-1] - P[i]
    print ans

Solution (Python):
while True:
    m, n1, n2 = map(int, input().split())
    if m == 0:
        break
    p = [int(input()) for _ in range(m)]
    p.sort(reverse = True)
    g = [p[i] - p[i - 1] for i in range(n1, n2 + 1)]
    print(n2 - g[::-1].index(min(g)))

Solution (Python):
while True:
    m, nl, nu = map(int, input().split())
    if m == 0:
        break

    p = [int(input()) for i in range(m)]
    gap = ans = 0
    for n in range(nl, nu + 1):
        if p[n - 1] - p[n] >= gap:
            gap = p[n - 1] - p[n]
            ans = n
    print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,ni,na = LI()
        if n == 0:
            break
        a = sorted([I() for _ in range(n)], reverse=True)
        r = 0
        mi = -1
        for i in range(ni, na+1):
            tr = a[i-1] - a[i]
            if r <= tr:
                r = tr
                mi = i
        rr.append(mi)

    return '\n'.join(map(str, rr))


print(main())

Solution (Python):
while True:
    P = list()
    ans = list()
    tans = list()
    m, Mn, Mx = map(int, input().split())
    if m == 0 and Mn == 0 and Mx == 0:
        break
    for i in range(0, m):
        P.append(int(input()))

    for j in range(Mn-1, Mx, 1):
        ans.append(P[j]-P[j+1])
    
    for k in range(0,len(ans)):
        if ans[k] == max(ans):
            tans.append(k)
    
    print(max(tans)+Mn)

Solution (Python):
da = list(map(int,input().split()))
k = []
while sum(da) != 0:
	for i in range(da[0]):
		k.append(int(input()))
	for i in range(da[0]):
		k[da[0] - 1 -i] = k[da[0] - 1 -i] - k[da[0]-2 -i]


	pp = k[da[1]:da[2]+1]
	qq = min(pp)

	for i in range(len(pp)):
		if pp[i] == qq:
			jj = i

	print(da[1]+jj)

	da = list(map(int,input().split()))
	k = []

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if (m+n_min+n_max) == 0:
        break
    else:
        score = []
        before = 0
        dif = 0
        num = 0
        for i in range(1, m+1):
            s = int(input())
            if n_min+1 <= i <= n_max+1:
                if before - s >= dif:
                    num = i - 1
                    dif = before - s
            before = s
        print(num)

Solution (Python):
while(True):
    try:
        m, n_min, n_max = map(int, input().split())
        Ps = sorted(list(int(input()) for i in range(m)), reverse=True)
        max_v = 0
        ans = 0
        if m == 0:
            break
        for i in range(n_min, n_max+1):
            if i == len(Ps):
                break
            if max_v <= Ps[i-1]-Ps[i]:
                max_v = Ps[i-1]-Ps[i]
                ans = i
        print(ans)
    except:
        break

Solution (Python):
while True:
    ans = [0, 0]
    m, n1, n2 = map(int, input().split())
    if m == n1 == n2 == 0:
        quit()
    p = []
    for i in range(m):
        p.append(int(input()))
    p.sort(reverse=True)
    for i in range(n1 - 1, n2):
        if ans[0] <= p[i] - p[i + 1]:
            ans[0] = p[i] - p[i + 1]
            ans[1] = i + 1
    print(ans[1])

Solution (Python):
while True:
    (m, mn, mx) = tuple(map(int, input().split()))
    if m == 0:
        break
    arr = [0 for i in range(m)]
    for i in range(m):
        arr[i] = int(input())
    arr.sort(reverse=True)
    res = []
    ap = res.append
    for i in range(mn, mx + 1):
        ap([arr[i - 1] - arr[i], i])
    res.sort(key=lambda x: x[0], reverse=True)
    reres = []
    rreap = reres.append
    maxa = res[0][0]
    for e in res:
        if e[0] < maxa:
            break
        rreap(e[1])
    reres.sort(reverse=True)
    print(reres[0])

Solution (Python):
while 1:
    m,nmi,nma=map(int,input().split())
    if not m and not nmi and not nma:break
    l=[int(input()) for _ in range(m)]
    tg=[l[:i][-1]-l[i:][0] for i in range(nmi,nma+1)]    
    print(nma-tg[::-1].index(max(tg)))

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if m == 0 and n_min == 0 and n_max == 0:
        break
    P = [0 for i in range(m)]
    for i in range(m):
        P[i] = int(input())
    
    P.sort()
    ans = 0
    ans_gap = 0
    prev = P[m - n_max - 1] 
    
    for i in range(m - n_max, m - n_min + 1):
        if P[i] != prev:
            if ans_gap < (P[i] - P[i - 1]):
                ans_gap = P[i] - P[i - 1]
                ans = m - i
        prev = P[i]
    
    print(ans)

Solution (Python):
def solve(m,na,nb):
	p = [int(input()) for i in range(m)]
	ans,gap = -1,0
	for i in range(na,nb + 1):
		if p[i - 1] - p[i] >= gap:
			gap = p[i - 1] - p[i]
			ans = i
	print(ans)
	

while True:
	m,na,nb = map(int,input().split())
	if m == 0: break
	solve(m,na,nb)

Solution (Python):
while True :
    m, n_min, n_max = map(int, input().split())
    if m == 0 and n_min == 0 and n_max == 0 :
        break
    
    P = list(int(input()) for _ in range(m))
    gap = 0
    for i in range(n_min-1, n_max) :
        x = P[i] - P[i+1]
        if x >= gap :
            gap = x
            n = i
    print(n+1)

Solution (Python):
while 1:
    m,n_min,n_max = map(int,input().split())
    if m == 0 and n_min == 0 and n_max == 0:
        break
    p  = [int(input()) for i in range(m)]
    p.sort()
    p.reverse()
    lists = list(range(n_min,n_max+1))
    ans = []
    Max = -9999999999
    ans = -9999999999
    for i in lists:
        if Max <= abs(p[i-1]-p[i]):
            Max = abs(p[i-1] - p[i])
            ans = max(ans,i)
    print(ans)

Solution (Python):
def get_input():
    data_list = input().split()
    for i in range(len(data_list)):
        data_list[i] = int(data_list[i])
    return data_list

def get_score_list(student_num):
    score_list = [None] * student_num
    for i in range(student_num):
        score_data = int(input())
        score_list[i] = score_data
    score_list = sorted(score_list, reverse=True)
    return score_list

def decide_success_student_num(score_list, min_num, max_num):
    max_diff = -float('inf')
    for i in range(min_num - 1, max_num):
        tmp_num = score_list[i] - score_list[i+1]
        if tmp_num >= max_diff:
            max_diff = tmp_num
            success_student_num = i + 1
    return success_student_num


if __name__ == "__main__":
    while True:
        student_num, min_num, max_num = get_input()
        if student_num == 0:
            break
        score_list = get_score_list(student_num)
        success_student_num = decide_success_student_num(score_list, min_num, max_num)
        print(success_student_num)

Solution (Python):
while 1:
    m, nmin, nmax = map(int,input().split())
    if m==0: break
    p = []
    ans = 0
    smax = 0
    for i in range(m):
        p.append(int(input()))
        if nmin <= i < nmax+1 and p[i-1] - p[i] >= smax:
            
            smax = p[i-1] - p[i]
            ans = i
    print(ans)

Solution (Python):
a=[]
while True:
    m,n_min,n_max=map(int,input().split())
    if m==0 and n_min==0 and n_max==0:
        for i in range(len(a)):
            print(a[i])
        break
    else:
        p=[]
        count=0
        counter=0
        for i in range(m):
            s=int(input())
            p.append(s)
        p=sorted(p,reverse=True)
        for i in range(n_min-1,n_max):
            if counter<=int(p[i])-int(p[i+1]):
                counter=int(p[i])-int(p[i+1])
                count=i+1
        a.append(count)

Solution (Python):
def solve(a,b,c):
    scores = [int(input()) for i in range(a)]
    gap = scores[b-1] - scores[b]
    tmpans = b-1
    for i in range(b-1,c):
        tmpgap = scores[i] - scores[i+1]
        if gap <= tmpgap:
            tmpans = i
            gap = tmpgap
    print(tmpans+1)
while True:
    a,b,c = map(int,input().split())
    if a == b == c and a == 0:
        exit()
    else:
        solve(a,b,c)

Solution (Python):
while True:
	m,a,b=map(int,input().split())
	if m==a==b==0:
		exit()
	ans=10**8
	ran=-1
	q=[]
	for i in range(m):
		x=int(input())
		q.append(x)
	for i in range(m-1):
		if -q[i+1]+q[i]>=ran and a<=i+1<=b:
			ans=i+1
			ran=-q[i+1]+q[i]
	print(ans)

Solution (Python):


while True:
    m,nmi,nma = map(int,input().split())

    if m == 0:
        break

    P = []

    for i in range(m):

        p = int(input())
        P.append(p)


    ans = 0
    ap = 0

    for i in range(m-1):


        if nmi <= i+1 and i+1 <= nma and ans <= P[i]-P[i+1]:

            ans = max(ans,P[i]-P[i+1])
            ap = i+1

    print (ap)

Solution (Python):

 



 
import sys
import math
 

class mymath:
    
    pi = 3.14159265358979323846264338
 
    
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []
 
        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist
 
    
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)
 
    
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)
 
    
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans
 
mymath = mymath()
 

class output:
    
    def list(self, l):
        l = list(l)
        
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()
 
output = output()
 






 


 


 


 





def get_input():
  N = []
  while True:
    try:
      N.append(input())
      
    except EOFError:
      break
  return N


while(True):
  M, N_min, N_max = [int(x) for x in input().split()]
  P = []

  if M == 0 and N_min == 0 and N_max == 0:
    break

  for i in range(M):
    P.append(int(input()))

  G_max = 0
  I = None

  for i in range(N_min-1, N_max):
    G = P[i] - P[i+1]
    if G >= G_max:
      G_max = G
      I = i+1
    
  print(I)

Solution (Python):
ans_list = []

while True:
    m,nmin,nmax = map(int,input().split())
    if (m,nmin,nmax) == (0,0,0):
        break
    P = sorted([int(input()) for _ in range(m)], reverse=True)
    d = -float("inf")
    
    for i in range(nmin-1,nmax):
        res = P[i] - P[i+1]
        if res >= d:
            d = res
            ans = i + 1
    ans_list.append(ans)    

for ans in ans_list:
    print(ans)

Solution (Python):
while True:
  m,n1,n2=map(int,input().split())
  if m==0 and n1==0 and n2==0:
    break
  P=[]
  A=[]
  B=[]
  for i in range(m):
    P.append(int(input()))
  
  for i in range(n1,n2+1):
    A.append(P[i-1]-P[i])
    B.append(i)
  S=[]   
  for i in range(len(A)):
    if A[i]==max(A):
      S.append(B[i])
  print(max(S))

Solution (Python):
while True:
    m, minn, maxn = map(int, input().split())
    if m == minn == maxn == 0:
        break
    P = [int(input()) for i in range(m)]
    ansd = 0
    ansi = 0
    for i in range(minn-1, maxn):
        if P[i] - P[i+1] >= ansd:
            ansd = P[i] - P[i+1]
            ansi = i+1
    print(ansi)

Solution (Python):
while True:
    m,nmin,nmax = map(int,input().split())
    if m == 0:
        exit()
    P = []
    for i in range(m):
        P.append(int(input()))
    max_diff = -1
    ans = -1
    for i in range(nmin-1,nmax):
        if max_diff <= P[i] - P[i+1]:
            max_diff = P[i] - P[i+1]
            ans = i + 1
    print(ans)

Solution (Python):
while True:
    m,min,max= list(map(int, input().split()))
    if m==0 and min==0 and max==0:
        break;
    P = []
    for i in range(m):
        P.append(int(input()))

    spaceMax=0
    spaceMaxIndex=0
    for i in range(min-1,max):

        if spaceMax <= P[i]-P[i+1]:
            spaceMax=P[i]-P[i+1]
            spaceMaxIndex=i+1
    print(spaceMaxIndex)

Solution (Python):
while True:
    m,n_min,n_max = list(map(int,input().split()))
    if m == 0:
        break
    v  = [int(input()) for _ in range(m)]
    
    max_gap = 0
    max_index = n_min


    for i in range(n_min,n_max+1):
        gap = v[i-1]-v[i]

        
        if gap > max_gap:
            max_gap = gap
            max_index = i
        elif gap == max_gap:
            max_index = i
            
    
    print(max_index)

Solution (Python):
def main(m, nx, nn):
    b = [int(input()) for i in range(m)]
    d = -1
    for i in range(nn, nx + 1):
        if d <= b[i - 1] - b[i]:
            d = b[i - 1] - b[i]
            ans = i
    print(ans)
while 1:
    m, nmin, nmax = map(int, input().split())
    if m == nmax == nmin == 0:
        break
    main(m,nmax, nmin)

Solution (Python):
for v in range(1000):
  s,t,u = input().split()
  s = int(s)
  t = int(t)
  u = int(u)
  if s == 0:
    break
  else:
    l = []
    m = []
    for i in range(s):
      l.append(int(input()))

    for o in range(s-1):
      w = l[o]-l[o+1]
      w = abs(w)
      m.append(w)

    m = m[t-1:u]
    mx = max(m)
    lll = len(m)
    hhh=-1
    for i in range(lll): 
      if mx==m[i]:
        hhh=i+t
    print(hhh)

Solution (Python):
import sys


from inspect import currentframe


def pri(*args):
    names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    


def solve(m, n_min, n_max, P):
    ans = n_min
    pri(P)
    gap = P[n_min - 1] - P[n_min]
    pri(gap)

    for i in range(n_min - 1, n_max):
        if gap <= P[i] - P[i+1]:
            gap = P[i] - P[i+1]
            ans = i + 1
            pri(ans)
            pri(gap)
    print(ans)

    return


if __name__ == '__main__':
    while True:
        m_input, n_min_input, n_max_input = map(int, input().split())
        if m_input == n_min_input == n_max_input == 0:
            break
        P_imput = [int(input()) for _ in range(m_input)]

        solve(m_input, n_min_input, n_max_input, P_imput)

Solution (Python):
while True:
    m,nmin,nmax = [int(x) for x in input().split()]
    if m == nmin == nmax == 0:
        break
    a = [0]
    for i in range(m):
        a.append(int(input()))

    ans = 0
    ans_index = nmin

    for n in range(nmin,nmax+1):
        if ans <= a[n]-a[n+1]:
            ans = a[n]-a[n+1]
            ans_index=n

    print(ans_index)

Solution (Python):
while True:
    can_n, pass_min, pass_max = [int(i) for i in input().split()]
    if can_n == pass_min == pass_max == 0:
    	break
    	
    score_lst = []
    for _ in range(can_n):
    	score_lst.append(int(input()))
    
    gap_lst = []
    for i in range(pass_min, pass_max + 1):
    	gap_lst.append(score_lst[i - 1] - score_lst[i])
    
    gap_max = max(gap_lst)	
    for i in range(len(gap_lst) - 1, -1, -1):
    	if gap_lst[i] == gap_max:
    		print(i + pass_min)
    		break

Solution (Python):
while True:
    m, n_min, n_max = map(int, input().split())
    if m == 0:
        break
    gap_max = 0
    ans = 0
    pre = int(input())
    for i in range(1, m):
        next = int(input())
        if n_min <= i and n_max >= i:
            tmp = pre - next
            if tmp >= gap_max:
                gap_max = tmp
                ans = i
        pre = next
    print(ans)

Solution (Python):
while True:
    m, nMin, nMax = map(int, input().split())
    if m == 0 and nMax == 0 and nMin == 0:
        break
    P = []
    Max = 0
    ans = 0
    for i in range(m):
        P.append(int(input()))
    else:
        for i in range(nMax-nMin+1):
            if i == 0 or Max <= P[nMin+i-1] - P[nMin+i]:
                Max = P[nMin+i-1] - P[nMin+i]
                ans = nMin + i
        else:
            print(ans)

Solution (Python):
while 1:
  m, n_min, n_max =map(int, input().split())
  if m==0:
    break
  P =[]
  for p in range(m):
    p =int(input())
    P.append(p)



  
  gap= 0
  x = 0
  for num in range(n_min, n_max+1):

    a = P[num-1]-P[num]
    if a>=gap:
      gap = a
      x = num
      

  print(x)

Solution (Python):
while True:
    m,ni,na = map(int,input().split())
    if m+na+ni == 0:
        break
    P = [int(input()) for _ in range(m)]
    P.sort(reverse=True)
    m = 0
    ans = 0
    for i in range(ni-1, na):
        if m <= abs(P[i]-P[i+1]):
            m = abs(P[i]-P[i+1])
            ans = i+1
    print(ans)

Solution (Python):

"""
5 2 4
100
90
82
70
65
"""

while True:
    m, nmin, nmax = map(int, input().split())
    if m == 0:
        break
    scores = [int(input()) for _ in range(m)]
    

    dif_score = [scores[0]-scores[1]]
    for i in range(1, m-1):
        dif_score.append(scores[i]-scores[i+1])

    dif_score = dif_score[nmin-1:nmax]

    

    max_dif_score = max(dif_score)

    ans = -1
    for i in range(len(dif_score)):
        if dif_score[i] == max_dif_score:
            ans = i

    print(ans+nmin)

Solution (Python):
while True:
  m, nmin, nmax = map(int, input().split())
  if m+nmin+nmax == 0:
    break
  P = [int(input()) for i in range(m)]
  gap = 0
  for i in range(nmin, nmax+1):
    if gap<=P[i-1]-P[i]:
      gap = P[i-1]-P[i]  
      n = i
  print(n)

Solution (Python):
while True :
  m, n, N = map(int, input().split())
  if(m == 0 and n == 0 and N == 0) :
    break
  else :
    p = [0] * m
    for i in range(m) :
      p[i] = int(input())
    s = 0
    for j in range(n - 1, N) :
      if(p[j] - p[j + 1] >= s) :
        s = p[j] - p[j + 1]
        a = j + 1
      else :
        pass
    print(a)

Solution (Python):

while(True):
    M, Nmin, Nmax = [int(n) for n in input().split()]
    if M + Nmin + Nmax == 0:
        break
    
    P = [int(input()) for _ in range(M)]
    
    
    
    
    dif = [0]*(M)
    for i in range(len(P)-1):
        dif[i+1] = P[i] - P[i+1]
    
    ans = Nmin
    tmp = dif[Nmin]
    for i in range(Nmin+1, Nmax+1):
        if dif[i] >= tmp:
            ans = i
            tmp = dif[i]
    print(ans)

Solution (Python):
j = 0
while 1:
    m,n_min,n_max = map(int,input().split())
    if m == 0 and n_max == 0 and n_min == 0:
        break
    lists = []
    ans_list = []
    max = -999999999999
    for i in range(m):
        point = int(input())
        lists.append(point)
    for i in range(n_min-1,n_max):
        num = lists[i] - lists[i+1]
        if max <= num:
            max = num
            ans = i+1
    print(ans)

Solution (Python):
def main():
    while True:
        
        head_d = input()
        head_d = head_d.split(" ")
        for i in range(len(head_d)):
            head_d[i] = int(head_d[i])
        if head_d == [0, 0, 0]:
            return

        s_num = head_d[0]
        n_min = head_d[1]
        n_max = head_d[2]
        s_dat = []

        for i in range(s_num):
            s_dat.append(int(input()))

        answer = showpnum(n_min, n_max, s_dat)
        print(answer)


def showpnum(n_min, n_max, s_dat):
    max_dist = 0
    for i in range(n_max - n_min + 1):
        i = i + n_min - 1
        dist = s_dat[i] - s_dat[i + 1]
        if dist >= max_dist:
            max_dist = dist
            pnum = i + 1

    return pnum
    
main()

Solution (Python):
def main():
    while True:
        m,minn,maxn = map(int,input().split())
        if m == 0 and minn == 0 and maxn == 0:
            return
        scores = []
        for _ in range(m):
            p = int(input())
            scores.append(p)
        ans,ansgap = 0,0
        for n in range(minn,maxn+1):
            gap = scores[n-1] - scores[n]
            if gap >= ansgap:
                ansgap = gap
                ans = n
        print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
while True:
    n,big,small = map(int,input().split(" "))
    if n == 0:
        break
    points = []
    for i in range(n):
        points.append(int(input()))

    results = []
    for i in range(big,small+1):
        results.append(points[i-1] - points[i])

    ameba = len(results)
    for i in range(ameba):
        if results[ameba-1-i] == max(results):
            print(ameba-i+big-1)
            break

Solution (Python):
while 1:
    m, nmin, nmax = map(int, input().split())
    if m == 0:
        break

    score = []
    for _ in range(m):
        score.append(int(input()))
    score.sort(reverse=True)

    ans = 0
    num = 0
    for i in range(nmin, nmax+1):
        gap = score[i-1] - score[i]
        if gap >= ans:
            ans = gap
            num = i

    print(num)