For N Students, Given their arrival time, if there are less than K students present after the class starts, class gets canceled. Print whether or not class gets canceled.
Input:
2
4 3
-1 -3 4 2
4 2
0 -1 2 1
Output:
YES
NO
Python Implementation:
Input:
2
4 3
-1 -3 4 2
4 2
0 -1 2 1
Output:
YES
NO
Python Implementation:
# Get the number of test cases from the user
t = int ( raw_input () )
# Do until the number of test cases become "0"
while ( t > 0 ) :
    
     # Create an empty list
     list = []
     # Get space separated integers from the user (N, the number of students & K, )
     n, k = map ( int, raw_input ().split () )
     # Get the space separated N students as a string
     s = raw_input ()
     # Split the string and store it in a list delimited by a space
     list = map ( int , s.split (' ') )
     #  If the sum of arrival time of the students in the list is less than "k"
     if ( sum ( i < = 0 for i in list ) < k ) :
          # Print YES
          print "YES"
     else :
         
          # Else Print NO
          print "NO"
     # Decrement number of test cases after evaluation of every test case
     t - = 1