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>
using namespace std;
#define MAX 100000
const long long INF=1145141919,MOD=1e9+7;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const double EPS = 1e-9;    // 許容誤差。問題によって変える
//typedef complex<double> P;  // Point
//typedef vector<P> VP; //単純多角形
//#define X real()
//#define Y imag()
//#define LE(n,m) ((n) < (m) + EPS)
//#define GE(n,m) ((n) + EPS > (m))
//#define EQ(n,m) (abs((n)-(m)) < EPS)
//namespace std{
//    bool operator < (const P a, const P b){
//        return a.X != b.X ? a.X <b.X : a.Y < b.Y;
//    }
//}
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
//外積cross(a,b) = |a||b|sinθ
//double cross(const P& a, const P& b) {
 // return imag(conj(a)*b);
//}
//内積dot(a,b) = |a||b|cosθ
//double dot(const P& a, const P& b) {
  //return real(conj(a)*b);
//}
//Line
//struct L : public vector<P> {
  //L(const P &a, const P &b) {
    //push_back(a); push_back(b);
  //}
//};
//円
//struct C{
//  P p; double r;
//  C(const P &p, double r) : p(p), r(r) { }
//};
int main(){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;
    while(m){
        int score[m]={},line=-INF,ans=0;
        for(int i=0;i<m;i++){
            cin>>score[i];
        }
        for(int i=nmin-1;i<nmax;i++){
            if(line<=score[i]-score[i+1]){
                line=score[i]-score[i+1];
                ans=i+1;
            }
        }
        cout<<ans<<endl;
        cin>>m>>nmin>>nmax;
    }
    return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int m, mn, mx;
  while (cin >> m >> mn >> mx) {
    if (m == 0 && mn == 0 && mx == 0) break;
    int p[m];
    REP(i, m) cin >> p[i];
    mn--, mx--;
    int d = 0;
    int ans = -1;
    for (int i = mn; i <= mx; ++i) {
      int tmp = p[i] - p[i + 1];
      if (d <= tmp) {
        d = tmp;
        ans = i;
      }
    }
    cout << ans + 1 << endl;
  }
  return 0;
}

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

using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define UNIQUE(o) (o).erase(unique(sort(all((o)))))

typedef long long ll;
const int M = 200;
int p[M];

int main() {
  int m, l, u;
  while(1) {
    scanf("%d%d%d ", &m, &l, &u);
    if (!m) break;
    REP(i,m) scanf("%d ", p+i);
    int res = 0, g = 0;
    FOR(n, l, u+1) {
      if (p[n-1] - p[n] >= g) {
        g = p[n-1] - p[n];
        res = n;
      }
    }
    printf("%d\n", res);
  }
  return 0;
}

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

int m, nMin, nMax;
int p[200];

int main() {
	while (cin >> m >> nMin >> nMax) {
		if (!m) break;
		for (int i = 0; i < m; i++) {
			cin >> p[i];
		}
		
		int gap = -1, ans = -1;
		for (int i = nMax; i >= nMin; i--) {
			if (gap < p[i-1] - p[i]) {
				gap = p[i-1] - p[i];
				ans = i;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,x;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            cin>>a>>b;
            std::deque<int> deq;
            for (int i=0;i<n;i++) {
                cin>>x;
                deq.emplace_back(x);
            }
            int gap=-1;
            int ans=0;
            while (a<=b) {
                if (deq[a-1]-deq[a]>=gap) {
                    gap=deq[a-1]-deq[a];
                    ans=a;
                }
                a++;
            }
            cout<<ans<<endl;
        }
    }
}

C++: #include <bits/stdc++.h>
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[m];

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

        sort(p,p+m,greater<int>());

        pair<int,int> ans = make_pair(0,0);

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

        cout << ans.first << endl;

    }

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vii;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip> vip;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 :1e9;
int main(){
	int n,a,b;
	while(cin>>n>>a>>b,n){
		vi in(n);
		rep(i,n)cin>>in[i];
		int ma=-1,mai;
		loop(i,a-1,b){
			int s=in[i]-in[i+1];
			if(s>=ma){
				ma=s;
				mai=i;
			}
		}
		cout<<mai+1<<endl;
	}
}

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++: //
//  main.cpp
//  Entrance Examination
//
//  Created by x15071xx on 2017/06/15.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;

int main(int argc, const char * argv[]) {
    
    while(1){
        
        int m,nmin,nmax;
        vector<int> score;
        vector<int> gap;
        
        cin >> m >> nmin >> nmax;
        
        if (m == 0 && nmin == 0 && nmax == 0) {
            break;
        }
        int tmp;
        for (int i = 0; i < m; i++) {
            cin >> tmp;
            score.push_back(tmp);
        }
        
        
        for (int i = nmin-1; i < nmax; i++) {
            gap.push_back(abs(score[i]-score[i+1]));
        }
        
        nmax = -1;
        for (int i = 0; i < gap.size(); i++) {
            if (gap[nmax] <= gap[i]) {
                nmax = i;
            }
        }
        
        cout << nmin+nmax << endl;
        
    }
    return 0;
}