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>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


bool solve(){
  int m, n_min, n_max, p[SIZE];

  cin >> m >> n_min >> n_max;

  if(m == 0) return false;
  
  int ans_max = 0, ans = -1;
  
  for(int i=0;i<m;i++){
    cin >> p[i];
    if(i > 0 && n_min <= i && i <= n_max){
      if(ans_max <= p[i-1] - p[i]){
        ans_max = p[i-1] - p[i];
        ans = i;
      }
    }
  }

  cout << ans << endl;
  
  return true;
}

int main(){
  while(solve());
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
   int m,max,min,p[1000];
   while(1){
       int n=0,gap=0;
       scanf("%d %d %d",&m,&min,&max);
       if(m==0&&max==0&&min==0){
           break;
       }
       for(int i=0;i<m;i++){
           cin>>p[i];
       }
       for(int i=min;i<=max;i++){
           if(gap<=p[i-1]-p[i]){
               gap=p[i-1]-p[i];
               n=i;
           }
       }
       cout<<n<<endl;
   }
   return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<iterator>
#include<vector>
 
using namespace std;
 
int main(void) {
    while(1) {
        int m,nmin,nmax;
        vector<int> p;
        scanf("%d%d%d",&m,&nmin,&nmax);
        if(!m) break;
 
        for(int i=0; i<m; i++) {
            int p_;
            scanf("%d",&p_);
            p.push_back(p_);
        }
 
        sort(begin(p), end(p));
 
        int last=p[0];
        int maxgap=-1, res=-1;
        while(1) {
            auto ub = upper_bound(begin(p), end(p), last);
            if(ub == end(p)) break;
 
            last = *ub;
 
            if(end(p) - ub > nmax || end(p) - ub < nmin) continue;
 
            if(maxgap < (*ub - *(ub-1))) {
                maxgap = (*ub - *(ub-1));
                res = end(p)-ub;
            }
             
        }
        printf("%d\n",res);
    }
    return 0;
}

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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1L<<62)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int M, Nmin, Nmax;
  while (cin >> M >> Nmin >> Nmax, M && Nmin && Nmax) {
    vector<int> P(M);
    rep(i, M) cin >> P[i];
    sort(P.begin(), P.end(), greater<int>());

    int max_gap = 0;
    int ans = 0;
    for (int n = Nmin; n <= Nmax; n++) {
      int gap = P[n-1] - P[n];
      if (gap >= max_gap) {
        max_gap = gap;
        ans = n;
      }
    }

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int m,mn,mx;
  while(cin>>m>>mn>>mx,m!=0||mn!=0||mx!=0){
    vector<int> p(m);
    for(int i=0;i<m;i++)
      cin>>p[i];
    int df=0,cnt=0;
    for(int i=mn-1;i<mx;i++){
      if(df<=p[i]-p[i+1]){
        df = p[i]-p[i+1];
        cnt=i+1;
      }
    }
    cout<<cnt<<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[100002];  // 1-origin
        for(int i = 1; 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] - p[i + 1];
                ans = i;
            }
        }

        cout << ans << endl;
        //cout << gap << endl;
    }





    return 0;
}

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

void solve(int n,int mn,int mx){
    int t,st=0,maxx=0,ans=0;
    vector<int> v;
    cin >> st;
    for(int i=0;i<n-1;i++){
        cin >> t;
        v.push_back(st-t);
        st=t;
    }
    for(int i=mn-1;i<mx;i++){
        if(maxx<v[i]){
            maxx=v[i];
        }
        if(maxx<=v[i]){
            ans=i+1;
        }
    }
    
    cout<<ans<<endl;
    
}

int main(void){
    int a,b,c;
    while(cin>>a>>b>>c,a){
        solve(a,b,c);
    }
    
    
    
}

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

int main(){
        int m,n_min,n_max,gap,gap_max,i,ans;
        int a[10000];

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

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

                for(i=n_min-1; i<n_max; i++) {
                        gap=a[i]-a[i+1];
                        if(gap>=gap_max) {
                                gap_max=gap;
                                ans=i+1;
                        }
                }

                cout<<ans<<endl;
        }
}

C++: #include <iostream>
using namespace std;
int main() {
  int m, n_min, n_max, ans, d;
  while (cin >> m >> n_min >> n_max, m) {
    int P[m];
    ans = 0;
    for (int i = 0; i < m; ++i) cin >> P[i];
    d = 0;
    for (int i = n_min-1; i < n_max; ++i) {
      if (P[i] - P[i+1] >= d) {
	ans = i+1;
	d = P[i] - P[i+1];
      }
    }
    cout << ans << endl;
  }
}

C++: #include <cstdio>

int m,nmin,nmax,p[200];

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

C++: #include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int m, min, max;
    cin >> m >> min >> max;
    vector<int> v;
    loop(m, i) {
        int j; cin >> j;
        v.push_back(i);
    }

    int gap = 0;
    int ans = 0;
    for (int i = min; i < max; i++) {
        if (gap < v[i-1] - v[1]) {
            gap = v[i-1] - v[1];
            ans = i;
        }
    }
    cout << ans << endl;
}