There were $N$ students (numbered $1$ through $N$) participating in the Indian Programming Camp (IPC) and they watched a total of $K$ lectures (numbered $1$ through $K$). For each student $i$ and each lecture $j$, the $i$-th student watched the $j$-th lecture for $T_{i, j}$ minutes.
Additionally, for each student $i$, we know that this student asked the question, "What is the criteria for getting a certificate?" $Q_i$ times.
The criteria for getting a certificate is that a student must have watched at least $M$ minutes of lectures in total and they must have asked the question no more than $10$ times.
Find out how many participants are eligible for a certificate.

-----Input-----
- The first line of the input contains three space-separated integers $N$, $M$ and $K$.
- $N$ lines follow. For each valid $i$, the $i$-th of these lines contains $K+1$ space-separated integers $T_{i, 1}, T_{i, 2}, \ldots, T_{i, K}, Q_i$.

-----Output-----
Print a single line containing one integer — the number of participants eligible for a certificate. 

-----Constraints-----
- $1 \le N, K \le 1,000$
- $1 \le M \le 10^6$
- $1 \le Q_i \le 10^6$ for each valid $i$
- $1 \le T_{i, j} \le 1,000$ for each valid $i$ and $j$

-----Example Input-----
4 8 4
1 2 1 2 5
3 5 1 3 4
1 2 4 5 11
1 1 1 3 12

-----Example Output-----
1

-----Explanation-----
- Participant $1$ watched $1 + 2 + 1 + 2 = 6$ minutes of lectures and asked the question $5$ times. Since $6 < M$, this participant does not receive a certificate.
- Participant $2$ watched $3 + 5 + 1 + 3 = 12$ minutes of lectures and asked the question $4$ times. Since $12 \ge M$ and $4 \le 10$, this participant receives a certificate.
- Participant $3$ watched $1 + 2 + 4 + 5 = 12$ minutes of lectures and asked the question $11$ times. Since $12 \ge M$ but $11 > 10$, this participant does not receive a certificate.
- Participant $4$ watched $1 + 1 + 1 + 3 = 6$ minutes of lectures and asked the question $12$ times. Since $6 < M$ and $12 > 10$, this participant does not receive a certificate.
Only participant $2$ receives a certificate.

Starter code:

Solutions:
N,M,K=map(int,input().split())
c=0
for i in range(N):
 T=list(map(int,input().split()))
 Q=T[-1]
 T.pop(-1)
 if Q<=10 and sum(T)>=M:
  c+=1
print(c)

n,m,k=map(int,input().split())
a=0
for i in range(n):
 t=list(map(int,input().split()))
 q=t[-1]
 t.pop(-1)
 if q<=10 and sum(t)>=m:
  a+=1
print(a)

a,b,c=map(int,input().split())
n=0
for i in range(a):
 t=list(map(int,input().split()))
 d=t[-1]
 t.pop(-1)
 if d<=10 and sum(t)>=b:
  n+=1
print(n)

# cook your dish here
n,m,k=map(int,input().split())
condit=0
for _ in range(n):
 l=list(map(int,input().split()))
 a=0
 for i in range(len(l)-1):
  a+=l[i]
 if a>=m and l[len(l)-1]<11:
  condit+=1
 
print(condit)

N,M,K=list(map(int,input().split()))
c=0
for i in range(N):
 T=list(map(int,input().split()))
 Q=T[-1]
 T.pop(-1)
 if Q<=10 and sum(T)>=M:
  c+=1
print(c)


N,M,K=map(int,input().split())
c=0
for i in range(K):
 T=list(map(int,input().split()))[:K+1]
 Q=T[-1]
 T.remove(T[-1])
 if Q<=10:
  if sum(T)>=M:
   c+=1
print(c)

count=0
inp=input().split(" ")
inp=[int(x) for x in inp]
while inp[0]!=0 :
 t=input().split(" ")
 t=[int(x) for x in t]
 s=sum(t)-t[-1]
 if s>=inp[1] and t[-1]<=10 :
  count+=1
 inp[0]-=1
print(count)

n,m,k=input().split(" ")
l=[] 
c1=0
while(int(n)>0): 
 s=0
 l=input().split(" ")
 for i in range(0,int(k)):
  s=s+int(l[i])
 if(s>=int(m) and int(l[-1])<=10):
  c1=c1+1 
 n=int(n)-1
print(c1)



# cook your dish here
n,m,k=map(int,input().split())
co=0
for i in range(n):
 l=list(map(int,input().split()))
 s=0
 for j in range(k):
  s=s+l[j]
 if s>=m and l[k]<=10:
  co=co+1
print(co)

storage = list(input().split(' '))
count = 0
for j in range(int(storage[0])):
 n = list(input().split(' '))
 flag1 = False
 flag2 = False
 sum = 0
 for k in range(int(storage[2])):
  sum += int(n[k])
 if int(storage[1]) <= sum:
  flag1 = True
 if int(n[-1]) <= 10:
  flag2 = True
 if flag1:
  if flag2:
   count+=1
print(count)


# cook your dish here
n,m,k = map(int,input().split())
arr = []
for i in range(n):
 arr.append(list(map(int,input().split())))

cnt = 0
for i in range(n):
 tot = sum(arr[i])
 q = arr[i][-1]
 tot -= q
 if tot >= m and q <= 10:
  cnt += 1

print(cnt)

N, M, K = map(int, input().split())
cnt = 0
while N:
 *T, Q = map(int,input().split())
 if sum(T) >= M and Q < 11:
  cnt += 1 
 N -= 1
print(cnt)

N, M, K = map(int, input().split())
cnt = 0
while N:
 *T, Q = map(int,input().split())
 if sum(T) >= M and Q < 11:
  cnt += 1 
 N -= 1
print(cnt)

N, M, K = map(int, input().split())
cnt = 0
while N:
 *T, Q = map(int,input().split())
 if sum(T) >= M and Q < 11:
  cnt += 1 
 N -= 1
print(cnt)


n,m,k=map(int,input().split())
c=0
for i in range(n):
 l=list(map(int,input().split()))
 r=l[:k]
 if sum(r)>=m and l[-1]<=10:
  c+=1
print(c)

N,M,K=list(map(int,input().split()))
s=0
certi=0
for i in range(N):
 l=[]
 l=list(map(int,input().split()))
 s=sum(l)-l[-1]
 if s>=M and l[-1]<=10:
  certi+=1

 
print(certi)# cook your dish here


N,M,K=list(map(int,input().split()))
s=0
certi=0
for i in range(N):
 l=[]
 l=list(map(int,input().split()))
 s=sum(l)-l[-1]
 if s>=M and l[-1]<=10:
  certi+=1

 
print(certi)# cook your dish here


inputs = list(map(int, input().split()))
n = inputs[0]
m = inputs[1]
k = inputs[2]
cnt=0
for _ in range(0,n):
 arr = list(map(int, input().split()))
 ques = arr[len(arr)-1]
 s=sum(arr)-ques
 if s<m:
  continue
 else:
  if ques<=10:
   cnt=cnt+1
print(cnt)




# cook your dish here
(n,m,k)=list(map(int,input().split()))
lec=[]
que=[]
for i in range(n):
 l=list(map(int,input().split()))
 que.append(l[-1])
 lec.append(sum(l)-l[-1])
stu=0
for i in range(n):
 if lec[i]>=m and que[i]<=10:
  stu+=1
 i+=1
print(stu)



# cook your dish here
n, m, k = map(int, input().split())
ans = 0
for i in range(n):
 temp = list(map(int, input().split()))
 su = 0
 for j in range(k):
  su += temp[j]
 
 if(su >= m and temp[-1] <= 10):
  ans += 1
  
print(ans)

# cook your dish here
n,m,k = map(int,input().split())
c = 0
for i in range(n):
 l = list(map(int,input().split()))
 s = sum(l)-l[-1]
 if s >= m and l[-1] <= 10:
  c += 1
print(c)

# -*- coding: utf-8 -*-
"""
Created on Sat Oct  3 14:08:49 2020

@author: Vineet
"""
try:

 
 
 
 n,m,k=list(map(int,input().split()))
 count=0
 for i in range(0,n):
  list1=list(map(int,input().split()[:k+1]))
  Sum=sum(list1[:k])
  
  if Sum>=m and list1[-1]<=10:
   count+=1
  else:
   continue
 print(count)

 
 
  
 

 
except:
 pass


n,m,k =list(map(int,input().split()))
mat = []
for _ in range(n):
 arr = list(map(int,input().split()))
 mat.append(arr)


count=0
for i in range(n):
 curr = 0
 for j in range(k):
  curr+=mat[i][j]
 if mat[i][-1]<=10 and curr>=m:
  count+=1
 
print(count)
  
# cook your dish here


# cook your dish here
n,m,k=map(int,input().split())
c=0
for i in range(n):
 t=list(map(int,input().split()))
 if t[-1]<=10 and sum(t)-t[-1]>=m:
  c+=1 
print(c)

# cook your dish here
n, m, k = map(int, input().split())
T = []

for i in range(n):
 temp = list(map(int, input().split()))
 T.append(temp)
 
ans = 0
for i in range(n):
 watchTime = 0; Ques = T[i][k]
 for j in range(k):
  watchTime += T[i][j]
 if(watchTime >= m and Ques <= 10):
  ans += 1
  
print(ans)