3
vector<int> sumEvenAfterQueries(vector<int> &nums, vector<vector<int>> &queries) {4
// Sum of all even numbers in the array intially5
int tes = accumulate(nums.begin(), nums.end(), 0, [](int curr, int a) {11
vector<int> ans(queries.size());12
bool a = false, b = false;13
for (int i = 0; i < queries.size(); i++) {14
// If both are even or odd it stays even then15
a = nums[queries[i][1]] % 2 == 0 && queries[i][0] % 2 == 0;16
b = abs(nums[queries[i][1]] % 2) == 1 && abs(queries[i][0] % 2) == 1;20
tes += queries[i][0] + nums[queries[i][1]];21
else if (nums[queries[i][1]] % 2 == 0)22
tes -= nums[queries[i][1]]; // If even turns to odd because of operation23
// remove that even value from ans24
ans[i] = tes; // Adding the result25
nums[queries[i][1]] += queries[i][0]; // now completing the operation in queries to use in