Task: Reasoning / Code Correction
User instruction:
Find and fix the errors and bugs in the code and tell me what was corrected.

#include <bits/stdc++.h>

int n;

void add(vector<int> v, int loc, int value){
    loc++;
    while(loc<=n){
        v[loc]+=value;
        loc+=loc&(-loc);
    }
}

int getpsum(vector<int> v, int loc){
    loc++;
    int ret = 0;
    while(loc>0){
        ret += v[loc];
        loc -= loc&(-loc);
    }
    return ret;
}

int main(){
    cin>>n;
    vector<int> v(n);
    add(v, 0, 1);
    cout<<getpsum(v, 1)<<endl;
}

Evaluation criteria:
Make sure you are not explicitly using `std::vector`.
Accept the vector argument by reference.
Change the range in the vector declaration to n+1.
Output exactly what was fixed, and nothing else.
Do not make any other incorrect modifications.