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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s128564717 | p02573 | u443996531 | 1598730862 | Python | Python (3.8.2) | py | Runtime Error | 1272 | 83192 | 517 | n,m = map(int,input().split())
if m<1:
print(1)
elif m == 1:
print(2)
else:
ab = [[]]*m
for i in range(m):
ab[i] = list(map(int,input().split()))
ab[i].sort()
ab.sort()
frgrps = {0:{ab[0][0],ab[0][1]}}
grpno = 0
for i in range(m):
if ab[i][0] in frgrps[grpno] or ab[i][1] in frgrps[grpno]:
... | Traceback (most recent call last):
File "/tmp/tmp2hh37iui/tmpqq3wir24.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s381206585 | p02573 | u251075661 | 1598730843 | Python | Python (3.8.2) | py | Runtime Error | 1991 | 1043932 | 403 | import numpy as np
from scipy.sparse.csgraph import connected_components
n, m = map(int, input().split())
A = np.zeros((n, n))
for _ in range(m):
a, b = map(int, input().split())
A[a-1, b-1] = 1
A[b-1, a-1] = 1
n, labels = connected_components(A)
result = 0
for i in range(n):
component_num = (labels == ... | Traceback (most recent call last):
File "/tmp/tmpbyzrg1le/tmpm339uue2.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s858576933 | p02573 | u326552320 | 1598730838 | Python | Python (3.8.2) | py | Runtime Error | 726 | 134612 | 892 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: D
# CreatedDate: 2020-08-29 21:38:12 +0900
# LastModified: 2020-08-29 21:53:47 +0900
#
import os
import sys
sys.setrecursionlimit(100000)
# import numpy as np
# import pandas as pd
from collections import Counter
def dfs(u, color, path, n, d):
color[... | Traceback (most recent call last):
File "/tmp/tmpwxc1cbb2/tmpmfa5tbz1.py", line 46, in <module>
main()
File "/tmp/tmpwxc1cbb2/tmpmfa5tbz1.py", line 27, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s795853903 | p02573 | u873776333 | 1598730828 | Python | PyPy3 (7.3.0) | py | Runtime Error | 618 | 159224 | 643 | def findgraphs(nodes):
graphs = []
while nodes:
graph = set()
queue = set([next(iter(nodes))])
while queue:
nextq = set()
graph.update(queue)
for q in queue:
nextq.update(n for n in nodes[q] if n not in graph)
del nodes[... | Traceback (most recent call last):
File "/tmp/tmp_xhpmkev/tmp9zq0l3wa.py", line 23, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s263730619 | p02573 | u665038048 | 1598730823 | Python | PyPy3 (7.3.0) | py | Runtime Error | 127 | 68624 | 266 | import numpy as np
n, m = map(int, input().split())
ab = np.array([[0] * n] * n)
for i in range(m):
a, b = map(int, input().split())
a -= 1
b -= 1
ab[a][b] = 1
ab[b][a] = 1
ans = 0
for i in range(n):
ans = max(sum(ab[i]), ans)
print(ans+1)
| Traceback (most recent call last):
File "/tmp/tmppt_xtc01/tmpllsj6zu2.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s192299646 | p02573 | u086138398 | 1598730815 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10380 | 592 | N,M = map(int,input().split())
edge = [[]]
for i in range(M):
a,b = map(int,input().split())
add = []
for j in range(len(edge)):
if a in edge[j] or b in edge[j]:
edge[j].append(a)
edge[j].append(b)
add.append(j)
if len(add) == 0:
edge.append([a,b])
... | Traceback (most recent call last):
File "/tmp/tmpmbtbdw89/tmpowk1_s4v.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s253285374 | p02573 | u344030307 | 1598730804 | Python | Python (3.8.2) | py | Runtime Error | 2228 | 834700 | 558 | 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()
if b not in frends:
frends[b] = set()
frends[a].add(b)
frends[b].add(a)
group = copy.copy(frends)
for i in frends:
flag = False
r = group[i]
f... | Traceback (most recent call last):
File "/tmp/tmp8rgx44db/tmpl21kxuf9.py", line 3, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s255055657 | p02573 | u326552320 | 1598730800 | Python | Python (3.8.2) | py | Runtime Error | 570 | 61936 | 891 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: D
# CreatedDate: 2020-08-29 21:38:12 +0900
# LastModified: 2020-08-29 21:52:24 +0900
#
import os
import sys
sys.setrecursionlimit(20000)
# import numpy as np
# import pandas as pd
from collections import Counter
def dfs(u, color, path, n, d):
color[u... | Traceback (most recent call last):
File "/tmp/tmp1scjoooa/tmp_mp1fefz.py", line 46, in <module>
main()
File "/tmp/tmp1scjoooa/tmp_mp1fefz.py", line 27, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s258521980 | p02573 | u370721525 | 1598730796 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2063 | 109568 | 367 | N, M = map(int, input().split())
li = [[] for i in range(N+1)]
for i in range(M):
a, b = map(int, input().split())
li[a].append(b)
li[b].append(a)
ans = 0
for i in range(1, N+1):
s = set(li[i])
for x in s:
for y in li[x]:
if y == i:
pass
elif y in s:
pass
else:
... | Traceback (most recent call last):
File "/tmp/tmpp9jc0vef/tmpj3b0plnz.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s761220505 | p02573 | u443996531 | 1598730757 | Python | Python (3.8.2) | py | Runtime Error | 1147 | 83468 | 486 | 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):
if ab[i][0] in frgrps[grpno] or ab[i][1] in frgrps[grpno]:
frgrps[grpno].update(ab[i]... | Traceback (most recent call last):
File "/tmp/tmp7vjgwceq/tmpc5fcwug5.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s081136508 | p02573 | u514687406 | 1598730750 | Python | Python (3.8.2) | py | Runtime Error | 612 | 72668 | 1081 | 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/tmp8aru6iih/tmppgj4vf3y.py", line 44, in <module>
solve()
File "/tmp/tmp8aru6iih/tmppgj4vf3y.py", line 37, in solve
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s353471548 | p02573 | u189806337 | 1598730738 | Python | Python (3.8.2) | py | Runtime Error | 522 | 9424 | 1241 | from collections import defaultdict
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.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(... | Traceback (most recent call last):
File "/tmp/tmpushn938i/tmpfn6taygg.py", line 46, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s328235739 | p02573 | u698902360 | 1598730720 | Python | PyPy3 (7.3.0) | py | Runtime Error | 488 | 162032 | 774 | import sys
from collections import defaultdict
import collections
class UnionFindPathCompression():
def __init__(self, n):
self.parents = list(range(n))
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | Traceback (most recent call last):
File "/tmp/tmp8sxafvv5/tmp3at_45_t.py", line 26, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s214847006 | p02573 | u413369061 | 1598730715 | Python | Python (3.8.2) | py | Runtime Error | 781 | 46132 | 713 | from collections import deque
n,m = map(int,input().split())
G=[[] for i in range(n)]
for i in range(m):
a,b=input().split()
G[int(a)-1]+=[int(b)-1]
G[int(b)-1]+=[int(a)-1]
#print(G)
dist=[-1 for i in range(n)]
# que=deque([0])
# dist[0]=0
count=0
def bfs(G):
global count
#print(que)
if no... | Traceback (most recent call last):
File "/tmp/tmpg29v5ymk/tmp1u66p6uk.py", line 3, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s746042089 | p02573 | u908763441 | 1598730697 | Python | PyPy3 (7.3.0) | py | Runtime Error | 381 | 101392 | 951 | n, m = map(int, input().split())
index = 1
group = [0] * (n + 1) # 何番目のグループにいるか
groups = [set()] # グループ
for i in range(m):
a, b = map(int, input().split())
_a = group[a]
_b = group[b]
if _a == 0 and _b == 0: # 新しいグループ
group[a] = index
group[b] = index
groups.append({a,b})
index += 1
elif _a ==... | Traceback (most recent call last):
File "/tmp/tmphk7j0g90/tmp08l8sfw9.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s548445002 | p02573 | u732061897 | 1598730685 | Python | Python (3.8.2) | py | Runtime Error | 891 | 81848 | 377 | N, M = map(int, input().split())
friends = dict()
for i in range(M):
a, b = map(int, input().split())
if friends.get(a) is None:
friends[a] = set([b])
else:
friends[a].add(b)
if friends.get(b) is None:
friends[b] = set([a])
else:
friends[b].add(a)
ans = max([len(a) fo... | Traceback (most recent call last):
File "/tmp/tmp6w01ccj2/tmpav2w0dm7.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s537700566 | p02573 | u326552320 | 1598730683 | Python | Python (3.8.2) | py | Runtime Error | 655 | 48908 | 862 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: D
# CreatedDate: 2020-08-29 21:38:12 +0900
# LastModified: 2020-08-29 21:51:01 +0900
#
import os
import sys
# import numpy as np
# import pandas as pd
from collections import Counter
def dfs(u, color, path, n, d):
color[u] = d
for v in path[u]:
... | Traceback (most recent call last):
File "/tmp/tmpv22g49gp/tmp541nqvjr.py", line 45, in <module>
main()
File "/tmp/tmpv22g49gp/tmp541nqvjr.py", line 26, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s366448561 | p02573 | u305826668 | 1598730673 | Python | PyPy3 (7.3.0) | py | Runtime Error | 425 | 163644 | 993 | #Uses python3
import sys
visited = set()
def explore(adj, x, comp, cc):
visited.add(x)
if not(cc in comp):
comp[cc] = []
comp[cc].append(x)
for w in adj[x]:
if not (w in visited):
explore(adj, w, comp, cc)
def number_of_components(adj, n):
#visited = [False for _ in r... | Traceback (most recent call last):
File "/tmp/tmpit6h4m4b/tmpqipx19y0.py", line 29, in <module>
n, m = data[0:2]
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s663348981 | p02573 | u238504302 | 1598730669 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 37848 | 489 | N, M = map(int,input().split())
A = []
B = []
for i in range(M):
a, b = input().split()
A.append(a)
B.append(b)
r = [[A[0],B[0]]]
for i in range(1, M):
for j in range(len(r)):
if A[i] in r[j] and B[i] in r[j]: break
if not A[i] in r[j] and B[i] in r[j]:
r[j].append(A[i])
break
if A[i] ... | Traceback (most recent call last):
File "/tmp/tmp7ifapy40/tmpfyizjek1.py", line 1, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s119457774 | p02573 | u018808362 | 1598730668 | Python | Python (3.8.2) | py | Runtime Error | 1078 | 645636 | 286 | 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=Adj**2
count=0
for i in range(N):
ans=np.count_nonzero(Adj[i, :])
if ans>count:
count=ans
print(count) | Traceback (most recent call last):
File "/tmp/tmpbtlm_iqq/tmpse124nlr.py", line 3, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s879337225 | p02573 | u822662438 | 1598730662 | Python | Python (3.8.2) | py | Runtime Error | 2316 | 3376048 | 746 | n,m = map(int, input().split())
group = []
people = [-1]*n
a,b = map(int, input().split())
group.append([a,b])
people[a-1] = 0
people[b-1] = 0
for i in range(m-1):
a,b = map(int, input().split())
if people[a-1] != -1 and people[b-1] == -1:
group[people[a-1]].append(b)
people[b-1] = people[a-1]
elif pe... | Traceback (most recent call last):
File "/tmp/tmp8bzu33d_/tmpwrsohx6p.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s207394411 | p02573 | u177388368 | 1598730656 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2211 | 177764 | 469 | n,m=list(map(int,input().split()))
par=[i for i in range(n)]
ro=dict()
for i in range(n):
ro[i]=1
def root(i):
if par[i]==i:
return i
else:
return root(par[i])
def unite(x,y):
rx=root(x)
ry=root(y)
if rx!=ry:
par[rx]=ry
ro[ry]+=ro[rx]
ro[rx]=0
for i in r... | Traceback (most recent call last):
File "/tmp/tmpfxsk_7dm/tmpm0r5my2l.py", line 1, in <module>
n,m=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s710301248 | p02573 | u970082363 | 1598730651 | Python | Python (3.8.2) | py | Runtime Error | 466 | 12812 | 451 | n,m = (int(x) for x in input().split())
friendlist = [0]*n
classes = 1
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:
friendlist[a] = classes
friend... | Traceback (most recent call last):
File "/tmp/tmp801ilsls/tmph7t3b3vi.py", line 1, in <module>
n,m = (int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s566068119 | p02573 | u989364230 | 1598730646 | Python | Python (3.8.2) | py | Runtime Error | 32 | 9136 | 210 | s = input()
t = input()
x = len(t)
res= 0
for i in range(len(s) - x):
tmp = s[i:x]
cntmp = 0
for j in range(x):
if t[j] == s[j]:
cntmp += 1
res = max(res, cntmp)
print(x-res) | Traceback (most recent call last):
File "/tmp/tmpcvjvx5ta/tmpq92fw6yy.py", line 1, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s440271536 | p02573 | u998733244 | 1598730628 | Python | PyPy3 (7.3.0) | py | Runtime Error | 607 | 155832 | 475 | #!/usr/bin/env python3
N, M = map(int, input().split())
d = {}
for i in range(N):
d[i] = set()
for i in range(M):
a, b = map(int, input().split())
d[a-1].add(b-1)
d[b-1].add(a-1)
G = []
index = 0
while index < N:
if index in d:
s = list([index] + list(d[index]))
G.append(s)
... | Traceback (most recent call last):
File "/tmp/tmp3yh3xk1n/tmpnfpng8f3.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s688425875 | p02573 | u970082363 | 1598730622 | Python | Python (3.8.2) | py | Runtime Error | 507 | 12608 | 465 | n,m = (int(x) for x in input().split())
friendlist = [0]*n
classes = 1
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:
friendlist[a] = classes
friend... | Traceback (most recent call last):
File "/tmp/tmpmw4mfpow/tmp_3nd_1mu.py", line 1, in <module>
n,m = (int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s102647362 | p02573 | u177388368 | 1598730601 | Python | PyPy3 (7.3.0) | py | Runtime Error | 104 | 80868 | 472 | n,m=list(map(int,input().split()))
par=[i for i in range(n)]
ro=dict(int)
for i in range(n):
ro[i]=1
def root(i):
if par[i]==i:
return i
else:
return root(par[i])
def unite(x,y):
rx=root(x)
ry=root(y)
if rx!=ry:
par[rx]=ry
ro[ry]+=ro[rx]
ro[rx]=0
for i i... | Traceback (most recent call last):
File "/tmp/tmp0th1ky_o/tmpynt1zfzq.py", line 1, in <module>
n,m=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s294513598 | p02573 | u314089899 | 1598730590 | Python | Python (3.8.2) | py | Runtime Error | 780 | 30028 | 1615 | N,M = map(int, input().split())
parent_dict = dict() #key:子 value:親
#接続追加
def add_connect(A,B):
A_parent = get_parent(A)
B_parent = get_parent(B)
if A_parent != B_parent:
parent_dict[B_parent] = A_parent
#接続有無判断
def judge_connection(A,B):
A_parent = get_parent(A) #未更新状態でも、ここで更新される
B_... | Traceback (most recent call last):
File "/tmp/tmpdjo3x2u0/tmpz8_85dn5.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s329706787 | p02573 | u604522449 | 1598730562 | Python | Python (3.8.2) | py | Runtime Error | 164 | 33672 | 1003 | import sys,os
import math
from fractions import Fraction
from collections import defaultdict
from random import randint
# sys.stderr=open('err.txt','w')
# sys.stdout=open('output.txt','w')
# sys.stdin=open('input.txt','r')
def linput():
return list(minput())
def minput():
return map(int, sys.stdin.readline(... | Traceback (most recent call last):
File "/tmp/tmp0cuw9_6i/tmpp3tagp2j.py", line 36, in <module>
n,m=minput()
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s417625756 | p02573 | u698902360 | 1598730529 | Python | PyPy3 (7.3.0) | py | Runtime Error | 585 | 161944 | 768 | import sys
from collections import defaultdict
class UnionFindPathCompression():
def __init__(self, n):
self.parents = list(range(n))
def find(self, x):
if self.parents[x] == x:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self... | Traceback (most recent call last):
File "/tmp/tmp44aeqcbc/tmpco9rnjp1.py", line 26, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s130505489 | p02573 | u181412342 | 1598730527 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2366 | 3552936 | 1737 | import sys, io, os, re
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from pprint import pprint
from math import sin, cos, pi, radians, sqrt, floor, ceil
from copy import copy, deepcopy
from collections import deque, defaultdict
from fractions import gcd
from functools import re... | Traceback (most recent call last):
File "/tmp/tmpz639qsyc/tmpwi33uddz.py", line 7, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s107445233 | p02573 | u511899838 | 1598730516 | Python | Python (3.8.2) | py | Runtime Error | 598 | 108776 | 464 | import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections
N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype=np.int8).T
if M == 0:
print(1)
else:
tmp = np.ones(M, dtype=np.int8).T
graph = csr_ma... | Traceback (most recent call last):
File "/tmp/tmpkbimize2/tmph7eqt8zr.py", line 6, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s809684020 | p02573 | u951145045 | 1598730496 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 11148 | 646 | N,M=map(int,input().split())
group=[]
number=[0 for i in range(N)]
A,B=map(int,input().split())
group.append([A,B])
number[0]=2
for i in range(M-1):
A,B=map(int,input().split())
flag=0
for j in range(len(group)):
new=[]
if A in group[j]:
flag=1
if B not in group[j]:... | Traceback (most recent call last):
File "/tmp/tmpae35sq44/tmpoz_h99vz.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s370502912 | p02573 | u951145045 | 1598730463 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 80768 | 646 | N,M=map(int,input().split())
group=[]
number=[0 for i in range(N)]
A,B=map(int,input().split())
group.append([A,B])
number[0]=2
for i in range(M-1):
A,B=map(int,input().split())
flag=0
for j in range(len(group)):
new=[]
if A in group[j]:
flag=1
if B not in group[j]:... | Traceback (most recent call last):
File "/tmp/tmpzuxlzfmg/tmp416obpji.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s256856019 | p02573 | u321035578 | 1598730441 | Python | Python (3.8.2) | py | Runtime Error | 862 | 74016 | 471 | def main():
n,m = map(int,input().split())
ary = []
for i in range(m):
aa, bb = map(int,input().split())
l = min(aa,bb)
r = max(aa,bb)
ary.append((l,r))
ary_s = list(set(ary))
a = []
# b = []
for i in range(len(ary_s)):
a.append(ary_s[i][0])
a... | Traceback (most recent call last):
File "/tmp/tmpro2gg0y4/tmpvd8fut30.py", line 21, in <module>
main()
File "/tmp/tmpro2gg0y4/tmpvd8fut30.py", line 3, in main
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s215326062 | p02573 | u177388368 | 1598730437 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 38096 | 517 | n,m=list(map(int,input().split()))
from collections import defaultdict
par=[i for i in range(n)]
ro=defaultdict(int)
for i in range(n):
ro[i]=1
def root(i):
if par[i]==i:
return i
else:
return root(par[i])
def unite(x,y):
rx=root(x)
ry=root(y)
if rx!=ry:
par[rx]=ry
... | Traceback (most recent call last):
File "/tmp/tmp0jqid0n0/tmpy5a4oqur.py", line 1, in <module>
n,m=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s591948847 | p02573 | u100641536 | 1598730428 | Python | PyPy3 (7.3.0) | py | Runtime Error | 365 | 79436 | 340 | import collections
n,m = map(int,input().split())
g = [-1]*n
for i in range(m):
a,b = map(int,input().split())
if g[a-1]!=-1:
g[b-1] = g[a-1]
elif g[b-1]!=-1:
g[a-1] = g[b-1]
else:
g[a-1] = i
g[b-1] = i
c = collections.Counter(g)
cnt = c.most_common()
if cnt[0][0]==-1:
print (cnt[1][1])
else:
... | Traceback (most recent call last):
File "/tmp/tmpwkbg6br7/tmpeq0l4qdv.py", line 2, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s794526323 | p02573 | u468972478 | 1598730412 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 72760 | 215 | n, m = map(int, input().split())
a = [set(map(int, input().split())) for i in range(m)]
b = []
for i in range(m):
for j in range(i+1, m):
if len(a[i] & a[j]) > 0:
b.append(len(a[i] | a[j]))
print(max(b)) | Traceback (most recent call last):
File "/tmp/tmpdg3kzoqk/tmpagm8p14b.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s331622997 | p02573 | u270144704 | 1598730393 | Python | PyPy3 (7.3.0) | py | Runtime Error | 475 | 136288 | 787 | from collections import Counter
n, m = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(m)]
g = [[] for _ in range(n)]
visited = [-1] * n
for a, b in ab:
a, b = a-1, b-1
g[a].append(b)
g[b].append(a)
# print(g)
def dfs(start):
global visited
if visited[start] != -1:
... | Traceback (most recent call last):
File "/tmp/tmpfzfoojcw/tmpqfxsxyco.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s859647926 | p02573 | u242757684 | 1598730388 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2225 | 646340 | 785 | N,M = map(int,input().split())
color = []
colorStorage = []
for i in range(N):
color.append(i)
colorStorage.append([i])
for _ in range(M):
p,q = map(int,input().split())
p -= 1
q -= 1
if color[p] == color[q]:
continue
else:
x = color[p]
y = color[q]
if len(c... | Traceback (most recent call last):
File "/tmp/tmpi6r9lcen/tmpeq0jgcex.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s732230671 | p02573 | u711295009 | 1598730370 | Python | Python (3.8.2) | py | Runtime Error | 444 | 31636 | 787 | n, m = map(int, input().split())
fMap = {}
count = 0
lister = []
for i in range(m):
a, b = map(int, input().split())
if a in fMap:
if not b in fMap:
lister[fMap[a]].append(b)
else:
if fMap[a] != fMap[b]:
de = fMap[b]
lB = lister[fMap[b]]
... | Traceback (most recent call last):
File "/tmp/tmpcsdl4rk8/tmpb1wkjcwy.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s695113754 | p02573 | u868600519 | 1598730362 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2215 | 338748 | 549 | 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/tmp8z3nwh0r/tmpry8myunp.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s169639195 | p02573 | u733581231 | 1598730355 | Python | Python (3.8.2) | py | Runtime Error | 759 | 268912 | 988 | #: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
input = sys.stdin.readline
impor... | Exception in thread Thread-1 (solve):
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, **... | |
s110602500 | p02573 | u908763441 | 1598730342 | Python | PyPy3 (7.3.0) | py | Runtime Error | 326 | 104940 | 815 | n, m = map(int, input().split())
index = 1
group = [0] * (n + 1) # 何番目のグループにいるか
groups = [set()] # グループ
for i in range(m):
a, b = map(int, input().split())
_a = group[a]
_b = group[b]
if _a == 0 and _b == 0:
group[a] = index
group[b] = index
groups.append({a,b})
index += 1
elif _a == 0:
gr... | Traceback (most recent call last):
File "/tmp/tmp_a54cfi3/tmp820llnum.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s056138901 | p02573 | u225845681 | 1598730337 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9152 | 27 | N,M = int(input())
print(N) | Traceback (most recent call last):
File "/tmp/tmpb3gy6lp3/tmpz0mv2ghu.py", line 1, in <module>
N,M = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s993906037 | p02573 | u544587633 | 1598730336 | Python | Python (3.8.2) | py | Runtime Error | 1702 | 258780 | 914 | #!/usr/bin/env python3
import sys
import networkx as nx
def solve(N: int, M: int, A: "List[int]", B: "List[int]"):
G=nx.Graph()
for a, b in zip(A,B):
G.add_edge(a, b)
Gc = max(nx.connected_components(G), key=len)
print(len(Gc))
return
# Generated by 1.1.7.1 https://github.com/kyuridenam... | Traceback (most recent call last):
File "/tmp/tmpfk6tyfxu/tmp4kokwh_m.py", line 33, in <module>
main()
File "/tmp/tmpfk6tyfxu/tmp4kokwh_m.py", line 23, in main
N = int(next(tokens)) # type: int
^^^^^^^^^^^^
StopIteration
| |
s064308981 | p02573 | u408262366 | 1598730323 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2335 | 3559300 | 255 | n,m = map(int, input().split())
friends = [[0] * n for i in range(n)]
for i in range(m):
a,b = map(int, input().split())
friends[a-1][b-1] = 1
friends[b-1][a-1] = 1
ans = 0
for i in friends:
if sum(i) > ans:
ans = sum(i)
print(ans+1) | Traceback (most recent call last):
File "/tmp/tmp4j920dgx/tmpecaegxc0.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s588692721 | p02573 | u615034089 | 1598730300 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 78816 | 1254 | # Python program to print connected
# components in an undirected graph
class Graph:
# init function to declare class variables
def __init__(self,V):
self.V = V
self.adj = [[] for i in range(V)]
def DFSUtil(self, temp, v, visited):
# Mark the current vertex as visited
visited[v] = True
# Stor... | Traceback (most recent call last):
File "/tmp/tmp1whtpts6/tmpg4zuv7as.py", line 45, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s054974345 | p02573 | u511899838 | 1598730295 | Python | Python (3.8.2) | py | Runtime Error | 645 | 109200 | 505 | import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections
N,M = map(int,input().split())
if M == 0:
print(N)
else:
edge = np.array([input().split() for _ in range(M)], dtype = np.int8).T
tmp = np.ones(M, dtype = np.int8).T
graph = cs... | Traceback (most recent call last):
File "/tmp/tmp6y62g0we/tmpto4rkjy8.py", line 6, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s624122494 | p02573 | u445807804 | 1598730295 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 46208 | 428 | import collections
N,M = map(int,input().split())
a = []
for i in range(M):
a.append(sorted(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)]
k = get_unique_list(a)
flat_list = []
original_list = k
for l in original_list:
... | Traceback (most recent call last):
File "/tmp/tmpjxy39y5_/tmpnrcq1cfv.py", line 2, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s100887379 | p02573 | u733581231 | 1598730264 | Python | PyPy3 (7.3.0) | py | Runtime Error | 448 | 180720 | 816 | #: Author - Soumya Saurav
import sys,io,os,time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect,math,heapq
alphabet = "abcdefghijklmnopqrstuvwxyz"
input = sys.stdin.readline
######... | Traceback (most recent call last):
File "/tmp/tmp63sbj532/tmpjij2dijg.py", line 14, in <module>
n , m = map(int , input().split())
^^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s573778030 | p02573 | u311488536 | 1598730248 | Python | Python (3.8.2) | py | Runtime Error | 2213 | 254596 | 665 | from collections import defaultdict
def DFS(G,v,seen=None,path=None):
if seen is None: seen = []
if path is None: path = [v]
seen.append(v)
paths = []
for t in G[v]:
if t not in seen:
t_path = path + [t]
paths.append(tuple(t_path))
paths.extend(DFS(G, t... | Traceback (most recent call last):
File "/tmp/tmpcujcijej/tmpmzl_v_ez.py", line 16, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s160607972 | p02573 | u622570247 | 1598730247 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 37848 | 502 | from collections import defaultdict
n, m = map(int, input().split())
color = [None] * (n + 1)
for i in range(n + 1):
color[i] = i
def root(x):
global color
if color[x] == x:
return x
return root(color[x])
def unite(x, y):
rx = root(x)
ry = root(y)
if rx == ry:
return
... | Traceback (most recent call last):
File "/tmp/tmpht9clnv8/tmpugqxs5ot.py", line 3, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s286422557 | p02573 | u715329136 | 1598730235 | Python | Python (3.8.2) | py | Runtime Error | 392 | 12400 | 920 | def resolve():
N, M = map(int, input().split())
person = [-1 for _ in range(N)]
group_counter = 0
menber_counter = []
for _ in range(M):
A, B = map(int, input().split())
A -= 1
B -= 1
if person[A] == -1 and person[B] == -1:
person[A] = group_counter
... | Traceback (most recent call last):
File "/tmp/tmpovz6z105/tmpi80laxwp.py", line 32, in <module>
resolve()
File "/tmp/tmpovz6z105/tmpi80laxwp.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s715838893 | p02573 | u514687406 | 1598730215 | Python | Python (3.8.2) | py | Runtime Error | 678 | 72376 | 1038 | import sys
import collections
input = lambda: sys.stdin.readline().rstrip("\r\n")
class DFS:
def __init__(self):
self.adj = collections.defaultdict(list)
self.ans = 0
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/tmp8gk4ohuf/tmpbqzovh4q.py", line 43, in <module>
solve()
File "/tmp/tmp8gk4ohuf/tmpbqzovh4q.py", line 37, in solve
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s339456354 | p02573 | u468972478 | 1598730214 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 76468 | 206 | n, m = map(int, input().split())
a = [set(map(int, input().split())) for i in range(m)]
b = []
for i in range(m):
for j in range(i+1, m):
if a[i] & a[j]:
b.append(len(a[i] | a[j]))
print(max(b)) | Traceback (most recent call last):
File "/tmp/tmpqtboqhtm/tmpur856y9o.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s035084666 | p02573 | u257234489 | 1598730211 | Python | Python (3.8.2) | py | Runtime Error | 810 | 20164 | 2005 |
# Python3 program to implement Disjoint Set Data
# Structure.
class DisjSet:
def __init__(self, n):
# Constructor to create and
# initialize sets of n items
self.rank = [1] * n
self.parent = [i for i in range(n)]
# Finds set of given item x
def find(self, x... | Traceback (most recent call last):
File "/tmp/tmpdrr5q210/tmpqinklh72.py", line 67, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s445376478 | p02573 | u347397127 | 1598730199 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2245 | 1086616 | 333 | n,m = map(int,input().split())
a,b = map(int,input().split())
sets = [set([a,b])]
for i in range(m-1):
a,b = map(int,input().split())
for s in sets:
if (a in s) or (b in s):
s.add(a)
s.add(b)
break
else:
sets.append(set([a,b]))
ans = 0
print(sets)
for s in sets:
ans = max(ans,len(s... | Traceback (most recent call last):
File "/tmp/tmpe_6vga38/tmpeu9d6yx8.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s891352508 | p02573 | u944325914 | 1598730179 | Python | Python (3.8.2) | py | Runtime Error | 30 | 9028 | 453 | for i in range(n):
nm[i]=list(set(nm[i]))
visited=[0]*(n+1)
count=0
for i in range(n):
if visited[i]==0:
stack=[]
stack.append(i)
visited[i]+=1
temp=1
while stack:
x=stack.pop()
for j in nm[x]:
if visited[j]==0:
... | Traceback (most recent call last):
File "/tmp/tmplrtbb2u3/tmpo81seco1.py", line 1, in <module>
for i in range(n):
^
NameError: name 'n' is not defined
| |
s436341869 | p02573 | u972591645 | 1598730169 | Python | Python (3.8.2) | py | Runtime Error | 2221 | 425524 | 282 | n, m = map(int, input().split())
c = []
for _ in range(m):
a, b = map(int, input().split())
for i in c:
if a in i or b in i:
i.add(a)
i.add(b)
else:
c.append(set())
c[-1].add(a)
c[-1].add(b)
print(max(map(len, c))) | Traceback (most recent call last):
File "/tmp/tmp7p4oe8z7/tmp1q6nayu2.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s106362312 | p02573 | u512212329 | 1598730162 | Python | PyPy3 (7.3.0) | py | Runtime Error | 415 | 81836 | 871 | from collections import defaultdict
def main():
people_count, info_count = [int(x) for x in input().split()]
frieds_circle_ids = [-1] * people_count
id_counter = defaultdict(int)
new_id = 0
for _ in range(info_count):
a, b = [int(x) - 1 for x in input().split()]
id_a = frieds_circl... | Traceback (most recent call last):
File "/tmp/tmpu86qc4n0/tmpcacbgk2m.py", line 30, in <module>
print(main())
^^^^^^
File "/tmp/tmpu86qc4n0/tmpcacbgk2m.py", line 5, in main
people_count, info_count = [int(x) for x in input().split()]
^^^^^^^
EOFError... | |
s287630397 | p02573 | u540627185 | 1598730159 | Python | PyPy3 (7.3.0) | py | Runtime Error | 352 | 150644 | 414 | import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()
def main():
n, m = map(int, input().split())
l = {}
for _ in range(m-1):
a, b = sorted(map(int, input().split()))
if a not in l:
l[a] = {b}
else:
l[a].add(b)
i = ma... | Traceback (most recent call last):
File "/tmp/tmpww7kf3y3/tmp_4o9adz9.py", line 20, in <module>
main()
File "/tmp/tmpww7kf3y3/tmp_4o9adz9.py", line 7, in main
n, m = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s358882093 | p02573 | u869567753 | 1598730145 | Python | Python (3.8.2) | py | Runtime Error | 2217 | 407972 | 335 | import sys
readline = sys.stdin.readline
N, M = map(int, readline().split())
a1, b1 = map(int, readline().split())
G = list()
G.append({a1, b1})
for i in range(1, M):
ai, bi = map(int, readline().split())
for j in G:
if ai in j or bi in j:
j.add(ai)
j.add(bi)
else:
G.append({ai, bi})
pri... | Traceback (most recent call last):
File "/tmp/tmptpiy59lr/tmpjyr_y5ya.py", line 4, in <module>
N, M = map(int, readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s347164832 | p02573 | u513434790 | 1598730128 | Python | Python (3.8.2) | py | Runtime Error | 680 | 15368 | 597 | import sys
sys.setrecursionlimit(10*100)
N, M = map(int, input().split())
UF = [-1] * (N+1)
def find(x):
global UF
if UF[x] == -1:
return x
else:
UF[x] = find(UF[x])
return UF[x]
def union(x,y):
global UF
xx = find(x)
yy = find(y)
if UF[x] == UF[y] == -1:
UF[... | Traceback (most recent call last):
File "/tmp/tmpkx1wq6pb/tmpu97hhusd.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s672664758 | p02573 | u391157755 | 1598730115 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 26412 | 711 | n, m = map(int, input().split())
parent = [i for i in range(n)]
root_list = [None for _ in range(n)]
element_count = [0 for _ in range(n)]
def root(x):
while parent[x] != x:
x = parent[x]
return x
for i in range(m):
a, b = map(int, input().split())
a, b = a - 1, b - 1
parent[root(b)] = r... | Traceback (most recent call last):
File "/tmp/tmpe62c3yl7/tmphu156d34.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s516737053 | p02573 | u912862653 | 1598730107 | Python | PyPy3 (7.3.0) | py | Runtime Error | 501 | 150260 | 958 | from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
input = sys.stdin.readline
INF = float("inf")
def dfs(G, visited, v, cnt):
visited[v] = True
for nv in G[v]:
if visited[nv]:
continue
cnt = dfs(G, visited, nv, cnt + 1)
... | Traceback (most recent call last):
File "/tmp/tmpgu3pdg84/tmpvbc1z5dj.py", line 2, in <module>
from fractions import gcd
ImportError: cannot import name 'gcd' from 'fractions' (/root/miniconda3/envs/sandbox-runtime/lib/python3.11/fractions.py)
| |
s204096966 | p02573 | u170839742 | 1598730102 | Python | Python (3.8.2) | py | Runtime Error | 906 | 41012 | 489 | from collections import defaultdict
N, M = map(int, input().split())
parent = defaultdict(lambda: -1)
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 _ i... | Traceback (most recent call last):
File "/tmp/tmpsgg5esw2/tmp0pe5bpyw.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s321593968 | p02573 | u680190333 | 1598730100 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 10408 | 564 | import sys
input = sys.stdin.readline
N,M= (int(x) for x in input().rstrip('\n').split())
res = 1
aed = []
f = []
for _ in range(M):
A,B = (int(x) for x in input().rstrip('\n').split())
if A not in aed and B not in aed:
f.append([A,B])
aed.append(A)
aed.append(B)
elif A in aed and B not in aed:
f... | Traceback (most recent call last):
File "/tmp/tmp8pd96o9l/tmpb6f_x4i5.py", line 4, in <module>
N,M= (int(x) for x in input().rstrip('\n').split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s455889015 | p02573 | u512551187 | 1598730092 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 70492 | 266 | from collections import *
n,m=map(int,input().split())
d=[]
for i in range(m):
l=list(map(int,input().split()))
if(sorted(l) not in d):
d.append(sorted(l))
dd=defaultdict(int)
for i in d:
dd[i[0]]+=1
dd[i[1]]+=1
k=max(dd.values())
print(k+1)
| Traceback (most recent call last):
File "/tmp/tmpt8vau8w3/tmp572_btiy.py", line 2, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s674117200 | p02573 | u592944963 | 1598730079 | Python | PyPy3 (7.3.0) | py | Runtime Error | 507 | 168492 | 472 | N, M = map(int, input().split())
A, B = list(zip(*[list(map(int, input().split())) for _ in range(M)]))
G = []
m = {}
for a, b in zip(A, B):
if a not in m and b not in m:
G.append({a, b})
m[a] = len(G) - 1
m[b] = len(G) - 1
elif a in m:
gid = m[a]
G[gid].add(b)
m... | Traceback (most recent call last):
File "/tmp/tmpj3thcp8h/tmpdaxsmol6.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s281538474 | p02573 | u314089899 | 1598730072 | Python | Python (3.8.2) | py | Runtime Error | 1013 | 96428 | 1585 | N,M = map(int, input().split())
parent_dict = dict() #key:子 value:親
#接続追加
def add_connect(A,B):
A_parent = get_parent(A)
B_parent = get_parent(B)
if A_parent != B_parent:
parent_dict[B_parent] = A_parent
#接続有無判断
def judge_connection(A,B):
A_parent = get_parent(A) #未更新状態でも、ここで更新される
B_... | Traceback (most recent call last):
File "/tmp/tmp98sczsh2/tmp4c7qpu1d.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s483105481 | p02573 | u029056424 | 1598730068 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 72476 | 421 | n,m=map(int,input().split())
Fmap=[]
a,b=map(int,input().split())
Fmap.append([a,b])
for i in range(m-1):
a,b=map(int,input().split())
for listF in Fmap:
if a in listF:
if b in listF:
pass
else:
listF.append(b)
if b in listF:
if a in listF:
pass
else:
... | Traceback (most recent call last):
File "/tmp/tmp562bribl/tmp2g9sof48.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s962262601 | p02573 | u149991748 | 1598730063 | Python | Python (3.8.2) | py | Runtime Error | 456 | 18724 | 670 | n, m = map(int, input().split())
ex = [0 for i in range(n)]
fri = {}
for i in range(m):
a, b = map(int, input().split())
if ex[a-1] == 0 and ex[b-1] == 0:
if a > b:
a, b = b,a
ex[a-1] = a
ex[b-1] = a
fri[a] = [a, b]
elif ex[a-1] == 0:
ex[a-1] = ex[b-1]
... | Traceback (most recent call last):
File "/tmp/tmpt5grvlkt/tmpryzhdo1k.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s358893049 | p02573 | u695261159 | 1598730061 | Python | Python (3.8.2) | py | Runtime Error | 542 | 46976 | 592 | N,M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]
appear = [0] * (N+1)
ans = 2
appear[AB[0][0]] = 1
appear[AB[0][1]] = 1
for i in range(1,M):
# print(ans, AB[i][0],appear[AB[i][0]] ,AB[i][1], appear[AB[i][1]] )
if appear[AB[i][0]] == 0 and appear[AB[i][1]] == 0:
... | Traceback (most recent call last):
File "/tmp/tmp2sx_zsgc/tmph1337p2g.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s997607769 | p02573 | u511899838 | 1598730039 | Python | Python (3.8.2) | py | Runtime Error | 670 | 112064 | 430 | import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections
N,M = map(int,input().split())
N = 2*(10**5)
edge = np.array([input().split() for _ in range(M)], dtype = np.int64).T
tmp = np.ones(M, dtype = np.int64).T
graph = csr_matrix((tmp, (edge[:] -1... | Traceback (most recent call last):
File "/tmp/tmpzkuv0z16/tmp34mzo9nq.py", line 6, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s354690441 | p02573 | u872538555 | 1598730035 | Python | Python (3.8.2) | py | Runtime Error | 618 | 32200 | 547 | from collections import Counter
class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
N, M = map... | Traceback (most recent call last):
File "/tmp/tmpebg92aa3/tmpydgatokx.py", line 15, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s568179247 | p02573 | u698902360 | 1598730035 | Python | PyPy3 (7.3.0) | py | Runtime Error | 484 | 167720 | 2162 | import sys
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.parents[x]
def union(self, x, y):... | Traceback (most recent call last):
File "/tmp/tmpfdy3eqla/tmptsrqo4d5.py", line 76, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s230172300 | p02573 | u242757684 | 1598730027 | Python | PyPy3 (7.3.0) | py | Runtime Error | 103 | 68608 | 783 | N,M = map(int,input().split())
color = []
colorStorage = []
for i in range(N):
color.append(i)
colorCount.append([i])
for _ in range(M):
p,q = map(int,input().split())
p -= 1
q -= 1
if color[p] == color[q]:
continue
else:
x = color[p]
y = color[q]
if len(col... | Traceback (most recent call last):
File "/tmp/tmp6cyw1rza/tmpuelf08v3.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s223388053 | p02573 | u592944963 | 1598729997 | Python | PyPy3 (7.3.0) | py | Runtime Error | 469 | 174260 | 398 | N, M = map(int, input().split())
A, B = list(zip(*[list(map(int, input().split())) for _ in range(M)]))
G = []
m = {}
for a, b in zip(A, B):
if a not in m and b not in m:
G.append({a, b})
m[a] = len(G) - 1
m[b] = len(G) - 1
elif a in m:
G[m[a]].add(b)
elif b in m:
G[... | Traceback (most recent call last):
File "/tmp/tmpn9ipdq_b/tmpuls_jro6.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s284358705 | p02573 | u501278784 | 1598729992 | Python | PyPy3 (7.3.0) | py | Runtime Error | 706 | 149256 | 502 | 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(list)
n,m=map(int,input().split())
for i in range(m):
u,v=map(int,input().split())
adj[u-1].append(v-1)... | Traceback (most recent call last):
File "/tmp/tmpu0bfz4he/tmp1t6b71xo.py", line 9, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s705517447 | p02573 | u471593927 | 1598729992 | Python | Python (3.8.2) | py | Runtime Error | 1977 | 1026696 | 831 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# def
def int_mtx(N):
x = []
for _ in range(N):
x.append(list(map(int,input().split())))
return np.array(x)
def str_mtx(N):
x = []
for _ in range(N):
x.append(list(input()))
return np.array(x)
def int_map():
return map(int,input()... | Traceback (most recent call last):
File "/tmp/tmpq14siiuq/tmp4hnaxfm1.py", line 36, in <module>
N,M = int_map()
^^^^^^^^^
File "/tmp/tmpq14siiuq/tmp4hnaxfm1.py", line 19, in int_map
return map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s333905418 | p02573 | u254221913 | 1598729977 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2341 | 3520664 | 280 | n, m = map(int, input().split())
friend = [[0] * n for i in range(n)]
for i in range(m):
x, y = map(int, input().split())
x -= 1
y -= 1
friend[x][y] = 1
friend[y][x] = 1
maxfriend = 0
for li in friend:
maxfriend = max(maxfriend, sum(li))
print(maxfriend+1) | Traceback (most recent call last):
File "/tmp/tmpzjo61k9x/tmpn62kernb.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s797988592 | p02573 | u371385198 | 1598729924 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 57204 | 761 | import sys
input = sys.stdin.readline
def readstr():
return input().strip()
def readint():
return int(input())
def readnums():
return map(int, input().split())
def readstrs():
return input().split()
def main():
N, M = readnums()
ab = [tuple(readnums()) for _ in range(M)]
al = list(... | Traceback (most recent call last):
File "/tmp/tmprrqqpwts/tmp4110bny9.py", line 44, in <module>
main()
File "/tmp/tmprrqqpwts/tmp4110bny9.py", line 22, in main
N, M = readnums()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s367433583 | p02573 | u232111869 | 1598729902 | Python | Python (3.8.2) | py | Runtime Error | 797 | 44700 | 572 | n, m = map(int, input().split())
graph = [[] for _ in range(n+1)]
visited = [False for _ in range(n+1)]
# print("graph is : ", graph)
# print("visited is : ", visited)
def dfs(node):
visited[node] = True
ret = 0
for child in graph[node]:
if not visited[child]:
ret += dfs(child)
retu... | Traceback (most recent call last):
File "/tmp/tmpuns0itd9/tmp8x8hb1z9.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s955989325 | p02573 | u779728630 | 1598729902 | Python | Python (3.8.2) | py | Runtime Error | 1011 | 81312 | 565 | N, M = map(int, input().split())
ad_list = {}
for i in range(M):
a, b = map(int, input().split())
if a in ad_list:
ad_list[a].add(b)
else:
ad_list[a] = {b}
if b in ad_list:
ad_list[b].add(a)
else:
ad_list[b] = {a}
#BFS
ans = 0
done = [True for i in range(N+1)]
def dfs(x):
global done
glo... | Traceback (most recent call last):
File "/tmp/tmp0cvpuerj/tmpvcqfvu2v.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s677289562 | p02573 | u177388368 | 1598729887 | Python | Python (3.8.2) | py | Runtime Error | 2209 | 130180 | 593 | n,m=list(map(int,input().split()))
f=[set() for i in range(n)]
from collections import defaultdict
g=[set() for i in range(n)]
par=[i for i in range(n)]
def root(i):
if par[i]==i:
return i
else:
return root(par[i])
def unite(x,y):
rx=root(x)
ry=root(y)
if rx!=ry:
par[rx]... | Traceback (most recent call last):
File "/tmp/tmpm6td5k8f/tmpccvn8wv4.py", line 1, in <module>
n,m=list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s934324334 | p02573 | u990726146 | 1598729870 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 44524 | 461 | N, M = map(int, input().split())
to = [[] for i in range(N)]
for i in range(M):
A, B = map(int, input().split())
if (B-1) not in to[A-1]:
to[A-1].append(B-1)
to[B-1].append(A-1)
ans = 0
def DFS(n):
global h, ans
#print(h)
if h[n] == 1:
ans = max(ans, sum(h))
return
... | Traceback (most recent call last):
File "/tmp/tmpy7tyf6dz/tmpacr4hi4p.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s493984622 | p02573 | u850087201 | 1598729852 | Python | Python (3.8.2) | py | Runtime Error | 789 | 46976 | 655 | (N,M) = map(int,input().split())
l = []
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)]
cnt = 0
for i in range(M):
if s[l[i][0]-1] == 0 and s[l[i][1]-1] == 0:
... | Traceback (most recent call last):
File "/tmp/tmpi0s9dnka/tmpp4ea0qt5.py", line 1, in <module>
(N,M) = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s332365098 | p02573 | u501278784 | 1598729845 | Python | PyPy3 (7.3.0) | py | Runtime Error | 685 | 174868 | 495 | 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(set)
n,m=map(int,input().split())
for i in range(m):
u,v=map(int,input().split())
adj[u-1].add(v-1)
... | Traceback (most recent call last):
File "/tmp/tmpl3k7y3ie/tmp1qjv9kuf.py", line 9, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s887101760 | p02573 | u893962649 | 1598729837 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45632 | 470 | N, M = map(int, input().split())
F = [list(map(int, input().split())) for i in range(M)]
G = []
for i, f in enumerate(F):
new_grp = True
for j, g in enumerate(G):
if f[0] in g:
if f[1] not in g:
G[j].append(f[1])
new_grp = False
if f[1] in g:
... | Traceback (most recent call last):
File "/tmp/tmpgx5jn0vh/tmp5s2w325w.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s847239958 | p02573 | u202641516 | 1598729785 | Python | PyPy3 (7.3.0) | py | Runtime Error | 851 | 175560 | 542 | x, y = map(int, input().split())
graph = [[] for n in range(x+1)]
st = {}
for n in range(y):
a, b = map(int, input().split())
if a > b:
a, b = b, a
if (a, b) not in st:
st[(a, b)] = 1
graph[a].append(b)
graph[b].append(a)
res = 0
vis = {}
def dfs(node):
global r... | Traceback (most recent call last):
File "/tmp/tmpojknl1w4/tmps3sp52sq.py", line 1, in <module>
x, y = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s091441829 | p02573 | u071360860 | 1598729784 | Python | Python (3.8.2) | py | Runtime Error | 871 | 40440 | 2273 | import collections
# https://www.ics.uci.edu/~eppstein/PADS/UnionFind.py
class UnionFind:
"""Union-find data structure.
Each unionFind instance X maintains a family of disjoint sets of
hashable objects, supporting the following two methods:
- X[item] returns a name for the set containing the given ... | Traceback (most recent call last):
File "/tmp/tmpen66sahe/tmp_t_so0k3.py", line 63, in <module>
n, m = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s608291717 | p02573 | u512551187 | 1598729783 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 70540 | 266 | from collections import *
n,m=map(int,input().split())
d=[]
for i in range(m):
l=list(map(int,input().split()))
if(sorted(l) not in d):
d.append(sorted(l))
dd=defaultdict(int)
for i in d:
dd[i[0]]+=1
dd[i[1]]+=1
k=max(dd.values())
print(k+1)
| Traceback (most recent call last):
File "/tmp/tmppfqyi1rd/tmp2ufyojk6.py", line 2, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s918956236 | p02573 | u511899838 | 1598729764 | Python | Python (3.8.2) | py | Runtime Error | 1183 | 365724 | 453 | import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections
n, m = map(int,input().split())
grid = []
for i in range(m):
array = list(map(int, input().strip().split(' ')))
grid.append(array)
l = np.zeros((n,n))
for i in range(m):
l[grid... | Traceback (most recent call last):
File "/tmp/tmppo_8cet9/tmpfg8pm3b2.py", line 6, in <module>
n, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s313145496 | p02573 | u347397127 | 1598729756 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2236 | 1122636 | 312 | n,m = map(int,input().split())
a,b = map(int,input().split())
sets = [set([a,b])]
for i in range(m-1):
a,b = map(int,input().split())
for s in sets:
if a in s:
s.add(b)
elif b in s:
s.add(a)
else:
sets.append(set([a,b]))
ans = 0
for s in sets:
ans = max(ans,len(s))
print(ans) | Traceback (most recent call last):
File "/tmp/tmptzmmne3n/tmpirzfa51a.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s189732954 | p02573 | u501278784 | 1598729751 | Python | PyPy3 (7.3.0) | py | Runtime Error | 867 | 174792 | 499 | 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(set)
n,m=map(int,input().split())
for i in range(m):
u,v=map(int,input().split())
adj[u-1].add(v-1)
... | Traceback (most recent call last):
File "/tmp/tmpd9xrn5nv/tmpx_mgacl1.py", line 9, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s711148028 | p02573 | u932868243 | 1598729725 | Python | Python (3.8.2) | py | Runtime Error | 730 | 32564 | 405 | n,m=map(int,input().split())
par=[i for i in range(n)]
def find(x):
if x==par[x]:
return x
else:
par[x]=find(par[x])
return par[x]
def union(x,y):
x=find(x)
y=find(y)
if x!=y:
par[x]=y
f=lambda x:int(x)-1
for i in range(m):
x,y=map(f,input().split())
union(x,y)
for j in range(n):
... | Traceback (most recent call last):
File "/tmp/tmp7x_dvkmt/tmpkeqnz8by.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s347971325 | p02573 | u374935093 | 1598729713 | Python | PyPy3 (7.3.0) | py | Runtime Error | 415 | 85640 | 560 | N,M = map(int,input().split())
ls = [0 for _ in range(N)]
flg = 1
for i in range(M):
a,b = map(int,input().split())
if ls[a-1] == 0 and ls[b-1]==0:
ls[a-1]=flg
ls[b-1]=flg
flg+=1
elif ls[a-1] == 0:
ls[a-1] = ls[b-1]
elif ls[b-1] == 0:
ls[b-1] = ls[a-1]
else:
... | Traceback (most recent call last):
File "/tmp/tmpsg1_t6h5/tmp3grzrys_.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s919242136 | p02573 | u377989038 | 1598729712 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 68124 | 361 | n, m = map(int, input().split())
fs = [list(map(int, input().split())) for i in range(m)]
g = [set([fs[0][0], fs[0][1]])]
for a, b in fs[1:]:
f = 0
for j in g:
if a in j or b in j:
f = 1
j.add(a)
j.add(b)
if f == 0:
g.append(set([a, b]))
ans = 0
for i in... | Traceback (most recent call last):
File "/tmp/tmphgot7ned/tmpjdys7cp3.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s219854287 | p02573 | u170839742 | 1598729708 | Python | Python (3.8.2) | py | Runtime Error | 670 | 31720 | 474 | 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/tmpg4j5pyq2/tmpec3b2fsy.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.