For this Question: There are N balloons placed on a number line. Newton doesn't like balloons so he wants to burst exactly K balloons.

The i- th balloon is placed on coordinate X<sub>i</sub>. Here, X<sub>1</sub> &lt; X<sub>2</sub> &lt; ... &lt; X<sub>n</sub>.

Initially Newton is at coordinate 0. In a single second, he can move from coordinate C to either C - 1 or C + 1.

Newton doesn't like to waste much of his time so find the minimum time needed to burst K balloons.The first line of the input contains 2 integers N and K
The next line contains N integers, X<sub>1</sub>, X<sub>2</sub>, ... , X<sub>n</sub>.

<b>Constraints:</b>
1 &le; N &le; 2 x 10<sup>5</sup>
1 &le; K &le; N
-10<sup>8</sup> &le; X<sub>i</sub> &le; 10<sup>8</sup>Output the minimum time<b>Sample Input 1:</b>
5 3
-40 -10 5 20 80

<b>Sample Output 1:</b>
40

<b>Explanation</b>
Newton would first burst the balloon at -10, then at 5, then at 20. Total time take = 10 + 10 + 5 + 15 = 40


<b>Sample Input 2:</b>
9 5
-20 -17 -9 -4 -3 1 2 3 4

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> candles(N);
  for (int i = 0; i < N; i++) cin >> candles.at(i);
  
  int mini = INT_MAX;
  for (int i = 0; i <= N-K; i++) {
    int l = candles.at(i), r = candles.at(i+K-1);
    if (l < 0 && r > 0)  mini = min(mini, min(abs(l), abs(r)) * 2 + max(abs(l), abs(r)));
    else mini = min(mini, max(abs(l), abs(r)));
  }
  cout << mini << endl;
  return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?