Hey @ilvpython !
The problem of TLE occurs when the time that your program runs for exceeds the limit that was set for that particular question.
For instance in this program, if the value of n is very high (1≤N≤10**9) and k is 1 then it would obviously exceed the set time limit.
To avoid this u can just use remainder division to get the answer for this qn.
Also, we must take care of ZeroDivisionError and if the value of the dividend is smaller than the divisor as well.
for i in range(int(input())):
n,k=map(int,input().split())
if n>=k and k!=0:
a = n%k
print(a)
else:
print(n)