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 <bits/stdc++.h>
using namespace std;
int m;
vector<int>p;
vector<int>s;
int maxn,minn;


int main(){
  int i,j,now=0,ni=0;
  while(1){
  cin >> m >> minn >> maxn;
  now = 0;
  if(m==0&&maxn==0&&minn==0)break;
  for(i=0;i<m;i++){
    cin >> j;
    p.push_back(j);
  }
  sort(p.begin(),p.end());
  for(i=0;i<m-1;i++)  s.push_back(p[i+1]-p[i]);
  for(i=m-minn-1;i>=m-maxn-1;i--){
    // cout << " bbb"<<s[i];
    if(s[i]>=now){
      now = s[i];
      ni = i;
      //cout <<"aaa"<< now << " "<< ni << endl;
    }
  }
  //cout <<endl<< ni << endl;
  cout << m-1-ni << endl;
  while(p.size())p.pop_back();
  while(s.size())s.pop_back();
  }
  return 0;
}

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

int main(){
  while(1){
    int m,nmin,nmax,g=-1,ans,p[M];
    cin>>m>>nmin>>nmax;
    if(!m&&!nmin&&!nmax)break;
    for(int i=1;i<=m;i++)cin>>p[i];
    for(int n=nmin;n<=nmax;n++){
      if(p[n]==p[n+1])continue;
      if(g<=p[n]-p[n+1]){
	g=p[n]-p[n+1];
	ans=n;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;
int main(){
	while(1){
		int m,nmin,nmax; cin >> m >> nmin >> nmax;
		if (m + nmin + nmax == 0) break;
		int dis = 0;
		int max = 0;
		int maxi = 0;
		int pre_p = 0;
		for (int i = 1; i <= m; i++){
			int p1; cin >> p1;
			if (nmin < i and i <= nmax + 1){
				dis = pre_p - p1;
				if (max <= dis){
					max = dis;
					maxi = i;
				}		
			}
			pre_p = p1;
		}
		cout << maxi - 1 << endl;
	}
return 0;
}

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

#define INF 100000

using namespace std;

int main()
{

    while (true) {
        int m, n_min, n_max;
        cin >> m >> n_min >> n_max;
        if (m==0 && n_min ==0 && n_max == 0) {
            return 0;
        }
        vector<int> pv(m);
        for (int i = 0; i < m; i++) {
            cin >> pv[i];
        }
        sort(pv.rbegin(), pv.rend());
        int d_max = -INF;
        int result = n_min;
        for (int n = n_min; n <= n_max; n++) {
            int d = pv[n - 1] - pv[n];
            if (d >= d_max) {
                d_max = d;
                result = n;
            }
        }
        cout << result << endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  while(true){
  int m,nmin,nmax;
  cin >> m >> nmin >> nmax;
  if(m==0)break;
  int list[m];
  for(int i=0;i<m;i++){
    cin >> list[i];
  }
  int gap=0,c;
  for(int i=nmin-1;i<nmax;i++){
    if(list[i]-list[i+1]>=gap){
      gap=list[i]-list[i+1];
      c=i+1;
    }
  }
  cout << c << 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 <bits/stdc++.h>
using namespace std;
using ll = long long;

signed
main(){
	int m,n,l;
			while(cin >> m >> n >> l && !(m==0 && n==0 && l==0))
			{
					vector<int> p(m);
					for(int i=0;i<m;i++)
							cin >> p[i];

					sort(p.rbegin(), p.rend());
					int ans = 0, sum = 0;;

					for(int i=n;i<=l;i++)
					{
							if(sum <= p[i-1]-p[i])
							{
								ans = i;
								sum = p[i-1] - p[i];
							}
					}
					cout << ans << endl;
			}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> answer;
  while(1){
    int m,n_min,n_max,gap_max = 0,ans;
    cin >> m >> n_min >> n_max;
    if(!m)break;
    vector<int> point(m);
    for(int i = 0;i < m;i++)cin >> point[i];
    sort(point.begin(),point.end());
    for(int i = m-n_max;i <= m-n_min;i++){
      if(point[i] - point[i-1] > gap_max){
        ans = m-i;
        gap_max = point[i] - point[i-1];
      }
    }
    answer.push_back(ans);
  }
  for(int i = 0;i < answer.size();i++)cout << answer[i] << endl;
}

C++: #include <iostream>

using namespace std;

int main() {
    int p[201], ans, t;
    int m, n_min, n_max;

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

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

        ans = 0; t = 0;

        for (int i = n_min; i <= n_max; i++) {
            if (t <= p[i-1] - p[i]) {
                ans = i;
                t = p[i-1] - p[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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

const int INF = (int)1e9;

int main() {
  while(true) {
    int m, nmin, nmax;
    cin >> m >> nmin >> nmax;
    if(m == 0 && nmin == 0 && nmax == 0) break;
    vector<int> p(m);
    for(int i = 0; i < m; ++i) cin >> p[i];
    int ansgap = 0;
    int ansac = -1;
    for(int point = 0; point <= 10000; ++point) {
      int acmin = INF;
      int wamax = 0;
      int numac = 0;
      for(int i = 0; i < m; ++i) {
        if(p[i] >= point) {
          acmin = min(acmin, p[i]);
          numac++;
        }
        else {
          wamax = max(wamax, p[i]);
        }
      }
      if(nmin <= numac && numac <= nmax) {
        if(ansgap < acmin - wamax || (ansgap == acmin - wamax && ansac < numac)) {
          ansgap = acmin - wamax;
          ansac = numac;
        }
      }
    }
    cout << ansac << endl;
  }
}

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

int main()
{
    int M, NA, NB;
    while (cin >> M >> NA >> NB, M || NA || NB) {
        vector<int> P(M);
        rep(i, M) {
            cin >> P[i];
        } 

        int ans = 0, mgap = 0;
        for (int i=NA; i<=NB; i++) {
            int gap = P[i-1] - P[i];
            if (gap >= mgap) {
                ans = i;
                mgap = gap;
            }
        }

        cout << ans << endl;
    }
}

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

int main(){
  int m,mini,maxi;
  while(1){
    cin>>m>>mini>>maxi;
    if(m==0&&mini==0&&maxi==0)break;
    int p[205];
    for(int i=0;i<m;i++)cin>>p[i];
    int gap=-1,t;
    if(m==maxi)maxi--;
    for(int i=mini-1;i<maxi;i++){
      //cout<<i+1<<": "<<p[i]-p[i+1]<<endl;
      if(gap<=p[i]-p[i+1]){
	gap=p[i]-p[i+1];
	t=i+1;
      }
    }
    cout<<t<<endl;
  }
  
  return 0;
}