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 <vector>
#include <algorithm>

using namespace std;

int main(void) {
	int m,nmin,nmax;
	while (cin >> m >> nmin >> nmax, m) {
		vector<int> p(m);
		for (int i = 0; i < m; ++i) {
			cin >> p[i];
		}
		int res = 0;
		int gap = 0;
		for (int i = nmin; i <= nmax; ++i) {
			if (p[i-1] - p[i] >= gap) {
				res = i;
				gap = p[i-1] - p[i];
			}
		}
		cout << res << endl;
	}
	return 0;
}

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[201], maxg = 0 , n;
	while (scanf("%d %d %d", &m, &nmin, &nmax)==3) {
		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;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        int n, nmin, nmax;
        cin >> n >> nmin >> nmax;
        if(n == 0) break;
        int a[205];
        for(int i = 1; i <= n; i++) cin >> a[i];
        int gap = 0;
        int ans = 0;
        for(int i = nmin; i <= nmax; i++) {
            if(a[i] == a[i+1]) continue;
            if(gap <= a[i] - a[i+1]) {
                gap = a[i] - a[i+1];
                ans = i;
            }
            //cerr << i << " " << gap << endl;
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
  int m, nmin, nmax;
  while (cin >> m >> nmin >> nmax) {
    if (m == 0)
      return 0;
    int mx = 0, ans = 0, a[m + 5];
    for (int i = 1; i <= m; i++)
      cin >> a[i];
    for (int i = nmin; i <= nmax; i++) {
      if (a[i] - a[i + 1] >= mx)
        mx = abs(a[i] - a[i + 1]), ans = i;
    }
    // cout << mx << endl;
    cout << ans << endl;
  }
}

C++: test

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#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 ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
	int m,n_min,n_max;
	while(cin>>m>>n_min>>n_max,m){
		vector<int> sc(m);
		vector<pair<int,int> > dif_sc(m);
		
		REP(i,m){
			cin >> sc[i];
			if(i)dif_sc[i] = make_pair(sc[i] - sc[i-1],i);
		}
		int max_dif = 0,max_i;
		REP(i,m){
			if(dif_sc[i].second >= n_min && dif_sc[i].second <= n_max)
				if(max_dif >= dif_sc[i].first){
					max_dif = dif_sc[i].first;
					max_i = i;
				}
		}
		cout << max_i << endl;
	}
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int p[200];
int main() {
	int m, s, g;
	while (scanf("%d%d%d", &m, &s, &g), m) {
		rep(i, m)scanf("%d", &p[i]);
		sort(p, p + m, greater<>());
		int Max = 0, cnt;
		for (int i = s - 1; i < g; i++) {
			if (p[i] - p[i + 1] >= Max) {
				Max = p[i] - p[i + 1];
				cnt = i + 1;
			}
		}
		printf("%d\n", cnt);
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<numeric>
#include<queue>
#include<string>
#include<sstream>

using namespace std;

int main(void) {

  int m, nmin, nmax;
  while(cin >> m >> nmin >> nmax){
    if( m == 0 ) break;

    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 g = 0;
    int ans = nmin;
    for(int i=nmin-1; i<nmax; i++){
      if(g <= p[i] - p[i+1]){
        ans = i+1;
        g = p[i] - p[i+1];
      }

    }
    cout << ans << endl;
  }


  return 0;
}










//

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


int main() {
    int n, mi, ma;
    while(cin >> n >> mi >> ma, n) {
        vector<int> v(n);
        int gap=0, ans=0;
        for(int i=0; i<n; ++i) {
            cin >> v[i];
        }
        
        for(int i=mi-1; i<ma; ++i) {
            if(gap == v[i] - v[i+1]) {
                ans = max(ans, i+1);
            } else if(gap < v[i] - v[i+1]) {
                gap = v[i] - v[i+1];
                ans = 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* p = new int[m];// 0-origin
        for(int i = 0; i < m; i++){
            cin >> p[i];
        }

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

        cout << ans << endl;
        delete[] p;
    }





    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main(){
	int n,nn;
	int nmax,nmin;
	vector<int> v(10000,0);
	vector<int> free;
	int point;
	int ss,s;

	while(1){
		cin >> n;
		cin >> nmin;
		cin >> nmax; 
		ss = 0;
		s = 0;
		nn = 0;

		if(n == 0 && nmax == 0 && nmin == 0){
			break;
		}

		for(int i = 0; i < n; i++){
			cin >> v[i];
		}
		
		for(int i = nmin - 1;i < nmax; i++){
			s = v[i] - v[i+1];
			if(i == nmin -1 || ss <= s){
				ss = s;
				nn = i+1;
			}
		}

		cout << nn <<endl;
	
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int p[201];

int main()
{
	while(1) {
		int m, nmin, nmax;
		cin >> m >> nmin >> nmax;
		if (!m && !nmin && !nmax) break;
		memset(p, 0, sizeof(p));
		rep(i,0,m) cin >> p[i];

		int ans = 0, d = 0;
		rep(n,nmin,nmax+1) {
			int a = p[n-1] - p[n];
			if (a >= d) {
				ans = n;
				d = a;
			}
		}
		cout << ans << endl;
	}

	return 0;
}