Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
graph=[[False]*N for i in range(N)]
for i in range(N):
    a,b=list(map(int, input().split()))
    graph[a-1][b-1]=True
    graph[b-1][a-1]=True
visited=[False]*N
def dfs(v,visited):
    if all(visited):
        return 1
    ret=0
    for i in range(N):
        if not graph[v][i]:
            continue
        if visited[i]:
            continue
        visited[i]=True
        ret+=dfs(i,visited)
        visited[i]=False
    return ret
visited[0]=True
print(dfs(0,visited))

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(M):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(M):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(N):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
def DFS(idx,visited):
    visited.add(idx)
    for i in links[idx]:
        if i in visited:
            continue
        visi=set(visited)
        DFS(i,visi)
        if len(visi)==N:
            global ct
            ct+=1
DFS(1,set())
print(ct)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N,M=list(map(int,input().split()))
links=defaultdict(list)
for i in range(M):
    a,b=list(map(int, input().split()))
    links[a].append(b)
    links[b].append(a)
ct=0
visited=[False]*N
def DFS(idx):
    global visited
    if all(visited):
        global ct
        ct+=1
        return
    for i in links[idx]:
        if visited[i-1]:
            continue
        visited[i-1]=True
        DFS(i)
        visited[i-1]=False
visited[0]=True
DFS(1)
print(ct)