check if rectangle can be formed
if ( y1 , y2 ) in lastx : NEW_LINE INDENT ans = min ( ans , ( x - lastx [ y1 , y2 ] ) * ( y2 - y1 ) ) NEW_LINE DEDENT lastx [ y1 , y2 ] = x NEW_LINE if ans < float ( ' inf ' ) : NEW_LINE return ans NEW_LINE else : NEW_LINE return 0 NEW_LINE