This problem should be classified as HARD


and here is my code in Python:
class Solution(object):
def canMeasureWater(self, x, y, z):
"""
:type x: int
:type y: int
:type z: int
:rtype: bool
"""
'''
ax + by = z
a(x + y) + (ba)y = z
'''
if z == 0:
return True
else:
passa = 1 b = 1 if x > y: a = x b = y else: a = y b = x if b == 0: if a != 0 and z%a == 0: return True else: return False else: pass if z > a + b: return False else: pass tmp = b while tmp != 0: tmp = a%b a = b b = tmp if z%a == 0: return True else: return False

@jedihy
It's just a math question. The solution is quite straightforward if the greatest common divisor calls to minds. Here is a very funny explanation https://www.youtube.com/watch?v=0Oef3MHYEC0