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>
 
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
typedef long long int ll;
using namespace std;

int main(void) {
    int m, nmin, nmax;
    vector<int> p(10001);
    while(scanf("%d %d %d", &m, &nmin, &nmax) && m > 0) {
        REP(i, m) scanf("%d", &p[i]);
        sort(p.begin(), p.end(), greater<int>());
        int ans, gap = 0;
        for(int i=nmin-1; i<nmax; ++i) {
            if(p[i]-p[i+1] >= gap) {
                gap = p[i]-p[i+1];
                ans = i+1;
            }
        }
        printf("%d\n", ans);
    }
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;
#define ll long long

int main() {
	int m, minn, maxn, hoge, ans, maxhoge;
	while (1) {
		cin >> m >> minn >> maxn;
		if (m == 0 && minn == 0 && maxn == 0)break;
		vector<int> p(m);
		for (int i = 0; i < m; i++) {
			cin >> p[i];
		}
		sort(p.begin(), p.end());
		reverse(p.begin(), p.end());
		ans = minn - 1;
		for (int i = minn - 1; i < maxn; i++) {
			if (i == minn - 1) maxhoge = p[i] - p[i + 1];
			hoge = p[i] - p[i + 1];
			if (ans < i && hoge >= maxhoge) {
				ans = i;
				maxhoge = hoge;
			}
		}
		cout << ++ans << endl;

	}
	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		ll m, nn, nx;
		cin>>m>>nn>>nx;
		if(m==0 && nn==0 && nx==0) break;
		vector<ll> p(m);
		REP(i, m) cin>>p[i];
		ll gap = -1;
		ll res = -1;
		for(ll i = nx - 1; i >= nn - 1; --i) {
			if(p[i] == p[nx]) continue;
			if(p[i] - p[i + 1] > gap) {
				gap = p[i] - p[i + 1];
				res = i + 1;
			}
		}
		cout<<res<<endl;
	}
}

C++: #include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int m, min, max;
    while (cin >> m >> min >> max && m) {
        vector<int> v;
        loop(m, i) {
            int j; cin >> j;
            v.push_back(j);
        }

        int gap = 0;
        int ans = 0;
        for (int i = min; i <= max; i++) {
            if (gap <= v[i-1] - v[i]) {
                gap = v[i-1] - v[i];
                ans = i;
            }
        }
        cout << ans << endl;
    }
}

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

int main(){
    int m,na,nb;
    while(cin>>m>>na>>nb){
        if(m==0){
            break;
        }
        int p[m];
        for(int i=0;i<m;i++){
            cin>>p[i];
        }
        sort(p,p+m);
        reverse(p,p+m);
        int k=p[na-1];
        int c=k-p[na];
        int l=na;
        for(int i=na;i<nb;i++){
            if(c<=p[i]-p[i+1]){
                l=i+1;
                c=p[i]-p[i+1];
            }
        }
        cout<<l<<endl;
    }
}

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

using namespace std;

int main()
{
  int M, Nmin, Nmax, P[200];

  while(cin >> M >> Nmin >> Nmax, M) {
    for(int i = 0; i < M; i++) {
      cin >> P[i];
    }

    int gap = numeric_limits< int >::max();
    for(int i = Nmax; i >= Nmin; i--) {
      gap = min(gap, P[i] - P[i - 1]);
    }
    for(int i = Nmax; i >= Nmin; i--) {
      if(P[i] - P[i - 1] == gap) {
        cout << i << endl;
        break;
      }
    }
  }
}

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

int main(){
  int m, mi, ma;
  while(cin >> m >> mi >> ma, m){
    vector<int> P(m);
    for(int i = 0; i < m; ++i) cin >> P[i];
    int g = -1, ans = -1;
    for(int i = mi; i <= ma; ++i){
      if(P[i-1] - P[i] < g) continue;
      g = P[i-1] - P[i];
      ans = i;
    }
    cout << ans << endl;
  }
}

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

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

C++: #include <stdio.h>

int main(void) {

	for (;;) {
		int num;
		int nmin;
		int nmax;

		scanf("%d %d %d", &num, &nmin, &nmax);
		if (num == 0 && nmin == 0 && nmax == 0) {
			break;
		}

		int prev;
		int max = 0;
		int i;
		for (i = 1; i <= nmin; i++) {
			scanf("%d", &prev);
		}

		int n;
		for (; i <= nmax + 1; i++) {
			int score;
			scanf("%d", &score);
			int gap = prev - score;

			if (max <= gap) {
				max = gap;
				n = i - 1;
			}

			prev = score;
		}
		for (; i <= num; i++) {
			int score;
			scanf("%d", &score);
		}

		printf("%d\n", n);
	}
	return 0;
}

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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(ll i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(ll i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(ll i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

const ll inf = 1ll<<62;
const ll mod = 1e9+7;

#define int ll

main()
{
  while(1){
    int m,nmin,nmax; cin >> m >> nmin >> nmax; nmin--; nmax--;
    if(m == 0) break;
    vi p(m); rep(i,m) cin >> p[i];
    int maxv = 0, pos;
    FOR(i,nmin,nmax+1){
      if(p[i] - p[i+1] > maxv){
	maxv = p[i] - p[i+1];
	pos = i;
      }
    }
    cout << pos + 1 << endl;
  }
}

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

int main(){
	int m, min, max, a[300], ans;
		
	while (1){
		int t = 0;
		cin>>m>>min>>max;
		if(m == 0 && min == 0 && max == 0){
			break;
		}
		for(int i = 1; i <= m; i++){
			cin>>a[i];
		}

		for(int i = min; i <= max; i++){
			if(a[i] - a[i + 1] >= t){
				t = a[i ] - a[i + 1];
				ans = i;
			}
		}
		cout<<ans<<endl;
		
	}
	return 0;
}