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++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int num_student;
  int num_min_pass;
  int num_max_pass;
  while(~scanf("%d %d %d", &num_student, &num_min_pass, &num_max_pass)) {
    if (num_student == 0) break;

    int score[10000];
    for (int student_i = 0; student_i < num_student; student_i++) {
      scanf("%d", &score[student_i]);
    }
    sort(score,score + num_student, greater<int>());
    int diff = -1;
    int res = 0;
    for (int pass_i = num_min_pass - 1; pass_i < num_max_pass; pass_i++) {
      int min_pass_score = score[pass_i];
      int max_fail_score = score[pass_i + 1];
      if (diff <= min_pass_score - max_fail_score) {
	diff = min_pass_score - max_fail_score;
	res = pass_i + 1;
      }
    }
    printf("%d\n",res);
  }
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int m,nmin,nmax,dmax,num;

  while(true){
    cin >> m >> nmin >> nmax;
    
    if(m == 0 && nmin == 0 && nmax == 0) break;

    int *score = new int[m];

    
    for(int i = 0; i<m; ++i)
      cin >> score[i];
    
    
    for(int i=nmin; i<nmax+1; ++i){
      if(i == nmin) dmax = score[i-1] - score[i];


      //cout << score[i-1] << " - " << score[i] << endl;
      if(score[i-1] - score[i] >= dmax){
	dmax = score[i-1] - score[i];
	num = i;

	//cout << num << " ******" << endl;
      }
    }

    delete[] score;

    cout << num << endl;
    
    dmax = num = 0;
    
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


signed main(){
    int M,L,R;
    while(cin>>M>>L>>R,M||L||R){
        vint P(M);rep(i,M)cin>>P[i];
        sort(all(P));reverse(all(P));

        int val=0,ma=0;
        for(int i=L-1;i<R;i++){
            int tmp=P[i]-P[i+1];
            if(tmp>=val){
                val=tmp;
                ma=i+1;
            }
        }
        cout<<ma<<endl;
    }
    return 0;
}

C++: #include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};

int main() {
	int m, nmin, nmax;
	while (cin >> m >> nmin >> nmax, m) {
		vi stu(m);
		REP(i, m)
			cin >> stu[i];
		int gp = 0;
		int ans = -1;
		FOR(i, nmin, nmax + 1) {
			if (gp <= stu[i - 1] - stu[i]) {
				gp = stu[i - 1] - stu[i];
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

C++: #include<iostream>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int m,na,ni,ans;
	while(cin>>m>>ni>>na,(m||ni)||na){
		int p[m];
		rep(i,m)cin>>p[i];
		sort(p,p+m);
		int gap=0;
		loop(i,ni,na+1){
			if(gap<=p[m-i]-p[m-i-1]){
				ans=i;
				gap=p[m-i]-p[m-i-1];
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    while (1) {
        int m, nmin, nmax;
        scanf("%d%d%d", &m, &nmin, &nmax);
        if (m == 0 && nmin == 0 && nmax == 0) break;

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

        sort(P, P + m, greater<int>());
//        for (int i = 0; i < m; ++i) {
//            cout << P[i] << endl;
//        }
        int maxgap = 0;
        int maxgapn;
        for (int i = nmin; i <= nmax; ++i) {
            int gap = P[i] - P[i + 1];
            if (gap >= maxgap) {
                maxgapn = i;
                maxgap = gap;
            }
        }

        cout << maxgapn + 1 << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <map>
#define rep(i,n) for(long long i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll MOD = 1000000007;

int m, n1, n2;
int p[200];

void solve(){
	rep(i,m) cin >> p[i];
	sort(p,p+m,greater<int>());
	int ans = 0;
	int gap = 0;
	for(int i = n1-1; i < n2; i++) if(gap <= p[i]-p[i+1]){ gap = p[i]-p[i+1]; ans = i+1; }
	cout << ans << endl;
}

int main(){
	while(cin >> m >> n1 >> n2){
		if(m == 0 && n1  == 0 && n2 == 0) break;
		solve();
	}	
}

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[100001], maxg = 0 , n;
	while (1) {
		scanf("%d %d %d", &m, &nmin, &nmax);
		for (int i = 0; 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;
			}
			printf("%d\n", n);
		}
		if (m == nmin == nmax == 0)return 0;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int M, Nmin, Nmax;
vector<int> P;

void solve(){
    sort(P.rbegin(), P.rend());
    
    int gap = 0;
    int ans = -1;
    for(int i=Nmin-1; i<Nmax; i++){
        if(P[i]-P[i+1] >= gap){
            gap = P[i]-P[i+1];
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

int main(){
    while(cin >> M >> Nmin >> Nmax, M|Nmin|Nmax){
        P.resize(M);
        for(auto &v: P)
            cin >> v;
        solve();
    }
}