<s> """<STR_LIT>""" <EOL> import sys <EOL> import os <EOL> if sys . version_info < ( <NUM_LIT:2> , <NUM_LIT:2> ) : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> if sys . version_info < ( <NUM_LIT:2> , <NUM_LIT:3> ) : <EOL> def enumerate ( collection ) : <EOL> return zip ( range ( len ( collection ) ) , collection ) <EOL> class Set : <EOL> def __init__ ( self , seq = None ) : <EOL> self . values = { } <EOL> if seq : <EOL> for e in seq : <EOL> self . values [ e ] = None <EOL> def add ( self , e ) : <EOL> self . values [ e ] = None <EOL> def discard ( self , e ) : <EOL> if e in self . values . keys ( ) : <EOL> del ( self . values [ e ] ) <EOL> def union ( self , s ) : <EOL> ret = Set ( ) <EOL> for e in self . values . keys ( ) : <EOL> ret . values [ e ] = None <EOL> for e in s . values . keys ( ) : <EOL> ret . values [ e ] = None <EOL> return ret <EOL> def issubset ( self , other ) : <EOL> for e in self . values . keys ( ) : <EOL> if e not in other . values . keys ( ) : <EOL> return False <EOL> return True <EOL> def __nonzero__ ( self ) : <EOL> return len ( self . values . keys ( ) ) <EOL> def __contains__ ( self , e ) : <EOL> return e in self . values . keys ( ) <EOL> def __iter__ ( self ) : <EOL> return iter ( set . values . keys ( ) ) <EOL> if os . name != "<STR_LIT>" : <EOL> import array <EOL> def createByteArraySequence ( seq ) : <EOL> return array . array ( '<STR_LIT:B>' , seq ) <EOL> def createByteArrayZeros ( howMany ) : <EOL> return array . array ( '<STR_LIT:B>' , [ <NUM_LIT:0> ] * howMany ) <EOL> def concatArrays ( a1 , a2 ) : <EOL> return a1 + a2 <EOL> def bytesToString ( bytes ) : <EOL> return bytes . tostring ( ) <EOL> def stringToBytes ( s ) : <EOL> bytes = createByteArrayZeros ( <NUM_LIT:0> ) <EOL> bytes . fromstring ( s ) <EOL> return bytes <EOL> import math <EOL> def numBits ( n ) : <EOL> if n == <NUM_LIT:0> : <EOL> return <NUM_LIT:0> <EOL> s = "<STR_LIT>" % n <EOL> return ( ( len ( s ) - <NUM_LIT:1> ) * <NUM_LIT:4> ) + { '<STR_LIT:0>' : <NUM_LIT:0> , '<STR_LIT:1>' : <NUM_LIT:1> , '<STR_LIT:2>' : <NUM_LIT:2> , '<STR_LIT:3>' : <NUM_LIT:2> , <EOL> '<STR_LIT:4>' : <NUM_LIT:3> , '<STR_LIT:5>' : <NUM_LIT:3> , '<STR_LIT>' : <NUM_LIT:3> , '<STR_LIT>' : <NUM_LIT:3> , <EOL> '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT>' : <NUM_LIT:4> , '<STR_LIT:a>' : <NUM_LIT:4> , '<STR_LIT:b>' : <NUM_LIT:4> , <EOL> '<STR_LIT:c>' : <NUM_LIT:4> , '<STR_LIT:d>' : <NUM_LIT:4> , '<STR_LIT:e>' : <NUM_LIT:4> , '<STR_LIT:f>' : <NUM_LIT:4> , <EOL> } [ s [ <NUM_LIT:0> ] ] <EOL> return int ( math . floor ( math . log ( n , <NUM_LIT:2> ) ) + <NUM_LIT:1> ) <EOL> BaseException = Exception <EOL> import sys <EOL> import traceback <EOL> def formatExceptionTrace ( e ) : <EOL> newStr = "<STR_LIT>" . join ( traceback . format_exception ( sys . exc_type , sys . exc_value , sys . exc_traceback ) ) <EOL> return newStr <EOL> else : <EOL> import java <EOL> import jarray <EOL> def createByteArraySequence ( seq ) : <EOL> if isinstance ( seq , type ( "<STR_LIT>" ) ) : <EOL> seq = [ ord ( c ) for c in seq ] <EOL> return jarray . array ( seq , '<STR_LIT:h>' ) <EOL> def createByteArrayZeros ( howMany ) : <EOL> return jarray . zeros ( howMany , '<STR_LIT:h>' ) <EOL> def concatArrays ( a1 , a2 ) : <EOL> l = list ( a1 ) + list ( a2 ) <EOL> return createByteArraySequence ( l ) <EOL> def bytesToString ( bytes ) : <EOL> return "<STR_LIT>" . join ( [ chr ( b ) for b in bytes ] ) <EOL> def stringToBytes ( s ) : <EOL> bytes = createByteArrayZeros ( len ( s ) ) <EOL> for count , c in enumerate ( s ) : <EOL> bytes [ count ] = ord ( c ) <EOL> return bytes <EOL> def numBits ( n ) : <EOL> if n == <NUM_LIT:0> : <EOL> return <NUM_LIT:0> <EOL> n = <NUM_LIT:1> L * n ; <EOL> return n . __tojava__ ( java . math . BigInteger ) . bitLength ( ) <EOL> def stringToJavaByteArray ( s ) : <EOL> bytes = jarray . zeros ( len ( s ) , '<STR_LIT:b>' ) <EOL> for count , c in enumerate ( s ) : <EOL> x = ord ( c ) <EOL> if x >= <NUM_LIT> : x -= <NUM_LIT> <EOL> bytes [ count ] = x <EOL> return bytes <EOL> BaseException = java . lang . Exception <EOL> import sys <EOL> import traceback <EOL> def formatExceptionTrace ( e ) : <EOL> newStr = "<STR_LIT>" . join ( traceback . format_exception ( sys . exc_type , sys . exc_value , sys . exc_traceback ) ) <EOL> return newStr </s>
