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>
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) break;

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

  int gap = -1;
  int n = -1;
 
  for(int i=n_min; i<=n_max; i++){
   int g = P[i-1]-P[i];
   if(gap<=g){
    gap = g;
    n = i;
   }
  }
  
  cout << n << endl;
 }

 return 0;
}

C++: #include<cstdio>

int main() {
	int m, nmin, nmax, p[201], maxg = 0 , n;
	while (1) {
		scanf("%d %d %d", &m, &nmin, &nmax);
		for (int i = 0; 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;
			}
			printf("%d\n", n);
		}
		if (m == nmin == nmax == 0)return 0;
	}
}

C++: #include <bits/stdc++.h>
 
using namespace std;
 
#define INF (1<<29)
 
int main()
{
    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 gap = P[nmin-1] - P[nmin], res = nmin;
        for (int i = nmin; i < nmax; i++) {
            if (gap < P[i] - P[i+1]) {
                gap = P[i] - P[i+1];
                res = i + 1;
            } else if (gap == P[i] - P[i+1]) {
                res = i + 1;
            }
        }
        cout << res << 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 VI = vector<long>;

int main() {
  int m, nmin, nmax;
  while (1) {
    cin >> m >> nmin >> nmax;
    if (m) {
      VI ps;
      for (int i = 0; i < m; i++) {
        long p;
        cin >> p;
        ps.push_back(p);
      }
      long n;
      long maxgap = 0;
      for (int i = nmin; i <= nmax; i++) {
        long gap = ps[i - 1] - ps[i];
        if (gap >= maxgap) {
          maxgap = gap;
          n = i;
        }
      }
      assert(maxgap != 0);
      cout << n << endl;
    }
  }
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#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__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, a, b;
    while (cin >> n >> a >> b, n || a || b) {
        vector<ll> s(n); cin >> s;
        P ans(-linf, -linf);
        rep(i, n-1) {
            if (a <= i+1 && i+1 <= b) {
                chmax(ans, P(s[i] - s[i+1], i+1));
            }
        }
        cout << ans.second << endl;
    }
}

C++: #include <stdio.h>

int main(){
	int m,na,nb,p[200];
	while(1){
		scanf("%d %d %d",&m,&na,&nb);
		if(!m) break;
		for(int i=0;i<m;i++)
			scanf("%d",&p[i]);
		int max=0;
		int ans;
		for(int i=na;i<=nb;i++){
			if(max<p[i-1]-p[i]){
				max=p[i-1]-p[i];
				ans=i;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
vector<int>score(201);
int main() {
	int m, nmin, nmax;
	
	while (cin >> m >> nmin >> nmax, !(m == 0 && nmin == 0 && nmax == 0)) {
		
		for (int i = 0; i < m; i++) {
			cin >> score[i];
		}
		int ans=0;
		int s = 0;
		for (int i = nmin-1; i <= nmax-1; i++) {
			
			if (s <= score[i ] - score[i+1]) {
				ans = max(ans,i+1);
				s = max(s, score[i ] - score[i+1]);
				
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
	int m, min, max, a[300], ans, t = 0;
		
	while (1){
		cin>>m>>min>>max;
		if(m == 0 && min == 0 && max == 0){
			break;
		}
		for(int i = 1; i <= m; i++){
			cin>>a[i];
		}
		for(int i = min; i <= max; i++){
			if(a[m - i + 1] - a[m - i] >= t){
				t = a[m - i] - a[m - i - 1];
				ans = i;
			}
		}
		cout<<ans<<endl;
		
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int main(){
  int num_student;
  int num_min_pass;
  int num_max_pass;
  while(~scanf("%d %d %d", &num_student, &num_min_pass, &num_max_pass)) {
    if (num_student == 0) break;

    int score[10000];
    for (int student_i = 0; student_i < num_student; student_i++) {
      scanf("%d", &score[student_i]);
    }
    sort(score,score + num_student, greater<int>());
    int diff = -1;
    int res = 0;
    for (int pass_i = num_min_pass - 1; pass_i < num_max_pass; pass_i++) {
      int min_pass_score = score[pass_i];
      int max_fail_score = score[pass_i + 1];
      if (diff <= min_pass_score - max_fail_score) {
	diff = min_pass_score - max_fail_score;
	res = pass_i + 1;
      }
    }
    printf("%d\n",res);
  }
}

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

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

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

int main(void){
  int m, nmin, nmax;
  while(cin >> m >> nmin >> nmax, m | nmin | nmax){
    vector<int> P(m);
    for(int i = 0; i < m; i++) cin >> P[i];
    sort(P.begin(), P.end(), greater<int>());
    int ans = 0;
    int gap = 0;
    for(int n = nmin; n <= nmax; n++){
      if(gap <= P[n-1] - P[n]){
          gap = P[n-1] - P[n];
          ans = n;
      }
    }
    cout << ans << endl;
  }
}