for _ in range(int(input())):
a, b, c = sorted([int(c) for c in input().split()])
print(a+b if c > a + b else (a+b+c)//2)
// 1100: Sweet Problem
// Jan 11 2023
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solve(){
long r,g,bl,a,b,c;
cin >> r >> g >> bl;
vector<int> vect{r, g, bl };
sort(vect.begin(),vect.end());
c = vect[0];
b = vect[1];
a = vect[2];
if(a > b+c){
cout << b+c << endl;
}
else{
long result = (a+b+c)/2;
cout << result << endl;
}
}
int main() {
int t;
cin >> t;
for(int i = 0; i < t;i++){
solve();
}
}
1506A - Strange Table | 456A - Laptops |
855B - Marvolo Gaunt's Ring | 1454A - Special Permutation |
1359A - Berland Poker | 459A - Pashmak and Garden |
1327B - Princesses and Princes | 1450F - The Struggling Contestant |
1399B - Gifts Fixing | 1138A - Sushi for Two |
982C - Cut 'em all | 931A - Friends Meeting |
1594A - Consecutive Sum Riddle | 1466A - Bovine Dilemma |
454A - Little Pony and Crystal Mine | 2A - Winner |
1622B - Berland Music | 1139B - Chocolates |
1371A - Magical Sticks | 1253A - Single Push |
706B - Interesting drink | 1265A - Beautiful String |
214A - System of Equations | 287A - IQ Test |
1108A - Two distinct points | 1064A - Make a triangle |
1245C - Constanze's Machine | 1005A - Tanya and Stairways |
1663F - In Every Generation | 1108B - Divisors of Two Integers |