304 North Cardinal St.
Dorchester Center, MA 02124

# Vishesh and his Popcorn Combo CodeChef Solution

## Get Vishesh and his Popcorn Combo CodeChef Solution

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 AB, 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.

### Input Format

• 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 A1​ and A2​, meaning that for combo A, the Popcorn bucket lasts A1​ minutes and the Coke cup lasts A2​ minutes.
• The second line of each test case contains two space-separated integers B1​ and B2​, meaning that for combo B, the Popcorn bucket lasts B1​ minutes and the Coke cup lasts B2​ minutes.
• The third line of each test case contains two space-separated integers C1​ and C2​, meaning that for combo C, the Popcorn bucket lasts C1​ minutes and the Coke cup lasts C2​ minutes.

### Output Format

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

### Constraints

• 1≤T≤1000
• 1≤A1​,A2​,B1​,B2​,C1​,C2​≤10^9

### Sample 1:

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

### Explanation:

• 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.

Therefore Vishesh’s maximum satisfaction is 15.

## Vishesh and his Popcorn Combo CodeChef Solution in Java

``````/* 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
{
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);
}
}
}
}
``````

## Vishesh and his Popcorn Combo CodeChef Solution in C++17

``````#include <iostream>
using namespace std;

int main() {
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;
}
``````

## Vishesh and his Popcorn Combo CodeChef Solution in Pyth 3

``````# 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)
``````
##### Vishesh and his Popcorn Combo CodeChef Solution Review:

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

Find on CodeChef

##### Conclusion:

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 >>

LeetCode Solutions

Hacker Rank Solutions

CodeChef Solutions