s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s238366029 | p02573 | u715329136 | 1598731956 | Python | Python (3.8.2) | py | Runtime Error | 389 | 11432 | 1170 | def resolve():
N, M = map(int, input().split())
person_group = [0] * (N+1)
group_counter = 0
member_counter = {0: 0}
def _marge_group(a, b):
for i in range(1, N+1):
if person_group[i] == b:
person_group[i] == a
member_counter[a] += member_counter.pop(b)
... | Traceback (most recent call last):
File "/tmp/tmpykc19_9d/tmpnqbecpu9.py", line 35, in <module>
resolve()
File "/tmp/tmpykc19_9d/tmpnqbecpu9.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s062171396 | p02573 | u602740328 | 1598731920 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 18384 | 221 | N,M = map(int,input().split())
Gs = []
for _ in range(M):
AB = set(map(int,input().split()))
for i,g in enumerate(Gs):
if len(g&AB):
Gs[i] = g|AB
break
else:
Gs.append(AB)
print(max(map(len,Gs))) | Traceback (most recent call last):
File "/tmp/tmp054ckl7e/tmpvfrrw4ye.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s536003275 | p02573 | u770558697 | 1598731892 | Python | Python (3.8.2) | py | Runtime Error | 548 | 21256 | 556 | import collections
n,m = map(int,input().split())
indexlist = [0 for i in range(n)]
indexnum = 1
for _ in range(m):
a,b = map(int,input().split())
x = indexlist[a-1]
y = indexlist[b-1]
if x == 0 and y == 0:
indexlist[a-1] = indexnum
indexlist[b-1] = indexnum
indexnum += 1
el... | Traceback (most recent call last):
File "/tmp/tmp7c6ki07j/tmp98c_6tq1.py", line 2, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s750586231 | p02573 | u933929042 | 1598731883 | Python | PyPy3 (7.3.0) | py | Runtime Error | 536 | 76900 | 1447 | import random
import sys
import resource
sys.setrecursionlimit(100000)
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))
n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
for i in range(m):
a, b = map(int, input().split()... | Traceback (most recent call last):
File "/tmp/tmpnqh93zs3/tmp9i4mpf9b.py", line 8, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s523458846 | p02573 | u170839742 | 1598731878 | Python | Python (3.8.2) | py | Runtime Error | 647 | 31364 | 539 | N, M = map(int, input().split())
parent = [-1] * N
def union(x, y):
x = find(x)
y = find(y)
if x == y:
return
parent[x] = y
def find(x):
if parent[x] == -1:
return x
res = parent[x] = find(parent[x])
return res
for _ in range(M):
a, b = map(int, input().split())
... | Traceback (most recent call last):
File "/tmp/tmpcppz1gxe/tmphcxmpjqz.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s866179299 | p02573 | u715329136 | 1598731875 | Python | PyPy3 (7.3.0) | py | Runtime Error | 321 | 73108 | 1170 | def resolve():
N, M = map(int, input().split())
person_group = [0] * (N+1)
group_counter = 0
member_counter = {0: 0}
def _marge_group(a, b):
for i in range(1, N+1):
if person_group[i] == b:
person_group[i] == a
member_counter[a] += member_counter.pop(b)
... | Traceback (most recent call last):
File "/tmp/tmpicwfk_eb/tmpvn332wr1.py", line 35, in <module>
resolve()
File "/tmp/tmpicwfk_eb/tmpvn332wr1.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s404946033 | p02573 | u960611411 | 1598731855 | Python | Python (3.8.2) | py | Runtime Error | 498 | 45340 | 1194 | [n, m] = list(map(int, input().split()))
abList = []
for i in range(m):
abList.append(list(map(int, input().split())))
class QuickFind(object):
id = []
count = 0
def __init__(self, n):
self.count = n
i = 0
while i < n:
self.id.append(i)
i += 1
def con... | Traceback (most recent call last):
File "/tmp/tmpa0uyhgw3/tmpoaz7n0ii.py", line 1, in <module>
[n, m] = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s296801397 | p02573 | u623283955 | 1598731855 | Python | Python (3.8.2) | py | Runtime Error | 639 | 29640 | 496 | n,m=map(int,input().split())
p=[(i,1)for i in range(n)]
def find(i):
if p[i][0]==i:return i
else:
c=find(p[i][0])
p[i]=(c,0)
return c
def union(i,j):
pi=find(i)
pj=find(j)
if not pi==pj:
if p[pi][1]>p[pj][1]:
p[pi]=(pi,p[pi][1]+p[pj][1])
p[pj]=(pi,0)
else:
p[pj]=(pj,p[pi]... | Traceback (most recent call last):
File "/tmp/tmpckddmt6p/tmp6xml2z4g.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s931383675 | p02573 | u116107171 | 1598731844 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45504 | 345 | N, M = map(int, input().split())
I = []
for _ in range(M):
I.append(list(map(int, input().split())))
ans = 2
f = [I[0][0], I[0][1]]
for i in range(1, M):
if I[i][0] in f:
if I[i][1] in f:
continue
f.append(I[i][1])
ans += 1
elif I[i][1] in f:
f.append(I[i][0])
... | Traceback (most recent call last):
File "/tmp/tmpyr7atzdg/tmpzbrjeri0.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s120392929 | p02573 | u170839742 | 1598731834 | Python | Python (3.8.2) | py | Runtime Error | 717 | 31400 | 531 | N, M = map(int, input().split())
parent = [-1] * N
def union(x, y):
x = find(x)
y = find(y)
if x == y:
return
parent[x] = y
def find(x):
if parent[x] == -1:
return x
res = parent[x] = find(parent[x])
return res
for _ in range(M):
a, b = map(int, input().split())
... | Traceback (most recent call last):
File "/tmp/tmpv3jgqw0r/tmp2sxsm659.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s399144756 | p02573 | u530606147 | 1598731828 | Python | Python (3.8.2) | py | Runtime Error | 943 | 81256 | 691 | import collections
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
l = []
for _ in range(n):
l.append([])
# for x in range(n):
# l[x]
for a, b in ab:
a -= 1
b -= 1
l[a].append(b)
l[b].append(a)
# c = [None] * n
# for i in range(n):
# if c[i] is None:
#... | Traceback (most recent call last):
File "/tmp/tmpln8n_tjp/tmph8nji8pf.py", line 3, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s118447461 | p02573 | u309562711 | 1598731819 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10660 | 285 | n,m=map(int,input().split())
lst=[]
for i in range(m):
var=list(map(int,input().split()))
if var not in lst and var[::-1] not in lst:
lst.append(var)
d={}
for i in lst:
d.setdefault(i[0],1)
d.setdefault(i[1],1)
d[i[0]]+=1
d[i[1]]+=1
ans=max(d.values())
print(ans)
| Traceback (most recent call last):
File "/tmp/tmplwdyal4o/tmpy4hen8e4.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s658428554 | p02573 | u155659281 | 1598731817 | Python | Python (3.8.2) | py | Runtime Error | 2512 | 195136 | 570 | import collections
def solve():
N,M = map(int,input().split())
ABlist = [[0 for _ in range(2)] for _ in range(M)]
WA = [0]*N
for i in range(N):
WA[i] = i+1
for i in range(M):
A, B = map(int,input().split())
if A>B:
A,B =B,A
ABlist[i][0] = A
ABlist[i][1] = B
ABlist.sort(key=lambda x... | Traceback (most recent call last):
File "/tmp/tmp318214hb/tmpt5ahwaqv.py", line 25, in <module>
solve()
File "/tmp/tmp318214hb/tmpt5ahwaqv.py", line 3, in solve
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s549835175 | p02573 | u934119021 | 1598731809 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10052 | 505 | import itertools
n, m = map(int, input().split())
f = []
for i in range(m):
a, b = map(int, input().split())
if a in list(itertools.chain.from_iterable(f)):
for j in range(len(f)):
if a in f[j]:
f[j].append(b)
break
elif b in list(itertools.chain.from_iterable(f)):
for j in range(len... | Traceback (most recent call last):
File "/tmp/tmp2lrtsb7a/tmp2mn0ptol.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s810518555 | p02573 | u070630744 | 1598731804 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 68624 | 1538 | def solve():
n, m = map(int, input().split())
group = []
done = [-1]*n
num = 0
for i in range(m):
a, b = map(lambda x:int(x)-1, input().split())
if done[a] != -1:
if done[b] == -1:
group[done[a]].append(b)
done[b] = done[a]
else:
... | File "/tmp/tmpjs_bn73s/tmps790oj_v.py", line 26
print(amari)def solve():
^^^
SyntaxError: invalid syntax
| |
s534736172 | p02573 | u476674874 | 1598731803 | Python | Python (3.8.2) | py | Runtime Error | 571 | 50500 | 521 | def main():
N, M = map(int, input().split())
groups = dict()
for _ in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
if a in groups:
groups[a].add(b)
groups[b] = groups[a]
elif b in groups:
groups[b].add(a)
gr... | Traceback (most recent call last):
File "/tmp/tmp_a63n2hp/tmpo382bljb.py", line 25, in <module>
main()
File "/tmp/tmp_a63n2hp/tmpo382bljb.py", line 2, in main
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s757985558 | p02573 | u130076114 | 1598731793 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 75916 | 544 | N,M=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(M)]
f=[[] for _ in range(N+1)]
for i in range(M):
f[s[i][0]].append(s[i][1])
found=[0 for _ in range(N+1)]
ans=0
def find(bi,i,root,found):
if root[i]:
return
root[i]=1
found[i]=1
f[i].append(bi)
for j in ra... | Traceback (most recent call last):
File "/tmp/tmpknmqa60z/tmp9umcx072.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s961070143 | p02573 | u770558697 | 1598731786 | Python | Python (3.8.2) | py | Runtime Error | 495 | 19648 | 598 | import collections
n,m = map(int,input().split())
indexlist = [0 for i in range(n)]
indexnum = 1
for _ in range(m):
a,b = map(int,input().split())
x = indexlist[a-1]
y = indexlist[b-1]
if x == 0 and y == 0:
indexlist[a-1] = indexnum
indexlist[b-1] = indexnum
indexnum += 1
el... | Traceback (most recent call last):
File "/tmp/tmp1xm8rqg7/tmp36l0eqlu.py", line 2, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s731007141 | p02573 | u743682467 | 1598731783 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 45376 | 525 | #D
N,M = map(int, input().split())
L = []
for i in range(N):
L.append([])
#print(L)
maxim = 0
for i in range(M):
A,B = map(int, input().split())
for j in L:
if A in j and B in j:
break
elif A in j:
j.append(B)
break
elif B in j:
j.appen... | Traceback (most recent call last):
File "/tmp/tmp5xexgm_n/tmpjrc4dq8g.py", line 2, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s188176776 | p02573 | u565711859 | 1598731768 | Python | PyPy3 (7.3.0) | py | Runtime Error | 562 | 161372 | 692 | import collections
class UnionFind:
def __init__(self, n):
self.parent = list(range(n))
def find(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(self, x, y):
x =... | Traceback (most recent call last):
File "/tmp/tmpiuuqrro2/tmp14uofgte.py", line 22, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s394636179 | p02573 | u470560351 | 1598731767 | Python | Python (3.8.2) | py | Runtime Error | 640 | 17848 | 1476 | N, M=map(int, input().split())
import collections
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.... | Traceback (most recent call last):
File "/tmp/tmplj9zh9zt/tmprpbe56vb.py", line 1, in <module>
N, M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s089072973 | p02573 | u491296898 | 1598731755 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 78000 | 770 | from collections import defaultdict, deque
n,m = list(map(int, input().split()))
d = defaultdict(list)
for _ in range(m):
a,b = list(map(int, input().split()))
d[a].append(b)
d[b].append(a)
def dfs(node):
s = set()
stack = deque([node])
while stack:
n = stac... | Traceback (most recent call last):
File "/tmp/tmpylf8v9_0/tmpcriow9rr.py", line 2, in <module>
n,m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s517804440 | p02573 | u933929042 | 1598731748 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1025 | 383356 | 1379 | import random
import sys
sys.setrecursionlimit(100000)
n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
for i in range(m):
a, b = map(int, input().split())
# a, b = random.sample(range(1,n+1), 2)
if group[a]==0 and... | Traceback (most recent call last):
File "/tmp/tmp7ttsd12b/tmpruz5ks3o.py", line 6, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s540350878 | p02573 | u450288159 | 1598731733 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 36356 | 802 | # -*- coding: utf-8 -*-
# def get_group_num(sum, nums):
# if len(nums) == 1:
# return sum + nums[0]
# pass
def main():
n, m = map(int, input().split())
friends_list = []
for i in range(m):
check=True
a,b = map(int, input().split())
for i, friends_set in enumerate(fri... | Traceback (most recent call last):
File "/tmp/tmpn7fmm60t/tmpt8do57bp.py", line 30, in <module>
main()
File "/tmp/tmpn7fmm60t/tmpt8do57bp.py", line 8, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s473394324 | p02573 | u994147425 | 1598731722 | Python | Python (3.8.2) | py | Runtime Error | 563 | 21252 | 672 | import collections
N,M = list(map(int, input().split()))
team_table = [0 for i in range(N)]
color = 0
for i in range(M):
A,B = list(map(int, input().split()))
if (team_table[A-1] == 0)&(team_table[B-1] == 0):
color = A
team_table[A-1] = color
team_table[B-1] = color
elif (team_tabl... | Traceback (most recent call last):
File "/tmp/tmp48svaw4e/tmppwwxabb2.py", line 3, in <module>
N,M = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s059925581 | p02573 | u155659281 | 1598731708 | Python | Python (3.8.2) | py | Runtime Error | 3885 | 194996 | 586 | import collections
def solve():
N,M = map(int,input().split())
ABlist = [[0 for _ in range(2)] for _ in range(M)]
WA = [0]*N
for i in range(N):
WA[i] = i+1
for i in range(M):
A, B = map(int,input().split())
if A>B:
A,B =B,A
ABlist[i][0] = A
ABlist[i][1] = B
ABlist.sort(key=lambda x... | Traceback (most recent call last):
File "/tmp/tmpt4693du_/tmpgisnuiqt.py", line 26, in <module>
solve()
File "/tmp/tmpt4693du_/tmpgisnuiqt.py", line 3, in solve
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s263687645 | p02573 | u698902360 | 1598731706 | Python | Python (3.8.2) | py | Runtime Error | 781 | 44568 | 946 | import sys
from collections import defaultdict
import collections
class UnionFind2:
def __init__(self, size):
# 負の値はルート (集合の代表)
# 正の値は次の要素を表す
self.table = [-1 for _ in range(size)]
# 集合の代表を求める
def find(self, x):
if self.table[x] < 0:
return x
else:
... | Traceback (most recent call last):
File "/tmp/tmpy_egjlya/tmpljaorhyd.py", line 31, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s496329162 | p02573 | u960611411 | 1598731697 | Python | Python (3.8.2) | py | Runtime Error | 446 | 45272 | 1269 | [n, m] = list(map(int, input().split()))
abList = []
for i in range(m):
abList.append(list(map(int, input().split())))
class QuickFind(object):
id = []
count = 0
def __init__(self, n):
self.count = n
i = 0
while i < n:
self.id.append(i)
i += 1
def c... | Traceback (most recent call last):
File "/tmp/tmprqur6clv/tmp7wlg6r6k.py", line 1, in <module>
[n, m] = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s742108147 | p02573 | u933929042 | 1598731679 | Python | PyPy3 (7.3.0) | py | Runtime Error | 917 | 382564 | 1378 | import random
import sys
sys.setrecursionlimit(10000)
n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
for i in range(m):
a, b = map(int, input().split())
# a, b = random.sample(range(1,n+1), 2)
if group[a]==0 and ... | Traceback (most recent call last):
File "/tmp/tmpv86rxsna/tmpup6g6vkn.py", line 6, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s768132211 | p02573 | u470560351 | 1598731664 | Python | Python (3.8.2) | py | Runtime Error | 657 | 17856 | 1471 | N, M=map(int, input().split())
import collections
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.... | Traceback (most recent call last):
File "/tmp/tmpuf7f9j3h/tmpuedftoy2.py", line 1, in <module>
N, M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s621656822 | p02573 | u260370057 | 1598731661 | Python | Python (3.8.2) | py | Runtime Error | 2278 | 2505992 | 683 | n,m = map(int,input().split())
frl = [] #friend list
number = [0]*n #personal number
lnum = 1
for i in range(m):
a,b = map(int,input().split())
if number[a-1] == 0 and number[b-1] == 0:
number[a-1] = lnum
number[b-1] = lnum
frl.append([a,b])
lnum += 1
elif number[a-1] != 0 and number[b-1] != 0:
if number[a... | Traceback (most recent call last):
File "/tmp/tmp6xi2zx85/tmpf44mordi.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225224804 | p02573 | u941047297 | 1598731643 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9480 | 834 | from collections import defaultdict
def generate_primes(n):
is_prime = [True] * (n + 1)
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(n**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, n + 1, i):
is_prime[j] = False
return [i for ... | Traceback (most recent call last):
File "/tmp/tmp6wj4n1fs/tmpk7p6huzh.py", line 34, in <module>
main()
File "/tmp/tmp6wj4n1fs/tmpk7p6huzh.py", line 14, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s114366801 | p02573 | u552145906 | 1598731635 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 46120 | 557 | N, M = map(int, input().split())
G = []
for _ in range(M):
ver = list(map(int,input().split()))
G.append(ver)
Ans = [G[0]]
for i in range(M):
test = False
for k in range(len(Ans)):
a = Ans[k]
b = G[i]
if set(a).isdisjoint(set(b)):
test = True
else:
... | Traceback (most recent call last):
File "/tmp/tmpoiuam37f/tmpov79xz6j.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s878525894 | p02573 | u933929042 | 1598731620 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1490 | 589568 | 1378 | import random
import sys
sys.setrecursionlimit(10000)
# n, m = map(int, input().split())
n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
for i in range(m):
# a, b = map(int, input().split())
a, b = random.sample(range(1,n+1), 2)
if group[a]==0 and ... | Traceback (most recent call last):
File "/tmp/tmp6_8z54st/tmp8a9ijrfg.py", line 50, in dps
count += dps(g_mem, edge, e)
^^^^^^^^^^^^^^^^^^^
File "/tmp/tmp6_8z54st/tmp8a9ijrfg.py", line 50, in dps
count += dps(g_mem, edge, e)
^^^^^^^^^^^^^^^^^^^
File "/tmp/tmp6_8z54st/tmp8a9ijrfg.... | |
s983684414 | p02573 | u896004073 | 1598731615 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1336 | 560232 | 598 | import sys
N, M = map(int, input().split())
sys.setrecursionlimit(M+N)
v_neighbor = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
v_neighbor[a-1].append(b-1)
v_neighbor[b-1].append(a-1)
v_visit = [False for _ in range(N)]
def search(n):
count = 0
for n_ in set(v_ne... | Traceback (most recent call last):
File "/tmp/tmpllwl5l9e/tmpwkgla3uo.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s078203020 | p02573 | u868600519 | 1598731576 | Python | PyPy3 (7.3.0) | py | Runtime Error | 788 | 175372 | 625 | from collections import defaultdict
N, M = map(int, input().split())
D = defaultdict(set)
R = {}
for _ in range(M):
a, b = map(int, input().split())
if a in R:
if b in R:
aa, bb = R[a], R[b]
if aa == bb:
pass
else:
if len(D[aa]) < len(D[bb]):
aa, bb = bb, aa
... | Traceback (most recent call last):
File "/tmp/tmp_ix1gtkh/tmpe346h7j1.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s897354232 | p02573 | u710515311 | 1598731574 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 128832 | 524 | def solve():
N, M = [int(i) for i in input().split()]
R = []
for _ in range(M):
A, B = [int(i) for i in input().split()]
f = False
if (len(R) > 0):
for r in R:
if A in r:
f = True
r.add(B)
elif B in r... | Traceback (most recent call last):
File "/tmp/tmp8fjdzjru/tmp10eiyy3e.py", line 22, in <module>
solve()
File "/tmp/tmp8fjdzjru/tmp10eiyy3e.py", line 2, in solve
N, M = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s521853536 | p02573 | u018808362 | 1598731573 | Python | Python (3.8.2) | py | Runtime Error | 2225 | 658964 | 295 | import numpy as np
N, M = map(int,input().split())
Adj=np.identity(N)
for i in range(M):
A, B= map(int,input().split())
Adj[A-1,B-1]=1
Adj[B-1,A-1]=1
AD=np.dot(Adj, Adj)
count=0
for i in range(N):
ans=np.count_nonzero(AD[i, :])
if ans>count:
count=ans
print(count) | Traceback (most recent call last):
File "/tmp/tmp9r0d3d8t/tmp2lxvzmg5.py", line 3, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s442110844 | p02573 | u463068683 | 1598731570 | Python | Python (3.8.2) | py | Runtime Error | 2219 | 358272 | 345 | n,m = map(int, input().split())
ls=[]
a,b = map(int, input().split())
tmp = {a, b}
ls.append(tmp)
for i in range(m-1):
a,b = map(int, input().split())
for s in ls:
if (a in s) or (b in s):
s.add(a)
s.add(b)
break
else:
tmp = {a,b}
ls.append(tmp)
ans = 0
for s in ls:
ans = ma... | Traceback (most recent call last):
File "/tmp/tmpkozife5x/tmpe97posl3.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s040302632 | p02573 | u698902360 | 1598731568 | Python | PyPy3 (7.3.0) | py | Runtime Error | 575 | 161900 | 947 | import sys
from collections import defaultdict
import collections
class UnionFind2:
def __init__(self, size):
# 負の値はルート (集合の代表)
# 正の値は次の要素を表す
self.table = [-1 for _ in range(size)]
# 集合の代表を求める
def find(self, x):
if self.table[x] < 0:
return x
else:
... | Traceback (most recent call last):
File "/tmp/tmpkyqa18zw/tmpu7f2rbah.py", line 31, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s741794908 | p02573 | u347502437 | 1598731559 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 39036 | 831 | N, M = map(int, input().split())
info = []
count = 0
while count < M:
A, B = map(int,input().split())
info += [[A,B]]
count += 1
friends = []
for k in range(1,N+1):
for I in info:
if I[0] == k and I[1] < k:
flag = False
for j in range(len(friends)):
if I... | Traceback (most recent call last):
File "/tmp/tmp41s9trh_/tmpgz85ubeu.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s713778186 | p02573 | u745685739 | 1598731541 | Python | Python (3.8.2) | py | Runtime Error | 784 | 25500 | 429 |
def solve():
n,m=map(int,input().split())
fa=list(range(0,n+1))
sz=[1]*(n+1)
def gf(x) :
if x==fa[x] :
return x
fa[x]=gf(fa[x])
return fa[x]
for i in range(m) :
a,b=map(gf,map(int,input().split()))
if a!=b :
fa[a]=b
sz[b]... | Traceback (most recent call last):
File "/tmp/tmpc1q0ozg8/tmprtde_t3e.py", line 24, in <module>
print(solve())
^^^^^^^
File "/tmp/tmpc1q0ozg8/tmprtde_t3e.py", line 3, in solve
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s368989587 | p02573 | u246907970 | 1598731541 | Python | Python (3.8.2) | py | Runtime Error | 2220 | 362280 | 445 | ininfo = input().split(" ")
num = int(ininfo[0])
m = int(ininfo[1])
list=[]
for i in range(m):
list.append(input().split(" "))
list[i].sort()
list.sort()
anslist=[]
s={list[0][0],list[0][1]}
anslist.append(s)
for i in list:
for j in anslist:
if i[0] in j or i[1] in j:
j.add(i[0])
j.add(i[1])
... | Traceback (most recent call last):
File "/tmp/tmpkbbixu23/tmplj3fo7mz.py", line 1, in <module>
ininfo = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s153161823 | p02573 | u418381221 | 1598731532 | Python | Python (3.8.2) | py | Runtime Error | 1866 | 1215032 | 533 | import numpy as np
from scipy.sparse.csgraph import connected_components
import collections
def main():
N, M = map(int, input().split())
ab = []
for i in range(M):
ab.append(list(map(int,input().split())))
l = np.zeros((N, N), dtype = np.int64)
for i in range(M):
l[ab[i][0]-1,ab[i... | Traceback (most recent call last):
File "/tmp/tmp_z_qj7a0/tmpa6lf1b60.py", line 23, in <module>
main()
File "/tmp/tmp_z_qj7a0/tmpa6lf1b60.py", line 6, in main
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s570084521 | p02573 | u496009935 | 1598731515 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 76976 | 501 |
def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
n,m=map(int,input().split())
L=[]
for i in range(m):
if L==[]:
L.append(list(map(int,input().split())))
else:
t=list(map(int,input().split()))
for j in range(len(L)):
... | Traceback (most recent call last):
File "/tmp/tmpd5my3mlf/tmpkdypzydt.py", line 6, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s860730646 | p02573 | u119982001 | 1598731507 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2347 | 3528100 | 261 | n, m = map(int, input().split())
arr = [[0]*n for i in range(n)]
ans = 0
for i in range(m):
a, b = map(int, input().split())
arr[a-1][b-1] = b
arr[b-1][a-1] = a
for i in range(len(arr)):
ans = max(ans, sum(x>0 for x in arr[i]))
print(ans+1)
| Traceback (most recent call last):
File "/tmp/tmpn22wedf_/tmpovos9up2.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s858210946 | p02573 | u760569096 | 1598731503 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 129720 | 429 | n,m = map(int, input().split())
g = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
if not b-1 in g[a-1]:
g[a-1].append(b-1)
if not a-1 in g[b-1]:
g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = [0]*n
def dfs(x,y):
for i in g[x]:
if v[i] == -1:
v[i]=v[x]+1
... | Traceback (most recent call last):
File "/tmp/tmp3mk5zmnq/tmpzwkfc3rv.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s687360984 | p02573 | u170839742 | 1598731487 | Python | PyPy3 (7.3.0) | py | Runtime Error | 484 | 100880 | 475 | from collections import defaultdict
N, M = map(int, input().split())
parent = [-1] * N
def union(x, y):
x = find(x)
y = find(y)
if x == y:
return
parent[x] = y
def find(x):
if parent[x] == -1:
return x
res = parent[x] = find(parent[x])
return res
for _ in range(M):
... | Traceback (most recent call last):
File "/tmp/tmpjwd9eow1/tmpb_0ldp13.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s169940642 | p02573 | u896004073 | 1598731469 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1361 | 571316 | 598 | import sys
N, M = map(int, input().split())
sys.setrecursionlimit(M+1)
v_neighbor = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
v_neighbor[a-1].append(b-1)
v_neighbor[b-1].append(a-1)
v_visit = [False for _ in range(N)]
def search(n):
count = 0
for n_ in set(v_ne... | Traceback (most recent call last):
File "/tmp/tmp7ks1jeuv/tmpk8u1xq8p.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s073460740 | p02573 | u608178601 | 1598731466 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45660 | 527 | N,M=map(int, input().split())
AB=[list(map(int, input().split())) for _ in range(M)]
mem=[AB.pop(0)]
for _ in range(M-1):
temp=AB.pop(0)
if temp not in AB:
i,j=temp[0],temp[1]
flag=0
for h in range(len(mem)):
if i in mem[h] and j not in mem[h]:
flag=1
mem[h].append(j)
elif j in mem[h] and i not i... | Traceback (most recent call last):
File "/tmp/tmp6866hgpk/tmpffxdz8ok.py", line 1, in <module>
N,M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s766586865 | p02573 | u933929042 | 1598731464 | Python | Python (3.8.2) | py | Runtime Error | 803 | 54820 | 1329 | import random
n, m = map(int, input().split())
# n, m = 10, 10
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
for i in range(m):
a, b = map(int, input().split())
# a, b = random.sample(range(1,n+1), 2)
if group[a]==0 and group[b] == 0:
g_num += 1
group[a... | Traceback (most recent call last):
File "/tmp/tmp3xzfo_9y/tmpjz_d38ux.py", line 3, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s570658255 | p02573 | u960611411 | 1598731456 | Python | Python (3.8.2) | py | Runtime Error | 469 | 45380 | 1117 | [n, m] = list(map(int, input().split()))
abList = []
for i in range(m):
abList.append(list(map(int, input().split())))
class QuickFind(object):
id = []
count = 0
def __init__(self, n):
self.count = n
i = 0
while i < n:
self.id.append(i)
i += 1
def c... | Traceback (most recent call last):
File "/tmp/tmpc_jtjo5v/tmphc2kad3n.py", line 1, in <module>
[n, m] = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s954518151 | p02573 | u821989875 | 1598731448 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 101052 | 637 | import collections
n, m = map(int, input().split())
gp = []
hf = [-1 for i in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
if hf[a] == -1 and hf[b] == -1:
hf[a] = len(gp)
hf[b] = len(gp)
gp.append([a, b])
elif hf[a] == -1:
hf[a] = hf[b]
gp[hf[b]].append(a)
elif hf[b] == -... | Traceback (most recent call last):
File "/tmp/tmp9lonuoth/tmpo2par5lh.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s306354230 | p02573 | u698902360 | 1598731446 | Python | PyPy3 (7.3.0) | py | Runtime Error | 536 | 169044 | 952 | import sys
from collections import defaultdict
import collections
class UnionFind2:
def __init__(self, size):
# 負の値はルート (集合の代表)
# 正の値は次の要素を表す
self.table = [-1 for _ in range(size)]
# 集合の代表を求める
def find(self, x):
if self.table[x] < 0:
return x
else:
... | Traceback (most recent call last):
File "/tmp/tmpsu5mdftc/tmpsrhvb9ya.py", line 31, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s971753840 | p02573 | u608178601 | 1598731443 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2209 | 102240 | 527 | N,M=map(int, input().split())
AB=[list(map(int, input().split())) for _ in range(M)]
mem=[AB.pop(0)]
for _ in range(M-1):
temp=AB.pop(0)
if temp not in AB:
i,j=temp[0],temp[1]
flag=0
for h in range(len(mem)):
if i in mem[h] and j not in mem[h]:
flag=1
mem[h].append(j)
elif j in mem[h] and i not i... | Traceback (most recent call last):
File "/tmp/tmp70mwa8o4/tmphgju63c1.py", line 1, in <module>
N,M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s180632706 | p02573 | u790812284 | 1598731431 | Python | Python (3.8.2) | py | Runtime Error | 691 | 72528 | 435 | from collections import Counter
N, M = map(int, input().split())
friends = []
for _ in range(M):
A_i, B_i = map(int, input().split())
if A_i > B_i:
A_i, B_i = B_i, A_i
friends.append((A_i, B_i))
friends = list(set(friends))
friends_count = []
for friend_set in friends:
friends_count.appen... | Traceback (most recent call last):
File "/tmp/tmpx8ip_jve/tmpbgd0uif5.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s638966280 | p02573 | u571999153 | 1598731424 | Python | Python (3.8.2) | py | Runtime Error | 1926 | 1021928 | 348 | import numpy as np
from scipy.sparse.csgraph import connected_components
n,m = map(int, input().split())
matrix = np.zeros((n,n))
for i in range(m):
a,b = map(int, input().split())
matrix[a-1][b-1] += 1
x, labels = connected_components(matrix)
group_count = [0 for i in range(x)]
for i in labels:
group_count[i] ... | Traceback (most recent call last):
File "/tmp/tmp22cbju32/tmpcfuwoz30.py", line 4, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s915819659 | p02573 | u514687406 | 1598731413 | Python | Python (3.8.2) | py | Runtime Error | 578 | 49404 | 1100 | import sys
import collections
input = lambda: sys.stdin.readline().rstrip("\r\n")
## taken from GFG
class Graph:
def __init__(self,V):
self.V = V
self.adj = [[] for i in range(V)]
def DFSUtil(self, temp, v, visited):
visited[v] = True
temp.append(v)
for i in self.adj[v]:
if visited[i] == Fa... | Traceback (most recent call last):
File "/tmp/tmp3skkaftu/tmpyd9a2be6.py", line 52, in <module>
solve()
File "/tmp/tmp3skkaftu/tmpyd9a2be6.py", line 37, in solve
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s318165681 | p02573 | u243061947 | 1598731407 | Python | Python (3.8.2) | py | Runtime Error | 1205 | 102844 | 644 | def make_group(checked, a, friends):
group = []
if checked[a]:
return group
group.append(a)
checked[a] = True
for b in friends[a]:
group += make_group(checked, b, friends)
return group
n, m = map(int, input().split())
friends = {}
checked = {}
for i in range(n):
friends[i+1] = set()
checked[i... | Traceback (most recent call last):
File "/tmp/tmp5wjr1u5y/tmpptq116m4.py", line 11, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s593715541 | p02573 | u942051624 | 1598731406 | Python | PyPy3 (7.3.0) | py | Runtime Error | 84 | 68684 | 448 | import collections
import math
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
N,M=map(int, input().split())
l=[[0 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]=1
a = np.array(l)
# print(type(a))
... | Traceback (most recent call last):
File "/tmp/tmpdy7fmwcr/tmptg84lbnl.py", line 8, in <module>
N,M=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s843614089 | p02573 | u199830845 | 1598731390 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9036 | 1733 |
def resolve():
import sys
sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数
# 入力を整数に変換して受け取る
def input_int():
return int(input())
def map_int_input():
... | File "/tmp/tmpdt1nw9qg/tmpu6nje8in.py", line 62
resolve()
^
IndentationError: unindent does not match any outer indentation level
| |
s128280699 | p02573 | u010379708 | 1598731379 | Python | PyPy3 (7.3.0) | py | Runtime Error | 355 | 107492 | 446 | n,q=map(int,input().split())
track=(n+1)*[0]
for i in range(q):
j, k = map(int, input().split())
j, k = min(j, k), max(j, k)
if type(track[j]) is int and track[j]==0:
track[j]={k:1}
track[k]=-j
elif type(track[j]) is int and track[j]<0:
track[-track[j]][k]=1
track[k]=trac... | Traceback (most recent call last):
File "/tmp/tmpbnphd3_5/tmpsxv7tyjf.py", line 1, in <module>
n,q=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s915042981 | p02573 | u285402032 | 1598731370 | Python | PyPy3 (7.3.0) | py | Runtime Error | 765 | 173084 | 424 | n, m = map(int, input().split())
friend = [set() for i in range(n)]
for i in range(m):
a = list(map(int, input().split()))
a.sort()
x, y = a[0]-1,a[1]-1
friend[x].add(y)
friend[y].add(x)
def dfs(s):
if vis[s] == False:
vis[s] = True
ary.append(s)
for j in friend[s]:
dfs(j)
vis = [False ... | Traceback (most recent call last):
File "/tmp/tmpm2yxc_uc/tmpzxugzgc6.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s336261450 | p02573 | u070630744 | 1598731368 | Python | PyPy3 (7.3.0) | py | Runtime Error | 437 | 85344 | 659 | def solve():
n, m = map(int, input().split())
group = []
done = [-1]*n
num = 0
for i in range(m):
a, b = map(lambda x:int(x)-1, input().split())
if done[a] != -1:
if done[b] == -1:
group[done[a]].append(b)
done[b] = done[a]
else:
... | Traceback (most recent call last):
File "/tmp/tmp0tvg9beb/tmp1emjl2h3.py", line 25, in <module>
solve()
File "/tmp/tmp0tvg9beb/tmp1emjl2h3.py", line 2, in solve
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s467648377 | p02573 | u202641516 | 1598731359 | Python | PyPy3 (7.3.0) | py | Runtime Error | 767 | 175636 | 602 | from collections import defaultdict as dc
x, y = map(int, input().split())
graph = [[] for n in range(x+1)]
st = dc(lambda: 0)
for n in range(y):
a, b = map(int, input().split())
if a > b:
a, b = b, a
if st[(a, b)] == 0:
st[(a, b)] = 1
graph[a].append(b)
graph[b].append(... | Traceback (most recent call last):
File "/tmp/tmphnwqa1nj/tmptcjeckcz.py", line 2, in <module>
x, y = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s262273438 | p02573 | u347502437 | 1598731345 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 39192 | 830 | N, M = map(int, input().split())
info = []
count = 0
while count < M:
A, B = map(int,input().split())
info += [[A,B]]
count += 1
friends = []
for k in range(1,N+1):
for I in info:
if I[0] == k and I[1] < k:
flag = False
for j in range(len(friends)):
if I... | Traceback (most recent call last):
File "/tmp/tmpv37v30or/tmps9jfb9u5.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s715779991 | p02573 | u496009935 | 1598731324 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 73680 | 435 | n,m=map(int,input().split())
L=[list(map(int,input().split()))]
def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
for i in range(m-1):
t=list(map(int,input().split()))
for j in range(len(L)):
if t[0] in L[j] or t[1] in L[j]:
L[... | Traceback (most recent call last):
File "/tmp/tmp1uy0mgmt/tmpucpca800.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s072259323 | p02573 | u868600519 | 1598731287 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 51184 | 563 | from collections import defaultdict
N, M = map(int, input().split())
D = defaultdict(set)
R = {}
for _ in range(M):
a, b = map(int, input().split())
if a in R:
if b in R:
aa, bb = R[a], R[b]
if aa == bb:
pass
else:
for x in D[bb]:
R[x] = aa
D[aa] |= D[bb]
... | Traceback (most recent call last):
File "/tmp/tmp8p42gg12/tmpnfw7ceiq.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s383196873 | p02573 | u581022379 | 1598731282 | Python | Python (3.8.2) | py | Runtime Error | 450 | 19556 | 501 | import collections
N, M = map(int, input().split())
groups = [0] * (N + 1)
group_num = 1
for _ in range(M):
A, B = map(int, input().split())
if groups[A] != 0:
groups[B] = groups[A]
elif groups[B] != 0:
groups[A] = groups[B]
else:
groups[A] = groups[B] = group_num
group_n... | Traceback (most recent call last):
File "/tmp/tmpnh34pl1u/tmp753l521e.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s441507740 | p02573 | u443996531 | 1598731274 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 66368 | 521 | n,m = map(int,input().split())
ab = [[]]*m
for i in range(m):
ab[i] = list(map(int,input().split()))
ab[i].sort()
if m<1:
print(1)
else:
ab.sort()
frgrps = {0:{ab[0][0],ab[0][1]}}
grpno = 0
for i in range(m):
for j in range(grpno+1):
if ab[i][0] in frgrps[j] or ab[i][1] in frgrps[j]:
f... | Traceback (most recent call last):
File "/tmp/tmprl4lx3xr/tmpntsg51te.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s370472496 | p02573 | u671455949 | 1598731267 | Python | Python (3.8.2) | py | Runtime Error | 3774 | 149524 | 323 | n, m = map(int, input().split())
group_idx = [i for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
if a > b:
a, b = b, a
group_idx[b - 1] = group_idx[a - 1]
print(group_idx)
groups = [0 for i in range(n)]
for i in range(n):
groups[group_idx[i]] += 1
print(group_idx)
print(max(group... | Traceback (most recent call last):
File "/tmp/tmpma5jlvog/tmp7ssinn0m.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s638093355 | p02573 | u522293645 | 1598731267 | Python | Python (3.8.2) | py | Runtime Error | 591 | 47656 | 1860 | import collections # deque, Counter
# import itertools # accumulate, compress, permutations(nPr), combinations(nCr)
# import bisect # bisect_left(insert位置), bisect_right(slice用)
# import math # factorical(階乗) # hypot(距離)
# import heapq
# from fractions import gcd # >=Python3.5 # lcm(最小公倍数) = (a*b)//gcd(a,... | Traceback (most recent call last):
File "/tmp/tmpy83_eik0/tmp00dig3to.py", line 59, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s560757693 | p02573 | u863397945 | 1598731259 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 58284 | 334 | #グループの最大人数を算出=ans
N,M = map(int,input().split())
groups = []
for i in range(M):
A,B = map(int,input().split())
groups.append([A,B])
for i in range(M):
groups = list(map(lambda x: list(set(x+groups[i])) if not set(x).isdisjoint(set(groups[i])) else x, groups))
print(max(len(x) for x in groups)) | Traceback (most recent call last):
File "/tmp/tmp8tl8sbyc/tmpztneghy2.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s444314824 | p02573 | u844426556 | 1598731251 | Python | Python (3.8.2) | py | Runtime Error | 1277 | 101352 | 849 | def DFS(graph, start, end, mark_set, max_count):
mark_set.add(start)
tmp = max_count
for target in list(graph[start]):
if target == end:
print("exist")
return
elif target not in mark_set:
mark_set.add(target)
tmp = max(DFS(graph, target, end, m... | Traceback (most recent call last):
File "/tmp/tmpvxb_m57l/tmpx3wi6tlu.py", line 14, in <module>
N, M = map(lambda x: int(x), input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s043901000 | p02573 | u850087201 | 1598731231 | Python | Python (3.8.2) | py | Runtime Error | 762 | 47484 | 950 | import copy
(N,M) = map(int,input().split())
l = []
if M == 0:
print(1)
else:
for i in range(M):
l.append([int(x) for x in input().split()])
mn = 0
for i in range(M):
for j in range(2):
mn = max(mn,l[i][j])
s = [0 for i in range(mn)]
k = [0 for i in range(M)]
c... | Traceback (most recent call last):
File "/tmp/tmpvhk5udc9/tmph9_rmgvl.py", line 2, in <module>
(N,M) = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s899221178 | p02573 | u310381103 | 1598731199 | Python | Python (3.8.2) | py | Runtime Error | 1552 | 248864 | 239 | n,m=map(int,input().split())
ab = [map(int, sorted(input().split())) for _ in range(m)]
a, b = [list(i) for i in zip(*ab)]
ans=[set(str(i)) for i in range(1,n+1)]
for i in range(m):
ans[a[i]-1].add(b[i])
print(max([len(x) for x in ans])) | Traceback (most recent call last):
File "/tmp/tmp78wepo0x/tmpf789pa9n.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s707524681 | p02573 | u199830845 | 1598731193 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12260 | 1564 | def resolve():
import sys
sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数
# 入力を整数に変換して受け取る
def input_int(): return int(input())
def map_int_input(): return map(int, ... | Traceback (most recent call last):
File "/tmp/tmp4ylloyph/tmp1go27h28.py", line 50, in <module>
resolve()
File "/tmp/tmp4ylloyph/tmp1go27h28.py", line 32, in resolve
N, M = MII_split()
^^^^^^^^^^^
File "/tmp/tmp4ylloyph/tmp1go27h28.py", line 14, in MII_split
def MII_split(): return map(int,... | |
s773627430 | p02573 | u418527037 | 1598731187 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 36484 | 842 | N, M = list(map(int, input().split()))
A, B = list(map(int, input().split()))
T = [{A, B}]
for i in range(M-1):
A, B = list(map(int, input().split()))
Flag = True
for j in T:
if A in j:
if B in j:
Flag = False
else:
j.add(B)
F... | Traceback (most recent call last):
File "/tmp/tmpcpcr7oc4/tmpisfbj4td.py", line 1, in <module>
N, M = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s761628554 | p02573 | u238504302 | 1598731186 | Python | Python (3.8.2) | py | Runtime Error | 2218 | 336884 | 311 | N, M = map(int,input().split())
r = [input().split()]
for i in range(1, M):
a, b = input().split()
for j in range(len(r)):
if a in r[j] or b in r[j]:
r[j].append(a)
r[j].append(b)
else:
r.append([a, b])
ans = 0
for i in range(len(r)):
ans = max(ans, len(set(r[i])))
print(ans) | Traceback (most recent call last):
File "/tmp/tmpnikt17sx/tmp6_ryfcw5.py", line 1, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s611689405 | p02573 | u344030307 | 1598731157 | Python | Python (3.8.2) | py | Runtime Error | 2233 | 821608 | 526 | import copy
n, m = map(int, input().split())
frends = {}
for i in range(m):
a,b = map(int, input().split())
if a not in frends:
frends[a] = set([a])
if b not in frends:
frends[b] = set([b])
frends[a].add(b)
frends[b].add(a)
group = copy.copy(frends)
for i in frends:
flag = False
r = group[... | Traceback (most recent call last):
File "/tmp/tmp0tehegkm/tmpw_eoumky.py", line 3, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s214152478 | p02573 | u435480265 | 1598731132 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2221 | 528980 | 591 | n, m = map(int, input().split())
d = {x:-1 for x in range(1,n+1)}
gp = []
for _ in range(m):
i,j = map(int, input().split())
if d[i] == -1 and d[j] == -1:
gp.append({i, j})
d[i] = len(gp) - 1
d[j] = len(gp) - 1
elif d[i] == -1 and d[j] != -1:
d[i] = d[j]
gp[d[j]].add... | Traceback (most recent call last):
File "/tmp/tmp3wv7c4hc/tmph_0w8e2s.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s248642858 | p02573 | u412255932 | 1598731125 | Python | PyPy3 (7.3.0) | py | Runtime Error | 586 | 173116 | 526 | from collections import defaultdict
def dfs(node):
if node in visited:
return False
visited.add(node)
for neighbor in adj_list[node]:
dfs(neighbor)
return True
N, M = map(int, input().split())
A, B = [], []
adj_list = defaultdict(set)
visited = set([])
count = 0
for i in range(M):
... | Traceback (most recent call last):
File "/tmp/tmp_i8b75pl/tmpan_gkx0z.py", line 11, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s647634982 | p02573 | u766486294 | 1598731113 | Python | Python (3.8.2) | py | Runtime Error | 493 | 16188 | 457 | import collections
N, M = map(int, input().split())
friend_group = [0] * (N+1)
for _ in range(M):
a, b = map(int, input().split())
tmp = max(friend_group[a], friend_group[b])
if tmp == 0:
tmp = a
friend_group[a] = tmp
friend_group[b] = tmp
col = collections.Counter(friend_group)
sorted_r... | Traceback (most recent call last):
File "/tmp/tmpycvvxk69/tmpdfn1hlzb.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s631922389 | p02573 | u067105756 | 1598731106 | Python | PyPy3 (7.3.0) | py | Runtime Error | 189 | 104044 | 980 | class UnionFind:
def __init__(self, n):
self.parent = [i for i in range(n)]
self.height = [0 for _ in range(n)]
def unite(self, i, j):
root_i = self.get_root(i)
root_j = self.get_root(j)
if root_i != root_j:
if self.height[root_i] < self.height[ro... | Traceback (most recent call last):
File "/tmp/tmpxyycfi8v/tmp25v5mq2y.py", line 27, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s784640496 | p02573 | u199830845 | 1598731106 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12244 | 1563 | def resolve():
import sys
sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数
# 入力を整数に変換して受け取る
def input_int(): return int(input())
def map_int_input(): return map(int, ... | Traceback (most recent call last):
File "/tmp/tmpfrrxc0ut/tmppptfnqvz.py", line 50, in <module>
resolve()
File "/tmp/tmpfrrxc0ut/tmppptfnqvz.py", line 32, in resolve
N, M = MII_split()
^^^^^^^^^^^
File "/tmp/tmpfrrxc0ut/tmppptfnqvz.py", line 14, in MII_split
def MII_split(): return map(int,... | |
s961943941 | p02573 | u868600519 | 1598731074 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2212 | 219540 | 563 | from collections import defaultdict
N, M = map(int, input().split())
D = defaultdict(set)
R = {}
for _ in range(M):
a, b = map(int, input().split())
if a in R:
if b in R:
aa, bb = R[a], R[b]
if aa == bb:
pass
else:
for x in D[bb]:
R[x] = aa
D[aa] |= D[bb]
... | Traceback (most recent call last):
File "/tmp/tmphum2dwyc/tmpu8t7gm4o.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s738803672 | p02573 | u916338311 | 1598731072 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2337 | 3518056 | 240 | N, M = map(int, input().split())
matrix = [[0] * N for _ in range(N)]
for _ in range(M):
i, j = map(int, input().split())
matrix[i-1][j-1] = matrix[j-1][i-1] = 1
num = 0
for i in range(N):
num = max(num, sum(matrix[i]))
print(num+1) | Traceback (most recent call last):
File "/tmp/tmp9gvzv7fr/tmpcyxy39h_.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s929378588 | p02573 | u970082363 | 1598731059 | Python | Python (3.8.2) | py | Runtime Error | 492 | 12708 | 459 | n,m = (int(x) for x in input().split())
friendlist = [0]*(n+1)
classes = 0
for i in range(m):
a,b = (int(x)-1 for x in input().split())
if friendlist[a]!=0:
friendlist[b] = friendlist[a]
elif friendlist[b]!=0:
friendlist[a] = friendlist[b]
else:
classes += 1
friendlist[a]... | Traceback (most recent call last):
File "/tmp/tmpt_szqpcq/tmp_cq8kjue.py", line 1, in <module>
n,m = (int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s818423818 | p02573 | u202641516 | 1598731040 | Python | PyPy3 (7.3.0) | py | Runtime Error | 800 | 179832 | 603 | from collections import defaultdict as dc
x, y = map(int, input().split())
graph = [[] for n in range(x+1)]
st = dc(lambda: 0)
for n in range(y):
a, b = map(int, input().split())
if a > b:
a, b = b, a
if st[(a, b)] == 0:
st[(a, b)] = 1
graph[a].append(b)
graph[b].append(... | Traceback (most recent call last):
File "/tmp/tmpfn9nbpqf/tmpd8s41lkf.py", line 2, in <module>
x, y = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s414431629 | p02573 | u209275335 | 1598731038 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2213 | 194448 | 800 | import statistics
import copy
n,m = map(int,input().split())
li = []
lig = [0]*n
for i in range(m):
a,b = map(int,input().split())
if a >= b:
li.append((b,a))
else:
li.append((a,b))
liset = list(set(li))
c = 1
for i in range(len(liset)):
if lig[liset[i][0]-1] == 0 and lig[liset[i][1]-1] ... | Traceback (most recent call last):
File "/tmp/tmpcxquseip/tmp1usxq_s5.py", line 3, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s313575804 | p02573 | u628335443 | 1598731035 | Python | Python (3.8.2) | py | Runtime Error | 934 | 72384 | 473 | N, M = map(int, input().split())
C = [set([]) for i in range(N)]
def dfs(n, y):
seen[n] = True
y += 1
for c in C[n]:
if seen[c]:
continue
else:
y = dfs(c, y)
return y
for i in range(M):
a, b = map(int, input().split())
C[a - 1].add(b - 1)
C[b - 1].... | Traceback (most recent call last):
File "/tmp/tmpq692r7zz/tmp9w2l7ejz.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s402881659 | p02573 | u305826668 | 1598731026 | Python | PyPy3 (7.3.0) | py | Runtime Error | 153 | 69416 | 1116 | #Uses python3
import sys
import threading
# This code is used to avoid stack overflow issues
sys.setrecursionlimit(10**9) # max depth of recursion
threading.stack_size(2**32) # new thread will get stack of such size
visited = set()
def explore(adj, x, comp, cc):
visited.add(x)
if not(cc in comp):
co... | Exception in thread Thread-1 (main):
Traceback (most recent call last):
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **s... | |
s134674533 | p02573 | u432453907 | 1598730948 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12624 | 268 | from statistics import mode
N, M = map(int, input().split())
f, k = [], []
for i in range(M):
A, B = map(int, input().split())
if [A, B] not in k and [B, A] not in k:
k.append([A, B])
f.append(A)
f.append(B)
print(f.count(mode(f))+1)
| Traceback (most recent call last):
File "/tmp/tmptb5l8gtq/tmpkx_noauv.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s781899239 | p02573 | u530606147 | 1598730926 | Python | Python (3.8.2) | py | Runtime Error | 1053 | 81252 | 617 | import collections
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
l = []
for _ in range(n):
l.append([])
# for x in range(n):
# l[x]
for a, b in ab:
a -= 1
b -= 1
l[a].append(b)
l[b].append(a)
# c = [None] * n
# for i in range(n):
# if c[i] is None:
#... | Traceback (most recent call last):
File "/tmp/tmpu35_hoc2/tmpa5sdui96.py", line 3, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s497119348 | p02573 | u896004073 | 1598730918 | Python | PyPy3 (7.3.0) | py | Runtime Error | 655 | 143208 | 553 | N, M = map(int, input().split())
v_neighbor = [[] for _ in range(N)]
for _ in range(M):
a, b = map(int, input().split())
v_neighbor[a-1].append(b-1)
v_neighbor[b-1].append(a-1)
v_visit = [False for _ in range(N)]
def search(n):
count = 0
for n_ in v_neighbor[n]:
if not v_visit[n_]:
... | Traceback (most recent call last):
File "/tmp/tmpicp1iir1/tmp7ako7rup.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s061477161 | p02573 | u305826668 | 1598730908 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1595 | 647364 | 1116 | #Uses python3
import sys
import threading
# This code is used to avoid stack overflow issues
sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**26) # new thread will get stack of such size
visited = set()
def explore(adj, x, comp, cc):
visited.add(x)
if not(cc in comp):
co... | Exception in thread Thread-1 (main):
Traceback (most recent call last):
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/root/miniconda3/envs/sandbox-runtime/lib/python3.11/threading.py", line 982, in run
self._target(*self._args, **s... | |
s688798761 | p02573 | u933929042 | 1598730899 | Python | Python (3.8.2) | py | Runtime Error | 703 | 54636 | 1176 | def dps(g_mem, edge, now):
count = g_mem[now]
if edge.get(now):
for e in edge[now]:
if g_reached[e] == 0:
g_reached[e] = 1
count += dps(g_mem, edge, e)
return count
n, m = map(int, input().split())
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = ... | Traceback (most recent call last):
File "/tmp/tmphky8wmy1/tmph8f3ls95.py", line 11, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s221312548 | p02573 | u501278784 | 1598730883 | Python | PyPy3 (7.3.0) | py | Runtime Error | 451 | 153728 | 441 | import collections
def connected(adj,v,visited,f):
visited[v]=True
f.append(v)
for i in adj[v]:
if not visited[i]:
connected(adj,i,visited,f)
adj=collections.defaultdict(int)
n,m=map(int,input().split())
f={}
for i in range(m):
u,v=map(int,input().split())
if u<=v:f[(u,v)... | Traceback (most recent call last):
File "/tmp/tmpnfm_vgp4/tmpr6nxhzvp.py", line 9, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s266380183 | p02573 | u170839742 | 1598730875 | Python | Python (3.8.2) | py | Runtime Error | 725 | 43036 | 475 | from collections import Counter
N, M = map(int, input().split())
parent = [-1] * N
def union(x, y):
x = find(x)
y = find(y)
if x == y:
return
parent[x] = y
def find(x):
if parent[x] == -1:
return x
res = parent[x] = find(parent[x])
return res
for _ in range(M):
a, ... | Traceback (most recent call last):
File "/tmp/tmp34udtxt2/tmp56yjbqi5.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s871968582 | p02573 | u514687406 | 1598730862 | Python | Python (3.8.2) | py | Runtime Error | 633 | 72744 | 1143 | import sys
import collections
input = lambda: sys.stdin.readline().rstrip("\r\n")
class DFS:
def __init__(self):
self.adj = collections.defaultdict(list)
self.ans = []
def addEdge(self, u, v):
self.adj[u].append(v)
self.adj[v].append(u)
def dfs_helper(self, src, visited):... | Traceback (most recent call last):
File "/tmp/tmp77i7jzsw/tmpt67ds2c4.py", line 47, in <module>
solve()
File "/tmp/tmp77i7jzsw/tmpt67ds2c4.py", line 37, in solve
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.