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>
#include <string>
#include <algorithm>
#include <vector>
#include<queue>
#include<set>
#include<climits>
using namespace std;

int main()
{
  while (true)
  {
    long long n = 0, min = 0, max = 0, result = 0, win = -1;
    cin >> n >> min >> max;

    if (n == 0 && min == 0 && max == 0)
      exit(0);

    vector<long long> v(n, 0);

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

    for (int i = min - 1; i < max; i++)
    {
      if (v[i] - v[i + 1] >= result)
      {
        result = v[i] - v[i + 1];
        // cout << result << endl;
        win = i;
      }
    }
    cout << win + 1 << endl;
  }

}

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

int main()
{
	int m, nmin, nmax;
	while(cin >> m >> nmin >> nmax, !(m == 0 && nmin == 0 && nmax == 0)) {
		vector<int> p(m);

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

		sort(p.begin(), p.end());
		reverse(p.begin(), p.end());

		int ans = 0, gap = -1;
		for(int i = nmax; i >= nmin; --i) {
			int g = p[i - 1] - p[i];

			if(gap < g) {
				ans = i;
				gap = g;
			}
		}

		cout << ans << endl;
	}
}

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

int main(){
    while(true){
        int m, min, max, p;
        vector<int> score;
        int n, gap=0;
        cin >> m >> min >> max;
        if(!(m||min||max)) break;
        for(int i=0;i<m;++i){
            cin >> p;
            score.push_back(p);
        }
        for(int i=min;i<=max;++i){
            if(gap <= score[i-1]-score[i]){
                gap = score[i-1]-score[i];
                n = i;
            }
        }
        cout << n << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;

ll m,n_min,n_max;
vl p;

int main(){
  while(cin >> m >> n_min >> n_max){
    if(m == 0 && n_min == 0 && n_max == 0) return 0;
    p = vl(m);
    for(ll i = 0;i < m;i++) cin >> p[i];
    sort(p.rbegin(),p.rend());
    ll gap = 0;
    ll ans = 0;
    for(ll i = n_min;i <= n_max;i++){
      if(p[i-1]-p[i] >= gap){
        ans = i;
        gap = p[i-1]-p[i];
      }
    }
    cout << ans << endl;
  }
}

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 Min = 100000;
		int ans = 0;
		for (int i = nmin-1; i <= nmax-1; i++) {
			Min = min(Min,p[i] - p[i+1]);
			if (Min == p[i] - p[i+1]) {
				ans = i;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef  unsigned long long int ull;
typedef pair<ll,ll> P;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int main(){
    ll m,l,r;
while(1){
   cin>>m>>r>>l;
   if(m==0)return 0;
   V<ll> a(m);
   for(int i=0;i<m;i++)cin>>a[i];
   sort(all(a));
   ll sum=0,ans;
   for(int i=m-l-1;i<m-r;i++){
         if(chmax(sum,a[i+1]-a[i]))ans=m-(i+1);
   }
   cout<<ans<<endl;
  }
}

C++: // 2016-12-03
#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int m, min, max, n;
	int p[200];
	while (cin >> m >> min >> max, m) {
		for (int i = 0; i < m; i++) {
			cin >> p[i];
		}
		n = min - 1;
		for (int i = min; i < max; i++) {
			if (p[i] - p[i + 1] >= p[n] - p[n + 1]) {
				n = i;
			}
		}
		cout << n + 1 << endl;
	}
	return 0;
}

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

int main(){
	int m,n1,n2;
	while(cin>>m>>n1>>n2,m){
		vector<int> p(m);
		for(int i=0;i<m;++i) cin>>p[i];
		int resgap=0;
		int resi=0;
		for(int i=n1;i<=n2;i++){
			int gap=p[i-1]-p[i];
			if(resgap<=gap){
				resgap=gap;
				resi=i;
			}
		}
		cout<<resi<<endl;
	}
}

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

using namespace std;
vector<int> ans;
int main(){
	while(1){
		int m,nmin,nmax;
		cin >> m >> nmin >> nmax;
		if(m + nmin + nmax == 0) break;
		int n;
		int p[200];
		for(int i = 0;i<m;i++){
			cin >> p[i];
		}
		sort(p,p+m);
		reverse(p,p+m);
		int maxg = 0;
		for(int i = nmin;i <= nmax;i++){
			int gap;
			gap = p[i-1] - p[i];
			if(gap >= maxg){
				maxg = gap;
				n = i;
			}
		}
		ans.push_back(n);
	}
	for(int i = 0;i < ans.size();i++) cout << ans[i] << endl;
	return 0;
}