fork 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)
Success #stdin #stdout 0.03s 9440KB
stdin
7 3
1
51
966369
7
9
999996
11
stdout
0