Codechef•Jul 17, 2025
Donation Drive
Hazrat Ali
Codechef
The drive has collected X donations so far. Find the remaining number of donations needed to reach the target.
Input Format
- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case contains two space-separated integers N and X — the number of required donations and the number of collected donations, respectively.
Output Format
For each test case, output on a new line, the remaining number of donations needed to reach the target.
Constraints
- 1≤T≤200
- 1≤X≤N≤20
Sample 1:
Input
4 5 2 3 3 5 4 7 5
Output
3 0 1 2
Solution
m = int(input())
for _ in range(m):
n, x = map(int, input().split())
print(n - x)