For this Question: N+1 towns are going to be attacked by monsters. The i-th town will be attacked by Ai monsters. Saloni has got N of her friends for rescue. The i-th friend has the capability to kill at most Bi monsters. The only constraint is that the i-th friend can kill monsters from town i and i+1 only.
Find the maximum number of monsters the friends can kill.The first line of input contains an integer N.
The next line contains N+1 integers Ai.
The next line contains N integers Bi.

Constraints
1 <= N <= 100000
1 <= Ai, Bi <= 1000000000Output a single integer, the maximum number of monsters that can be killed.Sample Input
2
3 5 2
4 5

Sample Output
9

Explanation
The first friend will kill 2 monsters from town 1 and 2 monsters from town 2.
The second friend will kill 3 monsters from town 2 and 2 monsters from town 3.

Sample Input:
2
100 1 1
1 100

Sample Output:
3, I have written this Solution Code: #include <bits/stdc++.h> // header file includes every Standard library
using namespace std;

int main() {

	int n;
    cin>>n;
    vector<int> v(n+1);
    for(int i=0;i<=n;i++)cin>>v[i];
    vector<int> vv(n+1);
    for(int i=1;i<=n;i++)cin>>vv[i];
    int ans=0;
    for(int i=1;i<=n;i++){
        int cnt=vv[i];
        if(i>0){
           int mn=min(cnt,v[i-1]);
           cnt-=mn;
           ans+=mn;
        }
        int mn=min(cnt,v[i]);
        ans+=mn;
        v[i]-=mn;
    } 
    cout<<ans<<endl;
    return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?