Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

min_a = min(a)
x = [i for i in range(min_a, max(a)+1)]
for i in range(n):
   if x[a[i]-min_a] == -1:
      print('NO')
      exit()
   else:
      x[a[i]-min_a] = -1

print('YES')


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

a.sort()
for i in range(n-1):
   if a[i] == a[i+1]:
      print('NO')
      exit()

print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))

maxe = 0


for i in range(n-k+1):
   e = 0
   for j in range(i, i+k):
      e += sum([k for k in range(1, p[j]+1)])/p[j]

   maxe = max(maxe, e)

print(maxe)


Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))

m = [(e + 1)/ 2 for e in p]

t = sum(m[0:k])
result = t
for i in range(n-k):
   t -= m[i]
   t += m[i+k]
   if t > result:
      result = t

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(x) for x in input().split()]

c = [1 if p[i] == min(p[:i+1]) else 0 for i in range(n)]
print(sum(c))


Fixed submission:
n = int(input())
p = [int(x) for x in input().split()]

ans = 1
minp = p[0]
for i in range(1, n):
   if (p[i] <= minp):
      minp = p[i]
      ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
for i in range(n):
   q = p[:i+1]
   if (q[i] == min(q)):
      ans += 1

print(ans)


Fixed submission:
n = int(input())
p = [int(x) for x in input().split()]

ans = 1
minp = p[0]
for i in range(1, n):
   if (p[i] <= minp):
      minp = p[i]
      ans += 1

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

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x-l, x+l]
r.sort()


while (1):
   ok = len(r)

   for i in range(0, len(r)):
      if (i==0):
         if (r[i][1] > r[i+1][0]):
            ok -= 1
            break
      elif (i==len(r)-1):
         if (r[i][0] > r[i-1][1]):
            ok -= 1
            break
      elif (r[i][0] > r[i-1][1] or r[i][1] > r[i+1][0]):
         ok -= 1
         break

   if (ok == len(r) or ok == 1):
      print(ok)
      exit()
   else:
      r.pop(i)


Fixed submission:
n = int(input())

r = [[0, 0]] * n
for i in range(n):
   x, l = map(int, input().split())
   r[i] = [x+l, x-l]
r.sort()

cur = -1000000000
ans = 0
for i in range(n):
   if (cur <= r[i][1]):
      ans += 1
      cur = r[i][0]

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
   if not ac[p]:
      wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
      print(*[a, b])


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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
x = [input().split() for i in range(m)]

y = ['WA' if (x[i][1]=='WA' and i<x.index([x[i][0], 'AC'])) else 'AC' if (x[i][1]=='AC' and i==x.index(x[i])) else 'None' for i in range(m)]
print(y.count('AC'), y.count('WA'))


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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
x = []
y = []
ac = 0
wa = 0
for i in range(m):
   p, s = map(str, input().split())
   p = int(p)
   if (s == 'AC' and [p, s] not in y):
      y.append([p, s])
      x.append(s)
   elif (s == 'WA' and [p, 'AC'] not in y):
      y.append([p, s])
      x.append(s)
print(x.count('AC'), x.count('WA'))


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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
x = []
for i in range(m):
   p, s = map(str, input().split())
   x.append([int(p), s])

y = []
ac = 0
wa = 0
for p, s in x:
   if (s == 'AC' and [p, s] not in y):
      y.append([p, s])
      ac += 1
   elif (s == 'WA' and [p, 'AC'] not in y):
      y.append([p, s])
      wa += 1
print(ac, wa)


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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

count = 0
for i in range(0, len(s)-2):
   if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
      count += 1
print(count)


Fixed submission:
k, x = map(int, input().split())

if (500 * k >= x):
   print('Yes')
else:
   print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

count = 0
for i in range(0, len(s)):
   if(s[i] == 'A' and s[i+1] == 'B' and s[i+2] == 'C'):
      count += 1
print(count)


Fixed submission:
n = int(input())
s = input()

print(s.count('ABC'))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

print(sum([i for i in range(1, n)]))


Fixed submission:
n = int(input())

ans = n * (n // 2)
if (n - 1) % 2 == 0:
   print(ans)
else:
   print(ans - int(n / 2))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

q = [i for i in range(1, n+1)]
p = [1 if i == n+1 else i for i in range(2, n+2)]

print(sum([x%y for x, y in zip(q, p)]))


Fixed submission:
n = int(input())

ans = n * (n // 2)
if (n - 1) % 2 == 0:
   print(ans)
else:
   print(ans - int(n / 2))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [sorted(list(input())) for _ in range(n)]

ans = 0
for i in range(n):
   for j in range(i+1, n):
      if s[i] == s[j]:
         ans += 1

print(ans)


Fixed submission:
import collections

n = int(input())
s = [''.join(sorted(input())) for _ in range(n)]

c = collections.Counter(s)

ans = 0
for i in set(s):
   n = c[i]
   ans += n * (n - 1) // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]

b = sorted(a, reverse=True)
for x in a:
   if x == max(a):
      print(b[1])
   else:
      print(b[0])


Fixed submission:
n = int(input())
A = [int(input()) for x in range(n)]

right = [0]
left = [0]

for a in A:
   left.append(max(a, left[-1]))

for a in reversed(A):
   right.append(max(a, right[-1]))

for i in range(n):
   print(max(left[i], right[n-i-1]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for x in range(n)]

import copy

for i in range(n):
   b = copy.deepcopy(a)
   b.pop(i)
   print(max(b))


Fixed submission:
n = int(input())
A = [int(input()) for x in range(n)]

right = [0]
left = [0]

for a in A:
   left.append(max(a, left[-1]))

for a in reversed(A):
   right.append(max(a, right[-1]))

for i in range(n):
   print(max(left[i], right[n-i-1]))
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
card = [i for i in range(1, n+1)]
for _ in range(m):
   l, r = map(int, input().split())
   x = [i for i in range(l, r+1)]
   card = list(set(card) & set(x))

print(len(card))


Fixed submission:
n, m = map(int, input().split())
L = 1
R = n
for _ in range(m):
   l, r = map(int, input().split())
   L = max(L, l)
   R = min(R, r)

if (L <= R):
   print(R - L + 1)
else:
   print(0)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
from functools import reduce
from itertools import combinations

n = int(input())
a = [int(x) for x in input().split()]

b = list(combinations(a, n-1))

gcd_a = [reduce(gcd, list(x)) for x in b]
print(max(gcd_a))


Fixed submission:
from fractions import gcd
from functools import reduce

n = int(input())
a = [int(x) for x in input().split()]

left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
   left[i+1] = gcd(left[i], a[i])
   right[n-i-1] = gcd(right[n-i], a[n-1-i])

ans = 0
for i in range(n):
   ans = max(ans, gcd(left[i], right[i+1]))
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
from itertools import combinations

n = int(input())
a = [int(x) for x in input().split()]

b = list(combinations(a, n-1))

gcd_a = [reduce(gcd, list(x)) for x in b]
print(max(gcd_a))


Fixed submission:
from fractions import gcd
from functools import reduce

n = int(input())
a = [int(x) for x in input().split()]

left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
   left[i+1] = gcd(left[i], a[i])
   right[n-i-1] = gcd(right[n-i], a[n-1-i])

ans = 0
for i in range(n):
   ans = max(ans, gcd(left[i], right[i+1]))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

count = 0
while ('01' in s or '10' in s and len(s) > 0):
   if ('01' in s):
      s = s.replace('01', '', 1)
   else:
      s = s.replace('10', '', 1)
   count += 2

print(count)


Fixed submission:
s = input()

ans = 2 * min(s.count('0'), s.count('1'))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()
ans = 10**9
for i in range(0, n-k+1):
   hmax = max(h[i:i+k])
   hmin = min(h[i:i+k])
   if (hmax - hmin < ans):
      ans = hmax - hmin

print(ans)


Fixed submission:
n, k = map(int, input().split())
height = [int(input()) for _ in range(n)]

height.sort()

diff = [height[i+k-1] - h for i, h in enumerate(height) if i+k-1 < len(height)]
print(min(diff))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()
ans = 10**9
for i in range(0, n-k+1):
   x = h[i:i+k]
   if (max(x) - min(x) < ans):
      ans = max(x) - min(x)

print(ans)


Fixed submission:
n, k = map(int, input().split())
height = [int(input()) for _ in range(n)]

height.sort()

diff = [height[i+k-1] - h for i, h in enumerate(height) if i+k-1 < len(height)]
print(min(diff))
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce

n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

print(reduce(math.gcd, x))


Fixed submission:
from fractions import gcd

n, X = map(int, input().split())
x = list(map(int, input().split()))

z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, n):
   ans = gcd(ans, z[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

import math
from functools import reduce

def gcd(*numbers):
   return reduce(math.gcd, numbers)

print(gcd(*x))


Fixed submission:
from fractions import gcd

n, X = map(int, input().split())
x = list(map(int, input().split()))

z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, n):
   ans = gcd(ans, z[i])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
a = []
for i in range(h):
   tmp = input()
   a.append(tmp)

for i in range(h):
   for j in range(w):
      row = [x.count('.') for x in a]
      a = [x for x, k in zip(a, row) if k < len(x)]

      b = [list(x) for x in zip(*a)]
      line = [x.count('.') for x in b]
      b = [x for x, k in zip(b, line) if k < len(x)]
      a = [list(x) for x in zip(*b)]

for i in range(len(a)):
   for j in range(len(a[i])):
      print(a[i][j], end='')
   print()


Fixed submission:
h, w = map(int, input().split())
a = []
for i in range(h):
   tmp = input()
   a.append(tmp)

for i in range(0, max(h, w)):
   row = [x.count('.') for x in a]
   a = [x for x, k in zip(a, row) if k < len(x)]

   b = [list(x) for x in zip(*a)]
   line = [x.count('.') for x in b]
   b = [x for x, k in zip(b, line) if k < len(x)]
   a = [list(x) for x in zip(*b)]

for i in range(len(a)):
   for j in range(len(a[i])):
      print(a[i][j], end='')
   print()
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

x = int(s[0])
if (x == 1):
   print(s[1])
else:
   print(s[0])


Fixed submission:
s = input()
k = int(input())

c1 = False
for i in range(k):
   x = s[i]
   if (x == '1'):
      c1 = True

   else:
      print(x)
      exit()

if (c1):
   print('1')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]

ans = 0
while (1):
   b = [x % 2 for x in a]
   if (0 not in b):
      break

   c = b.index(0)
   a = [int(a[i]/2) if i == c else a[i] for i in range(n)]
   ans += 1

print(ans)


Fixed submission:
n = int(input())
a = [int(x) for x in input().split()]

ans = 0
while (1):
   b = [x % 2 for x in a]
   ans += b.count(0)
   if (0 not in b):
      break

   a = [int(a[i]/2) if b[i]==0 else a[i] for i in range(n)]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

if ((b-a)+1 >= 2*k):
   c = [x for x in range(a, b+1)]
   for i in range(0, k):
      print(c[i])
   for i in reversed(range(1, k+1)):
      print(c[-i])
else:
   c = [print(x) for x in range(a, b+1)]


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

if ((b-a)+1 >= 2*k):
   c1 = [print(x) for x in range(a, a+k)]
   c2 = [x for x in reversed(range(b+1-k, b+1))]
   c2.sort()
   for i in c2:
      print(i)
else:
   c = [print(x) for x in range(a, b+1)]
Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())

for nx in range(n+1):
   for ny in range(n-i+1):
      if (1000 * nx + 5000 + ny * 1000 * (n - nx - ny) == y):
         print(nx, ny, n - nx - ny)
         exit()

print(-1, -1, -1)


Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
   for j in range(n-i+1):
      if (10000 * i + 5000 * j + 1000 * (n - i - j) == y):
         print(i, j, n - i - j)
         exit()

print(-1, -1, -1)

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())
y = int(y / 1000)

xmax = int(y / 10)
ymax = int(y / 5)
zmax = y

for nx in reversed(range(0, xmax+1)):
   for ny in reversed(range(0, ymax+1)):
      nz = n - nx - ny
      yy = 10 * nx + 5 * ny + nz
      if (nz >= 0 and nz <= zmax and yy == y):
         print(nx, ny, nz)
         exit()

print(-1, -1, -1)


Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
   for j in range(n-i+1):
      if (10000 * i + 5000 * j + 1000 * (n - i - j) == y):
         print(i, j, n - i - j)
         exit()

print(-1, -1, -1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for _ in range(n)]

c = [a.count(x) for x in set(a)]
print(len([x for x in c if x % 2 == 1]))


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

y = a[0]
c = 1
ans = 0
for i in range(1, n):
   if (a[i] == y):
      c += 1
   else:
      if (c % 2 == 1):
         ans += 1
      y = a[i]
      c = 1

if (c % 2 == 1):
   ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for _ in range(n):
   x = int(input())
   if x in a:
      a.pop(a.index(x))
   else:
      a.append(x)
print(len(a))


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()

y = a[0]
c = 1
ans = 0
for i in range(1, n):
   if (a[i] == y):
      c += 1
   else:
      if (c % 2 == 1):
         ans += 1
      y = a[i]
      c = 1

if (c % 2 == 1):
   ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

if n == 2:
   print(abs(a[0]-a[1]))
   exit()

ans = 10**10
for i in range(1, n-1):
   tmp = abs(sum(a[:i]) - sum(a[i:]))
   ans = min(tmp, ans)
print(ans)


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

x = a[0]
y = sum(a[1:])
ans = abs(x - y)
for i in range(1, n-1):
   x += a[i]
   y -= a[i]
   ans = min(abs(x-y), ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
b = []
for i in range(n):
   a.append(int(input()))
   b.append(0)

# 1: now, -1: visited, 0: none
b[0] = 1
now = 0
count = 0
while (b[1] != 1 and count <= n):
   next = a[now] - 1

   if (b[next] == -1):
      print(-1)
      exit()

   b[now] = -1
   b[next] = 1

   now = next
   count += 1

if (b[1] == 1):
   print(count)
else:
   print(-1)


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

now = b - a
if (now <= 0):
   print('delicious')
elif (now > 0 and now <= x):
   print('safe')
else:
   print('dangerous')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
for i in range(n):
   a.append(int(input()))
   b.append(0)

# 1: now, -1: visited, 0: none
b[0] = 1
now = 0
count = 0
while (b[1] != 1):
   next = a[now] - 1

   if (b[next] == -1):
      print(-1)
      exit()

   b[now] = -1
   b[next] = 1

   now = next
   count += 1

print(count)


Fixed submission:
n = int(input())
a = []
b = []
for i in range(n):
   a.append(int(input()))
   b.append(0)

# 1: now, -1: visited, 0: none
b[0] = 1
now = 0
count = 0
while (b[1] != 1 and count <= n):
   next = a[now] - 1

   if (b[next] == -1):
      print(-1)
      exit()

   b[now] = -1
   b[next] = 1

   now = next
   count += 1

if (b[1] == 1):
   print(count)
else:
   print(-1)
Buggy python submission (verdict: Runtime Error):
ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)


Fixed submission:
n = int(input())
a = [int(int(x)/400) for x in input().split()]
b = [x if x <= 7 else 8 for x in a]

ans = len(set(b))
if (8 in b):
   ans -= 1
   ans2 = b.count(8) + ans
   if (ans == 0):
      print(1, ans2)
   else:
      print(ans, ans2)
else:
   print(ans, ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
array = []
for i in range(n):
   a, b = map(int, input().split())
   array.extend([a for _ in range(b)])

array.sort()
print(array[k-1])


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

x = [0 for _ in range(0, 100001)]

for i in range(n):
   a, b = map(int, input().split())
   x[a] += b

l = 0
for i in range(1, 100001):
   if (l < k and (l + x[i]) >= k ):
      print(i)
      exit()

   l += x[i]
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

a = []
for i in range(n):
   a.append(input())

b = []
for i in range(m):
   b.append(input())

def func(base, target):
       for i in range(n-m+1):
        check = base[i:i+m]
        for j in range(n-m+1):
            check2 = [line[j:j+m] for line in check]
            if check2 == target:
                return print('Yes')
    return print('No')

func(a,b)


Fixed submission:
n, m = map(int, input().split())

a = []
for i in range(n):
   a.append(input())

b = []
for i in range(m):
   b.append(input())

def func(base, target):
   for i in range(n-m+1):
      check = base[i:i+m]
      for j in range(n-m+1):
         check2 = [line[j:j+m] for line in check]
         if check2 == target:
            return print('Yes')
   return print('No')

func(a,b)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
edge = [[0] * n for _ in range(n)]
for i in range(n):
   a, b = map(int, input().split())
   edge[a-1][b-1] = 1
   edge[b-1][a-1] = 1

# depth-first search
def dfs(now, visited):
   if (False not in visited):
      return(1)

   ans = 0
   for i in range(1, n+1):
      if (edge[now-1][i-1] == 1  and visited[i-1] == False):
         visited[i-1] = True
         # recursive
         ans += dfs(i, visited)
         visited[i-1] = False

   return(ans)

visited = [False] * n
visited[0] = True
print(dfs(1, visited))


Fixed submission:
n, m = map(int, input().split())
g = [[] for i in range(n)]

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

def dfs(v):
   if (len(v) == n):
      return 1

   ans = 0
   for u in set(g[v[-1]]) - set(v):
      ans += dfs(v + [u])

   return ans

print(dfs([0]))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
edge = [[0] * n for _ in range(n)]
for i in range(n):
   a, b = map(int, input().split())
   edge[a-1][b-1] = 1
   edge[b-1][a-1] = 1

def dfs(now, visited):
   if (False not in visited):
      return(1)

   ans = 0
   for i in range(n):
      if (edge[now-1][i-1] == 1  and visited[i-1] == False):
         visited[i-1] = True
         ans += dfs(i, visited)
         visited[i-1] = False

   return(ans)

visited = [False] * n
visited[0] = True
print(dfs(1, visited))


Fixed submission:
n, m = map(int, input().split())
g = [[] for i in range(n)]

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

def dfs(v):
   if (len(v) == n):
      return 1

   ans = 0
   for u in set(g[v[-1]]) - set(v):
      ans += dfs(v + [u])

   return ans

print(dfs([0]))
Buggy python submission (verdict: Runtime Error):
k, s = map(int, input().split())

count = 0
for x in range(0, k+1):
   for y in range(0, k+1):
         z = s - (x + y)
         if (z >= 0 and z <= k):
            count += 1
print(count)


Fixed submission:
s = input()
print(s.replace(',', ' '))
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())

count = 0
for x in range(0, k+1):
   for y in range(0, k+1):
      for z in range(0, k+1):
         check = x + y + z
         if (check == s):
            count += 1
print(count)


Fixed submission:
k, s = map(int, input().split())

count = 0
for x in range(0, k+1):
   for y in range(0, k+1):
         z = s - (x + y)
         if (z >= 0 and z <= k):
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
def f(n, x):
   if (n < 0):
      return(0)
   else:
      return(n//x+1)

print(f(b, x) - f(a-1, x))


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

def f(n, x):
   if (n < 0):
      return(0)
   else:
      return(n//x+1)

print(f(b, x) - f(a-1, x))