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 <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		int m, n_min, n_max; scanf("%d %d %d", &m, &n_min, &n_max);
		if (m == 0) break;
		vector<int> p(m); for (int i = 0; i < m; i++) scanf("%d", &p[i]);
		sort(p.rbegin(), p.rend());
		int g = -1;
		int res = 0;
		for (int i = n_max - 1; i >= n_min - 1; i--) {
			if (chmax(g, p[i] - p[i + 1])) {
				res = i + 1;
			}
		}
		printf("%d\n", res);
	}
	return 0;

}

C++: #include<iostream>
#include<vector>
#include <algorithm>
using namespace std;
int main(void){
    int m,na,ni,i,j,P,A,b;
    int max;
    

    while(cin>>m>>ni>>na,ni!=0||m!=0||na!=0){
        max=0;
         vector<int>sco(m,0);
      for(i=0;i<m;i++){
        
          cin>>P;
          sco[i]=P;
      }
      sort(sco.rbegin(),sco.rend());
      for(j=0;j<na-ni+1;j++){
        if(max<=(sco[ni-1+j]-sco[ni+j])){
            max=(sco[ni-1+j]-sco[ni+j]);
           b=ni+j;
        }

      }
    cout<<b<<endl;
     i=0;
     j=0;
     A=0;
     b=0;
    }

    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++: #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++: #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 = 1 ; 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<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v1;

int main(){
	int n,p,q;
	int i,j,k;
	int a,b,c;
	int s=0;
	while(cin>>n>>p>>q){
		if(!n)break;
		p--,q--;
		v1.clear();
		for(i=0;i<n;i++){
			cin>>a;
			v1.push_back(a);
		}
		sort(v1.rbegin(),v1.rend());
		a=0;
		for(i=p;i<=q;i++){
			if(a<=v1[i]-v1[i+1]){
				a=v1[i]-v1[i+1];
				s=i+1;
			}
		}
		cout<<s<<endl;
	}
}

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

int main(){
    int m;
    while(true){
        cin >> m;
        int mi,ma;
        cin >> mi >> ma;
        if(m==0&&mi==0&&ma==0)break;
        int k[m];
        for(int i=0;i<m;i++)cin >>k[i];
        int ans=0; int num=0;
        for(int i=mi-1;i<ma;i++){
            if(k[i]-k[i+1]>=num){
                num=k[i]-k[i+1];
                ans=i+1;
            }
        }
        cout << ans << endl;
    }
}

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

using namespace std;

int main(){
    int m,n_min,n_max;
    while(cin>>m>>n_min>>n_max,m){
        int pre;
        for(int i=0;i<n_min;++i){
            cin>>pre;
        }
        int buf1=0,ans;
        for(int i=n_min;i<=n_max;++i){
            int p;cin>>p;
            if(buf1<=pre-p){
                buf1=pre-p;
                ans=i;
            }
            pre=p;
        }
        for(int i=n_max+1;i<m;++i)cin>>pre;
        cout<<ans<<endl;
    }
}

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

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

int main(){

  while(1){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;
    if(m+nmin+nmax==0)break;
    vector<int> P(m);
    rep(i,m)cin>>P[i];

    int res = -1;
    int diff = 0;
    repl(i,nmin-1,nmax){
      int score = P[i]-P[i+1];
      if(diff<=score){
        diff = score;
        res = i;
      }
    }
    cout<<res+1<<endl;
  }

  return 0;
}

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


int a[10000]={};

void sw(int n){
for(int g=0;g<4*n;g++){
for(int i=0;i<n-1;i++){
if(a[i]<a[i+1]){swap(a[i],a[i+1]);}
}}}

int main(){
int m,mi,mx;
while(cin>>m){

int am;
int al=-1;
int b[10000];
cin>>mi>>mx;

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

sw(m);
for(int i=mx;i>=mi;i--){
b[i]=a[i]-a[i-1];
}

for(int i=mx;i>=mi;i--){
if(b[i]>al){al=b[i]; am=i;}
}

cout<<am<<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"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;



int main() {
	ios::sync_with_stdio(false);
	cin >> N >> L >> R;
	while (N) {
		int num[1000] = {};
		for (int i = 0; i < N; i++)cin >> num[i];
		sort(num, num + N);
		reverse(num, num + N);
		num[N] = 0;
		pair<int, int>ret = { 0,0 };
		for (int i = L; i <= R; i++) {
			ret = max(ret, { num[i - 1] - num[i],i });
		}
		cout << ret.second << endl;
		cin >> N >> L >> R;
	}
	return 0;
}