#include<stdio.h>
#define Max_Size 3
int stack[Max_Size];
int top=-1;
int size()
{
return top+1;
}
int empty()
{
if(size()==0)
{
return 1;
return 0;
}
}
void push(int x)
{
if(size()==Max_Size)
{
printf("over\n");
}
else
{
stack[++top]=x;
}
}
void pop()
{
if(size()==0)
{
printf("u\n");
}
else
{
top--;
}
}
int peek()
{
if(empty())
{
printf("em\n");
return -1;
}
else
{
return stack[top];
}
}
int main()
{
push(9);
printf("%d\n",top);
pop();
printf("%d\n",size());
}
I2luY2x1ZGU8c3RkaW8uaD4KI2RlZmluZSBNYXhfU2l6ZSAzCmludCBzdGFja1tNYXhfU2l6ZV07CmludCB0b3A9LTE7CmludCBzaXplKCkKewpyZXR1cm4gdG9wKzE7Cn0KaW50IGVtcHR5KCkKewppZihzaXplKCk9PTApCnsKcmV0dXJuIDE7CgpyZXR1cm4gMDsKfQp9CnZvaWQgcHVzaChpbnQgeCkKewppZihzaXplKCk9PU1heF9TaXplKQp7CnByaW50Zigib3ZlclxuIik7Cn0KZWxzZQp7CnN0YWNrWysrdG9wXT14Owp9Cn0Kdm9pZCBwb3AoKQp7CmlmKHNpemUoKT09MCkKewpwcmludGYoInVcbiIpOwp9CmVsc2UKewp0b3AtLTsKfQp9CmludCBwZWVrKCkKewppZihlbXB0eSgpKQp7CnByaW50ZigiZW1cbiIpOwpyZXR1cm4gLTE7Cn0KZWxzZQp7CnJldHVybiBzdGFja1t0b3BdOwoKfQp9CgppbnQgbWFpbigpCnsKcHVzaCg5KTsKcHJpbnRmKCIlZFxuIix0b3ApOwpwb3AoKTsKcHJpbnRmKCIlZFxuIixzaXplKCkpOwp9