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 <bits/stdc++.h>

using ll = long long;
#define int long long

// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
 * (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
	sort(all(v));\
	(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;

using namespace std;

int solve(int m) {
	int mi, ma; cin >> mi >> ma;
	vector<int> p(m);
	rep(i, m) cin >> p[i];
	int g = 1;
	int res = -1;
	reps(n, mi, ma+1) {
		if (g <= p[n-1] - p[n]) {
			g = p[n-1] - p[n];
			res = n;
		}
	}
	return res;
}

signed main() {
	int m;
	while (cin >> m, m) cout << solve(m) << endl;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int m,mi,ma;
    while(cin >> m >> mi >> ma,m){
        vector<int> p(m);
        REP(i,m){
            cin >> p[i];
        }
        //sort(All(p));
        int ga=0;
        int ans;
        for(int i=mi-1;i<ma;i++){
            if(ga<=p[i]-p[i+1]){
                ga=p[i]-p[i+1];
                ans=i+1;
            }
        }
        cout << ans << endl;
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int m,n1,n2;
  cin >> m >> n1 >> n2;
  while(m||n1||n2){
    int g=n1-1;
    int i,j,k;
    int d[300]={};
    for(i=0;i<m;i++) cin >> d[i];
    for(i=n1-1;i<n2;i++) {
      if(d[i]-d[i+1]>=d[g]-d[g+1]) g=i;
      //cout << g+1 << endl;
    }
    cout << g+1 << endl;
    //cout << endl;
    cin >> m >> n1 >> n2;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,l,r;
vi a;

int main(){
	while(1){
		cin>>n>>l>>r;
		if(!n) break;
		a=vi(n);
		for(int i=0;i<n;i++) cin>>a[i];
		sort(a.rbegin(),a.rend());
		P p={-1,0};
		for(int i=l;i<=r;i++){
			p=max(p,{a[i-1]-a[i],i});
		}
		cout<<p.second<<endl;
	}
}

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


int a[10000]={};

void sw(int n){
for(int g=0;g<2*n;g++){
for(int i=0;i<n-1;i++){
if(a[i]<a[i+1]){swap(a[i],a[i+1]);}
}}}

int main(){
int m,mi,mx,al=0;
while(cin>>m){
int am;
int b[10000];
cin>>mi>>mx;
for(int h=0;h<m;h++){
cin>>a[h];
}
sw(m);
for(int i=mx;i>=mi;i--){
b[i]=a[i]-a[i-1];}
for(int q=mx;q>=mi;q--){
if(b[q]>al){al=b[q]; am=q;}
}
cout<<am<<endl;
}

return 0;
}

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

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

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;
}

C++: #include <cstdio>
int n, l, r, p[222];
int main() {
	while (scanf("%d%d%d", &n, &l, &r), n | l | r) {
		for (int i = 0; i < n; i++) scanf("%d", &p[i]);
		int ret = 0, gap = -1;
		for (int i = l; i <= r; i++) {
			if (p[i - 1] - p[i] >= gap) ret = i, gap = p[i - 1] - p[i];
		}
		printf("%d\n", ret);
	}
	return 0;
}

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

#define vi vector<int>
#define pb push_back

int main(){
//    ifstream in("a_in.txt");
//    cin.rdbuf(in.rdbuf());

    int m, m_min, m_max;
    while(cin >> m >> m_min >> m_max, m) {
        int P[200];
        rep(p, m) {
            cin >> P[p];
        }

        int sabun[200];
        sabun[0] = 0;
        REP(i, 1, m) {
            sabun[i] = P[i-1] - P[i];
        }

        int s_max = 0;
        int ans = 0;
        REP(i, m_min, m_max+1) {
            if(s_max <= sabun[i]) {
                s_max = sabun[i];
                ans = i;
            }
        }

        cout << ans << endl;
    }

    return 0;
}