Codechef•Aug 07, 2025
Bull or Bear
Hazrat Ali
Codechef
Given that Chef bought the stock at value X and sold it at value Y. Help him calculate whether he made a profit, loss, or was it a neutral deal.
Input Format
- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of a single line of input containing two space-separated integers X and Y, denoting the value at which Chef bought and sold the stock respectively.
Output Format
For each test case, output PROFIT
if Chef made a profit on the deal, LOSS
if Chef incurred a loss on the deal, and NEUTRAL
otherwise.
The checker is case-insensitive so answers like pROfiT
, profit
, and PROFIT
would be considered the same.
Constraints
- 1≤T≤500
- 1≤X,Y≤100
Sample 1:
Input
4 4 2 8 8 3 4 2 1
Output
LOSS NEUTRAL PROFIT LOSS
Solution
t = int(input())
for _ in range(t):
x, y = map(int, input().split())
if x > y:
print("Loss")
elif x < y:
print("Profit")
else:
print("Neutral")