DOWNLOAD: Getting compile time exceed

import sys
N = input()
N=int(N)
T= []
for i in range(0,N):
i = input()
i=i.split()
T.append(i[0])
T.append(i[1])
Q=input()
Q=int(Q)
q=[]
t=[]
for j in range(0,Q):
j=input()
j=j.split()
q.append(int(j[0]))
temp=int(j[0])
k=1
while(temp):
t.append(int(j[k]))
temp-=1
k+=1
temp=Q
g=0
while(temp):
count=0
a=[]
for n in range(0,N):
a.append(0)
for m in range(0,q[Q-temp]):
for o in range(0,N):
if(int(T[2o])<=t[g]):
if(int(T[(2
o)+1])>=t[g]):
if(a[o]==0):
a[o]=1
count+=1
g+=1
print(count)
temp-=1
del q
del t
del T
del N
What can I do reduce my compile Time, pls suggest…i a beginner to python

It’ NOT compile time, but runtime time. Simply your algorithm is slow. You are using three for loops, so the complexity of the algorithm is something like O(N*q[Q-1]), so for N = 10^5 and q[Q-1] = 10^9 it will run for 10^5 seconds - that’s why you are getting TLE…

hiii, sachin