Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

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
		}

		score_list := []int{}
		for i := 0; i < m; i++ {
			score_list = append(score_list, nextInt(sc))
		}

		// 最低合格者数と最高合格者数の間の各得点間のギャップが最大になる合格者数を取得する
		scoreGap := 0
		scoreGapMax := 0
		qualifiedNum := 0
		for n := nMin; n <= nMax; n++ {
			scoreGap = score_list[n-1] - score_list[n]
			if scoreGap >= scoreGapMax {
				scoreGapMax = scoreGap
				qualifiedNum = n
			}
		}

		fmt.Println(qualifiedNum)
	}
}

C++: #include<cstdio>
#include<algorithm>
#include<iterator>
#include<vector>

using namespace std;

int main(void) {
    while(1) {
        int m,nmin,nmax;
        vector<int> p;
        scanf("%d%d%d",&m,&nmin,&nmax);
        if(!m) break;

        for(int i=0; i<m; i++) {
            int p_;
            scanf("%d",&p_);
            p.push_back(p_);
        }

        sort(begin(p), end(p));

        int last=p[0];
        int maxgap=-1, res=-1;
        while(1) {
            auto ub = upper_bound(begin(p), end(p), last);
            if(ub == end(p)) break;

            last = *ub;

            if(end(p) - ub > nmax || end(p) - ub < nmin) continue;

            if(maxgap < (*ub - *(ub-1))) {
                maxgap = (*ub - *(ub-1));
                res = end(p)-ub;
            }
            
        }
        printf("%d\n",res);
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main()
{
        int m,ni,na;
        while(cin>>m>>ni>>na,m)
        {
                vector<int> p(m);
                REP(i,m)
                {
                        cin>>p[i];
                }
                sort(p.begin(), p.end());
                int md=0,mp=ni;
                FOR(i, m-na, m-ni+1)
                {
                        if(p[i]-p[i-1]>md)
                        {
                                //cout<<md<<i<<endl;
                                md=p[i]-p[i-1];
                                mp=m-i;
                        }
                }
                cout<<mp<<endl;
        }
}
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~                                                                                                                   
~

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  while(1){
    int m,nmi,nma;
    cin >> m >> nmi >> nma;
    if(m==0) return 0;
    vector<int> a(m);
    for(int i=0;i<m;i++) cin >> a[i];
    sort(all(a),greater<int>());
    int ans=0,k=0;
    for(int i=nmi-1;i<=nma-1;i++){
      if(ans<=a[i]-a[i+1]){
        ans=a[i]-a[i+1];
        k=i;
        cout << ans << endl;
      }
    }
    cout << k << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int m,ni,na,i,j,k,ans,idx;
  while(cin>>m>>ni>>na,m||ni||na){
    int p[m];
    for(i=0;i<m;i++) cin>>p[i];
    sort(p,p+m);
    ans=0;
    idx=ni;
    for(i=ni;i<=na;i++){
      //cout<<p[m-i]-p[m-i-1]<<endl;
      if(p[m-i]-p[m-i-1]>=ans){
	ans=p[m-i]-p[m-i-1];
	idx=i;
      }
    }
    cout << idx << endl;
  }
  return 0;
}

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

using namespace std;

int main(){
  while calc();
}

bool calc(){
  int m, nMax, nMin;
  cin >> m >> nMax >> nMin;
  if(m == 0 && nMax == 0 && nMin == 0) return false;

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

  sort(p, p + m);

  int maxPoint = -1;
  int index = 0;
  for(int i = m - 1; i > 0; i--){
    int calc = p[i] - p[i - 1];
    if(maxPoint <= calc){
      maxPoint = calc;
      index = i;
    }
  }

  cout << m - index << endl;
  return true;
}

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

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

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
	int m,minn,maxn;
	while(cin>>m>>minn>>maxn&&m!=0){
		int a[200];
		for(int i=0;i<m;i++){
			cin>>a[i];
		}
		sort(a,a+m);
		reverse(a,a+m);
		int go=-1;
		int n=0;
		for(int i=minn;i<=maxn;i++){
			if(go<a[i-1]-a[i]){
				go=a[i-1]-a[i];
				n=i;
			}
			else if(go==a[i-1]-a[i]){
				n=i;
			}
		}
		cout<<n<<endl;
	}
}

C++: #include <stdio.h>

int main()	{

	int m, nmin, nmax, curr, next, res, gap, gapmax;

	while (true)	{

		scanf("%d %d %d", &m, &nmin, &nmax);

		if (m == 0)	{ break; }

		gapmax = -1;
		gap = -1;

		// res番目の点数を入力したところで、
		// res-1番目が合格するかどうか明らかになる
		for (int i = 1; i <= m; i++)	{

			if (i == 1)	{
				scanf("%d", &next);
				///
				//printf("1banme\n");
				///
				continue;
			}

			curr = next;
			scanf("%d", &next);

			if (i <= nmin)	{
				///
				//printf("hidarisugi\n");
				///
				continue;
			} else if	(i > nmax + 1)	{
				///
				//printf("migisugi\n");
				///
				continue;
			}

			gap = curr - next;

			if (gap >= gapmax)	{
				///
				//printf("ギャップが大きい\n");
				///
				gapmax = gap;
				res = i - 1;
			}
		}

		printf("%d\n", res);
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll n,a,b,s[201],t[201],ans,tmp;
int main(void){
    while(1){
    cin>>n>>a>>b;
    if(n==0)return 0;
    ans=0;
    tmp=0;
    
    for(int i=0;i<n;i++){
        cin>>s[i];
    }
    for(int i=1;i<n;i++){
        t[i]=s[i-1]-s[i];
    }
    for(int i=a;i<=b;i++){
        if(tmp<=t[i]){tmp=t[i];ans=i;}
    }
    cout<<ans<<endl;
    }
}