# IPL and RCB Codechef Solution

It’s IPL time and as usual RCB are finding it tough to qualify for playoffs. RCB needs a minimum of XX more points to qualify for playoffs in their remaining YY matches. A win, tie and loss in a match will yield 2,1,02,1,0 points respectively to a team.

You being a true RCB supporter want to find the minimum number of matches RCB needs to win to qualify for playoffs. It is guaranteed that RCB will qualify for playoffs if they win all their remaining YY matches.

### Input:

• First line will contain TT, number of testcases. Then the testcases follow.
• Each testcase contains of a single line of input, two space separated integers X,YX,Y

### Output:

For each testcase, output in a single line the minimum number of matches RCB must win to qualify for playoffs.

### Constraints :

• 1≤T≤100001≤T≤10000
• 1≤X≤1001≤X≤100
• 1≤Y≤1001≤Y≤100
• 1≤X≤2⋅Y1≤X≤2⋅Y

```2
10 5
1 5
```

```5
0
```

### Explanation:

• In first case X=10X=10 and Y=5Y=5, so RCB needs 1010 points from remaining 55 matches to qualify for playoffs. It is only possible if they win all their remaining 55 matches.
• In second case X=1X=1 and Y=5Y=5, so RCB needs 11 points from their remaining 55 matches to qualify for playoffs. It can be done if they tie any one of their 55 matches and lose the remaining 44. So they need to win 00 matches.

## IPL and RCB – CodeChef Solution in JAVA

```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
{
int t;
Scanner sc=new Scanner(System.in);
int x,y;
t=sc.nextInt();
for(int i=0;i<t;i++)
{
x=sc.nextInt();
y=sc.nextInt();
System.out.println(Math.max(0,x-y));
}
}
}
```

## IPL and RCB – CodeChef Solution in CPP

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

int main() {
int t;
cin>>t;
while(t--){
int x,y;
cin>>x>>y;
if(x>=y)
cout<<x-y<<endl;
else
cout<<0<<endl;
}
return 0;
}
```

## IPL and RCB -CodeChef Solution in Python

```# cook your dish here
t = int(input())
for _ in range(t):
x, y = map(int, input().split())
if x<=y:
print(0)
else:
print(x-y)```

Disclaimer: The above Problem (IPL and RCB) is generated by CodeChef but the solution is provided by Codeworld19.This tutorial is only for Educational and Learning purpose.