def has_duplicates(l):
    """
    Returns whether a given list contains duplicate elements.
    """
    seen = set()
    for x in l:
        if x in seen:
            return True
        seen.add(x)
    return False