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<iostream>
using namespace std;

int main(){
	while(1){
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m==0)
			break;
		int gap=0;
		int n=0;
		int P[200];
		for(int i=0;i<m;i++){
			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 <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int main(void){
	int32 N, l, r;
	while(cin >> N >> l >> r && N+l+r){
		vector<int32> P(N);
		REP(i, N) cin >> P[i];
		int32 res = l-1;
		sort(all(P), greater<int32>());
		FOR(i, l-1, r){
			if(P[res]-P[res+1] <= P[i]-P[i+1]){
				res = i;
			}
		}
		cout << res+1 << endl;
	}
}

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

int main() {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m | nmin | nmax) {
        vector<int> P(m);
        for (int i = 0; i < m; i++) {
            cin >> P[i];
        }

        int cost = 0, ans = 0;
        for (int i = 0; i < m; i++) {
            if (i + 1 < nmin || i + 1 > nmax) continue;
            if (i + 1 >= m) continue;
            if (P[i] - P[i + 1] >= cost) {
                cost = P[i] - P[i + 1];
                ans = i + 1;
            }
        }
        cout << ans << endl;
    }

    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}
template<typename T,typename U>
ll FindErase(T &v,U tar){
  ll cnt = 0;
  for(auto it = v.begin(); it != v.end();){
    if(*it == tar){
      it = v.erase(it);
      ++cnt;
    }
    else{
      ++it;
    }
  }
  return cnt;
}

template<typename T>
bool SuffixErase(T &v,size_t suf){
  if(suf > v.size()) return false;
  for(auto it = v.begin(); it != v.end();){
    if(distance(v.begin(),it) == suf){
      v.erase(it);
      return true;
    }
    else{
      ++it;
    }
  }
  return false;
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll m,n1,n2;
  while(cin >> m >> n1 >> n2 && m+n1+n2){
    vector<ll> v(m);
    rep(i,m){
      cin >> v[i];
    }
    sort(all(v));
    ll gapM = -1,ans = 0;
    REP(i,n1,n2+1){
      if(gapM <= v[m-i] - v[m-i-1]){
        gapM = v[m-i] - v[m-i-1];
        ans = i;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back

int main()
{
    int m, n_min, n_max;
    vector<int> x;
    while (1)
    {
        cin >> m >> n_min >> n_max;
        if (m == 0)
        {
            break;
        }
        int sum = 0;
        int total = 0;
        vector<int> a(m);
        for (int i = 0; i < m; i++)
        {
            cin >> a[i];
        }
        int cnt = 0;
        int difference = 0;
        // 平均をずらしていく
        for (int i = n_min-1; i < n_max; i++)
        {
            int tmp_diff = abs(a[i] - a[i+1]);
            // cout << a[i]  << a[i+1] << endl;
            if (tmp_diff >= difference)
            {
                difference = tmp_diff;
                cnt = i + 1;
            }
        }
        x.push_back(cnt);
    }
    for (int i = 0; i < x.size(); i++)
    {
        cout << x[i] << endl;
    }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){

  int m , n_min , n_max;
  int P[200];
  while(true){
    int ans, max_gap = 0;
    cin >> m >> n_min >> n_max;
    if(m == 0 && n_min == 0 && n_max == 0)   break;

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

    for(int i = n_min - 1 ; i < n_max ; i++){
      if(max_gap <= P[i] - P[i + 1]){
        max_gap = P[i] - P[i + 1];
        ans = i + 1;
      }
    }
      cout << ans << endl;
  }

  return 0;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

int A[210];

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    while(true){
        int M, Nmn, Nmx;
        std::cin >> M >> Nmn >> Nmx;
        if(!M){break;}
    
        for(int i=0;i<M;++i){
            std::cin >> A[i];
        }

        reverse(A, A+M);
        
        int res = Nmx;
        for(int i=Nmx;i>=Nmn;--i){
            if(A[M-i] - A[M-i-1] > A[M-res] - A[M-res-1]){
                res = i;
            }
        }

        std::cout << res << std::endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<map>
#define scanf scanf_s
using namespace std;

int main() {
	int a, b, c;
	while (scanf("%d%d%d", &a, &b, &c), a | b | c) {
		map<int, int>e;
		for (int d = 0; d < a; d++) {
			int f;
			scanf("%d", &f);
			e[20000-f]++;
		}
		auto i = e.begin();
		i--;
		int g = 0;
		int p = 0, q = 0;
		for (auto h = e.begin();h!=i; h++) {
			g += (*h).second;
			if (g < b)continue;
			else if (g > c)break;
			auto j = h;
			j++;
			if ((*j).first - (*h).first >= p) { p = (*j).first - (*h).first; q = g; }
		}
		cout << q << endl;
	}
}