NZEC Error although the compilation is getting carried out successfully

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

Hey, can you please tell the problem this code is for, need to check its constraints and input format in order to pinpoint the cause of error.
Also NZEC is a runtime error, at has no relation with compilation.