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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s158309773 | p02573 | u970348538 | 1598735401 | Python | Python (3.8.2) | py | Runtime Error | 1011 | 112032 | 506 | def search(x, num):
nodes.remove(x)
search_list = []
for y in list(edge[x]):
if y in nodes:
edge[y].discard(x)
num = search(y, num)
return num + 1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = [set() for _ in range(n+1)]
for x in d:
edge[x[0]].add... | Traceback (most recent call last):
File "/tmp/tmpkpnisrvh/tmpk7ii3eqq.py", line 11, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s910863746 | p02573 | u970348538 | 1598735327 | Python | Python (3.8.2) | py | Runtime Error | 1035 | 111756 | 502 | def search(x, num):
nodes.remove(x)
search_list = []
for y in list(edge[x]):
edge[y].discard(x)
if y in nodes:
num = search(y, num)
return num + 1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = [set() for _ in range(n+1)]
for x in d:
edge[x[0]].add(x[1... | Traceback (most recent call last):
File "/tmp/tmp7bcbdz_b/tmpvd26y0xg.py", line 11, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s523413674 | p02573 | u627057223 | 1598735324 | Python | Python (3.8.2) | py | Runtime Error | 885 | 72484 | 633 | from collections import defaultdict
count = 0
def dfs_main(adj,visited,src):
visited[src] = True
global count
count+=1
for negh in adj[src]:
if not visited[negh]:
dfs_main(adj,visited,negh)
def dfs(n,adj):
visited = defaultdict(lambda: False)
global count
mx = -1
for ... | Traceback (most recent call last):
File "/tmp/tmp20fizrjg/tmpk_mo204d.py", line 20, in <module>
n,e = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s007126683 | p02573 | u473172054 | 1598735314 | Python | Python (3.8.2) | py | Runtime Error | 224 | 55004 | 354 | N, M = map(int, input().split())
friends_set_list = [set() for i in range(N+1)]
ans = 1
for i in range(M):
A, B = map(int, input().split())
friends_set_list[B].add([A,B])
friends_set_list[A] |= friends_set_list[B]
friends_set_list[B] = friends_set_list[A]
num = len(friends_set_list[A])
if ans < ... | Traceback (most recent call last):
File "/tmp/tmpcgnx3kno/tmp03pbwwtb.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s905687567 | p02573 | u970348538 | 1598735300 | Python | Python (3.8.2) | py | Runtime Error | 984 | 111756 | 501 | def search(x, num):
nodes.remove(x)
search_list = []
for y in list(edge[x]):
edge[y].remove(x)
if y in nodes:
num = search(y, num)
return num + 1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = [set() for _ in range(n+1)]
for x in d:
edge[x[0]].add(x[1]... | Traceback (most recent call last):
File "/tmp/tmp2q6mx0b_/tmp8ft495eq.py", line 11, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s492957838 | p02573 | u825186577 | 1598735288 | Python | Python (3.8.2) | py | Runtime Error | 704 | 14172 | 466 | n, m = map(int, input().split())
root = [-1]*n
def r(x):
if root[x] < 0 :
return x
else:
root[x] = r(root[x])
return root[x]
def unite(x, y):
x = r(x)
y = r(y)
if x == y:
return
root[x] += root[y]
root[y] = x
def size(x):
x = r(x)
return - root[x]
... | Traceback (most recent call last):
File "/tmp/tmpa8acma7m/tmpoqxysizu.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s965277111 | p02573 | u273507800 | 1598735266 | Python | Python (3.8.2) | py | Runtime Error | 577 | 29920 | 425 | N, M = map(int, input().strip().split())
pg = {n: -1 for n in range(1, N + 1)} # person's group
gpc = [] # group person count
gc = 0 # group count
for _ in range(M):
Ai, Bj = map(int, input().strip().split())
if pg[Ai] < 0 and pg[Bj] < 0:
pg[Ai] = gc
pg[Bj] = gc
gpc.append(2)
gc += 1
if pg[Ai] < 0:
... | Traceback (most recent call last):
File "/tmp/tmpg2lyglx2/tmp_qznxepc.py", line 1, in <module>
N, M = map(int, input().strip().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s226483612 | p02573 | u534610124 | 1598735242 | Python | Python (3.8.2) | py | Runtime Error | 29 | 8856 | 825 | N,M = map(int, input().split())
dic = dict((i, set()) for i in range(1,N+1))
for _ in range(M):
a,b = map(int, input().split())
dic[a].add(b)
#始める点xとすでに探索した点の集合mark
# => xと友達な点の集合、探索した点
def dfs(x:int, mark:set):
if x in mark:
return , mark
marked = mark
a = {x}
a = a.u... | File "/tmp/tmp5z8_usq2/tmp3om2_df2.py", line 5
for _ in range(M):
IndentationError: unexpected indent
| |
s900201041 | p02573 | u295585689 | 1598735228 | Python | Python (3.8.2) | py | Runtime Error | 1440 | 28508 | 787 | import numpy as np
class union_find:
def __init__(self,N):
self.r = np.ones(N)*-1
def root(self,x):
if self.r[x]<0:
return int(x)
else:
self.r[x] = self.root(int(self.r[x]))
return int(self.r[x])
def unite(self,x,y):
x = self... | Traceback (most recent call last):
File "/tmp/tmp8d_mfikx/tmpvux14m4m.py", line 28, in <module>
N,M = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s587212770 | p02573 | u627057223 | 1598735192 | Python | Python (3.8.2) | py | Runtime Error | 1162 | 100368 | 626 | from collections import defaultdict
count = 0
def dfs_main(adj,visited,src):
visited[src] = True
global count
count+=1
for negh in adj[src]:
if not visited[negh]:
dfs_main(adj,visited,negh)
def dfs(n,adj):
visited = defaultdict(lambda: False)
global count
mx = -1
for ... | Traceback (most recent call last):
File "/tmp/tmpffob_qf5/tmp2r_csi4e.py", line 20, in <module>
n,e = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s664192852 | p02573 | u959682393 | 1598735131 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 82428 | 408 | N,M = map(int,input().split())
ans = [set() for i in range(N)]
a,b = map(int,input().split())
ans[0].add(a)
ans[0].add(b)
for i in range(M-1):
a,b = map(int,input().split())
for j in ans:
if len(j) == 0:
j.add(a)
j.add(b)
break
if a in j or b in... | Traceback (most recent call last):
File "/tmp/tmphvlh9_vs/tmp5h_z4t9a.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s355131507 | p02573 | u970109776 | 1598735076 | Python | Python (3.8.2) | py | Runtime Error | 1093 | 91796 | 540 | #coding: utf-8
from collections import defaultdict
N, M = [int(x) for x in input().split()]
G = defaultdict(set)
for i in range(M):
a, b = [int(x) - 1 for x in input().split()]
G[a].add(b)
G[b].add(a)
grp = [-1] * N
def dfs(node, color):
if grp[node] != -1:
return
grp[node] = color
... | Traceback (most recent call last):
File "/tmp/tmph1h7hmi8/tmppf31cnfx.py", line 4, in <module>
N, M = [int(x) for x in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s925835572 | p02573 | u970348538 | 1598735009 | Python | Python (3.8.2) | py | Runtime Error | 981 | 111952 | 552 | def search(x, num):
nodes.remove(x)
search_list = []
for y in edge[x]:
edge[y].remove(x)
search_list.append(y)
for y in search_list:
if y in nodes:
num = search(y, num)
return num + 1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = [set() for _ ... | Traceback (most recent call last):
File "/tmp/tmphiuc29dd/tmpivdufi92.py", line 13, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s283631530 | p02573 | u933929042 | 1598734963 | Python | PyPy3 (7.3.0) | py | Runtime Error | 627 | 127080 | 1528 | import random
import sys
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 group[b] == 0:
g_num +... | Traceback (most recent call last):
File "/tmp/tmpe02n_33k/tmpjrr7ezw7.py", line 4, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s777256813 | p02573 | u830588156 | 1598734766 | Python | Python (3.8.2) | py | Runtime Error | 708 | 30104 | 1570 | 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 = ... | Traceback (most recent call last):
File "/tmp/tmp0jufjv_2/tmpbqu26klv.py", line 66, in <module>
main()
File "/tmp/tmp0jufjv_2/tmpbqu26klv.py", line 48, in main
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s206005832 | p02573 | u608007704 | 1598734673 | Python | PyPy3 (7.3.0) | py | Runtime Error | 91 | 68692 | 864 | #include<bits/stdc++.h>
using namespace std;
int getID(vector<int>& v,int idx){
if(v[idx]==idx)return idx;
v[idx]=getID(v,v[idx]);
return v[idx];
}
int main(){
int N,M;
cin>>N>>M;
vector<int> d(N,0);
vector<int> v(N,-1);
for(int i=0;i<M;i++){
int s[2];
cin>>s[0]>>s[1];
s[0]--;
s[1]--;
... | File "/tmp/tmpqvydl90q/tmp4z44nfhn.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s832455820 | p02573 | u497952650 | 1598734648 | Python | PyPy3 (7.3.0) | py | Runtime Error | 807 | 105936 | 262 | from collections import Counter
N,M = map(int,input().split())
num = [i for i in range(N+1)]
ab = [list(map(int,input().split())) for _ in range(M)]
ab.sort()
for a,b in ab:
m = min(num[a],num[b])
num[a] = num[b] = m
print(max(Coutner(num).values())) | Traceback (most recent call last):
File "/tmp/tmpdwuh1595/tmp3gemo70g.py", line 3, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s316583647 | p02573 | u608007704 | 1598734647 | Python | PyPy3 (7.3.0) | py | Runtime Error | 180 | 68600 | 864 | #include<bits/stdc++.h>
using namespace std;
int getID(vector<int>& v,int idx){
if(v[idx]==idx)return idx;
v[idx]=getID(v,v[idx]);
return v[idx];
}
int main(){
int N,M;
cin>>N>>M;
vector<int> d(N,0);
vector<int> v(N,-1);
for(int i=0;i<M;i++){
int s[2];
cin>>s[0]>>s[1];
s[0]--;
s[1]--;
... | File "/tmp/tmp0hgu0625/tmpz44x338b.py", line 2
using namespace std;
^^^^^^^^^
SyntaxError: invalid syntax
| |
s864613156 | p02573 | u504299537 | 1598734646 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8884 | 626 | import sys
def main(lines):
n = int(lines[0].split()[0])
m = int(lines[0].split()[1])
friend = [0]*n
group = 1
for i in range(m):
g1 = int(lines[i+1].split()[0])
g2 = int(lines[i+1].split()[1])
if friend[g1] != 0:
if friend[g2] !=0:
if friend[g1] != friend[g2]:
e... | File "/tmp/tmpgakd7rd1/tmpoiafvdcy.py", line 16
else:
IndentationError: expected an indented block after 'if' statement on line 14
| |
s760281142 | p02573 | u134185377 | 1598734638 | Python | PyPy3 (7.3.0) | py | Runtime Error | 87 | 68716 | 421 | import numpy as np
N,M=map(int,input().split())
mat=np.zeros((N,N))
for _ in range(M):
a,b=map(int,input().split())
mat[a-1][b-1]=1
mat[b-1][a-1]=1
mat2=[[j for j in i] for i in mat]
for i in range(N-1):
for j in range(i+1,N):
for k in range(j+1,N):
if (mat[i][j]==1)&(mat[i][k]==1):
... | Traceback (most recent call last):
File "/tmp/tmpmkq0x33k/tmpk0nxz_lg.py", line 2, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s043809609 | p02573 | u825343780 | 1598734539 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9080 | 210 | n = int(input())
a = list(map(int,input().split()))
sums = 0
for i in range(n):
sums += a[i]
sums *= sums;
ans = sums;
for i in range(n):
ans -= a[i]*a[i]
ans //= 2
ans %= 1000000007
print(int(ans))
| Traceback (most recent call last):
File "/tmp/tmp1hzj_ebg/tmpq9cst250.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s399838430 | p02573 | u396252065 | 1598734534 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 70460 | 572 | data = input().split(" ")
N = int(data[0])
M = int(data[1])
Comb = [0]*M
List = []
for i in range(M):
buf = input().split(" ")
buf[0] = int(buf[0])
buf[1] = int(buf[1])
List.extend(buf)
Comb[i] = buf
List = list(set(List))
#print(Comb,List)
for i in range(len(List)):
buf = []
num = len(Comb)
for j in ... | Traceback (most recent call last):
File "/tmp/tmplivehf3a/tmp5jafj6md.py", line 1, in <module>
data = input().split(" ")
^^^^^^^
EOFError: EOF when reading a line
| |
s475424674 | p02573 | u063596417 | 1598734476 | Python | Python (3.8.2) | py | Runtime Error | 2239 | 1013364 | 673 | from collections import defaultdict
def main():
n, m = map(int, input().split())
friend_group = defaultdict(set)
for _ in range(m):
a, b = map(int, input().split())
for friend in friend_group[b] - friend_group[a] - {a}:
friend_group[friend].add(a)
friend_group[a].a... | Traceback (most recent call last):
File "/tmp/tmpcy4z575p/tmppuo41u4v.py", line 25, in <module>
main()
File "/tmp/tmpcy4z575p/tmppuo41u4v.py", line 5, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s355931791 | p02573 | u408262366 | 1598734455 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 82340 | 1361 | 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 = ... | Traceback (most recent call last):
File "/tmp/tmp14zt173e/tmp3n7nftgh.py", line 48, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s213982665 | p02573 | u143565147 | 1598734434 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 36284 | 559 | n, m = list(map(int, input().split()))
sets = []
a, b = list(map(int, input().split()))
s = set()
s.add(a)
s.add(b)
sets.append(s)
for i in range(1, m):
a, b = list(map(int, input().split()))
f = True
for si in range(len(sets)):
if a in sets[si] or b in sets[si]:
sets[si].add(a)
... | Traceback (most recent call last):
File "/tmp/tmpjhlwoik0/tmpzykqi1f6.py", line 1, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s782887668 | p02573 | u134185377 | 1598734398 | Python | Python (3.8.2) | py | Runtime Error | 2244 | 1205440 | 433 | import numpy as np
import copy
N,M=map(int,input().split())
mat=np.zeros((N,N))
for _ in range(M):
a,b=map(int,input().split())
mat[a-1][b-1]=1
mat[b-1][a-1]=1
mat2=[[j for j in i] for i in mat]
for i in range(N-1):
for j in range(i+1,N):
for k in range(j+1,N):
if (mat[i][j]==1)&(mat... | Traceback (most recent call last):
File "/tmp/tmp9rjlvdmf/tmpr6ulmn5j.py", line 3, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s962052504 | p02573 | u627057223 | 1598734391 | Python | Python (3.8.2) | py | Runtime Error | 958 | 100556 | 653 | from collections import defaultdict
mx = -10**18
def dfs_main(adj,visited,src,temp):
visited[src] = True
temp.append(src)
for negh in adj[src]:
if not visited[negh]:
dfs_main(adj,visited,negh,temp)
return len(temp)
def dfs(n,adj):
visited = {}
for key in adj:
visited[... | Traceback (most recent call last):
File "/tmp/tmpx2nhxuad/tmp3obenfdp.py", line 20, in <module>
n,e = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s052618464 | p02573 | u940622864 | 1598734380 | Python | Python (3.8.2) | py | Runtime Error | 618 | 72628 | 715 | import sys
input = sys.stdin.readline
n,m=map(int,input().split())
p = [tuple(sorted(list(map(int,input().split())))) for ii in range(m)]
p=set(p)
m=len(p)
g=[-1]*(n+1)
r=0
p2=list()
rr=list()
import numpy as np
for pii in p:
if g[pii[0]]<0 and g[pii[1]]<0:
g[pii[0]]=r
g[pii[1]]=r
rr.append(2)
r... | Traceback (most recent call last):
File "/tmp/tmpdv5qwbyh/tmppjpqqcfw.py", line 4, in <module>
n,m=map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s853285269 | p02573 | u392441504 | 1598734364 | Python | Python (3.8.2) | py | Runtime Error | 26 | 9140 | 328 | n,m=input().split()
ab = [map(int, input().split()) for _ in range(m)]
a, b = [list(i) for i in zip(*xy)]
friendnum = [0]*n
for i in range(n):
for k in range(m):
if a[k] == i:
friendnum[i].append(b[i])
if b[k] == i:
friendnum[i].append(a[i])
ans = max(ans,len(frindnum[i]))
pr... | Traceback (most recent call last):
File "/tmp/tmpvak93_l6/tmpqkxq3k19.py", line 1, in <module>
n,m=input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s050265948 | p02573 | u970348538 | 1598734290 | Python | Python (3.8.2) | py | Runtime Error | 936 | 111772 | 565 | def search(x, num):
search_list = []
for y in edge[x]:
if y in nodes:
nodes.remove(y)
edge[y].discard(x)
search_list.append(y)
for y in search_list:
num = search(y, num)
return num + 1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = ... | Traceback (most recent call last):
File "/tmp/tmpsgdhw65h/tmpfz05yyrf.py", line 13, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s794315746 | p02573 | u002765126 | 1598734259 | Python | Python (3.8.2) | py | Runtime Error | 1829 | 1043276 | 401 | from scipy.sparse.csgraph import connected_components
import numpy as np
#import sys
#imput = sys.stdin.readline
n, m = map(int,input().split())
conne = np.zeros((n,n))
for i in range(m):
a,b=map(int,input().split())
conne[a-1][b-1]=1
conne[b-1][a-1]=1
m, labels = connected_components(conne)
ans=0
for ... | Traceback (most recent call last):
File "/tmp/tmpn6urnwvt/tmpbe866is6.py", line 6, in <module>
n, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s260856129 | p02573 | u183509493 | 1598734213 | Python | Python (3.8.2) | py | Runtime Error | 728 | 18304 | 313 | n,m=map(int,input().split())
# Union-Find
a=list(range(n))
def find(x):
if a[x]==x:
return x
a[x] = find(a[x])
return a[x]
for _ in range(m):
x,y=map(int,input().split())
x,y=find(x-1),find(y-1)
if x == y: continue
a[y]=x
count=[0]*n
for i in range(n):
count[find(i)] += 1
print(max(count))
| Traceback (most recent call last):
File "/tmp/tmpv3lapzbo/tmpfdsyk7hk.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s171279675 | p02573 | u002765126 | 1598734183 | Python | Python (3.8.2) | py | Runtime Error | 1920 | 1043484 | 343 | import queue
from scipy.sparse.csgraph import connected_components
import numpy as np
import sys
#imput = sys.stdin.readline
n, m = map(int,input().split())
conne = np.zeros((n,n))
visited = [0]*n
for i in range(m):
a,b=map(int,input().split())
conne[a-1][b-1]=1
conne[b-1][a-1]=1
m, labels = connected_... | Traceback (most recent call last):
File "/tmp/tmphtpgmgb1/tmpxpxaty23.py", line 7, in <module>
n, m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s743345830 | p02573 | u200916944 | 1598734102 | Python | PyPy3 (7.3.0) | py | Runtime Error | 258 | 150404 | 278 | N,M,*A=map(int,open(0).read().split())
d={}
ss=[]
for i in range(0,len(A),2):
a=A[i]
b=A[i+1]
if a in d:
d[a].add(b)
elif b in d:
d[b].add(a)
else:
s=set([a,b])
ss.append(s)
d[a]=d[b]=s
print(max([len(s) for s in ss])) | Traceback (most recent call last):
File "/tmp/tmpvgura72x/tmp4s1tmen_.py", line 1, in <module>
N,M,*A=map(int,open(0).read().split())
^^^^^^
ValueError: not enough values to unpack (expected at least 2, got 0)
| |
s350109328 | p02573 | u143565147 | 1598734076 | Python | Python (3.8.2) | py | Runtime Error | 2283 | 2681996 | 592 | n, m = list(map(int, input().split()))
dp = [[0] * n for i in range(n)]
sets = []
a, b = list(map(int, input().split()))
s = set()
s.add(a)
s.add(b)
sets.append(s)
for i in range(1, m):
a, b = list(map(int, input().split()))
f = True
for si in range(len(sets)):
if a in sets[si] or b in sets[si]:
... | Traceback (most recent call last):
File "/tmp/tmpy1z3cz52/tmp7z9vvs3p.py", line 1, in <module>
n, m = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s294274612 | p02573 | u222643068 | 1598734058 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 69236 | 527 | a,b = list(map(int, input().split()))
friend_li = [[] for _ in range(a)]
result = 0
array = []
def append_child(array,li):
array += li
for i in range(len(li)):
append_child(array,friend_li[li[i]])
for i in range(b):
c,d = list(map(int, input().split()))
friend_li[min(c-1,d-1)].append(max(c-1,d-1))
for e... | Traceback (most recent call last):
File "/tmp/tmp46vmsf5c/tmpzz0x3fwl.py", line 1, in <module>
a,b = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s305963280 | p02573 | u686036872 | 1598734046 | Python | Python (3.8.2) | py | Runtime Error | 34 | 10556 | 854 | class UnionFind:
def __init__(self, N):
self.N = N
self.parent = [-1] * N
def root(self, A):
if (self.parent[A] < 0):
return A
self.parent[A] = self.root(self.parent[A])
return self.parent[A]
def size(self, A):
return -self.parent[self.root(A)]
... | Traceback (most recent call last):
File "/tmp/tmpn6_0el44/tmp9vgvpxbz.py", line 34, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s260361289 | p02573 | u659159398 | 1598734044 | Python | PyPy3 (7.3.0) | py | Runtime Error | 788 | 174668 | 498 | def dfs(g, start):
visited[start] = True
cc.append(0)
for nbr in g[start]:
if not visited[nbr]:
dfs(g, nbr)
from collections import defaultdict
n, m = map(int, input().split())
g = defaultdict(set)
for _ in range(m):
a, b = map(int, input().split())
g[a - 1].add(b - 1)
g[... | Traceback (most recent call last):
File "/tmp/tmpbr91bh2_/tmpr1td05s4.py", line 11, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s330198624 | p02573 | u273507800 | 1598734035 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 36356 | 293 | N, M = map(int, input().strip().split())
g = []
for _ in range(M):
Ai, Bj = map(int, input().strip().split())
j = -1
for i, _g in enumerate(g):
if Ai in _g or Bj in _g:
j = i
if j < 0:
g.append(set([Ai, Bj]))
else:
g[j].add(Ai)
g[j].add(Bj)
print(max([len(_g) for _g in g])) | Traceback (most recent call last):
File "/tmp/tmpw08bfg5_/tmp45mutsia.py", line 1, in <module>
N, M = map(int, input().strip().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s351343499 | p02573 | u107798522 | 1598733973 | Python | PyPy3 (7.3.0) | py | Runtime Error | 954 | 106052 | 668 | N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
group = [1]*N
tmp = 0
for i in range(M):
if AB[i][0] > AB[i][1]:
tmp = AB[i][0]
AB[i][0] = AB[i][1]
AB[i][1] = tmp
AB.sort()
before0 = AB[0][0]
before1 = AB[0][1]
for i in range(M):
if i == 0:
... | Traceback (most recent call last):
File "/tmp/tmpe23odk6_/tmpeg5gzf2i.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s928777794 | p02573 | u602677143 | 1598733961 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2207 | 73524 | 543 | import collections
n,m = map(int,input().split())
ls = []
for i in range(m):
a,b = map(int,input().split())
tmp = 0
for i in range(len(ls)):
if (a in ls[i]) and (b in ls[i]):
tmp = 1
break
if (a in ls[i]):
ls[i].append(b)
tmp = 1
break
elif (b in ls[... | Traceback (most recent call last):
File "/tmp/tmpd4e7mwwl/tmp19lz9rxc.py", line 2, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s058129794 | p02573 | u731807761 | 1598733931 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 12020 | 687 | from sys import exit, stdin
input = stdin.readline
import copy
from collections import deque, Counter
# import numpy as np
N, M = list(map(int, input().split()))
D = [-1] * N
tmp = 0
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
if D[a] == -1 and D[b] == -1:
D[a]... | Traceback (most recent call last):
File "/tmp/tmptkj3q1u6/tmpq2mqli6o.py", line 11, in <module>
N, M = list(map(int, input().split()))
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s916013542 | p02573 | u669812251 | 1598733897 | Python | PyPy3 (7.3.0) | py | Runtime Error | 359 | 104028 | 296 | # -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
edges = []
for _i in range(M):
edges.append(list(map(int, input().split())))
import networkx as nx
G = nx.Graph()
G.add_edges_from(edges)
ans = 1
for comp in nx.connected_components(G):
ans = max(ans, len(comp))
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpykzuzvqr/tmpzatvo2sr.py", line 2, in <module>
N, M = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s879654381 | p02573 | u183509493 | 1598733878 | Python | Python (3.8.2) | py | Runtime Error | 697 | 18180 | 281 | n,m=map(int,input().split())
# Union-Find
a=list(range(n))
def find(x):
if a[x]==x:
return x
a[x] = find(a[x])
return a[x]
for _ in range(m):
x,y=map(int,input().split())
a[find(y-1)]=find(x-1)
count=[0]*n
for i in range(n):
count[find(i)] += 1
print(max(count))
| Traceback (most recent call last):
File "/tmp/tmpeqb5m66o/tmpzyxircja.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s362649597 | p02573 | u356983865 | 1598733831 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45880 | 1008 | N,M = map(int,input().split())
hint_list = [list(map(int,input().split())) for i in range(M)]
friend_list = []
def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
hint_list = get_unique_list(hint_list)
if M == 0:
print(N)
else:
friend_list.append(hint_l... | Traceback (most recent call last):
File "/tmp/tmp36ua10su/tmpm7ik247n.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s314252056 | p02573 | u715329136 | 1598733823 | Python | Python (3.8.2) | py | Runtime Error | 379 | 11408 | 1230 | def resolve():
N, M = map(int, input().split())
person_group = [0] * (N+5)
group_counter = 0
member_counter = {0: 0}
def _marge_group(a, b):
for i in range(len(person_group)):
if person_group[i] == b:
person_group[i] == a
member_counter[a] = member_count... | Traceback (most recent call last):
File "/tmp/tmpt6yponsz/tmpez3blgam.py", line 37, in <module>
resolve()
File "/tmp/tmpt6yponsz/tmpez3blgam.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s076211246 | p02573 | u356983865 | 1598733812 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45728 | 1012 | N,M = map(int,input().split())
hint_list = [list(map(int,input().split())) for i in range(M)]
friend_list = []
def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
hint_list = get_unique_list(hint_list)
if M == 0:
print(N)
else:
friend_list.append(hint_l... | Traceback (most recent call last):
File "/tmp/tmpq0ubqx42/tmpyc_dtcud.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s192831710 | p02573 | u940622864 | 1598733787 | Python | Python (3.8.2) | py | Runtime Error | 651 | 72672 | 660 | import sys
input = sys.stdin.readline
n,m=map(int,input().split())
p = [tuple(sorted(list(map(int,input().split())))) for ii in range(m)]
p=set(p)
m=len(p)
g=[-1]*(n+1)
r=0
p2=list()
rr=list()
import numpy as np
for pii in p:
if g[pii[0]]<0 and g[pii[1]]<0:
g[pii[0]]=r
g[pii[1]]=r
rr.append(2)
r... | Traceback (most recent call last):
File "/tmp/tmppiy9_np_/tmpnvcuct_5.py", line 4, in <module>
n,m=map(int,input().split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s819630860 | p02573 | u699715278 | 1598733754 | Python | Python (3.8.2) | py | Runtime Error | 1037 | 115648 | 610 | [N, M] = [int(i) for i in input().split()]
friends = [set() for i in range(N+1)]
for i in range(M):
temp = [int(j) for j in input().split()]
friends[temp[0]].add(temp[1])
friends[temp[1]].add(temp[0])
def get_friend(p):
global comp
try:
comp.remove(p)
except:
return 0
temp... | Traceback (most recent call last):
File "/tmp/tmp8enebazr/tmprvnm6ffx.py", line 1, in <module>
[N, M] = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s188560904 | p02573 | u295585689 | 1598733752 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 29000 | 588 | import numpy as np
n,M = [int(i) for i in input().split()]
N = np.ones(n)*-1
n_group = 0
for i in range(M):
a,b = [int(i) for i in input().split()]
if N[a]==-1 and N[b]==-1:
N[a] = n_group
N[b] = n_group
n_group += 1
elif N[a]>-1 and N[b]>-1:
new = min(N[a],N[b])... | Traceback (most recent call last):
File "/tmp/tmpupr2ruy6/tmp5i9qigeg.py", line 3, in <module>
n,M = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s423412823 | p02573 | u414050834 | 1598733745 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 42960 | 371 | from collections import Counter
n,m=map(int,input().split())
l=[]
for i in range(m):
s=[]
a,b=map(int,input().split())
s.append(a)
s.append(b)
l.append(s)
def get_unique_list(seq):
seen = []
return [x for x in seq if (x or reversed(x)) not in seen and not seen.append(x)]
ls=get_unique_list(l)
cnt=Coun... | Traceback (most recent call last):
File "/tmp/tmpj3z0rb53/tmp_x_ykzle.py", line 2, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s952050644 | p02573 | u572026348 | 1598733739 | Python | Python (3.8.2) | py | Runtime Error | 760 | 335580 | 362 | import numpy as np
def main():
n, m = map(int, input().split())
friends_mat = np.zeros((n, n), dtype=int)
for i in range(m):
a, b = map(int, input().split())
friends_mat[a - 1][b - 1] = 1
friends_mat[b - 1][a - 1] = 1
# print(friends_mat)
print(max(friends_mat.sum(axis=0)+1... | Traceback (most recent call last):
File "/tmp/tmpexc0lgs0/tmpbcw3psm1.py", line 16, in <module>
main()
File "/tmp/tmpexc0lgs0/tmpbcw3psm1.py", line 5, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s983224356 | p02573 | u715329136 | 1598733716 | Python | Python (3.8.2) | py | Runtime Error | 385 | 11424 | 1200 | def resolve():
N, M = map(int, input().split())
person_group = [0] * (N+5)
group_counter = 0
member_counter = {0: 0}
def _marge_group(a, b):
for i in range(len(person_group)):
if person_group[i] == b:
person_group[i] == a
member_counter[a] = member_count... | Traceback (most recent call last):
File "/tmp/tmpsl4keihn/tmp981ux3np.py", line 35, in <module>
resolve()
File "/tmp/tmpsl4keihn/tmp981ux3np.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s225645974 | p02573 | u699715278 | 1598733696 | Python | Python (3.8.2) | py | Runtime Error | 1239 | 118688 | 639 | [N, M] = [int(i) for i in input().split()]
friends = [set() for i in range(N+1)]
print(friends)
for i in range(M):
temp = [int(j) for j in input().split()]
friends[temp[0]].add(temp[1])
friends[temp[1]].add(temp[0])
def get_friend(p):
global comp
try:
comp.remove(p)
except:
re... | Traceback (most recent call last):
File "/tmp/tmpzpfb3heq/tmp_9pzsb18.py", line 1, in <module>
[N, M] = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s827826012 | p02573 | u872538555 | 1598733662 | Python | Python (3.8.2) | py | Runtime Error | 896 | 33884 | 1036 | from collections import Counter
class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n)]
self.rank = [0] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par... | Traceback (most recent call last):
File "/tmp/tmpxd10es9x/tmpynl5zo3e.py", line 28, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s474281937 | p02573 | u267549387 | 1598733652 | Python | Python (3.8.2) | py | Runtime Error | 1322 | 44916 | 1464 | #!/usr/bin/env python3
# from typing import Optional
# from typing import List
# from typing import Dict
# from typing import Tuple
# from typing import Sequence
def main():
args = input().split()
N = int(args[0])
M = int(args[1])
groupList = list()
hitDict = set()
for i in range(M):
... | Traceback (most recent call last):
File "/tmp/tmpiuxdc2_8/tmp3vgqbxpp.py", line 60, in <module>
main()
File "/tmp/tmpiuxdc2_8/tmp3vgqbxpp.py", line 11, in main
args = input().split()
^^^^^^^
EOFError: EOF when reading a line
| |
s073822545 | p02573 | u692657167 | 1598733650 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2235 | 976640 | 752 | from itertools import combinations
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
x = [[] for _ in range(N + 1)]
for a, b in AB:
x[a].append(b)
x[b].append(a)
for row in x:
if len(row) >= 2:
for v in combinations(row, 2):
x[v[0]].append(v[1])... | Traceback (most recent call last):
File "/tmp/tmpxz2ynihb/tmp2of6_kru.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s987503141 | p02573 | u840037795 | 1598733643 | Python | PyPy3 (7.3.0) | py | Runtime Error | 566 | 157660 | 759 | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
nums = [0] * N
friends = []
for _ in range(N):
friends.append(set())
for _ in range(M):
A, B = map(int, input().split())
friends[A-1].add(B-1)
friends[B-1].add(A-1)
gnum = 0
groupn = 0
nmax = 0
def find_route(i):
global gnum
... | Traceback (most recent call last):
File "/tmp/tmp1y5zc25t/tmp1s2p80s7.py", line 4, in <module>
N, M = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s240405397 | p02573 | u878518432 | 1598733642 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2232 | 803084 | 661 | N, M = [int(i) for i in input().split()]
a, b = input().split()
tomodachi_list = [[a,b]] #同じグループにしてはいけないリスト
for _ in range(M-1):
a, b = input().split()
flag = 0
for group in tomodachi_list:
if a in group and b in group:
break
elif a in group and b not in group:
group... | Traceback (most recent call last):
File "/tmp/tmpm5h3n0e8/tmp3eb2amnm.py", line 1, in <module>
N, M = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s169326424 | p02573 | u875584014 | 1598733622 | Python | Python (3.8.2) | py | Runtime Error | 2205 | 18168 | 559 | N,M=map(int,input().split())
F=[1]*N
G=[0]*N
for i in range(M):
A,B=map(int,input().split())
if G[A-1]!=0 and G[B-1]==0:
f=F[A-1]+F[B-1]
F[A-1]=f
F[B-1]=f
G[B-1]=G[A-1]
elif G[A-1]==0 and G[B-1]!=0:
f=F[A-1]+F[B-1]
F[A-1]=f
F[B-1]=f
G[A-1]=G[B-1]
elif G[A-1]!=G[B-1]:
f=F[A-1... | Traceback (most recent call last):
File "/tmp/tmpzv12xzxx/tmpr9gcq3m6.py", line 1, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s710847307 | p02573 | u760569096 | 1598733618 | Python | PyPy3 (7.3.0) | py | Runtime Error | 661 | 137132 | 407 | n,m = map(int, input().split())
if m == 0:
print(1)
exit()
g = [[] for i in range(n)]
for i in range(m):
a, b = map(int, input().split())
g[a-1].append(b-1)
g[b-1].append(a-1)
v = [-1 for i in range(n)]
ans = [0]*(n+1)
def dfs(x,y):
for i in g[x]:
if v[i] == -1:
v[i]=1
ans[y]+=1
dfs(i,... | Traceback (most recent call last):
File "/tmp/tmp06_jkmg9/tmp6je6yu7b.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s409686953 | p02573 | u260370057 | 1598733613 | Python | Python (3.8.2) | py | Runtime Error | 544 | 18592 | 855 | 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 type(frl[number[a-1]-1]) == int:
number[a-1] = frl[number[a-1]-1]
if number[b-1] != 0 and type(frl[number[b-1]-1]) == int:
number[b-1] = frl[numb... | Traceback (most recent call last):
File "/tmp/tmpl05mgr6s/tmpku8qm5a8.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s740310139 | p02573 | u155604571 | 1598733612 | Python | Python (3.8.2) | py | Runtime Error | 525 | 47124 | 762 | n, m = map(int, input().split())
F = [list(map(int, input().split())) for i in range(m)]
friends=[1]
num=1
people=[-1]*n
ans=0
for f in F:
a=f[0]-1
b=f[1]-1
#print(a,b)
if people[a]==-1 and people[b]==-1:
friends.append(2)
people[a]=num
people[b]=num
num+=1
elif ... | Traceback (most recent call last):
File "/tmp/tmp96oohfd2/tmpegh6to9s.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s073908545 | p02573 | u412255932 | 1598733604 | Python | Python (3.8.2) | py | Runtime Error | 1223 | 95064 | 507 | from collections import defaultdict
N, M = map(int, input().split())
adj_list = defaultdict(set)
for i in range(M):
a, b = map(int, input().split())
adj_list[a].add(b)
adj_list[b].add(a)
visited = set([])
def dfs(target):
if target in visited:
return 0
visited.add(target)
node_count... | Traceback (most recent call last):
File "/tmp/tmp5nkmyife/tmpu0ro2v1m.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s899674498 | p02573 | u295585689 | 1598733603 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 28732 | 590 | import numpy as np
n,M = [int(i) for i in input().split()]
N = np.ones(n)*-1
n_group = 0
for i in range(M):
a,b = [int(i) for i in input().split()]
if N[a]==-1 and N[b]==-1:
N[a] = n_group
N[b] = n_group
n_group += 1
elif N[a]>-1 and N[b]>-1:
new = min(N[a],N[b])... | Traceback (most recent call last):
File "/tmp/tmpc0zze0yg/tmp4w01_ihy.py", line 3, in <module>
n,M = [int(i) for i in input().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s834353284 | p02573 | u297089927 | 1598733602 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9536 | 715 | n,m=map(int,input().split())
li=[]
ans=0
if m!=0:
for i in range(m):
a,b=map(int,input().split())
if len(li)==0:
li.append([a,b])
else:
flag=0
for j in range(len(li)):
if a in li[j] and b not in li[j]:
li[j].append(b)
... | Traceback (most recent call last):
File "/tmp/tmpesrkdlfr/tmpfxgt83ky.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s891105663 | p02573 | u548778623 | 1598733600 | Python | Python (3.8.2) | py | Runtime Error | 26 | 8940 | 1575 | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(ll i=0;i<(ll)n;++i)
struct UnionFind{
vector<int> d; //子なら親のID,根なら-サイズを保存
UnionFind(int n=0) : d(n,-1) {} //最初はみんな根でサイズ1 (コンストラクタ :と{}の間には初期化子が入る)
int find(int x){
//自分が根なら自分を、そうでなければ親のfind結果を返す(再帰)... | File "/tmp/tmpvhe9znrd/tmp7iafp1pp.py", line 11
//自分が根なら自分を、そうでなければ親のfind結果を返す(再帰)
^
SyntaxError: invalid character '、' (U+3001)
| |
s694662528 | p02573 | u663796637 | 1598733600 | Python | Python (3.8.2) | py | Runtime Error | 2227 | 609884 | 414 | n, m = map(int, input().split())
frends = []
for i in range(m):
frends.append(list(map(int, input().split())))
# print(frends)
matrix = [[0 for i in range(n)] for j in range(n)]
# print(matrix)
for i in range(m):
matrix[frends[i][0]-1][frends[i][1]-1] = 1
matrix[frends[i][1]-1][frends[i][0]-1] = 1
# print(matrix)
... | Traceback (most recent call last):
File "/tmp/tmphuoknca1/tmpqbwd010z.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s138711928 | p02573 | u133236239 | 1598733599 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 64640 | 483 | n, m = map(int, input().split())
li = list(set() for _ in range(m))
count = -1
for _ in range(m):
flag = False
one, two = map(int, input().split())
for i in range(count):
if one in li[i] or two in li[i]:
li[i].add(one)
li[i].add(two)
flag = True
brea... | Traceback (most recent call last):
File "/tmp/tmpu3zqllqu/tmpre80uomp.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s428512357 | p02573 | u002765126 | 1598733598 | Python | Python (3.8.2) | py | Runtime Error | 27 | 9128 | 491 | import math
n=int(input())
A=list(map(int,input().split()))
import queue
from scipy.sparse.csgraph import connected_components
import numpy as np
import sys
#imput = sys.stdin.readline
n, m = map(int,input().split())
conne = np.zeros((n,n))
visited = [0]*n
for i in range(m):
a,b=map(int,input().split())
c... | Traceback (most recent call last):
File "/tmp/tmpf793dk1x/tmp1r4rlcxm.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s455349537 | p02573 | u536017058 | 1598733598 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2370 | 3526988 | 241 | N, M = map(int, input().split())
L = []
N2 = [[0]*N for i in range(N)]
ans = 0
for _ in range(M):
A, B = map(int, input().split())
N2[A-1][B-1] = 1; N2[B-1][A-1] =1
sumN2 = []
for i in range(N):
sumN2.append(N[i]+1)
print(max(sumN2)) | Traceback (most recent call last):
File "/tmp/tmpehdejjom/tmprho9gt6d.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s295465281 | p02573 | u278601006 | 1598733597 | Python | Python (3.8.2) | py | Runtime Error | 2295 | 2569212 | 691 | import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations
N, M = map(int, input().split())
A = [0] * M
B = [0] * M
R = {i: set() for i in range(N)... | Traceback (most recent call last):
File "/tmp/tmpe4o67a0r/tmp0817nc4_.py", line 8, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s341448165 | p02573 | u386987737 | 1598733594 | Python | Python (3.8.2) | py | Runtime Error | 25 | 9036 | 537 | import numpy as np
N,M = list(map(int,input().split()))
newlist = [[] for i in range(N)]
for i in range(M):
A,B=input().split()
newlist[int(A)-1].append(int(A))
newlist[int(A)-1].append(int(B))
newlist[int(A)-1]=list(set(newlist[int(A)-1]))
for i in range(0,N-1):
for j in range(i+1,N):
if(newlist[i]... | File "/tmp/tmp1w8lm44h/tmp24m971i1.py", line 19
if (count>length):
TabError: inconsistent use of tabs and spaces in indentation
| |
s582324740 | p02573 | u840037795 | 1598733592 | Python | PyPy3 (7.3.0) | py | Runtime Error | 654 | 161860 | 771 | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
nums = [0] * N
friends = []
for _ in range(N):
friends.append(set())
for _ in range(M):
A, B = map(int, input().split())
friends[A-1].add(B-1)
friends[B-1].add(A-1)
gnum = 0
groupn = 0
nmax = 0
def find_route(i):
global gnum
... | Traceback (most recent call last):
File "/tmp/tmpl_f4eb9f/tmpyl7qjxoq.py", line 4, in <module>
N, M = map(int, input().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s195921835 | p02573 | u414050834 | 1598733592 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 43032 | 368 | from collections import Counter
n,m=map(int,input().split())
l=[]
for i in range(m):
s=[]
a,b=map(int,input().split())
s.append(a)
s.append(b)
l.append(s)
def get_unique_list(seq):
seen = []
return [x for x in seq if (x or reversed(x)) not in seen and not seen.append(x)]
ls=get_unique_list(l)
cnt=Coun... | Traceback (most recent call last):
File "/tmp/tmp9jahen_0/tmp3rx8nami.py", line 2, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s558129232 | p02573 | u395252999 | 1598733592 | Python | PyPy3 (7.3.0) | py | Runtime Error | 814 | 180780 | 875 | def main():
N, M = map(int, input().split())
relations = dict()
for _ in range(M):
r_a, r_b = map(int, input().split())
min_r, max_r = min(r_a, r_b), max(r_a, r_b)
if min_r not in relations:
relations[min_r] = {max_r}
else:
relations[min_r].add(max_r)
... | Traceback (most recent call last):
File "/tmp/tmpnfo8u_re/tmpffciij7q.py", line 35, in <module>
main()
File "/tmp/tmpnfo8u_re/tmpffciij7q.py", line 2, in main
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s342481950 | p02573 | u534610124 | 1598733592 | Python | Python (3.8.2) | py | Runtime Error | 2208 | 114680 | 681 | N,M = map(int, input().split())
dic = dict((i, set()) for i in range(1,N+1))
try:
for _ in range(M):
a,b = map(int, input().split())
dic[a].add(b)
except:
pass
def dfs(x:int, mark:set):
marked = mark
a = dic[x]
marked.add(x)
for i in dic[x]:
if i not in marked:
... | Traceback (most recent call last):
File "/tmp/tmppfwlfzmi/tmpojpfduen.py", line 1, in <module>
N,M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s807980881 | p02573 | u134185377 | 1598733591 | Python | Python (3.8.2) | py | Runtime Error | 2255 | 1219568 | 434 | import numpy as np
import copy
N,M=map(int,input().split())
mat=np.zeros((N,N))
for _ in range(M):
a,b=map(int,input().split())
mat[a-1][b-1]=1
mat[b-1][a-1]=1
mat2=[[j for j in i] for i in mat]
for i in range(N):
for j in range(i+1,N):
for k in range(j+1,N):
if (mat[i][j]==1)&(mat[i... | Traceback (most recent call last):
File "/tmp/tmpigp3ja4b/tmpluaizn89.py", line 3, in <module>
N,M=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s174063717 | p02573 | u970348538 | 1598733590 | Python | Python (3.8.2) | py | Runtime Error | 1042 | 111888 | 562 | def search(x, num):
search_list = []
for y in edge[x]:
if y in nodes:
nodes.remove(y)
edge[y].remove(x)
search_list.append(y)
for y in search_list:
num = search(y, num)
return num+1
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
edge = [se... | Traceback (most recent call last):
File "/tmp/tmp65k0seui/tmptn31v3kq.py", line 13, in <module>
(n,m),*d = [list(map(int, s.split())) for s in open(0)]
^^^^^^^^
ValueError: not enough values to unpack (expected at least 1, got 0)
| |
s582018629 | p02573 | u794448346 | 1598733590 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 17652 | 266 | N,M = map(int,input().split())
f = []
for i in range(M):
A,B = map(int,input().split())
a = {A,B}
for i in f:
if i & a != set():
a = i | a
f.remove(i)
# print(f,a,i)
f.append(a)
#print(f)
print(len(max(f))) | Traceback (most recent call last):
File "/tmp/tmpm0ymyivv/tmpa44t4kc_.py", line 1, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s834759238 | p02573 | u364693468 | 1598733588 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2208 | 80420 | 1051 | import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): r... | Traceback (most recent call last):
File "/tmp/tmphnk4wmn1/tmp4sy0r_7s.py", line 36, in <module>
main()
File "/tmp/tmphnk4wmn1/tmp4sy0r_7s.py", line 11, in main
N, M = MI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s742265382 | p02573 | u591808161 | 1598733584 | Python | PyPy3 (7.3.0) | py | Runtime Error | 495 | 107792 | 1838 | import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return... | Traceback (most recent call last):
File "/tmp/tmpjtcxss4i/tmp84ksmg5j.py", line 78, in <module>
main()
File "/tmp/tmpjtcxss4i/tmp84ksmg5j.py", line 22, in main
N, M = MI()
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s507122206 | p02573 | u278601006 | 1598733581 | Python | Python (3.8.2) | py | Runtime Error | 2288 | 2691552 | 707 | import numpy as np
from copy import deepcopy
from heapq import heappop, heappush
from bisect import bisect_left, bisect
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations
N, M = map(int, input().split())
A = [0] * M
B = [0] * M
R = {i: set() for i in range(N)... | Traceback (most recent call last):
File "/tmp/tmp_73k7hwg/tmpszjvn2kb.py", line 8, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s094821952 | p02573 | u243061947 | 1598733575 | Python | Python (3.8.2) | py | Runtime Error | 1383 | 97796 | 638 | 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(1, n+1):
friends[i] = set()
checke... | Traceback (most recent call last):
File "/tmp/tmpe24c9usd/tmp33marguj.py", line 11, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s336994366 | p02573 | u732832001 | 1598733574 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45444 | 862 | n, m = map(int, input().split())
li_all = []
for i in range(m):
li = list(map(int, input().split()))
li_all.append(li)
li_g = []
for i in range(1, m+1):
li_g.append([])
for j in range(m):
if i in li_all[j]:
li_g[i-1].extend(li_all[j])
li_g[i-1] = list(set(li_g[i-1]))
def conbine(li, check_num):
... | Traceback (most recent call last):
File "/tmp/tmpb2li4ecc/tmp6oectrq5.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s754230126 | p02573 | u872538555 | 1598733570 | Python | Python (3.8.2) | py | Runtime Error | 890 | 33736 | 1040 | from collections import Counter
class UnionFind():
def __init__(self, n):
self.par = [i for i in range(n)]
self.rank = [0] * n
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par... | Traceback (most recent call last):
File "/tmp/tmpijo2wtxe/tmp24imqh69.py", line 28, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s672551094 | p02573 | u018808362 | 1598733568 | Python | Python (3.8.2) | py | Runtime Error | 1029 | 684532 | 208 | 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
print(max(np.count_nonzero(AD, 0))) | Traceback (most recent call last):
File "/tmp/tmpol3miemy/tmp82qolyl5.py", line 2, in <module>
N, M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s069209660 | p02573 | u063596417 | 1598733568 | Python | Python (3.8.2) | py | Runtime Error | 2221 | 556436 | 481 | from collections import defaultdict
def main():
n, m = map(int, input().split())
friend_group = defaultdict(set)
for _ in range(m):
a, b = map(int, input().split())
friend_group[a].add(b)
friend_group[b].add(a)
friends = friend_group[a] | friend_group[b]
for friend ... | Traceback (most recent call last):
File "/tmp/tmpqnuwjczp/tmp4l9jwer5.py", line 18, in <module>
main()
File "/tmp/tmpqnuwjczp/tmp4l9jwer5.py", line 5, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s192097800 | p02573 | u617040773 | 1598733563 | Python | PyPy3 (7.3.0) | py | Runtime Error | 535 | 125032 | 817 | from collections import Counter
def resolve():
N, connections = map(int, input().split())
connection_set = set([tuple(map(int, input().split())) for _ in range(connections)])
group_list = [0]*N
group_num = 1
for connection in connection_set:
x0 = connection[0]-1
x1 = connection[... | Traceback (most recent call last):
File "/tmp/tmpzw1e4mcf/tmpgvv8h0t2.py", line 29, in <module>
resolve()
File "/tmp/tmpzw1e4mcf/tmpgvv8h0t2.py", line 3, in resolve
N, connections = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s407377306 | p02573 | u087470052 | 1598733561 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9532 | 757 | n, m = (int(x) for x in input().split())
l = []
l2 = []
for i in range(m):
a ,b =(int(x) for x in input().split())
f = False
f2 = False
for j in range(len(l)):
if a in l[j]:
f = True
for k in range(len(l) - j):
if b in l[j + k]:
f2 = True
if k != 0:
l[j] +... | Traceback (most recent call last):
File "/tmp/tmpief6utb4/tmp97i1w76z.py", line 1, in <module>
n, m = (int(x) for x in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s590849687 | p02573 | u715329136 | 1598733553 | Python | Python (3.8.2) | py | Runtime Error | 369 | 11388 | 1181 | def resolve():
N, M = map(int, input().split())
person_group = [0] * (N+5)
group_counter = 0
member_counter = {0: 0}
def _marge_group(a, b):
for i in range(len(person_group)):
if person_group[i] == b:
person_group[i] == a
member_counter[a] += member_coun... | Traceback (most recent call last):
File "/tmp/tmpny6ngmss/tmpv8lb7jmi.py", line 35, in <module>
resolve()
File "/tmp/tmpny6ngmss/tmpv8lb7jmi.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s106127420 | p02573 | u972591645 | 1598733550 | Python | PyPy3 (7.3.0) | py | Runtime Error | 852 | 121084 | 497 | n, m = map(int, input().split())
ab = sorted(set([tuple(map(int, input().split())) for _ in range(m)]))
c = []
flag = False
for i in ab:
a, b = i[0], i[1]
for i in c:
if a in i or b in i:
i.add(a)
i.add(b)
if len(i) == n:
flag = True
break... | Traceback (most recent call last):
File "/tmp/tmpi6ib7pr4/tmpmmayrbeu.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s039002283 | p02573 | u155604571 | 1598733539 | Python | Python (3.8.2) | py | Runtime Error | 526 | 47124 | 773 | n, m = map(int, input().split())
F = [list(map(int, input().split())) for i in range(m)]
friends=[1]
num=1
people=[-1]*n
ans=0
for f in F:
a=f[0]-1
b=f[1]-1
#print(a,b)
if people[a]==-1 and people[b]==-1:
friends.append(2)
people[a]=num
people[b]=num
num+=1
elif ... | Traceback (most recent call last):
File "/tmp/tmpy2axo7oi/tmp6qjbiw0a.py", line 1, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s131797764 | p02573 | u018808362 | 1598733527 | Python | Python (3.8.2) | py | Runtime Error | 31 | 8904 | 421 | mport numpy as np
def dot_py(A,B):
m, n = A.shape
p = B.shape[1]
C = np.zeros((m,p))
for i in range(0,m):
for j in range(0,p):
for k in range(0,n):
C[i,j] += A[i,k]*B[k,j]
return C
N, M = map(int,input().split())
Adj=np.identity(N)
for i in range(M):
A, B=... | File "/tmp/tmpr7e1bu2g/tmp558tmfv1.py", line 1
mport numpy as np
^^^^^
SyntaxError: invalid syntax
| |
s102726676 | p02573 | u450288159 | 1598733520 | Python | Python (3.8.2) | py | Runtime Error | 469 | 38568 | 1462 | # -*- 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 = []
num_check = {}
numnum = {}
set_num = 1
for i in range(m):
check=True
a,b = map(int, input().s... | Traceback (most recent call last):
File "/tmp/tmpbofllkle/tmp6n2ew9vd.py", line 57, in <module>
main()
File "/tmp/tmpbofllkle/tmp6n2ew9vd.py", line 8, in main
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s148733221 | p02573 | u107798522 | 1598733519 | Python | PyPy3 (7.3.0) | py | Runtime Error | 1009 | 109524 | 659 | N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
group = [1]*N
tmp = 0
for i in range(M):
if AB[i][0] > AB[i][1]:
tmp = AB[i][0]
AB[i][0] = AB[i][1]
AB[i][1] = tmp
AB.sort()
before0 = AB[0][0]
before1 = AB[0][1]
for i in range(M):
if i != 0:
... | Traceback (most recent call last):
File "/tmp/tmpe_xp6otb/tmp2femu6ql.py", line 1, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s052597218 | p02573 | u715329136 | 1598733511 | Python | Python (3.8.2) | py | Runtime Error | 397 | 11348 | 1181 | 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(len(person_group)):
if person_group[i] == b:
person_group[i] == a
member_counter[a] += member_coun... | Traceback (most recent call last):
File "/tmp/tmpdw8umioy/tmpw1f8wa3n.py", line 35, in <module>
resolve()
File "/tmp/tmpdw8umioy/tmpw1f8wa3n.py", line 2, in resolve
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s824696799 | p02573 | u724549242 | 1598733507 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 60528 | 844 | n,m = map(int,input().split())
A=[]
B=[]
for i in range(m):
a,b = map(int,input().split())
A.append(a)
B.append(b)
Flist=[]
for i in range(m):
flag = False
for F in Flist:
if A[i] in F:
flag = True
for G in Flist:
if (G != F) and (B[i] in G):
... | Traceback (most recent call last):
File "/tmp/tmpaohb_s84/tmp2kfjz4_1.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s013347402 | p02573 | u904331908 | 1598733504 | Python | Python (3.8.2) | py | Runtime Error | 2207 | 45796 | 423 | n,m = map(int,input().split())
p = [list(map(int,input().split())) for i in range(m)]
def get_unique_list(seq):
seen = []
return [x for x in seq if x not in seen and not seen.append(x)]
newp = get_unique_list(p)
def flatten_2d(data):
for block in data:
for elem in block:
yield elem
... | Traceback (most recent call last):
File "/tmp/tmp7dhjtkl3/tmpupdbdw_g.py", line 1, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s622634650 | p02573 | u282813849 | 1598733496 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9848 | 648 | N, M = [int(a) for a in input().split()]
lol = []
for i in range(M):
a, b = [int(a) for a in input().split()]
found_a = -10
found_b = -10
for j in range(len(lol)):
if a in lol[j]:
found_a = j
if b in lol[j]:
found_b = j
if found_a >= 0 and found_b >= 0:
break
if found_a < 0 an... | Traceback (most recent call last):
File "/tmp/tmpvebx7p35/tmp0xa01ftp.py", line 1, in <module>
N, M = [int(a) for a in 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.