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
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    cin >> skipws;

    for (;;) {
        int m, nmin, nmax;
        cin >> m >> nmin >> nmax;

        if (!m) break;

        map<int, int> mp;
        rep(i, 0, m) {
            int v; cin >> v;
            mp[v]++;
        }

        int maxgap = 0, passer = 0;
        int cntlo = 0, cnthi = m;

        vector<pair<int, int>> v(mp.begin(), mp.end());
        rep(i, 0, mp.size()) {
            // cout << cntlo << " " << cnthi << " " << endl;
            if (i && nmin <= cnthi && cnthi <= nmax) {
                int gap = v[i].first - v[i - 1].first;
                if (gap > maxgap) {
                    maxgap = gap;
                    passer = cnthi;
                }
            }
            cntlo += v[i].second, cnthi -= v[i].second;
        }

        cout << passer << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

set<int>ng={'q','w','e','r','t','a','s','d','f','g','z','x','c','v','b'};

signed main()
{
	IOS();
	vector<int>ans;
	while(1){
		int N,A,B;
		cin >> N >> A >> B;
		if(N == 0 && A == 0 && B == 0)break;
		vector<int>a(N);
		for(int i = 0;i < N;i++){
			cin>>a[i];
		}
		int ma = -1,it = -1;
		rep(i,A-1,B){
			if(ma<=a[i]-a[i+1]){
				ma = a[i] - a[i+1];
				it = i + 1;
			}
		}
		ans.push_back(it);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}

C++: #include<cstdio>
#include<algorithm>
#include<iterator>
#include<vector>

using namespace std;

int main(void) {
    while(1) {
        int m,nmin,nmax;
        vector<int> p;
        scanf("%d%d%d",&m,&nmin,&nmax);
        if(!m) break;

        for(int i=0; i<m; i++) {
            int p_;
            scanf("%d",&p_);
            p.push_back(p_);
        }

        sort(begin(p), end(p));

        int last=p[0];
        int maxgap=-1, res=-1;
        while(1) {
            auto ub = upper_bound(begin(p), end(p), last);
            if(ub == end(p)) break;

            last = *ub;

            if(end(p) - ub > nmax || end(p) - ub < nmin) continue;

            if(maxgap < (*ub - *(ub-1))) {
                maxgap = (*ub - *(ub-1));
                res = end(p)-ub;
            }
            
        }
        printf("%d\n",res);
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main()
{
        int m,ni,na;
        while(cin>>m>>ni>>na,m)
        {
                vector<int> p(m);
                REP(i,m)
                {
                        cin>>p[i];
                }
                sort(p.begin(), p.end());
                int md=0,mp=ni;
                FOR(i, m-na, m-ni+1)
                {
                        if(p[i]-p[i-1]>md)
                        {
                                //cout<<md<<i<<endl;
                                md=p[i]-p[i-1];
                                mp=m-i;
                        }
                }
                cout<<mp<<endl;
        }
}
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int m,nmi,nma;
    cin >> m >> nmi >> nma;
    if(m==0) return 0;
    vector<int> a(m);
    for(int i=0;i<m;i++) cin >> a[i];
    sort(all(a),greater<int>());
    int ans=0,k=0;
    for(int i=nmi-1;i<=nma-1;i++){
      if(ans<=a[i]-a[i+1]){
        ans=a[i]-a[i+1];
        k=i;
        cout << ans << endl;
      }
    }
    cout << k << endl;
  }
  return 0;
}