```
class MinStack:
# @param x, an integer
# @return an integer
def __init__(self):
self.data=[]
self.minl=[]
self.minn=0
def push(self, x):
if len(self.minl)==0 or x<self.getMin():
self.minl.append(x)
self.minn=1
elif x==self.getMin():
self.minn+=1
self.data.append(x)
# @return nothing
def pop(self):
d=self.data.pop()
if d==self.getMin():
self.minn-=1
if self.minn==0:
self.minl.pop()
self.minn=1
# @return an integer
def top(self):
return self.data[-1]
# @return an integer
def getMin(self):
return self.minl[-1]
```

the code will faill when:

push(2) push(2) push(1) pop() pop() getMin

but pass the test