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

int s[205];

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

    if ((m | nmin | nmax) == 0)
      break;

    for (int i = 1; i <= m; i++)
      cin >> s[i];

    int mv = nmin;
    for (int i = nmin; i <= nmax; i++)
      if (s[i] - s[i + 1] >= s[mv] - s[mv + 1])
        mv = i;
    cout << mv << endl;
  }
}

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

int main(){
	int m, min, max, a[300], ans, t = 0;
		
	while (1){
		cin>>m>>min>>max;
		if(m == 0 && min == 0 && max == 0){
			break;
		}
		for(int i = 1; i <= m; i++){
			cin>>a[i];
		}
		for(int i = min; i <= max; i++){
			if(a[m - i + 1] - a[m - i] >= t){
				t = a[m - i + 1] - a[m - i];
				ans = i;
			}
		}
		cout<<ans<<endl;
		
	}
	return 0;
}

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

int main(void){
	int m,n1,n2,a,b;
	int p[201];
	while(cin>>m>>n1>>n2,m||n1||n2){
		for(int i=0;i<m;i++)cin>>p[i];
		a=0;b=0;
		for(int i=n1;i<=n2;i++){
			if(a<=p[i-1]-p[i]){
				b=i;
				a=p[i-1]-p[i];
			}
		}
		cout<<b<<endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <map>

using namespace std;

int solve(int nmin, int nmax, vector<int> &score){
    vector<int> gp;
    for(int i = nmin-1; i < nmax; i++){
       gp.push_back(score[i] - score[i+1]);
    }
    int maxGp = gp[0];
    int index = 0;
    for(int i =1; i < gp.size(); i++){
        // cout<< gp[i] <<endl;
        if(maxGp <= gp[i] ){
            maxGp = gp[i];
            index = i;
        }
    }
    // cout<<index<<endl;
    return nmin + index;
}

int main(){
    int M,nmin,nmax;
    vector<int>ans;
    while(1){
        cin>>M>>nmin>>nmax;
        if(!M && !nmin && !nmax)break;
        vector<int> P;
        for(int i=0;i<M;i++){
            int keep;cin>>keep;
            P.push_back(keep);
        }
       ans.push_back(solve(nmin, nmax, P));
    }

    for(int i: ans)cout<<i<<endl;
}

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

using namespace std;

int main(void) {
  int table[205];

  int m, min, max, ans_n;

  while(1){
    cin >> m >> min >> max; if(m == 0) break;

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

    int ans = 0;
    for(int n = min - 1; n < max; n++){
      if(ans <= table[n] - table[n + 1]){
	ans = table[n] - table[n + 1];
	ans_n = n;
      }
    }

    cout << ans_n + 1 << endl;

  }

  return 0;
}

C++: #include<bits/stdc++.h>
#define M 205
using namespace std;
int m,nmin,nmax,p[M],maxp,ans;

int main(){
  while(1){
    cin>>m>>nmin>>nmax;
    if(!m&&!nmin&&!nmax)break;
    maxp=ans=0;
    for(int i=0;i<m;i++)cin>>p[i];
    for(int i=nmax-1;i>=nmin-1;i--)
      if(p[i]-p[i+1]>maxp)
	maxp=p[i]-p[i+1],ans=i+1;
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int m, n_min, n_max, p;
    vector<int> v;

    while (cin>>m>>n_min>>n_max, m||n_min||n_max) {
        for (int i = 0; i < m; ++i) {
            cin>>p;
            v.push_back(p);
        }
        sort(v.begin(), v.end(), greater<int>());
        int size = static_cast<int>(v.size());
        int diff = 0;
        int ans = 0;
        for (int i = n_max - 1; i >= n_min - 1; --i) {
            if (v[i] - v[i+1] > diff) {
                diff = v[i] - v[i+1];
                ans = i;
            }
        }
        cout<<ans+1<<endl;
        v.clear();
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

void _main() {
    int m, nmin, nmax;
    while (cin >> m >> nmin >> nmax, m) {
        vector<int> P(m);
        REP (i, m) cin >> P[i];
        int tmp = 0, ans = -1;
        FOR (i, nmin, nmax + 1) {
            if (P[i - 1] - P[i] >= tmp) {
                tmp = P[i - 1] - P[i];
                ans = i;
            }
        }
        cout << ans << endl;
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

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

int main(){
	int m,n1,n2;
	cin >> m>>n1>>n2;
	while(m!=0||n1!=0||n2!=0){
	int p[m];
	for(int i = 0; i < m; i++){
		cin>>p[i];
	}
	int g = 0;
	for(int i = n1; i <= n2; i++){
		cout <<p[i]<<":"<<p[i-1]<<endl;
		g = max(g,p[i-1]-p[i]);
	}
	for(int i = n2; i >= n1; i--){
		if(g==p[i-1]-p[i]){
			cout << i<<endl;
			break;
		}
	}
	cin >> m>>n1>>n2;
	}
	return 0;
}

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

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

        int cur,prev;
        cin >> prev;
        int pmax=0,gmax=0;
        for(int i=1; i<m; i++){
            cin >> cur;
            if(nmin<=i && i<=nmax){
                int gap = prev-cur;
                if(gap >= gmax){
                    gmax = gap;
                    pmax = i;
                }
            }
            prev = cur;
        }
        cout << pmax << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rall(c) (c).rbegin(), (c).rend()

int main() {
    for (int m, a, b; cin >> m >> a >> b, m | a | b;) {
        vector<int> p(m);
        for (int& e : p) cin >> e;
        sort(rall(p));
        int n = a;
        for (int i = a + 1; i <= b; ++i) if (p[i - 1] - p[i] >= p[n - 1] - p[n]) n = i;
        cout << n << endl;
    }
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(void) {
    while (1) {
        int m, nmin, nmax;
        scanf("%d%d%d", &m, &nmin, &nmax);
        if (m == 0 && nmin == 0 && nmax == 0) break;

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

        sort(P, P + m, greater<int>());
//        for (int i = 0; i < m; ++i) {
//            cout << P[i] << endl;
//        }
        int maxgap = 0;
        int maxgapn;
        for (int i = nmin; i <= nmax; ++i) {
            int gap = P[i] - P[i + 1];
            if (gap >= maxgap) {
                maxgapn = i;
                maxgap = gap;
            }
        }

        cout << maxgapn + 1 << endl;
    }
    return 0;
}