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>

int main() {
	int m, nmin, nmax, p[100001], maxg = 0 , n;
	while (1) {
		scanf("%d %d %d", &m, &nmin, &nmax);
		for (int i = 0; i < m; i++) {
			scanf("%d", &p[i]);
		}
		for (int j = nmin; j <= nmax; j++) {
			if (p[j+1] - p[j] > maxg) {
				maxg = p[j+1] - p[j];
				n = j;
			}
			printf("%d\n", n);
		}
		if (m == nmin == nmax == 0)return 0;
	}
}

C++: #include <cstdio>
int n, l, r, p[222];
int main() {
	while (scanf("%d%d%d", &n, &l, &r), n | l | r) {
		for (int i = 0; i < n; i++) scanf("%d", &p[i]);
		int ret = 0, gap = -1;
		for (int i = l; i <= r; i++) {
			if (p[i - 1] - p[i] >= gap) ret = i, gap = p[i - 1] - p[i];
		}
		printf("%d\n", ret);
	}
	return 0;
}

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;
    }
}