Go: package main

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

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

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
		}

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

		// 最低合格者数と最高合格者数の間の各得点間のギャップが最大になる合格者数を取得する
		scoreGap := 0
		scoreGapMax := 0
		qualifiedNum := 0
		for n := nMin; n <= nMax; n++ {
			scoreGap = score_list[n-1] - score_list[n]
			if scoreGap >= scoreGapMax {
				scoreGapMax = scoreGap
				qualifiedNum = n
			}
		}

		fmt.Println(qualifiedNum)
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) FOR(i,n,0)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


int m,nmin,nmax;
int p[1000000];

int main(){
  cin>>m>>nmin>>nmax;

  rep(i,m){
    cin>>p[i];
  }

  int n=nmin,pm=p[nmin-1]-p[nmin];

  FOR(i,nmin,nmax+1){
    if(pm<=p[i-1]-p[i]){
      pm = p[i-1]-p[i];
      n = i;
    }
  }

  cout<<n<<endl;

  return 0;
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
const int INF=1<<23;

int main() {
    ll n,a,b;
    while(true){
        cin>>n>>a>>b;
        if(n+a+b==0)break;
        vector<ll> v(n);
        rep(i,n){
            cin>>v[i];
        }
        sort(v.rbegin(),v.rend());
        ll gap=0;ll ans=0;
        for(ll i=a;i<=b;i++){
            ll g=v[i-1]-v[i];
            if(gap<=g){
                gap=g;
                ans=i;
            }
        }
        cout<<ans<<endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
	int m,min,max,ten[200],gap=10001,sa;
	
	cin>>m>>min>>max;
	
	while(1){
		if(m==0 && min==0 && max==0){
			break;
		}
	    for(int i=1;i<=m;i++){
    		cin>>ten[i];
    	}
    	for(int i=min;i<=max;i++){
    		if(gap>=ten[i+1]-ten[i]){
	    		gap=ten[i+1]-ten[i];
    			sa=i;
	    	}
	    }
    	cout<<sa<<endl;
    	gap=10001;
    	sa=0;
	    cin>>m>>min>>max;
	}

	
	return 0;
}

C++: #include<cstdio>

int main() {
	while (1) {
		int m, nmin, nmax, p[201], maxg = 0, n;
		scanf("%d %d %d", &m, &nmin, &nmax);
		for (int i = 1; i <= m; i++) {
			scanf("%d", &p[i]);
		}
		for (int j = nmin; j <= nmax; j++) {
			if (p[j] - p[j+1] >= maxg) {
				maxg = p[j] - p[j+1];
				n = j;
			}
		}
		if (m == 0 && nmin == 0 && nmax == 0) {
			return 0;
		}
		else {
			printf("%d\n", n);
		}
	}
}

C++: #include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

int main(int argc, char const *argv[]) {
  while(1){
    ll m=0,nmin=0,nmax=0;
    scanf("%lld%lld%lld",&m,&nmin,&nmax);
    if(m==0 && nmin==0 && nmax==0){
      break;
    }
    std::vector<ll> p(m);
    for (size_t i = 1; i <= m; i++) {
      scanf("%lld",&p[i]);
    }
    ll temp=0,memo=0,memoid=0;
    for (size_t i = nmin; i <= nmax; i++) {
      temp=p[i]-p[i+1];
      memo=std::max(memo,temp);
      if(memo==temp) memoid=i;
    }
    printf("%lld\n",memoid);
  }
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <stdlib.h>
#include <math.h>

using namespace std;

int main (void)
{
	int m,min,max,p[100],g[100],kkk,rrr;

	for (int o = 0; o < 100; o++)
	{
	cin >> m >> min >> max;

	if (m == 0 && min == 0)
	{
		if (max == 0)
		{
			break;
		}
	}

	kkk = 0;

	for (int i = 1; i < m + 1; i++)
	{
		cin >> p[i];
	}

	for (int j = min; j < max + 1; j++)
	{
		g[j] = p[j] - p[j + 1];

		if (kkk <= g[j])
		{
			kkk = 0;
			kkk = g[j];
			rrr = 0;
			rrr = j;
		}
	}

		cout << rrr << endl;
	}
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 
typedef vector<int> vi;


int main()
{
	int m, n1, n2;
	while (cin >> m >> n1 >> n2&&m)
	{
		vi a;
		FOR(i, m)
		{
			inin(x);
			a.push_back(x);
		}
		sort(a.rbegin(), a.rend());

		int g = -1, ans;
		for (int i = n1-1; i < n2;i++)
		{
			if (a[i]- a[i+1] >= g)
			{
				g = a[i] - a[i+1];
				ans = i+1;
			}
		}
		cout << ans << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,j) for (int (i)=0;(i)<(int)(j);++(i))
#define put(i) cout << (i) << endl
using namespace std;
typedef long long ll;

int main() {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, (m||nmin||nmax)) {
        vector<int> p(m);
        rep(i,m) cin >> p[i];
        sort(p.begin(), p.end(), [](const int & a, const int & b) {return a > b;});
        int ans = -1, v = -1;
        for (int i = nmin-1; i < nmax; ++i) {
            int gap = p[i]-p[i+1];
            if (gap >= v) {
                v = gap;
                ans = i+1;
            }
        }
        put(ans);
    }
}

C++: #include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll m, nmin, nmax;
	while(cin>>m>>nmin>>nmax, m!=0){
		vll p(m);
		ll gap=-1, ans=-1;
		rep(i, m) cin >> p[i];
		sort(rall(p));
		for(int i=nmin; i<=nmax; i++){
			int diff = p[i-1]-p[i];
			if (gap <= diff){
				gap = diff;
				ans = i;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}