Sherlock and Square

  • [deleted]
    + 1 comment

    can anyone tell me why am I getting termination due to timeout for the following code

    test = int(input())
    
    for i in range(test):
        num = int(input())
        answer = (2**(num+1)) + 2
        print(answer % 1000000007)
    

    is there a way to do it even faster