<s> """<STR_LIT>""" <EOL> import sys <EOL> import time <EOL> import random <EOL> import marshal <EOL> import tempfile <EOL> import os <EOL> td = tempfile . gettempdir ( ) <EOL> def randfloats ( n ) : <EOL> """<STR_LIT>""" <EOL> fn = os . path . join ( td , "<STR_LIT>" % n ) <EOL> try : <EOL> fp = open ( fn , "<STR_LIT:rb>" ) <EOL> except IOError : <EOL> r = random . random <EOL> result = [ r ( ) for i in xrange ( n ) ] <EOL> try : <EOL> try : <EOL> fp = open ( fn , "<STR_LIT:wb>" ) <EOL> marshal . dump ( result , fp ) <EOL> fp . close ( ) <EOL> fp = None <EOL> finally : <EOL> if fp : <EOL> try : <EOL> os . unlink ( fn ) <EOL> except os . error : <EOL> pass <EOL> except IOError , msg : <EOL> print "<STR_LIT>" , fn , "<STR_LIT::>" , msg <EOL> else : <EOL> result = marshal . load ( fp ) <EOL> fp . close ( ) <EOL> for i in range ( <NUM_LIT:10> ) : <EOL> i = random . randrange ( n ) <EOL> temp = result [ : i ] <EOL> del result [ : i ] <EOL> temp . reverse ( ) <EOL> result . extend ( temp ) <EOL> del temp <EOL> assert len ( result ) == n <EOL> return result <EOL> def flush ( ) : <EOL> sys . stdout . flush ( ) <EOL> def doit ( L ) : <EOL> t0 = time . clock ( ) <EOL> L . sort ( ) <EOL> t1 = time . clock ( ) <EOL> print "<STR_LIT>" % ( t1 - t0 ) , <EOL> flush ( ) <EOL> def tabulate ( r ) : <EOL> """<STR_LIT>""" <EOL> cases = tuple ( [ ch + "<STR_LIT>" for ch in r"<STR_LIT>" ] ) <EOL> fmt = ( "<STR_LIT>" + "<STR_LIT>" * len ( cases ) ) <EOL> print fmt % ( ( "<STR_LIT:i>" , "<STR_LIT>" ) + cases ) <EOL> for i in r : <EOL> n = <NUM_LIT:1> << i <EOL> L = randfloats ( n ) <EOL> print "<STR_LIT>" % ( i , n ) , <EOL> flush ( ) <EOL> doit ( L ) <EOL> L . reverse ( ) <EOL> doit ( L ) <EOL> doit ( L ) <EOL> for dummy in range ( <NUM_LIT:3> ) : <EOL> i1 = random . randrange ( n ) <EOL> i2 = random . randrange ( n ) <EOL> L [ i1 ] , L [ i2 ] = L [ i2 ] , L [ i1 ] <EOL> doit ( L ) <EOL> if n >= <NUM_LIT:10> : <EOL> L [ - <NUM_LIT:10> : ] = [ random . random ( ) for dummy in range ( <NUM_LIT:10> ) ] <EOL> doit ( L ) <EOL> for dummy in xrange ( n // <NUM_LIT:100> ) : <EOL> L [ random . randrange ( n ) ] = random . random ( ) <EOL> doit ( L ) <EOL> if n > <NUM_LIT:4> : <EOL> del L [ <NUM_LIT:4> : ] <EOL> L = L * ( n // <NUM_LIT:4> ) <EOL> L = map ( lambda x : - - x , L ) <EOL> doit ( L ) <EOL> del L <EOL> L = map ( abs , [ - <NUM_LIT:0.5> ] * n ) <EOL> doit ( L ) <EOL> del L <EOL> half = n // <NUM_LIT:2> <EOL> L = range ( half - <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:1> ) <EOL> L . extend ( range ( half ) ) <EOL> L = map ( float , L ) <EOL> doit ( L ) <EOL> print <EOL> def main ( ) : <EOL> """<STR_LIT>""" <EOL> k1 = <NUM_LIT:15> <EOL> k2 = <NUM_LIT:20> <EOL> if sys . argv [ <NUM_LIT:1> : ] : <EOL> k1 = k2 = int ( sys . argv [ <NUM_LIT:1> ] ) <EOL> if sys . argv [ <NUM_LIT:2> : ] : <EOL> k2 = int ( sys . argv [ <NUM_LIT:2> ] ) <EOL> if sys . argv [ <NUM_LIT:3> : ] : <EOL> x = <NUM_LIT:1> <EOL> for a in sys . argv [ <NUM_LIT:3> : ] : <EOL> x = <NUM_LIT> * x + hash ( a ) <EOL> random . seed ( x ) <EOL> r = range ( k1 , k2 + <NUM_LIT:1> ) <EOL> tabulate ( r ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
