Codechef•Aug 31, 2025
Good Investment or Not
Hazrat Ali
Codechef
An investment is called good if and only if the interest rate of the investment is at least twice of the inflation rate.
Determine whether the investment made by Chef is good or not.
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 integers X and Y, the interest rate and the current inflation rate respectively.
Output Format
For each test case, output YES
if the investment is good, NO
otherwise.
You can output any letter in any case. For example YES
, yes
, yES
are all considered same.
Constraints
- 1≤T≤400
- 1≤X,Y≤20
Sample 1:
Input
5 7 4 6 3 2 4 10 10 20 1
Output
NO YES NO NO YES
Solution
t = int(input())
for _ in range(t):
x, y = map(int, input().split())
if x >= 2 * y:
print("YES")
else:
print("NO")