Code for lab of IR course