Setting up Camp
The organizing committee plans to take the participants of the Olympiad on a hike after the tour. Currently, the number of tents needed to be taken is being calculated. It is known that each tent can accommodate up to $$$3$$$ people.Among the participants, there are $$$a$$$ introverts, $$$b$$$ extroverts, and $$$c$$$ universals:  Each introvert wants to live in a tent alone. Thus, a tent with an introvert must contain exactly one person — only the introvert himself.  Each extrovert wants to live in a tent with two others. Thus, the tent with an extrovert must contain exactly three people.  Each universal is fine with any option (living alone, with one other person, or with two others). The organizing committee respects the wishes of each participant very much, so they want to fulfill all of them.Tell us the minimum number of tents needed to be taken so that all participants can be accommodated according to their preferences. If it is impossible to accommodate the participants in a way that fulfills all the wishes, output $$$-1$$$.
In the first test case, $$$1$$$ tent will be given to the introverts, $$$1$$$ tent will be shared by two extroverts and one universal, and the last tent will be shared by two universals. In total, $$$3$$$ tents are needed.In the second test case, three extroverts will take $$$1$$$ tent, and $$$1$$$ tent will be taken by an introvert. Then, one extrovert and one universal will be left. This extrovert will not be able to live with two others.
Each test consists of multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. This is followed by the descriptions of the test cases.Each test case is described by a single line containing three integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$0 \le a, b, c \le 10^9$$$) — the number of introverts, extroverts, and universals, respectively.
For each test case, output a single integer — the minimum number of tents, or $$$-1$$$ if it is impossible to accommodate the participants.
for s in [*open(0)][1:]:
    (a, b, c) = map(int, s.split())
    b += c
    print((a - -b // 3, -1)[c < b % 3])
import math

def score(t, test_cases):
    results = []
    for _ in range(t):
        introvert = test_cases[_][0]
        extrovert = test_cases[_][1]
        universal = test_cases[_][2]
        total = introvert
        if extrovert >= 3:
            total += math.floor(extrovert / 3)
            remainder = extrovert % 3
        else:
            remainder = extrovert
        universal += remainder
        if universal % 3 == 0:
            total += math.floor(universal / 3)
        elif universal / 3 >= 1 or (universal < 3 and remainder == 0):
            total += math.floor(universal / 3 + 1)
        else:
            total = -1
        results.append(math.floor(total))
    return results
t = int(input())
test_cases = []
for _ in range(t):
    (n, m, p) = map(int, input().split())
    test_cases.append((n, m, p))
results = score(t, test_cases)
for res in results:
    print(res)
import math
import sys
tests = int(sys.stdin.readline().strip())
for i in range(tests):
    nums = sys.stdin.readline().strip().split()
    intro = int(nums[0])
    extra = int(nums[1])
    uni = int(nums[2])
    total = intro
    if (extra + uni) % 3 == 0:
        print(math.floor(total + (extra + uni) / 3))
    elif (extra + uni) % 3 == 1 and uni >= 1:
        print(math.floor(total + (extra + uni) / 3 + 1))
    elif (extra + uni) % 3 == 2 and uni >= 2:
        print(math.floor(total + (extra + uni) / 3 + 1))
    else:
        print(-1)