I am getting this NZEC error although the code is getting compiled and the pulbic test cases are passing. Working fine on replit as well.
t = int(input())
for i in range(t):
n = int(input())
c = input().split(" ")
k = len(c)
d = {}
for i in range(k):
d[i+1] = int(c[i])
q = int(input())
for i in range(q):
count = 0
id = input().split(" ")
for i in range (len(id)):
id[i] = int(id[i])
for i in range(id[0],id[-1]+1):
count+= d[i]
print(count)
Can anyone please point out the error? Still unable to fix it