For this Question: Pairs and vectors can be used together to achieve some amazing results. Here we will learn to use a vector that holds pairs.
You are given a vector V of size N. The vector hold pair of integers. Example V={(1,2),(3,4)...}. Now, you need to sum the second elements.First line contains N denoting the size of the array. The second line contains 2*N elements where the (2i - 1)'th and (2i)'th element represent the i'th pair.

Constraints:

1 <= N <= 10^5
0 <= Vi <= 10^5For each testcase, in a new line, print the required output.Input:
5
1 2 3 4 5 6 7 8 9 10

Output:
30

Explanation:
Sum = 10+8+6+4+2 = 30, I have written this Solution Code: #include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 1e3 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int a[N];

signed main() {
	IOS;
	int n, ans = 0;	cin >> n;
	for(int i = 1; i <= 2*n; i++){
		int p;	cin >> p;
		if(i%2 == 0)
			ans += p;
	}
	cout << ans;
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?