user_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
1 value
submission_id_v0
stringlengths
10
10
submission_id_v1
stringlengths
10
10
cpu_time_v0
int64
10
38.3k
cpu_time_v1
int64
0
24.7k
memory_v0
int64
2.57k
1.02M
memory_v1
int64
2.57k
869k
status_v0
stringclasses
1 value
status_v1
stringclasses
1 value
improvement_frac
float64
7.51
100
input
stringlengths
20
4.55k
target
stringlengths
17
3.34k
code_v0_loc
int64
1
148
code_v1_loc
int64
1
184
code_v0_num_chars
int64
13
4.55k
code_v1_num_chars
int64
14
3.34k
code_v0_no_empty_lines
stringlengths
21
6.88k
code_v1_no_empty_lines
stringlengths
20
4.93k
code_same
bool
1 class
relative_loc_diff_percent
float64
0
79.8
diff
list
diff_only_import_comment
bool
1 class
measured_runtime_v0
float64
0.01
4.45
measured_runtime_v1
float64
0.01
4.31
runtime_lift
float64
0
359
key
list
u645250356
p02697
python
s775942056
s325788867
192
109
86,384
13,844
Accepted
Accepted
43.23
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(m...
27
23
626
579
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify from bisect import bisect_left, bisect_right import sys, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): ...
false
14.814815
[ "- ge.append([l, r])", "+ ge.append(l)", "- ge.append([r, l])", "+ ge.append(r)", "-# print(ge)", "-x = 1", "- a, b = ge[i]", "- print((x, x + a))", "- x += 1", "+ print((i + 1, i + 1 + ge[i]))" ]
false
0.038119
0.039526
0.964402
[ "s775942056", "s325788867" ]
u254871849
p02807
python
s573253185
s738532669
528
161
23,316
26,724
Accepted
Accepted
69.51
import sys MOD = 10 ** 9 + 7 def make_table(size=10**6, p=MOD): fac = [None] * (size + 1) fac[0] = 1 for i in range(size): fac[i+1] = fac[i] * (i + 1) % p ifac = [None] * (size + 1) ifac[size] = pow(fac[size], p-2, p) for i in range(size, 0, -1): ifac[i-1] = ifac[i]...
import sys MOD = 10 ** 9 + 7 def make_table(size=10**6, p=MOD): fac = [None] * (size + 1) fac[0] = 1 for i in range(size): fac[i+1] = fac[i] * (i + 1) % p ifac = [None] * (size + 1) ifac[size] = pow(fac[size], p-2, p) for i in range(size, 0, -1): ifac[i-1] = ifac[i]...
41
41
946
975
import sys MOD = 10**9 + 7 def make_table(size=10**6, p=MOD): fac = [None] * (size + 1) fac[0] = 1 for i in range(size): fac[i + 1] = fac[i] * (i + 1) % p ifac = [None] * (size + 1) ifac[size] = pow(fac[size], p - 2, p) for i in range(size, 0, -1): ifac[i - 1] = ifac[i] * i % ...
import sys MOD = 10**9 + 7 def make_table(size=10**6, p=MOD): fac = [None] * (size + 1) fac[0] = 1 for i in range(size): fac[i + 1] = fac[i] * (i + 1) % p ifac = [None] * (size + 1) ifac[size] = pow(fac[size], p - 2, p) for i in range(size, 0, -1): ifac[i - 1] = ifac[i] * i % ...
false
0
[ "- return fac, ifac", "+ icumsum = [None] * (size + 1)", "+ icumsum[1] = 1", "+ for i in range(1, size):", "+ icumsum[i + 1] = (icumsum[i] + fac[i] * ifac[i + 1]) % MOD", "+ return fac, ifac, icumsum", "-fac, ifac = make_table(10**5)", "+fac, ifac, icumsum = make_table(10**5)", ...
false
0.110082
0.269352
0.408692
[ "s573253185", "s738532669" ]
u347640436
p03295
python
s504856005
s505207762
589
211
30,564
23,176
Accepted
Accepted
64.18
# Segment tree (Sum) class SegmentTree(): _data = [] _offset = 0 _size = 0 def __init__(self, size): _size = size t = 1 while t < size: t *= 2 self._offset = t - 1 self._data = [0 for _ in range(t * 2 - 1)] def update(self, index, v...
from sys import stdin readline = stdin.readline N, M = list(map(int, readline().split())) ab = [[] for _ in range(N + 1)] for _ in range(M): a, b = list(map(int, readline().split())) ab[a].append(b) dp = [0] * (N + 1) for i in range(1, N + 1): dp[i] = max(dp[i], dp[i - 1]) for j in ab[i]...
52
17
1,271
365
# Segment tree (Sum) class SegmentTree: _data = [] _offset = 0 _size = 0 def __init__(self, size): _size = size t = 1 while t < size: t *= 2 self._offset = t - 1 self._data = [0 for _ in range(t * 2 - 1)] def update(self, index, value): i...
from sys import stdin readline = stdin.readline N, M = list(map(int, readline().split())) ab = [[] for _ in range(N + 1)] for _ in range(M): a, b = list(map(int, readline().split())) ab[a].append(b) dp = [0] * (N + 1) for i in range(1, N + 1): dp[i] = max(dp[i], dp[i - 1]) for j in ab[i]: dp[j]...
false
67.307692
[ "-# Segment tree (Sum)", "-class SegmentTree:", "- _data = []", "- _offset = 0", "- _size = 0", "-", "- def __init__(self, size):", "- _size = size", "- t = 1", "- while t < size:", "- t *= 2", "- self._offset = t - 1", "- self._data ...
false
0.035927
0.154516
0.232513
[ "s504856005", "s505207762" ]
u729417323
p03013
python
s722326710
s551022457
1,668
185
7,056
11,964
Accepted
Accepted
88.91
# --*-coding:utf-8-*-- MOD = 1000000007 def f(N, A): A.append(-1) a = A.pop(0) c0 = 0 c1 = 1 for i in range(1, N+1): c0, c1 = c1, (c0+c1)%MOD if i == a: c1 = 0 a = A.pop(0) return c1 def main(): N,M = lis...
# --*-coding:utf-8-*-- MOD = 1000000007 def f(N, A): c0 = 0 c1 = 1 for i in range(1, N+1): c0, c1 = c1, (c0+c1)%MOD if i in A: c1 = 0 return c1 def main(): N,M = list(map(int, input().split())) A = set(int(eval(input())) for i...
32
26
451
386
# --*-coding:utf-8-*-- MOD = 1000000007 def f(N, A): A.append(-1) a = A.pop(0) c0 = 0 c1 = 1 for i in range(1, N + 1): c0, c1 = c1, (c0 + c1) % MOD if i == a: c1 = 0 a = A.pop(0) return c1 def main(): N, M = list(map(int, input().split())) A =...
# --*-coding:utf-8-*-- MOD = 1000000007 def f(N, A): c0 = 0 c1 = 1 for i in range(1, N + 1): c0, c1 = c1, (c0 + c1) % MOD if i in A: c1 = 0 return c1 def main(): N, M = list(map(int, input().split())) A = set(int(eval(input())) for i in range(M)) print((f(N, ...
false
18.75
[ "- A.append(-1)", "- a = A.pop(0)", "- if i == a:", "+ if i in A:", "- a = A.pop(0)", "- A = [int(eval(input())) for i in range(M)]", "+ A = set(int(eval(input())) for i in range(M))" ]
false
0.039707
0.035925
1.105275
[ "s722326710", "s551022457" ]
u644907318
p03436
python
s554295216
s975322819
1,087
26
4,212
3,568
Accepted
Accepted
97.61
INFTY = 1000 H,W = list(map(int,input().split())) S = [["#" for _ in range(W+2)]] for i in range(H): row = list(eval(input())) row.insert(0,"#") row.append("#") S.append(row) S.append(["#" for _ in range(W+2)]) G = {(i,j):[] for i in range(1,H+1) for j in range(1,W+1)} for i in range(1,H+1): ...
from collections import deque INFTY = 10**4 H,W = list(map(int,input().split())) S = [input().strip() for _ in range(H)] cnt = 0 for i in range(H): for j in range(W): if S[i][j]==".": cnt += 1 dist = [[INFTY for _ in range(W)] for _ in range(H)] hist = [[0 for _ in range(W)] for _ in r...
52
35
1,490
1,067
INFTY = 1000 H, W = list(map(int, input().split())) S = [["#" for _ in range(W + 2)]] for i in range(H): row = list(eval(input())) row.insert(0, "#") row.append("#") S.append(row) S.append(["#" for _ in range(W + 2)]) G = {(i, j): [] for i in range(1, H + 1) for j in range(1, W + 1)} for i in range(1, H...
from collections import deque INFTY = 10**4 H, W = list(map(int, input().split())) S = [input().strip() for _ in range(H)] cnt = 0 for i in range(H): for j in range(W): if S[i][j] == ".": cnt += 1 dist = [[INFTY for _ in range(W)] for _ in range(H)] hist = [[0 for _ in range(W)] for _ in range(...
false
32.692308
[ "-INFTY = 1000", "+from collections import deque", "+", "+INFTY = 10**4", "-S = [[\"#\" for _ in range(W + 2)]]", "+S = [input().strip() for _ in range(H)]", "+cnt = 0", "- row = list(eval(input()))", "- row.insert(0, \"#\")", "- row.append(\"#\")", "- S.append(row)", "-S.append([\...
false
0.045981
0.042241
1.088535
[ "s554295216", "s975322819" ]
u461833298
p02819
python
s982344542
s632190642
30
17
2,940
3,064
Accepted
Accepted
43.33
X = int(eval(input())) while True: flg=True for i in range(2, X): if X%i!=0: continue flg=False break if flg: print(X) break else: X+=1 continue
import math X = int(eval(input())) Y = int(math.sqrt(X)) while True: flg=True for i in range(2, Y): if X%i!=0: continue flg=False break if flg: print(X) break else: X+=1 continue
15
16
237
271
X = int(eval(input())) while True: flg = True for i in range(2, X): if X % i != 0: continue flg = False break if flg: print(X) break else: X += 1 continue
import math X = int(eval(input())) Y = int(math.sqrt(X)) while True: flg = True for i in range(2, Y): if X % i != 0: continue flg = False break if flg: print(X) break else: X += 1 continue
false
6.25
[ "+import math", "+", "+Y = int(math.sqrt(X))", "- for i in range(2, X):", "+ for i in range(2, Y):" ]
false
0.043912
0.036811
1.192885
[ "s982344542", "s632190642" ]
u602677143
p03476
python
s308479064
s732440042
443
339
20,584
21,760
Accepted
Accepted
23.48
import math from itertools import accumulate def is_prime(n): if n == 1: return 0 for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return 0 return 1 Q = int(eval(input())) L = [0]*Q R = [0]*Q for i in range(Q): L[i], R[i] = list(map(int, inp...
from itertools import accumulate # エラトステネスの篩 # is_prime := 1~nが素数か否か # table := 2~nのうち素数 def sieve(n): is_prime = [True for _ in range(n)] is_prime[0] = False for i in range(2, n+1): if is_prime[i-1]: j = 2 * i while j <= n: is_prime[j-1] = Fa...
39
42
676
885
import math from itertools import accumulate def is_prime(n): if n == 1: return 0 for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return 0 return 1 Q = int(eval(input())) L = [0] * Q R = [0] * Q for i in range(Q): L[i], R[i] = list(map(int, input().split())) min_...
from itertools import accumulate # エラトステネスの篩 # is_prime := 1~nが素数か否か # table := 2~nのうち素数 def sieve(n): is_prime = [True for _ in range(n)] is_prime[0] = False for i in range(2, n + 1): if is_prime[i - 1]: j = 2 * i while j <= n: is_prime[j - 1] = False ...
false
7.142857
[ "-import math", "-", "-def is_prime(n):", "- if n == 1:", "- return 0", "- for k in range(2, int(math.sqrt(n)) + 1):", "- if n % k == 0:", "- return 0", "- return 1", "+# エラトステネスの篩", "+# is_prime := 1~nが素数か否か", "+# table := 2~nのうち素数", "+def sieve(n):", "+ ...
false
0.038074
0.043687
0.871507
[ "s308479064", "s732440042" ]
u014139588
p03759
python
s625450792
s354783180
31
26
9,104
9,008
Accepted
Accepted
16.13
a,b,c = list(map(int,input().split())) if b-a==c-b: print("YES") else: print("NO")
a,b,c = list(map(int,input().split())) print(("YES" if b-a == c-b else "NO"))
5
2
84
70
a, b, c = list(map(int, input().split())) if b - a == c - b: print("YES") else: print("NO")
a, b, c = list(map(int, input().split())) print(("YES" if b - a == c - b else "NO"))
false
60
[ "-if b - a == c - b:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+print((\"YES\" if b - a == c - b else \"NO\"))" ]
false
0.034761
0.035956
0.966757
[ "s625450792", "s354783180" ]
u644516473
p03379
python
s695756555
s577813076
205
167
30,228
26,772
Accepted
Accepted
18.54
N = int(eval(input())) X = list(map(int, input().split())) mid1, mid2 = sorted(X)[N//2-1:N//2+1] print(('\n'.join(str(mid1) if xi>mid1 else str(mid2) for xi in X)))
N = int(eval(input())) X = list(map(int, input().split())) mid1, mid2 = sorted(X)[N//2-1:N//2+1] smid1 = str(mid1) smid2 = str(mid2) print(('\n'.join(smid1 if xi>mid1 else smid2 for xi in X)))
5
7
162
192
N = int(eval(input())) X = list(map(int, input().split())) mid1, mid2 = sorted(X)[N // 2 - 1 : N // 2 + 1] print(("\n".join(str(mid1) if xi > mid1 else str(mid2) for xi in X)))
N = int(eval(input())) X = list(map(int, input().split())) mid1, mid2 = sorted(X)[N // 2 - 1 : N // 2 + 1] smid1 = str(mid1) smid2 = str(mid2) print(("\n".join(smid1 if xi > mid1 else smid2 for xi in X)))
false
28.571429
[ "-print((\"\\n\".join(str(mid1) if xi > mid1 else str(mid2) for xi in X)))", "+smid1 = str(mid1)", "+smid2 = str(mid2)", "+print((\"\\n\".join(smid1 if xi > mid1 else smid2 for xi in X)))" ]
false
0.068141
0.083467
0.816388
[ "s695756555", "s577813076" ]
u744920373
p03061
python
s175818004
s547828458
1,105
896
121,540
114,208
Accepted
Accepted
18.91
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
89
94
2,202
2,357
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
5.319149
[ "- return 0", "+ return max(a, b)", "-A = sorted(li())", "+# A = sorted(li())", "+A = li()", "+\"\"\"", "- print((max(A)))", "+ print(max(A))", "- ide_ele = max(segfunc(A[-1], A[-2]), segfunc(A[-3], A[-4]))", "+ #ide_ele = max(segfunc(A[-1], A[-2]), segfunc(A[-3], A[-4]))...
false
0.130144
0.148919
0.873921
[ "s175818004", "s547828458" ]
u169138653
p02727
python
s004928351
s942482494
436
254
23,528
23,328
Accepted
Accepted
41.74
import heapq x,y,a,b,c=list(map(int,input().split())) p=list(map(int,input().split())) q=list(map(int,input().split())) r=list(map(int,input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p=p[:x] q=q[:y] heapq.heapify(p) heapq.heapify(q) for i in range(c): pp=heapq.heappop(p) ...
x,y,a,b,c=list(map(int,input().split())) p=list(map(int,input().split())) q=list(map(int,input().split())) r=list(map(int,input().split())) p.sort(reverse=True) q.sort(reverse=True) lis=p[:x]+q[:y]+r lis.sort(reverse=True) ans=0 for i in range(x+y): ans+=lis[i] print(ans)
32
12
767
280
import heapq x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) r.sort(reverse=True) p = p[:x] q = q[:y] heapq.heapify(p) heapq.heapify(q) for i in range(c): pp = heapq...
x, y, a, b, c = list(map(int, input().split())) p = list(map(int, input().split())) q = list(map(int, input().split())) r = list(map(int, input().split())) p.sort(reverse=True) q.sort(reverse=True) lis = p[:x] + q[:y] + r lis.sort(reverse=True) ans = 0 for i in range(x + y): ans += lis[i] print(ans)
false
62.5
[ "-import heapq", "-", "-r.sort(reverse=True)", "-p = p[:x]", "-q = q[:y]", "-heapq.heapify(p)", "-heapq.heapify(q)", "-for i in range(c):", "- pp = heapq.heappop(p)", "- pq = heapq.heappop(q)", "- if pp < r[i] and pq >= r[i]:", "- heapq.heappush(p, r[i])", "- heapq.hea...
false
0.038683
0.074415
0.519823
[ "s004928351", "s942482494" ]
u540761833
p03200
python
s017431797
s459763841
62
55
4,840
3,500
Accepted
Accepted
11.29
S = list(eval(input())) c = 0 for i in range(len(S)): if S[i] == 'W': c += i sc = S.count('W') print((int(c - sc*(sc-1)//2)))
S = eval(input()) wc = 0 w = S.count('W') for i in range(len(S)): if S[i] == 'W': wc += i print((wc - w*(w-1)//2))
7
7
135
124
S = list(eval(input())) c = 0 for i in range(len(S)): if S[i] == "W": c += i sc = S.count("W") print((int(c - sc * (sc - 1) // 2)))
S = eval(input()) wc = 0 w = S.count("W") for i in range(len(S)): if S[i] == "W": wc += i print((wc - w * (w - 1) // 2))
false
0
[ "-S = list(eval(input()))", "-c = 0", "+S = eval(input())", "+wc = 0", "+w = S.count(\"W\")", "- c += i", "-sc = S.count(\"W\")", "-print((int(c - sc * (sc - 1) // 2)))", "+ wc += i", "+print((wc - w * (w - 1) // 2))" ]
false
0.035045
0.03495
1.002739
[ "s017431797", "s459763841" ]
u394731058
p03220
python
s476412887
s392331707
20
18
3,188
3,060
Accepted
Accepted
10
import sys input = sys.stdin.readline def main(): ans = 0 N = int(eval(input())) T, A = list(map(int, input().split())) h = list(map(int, input().split())) temp = float('inf') for i in range(N): d = T - h[i]*0.006 if abs(A - temp) > abs(A - d): temp = ...
import sys input = sys.stdin.readline def main(): l = [] N = int(eval(input())) T, A = list(map(int, input().split())) h = list(map(int, input().split())) for i in range(N): l.append(abs(A-(T-h[i]*0.006))) print((l.index(min(l))+1)) if __name__ == '__main__': main()
19
15
390
304
import sys input = sys.stdin.readline def main(): ans = 0 N = int(eval(input())) T, A = list(map(int, input().split())) h = list(map(int, input().split())) temp = float("inf") for i in range(N): d = T - h[i] * 0.006 if abs(A - temp) > abs(A - d): temp = d ...
import sys input = sys.stdin.readline def main(): l = [] N = int(eval(input())) T, A = list(map(int, input().split())) h = list(map(int, input().split())) for i in range(N): l.append(abs(A - (T - h[i] * 0.006))) print((l.index(min(l)) + 1)) if __name__ == "__main__": main()
false
21.052632
[ "- ans = 0", "+ l = []", "- temp = float(\"inf\")", "- d = T - h[i] * 0.006", "- if abs(A - temp) > abs(A - d):", "- temp = d", "- ans = i + 1", "- print(ans)", "+ l.append(abs(A - (T - h[i] * 0.006)))", "+ print((l.index(min(l)) + 1))" ]
false
0.039313
0.038335
1.025516
[ "s476412887", "s392331707" ]
u077291787
p03575
python
s641242246
s686313865
31
19
3,572
3,192
Accepted
Accepted
38.71
# ABC075C - Bridge # find the number of bridges in a given undirected connected graph # bridge := an edge whose removal disconnects a graph import sys from copy import deepcopy input = sys.stdin.readline sys.setrecursionlimit(10 ** 9) def dfs(v: int) -> None: seen[v] = 1 # make vertex v searched ...
# ABC075C - Bridge # find the number of bridges in a given undirected connected graph # bridge := an edge whose removal disconnects a graph def dfs(start: int) -> None: seen[start] = 1 # make vertex v searched stack = [start] while stack: v = stack.pop() for u in g[v]: ...
38
32
1,010
954
# ABC075C - Bridge # find the number of bridges in a given undirected connected graph # bridge := an edge whose removal disconnects a graph import sys from copy import deepcopy input = sys.stdin.readline sys.setrecursionlimit(10**9) def dfs(v: int) -> None: seen[v] = 1 # make vertex v searched for u in g[v]...
# ABC075C - Bridge # find the number of bridges in a given undirected connected graph # bridge := an edge whose removal disconnects a graph def dfs(start: int) -> None: seen[start] = 1 # make vertex v searched stack = [start] while stack: v = stack.pop() for u in g[v]: if not se...
false
15.789474
[ "-import sys", "-from copy import deepcopy", "-", "-input = sys.stdin.readline", "-sys.setrecursionlimit(10**9)", "-", "-", "-def dfs(v: int) -> None:", "- seen[v] = 1 # make vertex v searched", "- for u in g[v]:", "- if not seen[u]:", "- dfs(u)", "+def dfs(start: in...
false
0.039539
0.062949
0.628111
[ "s641242246", "s686313865" ]
u532966492
p02815
python
s684492800
s483387012
673
222
102,256
27,108
Accepted
Accepted
67.01
def main(): n=int(eval(input())) a=list(map(int,input().split())) mod=10**9+7 if n==1: print((2*a[0]%mod)) return a.sort(key=lambda x:-x) mod=10**9+7 ans=0 for i in range(n): ans=(ans+pow(2,n-2,mod)*a[i]*(i+2))%mod ans=ans*pow(2,n,mod)%mod pri...
def main(): n=int(eval(input())) a=list(map(int,input().split())) mod=10**9+7 if n==1: print((2*a[0]%mod)) return a.sort(key=lambda x:-x) mod=10**9+7 ans=sum([a[i]*(i+2)%mod for i in range(n)]) ans=ans*pow(2,n,mod)*pow(2,n-2,mod)%mod print(ans) main()
16
14
329
309
def main(): n = int(eval(input())) a = list(map(int, input().split())) mod = 10**9 + 7 if n == 1: print((2 * a[0] % mod)) return a.sort(key=lambda x: -x) mod = 10**9 + 7 ans = 0 for i in range(n): ans = (ans + pow(2, n - 2, mod) * a[i] * (i + 2)) % mod ans = a...
def main(): n = int(eval(input())) a = list(map(int, input().split())) mod = 10**9 + 7 if n == 1: print((2 * a[0] % mod)) return a.sort(key=lambda x: -x) mod = 10**9 + 7 ans = sum([a[i] * (i + 2) % mod for i in range(n)]) ans = ans * pow(2, n, mod) * pow(2, n - 2, mod) % ...
false
12.5
[ "- ans = 0", "- for i in range(n):", "- ans = (ans + pow(2, n - 2, mod) * a[i] * (i + 2)) % mod", "- ans = ans * pow(2, n, mod) % mod", "+ ans = sum([a[i] * (i + 2) % mod for i in range(n)])", "+ ans = ans * pow(2, n, mod) * pow(2, n - 2, mod) % mod" ]
false
0.119132
0.04547
2.61999
[ "s684492800", "s483387012" ]
u865312527
p00057
python
s622406028
s217928028
20
10
4,900
4,448
Accepted
Accepted
50
import sys dp=[0]*10001 for line in sys.stdin.readlines(): n = int(line) dp[0]=1 for i in range(1,n+1): dp[i]=dp[i-1]+i print(dp[n])
import sys for line in sys.stdin.readlines(): n = int(line) dp=1 for i in range(1,n+1): dp+=i print(dp)
8
7
162
132
import sys dp = [0] * 10001 for line in sys.stdin.readlines(): n = int(line) dp[0] = 1 for i in range(1, n + 1): dp[i] = dp[i - 1] + i print(dp[n])
import sys for line in sys.stdin.readlines(): n = int(line) dp = 1 for i in range(1, n + 1): dp += i print(dp)
false
12.5
[ "-dp = [0] * 10001", "- dp[0] = 1", "+ dp = 1", "- dp[i] = dp[i - 1] + i", "- print(dp[n])", "+ dp += i", "+ print(dp)" ]
false
0.040333
0.041842
0.963932
[ "s622406028", "s217928028" ]
u065446124
p02996
python
s485607018
s038673642
922
604
53,600
53,608
Accepted
Accepted
34.49
n=int(eval(input())) l=[list(map(int,input().split())) for i in range(n)] l.sort(key=lambda x:x[1]) t=0 for i in l: a,b=i t+=a if(t>b): print("No") break else: print("Yes")
import sys input=sys.stdin.readline n=int(eval(input())) l=[list(map(int,input().split())) for i in range(n)] l.sort(key=lambda x:x[1]) t=0 for i in l: a,b=i t+=a if(t>b): print("No") break else: print("Yes")
12
14
209
247
n = int(eval(input())) l = [list(map(int, input().split())) for i in range(n)] l.sort(key=lambda x: x[1]) t = 0 for i in l: a, b = i t += a if t > b: print("No") break else: print("Yes")
import sys input = sys.stdin.readline n = int(eval(input())) l = [list(map(int, input().split())) for i in range(n)] l.sort(key=lambda x: x[1]) t = 0 for i in l: a, b = i t += a if t > b: print("No") break else: print("Yes")
false
14.285714
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.037219
0.078845
0.472058
[ "s485607018", "s038673642" ]
u644907318
p03438
python
s071738878
s261584236
188
97
40,432
68,384
Accepted
Accepted
48.4
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) x = 0 y = 0 for i in range(N): if A[i]>B[i]: x += A[i]-B[i] else: y += (B[i]-A[i])//2 if y>=x: print("Yes") else: print("No")
N = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) sa = sum(A) sb = sum(B) if sa>sb: print("No") else: d1 = 0 d2 = 0 for i in range(N): if A[i]>B[i]: d1 += A[i]-B[i] elif B[i]>A[i]: d2 += (B[i]-A[i])//2 ...
14
19
257
378
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) x = 0 y = 0 for i in range(N): if A[i] > B[i]: x += A[i] - B[i] else: y += (B[i] - A[i]) // 2 if y >= x: print("Yes") else: print("No")
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) sa = sum(A) sb = sum(B) if sa > sb: print("No") else: d1 = 0 d2 = 0 for i in range(N): if A[i] > B[i]: d1 += A[i] - B[i] elif B[i] > A[i]: d2 += (B[i] - A[i]) // 2 i...
false
26.315789
[ "-x = 0", "-y = 0", "-for i in range(N):", "- if A[i] > B[i]:", "- x += A[i] - B[i]", "+sa = sum(A)", "+sb = sum(B)", "+if sa > sb:", "+ print(\"No\")", "+else:", "+ d1 = 0", "+ d2 = 0", "+ for i in range(N):", "+ if A[i] > B[i]:", "+ d1 += A[i] - ...
false
0.037945
0.0359
1.05696
[ "s071738878", "s261584236" ]
u211236379
p02820
python
s760490630
s500762672
215
68
49,136
4,084
Accepted
Accepted
68.37
#N = int(input()) N,K= list(map(int,input().split())) S,P,R= list(map(int,input().split())) T = list(eval(input())) #v =list(map(int,input().split())) # [list(map(int,input().split())) for i in range(N)] res =[] answer = T.count('s')*S+T.count('p')*P+T.count('r')*R l = [0]*N for i in range(K,N): if T[i]...
N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = list(eval(input())) answer = 0 for i, t in enumerate(T): if t == 's': if i - K >= 0: if T[i-K] != t: answer += R else: T[i]=0 else: ...
34
33
864
706
# N = int(input()) N, K = list(map(int, input().split())) S, P, R = list(map(int, input().split())) T = list(eval(input())) # v =list(map(int,input().split())) # [list(map(int,input().split())) for i in range(N)] res = [] answer = T.count("s") * S + T.count("p") * P + T.count("r") * R l = [0] * N for i in range(K, N): ...
N, K = list(map(int, input().split())) R, S, P = list(map(int, input().split())) T = list(eval(input())) answer = 0 for i, t in enumerate(T): if t == "s": if i - K >= 0: if T[i - K] != t: answer += R else: T[i] = 0 else: answer += R...
false
2.941176
[ "-# N = int(input())", "-S, P, R = list(map(int, input().split()))", "+R, S, P = list(map(int, input().split()))", "-# v =list(map(int,input().split()))", "-# [list(map(int,input().split())) for i in range(N)]", "-res = []", "-answer = T.count(\"s\") * S + T.count(\"p\") * P + T.count(\"r\") * R", "-l...
false
0.044814
0.098554
0.454713
[ "s760490630", "s500762672" ]
u241159583
p03971
python
s716156586
s543760906
111
78
4,016
9,288
Accepted
Accepted
29.73
N, A, B = list(map(int, input().split())) S = eval(input()) jp = 0 os = 0 for s in S: ans = "No" if jp + os < A + B: if s == "a": jp += 1 ans = "Yes" if s == "b" and os < B: os += 1 ans = "Yes" print(ans)
n,a,b = list(map(int, input().split())) s = eval(input()) cnt = 0 x = 0 for i in range(n): if s[i] == "a": if cnt < a+b: cnt += 1 print("Yes") else: print("No") elif s[i] == "b": if cnt < a+b and x+1 <= b: cnt += 1 x += 1 ...
15
17
245
379
N, A, B = list(map(int, input().split())) S = eval(input()) jp = 0 os = 0 for s in S: ans = "No" if jp + os < A + B: if s == "a": jp += 1 ans = "Yes" if s == "b" and os < B: os += 1 ans = "Yes" print(ans)
n, a, b = list(map(int, input().split())) s = eval(input()) cnt = 0 x = 0 for i in range(n): if s[i] == "a": if cnt < a + b: cnt += 1 print("Yes") else: print("No") elif s[i] == "b": if cnt < a + b and x + 1 <= b: cnt += 1 x += ...
false
11.764706
[ "-N, A, B = list(map(int, input().split()))", "-S = eval(input())", "-jp = 0", "-os = 0", "-for s in S:", "- ans = \"No\"", "- if jp + os < A + B:", "- if s == \"a\":", "- jp += 1", "- ans = \"Yes\"", "- if s == \"b\" and os < B:", "- os += ...
false
0.043413
0.039327
1.103875
[ "s716156586", "s543760906" ]
u729133443
p03425
python
s815028796
s179916527
158
46
3,828
9,900
Accepted
Accepted
70.89
from itertools import*;d=[0]*91 for _ in[0]*int(eval(input())):d[ord(input()[0])]+=1 print((sum(d[p]*d[q]*d[r]for p,q,r in combinations(list(map(ord,'MARCH')),3))))
from itertools import*;d=[0]*91 for s in open(0).readlines():d[ord(s[0])]+=1 print((sum(d[p]*d[q]*d[r]for p,q,r in combinations(list(map(ord,'MARCH')),3))))
3
3
152
150
from itertools import * d = [0] * 91 for _ in [0] * int(eval(input())): d[ord(input()[0])] += 1 print((sum(d[p] * d[q] * d[r] for p, q, r in combinations(list(map(ord, "MARCH")), 3))))
from itertools import * d = [0] * 91 for s in open(0).readlines(): d[ord(s[0])] += 1 print((sum(d[p] * d[q] * d[r] for p, q, r in combinations(list(map(ord, "MARCH")), 3))))
false
0
[ "-for _ in [0] * int(eval(input())):", "- d[ord(input()[0])] += 1", "+for s in open(0).readlines():", "+ d[ord(s[0])] += 1" ]
false
0.057129
0.055555
1.028347
[ "s815028796", "s179916527" ]
u256363575
p03308
python
s679781086
s125275759
21
19
3,060
2,940
Accepted
Accepted
9.52
N = int(eval(input())) ans = 0 A=list(map(int,input().split())) for i in range(N): for j in range(N): ans = max(ans, abs(A[i]-A[j])) print(ans)
N = int(eval(input())) ans = 0 A=list(map(int,input().split())) for i in range(N): for j in range(i,N,): ans = max(ans, abs(A[i]-A[j])) print(ans)
7
7
155
158
N = int(eval(input())) ans = 0 A = list(map(int, input().split())) for i in range(N): for j in range(N): ans = max(ans, abs(A[i] - A[j])) print(ans)
N = int(eval(input())) ans = 0 A = list(map(int, input().split())) for i in range(N): for j in range( i, N, ): ans = max(ans, abs(A[i] - A[j])) print(ans)
false
0
[ "- for j in range(N):", "+ for j in range(", "+ i,", "+ N,", "+ ):" ]
false
0.132633
0.091037
1.456905
[ "s679781086", "s125275759" ]
u887207211
p03262
python
s691635664
s365053028
82
74
14,252
14,252
Accepted
Accepted
9.76
N, X = list(map(int,input().split())) x = list(map(int,input().split())) def gcd(m, n): while n: m, n = n, m%n return m tmp = [abs(X-xx) for xx in x] ans = tmp[0] for i in range(1,N): ans = gcd(ans, tmp[i]) print(ans)
def gcd(m, n): while n: m, n = n, m%n return m def ans(): N, X = list(map(int,input().split())) x = list(map(int,input().split())) xx = [abs(X-n) for n in x] res = xx[0] for i in range(1,N): res = gcd(res, xx[i]) print(res) ans()
12
14
233
261
N, X = list(map(int, input().split())) x = list(map(int, input().split())) def gcd(m, n): while n: m, n = n, m % n return m tmp = [abs(X - xx) for xx in x] ans = tmp[0] for i in range(1, N): ans = gcd(ans, tmp[i]) print(ans)
def gcd(m, n): while n: m, n = n, m % n return m def ans(): N, X = list(map(int, input().split())) x = list(map(int, input().split())) xx = [abs(X - n) for n in x] res = xx[0] for i in range(1, N): res = gcd(res, xx[i]) print(res) ans()
false
14.285714
[ "-N, X = list(map(int, input().split()))", "-x = list(map(int, input().split()))", "-", "-", "-tmp = [abs(X - xx) for xx in x]", "-ans = tmp[0]", "-for i in range(1, N):", "- ans = gcd(ans, tmp[i])", "-print(ans)", "+def ans():", "+ N, X = list(map(int, input().split()))", "+ x = list...
false
0.041469
0.105854
0.391758
[ "s691635664", "s365053028" ]
u392319141
p03127
python
s049080501
s691976866
100
83
16,300
14,252
Accepted
Accepted
17
import fractions as fr N = int(eval(input())) A = list(map(int,input().split())) ans = A[0] for i in range(1,N) : ans = fr.gcd(ans,A[i]) if ans == 1 : break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) def gcd(n, m): if m == 0: return n return gcd(m, n % m) G = A[0] for a in A: G = gcd(G, a) print(G)
14
13
195
188
import fractions as fr N = int(eval(input())) A = list(map(int, input().split())) ans = A[0] for i in range(1, N): ans = fr.gcd(ans, A[i]) if ans == 1: break print(ans)
N = int(eval(input())) A = list(map(int, input().split())) def gcd(n, m): if m == 0: return n return gcd(m, n % m) G = A[0] for a in A: G = gcd(G, a) print(G)
false
7.142857
[ "-import fractions as fr", "-", "-ans = A[0]", "-for i in range(1, N):", "- ans = fr.gcd(ans, A[i])", "- if ans == 1:", "- break", "-print(ans)", "+", "+", "+def gcd(n, m):", "+ if m == 0:", "+ return n", "+ return gcd(m, n % m)", "+", "+", "+G = A[0]", "+...
false
0.10555
0.065976
1.599826
[ "s049080501", "s691976866" ]
u692336506
p03574
python
s940511039
s385835019
32
29
9,392
9,236
Accepted
Accepted
9.38
# 0: 下、1: 右、2: 上、3: 左、4: 右下、5: 右上、6: 左上、7: 左下 dx = [1, 0, -1, 0, 1, -1, -1, 1] dy = [0, 1, 0, -1, 1, 1, -1, -1] # 入力 H, W = map(int, input().split()) S = [input() for _ in range(H)] # Python3 では str 型の要素の書き換えはできない # 答えを格納する二次元配列を別途用意する ('.' のところは 0 とする) result = [[0 if v == '.' else '#' for v in row] for ro...
dx = [1, 0, -1, 0, 1, -1, -1, 1] dy = [0, 1, 0, -1, 1, 1, -1, -1] # 入力 H, W = list(map(int, input().split())) S = [eval(input()) for _ in range(H)] # 各マス (i, j) について順に処理 for i in range(H): for j in range(W): if S[i][j] != '.': continue counter = 0 for d in range(8)...
28
24
749
595
# 0: 下、1: 右、2: 上、3: 左、4: 右下、5: 右上、6: 左上、7: 左下 dx = [1, 0, -1, 0, 1, -1, -1, 1] dy = [0, 1, 0, -1, 1, 1, -1, -1] # 入力 H, W = map(int, input().split()) S = [input() for _ in range(H)] # Python3 では str 型の要素の書き換えはできない # 答えを格納する二次元配列を別途用意する ('.' のところは 0 とする) result = [[0 if v == "." else "#" for v in row] for row in S] # 各マ...
dx = [1, 0, -1, 0, 1, -1, -1, 1] dy = [0, 1, 0, -1, 1, 1, -1, -1] # 入力 H, W = list(map(int, input().split())) S = [eval(input()) for _ in range(H)] # 各マス (i, j) について順に処理 for i in range(H): for j in range(W): if S[i][j] != ".": continue counter = 0 for d in range(8): n...
false
14.285714
[ "-# 0: 下、1: 右、2: 上、3: 左、4: 右下、5: 右上、6: 左上、7: 左下", "-H, W = map(int, input().split())", "-S = [input() for _ in range(H)]", "-# Python3 では str 型の要素の書き換えはできない", "-# 答えを格納する二次元配列を別途用意する ('.' のところは 0 とする)", "-result = [[0 if v == \".\" else \"#\" for v in row] for row in S]", "+H, W = list(map(int, input()....
false
0.049729
0.047058
1.056755
[ "s940511039", "s385835019" ]
u761320129
p02733
python
s033834676
s852103729
856
587
48,988
50,572
Accepted
Accepted
31.43
H,W,K = list(map(int,input().split())) S = [eval(input()) for i in range(H)] ans = H+W for b in range(1<<(H-1)): tmp = bin(b).count('1') ks = [0]*H valid = True for col in zip(*S): j = 0 for i,c in enumerate(col): if c=='1': ks[j] += 1 ...
H,W,K = list(map(int,input().split())) S = [eval(input()) for i in range(H)] ans = H+W for b in range(1<<(H-1)): gs = [[0]] for k in range(H-1): if b&(1<<k): gs.append([k+1]) else: gs[-1].append(k+1) tmp = bin(b).count('1') ws = [0] * len(gs) for...
30
30
756
807
H, W, K = list(map(int, input().split())) S = [eval(input()) for i in range(H)] ans = H + W for b in range(1 << (H - 1)): tmp = bin(b).count("1") ks = [0] * H valid = True for col in zip(*S): j = 0 for i, c in enumerate(col): if c == "1": ks[j] += 1 ...
H, W, K = list(map(int, input().split())) S = [eval(input()) for i in range(H)] ans = H + W for b in range(1 << (H - 1)): gs = [[0]] for k in range(H - 1): if b & (1 << k): gs.append([k + 1]) else: gs[-1].append(k + 1) tmp = bin(b).count("1") ws = [0] * len(gs) ...
false
0
[ "+ gs = [[0]]", "+ for k in range(H - 1):", "+ if b & (1 << k):", "+ gs.append([k + 1])", "+ else:", "+ gs[-1].append(k + 1)", "- ks = [0] * H", "- valid = True", "- for col in zip(*S):", "- j = 0", "- for i, c in enumerate(col):",...
false
0.191256
0.135276
1.413818
[ "s033834676", "s852103729" ]
u847467233
p00009
python
s016586359
s046170693
440
370
23,568
23,440
Accepted
Accepted
15.91
# AOJ 0009 Prime Number # Python3 2018.6.9 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(2, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i*i, MAX, i): prime[j] = False sieve() cn...
# AOJ 0009 Prime Number # Python3 2018.6.9 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) prime = [0] * MAX def sieve(): for i in range(3, MAX, 2): prime[i] = 1 for i in range(3, SQRT, 2): if prime[i] == 1: for j in range(i*i, MAX, i): prime[j] = 0 sieve() cnt = [0] * (MAX+1) cnt[2] ...
30
30
556
505
# AOJ 0009 Prime Number # Python3 2018.6.9 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) prime = [True for i in range(MAX)] def sieve(): for i in range(2, MAX, 2): prime[i] = False for i in range(3, SQRT, 2): if prime[i] is True: for j in range(i * i, MAX, i): prime[...
# AOJ 0009 Prime Number # Python3 2018.6.9 bal4u MAX = 1000000 SQRT = 1000 # sqrt(MAX) prime = [0] * MAX def sieve(): for i in range(3, MAX, 2): prime[i] = 1 for i in range(3, SQRT, 2): if prime[i] == 1: for j in range(i * i, MAX, i): prime[j] = 0 sieve() cnt = [...
false
0
[ "-prime = [True for i in range(MAX)]", "+prime = [0] * MAX", "- for i in range(2, MAX, 2):", "- prime[i] = False", "+ for i in range(3, MAX, 2):", "+ prime[i] = 1", "- if prime[i] is True:", "+ if prime[i] == 1:", "- prime[j] = False", "+ ...
false
0.781305
1.254105
0.622998
[ "s016586359", "s046170693" ]
u134302690
p02818
python
s360225485
s569889632
174
17
38,384
2,940
Accepted
Accepted
90.23
a,b,k=list(map(int,input().split())) if a-k>0 and a+b > k: print((str(a-k)+" "+str(b))) elif a-k <= 0 and a+b > k: print((str(0)+" "+str(b-(a-k)*(-1)))) else: print((str(0)+" "+str(0)))
a,b,k = list(map(int,input().split())) a = a - k if a >0: print((a,b)) elif a <=0: b += a if b >= 0: print((0,b)) else: print((0,0))
7
10
192
161
a, b, k = list(map(int, input().split())) if a - k > 0 and a + b > k: print((str(a - k) + " " + str(b))) elif a - k <= 0 and a + b > k: print((str(0) + " " + str(b - (a - k) * (-1)))) else: print((str(0) + " " + str(0)))
a, b, k = list(map(int, input().split())) a = a - k if a > 0: print((a, b)) elif a <= 0: b += a if b >= 0: print((0, b)) else: print((0, 0))
false
30
[ "-if a - k > 0 and a + b > k:", "- print((str(a - k) + \" \" + str(b)))", "-elif a - k <= 0 and a + b > k:", "- print((str(0) + \" \" + str(b - (a - k) * (-1))))", "-else:", "- print((str(0) + \" \" + str(0)))", "+a = a - k", "+if a > 0:", "+ print((a, b))", "+elif a <= 0:", "+ b ...
false
0.042021
0.133379
0.315051
[ "s360225485", "s569889632" ]
u146346223
p02641
python
s003505416
s217521245
24
19
9,208
9,116
Accepted
Accepted
20.83
x, n = list(map(int, input().split())) if n == 0: print(x) exit() arr = list(map(int, input().split())) # p1 ... pn arr2 = [] arr3 = [] for i in range(-50, 110): if not i in arr: arr2.append(i) arr3.append(abs(x - i)) n2 = min([i for i, v in enumerate(arr3) if v == min(a...
X, N = list(map(int, input().split())) arr = list(map(int, input().split())) ans = 0 for i in range(1, 102): if abs(X - i) < abs(X - ans) and i not in arr: ans = i print(ans)
18
8
337
189
x, n = list(map(int, input().split())) if n == 0: print(x) exit() arr = list(map(int, input().split())) # p1 ... pn arr2 = [] arr3 = [] for i in range(-50, 110): if not i in arr: arr2.append(i) arr3.append(abs(x - i)) n2 = min([i for i, v in enumerate(arr3) if v == min(arr3)]) print((arr2[n...
X, N = list(map(int, input().split())) arr = list(map(int, input().split())) ans = 0 for i in range(1, 102): if abs(X - i) < abs(X - ans) and i not in arr: ans = i print(ans)
false
55.555556
[ "-x, n = list(map(int, input().split()))", "-if n == 0:", "- print(x)", "- exit()", "-arr = list(map(int, input().split())) # p1 ... pn", "-arr2 = []", "-arr3 = []", "-for i in range(-50, 110):", "- if not i in arr:", "- arr2.append(i)", "- arr3.append(abs(x - i))", "-n...
false
0.038071
0.036585
1.040606
[ "s003505416", "s217521245" ]
u285681431
p02793
python
s037511467
s764862192
1,584
155
75,152
82,832
Accepted
Accepted
90.21
import math import sys input = sys.stdin.readline def lcm(a, b): return (a * b) // math.gcd(a, b) N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 # A全体の最小公倍数 a_lcm = 1 for a in A: a_lcm = lcm(a_lcm, a) # Bの総和 b_sum = 0 for i in range(N): b_sum += a_lcm // A[...
from collections import Counter MOD = 10**9+7 N = int(eval(input())) A = list(map(int,input().split())) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f el...
22
35
339
748
import math import sys input = sys.stdin.readline def lcm(a, b): return (a * b) // math.gcd(a, b) N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 # A全体の最小公倍数 a_lcm = 1 for a in A: a_lcm = lcm(a_lcm, a) # Bの総和 b_sum = 0 for i in range(N): b_sum += a_lcm // A[i] print((b_sum % ...
from collections import Counter MOD = 10**9 + 7 N = int(eval(input())) A = list(map(int, input().split())) def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: ...
false
37.142857
[ "-import math", "-import sys", "+from collections import Counter", "-input = sys.stdin.readline", "+MOD = 10**9 + 7", "+N = int(eval(input()))", "+A = list(map(int, input().split()))", "-def lcm(a, b):", "- return (a * b) // math.gcd(a, b)", "+def prime_factorize(n):", "+ a = []", "+ ...
false
0.043837
0.204708
0.214144
[ "s037511467", "s764862192" ]
u263737105
p02578
python
s548138529
s848094313
120
102
25,316
25,148
Accepted
Accepted
15
import sys cin = sys.stdin.readline n = int(cin()) height = cin().split() last, ans = 0, 0 for i in height: diff = last - int(i) if diff > 0: ans += diff continue last = int(i) print(ans)
import sys cin = sys.stdin.readline n = int(cin()) height = list(map(int, cin().split())) last, ans = 0, 0 for i in height: diff = last - i if diff > 0: ans += diff continue last = i print(ans)
13
13
229
229
import sys cin = sys.stdin.readline n = int(cin()) height = cin().split() last, ans = 0, 0 for i in height: diff = last - int(i) if diff > 0: ans += diff continue last = int(i) print(ans)
import sys cin = sys.stdin.readline n = int(cin()) height = list(map(int, cin().split())) last, ans = 0, 0 for i in height: diff = last - i if diff > 0: ans += diff continue last = i print(ans)
false
0
[ "-height = cin().split()", "+height = list(map(int, cin().split()))", "- diff = last - int(i)", "+ diff = last - i", "- last = int(i)", "+ last = i" ]
false
0.052051
0.069673
0.747073
[ "s548138529", "s848094313" ]
u404629709
p02695
python
s367794012
s638607450
938
424
24,984
9,232
Accepted
Accepted
54.8
import itertools n,m,q=list(map(int,input().split())) l=[i for i in range(1,m+1)] que=list(itertools.combinations_with_replacement(l, n)) point=[0 for i in range(len(que))] ans=0 for i in range(q): a,b,c,d=list(map(int,input().split())) a-=1 b-=1 for j in range(len(que)): if que[j][b]-que[j][...
n,m,q = list(map(int,input().split())) a,b,c,d = [],[],[],[] ans = 0 A = [1] for i in range(q): ai,bi,ci,di = list(map(int, input().split())) a.append(ai) b.append(bi) c.append(ci) d.append(di) def dfs(A): global ans if n == len(A): now = 0 for i in range(q)...
16
28
358
550
import itertools n, m, q = list(map(int, input().split())) l = [i for i in range(1, m + 1)] que = list(itertools.combinations_with_replacement(l, n)) point = [0 for i in range(len(que))] ans = 0 for i in range(q): a, b, c, d = list(map(int, input().split())) a -= 1 b -= 1 for j in range(len(que)): ...
n, m, q = list(map(int, input().split())) a, b, c, d = [], [], [], [] ans = 0 A = [1] for i in range(q): ai, bi, ci, di = list(map(int, input().split())) a.append(ai) b.append(bi) c.append(ci) d.append(di) def dfs(A): global ans if n == len(A): now = 0 for i in range(q): ...
false
42.857143
[ "-import itertools", "+n, m, q = list(map(int, input().split()))", "+a, b, c, d = [], [], [], []", "+ans = 0", "+A = [1]", "+for i in range(q):", "+ ai, bi, ci, di = list(map(int, input().split()))", "+ a.append(ai)", "+ b.append(bi)", "+ c.append(ci)", "+ d.append(di)", "-n, m,...
false
0.060064
0.061734
0.972951
[ "s367794012", "s638607450" ]
u722148122
p02713
python
s317475461
s261915362
1,119
25
9,120
9,164
Accepted
Accepted
97.77
from math import gcd k = int(eval(input())) sum_ = 0 for a in range(1, k + 1): for b in range(1, k + 1): gcd_ab = gcd(a, b) for c in range(1, k + 1): sum_ += gcd(c, gcd_ab) print(sum_)
k = int(eval(input())) n = 3 c = {i: pow(k//i, n) for i in range(1, k+1)} for i in range(k, 0, -1): for j in range(2*i, k+1, i): c[i] -= c[j] _sum = 0 for x in range(1, k+1): _sum += c[x] * x print(_sum)
10
10
205
223
from math import gcd k = int(eval(input())) sum_ = 0 for a in range(1, k + 1): for b in range(1, k + 1): gcd_ab = gcd(a, b) for c in range(1, k + 1): sum_ += gcd(c, gcd_ab) print(sum_)
k = int(eval(input())) n = 3 c = {i: pow(k // i, n) for i in range(1, k + 1)} for i in range(k, 0, -1): for j in range(2 * i, k + 1, i): c[i] -= c[j] _sum = 0 for x in range(1, k + 1): _sum += c[x] * x print(_sum)
false
0
[ "-from math import gcd", "-", "-sum_ = 0", "-for a in range(1, k + 1):", "- for b in range(1, k + 1):", "- gcd_ab = gcd(a, b)", "- for c in range(1, k + 1):", "- sum_ += gcd(c, gcd_ab)", "-print(sum_)", "+n = 3", "+c = {i: pow(k // i, n) for i in range(1, k + 1)}", ...
false
0.217101
0.041793
5.19472
[ "s317475461", "s261915362" ]
u347640436
p03387
python
s803622696
s539606864
19
17
3,064
3,064
Accepted
Accepted
10.53
# 1. 3つとも違う数字 # => 小さいふたつを + 1 # 2. 2つ同じ数字 # => 1つだけの数字が小さい # 小さい数字を + 2 # => 1つだけの数字が大きい # 小さいふたつを + 1 a, b, c = list(map(int, input().split())) result = 0 while True: if a == b and b == c: break elif a != b and b != c and a != c: if a < b: if b < c: a += 1 ...
A, B, C = list(map(int, input().split())) # 1. 3つとも違う数字 # => 小さいふたつを + 1 # 2. 2つ同じ数字 # => 1つだけの数字が小さい # 小さい数字を + 2 # => 1つだけの数字が大きい # 小さいふたつを + 1 result = 0 while True: if A == B and B == C: break elif A != B and B != C and A != C: if A < B: if B < C: ...
49
50
805
1,041
# 1. 3つとも違う数字 # => 小さいふたつを + 1 # 2. 2つ同じ数字 # => 1つだけの数字が小さい # 小さい数字を + 2 # => 1つだけの数字が大きい # 小さいふたつを + 1 a, b, c = list(map(int, input().split())) result = 0 while True: if a == b and b == c: break elif a != b and b != c and a != c: if a < b: if b < c: a += ...
A, B, C = list(map(int, input().split())) # 1. 3つとも違う数字 # => 小さいふたつを + 1 # 2. 2つ同じ数字 # => 1つだけの数字が小さい # 小さい数字を + 2 # => 1つだけの数字が大きい # 小さいふたつを + 1 result = 0 while True: if A == B and B == C: break elif A != B and B != C and A != C: if A < B: if B < C: A += ...
false
2
[ "+A, B, C = list(map(int, input().split()))", "-a, b, c = list(map(int, input().split()))", "- if a == b and b == c:", "+ if A == B and B == C:", "- elif a != b and b != c and a != c:", "- if a < b:", "- if b < c:", "- a += 1", "- b += 1", "...
false
0.052748
0.05238
1.007044
[ "s803622696", "s539606864" ]
u987164499
p02838
python
s895870203
s058710757
332
307
50,852
48,808
Accepted
Accepted
7.53
import numpy as np n = int(eval(input())) a = list(map(int,input().split())) a = np.array(a,dtype=np.int64) point = 0 mod = 10**9+7 for i in range(61): b = (a >> i)&1 x = np.count_nonzero(b) y = n-x point += 2**i*(x*y)%mod print((point%mod))
import numpy as np n = int(eval(input())) a = list(map(int,input().split())) a = np.array(a,dtype=np.int64) point = 0 mod = 10**9+7 b = [((a>>i)&1).sum() for i in range(61)] c = [n-b[i] for i in range(61)] d = [c[i]*b[i]%mod for i in range(61)] point = 0 now = 1 for i in range(61): point += now*...
15
22
266
382
import numpy as np n = int(eval(input())) a = list(map(int, input().split())) a = np.array(a, dtype=np.int64) point = 0 mod = 10**9 + 7 for i in range(61): b = (a >> i) & 1 x = np.count_nonzero(b) y = n - x point += 2**i * (x * y) % mod print((point % mod))
import numpy as np n = int(eval(input())) a = list(map(int, input().split())) a = np.array(a, dtype=np.int64) point = 0 mod = 10**9 + 7 b = [((a >> i) & 1).sum() for i in range(61)] c = [n - b[i] for i in range(61)] d = [c[i] * b[i] % mod for i in range(61)] point = 0 now = 1 for i in range(61): point += now * d[i...
false
31.818182
[ "+b = [((a >> i) & 1).sum() for i in range(61)]", "+c = [n - b[i] for i in range(61)]", "+d = [c[i] * b[i] % mod for i in range(61)]", "+point = 0", "+now = 1", "- b = (a >> i) & 1", "- x = np.count_nonzero(b)", "- y = n - x", "- point += 2**i * (x * y) % mod", "-print((point % mod))",...
false
0.328359
0.495442
0.66276
[ "s895870203", "s058710757" ]
u072053884
p02278
python
s757741528
s090969934
60
40
7,812
7,836
Accepted
Accepted
33.33
"""Minimum cost Sort.""" def min_cost_sort(A): """Sort list A in ascending order. And return the switching cost in sorting. """ B = list(A) B.sort() cost = 0 min_w = B[0] for i, b in enumerate(B): tmp_cost = 0 bi = A.index(b) cnt = 0 whil...
"""Minimum cost Sort.""" def min_cost_sort(A): """Sort list A in ascending order. And return the switching cost in sorting. """ B = list(A) B.sort() cost = 0 min_w = B[0] for i, b in enumerate(B): tmp_cost = 0 bi = A.index(b) cnt = 0 whil...
39
38
821
780
"""Minimum cost Sort.""" def min_cost_sort(A): """Sort list A in ascending order. And return the switching cost in sorting. """ B = list(A) B.sort() cost = 0 min_w = B[0] for i, b in enumerate(B): tmp_cost = 0 bi = A.index(b) cnt = 0 while bi != i: ...
"""Minimum cost Sort.""" def min_cost_sort(A): """Sort list A in ascending order. And return the switching cost in sorting. """ B = list(A) B.sort() cost = 0 min_w = B[0] for i, b in enumerate(B): tmp_cost = 0 bi = A.index(b) cnt = 0 while bi != i: ...
false
2.564103
[ "- if cnt:", "- dec = cnt * (b - min_w)", "- inc = 2 * (min_w + b)", "- if dec < inc:", "- cost += tmp_cost", "- else:", "- cost += tmp_cost - dec + inc", "+ dec = cnt * (b - min_w)", "+ inc = 2 * (min_w +...
false
0.068943
0.067837
1.016307
[ "s757741528", "s090969934" ]
u694665829
p02972
python
s169322906
s735306817
175
153
18,260
18,352
Accepted
Accepted
12.57
n = int(eval(input())) a = list(map(int,input().split())) b = [0]*n ans = [] for i in range(n-1, -1, -1): if sum(b[i::i+1])%2 != a[i]: b[i] = 1 ans.append(i+1) print((len(ans))) if len(ans): print((*ans))
def solve(): n = int(eval(input())) a = list(map(int,input().split())) b = [0]*n ans = [] for i in range(n-1, -1, -1): if sum(b[i::i+1])%2 != a[i]: b[i] = 1 ans.append(i+1) print((len(ans))) if len(ans): print((*ans)) if _...
11
15
232
345
n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n ans = [] for i in range(n - 1, -1, -1): if sum(b[i :: i + 1]) % 2 != a[i]: b[i] = 1 ans.append(i + 1) print((len(ans))) if len(ans): print((*ans))
def solve(): n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n ans = [] for i in range(n - 1, -1, -1): if sum(b[i :: i + 1]) % 2 != a[i]: b[i] = 1 ans.append(i + 1) print((len(ans))) if len(ans): print((*ans)) if __name__ == "__m...
false
26.666667
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-b = [0] * n", "-ans = []", "-for i in range(n - 1, -1, -1):", "- if sum(b[i :: i + 1]) % 2 != a[i]:", "- b[i] = 1", "- ans.append(i + 1)", "-print((len(ans)))", "-if len(ans):", "- print((*ans))", "+def so...
false
0.038819
0.046174
0.840711
[ "s169322906", "s735306817" ]
u163320134
p02815
python
s970257297
s336536025
663
242
27,108
26,800
Accepted
Accepted
63.5
mod=10**9+7 n=int(eval(input())) arr=list(map(int,input().split())) arr=sorted(arr) ans=0 for i in range(n): ans+=pow(2,2*n-2,mod)*(n-i+1)*arr[i] ans%=mod print((int(ans)))
mod=10**9+7 n=int(eval(input())) arr=list(map(int,input().split())) arr=sorted(arr) ans=0 total=pow(2,2*n-2,mod) for i in range(n): ans+=total*(n-i+1)*arr[i] ans%=mod print((int(ans)))
9
10
176
190
mod = 10**9 + 7 n = int(eval(input())) arr = list(map(int, input().split())) arr = sorted(arr) ans = 0 for i in range(n): ans += pow(2, 2 * n - 2, mod) * (n - i + 1) * arr[i] ans %= mod print((int(ans)))
mod = 10**9 + 7 n = int(eval(input())) arr = list(map(int, input().split())) arr = sorted(arr) ans = 0 total = pow(2, 2 * n - 2, mod) for i in range(n): ans += total * (n - i + 1) * arr[i] ans %= mod print((int(ans)))
false
10
[ "+total = pow(2, 2 * n - 2, mod)", "- ans += pow(2, 2 * n - 2, mod) * (n - i + 1) * arr[i]", "+ ans += total * (n - i + 1) * arr[i]" ]
false
0.035794
0.03567
1.003466
[ "s970257297", "s336536025" ]
u952708174
p03458
python
s090352905
s404434380
1,685
1,390
234,072
106,216
Accepted
Accepted
17.51
def d_checker(N, K, Q): # マス(x,y)が白⇔マス(x,y+K)が黒なので、希望の色がすべて黒になるようにする # 市松模様の周期は2Kなので、x,y座標をそれぞれ2Kで剰余を取った座標と同一視できる mat = [[0]*(2*K+2) for _ in range(2*K+2)] total = [[0]*(4*K+2) for _ in range(4*K+2)] for x, y, c in Q: if c == 'W': y += K mat[(x % (2*K)) + 1][(y % ...
def d_checker(): # 参考1: https://pitsbuffersolution.com/compro/atcoder/arc089d.php # 参考2: https://atcoder.jp/contests/abc086/submissions/3271380 import numpy as np N, K = [int(i) for i in input().split()] def get_bound(p): """ある希望を満たすような角のマスの集合はKxK正方形区間のようになっている p<K-1 のときはその正...
34
32
1,141
1,368
def d_checker(N, K, Q): # マス(x,y)が白⇔マス(x,y+K)が黒なので、希望の色がすべて黒になるようにする # 市松模様の周期は2Kなので、x,y座標をそれぞれ2Kで剰余を取った座標と同一視できる mat = [[0] * (2 * K + 2) for _ in range(2 * K + 2)] total = [[0] * (4 * K + 2) for _ in range(4 * K + 2)] for x, y, c in Q: if c == "W": y += K mat[(x % (2 * ...
def d_checker(): # 参考1: https://pitsbuffersolution.com/compro/atcoder/arc089d.php # 参考2: https://atcoder.jp/contests/abc086/submissions/3271380 import numpy as np N, K = [int(i) for i in input().split()] def get_bound(p): """ある希望を満たすような角のマスの集合はKxK正方形区間のようになっている p<K-1 のときはその正方形を分割しな...
false
5.882353
[ "-def d_checker(N, K, Q):", "- # マス(x,y)が白⇔マス(x,y+K)が黒なので、希望の色がすべて黒になるようにする", "- # 市松模様の周期は2Kなので、x,y座標をそれぞれ2Kで剰余を取った座標と同一視できる", "- mat = [[0] * (2 * K + 2) for _ in range(2 * K + 2)]", "- total = [[0] * (4 * K + 2) for _ in range(4 * K + 2)]", "- for x, y, c in Q:", "- if c == \"W\...
false
0.041127
0.759185
0.054172
[ "s090352905", "s404434380" ]
u546285759
p00780
python
s748264521
s921703358
1,780
50
8,436
6,044
Accepted
Accepted
97.19
from itertools import takewhile primes = [0, 0] + [1] * (2**15) for i in range(2, 182): if primes[i]: for j in range(i*i, 2**15 + 2, i): primes[j] = 0 while True: n = int(eval(input())) if n == 0: break prime_values = [i for i in range(len(primes[:n])) if primes[i...
import bisect primes = [0, 0] + [1] * 32767 for i in range(2, 182): if primes[i]: for j in range(i*i, 32769, i): primes[j] = 0 prime_values = [i for i, v in enumerate(primes) if v] while True: n = int(eval(input())) if n == 0: break eov = bisect.bisect(prime_valu...
13
16
410
385
from itertools import takewhile primes = [0, 0] + [1] * (2**15) for i in range(2, 182): if primes[i]: for j in range(i * i, 2**15 + 2, i): primes[j] = 0 while True: n = int(eval(input())) if n == 0: break prime_values = [i for i in range(len(primes[:n])) if primes[i]] pr...
import bisect primes = [0, 0] + [1] * 32767 for i in range(2, 182): if primes[i]: for j in range(i * i, 32769, i): primes[j] = 0 prime_values = [i for i, v in enumerate(primes) if v] while True: n = int(eval(input())) if n == 0: break eov = bisect.bisect(prime_values, n // 2...
false
18.75
[ "-from itertools import takewhile", "+import bisect", "-primes = [0, 0] + [1] * (2**15)", "+primes = [0, 0] + [1] * 32767", "- for j in range(i * i, 2**15 + 2, i):", "+ for j in range(i * i, 32769, i):", "+prime_values = [i for i, v in enumerate(primes) if v]", "- prime_values = [i fo...
false
0.057545
0.046897
1.227052
[ "s748264521", "s921703358" ]
u058781705
p03307
python
s586027358
s622483975
308
119
65,388
77,544
Accepted
Accepted
61.36
import fractions N = int(eval(input())) print((int(N * 2 / fractions.gcd(N, 2))))
import fractions N = int(eval(input())) print((N*2//fractions.gcd(2, N)))
4
5
78
72
import fractions N = int(eval(input())) print((int(N * 2 / fractions.gcd(N, 2))))
import fractions N = int(eval(input())) print((N * 2 // fractions.gcd(2, N)))
false
20
[ "-print((int(N * 2 / fractions.gcd(N, 2))))", "+print((N * 2 // fractions.gcd(2, N)))" ]
false
0.186478
0.053991
3.453899
[ "s586027358", "s622483975" ]
u645250356
p03634
python
s226507062
s289790738
1,607
841
214,060
123,804
Accepted
Accepted
47.67
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 mod2 = 998244353 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.rea...
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify import sys,bisect,math,itertools,fractions from decimal import Decimal sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin...
41
34
966
849
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions, pprint sys.setrecursionlimit(10**8) mod = 10**9 + 7 mod2 = 998244353 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(in...
from collections import Counter, defaultdict, deque from heapq import heappop, heappush, heapify import sys, bisect, math, itertools, fractions from decimal import Decimal sys.setrecursionlimit(10**8) mod = 10**9 + 7 INF = float("inf") def inp(): return int(sys.stdin.readline()) def inpl(): return list(map...
false
17.073171
[ "-import sys, bisect, math, itertools, fractions, pprint", "+import sys, bisect, math, itertools, fractions", "+from decimal import Decimal", "-mod2 = 998244353", "-def inpln(n):", "- return list(int(sys.stdin.readline()) for i in range(n))", "-", "-", "-g = [[] for i in range(n)]", "-cc = dict...
false
0.037489
0.046393
0.808073
[ "s226507062", "s289790738" ]
u623231048
p02678
python
s988605730
s459764290
1,051
892
34,696
34,872
Accepted
Accepted
15.13
n,m = list(map(int,input().split())) edges = [[] for _ in range(n)] for _ in range(m): a,b = list(map(int,input().split())) edges[a-1].append(b-1) edges[b-1].append(a-1) q = [0] ans = [-1]*n ans[0] = 0 count = 1 while q: l = q.pop(0) for i in edges[l]: if ans[i] == -1:...
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) edges = [[] for _ in range(n)] for _ in range(m): a,b = list(map(int,input().split())) edges[a-1].append(b-1) edges[b-1].append(a-1) q = [0] ans = [-1]*n ans[0] = 0 count = 1 while q: l = q.pop(0) fo...
31
34
520
562
n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) edges[b - 1].append(a - 1) q = [0] ans = [-1] * n ans[0] = 0 count = 1 while q: l = q.pop(0) for i in edges[l]: if ans[i] == -1: ...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): a, b = list(map(int, input().split())) edges[a - 1].append(b - 1) edges[b - 1].append(a - 1) q = [0] ans = [-1] * n ans[0] = 0 count = 1 while q: l = q.pop(0) for i in edge...
false
8.823529
[ "+import sys", "+", "+input = sys.stdin.readline" ]
false
0.036327
0.036784
0.98756
[ "s988605730", "s459764290" ]
u837673618
p02709
python
s719273779
s988514736
1,484
875
9,496
9,728
Accepted
Accepted
41.04
N = int(eval(input())) A = list(map(int, input().split())) ABI = sorted(((a, max(N-i, i-1)*a, i) for i, a in enumerate(A, 1)), reverse=True) prev = [0] for k, (a, b, i) in enumerate(ABI): curr = [0]*(k+2) for l in range(k+1): curr[l] = max(curr[l], prev[l]+abs(N-i-k+l)*a) curr[l+1] = prev[l]+abs...
from operator import itemgetter as get N = int(eval(input())) A = list(map(int, input().split())) SB = 0 ABI = sorted(((b:=max(N-i, i-1)*a, SB:=SB+b) and (a, b, i) for i, a in enumerate(A, 1)), reverse=True) def solve(a, i, prev, th): pl, pr, ps = 0, -1, 0 for l, r, s in prev: if s < th: cont...
15
30
355
734
N = int(eval(input())) A = list(map(int, input().split())) ABI = sorted(((a, max(N - i, i - 1) * a, i) for i, a in enumerate(A, 1)), reverse=True) prev = [0] for k, (a, b, i) in enumerate(ABI): curr = [0] * (k + 2) for l in range(k + 1): curr[l] = max(curr[l], prev[l] + abs(N - i - k + l) * a) c...
from operator import itemgetter as get N = int(eval(input())) A = list(map(int, input().split())) SB = 0 ABI = sorted( ( (b := max(N - i, i - 1) * a, SB := SB + b) and (a, b, i) for i, a in enumerate(A, 1) ), reverse=True, ) def solve(a, i, prev, th): pl, pr, ps = 0, -1, 0 for l, ...
false
50
[ "+from operator import itemgetter as get", "+", "-ABI = sorted(((a, max(N - i, i - 1) * a, i) for i, a in enumerate(A, 1)), reverse=True)", "-prev = [0]", "-for k, (a, b, i) in enumerate(ABI):", "- curr = [0] * (k + 2)", "- for l in range(k + 1):", "- curr[l] = max(curr[l], prev[l] + abs(...
false
0.035913
0.03199
1.122626
[ "s719273779", "s988514736" ]
u326609687
p03111
python
s318049743
s619320221
101
64
3,064
3,064
Accepted
Accepted
36.63
def func(n): if n == N: p = 0 for c in count: if c == 0: return p += 10 * (c - 1) p += abs(length[0] - A) p += abs(length[1] - B) p += abs(length[2] - C) global ans if p < ans: ans = p else: ...
PENALTY = 3000 def func(n, a, b, c): if n == N: return (abs(a - A) if a > 0 else PENALTY) +\ (abs(b - B) if b > 0 else PENALTY) +\ (abs(c - C) if c > 0 else PENALTY) else: r0 = func(n + 1, a, b, c) r1 = func(n + 1, a + l[n], b, c) + 10 r...
40
20
859
562
def func(n): if n == N: p = 0 for c in count: if c == 0: return p += 10 * (c - 1) p += abs(length[0] - A) p += abs(length[1] - B) p += abs(length[2] - C) global ans if p < ans: ans = p else: count...
PENALTY = 3000 def func(n, a, b, c): if n == N: return ( (abs(a - A) if a > 0 else PENALTY) + (abs(b - B) if b > 0 else PENALTY) + (abs(c - C) if c > 0 else PENALTY) ) else: r0 = func(n + 1, a, b, c) r1 = func(n + 1, a + l[n], b, c) + 10 ...
false
50
[ "-def func(n):", "- if n == N:", "- p = 0", "- for c in count:", "- if c == 0:", "- return", "- p += 10 * (c - 1)", "- p += abs(length[0] - A)", "- p += abs(length[1] - B)", "- p += abs(length[2] - C)", "- global a...
false
0.290615
0.094402
3.078493
[ "s318049743", "s619320221" ]
u970269944
p00462
python
s779292869
s120141972
310
280
13,340
13,348
Accepted
Accepted
9.68
def find(l, e, start, end): mid = (start+end)//2 if (l[mid] == e): return (e, e) elif (l[mid] > e): if (l[mid-1] < e): return (l[mid-1], l[mid]) return find(l, e, start, mid) elif (l[mid] < e): if (l[mid+1] > e): return (l[mid], l[mid+1]) return find(l, e, mid, end) def print_sum(): ...
def find(l, e): start, end = 0, len(l) while True: mid = (start+end)//2 if l[mid] == e: return (e, e) elif (l[mid] > e): if (l[mid-1] < e): return (l[mid-1], l[mid]) end = mid continue elif (l[mid] < e): if (l[mid+1] > e): return (l[mid], l[mid+1]) start = mid def p...
29
32
673
676
def find(l, e, start, end): mid = (start + end) // 2 if l[mid] == e: return (e, e) elif l[mid] > e: if l[mid - 1] < e: return (l[mid - 1], l[mid]) return find(l, e, start, mid) elif l[mid] < e: if l[mid + 1] > e: return (l[mid], l[mid + 1]) ...
def find(l, e): start, end = 0, len(l) while True: mid = (start + end) // 2 if l[mid] == e: return (e, e) elif l[mid] > e: if l[mid - 1] < e: return (l[mid - 1], l[mid]) end = mid continue elif l[mid] < e: ...
false
9.375
[ "-def find(l, e, start, end):", "- mid = (start + end) // 2", "- if l[mid] == e:", "- return (e, e)", "- elif l[mid] > e:", "- if l[mid - 1] < e:", "- return (l[mid - 1], l[mid])", "- return find(l, e, start, mid)", "- elif l[mid] < e:", "- if l[m...
false
0.038624
0.036643
1.05405
[ "s779292869", "s120141972" ]
u821588465
p03076
python
s303035818
s673792187
31
27
9,172
9,040
Accepted
Accepted
12.9
from itertools import permutations from math import ceil times = [int(eval(input())) for _ in range(5)] orders = list(permutations(times)) minimum = sum(ceil(time/10)*10 for time in times) for order in orders: total = order[0] for i in range(1, 5): total += ceil(order[i]/10)*10 minimum ...
from itertools import permutations from math import ceil times = list(int(eval(input())) for _ in range(5)) orders = list(permutations(times, 5)) minimum = sum(ceil(time/10)*10 for time in times) for order in orders: cnt = order[0] for i in range(1, 5): cnt += ceil(order[i]/10)*10 minim...
14
13
354
353
from itertools import permutations from math import ceil times = [int(eval(input())) for _ in range(5)] orders = list(permutations(times)) minimum = sum(ceil(time / 10) * 10 for time in times) for order in orders: total = order[0] for i in range(1, 5): total += ceil(order[i] / 10) * 10 minimum = mi...
from itertools import permutations from math import ceil times = list(int(eval(input())) for _ in range(5)) orders = list(permutations(times, 5)) minimum = sum(ceil(time / 10) * 10 for time in times) for order in orders: cnt = order[0] for i in range(1, 5): cnt += ceil(order[i] / 10) * 10 minimum =...
false
7.142857
[ "-times = [int(eval(input())) for _ in range(5)]", "-orders = list(permutations(times))", "+times = list(int(eval(input())) for _ in range(5))", "+orders = list(permutations(times, 5))", "- total = order[0]", "+ cnt = order[0]", "- total += ceil(order[i] / 10) * 10", "- minimum = min(m...
false
0.048626
0.076113
0.638865
[ "s303035818", "s673792187" ]
u562016607
p02959
python
s603198220
s695929004
280
157
87,652
18,620
Accepted
Accepted
43.93
N=int(eval(input())) A=[int(i) for i in input().split()] B=[int(i) for i in input().split()] C=[B[i] for i in range(N)] X=[A[i] for i in range(N+1)] for i in range(N): if X[i]<C[i]: C[i]-=X[i] X[i]=0 X[i+1]=max(0,X[i+1]-C[i]) else: X[i]-=C[i] C[i]=0 print((su...
N=int(eval(input())) A=[int(i) for i in input().split()] C=[int(i) for i in input().split()] X=[A[i] for i in range(N+1)] for i in range(N): if X[i]<C[i]: C[i]-=X[i] X[i]=0 X[i+1]=max(0,X[i+1]-C[i]) else: X[i]-=C[i] C[i]=0 print((sum(A)-sum(X)))
14
13
325
298
N = int(eval(input())) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] C = [B[i] for i in range(N)] X = [A[i] for i in range(N + 1)] for i in range(N): if X[i] < C[i]: C[i] -= X[i] X[i] = 0 X[i + 1] = max(0, X[i + 1] - C[i]) else: X[i] -= C[i] ...
N = int(eval(input())) A = [int(i) for i in input().split()] C = [int(i) for i in input().split()] X = [A[i] for i in range(N + 1)] for i in range(N): if X[i] < C[i]: C[i] -= X[i] X[i] = 0 X[i + 1] = max(0, X[i + 1] - C[i]) else: X[i] -= C[i] C[i] = 0 print((sum(A) - sum(...
false
7.142857
[ "-B = [int(i) for i in input().split()]", "-C = [B[i] for i in range(N)]", "+C = [int(i) for i in input().split()]" ]
false
0.03969
0.047479
0.835954
[ "s603198220", "s695929004" ]
u057109575
p02888
python
s245468823
s511592943
751
622
44,968
74,428
Accepted
Accepted
17.18
from bisect import bisect_left N, *L= list(map(int, open(0).read().split())) X = sorted(L) ans = 0 for i in range(N): for j in range(i + 1, N): ub = bisect_left(X, X[i] + X[j]) ans += ub - (j + 1) print(ans)
from bisect import bisect_left, bisect_right N, *X = list(map(int, open(0).read().split())) X.sort() ans = 0 for i in range(N - 2): for j in range(i + 1, N - 1): k1 = bisect_right(X, X[j] - X[i]) k2 = bisect_left(X, X[i] + X[j]) k1 = max(k1, j + 1) ans += max(0, k2 - k1)...
12
14
244
329
from bisect import bisect_left N, *L = list(map(int, open(0).read().split())) X = sorted(L) ans = 0 for i in range(N): for j in range(i + 1, N): ub = bisect_left(X, X[i] + X[j]) ans += ub - (j + 1) print(ans)
from bisect import bisect_left, bisect_right N, *X = list(map(int, open(0).read().split())) X.sort() ans = 0 for i in range(N - 2): for j in range(i + 1, N - 1): k1 = bisect_right(X, X[j] - X[i]) k2 = bisect_left(X, X[i] + X[j]) k1 = max(k1, j + 1) ans += max(0, k2 - k1) print(ans)
false
14.285714
[ "-from bisect import bisect_left", "+from bisect import bisect_left, bisect_right", "-N, *L = list(map(int, open(0).read().split()))", "-X = sorted(L)", "+N, *X = list(map(int, open(0).read().split()))", "+X.sort()", "-for i in range(N):", "- for j in range(i + 1, N):", "- ub = bisect_left...
false
0.04708
0.074149
0.63494
[ "s245468823", "s511592943" ]
u606045429
p03651
python
s112478786
s902164810
181
84
14,252
14,224
Accepted
Accepted
53.59
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] from fractions import gcd from functools import reduce if max(A) < K: print("IMPOSSIBLE") quit() g = reduce(gcd, A) for a in A: if gcd(a, K) == g: print("POSSIBLE") quit() print("IMPOSSIBLE")
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] from functools import reduce from fractions import gcd if K <= max(A) and K % reduce(gcd, A) == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
17
10
318
241
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] from fractions import gcd from functools import reduce if max(A) < K: print("IMPOSSIBLE") quit() g = reduce(gcd, A) for a in A: if gcd(a, K) == g: print("POSSIBLE") quit() print("IMPOSSIBLE")
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] from functools import reduce from fractions import gcd if K <= max(A) and K % reduce(gcd, A) == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
false
41.176471
[ "+from functools import reduce", "-from functools import reduce", "-if max(A) < K:", "+if K <= max(A) and K % reduce(gcd, A) == 0:", "+ print(\"POSSIBLE\")", "+else:", "- quit()", "-g = reduce(gcd, A)", "-for a in A:", "- if gcd(a, K) == g:", "- print(\"POSSIBLE\")", "- ...
false
0.09073
0.091355
0.99316
[ "s112478786", "s902164810" ]
u761320129
p02994
python
s433028484
s598297947
22
18
3,316
2,940
Accepted
Accepted
18.18
N,L = list(map(int,input().split())) A = [L+i for i in range(N)] x = 10**9 y = -1 for a in A: if abs(a) < x: x = abs(a) y = a print((sum(A) - y))
N,L = list(map(int,input().split())) R = L+N-1 if L <= 0 <= R: print((sum(range(L,R+1)))) elif L > 0: print((sum(range(L+1,R+1)))) else: print((sum(range(L,R))))
9
8
165
169
N, L = list(map(int, input().split())) A = [L + i for i in range(N)] x = 10**9 y = -1 for a in A: if abs(a) < x: x = abs(a) y = a print((sum(A) - y))
N, L = list(map(int, input().split())) R = L + N - 1 if L <= 0 <= R: print((sum(range(L, R + 1)))) elif L > 0: print((sum(range(L + 1, R + 1)))) else: print((sum(range(L, R))))
false
11.111111
[ "-A = [L + i for i in range(N)]", "-x = 10**9", "-y = -1", "-for a in A:", "- if abs(a) < x:", "- x = abs(a)", "- y = a", "-print((sum(A) - y))", "+R = L + N - 1", "+if L <= 0 <= R:", "+ print((sum(range(L, R + 1))))", "+elif L > 0:", "+ print((sum(range(L + 1, R + 1))...
false
0.045637
0.045752
0.997493
[ "s433028484", "s598297947" ]
u883048396
p03721
python
s529131180
s228236184
181
165
10,592
28,204
Accepted
Accepted
8.84
import sys iN,iK = [int(_) for _ in input().split()] #aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()] d = {} for _ in range(iN): a,b = [int(_) for _ in sys.stdin.readline().split()] if a in d: d[a] += b else: d[a] = b iC = 0 for a in sorted(d.keys())...
import sys def 解(): iN,iK = [int(_) for _ in input().split()] #aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()] d = {} for a,b in [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]: if a in d: d[a] += b else: ...
17
18
391
465
import sys iN, iK = [int(_) for _ in input().split()] # aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()] d = {} for _ in range(iN): a, b = [int(_) for _ in sys.stdin.readline().split()] if a in d: d[a] += b else: d[a] = b iC = 0 for a in sorted(d.keys()): iC ...
import sys def 解(): iN, iK = [int(_) for _ in input().split()] # aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()] d = {} for a, b in [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]: if a in d: d[a] += b else: d[a]...
false
5.555556
[ "-iN, iK = [int(_) for _ in input().split()]", "-# aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]", "-d = {}", "-for _ in range(iN):", "- a, b = [int(_) for _ in sys.stdin.readline().split()]", "- if a in d:", "- d[a] += b", "- else:", "- d[a] = b...
false
0.043131
0.107816
0.400042
[ "s529131180", "s228236184" ]
u861651996
p03494
python
s146812132
s131224909
317
149
21,884
12,480
Accepted
Accepted
53
import numpy as np # 複数個格納 # A B = map(int, input().split()) # 行列化 # A = np.array(A) # A=A.reshape(1,-1) # A=A.T N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A) A=A.reshape(1,-1) vector0=A*0 count=0 i=0 flg=False for i in range(19999): B=A%2 for k in range(N-1) : ...
import numpy as np # 複数個格納 # A B = map(int, input().split()) # 行列化 # A = np.array(A) # A=A.reshape(1,-1) # A=A.T N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A) A=A.reshape(1,-1) vector0=A*0 count=0 i=0 flg=False for i in range(100): B=A%2 C=((A%2 == vector0).all(...
29
26
455
397
import numpy as np # 複数個格納 # A B = map(int, input().split()) # 行列化 # A = np.array(A) # A=A.reshape(1,-1) # A=A.T N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A) A = A.reshape(1, -1) vector0 = A * 0 count = 0 i = 0 flg = False for i in range(19999): B = A % 2 for k in range(N - 1): ...
import numpy as np # 複数個格納 # A B = map(int, input().split()) # 行列化 # A = np.array(A) # A=A.reshape(1,-1) # A=A.T N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A) A = A.reshape(1, -1) vector0 = A * 0 count = 0 i = 0 flg = False for i in range(100): B = A % 2 C = (A % 2 == vector0).all(...
false
10.344828
[ "-for i in range(19999):", "+for i in range(100):", "- for k in range(N - 1):", "- if B[0, k] != 0:", "- flg = True", "- break", "- if flg:", "+ C = (A % 2 == vector0).all()", "+ if C == False:" ]
false
0.295267
0.352307
0.838096
[ "s146812132", "s131224909" ]
u198062737
p03634
python
s262327747
s181652328
1,945
941
100,580
90,468
Accepted
Accepted
51.62
import heapq N = int(eval(input())) edges = {i: [] for i in range(N)} for i in range(N - 1): a, b, c = list(map(int, input().split(" "))) edges[a - 1].append((b - 1, c)) edges[b - 1].append((a - 1, c)) Q, K = list(map(int, input().split(" "))) # Kからの最短距離を計算 dist = [-1 for i in range(N)] que = ...
import heapq import sys input = sys.stdin.readline N = int(eval(input())) edges = {i: [] for i in range(N)} for i in range(N - 1): a, b, c = list(map(int, input().split(" "))) edges[a - 1].append((b - 1, c)) edges[b - 1].append((a - 1, c)) Q, K = list(map(int, input().split(" "))) # Kからの最短距離を計...
27
29
728
768
import heapq N = int(eval(input())) edges = {i: [] for i in range(N)} for i in range(N - 1): a, b, c = list(map(int, input().split(" "))) edges[a - 1].append((b - 1, c)) edges[b - 1].append((a - 1, c)) Q, K = list(map(int, input().split(" "))) # Kからの最短距離を計算 dist = [-1 for i in range(N)] que = [] heapq.heap...
import heapq import sys input = sys.stdin.readline N = int(eval(input())) edges = {i: [] for i in range(N)} for i in range(N - 1): a, b, c = list(map(int, input().split(" "))) edges[a - 1].append((b - 1, c)) edges[b - 1].append((a - 1, c)) Q, K = list(map(int, input().split(" "))) # Kからの最短距離を計算 dist = [-1 ...
false
6.896552
[ "+import sys", "+input = sys.stdin.readline" ]
false
0.044533
0.074726
0.595952
[ "s262327747", "s181652328" ]
u724892495
p03212
python
s624610969
s017456843
1,766
37
3,064
4,212
Accepted
Accepted
97.9
s = eval(input()) l = len(s) N = int(s) ans = 0 for i1, a in enumerate(" 357"): if l<9 and i1>0: break for i2, b in enumerate(" 357"): if l<8 and i2>0: break for i3, c in enumerate(" 357"): if l<7 and i3>0: break for i4, d in enumerate(" 357"): ...
from functools import lru_cache @lru_cache(maxsize=1000) def digit_search(k, tight, own, X, started): if k == len(X): return int(own==7) digit = int(X[k]) lim = digit if tight else 9 res = 0 for i in range(lim+1): if started: if i!=3 and i!=5 and i!=7: continu...
28
22
1,167
636
s = eval(input()) l = len(s) N = int(s) ans = 0 for i1, a in enumerate(" 357"): if l < 9 and i1 > 0: break for i2, b in enumerate(" 357"): if l < 8 and i2 > 0: break for i3, c in enumerate(" 357"): if l < 7 and i3 > 0: break for i4, d i...
from functools import lru_cache @lru_cache(maxsize=1000) def digit_search(k, tight, own, X, started): if k == len(X): return int(own == 7) digit = int(X[k]) lim = digit if tight else 9 res = 0 for i in range(lim + 1): if started: if i != 3 and i != 5 and i != 7: ...
false
21.428571
[ "-s = eval(input())", "-l = len(s)", "-N = int(s)", "-ans = 0", "-for i1, a in enumerate(\" 357\"):", "- if l < 9 and i1 > 0:", "- break", "- for i2, b in enumerate(\" 357\"):", "- if l < 8 and i2 > 0:", "- break", "- for i3, c in enumerate(\" 357\"):", "-...
false
0.173596
0.043161
4.022107
[ "s624610969", "s017456843" ]
u351480677
p03160
python
s515046951
s057239268
206
189
13,928
13,928
Accepted
Accepted
8.25
n = int(eval(input())) h = list(map(int,input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n-1): dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i])) if i<n-2: dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i])) print((dp[n-1]))
n = int(eval(input())) h = list(map(int,input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n-1): dp[i+1] = min(dp[i+1], dp[i]+abs(h[i]-h[i+1])) if i<=n-3: dp[i+2] = min(dp[i+2], dp[i]+abs(h[i]-h[i+2])) print((dp[n-1]))
10
9
265
264
n = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])) if i < n - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i])) print((dp[n - 1]))
n = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf") for _ in range(n)] dp[0] = 0 for i in range(n - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1])) if i <= n - 3: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2])) print((dp[n - 1]))
false
10
[ "- dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))", "- if i < n - 2:", "- dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]))", "+ dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))", "+ if i <= n - 3:", "+ dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + ...
false
0.049494
0.049171
1.006571
[ "s515046951", "s057239268" ]
u535803878
p02715
python
s864426651
s171079168
503
97
28,632
69,952
Accepted
Accepted
80.72
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[...
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[...
31
30
714
695
def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if ar...
def factorization(n): arr = [] temp = n for i in range(2, int(-(-(n**0.5) // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) if ar...
false
3.225806
[ "-import numpy as np", "-", "-nums = np.zeros((k + 1), dtype=int)", "+# nums = np.zeros((k+1), dtype=int)", "- tmp -= nums[(2 * i) :: i].sum()", "+ tmp -= sum(nums[(2 * i) :: i])", "-# print(sum((i)*nums[i]%M for i in range(len(nums)))%M)", "-print(((np.arange(k + 1) * nums).sum() % M))", "+pr...
false
0.33312
0.070878
4.699889
[ "s864426651", "s171079168" ]
u497952650
p02885
python
s001134197
s016034364
20
17
3,316
2,940
Accepted
Accepted
15
a,b = list(map(int,input().split())) print((max(0,a-2*b)))
A,B = list(map(int,input().split())) print((max(0,A-2*B)))
2
3
51
53
a, b = list(map(int, input().split())) print((max(0, a - 2 * b)))
A, B = list(map(int, input().split())) print((max(0, A - 2 * B)))
false
33.333333
[ "-a, b = list(map(int, input().split()))", "-print((max(0, a - 2 * b)))", "+A, B = list(map(int, input().split()))", "+print((max(0, A - 2 * B)))" ]
false
0.106873
0.067635
1.580134
[ "s001134197", "s016034364" ]
u855831834
p02900
python
s099629928
s538537365
869
132
74,848
74,576
Accepted
Accepted
84.81
def make_divisors(n): from collections import deque divisors = deque([]) for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) lst_divisors = list(divisors) lst_divisors.sort() return ls...
def make_divisors(n): from collections import deque divisors = deque([]) for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) lst_divisors = list(divisors) lst_divisors.sort() return ls...
36
35
812
760
def make_divisors(n): from collections import deque divisors = deque([]) for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) lst_divisors = list(divisors) lst_divisors.sort() return lst_div...
def make_divisors(n): from collections import deque divisors = deque([]) for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) lst_divisors = list(divisors) lst_divisors.sort() return lst_div...
false
2.777778
[ "- for n in cand[1:]:", "- for waru in ans:", "- if n % waru == 0:", "- break", "- else:", "- ans.append(n)", "+ for waru in ans:", "+ if n % waru == 0:", "+ ...
false
0.041742
0.036827
1.133453
[ "s099629928", "s538537365" ]
u580697892
p03103
python
s215358437
s536745660
767
481
37,872
29,788
Accepted
Accepted
37.29
#coding: utf-8 import numpy as np N, M = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for _ in range(N)]) money = 0 col_num = 0 AB = AB[np.argsort(AB[:, col_num])] if M <= AB[np.argmin(AB[:, 0]), 1]: money += AB[0, 0] * M else: i = 0 while M > 0: money +...
N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N)] money = 0 AB = sorted(AB, key=lambda x: x[0]) if M <= AB[0][1]: money += AB[0][0] * M else: i = 0 while M > 0: money += AB[i][0] * AB[i][1] M -= AB[i][1] if M <= 0: money += AB[i][0] * M ...
18
16
441
351
# coding: utf-8 import numpy as np N, M = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for _ in range(N)]) money = 0 col_num = 0 AB = AB[np.argsort(AB[:, col_num])] if M <= AB[np.argmin(AB[:, 0]), 1]: money += AB[0, 0] * M else: i = 0 while M > 0: money += AB[i, 0]...
N, M = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(N)] money = 0 AB = sorted(AB, key=lambda x: x[0]) if M <= AB[0][1]: money += AB[0][0] * M else: i = 0 while M > 0: money += AB[i][0] * AB[i][1] M -= AB[i][1] if M <= 0: money += AB...
false
11.111111
[ "-# coding: utf-8", "-import numpy as np", "-", "-AB = np.array([list(map(int, input().split())) for _ in range(N)])", "+AB = [list(map(int, input().split())) for _ in range(N)]", "-col_num = 0", "-AB = AB[np.argsort(AB[:, col_num])]", "-if M <= AB[np.argmin(AB[:, 0]), 1]:", "- money += AB[0, 0] ...
false
0.205915
0.070536
2.919282
[ "s215358437", "s536745660" ]
u479719434
p02665
python
s948289322
s890279539
727
175
654,648
26,380
Accepted
Accepted
75.93
n = int(eval(input())) leaves = list(map(int, input().split())) ans = 0 nodes_min = [0] * (n + 1) nodes_max = [0] * (n + 1) nodes_min[n] = leaves[n] nodes_max[n] = leaves[n] for depth in range(n, 0, -1): root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2 nodes_min[depth - 1] = leaves[depth - 1...
n = int(eval(input())) leaves = list(map(int, input().split())) ans = 0 nodes_min = [0] * (n + 1) nodes_max = [0] * (n + 1) nodes_min[n] = leaves[n] nodes_max[n] = leaves[n] for depth in range(n, 0, -1): root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2 nodes_min[depth - 1] = leaves[depth - 1...
25
27
709
771
n = int(eval(input())) leaves = list(map(int, input().split())) ans = 0 nodes_min = [0] * (n + 1) nodes_max = [0] * (n + 1) nodes_min[n] = leaves[n] nodes_max[n] = leaves[n] for depth in range(n, 0, -1): root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2 nodes_min[depth - 1] = leaves[depth - 1] + root_min ...
n = int(eval(input())) leaves = list(map(int, input().split())) ans = 0 nodes_min = [0] * (n + 1) nodes_max = [0] * (n + 1) nodes_min[n] = leaves[n] nodes_max[n] = leaves[n] for depth in range(n, 0, -1): root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2 nodes_min[depth - 1] = leaves[depth - 1] + root_min ...
false
7.407407
[ "-for depth in range(n):", "- roots = nodes[depth] - leaves[depth]", "- nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])", "-for depth in range(n + 1):", "- if nodes[depth] < nodes_min[depth]:", "- print((-1))", "- break", "+if nodes[0] < nodes_min[0]:", "+ print((-1...
false
0.036988
0.070157
0.527219
[ "s948289322", "s890279539" ]
u057109575
p02769
python
s978267979
s428896553
143
122
84,668
85,648
Accepted
Accepted
14.69
N, K = list(map(int, input().split())) MAX = 6 * 10 ** 5 + 1 MOD = 10 ** 9 + 7 # Factorial fac = [0] * (MAX + 1) fac[0] = 1 fac[1] = 1 # Inverse inv = [0] * (MAX + 1) inv[1] = 1 # Inverse factorial finv = [0] * (MAX + 1) finv[0] = 1 finv[1] = 1 for i in range(2, MAX + 1): fac[i] = fac[i -...
N, K = list(map(int, input().split())) MAX = 4 * 10 ** 5 + 1 MOD = 10 ** 9 + 7 # Factorial fac = [0] * (MAX + 1) fac[0] = 1 fac[1] = 1 # Inverse inv = [0] * (MAX + 1) inv[1] = 1 # Inverse factorial finv = [0] * (MAX + 1) finv[0] = 1 finv[1] = 1 for i in range(2, MAX + 1): fac[i] = fac[i -...
44
41
789
746
N, K = list(map(int, input().split())) MAX = 6 * 10**5 + 1 MOD = 10**9 + 7 # Factorial fac = [0] * (MAX + 1) fac[0] = 1 fac[1] = 1 # Inverse inv = [0] * (MAX + 1) inv[1] = 1 # Inverse factorial finv = [0] * (MAX + 1) finv[0] = 1 finv[1] = 1 for i in range(2, MAX + 1): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD ...
N, K = list(map(int, input().split())) MAX = 4 * 10**5 + 1 MOD = 10**9 + 7 # Factorial fac = [0] * (MAX + 1) fac[0] = 1 fac[1] = 1 # Inverse inv = [0] * (MAX + 1) inv[1] = 1 # Inverse factorial finv = [0] * (MAX + 1) finv[0] = 1 finv[1] = 1 for i in range(2, MAX + 1): fac[i] = fac[i - 1] * i % MOD inv[i] = MOD ...
false
6.818182
[ "-MAX = 6 * 10**5 + 1", "+MAX = 4 * 10**5 + 1", "-def comb_rep(n, k):", "- return comb(n + k - 1, n - 1)", "-", "-", "-if K >= N - 1:", "- print((comb_rep(N + 1, N - 1)))", "+if N - 1 <= K:", "+ print((comb(2 * N - 1, N - 1)))", "+ # zero: 0 ~ K", "- for i in range(K + 1):", "...
false
2.145936
1.508426
1.422633
[ "s978267979", "s428896553" ]
u678167152
p02579
python
s201978557
s872499193
1,894
704
129,848
93,936
Accepted
Accepted
62.83
H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) sh += 1 sw += 1 gh += 1 gw += 1 S = [0]*(H+4) S[0] = '*'*(W+4) S[1] = '*'*(W+4) S[-2] = '*'*(W+4) S[-1] = '*'*(W+4) for h in range(2,H+2): S[h] = '**' + eval(input()) + '**' vis...
H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) sh += 1 sw += 1 gh += 1 gw += 1 s = sh*3000+sw g = gh*3000+gw S = [0]*(H+4) S[0] = '*'*(W+4) S[1] = '*'*(W+4) S[-2] = '*'*(W+4) S[-1] = '*'*(W+4) for h in range(2,H+2): S[h] = '*...
53
57
1,233
1,327
H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) sh += 1 sw += 1 gh += 1 gw += 1 S = [0] * (H + 4) S[0] = "*" * (W + 4) S[1] = "*" * (W + 4) S[-2] = "*" * (W + 4) S[-1] = "*" * (W + 4) for h in range(2, H + 2): S[h] = "**" + eval(input()) + "**...
H, W = list(map(int, input().split())) sh, sw = list(map(int, input().split())) gh, gw = list(map(int, input().split())) sh += 1 sw += 1 gh += 1 gw += 1 s = sh * 3000 + sw g = gh * 3000 + gw S = [0] * (H + 4) S[0] = "*" * (W + 4) S[1] = "*" * (W + 4) S[-2] = "*" * (W + 4) S[-1] = "*" * (W + 4) for h in range(2, H + 2):...
false
7.017544
[ "+s = sh * 3000 + sw", "+g = gh * 3000 + gw", "-heappush(d, (0, sh, sw))", "+heappush(d, s)", "- cnt, h, w = heappop(d)", "+ a = heappop(d)", "+ cnt, a1 = divmod(a, 10**7)", "+ h, w = divmod(a1, 3000)", "- heappush(d, (cnt, h1, w1))", "+ heappush(d, cnt * ...
false
0.069809
0.048298
1.445392
[ "s201978557", "s872499193" ]
u790710233
p03166
python
s035945751
s359432416
662
471
109,616
76,448
Accepted
Accepted
28.85
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x)-1 for x in input().split()]) edges[x].append(y) def memoize(f): memo = [-1]*n def memoized(args): if me...
from collections import deque, defaultdict import sys input = sys.stdin.readline n, m = list(map(int, input().split())) edges = [[]for _ in range(n)] dd = defaultdict(int) for _ in range(m): x, y = list([int(x)-1 for x in input().split()]) edges[x].append(y) dd[y] += 1 queue = deque([]) for i i...
34
35
694
798
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] for _ in range(m): x, y = list([int(x) - 1 for x in input().split()]) edges[x].append(y) def memoize(f): memo = [-1] * n def memoized(args): if memo[args] ...
from collections import deque, defaultdict import sys input = sys.stdin.readline n, m = list(map(int, input().split())) edges = [[] for _ in range(n)] dd = defaultdict(int) for _ in range(m): x, y = list([int(x) - 1 for x in input().split()]) edges[x].append(y) dd[y] += 1 queue = deque([]) for i in range(n...
false
2.857143
[ "+from collections import deque, defaultdict", "-sys.setrecursionlimit(10**7)", "+dd = defaultdict(int)", "-", "-", "-def memoize(f):", "- memo = [-1] * n", "-", "- def memoized(args):", "- if memo[args] != -1:", "- return memo[args]", "- else:", "- ...
false
0.039449
0.049136
0.802844
[ "s035945751", "s359432416" ]
u046158516
p03862
python
s691323103
s225458988
103
89
14,252
85,760
Accepted
Accepted
13.59
n,x=list(map(int,input().split())) a=list(map(int,input().split())) ans=0 if a[0]>x: ans=a[0]-x a[0]=x for i in range(1,n): if a[i-1]+a[i]>x: ans+=a[i-1]+a[i]-x a[i]=x-a[i-1] print(ans)
n,x=list(map(int,input().split())) a=list(map(int,input().split())) ans=0 if a[0]>x: ans+=a[0]-x a[0]=x for i in range(1,n): if a[i]+a[i-1]>x: ans+=a[i]+a[i-1]-x a[i]-=a[i]+a[i-1]-x print(ans)
11
11
203
210
n, x = list(map(int, input().split())) a = list(map(int, input().split())) ans = 0 if a[0] > x: ans = a[0] - x a[0] = x for i in range(1, n): if a[i - 1] + a[i] > x: ans += a[i - 1] + a[i] - x a[i] = x - a[i - 1] print(ans)
n, x = list(map(int, input().split())) a = list(map(int, input().split())) ans = 0 if a[0] > x: ans += a[0] - x a[0] = x for i in range(1, n): if a[i] + a[i - 1] > x: ans += a[i] + a[i - 1] - x a[i] -= a[i] + a[i - 1] - x print(ans)
false
0
[ "- ans = a[0] - x", "+ ans += a[0] - x", "- if a[i - 1] + a[i] > x:", "- ans += a[i - 1] + a[i] - x", "- a[i] = x - a[i - 1]", "+ if a[i] + a[i - 1] > x:", "+ ans += a[i] + a[i - 1] - x", "+ a[i] -= a[i] + a[i - 1] - x" ]
false
0.079335
0.039651
2.000822
[ "s691323103", "s225458988" ]
u063596417
p03944
python
s570128142
s142231755
75
25
62,740
9,196
Accepted
Accepted
66.67
w, h, n = list(map(int, input().split())) x_min = 0 x_max = w y_min = 0 y_max = h for _ in range(n): x, y, a = list(map(int, input().split())) if a == 1: x_min = max(x_min, x) elif a == 2: x_max = min(x_max, x) elif a == 3: y_min = max(y_min, y) else: y_max = min(y_max, y) ...
def main(): w, h, n = list(map(int, input().split())) x_min = 0 x_max = w y_min = 0 y_max = h for _ in range(n): x, y, a = list(map(int, input().split())) if a == 1: x_min = max(x_min, x) elif a == 2: x_max = min(x_max, x) e...
22
27
401
564
w, h, n = list(map(int, input().split())) x_min = 0 x_max = w y_min = 0 y_max = h for _ in range(n): x, y, a = list(map(int, input().split())) if a == 1: x_min = max(x_min, x) elif a == 2: x_max = min(x_max, x) elif a == 3: y_min = max(y_min, y) else: y_max = min(y_ma...
def main(): w, h, n = list(map(int, input().split())) x_min = 0 x_max = w y_min = 0 y_max = h for _ in range(n): x, y, a = list(map(int, input().split())) if a == 1: x_min = max(x_min, x) elif a == 2: x_max = min(x_max, x) elif a == 3: ...
false
18.518519
[ "-w, h, n = list(map(int, input().split()))", "-x_min = 0", "-x_max = w", "-y_min = 0", "-y_max = h", "-for _ in range(n):", "- x, y, a = list(map(int, input().split()))", "- if a == 1:", "- x_min = max(x_min, x)", "- elif a == 2:", "- x_max = min(x_max, x)", "- elif ...
false
0.035127
0.034089
1.030443
[ "s570128142", "s142231755" ]
u606045429
p02793
python
s363069553
s199636324
1,512
580
6,140
6,136
Accepted
Accepted
61.64
from fractions import gcd from functools import reduce lcm = lambda a, b: b // gcd(a, b) * a mod = 10 ** 9 + 7 N, *A = list(map(int, open(0).read().split())) L = reduce(lcm, A) print((sum(L // a for a in A) % mod))
from fractions import gcd from functools import reduce lcm = lambda a, b: b // gcd(a, b) * a mod = 10 ** 9 + 7 N, *A = list(map(int, open(0).read().split())) L = reduce(lcm, A) % mod print((sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod))
10
10
219
248
from fractions import gcd from functools import reduce lcm = lambda a, b: b // gcd(a, b) * a mod = 10**9 + 7 N, *A = list(map(int, open(0).read().split())) L = reduce(lcm, A) print((sum(L // a for a in A) % mod))
from fractions import gcd from functools import reduce lcm = lambda a, b: b // gcd(a, b) * a mod = 10**9 + 7 N, *A = list(map(int, open(0).read().split())) L = reduce(lcm, A) % mod print((sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod))
false
0
[ "-L = reduce(lcm, A)", "-print((sum(L // a for a in A) % mod))", "+L = reduce(lcm, A) % mod", "+print((sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod))" ]
false
0.091316
0.047348
1.9286
[ "s363069553", "s199636324" ]
u797673668
p02304
python
s311126938
s407222877
7,520
1,800
29,588
39,900
Accepted
Accepted
76.06
import bisect def memoize(f): cache = {} def func(x): if x not in cache: cache[x] = f(x) return cache[x] return func @memoize def get_bisect(y): return bisect.bisect(vy, (y,)) n = int(eval(input())) vx, vy = [], [] for _ in range(n): x1, y1, ...
import bisect class BIT: def __init__(self, n): self.tree = [0] * (n + 1) self.n = n def add(self, i, v): while i <= self.n: self.tree[i] += v i += i & -i def _sum(self, i): ret = 0 while i: ret += self.tree[i] ...
40
57
719
1,209
import bisect def memoize(f): cache = {} def func(x): if x not in cache: cache[x] = f(x) return cache[x] return func @memoize def get_bisect(y): return bisect.bisect(vy, (y,)) n = int(eval(input())) vx, vy = [], [] for _ in range(n): x1, y1, x2, y2 = list(map(int,...
import bisect class BIT: def __init__(self, n): self.tree = [0] * (n + 1) self.n = n def add(self, i, v): while i <= self.n: self.tree[i] += v i += i & -i def _sum(self, i): ret = 0 while i: ret += self.tree[i] i -= ...
false
29.824561
[ "-def memoize(f):", "- cache = {}", "+class BIT:", "+ def __init__(self, n):", "+ self.tree = [0] * (n + 1)", "+ self.n = n", "- def func(x):", "- if x not in cache:", "- cache[x] = f(x)", "- return cache[x]", "+ def add(self, i, v):", "+ ...
false
0.039187
0.038644
1.014047
[ "s311126938", "s407222877" ]
u562935282
p03578
python
s656493928
s913775793
275
224
68,960
41,308
Accepted
Accepted
18.55
n = int(eval(input())) d = input().split() b1 = dict() for i in d: b1[i] = b1.get(i, 0) + 1##b1[難易度]=手持ちの問題案で, 該当する難易度の問題数 m = int(eval(input())) t = input().split() b2 = dict() for i in t: b2[i] = b2.get(i, 0) + 1##b2[難易度]=予選に使う問題セットで, 該当する難易度の問題数 for tKey in list(b2.keys()): if not(tKey in ...
def main(): from collections import defaultdict N = int(eval(input())) D = tuple(map(int, input().split())) M = int(eval(input())) T = tuple(map(int, input().split())) d = defaultdict(int) for D_ in D: d[D_] += 1 for T_ in T: d[T_] -= 1 if d[T_] <...
17
22
397
408
n = int(eval(input())) d = input().split() b1 = dict() for i in d: b1[i] = b1.get(i, 0) + 1 ##b1[難易度]=手持ちの問題案で, 該当する難易度の問題数 m = int(eval(input())) t = input().split() b2 = dict() for i in t: b2[i] = b2.get(i, 0) + 1 ##b2[難易度]=予選に使う問題セットで, 該当する難易度の問題数 for tKey in list(b2.keys()): if not (tKey in b1) or (b2...
def main(): from collections import defaultdict N = int(eval(input())) D = tuple(map(int, input().split())) M = int(eval(input())) T = tuple(map(int, input().split())) d = defaultdict(int) for D_ in D: d[D_] += 1 for T_ in T: d[T_] -= 1 if d[T_] < 0: ...
false
22.727273
[ "-n = int(eval(input()))", "-d = input().split()", "-b1 = dict()", "-for i in d:", "- b1[i] = b1.get(i, 0) + 1 ##b1[難易度]=手持ちの問題案で, 該当する難易度の問題数", "-m = int(eval(input()))", "-t = input().split()", "-b2 = dict()", "-for i in t:", "- b2[i] = b2.get(i, 0) + 1 ##b2[難易度]=予選に使う問題セットで, 該当する難易度の問題数...
false
0.042279
0.008545
4.947777
[ "s656493928", "s913775793" ]
u912237403
p00125
python
s136798827
s828900938
20
10
4,220
4,220
Accepted
Accepted
50
M=[0,31,28,31,30,31,30,31,31,30,31,30] def L(y,m): if m<=2: y-=1 return y/4-y/100+y/400+sum(M[:m]) while 1: x=list(map(int,input().split(" "))) if x==[-1]*6: break a,b,c,d,e,f=x print((d-a)*365+f-c+L(d,e)-L(a,b))
M=[0,1,-1,0,0,1,1,2,3,3,4,4] def L(y,m): if m<=2: y-=1 return y/4-y/100+y/400+M[m-1] while 1: a,b,c,d,e,f=x=list(map(int,input().split(" "))) if any([i<0 for i in x]): break ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b) print(ans)
9
10
229
244
M = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30] def L(y, m): if m <= 2: y -= 1 return y / 4 - y / 100 + y / 400 + sum(M[:m]) while 1: x = list(map(int, input().split(" "))) if x == [-1] * 6: break a, b, c, d, e, f = x print((d - a) * 365 + f - c + L(d, e) - L(a, b))
M = [0, 1, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4] def L(y, m): if m <= 2: y -= 1 return y / 4 - y / 100 + y / 400 + M[m - 1] while 1: a, b, c, d, e, f = x = list(map(int, input().split(" "))) if any([i < 0 for i in x]): break ans = (d - a) * 365 + (e - b) * 30 + f - c + L(d, e) - L(a, b)...
false
10
[ "-M = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30]", "+M = [0, 1, -1, 0, 0, 1, 1, 2, 3, 3, 4, 4]", "- return y / 4 - y / 100 + y / 400 + sum(M[:m])", "+ return y / 4 - y / 100 + y / 400 + M[m - 1]", "- x = list(map(int, input().split(\" \")))", "- if x == [-1] * 6:", "+ a, b, c, d, e, ...
false
0.039747
0.039503
1.006178
[ "s136798827", "s828900938" ]
u284854859
p02901
python
s343816359
s842751289
801
290
45,928
44,124
Accepted
Accepted
63.8
n,m = list(map(int,input().split())) dp = [float("inf")]*(2**n) p = [] used = [True]*(2**n) for _ in range(m): a,b = list(map(int,input().split())) c = tuple(map(int,input().split())) jkl = 0 for e in c: jkl += 1 << (e-1) p.append(jkl) dp[jkl] = min(dp[jkl],a) used[...
import sys input = sys.stdin.readline n,m = list(map(int,input().split())) dp = [float("inf")]*(1<<n) dp[0] = 0 for _ in [0]*m: a,b = list(map(int,input().split())) sc = 0 for e in map(int,input().split()): sc += 1<<(e-1) for i in range(1<<n): dp[i|sc] = min(dp[i|sc],d...
38
20
748
388
n, m = list(map(int, input().split())) dp = [float("inf")] * (2**n) p = [] used = [True] * (2**n) for _ in range(m): a, b = list(map(int, input().split())) c = tuple(map(int, input().split())) jkl = 0 for e in c: jkl += 1 << (e - 1) p.append(jkl) dp[jkl] = min(dp[jkl], a) used[jkl] =...
import sys input = sys.stdin.readline n, m = list(map(int, input().split())) dp = [float("inf")] * (1 << n) dp[0] = 0 for _ in [0] * m: a, b = list(map(int, input().split())) sc = 0 for e in map(int, input().split()): sc += 1 << (e - 1) for i in range(1 << n): dp[i | sc] = min(dp[i | sc...
false
47.368421
[ "+import sys", "+", "+input = sys.stdin.readline", "-dp = [float(\"inf\")] * (2**n)", "-p = []", "-used = [True] * (2**n)", "-for _ in range(m):", "+dp = [float(\"inf\")] * (1 << n)", "+dp[0] = 0", "+for _ in [0] * m:", "- c = tuple(map(int, input().split()))", "- jkl = 0", "- for e...
false
0.044192
0.037397
1.181689
[ "s343816359", "s842751289" ]
u404676457
p03651
python
s897198542
s521590636
110
71
14,252
14,224
Accepted
Accepted
35.45
n, k = list(map(int, input().split())) a = list(map(int, input().split())) a.sort() def f(l, s): return s if l % s == 0 else f(s, l % s) z = f(max(a), min(a)) for i in a: z = f(i, z) if max(a) >= k and k % z == 0: print('POSSIBLE') else: print('IMPOSSIBLE')
n, k = list(map(int, input().split())) a = list(map(int, input().split())) def f(l, s): return s if l % s == 0 else f(s, l % s) z = f(max(a), min(a)) for i in a: z = f(i, z) if max(a) >= k and k % z == 0: print('POSSIBLE') else: print('IMPOSSIBLE')
14
12
282
270
n, k = list(map(int, input().split())) a = list(map(int, input().split())) a.sort() def f(l, s): return s if l % s == 0 else f(s, l % s) z = f(max(a), min(a)) for i in a: z = f(i, z) if max(a) >= k and k % z == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
n, k = list(map(int, input().split())) a = list(map(int, input().split())) def f(l, s): return s if l % s == 0 else f(s, l % s) z = f(max(a), min(a)) for i in a: z = f(i, z) if max(a) >= k and k % z == 0: print("POSSIBLE") else: print("IMPOSSIBLE")
false
14.285714
[ "-a.sort()" ]
false
0.03428
0.036343
0.943246
[ "s897198542", "s521590636" ]
u218843509
p03305
python
s364766938
s563579978
1,971
1,211
127,820
122,876
Accepted
Accepted
38.56
n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append([u - 1, a]) snuke_edge[u - 1].append([v - 1, b]) snuke_edge[v - 1]...
import heapq, sys def input(): return sys.stdin.readline()[:-1] n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].appe...
104
76
3,642
2,019
n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append([u - 1, a]) snuke_edge[u - 1].append([v - 1, b]) snuke_edge[v -...
import heapq, sys def input(): return sys.stdin.readline()[:-1] n, m, s, t = list(map(int, input().split())) yen_edge = [[] for _ in range(n)] snuke_edge = [[] for _ in range(n)] for _ in range(m): u, v, a, b = list(map(int, input().split())) yen_edge[u - 1].append([v - 1, a]) yen_edge[v - 1].append...
false
26.923077
[ "+import heapq, sys", "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "+", "-import heapq", "-class Dijkstra(object):", "- def dijkstra(self, lst, start, goal=None):", "- \"\"\"", "- ダイクストラアルゴリズムによる最短経路を求めるメソッド", "- 入力", "- adj: adj[i...
false
0.041074
0.035598
1.153817
[ "s364766938", "s563579978" ]
u098012509
p02678
python
s112288004
s146627835
705
493
62,424
60,628
Accepted
Accepted
30.07
import sys import collections sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parent...
import sys import collections sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N, M = [int(x) for x in input().split()] AB = [[int(x) for x in input().split()] for _ in range(M)] A = [[] for j in range(N + 1)] ans = [0] * (N + 1) for a, b in AB: A[a...
95
40
2,048
729
import sys import collections sys.setrecursionlimit(10**8) input = sys.stdin.readline class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self....
import sys import collections sys.setrecursionlimit(10**8) input = sys.stdin.readline def main(): N, M = [int(x) for x in input().split()] AB = [[int(x) for x in input().split()] for _ in range(M)] A = [[] for j in range(N + 1)] ans = [0] * (N + 1) for a, b in AB: A[a].append(b) A...
false
57.894737
[ "-class UnionFind:", "- def __init__(self, n):", "- self.n = n", "- self.parents = [-1] * n", "-", "- def find(self, x):", "- if self.parents[x] < 0:", "- return x", "- else:", "- self.parents[x] = self.find(self.parents[x])", "- ...
false
0.039867
0.072412
0.550558
[ "s112288004", "s146627835" ]
u814781830
p03160
python
s745070294
s475478134
178
127
13,900
13,928
Accepted
Accepted
28.65
N = int(eval(input())) H = list(map(int, input().split())) for _ in range(10): H.append(10**9) dp = [10**9] * (N+2) dp[0] = 0 # 配る方式 for i in range(N): dp[i+1] = min(dp[i] + abs(H[i]-H[i+1]),dp[i+1]) dp[i+2] = min(dp[i] + abs(H[i]-H[i+2]), dp[i+2]) print((dp[N-1]))
N = int(eval(input())) H = list(map(int, input().split())) for _ in range(10): H.append(10**9) dp = [10**9] * (N+2) dp[0] = 0 # 引っ張ってくる方式 for i in range(1, N): dp[i] = min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2])) print((dp[N-1]))
12
12
282
254
N = int(eval(input())) H = list(map(int, input().split())) for _ in range(10): H.append(10**9) dp = [10**9] * (N + 2) dp[0] = 0 # 配る方式 for i in range(N): dp[i + 1] = min(dp[i] + abs(H[i] - H[i + 1]), dp[i + 1]) dp[i + 2] = min(dp[i] + abs(H[i] - H[i + 2]), dp[i + 2]) print((dp[N - 1]))
N = int(eval(input())) H = list(map(int, input().split())) for _ in range(10): H.append(10**9) dp = [10**9] * (N + 2) dp[0] = 0 # 引っ張ってくる方式 for i in range(1, N): dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2])) print((dp[N - 1]))
false
0
[ "-# 配る方式", "-for i in range(N):", "- dp[i + 1] = min(dp[i] + abs(H[i] - H[i + 1]), dp[i + 1])", "- dp[i + 2] = min(dp[i] + abs(H[i] - H[i + 2]), dp[i + 2])", "+# 引っ張ってくる方式", "+for i in range(1, N):", "+ dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]))" ]
false
0.054367
0.055224
0.984487
[ "s745070294", "s475478134" ]
u887152994
p03145
python
s599901820
s403963335
21
17
2,940
2,940
Accepted
Accepted
19.05
a,b,c = list(map(int,input().split())) print((round(0.5*a*b)))
a,b,c = list(map(int,input().split())) print((int(0.5*a*b)))
2
2
55
53
a, b, c = list(map(int, input().split())) print((round(0.5 * a * b)))
a, b, c = list(map(int, input().split())) print((int(0.5 * a * b)))
false
0
[ "-print((round(0.5 * a * b)))", "+print((int(0.5 * a * b)))" ]
false
0.041629
0.04073
1.022078
[ "s599901820", "s403963335" ]
u545368057
p03061
python
s310631758
s110895440
461
302
14,076
14,584
Accepted
Accepted
34.49
n = int(eval(input())) As = list(map(int, input().split())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5)+1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n//i) return divisors # 1個目と2個目の約数列挙 # ⇨ 1個しか消さない...
n = int(eval(input())) As = list(map(int, input().split())) # from math import gcd def gcd(n, m): # 最大公約数 a = max(n,m) b = min(n,m) while b: a, b = b, a % b return a # 左からの累積GCDと g = As[0] left = [] for a in As: g = gcd(g, a) left.append(g) # 右からの累積GCD As_r = As[::-1...
23
36
554
655
n = int(eval(input())) As = list(map(int, input().split())) def make_divisors(n): divisors = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: divisors.append(i) if i != n // i: divisors.append(n // i) return divisors # 1個目と2個目の約数列挙 # ⇨ 1個しか消さないから必ずどちら...
n = int(eval(input())) As = list(map(int, input().split())) # from math import gcd def gcd(n, m): # 最大公約数 a = max(n, m) b = min(n, m) while b: a, b = b, a % b return a # 左からの累積GCDと g = As[0] left = [] for a in As: g = gcd(g, a) left.append(g) # 右からの累積GCD As_r = As[::-1] g_r = As_r[...
false
36.111111
[ "+# from math import gcd", "+def gcd(n, m):", "+ # 最大公約数", "+ a = max(n, m)", "+ b = min(n, m)", "+ while b:", "+ a, b = b, a % b", "+ return a", "-def make_divisors(n):", "- divisors = []", "- for i in range(1, int(n**0.5) + 1):", "- if n % i == 0:", "- ...
false
0.112178
0.086702
1.293838
[ "s310631758", "s110895440" ]
u047796752
p02792
python
s102748094
s256369745
230
81
40,428
67,916
Accepted
Accepted
64.78
N = int(eval(input())) cnt = [[0]*10 for _ in range(10)] for i in range(1, N+1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += cnt[i][j]*cnt[j][i] print(ans)
N = int(eval(input())) cnt = [[0]*10 for _ in range(10)] for i in range(1, N+1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(10): for j in range(10): ans += cnt[i][j]*cnt[j][i] print(ans)
15
15
262
256
N = int(eval(input())) cnt = [[0] * 10 for _ in range(10)] for i in range(1, N + 1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += cnt[i][j] * cnt[j][i] print(ans)
N = int(eval(input())) cnt = [[0] * 10 for _ in range(10)] for i in range(1, N + 1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(10): for j in range(10): ans += cnt[i][j] * cnt[j][i] print(ans)
false
0
[ "-for i in range(1, 10):", "- for j in range(1, 10):", "+for i in range(10):", "+ for j in range(10):" ]
false
0.086951
0.065757
1.322305
[ "s102748094", "s256369745" ]
u098012509
p02923
python
s105836042
s581578262
72
65
14,252
20,260
Accepted
Accepted
9.72
N = int(eval(input())) H = [int(x) for x in input().split()] count = [] current_count = 0 for x in range(N - 1): if H[x] >= H[x + 1]: current_count += 1 else: count.append(current_count) current_count = 0 count.append(current_count) print((max(count)))
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): N = int(eval(input())) H = [int(x) for x in input().split()] cnt = 0 prev = H[0] ans = 0 for i in range(1, N): if prev >= H[i]: cnt += 1 else: ans = max...
14
31
291
464
N = int(eval(input())) H = [int(x) for x in input().split()] count = [] current_count = 0 for x in range(N - 1): if H[x] >= H[x + 1]: current_count += 1 else: count.append(current_count) current_count = 0 count.append(current_count) print((max(count)))
import sys sys.setrecursionlimit(10**8) input = sys.stdin.readline def main(): N = int(eval(input())) H = [int(x) for x in input().split()] cnt = 0 prev = H[0] ans = 0 for i in range(1, N): if prev >= H[i]: cnt += 1 else: ans = max(ans, cnt) ...
false
54.83871
[ "-N = int(eval(input()))", "-H = [int(x) for x in input().split()]", "-count = []", "-current_count = 0", "-for x in range(N - 1):", "- if H[x] >= H[x + 1]:", "- current_count += 1", "- else:", "- count.append(current_count)", "- current_count = 0", "-count.append(curr...
false
0.118037
0.047277
2.496724
[ "s105836042", "s581578262" ]
u775681539
p02720
python
s833357983
s322597145
68
45
86,200
14,152
Accepted
Accepted
33.82
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): K = int(readline()) dq = [] for i in range(1, 10): dq.append(i) for i in range(K): v = dq[i] r = v%10 if r == 9: dq.app...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def main(): K = int(readline()) dq = deque() cnd = [] for i in range(1, 10): dq.append(i) cnd.append(i) while len(dq)>...
27
45
625
1,097
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(): K = int(readline()) dq = [] for i in range(1, 10): dq.append(i) for i in range(K): v = dq[i] r = v % 10 if r == 9: dq.append(v * ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque def main(): K = int(readline()) dq = deque() cnd = [] for i in range(1, 10): dq.append(i) cnd.append(i) while len(dq) > 0: v = ...
false
40
[ "+from collections import deque", "- dq = []", "+ dq = deque()", "+ cnd = []", "- for i in range(K):", "- v = dq[i]", "+ cnd.append(i)", "+ while len(dq) > 0:", "+ v = dq.popleft()", "- if r == 9:", "- dq.append(v * 10 + 8)", "- ...
false
0.069177
0.042392
1.631847
[ "s833357983", "s322597145" ]
u724687935
p03714
python
s380943477
s561376441
439
405
37,212
40,340
Accepted
Accepted
7.74
from heapq import heappush, heapreplace N = int(eval(input())) A = list(map(int, input().split())) dp = [0] * (N + 1) q = [] cnt = 0 for i in range(N): a = A[i] heappush(q, a) cnt += a dp[0] = cnt for i in range(N, 2 * N): a = A[i] if a > q[0]: cnt += a - heapreplace(q, a...
from heapq import heapreplace, heapify N = int(eval(input())) A = list(map(int, input().split())) dp = [0] * (N + 1) q = A[:N] heapify(q) dp[0] = sum(q) for i in range(N, 2 * N): a = A[i] if a > q[0]: dp[i - N + 1] += a - heapreplace(q, a) dp[i - N + 1] += dp[i - N] dp2 = [0] *...
39
31
708
645
from heapq import heappush, heapreplace N = int(eval(input())) A = list(map(int, input().split())) dp = [0] * (N + 1) q = [] cnt = 0 for i in range(N): a = A[i] heappush(q, a) cnt += a dp[0] = cnt for i in range(N, 2 * N): a = A[i] if a > q[0]: cnt += a - heapreplace(q, a) dp[i - N + 1]...
from heapq import heapreplace, heapify N = int(eval(input())) A = list(map(int, input().split())) dp = [0] * (N + 1) q = A[:N] heapify(q) dp[0] = sum(q) for i in range(N, 2 * N): a = A[i] if a > q[0]: dp[i - N + 1] += a - heapreplace(q, a) dp[i - N + 1] += dp[i - N] dp2 = [0] * (N + 1) q = [-A[i] f...
false
20.512821
[ "-from heapq import heappush, heapreplace", "+from heapq import heapreplace, heapify", "-q = []", "-cnt = 0", "-for i in range(N):", "- a = A[i]", "- heappush(q, a)", "- cnt += a", "-dp[0] = cnt", "+q = A[:N]", "+heapify(q)", "+dp[0] = sum(q)", "- cnt += a - heapreplace(q, a)...
false
0.121023
0.119384
1.013733
[ "s380943477", "s561376441" ]
u875291233
p03806
python
s251408717
s097331515
213
47
43,120
3,444
Accepted
Accepted
77.93
# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline #文字列入力のときは注意 n,A,B = [int(i) for i in readline().split()] abc = [[int(i) for i in readline().split()] for j in range(n)] res1 = [] res2 = [] eq = 10**9 """ def dfs(s,g,amari,yen,List): globa...
# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline #文字列入力のときは注意 n,A,B = [int(i) for i in readline().split()] abc = [[int(i) for i in readline().split()] for j in range(n)] ans = 10**9 d = {0:0} for i in range(n): nd = {} a,b,c = abc[i] ...
96
40
1,878
786
# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline # 文字列入力のときは注意 n, A, B = [int(i) for i in readline().split()] abc = [[int(i) for i in readline().split()] for j in range(n)] res1 = [] res2 = [] eq = 10**9 """ def dfs(s,g,amari,yen,List): global eq if s != ...
# coding: utf-8 # Your code here! import sys sys.setrecursionlimit(10**6) readline = sys.stdin.readline # 文字列入力のときは注意 n, A, B = [int(i) for i in readline().split()] abc = [[int(i) for i in readline().split()] for j in range(n)] ans = 10**9 d = {0: 0} for i in range(n): nd = {} a, b, c = abc[i] for amari, ...
false
58.333333
[ "-res1 = []", "-res2 = []", "-eq = 10**9", "-\"\"\"", "-def dfs(s,g,amari,yen,List):", "- global eq", "- if s != g:", "- a,b,c = abc[s]", "- if a*B == A*b:", "- eq = min(eq,c)", "- dfs(s+1,g,amari,yen,List)", "- else:", "- dfs(s+1,g...
false
0.038049
0.037531
1.013813
[ "s251408717", "s097331515" ]
u644907318
p03435
python
s974509966
s234531859
190
166
38,452
38,256
Accepted
Accepted
12.63
A = [list(map(int,input().split())) for _ in range(3)] C = [0,0,0] for j in range(3): for i in range(3): C[j] += A[i][j] R = [0,0,0] for i in range(3): for j in range(3): R[i] += A[i][j] if (C[0]-C[1])%3==0 and (C[1]-C[2])%3==0 and (R[0]-R[1])%3==0 and (R[1]-R[2])%3==0: print("Yes"...
C = [list(map(int,input().split())) for _ in range(3)] if C[0][0]-C[0][1]==C[1][0]-C[1][1]==C[2][0]-C[2][1] and C[0][1]-C[0][2]==C[1][1]-C[1][2]==C[2][1]-C[2][2] \ and C[1][0]-C[0][0]==C[1][1]-C[0][1]==C[1][2]-C[0][2] and C[2][0]-C[1][0]==C[2][1]-C[1][1]==C[2][2]-C[1][2]: print("Yes") else: print("No")...
13
6
345
320
A = [list(map(int, input().split())) for _ in range(3)] C = [0, 0, 0] for j in range(3): for i in range(3): C[j] += A[i][j] R = [0, 0, 0] for i in range(3): for j in range(3): R[i] += A[i][j] if ( (C[0] - C[1]) % 3 == 0 and (C[1] - C[2]) % 3 == 0 and (R[0] - R[1]) % 3 == 0 and (R...
C = [list(map(int, input().split())) for _ in range(3)] if ( C[0][0] - C[0][1] == C[1][0] - C[1][1] == C[2][0] - C[2][1] and C[0][1] - C[0][2] == C[1][1] - C[1][2] == C[2][1] - C[2][2] and C[1][0] - C[0][0] == C[1][1] - C[0][1] == C[1][2] - C[0][2] and C[2][0] - C[1][0] == C[2][1] - C[1][1] == C[2][2] -...
false
53.846154
[ "-A = [list(map(int, input().split())) for _ in range(3)]", "-C = [0, 0, 0]", "-for j in range(3):", "- for i in range(3):", "- C[j] += A[i][j]", "-R = [0, 0, 0]", "-for i in range(3):", "- for j in range(3):", "- R[i] += A[i][j]", "+C = [list(map(int, input().split())) for _ i...
false
0.031193
0.034153
0.913329
[ "s974509966", "s234531859" ]
u375616706
p03061
python
s322792120
s173684513
622
507
62,828
60,908
Accepted
Accepted
18.49
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class SegmentTree(): ''' RMQ の実装 ''' def __init__(self, n, inf=float('inf')): ''' 木の高さhとすると, n:h-1までのノード数。h段目のノードにアクセスするために使う。 data:ノード。 parent:k->...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class SegmentTree(): ''' 非再帰 segment tree ''' def __init__(self, _n, func, inf=float('inf')): ''' _n->配列の長さ func:func(a,b)->val, func=minだとRMQになる 木の高さh...
84
89
1,773
1,910
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class SegmentTree: """ RMQ の実装 """ def __init__(self, n, inf=float("inf")): """ 木の高さhとすると, n:h-1までのノード数。h段目のノードにアクセスするために使う。 data:ノード。 parent:k->child k*2+1とk*2+2...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline class SegmentTree: """ 非再帰 segment tree """ def __init__(self, _n, func, inf=float("inf")): """ _n->配列の長さ func:func(a,b)->val, func=minだとRMQになる 木の高さhとすると, n:h...
false
5.617978
[ "- RMQ の実装", "+ 非再帰", "+ segment tree", "- def __init__(self, n, inf=float(\"inf\")):", "+ def __init__(self, _n, func, inf=float(\"inf\")):", "+ _n->配列の長さ", "+ func:func(a,b)->val, func=minだとRMQになる", "- self.n = 2 ** (n - 1).bit_length()", "+ self.n = 2 **...
false
0.047523
0.046625
1.019254
[ "s322792120", "s173684513" ]
u150984829
p00436
python
s912831199
s618666565
30
20
5,684
5,676
Accepted
Accepted
33.33
from itertools import chain n=int(eval(input())) c=list(range(1,1+2*n)) for _ in[0]*int(eval(input())): k=int(eval(input())) c=c[k:]+c[:k]if k else list(chain.from_iterable(x for x in zip(c[:n],c[n:]))) for x in c:print(x)
from itertools import chain n=int(eval(input())) c=list(range(2*n)) for _ in[0]*int(eval(input())): k=int(eval(input())) c=c[k:]+c[:k]if k else list(chain.from_iterable(list(zip(c[:n],c[n:])))) for x in c:print((x+1))
7
7
219
206
from itertools import chain n = int(eval(input())) c = list(range(1, 1 + 2 * n)) for _ in [0] * int(eval(input())): k = int(eval(input())) c = c[k:] + c[:k] if k else list(chain.from_iterable(x for x in zip(c[:n], c[n:]))) for x in c: print(x)
from itertools import chain n = int(eval(input())) c = list(range(2 * n)) for _ in [0] * int(eval(input())): k = int(eval(input())) c = c[k:] + c[:k] if k else list(chain.from_iterable(list(zip(c[:n], c[n:])))) for x in c: print((x + 1))
false
0
[ "-c = list(range(1, 1 + 2 * n))", "+c = list(range(2 * n))", "- c = c[k:] + c[:k] if k else list(chain.from_iterable(x for x in zip(c[:n], c[n:])))", "+ c = c[k:] + c[:k] if k else list(chain.from_iterable(list(zip(c[:n], c[n:]))))", "- print(x)", "+ print((x + 1))" ]
false
0.084755
0.083984
1.009179
[ "s912831199", "s618666565" ]
u526459074
p03290
python
s731487996
s798772402
139
100
3,064
3,064
Accepted
Accepted
28.06
""" https://atcoder.jp/contests/abc104/tasks/abc104_c """ D,G=list(map(int,input().split())) l = [list(map(int, input().split())) for _ in range(D)] minP = 10 ** 100 for i in range(2**D): point, tmpP = 0,0 for j in range(D): if (i>>j)&1: point += 100*l[j][0]*(j+1) + l[j][1] tmpP += l[j...
D, G = list(map(int,input().split())) PC = [list(map(int, input().split())) for _ in range(D)] comp_ans_ll = [0 for _ in range(D) ] n_ans=float("inf") def main(): global n_ans for i in range(1<<D): comp_ans_l = [0 for _ in range(D) ] score = 0 tmp_n_ans = 0 for j in range(D): if (...
29
33
658
843
""" https://atcoder.jp/contests/abc104/tasks/abc104_c """ D, G = list(map(int, input().split())) l = [list(map(int, input().split())) for _ in range(D)] minP = 10**100 for i in range(2**D): point, tmpP = 0, 0 for j in range(D): if (i >> j) & 1: point += 100 * l[j][0] * (j + 1) + l[j][1] ...
D, G = list(map(int, input().split())) PC = [list(map(int, input().split())) for _ in range(D)] comp_ans_ll = [0 for _ in range(D)] n_ans = float("inf") def main(): global n_ans for i in range(1 << D): comp_ans_l = [0 for _ in range(D)] score = 0 tmp_n_ans = 0 for j in range(D)...
false
12.121212
[ "-\"\"\"", "-https://atcoder.jp/contests/abc104/tasks/abc104_c", "-\"\"\"", "-l = [list(map(int, input().split())) for _ in range(D)]", "-minP = 10**100", "-for i in range(2**D):", "- point, tmpP = 0, 0", "- for j in range(D):", "- if (i >> j) & 1:", "- point += 100 * l[j][...
false
0.007977
0.036572
0.218112
[ "s731487996", "s798772402" ]
u261103969
p02689
python
s507848549
s550364725
134
117
85,904
86,536
Accepted
Accepted
12.69
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): n, m = list(map(int, readline().split())) h = list(map(int, readline().split())) good = [True] * n for _ in range(m): a, b = list(map(int, readline().split...
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): import io, os input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline n, m = list(map(int, input().decode().rstrip("\n\r").split())) h = list(map(int, input().de...
28
30
560
696
import sys readline = sys.stdin.readline MOD = 10**9 + 7 INF = float("INF") sys.setrecursionlimit(10**5) def main(): n, m = list(map(int, readline().split())) h = list(map(int, readline().split())) good = [True] * n for _ in range(m): a, b = list(map(int, readline().split())) a, b = a...
import sys readline = sys.stdin.readline MOD = 10**9 + 7 INF = float("INF") sys.setrecursionlimit(10**5) def main(): import io, os input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline n, m = list(map(int, input().decode().rstrip("\n\r").split())) h = list(map(int, input().decode().rstrip("\n...
false
6.666667
[ "- n, m = list(map(int, readline().split()))", "- h = list(map(int, readline().split()))", "- good = [True] * n", "+ import io, os", "+", "+ input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline", "+ n, m = list(map(int, input().decode().rstrip(\"\\n\\r\").split()))", "+ h ...
false
0.058726
0.107732
0.545111
[ "s507848549", "s550364725" ]
u780698286
p02900
python
s366237065
s072739406
186
83
9,256
9,116
Accepted
Accepted
55.38
import math def divisors(x): l = [[], []] for i in range(1, int(math.sqrt(x))+1): if x % i == 0: if i**2 != x: l[0].append(i) l[1].append(x//i) else: l[0].append(i) return l[0]+l[1][::-1] def primenumber(x): ...
def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a from math import sqrt from ma...
27
21
597
421
import math def divisors(x): l = [[], []] for i in range(1, int(math.sqrt(x)) + 1): if x % i == 0: if i**2 != x: l[0].append(i) l[1].append(x // i) else: l[0].append(i) return l[0] + l[1][::-1] def primenumber(x): for i ...
def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a from math import sqrt from math import gcd a...
false
22.222222
[ "-import math", "+def prime_factorize(n):", "+ a = []", "+ while n % 2 == 0:", "+ a.append(2)", "+ n //= 2", "+ f = 3", "+ while f * f <= n:", "+ if n % f == 0:", "+ a.append(f)", "+ n //= f", "+ else:", "+ f += 2", "...
false
0.034556
0.043834
0.788344
[ "s366237065", "s072739406" ]
u969850098
p02947
python
s779580679
s617611267
777
633
19,848
19,844
Accepted
Accepted
18.53
import sys from collections import Counter from math import factorial def combinations_count(n, r): return factorial(n) // (factorial(n - r) * factorial(r)) def main(): inpurt = sys.stdin.readline N = int(eval(input())) texts = [''.join(sorted(list(input().rstrip()))) for _ in range(N)] c = Cou...
import sys from collections import Counter from math import factorial def combinations_count(n, r): return factorial(n) // (factorial(n - r) * factorial(r)) def main(): input = sys.stdin.readline N = int(eval(input())) texts = [''.join(sorted(list(input().rstrip()))) for _ in range(N)] c = Coun...
20
20
469
469
import sys from collections import Counter from math import factorial def combinations_count(n, r): return factorial(n) // (factorial(n - r) * factorial(r)) def main(): inpurt = sys.stdin.readline N = int(eval(input())) texts = ["".join(sorted(list(input().rstrip()))) for _ in range(N)] c = Coun...
import sys from collections import Counter from math import factorial def combinations_count(n, r): return factorial(n) // (factorial(n - r) * factorial(r)) def main(): input = sys.stdin.readline N = int(eval(input())) texts = ["".join(sorted(list(input().rstrip()))) for _ in range(N)] c = Count...
false
0
[ "- inpurt = sys.stdin.readline", "+ input = sys.stdin.readline" ]
false
0.129175
0.044868
2.878964
[ "s779580679", "s617611267" ]
u777923818
p03240
python
s348301159
s452619162
1,245
209
21,764
42,992
Accepted
Accepted
83.21
def inpl(): return list(map(int, input().split())) import numpy as np N = int(eval(input())) X = np.zeros(N, dtype=np.int64) Y = np.zeros(N, dtype=np.int64) H = np.zeros(N, dtype=np.int64) Q = sorted([inpl() for _ in range(N)], key=lambda x: x[2], reverse=True) for i, q in enumerate(Q): X[i], Y[i], ...
from operator import itemgetter import sys input = sys.stdin.readline def inpl(): return list(map(int, input().split())) N = int(eval(input())) Q = sorted([inpl() for _ in range(N)], key=itemgetter(2), reverse=True) for cx in range(101): for cy in range(101): ch = abs(cx - Q[0][0]) + abs(cy - Q[...
21
16
561
483
def inpl(): return list(map(int, input().split())) import numpy as np N = int(eval(input())) X = np.zeros(N, dtype=np.int64) Y = np.zeros(N, dtype=np.int64) H = np.zeros(N, dtype=np.int64) Q = sorted([inpl() for _ in range(N)], key=lambda x: x[2], reverse=True) for i, q in enumerate(Q): X[i], Y[i], H[i] = q ...
from operator import itemgetter import sys input = sys.stdin.readline def inpl(): return list(map(int, input().split())) N = int(eval(input())) Q = sorted([inpl() for _ in range(N)], key=itemgetter(2), reverse=True) for cx in range(101): for cy in range(101): ch = abs(cx - Q[0][0]) + abs(cy - Q[0][...
false
23.809524
[ "+from operator import itemgetter", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "-import numpy as np", "-", "-X = np.zeros(N, dtype=np.int64)", "-Y = np.zeros(N, dtype=np.int64)", "-H = np.zeros(N, dtype=np.int64)", "-Q = sorted([inpl() for _ in range(N)], key=lambda x: x[2], ...
false
0.548283
0.079442
6.901699
[ "s348301159", "s452619162" ]
u428199834
p02695
python
s575807581
s467218174
1,860
402
9,228
9,208
Accepted
Accepted
78.39
N,M,Q=list(map(int,input().split())) a=[0]*Q b=[0]*Q c=[0]*Q d=[0]*Q for i in range(Q): a[i],b[i],c[i],d[i]=list(map(int,input().split())) import itertools ans=0 for A in itertools.combinations_with_replacement(list(range(1,M+1)),N): A_=list(A) s=0 for i in range(Q): if A_[b[i]-1]-A_[a[i]-1...
def dfs(seq): ans = 0 if len(seq) == n: kou = 0 for u in data: if seq[u[1]-1] - seq[u[0]-1] == u[2]: kou+=u[3] return kou else:#len(seq)==N-1からの遷都を考えると良い for i in range(seq[-1], m+1): seq_next=seq+[i] ans = max(an...
18
19
359
491
N, M, Q = list(map(int, input().split())) a = [0] * Q b = [0] * Q c = [0] * Q d = [0] * Q for i in range(Q): a[i], b[i], c[i], d[i] = list(map(int, input().split())) import itertools ans = 0 for A in itertools.combinations_with_replacement(list(range(1, M + 1)), N): A_ = list(A) s = 0 for i in range(Q)...
def dfs(seq): ans = 0 if len(seq) == n: kou = 0 for u in data: if seq[u[1] - 1] - seq[u[0] - 1] == u[2]: kou += u[3] return kou else: # len(seq)==N-1からの遷都を考えると良い for i in range(seq[-1], m + 1): seq_next = seq + [i] ans = ma...
false
5.263158
[ "-N, M, Q = list(map(int, input().split()))", "-a = [0] * Q", "-b = [0] * Q", "-c = [0] * Q", "-d = [0] * Q", "-for i in range(Q):", "- a[i], b[i], c[i], d[i] = list(map(int, input().split()))", "-import itertools", "+def dfs(seq):", "+ ans = 0", "+ if len(seq) == n:", "+ kou =...
false
0.092815
0.045839
2.024796
[ "s575807581", "s467218174" ]
u532966492
p03364
python
s477514018
s542060052
1,846
579
54,748
39,792
Accepted
Accepted
68.63
def main(): n=int(eval(input())) nn=2*n-1 s=[eval(input()) for _ in [0]*n] s=[i+i[:-1] for i in s]+[i+i[:-1] for i in s][:-1] ans=[[0]*n for _ in [0]*n] for i in range(1,nn): m=min(i+1,n) for j in range(nn-1): for k in range(max(i-j-n,0)+1,min(m,nn-j,i-j+n)):...
def main(): n=int(eval(input())) s=[eval(input()) for _ in [0]*n] def check(a): for i in range(n): for j in range(i): if s[i%n][(j+a)%n]!=s[j%n][(i+a)%n]: return 0 return 1 print((n*sum([check(i) for i in range(n)]))) main()
20
11
693
300
def main(): n = int(eval(input())) nn = 2 * n - 1 s = [eval(input()) for _ in [0] * n] s = [i + i[:-1] for i in s] + [i + i[:-1] for i in s][:-1] ans = [[0] * n for _ in [0] * n] for i in range(1, nn): m = min(i + 1, n) for j in range(nn - 1): for k in range(max(i - j...
def main(): n = int(eval(input())) s = [eval(input()) for _ in [0] * n] def check(a): for i in range(n): for j in range(i): if s[i % n][(j + a) % n] != s[j % n][(i + a) % n]: return 0 return 1 print((n * sum([check(i) for i in range(n)]))...
false
45
[ "- nn = 2 * n - 1", "- s = [i + i[:-1] for i in s] + [i + i[:-1] for i in s][:-1]", "- ans = [[0] * n for _ in [0] * n]", "- for i in range(1, nn):", "- m = min(i + 1, n)", "- for j in range(nn - 1):", "- for k in range(max(i - j - n, 0) + 1, min(m, nn - j, i - j + n...
false
0.079076
0.042668
1.853285
[ "s477514018", "s542060052" ]
u297574184
p02888
python
s141790982
s875098032
1,332
731
3,188
43,824
Accepted
Accepted
45.12
from bisect import bisect_left, bisect_right N = int(eval(input())) Ls = list(map(int, input().split())) Ls.sort() #print(Ls) ans = 0 for i in range(N): for j in range(i+1, N): k = bisect_left(Ls, Ls[i]+Ls[j]) ans += k-j-1 print(ans)
from bisect import bisect_left, bisect_right def solve(): N = int(eval(input())) Ls = list(map(int, input().split())) Ls.sort() ans = 0 for i in range(N): for j in range(i+1, N): k = bisect_left(Ls, Ls[i]+Ls[j]) - 1 ans += k-j print(ans) sol...
14
18
264
319
from bisect import bisect_left, bisect_right N = int(eval(input())) Ls = list(map(int, input().split())) Ls.sort() # print(Ls) ans = 0 for i in range(N): for j in range(i + 1, N): k = bisect_left(Ls, Ls[i] + Ls[j]) ans += k - j - 1 print(ans)
from bisect import bisect_left, bisect_right def solve(): N = int(eval(input())) Ls = list(map(int, input().split())) Ls.sort() ans = 0 for i in range(N): for j in range(i + 1, N): k = bisect_left(Ls, Ls[i] + Ls[j]) - 1 ans += k - j print(ans) solve()
false
22.222222
[ "-N = int(eval(input()))", "-Ls = list(map(int, input().split()))", "-Ls.sort()", "-# print(Ls)", "-ans = 0", "-for i in range(N):", "- for j in range(i + 1, N):", "- k = bisect_left(Ls, Ls[i] + Ls[j])", "- ans += k - j - 1", "-print(ans)", "+", "+def solve():", "+ N = in...
false
0.04275
0.038668
1.105581
[ "s141790982", "s875098032" ]
u781262926
p02685
python
s156456249
s484581697
1,671
835
24,604
24,472
Accepted
Accepted
50.03
class Factorial(): def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 self._factorial_inv = [1] self._size_inv = 1 def __call__(self, n): return self.fact(n) def fact(self, n): ''' n! % mod ''' ...
class Factorial(): def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 self._factorial_inv = [1] self._size_inv = 1 def __call__(self, n): return self.fact(n) def fact(self, n): ''' n! % mod ''' ...
84
106
2,445
3,105
class Factorial: def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 self._factorial_inv = [1] self._size_inv = 1 def __call__(self, n): return self.fact(n) def fact(self, n): """n! % mod""" if n >= self.mod...
class Factorial: def __init__(self, mod=10**9 + 7): self.mod = mod self._factorial = [1] self._size = 1 self._factorial_inv = [1] self._size_inv = 1 def __call__(self, n): return self.fact(n) def fact(self, n): """n! % mod""" if n >= self.mod...
false
20.754717
[ "- self._make(n)", "- self._factorial_inv[n] = self.modinv(self._factorial[n])", "+ self._factorial_inv[n] = self.modinv(self.fact(n))", "+", "+ def _make_inv(self, n, r=2):", "+ if n >= self.mod:", "+ n = self.mod - 1", "+ if self._size_inv < n...
false
0.179993
0.439577
0.409469
[ "s156456249", "s484581697" ]
u533232830
p02684
python
s185046274
s808244884
186
162
32,312
32,364
Accepted
Accepted
12.9
n, k = list(map(int, input().split())) A = list(map(int, input().split())) A = [x-1 for x in A] town = 0 cnt = 0 # memo = [] # visited = [False] * n # visited[0] = -1 # start = 0 # loop = 10**8 # start_cnt = 0 # for i in range(n*2): # town = A[town] # memo.append(town) # if visited[town]...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) A = [x-1 for x in A] town = 0 cnt = 0 visited = [False] * n visited[0] = -1 start_cnt = 0 for i in range(n*2): town = A[town] if visited[town] != False: start_cnt = i + 1 loop = i - visited[town] ...
54
29
973
491
n, k = list(map(int, input().split())) A = list(map(int, input().split())) A = [x - 1 for x in A] town = 0 cnt = 0 # memo = [] # visited = [False] * n # visited[0] = -1 # start = 0 # loop = 10**8 # start_cnt = 0 # for i in range(n*2): # town = A[town] # memo.append(town) # if visited[town] != False: # ...
n, k = list(map(int, input().split())) A = list(map(int, input().split())) A = [x - 1 for x in A] town = 0 cnt = 0 visited = [False] * n visited[0] = -1 start_cnt = 0 for i in range(n * 2): town = A[town] if visited[town] != False: start_cnt = i + 1 loop = i - visited[town] break els...
false
46.296296
[ "-# memo = []", "-# visited = [False] * n", "-# visited[0] = -1", "-# start = 0", "-# loop = 10**8", "-# start_cnt = 0", "-# for i in range(n*2):", "-# town = A[town]", "-# memo.append(town)", "-# if visited[town] != False:", "-# start_cnt = i + 1", "-# loop = i - v...
false
0.035318
0.032601
1.08333
[ "s185046274", "s808244884" ]
u477977638
p02756
python
s565432385
s047596700
439
391
4,468
4,468
Accepted
Accepted
10.93
s=eval(input()) n=int(eval(input())) f=0 l="" r="" for i in range(n): q=input().split() if q[0]=="1": f^=1 else: if (f==0 and q[1]=="1") or (f==1 and q[1]=="2"): l=l+q[2] else: r=r+q[2] if f==0: ans=l[::-1]+s+r else: ans=r[::-1]+s[::-1]+l print(ans)
import sys #input = sys.stdin.buffer.readline # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): s = eval(input()) n = int(eval(input())) f = 0 l = "" r = "" for i in range(n): q=input().split() if q[0] == "1": f ^= 1 else: if (f...
26
33
287
537
s = eval(input()) n = int(eval(input())) f = 0 l = "" r = "" for i in range(n): q = input().split() if q[0] == "1": f ^= 1 else: if (f == 0 and q[1] == "1") or (f == 1 and q[1] == "2"): l = l + q[2] else: r = r + q[2] if f == 0: ans = l[::-1] + s + r else:...
import sys # input = sys.stdin.buffer.readline # mod=10**9+7 # rstrip().decode('utf-8') # map(int,input().split()) # import numpy as np def main(): s = eval(input()) n = int(eval(input())) f = 0 l = "" r = "" for i in range(n): q = input().split() if q[0] == "1": f ^...
false
21.212121
[ "-s = eval(input())", "-n = int(eval(input()))", "-f = 0", "-l = \"\"", "-r = \"\"", "-for i in range(n):", "- q = input().split()", "- if q[0] == \"1\":", "- f ^= 1", "+import sys", "+", "+# input = sys.stdin.buffer.readline", "+# mod=10**9+7", "+# rstrip().decode('utf-8')", ...
false
0.043157
0.040279
1.071468
[ "s565432385", "s047596700" ]
u057109575
p03209
python
s565315813
s235595705
168
61
38,384
62,020
Accepted
Accepted
63.69
N, X = list(map(int, input().split())) a = [1] * (N + 1) p = [1] * (N + 1) for i in range(N): a[i + 1] = a[i] * 2 + 3 p[i + 1] = p[i] * 2 + 1 def f(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= 1 + a[n - 1]: return f(n - 1, x - 1) else: return p[n - 1]...
N, X = list(map(int, input().split())) a = [1] * (N + 1) p = [1] * (N + 1) for i in range(N): a[i + 1] = a[i] * 2 + 3 p[i + 1] = p[i] * 2 + 1 def func(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= 1 + a[n - 1]: return func(n - 1, x - 1) return p[n - 1] + ...
17
20
370
371
N, X = list(map(int, input().split())) a = [1] * (N + 1) p = [1] * (N + 1) for i in range(N): a[i + 1] = a[i] * 2 + 3 p[i + 1] = p[i] * 2 + 1 def f(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= 1 + a[n - 1]: return f(n - 1, x - 1) else: return p[n - 1] + 1 + f(n - 1...
N, X = list(map(int, input().split())) a = [1] * (N + 1) p = [1] * (N + 1) for i in range(N): a[i + 1] = a[i] * 2 + 3 p[i + 1] = p[i] * 2 + 1 def func(n, x): if n == 0: return 0 if x <= 0 else 1 elif x <= 1 + a[n - 1]: return func(n - 1, x - 1) return p[n - 1] + 1 + func(n - 1, x -...
false
15
[ "-def f(n, x):", "+def func(n, x):", "- return f(n - 1, x - 1)", "- else:", "- return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1])", "+ return func(n - 1, x - 1)", "+ return p[n - 1] + 1 + func(n - 1, x - 2 - a[n - 1])", "-print((f(N, X)))", "+print((func(N, X)))" ]
false
0.042594
0.035679
1.193806
[ "s565315813", "s235595705" ]
u046158516
p03356
python
s896316075
s861401533
975
403
89,580
84,724
Accepted
Accepted
58.67
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): ...
57
59
1,436
1,439
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = se...
false
3.389831
[ "-uf = UnionFind(n)", "+uf = UnionFind(n + 1)", "- uf.union(x - 1, y - 1)", "-yes = [0] * n", "-for i in range(n):", "- if uf.same(p[i] - 1, i):", "- yes[p[i] - 1] = 1", "-print((sum(yes)))", "+ uf.union(p[x - 1], p[y - 1])", "+ans = 0", "+for i in range(1, n + 1):", "+ if u...
false
0.038662
0.036862
1.048844
[ "s896316075", "s861401533" ]
u867848444
p03352
python
s639176058
s529195240
21
18
2,940
2,940
Accepted
Accepted
14.29
x=int(eval(input())) p=10 ans=0 for i in range(1,1+x): for j in range(2,p+1): if i**j<=x: ans=max(ans,i**j) print(ans)
x=int(eval(input())) maxim=0 for i in range(2,32): for j in range(2,10): temp=i**j if temp<=x and maxim<temp: maxim=temp print((maxim if maxim>0 else 1))
9
8
157
184
x = int(eval(input())) p = 10 ans = 0 for i in range(1, 1 + x): for j in range(2, p + 1): if i**j <= x: ans = max(ans, i**j) print(ans)
x = int(eval(input())) maxim = 0 for i in range(2, 32): for j in range(2, 10): temp = i**j if temp <= x and maxim < temp: maxim = temp print((maxim if maxim > 0 else 1))
false
11.111111
[ "-p = 10", "-ans = 0", "-for i in range(1, 1 + x):", "- for j in range(2, p + 1):", "- if i**j <= x:", "- ans = max(ans, i**j)", "-print(ans)", "+maxim = 0", "+for i in range(2, 32):", "+ for j in range(2, 10):", "+ temp = i**j", "+ if temp <= x and maxim ...
false
0.050326
0.03719
1.353232
[ "s639176058", "s529195240" ]
u312025627
p03290
python
s208047336
s483363708
223
202
42,480
41,584
Accepted
Accepted
9.42
def main(): D, G = (int(i) for i in input().split()) pc = [[int(i) for i in input().split()] for j in range(D)] ans = 10**6 for bit in range(1<<D): completed = [] for i in range(D): if bit & (1<<i): completed.append(i) score = 0 solve...
def main(): D, G = (int(i) for i in input().split()) A = [[int(i) for i in input().split()] for j in range(D)] ans = 10**6 for bit in range(1 << D): # bitが立っている問題のコンプリートボーナスを得る cur = 0 cur_sum = 0 cur_set = set() for j in range(D): if (bit & (1 << j)...
29
31
859
984
def main(): D, G = (int(i) for i in input().split()) pc = [[int(i) for i in input().split()] for j in range(D)] ans = 10**6 for bit in range(1 << D): completed = [] for i in range(D): if bit & (1 << i): completed.append(i) score = 0 solve = 0 ...
def main(): D, G = (int(i) for i in input().split()) A = [[int(i) for i in input().split()] for j in range(D)] ans = 10**6 for bit in range(1 << D): # bitが立っている問題のコンプリートボーナスを得る cur = 0 cur_sum = 0 cur_set = set() for j in range(D): if bit & (1 << j): ...
false
6.451613
[ "- pc = [[int(i) for i in input().split()] for j in range(D)]", "+ A = [[int(i) for i in input().split()] for j in range(D)]", "- for bit in range(1 << D):", "- completed = []", "- for i in range(D):", "- if bit & (1 << i):", "- completed.append(i)", "-...
false
0.037725
0.080361
0.469449
[ "s208047336", "s483363708" ]