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

Python: answers = []
while True:
    head = input()
    if head == "0 0 0":
        break
    nums = head.split(" ")
    num = int(nums[0])
    mini = int(nums[1])
    maxi = int(nums[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:]
        if len(oks) and len(ngs): 
            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: 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())

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

Python: import sys


from inspect import currentframe


def pri(*args):
    names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    # print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))


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)

Python: import numpy as np
while true:
    N = input().split(" ")
    if N[0] == 0:
        break
    a = [input() for i in range(int(N[0]))]
    print(N)
    print(a)
    #b = int(a[int(N[1]) - 1]) - int(a[int(N[1])])
    #print(b)
    ma = int(N[2])
    mi = int(N[1])
    gap = []
    x = mi
    while x != ma + 1:
        value = int(a[x - 1]) - int(a[x])
        gap.append(value)
        x = x + 1
    #print(gap)
    gapIndex = np.array(gap)
    maxIndex = [i for i, x in enumerate(gapIndex) if x == max(gapIndex)]
    print(int(maxIndex[0]) + 2)

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

Python: import sys
while True:
    m, nmin, nmax = [int(i) for i in input().split()]
    if m == 0:
        sys.exit()
    p = [int(input()) for i in range(m)]
    ansnum = 1000000
    ans = 0
    for i in range(nmin-1,nmax):
        if ansnum >= p[i]-p[i+1]:
            ans = i
        ansnum = min(ansnum,p[i]-p[i+1])
    print(ans)

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):
        # print("i: {}, P[i-1]: {}, P[i]: {}".format(i, P[i-1], P[i]))
        ans[0] = max(P[i - 1] - P[i], ans[0])
        if ans[0] == P[i - 1] - P[i]:
            ans[1] = i
    print(ans[1])

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)

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)

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

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)

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)