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>
#include <cstdio>
#include <vector>
#include <algorithm>
#define ll long long
#define all(a) (a).begin(),(a).end()

int main(int argc, char const *argv[]) {
  while(1){
    int m=0,nmin=0,nmax=0;
    scanf("%d%d%d",&m,&nmin,&nmax);
    if(m==0 && nmin==0 && nmax==0){
      break;
    }
    std::vector<int> p(m);
    for (int i = 1; i <= m; i++) {
      scanf("%d",&p[i]);
    }
    int temp=0,memo=0,memoid=0;
    for (int i = nmin; i <= nmax; i++) {
      temp=p[i]-p[i+1];
      memo=std::max(memo,temp);
      if(memo==temp) memoid=i;
    }
    p.erase(all(p));
    printf("%d\n",memoid);
  }
  return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

signed main(){
	while(true){
		int m, nmin, nmax; cin >> m >> nmin >> nmax;
		if(m == 0)break;
		vector<int> p(m);
		for(auto &&e : p)cin >> e;
		sort(ALL(p), greater<int>());
		int acc = 0, ans;
		for(int i = nmin; i <= nmax; i++){
			if(p[i-1] - p[i] >= acc){
				ans = i;
				acc = p[i-1]-p[i];
			}
		}
		cout << ans << endl;

	}

	return 0;
}

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

int main(){
  int m, n, nn;
  while(std::cin >> m >> n >> nn, m){
    vector<int> p(m);
    for (int i = 0; i < m; i++) {
      std::cin >> p[i];
    }
    sort(p.begin(), p.end());
    int maxi = 0, ans = 1e9;
    for (int i = n; i <= nn; i++) {
      if(maxi <= p[m - i] - p[m - i - 1]){
        ans = i;
        maxi = p[m - i] - p[m - i - 1];
      }
    }
    std::cout << ans << std::endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int a, b, c;
    while (cin >> a >> b >> c) {
        if (a == 0 && b == 0 && c == 0) break;
        int in[a]; rep(i, a) cin >> in[i];
        int table[a - 1]; rep(i, a - 1) table[i] = in[i] - in[i + 1];
        //rep(i, a - 1) cout << table[i] << " "; cout << endl;
        int ans = 0, num = 0;
        rrep(i, b - 1, c) {
            if (table[i] == 0) continue;
            if (table[i] >= ans) {
                ans = table[i];
                num = i;
            }
        }
        cout << num + 1 << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int m, n_min, n_max, p;
 
    while (cin>>m>>n_min>>n_max, m||n_min||n_max) {
        vector<int> v;
        for (int i = 0; i < m; ++i) {
            cin>>p;
            v.push_back(p);
        }
        sort(v.begin(), v.end(), greater<int>());
        int diff = 0;
        int ans = 0;
        for (int i = n_max - 1; i >= n_min - 1; --i) {
            if (v[i] - v[i+1] > diff) {
                diff = v[i] - v[i+1];
                ans = i;
            }
        }
        cout<<ans+1<<endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
const ll inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int m, n, M;

int main()
{
    while (cin >> m >> n >> M)
    {
        if (m == 0 && n == 0 && M == 0)
            return 0;
        vector<int> a(m);
        for (int i = 0; i < m; i++)
        {
            cin >> a[i];
        }
        ll g = -inf, ans = 0;
        for (int i = n - 1; i < M; i++)
        {
            if (a[i] - a[i + 1] >= g)
            {
                g = a[i] - a[i + 1];
                ans = i + 1;
            }
        }
        cout << ans << endl;
    }
}

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

int m, x, y;
template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	while(1){
		cin >> m >> x >> y;
		if(m == 0 && x == 0 && y == 0) return 0;
		vector<int> p;
		readVector(m, p);
		int tmp = 0, ans = 0;
		for(int i=1; i<m; ++i){
			if(x <= i && i <= y && p[i-1] - p[i] >= tmp){
				ans = i;
				tmp = p[i-1] - p[i];
			}
		}
		cout << ans << "\n";
	}
}

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;
		for (int i = 0, tmp, btm = 100000; i < m; i++) {
			cin >> 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<iostream>
#include<math.h>
#include<iomanip>
#include<string>
#include<fstream>
using namespace std;

int main(){
  int m,nmin,nmax;
  while(1){
    cin >> m>>nmin>>nmax;
    if(m==0 && nmin==0 && nmax==0){
      return 0;
    }
    int pi,pib,sa,ans;
    int samax=0;
    for(int i=0;i<m;i++){
      if(i>0)pib=pi;
      cin >> pi;
      if(i==0)pib=pi;
      if(nmin<=i && i <=nmax){
	sa=pib-pi;
	if(sa>=samax){
	  samax=sa;
	  ans=i;
	}
      }
      if(i>nmax)break;
    }
    cout << ans <<endl;
  }
}

C++: #include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    for(;;){
        int m,n,N;
        cin>>m;
        if(!m) return 0;
        cin>>n>>N;
        vector<int> p(m);
        rep(i,0,m) cin>>p[i];
        int ma=-1;
        rep(i,n,N+1){
            ma=max(ma, p[i-1]-p[i]);
        }
        rer(i,N+1,n){
            if(ma==p[i-1]-p[i]){
                cout <<i<<"\n";
                break;
            }
        }
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
//#include<stdlib.h>
using namespace std;
int main() {
	vector<int>out(0);
	int n, max, min, on = -1, l=0;
	vector<int>p(200,0);
	while (true)
	{
		cin >> n >> min >> max;
		if (n == 0) { break; }
		out.push_back(0);
		on++;
		for (int a = 0; a < n; a++) { cin >> p[a]; }
		for (int a = min-1 ; a < max; a++) {
			if (l <= p[a] - p[a + 1]) { l = p[a] - p[a + 1]; out[on] = a+1; }
		}
		for (int a = 0; a < n; a++) {  p[a]=0; }
		n = 0; min = 0; max = 0; l = 0;
	}
	for (int a = 0; a < on+1; a++) { cout << out[a]<<endl; }
	return 0;
}