**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

Vishesh has gone to watch the new Spider-Man movie, but he is having troubles choosing which Popcorn-and-Coke combo to buy.

There are three combos *A*, *B*, and *C* available at the counter. You are given the time (in minute) for which each Popcorn bucket and Coke cup lasts. Given that Vishesh’s satisfaction from a combo is defined as the total lasting time (in minute) of the Popcorn bucket and the Coke cup, find the maximum satisfaction he can get by buying a single combo.

- The first line of each input contains
*T*– the number of test cases. The test cases then follow. - The first line of each test case contains two space-separated integers
*A*1 and*A*2, meaning that for combo*A*, the Popcorn bucket lasts*A*1 minutes and the Coke cup lasts*A*2 minutes. - The second line of each test case contains two space-separated integers
*B*1 and*B*2, meaning that for combo*B*, the Popcorn bucket lasts*B*1 minutes and the Coke cup lasts*B*2 minutes. - The third line of each test case contains two space-separated integers
*C*1 and*C*2, meaning that for combo*C*, the Popcorn bucket lasts*C*1 minutes and the Coke cup lasts*C*2 minutes.

For each test case, output on a single line the maximum satisfaction Vishesh can get.

- 1≤
*T*≤1000 - 1≤
*A*1,*A*2,*B*1,*B*2,*C*1,*C*2≤10^9

```
Input:
3
3 6
5 10
8 7
99 1
55 55
33 51
54 146
5436 627
1527 5421
Output:
15
110
6948
```

**Test case 1:**- For combo
*A*, the Popcorn bucket lasts 3 minutes, and the Coke cup lasts 6 minutes, so Vishesh gets a satisfaction of 3+6=9 if he buys this combo. - For combo
*B*, the Popcorn bucket lasts 5 minutes, and the Coke cup lasts 10 minutes, so Vishesh gets a satisfaction of 5+10=15 if he buys this combo. - For combo
*C*, the Popcorn bucket lasts 8 minutes, and the Coke cup lasts 7 minutes, so Vishesh gets a satisfaction of 8+7=15 if he buys this combo.

- For combo

Therefore Vishesh’s maximum satisfaction is 15.

```
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int d=sc.nextInt();
int e=sc.nextInt();
int f=sc.nextInt();
int k=a+b;
int h=c+d;
int j=e+f;
if(k>h && k>j)
{
System.out.println(k);
}
else if(h>k && h>j)
{
System.out.println(h);
}
else
{
System.out.println(j);
}
}
}
}
```

```
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int a1,a2,b1,b2,c1,c2;
cin>>a1>>a2>>b1>>b2>>c1>>c2;
int a=a1+a2;
int b=b1+b2;
int c=c1+c2;
if(a>b && a>c){
cout<<a<<endl;
}
else if(b>c){
cout<<b<<endl;
}
else{
cout<<c<<endl;
}
}
return 0;
}
```

```
# cook your dish here
for _ in range(int(input())):
ans = 0
for i in range(3):
ans = max([sum([int(x) for x in input().split()]), ans])
print(ans)
```

In our experience, we suggest you solve this Vishesh and his Popcorn Combo CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Vishesh and his Popcorn Combo CodeChef Solution

I hope this Vishesh and his Popcorn Combo CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.

Keep Learning!

**More Coding Solutions >>**