PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: pd_codes
Tester: yash_daga
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
G girls and B boys want to make teams of one boy and one girl each.
Given that G \lt B, how many boys will be left without a partner at minimum?
EXPLANATION:
Since there are fewer girls than boys, at most G boys will be able to find partners.
This leaves B - G boys without a partner, and so the answer is B - G.
TIME COMPLEXITY
\mathcal{O}(1) per test case.
CODE:
Editorialist's code (Python)
for _ in range(int(input())):
g, b = map(int, input().split())
print(b - g)