Problem p02719 (python)

Fixed submission:
a=list(map(int, input().split()))
def d(a,b):
    _1=a%b
    _2=b-(a%b)
    if _1<_2:
        print(_1)
    else:
        print(_2)
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1:
    print(0)
    exit()
elif a[0]==0:
    print(0)
    exit()
elif a[1]==1:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            d(b-a,b)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1:
    print(0)
    exit()
elif a[0]==0:
    print(0)
    exit()
elif a[1]==1:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            print(l)
            d(b-a,b)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            print(l)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1:
    print(0)
    exit()
elif a[0]==0:
    print(0)
    exit()
elif a[1]==1:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1 or a[1]==1:
    print(0)
    exit()
elif a[0]==0:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1 or a[1]==1:
    print(0)
    exit()
elif a[0]==0:
    print(a[1])
    exit()
elif a[1]==0:
    print(a[0])
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1 or a[1]==1:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)>b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(min(l))
            exit()
    elif b<a:
        if min(l)>a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(min(l))
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
if a[0]==1 or a[1]==1:
    print(0)
    exit()
def d(a,b):
    if a<b:
        if min(l)!=b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(b-a)
            exit()
    elif b<a:
        if min(l)!=a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(a-b)
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
def d(a,b):
    if a==1 or b==1:
        return 0
    elif a<b:
        if min(l)!=b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            return b-a
    elif b<a:
        if min(l)!=a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            return a-b
print(d(a[0],a[1]))

Buggy submission (verdict: Runtime Error):
a=list(map(int, input().split()))
l=[a[0]]
def d(a,b):
    if a<b:
        if min(l)!=b-a:
            l.append(b-a)
            d(b-a,a)
        else:
            print(b-a)
            exit()
    elif b<a:
        if min(l)!=a-b:
            l.append(a-b)
            d(a-b,b)
        else:
            print(a-b)
            exit()
    else:
        print(0)
        exit()
d(a[0],a[1])