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() {
  int m, min, max, su, gap, temp;
  vector<int> p;

  while(1) {
    cin >> m >> min >> max;
    if(m == 0 && min == 0 && max == 0)
      break;

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

    // sort(p.begin(), p.end(), greater<int>());                               

    su = p[min-1]-p[min];
    gap = min;
    for(int i = min-1; i < max; i++) {
      temp  = p[i] - p[i+1];
      cout << temp << ' ' << gap << endl;
      if(temp > su) {
        su = temp;
        gap = i+1;
      }
    }
    cout << gap << endl;
    p.clear();
  }

  return 0;
}

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

using namespace std;

int main() {
	vector<int> v;
	int m, nmin, nmax, gap = -1, gapnum;
	for (;;) {
		cin >> m >> nmin >> nmax;
		if (m == 0 && nmin == 0 && nmax == 0) break;
		v.resize(m);
		for (int i = 0; i < m; i++) cin >> v[i];

		for (int i = nmin-1; i < nmax; i++) {
			if (gap == -1) {
				gap = v[i] - v[i + 1];
				gapnum = i+1;
			}
			else {
				if (gap <= v[i] - v[i + 1]) {
					gap = v[i] - v[i + 1];
					gapnum = i+1;
				}
			}
		}
		cout << gapnum << endl;
		gap = -1;
	}
}

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

int solve(int N, int L, int R) {
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    sort(a.begin(), a.end(), greater<int>());
    
    int ret;
    int ma = 1;
    for (int i = L-1; i < R; i++) {
        if (ma <= a[i] - a[i+1]) {
            ret = i+1;
            ma = a[i] - a[i+1];
        }   
    }
    return ret;
}

int main(void){
    // Your code here!
    int N, L, R;
    vector<int> ans;
    while (1) {
        cin >> N >> L >> R;
        if (!N && !L && !R) break;
        ans.push_back(solve(N, L, R));
    }
    for (auto &i : ans) {
        cout << i << endl;
    }
}

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

int main (){
	int n,min,max;
	while(cin>>n>>min>>max && n){
		min--; max--;
		vector<int> v(n);
		for(int i=0;i<n;i++)cin>>v[i];
		sort(v.begin(),v.end(),greater<int>());
		
		int ans,gap=0;
		for(int i=min;i<=max;i++){
			if(gap>=v[i+1]-v[i]){
				gap=v[i+1]-v[i];
				ans=i+1;
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <functional>


int main (){


  int m,nmin,nmax,ans,diff;
  int point[200];
  while(1){
    scanf("%d %d %d",&m,&nmin,&nmax);
    if(m == 0 && nmin == 0 && nmax == 0) break;
    for(int i = 0;i < m;i++){
      scanf("%d",&point[i]);
    }
    //std::sort(point,point+m,std::greater<int>());
    //ans = nmin;
    ans = 0;
    diff = 0;
    for(int ss = nmin;ss <= nmax;ss++){
      if(point[ss-1] - point[ss] >= diff){
        diff = point[ss-1] - point[ss];
        ans = ss;
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

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 gap=-1;
		int n=-1;
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		for(int i=nmin;i<nmax+1;i++){
			if(P[i-1]-P[i]>=gap){
				gap=P[i-1]-P[i];
				n=i;
			}
		}
		cout<<n<<endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int m, nm, nx;
    cin >> m >> nm >> nx;
    if(m == 0) break;
    vector<int> cs;
    for(int i = 0; i < m; i++) {
      int p;
      cin >> p;
      cs.push_back(p);
    }
    int dx = 0;
    int nn = nm;
    for(int i = nm - 1; i < nx; i++) {
      int d = cs[i] - cs[i+1];
      if(d >= dx) {
        dx = d;
        nn = i + 1;
      }
    }
    cout << nn << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false);
	int m, mn, mx;
	while (cin >> m >> mn >> mx, m)
	{
		vi v(m);
		REP(i, m) cin >> v[i];
		pii ans(-1, -1);
		FOR(i, mn, mx + 1)
		{
			chmax(ans, pii(v[i - 1] - v[i], i));
		}
		cout << ans.second << endl;
	}
	return 0;
}

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

int main()
{
	int m, nmin, nmax, res;
	while (cin >> m >> nmin >> nmax, m || nmin || nmax) {
		int gmax = 0;
		vector<int> P;
		P.reserve(m);
		for (int i = 0, tmp, btm = 100000; i < m; i++) {
			cin >> tmp;
			P.push_back(tmp);
			if (i >= nmin && i <= nmax && btm != 100000 && btm != tmp && btm - tmp >= gmax) {
				res = i;
				gmax = btm - tmp;
			}
			btm = tmp;
		}
		cout << res << endl;
	}
	return 0;
}

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

int main() {
    int m, n_min, n_max;
    while (cin >> m >> n_min >> n_max, m) {
        vector<int> p(m);
        for (int &pi: p) cin >> pi;
        sort(p.begin(), p.end());
        reverse(p.begin(), p.end());
        vector<pair<int, int>> res;
        for (int n = n_min; n <= n_max; n++) {
            res.emplace_back(p[n - 1] - p[n], n);
        }
        sort(res.begin(), res.end());
        cout << res[res.size() - 1].second << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
	int nmin,nmax,m,temp,n;
	int p[200];

	start:

	scanf("%d %d %d", &m,&nmin,&nmax);

	n = nmin;

	if (m == 0) {
		goto finish;
	}

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

	for (int i = 0; i < m-1; i++) {
		for (int j = i+1; j < m; j++) {
			if (p[i] < p[j]) {
				temp = p[i];
				p[i] = p[j];
				p[j] = temp;
			}
		}
	}

	for (int i = nmin-1; i <= nmax-1; i++) {
		if (p[n-1]-p[n] <= p[i] - p[i + 1]) {
			n = i+1;
		}
	}
	
	cout << n << endl;

	n = 0;

	goto start;

	finish:

	return 0;
}

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

int main() {
    int n;
    int n1;
    int n2;
    int num;
    int cnt;
    int ans = 0;
    int tmpans;
    int m;
    while (cin>>n>>n1>>n2,n!=0||n1!=0||n2!=0){
        vector<int> vec(n);
        m = 0;
        for(m = 0;m < n;m++){
            cin >> num;
            vec.at(m) = num;
        }
        ans = 0;
        while(n1<=n2){
            tmpans = vec.at(n1-1) - vec.at(n1);
            if (tmpans >= ans){
                ans = tmpans;
                cnt = n1;
            }
            n1 = n1 + 1;
        }
        cout<<cnt<<endl;
    }
}