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
s798385356
p02573
u218375549
1598733495
Python
PyPy3 (7.3.0)
py
Runtime Error
2225
548588
380
N, M = map(int, input().split()) S = [] for i in range(M): S.append(set(input().split())) # print(S) groups = [S[0]] for j in range(1,len(S)-1): for k in range(len(groups)): if S[j] & groups[k] != set(): groups[k] = S[j] | group else: groups.append(S[j]) lens = [] for g...
Traceback (most recent call last): File "/tmp/tmpp9v53mem/tmp9lj7nnxk.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s013668748
p02573
u260370057
1598733492
Python
Python (3.8.2)
py
Runtime Error
29
10712
813
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 type(frl[number[a-1]-1]) == int: number[a-1] = frl[number[a-1]-1] if type(frl[number[b-1]-1]) == int: number[b-1] = frl[number[b-1]-1] if number[a-1] == 0 and number...
Traceback (most recent call last): File "/tmp/tmppaen0mpc/tmpby_vnmju.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s382610036
p02573
u643426419
1598733485
Python
Python (3.8.2)
py
Runtime Error
2207
45752
532
# -*- coding: utf-8 -*- N, M=map(int,input().split(' ')) A=[list(map(int,input().split(' '))) for _ in range(M)] friends = [] for a in A: l=[] for i in range(len(friends)): if a[0] in friends[i] or a[1] in friends[i]: friends[i].extend(a) l.append(i) if len(l) == 0: friends.append(a) eli...
Traceback (most recent call last): File "/tmp/tmpcgroicb0/tmpyacz3jxl.py", line 2, in <module> N, M=map(int,input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s578920959
p02573
u003926785
1598733484
Python
PyPy3 (7.3.0)
py
Runtime Error
101
75804
586
N, M = map(int, input().split()) l = [] A = 0 B = 0 ans = 1 if M > 0: A, B = map(int, input().split()) l.append([A, B]) for i in range(M-1): A, B = map(int, input().split()) hit = None for tup in l: if A in tup or B in tup: if hit != None: hit = set(hit+tup+[A, B...
Traceback (most recent call last): File "/tmp/tmpboqjxiln/tmpdezf_k55.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s533511975
p02573
u534610124
1598733483
Python
Python (3.8.2)
py
Runtime Error
2209
81444
618
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, marked:set): a = dic[x] marked.add(x) for i in dic[x]: if i not in marked: b, mark...
Traceback (most recent call last): File "/tmp/tmpl1mhl0hy/tmpb4nuhu57.py", line 1, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s086663207
p02573
u715329136
1598733481
Python
PyPy3 (7.3.0)
py
Runtime Error
323
72632
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/tmphpsxl2jj/tmp432kavci.py", line 35, in <module> resolve() File "/tmp/tmphpsxl2jj/tmp432kavci.py", line 2, in resolve N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s811057927
p02573
u710515311
1598733480
Python
PyPy3 (7.3.0)
py
Runtime Error
2209
113436
909
def solve(): N, M = [int(i) for i in input().split()] F = [-1] * N d = {} for m in range(M): A, B = [int(i) for i in input().split()] if F[A - 1] == -1 and F[B - 1] == -1: F[A - 1] = m F[B - 1] = m d[m] = [A, B] elif F[A - 1] == -1 and F[B - 1]...
Traceback (most recent call last): File "/tmp/tmp27ts1kao/tmp33ebuwlh.py", line 31, in <module> solve() File "/tmp/tmp27ts1kao/tmp33ebuwlh.py", line 2, in solve N, M = [int(i) for i in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s528409342
p02573
u002765126
1598733478
Python
PyPy3 (7.3.0)
py
Runtime Error
2416
3527672
765
import queue import sys imput = sys.stdin.readline n, m = map(int,input().split()) conne = [[0]*n for _ in range(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 ans=0 for i in range(n): d=1 count=0 if visited[i]==0: visited...
Traceback (most recent call last): File "/tmp/tmppueen2sz/tmp7dhqywt6.py", line 5, in <module> n, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s833847527
p02573
u155604571
1598733477
Python
Python (3.8.2)
py
Runtime Error
534
47112
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/tmp9dqq0km2/tmpg0afr38e.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s457566843
p02573
u155604571
1598733460
Python
Python (3.8.2)
py
Runtime Error
4141
166364
811
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/tmp6mdbuhhv/tmpywintoh7.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s756095543
p02573
u659159398
1598733456
Python
PyPy3 (7.3.0)
py
Runtime Error
768
174708
487
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/tmpiu9d3xex/tmp1pwk6u8g.py", line 11, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s754217538
p02573
u766486294
1598733453
Python
Python (3.8.2)
py
Runtime Error
2208
79084
820
import collections import copy class Num: def __init__(self, conum): self.conum = CoNum(conum) class CoNum: def __init__(self, num): self.num = num N, M = map(int, input().split()) friend_group = [Num(0) for i in range(N+1)] for _ in range(M): a, b = map(int, input().split()) tmp = m...
Traceback (most recent call last): File "/tmp/tmp52g7b6dq/tmpk7og2vuu.py", line 12, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s203893302
p02573
u962718741
1598733453
Python
Python (3.8.2)
py
Runtime Error
2206
36304
652
#!/usr/bin/env python3 def main(): N, M = map(int, input().split()) groups = [] for _ in range(M): a, b = map(int, input().split()) if len(groups) == 0: groups.append({a, b}) else: flag = True for g in groups: if a in g: ...
Traceback (most recent call last): File "/tmp/tmpev_772wg/tmpa3nygcd2.py", line 29, in <module> main() File "/tmp/tmpev_772wg/tmpa3nygcd2.py", line 4, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s861243913
p02573
u724549242
1598733441
Python
Python (3.8.2)
py
Runtime Error
2258
69712
893
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/tmp1yg2wqxg/tmpq89dvvlf.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s123898298
p02573
u457554982
1598733440
Python
Python (3.8.2)
py
Runtime Error
1336
95656
980
#import sys #sys.setrecursionlimit(99999999) [n,m]=list(map(int,input().split())) friends=[] for i in range(m): friends.append(list(map(int,input().split()))) tomodachi=[[]for i in range(n)] for i in range(m): tomodachi[friends[i][0]-1].append(friends[i][1]-1) tomodachi[friends[i][1]-1].append(friends[i...
Traceback (most recent call last): File "/tmp/tmp858_nxqm/tmpoo4fbz17.py", line 5, in <module> [n,m]=list(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s142695586
p02573
u081193942
1598733440
Python
Python (3.8.2)
py
Runtime Error
2209
181160
515
n, m = map(int, input().split()) l = {k: k for k in range(1, n+1)} g = {k: set() for k in range(1, n+1)} for _ in range(m): a, b = map(int, input().split()) g[a].add(b) g[b].add(a) def get_group(curr_group, x): if g.get(x): group = set(curr_group) | {x} for i in g[x] - curr_group: group |= get_...
Traceback (most recent call last): File "/tmp/tmpg0e74hzn/tmpr1sizrhd.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s435649970
p02573
u143559014
1598733438
Python
Python (3.8.2)
py
Runtime Error
2220
338680
743
import numpy as np import copy N, M = map(int, input().split()) rinsetu = np.zeros((N, N)) def explore(i, through, ungropued): through += [i] ungrouped.remove(i) candidates = copy.deepcopy(ungrouped) for j in candidates: if j not in through and rinsetu[i, j] == 1: through = explo...
Traceback (most recent call last): File "/tmp/tmpz8x4vte0/tmp9rtpksp1.py", line 5, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s820552691
p02573
u608007704
1598733423
Python
PyPy3 (7.3.0)
py
Runtime Error
93
75736
678
N,M=map(int,input().split()) l=[-1]*N getIDmem={} def getID(l,idx): orig=idx if(getIDmem.get(idx)!=None):idx=getIDmem[idx] while True: if idx==l[idx]:break idx=l[idx] getIDmem[orig]=idx return idx d={} for i in range(M): s=list(map(int,input().split())) a,b=s[0]-1,s[1]-1 s[0]-=1 s[1]-=1 i...
Traceback (most recent call last): File "/tmp/tmpzyckm9bm/tmpxa7ouah3.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s402055913
p02573
u875584014
1598733423
Python
Python (3.8.2)
py
Runtime Error
2206
18128
687
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] print(f,G[A-1],G[B-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] pri...
Traceback (most recent call last): File "/tmp/tmp_wbx5la9/tmps5_xc80d.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s813807647
p02573
u364693468
1598733416
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
75880
1650
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/tmpapowxe3y/tmpeyq6ylt3.py", line 60, in <module> main() File "/tmp/tmpapowxe3y/tmpeyq6ylt3.py", line 54, in main main() File "/tmp/tmpapowxe3y/tmpeyq6ylt3.py", line 29, in main N, M = MI() ^^^^ ValueError: not enough values to unpack (expected 2, got ...
s038873766
p02573
u659159398
1598733412
Python
PyPy3 (7.3.0)
py
Runtime Error
507
170772
525
def dfs(g, start): visited[start] = True cc.append(0) for nbr in g[start]: if not visited[nbr]: dfs(g, nbr) import sys from collections import defaultdict input = sys.stdin.readline n, m = map(int, input().split()) g = defaultdict(set) for _ in range(m): a, b = map(int, input().s...
Traceback (most recent call last): File "/tmp/tmp1q6c5nkq/tmpe1v86ysj.py", line 13, in <module> n, m = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s239009938
p02573
u134185377
1598733410
Python
Python (3.8.2)
py
Runtime Error
2222
645600
423
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=copy.deepcopy(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][k]==1): ...
Traceback (most recent call last): File "/tmp/tmp1g4bxzw8/tmpxyy5ybai.py", line 3, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s332794700
p02573
u412255932
1598733408
Python
PyPy3 (7.3.0)
py
Runtime Error
804
195680
592
from collections import defaultdict N, M = map(int, input().split()) if M == 0: print(1) exit() 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): global visited if target in visited: ...
Traceback (most recent call last): File "/tmp/tmpn77m0kwc/tmpe9chugl3.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s888313300
p02573
u107798522
1598733401
Python
PyPy3 (7.3.0)
py
Runtime Error
945
106232
579
N, M = map(int, input().split()) AB = [list(map(int, input().split())) for _ in range(M)] group = [1]*N 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: if be...
Traceback (most recent call last): File "/tmp/tmpxrlzdnk1/tmpran92qrx.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s792536127
p02573
u183509493
1598733399
Python
Python (3.8.2)
py
Runtime Error
770
19152
372
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] def union(x,y): x, y = find(x), find(y) if x == y: return a[min(x,y)] = max(x,y) for _ in range(m): x,y=map(lambda x:int(x)-1,input().split()) union(x, y) count=[0]*n for i i...
Traceback (most recent call last): File "/tmp/tmpujdeh8q9/tmph3euhigz.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s140391924
p02573
u243061947
1598733398
Python
Python (3.8.2)
py
Runtime Error
1403
96700
646
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/tmpid39usu5/tmpl0w5hwv3.py", line 11, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s039344829
p02573
u536017058
1598733387
Python
PyPy3 (7.3.0)
py
Runtime Error
2341
3530064
229
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 for i in range(N): ans = max(ans, sum(N2[i])+1) print(ans)
Traceback (most recent call last): File "/tmp/tmpae6qhof2/tmp06_c8sfh.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s816822679
p02573
u173720816
1598733383
Python
Python (3.8.2)
py
Runtime Error
2206
11000
1041
n, m = map(int, input().split()) count = [] A = [] answer = [] for idx in range(m): a, b = map(int, input().split()) if a < b: friends = [a, b] else: friends = [b, a] if friends not in A: A.append(friends) A = sorted(A) A_length = len(A) sub_list = [] for idx in range(A_le...
Traceback (most recent call last): File "/tmp/tmpta16svkc/tmp11fgpwe_.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s243063602
p02573
u875584014
1598733382
Python
Python (3.8.2)
py
Runtime Error
22
8988
586
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]: ...
File "/tmp/tmpcfbeypph/tmp60tc5s4o.py", line 36 print(max(F)) IndentationError: expected an indented block after 'else' statement on line 35
s864012597
p02573
u990726146
1598733382
Python
PyPy3 (7.3.0)
py
Runtime Error
2211
176796
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/tmpm9fd59jd/tmpzypyre55.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s458942740
p02573
u005569385
1598733378
Python
Python (3.8.2)
py
Runtime Error
2207
47136
570
N,M = map(int,input().split()) a = [list(map(int,input().split())) for i in range(M)] t = [[0]]*(2*10**5) for i in range(len(a)): for j in range(len(a)): if (a[i][0] or a[i][1]) in a[j] and i != j: if a[j][0] not in t[i] and a[j][1] in t[i]: t[i].append(a[j][1]) elif ...
Traceback (most recent call last): File "/tmp/tmpu1ip19x1/tmpp_ah0bfr.py", line 1, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s837187810
p02573
u260204064
1598733378
Python
Python (3.8.2)
py
Runtime Error
481
32524
615
n, m = map(int, input().split()) li = [0]*(n+1) lii = [] flag = 1 for _ in range(m): a, b = map(int, input().split()) if li[a] and li[b]: if li[a] != li[b]: lii.append(li[a],li[b]) elif li[a] or li[b]: s = max(li[a],li[b]) li[a] = s li[b] = s else: li[...
Traceback (most recent call last): File "/tmp/tmpkl4x44do/tmpywehdhgi.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s697696961
p02573
u638217437
1598733375
Python
Python (3.8.2)
py
Runtime Error
793
82556
450
n, m = [int(x) for x in input().split(" ")] relations = set([tuple([int(x) for x in input().split(" ")]) for _ in range(m)]) table = {} groups = [] for a, b in relations: if a in table: table[a].add(b) table[b] = table[a] elif b in table: table[b].add(a) table[a] = table[b] ...
Traceback (most recent call last): File "/tmp/tmp_jxw0bey/tmppdy3i4v8.py", line 1, in <module> n, m = [int(x) for x in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s433794180
p02573
u524882377
1598733370
Python
Python (3.8.2)
py
Runtime Error
2207
52096
1048
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) group, lst = {}, {} cnt = 1 for i in range(m): group_a, group_b = None, None if a[i] in lst: group_a = lst[a[i]] if b[i] in lst: group_b = lst[b[i]] ...
Traceback (most recent call last): File "/tmp/tmp8asrr1w7/tmpauuihmvh.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s627399878
p02573
u650939551
1598733368
Python
Python (3.8.2)
py
Runtime Error
2207
53368
1706
# Python3 program to print DFS traversal # from a given given graph from collections import defaultdict # This class represents a directed graph using # adjacency list representation class Graph: # Constructor def __init__(self): self.zrr=[] # default dictionary to store graph self....
Traceback (most recent call last): File "/tmp/tmpgyekv8i3/tmpk__654mw.py", line 60, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s706489074
p02573
u760569096
1598733366
Python
PyPy3 (7.3.0)
py
Runtime Error
644
136492
403
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 def dfs(x,y): for i in g[x]: if v[i] == -1: v[i]=1 ans[y]+=1 dfs(i,y) f...
Traceback (most recent call last): File "/tmp/tmp81z2dt2t/tmpb3oro1vd.py", line 1, in <module> n,m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s125508775
p02573
u412255932
1598733361
Python
PyPy3 (7.3.0)
py
Runtime Error
774
195888
623
from collections import defaultdict N, M = map(int, input().split()) if M == 0: print(1) exit() 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 not in adj_list: return ...
Traceback (most recent call last): File "/tmp/tmp_jqwvsh5/tmparbwy3z3.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s461352830
p02573
u136948974
1598733343
Python
Python (3.8.2)
py
Runtime Error
26
9184
389
def solve(): n, m = map(int, input().split()) arr = [[0 for _ in range(5)] for _ in range(5)] for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 arr[a][b] = 1 arr[b][a] = 1 ans = max([arr[i].count(1)+1 for i in range(n)]) print(ans) def main(...
Traceback (most recent call last): File "/tmp/tmptg0l0q06/tmppf_qsnm6.py", line 22, in <module> main() File "/tmp/tmptg0l0q06/tmppf_qsnm6.py", line 18, in main solve() File "/tmp/tmptg0l0q06/tmppf_qsnm6.py", line 2, in solve n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF wh...
s847478825
p02573
u656120612
1598733342
Python
Python (3.8.2)
py
Runtime Error
2206
10848
469
n,m=map(int,input().split()) l=[] for i in range(n): l.append(-1) for j in range(m): a,b=map(int,input().split()) a-=1 b-=1 if l[a]!=-1 and l[b]!=-1: e=l[b] for o in range(l.count(e)): l[l.index(e)]=l[a] elif l[a]==-1 and l[b]==-1: l[a]=1+max(l) l[b]=m...
Traceback (most recent call last): File "/tmp/tmp_la1un8z/tmp3ldcvq8y.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s793255109
p02573
u852790844
1598733331
Python
Python (3.8.2)
py
Runtime Error
434
28788
699
import sys import numpy as np readline = sys.stdin.readline read = sys.stdin.read n, m = map(int, readline().split()) if m == 0: print(1) sys.exit() d = np.zeros(n+1,dtype=np.int64) for i in range(m): a, b = map(int, readline().split()) if d[a] == 0: if d[b] == 0: d[b] == a ...
Traceback (most recent call last): File "/tmp/tmpk3i9fn_f/tmp3zjxsy3k.py", line 6, in <module> n, m = map(int, readline().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s931566727
p02573
u070630744
1598733326
Python
PyPy3 (7.3.0)
py
Runtime Error
368
85632
786
def solve(): n, m = map(int, input().split()) group = [] done = [-1]*n num = 0 for i in range(m): a, b = map(lambda x:int(x)-1, input().split()) if done[a] != -1: if done[b] == -1: group[done[a]].append(b) done[b] = done[a] else: ...
Traceback (most recent call last): File "/tmp/tmp8x0iguiq/tmpx9xyni2g.py", line 30, in <module> solve() File "/tmp/tmp8x0iguiq/tmpx9xyni2g.py", line 2, in solve n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s862286634
p02573
u960611411
1598733325
Python
Python (3.8.2)
py
Runtime Error
2207
53484
1242
# [] = list(map(int, input().split())) [n, m] = list(map(int, input().split())) abList = [] for i in range(m): abList.append(list(map(int, input().split()))) class QuickFind(object): id = [] count = 0 def __init__(self, n): self.count = n i = 0 while i < n: self.i...
Traceback (most recent call last): File "/tmp/tmpk7cxj8e4/tmp3a2t9255.py", line 3, in <module> [n, m] = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s655503058
p02573
u183509493
1598733319
Python
Python (3.8.2)
py
Runtime Error
726
19044
358
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] def union(x,y): x, y = find(x), find(y) if x == y: return a[x] = y for _ in range(m): x,y=map(lambda x:int(x)-1,input().split()) union(x, y) count=[0]*n for i in range(n): ...
Traceback (most recent call last): File "/tmp/tmp3k8k2erd/tmptva7zfbj.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s557178202
p02573
u319589470
1598733308
Python
Python (3.8.2)
py
Runtime Error
479
16868
1637
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**7) import bisect import heapq import itertools import math from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from math import gcd from operator import add, itemgetter, mul, xor def cmb(n,r,mod): bunshi=...
Traceback (most recent call last): File "/tmp/tmp4oes11ti/tmpo92_sgd9.py", line 34, in <module> n,m = MI() ^^^^ File "/tmp/tmp4oes11ti/tmpo92_sgd9.py", line 23, in MI def MI(): return map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s554062337
p02573
u169165784
1598733307
Python
Python (3.8.2)
py
Runtime Error
2207
63432
774
import numpy N, M = map(int, input().split()) R = numpy.array([[int(r) for r in input().split()] for _ in range(M)]) - 1 size = [1] * N groups = numpy.array([-1] * N) gnum = 1 sameinfo = [] for p1, p2 in R: g1 = groups[p1] g2 = groups[p2] if g1 == -1 and g2 == -1: groups[p1] = gnum gro...
Traceback (most recent call last): File "/tmp/tmpngqodfj3/tmphti1fpgf.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s738372533
p02573
u840037795
1598733300
Python
PyPy3 (7.3.0)
py
Runtime Error
502
157624
753
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/tmp5gofe8te/tmprhq5zb7k.py", line 4, in <module> N, M = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s707117926
p02573
u412255932
1598733288
Python
PyPy3 (7.3.0)
py
Runtime Error
919
195796
572
from collections import defaultdict N, M = map(int, input().split()) if M == 0: print(1) exit() 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 ...
Traceback (most recent call last): File "/tmp/tmp9ojaognz/tmpnnxsm63j.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s639125617
p02573
u107798522
1598733275
Python
PyPy3 (7.3.0)
py
Runtime Error
827
106128
463
N, M = map(int, input().split()) AB = [list(map(int, input().split())) for _ in range(M)] group = [1]*N 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: if be...
Traceback (most recent call last): File "/tmp/tmpo80cc47p/tmpwfgo7ivn.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s107806141
p02573
u950825280
1598733253
Python
Python (3.8.2)
py
Runtime Error
30
9060
441
N, M = map(int, input().split()) F = [] for _ in range(M): A, B = map(int, input().split()) if len(F) == 0: F.append([A, B]) isExist = False for f in F: if A in f or B in f: f.append(A) f.append(B) isExist = True if not isExist: F.append([A...
File "/tmp/tmp4ozini2o/tmpi6l_lcbi.py", line 20 ans = max(ans, len(list(set(f)))) ^ IndentationError: expected an indented block after 'for' statement on line 19
s763849673
p02573
u872538555
1598733252
Python
Python (3.8.2)
py
Runtime Error
706
33856
952
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/tmp67asi4hj/tmpmjn_pjq6.py", line 28, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s581672160
p02573
u576335153
1598733250
Python
Python (3.8.2)
py
Runtime Error
38
11936
593
n, m = map(int, input().split()) ab = [list(map(int, input().split()))] friends = [0]*n group = [-1]*n for a, b in ab: if a > b: a, b = b, a a -= 1 b -= 1 if group[a] == -1 and group[b] == -1: group[a] = a group[b] = b friends[a] += 2 elif group[a] != -1 and group[b...
Traceback (most recent call last): File "/tmp/tmplybko7y6/tmp9smppzxx.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s281933648
p02573
u945761460
1598733246
Python
Python (3.8.2)
py
Runtime Error
2209
92920
488
n,m=map(int, input().split()) l=[set()]*(n+1) c=set() e=[] for i in range(m): a,b=map(int, input().split()) a,b=min(a,b),max(a,b) d={(a,b)} if not d <= c:#チェック機能 c.add((a,b)) e.append({a,b}) l[0]=l[0]|e[0] for i in range(len(e)): ok=True j=0 while ok: if e[i] & l[j] != set(): l[j]=l[...
Traceback (most recent call last): File "/tmp/tmpf_dsqm1m/tmpkptbuza6.py", line 1, in <module> n,m=map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s809879919
p02573
u864069774
1598733241
Python
Python (3.8.2)
py
Runtime Error
871
97672
318
import itertools import collections n,m = map(int,input().split()) ab = [sorted(list(map(int,input().split()))) for i in range(m)] ab = list(map(list, set(map(tuple, ab)))) friend = [] # print(ab) flat = list(itertools.chain.from_iterable(ab)) # print(flat) c = collections.Counter(flat) print(c.most_common()[0][1]+1)
Traceback (most recent call last): File "/tmp/tmpkjlsglap/tmp987pgk5y.py", line 3, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s749756587
p02573
u002765126
1598733240
Python
Python (3.8.2)
py
Runtime Error
2287
2460076
462
from scipy.sparse.csgraph import connected_components from scipy.sparse import csr_matrix import numpy as np n, m = map(int,input().split()) A=[] B=[] conne = [[0]*n for _ in range(n)] visited = [0]*n for i in range(m): a,b=map(int,input().split()) A.append(a) B.append(b) conne[a-1][b-1]=1 conne[b-...
Traceback (most recent call last): File "/tmp/tmps71a6p1z/tmp58adohjd.py", line 4, in <module> n, m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s928183331
p02573
u534610124
1598733236
Python
Python (3.8.2)
py
Runtime Error
2208
81664
612
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) #dic[b].add(a) def dfs(x:int, marked:set): a = dic[x] marked.add(x) for i in dic[x]: if i not in marked: b, marked = dfs(i, mark...
Traceback (most recent call last): File "/tmp/tmp69n_4hbn/tmpolgzfjhh.py", line 1, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s269706776
p02573
u748311048
1598733232
Python
Python (3.8.2)
py
Runtime Error
500
15068
535
from collections import Counter n,m=map(int, input().split()) ans=1 l=[] x=[-1]*n for i in range(m): a,b=map(int, input().split()) a-=1 b-=1 if x[a]+x[b]==-2: l.append(2) x[a]=len(l)-1 x[b]=len(l)-1 elif x[a]==x[b]: continue elif x[a]!=-1: l[x[b]]+=1 ...
Traceback (most recent call last): File "/tmp/tmpt87w9_z8/tmp09aa90w_.py", line 2, in <module> n,m=map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s951204204
p02573
u282813849
1598733208
Python
Python (3.8.2)
py
Runtime Error
2206
9636
534
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/tmp1z6rhq0_/tmpoj2hhf2w.py", line 1, in <module> N, M = [int(a) for a in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s247799957
p02573
u347502437
1598733208
Python
Python (3.8.2)
py
Runtime Error
589
39228
548
N, M = map(int, input().split()) if M == 0: print(1) else: D = {} count = 0 friends = [] while count < M: A, B = map(int,input().split()) if A not in D and B not in D: friends += [[A,B]] D[A] = len(friends) -1 D[B] = len(friends) - 1 elif A...
Traceback (most recent call last): File "/tmp/tmpaw5xaqts/tmpp19yh8tm.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s080959863
p02573
u581022379
1598733197
Python
Python (3.8.2)
py
Runtime Error
839
31604
1139
from collections import Counter N, M = map(int, input().split()) groups = [0] * (N + 1) group_num_list = [[0]] group_num = 1 for _ in range(M): A, B = map(int, input().split()) if groups[A] != 0 and groups[B] != 0: if groups[A] != groups[B]: lower = min(groups[A], groups[B]) high...
Traceback (most recent call last): File "/tmp/tmpdjw2914p/tmp5z2wtgby.py", line 2, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s579112589
p02573
u942697937
1598733191
Python
PyPy3 (7.3.0)
py
Runtime Error
86
68980
616
import math import functools N = int(input()) A = [int(_) for _ in input().split()] p = set([]) y = functools.reduce(math.gcd, A) pairwise = True for a in A: if a == 1: continue if pairwise is False: break for k in range(2, int(math.sqrt(a)) + 2): if a % k == 0: if k i...
Traceback (most recent call last): File "/tmp/tmpz474afr6/tmpdp50t87x.py", line 4, in <module> N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s581607235
p02573
u743383679
1598733183
Python
Python (3.8.2)
py
Runtime Error
2206
25408
832
n, m = list(map(int, input().split())) am = [] bm = [] for _ in range(m): a, b = list(map(int, input().split())) am.append(a) bm.append(b) groups = [] for ai, bi in zip(am, bm): ag = None bg = None for g, group in enumerate(groups): if ai in group: ag = g if bi in gr...
Traceback (most recent call last): File "/tmp/tmp_q30qwmn/tmpcnafspj4.py", line 1, in <module> n, m = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s481485481
p02573
u617040773
1598733177
Python
PyPy3 (7.3.0)
py
Runtime Error
481
124672
815
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/tmpiv98lqi3/tmp3qr3z8q_.py", line 29, in <module> resolve() File "/tmp/tmpiv98lqi3/tmp3qr3z8q_.py", line 3, in resolve N, connections = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s974423883
p02573
u880400515
1598733176
Python
PyPy3 (7.3.0)
py
Runtime Error
2359
3525004
1114
N, M = list(map(int, input().split())) G = [[0] * N for i in range(N)] if (M == 0): print(1) exit(0) for i in range(M): a, b = list(map(int, input().split())) G[a - 1][b - 1] = 1 G[b - 1][a - 1] = 1 friend_chain = [] checked = [False]*N for i in range(N): if (checked[i] == True): ...
Traceback (most recent call last): File "/tmp/tmpgksklalw/tmp2kaodpkh.py", line 1, in <module> N, M = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s742710303
p02573
u369094007
1598733166
Python
Python (3.8.2)
py
Runtime Error
1096
72288
406
N, M = map(int, input().split()) f = [set() for _ in range(N)] v = [False for _ in range(N)] ans = 1 for _ in range(M): a, b = map(int, input().split()) a, b = a - 1, b - 1 f[a].add(b) f[b].add(a) def dfs(fi): if v[fi]: return 0 v[fi] = True cnt = 1 for fr in f[fi]: cnt += dfs(fr) ...
Traceback (most recent call last): File "/tmp/tmpmr1jv56_/tmpb7tyf2l_.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s128250994
p02573
u701017915
1598733144
Python
PyPy3 (7.3.0)
py
Runtime Error
341
100888
843
N, M = map(int,input().split()) communities = [0 for i in range(N)] same = [] num = 1 for i in range(M): A, B = map(int,input().split()) if communities[A-1] == 0 and communities[B-1] == 0: communities[A-1] = num communities[B-1] = num num += 1 elif communities[A-1] == 0: communities[A-1] = communi...
Traceback (most recent call last): File "/tmp/tmpi2753c1q/tmpam005blr.py", line 1, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s279683797
p02573
u743682467
1598733143
Python
Python (3.8.2)
py
Runtime Error
2206
26948
553
#D N,M = map(int, input().split()) L = [] for i in range(N): L.append([]) maxim = 0 for i in range(M): A,B = map(int, input().split()) for j in L[:maxim+1]: #print(L[:maxim+1]) if A in j and B in j: break elif A in j: j.append(B) break elif...
Traceback (most recent call last): File "/tmp/tmpsoippjrt/tmplp7mncvu.py", line 2, in <module> N,M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s758239468
p02573
u259190728
1598733142
Python
PyPy2 (7.3.0)
py
Runtime Error
394
85672
1637
from __future__ import print_function range = xrange input = raw_input import sys,bisect from sys import stdin,stdout from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right from math import gcd,ceil,floor,sqrt from collections import Counter,defaultdict,deque,OrderedDict dx=[-1,1,0,0]...
Traceback (most recent call last): File "/tmp/tmpxfjttiy3/tmpmbq7o2pz.py", line 2, in <module> range = xrange ^^^^^^ NameError: name 'xrange' is not defined. Did you mean: 'range'?
s626574877
p02573
u099300051
1598733136
Python
Python (3.8.2)
py
Runtime Error
2206
29932
595
N,M=map(int,input().split()) friendlist={i+1:0 for i in range(N)} sumg=0 for m in range(M): A,B=map(int,input().split()) if friendlist[A]==0 and friendlist[B]==0: sumg+=1 friendlist[A]=sumg friendlist[B]=sumg elif friendlist[A]==0: friendlist[A]=friendlist[B] elif friendlist[B]==0: friendlis...
Traceback (most recent call last): File "/tmp/tmp1ao0hhq2/tmpyv9s3vdv.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s837179851
p02573
u445807804
1598733132
Python
Python (3.8.2)
py
Runtime Error
2208
63620
355
import collections import numpy as np 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) k = np.ravel(k) s = collections.Counter...
Traceback (most recent call last): File "/tmp/tmpxhqpmlwh/tmpbhae6llc.py", line 3, in <module> N,M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s084381950
p02573
u656120612
1598733117
Python
Python (3.8.2)
py
Runtime Error
2206
10792
466
n,m=map(int,input().split()) l=[] for i in range(n): l.append(-1) for j in range(m): a,b=map(int,input().split()) a-=1 b-=1 if l[a]!=-1 and l[b]!=-1: e=l[b] for o in range(l.count(e)): l[l.index(e)]=e elif l[a]==-1 and l[b]==-1: l[a]=1+max(l) l[b]=max(...
Traceback (most recent call last): File "/tmp/tmpdlkcf2mi/tmpx691as2i.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s671087856
p02573
u344655022
1598733108
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
123220
777
import sys input = sys.stdin.readline INF = 10**18 sys.setrecursionlimit(10**6) def li(): return [int(x) for x in input().split()] N, M = li() L = [] for i in range(M): a, b = sorted(li()) L.append((a, b)) L = set(L) cnts = [0] * (N+1) for l in L: a, b = l cnts[a] += 1 cnts[b] += 1 # print(...
Traceback (most recent call last): File "/tmp/tmpifbs8y64/tmpiai5f49u.py", line 9, in <module> N, M = li() ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s126851792
p02573
u962718741
1598733100
Python
Python (3.8.2)
py
Runtime Error
2206
36484
589
#!/usr/bin/env python3 def main(): N, M = map(int, input().split()) a, b = map(int, input().split()) groups = [] groups.append({a, b}) for _ in range(1, M): a, b = map(int, input().split()) flag = True for g in groups: if a in g: g.add(b) ...
Traceback (most recent call last): File "/tmp/tmp83cmkorb/tmps4d4tczg.py", line 28, in <module> main() File "/tmp/tmp83cmkorb/tmps4d4tczg.py", line 4, in main N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s917976978
p02573
u264395947
1598733092
Python
Python (3.8.2)
py
Runtime Error
837
64804
663
import numpy as np N, M = map(int, input().split()) c = [list(map(int, input().split())) for i in range(M)] g = np.zeros(N, dtype = int) n = np.zeros(N, dtype = int) num = 1 for i in range(len(c)): s = g[c[i][0]-1] t = g[c[i][1]-1] if s != 0 and t != 0: if s == t: pass ...
Traceback (most recent call last): File "/tmp/tmptjlu_u_k/tmp8pf5js2v.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s297453223
p02573
u535833744
1598733079
Python
Python (3.8.2)
py
Runtime Error
32
8992
290
たとえば 6 3 1 2 1 3 4 5 だったら、 1 2 と 1 3を連結させて 1 2 3 にして 1 2 3 4 5 6 というようにするとかして最も連結が長くなっているものの連結数(今回の場合は1 2 3 で3つ)が 解答となるようなプログラムを書けばいい。
File "/tmp/tmp870kgpx1/tmp99y8cqav.py", line 6 だったら、 ^ SyntaxError: invalid character '、' (U+3001)
s569161926
p02573
u347502437
1598733076
Python
Python (3.8.2)
py
Runtime Error
2206
14756
634
N, M = map(int, input().split()) if M == 0: print(1) else: D = {} count = 0 people = set() friends = [] while count < M: A, B = map(int,input().split()) if A not in people and B not in people: friends += [[A,B]] D[A] = len(friends) -1 D[B] = le...
Traceback (most recent call last): File "/tmp/tmp97lysjw8/tmp0vf0m4dn.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s703795719
p02573
u282813849
1598733071
Python
Python (3.8.2)
py
Runtime Error
2206
9664
536
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 break for j in range(len(lol)): if b in lol[j]: found_b = j break if found_a < 0 ...
Traceback (most recent call last): File "/tmp/tmppd8rlvg8/tmpvmd5gumi.py", line 1, in <module> N, M = [int(a) for a in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s990406871
p02573
u581022379
1598733070
Python
Python (3.8.2)
py
Runtime Error
829
31548
1103
from collections import Counter N, M = map(int, input().split()) groups = [0] * (N + 1) group_num_list = [[0]] group_num = 1 for _ in range(M): A, B = map(int, input().split()) if groups[A] != 0 and groups[B] != 0: if groups[A] != groups[B]: lower = min(groups[A], groups[B]) high...
Traceback (most recent call last): File "/tmp/tmpdhycl9iv/tmp74w82p2y.py", line 2, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s393237090
p02573
u183509493
1598733068
Python
Python (3.8.2)
py
Runtime Error
783
19032
298
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(lambda x:find(int(x)-1),input().split()) if x != y: a[x] = y count=[0]*n for i in range(n): count[find(i)] += 1 print(max(count))
Traceback (most recent call last): File "/tmp/tmphzezzb2n/tmp2f0nje3f.py", line 1, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s246029384
p02573
u110044127
1598733062
Python
Python (3.8.2)
py
Runtime Error
27
8984
2665
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const int INF = 1e9; #define PB push_back #define PF push_front #define fi first #define se second #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vpi vector<pii> #define vll vector<ll> #defin...
File "/tmp/tmpiqauut6l/tmp7nf00es0.py", line 2 using namespace std; ^^^^^^^^^ SyntaxError: invalid syntax
s750518456
p02573
u412255932
1598733058
Python
PyPy3 (7.3.0)
py
Runtime Error
788
201420
573
from collections import defaultdict def dfs(target): if target in visited: return 0 visited.add(target) node_count = 1 for neighbor in adj_list[target]: node_count += dfs(neighbor) return node_count N, M = map(int, input().split()) if M == 0: print(1) exit() adj_list = de...
Traceback (most recent call last): File "/tmp/tmpg7hfdqv9/tmp3oy_oonb.py", line 12, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s419748709
p02573
u283341082
1598733058
Python
Python (3.8.2)
py
Runtime Error
2208
65668
948
import numpy as np from collections import deque N, M = map(int, input().split()) rel_matrix = np.zeros((N, N), dtype='bool') for i in range(M): A, B = map(int, input().split()) rel_matrix[A-1, B-1] = True rel_matrix[B-1, A-1] = True people = list(np.arange(N)) max_cluster_size = 0 while len(people) != 0...
Traceback (most recent call last): File "/tmp/tmp84_5s3vo/tmprqcrejr1.py", line 4, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s966132906
p02573
u581022379
1598733037
Python
Python (3.8.2)
py
Runtime Error
812
31228
1098
from collections import Counter N, M = map(int, input().split()) groups = [0] * (N + 1) group_num_list = [[0]] group_num = 1 for _ in range(M): A, B = map(int, input().split()) if groups[A] != 0 and groups[B] != 0: if groups[A] != groups[B]: lower = min(groups[A], groups[B]) high...
Traceback (most recent call last): File "/tmp/tmpml3ugx4k/tmpqe4wc2zh.py", line 2, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s490855016
p02573
u878389297
1598733029
Python
Python (3.8.2)
py
Runtime Error
2206
14240
554
import collections a=input() a=a.split() n=int(a[0]) m=int(a[1]) l=[0]*(n) k=1 for i in range(m): x=input() x=x.split() xa=int(x[0])-1 xb=int(x[1])-1 if l[xa]==0 and l[xb]==0: l[xa]=k l[xb]=k k+=1 if l[xa]==0 and l[xb]!=0: l[xa]=l[xb] if l[xa]!=0 and l[xb]==0:...
Traceback (most recent call last): File "/tmp/tmpor4l2fv_/tmpj5667v1b.py", line 2, in <module> a=input() ^^^^^^^ EOFError: EOF when reading a line
s667406870
p02573
u264395947
1598733013
Python
Python (3.8.2)
py
Runtime Error
836
65088
694
import numpy as np N, M = map(int, input().split()) c = [list(map(int, input().split())) for i in range(M)] g = np.zeros(N, dtype = int) n = np.zeros(N, dtype = int) num = 1 for i in range(len(c)): s = g[c[i][0]-1] t = g[c[i][1]-1] if s != 0 and t != 0: if s == t: pass ...
Traceback (most recent call last): File "/tmp/tmpjng5yhx4/tmpxxnp06k4.py", line 3, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s177977816
p02573
u701017915
1598733011
Python
PyPy3 (7.3.0)
py
Runtime Error
316
80904
783
N, M = map(int,input().split()) communities = [0 for i in range(N)] same = [] num = 1 for i in range(M): A, B = map(int,input().split()) if communities[A-1] == 0 and communities[B-1] == 0: communities[A-1] = num communities[B-1] = num num += 1 elif communities[A-1] == 0: communities[A-1] = communi...
Traceback (most recent call last): File "/tmp/tmph7f7h30g/tmp2nikiu23.py", line 1, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s953474122
p02573
u584658281
1598733006
Python
Python (3.8.2)
py
Runtime Error
801
63628
377
N,M=map(int,input().split()) friends_set=set() for i in range(M): a,b=map(int,input().split()) if a>b: a,b=b,a friends_set.add((a,b)) friends_list=[[] for _ in range(N)] for f in friends_set: friends_list[f[0]].append(f[1]) friends_list[f[1]].append(f[0]) max_len=0 for i in friends_li...
Traceback (most recent call last): File "/tmp/tmp2j8sqs_5/tmputbxusci.py", line 1, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s737254281
p02573
u497805118
1598732985
Python
Python (3.8.2)
py
Runtime Error
2206
40136
622
import collections class UnionFindBasic(): def __init__(self, n): self.parents = list(range(n)) def find(self, x): if self.parents[x] == x: return x else: return self.find(self.parents[x]) def union(self, x, y): x = self.find(x) y = self.fin...
Traceback (most recent call last): File "/tmp/tmpvoooex3o/tmpkirjqr30.py", line 22, in <module> n, m = map(int, input().split(" ")) ^^^^^^^ EOFError: EOF when reading a line
s795246099
p02573
u804800128
1598732980
Python
Python (3.8.2)
py
Runtime Error
228
37988
1384
import sys input = sys.stdin.readline def main(): n , m = map( int, input().split() ) Sets = [] Dicto = [ -1 for i in range(n + 1)] for i in range( m ): a , b = map( int , input().split() ) if Dicto[a] == -1 and Dicto[b] == -1: Sets.append( set( [a,b] ) ) x_i =...
Traceback (most recent call last): File "/tmp/tmplb8vjwnv/tmp5vhl0n0e.py", line 50, in <module> main() File "/tmp/tmplb8vjwnv/tmp5vhl0n0e.py", line 5, in main n , m = map( int, input().split() ) ^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s431324705
p02573
u685998974
1598732976
Python
PyPy3 (7.3.0)
py
Runtime Error
326
132176
780
N, M = map(int, input().split()) A = list() B = list() for _ in range(M): a, b = map(int, input().split()) A.append(a-1) B.append(b-1) largest = 1 group = [] people = [-1] * N for a, b in zip(A, B): if people[a] != -1 and people[b] != -1 and people[a] != people[b]: group[people[a]] |= group[peo...
Traceback (most recent call last): File "/tmp/tmph19nhww3/tmp8g3w4_ly.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s690324577
p02573
u194913468
1598732975
Python
Python (3.8.2)
py
Runtime Error
2207
41244
584
n, m = map(int, input().split()) ed = [0] * (n+1) def rm(nu): if len(vr) == 0: return 0 curr = vr.pop(vr.index(nu)) if ed[curr] == 0: return 1 else: tmp = 1 for p in ed[curr]: tmp += rm(p) return tmp for i in range(m): t1, t2 = map(int, input()...
Traceback (most recent call last): File "/tmp/tmpgf0m692k/tmp96d57jt5.py", line 1, in <module> n, m = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s724093744
p02573
u018808362
1598732973
Python
Python (3.8.2)
py
Runtime Error
1163
683876
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/tmpozpag2e6/tmph8wqxy4r.py", line 2, in <module> N, M = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s818989530
p02573
u326609687
1598732972
Python
Python (3.8.2)
py
Runtime Error
1069
33456
953
import numpy as np i4 = np.int32 i8 = np.int64 def find(x, parents): if parents[x] == x: return x else: return find(parents[x], parents) def union (x, y, parents, depth): x = find(x, parents) y = find(y, parents) if x == y: return if depth[x] == depth[y]: dep...
Traceback (most recent call last): File "/tmp/tmp9jwauwth/tmpa34oldwc.py", line 47, in <module> main('/dev/stdin') File "/tmp/tmp9jwauwth/tmpa34oldwc.py", line 30, in main N, M = [int(x) for x in stdin.readline().split()] ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s931994530
p02573
u530383736
1598732972
Python
Python (3.8.2)
py
Runtime Error
781
106304
1090
# -*- coding: utf-8 -*- import sys def main(): N,M = list(map(int, sys.stdin.readline().split())) AB_list = [ list(map(int, sys.stdin.readline().split())) for _ in range(M) ] edge = {} # { int : set } # { the number of human : {friends} } for a,b in AB_list: edge.setdefault(a, set...
Traceback (most recent call last): File "/tmp/tmpzb49ny2_/tmp3ceus707.py", line 53, in <module> main() File "/tmp/tmpzb49ny2_/tmp3ceus707.py", line 6, in main N,M = list(map(int, sys.stdin.readline().split())) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s110873840
p02573
u554133763
1598732968
Python
PyPy3 (7.3.0)
py
Runtime Error
2345
3532344
253
N, M = map(int, input().split()) graph = [[0]*N for _ in range(N)] sum_g = 0 for _ in range(M): a, b = map(int, input().split()) graph[a-1][b-1] = 1 graph[b-1][a-1] = 1 for i in range(N): sum_g = max(sum_g, sum(graph[i])) print(sum_g+1)
Traceback (most recent call last): File "/tmp/tmppy9o21nr/tmp2qt7safh.py", line 1, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s412341881
p02573
u505564549
1598732957
Python
Python (3.8.2)
py
Runtime Error
683
108412
321
import sys input = sys.stdin.readline n,m=map(int,input().split()) M=set(tuple(map(int,input().split())) for _ in range(m)) d={i:set() for i in range(1,n+1)} for a,b in M: if a>b: a,b=b,a d[a].add(b) val = max(d,key=d.get) for i in d[val]: if d[i]!=set(): d[val]|=d[i] print(len(d[val])+1) ...
Traceback (most recent call last): File "/tmp/tmp1jxncvrg/tmpfqs1oi_g.py", line 3, in <module> n,m=map(int,input().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s912952853
p02573
u935685410
1598732956
Python
PyPy3 (7.3.0)
py
Runtime Error
546
137440
363
import collections N,M = tuple(map(int,input().split())) friend_list = [] for i in range(M): a,b = map(int,input().split()) friend_list.append(a) friend_list.append(b) #print(friend_list) friend_list.sort() #print(friend_list) c = collections.Counter(friend_list) collect = c.most_common()[0][1]+1 if collect >...
Traceback (most recent call last): File "/tmp/tmpvukg2k6d/tmpgx7c8i3k.py", line 2, in <module> N,M = tuple(map(int,input().split())) ^^^^^^^ EOFError: EOF when reading a line
s217486753
p02573
u872538555
1598732948
Python
Python (3.8.2)
py
Runtime Error
858
36248
1018
from collections import Counter class UnionFind(): def __init__(self, n): self.par = [i for i in range(n + 1)] 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...
Traceback (most recent call last): File "/tmp/tmpqmme1cb5/tmpbnkk2du4.py", line 28, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s922665758
p02573
u790812284
1598732941
Python
Python (3.8.2)
py
Runtime Error
822
335616
331
import sys import numpy as np N, M = map(int, input().split()) if M==0: print(1) sys.exit() friends_map = np.zeros(shape=(N, N)) for _ in range(M): A_i, B_i = map(int, input().split()) friends_map[A_i-1][B_i-1] = 1 friends_map[B_i-1][A_i-1] = 1 ans = int(max(np.sum(friends_map, axis=1))+1) ...
Traceback (most recent call last): File "/tmp/tmpl5lmi4nl/tmph59mnlmb.py", line 4, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s056237244
p02573
u804800128
1598732906
Python
Python (3.8.2)
py
Runtime Error
236
38032
1434
import sys input = sys.stdin.readline def main(): n , m = map( int, input().split() ) Sets = [] Dicto = [ -1 for i in range(n + 1)] for i in range( m ): a , b = map( int , input().split() ) if Dicto[a] == -1 and Dicto[b] == -1: Sets.append( set( [a,b] ) ) x_i =...
Traceback (most recent call last): File "/tmp/tmp9omnelnp/tmpipyqfl3t.py", line 51, in <module> main() File "/tmp/tmp9omnelnp/tmpipyqfl3t.py", line 5, in main n , m = map( int, input().split() ) ^^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s352291962
p02573
u505564549
1598732894
Python
Python (3.8.2)
py
Runtime Error
768
108420
297
import sys input = sys.stdin.readline n,m=map(int,input().split()) M=set(tuple(map(int,input().split())) for _ in range(m)) d={i:set() for i in range(1,n+1)} for a,b in M: if a>b: a,b=b,a d[a].add(b) val = max(d,key=d.get) for i in d[val]: d[val]|=d[i] print(len(d[val])+1)
Traceback (most recent call last): File "/tmp/tmp62tszk_l/tmprkj4xt8_.py", line 3, in <module> n,m=map(int,input().split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)