**Physical Address**

304 North Cardinal St.

Dorchester Center, MA 02124

Chef’s coding class is very famous in Chefland.

This year *X* students joined his class and each student will require one chair to sit on. Chef already has *Y* chairs in his class. Determine the minimum number of new chairs Chef must buy so that every student is able to get one chair to sit on.

- The first line contains a single integer
*T*— the number of test cases. Then the test cases follow. - The first and only line of each test case contains two integers X and
*Y*— the number of students in the class and the number of chairs Chef already has.

For each test case, output the minimum number of extra chairs Chef must buy so that every student gets one chair.

- 1 \leq T \leq 10001≤
*T*≤1000 - 0 \leq X, Y \leq 1000≤
*X*,*Y*≤100

```
Input: 4
20 14
41 41
35 0
50 100
Output: 6
0
35
0
```

**Test case 1:**There are 20 students in the class and Chef has 14 chairs already. Therefore Chef must buy 6 more chairs.**Test case 2:**There are 41 students in the class and Chef already has exactly 41 chairs. Therefore Chef does not need to buy any more chairs.**Test case 3:**There are 35 students in the class and Chef has no chairs initially. Therefore Chef must buy 35 chairs.

```
n=int(input())
for i in range(n):
x,y=map(int,input().split())
if x>y:
print(x-y)
else:
print("0")
```

```
#include <bits/stdc++.h>
using namespace std;
int n,x,y;
int main (){
cin>>n;
while (n--){
cin>>x>>y;
if (x<=y) cout<<0<<endl;
else cout<<x-y<<endl;
}
return 0;
}
```

```
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 1; i <= t; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
if (x > y)
System.out.println(x - y);
else System.out.println("0");
}
}
}
```

In our experience, we suggest you solve this Chairs Requirement 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 Chairs Requirement CodeChef Solution

I hope this Chairs Requirement 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 >>**