Help me in solving P2149 problem

My issue

In this problems statement it says that

using which you can change any single dimension of a red object to any positive integer’

is that’s it so the highest number of the minimum cost will be 2
As I can make A and B 1,1 in 2 operation is that so why my this code is failing in hidden test cases
answer =
import math
for _ in range(int(input())):
a,b,x = map(int,input().split())
area_rect = ab
area_sqar = x
x
if area_sqar >= area_rect:
answer.append(0)
else:
m = max(a,b)-1
mi = min(a,b)
if m*mi<=area_sqar:
answer.append(1)
else:
answer.append(2)
for case in answer:
print(case)

My code

answer = []
import math
for _ in range(int(input())):
   a,b,x = map(int,input().split())
   area_rect = a*b
   area_sqar = x*x
   if area_sqar >= area_rect:
      answer.append(0)
   else:
      m = max(a,b)-1
      mi = min(a,b)
      if m*mi<=area_sqar:
         answer.append(1)
      else:
         answer.append(2)
for case in answer:
   print(case)

Problem Link: Magical World Practice Coding Problem