class CustomStack {
vector<int>stk;
int maxSize;
int top;
public:
CustomStack(int m) {
stk = vector<int>(m);
maxSize = m;
top = -1;
}
void push(int x) {
if(top == maxSize-1)
{
return ;
}
stk[++top] = x;
}
int pop() {
if(top == -1)
{
return -1;
}
return stk[top--];
}
void increment(int k, int val) {
for(int i = 0 ; i <= top && i < k; i++)
{
stk[i] += val;
}
}
};
/**
* Your CustomStack object will be instantiated and called as such:
* CustomStack* obj = new CustomStack(maxSize);
* obj->push(x);
* int param_2 = obj->pop();
* obj->increment(k,val);
*/