def valid(numbers, i):
    """Check if the number at position i is the sum of 2 numbers in the previous 25"""
    seen = set()
    for k in range(i-25, i):
        if (numbers[i] - numbers[k]) in seen:
            return True
        seen.add(numbers[k])
    return False