#include #include #include #include #include #include #include #include #include #include using namespace std; struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<> t; for (int i=0; i> a >> b >> c; if ((ac) swap(a,c); if (a == b && a == c) { ans = 3; a--; c-=2; } else if (abs(b-a) < abs(c-b) + (b-1==a? 1 : 0)) { ans = abs(b-a) + 1; b = a-1; } else { ans = abs(c-b) + 1; c = b-1; if (a == c) c--,ans++; } if (a<=0 || b<=0 || c<=0) ans = -1; cout << ans << endl; } }