Solution 1:

```
def read(self, buf, n):
index = 0
while True:
buf4 = [""]*4
oneread = read4(buf4)
self.queue.extend(buf4)
curr = min(len(self.queue),n-index)
for i in xrange(curr):
buf[index] = self.queue.pop(0)
index += 1
if curr == 0: break
return index
```

Accepted

Solution 2

```
def read(self, buf, n):
index = 0
while True:
buf4 = [""]*4
oneread = read4(buf4)
self.queue.extend(buf4)
curr = min(len(self.queue),n-index)
for i in xrange(curr):
ele = self.queue.pop(0)
if ele:
buf[index] = ele
index += 1
else: break
if curr == 0: break
return index
```

Submission Result: TLE

Last executed input: "", [read(1)] Why ?