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>
#include<stack>
#include<queue>
#include<string.h>
#include<string>
#include<functional>
#include<iomanip>
using namespace std;

#define INF 1<<21
#define DIV 1000000007

int main() {
  int m, nmin, nmax;
  while (cin >> m >> nmin >> nmax, (m || nmin || nmax)) {
	int p[10005];
	int gap = 0, gap1=0, gap2=0;
	int ans = 0;
	for (int i = 1; i <= m; i++) {
	  cin >> p[i];
	}
	for (int i = nmin; i <= nmax; i++) {
	  if (gap <= p[i] - p[i+1]) {
		gap = p[i] - p[i + 1];
		ans = i;
	  }
	}
	cout << ans << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

int main() {

	int m, nmin, nmax;
	while(cin >> m >> nmin >> nmax, m){
		vector<int> p(m);
		rep(i, m) cin >> p[i];
		
		int ans = 0;
		int maxi = 0;
		REP(i, nmin-1, nmax){
			if(maxi <= p[i] - p[i+1]){
				maxi = p[i] - p[i+1];
				ans = i + 1;
			}
		}
		cout << ans << endl;
		
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long 
#define Rep(i, N) for(int i = 0; i < N; i++)
#define Reps(i, x, N) for(int i = x; i < N; i++)

signed main()
{
  int M, nmin, nmax;
  int P, save;
  
  while(cin >> M >> nmin >> nmax, M || nmin || nmax) {
    int maxp = -1, maxv = 0;
    
    cin >> save;
    Reps(i, 1, M) {
      cin >> P;
      if(i >= nmin && i <= nmax) {
	if(maxv <= save - P) { 
	  maxp = i, maxv = save - P;
	}
      }
      save = P;
    }
    
    cout << maxp << endl;
    
  }

  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <list>
using namespace std;

void solve(int m,int nmin,int nmax){
	vector<int> score(m);
	for(int i=0;i<m;i++){
		cin>>score[i];
	}
	
	int maxdiff=0;
	int result;
	for(int i=nmin;i<=nmax;i++){
		int diff=score[i-1]-score[i];
		if(diff>maxdiff){
			maxdiff=diff;
			result=i;
		}else if(diff==maxdiff){
			result=i;
		}
	}
	cout<<result<<endl;
}
int main(void){
	while(1){
		
		int m,nmin,nmax;
		cin>>m>>nmin>>nmax;
		if(m==0) break;
		solve(m,nmin,nmax);
		
		}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = 99999999;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)

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

C++: #include <iostream>

using namespace std;

int main()
{
	int n,k,l,m,q,p,a[205],b[205],i,j;
	m=0;
	do{
		cin >> n >> k >> l;
		for(i=0; i<n; i++)
			cin >> a[i];
		p=200000;
		for(j=k; j<=l; j++)
		{
			if(a[j]-a[j-1]<=p)
			{
				p=a[j]-a[j-1];
				q=j;
			}
		}
		b[m]=q;
		m++;
	}while(n!=0||k!=0||l!=0);
	for(i=0; i<m-1; i++)
		cout << b[i] << "\n";
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int m, n_min, n_max;
	while (1) {
		cin >> m >> n_min >> n_max;
		if (m == 0) break;
		
		vector< int > p(m);
		for_(i,0,m) cin >> p[i];
		
		int ans = 0, max_diff = 0;
		for_(i,n_min,n_max+1) {
			int diff = p[i-1] - p[i];
			if (max_diff <= diff) {
				max_diff = diff;
				ans = i;
			}
		}
		cout << ans << endl;
	}
}

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

#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

int p[10010];

int main() {
    while(1){
        int m, nmin, nmax;
        cin >> m >> nmin >> nmax;
        if(m == 0 and nmin == 0 and nmax == 0) break;
        memset(p, 0, sizeof(p));
        rep(i,m) cin >> p[i];

        int ans = 0, mx = -1;
        for(int i = nmin-1; i < nmax; i++){
            int diff = p[i] - p[i+1];
            if(diff >= mx){
                mx = diff;
                ans = i+1;
            }
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include<iostream>

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#define _USE_MATH_DEFINES

#include<cmath>

using namespace std;

int main(){

  int m,min,max;

  while(cin >> m >> min >> max,m){

    int p[m];

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

    int gap=0,n=0;

    for(int i=min-1;i<max;i++){

      if(gap<=p[i]-p[i+1]){

        n=i+1;

        gap=p[i]-p[i+1];

      }

    }

  cout << n << endl;

  }

}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;
typedef pair<int, int> PII;
 
int M, NMIN, NMAX, P[200];
 
int main(void) {
  while(cin >> M >> NMIN >> NMAX, M) {
    REP(i, 0, M) cin >> P[i];
 
    vector<PII> vec;
    REP(i, NMIN, NMAX + 1) vec.push_back(PII(P[i - 1] - P[i], i));
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
 
    cout << vec[0].second << endl;
  }
}