Write a Python function to check if a given list contains any duplicate elements.
def check_duplicates(A):
    seen = set()
    for elem in A:
        if elem in seen:
            return True
        seen.add(elem)
    return False