# PROBLEM LINK:

Practice

Div-2 Contest

Div-1 Contest

In case the contest did not have two separate pages for Div-1 and Div-2, you can delete one of these above lines.

* Author:* Riddhish Lichade

*Prathamesh Sogale*

**Tester:***Ram Agrawal*

**Editorialist:**# DIFFICULTY:

EASY

# PREREQUISITES:

Math

# PROBLEM:

Given the number of ribbons of 3 different colors, Rahul wants to decorate some stalls using these. He uses a total of 3 ribbons to decorate one stall. He can’t use all the ribbons of the same color to decorate a stall. Find the maximum number of stalls he can decorate.

# EXPLANATION:

Let’s take A as the minimum, C as the maximum, and B as the other of the three colors of ribbons. Now if A+B\leq C/2 then he can decorate a maximum of A+B stalls else he can simply decorate (A+B+C)/3 stalls.

# SOLUTIONS:

## Solution

```
from sys import stdin
for _ in range(int(stdin.readline())):
l = list(map(int, stdin.readline().strip().split()))
l.sort()
if(l[0]+l[1]<=l[2]//2):
print(l[0]+l[1])
else:
print((l[0]+l[1]+l[2])//3)
```