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
s449698194
p03864
u485137520
1549058391
Python
Python (3.4.3)
py
Runtime Error
105
14132
297
n, x = map(int, input().split()) l = list(map(int, input().split())) total = 0 for i in range(n - 1): sub = l[i] + l[i+1] if sub > x: total += sub - x l[i+1] -= sub - x if l[i+1] > x: l[i] -= l[i+1] - x total += l[i+1 - x] print(total)
s105464647
p03864
u236127431
1544466834
Python
Python (3.4.3)
py
Runtime Error
19
3188
794
from heapq import heapify,heappop,heappush xs,ys,xt,yt=map(int,input().split()) P=[] inf=float("inf") P.append((xs,ys,0)) N=int(input()) for i in range(N): x,y,r=map(int,input().split()) P.append((x,y,r)) P.append((xt,yt,0)) G=[set() for i in range(N+2)] for i in range(N+2): for j in range(N+2): if i!=j: ...
s220807976
p03864
u397531548
1543618357
Python
Python (3.4.3)
py
Runtime Error
79
14052
137
N,x=map(int,input().split()) a=list(map(int,input().split())) b=0 for i in range(N//2): b+=max(a[2*i],a[2*(i+1)])+a[2*i+1]-x print(b)
s885938368
p03864
u438786370
1541172919
Python
Python (3.4.3)
py
Runtime Error
110
14060
356
N,x =map(int, input().split()) candy = list(map(int, input().split())) eat = 0 for i in range(N - 1): if(candy[i] + candy[i + 1] > x): ex = candy[i] + candy[i + 1] - x eat += ex if(candy[i + 1] >= ex): candy[i + 1] -= ex else: candy[i] -= ex - cndy[i + 1] ...
s693358039
p03864
u177398299
1537989080
Python
PyPy3 (2.4.0)
py
Runtime Error
194
40304
933
from heapq import heappop, heappush INF = 10 ** 20 xs, ys, xt, yt = map(int, input().split()) N = int(input()) circle = [list(map(int, input().split())) for _ in range(N)] circle = [[xs, ys, 0]] + circle + [[xt, yt, 0]] edges_lst = [[] for _ in range(N + 2)] for i, (x1, y1, r1) in enumerate(circle): for j, (x2, y...
s885741832
p03864
u200239931
1531392590
Python
Python (3.4.3)
py
Runtime Error
164
14588
849
def getinputdata(): # 配列初期化 array_result = [] data = input() array_result.append(data.split(" ")) flg = 1 try: while flg: data = input() if(data != ""): array_result.append(data.split(" ")) flg = 1 ...
s146329704
p03864
u033407970
1494710064
Python
Python (3.4.3)
py
Runtime Error
150
12448
772
import numpy as np xs, ys, xt, yt = [int(x) for x in input().split(' ')] n = int(input()) cirl = [] for i in range(n): cirl.append([int(x) for x in input().split(' ')]) cirl = [[xs, ys, 0]] + cirl + [[xt, yt, 0]] use = [x for x in range(n+2)] weigth = [0] + [10**10 for x in range(n+1)] while min(weigth) != weigth[...
s123606732
p03864
u159380019
1494705118
Python
Python (3.4.3)
py
Runtime Error
18
3064
1018
from math import sqrt class Edge: def __init__(self, to, cost): self.to = to self.cost = cost def dijkstra(G, s): from heapq import heappush, heappop l = len(G) dist = [float('inf')] * l done = [False] * l dist[s] = 0 pq = [] heappush(pq, (0, s)) while pq: c...
s599843640
p03864
u107077660
1494301926
Python
PyPy3 (2.4.0)
py
Runtime Error
170
38640
868
from math import hypot def dijkstra(matrix): from heapq import heappush, heappop n = len(matrix) inf = 10**10 hq = [] ans = [inf]*n ans[0] = 0 heappush(hq, (0, 0)) while hq: d, p = heappop(hq) for i in range(n): if ans[p] == d and p != i and d + matrix[p][i] <...
s460039863
p03864
u509661905
1482104657
Python
PyPy3 (2.4.0)
py
Runtime Error
211
38640
1564
#!/usr/bin/env pypy3 import math import itertools INVALID = -1 INF = 10 ** 12 def dijkstra_dense(num_vs, adj_matrix, source, dest): dist = [INF for _ in range(num_vs)] visited = [False for _ in range(num_vs)] dist[source] = 0 while True: try: u = min((j for j in range(num_vs) if...
s949146595
p03864
u509661905
1482104304
Python
Python (3.4.3)
py
Runtime Error
24
3192
1533
#!/usr/bin/env python3 import math import itertools INVALID = -1 INF = 10 ** 12 def dijkstra_dense(num_vs, adj_matrix, source, dest): dist = [INF for _ in range(num_vs)] visited = [False for _ in range(num_vs)] dist[source] = 0 while True: u = min((j for j in range(num_vs) if not visited[j]...
s005156561
p03864
u272028993
1480915960
Python
PyPy2 (5.6.0)
py
Runtime Error
49
9328
1041
import math import heapq def dijkstra(s,m,n): visited=[0]*n d=[float("inf")]*n d[s]=0 while True: mincost=float("inf") for i in xrange(n): if visited[i]!=2 and d[i]<mincost: mincost=d[i] u=i if mincost==float("inf"): break ...
s258797385
p03864
u091855288
1480912206
Python
Python (3.4.3)
py
Runtime Error
132
14224
802
def get_input(f, n): l = [f(x) for x in input().split()] if n==1: return l[0] else: return l N, x = get_input(int, 2) As = get_input(int, N) Bs = [As[i]+As[i+1] for i in range(N-1)] result = 0 for idx in range(N-2): if Bs[idx] > x: if Bs[idx+1] > x: la = max(Bs[idx...
s894489062
p03864
u107077660
1480910980
Python
Python (3.4.3)
py
Runtime Error
23
3188
621
from math import sqrt inf = 10**10 x_s, y_s, x_t, y_t = map(int, input().split()) N = int(input()) xyr = [] for i in range(N): x_i, y_i, r_i = map(int, input().split()) xyr.append((x_i, y_i, r_i)) p = (x_s, y_s) goal = (x_t, y_t) ans = 0 while p != goal and xyr: D = inf for i in range(N): x, y, r = xyr[i] d = s...
s034398687
p03864
u272028993
1480908222
Python
PyPy2 (5.6.0)
py
Runtime Error
39
9072
1037
import math def dis(x1,y1,r1,x2,y2,r2): if math.sqrt(abs(x1-x2)**2+abs(y1-y2)**2)>r1+r2: return math.sqrt(abs(x1-x2)**2+abs(y1-y2)**2)-r1-r2 else: return 0 import heapq def dijkstra(s,g,c,n): d=[float('inf')]*n d[s]=0 pq=[] heapq.heappush(pq,[0,s]) while len(pq)!=0: ...
s228202447
p03864
u039623862
1480907457
Python
Python (3.4.3)
py
Runtime Error
23
3316
1140
xs,ys,xt,yt = map(int, input().split()) n = int(input()) c = [(xs,ys, 0),(xt,yt,0)] for i in range(n): x,y,r = map(int, input().split()) c.append((x,y,r)) def circle_circle(ax,ay,ar,bx,by,br): d =((ax-bx)**2 + (ay-by)**2)**0.5 return max(0, d-(ar+br)) def dijkstra(V, edges, root): import heapq ...
s999864342
p03864
u039623862
1480907289
Python
PyPy3 (2.4.0)
py
Runtime Error
197
38640
1150
xs,ys,xt,yt = map(int, input().split()) n = int(input()) c = [(xs,ys, 0),(xt,yt,0)] for i in range(n): x,y,r = map(int, input().split()) c.append((x,y,r)) def circle_circle(ax,ay,ar,bx,by,br): d =((ax-bx)**2 + (ay-by)**2)**0.5 return max(0, d-(ar+br)) def dijkstra(V, edges, root): import heapq ...
s483982470
p03865
u827202523
1583360231
Python
PyPy3 (2.4.0)
py
Runtime Error
190
39220
100
s = input().strip() l = len(s) if (l + s[0] == s[-1]) % 2: print("First") else: print("Second")
s528270335
p03865
u835482198
1481278509
Python
Python (3.4.3)
py
Runtime Error
24
3316
139
#!/usr/bin/env python # -*- coding:utf-8 -*- s = input() if len(s) % 2 == 0 ^ s[0] == s[-1]: print("Second") else: print("First")
s007216014
p03865
u113430839
1481238092
Python
Python (3.4.3)
py
Runtime Error
24
3316
246
s=input();l = len;p = print if (s[0]==s[-1] * l(s)%2==0) + (s[0]!=s[-1] * l(s)%2==1): p("First") else: p("Second") s=input();l = len;p = print if (s[0]==s[-1] * l(s)%2==0) + (s[0]!=s[-1] * l(s)%2==1): p("First") else: p("Second")
s108835057
p03866
u399721252
1597192021
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
95168
1170
def djkstra(in_connect_list,v): out_shortest_list = [10**14 for i in range(v)] out_shortest_list[0] = 0 searching_list = [0] while searching_list != []: new_search_list = [] for i in searching_list: for j in range(len(in_connect_list[i])): if i != j ...
s591065548
p03866
u509368316
1590460038
Python
Python (3.4.3)
py
Runtime Error
217
39340
453
xs,ys,xt,yt=map(int,input().split()) N=int(input()) import numpy as np XYR=np.empty((N+2,3),dtype=np.float64) XYR[1:-1,:]=np.array([input().split() for i in range(N)]) XYR[0,:]=[xs,ys,0] XYR[-1,:]=[xt,yt,0] X,Y,R=XYR.T c=np.maximum(0,np.sqrt(np.square(X[None,:]-X[:,None])+np.square(Y[None,:]-Y[:,None]))-R[None,:]-R[:,N...
s380195391
p03866
u674574659
1590118420
Python
Python (3.4.3)
py
Runtime Error
2107
61040
894
import heapq xs,yx,xt,yt = map(int,input().split()) N = int(input()) l = [[],[xs,yx,0],[xt,yt,0]] for i in range(N): l.append(list(map(int,input().split()))) ##距離リスト d = [[0]*(N+3) for _ in range(N+3)] for i in range(1,N+3): d[i][i] = 0 #O(10**6) for i in range(1,N+3): for j in range(i+1,N+3): sa = (l[i][0]-l...
s950431093
p03866
u227082700
1590110344
Python
PyPy3 (2.4.0)
py
Runtime Error
164
38292
867
def main() import sys input=sys.stdin.readline sx,sy,tx,ty=map(int,input().split()) n=int(input()) p=[(sx,sy,0)] for _ in range(n): x,y,r=map(int,input().split()) p.append((x,y,r)) p.append((tx,ty,0)) n+=2 edge=[[]for _ in range(n)] for i in range(n-1): for j in range(i+1,n): sx,sy...
s369328321
p03866
u893063840
1589730312
Python
Python (3.4.3)
py
Runtime Error
274
40560
578
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline import numpy as np from scipy.spatial.distance import cdist from scipy.sparse.csgraph import dijkstra, csgraph_from_dense xs, ys, xt, yt = map(int, readline().split()) n = int(readline()) xyr = np.array(read().split(), np.int64) xyr = np.app...
s740598019
p03866
u919730120
1589678292
Python
PyPy3 (2.4.0)
py
Runtime Error
783
129364
1316
import heapq def dijkstra_heap(s,g,edge): #始点sから各頂点への最短距離 d = [10**20] * (n+2) used = [True] * (n+2) #True:未確定 d[s] = 0 used[s] = False edgelist = [] sx,sy,sr=edge[s][0],edge[s][1],edge[s][2] for i in range(n+2): x,y,r=edge[i][0],edge[i][1],edge[i][2] dist=((x-sx)**2+(y-s...
s202570144
p03866
u623819879
1587948753
Python
PyPy3 (2.4.0)
py
Runtime Error
189
38384
7804
import sys from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter def Golf():*a,=map(int,open(0)) def I():return int(input()) def S_():return input() def IS():return input().split() def LS():return [i for i in input().split()] def LI():return [int(i) for i in input().split()] def L...
s997254251
p03866
u623819879
1587948474
Python
PyPy3 (2.4.0)
py
Runtime Error
170
38256
7904
import sys,bisect,string,math,time,functools,random from heapq import heappush,heappop,heapify from collections import deque,defaultdict,Counter from itertools import permutations,combinations,groupby def Golf():*a,=map(int,open(0)) def I():return int(input()) def S_():return input() def IS():return input().split() def...
s709261000
p03866
u497046426
1587056116
Python
PyPy3 (2.4.0)
py
Runtime Error
2110
125548
1141
from itertools import combinations from heapq import heappush, heappop def dist(p1, p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) ** 0.5 xs, ys, xt, yt = map(int, input().split()) N = int(input()) P = [[(xs, ys), 0, 0], [(xt, yt), 0, 1]] for i in range(2, N+2): x, y, r = map(int, input().split()) ...
s589332870
p03866
u497046426
1587056040
Python
PyPy3 (2.4.0)
py
Runtime Error
253
62320
1137
from itertools import combinations from heapq import heappush, heappop def dist(p1, p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) ** 0.5 xs, ys, xt, yt = map(int, input().split()) N = int(input()) P = [[(xs, ys), 0, 0], [(xt, yt), 0, 1]] for i in range(2, N+2): x, y, r = map(int, input().split()) ...
s169594859
p03866
u497046426
1587055997
Python
PyPy3 (2.4.0)
py
Runtime Error
239
61424
1135
from itertools import combinations from heapq import heappush, heappop def dist(p1, p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) ** 0.5 xs, ys, xt, yt = map(int, input().split()) N = int(input()) P = [[(xs, ys), 0, 0], [(xt, yt), 0, 1]] for i in range(2, N+2): x, y, r = map(int, input().split()) ...
s541277128
p03866
u779455925
1582590208
Python
PyPy3 (2.4.0)
py
Runtime Error
764
122972
1555
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] idle=10**13 xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR...
s968758340
p03866
u779455925
1582590134
Python
PyPy3 (2.4.0)
py
Runtime Error
2111
122460
1539
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] idle=10**13 xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR...
s442377458
p03866
u779455925
1582589812
Python
PyPy3 (2.4.0)
py
Runtime Error
2109
103004
1524
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] #print(max(((0)**2+(0)**2)**.5-0-0,0)) xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] ...
s386624412
p03866
u779455925
1582589068
Python
PyPy3 (2.4.0)
py
Runtime Error
813
129032
1448
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR.append([xs,...
s136069938
p03866
u779455925
1582589015
Python
PyPy3 (2.4.0)
py
Runtime Error
882
128776
1436
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR.append([xs,...
s213372034
p03866
u779455925
1582588708
Python
PyPy3 (2.4.0)
py
Runtime Error
942
137088
1476
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR.append([xs,...
s800074374
p03866
u779455925
1582588431
Python
PyPy3 (2.4.0)
py
Runtime Error
577
101980
1471
from collections import * from itertools import * from bisect import * from heapq import * import copy #N=int(input()) #S=[list(map(int,input().split())) for i in range(N)] xs,ys,xt,yt=map(int,input().split()) N=int(input()) XYR=[list(map(int,input().split())) for i in range(N)] XYR.append([xt,yt,0])#終点 XYR.append([xs,...
s531781634
p03866
u532966492
1575652113
Python
PyPy3 (2.4.0)
py
Runtime Error
181
38392
914
from heapq import * def main(): import numpy as np xs,ys,xt,yt=map(int,input().split()) n=int(input()) xyr=[[xs,ys,0],[xt,yt,0]]+[list(map(int,input().split())) for _ in [0]*n] inf=float('inf') g=[[] for _ in [0]*(n+2)] for i in range(n+1): x1,y1,r1=xyr[i] xy1=np.array([x1,y1...
s790221365
p03866
u716530146
1570661229
Python
Python (3.4.3)
py
Runtime Error
2115
73784
757
#!/usr/bin/env python3 from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall, dijkstra # G = csgraph_from_dense(edge, null_value=10**9) # f = floyd_warshall(G) # d = dijkstra(G, indices=1) import sys input = lambda: sys.stdin.readline()[:-1] sys.setrecursionlimit(10**8) xs,ys,xt,yt=map(int,input().split(...
s448999869
p03866
u392319141
1568766454
Python
Python (3.4.3)
py
Runtime Error
2113
51472
714
import numpy as np from scipy.sparse.csgraph import dijkstra, csgraph_from_dense sX, sY, eX, eY = map(int, input().split()) N = int(input()) circles = [(sX, sY, 0)] for _ in range(N): cx, cy, r = map(int, input().split()) circles.append((cx, cy, r)) circles.append((eX, eY, 0)) minDist = [[float('inf')] * (N ...
s191089209
p03866
u844789719
1568172174
Python
Python (3.4.3)
py
Runtime Error
2109
27232
626
import numpy as np from scipy.sparse import csgraph xs, ys, xt, yt = [int(_) for _ in input().split()] N = int(input()) XYR = np.array([[xs, ys, 0]] + [[int(_) for _ in input().split()] for _ in range(N)] + [[xt, yt, 0]]) edge = [[0] * (N + 2) for _ in range(N + 2)] for i in range(N + 1...
s950438275
p03866
u844789719
1568171070
Python
Python (3.4.3)
py
Runtime Error
224
16532
611
import numpy as np from scipy.sparse.csgraph import * xs, ys, xt, yt = [int(_) for _ in input().split()] N = int(input()) XYR = np.array([[xs, ys, 0]] + [[int(_) for _ in input().split()] for _ in range(N)] + [[xt, yt, 0]]) edge = [[0] * (N + 2) for _ in range(N + 2)] for i in range(N + ...
s020913897
p03866
u102461423
1562701932
Python
Python (3.4.3)
py
Runtime Error
170
13676
619
import sys input = sys.stdin.readline import numpy as np from scipy.sparse.csgraph import * xs,ys,xt,yt = map(int,input().split()) N = int(input()) XYR = np.empty((3,N+2),dtype=np.int64) XYR[:,:2] = [[xs,xt],[ys,yt],[0,0]] XYR[:,2:] = np.array([input().split() for _ in range(N)], dtype=np.int64).T X,Y,R = XYR dist ...
s599534876
p03866
u399721252
1561836278
Python
PyPy3 (2.4.0)
py
Runtime Error
182
38384
1349
def djkstra(in_connect_list,v): out_parent_list = [-1 for i in range(v)] out_shortest_list = [10**9 for i in range(v)] out_shortest_list[0] = 0 searching_list = [0] while searching_list != []: new_search_list = [] for i in searching_l...
s441310703
p03866
u310678820
1559669432
Python
Python (3.4.3)
py
Runtime Error
172
13660
593
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra from numpy.linalg import norm from numpy import array xs, ys, xt, yt = map(int, input().split()) N = int(input()) p=[(xs, ys, 0), (xt, yt, 0)] edge = [[-1]*(n+2) for _ in range(n+2)] edge[0][1] = edge[1][0] = norm(array([xs-xt, ys-yt])) for i in range(N): ...
s751941307
p03866
u284854859
1559663909
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38640
512
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra xs, ys, xt, yt = map(int, input().split()) n = int(input()) p = [(xs,ys,0),(xt,yt,0)] for i in range(2,n+2): p.append(tuple(map(int,input().split()))) edge = [[-1]*(n+2)for i in range(n+2)] for i in range(n+2): for j in range(i+1,n+2): edg...
s846387625
p03866
u284854859
1559663248
Python
Python (3.4.3)
py
Runtime Error
1415
51516
527
from scipy.sparse.csgraph import csgraph_from_dense,dijkstra xs, ys, xt, yt = map(int, input().split()) n = int(input()) p = [(xs,ys,0),(xt,yt,0)] for i in range(2,n+2): p.append(tuple(map(int,input().split()))) edge = [[0]*(n+2)for i in range(n+2)] for i in range(n+2): for j in range(i+1,n+2): edge...
s248066137
p03866
u627417051
1552959980
Python
Python (3.4.3)
py
Runtime Error
18
3064
1462
from collections import defaultdict from heapq import heappop, heappush class Graph(object): def __init__(self): self.graph = defaultdict(list) def add_edge(self, a, b, w): self.graph[a].append((b, w)) class Dijkstra(object): def __init__(self, graph, s): self.g = graph.graph ...
s335521828
p03866
u803848678
1552351035
Python
Python (3.4.3)
py
Runtime Error
1284
51612
609
from math import sqrt from scipy.sparse.csgraph import dijkstra, csgraph_from_dense def calc_dist(p1,p2): return max(0, sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2) - (p1[2]+p2[2])) xs, ys, xg, yg = map(int, input().split()) n = int(input()) p = [list(map(int, input().split())) for i in range(n)] p = [[xs,ys,0], [xg...
s940326337
p03866
u284854859
1550650862
Python
Python (3.4.3)
py
Runtime Error
17
3064
1056
def dijkstra(s): #始点sから各頂点への最短距離 #n:頂点数, w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf) d = [float("inf")] * n used = [False] * n d[s] = 0 while True: v = -1 #まだ使われてない頂点の中から最小の距離のものを探す for i in range(n): if (not used[i]) and (v == -1): v = i ...
s611365865
p03866
u284854859
1550650596
Python
Python (3.4.3)
py
Runtime Error
43
11508
1070
def dijkstra(s): #始点sから各頂点への最短距離 #n:頂点数, w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf) d = [float("inf")] * n used = [False] * n d[s] = 0 while True: v = -1 #まだ使われてない頂点の中から最小の距離のものを探す for i in range(n): if (not used[i]) and (v == -1): v = i ...
s881077434
p03866
u926678805
1550135428
Python
Python (3.4.3)
py
Runtime Error
18
3064
909
sx,sy,gx,gy=map(int,input().split()) n=int(input()) g = [[] for i in range(n+2)] data=[(sx,sy,0)] for i in range(n): data.append(tuple(map(int,input().split()))) data.append((gx,gy,0)) for i in range(n+2): for j in range(i+1,n+2): tmp=(data[i][0]-data[j][0])**2+(data[i][1]-data[j][1])**2)**0.5-data[i][2...
s990352747
p03866
u226155577
1548400210
Python
Python (3.4.3)
py
Runtime Error
2106
27508
1094
from heapq import heappush, heappop, heapify from math import sqrt readline = open(0).readline xs, ys, xt, yt = map(int, readline().split()) N = int(readline()) C = [list(map(int, readline().split())) for i in range(N)] C.append((xt, yt, 0)) que = [] dist = [10**18]*(N+1) rest = set(range(N+1)) for i in range(N+1): ...
s051705368
p03866
u690536347
1548391759
Python
PyPy3 (2.4.0)
py
Runtime Error
181
38768
592
from heapq import heappush,heappop from math import sqrt inf=float("inf") xs,ys,xt,yt=map(int,input().split()) n=int(input()) q=[] l=[(xs,ys,0),(xt,yt,0)]+[tuple(map(int,input().split())) for _ in range(n)] sizeV=len(l) rests={*range(sizeV)} cost=[inf]*sizeV cost[0]=0 heappush(q,(0,0)) while q: c1,i=heappop(q) ...
s233223618
p03866
u690536347
1548391722
Python
Python (3.4.3)
py
Runtime Error
18
3060
592
from heapq import heappush,heappop from math import sqrt inf=float("inf") xs,ys,xt,yt=map(int,input().split()) n=int(input()) q=[] l=[(xs,ys,0),(xt,yt,0)]+[tuple(map(int,input().split())) for _ in range(n)] sizeV=len(l) rests={*range(sizeV)} cost=[inf]*sizeV cost[0]=0 heappush(q,(0,0)) while q: c1,i=heappop(q) ...
s892997076
p03866
u690536347
1548391230
Python
Python (3.4.3)
py
Runtime Error
18
3060
572
from heapq import heappush,heappop from math import sqrt inf=float("inf") xs,ys,xt,yt=map(int,input().split()) n=int(input()) q=[] l=[(xs,ys,0),(xt,yt,0)]+[tuple(map(int,input().split())) for _ in range(n)] sizeV=len(l) rests={*range(sizeV)} cost=[inf]*sizeV cost[0]=0 heappush(q,(0,0)) while q: c1,i=heappop(q) ...
s516289527
p03866
u690536347
1548391088
Python
Python (3.4.3)
py
Runtime Error
18
3060
550
from heapq import heappush,heappop from math import sqrt inf=float("inf") xs,ys,xt,yt=map(int,input().split()) n=int(input()) q=[] l=[(xs,ys,0),(xt,yt,0)]+[tuple(map(int,input().split())) for _ in range(n)] sizeV=len(l) rests={*range(sizeV)} cost=[inf]*sizeV cost[0]=0 heappush(q,(0,0)) while q: c1,i=heappop(q) ...
s393741633
p03866
u690536347
1548390934
Python
Python (3.4.3)
py
Runtime Error
20
3060
550
from heapq import heappush,heappop from math import sqrt inf=float("inf") xs,ys,xt,yt=map(int,input().split()) n=int(input()) q=[] l=[(xs,ys,0),(xt,yt,0)]+[tuple(map(int,input().split())) for _ in range(n)] sizeV=len(l) rests={*range(sizeV)} cost=[inf]*sizeV cost[0]=0 heappush(q,(0,0)) while q: c1,i=heappop(q) ...
s372836309
p03866
u368780724
1542650967
Python
Python (3.4.3)
py
Runtime Error
746
60584
947
def flpl(): return [float(i) for i in input().split()] def inpl(): return [int(i) for i in input().split()] import numpy as np import heapq xs, ys, xt, yt = flpl() N = int(input()) xyr = [(xs, ys, 0),(xt, yt, 0)] + [inpl() for _ in range(N)] X, Y, R = np.array(xyr).T X, Y, R = np.tile(X, (N+2, 1)), np.tile(Y, (N+2, 1)...
s600026922
p03866
u777923818
1523119743
Python
Python (3.4.3)
py
Runtime Error
359
41348
648
# -*- coding: utf-8 -*- import numpy as np from scipy.sparse.csgraph import csgraph_from_dense, dijkstra def inpl(): return map(int, input().split()) sx, sy, tx, ty = inpl() N = int(input()) X = np.zeros((1, N+2), dtype=np.float64) Y = np.zeros((1, N+2), dtype=np.float64) R = np.zeros((1, N+2), dtype=np.float64) X[0]...
s867766005
p03866
u820351940
1496116814
Python
Python (3.4.3)
py
Runtime Error
2105
24500
1190
def dist(x1, y1, x2, y2): return pow((x1 - x2)**2 + (y1 - y2)**2, 0.5) def dist_high(i, now): if i == -1 and now == -1: return dist(stx, sty, enx, eny) if now == -1: result = dist(stx, sty, xyr[i][0], xyr[i][1]) result -= xyr[i][2] elif i == -1: result = dist(xyr[now][0...
s387448089
p03866
u509661905
1482104161
Python
PyPy3 (2.4.0)
py
Runtime Error
404
74844
1531
#!/usr/bin/env pypy3 import math import itertools INVALID = -1 INF = 10 ** 12 def dijkstra_dense(num_vs, adj_matrix, source, dest): dist = [INF for _ in range(num_vs)] visited = [False for _ in range(num_vs)] dist[source] = 0 while True: u = min((j for j in range(num_vs) if not visited[j]),...
s821405834
p03866
u854685751
1481059215
Python
PyPy2 (5.6.0)
py
Runtime Error
49
9328
1773
xs,ys,xt,yt=list(map(int,input().split())) N=int(input()) a=[] for i in range(N): a.append(list(map(int,input().split()))) # xs,ys,xt,yt=[-1000000000, -1000000000, 1000000000, 1000000000] # N=1 # a=[[-1000000000, 1000000000, 1]] class Dijkstra(object): """ ダイクストラ法,(N^2) ステータス:distance(list),prev(list),size(int) ...
s568048775
p03866
u854685751
1480917517
Python
PyPy3 (2.4.0)
py
Runtime Error
230
39920
1488
xs,ys,xt,yt=list(map(int,input().split())) N=int(input()) a=[] for i in N: a.append(list(map(int,input().split()))) # xs,ys,xt,yt=[4,-2,-2,4] # N=3 # a=[[0,0,2],[4,0,1],[0,4,1]] class Dijkstra(object): """ ダイクストラ法,(N^2) ステータス:distance(list),route(list),prev(list),size(int) """ def __init__(self, distancemap, st...
s921024453
p03866
u226155577
1480908205
Python
PyPy2 (5.6.0)
py
Runtime Error
1090
106908
1512
from heapq import heappush, heappop from math import sqrt EPS = 1e-10 xs, ys, xt, yt = map(int, raw_input().split()) n = input() ps = [map(int, raw_input().split()) for i in xrange(n)] def calc(x0, y0, r0, x1, y1, r1): v = (x0 - x1)**2 + (y0 - y1)**2 if v <= (r0+r1)**2 + EPS: return 0. return sqrt(v...
s309951077
p03867
u680707192
1596945476
Python
PyPy3 (7.3.0)
py
Runtime Error
120
74028
2453
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> p_ll; template<class T> void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; } #define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++) #define all(vec) vec.begin(), vec.en...
s008102275
p03867
u875291233
1593212139
Python
PyPy3 (7.3.0)
py
Runtime Error
116
74452
1036
# coding: utf-8 # Your code here! import sys read = sys.stdin.read readline = sys.stdin.readline n,k = map(int,readline().split()) MOD = 10**9+7 if n&1: ans = k + (pow(k,(n+1)//2,MOD)-k)*n print(ans%MOD) else: assert 0 def divisor_list(N): #約数のリスト if N == 1: return [1] res = [] ...
s540651161
p03867
u353919145
1553541372
Python
Python (2.7.6)
py
Runtime Error
10
2568
621
@parallel @roles('allgame') def _last_redis_save(): with cd(get_deploy_path()): redisSet = set() ret = run('supervisorctl status') for line in ret.split('\n'): line = line.strip() if line.find('RUNNING') >= 0 and line.find('redis') >= 0: name = line.split()[0].strip() redisSet.add(name) ret = []...
s528081524
p03867
u280667879
1480992295
Python
PyPy2 (5.6.0)
py
Runtime Error
42
8944
294
M=10**9+7;D=[];i=1;r=0;N,K=map(int,input().split()) while i*i<=N: if N%i==0:D.append(i);i*i<N and D.append(N//i) i+=1 D.sort();N=[] for i in range(len(D)): N.append(pow(K,-~D[i]//2,M)) for j in range(i): if D[i]%D[j]==0:N[i]=(N[i]-N[j])%M r=(r+(N[i]*D[i]*pow(2,M-2+D[i]%2,M)))%M print(r)
s882361741
p03869
u584174687
1568496288
Python
Python (3.4.3)
py
Runtime Error
320
105924
1081
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline from math import factorial import heapq, bisect import math import itertools import queue from collections import deque def check(max_length, left, right, r, index): if index == 100: p...
s135101637
p03869
u584174687
1568496174
Python
Python (3.4.3)
py
Runtime Error
304
105924
1082
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline from math import factorial import heapq, bisect import math import itertools import queue from collections import deque def check(max_length, left, right, r, index): if index == 1000: ...
s444273681
p03877
u687214625
1582165500
Python
Python (3.4.3)
py
Runtime Error
19
2940
4381
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} template<typename T,T MOD = 1000000007> struct Mint{ T v; Mint():v(0){} Mint(signed v):v...
s453603044
p03878
u163320134
1566859220
Python
Python (3.4.3)
py
Runtime Error
522
28632
318
n=int(input()) arr=[(int(input()),i//n) for i in range(2*n)] arr=sorted(arr,key=lambda x:x[0]) mod=10**9+7 ans=1 cnta=0 cntb=0 for pos,flag in arr: if flag==0: if cntb==0: cnta+=1 else: cntb-=1 else: if cnta>=1: ans*=cnt ans%=mod cnta-=1 else: cntb+=1 print(ans)
s165008329
p03878
u163320134
1566859180
Python
Python (3.4.3)
py
Runtime Error
524
28628
317
n=int(input()) arr=[(int(input()),i//n) for i in range(2*n)] arr=sorted(arr,key=lambda x:x[0]) mod=10**9+7 ans=1 cnta=0 cntb=0 for pos,flag in arr: if flag==0: if cntb==0: cnta+=1 else: cntb-=1 else: if cnta>=1: ans*=cnt ans%=mod cnt-=1 else: cntb+=1 print(ans)
s565417243
p03878
u163320134
1566859137
Python
Python (3.4.3)
py
Runtime Error
360
12600
317
n=int(input()) arr=[(int(input())+i//n) for i in range(2*n)] arr=sorted(arr,key=lambda x:x[0]) mod=10**9+7 ans=1 cnta=0 cntb=0 for pos,flag in arr: if flag==0: if cntb==0: cnta+=1 else: cntb-=1 else: if cnta>=1: ans*=cnt ans%=mod cnt-=1 else: cntb+=1 print(ans)
s802290610
p03878
u548768105
1566719866
Python
Python (3.4.3)
py
Runtime Error
17
2940
1564
#include "bits/stdc++.h" typedef long long ll; #define int ll #define fi first #define se second #define SORT(a) sort(a.begin(),a.end()) #define rep(i,n) for(int i = 0;i < (n) ; i++) #define REP(i,n) for(int i = 0;i < (n) ; i++) #define MP(a,b) make_pair(a,b) #define pb(a) push_back(a) #define INF LLONG_MAX/2 #defi...
s546671229
p03878
u619819312
1566172292
Python
PyPy3 (2.4.0)
py
Runtime Error
189
38384
201
p=1 s=[0]*2 n=int(input()) q=sorted([[int(input()),i//n]for i in range(2*n)]) for i in q: if s[1-i[1]]==0: s[i[1]]+=1 else: p*=s[1-i[1]] s[1-[i[1]]-=1 print(p%(10**9+7))
s817887864
p03878
u054106284
1548997079
Python
Python (3.4.3)
py
Runtime Error
18
3064
322
N = int(input()) L = [] for i in range(N): L.append((int(input),'a')) for i in range(N): L.append((int(input),'b')) L.sort() res = 1 cc = 0 nowcol = None mo = 1000000007 for i in range(2*N): if cc == 0: nowcol=L[i][1] if nowcol == L[i][1]: cc += 1 else: res *= cc res %= mo cc -= 1 print(re...
s806854824
p03878
u064408584
1548124292
Python
Python (3.4.3)
py
Runtime Error
741
31344
274
import math n=int(input()) a=[[int(input()),1] for i in range(n)]+[[int(input()),-1] for i in range(n)] a.sort() c=0 b=a[0][1] d=[] for i,j in a: if j!=b and c*j<0:d.append(abs(c)) c+=j b=j print(d,c,r) ans=1 for i in d: ans*=math.factorial(i) print(ans)
s846073807
p03878
u619631862
1547394764
Python
PyPy3 (2.4.0)
py
Runtime Error
1534
86360
479
def i1(): return int(input()) def i2(): return [int(i) for i in input().split()] n=i1() x=[] for i in range(n): x.append([i1(),0]) for i in range(n): x.append([i1(),1]) x.sort() d=x[0][1] c=0 dd=[] cc=0 for i in range(2*n): if x[i][1]==d: c+=1 cc=0 else: if cc==0: dd.append(c) cc=1 ...
s356217336
p03878
u760968784
1487223692
Python
Python (3.4.3)
py
Runtime Error
18
3060
425
from sys import stdin, stdout, stderr, setrecursionlimit from io import StringIO def read(): return stdin.readline().rstrip() def reada(sep=None, maxsplit=-1): return read().split(sep, maxsplit) def readint(): return int(read()) def readia(sep=None, maxsplit=-1): return [int(a) for a in reada(sep, m...
s639373510
p03879
u467736898
1539404012
Python
Python (3.4.3)
py
Runtime Error
17
3064
776
def norm(x1, y1, x2, y2): return ((x1-x2)**2 + (y1-y2)**2)**0.5 def d(a, b, c, x, y): return abs(a*x + b*y + c) / (a**2 + b**2)**0.5 def points2line(x1, y1, x2, y2): la = y1 - y2 lb = x2 - x1 lc = x1 * (y2 - y1) + y1 * (x1 - x2) return la, lb, lc #from numpy import argmax def argmax(L): retu...
s932687292
p03879
u467736898
1539403729
Python
Python (3.4.3)
py
Runtime Error
17
3064
708
def norm(x1, y1, x2, y2): return ((x1-x2)**2 + (y1-y2)**2)**0.5 def d(a, b, c, x, y): return abs(a*x + b*y + c) / (a**2 + b**2)**0.5 def points2line(x1, y1, x2, y2): la = y1 - y2 lb = x2 - x1 lc = x1 * (y2 - y1) + y1 * (x1 - x2) return la, lb, lc from numpy import argmax x1, y1 = map(int, input...
s163407397
p03879
u467736898
1539403648
Python
Python (3.4.3)
py
Runtime Error
17
3064
698
def norm(x1, y1, x2, y2): return ((x1-x2)**2 + (y1-y2)**2)**0.5 def d(a, b, c, x, y): return abs(a*x + b*y + c) / (a**2 + b**2)**0.5 def points2line(x1, y1, x2, y2): la = y1 - y2 lb = x2 - x1 lc = x1 * (y2 - y1) + y1 * (x1 - x2) return la, lb, lc from numpy import argmax x1, y1 = map(int, input...
s576518461
p03879
u536113865
1539003178
Python
Python (3.4.3)
py
Runtime Error
149
12504
396
import numpy as np import math def calc(A,B,C): a = np.linalg.norm(B - C) b = np.linalg.norm(C - A) c = np.linalg.norm(A - B) cosC = np.inner(A-C, B-C)/(b*a) if cosC <= 0: return 0 tanC = math.sqrt(1/(cosC**2)-1) return (1 - 1/cosC + tanC) * (a+b-c)/4 a = np.array(ai()) b = np.ar...
s221326649
p03879
u020381098
1531003502
Python
Python (2.7.6)
py
Runtime Error
10
2568
183
from sys import stdin n = int(stdin.readline()) a = map(int,stdin.readline().split(' ')) xs = 0 oc = 0 for x in a: xs ^= x >> 1 oc ^= x & 1 if xs: print -1 else: print oc
s735481396
p03880
u754022296
1583189301
Python
Python (3.4.3)
py
Runtime Error
217
24688
514
import sys input = sys.stdin.readline read = sys.stdin.read import numpy as np n = int(input()) A = np.array(read().split(), dtype=np.int64) m = 30 C = np.zeros(m, dtype=bool) used = np.zeros(m, dtype=bool) x = 0 for a in A: x ^= a for i in range(m): idx = np.where(A>>i & 1) if np.any(~used[idx]): C[i] = Tru...
s646194231
p03880
u532966492
1576893528
Python
Python (3.4.3)
py
Runtime Error
194
7840
664
def main(): n = int(input()) a = [int(input()) for _ in [0]*n] m = max(a) xor = 0 for i in a: xor ^= i i = 1 cnt = 0 while True: if xor >= i: i *= 2 cnt += 1 else: break ans = 0 for i in range(cnt-1, -1, -1): j =...
s972134573
p03880
u879309973
1570090412
Python
Python (3.4.3)
py
Runtime Error
209
11064
927
def solve(n, a): """ References ---------- [1]. 足跡-sokuseki-, CODE FESTIVAL 2016 Grand Final C - Cheating Nim, http://wk1080id.hatenablog.com/entry/2018/08/17/234023 [2]. iroiro, CODE FESTIVAL 2016 Grand Final C - Cheating Nim, http://xxxasdfghjk999.hatenablog.jp/entry/2018/11/01/235259 [3]. Yan...
s872599828
p03880
u296518383
1569878488
Python
Python (3.4.3)
py
Runtime Error
225
15032
339
import math N=int(input()) A=[int(input()) for _ in range(N)] #print(A) B=0 for a in A: B^=a C=[] D=[0]*30 for a in A: C.append(bin(a^(a-1))[2:]) #print(C) for c in C: D[len(c)]=1 #print(D) ans=0 while B: #print(B,bin(B)) if D[len(bin(B)[2:])]: B^=2**len(bin(B)[2:])-1 ans+=1 else: ans=-1 ...
s145041413
p03880
u052499405
1566944264
Python
Python (3.4.3)
py
Runtime Error
240
3064
370
n = int(input()) xor = 0 rank = [0] * 12 for i in range(n): a = int(input()) LSB = (a & -a).bit_length() rank[LSB] += 1 xor ^= a prev = False ans = 0 for i in range(10, -1, -1): bit = xor & (1 << i) if bit ^ prev: if rank[i+1] == 0: print(-1) exit() el...
s693254047
p03880
u467736898
1539405857
Python
Python (3.4.3)
py
Runtime Error
340
7072
397
N = int(input()) A = [int(input()) for i in range(N)] s = 0 L = [False]*22 for a in A: s ^= a c = 0 while a&1==0: c += 1 a >>= 1 L[c] = True if s==0: print(0) exit() ss = "0" + bin(s)[2:] ans = 0 for i in range(len(ss)-1): if ss[-1-i] != ss[-2-i]: if L[i]: ...
s703532035
p03880
u272028993
1482376586
Python
PyPy2 (5.6.0)
py
Runtime Error
233
21532
793
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] mxlba=0 for i in xrange(n): mxlba=max(mxlba,len(bin(a[i])[2:])) cnt=[0]*(mxlba+5) for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i i...
s848956893
p03880
u272028993
1482376390
Python
PyPy2 (5.6.0)
py
Runtime Error
229
21532
747
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] mxlba=0 for i in xrange(n): mxlba=max(mxlba,len(bin(a[i])[2:])) cnt=[0]*(mxlba+5) for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i i...
s946973165
p03880
u272028993
1482376080
Python
PyPy2 (5.6.0)
py
Runtime Error
229
21532
712
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] mxlba=0 for i in xrange(n): mxlba=max(mxlba,len(bin(a[i])[2:])) cnt=[0]*(mxlba+5) for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i i...
s424739725
p03880
u272028993
1482375940
Python
PyPy2 (5.6.0)
py
Runtime Error
335
28828
708
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] mxlba=0 for i in xrange(n): mxlba=max(mxlba,len(bin(a[i])[2:])) cnt=[0]*mxlba for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i in xr...
s700850283
p03880
u272028993
1482375436
Python
PyPy2 (5.6.0)
py
Runtime Error
275
24348
703
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] mxlba=0 for i in xrange(n): mxlba=max(mxlba,len(bin(a[i])[2:])) cnt=[0]*mxlba for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i in xr...
s052143373
p03880
u272028993
1482375191
Python
PyPy2 (5.6.0)
py
Runtime Error
300
30364
669
n=int(raw_input()) a=[int(raw_input()) for _ in xrange(n)] cnt=[0]*len(bin(max(a))[2:]) for i in xrange(n): bit=bin(a[i])[2:] lb=len(bit) for j in xrange(lb-1,-1,-1): if bit[j]=="1": cnt[lb-1-j]+=1 break axor=0 for i in xrange(n): axor^=a[i] axor=bin(axor)[2:] mx=len(bi...
s163357720
p03880
u382423941
1480369686
Python
Python (3.4.3)
py
Runtime Error
690
9604
515
import math as m import functools def int_reverse(num): num_len = len(bin(num))-2 f = 2**num_len-1 return num ^ f n = int(input()) A = [int(input()) for i in range(n)] lsbs = [[i for i in range(int(m.log2(a))+1) if (a>>i)&1][0] for a in A] nim = functools.reduce(lambda x,y:x^y, A) cnt = 0 if nim == 0: ...