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

int main(){

    int m,n_min,n_max,gap,temp_gap,n;
    int p[200];

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

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

        gap=p[n_min-1]-p[n_min];

        for(int i=n_min;i<=n_max;i++){
            temp_gap=p[i-1]-p[i];
            if(temp_gap>=gap){
                gap=temp_gap;
                n=i;
            }
        }

        cout<<n<<endl;
    }

    

    return 0;

}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1000000007;

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

//myfuncs
template<class T> inline T isPrime(T x) {
	bool ret = true;
	if (x < 2) {
		ret = false;
	}
	for (LL i = 2; i <= sqrt(x); i++) {
		if (x%i == 0) {
			ret = false;
		}
	}
	return ret;
}

int main(int argc, char const* argv[])
{
	int m,nmin,nmax;
	while (1) {
		cin >> m >> nmin >> nmax;
		if (m == 0 && nmin == 0 && nmax == 0) {
			return 0;
		}
		int p[m];
		for (int i = 0; i < m; i++) {
			cin >> p[i];
		}
		int Max = -1;
		int ans = 0;
		for (int i = nmin-1; i <= nmax-1; i++) {
			Max = max(Max,p[i] - p[i+1]);
			if (Max == p[i] - p[i+1]) {
				ans = i + 1;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 m, nmin, nmax;
	while (cin >> m >> nmin >> nmax && m+nmin+nmax) {
	  vector<int64> P(m);
	  REP(i, m) {
	    cin >> P[i];
	  }

	  sort(all(P), greater<int64>());
	  int64 res = -1, diff = -1;
	  FOR(i, nmin-1, nmax) {
	    if (diff <= P[i]-P[i+1]) {
	      res = i;
	      diff = P[i]-P[i+1];
	    }
	  }
	  cout << res+1 << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, a, b;
    while(cin >> n >> a >> b, n|a|b){
        vector<int> v(n);
        for (auto &&i : v) scanf("%d", &i);
        int ans = 0, M = -1;
        for (int i = a; i <= b; ++i) {
            if(M <= v[i-1]-v[i]) {
                ans = i;
                M = v[i-1]-v[i];
            }
        }
        cout << ans << "\n";
    }
    return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int main(){
	int m,nmin,nmax;
	while(cin>>m>>nmin>>nmax&&(m||nmin||nmax)){
		vector<int> v(m);
		rep(i,m)cin>>v[i];
		
		int maxi = -1;
		int pos = -1;
		for(int i=nmin;i<=nmax;i++){
			int t = v[i-1]-v[i];
			if(maxi<=t){
				maxi = t;
				pos = i;
			}
		}
		cout<<pos<<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;

bool solve()
{
    int m, nmin, nmax;
    cin >> m >> nmin >> nmax;
    if(m == 0) return false;

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

    int res = nmin, gap = P[nmin-1] - P[nmin];
    for(int i = nmin; i <= nmax; ++i) {
        int tmp = P[i - 1] - P[i];
        if(gap <= tmp) res = i, gap = tmp;
    }

    cout << res << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}