Added solution
Shorten tags
Added code to check if x and y are valid integers
Added comments
Added assumptions