For this Question: After saving the planet of Xander in 2014 from Ronan, the guardians of the galaxy decided to play a game on it. Between the vast furious oceans, they discover a row of buildings. The buildings are of different heights arranged at each index along a number line. Gamora starts at building 0 and a height of 0. Groot gets the task to <b>determine the minimum thrust that Gamora needs at the start of the game so that she can jump to the top of each building without her thrust going below zero</b>. Write a code to help Groot with his task.
The units of height relate directly to units of thrust. Gamora’s thrust level is calculated as follows:
•	If gamora's thrust is less than the height of the building, her new thrust = gamora's thrust – (height – gamora's thrust)
•	If gamora's thrust is greater than equal to the height of the building, her new thrust = gamora's thrust + (gamora's thrust - height)The first line contains an integer n, the number of buildings.
The second line n space-separated integers, arr[1], arr[2]…arr[n], the heights of the building.

<b>Constraints:-</b>
1 &le; n &le; 10<sup>5</sup>
1 &le; arr[i] &le; 10<sup>5</sup>The output contains a single integer denoting the minimum thrust Gamora needs at the start of the game.Sample Input:-
5
3 4 3 2 4

Sample Output:-
4

Explanation:- 
If we take 3 then:-
at index 1:- 3 + 3-3 = 3
at index 2:- 3 - (4-3) = 2
at index 3:- 2 - (3-2) = 1
at index 4:- 1 - (2-1) = 0

Sample Input:-
3
4 4 4

Sample Output:-
4, I have written this Solution Code: #include <bits/stdc++.h>
using namespace std;

const long long linf = 0x3f3f3f3f3f3f3f3fLL;
const int N = 111111;

int n;
int h[N];

int check(long long x) {
    long long energy = x;
    for(int i = 1; i <= n; i++) {
        energy += energy - h[i];
        if(energy >= linf) return 1;
        if(energy < 0) return 0;
    }
    return 1;
}
int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> h[i];
    }

    long long  L = 0, R = linf;
    long long ans=0;

    while(L < R) {
        long long M = (L + R) / 2;
        if(check(M)) {
            R = M;
            ans=M;
        } else {
            L = M + 1;
        }
    }

    cout << ans << endl;

    return 0;
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?