Source Code
t = int(input())
while t != 0:
    q = int(input())
    ways = 1
    if int(q) % 2 == 0:
        ways+=1
    temp = q
    while temp > 2:
        temp-=2
        ways+= (2 ** temp)
    print(ways % 1000000007)
    t-=1

Copy
Study Schedule iwjx
Python 3
2094 ms
4.2 MB
Time Limit Exceeded