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.
    Screens out duplicate urls and returns the urls sorted into
    increasing order."""
    host = filename[(filename.find("_")+1):]
    logs = ""
    puzzle_urls = []
    with open(filename) as file:
        logs = file.read()

    for url in re.findall(r'GET.*HTTP',logs):
        if re.match(r'.*puzzle.*',url):
            complete_url = "http://" + host+url[4:-5]
            if complete_url not in puzzle_urls:
                puzzle_urls.append(complete_url)

    puzzle_sorted = sorted(puzzle_urls,key=lambda x: x[-8:])

    return puzzle_sorted