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++: #define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  int m, nmax, nmin;
  int P[222];
  while (true) {
    cin >> m >> nmin >> nmax;
    if (m == 0 && nmin == 0 && nmax == 0) break;
    for (int i = 0; i < m; i++) cin >> P[i];
    int ans = 0, dist = 0, mi = 0, cnt = 0;
    for (int i = 0; i < m; i++) {
      
      if (cnt + 1 < nmin) {
        mi = P[i];
        cnt++;
        continue;
      }
      mi = P[i];
      cnt++;
      if (nmax < cnt) break;
      if (dist <= mi - P[i + 1] && i + 1 < m) {
        dist = mi - P[i + 1];
        ans = cnt;
      }
    }
    cout << ans << "\n";
  }

  return 0;
}

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

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

		if (m==0&&nmin==0&&nmax==0) break;

		int P[200];
		for (int i = 0; i < m; i++) {
			cin>>P[i];
		}

		int gap=-1;
		int n=-1;

		for (int i = nmin; i <= nmax; i++) {
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=i;
			}
		}
		cout<<n<<endl;
	}
	return 0;
}

C++: #define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000000000000000000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	while (true) {
		int a, b, c;
		cin >> a >> b >> c;
		if (a == 0) return 0;
		vector<int> geko;
		REP(i, a) {
			int tmp;
			cin >> tmp;
			geko.push_back(tmp);
		}
		int ans = -1;
		int now_a = 0;
		for (int i = b; i <= c&&i < geko.size(); ++i) {
			if (ans <= geko[i-1] - geko[i ]) {
				ans = geko[i-1] - geko[i ];
				now_a = i;
			}
		}
		cout << now_a << endl;
	}
}

C++: #include<iostream>

using namespace std;


int main(){

while(1){
 int m,min,max;
 cin>>m>>min>>max;

 if(m==0&&max==0&&min==0){break;}

 int p[200];
 for(int i=0;i<m;i++){
	cin>>p[i];
 }

 int gap=-1;
 int n=-1;

 
 for(int i=min;i<max+1;i++){
	int g=p[i-1]-p[i];

	if(gap<=g){
		gap=g;
		n=i;
	}
 }
 cout<<n<<endl;
}
return 0;
}

C++: #include<iostream>
using namespace std;
int m,n1,n2;
main()
{
	while(cin>>m>>n1>>n2,m)
	{
		int p[222],ansg=0,ansi;
		for(int i=0;i<m;i++)cin>>p[i];
		for(int i=n2;i>=n1;i--)
		{
			if(ansg<p[i-1]-p[i])
			{
				ansg=p[i-1]-p[i];
				ansi=i;
			}
		}
		cout<<ansi<<endl;
	}
}

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

int main(){

	  while(1){
			int m,nmin,nmax;
			cin >> m >> nmin >> nmax;
			if(!m) break;

			vector<int> p(m);
			for(int i=0; i<m; i++) cin >> p[i];

			int gap = 0,ans = 0;
			for(int i=nmin-1; i<nmax; i++){
				  if( gap <= p[i]-p[i+1] ) {
						gap = p[i] - p[i+1];
						ans = i;
				  }
			}
			cout << ans+1 << endl;
				  
			
			
			
	  }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define debug(var) do{cout << #var << " : "; print(var); } while(0)
using namespace std;
typedef long long ll;
void print() { cout << endl; }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head; if (sizeof...(tail) != 0) cout << " "; print(forward<Tail>(tail)...); }
template <class T> void print(vector<T> &vec) { for (auto& a : vec) { cout << a; if (&a != &vec.back()) cout << " "; } cout << endl; }
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec); } }
const int INF = 1e9;
const int MOD = 1e9+7;

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

	while (true) {
		int n, nmin, nmax; cin >> n >> nmin >> nmax;
		if (n+nmin+nmax==0) break;

		vector<int> vec(n);
		rep(i, n) cin >> vec[i];
		int difmax = 0;
		int ans;
		rep(i, n) {
			int dif = 0;
			if (i>=nmin && i<=nmax) dif = vec[i-1]-vec[i];
			if (dif>=difmax) {
				difmax = dif;
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  while (true) {
    int m, n1, n2; cin >> m >> n1 >> n2;
    if (m == 0 and n1 == 0 and n2 == 0) break;
    vector<int> P(m); REP(i, m) cin >> P[i];
    sort(ALL(P));
    int max_gap = -1, max_idx = m - n2 + 1;
    FOR(i, m - n2, m - n1 + 1) {
      if (max_gap < P[i] - P[i-1]) max_gap = P[i] - P[i-1], max_idx = i;
    }
    cout << m - max_idx << endl;
  }

  return 0;
}

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

int main()
{
    int N, nmin, nmax, pcurr, pprev, maxi, maxv;
    for (;;) {
        scanf("%d %d %d", &N, &nmin, &nmax);
        if (N == 0 && nmin == 0 && nmax == 0) break;
        maxi = -1, maxv = 0;
        scanf("%d", &pprev);
        for (int i = 2; i <= N; i++) {
            scanf("%d", &pcurr);
            if (i > nmin && i <= nmax + 1 && pprev - pcurr >= maxv) maxv = pprev - pcurr, maxi = i -1;
            pprev = pcurr;
        }
        printf("%d\n", maxi);
    }
    return 0;
}