CodechefJul 19, 2025

IPL Ticket Rush

Hazrat Ali

Codechef

A total of N students from the college want to go while only M tickets are available for the match.

Determine how many students won't be able to book tickets.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of two space-separated integers N and M — the number of students wants to go and the total number of tickets available, respectively.

Output Format

For each test case, output on a new line the number of students who won't be able to book tickets.

Constraints

  • 1≤T≤1000
  • 1≤N,M≤105

Sample 1:

Input
4
5 3
5 7
4 1
8 8
Output
 
2
0
3
0

Solution
t = int(input())
for _ in range(t):
    n, m = map(int, input().split())
    if m >= n:
        print(0)
    else:
        print(n - m)




Comments