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;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

// tourist set
template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << '\n'; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
// tourist set end

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<'\n'
#define p2(s, t) cout << (s) << " " << (t) << '\n'
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << '\n'
#define p_yes() p("YES")
#define p_no() p("NO")
#define SZ(x) ((int)(x).size())
#define SORT(A) sort(ALL(A))
#define RSORT(A) sort(ALL(A), greater<ll>())

void no(){p_no(); exit(0);}
void yes(){p_yes(); exit(0);}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
const double PI = acos(-1);

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

    // input
    ll m, mi, ma;

    while(cin>>m>>mi>>ma){
      if(m==0) return 0;

      VI A(m);
      rep(i, m) cin>>A[i];

      ll n;
      ll max_gap = -1;
      for(int i=ma; i>=mi; i--){
        ll gap = A[i-1] - A[i];
        if(gap>max_gap){
          max_gap = gap;
          n = i;
        }
      }
      p(n);
    }
    
    return 0;
}

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

using namespace std;

int main(){
 int p[210];
 int m,nm,nM,sub=0,ans;
 while(1){
  cin >> m >> nm >> nM;
  if(m==0)break;
  sub = 0;
  int i;
  for(i=1;i<=m;i++){
   cin >> p[i];
   if(nm<i && i<=nM+1){
    if(p[i-1]-p[i] >= sub){
     sub=p[i-1]-p[i];
     ans=i-1;
    }
   }
  }
  cout << ans << endl;
 }
 return 0;
}

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;i<=nma;i++){
      if(ans<=a[i]-a[i+1]){
        ans=a[i]-a[i+1];
        k=i;
      }
    }
    cout << k << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m,k;
	while(cin>>n>>m>>k,n){
		vi a(n);
		rep(i,n)cin>>a[i];
		sort(all(a),[](int a,int b){return a>b;});
		int out=0;
		int outa=0;
		loop(i,m,k+1){
			int t=a[i-1]-a[i];
			if(out<=t){
				out=t;
				outa=i;
			}
		}
		cout<<outa<<endl;
	}
}

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

int main(){

    int m,n_min,n_max,gap,temp_gap,n;
    int p[200];

    while(cin>>m>>n_min>>n_max,m||n_min||n_max){

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

        gap=p[n_min-1]-p[n_min];

        for(int i=n_min;i<=n_max;i++){
            temp_gap=p[i-1]-p[i];
            if(temp_gap>=gap){
                gap=temp_gap;
                n=i;
            }
            cout<<gap<<endl;
        }

        cout<<n<<endl;
    }

    

    return 0;

}

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

int scores[200];

int main()
{
	while (true) {
		int input_count, nmin, nmax;
		std::cin >> input_count >> nmin >> nmax;

		if (input_count == 0) return 0;

		for (int i = 0; i < input_count; i++) {
			int p;
			std::cin >> p;
			scores[i] = p;
		}

		std::sort(&scores[0], &scores[input_count]);

		int result_pass_count;
		int max_gap = 0;
		for (int pass_count = nmin; pass_count <= nmax; pass_count++) {
			int gap = scores[input_count - pass_count] - scores[input_count - pass_count - 1];
			if (gap >= max_gap) {
				result_pass_count = pass_count;
				max_gap = gap;
			}
		}

		std::cout << result_pass_count << std::endl;
	}
}

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

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

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

		vector<int> P;

		for (int i = 0; i < m; i++) {
			int temp;
			cin >> temp;
			P.push_back(temp);
		}

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

		int gap = 0;
		int num;

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

		cout << num << endl;
	}

	return 0;
}