Need Solution to a practice problem

Need solution to this problem in c++ → Contest Page | CodeChef

Here is my code:

class F{
public:
int size;
vector arr;

F(int c, int n){
    size=n+1;
    arr.assign(size, c);
}

void add(int i, int val){
    for(++i; i<size; i+=i&-i){
        arr[i]+=val;
    }
}

void range(int u, int v, int k){
    add(u, k);
    add(v+1, -k);
}

int heap(int p){
    return arr[p];
}

};
int main(){

int n, m, c; cin>>n>>m>>c;
F t(n,c);

while(m--){
    char q; cin>>q;
    if(q=='S'){
       int u, v, k; cin>>u>>v>>k;
       t.range(u, v, k);
    }
    
    else if(q=='Q'){
        int p; cin>>p;
        cout<<t.heap(p)<<endl;
    }
}




return 0;

}