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"
#include<iostream>
#include<ostream>
#include<vector>
#include<string>
#include<algorithm>

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)



using namespace std;
using ll = long long;



void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	ll n=0, max=0, min=0;

	while (cin >> n >> min >> max, n) {
		vector<ll> v(n+1);
		REP(i, n) {
			cin >> v[i+1];
		}

		ll g = -1e9, ans = 0;

		FOR(i, min , max+1) {
			if (g <= (v[i] - v[i + 1])) {
				g = (v[i] - v[i + 1]);
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, mi, ma;
    while(cin >> n >> mi >> ma) {
        if(!n && !mi && !ma) break;
        vector<int> v(n), s(n-1);
        rep(i,0,n) cin >> v[i];
        sort(v.begin(), v.end(), greater<int>());
        rep(i,0,n-1) s[i] = v[i] - v[i+1];

        mi--; ma--;
        int gap = 0, ans;
        repq(i, mi, ma) {
            if(gap <= s[i]) {
                gap = s[i];
                ans = i+1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: // 2017/12/26 Tazoe

#include <iostream>
using namespace std;

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

		if(m==0 && nmin==0 && nmax==0)
			break;

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

		int gap = -1;
		int n = -1;

		for(int i=nmin-1; i<nmax; i++){
			int g = P[i]-P[i+1];

			if(gap<=g){
				gap = g;
				n = i+1;
			}

//			cout << i << ' ' << g << ' ' << gap << ' ' << n << endl;
		}

		cout << n << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    int m,nmin,nmax,ans=0,max=0,p[200]={};
  cin>>m>>nmin>>nmax;
  if(m+nmin+nmax==0)break;
  for(int i=0;i<m;i++)cin>>p[i];
  for(int i=nmin;i<=nmax;i++)
    if(p[i-1]-p[i]>=max){
      max=p[i-1]-p[i];
      ans=i;
    }
  cout<<ans<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
#define _all(arg) begin(arg),end(arg)

template<class T>bool chmax(T &a, const T &b) { return (a<=b)?(a=b,1):0; }

using namespace std;

int main(void){
	int m, nmin, nmax;
	while(cin>>m>>nmin>>nmax,m,nmin,nmax) {
		int res = 0;
		int n = 0;
		int prev = 0;
		rep(i,m) {
			int cur; cin >> cur;
			if(nmin<=i && i <= nmax) if(chmax(res, prev-cur)) n=i;
			prev = cur;
		}
		cout << n << endl;
	}
        
	return 0;
}

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

using namespace std;

typedef long long  ll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int m, min_n, max_n;

    while (cin >> m >> min_n >> max_n, m) {
        vector<int> p(m);
        for (int i = 0; i < m; ++i)
            cin >> p[i];
        sort(p.begin(), p.end(), greater<int>());

        int n = 0, gap = 0;
        for (int i = min_n; i <= max_n; ++i) {
            int tmp_gap = p[i - 1] - p[i];
            if (gap <= tmp_gap) {
                gap = tmp_gap;
                n = i;
            }
        }

        cout << n << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1 ; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1 ; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1e9+100;
const bool debug = 0;
/***************************************/

int M, Nmi, Nma;
int P[200];

int main() {
  while (cin >> M >> Nmi >> Nma, M || Nmi || Nma) {
    REP(i, M) scanf("%d", P + i);
    if (debug) putchar('@');

    pii ans(0, 0); // ギャップ, 人数

    FOR(i, Nmi - 1, Nma) {
      chmax(ans, pii(P[i]-P[i+1], i + 1));
    }

    cout << ans.se << endl;
  }
  return 0;
}

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

int main(){
    int m,nl,ns;
    while(cin>>m>>ns>>nl,m){
        vector<int> p(m);
        for(int i=0;i<m;i++) cin>>p[i];
        int res=0;
        int gap=0;
        for(int i=0;i<=10000;i++){
            int mi=1000000;
            int ma=0;
            int cnt=0;
            for(int j=0;j<m;j++){
                if(i<=p[j]){
                    cnt++;
                    mi=min(mi,p[j]);
                }
                else{
                    ma=max(ma,p[j]);
                }
            }
            int ga=mi-ma;
            if(ns<=cnt && cnt<=nl){
                if(gap<ga){
                    res=cnt;
                    gap=ga;
                }
                else{
                    res=max(cnt,res);
                }
            }
        }

        cout<<res<<endl;

    }
    return 0;

}

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

int m, nmin, nmax, p[200];
int diff, ans;

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