def popmin(a, b):
 if (len(a) == 0):
  return (b[0], a, b[1:])
 elif (len(b) == 0):
  return (a[0], a[1:], b)
 elif (a[0] > b[0]):
  return (b[0], a, b[1:])
 else:
  return (a[0], a[1:], b)

def popmin ( a , b ) : if ( len ( a ) == 0 ) : return ( b [ 0 ] , a , b [ 1 : ] ) elif ( len ( b ) == 0 ) : return ( a [ 0 ] , a [ 1 : ] , b ) elif ( a [ 0 ] > b [ 0 ] ) : return ( b [ 0 ] , a , b [ 1 : ] ) else : return ( a [ 0 ] , a [ 1 : ] , b )
popmin -> where i is min and a/b are the results of removing i from the relevant sequence .