Our paper In the contest of MCM-ICM we chose Problem D and wrote the paper within 4 days. The paper is in here. And the codes are in here.