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>

using namespace std;

int main(){
  int m,max,min,point;

  while(1){
    vector<int> P;

    cin>>m;
    cin>>min;
    cin>>max;

    if(m == 0 && min == 0 && max == 0){
      break;
    }

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

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

    int Pmax,Pmin,Gap,n;
    int a = min - 1;

    for(int i = min - 1;i < max;++i){
      Pmax = P.at(i);
      Pmin = P.at(i+1);

      if(i == a){
        Gap = Pmax - Pmin;
        n = i + 1;
      }
      else{
        if(Gap <= Pmax - Pmin){
          Gap = Pmax - Pmin;
          n = i + 1;
        }
      }
    }

    cout<<n<<endl;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define be(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};

int main()
{
    int m,n1,n2;
    while(cin>>m>>n1>>n2)
    {
        if(m==0)return 0;
        vector<pair<int,int> >pp(m-1);
        //vector<int>p(m);
        int now,fo;
        cin>>now;
        REP(i,m-1)
        {
            fo=now;
            cin>>now;
            pp.push_back(make_pair(fo-now,i+1));
        }
        sort(pp.begin(),pp.end());
        reverse(pp.begin(),pp.end());
        //bool flag=0;
        REP(i,m-1)
        {
            if(pp.at(i).second>=n1&&pp.at(i).second<=n2)
            {
                cout<<pp.at(i).second<<endl;
                //flag=1;
                break;
            }
        }
    }
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;
 
#ifdef LOCAL
#include "contest.h"
#else
#define error(args...) 
#endif
 
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }
 
void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}
 
int main(){
    iostream_init();
    int m, n1, n2;
    while(cin >> m >> n1 >> n2 && m != 0) {
    vector<int> P(m);
    REP(i, m) cin >> P[i];
    int max_diff = -1;
    int ans = -1;
    for(int i = n1; i <= n2; i++) {
        int diff = P[i-1] - P[i];
        if(diff >= max_diff) {
            max_diff = diff;
            ans = i;
        }
    }
    cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int a, b, c, d[10000];
vector<pair<int, int> >P;
int main() {
    while (true) {
        cin >> a >> b >> c; P.clear();
        if (a == 0)break;
        for (int i = 1; i <= a; i++)cin >> d[i];
        for (int i = b; i <= c; i++) {
            P.push_back(make_pair(d[i] - d[i + 1], i));
        }
        sort(P.begin(), P.end());
        cout << P[P.size() - 1].second << endl;
    }
    return 0;
}

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

#define rep(i, n) for(auto i=0; i != n; ++i)
#define REP(i, k, n) for(auto i=k; i != n; ++i)
#define rrep(i, n) for(auto i=n; i != 0; --i)
#define RREP(i, n, k) for(auto i=n; i != k; --i)


int main() {
    cin.tie(nullptr);

    while(1){
        int m, nmin, nmax; cin >> m >> nmin >> nmax;

        if(m+nmin+nmax == 0)    break;
        vector<int> p(m);
        rep(i, m)   cin >> p[i];
        int max_gap = 0, ans = 0;
        REP(i, nmin, nmax+1){
            if(max_gap <= p[i-1] - p[i]) {
                max_gap = p[i - 1] - p[i];
                ans = i;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

int main(void) {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m) {
        vector<int> v(m);
        for (int i = 0; i < m; i++)
            cin >> v[i];
        
        int gap = 0, ans;
        for (int i = nmin; i <= nmax; i++) {
            if (v[i - 1] - v[i] < gap) continue;
            gap = v[i - 1] - v[i];
            ans = i;
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    int m,nmin,nmax;
    while(cin >> m >> nmin >> nmax){
        if(m == 0) return 0;
        int mx = 0,ans = 0,a[m+5];
        for(int i = 1;i<=m;i++) cin >> a[i];
        for(int i = nmin;i<=nmax;i++){
            if(a[i]-a[i+1] >= mx) mx = a[i]-a[i-1],ans = i;
        }
        cout << ans << endl;
    }
}

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

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

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

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

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

        int max_gap = -1;
        int ans_n = 0;
        for (int i = nmin; i <= nmax; i++) {
            int gap = P[i-1] - P[i];
            if (gap >= max_gap) {
                max_gap = gap;
                ans_n = i;
            }
        }

        cout << ans_n << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<map>
using namespace std;

int main() {
	int a, b, c;
	while (cin>>a>>b>>c, a | b | c) {
		map<int, int>e;
		for (int d = 0; d < a; d++) {
			int f;
			cin >> f;
			e[20000-f]++;
		}
		auto i = e.begin();
		i--;
		int g = 0;
		int p = 0, q = 0;
		for (auto h = e.begin();h!=i; h++) {
			g += (*h).second;
			if (g < b)continue;
			else if (g > c)break;
			auto j = h;
			j++;
			if ((*j).first - (*h).first >= p) { p = (*j).first - (*h).first; q = g; }
		}
		cout << q << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<map>
#define _CRT_SECURE_NO_WARNINGS
using namespace std;

int main() {
	int a, b, c;
	while (scanf("%d%d%d", &a, &b, &c), a | b | c) {
		map<int, int>e;
		for (int d = 0; d < a; d++) {
			int f;
			scanf("%d", &f);
			e[20000-f]++;
		}
		auto i = e.begin();
		i--;
		int g = 0;
		int p = 0, q = 0;
		for (auto h = e.begin();h!=i; h++) {
			g += (*h).second;
			if (g < b)continue;
			else if (g > c)break;
			auto j = h;
			j++;
			if ((*j).first - (*h).first >= p) { p = (*j).first - (*h).first; q = g; }
		}
		cout << q << endl;
	}
}