Can anyone tell me why does this give RTE for Wormholes problems in ZCO?

import bisect
contestlist=[]
n,x,y=map(int,raw_input().split())
for i in range(n):
start,end=map(int,raw_input().split())
contestlist.append((start,end))
contestlist.sort()
openlist=map(int,raw_input().split())
openlist.append(100000)
openlist.sort()
closelist=map(int,raw_input().split())
closelist.append(100000)
closelist.sort()
tmp=[]
for i in range(n):
starttime=bisect.bisect_right(openlist,contestlist[i][0])
if starttime!=0:
starttime-=1
else: continue
endtime=bisect.bisect_left(closelist,contestlist[i][1])
tmp.append(closelist[endtime]-openlist[starttime])
print min(tmp)+1
enter code here

//