s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s004423164
p03746
u619631862
1546099859
Python
PyPy3 (2.4.0)
py
Runtime Error
1384
77088
654
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] [n,m]=i2() e=[[] for i in range(n+1)] for i in range(m): [a,b]=i2() e[a].append(b) e[b].append(a) import sys sys.setrecursionlimit(10000) d=[0 for i in range(n+1)] dd=[] def dfs1(v): d[v]=1 for i in range(len(e[v])): if d...
s410868635
p03746
u619631862
1546098457
Python
Python (3.4.3)
py
Runtime Error
520
31072
649
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] [n,m]=i2() e=[[] for i in range(n+1)] for i in range(m): [a,b]=i2() e[a].append(b) e[b].append(a) import sys sys.setrecursionlimit(10000) d=[0 for i in range(n+1)] dd=[] def dfs1(v): d[v]=1 for i in range(len(e[v])): if d...
s081533847
p03746
u619631862
1546096523
Python
PyPy3 (2.4.0)
py
Runtime Error
1297
77216
649
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] [n,m]=i2() e=[[] for i in range(n+1)] for i in range(m): [a,b]=i2() e[a].append(b) e[b].append(a) import sys sys.setrecursionlimit(10000) d=[0 for i in range(n+1)] dd=[] def dfs1(v): d[v]=1 for i in range(len(e[v])): if d...
s693684281
p03746
u846150137
1537641188
Python
Python (3.4.3)
py
Runtime Error
617
70832
358
import sys sys.setrecursionlimit(50000) I=lambda:map(int,input().split()) n,m=I() g=[[]for _ in range(n+1)] v=[1 for _ in range(n+1)] v[1]=0 for _ in range(m): a,b=I() g[a]+=[b] g[b]+=[a] def dfs(x): for j in g[x]: if v[j]: v[j]=0 return [j]+dfs(j) break else: return [] z=dfs(1)[::...
s954940645
p03746
u846150137
1537640608
Python
Python (3.4.3)
py
Runtime Error
496
22900
310
I=lambda:map(int,input().split()) n,m=I() g=[[]for _ in range(n+1)] v=[1 for _ in range(n+1)] v[1]=0 for _ in range(m): a,b=I() g[a]+=[b] g[b]+=[a] def D(x): for j in g[x]: if v[j]: v[j]=0 return [j]+D(j) break else: return [] z=D(1)[::-1]+[1]+D(1) print(len(z)) print(*z)
s987056506
p03746
u846150137
1537639287
Python
Python (3.4.3)
py
Runtime Error
493
22896
323
I=lambda:map(int,input().split()) n,m=I() g=[[]for _ in range(n+1)] v=[0 for _ in range(n+1)] v[1]=1 for _ in range(m): a,b=I() g[a]+=[b] g[b]+=[a] def dfs(x): for j in g[x]: if v[j]==0: v[j]=1 return [j]+dfs(j) break else: return [] z=dfs(1)[::-1]+[1]+dfs(1) print(len(z)) print(...
s860188218
p03746
u846150137
1537637876
Python
Python (3.4.3)
py
Runtime Error
484
22904
335
I=lambda:map(int,input().split()) n,m=I() n+=1 g=[[] for _ in range(n)] v=[0 for _ in range(n)] for _ in range(m): a,b=I() g[a]+=[b] g[b]+=[a] l=[] v[1]=1 def bfs(x,l): for j in g[x]: if v[j]==0: v[j]=1 return [j]+bfs(j,l) break else: return l z=bfs(1,l)[::-1]+[1]+bfs(1,l) print(le...
s152049073
p03746
u846150137
1537637638
Python
Python (3.4.3)
py
Runtime Error
493
22900
320
I=lambda:map(int,input().split()) n,m=I() n+=1 g=[[] for _ in range(n)] v=[0 for _ in range(n)] for _ in range(m): a,b=I() g[a]+=[b] g[b]+=[a] l=[] v[1]=1 def bfs(x,l): for j in g[x]: if v[j]==0: v[j]=1 return [j]+bfs(j,l) break else: return l z=[1]+bfs(1,l) print(len(z)) print(*z)
s031445642
p03746
u391475811
1532025566
Python
Python (3.4.3)
py
Runtime Error
575
42944
473
from collections import defaultdict ans=[] V=defaultdict(set) N,M=map(int,input().split()) a,b=map(int,input().split()) V[a].add(b) V[b].add(a) ans.append(a) ans.append(b) for i in range(1,M): a,b=map(int,input().split()) V[a].add(b) V[b].add(a) def solve(li): s=li[0] e=li[-1] for v in V[s]: if not...
s830908928
p03746
u455638863
1521083434
Python
Python (3.4.3)
py
Runtime Error
2105
31824
1621
def search(v, A, B, flg, p, c): # if c > 2: # print("v=", v, "flg=", flg, "p=", p, "cnt=", c) if flg[v-1] == 1: # Finish searching and determine if path is found or not. for idx in range(len(A)): if p[0] == A[idx] and flg[B[idx-1]] != 1: return 0 # Start vertex doesn't satisfy the condition. ...
s799869732
p03746
u455638863
1521029105
Python
Python (3.4.3)
py
Runtime Error
2105
31460
1471
def search(v, A, B, flg, p, c, s): #if c > 2: # print("v=", v, "flg=", flg, "p=", p, "cnt=", c) if flg[v-1] == 1: return c flg[v-1] = 1 p.append(v) c += 1 for idx in range(len(A)): if v == A[idx]: cnt = search(B[idx], A, B, flg, p, c, s) if cnt == 0: flg[idx] = 0 return 0 ...
s774838786
p03746
u226155577
1519444502
Python
Python (3.4.3)
py
Runtime Error
17
3064
663
import sys sys.setrecursionlimit(10**6) N, M = map(int, input().split()) 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) used = [0]*N Q1 = [] Q2 = [] def dfs(v, Q): if used[v]: return 0 used[v] = 1 Q.append(v+1) f...
s415956679
p03746
u602860891
1493249720
Python
Python (3.4.3)
py
Runtime Error
379
11056
853
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2 or B.count(A[i]) >= 2 or\ A.count(B[i]) >= 2 or B.count(B[i]) >= 2: index = i break...
s833444124
p03746
u602860891
1493249678
Python
Python (3.4.3)
py
Runtime Error
377
11056
853
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2 or B.count(A[i]) >= 2 or\ A.count(B[i]) >= 2 or B.count(B[i]) >= 2: index = i break...
s047325574
p03746
u602860891
1493249362
Python
Python (3.4.3)
py
Runtime Error
390
11064
927
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2 or B.count(A[i]) >= 2 or\ A.count(B[i]) >= 2 or B.count(B[i]) >= 2: index = i break...
s960590052
p03746
u602860891
1493249267
Python
Python (3.4.3)
py
Runtime Error
2104
11064
930
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2 and B.count(A[i]) >= 2 or\ A.count(B[i]) >= 2 and B.count(B[i]) >= 2: index = i bre...
s726775468
p03746
u602860891
1493249119
Python
Python (3.4.3)
py
Runtime Error
385
11060
854
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2: index = 0 break path_points = [ A[index], B[index] ] for i in range(1, M): line = A[...
s802232253
p03746
u602860891
1493248999
Python
Python (3.4.3)
py
Runtime Error
381
11020
817
N, M = list(map(int, input().split())) A = list() B = list() for _ in range(M): a, b = list(map(int, input().split())) A.append(a) B.append(b) index = None for i in range(M): if A.count(A[i]) >= 2: index = 0 break path_points = [ A[index], B[index] ] for i in range(1, M): line = A[...
s362654382
p03746
u362829196
1492719322
Python
Python (3.4.3)
py
Runtime Error
493
33860
1201
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def checkPath(_path): set_unused = set(allLinked0) - set(_path) unused = list(set_unused) if len(unused) == 0: print(str(len(_path))) out = "" for v in _path: out += str(v) + " " out = out[:-1] print(out) return -1 allLinked = linkage[_path[...
s268599541
p03746
u362829196
1492716659
Python
Python (3.4.3)
py
Runtime Error
660
35180
1606
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def search() : min = m candidate = -1 linked = linkage[path[len(path) - 1]] # print("linked:" + str(linked)) for l in linked: if l in path: continue if counter[l] < min: min = counter[l] candidate = l if candidate == -1: # print("next") ...
s995642354
p03746
u942033906
1492575520
Python
Python (3.4.3)
py
Runtime Error
809
40052
1165
N,M = map(int,input().split()) edges = [[] for i in range(N)] degrees = [(0,i) for i in range(N)] for i in range(M): a,b = map(int, input().split()) edges[a-1].append(b-1) edges[b-1].append(a-1) degrees[a-1] = (degrees[a-1][0] + 1, a-1) degrees[b-1] = (degrees[b-1][0] + 1, b-1) sdegrees = sorted(degrees) path = [...
s452645613
p03746
u942033906
1492574441
Python
Python (3.4.3)
py
Runtime Error
825
40068
1037
def rm(nodes, i): if i in nodes: nodes.remove(i) return nodes N,M = map(int,input().split()) edges = [[] for i in range(N)] degrees = [(0,i) for i in range(N)] for i in range(M): a,b = map(int, input().split()) edges[a-1].append(b-1) edges[b-1].append(a-1) degrees[a-1] = (degrees[a-1][0] + 1, a-1) degrees[b-1...
s811617573
p03746
u942033906
1492574161
Python
Python (3.4.3)
py
Runtime Error
846
40068
1021
def rm(nodes, i): if i in nodes: nodes.remove(i) return nodes N,M = map(int,input().split()) edges = [[] for i in range(N)] degrees = [(0,i) for i in range(N)] for i in range(M): a,b = map(int, input().split()) edges[a-1].append(b-1) edges[b-1].append(a-1) degrees[a-1] = (degrees[a-1][0] + 1, a-1) degrees[b-1...
s864592030
p03746
u942033906
1492573732
Python
Python (3.4.3)
py
Runtime Error
828
40068
998
def rm(nodes, i): if i in nodes: nodes.remove(i) return nodes N,M = map(int,input().split()) edges = [[] for i in range(N)] degrees = [(0,i) for i in range(N)] for i in range(M): a,b = map(int, input().split()) edges[a-1].append(b-1) edges[b-1].append(a-1) degrees[a-1] = (degrees[a-1][0] + 1, a-1) degrees[b-1...
s021149552
p03746
u272028993
1492568580
Python
Python (2.7.6)
py
Runtime Error
352
21860
733
from collections import deque def dfs1(now,visited,ans): visited[now]=True for nx in g[now]: if not visited[nx]: ans.appendleft(nx) dfs1(nx,visited,ans) break def dfs2(now,visited,ans): visited[now]=True for nx in g[now]: if not visited[nx]: ...
s485875393
p03746
u332385682
1492311161
Python
Python (3.4.3)
py
Runtime Error
294
23396
1534
import sys from collections import deque def solve(): def dfs1(u, path, visited): for w in Adj[u]: if not visited[w]: path.append(w) visited[w] = True dfs1(w, path, visited) return def dfs2(u, path, visited): for w in ...
s929462499
p03746
u777923818
1492310061
Python
Python (3.4.3)
py
Runtime Error
465
32728
993
# -*- coding: utf-8 -*- from queue import Queue N, M = [int(n) for n in input().split()] graph = {n: [] for n in range(1, N+1)} for m in range(M): A, B = [int(n) for n in input().split()] graph[A].append(B) graph[B].append(A) starts_ = sorted(graph.keys(), key=lambda x: len(graph[x])) starts = iter(starts...
s235596753
p03746
u402629484
1492310003
Python
Python (3.4.3)
py
Runtime Error
2105
21296
405
N, M = map(int, input().split()) s = [[] for i in range(M)] for i in range(M): a, b = map(int, input().split()) s[a - 1].append(b) s[b - 1].append(a) def go(path): node = path[-1] for next in s[node - 1]: if next not in path: path.append(next) return True retur...
s846284699
p03746
u402629484
1492309878
Python
Python (3.4.3)
py
Runtime Error
2106
37424
402
N, M = map(int, input().split()) s = [set() for i in range(M)] for i in range(M): a, b = map(int, input().split()) s[a - 1].add(b) s[b - 1].add(a) def go(path): node = path[-1] for next in s[node - 1]: if next not in path: path.append(next) return True return F...
s884371400
p03746
u872191059
1492309820
Python
Python (3.4.3)
py
Runtime Error
575
30212
808
N, M = map(int, input().split()) As = [] Bs = [] Gr = {} for _ in range(M): A, B = map(int, input().split()) As.append(A) Bs.append(B) if A in Gr: Gr[A].append(B) else: Gr[A] = [B] if B in Gr: Gr[B].append(A) else: Gr[B] = [A] def check(path): return set...
s424950115
p03746
u402629484
1492309716
Python
Python (3.4.3)
py
Runtime Error
487
37432
385
N, M = map(int, input().split()) s = [set() for i in range(M)] for i in range(M): a, b = map(int, input().split()) s[a - 1].add(b) s[b - 1].add(a) def go(path): node = path[-1] for next in s[node - 1]: if next not in path: path.append(next) go(path) ret...
s113743818
p03746
u039623862
1492309052
Python
PyPy3 (2.4.0)
py
Runtime Error
983
85280
1556
def dijkstra_path(V, source, target): import heapq visited = [False] * V prev = [-1 for i in range(V)] dist = [float('inf')] * V dist[source] = 0 h = [(0, source)] while h: c, v = heapq.heappop(h) if visited[v]: continue visited[v] = True for i...
s723371124
p03746
u402629484
1492308709
Python
Python (3.4.3)
py
Runtime Error
529
37416
430
N, M = map(int, input().split()) s = [set() for i in range(M)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 s[a].add(b) s[b].add(a) def go(path): node = path[-1] for next in s[node]: if next not in path: path.append(next) go(path) ...
s570188732
p03746
u402629484
1492308207
Python
Python (3.4.3)
py
Runtime Error
610
37456
431
N, M = map(int, input().split()) s = [set() for i in range(M)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 s[a].add(b) s[b].add(a) def go(path): node = path[-1] for next in s[node]: if next not in path: path.append(next) go(path) ...
s370936819
p03746
u104282757
1492308199
Python
Python (3.4.3)
py
Runtime Error
408
30180
1032
# B from collections import deque # input N, M = map(int, input().split()) G = dict() for n in range(1, N+1): G[n] = [] for _ in range(M): A, B = map(int, input().split()) G[A].append(B) G[B].append(A) # find minimum degree s = np.argmin(np.array([len(G[k]) for k in range(1, N+1)])) + 1 targets =...
s162688386
p03746
u402629484
1492308061
Python
Python (3.4.3)
py
Runtime Error
541
37396
414
N, M = map(int, input().split()) s = [set() for i in range(M)] for i in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 s[a].add(b) s[b].add(a) def go(path): node = path[-1] for next in s[node]: if next not in path: path.append(next) go(path) ...
s860491737
p03746
u945080461
1492306811
Python
Python (2.7.6)
py
Runtime Error
103
20100
2076
from sys import stdin from itertools import repeat def main(): n, m = map(int, stdin.readline().split()) dat = map(int, stdin.read().split(), repeat(10, 2 * m)) la = [None] * (n + 1) xt = [None] * len(dat) j = 0 for i in xrange(m): x, y = dat[j:j+2] xt[j] = la[y] xt[j+1] ...
s790915624
p03746
u237316771
1492306293
Python
Python (2.7.6)
py
Runtime Error
405
29940
672
n, m = [int(x) for x in raw_input().split()] t = [[] for i in xrange(m)] for i in xrange(m): a, b = [int(x) - 1 for x in raw_input().split()] t[a].append(b) t[b].append(a) pre = [a] pos = [b] visited = {a, b} while 1: for ne in t[pre[-1]]: if ne not in visited: visited.add(ne) ...
s902989626
p03747
u842170774
1599190640
Python
PyPy3 (7.3.0)
py
Runtime Error
258
92296
610
# AGC C Ants on a Circle f=lambda:map(int,input().split()) N,L,T=f() X,W=[],[] for _ in [0]*N: x,w=f() X.append(x) W.append(w) if W[0]==2: X[0]+=L col=0 for j in range(N): if W[j]==W[0]: continue else: if W[0]>0: if 2*T-(X[j]-X[0])>=0: col+=1...
s364083343
p03747
u892251744
1593222391
Python
PyPy3 (7.3.0)
py
Runtime Error
205
87020
1850
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, L, T = map(int, input().split()) M, T = divmod(T, L) X = [] W = [] for _ in range(N): x, w = map(int, input().split()) X.append(x) W.append(w) if N == 1: if W[0] == 1: ...
s283982169
p03747
u892251744
1593220738
Python
PyPy3 (7.3.0)
py
Runtime Error
193
87576
1793
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, L, T = map(int, input().split()) T %= L X = [] W = [] for _ in range(N): x, w = map(int, input().split()) X.append(x) W.append(w) if N == 1: if W[0] == 1: pr...
s478886573
p03747
u892251744
1593219370
Python
PyPy3 (7.3.0)
py
Runtime Error
197
85396
1644
mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, L, T = map(int, input().split()) T %= L X = [] W = [] for _ in range(N): x, w = map(int, input().split()) X.append(x) W.append(w) if N == 1: if W[0] == 1: pr...
s406678594
p03747
u146346223
1592165358
Python
Python (3.4.3)
py
Runtime Error
17
3064
323
n, l, t = map(int, input().split()) arr = [] for i in range(n): x, w = map(int, input().split()) if w == 1: arr.append((x+t) % l) s += (x+t) // l else: # W == 2: arr.append((x-t) % l) s += (x-t) // l arr.sort() s %= n arr = arr[s:] + arr[:s] print(*[i for i in arr], sep='\...
s077684191
p03747
u868982936
1591308763
Python
Python (3.4.3)
py
Runtime Error
17
2940
584
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] count = 0 for i in range(N): x,w = map(int, readline().split()) if w==1: count += (x+T)//L ...
s422088433
p03747
u868982936
1591308568
Python
Python (3.4.3)
py
Runtime Error
17
2940
573
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] cnt = 0 for i in range(N): x,w = map(int, readline().split()) if w==1: cnt += (x+T)//L ...
s178927960
p03747
u868982936
1591308525
Python
Python (3.4.3)
py
Runtime Error
18
2940
576
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] cnt = 0 for i in range(N): x,w = map(int, readline().split()) if w==1: cnt += (x+T)//L ...
s337756552
p03747
u868982936
1591307957
Python
Python (3.4.3)
py
Runtime Error
17
3064
578
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] cnt = 0 for i in range(N): x, w = map(int, input().split()) if w == 1: cnt += (x - T)//L ...
s809504843
p03747
u193264896
1591281637
Python
Python (3.4.3)
py
Runtime Error
236
8944
751
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] #0をL-1からーに時計回りに超える場合は+1 #0からL-1に反時計回りに超える場合は-1 count = 0 for i in range(N): x,w = map(int, readline().spli...
s723042914
p03747
u193264896
1591281517
Python
Python (3.4.3)
py
Runtime Error
186
11756
721
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): N, L, T = map(int, readline().split()) position = [] #0をL-1からーに時計回りに超える場合は+1 #0からL-1に反時計回りに超える場合は-1 count = 0 for i in range(N): x,w = map(int, readline().spli...
s947765033
p03747
u754022296
1591091543
Python
Python (3.4.3)
py
Runtime Error
251
29088
550
import sys input = sys.stdin.readline n, l, t = map(int, input().split()) XW = [list(map(int, input().split())) for _ in range(n)] L = [] for i, xw in enumerate(XW): x, w = xw if w == 1: L.append((x+t)%l) else: L.append((x-t)%l) L.sort() x_0, w_0 = XW[0] b = 0 for x, w in XW[1:]: if w_0 == w: conti...
s466364551
p03747
u105290050
1590031540
Python
Python (3.4.3)
py
Runtime Error
2104
11020
521
n, l, t =map(int, input().split()) x=[] w=[] for i in range(n): a, b=map(int, input().split()) x.append(a) if b==2: w.append(-1) else: w.append(1) for fn in range(t*2): x=[d+0.5*e for (d, e) in zip(x, w)] for f in range(n): if x[f]>=l: x[f]-=l elif x[f]<0: x[f]+=l for p in rang...
s601032053
p03747
u151820863
1588804997
Python
Python (3.4.3)
py
Runtime Error
17
3064
2096
import copy (N, L, T) = list(map(int, input().split())) snapshot = [] for no in range(1, N + 1): (x, w) = list(map(int, input().split())) snapshot.append({ 'i': no - 1, 'no': no, 'x': x, 'w': 1 if w == 1 else -1 }) def normalize(x): return (x + L) % L def find_neigh...
s111823716
p03747
u591524911
1588422650
Python
Python (3.4.3)
py
Runtime Error
452
18192
805
N, L, T = map(int, input().split()) lst = [tuple(map(int, input().split())) for i in range(N)] lst2 = [] count = 0 a = T % L base = None for tpl in lst: if tpl[1] == 1: lst2.append(tpl[0]+T) elif tpl[1] == 2: lst2.append(tpl[0]-T) if base == None: base = tpl elif tpl[1] != ...
s305176970
p03747
u719181921
1587263623
Python
Python (3.4.3)
py
Runtime Error
2104
11924
210
s = input() n = len(s) f = '' for i in range(2**(n-1)): b = format(i, 'b').zfill(n) for j in range(n): if b[j] == '1': f += '+' + s[j] else: f += s[j] f+= '+' print(eval(f[:len(f)-1]))
s524258781
p03747
u719181921
1587263556
Python
Python (3.4.3)
py
Runtime Error
2104
11940
210
s = input() n = len(s) f = '' for i in range(2**(n-1)): b = format(i, 'b').zfill(n) for j in range(n): if b[j] == '1': f += '+' + s[j] else: f += s[j] f+= '+' print(eval(f[:len(f)-1]))
s511303391
p03747
u095021077
1586660081
Python
Python (3.4.3)
py
Runtime Error
462
31052
700
N, L, T=map(int, input().split()) XW=[list(map(int, input().split())) for _ in range(N)] X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)] X_.sort() A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L P0_=X_.index(A0_) if P0_>0: X_=X_[P0_:]+X_[:P0_] if XW[0][1]==1: C0_=round(sum([(...
s104324515
p03747
u095021077
1586659935
Python
Python (3.4.3)
py
Runtime Error
463
31660
695
N, L, T=map(int, input().split()) XW=[list(map(int, input().split())) for _ in range(N)] X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)] X_.sort() A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L P0_=X_.index(A0_) if P0_>0: X_=X_[P0_:]+X_[:P0_] if XW[0][1]==1: C0_=round(sum([(...
s981330529
p03747
u095021077
1586659810
Python
Python (3.4.3)
py
Runtime Error
459
31548
688
N, L, T=map(int, input().split()) XW=[list(map(int, input().split())) for _ in range(N)] X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)] X_.sort() A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L P0_=X_.index(A0_) if P0_>0: X_=X_[P0_:]+X_[:P0_] if XW[0][1]==1: C0_=round(sum([(...
s974995608
p03747
u095021077
1586659726
Python
Python (3.4.3)
py
Runtime Error
452
31548
702
N, L, T=map(int, input().split()) XW=[list(map(int, input().split())) for _ in range(N)] X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)] X_.sort() A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L P0_=X_.index(A0_) if P0_>0: X_=X_[P0_:]+X_[:P0_] if XW[0][1]==1: C0_=round(sum([(...
s043250135
p03747
u095021077
1586659492
Python
Python (3.4.3)
py
Runtime Error
446
31660
681
N, L, T=map(int, input().split()) XW=[list(map(int, input().split())) for _ in range(N)] X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)] X_.sort() A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L P0_=X_.index(A0_) if P0_>0: X_=X_[P0_:]+X_[:P0_] if XW[0][1]==1: C0_=round(sum([(...
s647719166
p03747
u106778233
1586020733
Python
Python (3.4.3)
py
Runtime Error
17
2940
447
n,l,T=map(int,input().split()) from collections import deque a=deque() b=deque() for i in range(n): q,ww=map(int,input().spilt()) w=3-2*ww a.append([(j*w*2+2*q)%(2*l) for j in range(1,2*T+1)] b.append(i) for k in range(2*T): for i in range(n): for j in range(i+1,n): if a[i][k]=a[j][k]: ...
s104048814
p03747
u278183305
1584915747
Python
Python (3.4.3)
py
Runtime Error
2123
211956
1641
# input n,l,time = map(int, input().split()) ant = [0] * n v = [0] * n for i in range(n): ant[i],v[i] = map(int, input().split()) # plus def plus(point): if l <= point+1: res = 0 else: res = point+1 return res # minus def minus(point): if 0 > point-1: res = l-1 else: ...
s346712766
p03747
u638795007
1584554598
Python
Python (3.4.3)
py
Runtime Error
838
61524
3943
def examA(): N = I() A = LI() ans = 1 flag = None for i in range(N-1): cur = A[i+1] - A[i] if not flag: if cur<0: flag = "d" elif cur>0: flag = "u" else: if cur<0 and flag=="u": flag = None ...
s369110788
p03747
u638795007
1584510048
Python
PyPy3 (2.4.0)
py
Runtime Error
392
81832
3552
def examA(): N = I() A = LI() ans = 1 flag = None for i in range(N-1): cur = A[i+1] - A[i] if not flag: if cur<0: flag = "d" elif cur>0: flag = "u" else: if cur<0 and flag=="u": flag = None ...
s788820091
p03747
u235783479
1583398064
Python
Python (3.4.3)
py
Runtime Error
2105
31528
2230
n, l, total_t = map(int, input().split()) pos_nt = {i:[] for i in range(n)} xl = [] wl = [] rrp = [] lrp = [] for i in range(n): x, w = map(int, input().split()) xl.append(x) wl.append(w) if w ==1: rrp.append(x) else:lrp.append(x) for i in range(n): if wl[i] == 1: orig_idx...
s290392388
p03747
u314050667
1579635413
Python
Python (3.4.3)
py
Runtime Error
550
17692
850
import numpy as np N,L,T = map(int, input().split()) x,w = [],[] for _ in range(N): tx,tw = map(int, input().split()) if tw == 2: tw = -1 x.append(tx) w.append(tw) x = np.array(x) w = np.array(w) f = x+(w*T) f %= L if w[0] == 1: ghost = T*2 s,t = divmod(ghost,L) cnt = s*np.count_nonzero(w == -1) dist = x[0...
s852841193
p03747
u747220349
1578783295
Python
PyPy3 (2.4.0)
py
Runtime Error
174
38256
224
n,l,t=map(int,input().split()) inf=[] s=0 for _ in range(n): x,y=map(int,input().split()) if y==1: x+=t else: x-=t inf.append(x%l) s+=x//l inf.sort() s%n for i in range(n): print(inf[(i+s)%n])
s764723895
p03747
u747220349
1578783247
Python
PyPy3 (2.4.0)
py
Runtime Error
163
38384
224
n,l,t=map(int,input().split()) inf=[] s=0 for _ in range(n): x,y=map(int,input().split()) if y==1: x+=t else: x-=t inf.append(x%l) s+=x//l inf.sort() s%n for i in range(n): print(inf[(i+p)%n])
s662020202
p03747
u747220349
1578783202
Python
PyPy3 (2.4.0)
py
Runtime Error
163
38384
223
n,l,t=map(int,input().split()) inf=[] s=0 for _ in range(n) x,y=map(int,input().split()) if y==1: x+=t else: x-=t inf.append(x%l) s+=x//l inf.sort() s%n for i in range(n): print(inf[(i+p)%n])
s716415467
p03747
u381635950
1577270753
Python
PyPy3 (2.4.0)
py
Runtime Error
748
66648
1056
# coding: utf-8 # Your code here! CLOCKWISE = 1 COUNTERCLOCKWISE = -1 class Ant: def __init__(self, x, w): self.x = x self.w = w nums=list(map(int,input().split())) N = nums[0] L = nums[1] T = nums[2] ants = [] for i in range(N): nums=list(map(int,input().split())) if nums[1] == 1: ...
s487425103
p03747
u381635950
1577269510
Python
PyPy3 (2.4.0)
py
Runtime Error
692
66648
1028
# coding: utf-8 # Your code here! CLOCKWISE = 1 COUNTERCLOCKWISE = -1 class Ant: def __init__(self, x, w): self.x = x self.w = w nums=list(map(int,input().split())) N = nums[0] L = nums[1] T = nums[2] ants = [] for i in range(N): nums=list(map(int,input().split())) if nums[1] == 1: ...
s904090211
p03747
u591503175
1575434070
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38384
1987
# %% # VScodeで入力をテキストから読み込んで標準入力に渡す import sys import os f=open(r'.\ant_1-6-2_AGC013C\AGC013_input.txt', 'r', encoding="utf-8") # inputをフルパスで指定 # win10でファイルを作るとs-jisで保存されるため、読み込みをutf-8へエンコードする必要あり # VScodeでinput file開くとutf8になってるんだけど中身は結局s-jisになっているらしい sys.stdin=f # # 入力スニペット # num = int(input()) # num_list = [int(item...
s143352489
p03747
u591503175
1575396755
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38256
1318
N, L, T = [int(item) for item in input().split()] pos_list = [[int(item) for item in input().split()] for _ in range(N)] num = 0 next_list = [] for i, item in enumerate(pos_list): next_list.append([*item , i]) while T >= 1: pos_list, next_list = next_list, [] # print(pos_list) for pos, direction, num...
s969171171
p03747
u591503175
1575396638
Python
Python (3.4.3)
py
Runtime Error
18
3192
1318
N, L, T = [int(item) for item in input().split()] pos_list = [[int(item) for item in input().split()] for _ in range(N)] num = 0 next_list = [] for i, item in enumerate(pos_list): next_list.append([*item , i]) while T >= 1: pos_list, next_list = next_list, [] # print(pos_list) for pos, direction, num...
s715946831
p03747
u591503175
1575396172
Python
Python (3.4.3)
py
Runtime Error
18
3064
1300
N, L, T = [int(item) for item in input().split()] pos_list = [[int(item) for item in input().split()] for _ in range(N)] num = 0 next_list = [] for i, item in enumerate(pos_list): next_list.append([*item , i]) while T >= 0: pos_list, next_list = next_list, [] # print(pos_list) for pos, direction, num...
s688066750
p03747
u601321817
1567741823
Python
Python (3.4.3)
py
Runtime Error
17
3064
1103
def next_ants(r_ants, l_ants, r_ants_cord, l_ants_cord): for i,c in enumerate(r_ants_cord[::]): r_ants_cord[i] = (c + 0.5) % L for i,c in enumerate(l_ants_cord[::]): l_ants_cord[i] = (c - 0.5) % L for i,r_cord in enumerate(r_ants_cord): for j,l_cord in enumerate(l_ants_cord): ...
s216009281
p03747
u532966492
1567477349
Python
Python (3.4.3)
py
Runtime Error
489
34696
1829
n,l,t=map(int,input().split()) xw=[list(map(int,input().split())) for _ in [0]*n] first_x=xw[0][0] first_w=xw[0][1] right=[] left=[] for x,w in xw: if w==1: right.append(x) else: left.append(x) if first_w==1: left=[(i-first_x)/2 for i in left] right.reverse() right=[(l+first_x-i)...
s051333488
p03747
u532966492
1567476908
Python
Python (3.4.3)
py
Runtime Error
515
34688
1937
n,l,t=map(int,input().split()) xw=[list(map(int,input().split())) for _ in [0]*n] first_x=xw[0][0] first_w=xw[0][1] right=[] left=[] for x,w in xw: if w==1: right.append(x) else: left.append(x) if first_w==1: left=[(i-first_x)/2 for i in left] right.reverse() right=[(l+first_x-i)...
s393339347
p03747
u908763441
1567107303
Python
Python (3.4.3)
py
Runtime Error
2133
383272
723
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * (L * 2) for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)] ...
s337153259
p03747
u908763441
1567107234
Python
Python (3.4.3)
py
Runtime Error
1833
1297396
137
N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2
s317365119
p03747
u908763441
1567107133
Python
Python (3.4.3)
py
Runtime Error
1878
1297396
233
N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2)
s410289705
p03747
u908763441
1567107053
Python
Python (3.4.3)
py
Runtime Error
2115
1297396
355
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)]
s946268040
p03747
u908763441
1567107016
Python
Python (3.4.3)
py
Runtime Error
2114
1297524
540
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)] ...
s897491986
p03747
u908763441
1567106993
Python
Python (3.4.3)
py
Runtime Error
2113
1297524
678
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)] ...
s217061913
p03747
u908763441
1567106338
Python
Python (3.4.3)
py
Runtime Error
2115
1297524
720
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) # アリの数、外周、時間 P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)] ...
s289187064
p03747
u908763441
1567106000
Python
Python (3.4.3)
py
Runtime Error
2129
1297524
687
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 N, L, T = map(int, input().split()) P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): t1, t2 = map(int, input().split()) P.append(t1 * 2) D.append(t2) for t in range(T * 2): J = [0 for _ in range(L * 2)] for n in range...
s873166481
p03747
u908763441
1567105198
Python
Python (3.4.3)
py
Runtime Error
2111
1297524
589
N, L, T = map(int, input().split()) P = [] # アリの位置 D = [] # アリの方向 J = [0] * L * 2 for n in range(N): tmp = list(map(int, input().split())) P.append(tmp[0] * 2) D.append(tmp[1]) for t in range(T * 2): J = [0 for _ in range(L * 2)] for n in range(N): P[n] += 1 if D[n] == 1 else -1 P[...
s231295638
p03747
u499381410
1565284966
Python
Python (3.4.3)
py
Runtime Error
17
3064
452
normal_ant = [i for i, direction in ants if direction==1] counter_ant = [i for i, direction in ants if direction==2] cnt = (t // l) * len(normal_ant) + sum([1 for i in normal_ant if i + t%l >= l]) counter_cnt = (t // l) * len(counter_ant) + sum([1 for i in counter_ant if i - t%l < 0]) final_pos = sorted([(i-t)%l for i ...
s466399040
p03747
u485979475
1564817277
Python
Python (3.4.3)
py
Runtime Error
2110
34924
1474
import sys import numpy as np n,l,t=map(int,input().rstrip().split()) iniposition =[] finposition=[] fline=np.array([]) bline=np.array([]) for i in range(n): temp1,temp2 = map(int,sys.stdin.readline().rstrip().split()) iniposition.append([i,temp1,temp2]) for element in iniposition: temp1=((-1*(2*element[2]-3)...
s603039007
p03747
u485979475
1564813060
Python
PyPy3 (2.4.0)
py
Runtime Error
2111
126728
1415
import sys n,l,t=map(int,input().rstrip().split()) iniposition =[] finposition=[] fline=[] bline=[] for i in range(n): temp1,temp2 = map(int,sys.stdin.readline().rstrip().split()) iniposition.append([i,temp1,temp2]) for element in iniposition: temp1=((-2*(element[2]-1.5)*t)+element[1]) % l finposition.append...
s513486810
p03747
u485979475
1564812839
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38384
1410
import sys n,l,t=map(int,input().rstrip().split()) iniposition =[] finposition=[] fline=[] bline=[] for i in range(n): temp1,temp2 = map(int,sys.stdin.readline().rstrip().split()) iniposition[i]=[i,temp1,temp2] for element in iniposition: temp1=((-2*(element[2]-1.5)*t)+element[1]) % l finposition.append(int(...
s670722309
p03747
u485979475
1564811922
Python
Python (3.4.3)
py
Runtime Error
2108
30680
1415
import sys n,l,t=map(int,input().rstrip().split()) iniposition =[] finposition=[] fline=[] bline=[] for i in range(n): temp1,temp2 = map(int,sys.stdin.readline().rstrip().split()) iniposition.append([i,temp1,temp2]) for element in iniposition: temp1=((-2*(element[2]-1.5)*t)+element[1]) % l finposition.append...
s413093772
p03747
u485979475
1564809609
Python
Python (3.4.3)
py
Runtime Error
2105
28996
1362
n,l,t=map(int,input().rstrip().split()) iniposition =[] finposition=[] fline=[] bline=[] for i in range(n): temp1,temp2 = map(int,input().rstrip().split()) iniposition.append([i,temp1,temp2]) for i in range(n): temp1=((-2*(iniposition[i][2]-1.5)*t)+iniposition[i][1]) % l finposition.append(int(temp1)) positi...
s439186377
p03747
u610540994
1564216348
Python
Python (3.4.3)
py
Runtime Error
17
3060
219
N, L, T = map(int, input().split()) n = [[*map(int, input().split())] for _ in range(N)] t = [X + (0, T, -T)[W] for X, W in n] x = sorted(i % L for i in t) s = sum(i // L for i in t) % N for i in x[s:] + x[:s]: print(i)
s725151298
p03747
u214434454
1563560333
Python
Python (3.4.3)
py
Runtime Error
576
24248
1733
n,l,T = map(int,input().split()) s = [0 for i in range(n)] for i in range(n): s[i] = list(map(int, input().split())) def f(w): if w == 1: return 1 elif w == 2: return -1 t = 0 d = l while t < T: for i in range(n): if i < n-1 : if s[i][0] < s[i+1][0] and s[i][1]...
s035453455
p03747
u214434454
1563559484
Python
Python (3.4.3)
py
Runtime Error
2105
25112
2413
n,l,T = map(int,input().split()) s = [0 for i in range(n)] for i in range(n): s[i] = list(map(int, input().split())) def f(w): if w == 1: return 1 elif w == 2: return -1 t = 0 d = l i_d = [] while t < T: for i in range(n): if i < n-1 : if s[i][0] < s[i+1][0] an...
s962392180
p03747
u793821463
1560481094
Python
PyPy3 (2.4.0)
py
Runtime Error
2111
123804
1418
N,L,T = map(int , input().split()) X = [0]*N W = [0]*N Y = [0]*(N+4) Z = [0]*(N+4) for i in range(N): X[i],W[i] = map(int , input().split()) Y[i+2] = X[i] Z[i+2] = W[i] Y[0] = X[N-2] Y[1] = X[N-1] Y[N+2] = X[0] Y[N+3] = X[1] Z[0] = W[N-2] Z[1] = W[N-1] Z[N+2] = W[0] Z[N+3] = W[1] for i in range(T): f...
s036016484
p03747
u793821463
1560480758
Python
Python (3.4.3)
py
Runtime Error
2108
12556
1418
N,L,T = map(int , input().split()) X = [0]*N W = [0]*N Y = [0]*(N+4) Z = [0]*(N+4) for i in range(N): X[i],W[i] = map(int , input().split()) Y[i+2] = X[i] Z[i+2] = W[i] Y[0] = X[N-2] Y[1] = X[N-1] Y[N+2] = X[0] Y[N+3] = X[1] Z[0] = W[N-2] Z[1] = W[N-1] Z[N+2] = W[0] Z[N+3] = W[1] for i in range(T): f...
s446938137
p03747
u218843509
1559790333
Python
Python (3.4.3)
py
Runtime Error
468
35692
765
from bisect import bisect_left n, l, t = map(int, input().split()) ants = [list(map(int, input().split())) for _ in range(n)] bnts = [] diff = [] for i in range(n): x, w = ants[i][0], 3 - 2*ants[i][1] bnts.append((x + t*w) % l) if i == 0: zero = bnts[-1] if ants[i][1] != ants[0][1]: if ants[0][1] == 1: diff...
s253434561
p03747
u684695949
1559183382
Python
PyPy3 (2.4.0)
py
Runtime Error
642
60888
1361
import bisect N,L,T= map(int,input().split()) ants = [[],[]] for i in range(N): X,W = map(int,input().split()) ants[W-1].append(X) if len(ants[0]) == N: for i in range(N): print(((x+T)%L)) exit() if len(ants[0]) == 0: for i in range(N): print(((x-T)%L)) exit() ants_final_pos = sorted([((x+T)%L) for x in ...