NZEC Error

Hi i am facing NZEC error. Not able to figure what is the issue as I have given the custom input and getting the correct answer.
This is my solution.
Problem link :https://www.codechef.com/PPW12020/problems/ANITGUY2
/**
n=int(input())
for i in range(n):
p=int(input())
q=int(input())
a=list(map(int,input().split()))
count=0
for j in range(q):
if a[j]<p:
count=count+1

    prod=a[j]
    for k in range(j+1,q):
        prod=prod*a[k]
        if prod<p:
            count=count+1
        else:
            break
        
print(count)
        **/