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;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> VI;
typedef vector<VI> VVI;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = numeric_limits<int>::max() / 2;
const int NEG_INF = numeric_limits<int>::min() / 2;

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

  int m,mi,ma;
  while(true){
    cin >> m >> mi >> ma;
    if(m==0) break;
    std::vector<int> v;
    for(int i=0;i<m;i++){
      int p;cin >> p;
      v.push_back(p);
    }
    sort(v.begin(),v.end(),greater<int>());
    int gap=-1,n=mi;
    for(int i=mi-1;i<ma;i++){
      int temp=v[i]-v[i+1];
      if(temp>=gap){
        gap=temp;
        n=i+1;
      }
    }
    cout << n << endl;
  }
}

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

int main(void) {
	int num, max, min, tem, point[200], flag;
	vector<int> ans;
	
	while (cin >> num >> min >> max, num && min && max) {
		tem = -1;
		flag = 0;
		for (int i = 1;i <= num;i++) {
			cin >> point[i];
		}
		for (int i = min;i <= max;i++) {
			if (tem <= point[i] - point[i + 1]) {
				tem = point[i] - point[i + 1];
				flag = i;
			}
		}
		ans.push_back(flag);
	}

	for (auto itr = ans.begin();itr != ans.end();itr++) {
		cout << *itr << endl;
	}

	return 0;
}

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

int main() {
	int N, A, B;
	while (cin >> N >> A >> B) {
		if (N == 0) return 0;
		vector<int> P(N);
		for (int i = 0; i < N; i++) cin >> P[i];
		int MAX = -1, ANS = -1;
		for (int i = A; i <= B; i++) {
			if (P[i - 1] - P[i] >= MAX) MAX = P[i - 1] - P[i], ANS = i;
		}
		cout << ANS << endl;
	}
}

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[100001], maxg = 0 , n;
	while (1) {
		scanf("%d %d %d", &m, &nmin, &nmax);
		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;
			}
			printf("%d\n", n);
		}
		if (m == nmin == nmax == 0)return 0;
	}
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int main()
{
    int m,a,b;
    while(cin >>m >>a >>b,m)
    {
        vector<int> p(m);
        rep(i,m) cin >>p[i];

        int ans=b;
        int gap=0;

        //????????????i?????¨??????
        for(int i=b; i>=a; --i)
        {
            int tgap=p[i-1]-p[i];
            if(tgap>gap)
            {
                gap=tgap;
                ans=i;
            }
        }

        cout << ans << endl;
    }
    return 0;
}

C++: #if 1
  #include <bits/stdc++.h>
#else
  #include "../../bits/stdc++.h"
#endif

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

using namespace std;

typedef pair<int, int> P;
#define pb push_back
#define mp make_pair
#define ft first
#define sd second

int m, nin, nax;
int p[202];

bool input(){
  cin>>m>>nin>>nax;
  REP(i, m)cin>>p[i];
  return m;
}

void solve(){
  int s=0, b=0;
  FOR(i, nin-1, nax) {
    if(p[i]-p[i+1]>=s){
      b=i+1;
      s=p[i]-p[i+1];
    }
  }
  cout<<b<<endl;
}

int main(){
  cin.tie(0);
  
  while (input()){
      solve();
  }
  
  return 0;
}

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

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

	while (1){
		cin >> m >> min >> max;
		if (m == 0 && min == 0 && max == 0) break;
		vector<int> student;
		for (int i = 0; i < m; i++){
			int x;
			cin >> x;
			student.push_back(x);
		}
		int MaxGap = 0;
		int count = 0;
		for (int i = min; i <= max; i++){
			if (i == 0)continue;

			int gap = student[i-1] - student[i];
			if (MaxGap <= gap){
				count = i;
				MaxGap = gap;
			}
		}
		cout << count << endl;
	}

	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v),end()
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;

template<typename A,typename B> inline void chmin(A &a,B b){if(a>b) a=b;}
template<typename A,typename B> inline void chmax(A &a,B b){if(a<b) a=b;}
//-----------------------------------------------------------------------

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

    int m,nmin,nmax;
    while(cin>>m>>nmin>>nmax,m|nmin|nmax){
        int p[205];
        REP(i,m) cin>>p[i+1];
        int ma=0,ans;
        for(int i=nmin;i<=nmax;i++){
            if(p[i]-p[i+1]>=ma){
                ma=p[i]-p[i+1];
                ans=i;
            }
        }
        cout<<ans<<endl;
    }

}

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

#define ll long long

using namespace std;


int m,Nmin,Nmax;

int P[205]={};


int main(){

    while(1){
        int ans = 0;
        scanf("%d %d %d",&m,&Nmin, &Nmax);
        if(m == 0 && Nmin == 0 && Nmax == 0) break;

        for(int i=0;i<m;i++){
            scanf("%d",&P[i]);
        }
        int max_gap = 0;
        for(int i=Nmin-1;i<Nmax;i++){
            int gap = P[i] - P[i+1];
            if(max_gap <= gap){
                max_gap = gap;
                ans = i+1;
            }
        }
        printf("%d\n",ans);
    }


}

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


int main(){
  int m,mi,ma;
  scanf ("%d %d %d",&m,&mi,&ma);
  while(m){
    int ans=0;
    int k=0;
    vector<int> p(m);
    for(int t=0;t<m;t++){
      scanf ("%d",&p[t]);
    }
    for(int t=mi-1;t<ma;t++){
      if(k<=(p[t]-p[t+1])){
        k=(p[t]-p[t+1]);
        ans=t;
      }
    }
    printf("%d\n",ans+1);
    scanf ("%d %d %d",&m,&mi,&ma);
  }
}

C++: #include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repp(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

signed main(){
    int m, Nmin, Nmax;
    while(1){
        cin >> m >> Nmin >> Nmax;
        if(m + Nmin + Nmax == 0) break;
        vector<int> d(m);
        rep(i, 0, m){
            cin >> d[i];
        }
        sort(all(d));
        reverse(all(d));
        int MAX = 0, ans = -1;
        rep(i, Nmin, Nmax + 1){
            int diff = d[i - 1] - d[i];
            if(MAX <= diff){
                MAX = diff;
                ans = i;
            }
        }
        cout << ans << endl;
    }
}