
with open("hdc.tex",'w') as fout:
	fout.write("\\input{header.tex} \n")
	fout.write("\\togglefalse{IC} \n")
	fout.write("\\begin{document} \n")
	for i in range(2,45):
		with open("Lecture"+str(i)+".tex",'r') as f:
			flag = False
			for line in f:
				if flag == False:
					if "\hdc" in line: 
						flag = True
						fout.write("\\textbf{Lecture " + str(i) + "} \\vskip1em")
				else:
					fout.write(line)
					if "\\vskip3em" in line:
						fout.write('\\newpage')
						flag = False
	fout.write("\\end{document}")
