Tak z _FIXED_ by recursive

def T(x,y,z,C={}):t=x,y,z;C[t]=C.get(t,(x<=y)*z)or T(T(x-5,y,z),T(y-5,z,x),T(z-5,x,y));return C[t]
while 1:print T(*map(int,raw_input().split()))

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top