Problem link solution link Its giving me tle but I think the approach is correct. Can anyone help me to improve the complexity of my solution. Thanks in advance.
try: t=int(input()) for _ in range(t): a,b=map(int,input().split()) res=0 while a//b < b: if (a%b) >= (a//b): res+=(a//b) else: res+=(a//b-1) b-=1 print(res+ ( (b-1)*b ) //2 ) except EOFError: pass







