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++: // 2018/01/05 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int m, nmin, nmax;
		cin >> m >> nmin >> nmax;

		if(m==0 && nmin==0 && nmax==0)
			break;

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

		int gap = -1;			// ギャップの最大値
		int n = -1;			// 合格者の人数

		for(int i=nmin; i<=nmax; i++){
			int g = P[i-1]-P[i];		// ギャップ

			if(gap<=g){
				gap = g;
				n = i;
			}
		}

		cout << n << endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <complex>
#include <vector>
#include <cstdio>
#include <cmath>
#include <time.h>
#define all(c) ((c).begin(),(c).end())
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n)
#define vsort(v) sort(v.begin(),v.end())
#define vvsort(v) sort(v.begin(),v.end(),greater<int>())
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
const ll MOD = 1e9 + 7;
const double PI = acos(-1.0);
//---------------------------------------------------------------------------------------------//
int m, nmax, nmin;
int a[101];
int main() {
	while (cin >> m >> nmin >> nmax, m) {
		int sa = 0;
		int ansi=nmin;
		for (int i = 0; i < m; i++)cin >> a[i];
		for (int i = nmin ; i <= nmax; i++) {
			int now = sa;
			sa = max(sa, a[i-1] - a[i]);
			if (sa != now)ansi = i;
			if (a[i - 1] - a[i] == now)ansi = i;
		}
		cout << ansi << endl;
	}
}

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

using namespace std;

int main()
{
    int m, n1, n2;
    while(cin >> m >> n1 >> n2, m || n1 || n2){
	int P[201];
	for(int i = 0; i < m; i++) cin >> P[i];
	int ans = n1;
	for(int i = n1; i <= n2; i++){
	    if(P[ans-1]-P[ans] <= P[i-1]-P[i]) ans = i;
	}
	cout << ans << endl;
    }
    
    return 0;
}

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

using namespace std;

int n[1000]={};
long long a[1000][1000]={};
long long ans = 10000000000;

int main(){
    int s=0;
    while(1){
        scanf("%d",&n[s]);
        if(n[s] == 0){
            break;
        }
        for(int i=0;i<n[s];i++){
           scanf("%lld",&a[s][i]); 
        }
        s++;
    }

    int times =s;
    int sub;
    for(int i=0;i<s;i++){
        sort(a[i],a[i]+n[i]);
        for(int j=0;j<n[i]-1;j++){
            sub = abs(a[i][j] - a[i][j+1]);
            if(ans >= sub){
                ans = sub;
            }
        }
        cout << ans << endl;
        ans = 1000000000;
    }
    

    return 0;
}

C++: #include <iostream> 
#include <vector>
#include <algorithm>
using namespace std; 
int main() {
	int m;
	int nmin;
	int nmax;
	while (cin >> m >> nmin >> nmax, m != 0) {
		vector <int> vec(m);
		for (int i = 0; i < m; i++) {
			cin >> vec.at(i);
		}
		int cnt = 0;
		for (int j = nmin-1; j <= nmax-1; j++) {
			cnt = max(cnt, vec.at(j) - vec.at(j+1));
		}
		for (int k = nmax-1; k >= nmin-1; k--) {
			if (cnt == vec.at(k) - vec.at(k+1)) {
				cout << k + 1 << endl;
				break;
			}
			else {
				continue;
			}
		}
	}
}

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

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

void solve(){
    int m,mn,mx;
    cin>>m>>mn>>mx;
    if(m==0){
        exit(0);
    }
    vector<int>P(m);
    REP(i,m){
        cin>>P[i];
    }
    int mx_d=0;
    int ans=0;
    for(int i=mn;i<=mx;i++){
        int dif=P[i-1]-P[i];
        if(dif>=mx_d){
            mx_d=dif;
            ans=i;
        }
    }
    cout<<ans<<endl;
}
int main(){
    while(true)solve();
}

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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define RFOR(i, a, b) for (int i = (int)(b - 1); i >= (int)(a); --i)
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define RREP(i, n) for (int i = (int)(n - 1); i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(a) ((int)(a).size())
#define BIT(x, i) (((x) >> (i)) & 1)
#define SQ(x) ((x) * (x))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
    int m, mi, ma;
    while (cin >> m >> mi >> ma, m|mi|ma) {
        vi p(m);
        REP(i, m) cin >> p[i];
        pii gap = {0, 0};
        FOR(i, max(0, mi-1), ma) {
            gap = max(gap, {-(p[i+1] - p[i]), i+1});
        }
        cout << gap.second << endl;
    }
}

C++: //https://onlinejudge.u-aizu.ac.jp/challenges/sources/ICPC/Prelim/1600?year=2015

#include <bits/stdc++.h>

using namespace std;

int main() {
    int m, n_min, n_max;

    while (cin >> m >> n_min >> n_max, m | n_min | n_max) {
        vector<int> a(m);
        for (int i = 0; i < m; ++i) {
            cin >> a[i];
        }

        int ans = 0;
        int gap = 0;
        for (int k = n_min; k <= n_max; ++k) {
            if (a[k - 1] - a[k] >= gap) {
                gap = a[k - 1] - a[k];
                ans = k;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

/*
 * 「k人受かる」＝「n-k人落ちる」なので，
 * 合格者の最低点はa[k-1]。
 * 不合格者の最高点はa[k]，
 * これらの差が最大になる場合を調べる。
 *
 */

C++: #include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int n;
    while(cin>>n, n){
        int a, b; cin>>a>>b;
        vector<int> p(n);
        for(int i=0; i<n; i++) cin>>p[i];

        int gmin=1e9;
        int ans;
        for(int i=0; i+1<n; i++){
            if(a-1<=i && i<=b-1){
                if(p[i+1]-p[i]<=gmin){
                    gmin=p[i+1]-p[i];
                    ans=i+1;
                }
            }
        }
        cout << ans << endl;
    }
}

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

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