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 <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

signed main(){
    
    while(1){

    int m, mi, ma; cin >> m >> mi >> ma;
    if(m == 0) break;
    vector<int> p(m);
    for(int i = 0; i < m; i++) cin >> p[i];
    sort(p.rbegin(), p.rend());

    int ans = 0;
    int ans_n;

    for(int n = mi; n <= ma; n++){
        int tmp = 0;
        tmp = p[n - 1] - p[n];
        if(tmp >= ans){
            ans = tmp;
            ans_n = n;
        }
    }

    cout << ans_n << endl;
    }
    return 0;

}

C++: #include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<numeric>
#include<map>
#include<limits>
using namespace std;

#define R(i,s,n) for(int i=s;i<n;i++)
#define D(i,n,s) for(int i=n-1;i>=s;i--)
typedef pair<int,int> P;
typedef unsigned long long ull;
typedef long long ll;

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

C++: #include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <cerrno>
#include <cfenv>
#include <math.h>
#include <iomanip>
#include <limits>
#define ll long long int

using namespace std;

int main(){

    int m,n_min,n_max;
    vector<int> data(200);

    while(true){

        cin >> m >> n_min >> n_max;

        if(m==0&&n_min==0&&n_max==0){
            break;
        }

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

        vector<pair<int,int> > ans(200);

        int cnt=0;

        for(int i=n_min;i<=n_max;i++){
            ans[cnt] = make_pair(data[i-1]-data[i],i);;
            cnt++;
        }


        int max = ans[0].first;
        int max_num = ans[0].second;

        for(int i=1;i<n_max-n_min+1;i++){
            //cout << ans[i].first << " " << ans[i].second << endl;
            if(max<=ans[i].first){
                //cout << i << endl;
                max = ans[i].first;
                max_num = ans[i].second;
            }
        }

        cout << max_num << endl;

    }

    /*5 2 4
    100
    90
    80
    75
    65 */

    return 0;
}

C++: #include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int m, min, max; m = in(), min = in() - 1, max = in();) {
		vector<int> v(m), w;
		for (int &p: v)
			p = in();
		for (int i = min; i < max; i++)
			w.push_back(v[i] - v[i + 1]);
		long s = 0, i = 0;
		for (int &x: w)
			if (x >= s) {
				i = &x - &w[0];
				s = x;
			}
		outl(i + min + 1);
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	while (true) {
		int m, min, max;
		cin >> m >> min >> max;
		if (m == 0 && min == 0 && max == 0)break;

		VI p(m);
		rep(i, m)cin >> p[i];

		SORT(p); REVE(p);
		int ans = 0, ans1;
		FOR(i, min, max + 1) {
			int x = p[i - 1] - p[i];
			if (x >= ans)ans = x, ans1 = i;
		}
		cout << ans1 << endl;
	}
}

C++: #include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    cout << fixed << setprecision(10);
    while(1){
        int m,n_min,n_max;
        cin >> m >> n_min >> n_max;
        if(m == 0 && n_min == 0 && n_max == 0) break;
        vector<int> v(m);
        rep(i,m){
            cin >> v[i];
        }
        sort(v.begin(),v.end());
        int ans;
        int now = 0;
        for(int i =  n_min; i <= n_max;i++){
            if( now <= abs(v[m - i] - v[m - i -1])){
                now = abs(v[m - i] - v[m - i -1]);
                ans = i;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int main()
{
	int m, nmin, nmax;
	while (cin >> m >> nmin >> nmax, m || nmin || nmax) {
		int P[201];
		REP(i, 0, m) cin >> P[i];

		int gap = 0, ans=0;
		REP(i, nmin, nmax + 1) {
			if (P[i - 1] - P[i] >= gap) {
				gap = P[i - 1] - P[i];
				ans = i;
			}
		}

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