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>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;

int main()
{
    int m, min, max;
    while (cin >> m >> min >> max && m) {
        vector<int> v;
        loop(m, i) {
            int j; cin >> j;
            v.push_back(j);
        }

        int gap = 0;
        int ans = 0;
        for (int i = min; i <= max; i++) {
            if (gap < v[i-1] - v[i]) {
                gap = v[i-1] - v[i];
                ans = i;
            }
        }
        cout << ans << endl;
    }
}

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

int main(){
  int m,nmin,nmax;
  while(cin>>m>>nmin>>nmax,m){
    int score[m];
    int Maxnum=0;
    for(int i=0;i<m;i++)
      cin>>score[i];
    for(int i=nmin,Max=0;i<=nmax;i++)
      if(score[i-1]-score[i]>=Max){
	Max=score[i-1]-score[i]; Maxnum=i;
      }
    cout<<Maxnum<<endl;
  }
}

C++: #include <iostream>
using namespace std;
int main(){
    
    int m,nmax,nmin;

    while(cin>>m>>nmin>>nmax,m){
    
        int P[m];
        int M=0,ans=0;


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

        for(int i=nmin-1;i<nmax;i++){
            
            if(M<=P[i]-P[i+1]){
                
                M=P[i]-P[i+1];
                ans=i+1;
            }
            
        }


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

C++: #include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int p[1000000];
int n;

int main(){
  cin>>n;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    p[a-1]++;
    p[b]--;
  }

  rep(i,1000000){
    if(i==0) continue;
    p[i]+=p[i-1];
  }

  int ans=0;
  rep(i,1000000){
    if(p[i]>=i)
      ans=i;
  }

  cout<<ans<<endl;


  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int M,Nmin,Nmax;
    cin >> M >> Nmin >> Nmax;
    while(M){
        vector<int> V(M);
        rep(i,0,M)cin >> V[i];
        int maxd = 0,maxi;
        rep(i,Nmin-1,Nmax){
            if(maxd <= V[i] - V[i+1]){
                maxd = V[i] - V[i + 1];
                maxi = i + 1;
            }
        }
        cout << maxi << endl;
        cin >> M >> Nmin >> Nmax;
    }
}

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

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

using namespace std;

int main() {
  while(1){
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;
    if(!m)break;
    int gap = 0;
    int n = 0;
    vector<int> p(m);
    REP(i,m) cin>>p[i];
    for (int i = nmin; i <= nmax; ++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>
#include <string>
#include <cmath>
#include <map>
#include <functional>
#include <array>

using namespace std;

int main(){
    while(true){
        int m, nmin, nmax;
        cin >> m >> nmin >> nmax;
        if(m == 0 && nmin == 0 && nmax == 0) break;
        --nmin, --nmax;

        vector<int> P(m);
        for(int i = 0; i < m; ++i){
            cin >> P[i];
        }
        int gyap = 0;
        int ans = 0;
        for(int i = nmin; i <= nmax; ++i){
            if(gyap <= P[i] - P[i+1]){
                gyap = P[i] - P[i+1];
                ans = i+1;
            }
        }
        cout << ans << endl;
    }
}