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>
using namespace std;

int main(){
	int m,max,min,gap,maxgap,ans;
  	vector<int> score(201);
  	for(int i=0; i < 10001; i++){
      cin >> m >> min >> max;
      if(m == 0 && min == 0 && max == 0){
        break;
      }else{
  	  	for(int j=0; j < m; j++){
          cin >> score.at(j);
        }
        maxgap = score.at(min-1) - score.at(min);
        ans = min;
        for(int k = min; k < max; k++){
          gap = score.at(k) - score.at(k+1);
          if(gap >= maxgap){
            maxgap = gap;
            ans = k+1;
          }
        }
        cout << ans << endl;
      }
    }
  return 0;
}

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

int main(){
  while (1){
    int m, nmin,nmax;
    cin >> m >> nmin >> nmax;
    if(m==0) break;

    vector<int> pt(m+1);
    for(int i=1; i<=m; i++){
      cin >> pt[i];
    }
    int dmax=0, mx=0;
    for(int i=nmin; i<=nmax; i++){
      if(dmax <= pt[i]-pt[i+1]){
        dmax = pt[i]-pt[i+1];
        mx=i;
      }
    }
    cout << mx << endl;
    
  }
  return 0;
}

C++: // Last Change: 11/07/2019 18:37:25.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void solve(ll m, ll nMin, ll nMax) {
  vector<ll> P(m);
  for (auto &&e : P) {
    cin >> e;
  }

  ll gap = 0, res = nMin;
  for (int i = nMin - 1; i < nMax; ++i) {
    if (gap <= P[i] - P[i + 1]) {
      gap = P[i] - P[i + 1];
      res = i + 1;
    }
  }

  cout << res << endl;
}

int main() {
  ll m, nmin, nmax;
  while (cin >> m >> nmin >> nmax and !(m == 0 and nmin == 0 and nmax == 0)) {
    solve(m, nmin, nmax);
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int m, nmin, nmax;
	while (cin >> m >> nmin >> nmax&&m&&nmin&&nmax) {
		int p[200];
		for (int i = 0; i < m; i++)cin >> p[i];
		int soeji, sa1=p[nmin-1]-p[nmin],sa2;
		for (int i = nmin - 1; i <= nmax - 1; i++) {
			if (sa1 <= p[i] - p[i + 1]) {
				sa1 = p[i] - p[i + 1];
				soeji = i+1;
			}
		}
		cout << soeji << endl;
	}
	return 0;
}

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

int main(void){
  while(true){
    int m, nmin, nmax = 0;
    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 maxgap = 0, ans = 0;
    for(int i = nmin; i <= nmax; i++){
      int gap = p[i - 1] - p[i];
      if(maxgap <= gap){
        maxgap = gap;
        ans = i;
      }
    }
    
    cout << ans << endl;
  }




  return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>
#include<queue>
#include<string>
#include<set>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int i=(m);(i)<(n);(i)++)
typedef long long ll;

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

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

int main() {
  int M, Nmin, Nmax;
  while (cin >> M >> Nmin >> Nmax && M) {
    vector<int> P(M);
    REP(i, M) { cin >> P[i]; }
    int ans = 0, gap_max = 0;
    for (int i = Nmin; i <= Nmax; ++i) {
      int gap = P[i - 1] - P[i];
      if (gap >= gap_max) {
        ans = i, gap_max = gap;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  for(;;){
    int m,a,b;
    cin >> m >> a >> b;
    if(m==0) return 0;
    vector<int> p(m);
    REP(i,m) cin >> p[i];
    pair<int,int> answer=make_pair(0,0);
    FOR(i,a,b+1){
      answer=max(answer,make_pair(p[i-1]-p[i],i));
    }
    cout << answer.second << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
#define TO(x,t,f) ((x)?(t):(f))
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define FILV(x,a) fill(x.begin(),x.end(),a)
#define FILA(ar,N,a) fill(ar,ar+N,a)
#define NEXTP(x) next_permutation(x.begin(),x.end())
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;else return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define pb push_back
#define pri(aa) cout<<(aa)<<endl
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
const ll INF=1e9+7;
const ll N = 1007;





int main(){
	while(1){
		ll m,nmin,nmax,ans;
		vector<ll> p;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0)break;
		p.resize(m);
		FOR(i,0,m){
			cin>>p[i];
		}
		SORT(p);
		ll g=p[m-nmin] - p[m-nmin-1];
		ans = nmin;
		FOR(i,nmin,nmax+1){
			if(g<=p[m-i] - p[m-i-1]){
				ans = i;
				g = p[m-i] - p[m-i-1];
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FOREQ(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPEQ(i, n) FOREQ(i, 0, n)
#define ALL(c) (c).begin(), (c).end()

template <typename T> inline int size(const T& x) { return x.size(); }

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

    int m, n_min, n_max;
    while (cin >> m >> n_min >> n_max, m | n_min | n_max) {

        vector<int> P(m);
        REP(i, m) cin >> P[i];

        int max_gap = 0, ans = -1;
        FOR(i, n_min-1, n_max) {
            int gap = P[i] - P[i+1];
            if (gap >= max_gap) {
                max_gap = gap;
                ans = i+1;
            }
        }

        cout << ans << endl;
    }
}