#42317: python AC 解


deansuo1825@gmail.com (黃昱碩)

學校 : 不指定學校
編號 : 256775
來源 : []
最後登入時間 :
2023-11-25 09:56:15

n,d=map(int,input().split())
total=0
total_thing=0
for i in range(n):
  s=list(map(int,input().split()))
  if max(s)-min(s)>=d:
    total+=((s[0]+s[1]+s[2])//3)
    total_thing+=1
print(total_thing,total)