Bring equality
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Time Limit: 1.0 s
Memory Limit: 256.0 MB
Description
You are given three nonnegative integer \(A,B,C\). You can chose an arbitary number \(K\).
In one operation you can add or subtract \(K\) from one of \(A,B,C\). In other word, in an operation you can do one of the following :
 update \(A\) to \(A+K\)
 update \(A\) to \(AK\)
 update \(B\) to \(B+K\)
 update \(B\) to \(BK\)
 update \(C\) to \(C+K\)
 update \(C\) to \(CK\)
what is the minimum number of operations needed to make \(A=B=C\) (all of them equal)
Input
first line of input takes an integer \(T\) : number of testcases
each testcase takes 3 integers \(A,B,C\)
\(1 \le T \le 10^4\)
\(0 \le A,B,C \le 10^6\)
Output
Print one integer for each of \(T\) testcases : minimum number of operations needed.
Sample
Input  Output 



first testcase: all number are equal, so you dont need to do any operation
second testcase: chose k=2, and do the only operation 52=3
Brain Booster #4
 Status
 Done
 Rule
 ACM/ICPC
 Problem
 9
 Start at
 20240714 15:30
 End at
 20240714 19:00
 Duration
 3.5 hour(s)
 Host
 Partic.
 89