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>
int P[201];
int main() {
  int m, nmin, nmax;
  while (true) {
    scanf("%d %d %d", &m, &nmin, &nmax);
    if (m == 0 && nmin == 0 && nmax == 0) break;
    for (int i=0;i<m;i++) scanf("%d", &P[i]);
    int max_gap = -1, max_n = -1;
    for (int n=nmin;n<=nmax;n++) {
      const int gap = P[n-1]-P[n];
      if (gap >= max_gap) {
        max_gap = gap;
        max_n = n;
      }
    }
    printf("%d\n", max_n);
  }
}

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

int main() {
	while (1) {
		int m, l, f;
		vector<int> mem;
		cin >> m >> l >> f;
		if (m == 0)break;

		for (int i = 0; i < m; i++) {
			int x;
			cin >> x;
			mem.push_back(x);
		}

		int gap = 0, gapi = 0;
		for (int i = l - 1; i < f; i++) {
			if (mem[i] - mem[i + 1] >= gap) {
				gap = mem[i] - mem[i + 1];
				gapi = i;
			}
		}
		cout << gapi + 1 << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){

	int num,n_min,n_max,div,div_max,ans,pre,tmp;

	while(true){
		scanf("%d %d %d",&num,&n_min,&n_max);
		if(num == 0 && n_min == 0 && n_max == 0)break;

		div_max = -1;
		for(int i = 1; i <= num; i++){
			scanf("%d",&tmp);

			if(i >= n_min+1 && i <= n_max+1){
				div = pre - tmp;
				if(div >= div_max){
					div_max = div;
					ans = i-1;
				}
			}
			pre = tmp;
		}
		printf("%d\n",ans);
	}
    return 0;
}

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

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

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 <bits/stdc++.h>

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    vector<int> ans;
    int m, nmin, nmax, res, temp;
    while(true){
        temp = 0;
        res = 0;
        cin >> m >> nmin >> nmax;
        if(m == 0) break;
        vector<int> A(m);
        rep(i, m) cin >> A[i];
        sort(A.begin(), A.end(), greater<int>());
        for(int i = nmin; i <= nmax; i++){
            if(temp <= A[i-1] - A[i]){
                temp = A[i-1] - A[i];
                res = i;
            }
        }
        ans.push_back(res);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void) {
  while (true) {
    int m, nmin, nmax, p[210];
    cin >> m >> nmin >> nmax;
    if(!m && !nmin && !nmax) break;
    REP(i, m) cin >> p[i];

    int diff, maxdiff = -INF, ans = 0;
    ;
    FOR(i, nmin, nmax + 1) {
      diff = p[i - 1] - p[i];
      if (diff >= maxdiff) {
        maxdiff = diff;
        ans = i;
      }
    }

    cout << ans << endl;
  }
  return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int m,nmi,nma;
    cin >> m >> nmi >> nma;
    if(m==0) return 0;
    vector<int> a(m);
    for(int i=0;i<m;i++) cin >> a[i];
    sort(all(a),greater<int>());
    int ans=0,k=0;
    for(int i=nmi-1;i<=nma-1;i++){
      if(ans<=a[i]-a[i+1]){
        ans=a[i]-a[i+1];
        k=i;
        // cout << ans << endl;
      }
    }
    cout << k+1 << endl;
  }
  return 0;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

int main(void) {
	while (1) {
		int m, mini, maxi;
		int sa = -1;
		int pos;
		int p[201] = {};

		cin >> m >> mini >> maxi;
		if (m == 0) {
			break;
		}
		FOR(i, 1, m) {
			cin >> p[i];
		}
		FOR(i, mini, maxi) {
			if (p[i] - p[i + 1] >= sa) {
				sa = p[i] - p[i + 1];
				pos = i;
			}
		}
		cout << pos << endl;
	}
}

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

using namespace std;

int main(){
    int m, nmin, nmax ;
    while(1){
        cin >> m >> nmin >> nmax;
        if(m==0 and nmin ==0 and nmax==0) break;
        vector<int> P(m, 0);
        for(int i=0; i< m; i++) cin >> P[i];
        int ans_index;
        int max_gap=-1;
        for(int n=nmin;n<=nmax;n++){
            if(P[n-1] - P[n] >= max_gap){
                ans_index = n;
                max_gap = P[n-1] - P[n];
            }
        }
        cout << ans_index << endl;
    }
}

C++: #include <iostream>
#define INF (int)1e09

int main(void) {
    int m;
    int n_min;
    int n_max;
    int gap;
    int pass_num;

    int pass;
    int fail;

    while (1) {
        std::cin >> m >> n_min >> n_max;
        pass = INF;
        fail = INF;
        gap = 0;

        if (m == 0) {
           break; 
        }

        for (int i = 0; i < n_min; i++) {
            std::cin >> pass;
        }
        for (int i = n_min; i <= n_max; i++) {
            std::cin >> fail;
            if (pass - fail >= gap) {
                gap =  pass -fail;
                pass_num = i;
            }
            pass = fail;
        }
        for (int i = n_max + 1; i < m; i++) {
            std::cin >> pass;
        }
        std::cout << pass_num << std::endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;


int main(void){
	int m,n1,n2;
	while(true){
		cin>>m>>n1>>n2;
		if(m==0 && n1==0 && n2==0)break;
		vector<int>p(m);
		for(int i=0;i<m;i++)cin>>p[i];
		sort(p.begin(),p.end(),greater<int>());
		int ans=0,index=-1;
		for(int i=n1-1;i<n2;i++){
			if(p[i]-p[i+1]>=ans){
				ans=p[i]-p[i+1];
				index=i;
			}
		}
		cout<<index+1<<endl;
	}
    return 0;
}