Runtime(NZEC). where is the problem (there if none)

1 count=0
2 t=int(input(""))
3 for i in range(0,t):
4 n=0
5 k=0
6 l=[]
7 n,k= input().split()
8 n,k=int (n),int (k)
9 l = [int(i) for i in input().split()]
10 a=sorted(l, reverse=True)
11
12 z=list(set(a))
13 p=sorted(z, reverse=True)
14
15 q=p[k]
16
17 for i in range(0,n):
18 if(a[i]==q):
19 break
20 else:
21 count+=1
22 continue
23 print(count)
24 count=0

I don’t know the problem statement but still assuming something I found:

  1.  <pre>        z=list(set(a))
     p=sorted(z, reverse=True)
     q=p[k]</pre>
    

if k==1en(l) it will give an error in case of the same element in list l

size of a list reduces when you use set (if same elements exist in it)

Example: [4 2 3 3 4] after applying set operation on it … it will give a result like this {2,3,4}

suggestion once you have used set no need sort it again … elements get sorted when you use set()

https://bpaste.net/show/24edae0719c9 this is the code sorry for this format