language: Python (python 2.7.3)
date: 477 days 22 hours ago
link:
visibility: private
1
2
3
4
5
import sys
from functools import partial
 
print(sum(chunk.count('\n') for chunk in iter(partial(sys.stdin.read, 1 << 15), '')))
 
  • upload with new input
  • result: Success     time: 0.03s    memory: 6376 kB     returned value: 0

    $ pv out.txt | wc -l
      99MB 0:00:00 [ 840MB/s] [=========================================>] 100%            
    2055312
    
    $ pv out.txt | python count-lines.py
      99MB 0:00:00 [ 660MB/s] [=========================================>] 100%            
    2055312
    
    7