Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02689 (python)

Fixed submission:
N,M=map(int, input().split())
H=list(map(int, input().split()))

ans = [True]*N
ctr = 0

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    if H[a] >= H[b]: ans[b] = False
    if H[a] <= H[b]: ans[a] = False

for i in range(N):
    if ans[i]:
        ctr += 1

print(ctr)

Buggy submission (verdict: Runtime Error):
X=int(input())

for i in range(0, 1000):
    for j in range(-1000,0):
        if X == (i**5-j**5):
            print(i, j)
            exit()

Buggy submission (verdict: Runtime Error):
X=int(input())

for i in range(0, 1000):
    for j in range(-1000,0):
        if X == (i**5-j**5):
            print(i, j)
            exit()
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement as combr

N,M,Q = map(int, input().split())
a, b, c, d = [0]*Q, [0]*Q, [0]*Q, [0]*Q
for i in range(Q):
    a[i],b[i],c[i],d[i] = map(int, input().split())

ans = 0
# lis = list(range(1, M+1))
for pair in combr(range(1,M+1), N):
    tmp = 0
    pair = list(pair)
    for i in range(Q):
        if (pair[b[i]-1]-pair[a[i]-1]) == c[i]:
            tmp += d[i]
            
    ans=max(ans, tmp)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import itertools

N,M,Q = map(int, input().split())
a = [0]*Q
b = [0]*Q
c = [0]*Q
d = [0]*Q
for i in range(Q):
    a[i],b[i],c[i],d[i] = map(int, input().split())

maximum = 0
lis = list(range(1, M+1, 1))
for pair in itertools.combinations(lis, N):
    sum = 0
    pair = list(pair)
    for i in range(N):
        if pair[b[i]-1]-pair[a[i]-1] == c[i]:
            sum += d[i]
            
    if maximum < sum:
        maximum = sum

print(maximum)
Problem p02577 (python)

Fixed submission:
n=input()
ls=[]
for i in n:
    ls.append(int(i))
if sum(ls)%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=list(input())
if sum(n)%9==0:
  print("Yes")
else:
  print("No")
Problem p02659 (python)

Fixed submission:
a,b=map(float,input().split())
a=int(a)
print((round(b*100)*a)//100)

Buggy submission (verdict: Runtime Error):
a,b=map(float,input().split())
a=int(a)
print(math.trunc(a*b))
Problem p02688 (python)

Fixed submission:
l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  for j in num:
    kashi.append(j)
kashi=set(kashi)
print(n-len(kashi))

Buggy submission (verdict: Runtime Error):
l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  kashi.append(num)
kashi=set(kashi)
print(n-len(kashi))
Problem p02623 (python)

Fixed submission:
n, m, k = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))

nss = [0]
for i, v in enumerate(ns):
    nss.append(nss[i] + ns[i])

mss = [0]
for i, v in enumerate(ms):
    mss.append(mss[i] + ms[i])

mx = 0
j = m
for i in range(n + 1):
    if nss[i] > k:
        break

    while mss[j] > k - nss[i]:
        j -= 1
    
    mx = max(mx, i + j)

print(mx)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))

nss = [0]
for i, v in enumerate(ns): nss.append(nss[i] + ns[i])
mss = [0]
for i, v in enumerate(ms): mss.append(mss[i] + ms[i])

from bisect import bisect_left

mx = 0
for i in range(n + 1):
    if nss[i] > k:
        break

    v = k - nss[i]
    j = bisect_left(mss, v)
    print(i, nss, j, mss, k)
    if j < m and mss[j] != v:
        j -= 1

    mx = max(mx, i + j)

print(mx)

Buggy submission (verdict: Runtime Error):
n, m, k = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))

import pandas as pd
nss = pd.Series([0] + ns).cumsum()
mss = pd.Series([0] + ms).cumsum()

mx = 0
for i in range(n + 1):
    if nss[i] > k:
        break

    j = -1
    for v in mss:
        if nss[i] + v > k:
            break
        j += 1
    mx = max(mx, i + j)

print(mx)
Problem p02820 (python)

Fixed submission:
n=list(map(int,input().split()))
score=list(map(int,input().split()))
s=input()

def rscore(ss):
  if ss=='r':
    return score[2]
  elif ss=='s':
    return score[0]
  elif ss=='p':
    return score[1]

result=0
flg=[]
for i in range(n[1]):
  result+=rscore(s[i])
  flg.append(True)
for i in range(n[1],len(s)):
  if(s[i-n[1]]==s[i] and flg[i-n[1]]):
    flg.append(False)
    continue
  else:
    flg.append(True)
    result+=rscore(s[i])
print(result)

Buggy submission (verdict: Runtime Error):
n=list(map(int,input().split()))
score=list(map(int,input().split()))
s=input()

n[1]-=1

def rscore(ss):
  if ss=='r':
    return score[2]
  elif ss=='s':
    return score[0]
  elif ss=='p':
    return score[1]

result=0
flg=[]
for i in range(n[1]):
  result+=rscore(s[i])
  flg.append(True)
for i in range(n[1],len(s)):
  if(s[i-n[1]-1]==s[i] and flg[i-n[1]-1]):
    flg.append(False)
    continue
  else:
    flg.append(True)
    result+=rscore(s[i])
print(result)
Problem p03017 (python)

Fixed submission:
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if figure[3]>figure[4]:
  flg=True
  
for i in range(max(int(figure[3]),int(figure[4]))-1):
  if math[i]=='#' and math[i+1]=='#':
    if i>int(figure[1]) and i<int(figure[3])-1 or i>int(figure[2]) and i<int(figure[4])-1:
    	print('No')
    	exit()
    
  if flg and i>=int(figure[2])-2 and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if math[3]>math[4]:
  flg=True
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()
    
  if flg and i>=int(figure[2])-1 and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if math[3]>math[4]:
  flg=True
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()
    
  if flg and i>=int(figure[2]-1) and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
figure=input()
math=input()
flg=False
 
figure=figure.split(' ')
if math[3]>math[4]:
  print('a')
  flg=True
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()
    
  if flg and i<int(figure[4])-1 and math[i]=='.' and math[i+1]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
figure=input()
math=input()
flg=False

figure=figure.split(' ')
if math[3]>math[4]:
  flg=True
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()
    
  if flg and i<figure[4] and math[i]=='.' and math[i]=='.' and math[i+2]=='.':
    flg=False

if not flg:
	print('Yes')
Problem p02627 (python)

Fixed submission:

char = input()

flg = char.isupper()

if flg:
    print('A')
else:
    print('a')

Buggy submission (verdict: Runtime Error):
# coding: utf-8

N = int(input())
A = list(map(int, input().split()))

A.sort()

dict_a = dict()

for a in A:
    if not (a in dict_a):
        dict_a[a] = 1
    else:
        dict_a[a] += 1


Q = int(input())

B = []
C = []

sums = []
for i in range(Q):
    b, c = list(map(int, input().split()))
    B.append(b)
    C.append(c)

for b, c in zip(B, C):
    if (b in dict_a):
        num = dict_a[b]
    
        if not (c in dict_a):
            dict_a[c] = num
        else:
            dict_a[c] += num

        dict_a.pop(b)

    keys = dict_a.keys()
    vals = dict_a.values()

    sumval = 0
    for k, v in zip(keys, vals):
        sumval += k * v

    print(sumval)
Problem p02793 (python)

Fixed submission:
import functools

MOD = 10**9 + 7


def lcm(a, b) -> int:
    c, d = a, b
    while d != 0:
        c, d = d, c % d
    return a // c * b


def inv_mod(x):
    return pow(x, MOD - 2)


def pow(x: int, n: int) -> int:
    res = 1
    while n > 0:
        if n & 1 == 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1

    return res


def main():
    N = int(input())
    an = list(map(int, input().split()))

    lcm_an = functools.reduce(lcm, an)
    lcm_an %= MOD

    ans = 0
    for a in an:
        ans = (ans + lcm_an * inv_mod(a)) % MOD

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
const MOD: i64 = 1_000_000_007;


fn gcd(a: i64, b: i64) -> i64 {
    let (mut a, mut b) = (a, b);
    while b != 0 {
        let tmp = a - (a / b) * b;
        a = b;
        b = tmp;
    }
    a
}


fn lcm(iterable: &Vec<i64>) -> i64 {
    let mut a = iterable[0];

    for b in iterable.iter() {
        a = a * b / gcd(a, *b)
    }
    a

}


fn main() {
    let n: i64 = read();
    let an: Vec<i64> = read_vec();

    let lcm_an = lcm(&an);

    let mut ans = 0;
    for a in an.iter() {
        ans += lcm_an / a;
        ans %= MOD;
    }

    println!("{}", ans);

}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
Problem p02627 (python)

Fixed submission:
x = input()
if x.upper() == x:
    print("A")
else:
    print("a")

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%10 in (2,4,5,7,9):
    print ('hon')
elif n%10 in (0,1,6,8):
    print ('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env pypy3
n=int(input())
if n%10 in (2,4,5,7,9):
    print ('hon')
elif n%10 in (0,1,6,8):
    print ('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
n = int(input())

keta = 0
tmp = 26
beki = [26]

while True:
    if n <= beki[-1]:
        break
    tmp *= 26
    beki.append(beki[-1] + tmp)
    keta += 1
n_tmp = n
ans_num = []

n_tmp -= beki[keta - 1] + 1
for i in range(keta):
    waru = 26**(keta - i)
    x = (n_tmp) // waru
    ans_num.append(x)
    n_tmp -= x * waru

ans_num.append(n_tmp)
ans = ''

for d in ans_num:
    ans += chr(d + 97)

if n <= 26:
    print(chr(n + 96))
else:
    print(ans)
Problem p02987 (python)

Fixed submission:
a=input()
ret = True
for s in a:
	sum = 0
	for t in a:
		if s==t:
			sum += 1
	if sum != 2:
		ret = False
if ret:
	print("Yes")
else:
	print ("No")

Buggy submission (verdict: Runtime Error):
a=input()
ret = True
for s in a:
	sum = 0
	for t in _in:
		if s==t:
			sum += 1
	if sum != 2:
		ret = False
if ret:
	print("Yes")
else:
	print ("No")
Problem p02623 (python)

Fixed submission:
n,m,k=map(int, input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
import bisect
AR=[0]
BR=[0]
for i in range(n):
	AR.append(A[i]+AR[i])
for i in range(m):
	BR.append(B[i]+BR[i])

ans=0
for i in range(n+1):
	if AR[i]>k:
		break
	s=k-AR[i]
	t=bisect.bisect(BR,s)-1
	ans=max(ans,i+t)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
a=0
b=0
cnt=0
for i in range(max(n+1,m+1)):
	if min(A[a],B[b])>k:
		break
	if A[a]>=B[b]:
		k-=B[b]
		b+=1
		cnt+=1
	else:
		k-=A[a]
		a+=1
		cnt+=1
print(cnt)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s==u:
	print(a-1, b)
elif t==u:
	print(a, b-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s==u:
	print((a-1)+' '+b)
elif t==u:
	print(a+' '+(b-1))
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())

print(6-(a+b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
import math
print(a*b/math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
import math
print(a*b/math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
a, b = map(int, intput().split())
import math
print(a*b//math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
n = int(input())
S = list(input().split())
T = list(input().split())

ans=""

for i in range(n)
	ans+=S[i]+T[i]

print(ans)
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())

x = []
y = []
sum = 0

#座標入力
for i in range(n):
	a, b = map(int, input().split())
	x.append(a)
	y.append(b)

#距離の総和
for i in range(n):
	for j in range(n):
		num = math.factorial(n-1)									
		dist = ((x[i-1]-x[j-1])^2+(y[i-1]-y[j-1])^2)**0.5
		sum+= num*dist

print(sum/math.factorial(n))

Buggy submission (verdict: Runtime Error):
r = int(input())
ptint(r**2)

Buggy submission (verdict: Runtime Error):
r = int(input())
ptinr(r**2)
Problem p03208 (python)

Fixed submission:
n ,k =map(int, input().split())
S=[]

def merge(array):                                   # line1
    mid = len(array)                                # line2
    if mid > 1:                                     # line3
        left = merge(array[:(mid//2)])               # line4
        right = merge(array[(mid//2):])              # line5
        array = []                                  # line6
        while len(left) != 0 and len(right) != 0:   # line7
            if left[0] < right[0]:                  # line8
                array.append(left.pop(0))           # line9
            else:                                   # line10
                array.append(right.pop(0))          # line11
        if len(left) != 0:                          # line12
            array.extend(left)                      # line13
        elif len(right) != 0:                       # line14
            array.extend(right)                     # line15
    return array



for i in range(n):
	a=int(input())
	S.append(a)
L=merge(S)

ans=-L[0]+L[n-1]
for i in range(n-k+1):
	if -L[i]+L[i+k-1]<ans:
		ans=-L[i]+L[i+k-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n ,k =map(int, input().split())
S=[]

def merge(array):                                   # line1
    mid = len(array)                                # line2
    if mid > 1:                                     # line3
        left = merge(array[:(mid//2)])               # line4
        right = merge(array[(mid//2):])              # line5
        array = []                                  # line6
        while len(left) != 0 and len(right) != 0:   # line7
            if left[0] < right[0]:                  # line8
                array.append(left.pop(0))           # line9
            else:                                   # line10
                array.append(right.pop(0))          # line11
        if len(left) != 0:                          # line12
            array.extend(left)                      # line13
        elif len(right) != 0:                       # line14
            array.extend(right)                     # line15
    return array



for i in range(n):
	a=int(input())
	S.append(a)
L=merge(S)
#print(L)
ans=-L[0]+L[n-1]
for i in range(k):
	if -L[i]+L[i+k-1]<ans:
		ans=-L[i]+L[i+k-1]
print(ans)
Problem p03634 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n= int(input())
G=[[] for i in range(n+1)]

for i in range(n-1):
	a,b,c=map(int, input().split())
	G[a].append([b,c])
	G[b].append([a,c])

q,k=map(int,input().split())


D=[None]*(n+1)
 
def dfs(x,d):
    D[x]=d
    for yy,dd in G[x] :
        if D[yy] is not None:
            continue
        dfs(yy,dd+d)
dfs(k,0)

for i in range(q):
    x, y = map(int, input().split())
    print(D[x] + D[y])

Buggy submission (verdict: Runtime Error):
n= int(input())
G=[[] for i in range(n+1)]

for i in range(n-1):
	a,b,c=map(int, input().split())
	G[a].append([b,c])
	G[b].append([a,c])

q,k=map(int,input().split())


D=[None]*(n+1)
 
def dfs(x,d):
    D[x]=d
    for yy,dd in G[x] :
        if D[yy] is not None:
            continue
        dfs(yy,dd+d)
dfs(k,0)

for i in range(q):
    x, y = map(int, input().split())
    print(D[x] + D[y])
Problem p02819 (python)

Fixed submission:
x = int(input())

d = 2

ans = 2

if x != 2:
  while d <= 1+x//2:
    if x%d == 0:
      x += 1
      d = 2
    else:
      if d == 1+x//2:
        ans = x
        break
      else:
        d += 1
  print(ans)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())

d = 2

while d < 1+x//2:
  if x%d == 0:
    x += 1
    d = 2
  else:
    if d == 1+x//2:
      ans = x
      break
    else:
      d += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(input())

d = 2

while d < 1+x//2:
  if x%d == 0:
    x += 1
    d = 1
  else:
    if d == 1+x//2:
      ans = x
      break
    else:
      d += 1
print(ans)
Problem p02836 (python)

Fixed submission:
def main():
    s = input()
    m = len(s)//2
    ans = 0
    if len(s)%2 == 0:
        a = s[:m]
        b = s[m:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)
    else:
        a = s[:m]
        b = s[m+1:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    m = len(s)//2
    ans = 0
    if m%2 == 0:
        a = s[:m]
        b = s[m:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)
    else:
        a = s[:m]
        b = s[m+1:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)


if __name__ == "__main__":
    main()
Problem p02951 (python)

Fixed submission:
a,b,c = map(int, input().split())

ans = 0

if a < b+c:
  ans = c-(a-b)

print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c = map(nt, input().split())

ans = a

if a > b+c:
  ans = b+c

print(ans)
Problem p03072 (python)

Fixed submission:
n = int(input())
h = input().split()
 
ans = 1
m = n-1
high = int(h[0])
 
for i in range(m):
    if int(h[i+1]) >= high:
        ans += 1
        high = int(h[i+1])
    else:
        continue
        
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()
hl = [0]*n
 
for i in range(n):
  hi = h[i]
  hl[i] = int(hi)
 
ans = 1
m = n - 1
high = hl[0]
 
for i in range(m):
  if hl[i+1] >= high:
    ans += 1
    high = hl[i+1]
   else:
    continue
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()
hl = [0]*n
 
for i in range(n):
  hi = h[i]
  hl[i] = int(hi)
 
ans = 1
m = n - 1
high = hl[0]
 
for i in range(m):
  if hl[i+1] >= high:
    ans += 1
    high = hl[i+1]
   else:
    continue
 
print(ans)
n = input()
h = input().split()
hl = [0]*n

for i in range(n):
  hi = h[i]
  hl[i] = int(hi)

ans = 1
m = n - 1
high = hl[0]
 
for i in range(m):
  if hl[i+1] >= high:
    ans += 1
    high = hl[i+1]
   else:
    continue
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
h = input().split()
hl = [0]*n

for i in range(n):
  hi = h[i]
  hl[i] = int(hi)

ans = 1
m = n - 1
high = hl[0]
 
for i in range(m):
  if hl[i+1] >= high:
    ans += 1
    high = hl[i+1]
   else:
    continue
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = input().split()

ans = 1
m = n - 1
high = int(h[0])

for i in range(m):
  if int(h[i+1]) >= high:
    ans += 1
    high = int(h[i+1])
   else:
    continue

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split())

ans = 1
m = n-1
high = h[0]

for i in range(m):
    if h[i+1] >= high:
        ans += 1
        high = h[i+1]
    else:
        continue
        

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = map(int, input().split())

ans = 1
m = n-1
high = ih[0]

for i in range(m):
    if h[i+1] >= high:
        ans += 1
        high = h[i+1]
    else:
        continue
        

print(ans)
Problem p03803 (python)

Fixed submission:
a,b = map(int, input().split())
if a == 1:
    if b == 1:
        print("Draw")
    else:
        print("Alice")
else:
    if a == b:
        print("Draw")
    elif b == 1:
        print("Bob")
    elif a > b:
        print("Alice")
    else:
        print("Bob")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
if a == 1:
  if b == 1:
    print("Draw")
    exit()
  else:
  	print("Alice")
    exit()
else:
  if a == b:
    print("Draw")
    exit()
  elif a > b:
    print("Alice")
    exit()
  else:
    print("Bob")
    exit()
Problem p03805 (python)

Fixed submission:
N, M = list(map(int, input().split()))

ans = 0

def dfs(n, visited):
    global ans
    visited.append(n)
    if len(visited) == N:
        ans += 1
    else:
        for i in l[n-1]:
            if i not in visited:
                dfs(i, visited)
    visited.remove(n)

l = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    l[a-1].append(b)
    l[b-1].append(a) 

dfs(1, [])
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ls = [tuple(map(int, input().split())) for _ in range(m)]
neighborls = []
for i in range(1,n+1):
    neighbors = []
    for j in range(1, m+1):
        if (i,j) in ls or (j,i) in ls:
            neighbors.append(j)
    neighborls.append(neighbors)

ans = 0

def main():
    global ans
    visitedls = [1]
    ans = dfs(1, visitedls, ans)

    print(ans)
    
        
def dfs(a, visitedls, ans):
    global ans
    if len(visitedls) == n:
        ans += 1
    for i in range(1,n+1):
        if i not in visitedls and i in neighborls[a-1]:
            visitedls.append(i)
            ans = dfs(i, visitedls, ans)
            visitedls.remove(i)
    return ans


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
ls = [tuple(map(int, input().split())) for _ in range(m)]
neighborls = []
for i in range(1,n+1):
    neighbors = []
    for j in range(1, m+1):
        if (i,j) in ls or (j,i) in ls:
            neighbors.append(j)
    neighborls.append(neighbors)

ans = 0

def main():
    visitedls = [1]
    ans = dfs(1, visitedls, ans)

    print(ans)
    
        
def dfs(a, visitedls, ans):
    if len(visitedls) == n:
        ans += 1
        return ans
    for i in range(1,n+1):
        if i not in visitedls and i in neighborls[a-1]:
            visitedls.append(i)
            ans = dfs(i, visitedls, ans)
            visitedls.remove(i)
    return ans


if __name__ == "__main__":
    main()