import re


def read_urls(filename):
    """Returns a list of the puzzle URLs from the given log file,
    extracting the hostname from the filename itself, sorting
    alphabetically in increasing order, and screening out duplicates.
    """
    img_urls = []
    prefix = filename.split("_")[-1]
    pattern = re.compile(r"\/\S*\/puzzle\/\S*")

    with open(filename, "r") as f:
        contents = f.read()
        all_urls = pattern.finditer(contents)
        for match in all_urls:
            url = "https://" + prefix + match.group(0)
            if url not in img_urls:
                img_urls.append(url)
        f.close()

    img_urls.sort(key=lambda img: img.split("-")[-1])
    return img_urls