ZhenlongDai/ACPR huggingface dataset:
Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())

min_c = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t < T and c < min_c:
        min_c = c

if min_c != 1001:
    print(min_c)
else:
    print('TLE')


Failing test case input:
4 0
-1 0111
-4 0
2 1011
1 0

Expected output:
-4


Actual output:
TLE


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())

min_c = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c < min_c:
        min_c = c

if min_c != 1001:
    print(min_c)
else:
    print('TLE')

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,t = map(int, input().split())
c = 100000000
for i in range(n):
    a,b = map(int, input().split())
    if b<=t:
        c = min(a,c)
print("TLE" if c == 10000000 else c)

Failing test case input:
-5 0
0 0100
1 1
4 1101
6 28

Expected output:
TLE


Actual output:
100000000


Fixed submission (verdict: Accepted):
n,t = map(int, input().split())
c = 1001
for i in range(n):
    a,b = map(int, input().split())
    if b<=t:
        c = min(a,c)
print("TLE" if c == 1001 else c)

Problem: p03239
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,T=map(int,input().split())
cost=1000
for _ in range(N):
    c,t=map(int,input().split())
    if t<=T:
        if cost>=c:
            cost=c
if cost>=1000:
    print(cost)
else:print("TLE")

Failing test case input:
-4 -2
0 0101
1 0
1 0001
3 31

Expected output:
TLE


Actual output:
1000


Fixed submission (verdict: Accepted):
N,T=map(int,input().split())
cost=1001
for _ in range(N):
    c,t=map(int,input().split())
    if t<=T:
        cost=min(c,cost)
if cost<=1000:
    print(cost)
else:print("TLE")

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,T = map(int,input().split())
m = 1001
for i in range(N) :
    c,t = map( int, input().split() )
    if t<=T:
        m = min(m,c)
    print('TLF' if m==1001 else m)

Failing test case input:
-2 -4
0 0101
2 0
2 0001
2 14

Expected output:
TLE


Actual output:

Fixed submission (verdict: Accepted):
N,T = map(int,input().split())
m = 1001
for i in range(N) :
    c,t = map( int, input().split() )
    if t<=T:
        m = min(m,c)
print('TLE' if m==1001 else m)
Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())
List = []
List2 = []
min = 1000

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)

Failing test case input:
-2 -4
0 0101
2 0
2 0001
2 14

Expected output:
TLE


Actual output:
1000


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())
List = []
List2 = []
min = 1001

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List2[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)

Problem: p03239
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,T = map(int,(list(input().split())))
cost = 1000
for _ in range(N):
    c,t = map(int,(list(input().split())))
    if t<=T:
        cost = min(cost,c)
print(cost)

Failing test case input:
-5 0
0 0100
1 1
4 1101
6 28

Expected output:
TLE


Actual output:
1000


Fixed submission (verdict: Accepted):
N,T = map(int,(list(input().split())))
cost = 1001
for _ in range(N):
    c,t = map(int,(list(input().split())))
    if t<=T:
        cost=min(cost,c)
if cost == 1001:
    print('TLE')
else:
    print(cost)

Problem: p03239
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = list(map(int,input().split()))
ans = 10**9
l = []
for i in range(n[0]):
  l.append(list(map(int,input().split())))
for i in range(n[0]):
  if l[i][1] <= n[1]:
    ans = min(l[i][0],ans)
print(ans)

Failing test case input:
-2 -4
0 0101
2 0
2 0001
2 14

Expected output:
TLE


Actual output:
1000000000


Fixed submission (verdict: Accepted):
n,t = map(int,input().split())
ans = 10**9
l = []
for i in range(n):
  l.append(list(map(int,input().split())))
for i in range(n):
  if l[i][1] <= t:
    ans = min(l[i][0],ans)
if ans == 10**9:
  print("TLE")
else:
  print(ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,t=map(int,input().split())
navi=[]
for i in range(n):
  k=list(map(int,input().split()))
navi.sort()
flag=False
for i in navi:
  if i[1]<=t:
    print(i[0])
    flag=True
    break
if flag==False:
  print('TLE')

Failing test case input:
2 3
0 1100
1 1
2 0011
4 156

Expected output:
1


Actual output:
TLE


Fixed submission (verdict: Accepted):
n,t=map(int,input().split())
navi=[]
for i in range(n):
  k=list(map(int,input().split()))
  navi.append(k)
navi.sort()
for i in navi:
  if i[1]<=t:
    print(i[0])
    exit()
print('TLE')
Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,w = map(int,input().split())
m = 1001
for i in range(n):
    a,b = map(int,input().split())
    if b <= w and a < m:
        m = a
if m == 101:
    print("TLE")
else:
    print(m)
    

Failing test case input:
-2 -4
0 0001
2 0
2 0001
2 14

Expected output:
TLE


Actual output:
1001


Fixed submission (verdict: Accepted):
n,w = map(int,input().split())
m = 1001
for i in range(n):
    a,b = map(int,input().split())
    if b <= w and a < m:
        m = a
if m == 1001:
    print("TLE")
else:
    print(m)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,t=map(int,input().split())
result=1001
for i in range(n):
    ci,ti=map(int,input().split())
    if ti > t:
        pass
    else:
        result=min(result,ci)
if result==t+1:
    print('TLE')
else:
    print(result)


Failing test case input:
-2 -1
0 0101
1 -1
2 0001
3 12

Expected output:
TLE


Actual output:
1001


Fixed submission (verdict: Accepted):
n,t=map(int,input().split())
result=1001
for i in range(n):
    ci,ti=map(int,input().split())
    if ti > t:
        pass
    else:
        result=min(result,ci)
if result==1001:
    print('TLE')
else:
    print(result)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())
ct = []
for _ in range(N):
    ct.append(list(map(int,input().split())))

ans = 1001
for i in ct:
    if T > i[1]:
        ans = min(ans, i[0])

if ans == 1001:
    print('TLE')
else:
    print(ans)

Failing test case input:
5 9
25 8
5 9
4 10
0100 1000
6 1

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())
ct = []
for _ in range(N):
    ct.append(list(map(int,input().split())))

ans = 1001
for i in ct:
    if T >= i[1]:
        ans = min(ans, i[0])

if ans == 1001:
    print('TLE')
else:
    print(ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, t = map(int, input().split())
li = []
for i in range(0, n):
    li.append(list(map(int,input().split())))

cost = 1001

for i in li:
    if t > i[1]:
        if cost > i[0]:
            cost = i[0]

if cost == 1001:
    print('TLE')
else:
    print(cost)


Failing test case input:
5 9
25 8
5 9
4 10
0000 1000
6 1

Expected output:
5


Actual output:
6


Fixed submission (verdict: Accepted):
n, t = map(int, input().split())
li = []
for i in range(0, n):
    li.append(list(map(int,input().split())))

cost = 1001

for i in li:
    if t >= i[1]:
        if cost > i[0]:
            cost = i[0]

if cost == 1001:
    print('TLE')
else:
    print(cost)
Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())
ans = 10000;
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    else:
        ans = min(ans, c)
print(ans)

Failing test case input:
-5 -8
0 0100
1 1
2 0100
3 31

Expected output:
TLE


Actual output:
10000


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())
ans = 1000000
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print("TLE" if ans == 1000000 else ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]
li = []
lim = 1001
for i in ct:
    if i[0] < lim or i[1] < lim:        
        if i[1] <= T:
            li.append(i[0])
if len(li) != 0:
    print(min(li))
else:
    print('TEL')

Failing test case input:
-4 -2
0 0101
0 0
2 0001
4 17

Expected output:
TLE


Actual output:
TEL


Fixed submission (verdict: Accepted):
n, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]

ans = []
for i in ct:
    if i[1] <= T:
        ans.append(i[0])
if len(ans) == 0:
    print('TLE')
else:
    print(min(ans))

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())
List = []
List2 = []
min = 1000

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List[n][0]

if min == 1000:
    print('TLE')
else:
    print(min)

Failing test case input:
4 0
0 0100
-1 6
1 1010
6 -1

Expected output:
6


Actual output:
0


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())
List = []
List2 = []
min = 1001

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List2[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)

Problem: p03239
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b=input().split()
a=int(a)
b=int(b)
c=[input().split() for i in range(a)]
d=1001
for i in range(a-1):
  if int(c[i][1])<=b:
    if d>int(c[i][0]):
      d=int(c[i][0])
if d==1001:
  print("TLE")
else:
  print(d)
      

Failing test case input:
4 -1
-1 0101
-1 6
1 1010
-1 -2

Expected output:
-1


Actual output:
TLE


Fixed submission (verdict: Accepted):
a,b=input().split()
a=int(a)
b=int(b)
c=[input().split() for i in range(a)]
d=1001
for i in range(a):
  if int(c[i][1])<=b:
    if d>int(c[i][0]):
      d=int(c[i][0])
if d==1001:
  print("TLE")
else:
  print(d)
Problem: p03239
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,T = map(int,input().split())
mn = 10**10
for i in range(N):
    c,t = map(int,input().split())
    if t <= T and c < mn:
        mn = c
if mn == 10**10:
    print("TLE")
else:
    print(c)


Failing test case input:
3 36
7 94
3 2
7 20

Expected output:
3


Actual output:
7


Fixed submission (verdict: Accepted):
N,T = map(int,input().split())
mn = 10**10
for i in range(N):
    c,t = map(int,input().split())
    
    if t <= T and c <= mn:
        mn = c
if mn == 10**10:
    print("TLE")
else:
    print(mn)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,t = map(int,input().split())
ans = 1e10
for i in range(n):
  a,b = map(int,input().split())
  if b <= t:
    ans = min(a,ans)
print(ans)

Failing test case input:
-5 0
0 0100
1 1
4 1101
6 28

Expected output:
TLE


Actual output:
10000000000.0


Fixed submission (verdict: Accepted):
n,t = map(int,input().split())
ans = 1e10
for i in range(n):
  a,b = map(int,input().split())
  if b <= t:
    ans = min(a,ans)
if ans == 1e10:
  print("TLE")
else:
  print(ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, T = map(int, input().split())
ans = 10000
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print(ans)

Failing test case input:
-2 -1
0 0101
1 -1
2 0001
3 14

Expected output:
TLE


Actual output:
10000


Fixed submission (verdict: Accepted):
n, T = map(int, input().split())
ans = float('inf')
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print('TLE' if ans == float('inf') else ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int, input().split())
ans=1001
for _ in range(N):
    c, t = map(int, input().split())
    if T>t:
        ans=min(ans,c)

if ans==1001:
    print('TLE')

print(ans)

Failing test case input:
-5 0
0 0100
1 1
4 1101
6 28

Expected output:
TLE


Actual output:
TLE
1001


Fixed submission (verdict: Accepted):
N, T = map(int, input().split())
ans=1001
for _ in range(N):
    c, t = map(int, input().split())
    if T>=t:
        ans=min(ans,c)

if ans==1001:
    print('TLE')
else:
    print(ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,T  = map(int,input().split())
Ans = T + 1
for item in range(N):
    C = input().split()
    if int(C[1]) <= T:
        Ans = min(Ans,int(C[0]))
        
if Ans > T:
    print ("TLE")
else:
    print(Ans)

Failing test case input:
4 0
0 0100
-1 6
1 1010
6 -1

Expected output:
6


Actual output:
TLE


Fixed submission (verdict: Accepted):
N,T  = map(int,input().split())
AnsC = 9999
for item in range(N):
    C = input().split()
    if int(C[1]) <= T:
        AnsC = min(AnsC,int(C[0]))
        


if AnsC >= 1001:
    print ("TLE")
else:
    print(AnsC)
Problem: p03239
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,t = map(int,input().split())

ans = 10**9

for i in range(n):
  c,y = map(int,input().split())
  if y<=t:
    ans = min(ans,c)
    
    
print(ans)

Failing test case input:
-5 -4
0 0100
0 1
2 0101
3 31

Expected output:
TLE


Actual output:
1000000000


Fixed submission (verdict: Accepted):
n,t = map(int,input().split())

ans = 10**9

for i in range(n):
  c,y = map(int,input().split())
  if y<=t:
    ans = min(ans,c)
    
if ans == 10**9:
  print("TLE")
else:
  print(ans)

Problem: p03239
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, T = map(int,input().split())

C,t = [], []

for i in range(N):
    CT = list(map(int,input().split()))
    C.append(CT[0])
    t.append(CT[1])

C_min = 10000
for i,t_i in enumerate(t):
    if t_i <= T and C_min > C[i]:
        C_min = C[i]
        
if C_min == 0:
    print('TLE')
else:
    print(C_min)

Failing test case input:
-5 -8
0 0100
1 1
4 0100
6 45

Expected output:
TLE


Actual output:
10000


Fixed submission (verdict: Accepted):
N, T = map(int,input().split())

C,t = [], []

for i in range(N):
    CT = list(map(int,input().split()))
    C.append(CT[0])
    t.append(CT[1])

C_min = 10000
for i,t_i in enumerate(t):
    if t_i <= T and C_min >= C[i]:
        C_min = C[i]
        
if C_min == 10000:
    print('TLE')
else:
    print(C_min)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n, m = map(int, input().split())
d = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a-=1
    b-=1
    d[a][b] = 1
    d[b][a] = 1
ans = 0

nums = [i for i in range(n)]
for num in itertools.permutations(nums):
    if(num[0] != 0):
        continue
    flag = True
    for i in range(n - 1):
            flag = False
            break
    if(flag):
        ans += 1

print(ans)


Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 1
5 6
6 7

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
import itertools
n, m = map(int, input().split())
d = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a-=1
    b-=1
    d[a][b] = 1
    d[b][a] = 1
ans = 0

nums = [i for i in range(n)]
for num in itertools.permutations(nums):
    if(num[0] != 0):
        continue
    flag = True
    for i in range(n - 1):
        if(d[num[i]][num[i+1]] != 1):
            flag = False
            break
    if(flag):
        ans += 1

print(ans)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import permutations
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

ver = [[] for _ in range(N)]

print(ver)

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

ans = 0

for i in permutations(range(1, N)):
    here = 0
    for j in i:
        if j not in ver[here]:
            break
        here = j
    else:
        ans += 1

print(ans)

Failing test case input:
7 4
1 5
2 7
3 2
4 5
4 6
5 6
6 7

Expected output:
0


Actual output:
[[], [], [], [], [], [], []]
0


Fixed submission (verdict: Accepted):
from itertools import permutations
import sys
input = sys.stdin.readline

N, M = map(int, input().split())

ver = [[] for _ in range(N)]


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

ans = 0

for i in permutations(range(1, N)):
    here = 0
    for j in i:
        if j not in ver[here]:
            break
        here = j
    else:
        ans += 1

print(ans)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import permutations
N, M = map(int, input().split())
edge = []
for _ in range(M):
    a, b = map(int, input().split())
    edge.append(set((a, b)))

p = list(map(lambda x: [1] + list(x), permutations([i for i in range(2, N + 1)])))

ans = 0

for root in p:
    for i in range(len(root) - 1):
        if not set((root[i], root[i + 1])) in edge:
            break
    else:
        print(root)
        ans += 1

print(ans)


Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 1
5 6
6 7

Expected output:
1


Actual output:
[1, 3, 4, 5, 6, 7, 2]
1


Fixed submission (verdict: Accepted):
from itertools import permutations
N, M = map(int, input().split())
edge = []
for _ in range(M):
    a, b = map(int, input().split())
    edge.append(set((a, b)))

p = list(map(lambda x: [1] + list(x), permutations([i for i in range(2, N + 1)])))

ans = 0

for root in p:
    for i in range(len(root) - 1):
        if not set((root[i], root[i + 1])) in edge:
            break
    else:
        ans += 1

print(ans)

Problem: p03805
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = tuple(map(int,input().split()))
from collections import defaultdict
graph = defaultdict(list)
for i in range(M):
  a,b = tuple(map(int,input().split()))
  graph[a].append(b)
  graph[b].append(a)
  

queue = [(1,set())]
res = 0
while queue:
  now,prevs = queue.pop()
  if len(prevs) == 1:
      res += 1
  for next_node in graph[now]:
    if next_node not in prevs:
      queue.append((next_node, prevs|{now}))
print(res)

Failing test case input:
6 4
1 5
2 5
3 4
4 5
5 12
5 3
0 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = tuple(map(int,input().split()))
from collections import defaultdict
graph = defaultdict(list)
for i in range(M):
  a,b = tuple(map(int,input().split()))
  graph[a].append(b)
  graph[b].append(a)
  

queue = [(1,set())]
res = 0
while queue:
  now,prevs = queue.pop()
  
  if len(prevs) == N-1:
      res += 1
      continue
  for next_node in graph[now]:
    
    if next_node not in prevs:
      queue.append((next_node, prevs|{now}))
print(res)

Problem: p03805
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == m:
    ary.append(t)
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])

dfs(0,[0])

print (len(ary))

Failing test case input:
9 3
1 5
5 7
3 4
4 5
1 12
5 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == n:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
G = [[] for i in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
l = [i for i in range(2,N+1)]
import itertools
ans = 0
for v in itertools.permutations(l):
    v = list(v)
    s = 1
    t = 1
    while v:
        s = t
        t = v.pop(0)
        if t not in G[s]:
            break
    if len(v) == 0:
        ans += 1
print(ans)

Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 5
4 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
G = [[] for i in range(N+1)]
for i in range(M):
    a,b = map(int,input().split())
    G[a].append(b)
    G[b].append(a)
l = [i for i in range(2,N+1)]
import itertools
ans = 0
for v in itertools.permutations(l):
    v = list(v)
    flag = 1
    s = 1
    t = 1
    while v:
        s = t
        t = v.pop(0)
        if t not in G[s]:
            flag = 0
            break
    ans += flag
print(ans)

Problem: p03805
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import itertools

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

P = N-1
count = 0
for path in itertools.permutations(ab, P):
  flag = True
  prev = 1
  for i in range(P):
    if flag == True:
      if path[i][0] == prev:
        prev = path[i][1]
      elif path[i][1] == prev:
        prev = path[i][0]
      else:
        flag = False
        continue
      if i == P-1:
        print(path)
        count += 1
        
print(count)


Failing test case input:
7 7
1 6
2 7
3 4
4 5
6 3
5 6
6 7

Expected output:
0


Actual output:
([1, 6], [6, 3], [3, 4], [4, 5], [5, 6], [6, 7])
([1, 6], [5, 6], [4, 5], [3, 4], [6, 3], [6, 7])
2


Fixed submission (verdict: Accepted):
import itertools

N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

count = 0
for path in itertools.permutations([i for i in range(2, N+1)], N-1):
  flag = True
  if [1, path[0]] in ab or [path[0], 1] in ab:
    pass
  else:
    flag = False
    continue
  for i in range(1, N):
    if flag:
      if i == N-1:
        count += 1
        continue
      if [path[i-1], path[i]] in ab or [path[i], path[i-1]] in ab:
        continue
      else:
        flag = False
print(count)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
L = [[False for i in range(N)] for j in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    L[a-1][b-1] = True
    L[b-1][a-1] = True
    
def dfs(x):
    global check
    check[x] += 1
    for i in range(N):
        if L[x][i] == True:
            L[x][i] = False
            dfs(i)
            
check = [0 for i in range(N)]
dfs(0)
print(min(check))

Failing test case input:
7 7
1 5
2 7
3 4
4 5
4 6
4 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
L = [[] for i in range(N)]
for i in range(M):
    a,b = map(int, input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
    
import itertools
s = [int(i) for i in range(N)]
count = 0
for p in itertools.permutations(s, N):

    if p[0] == 0:

        flag = True
        for i in range(N-1):


            if p[i+1] not in L[p[i]]:
                flag = False
        if flag:

            count += 1
print(count)

Problem: p03805
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)
  if i == 0:
    x = a

ary = []
def dfs(s,t):
  if len(t) == m:
    ary.append(t)
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])

dfs(x,[0])

print (len(ary))

Failing test case input:
9 4
1 5
2 7
3 4
4 5
4 6
7 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == n:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n,m=map(int,input().split())
node=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
  a,b=[int(x)-1 for x in input().split()]
  node[a][b]=1
ct=0
for order in itertools.permutations(range(n),n):
  if order[0]==0:
    for j in range(n-1):
      if node[order[j]][order[j+1]]!=1:
        break
    ct+=1
print(ct)

Failing test case input:
7 4
1 4
2 7
3 4
4 5
4 6
5 6
6 7

Expected output:
0


Actual output:
720


Fixed submission (verdict: Accepted):
import itertools
n,m=map(int,input().split())
node=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
  a,b=[int(x)-1 for x in input().split()]
  node[a][b]=1
  node[b][a]=1
ct=0
for order in itertools.permutations(range(n),n):
  if order[0]==0:
    for j in range(n):
      if j==n-1:
        ct+=1
        break
      if not node[order[j]][order[j+1]]:
        break
    
print(ct)
Problem: p03805
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import itertools
N,M=map(int,input().split())
L=[[]]*N
for _ in range(M):
    a,b=map(int,input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
cnt=0
for i in itertools.permutations(range(N),N):
    if i[0]==0:
        for j in range(N):
            if j==N-1:
                cnt+=1
                break
            if not (i[j+1] in L[i[j]]):
                break
print(cnt)

Failing test case input:
7 4
1 6
2 7
3 4
4 5
4 3
5 6
6 7

Expected output:
0


Actual output:
720


Fixed submission (verdict: Accepted):
import itertools
N,M=map(int,input().split())
L=[[] for _ in range(N)]
for _ in range(M):
    a,b=map(int,input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
cnt=0
for i in itertools.permutations(range(N),N):
    if i[0]==0:
        for j in range(N):
            if j==N-1:
                cnt+=1
                break
            if not (i[j+1] in L[i[j]]):
                break
print(cnt)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n, m = map(int, input().split())
ab = {}
for i in range(n+1):
    ab[i] = []
for i in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)
print(ab) 
count = 0
 
for values in list(itertools.permutations(range(2, n+1))):
    pre = 1
    for i, v in enumerate(values):
        if(v not in ab[pre]):
            break
        if i == n-2:
            count += 1
        pre = v

print(count)

Failing test case input:
7 4
1 2
4 4
3 1
4 5
4 6
7 9
1 1

Expected output:
0


Actual output:
{0: [], 1: [2, 3], 2: [1], 3: [1], 4: [4, 4, 5], 5: [4], 6: [], 7: []}
0


Fixed submission (verdict: Accepted):
import itertools
n, m = map(int, input().split())
ab = {}
for i in range(n+1):
    ab[i] = []
for i in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

count = 0
 
for values in list(itertools.permutations(range(2, n+1))):
    pre = 1
    for i, v in enumerate(values):
        if(v not in ab[pre]):
            break
        if i == n-2:
            count += 1
        pre = v

print(count)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
path = list([False] * n for _ in range(n))
for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
ans = 0
import itertools
for i in itertools.permutations(range(n),n):
  if i[0] == 0:
    for j in range(n):
      if j == n-1:
        ans += 1
        break
      if not path[j][j+1]:
        break
print(ans)
    
  
  

Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 1
5 6
6 7

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
path = list([False] * n for _ in range(n))
for i in range(m):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  path[a][b] = True
  path[b][a] = True
ans = 0
import itertools
for i in itertools.permutations(range(n),n):
  if i[0] == 0:
    for j in range(n):
      if j == n-1:
        ans += 1
        break
      if not path[i[j]][i[j+1]]:
        break
print(ans)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict


n, m = map(int, input().split())
edges = [map(int, input().split()) for i in range(m)]
graph = defaultdict(list)
for k,v in edges:
    graph[k].append(v)
    graph[v].append(k)

cnt = 0

def dfs(node, visited):
    global cnt
    if node in visited:
        return None
    elif len(visited) + 1 == m:
        cnt += 1
        return None
    else:
        for v in graph[node]:
            dfs(v, visited+[node])
dfs(1, [])
print(cnt)

Failing test case input:
7 4
1 4
3 7
3 4
4 5
4 6
1 6
9 8

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import defaultdict


n, m = map(int, input().split())
edges = [map(int, input().split()) for i in range(m)]
graph = defaultdict(list)
for k,v in edges:
    graph[k].append(v)
    graph[v].append(k)

cnt = 0

def dfs(node, visited):
    global cnt
    if node in visited:
        return None
    elif len(visited) + 1 == n:
        cnt += 1
        return None
    else:
        for v in graph[node]:
            dfs(v, visited+[node])
dfs(1, [])
print(cnt)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=[int(i) for i in input().split()]
es=set()
for _ in range(m):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    es|={(u,v),(v,u)}


p=[[0]]
x=0
while p:  
  p1=p.pop()
  for l0,l1 in es:
    if l0==p1[len(p1)-1] and l1 not in p1:
      if len(p1)==m-1:
        x+=1
      else:
        p.append(p1+[l1])

print(x)

Failing test case input:
7 3
1 5
5 7
3 5
4 8
1 12
5 6
6 7

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):
n,m=[int(i) for i in input().split()]
es=set()
for _ in range(m):
    u,v=map(int,input().split())
    u,v=u-1,v-1
    es|={(u,v),(v,u)}


p=[[0]]
x=0
while p:  
  p1=p.pop()
  if len(p1)==n:
    x+=1
  else:
    for l0,l1 in es:
      if l0==p1[len(p1)-1] and l1 not in p1:
          p.append(p1+[l1])

print(x)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools

N, M = map(int,input().split())
edges = {tuple(sorted(map(int,input().split()))) for i in range(M)}
print(edges)
ans = 0
num = 0
for i in itertools.permutations(range(2,N+1)):
  
  l = [1] + list(i)
  for edge in zip(l,l[1:]):
    
    if tuple(sorted(edge)) in edges:
      num += 1
      if num == N-1:
        ans += 1
        num = 0
  
  
  
print(ans)         


Failing test case input:
7 4
1 5
2 7
3 4
4 5
4 3
5 6
5 7

Expected output:
0


Actual output:
{(4, 5), (3, 4), (2, 7), (1, 5)}
140


Fixed submission (verdict: Accepted):
import itertools

N, M = map(int,input().split())
edges = {tuple(sorted(map(int,input().split()))) for i in range(M)}
ans = 0
for i in itertools.permutations(range(2,N+1)):
  l = [1] + list(i)
  ans += sum(1 for edge in zip(l,l[1:]) if tuple(sorted(edge)) in edges)==N-1
print(ans)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
dic = {i+1:[] for i in range(N)}

for i in range(M):
    f,g = map(int,input().split())
    dic[f].append(g)

visited = [0 for i in range(N)]

stack = [[1,1]]
root = 0
while len(stack) >0:
    now = stack[-1][0]
    length = stack[-1][1]
    del stack[-1]
    for next in dic[now]:
        if length +1<N-1:
            stack.append([next,length+1])
        else:
            root += 1

print(root)

Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 1
5 6
6 7

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
dic = {i+1:[] for i in range(N)}

for i in range(M):
    f,g = map(int,input().split())
    dic[f].append(g)
    dic[g].append(f)


stack = [[1,1,[1]]]
root = 0
while len(stack) >0:
    now = stack[-1][0]
    length = stack[-1][1]
    visited = stack[-1][2]
    del stack[-1]
    for next in dic[now]:
        if next not in visited:
            temp = visited.copy()
            if length +1 <=N-1:
                temp.append(next)
                stack.append([next,length+1,temp])
            elif length +1 == N:
                root += 1


print(root)

Problem: p03805
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)
  if i == 0:
    x = a

ary = []
def dfs(s,t):
  if len(t) == m:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])

dfs(x,[0])

print (len(ary))

Failing test case input:
9 3
1 5
5 7
3 4
4 5
1 12
5 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == n:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())

lc=[[] for _ in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    lc[a-1].append(b)
    lc[b-1].append(a)
st=[1]
df={1:1}
ans=0
while st:
    tmp=st.pop()
    if len(df)==N:
        ans+=1
        del df[tmp]
    for c in lc[tmp-1]:
        if not c in df:
            st.append(c)
            df[c]=1
print(ans)


Failing test case input:
7 7
1 6
2 7
3 4
4 5
6 3
5 6
6 7

Expected output:
0


Actual output:
2


Fixed submission (verdict: Accepted):






N,M=map(int,input().split())

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


st=[[1,0]]

df={}
lp=[0]
ans=0
while st:
    
    tmptp=st.pop()
    
    tmp=tmptp[0]
    ptmp=tmptp[1]
    p=lp.pop()
    while p!=ptmp:
        del df[p]
        p=lp.pop()
    lp.append(p)
    lp.append(tmp)
    df[tmp]=1
    if len(df)==N:
        ans+=1
        
        
        
    for c in lc[tmp-1]:
        if not c in df:
            
            st.append([c,tmp])
            
print(ans)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def dfs(i):
    if all(visited):
        global ans
        ans += 1
        return
    for j in range(N):
        if g[i][j] and not visited[j]:
            visited[j] = True
            dfs(j)
            visited[j] = False

N, M = map(int, input().split())
g = [[False] * N for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    g[a-1][b-1] = True
    g[b-1][a-1] = True

ans = 0
visited = [False] * N
visited[0] = True
dfs(0)

Failing test case input:
7 3
1 5
3 7
3 4
4 5
1 12
5 6
6 7

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
def dfs(i):
    if all(visited):
        global ans
        ans += 1
        return
    for j in range(N):
        if g[i][j] and not visited[j]:
            visited[j] = True
            dfs(j)
            visited[j] = False

N, M = map(int, input().split())
g = [[False] * N for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    g[a-1][b-1] = True
    g[b-1][a-1] = True

ans = 0
visited = [False] * N
visited[0] = True
dfs(0)
print(ans)
Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from itertools import permutations

n,m = map(int,input().split(' '))
choices = permutations(range(1,n))
nords = [[]for _ in range(n)]
for i in range(m):
    a, b = map(lambda x : int(x)-1,input().split(" "))
    nords[a].append(b)
    nords[b].append(a)


ans = 0
for choice in choices:
    for i,nextnord in enumerate(choice):
        if i== n -2:
            ans += 1
            
        if not nextnord in nords[i]:
            break
       

print(ans)





Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 6
5 5
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from itertools import permutations

n,m = map(int,input().split(' '))
choices = permutations(range(1,n))
nords = [[]for _ in range(n)]
for i in range(m):
    a, b = map(lambda x : int(x)-1,input().split(" "))
    nords[a].append(b)
    nords[b].append(a)


ans = 0
for choice in choices:
    row = list(choice)
    row.insert(0,0)
    for i,nownord in enumerate(row):
        if i== n - 1 :
            ans += 1
            break
        nextnord = row[i+1]
        if not nextnord in nords[nownord]:
            break
            
            
print(ans)

Problem: p03805
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def dfs(g, v, i):
    if len(v) == len(g) - 1: return 1
    v.add(i)
    c = 0
    for u in g[i]:
        if u not in v: c += dfs(g, v, u)
    return c

n, m = map(int, input().split())
g = [list() for _ 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)
print(dfs(g, set(), 0))


Failing test case input:
7 7
1 5
2 7
3 4
4 5
4 6
4 6
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
def dfs(g, v, i):
    if len(v) == len(g) - 1: return 1
    v.add(i)
    c = 0
    for u in g[i]:
        if u not in v: c += dfs(g, v, u)
    v.remove(i)
    return c

n, m = map(int, input().split())
g = [list() for _ 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)
print(dfs(g, set(), 0))
Problem: p03805
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from itertools import permutations

n, m = map(int, input().split())
L = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    L[a-1].add(b-1)
    L[b-1].add(a-1)
lst = [i for i in range(1, n)]
ans = 0
for v in permutations(lst, n-1):
    case = [0] + list(v)
    for i in range(n-2):
        next = case[i+1]
        if next not in L[i]:
            break
    else:
        ans += 1
print(ans)


Failing test case input:
7 7
1 3
2 7
3 4
4 5
4 6
5 5
6 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from itertools import permutations

n, m = map(int, input().split())
L = [set() for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    L[a-1].add(b-1)
    L[b-1].add(a-1)
lst = [i for i in range(1, n)]
ans = 0
for v in permutations(lst, n-1):
    case = [0] + list(v)
    for i in range(n-1):
        next = case[i+1]
        if next not in L[case[i]]:
            break
    else:
        ans += 1
print(ans)

Problem: p03805
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == m:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))

Failing test case input:
6 4
1 5
2 5
3 4
4 5
5 12
5 3
0 7

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**7)
n, m = map(int, input().split())
ab = [[] for i in range(n)]
for i in range(m):
  a, b = map(int, input().split())
  a -= 1
  b -= 1
  ab[a].append(b)
  ab[b].append(a)

ary = []
def dfs(s,t):
  if len(t) == n:
    ary.append(t)
    return
  for i in ab[s]:
    if i not in t:
      dfs(i,t+[i])
  return
dfs(0,[0])

print (len(ary))
Problem: p03575
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
e=[list(map(int,input().split())) for _ in range(m)]

cnt=0
for x in e:
  l=list(range(n))
  for y in e:
    print('y',y)
    if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(n)]
    print('l',l)
  if len(set(l))!=1:cnt+=1
print(cnt)

Failing test case input:
6 5
1 2
2 3
3 4
3 5
5 6

Expected output:
5


Actual output:
y [1, 2]
l [0, 1, 2, 3, 4, 5]
y [2, 3]
l [0, 1, 1, 3, 4, 5]
y [3, 4]
l [0, 1, 1, 1, 4, 5]
y [3, 5]
l [0, 1, 1, 1, 1, 5]
y [5, 6]
l [0, 1, 1, 1, 1, 1]
y [1, 2]
l [0, 0, 2, 3, 4, 5]
y [2, 3]
l [0, 0, 2, 3, 4, 5]
y [3, 4]
l [0, 0, 2, 2, 4, 5]
y [3, 5]
l [0, 0, 2, 2, 2, 5]
y [5, 6]
l [0, 0, 2, 2, 2, 2]
y [1, 2]
l [0, 0, 2, 3, 4, 5]
y [2, 3]
l [0, 0, 0, 3, 4, 5]
y [3, 4]
l [0, 0, 0, 3, 4, 5]
y [3, 5]
l [0, 0, 0, 3, 0, 5]
y [5, 6]
l [0, 0, 0, 3, 0, 0]
y [1, 2]
l [0, 0, 2, 3, 4, 5]
y [2, 3]
l [0, 0, 0, 3, 4, 5]
y [3, 4]
l [0, 0, 0, 0, 4, 5]
y [3, 5]
l [0, 0, 0, 0, 4, 5]
y [5, 6]
l [0, 0, 0, 0, 4, 4]
y [1, 2]
l [0, 0, 2, 3, 4, 5]
y [2, 3]
l [0, 0, 0, 3, 4, 5]
y [3, 4]
l [0, 0, 0, 0, 4, 5]
y [3, 5]
l [0, 0, 0, 0, 0, 5]
y [5, 6]
l [0, 0, 0, 0, 0, 5]
5


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
e=[list(map(int,input().split())) for _ in range(m)]

cnt=0
for x in e:
  l=list(range(n))
  for y in e:
    if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(n)]
  if len(set(l))!=1:cnt+=1
print(cnt)

Problem: p03575
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0
print(n,m,edges)

for x in edges:
    l = list(range(n))
    print(l)
    for y in edges:
        if y != x:
            l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
            print(l)
    if len(set(l)) != 1:
        count += 1

print(count)

Failing test case input:
8 -1
0 -1
1 2
1 3

Expected output:
0


Actual output:
8 -1 []
0


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0
 
for x in edges:
    l = list(range(n))
    for y in edges:
        if y != x:
            l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
    if len(set(l)) != 1:
        count += 1
 
print(count)
Problem: p03575
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0

for x in edges:
    l = list(range(n))
    print(l)
    for y in edges:
        if y != x:
            l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
            print(l)
    if len(set(l)) != 1:
        count += 1

print(count)

Failing test case input:
6 1
2 1
1 1
1 3

Expected output:
1


Actual output:
[0, 1, 2, 3, 4, 5]
1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
edges = [list(map(int, input().split())) for i in range(m)]
count = 0
 
for x in edges:
    l = list(range(n))
    for y in edges:
        if y != x:
            l = [l[y[0]-1] if l[i] == l[y[1]-1] else l[i] for i in range(n)]
    if len(set(l)) != 1:
        count += 1
 
print(count)

Problem: p03575
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
V,E=map(int,input().split())
edges=[set() for i in range(V)]
for i in range(E):
    a,b=map(int,input().split())
    edges[a-1].add(b-1)
    edges[b-1].add(a-1)
for i in range(V):
    print(len({n for v in edges[i] for n in edges[v] if not n in edges[i] and n!=i}))

Failing test case input:
8 -1
2 -1
1 4
1 0

Expected output:
0


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
edges=[list(map(int,input().split())) for i in range(M)]
ans=0
for x in edges:
    l=list(range(N))
    for y in edges:
        if y!=x:l=[l[y[0]-1] if l[i]==l[y[1]-1] else l[i] for i in range(N)]
    if len(set(l))!=1:ans+=1
print(ans)
Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=int(input())
print(a+a**+a*a*a)

Failing test case input:
-14

Expected output:
-2562


Actual output:
-13.999999999999982


Fixed submission (verdict: Accepted):
a=int(input())
print(a+a*a+a*a*a)

Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = int(input())
ans = a + a^2 + a^3
print(ans)

Failing test case input:
-65

Expected output:
-270465


Actual output:
188


Fixed submission (verdict: Accepted):
a = int(input())
ans = a + (a*a) + (a*a*a)
print(ans)

Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

N = int(input().rstrip())
print(N*(1+N+N^2))

Failing test case input:
-4

Expected output:
-52


Actual output:
20


Fixed submission (verdict: Accepted):
N = int(input().rstrip())
N_2=pow(N,2)
print(N*(1+N+N_2))

Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=int(input())
print(int(a+a**2*a**3))

Failing test case input:
-47

Expected output:
-101661


Actual output:
-229345054


Fixed submission (verdict: Accepted):
a=int(input())
print(int(a+a**2+a**3))

Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from math import pow

def func(x):
    return x + pow(x,2) + pow(x,3)
    

if __name__=="__main__":
    input = input()
    print(func(int(input)))
    

Failing test case input:
-14

Expected output:
-2562


Actual output:
-2562.0


Fixed submission (verdict: Accepted):
def func(x):
    return x + x**2 + x**3
    

if __name__=="__main__":
    input = input()
    print(func(int(input)))

Problem: p02621
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A=int(input())
sums=0
for i in range(3):
  sums+=A^(i+1)
  
print(sums)

Failing test case input:
488

Expected output:
116452904


Actual output:
1470


Fixed submission (verdict: Accepted):
A=int(input())
sums=0
for i in range(1,4):
  sums += A**i
  
print(sums)