NET.\r//fgUVhi\rinlineintdatecmp(datea,dateb){\rif(a.year!=b.year)\rreturna.year-b.year;\rif(a.month!=b.month)\rreturna.month-b.month;\rreturna.day-b.day;\r)\r4:;jkUV<lVm\rintweekday(datea){\rinttm=a.month>=3?(a.month-2):(a.month+10);\rintty=a.month>=3?a.year:(a.year-1);\rreturn(ty+ty/4-ty/100+ty/400+(int)(2.6*tm-0.2)+a.day)%7;\r)\r4UVrsXtu\rintdate2int(datea){\rintret=a.year*365+(a.year-1)/4-(a.year-1)/100+(a.year-l)/400,i;\rdays[l]+=leap(a.year);\rfor(i=0;i<a.month-1;ret+=days[i++]);\rdays[1]=28;\rreturnret+a.day;\r}\r4sXturIIV\rdateint2date(inta){\rdateret;\rret.year=a/146097*400;\rfor(a%=146097;a>=365+leap(ret.year);a-=365+leap(ret.year),ret.year++);\rdays[l]+=leap(ret.year);\rfor(ret.month=l;a>=days[ret.month-1];a-=days[ret.month-1],ret.month++);\rdays[1]=28;\rret.day=a+1;\rreturnret;