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 <vector>
#include <algorithm>
#include <utility>

using namespace std;

int main(void) {

  while (true) {
    int m, min, max;
    cin >> m >> min >> max;
    if (m == 0 && min == 0 && max == 0) break;

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

    for (int i = min; i <= max; i++) {
      pair<int,int> tmp = make_pair(i,p[i-1]-p[i]);
      //cout << tmp.first << " " << tmp.second << endl;
      
      g.push_back(tmp);
    }

    int gmax = -1;
    int n;
    for (int i = 0; i < g.size(); i++) {
      pair<int,int> tmp = g[i];
      if (gmax <= tmp.second) {
	n = tmp.first;
	gmax = tmp.second;
      }
    }
    cout << n << endl;
    
  }

  return 0;
  
}

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

int main(){
	int m,nmin,nmax,x,res,resmax;
	vector<int> v;
	while(1){
		cin >> m >> nmin >> nmax;
		if(m == 0)break;
		resmax = 0;
		v.clear();
		for(int i = 0;i < m;i++){
			cin >> x;
			v.push_back(x);
		}
		sort(v.begin(),v.end(),greater<int>());
		for(int i = nmin - 1;i < nmax;i++){
			x = v[i] - v[i+1];
			if(x >= resmax){
				res = i + 1;
				resmax = x;
			}
		}
		cout << res << endl;
	}
	return 0;
}

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

int main(){
  int m,nmin,nmax,dmax,num;

  while(true){
    cin >> m >> nmin >> nmax;
    if(m == 0 && nmin == 0 && nmax == 0) break;

    int *score = new int[m];

    for(int i = 0; i<m; ++i)
      cin >> score[i];
    
    
    for(int i=nmin - 1; i<nmax - 1; ++i){
      if(i == nmin - 1) dmax = score[i] - score[i+1];
      
      if(score[i] - score[i+1] >= dmax){
	dmax = score[i] - score[i+1];
	num = i + 1;
        
      }
    }

    delete[] score;

    cout << num << endl;
    
  }
  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++){
		g = max(g,p[i-1]-p[i]);
	}
	for(int i = n2; i >= n1; i--){
		if(g==p[i-1]-p[i]){
			break;
		}
	}
	cin >> m>>n1>>n2;
	}
	return 0;
}

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

int main(){
 while(true){
  int m, n_min, n_max;
  cin >> m >> n_min >> n_max;
  if(m==0 && n_min==0 && n_max==0) break;

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

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

 return 0;
}

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

int main() {
	int m, a, b;
	while (cin >> m >> a >> b,m,a,b) {
		int p[300];
		for (int i = 0;i < m;i++)cin >> p[i];

		int ans = 0;
		int g = 0;

		for (int i = 0;i < m - 1;i++) {
			int c = p[i] - p[i + 1];
			if (g <= c && (i + 1 >= a) && (i + 1 <= b)) {
				ans = i + 1;
				g = c;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

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

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

C++: #include<iostream>                                                 
#include<vector>                                                   
using namespace std;                                               
                                                                   
int main(void) {                                                   
  while (true) {                                                   
    int m, n_min, n_max;                                           
    cin >> m >> n_min >> n_max;                                    
    if (m==0) {                                                    
      break;                                                       
    }                                                              
    vector<int> P;                                                 
    for (int i=0; i<m; i++) {                                      
      int x;                                                       
      cin >> x;                                                    
      P.push_back(x);                                              
    }                                                              
    int gap=0;                                                     
    int gapi=0;                                                    
    for (int i=n_min-1; i<n_max; i++) {                            
      if (P[i]-P[i+1]>=gap) {                                      
        gap = P[i]-P[i+1];                                         
        gapi = i+1;                                                
      }                                                            
    }                                                              
    cout << gapi << endl;                                          
  }                                                                
  return 0;                                                        
}

C++: #include "bits/stdc++.h"

using namespace std;

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

    int m,nmin,nmax;
    while(cin>>m>>nmin>>nmax,m||nmin||nmax){
        vector<int> p(m);
        nmin--;nmax--;
        for(int i=0;i<m;i++) cin>>p[i];
        sort(p.rbegin(),p.rend());
        int res=0,gap=0;
        for(int i=nmin;i<=nmax;i++){
            int gtmp=p[i]-p[i+1];
            if(gtmp>=gap){
                gap=gtmp;
                res=i+1;
            }
        }
        cout<<res<<endl;
    }
}

C++: 
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>

using namespace std;
int solve();

int main(void) {
	
	while(solve()){}

	return 0;
}

int solve() {

	int m, nmin, nmax;
		cin >> m >> nmin >> nmax;
	if( !(m|nmin|nmax) ) { return 0; }

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

	sort(p.begin(),p.end());

	int ans, gap = 0;
	for( int n = nmax; n >= nmin; n-- ) {
		int j = m - n;
		if( gap < p[j] - p[j-1] ) {
			gap = p[j]-p[j-1];
			ans = n;
		}
	}
	
	cout << ans << endl;

	return 1;

}

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

int main(){
	int m, nmax, nmin, n, a;
	while(1){
		n = 0;
		cin >> m >> nmin >> nmax;
		if(m == 0 && nmax == 0 && nmin == 0) break;
		int* p = new int[m];
		for(int i = 0; i < m; i++){
			cin >> p[i];
		}
		for(int j = nmin; j < nmax; j++){
			if(n < p[j-1] - p[j]){
				n = p[j-1] - p[j];
				a = j;
			}
		}
		cout << a << endl;
		delete[] p;
	}
	return 0;
}