If the quantity of packets is greater than or equal to the number of students of age j , then we can choose these packets for the students
if ( fr1 [ j ] <= fr2 [ k ] ) { flag = true ; break ; } k += 1 ; }