i am getting NZEC error in this code can any one solve it

i=int(input())
for i in range(i):
max1,max2,max3,count=0,0,0,0
a,b=str(input()).split()
a=int(a)
b=int(b)
for i in range(1,a+1):
x=a%i
if max1<x:
max1=x
max2=i
max3=max2
for i in range(1,b+1):
for j in range(1,b+1):
g=(((a max2) i) j) a
if g == max1:
count=count+1
print(count)

//