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(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m=0)
			break
		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<bits/stdc++.h>
using namespace std;
int m,a,b,p[205],c,d;
 
int main(){
  while(1){
    cin>>m>>a>>b;
    if(!m&&!a&&!b)break;
    c=d=0;
    for(int i=0;i<m;i++)cin>>p[i];
    for(int i=b-1;i>=a-1;i--)
      if(p[i]-p[i+1]>c)c=p[i]-p[i+1],d=i+1;
    cout<<d<<endl;
  }
  return 0;
}

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

int main(){

  int m, n_min, n_max, gap = 1000000, z;
  int ary[1000001];

  
  while(1){
    cin >> m >> n_min >> n_max;
    if(m == 0 && n_min == 0 && n_max == 0) break;

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

    for(int i = n_min ; i <= n_max ; i++){
      if(gap >= ary[i-1] - ary[i]){
	gap = ary[i-1] - ary[i];
	z = i;
      }
    }
    cout << z << endl;
    gap = 1000000;
    z = 0;
  }

  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;


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

    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m) {
        V a(m);
        rep(i, m) cin >> a[i];

        int ans = -1;
        int ma_gap = -1;
        rep(i, m) {
            if (nmin <= i + 1 && i + 1 <= nmax) {
                int now_gap = a[i] - a[i + 1];
                if (now_gap >= ma_gap) {
                    ans = i + 1;
                    ma_gap = now_gap;
                }
            }
        }

        cout << ans << endl;
    }
}

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

using namespace std;

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

#define SZ(x) ((int)(x).size())
#define all(x) begin(x),end(x)

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

template<class T>
ostream &operator<<(ostream &os, const vector <T> &v) {
    os << "[";
    REP (i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T, class U>
ostream &operator<<(ostream &os, const pair <T, U> &p) {
    return os << "(" << p.first << " " << p.second << ")";
}

template<class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector <vector<int>>;
using vvll = vector <vector<ll>>;

#define inf(T) (numeric_limits<T>::max() / 2)
const ll MOD = 1e9 + 7;
const ld EPS = 1e-9;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    for (;;) {
        int m; cin >> m;
        if (m == 0) break;

        int a, b; cin >> a >> b;
        vi s(m);
        REP(i, m) cin >> s[i];

        int ma = 0, maxId = -1;
        FOR(i, a-1, b) {
            if (ma <= s[i] - s[i+1]) {
                ma = s[i] - s[i+1];
                maxId = i;
            }
        }
        cout << maxId + 1 << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int n,a[200],min,max,i,c=0,k;
  while((cin>>n>>min>>max),n!=0){
    c=0;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=min-1;i<=max-1;i++){
      if(c<=a[i]-a[i+1]){
	c=a[i]-a[i+1];
	k=i;
      }
    }
    cout<<k+1<<endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
#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 (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define PII pair<int,int>
#define VS vector<string>
#define VI vector<int>
#define ll long long
#define ull unsigned long long
#define FST first
#define SEC second
int main(){
  int m,na,nb;
  while(1){
    cin>>m>>na>>nb;
    if(m+na+nb==0)break;
    VI V(m);
    REP(i,m)cin>>V[i];
    sort(ALL(V));
    reverse(ALL(V));
    int ma=-1,ans=-1;
    for(int i=na;i<=nb;i++){
      int d=V[i-1]-V[i];
      if(d>=ma){
        ma=d;ans=i;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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;
    int p[201];
    while(cin >> m >> nmin >> nmax && m) {
        REP(i, m) cin >> p[i];
        sort(p, p+m, greater<int>());
        int gap = 0;
        int ans = 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;
            }
        }
        cout << ans << endl;
    }
}