<s> def read4 ( buf ) : <EOL> global file_content <EOL> i = <NUM_LIT:0> <EOL> while i < len ( file_content ) and i < <NUM_LIT:4> : <EOL> buf [ i ] = file_content [ i ] <EOL> i += <NUM_LIT:1> <EOL> if len ( file_content ) > <NUM_LIT:4> : <EOL> file_content = file_content [ <NUM_LIT:4> : ] <EOL> else : <EOL> file_content = "<STR_LIT>" <EOL> return i <EOL> class Solution ( object ) : <EOL> def read ( self , buf , n ) : <EOL> """<STR_LIT>""" <EOL> read_bytes = <NUM_LIT:0> <EOL> buffer = [ '<STR_LIT>' ] * <NUM_LIT:4> <EOL> for i in xrange ( n / <NUM_LIT:4> + <NUM_LIT:1> ) : <EOL> size = read4 ( buffer ) <EOL> if size : <EOL> buf [ read_bytes : read_bytes + size ] = buffer <EOL> read_bytes += size <EOL> else : <EOL> break <EOL> return min ( read_bytes , n ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> global file_content <EOL> buf = [ '<STR_LIT>' for _ in xrange ( <NUM_LIT:100> ) ] <EOL> file_content = "<STR_LIT:a>" <EOL> print buf [ : Solution ( ) . read ( buf , <NUM_LIT:9> ) ] <EOL> file_content = "<STR_LIT>" <EOL> print buf [ : Solution ( ) . read ( buf , <NUM_LIT:9> ) ] </s>
