def s(a,b):
return 1+s(a-1,b) if a > 0 else s(a,b-1)+1 if b > 0 else 0
def d(a,b):
return 1+d(a-1,b) if a > 0 else d(a,b-1)-1 if b > 0 else 0
def a(l):
return 0 if l == [] else l[0] if l[1:] == [] else s(a([l[0]]),a(l[1:])) if d(l[1],l[0]) > 0 else a([l[0]])
in pseudocodice