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++: #include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

int main(){
    int m,nmin,nmax;
    while(cin >> m >> nmin >> nmax,m|nmin|nmax){
        vector<int> P(m);
        rep(i,m)cin >> P[i];
        sort(P.begin(),P.end());
        reverse(P.begin(),P.end());
        int res=0,gap_max=0;
        for(int i=nmin;i<=nmax;i++){
            int gap = P[i-1]-P[i];
            if(gap>=gap_max){
                res=i;
                gap_max=gap;
            }
        }
        cout << res << endl;
    }
    return 0;
}

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

int main() {
  int M, Nmin, Nmax;
  while (cin >> M >> Nmin >> Nmax && M) {
    vector<int> P(M);
    REP(i, M) { cin >> P[i]; }
    int ans = 0, gap_max = 0;
    for (int i = Nmin; i <= Nmax; ++i) {
      int gap = P[i - 1] - P[i];
      if (gap >= gap_max) {
        ans = i, gap_max = gap;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

#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(void)
{
  for(;;){
    int m,a,b;
    cin >> m >> a >> b;
    if(m==0) return 0;
    vector<int> p(m);
    REP(i,m) cin >> p[i];
    pair<int,int> answer=make_pair(0,0);
    FOR(i,a,b+1){
      answer=max(answer,make_pair(p[i-1]-p[i],i));
    }
    cout << answer.second << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e9+7;
const ll N = 1007;





int main(){
	while(1){
		ll m,nmin,nmax,ans;
		vector<ll> p;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0)break;
		p.resize(m);
		FOR(i,0,m){
			cin>>p[i];
		}
		SORT(p);
		ll g=p[m-nmin] - p[m-nmin-1];
		ans = nmin;
		FOR(i,nmin,nmax+1){
			if(g<=p[m-i] - p[m-i-1]){
				ans = i;
				g = p[m-i] - p[m-i-1];
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPEQ(i, n) FOREQ(i, 0, n)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline int size(const T& x) { return x.size(); }

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

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

        vector<int> P(m);
        REP(i, m) cin >> P[i];

        int max_gap = 0, ans = -1;
        FOR(i, n_min-1, n_max) {
            int gap = P[i] - P[i+1];
            if (gap >= max_gap) {
                max_gap = gap;
                ans = i+1;
            }
        }

        cout << ans << endl;
    }
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		int M, Nmin, Nmax; cin >> M >> Nmin >> Nmax;
		if (!M)break;
		vector<int>vs(M);
		for (int i = 0; i < M; ++i)cin >> vs[i];
		sort(vs.begin(), vs.end(), greater<int>());
		int ans = 0;
		int num = -1;
		for (int i = Nmax-1; i >= Nmin-1; --i) {
			int n = vs[i] - vs[i + 1];
			if (n > num) {
				ans = i;
				num = n;
			}
		}
		cout << ans+1 << endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n, nMax, nMin; cin >> n >> nMin >> nMax;
        if(n == 0 and nMax == 0 and nMin == 0) return 0;
        else{
            vector<int> score(n);
            REP(i, n) cin >> score[i];
            int ans = 0, gap = 0;
            FOR(i, nMin, nMax + 1){
                if(score[i - 1] - score[i] >= gap){
                    gap = score[i - 1] - score[i];
                    ans = i;
                }
            }
            cout << ans << endl;
        }
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

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

	return 0;
}

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

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

		if (m == 0) {
			break;
		}

		std::vector<int>ps;
		ps.resize(m);

		for (int i = 0; i < m; i++) {
			std::cin >> ps.at(i);
		}

		int maxgap = -1;
		int ans = -1;
		for (int i = nmin; i <= nmax; i++) {
			int gap = ps.at(i - 1) - ps.at(i);

			if (gap >= maxgap) {
				maxgap = gap;
				ans = i;

			}

		}

		std::cout << ans << std::endl;
	}

	return 0;
}