Pooja would like to withdraw X US from an ATM. The cash machine will only accept the transaction if X is a multiple of 5, and Pooja's account balance has enough cash to perform the withdrawal transaction (including bank charges).  For each successful withdrawal the bank charges 0.50 US.

Calculate Pooja's account balance after an attempted transaction.  

------ Input Format ------ 

Each input contains 2 integers X and Y. \
X is the amount of cash which Pooja wishes to withdraw. \
Y is Pooja's initial account balance.

------ Output Format ------ 

Output the account balance after the attempted transaction, given as a number with two digits of precision.  If there is not enough money in the account to complete the transaction, output the current bank balance.

------ Constraints ------ 

1. $0 < X ≤ 2000$ - the amount of cash which Pooja wishes to withdraw.
2. $0 ≤ Y ≤ 2000$ with two digits of precision - Pooja's initial account balance.

----- Sample Input 1 ------ 
30 120.00
----- Sample Output 1 ------ 
89.50
----- explanation 1 ------ 
Example - Successful Transaction

----- Sample Input 2 ------ 
42 120.00

----- Sample Output 2 ------ 
120.00
----- explanation 2 ------ 
Example - Incorrect Withdrawal Amount (not multiple of 5)

----- Sample Input 3 ------ 
300 120.00
----- Sample Output 3 ------ 
120.00
----- explanation 3 ------ 
Example - Insufficient Funds

Difficulty: EASY
Tags: Data structures
Skill types: Data structures

Starter code:

Solutions:
(X, Y) = map(float, input().split())
X = int(X)
if X + 0.5 <= Y and X % 5 == 0:
	print(float(Y - X - 0.5))
else:
	print(float(Y))


(x, y) = map(float, input().split())
x = int(x)
if x + 0.5 <= y and x % 5 == 0:
	acc_bal = y - x - 0.5
	print(float(acc_bal))
else:
	print(float(y))


(x, y) = map(float, input().split())
if x + 0.5 <= y and x % 5 == 0:
	print(format(y - x - 0.5, '.2f'))
else:
	print(format(y, '.2f'))


(n, atm) = map(float, input().split())
n = int(n)
if n + 0.5 <= atm and n % 5 == 0:
	print(float(atm - n - 0.5))
else:
	print(float(atm))
try:
	(x, y) = map(float, input().split())
	if x <= y - 0.5 and x % 5 == 0:
		print('%.2f' % (y - x - 0.5))
	else:
		print('%.2f' % y)
except:
	pass


(n, atm) = map(float, input().split())
n = int(n)
if n + 0.5 <= atm and n % 5 == 0:
	print(float(atm - n - 0.5))
else:
	print(float(atm))


(x, y) = list(map(float, input().split()))
if x + 0.5 <= y:
	if x % 5 == 0:
		print(y - x - 0.5)
	else:
		print(y)
else:
	print(y)


(withdraw, balance) = map(str, input().split())
withdraw = int(withdraw)
balance = float(balance)
if withdraw % 5 == 0 and balance >= withdraw + 0.5:
	print(balance - (withdraw + 0.5))
else:
	print(balance)


lst = list(map(float, input().split()))
x = lst[0]
y = lst[1]
x = int(x)
if x + 0.5 <= y and x % 5 == 0:
	y = y - (x + 0.5)
	print('{:.2f}'.format(y))
else:
	print('{:.2f}'.format(y))


a = input()

def words(valuestring):
	spacepos = valuestring.index(' ')
	return [valuestring[:spacepos], valuestring[spacepos + 1:]]
values = words(a)
wdrw = float(values[0])
balance = float(values[1])
if wdrw % 5 != 0 or wdrw + 0.5 > balance:
	print('{:.2f}'.format(balance))
else:
	print('{:.2f}'.format(balance - wdrw - 0.5))


try:
	(x, y) = map(float, input().split())
	if x <= y - 0.5 and x % 5 == 0:
		print('%.2f' % (y - x - 0.5))
	else:
		print('%.2f' % y)
except:
	pass


(X, Y) = map(float, input().split())
if X % 5 == 0 and X + 0.5 <= Y:
	new_balance = Y - X - 0.5
else:
	new_balance = Y
print('{:.2f}'.format(new_balance))