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 <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << endl;}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << endl;
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    while(1){
        ll m,a,b; cin >> m >> a >> b;
        if(!m && !a && !b) break;
        vl p(m); rep(i,m) cin >> p[i];
        sort(rall(p));
        ll mxid = 0;
        ll mx = 0;
        REP(i,a,b+1){
            if(mx <= p[i-1] - p[i]){
                mx = p[i-1] - p[i];
                mxid = i;
            }
        }
        cout << mxid << endl;
    }
}

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

using namespace std;

int main() {
	int m, nmin, nmax; 
	while (cin >> m >> nmin >> nmax && (m || nmin || nmax)) {
		vector<int> p(m);
		for (int i = 0; i < m; ++i) cin >> p[i];
		pair<int, int> ans = { 0,0 };
		for (int i = nmin; i <= nmax; ++i) {
			if (p[i - 1] - p[i] >= ans.first) ans = make_pair(p[i - 1] - p[i], i);
		}
		cout << ans.second << 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 _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

int main(void){
	for(int m, nmin, nmax; cin >> m >> nmin >> nmax, m;){
		vi p(m);
		for(auto & e : p) cin >> e;

		sort(_all(p), greater<int>());

		int res = 0, resn;
		rep(n, nmin, nmax + 1){
			int gap = p[n - 1] - p[n];
			if(res <= gap){
				res = gap;
				resn = n;
			}
		}

		cout << resn << endl;
	}

	return 0;
}

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

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

C++: #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;

int main(){
    int m, maxi, mini;
    int p[10005];
    while(cin >> m >> mini >> maxi, m||mini||maxi){
        mini--; maxi--;
        rep(i,m) cin >> p[i];

        int n = 0, g = 0;
        for(int i = maxi; i >= mini; i--){
            if(p[i] - p[i + 1] > g){
                g = p[i] - p[i + 1];
                n = i + 1;
            }
        }
        cout << n << endl; 
    }
}

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

int main()
{
	while (1)
	{
		vector<int> GAP;
		priority_queue<int> PQ;
		int m, n_min, n_max;
		cin >> m >> n_min >> n_max;
		if (m == 0)break;
		for (int i = 0; i < m; i++)
		{
			int k;
			cin >> k;
			PQ.push(k);
		}
		for (int i = n_min; i <= n_max; i++)
		{
			priority_queue<int> tPQ = PQ;
			for (int l = 0; l < i-1; l++)
			{
				tPQ.pop();
			}
			int temp = tPQ.top();
			tPQ.pop();
			GAP.push_back(temp - tPQ.top());
		}
		int max_gap = 0;
		int index = 0;
		int max_index;
		for (auto itr = GAP.begin(); itr != GAP.end(); itr++)
		{
			if (max_gap <= *itr)
			{
				max_gap = *itr;
				max_index = index;
			}
			index++;
		}
		cout <<n_min+max_index << endl;
	}
	return 0;
}