fork(1) download
  1. from sys import stdin
  2.  
  3. N,K = map(int, stdin.readline().split())
  4.  
  5. #ustding memois(z)ation
  6. memo=dict()
  7.  
  8. nums = stdin.buffer.read( ).splitlines( )
  9.  
  10. for s in nums:
  11. if s not in memo:
  12. memo[s]=1
  13. else:
  14. memo[s] += 1
  15.  
  16. total=0
  17. for key, value in memo.items():
  18. if int(key)%K == 0:
  19. total += value
  20. print(total)
Runtime error #stdin #stdout #stderr 0.01s 7896KB
stdin
7 3
1
51
966369
7
9
999996
11
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 8, in <module>
AttributeError: 'file' object has no attribute 'buffer'