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 <list>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
using pii=pair<int,int>;
using vs=vector<string>;
using vpii=vector<pii>;
using si=set<int>;

#define REP(i,a) for(int i=0;i<a;i++)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rREP(i,a) for(int i=(a)-1;i>=0;i--)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define out(S) cout<<(S)<<endl;
#define beginend(v) (v).begin(),(v).end()
#define IfOut(condition,text) if(condition){out(text);return 0;}
#define IfOutElse(condition,if_text,else_text) if(condition){out(if_text);return 0;}else{out(else_text);return 0;}
#define mod(s) ((s)%(ll)(1e9+7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a*modpow((ll)b,(ll)(1e9+5))))
#define pb(i) push_back(i)
#define fst first
#define snd second
#define Foreach(item,collection) for(auto item:collection)
#define INF 1e10
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) {ll prime;double sqrtmax = sqrt(max);vector<ll> primeVec, searchVec;FOR(i, 2, max + 1) searchVec.push_back(i);do{prime = searchVec[0];primeVec.push_back(prime);auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; });searchVec.erase(itr, searchVec.end());} while (prime < sqrtmax);primeVec.reserve(primeVec.size() + searchVec.size());primeVec.insert(primeVec.end(), beginend(searchVec));return primeVec;}
ll sum(vi v) {ll sum=0;Foreach(i,v){sum+=i;}return sum;}
#define ShowAll(v) Foreach(i,v) out(i);

int shouhi(int v,int x,int y){
    double motone=(double)v*100.0/(100.0+x);
    return motone*(100.0+y)/100.0;
}

int main(){
    vi ans;
    int m,nmin,nmax;
    while (cin>>m>>nmin>>nmax,(m||nmin||nmax))
    {
        vi P(m);
        REP(i,m)cin>>P[i];
        int n=nmin-1,pmax=0;
        FOR(i,nmin-1,nmax){
            if(pmax<=P[i]-P[i+1]){
                pmax=P[i]-P[i+1];
                n=i;
            }
        }
        ans.pb(n+1);
    }
    
    ShowAll(ans);
    return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  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> P(m);
    for (int i = 0; i < m; i++){
      cin >> P[i];
    }
    int ans = 0;
    int mx = -1;
    for (int i = n_min; i <= n_max; i++){
      int tmp = P[i - 1] - P[i];
      if (tmp >= mx){
        mx = tmp;
        ans = i;
      }
    }
    cout << ans << endl;
  }
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int student = 0;
    int maxN,minN = 0;
    int gap = 0,gapMax = 0,gapnumber  = 0;
    int score[1020] = {0};
    
    while(cin >> student >>minN >>maxN,student+maxN+minN)
    {
        REP(i,student)
        cin >> score[i];
  
    
    FOR(j,minN,maxN)
        {
            gap = score[0] - score[j];
            if(gapMax < gap)
            {
                gapnumber = j;
                gapMax = gap;
                
            }
        }
        cout << gapnumber << endl;
    
    }
    return 0;
}

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

using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

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

        if(m==0)break;

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

        int ans=0,point=0;

        for(int i=nmin;i<=nmax;i++){
            int gap=p[i-1]-p[i];
            if(point<gap){
                ans=i;
                point=gap;
            }
        }

        cout<<ans<<endl;

    }

}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <utility>
#include <stack>
#include <queue>
#include <iomanip>
#include <cctype>
using namespace std;
typedef long long ll;
int main()
{
    int m,nmin,nmax;
    cin>>m>>nmin>>nmax;
    while(m&&nmin&&nmax)
    {
        vector<int> p(m);
        for(int i=0;i<m;i++)
        {
            cin>>p[i];
            
        }
        int cmax=-1;
        int ci=0;
        for(int i=nmax;i>=nmin;i--)
        {
            int t=p[i-1]-p[i];
            if(cmax<t)
            { cmax=t;
                ci=i;
                }
        }
            cout<<ci<<endl;
        cin>>m>>nmin>>nmax;
    }
    
    
    return 0;
}

C++: #include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
  while(true){
    int n, min, max;
    cin >> n >> min >> max;
    if(n == 0 && min == 0 && max == 0) break;
    int a[n];
    for(int i = 0; i < n; i++){
      cin >> a[i];
    }
    int max_gap = 0;
    int target = 0;
    for(int i = min; i <= max; i++){
      int gap = a[i - 1] - a[i];
      if(max_gap <= gap){
        max_gap = gap;
        target = i;
      }
    }

    cout << target << endl;
  }
}

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

int main(){
  int m,ns,nd,P[201];
  while(cin >> m >> ns >> nd , m){
    for(int i=0;i<m;i++){
      cin >> P[i];
    }
    int ans = 0;
    int mmax = -1;
    for(int i=nd;i>=ns;i--){
      int gapp = P[i-1] - P[i];
      if(mmax < gapp){
	mmax = gapp;
	ans = i;
      }
    }
    cout << ans << endl;
  }
}