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<algorithm>
using namespace std;
int main() {
	int m, nmin, nmax;
	while (cin >> m >> nmin >> nmax&&m&&nmin&&nmax) {
		int p[200];
		for (int i = 0; i < m; i++)cin >> p[i];
		int soeji, sa1=p[nmin-1]-p[nmin],sa2;
		for (int i = nmin - 1; i <= nmax - 1; i++) {
			if (sa1 <= p[i] - p[i + 1]) {
				sa1 = p[i] - p[i + 1];
				soeji = i+1;
			}
		}
		cout << soeji << endl;
	}
	return 0;
}

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

int main(void)
{
        int i,m,nmin,nmax,Diff,num;

        while(1){
                num = 0;
                Diff = 0;
                cin >> m >> nmin >> nmax;
                if(m == 0 && nmin == 0 && nmax == 0){
                        break;
                }

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

                vector<int> diff(m-1);
                for(i = 0; i < m-1; i++){
                        diff[i] = data[i] - data[i+1];
                }

                for(i = nmin-1; i < nmax; i++){
                        if(diff[i] >= Diff){
                                Diff = diff[i];
                                num = i;
                        }
                }
                cout << num + 1 << endl;
                vector<int>().swap(data);
                vector<int>().swap(diff);
        }
        return 0;
}

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

using namespace std;

int main (void)
{
	long m,min,max,p[10000],g[10000],kkk,rrr;

	for (long o = 0; o < 10000; o++)
	{
	cin >> m >> min >> max;

	if (m == 0 && min == 0)
	{
		if (max == 0)
		{
			break;
		}
	}

	kkk = 0;

	for (long i = 1; i < m + 1; i++)
	{
		cin >> p[i];
	}

	for (long j = min; j < max + 1; j++)
	{
		g[j] = p[j] - p[j + 1];

		if (kkk <= g[j])
		{
			kkk = 0;
			kkk = g[j];
			rrr = 0;
			rrr = j;
		}
	}

		cout << rrr << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

int main(void){
    int n,a,b;
    while(cin>>n>>a>>b,n){
        vi s(n);
        int ans=-1,t=-1;
        rep(i,n){
            cin>>s[i];
            if(a<=i && i<=b && t<=s[i-1]-s[i]){
                t=s[i-1]-s[i];
                ans=i;
            }
        }
        cout<<ans<<endl;
    }
}

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

using namespace std;

void solve()
{
	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 gap = -1;
		int ans = 0;
		for (int i = nmin - 1; i < nmax; ++i)
		{
			if (gap <= p[i] - p[i + 1])
			{
				gap = p[i] - p[i + 1];
				ans = i + 1;
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define rep(i, n) for(int i = 0;i < n;i++)
#define repb(i, n) for(int i = n;i >= 0;i--)
#define reps(i, m, n) for(int i = m;i < n;i++)
#define repsb(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;


int main(){
	int m,mi,mx,n;
	while(1){
		cin>>m>>mi>>mx;
		if(m==0&&mi==0&&mx==0)	break;
		int p[10000],d=0;
		reps(i,1,m+1){
			cin>>p[i];
		}
		n=0;
		reps(i,mi,mx+1){
			if(d<=p[i]-p[i+1]){
				d=p[i]-p[i+1];
				n=i;
			}
		}
		cout<<n<<endl;
	}

	return 0;
}

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


using namespace std;


// Powered by caide (code generator, tester, and library code inliner)


class Solution {
public:
  void solve(std::istream& in, std::ostream& out)
  {
    int m, nmin, nmax;
    while (in >> m >> nmin >> nmax && m && nmin && nmax) {
      vector<int> p(m);
      for (auto&& i : p) {
        in >> i;
      }
      sort(p.rbegin(), p.rend());
      int maxdist = nmax;
      for(int n = nmax; n >= nmin; n--) {
        if (p[maxdist - 1] - p[maxdist] < p[n - 1] - p[n]) {
          maxdist = n;
        }
      }
      out << maxdist << "\n";
    }
  }
};

void solve(std::istream& in, std::ostream& out)
{
  out << std::setprecision(12);
  Solution solution;
  solution.solve(in, out);
}


#include <fstream>
#include <iostream>


int main() {
  
  ios_base::sync_with_stdio(0);
  cin.tie(0);


  istream& in = cin;


  ostream& out = cout;

  solve(in, out);
  return 0;
}

C++: #include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n);i<(N);i++)
#define RREP(i,n,N) for(ll i=(N-1);i>=(n);i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(), (v).end()
#define MCP(a,b) memcpy(b,a, sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;
const ll inf =1e18;

ll n, nmin, nmax;
ll P[210];
int main(){
    while(cin>>n>>nmin>>nmax, n!=0){
        REP(i, 0, n) cin>>P[i];

        ll gap=0;
        ll ans;
        sort(P, P+n);
        reverse(P, P+n);

        REP(i, nmin, nmax+1){
            ll d=P[i-1]-P[i];
            if(gap<=d){
                gap=d;
                ans=i;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int a, b, c, d[10000];
vector<pair<int, int> >P;
int main() {
	while (true) {
		cin >> a >> b >> c; P.clear();
		if (a == 0)break;
		for (int i = 1; i <= a; i++)cin >> d[i];
		for (int i = b; i <= c; i++) {
			P.push_back(make_pair(d[i] - d[i + 1], i));
		}
		sort(P.begin(), P.end());
		cout << P[P.size() - 1].second << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); (i)--)
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
using namespace std;
typedef long long lint;
typedef vector<vector<lint>> mat;

int m, nmin, nmax, p[100010];

int main(){
    while(true){
        cin >> m >> nmin >> nmax;
        if(m == 0) return 0;
        rep(i, m) cin >> p[i];
        int dmax = 0;
        int num = 0;
        For(i, nmin-1, nmax){
            if(p[i] - p[i+1] >= dmax){
                dmax = p[i] - p[i+1];
                num = i + 1;
            }
        }
        cout << num << endl;
    } 
}