Help in IPCTRAIN

i am unable to understand author’s solution

link to the problem:-IPCTRAIN Problem - CodeChef

here is the author’s solution:-https://s3.amazonaws.com/codechef_shared/download/Solutions/JULY17/Setter/IPCTRAIN.cpp

the part i am unable to undrstand is

   for (auto it: persons) 
 {
 int lec = lectures[it.second];

		for (int i = 0; i < lec; i++) {
			auto iter = daySet.lower_bound(startDay[it.second]);
			if (iter == daySet.end()) {
				break;
			} else {
				lecturesTaken[it.second]++;
			  daySet.erase(iter);
			}
		}
	}

what is this part doing