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 <stdio.h>
#include <vector>
#include <algorithm>

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int student = 0;
    int maxN,minN = 0;
    int gap = 0,gapMax = 0,gapnumber  = 0;
    int score[1020] = {0};
    
    while(cin >> student >>minN >>maxN,student+maxN+minN)
    {
        REP(i,student)
        cin >> score[i];
  
    
    FOR(j,minN,maxN+1)
        {
            gap = score[0] - score[j];
            if(gapMax <= gap)
            {
                gapnumber = j;
                gapMax = gap;
                
            }
        }
        cout << gapnumber << endl;
    
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

typedef pair<int, int> pii;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int P[210];

signed main() {
    int M, Nmi, Nma;
    while(cin >> M >> Nmi >> Nma, M || Nmi || Nma) {
        rep(i,0,M) cin >> P[i];
        sort(P, P+M, greater<int>());
        int gapmax = -1, ans = 0;
        rep(i,0,M) {
            if(!(Nmi <= i+1 && i+1 <= Nma)) continue;
            int gap = P[i] - P[i+1];
            if(gapmax <= gap) {
                gapmax = gap;
                ans = i+1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int m, nmax, nmin;
int a[101];
int main() {
	while (cin >> m >> nmin >> nmax) {
		if (m == 0)return 0;
		int sa = 0;
		int ansi=nmin;
		for (int i = 0; i < m; i++)cin >> a[i];
		for (int i = nmin ; i <= nmax; i++) {
			int now = sa;
			sa = max(sa, a[i-1] - a[i]);
			if (sa != now)ansi = i;
			if (a[i - 1] - a[i] == now)ansi = i;
		}
		cout << ansi << endl;
	}
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
 
int m,a,b;
int p[205];
 
int main(){
  while(1){
    cin>>m>>a>>b;
    if(m==0&&a==0&&b==0)break;
    for(int i=1;i<=m;i++){
      cin>>p[i];
    }
    int maxm=0,id;
    for(int i=a;i<=b;i++){
      if(maxm<=p[i]-p[i+1]){
        maxm=p[i]-p[i+1];
        id=i;
      }
    }
    cout<<id<<endl;
  }
  return 0;
}

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

int n, nmin, nmax;
int main() {
  while (cin >> n >> nmin >> nmax) {
	if (n == 0) break;
	vector<int> P(n);
	for (int i = 0; i < n; ++i) cin >> P[i];
	sort(P.begin(), P.end(), greater<int>());
	int mgap = 0;
	int res = -1;
	for (int i = nmax; i >= nmin; --i) {
	  int gap = P[i-1] - P[i];
	  if (mgap < gap) {
		mgap = gap;
		res = i;
	  }
	}
	cout << res << endl;
  }
}

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

int main(){

  int m, n_min, n_max, gap = 1000000, z;
  vector<int> vc;

  cin >> m >> n_min >> n_max;
  while(1){
    if(m == 0 && n_min == 0 && n_max == 0) break;
    
    while(m--){
      int x;
      cin >> x;
      vc.push_back(x);
    }

    for(int i = n_min ; i < n_max ; i++){
      if(gap >= vc[i-1] - vc[i]){
	gap = vc[i-1] - vc[i];
	z = i;
      }
    }
    cout << z;
  }

  return 0;
}

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

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

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[100001], maxg = 0 , n;
	while (scanf("%d %d %d", &m, &nmin, &nmax)==3) {
		for (int i = 1; i <= m; i++) {
			scanf("%d", &p[i]);
		}
		for (int j = nmin; j <= nmax; j++) {
			if (p[j] - p[j+1] > maxg) {
				maxg = p[j] - p[j+1];
				n = j;
			}
		}
		if (m == 0 && nmin == 0 && nmax == 0) {
			return 0;
		}
		else {
			printf("%d\n", n);
		}
	}
}