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 <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

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

int main() {
	while (cin >> m >> nmin >> nmax&&m + nmax + nmin) {
		REP(i, m) {
			cin >> p[i];
		}
		int ans;
		int num = -1;
		sort(p, p + 10000, greater<int>());
		for (int i = nmin; i <= nmax; i++) {
			if (num <= p[i - 1] - p[i]) {
				num = p[i - 1] - p[i];
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

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

int main()
{
    int m, n_min, n_max;
    while (true)
    {

        cin >> m >> n_min >> n_max;
        if (m == 0 && n_min == 0 && n_max == 0)
            break;
        int p[m];

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

        int gap = 0, ans;
        for (int j = n_min; j <= n_max; j++)
        {
            if (gap <= p[j - 1] - p[j])
            {
                gap = p[j - 1] - p[j];
                ans = j;
            }
        }

        cout << ans << endl;
    }
}

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

int main(){
	int m,nmax,nmin;
	while(cin >> m >> nmin >> nmax , m){
		int num[210];
		for(int i=0;i<m;i++){
			cin >> num[i];
		}
		sort(num,num+m,greater<int>() );
		int mgap=-1;
		int ans = 0;
		for(int i=nmax;i>=nmin;i--){
			if(num[i-1]-num[i] > mgap){
				mgap = num[i-1] - num[i];
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

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

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m=0)
			break;
		int gap=0;
		int n=0;
		int P[m];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin-1;i<nmax-1;i++){
			if(P[i]-P[i+1]>=gap){
				gap=P[i]-P[i+1];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}

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

int main() {
  while (true) {
    int m, nmin, nmax;
    cin >> m >> nmin >> nmax;

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

    sort(P.begin(), P.end());

    int maxgap = 0;
    int maxidx = 0;
    for (int i = m - nmax; i <= m - nmin; i++) {
      int gap = P[i] - P[i - 1];
      if (gap > maxgap) {
	maxgap = gap;
	maxidx = i;
      }
    }

    cout << m - maxidx << endl;
  }
}

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

#define ll long long

using namespace std;


int m,Nmin,Nmax;

int P[205]={};
int ans;

int main(){

    while(1){
        scanf("%d %d %d",&m,&Nmin, &Nmax);
        if(m == 0 && Nmin == 0 && Nmax == 0) break;

        for(int i=0;i<m;i++){
            scanf("%d",&P[i]);
        }
        int max_gap;

        for(int i=Nmin-1;i<Nmax;i++){
            int gap = P[i] - P[i+1];
            if(max_gap < gap){
                max_gap = gap;
                ans = i+1;
            }
        }
        printf("%d\n",ans);
    }


}

C++: //#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
  int n, left, right;
  vector<int> p;

  while (cin >> n >> left >> right, n) {
    p.resize(n);
    rep (i, n) cin >> p[i];

    // sort(p.begin(), p.end());
    // reverse(p.begin(), p.end());

    int n_passed = 0;
    int max_gap = 0;

    rep (i, n-1) {
      // cout << "i: " << i << endl;
      if (! (left <= i+1 && i+1 <= right) ) continue;
      // cout << "passed " << i+1 << " students (lowest: " << left << ", highest: " << right << ")" << endl;
      // cout << "current gap: " << p[i] - p[i+1] << endl;

      if (max_gap <= p[i] - p[i+1]) {
        // cout << "new gap: " << p[i] - p[i+1] << endl;
        // cout << left << ", " << i+1 << ", " << right << endl;
        // cout << "update" << endl;
        n_passed = i+1;
        max_gap = p[i] - p[i+1];
      }
    }
    cout << n_passed << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    while (true){
        int m,a,b;
        cin >> m >> a >> b;
        if (m==0 && a==0 && b==0) break;
        vector<int> n(m);
        for (int i=0;i<m;i++){
            cin >> n.at(i);
        }
        int u=0,ans=0;
        for (int i=a-1;i<b;i++){
            if (n.at(i)-n.at(i+1)>=u) {u=n.at(i)-n.at(i+1);ans=i+1;}
        }
        cout << ans << endl;
    }
}

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

int main(){
  while(1){
      int m,nmin,nmax,max,ans=0,ansp=0;
  int p[201];
  cin>>m>>nmin>>nmax;
  if(m+nmin+nmax==0) break;
  for(int i=0;i<m;i++)cin>>p[i];
  sort(p,p+m);
  for(int i=nmin;i<=nmax;i++){
    max=p[m-i]-p[m-i-1];
    if(ans<=max)ans=max,ansp=i;
  }
  cout<<ansp<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	while(1){
		int m,n,N,ans=0,now,last=0,out;
		cin >> m >> n >> N;
		if(!m&&!n&&!N)	break;
		for(int i=1;i<=m;i++){
			cin >> now;
			if(n<i&&i<=N+1&&i!=1){
				if((last-now)>=ans){
					ans = last-now;
					out = i-1;
				}
			}
			last = now;	
		}
		cout << out << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef pair<int, int> PII;

int M, NMIN, NMAX, P[200];

int main(void) {
  while(cin >> M >> NMIN >> NMAX, M) {
    REP(i, 0, M) cin >> P[i];

    vector<PII> vec;
    REP(i, NMIN, NMAX + 1) vec.push_back(PII(P[i - 1] - P[i], i));
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());

    cout << vec[0].second << endl;
  }
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#define all(c) (c).begin(),(c).end()

using namespace std;

int main(void){

  int m,nmin,nmax;

  while(cin >> m >> nmin >> nmax, m){
    vector<int>v(m);
    for(int i=0;i<m;i++)cin >> v[i];
    sort(all(v),greater<int>());
    int gap = 0, ans = 0;
    for(int i=nmax;i>=nmin;i--){
      if(v[i-1]-v[i] > gap)gap = v[i-1]-v[i], ans = i;
    }
    cout << ans << endl;
  }
  
  return 0;
}