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>
#define ll long long
#define all(a) (a).begin(),(a).end()

int main(int argc, char const *argv[]) {
  while(1){
    ll m=0,nmin=0,nmax=0;
    scanf("%lld%lld%lld",&m,&nmin,&nmax);
    if(m==0 && nmin==0 && nmax==0){
      break;
    }
    std::vector<ll> p(m);
    for (ll i = 1; i <= m; i++) {
      scanf("%lld",&p[i]);
    }
    ll temp=0,memo=0,memoid=0;
    for (ll i = nmin; i <= nmax; i++) {
      temp=p[i]-p[i+1];
      memo=std::max(memo,temp);
      if(memo==temp) memoid=i;
    }
    printf("%lld\n",memoid);
  }
  return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int m, nmax, nmin;
int a[210];
int main() {
	while (cin >> m >> nmin >> nmax) {
		if (m == 0)return 0;
		int sa = 0;
		int ansi=nmin;
		for (int i = 0; i < m; i++)cin >> a[i];
		for (int i = nmin ; i <= nmax; i++) {
			int now = sa;
			sa = max(sa, a[i-1] - a[i]);
			if (sa != now)ansi = i;
			if (a[i - 1] - a[i] == now)ansi = i;
		}
		cout << ansi << endl;
	}
}

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

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	int m,n_min,n_max;
	cin >> m;
	cin >> n_min;
	cin >> n_max;

	while (m!=0||n_min!=0||n_max!=0) {
		std::vector<int> p(m);
		int num_p = n_min;
		int gap_max;
		int gap;
		for (int i = 0; i < m; i++) {
			cin >> p[i];
		}
		gap_max = p[n_min-1] - p[n_min];	
		for (int i = n_min+1; i < n_max+1; i++) {
			gap = p[i-1] - p[i];	
			if (gap >= gap_max) {
				gap_max = gap;
				num_p = i;
			}
		}
		cout << num_p << endl;

		cin >> m;
		cin >> n_min;
		cin >> n_max;
	}
	return 0;
}

C++: #include"bits/stdc++.h"

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}


void solve();

int main() {

	solve();
	return 0;

}

void solve() {

	ll m, n_min, n_max;
	vector<ll> s;



	cin >> m >> n_min >> n_max;

	while (m > 0) {
		ll gap = 0, ans = 0;
		s.resize(m);
		REP(i, m) {

			cin >> s[i];

		}

		FOR(i, n_min-1, n_max ) {

			if (s[i] - s[i + 1] >= gap) {

				ans = i+1;
				gap = s[i] - s[i + 1];

			}

		}

		cout << ans << endl;

	}

}

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

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m==0&&nmin==0&&nmax==0)
			break;
			
		int gap=-1;
		int n=-1;
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin;i<nmax;i++){
			if(P[i-1]-P[i]>=gap){
				gap=P[i-1]-P[i];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}

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

using namespace std;

int main(void)
{
  int n_min,n_max;
  int m;
  int p;
  int result=0;
  
  vector <int> point;

  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 >> p;
	  point.push_back(p);
	}

      sort(point.begin(),point.end(),greater<int>());

      int gap_max=0;
      int gap_tmp;
  
      for(int i=n_min;i<=n_max;i++)
	{
	  //cout << i << endl;
	  if(i!=0)
	    {
	      gap_tmp = point[i-1]-point[i];
	      if(gap_tmp>=gap_max && i > result)
		{
		  gap_max=gap_tmp;
		  result=i;
		}
	    }
	}

      cout << result << endl;

      gap_max=0;
      result=0;
      point.clear();
    }
  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int m,mn,mx;
  int gap;
  int pass;
  while(1){
    gap=0;
    pass=0;
    cin>>m>>mn>>mx;
    if(m==0 && mn==0 & mx==0) break;
    int score[m];
    for(int i=0;i<m;i++){
      cin>>score[i];
    }
    for(int i=mn;i<=mx;i++){
      if(gap<=score[i-1]-score[i]){
	gap=score[i-1]-score[i];
	pass=i;
      }
      /* cout<<pass<<" "<<gap<<endl;*/
    }
    cout<<pass<<endl;
  }
  return 0;
}

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[100001], maxg = 0 , n;
	while (1) {
		scanf("%d %d %d", &m, &nmin, &nmax);
		for (int i = 1; i <= m; i++) {
			scanf("%d", &p[i]);
		}
		for (int j = nmin; j <= nmax; j++) {
			if (p[j] - p[j+1] > maxg) {
				maxg = p[j] - p[j+1];
				n = j;
			}
		}
		if (m == 0 && nmin == 0 && nmax == 0) {
			return 0;
		}
		else {
			printf("%d\n", n);
		}
	}
}

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

int main() {
    int n, nmin, nmax;
    while (cin >> n >> nmin >> nmax, n || nmin || nmax) {
        vector<int> p(n);
        for (auto& i : p) cin >> i;

        int ans = 0, c = 0;
        for (int i = nmin; i <= nmax; i++) {
            if (c <= p[i-1] - p[i]) {
                ans = i;
                c = p[i-1] - p[i];
            }
        }

        cout << ans << endl;
    }

    return 0;
}

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

using ll = long long;

using namespace std;

int main() {
    while (true) {
        int m, nmi, nma;
        cin >> m >> nmi >> nma;
        if (m == 0) break;
        int prev, ans, dma = 0;
        for (int i=0, ai; i<m; i++) {
            cin >> ai;
            if (i >= nmi && i <= nma) {
                if (dma >= ai - prev) {
                    ans = i;
                    dma = ai - prev;
                }
            }
            prev = ai;
        }
        cout << ans << '\n';
    }
    return 0;
}