Go: // Entrance Examination(入学試験)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1600&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		m, nMin, nMax := nextInt(sc), nextInt(sc), nextInt(sc)
		if m == 0 && nMin == 0 && nMax == 0 {
			break
		}

		points := []int{}
		for i := 0; i < m; i++ {
			points = append(points, nextInt(sc))
		}

		gapMax, pass := 0, 0
		for n := nMin; n <= nMax; n++ {
			gap := points[n-1] - points[n]
			if gap >= gapMax {
				gapMax, pass = gap, n
			}
		}

		fmt.Println(pass)
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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
    #print(line)
    anslist.append(m - line)

for i in anslist:
    print(i)

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)

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

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)

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)

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)

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: 10 * x[0] + x[1], reverse=True)
    print(res[0][1])

Python: answers = []
while True:
    head = input()
    if head == "0 0 0":
        break
    nums = head.split(" ")
    num = int(head[0])
    mini = int(head[1])
    maxi = int(head[2]) 

    scores = []

    gaps = []

    for _ in range(int(head[0])):
        scores.append(int(input()))
    
    for i in range(mini, maxi + 1):
        oks = scores[:i]
        ngs = scores[i:]
        gap = oks[-1] - ngs[0]
        gaps.append((i,gap))

    filtered = list(filter(lambda x: x[1] == max(map(lambda x: x[1], gaps)), gaps))
    sorted(filtered,key=lambda x: x[0])
    answers.append(filtered[-1][0])

for i in answers:
    print(i)

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)

Python: #1600_入学試験
#1行目：（m, nmin, nmax) [(データ個数, 合格者最小人数, 合格者最大人数)]
#合格者数 n は nmin 人以上，nmax 人以下とする． n はこの範囲内でギャップを最大とするものでなくてはいけない． 
#ギャップとは合格者の最低点と不合格者の最高点の差
#同じギャップになる n が複数あるときは，その中で n が最大になるように選ぶ．


while True :

  m, nmin, nmax = map(int,input().split())
  #もしm=0ならbreak
  if m == 0:
    break
  else:
    #配列n[i]を読み込む(1<=i<=n)
    n = [int(input()) for i in range(m)]
    
    gap = 0
    cnt = 0
    
    for i in range(nmax, nmin-1,-1) :
      #iのときのギャップを求める
      if (abs(n[i]- n[i-1])) > gap :
        
        gap =  abs(n[i] - n[i-1])
        cnt = i
        
        
        
    
    print(cnt)

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])
    #print(ans)
    for k in range(0,len(ans)):
        if ans[k] == max(ans):
            tans.append(k)
    #print(tans)
    print(max(tans)+Mn)

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)

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

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)

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)

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)