name-string-1

Description:
Name string is a string consisting of letters "R","K" and "V". Today Oz wants to design a name string in a beautiful manner. Actually Oz cannot insert these three letters arbitrary anywhere ,he has to follow some rules to make the name string look beautiful. First thing is that the name string should consist of at most two different letters. Secondly adjacent letters in name string must be different.

After this procedure Oz wants name string to be as long as possible. Given the number of "R","K" and "V" letters that you have initially ,help Oz to find the maximum length of name string that Oz can make.

Input :
The first line contains the number of test cases T . Each test case consists of three space separated integers - A,B and C representing number of "R" letters, number of "K" letters and number of "V" letters respectively. 

Output :
For each test case T, output maximum length of name string that Oz can make.

Constraints :
1 ≤ T ≤100
0 ≤ A,B,C ≤10^6

SAMPLE INPUT
2
1 2 5
0 0 2

SAMPLE OUTPUT
5
1

Explanation

For first sample :
The longest name string possible is :  VKVKV  using 3 "V" letters and 2 "K" letters and its length is 5.

Difficulty: EASY
Tags: Mathematics

Ad-hoc

Starter code:

Solutions:
l = []

for x in range(int(input())):
	l.append(tuple(sorted(map(int, input().split()))))
	
for case in l:
	if any(value >= 1 for value in case) and case[1] < case[2]:
		print(((case[1]*2)+1))
	elif any(value >= 1 for value in case):
		print((case[1]*2))
	else:
		print((0))


for _ in range(int(input())):
	r,k,v=list(map(int,input().split()))
	if r>=k:
		a=r
		if k>=v:
			b=k
		else:
			b=v
	else:
		a=k
		if r>=v:
			b=r
		else:
			b=v
	if b>a:
		b,a=a,b
	if b==a:
		print((2*b));
	else:
		print((2*b+1));


for _ in range(eval(input())):
	a, b, c = sorted(map(int, input().split()), reverse=True)
	if a == b:
		print(b * 2)
	else:
		print((b * 2) + 1)
		


for _ in range(eval(input())):
	a, b, c = sorted(map(int, input().split()), reverse=True)
	if a == b:
		print(b * 2)
	else:
		print((b * 2) + 1)
		


for _ in range(eval(input())):
	a,b,c = list(map(int,input().split()))
	total = 1
	if a ==0 and b==0 and c==0:
		total = 0
	elif a > b and a >=c:
		if b >=c and a != b:
			total = 2*b+1
		elif b>=c and a==b:
			total = 2*b
		elif c>=b and c!=a:
			total = 2*c+1
		else:
			total = 2*c
	elif b>c:
		if b !=a and a >=c :
			total = 2*a+1
		elif b ==a and a>=c:
			total = 2*a
		elif b !=c and c>=a:
			total = 2*c+1
		else:
			total = 2*c
	else:
		if c != a and a>=b:
			total = 2*a+1
		elif c == a and a>=b:
			total = 2*a
		elif c !=b and b>=a:
			total = 2*b+1
		else:
			total = 2*b
	print(total)
			


for _ in range(eval(input())):
	r,k,v=sorted(map(int,input().split()))
	if k==v:
		print(k+v)
	else:
		print(2*k+1)


_ = eval(input())
while _>0:
	_ -= 1
	a, b, c = sorted(map(int, input().split()))
	print(2*b if b==c else (2*b)+1)
			
	


A = int(input())
for _ in range(A):
	alist = list(map(eval, input().split()))
	max1 = max(alist)
	alist.remove(max1)
	max2  = max(alist)
	count = 0
	if(max1==max2):
		print(2*max1)
	else:
		print(2*max2+1)



test=eval(input())
for i in range(test):
	l=list(map(int,input().split()))
	l.sort()
	medium=l[1]
	maximum=l[2]
	count=0
	while maximum !=0 and medium!=0:
		maximum-=1
		medium-=1
		count+=2
	if maximum!=0:
		print(count+1)
	else:
		print(count)


def MaxCount(a):
	a.sort(key=None,reverse=True)
	c=a[1]*2
	if a[0]>a[1]:
		c+=1
	return c

t=int(input())
while t:
	a=[int(i) for i in input().split()]
	print((MaxCount(a)))
	t-=1


_ = eval(input())

while _>0:
	_ -= 1
	
	a, b, c = sorted(map(int, input().split()))
	print(2*b if b==c else (2*b)+1)