# -*- coding: utf-8 -*-
import io,sys,ssl,urllib.request,urllib.error
sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding="utf-8")
ctx=ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
urls={
"ut-stat":"https://www.sgs.utoronto.ca/programs/statistics/",
"ut-cs":"https://www.sgs.utoronto.ca/programs/computer-science/",
"uw-mmath":"https://uwaterloo.ca/future-graduate-students/programs/by-faculty/math/computer-science-master-math-mmath",
"harvard-ds":"https://gsas.harvard.edu/program/data-science",
"stan-bmds":"https://bulletin.stanford.edu/programs/BMDS-MS",
"stan-cs":"https://bulletin.stanford.edu/programs/CS-MS",
"stan-stats":"https://bulletin.stanford.edu/programs/STATS-MS",
"rice-cs":"https://ga.rice.edu/programs-study/departments-programs/engineering/computer-science",
"rice-ds":"https://ga.rice.edu/programs-study/departments-programs/engineering/data-science",
"rice-stat":"https://ga.rice.edu/programs-study/departments-programs/engineering/statistics",
"notre-cse":"https://graduateschool.nd.edu/degree-programs/computer-science-and-engineering-mscse---masters-professional/",
}
for k,u in urls.items():
    try:
        req=urllib.request.Request(u,headers={"User-Agent":"Mozilla/5.0"})
        r=urllib.request.urlopen(req,timeout=18,context=ctx)
        b=r.read()
        print(f"{k:12} {r.status} len={len(b)} {u}")
    except urllib.error.HTTPError as e:
        print(f"{k:12} HTTP {e.code} len=0 {u}")
    except Exception as e:
        print(f"{k:12} ERR {type(e).__name__}: {str(e)[:50]} {u}")
