For this Question: There is a marathon to be run on a circular track. There are N checkpoints on the track where energy drinks are placed. Checkpoints are numbered from 1 to N (both inclusive). For each checkpoint, you know the distance to the next checkpoint and also the energy replenished by the drink at this checkpoint.
Toros is going to take part in the marathon. For every 1 unit distance covered by him, his energy decreases by 1. He can't run further if he has 0 energy. Find the minimum index of the point where he should start so that he can visit every checkpoint at least once. Initially, he has 0 energy.The first line contains a single integer N, denoting the number of checkpoints.
The next N lines contain two space-separated integers, E[i] and D[i], denoting the energy replenished by the energy drink kept at the ith checkpoint and the distance to the next checkpoint.

<b>Constraints</b>
1 &le; N &le; 10<sup>5</sup>
1 &le; E[i], D[i] &le; 10<sup>9</sup>
Print a single integer containing the minimum index of the checkpoint where Toros should start so that he can complete the race.
If no such point exists, print -1Sample Input 1:
3
1 5
10 3
3 4

Sample Output 1:
2

Sample Input 2:-
3
2 4
5 4
2 7

Sample Output 2:-
-1

Sample Input 3:-
5
1 4
5 6
3 1
7 2
5 8

Sample Output 3:-
3

<b>Explanation 1:</b>
Toros starts at index 2 and drinks energy drinks. So, current energy = 10. At index 3, energy = 10 - 3 + 3 = 10. At index 1 energy = 10 - 4 + 1 = 7., I have written this Solution Code: #include<bits/stdc++.h>
//#define int            long long
#define ll             long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define dep(i,a,b)    for(int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

const int N = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N], b[N];

void solve(){
    int n;  cin >> n;
    bool flag = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    int l = 0, r = 0;
    int sum = 0, d, c = 0;
    while((l + 1)%n != r && c < 2){
        d = a[l] - b[l];
        if(sum + d >= 0)
            l++, sum += d;
        else
            sum = 0, l++, r = l;
        if(l == n)  c++;
        l %= n;
    }
    if(c == 2)  cout << -1 << endl;
    else cout << r+1 << endl;
}

void testcases(){
    int tt = 1;
    //cin >> tt;
    while(tt--){
        solve();
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

 		clock_t start = clock();


    testcases();


 		cerr << (double)(clock() - start)*1000/CLOCKS_PER_SEC << " ms: ";
    return 0;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?