<s> """<STR_LIT>""" <EOL> import functools <EOL> import itertools <EOL> import sys <EOL> import urllib <EOL> PY3 = ( sys . version_info [ <NUM_LIT:0> ] >= <NUM_LIT:3> ) <EOL> PY3_2 = sys . version_info [ : <NUM_LIT:2> ] == ( <NUM_LIT:3> , <NUM_LIT:2> ) <EOL> if PY3 : <EOL> import builtins <EOL> from io import StringIO , BytesIO <EOL> cStringIO = StringIO <EOL> import pickle as cPickle <EOL> pickle = cPickle <EOL> import urllib . request <EOL> import urllib . parse <EOL> from urllib . request import HTTPError , urlretrieve , URLError <EOL> import io <EOL> bytes = bytes <EOL> str = str <EOL> asunicode = lambda x , _ : str ( x ) <EOL> def asbytes ( s ) : <EOL> if isinstance ( s , bytes ) : <EOL> return s <EOL> return s . encode ( '<STR_LIT>' ) <EOL> def asstr ( s ) : <EOL> if isinstance ( s , str ) : <EOL> return s <EOL> return s . decode ( '<STR_LIT>' ) <EOL> def asstr2 ( s ) : <EOL> if isinstance ( s , str ) : <EOL> return s <EOL> elif isinstance ( s , bytes ) : <EOL> return s . decode ( '<STR_LIT>' ) <EOL> else : <EOL> return str ( s ) <EOL> def isfileobj ( f ) : <EOL> return isinstance ( f , io . FileIO ) <EOL> def open_latin1 ( filename , mode = '<STR_LIT:r>' ) : <EOL> return open ( filename , mode = mode , encoding = '<STR_LIT>' ) <EOL> strchar = '<STR_LIT>' <EOL> range = range <EOL> map = map <EOL> zip = zip <EOL> filter = filter <EOL> reduce = functools . reduce <EOL> long = int <EOL> unichr = chr <EOL> zip_longest = itertools . zip_longest <EOL> def lrange ( * args , ** kwargs ) : <EOL> return list ( range ( * args , ** kwargs ) ) <EOL> def lzip ( * args , ** kwargs ) : <EOL> return list ( zip ( * args , ** kwargs ) ) <EOL> def lmap ( * args , ** kwargs ) : <EOL> return list ( map ( * args , ** kwargs ) ) <EOL> def lfilter ( * args , ** kwargs ) : <EOL> return list ( filter ( * args , ** kwargs ) ) <EOL> urlopen = urllib . request . urlopen <EOL> urljoin = urllib . parse . urljoin <EOL> urlretrieve = urllib . request . urlretrieve <EOL> urlencode = urllib . parse . urlencode <EOL> string_types = str <EOL> input = input <EOL> else : <EOL> import __builtin__ as builtins <EOL> from cStringIO import StringIO as cStringIO <EOL> from StringIO import StringIO <EOL> BytesIO = StringIO <EOL> import cPickle <EOL> pickle = cPickle <EOL> import urllib2 <EOL> import urlparse <EOL> bytes = str <EOL> str = str <EOL> asbytes = str <EOL> asstr = str <EOL> asstr2 = str <EOL> strchar = '<STR_LIT:S>' <EOL> def isfileobj ( f ) : <EOL> return isinstance ( f , file ) <EOL> def asunicode ( s , encoding = '<STR_LIT:ascii>' ) : <EOL> if isinstance ( s , unicode ) : <EOL> return s <EOL> return s . decode ( encoding ) <EOL> def open_latin1 ( filename , mode = '<STR_LIT:r>' ) : <EOL> return open ( filename , mode = mode ) <EOL> range = xrange <EOL> zip = itertools . izip <EOL> filter = itertools . ifilter <EOL> map = itertools . imap <EOL> reduce = reduce <EOL> long = long <EOL> unichr = unichr <EOL> zip_longest = itertools . izip_longest <EOL> lrange = builtins . range <EOL> lzip = builtins . zip <EOL> lmap = builtins . map <EOL> lfilter = builtins . filter <EOL> urlopen = urllib2 . urlopen <EOL> urljoin = urlparse . urljoin <EOL> urlencode = urllib . urlencode <EOL> HTTPError = urllib2 . HTTPError <EOL> URLError = urllib2 . URLError <EOL> string_types = basestring <EOL> input = raw_input <EOL> def getexception ( ) : <EOL> return sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> def asbytes_nested ( x ) : <EOL> if hasattr ( x , '<STR_LIT>' ) and not isinstance ( x , ( bytes , str ) ) : <EOL> return [ asbytes_nested ( y ) for y in x ] <EOL> else : <EOL> return asbytes ( x ) <EOL> def asunicode_nested ( x ) : <EOL> if hasattr ( x , '<STR_LIT>' ) and not isinstance ( x , ( bytes , str ) ) : <EOL> return [ asunicode_nested ( y ) for y in x ] <EOL> else : <EOL> return asunicode ( x ) <EOL> try : <EOL> advance_iterator = next <EOL> except NameError : <EOL> def advance_iterator ( it ) : <EOL> return it . next ( ) <EOL> next = advance_iterator <EOL> try : <EOL> callable = callable <EOL> except NameError : <EOL> def callable ( obj ) : <EOL> return any ( "<STR_LIT>" in klass . __dict__ for klass in type ( obj ) . __mro__ ) <EOL> def iteritems ( obj , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . items <EOL> return func ( ** kwargs ) <EOL> def iterkeys ( obj , ** kwargs ) : <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . keys <EOL> return func ( ** kwargs ) <EOL> def itervalues ( obj , ** kwargs ) : <EOL> func = getattr ( obj , "<STR_LIT>" , None ) <EOL> if not func : <EOL> func = obj . values <EOL> return func ( ** kwargs ) <EOL> def get_function_name ( func ) : <EOL> try : <EOL> return func . im_func . func_name <EOL> except AttributeError : <EOL> return func . __name__ <EOL> def get_class ( func ) : <EOL> try : <EOL> return func . im_class <EOL> except AttributeError : <EOL> return func . __self__ . __class__ <EOL> try : <EOL> combinations = itertools . combinations <EOL> except : <EOL> def combinations ( iterable , r ) : <EOL> pool = tuple ( iterable ) <EOL> n = len ( pool ) <EOL> if r > n : <EOL> return <EOL> indices = lrange ( r ) <EOL> yield tuple ( pool [ i ] for i in indices ) <EOL> while True : <EOL> for i in reversed ( lrange ( r ) ) : <EOL> if indices [ i ] != i + n - r : <EOL> break <EOL> else : <EOL> return <EOL> indices [ i ] += <NUM_LIT:1> <EOL> for j in range ( i + <NUM_LIT:1> , r ) : <EOL> indices [ j ] = indices [ j - <NUM_LIT:1> ] + <NUM_LIT:1> <EOL> yield tuple ( pool [ i ] for i in indices ) </s>
