Go: // Entrance Examination(入学試験)
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1600&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

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
		}

		points := []int{}
		for i := 0; i < m; i++ {
			points = append(points, nextInt(sc))
		}

		gapMax, pass := 0, 0
		for n := nMin; n <= nMax; n++ {
			gap := points[n-1] - points[n]
			if gap >= gapMax {
				gapMax, pass = gap, n
			}
		}

		fmt.Println(pass)
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	while (1) {
		int M, Nmin, Nmax; cin >> M >> Nmin >> Nmax;
		if (!M)break;
		vector<int>vs(M);
		for (int i = 0; i < M; ++i)cin >> vs[i];
		sort(vs.begin(), vs.end(), greater<int>());
		int ans = 0;
		int num = -1;
		for (int i = Nmax-1; i >= Nmin-1; --i) {
			int n = vs[i] - vs[i + 1];
			if (n > num) {
				ans = i;
				num = n;
			}
		}
		cout << ans+1 << endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    while(true){
        int n, nMax, nMin; cin >> n >> nMin >> nMax;
        if(n == 0 and nMax == 0 and nMin == 0) return 0;
        else{
            vector<int> score(n);
            REP(i, n) cin >> score[i];
            int ans = 0, gap = 0;
            FOR(i, nMin, nMax + 1){
                if(score[i - 1] - score[i] >= gap){
                    gap = score[i - 1] - score[i];
                    ans = i;
                }
            }
            cout << ans << endl;
        }
    }
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

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

	return 0;
}

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

int main()
{
	while (true) {
		int m, nmin, nmax;
		std::cin >> m >> nmin >> nmax;

		if (m == 0) {
			break;
		}

		std::vector<int>ps;
		ps.resize(m);

		for (int i = 0; i < m; i++) {
			std::cin >> ps.at(i);
		}

		int maxgap = -1;
		int ans = -1;
		for (int i = nmin; i <= nmax; i++) {
			int gap = ps.at(i - 1) - ps.at(i);

			if (gap >= maxgap) {
				maxgap = gap;
				ans = i;

			}

		}

		std::cout << ans << std::endl;
	}

	return 0;
}

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