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++: //
//  main.cpp
//  Entrance Examination
//
//  Created by x15071xx on 2017/06/15.
//  Copyright ?? 2017??´ AIT. All rights reserved.
//

#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;

int main(int argc, const char * argv[]) {
    
    while(1){
        
        int m,nmin,nmax;
        vector<int> score;
        vector<int> gap;
        
        cin >> m >> nmin >> nmax;
        
        if (m == 0 && nmin == 0 && nmax == 0) {
            break;
        }
        int tmp;
        for (int i = 0; i < m; i++) {
            cin >> tmp;
            score.push_back(tmp);
        }
        
        
        for (int i = nmin-1; i < nmax; i++) {
            gap.push_back(abs(score[i]-score[i+1]));
        }
        
        nmax = -1;
        for (int i = 0; i < gap.size(); i++) {
            if (gap[nmax] <= gap[i]) {
                nmax = i;
            }
        }
        
        cout << nmin+nmax << endl;
        
    }
    return 0;
}

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

int main(void) {
    int m, nmin, nmax;
    vector<int> p(201);
    while(cin >> m >> nmin >> nmax && m) {
        REP(i, m) scanf("%d", &p[i]);
        sort(p.begin(), p.end(), greater<int>());
        int ans, gap = 0;
        for(int i=nmin-1; i<nmax; ++i) {
            if(p[i]-p[i+1] >= gap) {
                gap = p[i]-p[i+1];
                ans = i+1;
            }
        }
        cout << ans << endl;
    }
}

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

int main(){
    int m, nmin, nmax;
    while(cin >> m >> nmin >> nmax, m != 0){
        vector<int> v;
        for(int i=0;i<m;++i){
            int p;
            cin >> p;
            v.push_back(p);
        }
        sort(v.rbegin(), v.rend());
        int maxi = 0, n = 0;
        for(int i=nmin-1;i<nmax;++i){
            if(v[i] - v[i+1] >= maxi){
                maxi = v[i] - v[i+1];
                n = i + 1;
            }
        }
        cout << n << endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int a,min,max,p,mmax=0,mm,i,b;
    while(1){
        mmax=0;
        cin>>a>>min>>max;
        if(a==min && min==max && a==0) break;
        for(i=0;i<a;i++){
            cin>>p;
            if(i>=min && i<max+1){
                if(mm-p>=mmax) {
                    mmax=mm-p;
                    b=i;
                //  cout<<mm<<" "<<p<<" "<<mmax<<endl;
                }
            }
            mm=p;
        }
        cout<<b<<endl;
    }
    return 0;
}

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

int main(){
  int n,a,b,x[200];
  while(1){
    cin>>n>>a>>b;
    if(n==0 && a==0 && b==0) break;
    for(int i =0;i<n;i++){
      cin>>x[i];
    }
    int j=0,k=a;
    for(int i=a-1;i<b;i++){
      if(x[i]-x[i+1]>=j){
	j=x[i]-x[i+1];
	k=i+1;
      }
    }
    cout<<k<<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int p[200];
int main() {
	int m, s, g;
	while (scanf("%d%d%d", &m, &s, &g), m) {
		rep(i, m)scanf("%d", &p[i]);
		sort(p, p + m, greater<>());
		int Max = 0, cnt;
		for (int i = s - 1; i < g; i++) {
			if (p[i + 1] - p[i] >= Max) {
				Max = p[i + 1] - p[i];
				cnt = i + 1;
			}
		}
		printf("%d\n", cnt);
	}
}

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

using namespace std;

int main()
{
    while (true) {
        int m;
        int nMin;
        int nMax;
        cin >> m >> nMin >> nMax;

        if (m == 0 && nMax == 0 && nMin == 0) {
            break;
        }

        vector<int> v;
        for (int i = 0; i < m; ++i) {
            int p;
            cin >> p;
            v.push_back(p);
        }

        auto maximum = make_pair(0, -1);
        for (int n = nMin; n <= nMax; ++n) {
            auto gap = v[n - 1] - v[n];
            if (maximum.second <= gap) {
                maximum = make_pair(n, gap);
            }
        }
        cout << maximum.first << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
#include<random>
using namespace std;

int main()
{
	int n, l, r, curr, pre;
	
	vector<int> ans;
	while (1)
	{
		cin >> n >> l >> r;
		vector<int> m(n);
		if (n == 0 && l == 0 && r == 0) break;
		int max = 0;
		pre = 0;
		for (int i = 0; i < n; ++i)
			cin >> m[i];
		int diff = 0;
		for (int i = 0; i < r - l + 1; ++i)
		{
			if (diff <= m[i + l - 1] - m[i + l])
			{
				diff = m[i + l - 1] - m[i + l];
				max = i + l;
			}
		}
		ans.push_back(max);
	}
	for (const auto& a : ans)
		cout << a << endl;
	return 0;

}

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

int main(){
	while(1){
		int m,n1,n2;//n2は最大人数
		cin>>m>>n1>>n2;

		if(m==0&&n1==0&&n2==0)
			break;
		
		int P[200];
		for(int i=0;i<m;i++){
			cin>>P[i];
		}
		
		int gap=-1;
 		int n=-1;

 		for(int i=n1;i<=n2;i++){
			int g=P[i-1]-P[i];

			if(gap<=g){
				gap=g;
				n=i;
			}
		}

		cout<<n<<endl
	}
	
	return 0;
}

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

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

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int m, nmin, nmax, ans, dif;
int tester[205];

int main(void) {
    init();

    while (cin >> m >> nmin >> nmax, m | nmin | nmax) {
        memset(tester, 0, sizeof(tester));
        ans = dif = -1;
        rep (i,m) cin >> tester[i];

        sort(tester, tester + m, greater<int>());

        for (int i = nmin; i <= nmax; ++i) {
            int tmp = tester[i-1] - tester[i];
            if (dif <= tmp) {
                ans = i;
                dif = tmp;
            }
        }
        cout << ans << endl;
        /*rep(i,m) {
            cout << tester[i] << endl;
        }*/
    }
    return 0;
}

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