Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
pair=[i for i in range(n)]
a=[0]*n
b=[0]*n
for i in range(m):
    ai,bi=map(int,input().split())
    a[i]=ai-1
    b[i]=bi-1
    
def root(x):
    if x==pair[x]:
        return x
    else:
        tmp=root(pair[x])
        pair[x]=tmp
        return tmp

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y:return
    pair[x]=y

icnt=0
for i in range(m):
    pair=[i for i in range(n)]
    for ii in range(m):
        if ii==i:
            continue
        unite(a[ii],b[ii])

    l=[root(ii) for ii in range(n)]
#    print(i,l)
    lenpair=len(set(l))    
    if lenpair!=1:
        icnt+=1

print(icnt)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)

n,m=map(int,input().split())
pair=[i for i in range(n)]
a=[0]*n
b=[0]*n
for i in range(m):
    ai,bi=map(int,input().split())
    a[i]=ai-1
    b[i]=bi-1
    
def root(x):
    if x==pair[x]:
        return x
    else:
        tmp=root(pair[x])
        pair[x]=tmp
        return tmp

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y:return
    pair[x]=y

icnt=0
for i in range(m):
    pair=[i for i in range(n)]
    for ii in range(m):
        if ii==i:
            continue
        unite(a[ii],b[ii])

    l=[root(ii) for ii in range(n)]
#    print(i,l)
    lenpair=len(set(l))    
    if lenpair!=1:
        icnt+=1

print(icnt)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**7)

n,m=map(int,input().split())
pair=[i for i in range(n)]
a=[0]*n
b=[0]*n
for i in range(m):
    ai,bi=map(int,input().split())
    a[i]=ai-1
    b[i]=bi-1
    
def root(x):
    if x==pair[x]:
        return x
    else:
        tmp=root(pair[x])
        pair[x]=tmp
        return tmp

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y:return
    pair[x]=y

icnt=0
for i in range(m):
    pair=[i for i in range(n)]
    for ii in range(m):
        if ii==i:
            continue
        unite(a[ii],b[ii])

    l=[root(ii) for ii in range(n)]
#    print(i,l)
    lenpair=len(set(l))    
    if lenpair!=1:
        icnt+=1

print(icnt)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)

Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

n,m=map(int,input().split())
pair=[i for i in range(n)]
a=[0]*n
b=[0]*n
for i in range(m):
    ai,bi=map(int,input().split())
    a[i]=ai-1
    b[i]=bi-1
    
def root(x):
    if x==pair[x]:
        return x
    else:
        tmp=root(pair[x])
        pair[x]=tmp
        return tmp

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y:return
    pair[x]=y

icnt=0
for i in range(m):
    pair=[i for i in range(n)]
    for ii in range(m):
        if ii==i:
            continue
        unite(a[ii],b[ii])

    l=[root(ii) for ii in range(n)]
#    print(i,l)
    lenpair=len(set(l))    
    if lenpair!=1:
        icnt+=1

print(icnt)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)

Buggy python submission (verdict: Runtime Error):
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.appned(ai)
        b.appned(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                for v2 in vtx1:
                    if v1!=v2:
                        if b1[i] in v2:
                            break
                if v1!=v2:
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)        
#for i in range(m):
#    for v1 in vtx1:
#        if a[i] in v1:
#            for v2 in vtx1:
#                if v1!=v2:
#                    if b[i] in v2:
#                        break
#            if v1!=v2:
#                vtx1.remove(v1)
#                vtx1.remove(v2)
#                v3=v1+v2
#                vtx1.append(v3)
#    print(a[i],b[i],len(vtx1),vtx1)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)

Buggy python submission (verdict: Runtime Error):
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.appned(ai)
        b.appned(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                for v2 in vtx1:
                    if v1!=v2:
                        if b1[i] in v2:
                            break
                if v1!=v2:
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)        
#for i in range(m):
#    for v1 in vtx1:
#        if a[i] in v1:
#            for v2 in vtx1:
#                if v1!=v2:
#                    if b[i] in v2:
#                        break
#            if v1!=v2:
#                vtx1.remove(v1)
#                vtx1.remove(v2)
#                v3=v1+v2
#                vtx1.append(v3)
#    print(a[i],b[i],len(vtx1),vtx1)


Fixed submission:
icase=0
if icase==0:
    n,m=map(int, input().split())
    a=[]
    b=[]
    for i in range(m):
        ai,bi=map(int, input().split())
        a.append(ai)
        b.append(bi)
elif icase==1:
    n=6
    m=5
#    a=[[1],[2],[3],[4],[5]]
#    b=[[2],[3],[4],[5],[6]]
    a=[1,2,3,4,5]
    b=[2,3,4,5,6]
elif icase==2:
    n=7
    m=7
    a=[1,2,3,4,4,5,6]
    b=[3,7,4,5,6,6,7]

    
vtx=[]
for i in range(n):
    vtx.append([i+1])
icnt=0

for j in range(m):    
    vtx1=vtx.copy()
    a1=a.copy()
    b1=b.copy()
    del a1[j]
    del b1[j]
    
    for i in range(m-1):
        for v1 in vtx1:
            if a1[i] in v1:
                if not b1[i] in v1:
                    for v2 in vtx1:
                        if v1!=v2:
                            if b1[i] in v2:
                                break
                    vtx1.remove(v1)
                    vtx1.remove(v2)
                    v3=v1+v2
                    vtx1.append(v3)
#        print(a[i],b[i],len(vtx1),vtx1)
#    print(len(vtx1),vtx1)
    if len(vtx1)!=1:
        icnt=icnt+1
print(icnt)