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 <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    while(cin >> n >> a >> b, n or a or b)
    {
        vector<int> v(n);
        for(int i = 0; i < n; i++) cin >> v[i];
        sort(v.begin(), v.end(), greater<int>());
        int ans = -1, gap = 0;
        for(int i = a; i <= b; i++)
        {
            int s = v.front(), t = v.back();
            for(int j = 0; j < i; j++) s = min(s, v[j]);
            for(int j = i; j < v.size(); j++) t = max(t, v[j]);
            int d = abs(s - t);
            if(d >= gap)
            {
                gap = d;
                ans = i;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main()
{
	int m, nmin, nmax, res;
	while (cin >> m >> nmin >> nmax, m || nmin || nmax) {
		int gmax = 0;
		vector<int> P;
		P.reserve(m);
		for (int i = 0, tmp, btm = 100000; i < m; i++) {
			cin >> tmp;
			P.push_back(tmp);
			if (i >= nmin && i <= nmax && btm != 100000 && btm != tmp && btm - tmp >= gmax) {
				res = i;
				gmax = btm - tmp;
			}
			btm = tmp;
		}
		cout << res << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    while(true){
        int m, Nmax, Nmin;
        cin >> m >> Nmin >> Nmax;
        if(m == 0){
            break;
        }
        int P[m];
        for(int i = 0; i < m; i++){
            cin >> P[i];
        }
        int maxGap = 0;
        int ret = 0;
        for(int i = Nmin - 1; i < Nmax; i++){
            if(P[i] - P[i + 1] >= maxGap){
                maxGap = P[i] - P[i + 1];
                ret = i + 1;
            }
        }
        cout << ret << endl;
    }
}

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

int main(){

  int n, n_min, n_max, tmp = 0, ans = 0, max;
  int p[110000];
  int g[110000];

  while(cin >> n >> n_min >> n_max){

    if(n + n_min + n_max == 0) break;
    int i;
    for(i = 0; i < n; i++){
      cin >> p[i];
      g[i] = tmp - p[i];
      tmp = p[i];
    }
    int j = n_min, max = 0;
    for(i = n_min; i <= n_max; i++){
      if(max <= g[j]){
        max = g[j];
        ans = j;
      }
      j++;
    }
    cout << ans << endl;
  }
  return 0;
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename A, typename B>
bool cemax(A &a, const B &b) {
  return a <= b ? (a = b, true) : false;
}

void solve() {
  int m, mi, ma;
  while (cin >> m >> mi >> ma, m) {
    mi--, ma--;
    vi p(m);
    rep(i, m) cin >> p[i];
    int c = 0, r = 0;
    for (int i = mi; i <= ma; i++) {
      if (cemax(c, p[i] - p[i + 1])) r = i;
    }
    cout << r + 1 << endl;
  }
}

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

using namespace std;

int main(){
  int a,b,c,t,g=0,r;
  vector<int> d;
  while(cin >> a >> b >> c,a){
    d.clear();g=0;
    for(int i=0;i<a;i++){
      cin >> t;
      d.push_back(t);
    }r=b;
    //for(int i=0;i<a;i++)cout << d[i] << endl;
    for(int i=b;i<=c;i++){
      // cout << d[i-1] << " " << d[i] << (d[i-1]-d[i]>=g) << endl;
      if((d[i-1]-d[i])>=g){
        g=d[i-1]-d[i];
        r=i;
      }
    }
    cout << r << endl;
  }
}

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

int main() {
  int m, min, max, su, gap, temp;
  vector<int> p;

  while(1) {
    cin >> m >> min >> max;
    if(m == 0 && min == 0 && max == 0)
      break;

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

    sort(p.begin(), p.end(), greater<int>());

    su = p[min]-p[min+1];
    gap = min;
    for(int i = min+1; i <= max; i++) {
      temp  = p[i] - p[i+1];
      if(temp < su) {
        su = temp;
        gap = i;
      }
    }
    cout << gap	<< endl;
  }

  return 0;
}

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

#define PI 4*atan(1)
#define INF 1e8

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int main(){
  int m, n_min, n_max;
  while(cin >> m >> n_min >> n_max, m||n_min||n_max){
    vector<int> P(m);
    for(int i = 0; i < m; i++){
      cin >> P[i];
    }
    int diff = 0, ans;
    for(int i = n_min; i <= n_max; i++){
      if(diff <= P[i-1] - P[i]){
        diff = P[i-1] - P[i];
        ans = i;
      }
    }
    cout << ans << endl;
  }
}

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

#define ll long long

using namespace std;


int m,Nmin,Nmax;

int P[205]={};


int main(){

    while(1){
        int ans = 0;
        scanf("%d %d %d",&m,&Nmin, &Nmax);
        if(m == 0 && Nmin == 0 && Nmax == 0) break;

        for(int i=0;i<m;i++){
            scanf("%d",&P[i]);
        }
        int max_gap = 0;
        for(int i=Nmin-1;i<Nmax;i++){
            int gap = P[i] - P[i+1];
            if(max_gap <= gap){
                max_gap = gap;
                ans = i+1;
            }
        }
        printf("%d\n",ans);
    }


}

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

bool compare(int a, int b){
	return (a > b);
}

int s[10000];

int main(){
	while(true){
		int a,b,c,d,e,f;
		cin >> a >> b >> c;
		if(a==0&&b==0&&c==0){
			break;
		}
		for(int n=0;n<a;n++){
			cin >> d;
			s[n]=d;
		}
		sort(s,s+a, compare);
		a=0;
		for(int m=b;m<=c;m++){
			e=s[m-1]-s[m];
			if(a<=e){
				a=e;
				f=m;
			}
		}
		printf("%d\n",f);
	}
}