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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
template<typename V> constexpr typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename A, typename B>
bool cemax(A &a, const B &b) {
  return a <= b ? (a = b, true) : false;
}

void solve() {
  int m, mi, ma;
  while (cin >> m >> mi >> ma, m) {
    mi--, ma--;
    vi p(m);
    rep(i, m) cin >> p[i];
    int c = 0, r = 0;
    for (int i = mi; i <= ma; i++) {
      if (cemax(c, p[i] - p[i + 1])) r = i;
    }
    cout << r + 1 << endl;
  }
}

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

using namespace std;

int main(){
  int a,b,c,t,g=0,r;
  vector<int> d;
  while(cin >> a >> b >> c,a){
    d.clear();g=0;
    for(int i=0;i<a;i++){
      cin >> t;
      d.push_back(t);
    }r=b;
    //for(int i=0;i<a;i++)cout << d[i] << endl;
    for(int i=b;i<=c;i++){
      // cout << d[i-1] << " " << d[i] << (d[i-1]-d[i]>=g) << endl;
      if((d[i-1]-d[i])>=g){
        g=d[i-1]-d[i];
        r=i;
      }
    }
    cout << r << endl;
  }
}

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

int main() {
  int m, min, max, su, gap, temp;
  vector<int> p;

  while(1) {
    cin >> m >> min >> max;
    if(m == 0 && min == 0 && max == 0)
      break;

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

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

    su = p[min]-p[min+1];
    gap = min;
    for(int i = min+1; i <= max; i++) {
      temp  = p[i] - p[i+1];
      if(temp < su) {
        su = temp;
        gap = i;
      }
    }
    cout << gap	<< endl;
  }

  return 0;
}

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

#define PI 4*atan(1)
#define INF 1e8

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

int main(){
  int m, n_min, n_max;
  while(cin >> m >> n_min >> n_max, m||n_min||n_max){
    vector<int> P(m);
    for(int i = 0; i < m; i++){
      cin >> P[i];
    }
    int diff = 0, ans;
    for(int i = n_min; i <= n_max; i++){
      if(diff <= P[i-1] - P[i]){
        diff = P[i-1] - P[i];
        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<bits/stdc++.h>
using namespace std;

bool compare(int a, int b){
	return (a > b);
}

int s[10000];

int main(){
	while(true){
		int a,b,c,d,e,f;
		cin >> a >> b >> c;
		if(a==0&&b==0&&c==0){
			break;
		}
		for(int n=0;n<a;n++){
			cin >> d;
			s[n]=d;
		}
		sort(s,s+a, compare);
		a=0;
		for(int m=b;m<=c;m++){
			e=s[m-1]-s[m];
			if(a<=e){
				a=e;
				f=m;
			}
		}
		printf("%d\n",f);
	}
}

C++: #include <cstdio>
#include <cstdlib>
#include <math.h>
#include <algorithm>
using namespace std;

int m,nmin,nmax,ten[205],gap,ans;

int main(){
while(1){
	
	
	scanf("%d %d %d",&m,&nmin,&nmax);
	if(m + nmin + nmax == 0)break;
	for(int i = 0;i < m;i++){
		scanf("%d",&ten[i]);
	}
	gap = -1;
	for(int i = nmin - 1;i < nmax ;i++){
		if(ten[i] - ten[i+1] >= gap){
			ans = i + 1;
			gap = ten[i] - ten[i+1];
		}
	}
	
	printf("%d\n",ans);
	
}

return 0;

}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int num_student;
  int num_min_pass;
  int num_max_pass;
  while(~scanf("%d %d %d", &num_student, &num_min_pass, &num_max_pass)) {
    if (num_student == 0) break;

    int score[10000];
    for (int student_i = 0; student_i < num_student; student_i++) {
      scanf("%d", &score[student_i]);
    }
    sort(score,score + num_student, greater<int>());
    int diff = -1;
    int res = 0;
    for (int pass_i = num_min_pass - 1; pass_i < num_max_pass; pass_i++) {
      int min_pass_score = score[pass_i];
      int max_fail_score = score[pass_i + 1];
      if (diff <= min_pass_score - max_fail_score) {
	diff = min_pass_score - max_fail_score;
	res = pass_i + 1;
      }
    }
    printf("%d\n",res);
  }
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int m,max,min,p[1000];
    while(1){
        int n=0;
        scanf("%d %d %d",&m,&min,&max);
        if(m==0&&max==0&&min==0){
            break;
        }
        for(int i=1;i<m+1;i++){
            cin>>p[i];
        }
        for(int i=max;i>=min;i--){
            if(n<p[i]-p[i+1]){
                n=p[i]-p[i+1];
            }
        }
        for(int i=max;i<=min;i--){
            if(n==p[i]-p[i+1]){
                cout<<i<<endl;
                
            }
        }        
    }
    return 0;
}