I have written the code which gives correct output but only gets one subtask done while running.

s = int(input())
n = int(1)
while n <= s:
n = n + 1
string = input()
k = 0
while string[k] != " ":
k=k+1
na = int(k)
n1 = int(string[0:na])
n2 = int(string[na+1:len(string)])
u = 0
while n2 >= u*5:
u = u + 1
l = ((n1-(n1%5))/5)-(u-1)
print(int(l))

Can you please tell what is wrong with this?

Share the link or the code of the problem

Code - JOINING