output_description: For each query, print the maximum possible number of participants whose scores
  are smaller than Takahashi's.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      Q
      A_1 B_1
      :
      A_Q B_Q
attempt: N = int(input())
  lis = []
  for T in range(N):
      c = list(map(int, input().split()))
      pro = c[0] * c[1]
      sq = int(pro**0.5)
      if c[0] == c[1]:
          n = (sq - 1) * 2
      elif (c[0] % 2 != 0 and c[1] % 2 == 0) or (c[1] % 2 != 0 and c[0] % 2 == 0):
          n = (sq - 1) * 2
      elif c[0] % 2 == 0 and c[1] % 2 == 0:
          n = (sq * 2) - 1
      else:
          n = (sq * 2) - 2
      lis.append(n)
  for i in lis:
      print(i)
  
problem_description: Statement
  
  10^{10^{10}} participants, including Takahashi, competed in two programming
  contests. In each contest, all participants had distinct ranks from first
  through 10^{10^{10}}-th.
  
  The _score_ of a participant is the product of his/her ranks in the two
  contests.
  
  Process the following Q queries:
  
    * In the i-th query, you are given two positive integers A_i and B_i. Assuming that Takahashi was ranked A_i-th in the first contest and B_i-th in the second contest, find the maximum possible number of participants whose scores are smaller than Takahashi's.
samples: [{"input": "8\n    1 4\n    10 5\n    3 3\n    4 11\n    8 9\n    22 40\n    8 36\n    314159265 358979323", "output": "1\n    12\n    4\n    11\n    14\n    57\n    31\n    671644785\n    \n\nLet us denote a participant who was ranked x-th in the first contest and y-th\nin the second contest as (x,y).\n\nIn the first query, (2,1) is a possible candidate of a participant whose score\nis smaller than Takahashi's. There are never two or more participants whose\nscores are smaller than Takahashi's, so we should print 1."}]