Project Euler #1: Multiples of 3 and 5

  • + 0 comments

    I am getting Runtime Error for Test Case 2 & 3. The logic seems fine, can someone please help?

    #!/bin/python3
    
    import sys
    
    t = int(input().strip())
    for a0 in range(t):
        n = int(input().strip())
        p = 0
        if 1 <= t <= 10 ** 5 and 1 <=n <= 10 ** 9:
            p = [x for x in range(1,n) if x % 3 == 0 or x % 5 == 0]
            print(sum(p))