Deputy Chef problem in Beginner section facing runtime Error

Hi all, I am facing a runtime error for my code of Deputy chef problem in beginner section.Kindly have a look at my code, it shows successfully executed for the test cases, but when I submit it shows runtime Error.
Here is my code:

  1. t=int(input('Enter test cases: '))
    while(t!=0): n=int(input('Enter
    people in the formation: '))
    a=list(map(int,input('Enter attack
    value: ').split()))
    d=list(map(int,input('Enter Defense
    value: ').split())) sum=[]
    sum.append(zeroth) for i in
    sum.appendĀ§ last=int(a[len(a)-2]+a[0])
    sum.append(last) q=[i - j for i, j in zip(d,sum)] r=max(q)
    if(r<=0): print(-1) else:
    print(d[q.index(max(q))]) t-=1

Share a link to your submission.