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
s836238455
p03557
u419686324
1533006580
Python
Python (3.4.3)
py
Runtime Error
558
114108
676
import bisect, functools, sys sys.setrecursionlimit(10**6) N = int(input()) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) @functools.lru_cache(maxsize=None) def a(n): return bisect.bisect_left(A, n) b_cache = [0] * N b_cached = ...
s375496199
p03557
u419686324
1533005783
Python
Python (3.4.3)
py
Runtime Error
867
49004
525
import bisect, functools N = int(input()) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) @functools.lru_cache(maxsize=None) def a(n): return bisect.bisect_left(A, n) @functools.lru_cache(maxsize=None) def b_i(i): if i >= 1: ...
s176210911
p03557
u759651152
1532989056
Python
Python (3.4.3)
py
Runtime Error
2105
28568
586
#-*-coding:utf-8-*- def main(): n = int(input()) a_list = list(set(list(map(int, input().split())))) b_list = list(set(list(map(int, input().split())))) c_list = list(set(list(map(int, input().split())))) a_list.sort() b_list.sort() c_list.sort() cnt = 0 for i in range(n): ...
s801891104
p03557
u884982181
1530899267
Python
Python (3.4.3)
py
Runtime Error
380
24052
430
import bisect N = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) a = sorted(a) b = sorted(b) c = sorted(c) z = [0] * N ans = 0 for i in range(N-1,-1,-1): e = b[i] cin = bisect.bisect_right(c,e) if i + 1 == N: z[i] = N-cin else: z[i]...
s527940373
p03557
u698479721
1530029773
Python
Python (3.4.3)
py
Runtime Error
327
23360
529
import bisect N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() c.sort() ans = 0 def find_lt(a, x): 'Find rightmost value less than x' i = bisect.bisect_left(a, x) if i: return i raise ValueError def find_gt(a, x...
s210299893
p03557
u506302470
1529988868
Python
PyPy3 (2.4.0)
py
Runtime Error
163
38256
478
#include <bits/stdc++.h> using namespace std; int N; int a[3][111111]; long long ans; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>N; for(int i=0;i<3;i++) for(int j=0;j<N;j++) cin>>a[i][j]; for(int i=0;i<3;i++)sort(a[i],a[i]+N); for(int i=0;i<N;i++){ ...
s591668008
p03557
u409064224
1529365937
Python
Python (3.4.3)
py
Runtime Error
17
2940
316
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) num = 0 #a.sort #b.sort #c.sort for i in range(n): for j in range(n): if a[i] < b[i]: for k in range(n): b[j] < c[k]: num += 1 print(num)
s346427570
p03557
u267325300
1528834134
Python
Python (3.4.3)
py
Runtime Error
17
2940
558
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() count = 0 Ai = -1 Ci = -1 for i in range(N): if Ai < N - 1: while A[Ai + 1] < B[i]: Ai += 1 if Ai =...
s775492219
p03557
u061732150
1528750268
Python
Python (3.4.3)
py
Runtime Error
304
24180
614
def main(): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() count = 0 Ai = -1 Ci = -1 for i in range(N): if Ai<N-1: while A[Ai+1]<B[i]: ...
s675056006
p03557
u503901534
1524955658
Python
Python (3.4.3)
py
Runtime Error
2106
64284
1249
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) adic = {} bdic = {} cdic = {} setabc = list(sorted(list(set(a) | set(b) | set(c)))) setdict = {} for i in range(len(setabc)): setdict.update({setabc[i]:i}) for i in range(len(a)): ...
s753080259
p03557
u503901534
1524954042
Python
Python (3.4.3)
py
Runtime Error
2107
64228
1213
n = int(input()) a = list(map(int,input().split())) b = list(map(int,input().split())) c = list(map(int,input().split())) adic = {} bdic = {} cdic = {} setabc = list(sorted(list(set(a) | set(b) | set(c)))) setdict = {} for i in range(len(setabc)): setdict.update({setabc[i]:i}) for i in range(len(a)): ...
s854781816
p03557
u729707098
1521434840
Python
Python (3.4.3)
py
Runtime Error
2104
23296
400
n = int(input()) a = [int(i) for i in input().split()] b = [int(i) for i in input().split()] c = [int(i) for i in input().split()] a.sort() b.sort() c.sort() c = c[::-1] answer,x,y = 0,0,n-1 for j in b: for k in range(x,n): if a[k] >= j: x = k break elif k == n-1: x = n for k2 in range(y+1): if c[k2] <...
s834798809
p03557
u030726788
1519781433
Python
Python (3.4.3)
py
Runtime Error
2104
23220
600
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) c=list(map(int,input().split())) a.sort() b.sort() c.sort() b.reverse() c.reverse() pat=0 keepi,keepj=-1,-1 for x in range(n): i=a[x] if(i!=keepi): keepi=i patj=0 else: pat+=patj continue for y in range(n): j=b[...
s803003952
p03557
u052746401
1516683130
Python
Python (3.4.3)
py
Runtime Error
2135
503960
491
import numpy as np N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() M = np.array([[0 for _ in range(0, max(C)+1)] for _ in range(2)]) for i in range(N): M[0][A[i]] += 1 M[1][C[i]] += 1 cum_M = np.cumsum(M, axi...
s327452286
p03557
u052746401
1516682867
Python
Python (3.4.3)
py
Runtime Error
2135
499456
506
import numpy as np N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() M = np.array([[0 for _ in range(0, max(C)+1)] for _ in range(3)]) for i in range(N): M[0][A[i]] += 1 M[1][B[i]] += 1 M[2][C[i]] += 1 cum_...
s784805081
p03557
u052746401
1516682856
Python
Python (3.4.3)
py
Runtime Error
2136
502456
506
import numpy as np N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() M = np.array([[0 for _ in range(0, max(C)+1)] for _ in range(3)]) for i in range(N): M[0][A[i]] += 1 M[1][B[i]] += 1 M[2][C[i]] += 1 cum_...
s464185448
p03557
u787988531
1513107461
Python
Python (2.7.6)
py
Runtime Error
469
42192
286
N = int(raw_input()) As = [(int(i), 2) for i in raw_input().split(" ")] Bs = [(int(i), 1) for i in raw_input().split(" ")] Cs = [(int(i), 0) for i in raw_input().split(" ")] l = sorted(As + Bs + Cs) count = (0, 0, 0, 1) for i in l: count[i[1]] += count[i[1] + 1] print count[0]
s366700783
p03557
u787988531
1513107385
Python
Python (2.7.6)
py
Runtime Error
473
41424
279
N = int(raw_input()) As = [(int(i), 2) for i in raw_input().split(" ")] Bs = [(int(i), 1) for i in raw_input().split(" ")] Cs = [(int(i), 0) for i in raw_input().split(" ")] l = sorted(As + Bs + Cs) count = (0, 0, 0, 1) for i in l: count[i] += count[i + 1] print count[0]
s327412374
p03557
u787988531
1513107375
Python
Python (2.7.6)
py
Runtime Error
463
41424
280
N = int(raw_input()) As = [(int(i), 2) for i in raw_input().split(" ")] Bs = [(int(i), 1) for i in raw_input().split(" ")] Cs = [(int(i), 0) for i in raw_input().split(" ")] l = sorted(As + Bs + Cs) count = (0, 0, 0, 1) for i in l: count[i] += count[i + 1] print count[0]
s292836785
p03557
u787988531
1513106801
Python
Python (2.7.6)
py
Runtime Error
681
71992
347
N = int(raw_input()) As = [(int(i), 2) for i in raw_input().split(" ")] Bs = [(int(i), 1) for i in raw_input().split(" ")] Cs = [(int(i), 0) for i in raw_input().split(" ")] l = sorted(As + Bs + Cs, key=lambda x: (x[0],x[1])) count = (0, 0, 0) for i in l: count[i[1]] += 1 if(i[1] == 2)else count[2] if(i[1] == 1) el...
s076789747
p03557
u443630646
1513017698
Python
Python (3.4.3)
py
Runtime Error
386
23388
430
import bisect n = int(input()) count = 0 a = [[0 for i in range(n)] for i in range(3)] for i in range(3): a[i] = [int(x) for x in input().split()] a[i].sort() # Binary Search for i in a[1]: index0_left = bisect.bisect_left(a[0], i) index2_right = bisect.bisect_right(a[2], i) if ( i > a[0][index0_...
s717795340
p03557
u443630646
1512999223
Python
Python (3.4.3)
py
Runtime Error
417
23388
651
import bisect n = int(input()) count = 0 a = [[0 for i in range(n)] for i in range(3)] for i in range(3): a[i] = [int(x) for x in input().split()] a[i].sort() # Binary Search for i in a[1]: index0_left = bisect.bisect_left(a[0], i) while i == a[0][index0_left-1]: if index0_left == 0: ...
s451536145
p03557
u443630646
1512999145
Python
Python (3.4.3)
py
Runtime Error
418
23388
631
import bisect n = int(input()) count = 0 a = [[0 for i in range(n)] for i in range(3)] for i in range(3): a[i] = [int(x) for x in input().split()] a[i].sort() # Binary Search for i in a[1]: index0_left = bisect.bisect_left(a[0], i) while i == a[0][index0_left-1]: if index0_left == 0: ...
s117327815
p03557
u803848678
1511565916
Python
Python (3.4.3)
py
Runtime Error
2105
28568
755
N = int(input()) ue = list(set(list(map(int, input().split())))) mid = list(set(list(map(int, input().split())))) bot = list(set(list(map(int, input().split())))) ue.sort() mid.sort() bot.sort() #高速化できるのがキャッシュしか無い ans = 0 pos_j = 0 for i in ue: flag = 0 while(mid[pos_j] <= i): pos_j += 1 if po...
s868195294
p03557
u803848678
1511565740
Python
Python (3.4.3)
py
Runtime Error
2105
27840
716
N = int(input()) ue = list(set(list(map(int, input().split())))) mid = list(set(list(map(int, input().split())))) bot = list(set(list(map(int, input().split())))) ue.sort() mid.sort() bot.sort() #高速化できるのがキャッシュしか無い ans = 0 pos_j = 0 for i in ue: flag = 0 while(mid[pos_j] <= i): pos_j += 1 if po...
s399078965
p03557
u019584841
1511413102
Python
Python (3.4.3)
py
Runtime Error
313
23360
310
import bisect n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() A = 0 for x in b: i = bisect.bisect_left(a, x) j = bisect.bisect_right(c, x) if i > 0 and j != len(c): ans += i * (n - j) print(ans)
s599282201
p03557
u745087332
1510970002
Python
Python (2.7.6)
py
Runtime Error
2104
17712
972
# coding:utf-8 n = input() top = map(int, raw_input().split()) middle = map(int, raw_input().split()) under = map(int, raw_input().split()) top.sort() middle.sort() under.sort() total = 0 for i in xrange(n): high = n - 1 low = 0 t = (high+low)/2 d = middle[i] - 1 while(low <= high): if top[...
s389044983
p03557
u745087332
1510969821
Python
Python (2.7.6)
py
Runtime Error
2106
17712
971
# coding:utf-8 n = input() top = map(int, raw_input().split()) middle = map(int, raw_input().split()) under = map(int, raw_input().split()) top.sort() middle.sort() under.sort() total = 0 for i in xrange(n): high = n - 1 low = 0 t = (high+low)/2 d = middle[i] - 1 while(low <= high): if top[...
s188016307
p03557
u938594975
1510447634
Python
Python (3.4.3)
py
Runtime Error
18
2940
342
#参考 import bisect n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 a.sort() b.sort() c.sort() for j in range(n): ans += bisect.bisect_left(a,b[j])*(n-bisect.bisect_right(c,b[j...
s374199372
p03557
u207707177
1510442887
Python
Python (3.4.3)
py
Runtime Error
2104
24052
616
N = int(input()) A = list(int(i) for i in input().split()) B = list(int(i) for i in input().split()) C = list(int(i) for i in input().split()) A.sort() B.sort() C.sort() sum = 0 for j in range(N): low = low2 = 0 high = high2 = N b = B[j] #print(b) while(high>low): mid = (high + low)//2 ...
s518819598
p03557
u207707177
1510442796
Python
Python (3.4.3)
py
Runtime Error
2105
23924
615
N = int(input()) A = list(int(i) for i in input().split()) B = list(int(i) for i in input().split()) C = list(int(i) for i in input().split()) A.sort() B.sort() C.sort() sum = 0 for j in range(N): low = low2 = 0 high = high2 = N b = B[j] #print(b) while(high>low): mid = (high + low)//2 ...
s534739217
p03557
u207707177
1510437670
Python
Python (3.4.3)
py
Runtime Error
1871
23328
1172
N = int(input()) A = list(int(i) for i in input().split()) B = list(int(i) for i in input().split()) C = list(int(i) for i in input().split()) A.sort() B.sort() C.sort() sum = 0 #print(A,B,C) for j in range(N): low = low2 = 0 high = high2 = N - 1 mid =mid2 = (N - 1) // 2 b = B[j] if A[0] > b: ...
s504488865
p03557
u207707177
1510206991
Python
Python (3.4.3)
py
Runtime Error
2105
40612
1918
N = int(input()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] C = [int(i) for i in input().split()] A2=sorted(A) B2=sorted(B) C2=sorted(C) ans = 0 sum = 0 t =0 b = 0 for i in range(N): a = A2[i] low = 0 high = N-1 while True: t = (low + high) // 2 if B2[t] ...
s776703886
p03557
u965230804
1510091054
Python
Python (3.4.3)
py
Runtime Error
1993
22720
1023
n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 a.sort() b.sort() c.sort() for y in range(n): if a[n-1] <= b[y]: a_ans = n elif a[0] > b[y]: a_ans = 0 else: left = 0 right = n while T...
s734101716
p03557
u058240079
1509976429
Python
Python (2.7.6)
py
Runtime Error
339
24012
404
n = int(raw_input()) al = map(int, raw_input().split()) bl = map(int, raw_input().split()) cl = map(int, raw_input().split()) al.sort() bl.sort() cl.sort() l = [(0,0) for _ in range(n)] p = 0 for i, b in enumerate(bl): while cl[p] <= b: p += 1 l[i] = (b, n-p) p = n-1 s = 0 t = 0 for a in al[::-1]: w...
s256281466
p03557
u909643606
1509936117
Python
Python (3.4.3)
py
Runtime Error
326
23644
722
n=int(input()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] c=[int(i) for i in input().split()] a.sort() b.sort() c.sort() #n_max=10 n_max=10**5+2 ans=0 #a_count=[0 for i in range(n_max+1)] b_count=[0 for i in range(n_max+1)] c_count=[0 for i in range(n_max+1)] ans_count=[0 for i in range(n...
s990903641
p03557
u909643606
1509936023
Python
Python (3.4.3)
py
Runtime Error
321
23412
720
n=int(input()) a=[int(i) for i in input().split()] b=[int(i) for i in input().split()] c=[int(i) for i in input().split()] a.sort() b.sort() c.sort() #n_max=10 n_max=10**5 ans=0 #a_count=[0 for i in range(n_max+1)] b_count=[0 for i in range(n_max+1)] c_count=[0 for i in range(n_max+1)] ans_count=[0 for i in range(n_m...
s169040415
p03557
u795479967
1509926807
Python
Python (3.4.3)
py
Runtime Error
1316
23520
1424
import operator def snuke_fest(top_arr, middle_arr, bottom_arr): sorted_arrs = list(sorted(arr) for arr in (top_arr, middle_arr, bottom_arr)) del top_arr del middle_arr del bottom_arr pointers = [0] * 3 ended = [False] * 3 min_posi = [None] * len(sorted_arrs[0]) * 3 min_posi_pointer = 0...
s593785818
p03557
u795479967
1509926452
Python
Python (3.4.3)
py
Runtime Error
1307
23644
1393
import operator def snuke_fest(top_arr, middle_arr, bottom_arr): sorted_arrs = list(sorted(arr) for arr in (top_arr, middle_arr, bottom_arr)) pointers = [0] * 3 ended = [False] * 3 min_posi = [None] * len(top_arr) * 3 min_posi_pointer = 0 while not all(ended): nums = [0] * 3 min...
s483282025
p03557
u795479967
1509926214
Python
Python (3.4.3)
py
Runtime Error
1303
23892
1356
import operator def snuke_fest(top_arr, middle_arr, bottom_arr): sorted_arrs = list(sorted(arr) for arr in (top_arr, middle_arr, bottom_arr)) pointers = [0] * 3 ended = [False] * 3 min_posi = [None] * len(top_arr) * 3 min_posi_pointer = 0 while not all(ended): nums = [0] * 3 min...
s916312823
p03557
u667084803
1509926153
Python
PyPy3 (2.4.0)
py
Runtime Error
179
38384
389
=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) A.sort() B.sort() C.sort() ans=0 small=0 large=0 for i in range(N): for k in range(small,N): if A[k]>=B[i]: small=k break else: small=N for k in range(large,N): if C[k]>B[i]: ...
s987583481
p03557
u419832736
1509924386
Python
Python (3.4.3)
py
Runtime Error
2105
24224
445
N=int(input()) A=sorted(list(map(int,input().split()))) B=sorted(list(map(int,input().split()))) C=sorted(list(map(int,input().split()))) num=0 for i in range(N): j=0 while B[i]>A[j]: if j<=N-2: j += 1 else: j=N break x=j k=0 while B[i]>=C[k]: ...
s257516984
p03557
u825528847
1509913963
Python
Python (3.4.3)
py
Runtime Error
17
2940
231
import bisect N = int(input()) A = sorted(map(int, input().split())) B = list(map(int, input().split())) C = sorted(map(int, input().split())) print(sum(len(A[:bisect.bisect_left(A, b)]) * len(C[bisect.bisect(C, b)]) b for b in B))
s707855773
p03557
u499259667
1509859228
Python
Python (2.7.6)
py
Runtime Error
12
2692
421
import numpy as np import bisect a=int(raw_input()) Ali = np.array( map(int,raw_input().split())) Bli =np.array(map(int,raw_input().split())) Cli =np.array(map(int,raw_input().split())) Ali = np.sort(Ali) Cli = np.sort(Cli)[::-1] co=0 for B in Bli: ca = bisect.bisect_left(Ali,B) cb =0 for C in Cli: ...
s547632565
p03557
u488497128
1509850510
Python
Python (3.4.3)
py
Runtime Error
1941
25820
970
import sys import numpy as np def binary_search(array, num): # numより真に大きいはじめのindex if array[-1] <= num: return -1 left = -1 right = N-1 while right - left > 1: mid = int((left + right)/2) if array[mid] <= num: left = mid else: right = mid ...
s576942125
p03557
u125205981
1509850413
Python
Python (3.4.3)
py
Runtime Error
2104
23224
344
def main(): N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) C = tuple(map(int, input().split())) b = [0] * 100002 for i in B: b[i] += 1 cnt = 0 for i in A: for j in C: if i < j: cnt += sum(b[i+1:j]) ...
s784729332
p03557
u938819936
1509849712
Python
Python (3.4.3)
py
Runtime Error
2105
24180
595
import bisect N = int(input()) a = sorted(map(int, input().split())) lst = [sorted(map(int, input().split())), sorted(map(int, input().split()))] memo = [[-1] * N, [-1] * N] def find(key, itr): idx = bisect.bisect_right(lst[itr], key) if memo[itr][idx] < 0: memo[itr][idx] = 0 cur = idx ...
s430724669
p03557
u867069435
1509849600
Python
Python (3.4.3)
py
Runtime Error
2109
31484
546
import numpy as np long = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 a.sort() b.sort() c.sort() ble = np.array for i in range(len(b)): for k in range(len(c)): if b[i] < c[k]: np.append(ble, int(len(c) - k)) ...
s589227783
p03557
u792547805
1509849596
Python
Python (3.4.3)
py
Runtime Error
2109
72972
403
n = int(input()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] C = [int(i) for i in input().split()] count_1 = 0 count_2 = 0 X = [] for i in range(n): for j in range(n): if A[i] < B[j]: count_1 += 1 X.append(B[j]) all = n*n for j in len(X): for k in ...
s540305909
p03557
u867069435
1509849593
Python
Python (3.4.3)
py
Runtime Error
2109
31484
546
import numpy as np long = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 a.sort() b.sort() c.sort() ble = np.array for i in range(len(b)): for k in range(len(c)): if b[i] < c[k]: np.append(ble, int(len(c) - k)) ...
s484371538
p03557
u023041408
1509849546
Python
Python (3.4.3)
py
Runtime Error
2104
23220
1263
import sys N = int(sys.stdin.readline()) As= list(map(int, sys.stdin.readline().rstrip().split(" "))) Bs= list(map(int, sys.stdin.readline().rstrip().split(" "))) Cs= list(map(int, sys.stdin.readline().rstrip().split(" "))) As = sorted(As) Bs = sorted(Bs) Cs = sorted(Cs) Amin = min(As) Amax = max(As) Bs = list(filt...
s084378906
p03557
u833492079
1509849334
Python
Python (3.4.3)
py
Runtime Error
464
23232
676
N = int(input()) A = [int(i) for i in input().split()] # 1 2 3 4 5 ... B = [int(i) for i in input().split()] # 1 2 3 4 5 ... C = [int(i) for i in input().split()] # 1 2 3 4 5 ... A.sort() B.sort() C.sort() #print(A) #print(B) #print(C) ##exit(0) ab=[0]*N bc=[0]*N b=N-1 c=N-1 count=0 while (0<=b): while (0<=c): i...
s886154629
p03557
u867069435
1509849170
Python
Python (3.4.3)
py
Runtime Error
2105
43584
696
long = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) ans = 0 while min(b) <= min(a): b.remove(min(b)) while min(c) <= min(b): c.remove(min(c)) while max(b) >= max(c): b.remove(max(b)) while max(a) >= max(b): a.remove(max(a)) a.s...
s152985366
p03557
u943004959
1509847695
Python
PyPy3 (2.4.0)
py
Runtime Error
2136
718956
733
#!/usr/bin/python # -*- coding: utf-8 -*- import sys import os import itertools from collections import OrderedDict, deque, Counter from bisect import bisect_left, bisect_right, insort_left, insort_right sys.setrecursionlimit(10000) def solve(): N = int(input()) A = deque() B = deque() C = deque() ...
s463877801
p03557
u062864034
1509847233
Python
Python (3.4.3)
py
Runtime Error
2105
22452
398
N = int(input()) A = sorted([int(i) for i in input().split()]) B = sorted([int(i) for i in input().split()]) C = sorted([int(i) for i in input().split()]) B_list = [] for i,b in enumerate(B): for j,c in enumerate(C): if b < c: B_list[i] = len(C)-j break res = 0 for i,b in enumerat...
s946158101
p03557
u007808656
1509847199
Python
PyPy3 (2.4.0)
py
Runtime Error
268
63984
493
n=int(input()) array_a=sorted([a for a in map(int, input().split())])+[inf] array_b=sorted([a for a in map(int, input().split())])+[inf] array_c=sorted([a for a in map(int, input().split())]) nums_b=[0 for _ in range(n)] cur=0 for (idx,b) in enumerate(array_b[:-1]): while(array_a[cur]<b): cur+=1 nums_b[...
s623844322
p03557
u498631675
1509846852
Python
Python (2.7.6)
py
Runtime Error
2105
26076
278
# -*- coding: utf-8 -*- import itertools N = input() A = map(int, raw_input().split()) B = map(int, raw_input().split()) C = map(int, raw_input().split()) for i, j, k in itertools.product(range(N), range(N), range(N)): if A[i]<B[j]<C[k]: count+=1 print count
s244679024
p03557
u498631675
1509846730
Python
Python (2.7.6)
py
Runtime Error
2105
22132
314
# -*- coding: utf-8 -*- import itertools N = input() A = map(int, raw_input().split()) B = map(int, raw_input().split()) C = map(int, raw_input().split()) for i, j in itertools.product(range(N), range(N)): if A[i]<B[j]: for k in range(N): if C[k]>j: count+=1 print count
s467365272
p03557
u891827776
1509846576
Python
Python (3.4.3)
py
Runtime Error
17
3064
333
import sys num_of_parts = int (raw_input()) A = map(int, raw_input().split()) B = map(int, raw_input().split()) C = map(int, raw_input().split()) n = 0 #initialize for a in A: filtered_B = filter(lambda x:x > a, B) for b in filtered_B: filtered_C = filter(lambda x:x > b, C) n += len(filtered_...
s167372517
p03557
u779602548
1509846470
Python
Python (3.4.3)
py
Runtime Error
2105
24056
500
#http://abc077.contest.atcoder.jp/ # -*- coding: utf-8 -*- n = int(input()) a = sorted(list(map(int,input().split()))) b = sorted(list(map(int,input().split()))) c = sorted(list(map(int,input().split()))) for i,v in enumerate(b[:]): if v <= a[0]: b.pop(i) for i,v in enumerate(c[:]): if v <= a[0] or v <= b[0]:...
s389314317
p03557
u330205771
1509846041
Python
Python (3.4.3)
py
Runtime Error
199
15496
725
N = int(input()) A = list(map(int, input().split())).sort() B = list(map(int, input().split())).sort() C = list(map(int, input().split())).sort() def extract(M): Md = [] Mc = [] for m in M: try: f = Md.index(m) Mc[f] += 1 except ValueError: Md.append(m) ...
s197891584
p03557
u857148155
1509845776
Python
Python (3.4.3)
py
Runtime Error
2105
24564
539
n=int(input()) pa,pb,pc=[sorted([int(s)for s in input().split(" ")])for i in range(3)] pnb,pna=[[0 for i in range(n)]for j in range(2)] i=0 while i<n: j=0 while j<n: if pa[j]>=pb[i]: pna[i]=j i+=1 continue j+=1 pna[i]=n i+=1 i=0 while i<n: j=0 ...
s002135239
p03557
u448351882
1509845334
Python
Python (3.4.3)
py
Runtime Error
2105
23248
600
# coding: utf-8 import math n = int(input()) tops = list(map(int, input().split())) middles = list(map(int, input().split())) lowers = list(map(int, input().split())) max_lower = max(lowers) middles = list(filter(lambda x: x < max_lower, middles)) max_middle = max(middles) tops = list(filter(lambda x: x < max_midd...
s822718302
p03557
u779602548
1509845126
Python
Python (3.4.3)
py
Runtime Error
2105
23744
482
#http://abc077.contest.atcoder.jp/ # -*- coding: utf-8 -*- n = int(input()) a = sorted(list(map(int,input().split()))) b = list(map(int,input().split())) c = list(map(int,input().split())) for i,v in enumerate(b[:]): if v <= a[0]: b.pop(i) for i,v in enumerate(c[:]): if v <= a[0] or v <= b[0]: c.pop(i) count...
s522755446
p03558
u119148115
1596895799
Python
PyPy3 (7.3.0)
py
Runtime Error
309
95528
610
import sys def I(): return int(sys.stdin.readline().rstrip()) K = I() Graph = [0]*K for i in range(K): if (i+1) % K != (10*i) % K: Graph[i] = [(1,(i+1) % K),(0,(10*i) % K)] # 1を加える,10倍する else: Graph[i] = [(0,(10*i) % K)] # dijkstra from heapq import heappush,heappop d = [100]*K d[1] = 1 q ...
s495072111
p03558
u533039576
1594693710
Python
Python (3.8.2)
py
Runtime Error
318
42508
785
from heapq import heappush, heappop def dijkstra(graph: list, n: int, v_s: int, INF: int = float('inf')) -> list: # graph[v_from] = [(cost, v_to), ...] dist = [INF] * n dist[v_s] = 0 heap = [(0, v_s)] # heap = [(dist[v], v), ...] while heap: dist2v, v_from = heappop(heap) if dist...
s573774674
p03558
u533039576
1594693590
Python
Python (3.8.2)
py
Runtime Error
311
41852
785
from heapq import heappush, heappop def dijkstra(graph: list, n: int, v_s: int, INF: int = float('inf')) -> list: # graph[v_from] = [(cost, v_to), ...] dist = [INF] * n dist[v_s] = 0 heap = [(0, v_s)] # heap = [(dist[v], v), ...] while heap: dist2v, v_from = heappop(heap) if dist...
s121124707
p03558
u488401358
1587790518
Python
PyPy3 (2.4.0)
py
Runtime Error
241
42608
292
K=int(input()) if K%10==0: print(1) else: mod=set([]) i=0 while pow(10,i,K) not in mod: mod.add(pow(10,i,K)) i+=1 mod=list(mod) mod.sort(reverse=True) ans=0 for i in range(0,len(mod)): ans+=K//mod[i] K%=mod[i] print(ans)
s360275321
p03558
u007550226
1586541744
Python
Python (3.4.3)
py
Runtime Error
18
3064
956
import heapq def main(): if k==2:print(1) elif k==3:print(3) elif k==8:print(1) elif k==9:print(9) else: brdict = {} for i in range(1,k): if i==k-1:brdict[i] = [(0,1)] else: brdict[i] = [((i*10)%k,0)] if (i*10)%k!=i+1:brdict[i] ...
s378394899
p03558
u007550226
1586541102
Python
Python (3.4.3)
py
Runtime Error
425
48364
783
import heapq def main(): k=int(input()) brdict = {} for i in range(1,k): if i==k-1:brdict[i] = [(0,1)] else: brdict[i] = [((i*10)%k,0)] if (i*10)%k!=i+1:brdict[i] += [(i+1,1)] start=1 cost=[i for i in range(k)] cost[0]=k fixed=[False]*k fixed[start...
s909914066
p03558
u237316771
1585592915
Python
Python (3.4.3)
py
Runtime Error
174
16240
1177
#!/usr/bin/env python3 from collections import deque import sys try: from typing import Deque, List except ImportError: pass def solve(K: int): pars = list(range(K)) def union(a: int, b: int): pars[a] = b def getpar(a: int): if pars[a] == a: return a pars[a] =...
s086836854
p03558
u237316771
1585592864
Python
Python (3.4.3)
py
Runtime Error
174
16244
1173
#!/usr/bin/env python3 from collections import deque import sys try: from typing import Deque, List except ImportError: pass def solve(K: int): pars = list(range(K)) def union(a: int, b: int): pars[a] = b def getpar(a: int): if pars[a] == a: return a pars[a] =...
s055764025
p03558
u831752983
1578675588
Python
Python (3.4.3)
py
Runtime Error
17
2940
128
def bi_power(n): rtn=0 while n%2==0: n//=2 rtn+=1 return rtn n=int(input()) print(n//=bi_power(n))
s813404368
p03558
u754022296
1571965750
Python
PyPy3 (2.4.0)
py
Runtime Error
170
38256
153
= input() c = 0 for i in n: c += int(i) for i in range(1,10**7): d = 0 l = str(int(n)*(i+1)) for j in l: d += int(j) c = min(c, d) print(c)
s438587044
p03558
u332906195
1565509323
Python
Python (3.4.3)
py
Runtime Error
22
3316
323
import collections N = int(input()) q = collections.deque([(1, 0)]) v = {1} while len(q) > 0: c, p = deque.popleft() v.add(c) if c == 0: break n1, n10 = (c + 1) % N, (c * 10) % n if not n1 in v: q.append((n1, p + 1)) if not n10 in v: q.appendleft((n10, p)) print(p + ...
s173807432
p03558
u332906195
1565509282
Python
PyPy3 (2.4.0)
py
Runtime Error
171
38384
323
import collections N = int(input()) q = collections.deque([(1, 0)]) v = {1} while len(q) > 0: c, p = deque.popleft() v.add(c) if c == 0: break n1, n10 = (c + 1) % N, (c * 10) % n if not n1 in v: q.append((n1, p + 1)) if not n10 in v: q.appendleft((n10, p)) print(p + ...
s694760996
p03558
u497596438
1559974828
Python
PyPy3 (2.4.0)
py
Runtime Error
193
55152
390
K=int(input()) G=[[(1,(i+1)%K)] for i in range(K)] for i in range(K): a=(i*10)%K G[i].append((0,a)) stack=list(G[1]) heapq.heapify(stack) reached=[0]*K reached[1]=1 while(stack): c,g=heapq.heappop(stack) if g==0: print(c+1) quit() reached[g]=1 for i in G[g]: if reached[i[...
s733460090
p03558
u497596438
1559960420
Python
PyPy3 (2.4.0)
py
Runtime Error
180
38640
442
from math import log K=int(input()) N=K def func(N): res=0 while(N!=0): res+=N%10 N//=10 return res ans=func(K) if ans==1: print(ans) quit() n=ceil(log(K,10)) MOD=10**(n) K=K*(ceil((10**n)/K)) ans=min(ans,func(K)) used=[0]*N K%=MOD K*=10 while(True): K%=N if K==0: pri...
s091218762
p03558
u904804404
1559134610
Python
Python (3.4.3)
py
Runtime Error
17
2940
381
k = int(input()) from collections import deque d = deque([1]) discovered = {1:1} while true: q = d.popleft() if q == 0: print(discovered[q]) quit() if (q*10)%k not in discovered: if (q*10)%k == 0: d.appendleft((q*10)%k) discovered[(q*10)%k] = discovered[q] if q+1 not in discoverd: ...
s201519540
p03558
u844005364
1559098391
Python
Python (3.4.3)
py
Runtime Error
17
3064
682
import heapq def small_multiple(k): # kの倍数で各桁の総数が最も小さくなるような、各桁の総数 dist = [float("inf")] * k q = [] # kで割った余りが1になるような最小の数は1 heapq.heappush(q, (1, 1)) while q: n, c = heapq.heappop(q) if dist[n] <= c: continue print(n, c) dist[n] = c if dis...
s530758555
p03558
u844005364
1559098328
Python
Python (3.4.3)
py
Runtime Error
17
3064
675
import heapq def small_multiple(k): # kの倍数で各桁の総数が最も小さくなるような、各桁の総数 dist = [float("inf")] * k q = [] # kで割った余りが1になるような最小の数は1 heapq.heappush(q, (1, 1)) while q: n, c = heapq.heappop(q) if dist[n] <= c: continue print(n, c) dist[n] = c if dist[...
s768087988
p03558
u794173881
1553324048
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38436
263
k = int(input()) def sum_keta(num): ans = 0 for i in str(num): ans = ans + int(i) return ans min_sum_keta = float("inf") limit = k*10**len(str(k)+1) add = k while k < limit: min_sum_keta = min(min_sum_keta,sum_keta(k)) k += add print(min_sum_keta)
s767617257
p03558
u826263061
1540053234
Python
Python (3.4.3)
py
Runtime Error
17
2940
146
k = int(input()) ans= 10*10 for i in range(2,10*5): o = list(str(i*k)) sumorder = sum(o) if sumorder < ans: ans = sumorder print(ans)
s973863615
p03558
u631277801
1539168947
Python
PyPy3 (2.4.0)
py
Runtime Error
2110
127724
925
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s560811278
p03558
u631277801
1539168764
Python
PyPy3 (2.4.0)
py
Runtime Error
2109
121452
856
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s126718297
p03558
u631277801
1539168603
Python
Python (3.4.3)
py
Runtime Error
2104
7768
940
import sys stdin = sys.stdin sys.setrecursionlimit(10**5) def li(): return map(int, stdin.readline().split()) def li_(): return map(lambda x: int(x)-1, stdin.readline().split()) def lf(): return map(float, stdin.readline().split()) def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip(...
s638642831
p03558
u422104747
1535315967
Python
PyPy3 (2.4.0)
py
Runtime Error
169
38460
266
import time begin=time.monotonic() def sum(i): s=str(i) ret=0 for c in s: ret+=int(c) return ret n=int(input()) res=sum(n) i=2 while True: x=n*i res=min(res,sum(x)) i+=1 if time.monotonic()-begin>1.9: break print(res)
s177844740
p03558
u846150137
1533611058
Python
Python (3.4.3)
py
Runtime Error
2104
3460
178
ktw=lambda x:sum(int(i) for i in str(x)) a=int(input()) while True: if a % 2 !=0: a/=2 else: break m=ktw(a) for i in range(2,10**5): a*=i m=min(m,ktw(m)) print(m)
s573333179
p03558
u419686324
1533005716
Python
Python (3.4.3)
py
Runtime Error
23
3572
525
import bisect, functools N = int(input()) A = sorted(int(x) for x in input().split()) B = sorted(int(x) for x in input().split()) C = sorted(int(x) for x in input().split()) @functools.lru_cache(maxsize=None) def a(n): return bisect.bisect_left(A, n) @functools.lru_cache(maxsize=None) def b_i(i): if i >= 1: ...
s951966639
p03558
u033378815
1520876093
Python
Python (3.4.3)
py
Runtime Error
18
2940
360
import heapq as hq INF = 10_0000_0007 K = int(input()) dist = [INF for _ in range(K)] h = [] hq.heappush(h, (1, 1)) while h: v, c = hq.heappop(h) if dist[v] <= c: continue dist[v] = c if dist[(v+1)%K] > c+1: hq.heappush(h, ((v+1)%K, c+1)) if dist[(v*10)%K] > c: hq.he...
s429305859
p03558
u562016607
1520806121
Python
PyPy3 (2.4.0)
py
Runtime Error
175
38384
349
# coding: utf-8 # Your code here! from datetime import datetime K = int(input()) start = datetime.now() def KSum(n): k = 0 for i in str(n): k += int(i) return k m = KSum(K) j = 1 while((datetime.now()-start).total_seconds() < 1.8): for x in range(100): P = KSum(K*j) if m > P: ...
s127601263
p03558
u562016607
1520806039
Python
PyPy3 (2.4.0)
py
Runtime Error
168
38384
313
from datetime import datetime K = int(input()) start = datetime.now() def KSum(n): k = 0 for i in str(n): k += int(i) return k m = KSum(K) j = 1 while((datetime.now()-start).total_seconds() < 1.8): for x in range(100): P = KSum(K*j) if m > P: m = P j += 1 print(m)
s067355457
p03558
u863370423
1517445642
Python
Python (2.7.6)
py
Runtime Error
10
2568
723
#include <iostream> #include <string> #include <cstdio> #include <vector> #include <queue> #include <list> #include <cstdlib> #include <algorithm> #include <set> #include <map> #include <deque> #include <cstring> #include <cmath> //#include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; const int SIZE=1...
s938091207
p03558
u550574002
1514657320
Python
Python (3.4.3)
py
Runtime Error
2104
5548
337
k=int(input()) while k%2 == 0: k //=2 while k%5 == 0: k //=5 lst = [k+1]*k queue = [1] lst[1] = 1 while queue: a = queue.pop(0) if lst[a*10%k] > lst[a]: lst[a*10%k] = lst[a] queue.insert(0,a*10%k) if lst[(a+1)%k]>= lst[a]+1: lst[(a+1)%k] = lst[a]+1 queue.append((a+1)...
s005697365
p03558
u846150137
1514652677
Python
Python (3.4.3)
py
Runtime Error
536
3064
323
a=int(input()) x1=0 x2=0 for j in range(1,17): if a % 2**j==0: x1 = j for j in range(1,17): if a % 5**j==0: x2 = j c = str(a * (5**(x1-x2))) for j in range(len(c),0,-1): if c[j-1]=='0': c=c[:j] y=10000000000000 for j in range(1,1000): b=sum([int(i) for i in list(str(c * j))]) y=min(y , b) print...
s730009436
p03558
u846150137
1514652561
Python
Python (3.4.3)
py
Runtime Error
437
3064
317
a=int(input()) x=0 for j in range(1,17): if a % 2**j==0: x1 = j for j in range(1,17): if a % 5**j==0: x2 = j c = str(a * (5**(x1-x2))) for j in range(len(c),0,-1): if c[j-1]=='0': c=c[:j] y=10000000000000 for j in range(1,1000): b=sum([int(i) for i in list(str(c * j))]) y=min(y , b) print(y)
s776168794
p03558
u942788644
1511567187
Python
Python (2.7.6)
py
Runtime Error
11
2568
90
k=input() print min([sum(map(int, list(strk*i))) for i in xrange(1, 10**(len(str(k))+1))])
s365645879
p03558
u942788644
1511567131
Python
Python (2.7.6)
py
Runtime Error
10
2568
91
k=input() print min([sum(map(int, list(strk*i)))) for i in xrange(1, 10**(len(str(k))+1))])
s750152243
p03558
u795479967
1509933867
Python
Python (3.4.3)
py
Runtime Error
23
3064
646
import math def small_multiple(K): n_digits = int(math.log10(float(K))) + 1 min_val = K for i in range(int(10**n_digits)): K_m = K*(i+1) K_m_n_digits = int(math.log10(float(K_m))) + 1 val = 0 for j in range(K_m_n_digits): val += (K_m % (10**(j+1))) // (10**j) ...
s452451953
p03558
u158225062
1509850820
Python
Python (3.4.3)
py
Runtime Error
17
3064
264
# coding: utf-8 N = int(input()) array = [] X = int(100000/N) for i in range(X): Y = str(N*(i+1)) a_list = list(map(int,Y)) ddd = sum(a_list) if ddd < array[1]: array.pop(0) array.append(ddd) print(int(array[0]))