Help me in solving BMC09 problem

My issue

What’s wrong in my code

My code

# Update the code below to solve the problem

t = int(input())
flag = 0
for i in range(t):
    N = int(input())
    for i in range(N):
        for t in range(N):
            if 2 * i + 7 * t == N:
                flag = 1
                break
            if 2 * t == N:  # Check for even divisors
                flag = 1
                break
    if flag == 1:
        print('YES')
    else:
        print('NO')

Learning course: Solve Programming problems using Python
Problem Link: Practice problem - Construct N Practice Problem in Solve Programming problems using Python - CodeChef

@sidcode12
u have to do it without loop
like this

# Solution as follows

t = int(input())
for i in range(t):
    N = int(input())
    
    if N == 1 or N == 3 or N == 5:
        print('NO')
    else:
        print('YES')
1 Like