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
u604839890
p02676
python
s622516650
s262095542
65
33
61,456
9,112
Accepted
Accepted
49.23
k = int(eval(input())) s = eval(input()) print((s if len(s) <= k else s[0:k:]+'...'))
k = int(eval(input())) s = eval(input()) print((s if len(s) <= k else s[:k:]+'...'))
3
3
73
72
k = int(eval(input())) s = eval(input()) print((s if len(s) <= k else s[0:k:] + "..."))
k = int(eval(input())) s = eval(input()) print((s if len(s) <= k else s[:k:] + "..."))
false
0
[ "-print((s if len(s) <= k else s[0:k:] + \"...\"))", "+print((s if len(s) <= k else s[:k:] + \"...\"))" ]
false
0.046689
0.043734
1.067554
[ "s622516650", "s262095542" ]
u157232135
p02572
python
s006139692
s390523711
145
131
31,124
31,564
Accepted
Accepted
9.66
from itertools import accumulate def main(): mod=10**9+7 n=int(eval(input())) a=list(map(int,input().split())) aa=[0]+list(accumulate(a)) ans=0 for i in range(n-1): ans += a[i]*(aa[-1]-aa[i+1])%mod print((ans%mod)) if __name__ == '__main__': main()
from itertools import accumulate def main(): n=int(eval(input())) a=list(map(int,input().split())) aa=list(accumulate(a)) mod=10**9+7 ans=0 for i in range(n): ans += a[i]*(aa[-1]-aa[i])%mod print((ans%mod)) if __name__ == "__main__": main()
13
13
293
289
from itertools import accumulate def main(): mod = 10**9 + 7 n = int(eval(input())) a = list(map(int, input().split())) aa = [0] + list(accumulate(a)) ans = 0 for i in range(n - 1): ans += a[i] * (aa[-1] - aa[i + 1]) % mod print((ans % mod)) if __name__ == "__main__": main()
from itertools import accumulate def main(): n = int(eval(input())) a = list(map(int, input().split())) aa = list(accumulate(a)) mod = 10**9 + 7 ans = 0 for i in range(n): ans += a[i] * (aa[-1] - aa[i]) % mod print((ans % mod)) if __name__ == "__main__": main()
false
0
[ "- mod = 10**9 + 7", "- aa = [0] + list(accumulate(a))", "+ aa = list(accumulate(a))", "+ mod = 10**9 + 7", "- for i in range(n - 1):", "- ans += a[i] * (aa[-1] - aa[i + 1]) % mod", "+ for i in range(n):", "+ ans += a[i] * (aa[-1] - aa[i]) % mod" ]
false
0.047381
0.127014
0.373041
[ "s006139692", "s390523711" ]
u325282913
p02971
python
s645815209
s602955409
613
303
14,092
90,408
Accepted
Accepted
50.57
N = int(eval(input())) arr = [0] * N for i in range(N): arr[i] = int(eval(input())) sorted_list = sorted(arr) max = sorted_list[N-1] sub_max = sorted_list[N-2] max_count = arr.count(max) if max_count == 1: max_index = arr.index(max) for i in range(N): if i == max_index: p...
N = int(eval(input())) arr = [int(eval(input())) for _ in range(N)] arr2 = sorted(arr) max1 = arr2[-1] max2 = arr2[-2] for i in range(N): if arr[i] == max1: print(max2) else: print(max1)
21
10
414
207
N = int(eval(input())) arr = [0] * N for i in range(N): arr[i] = int(eval(input())) sorted_list = sorted(arr) max = sorted_list[N - 1] sub_max = sorted_list[N - 2] max_count = arr.count(max) if max_count == 1: max_index = arr.index(max) for i in range(N): if i == max_index: print(sub_max...
N = int(eval(input())) arr = [int(eval(input())) for _ in range(N)] arr2 = sorted(arr) max1 = arr2[-1] max2 = arr2[-2] for i in range(N): if arr[i] == max1: print(max2) else: print(max1)
false
52.380952
[ "-arr = [0] * N", "+arr = [int(eval(input())) for _ in range(N)]", "+arr2 = sorted(arr)", "+max1 = arr2[-1]", "+max2 = arr2[-2]", "- arr[i] = int(eval(input()))", "-sorted_list = sorted(arr)", "-max = sorted_list[N - 1]", "-sub_max = sorted_list[N - 2]", "-max_count = arr.count(max)", "-if ma...
false
0.045406
0.04575
0.992496
[ "s645815209", "s602955409" ]
u818655004
p03493
python
s241406041
s831322436
19
17
3,316
2,940
Accepted
Accepted
10.53
s = eval(input()) a = int(s[0]) b = int(s[1]) c = int(s[2]) print((a+b+c))
s = eval(input()) result = int(s[0]) + int(s[1]) + int(s[2]) print(result)
8
3
76
70
s = eval(input()) a = int(s[0]) b = int(s[1]) c = int(s[2]) print((a + b + c))
s = eval(input()) result = int(s[0]) + int(s[1]) + int(s[2]) print(result)
false
62.5
[ "-a = int(s[0])", "-b = int(s[1])", "-c = int(s[2])", "-print((a + b + c))", "+result = int(s[0]) + int(s[1]) + int(s[2])", "+print(result)" ]
false
0.069261
0.087481
0.791724
[ "s241406041", "s831322436" ]
u644907318
p03779
python
s411476756
s144154550
162
73
38,640
62,776
Accepted
Accepted
54.94
X = int(eval(input())) k = 1 while (k*(k+1))//2<X: k += 1 print(k)
X = int(eval(input())) t = 1 while X>(t*(t+1))//2: t += 1 print(t)
5
5
68
68
X = int(eval(input())) k = 1 while (k * (k + 1)) // 2 < X: k += 1 print(k)
X = int(eval(input())) t = 1 while X > (t * (t + 1)) // 2: t += 1 print(t)
false
0
[ "-k = 1", "-while (k * (k + 1)) // 2 < X:", "- k += 1", "-print(k)", "+t = 1", "+while X > (t * (t + 1)) // 2:", "+ t += 1", "+print(t)" ]
false
0.035144
0.116257
0.302292
[ "s411476756", "s144154550" ]
u062691227
p02574
python
s311147766
s182479407
545
351
227,356
205,104
Accepted
Accepted
35.6
from functools import reduce from math import gcd n = int(eval(input())) aa = list(map(int, input().split())) ma = max(aa) cnt = [0] * (ma+1) for a in aa: cnt[a] += 1 if reduce(gcd, aa) != 1: print('not coprime') elif all([sum(cnt[i::i]) <= 1 for i in range(2, ma)]): print('pairwise coprime')...
from functools import reduce from math import gcd n = int(eval(input())) aa = list(map(int, input().split())) ma = max(aa) cnt = [0] * (ma+1) for a in aa: cnt[a] += 1 if reduce(gcd, aa) != 1: print('not coprime') elif all(sum(cnt[i::i]) <= 1 for i in range(2, ma)): print('pairwise coprime') ...
16
16
351
349
from functools import reduce from math import gcd n = int(eval(input())) aa = list(map(int, input().split())) ma = max(aa) cnt = [0] * (ma + 1) for a in aa: cnt[a] += 1 if reduce(gcd, aa) != 1: print("not coprime") elif all([sum(cnt[i::i]) <= 1 for i in range(2, ma)]): print("pairwise coprime") else: p...
from functools import reduce from math import gcd n = int(eval(input())) aa = list(map(int, input().split())) ma = max(aa) cnt = [0] * (ma + 1) for a in aa: cnt[a] += 1 if reduce(gcd, aa) != 1: print("not coprime") elif all(sum(cnt[i::i]) <= 1 for i in range(2, ma)): print("pairwise coprime") else: pri...
false
0
[ "-elif all([sum(cnt[i::i]) <= 1 for i in range(2, ma)]):", "+elif all(sum(cnt[i::i]) <= 1 for i in range(2, ma)):" ]
false
0.039885
0.035612
1.119976
[ "s311147766", "s182479407" ]
u602677143
p03545
python
s591142557
s893900232
172
17
38,256
3,060
Accepted
Accepted
90.12
import sys s = (eval(input())) a = int(s[0]) b = int(s[1]) c = int(s[2]) d = int(s[3]) ls = ["+","-"] ans = a+b+c+d if ans == 7: print((str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")) sys.exit() ans = a+b+c-d if ans == 7: print((str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")) sys.exit() ans...
a,b,c,d = eval(input()) for i in range(3**2): ls = ["+","+","+"] for j in range(len(ls)): if (i >> j) & 1: ls[j] = "-" if eval(a+ls[0]+b+ls[1]+c+ls[2]+d) == 7: print((a+ls[0]+b+ls[1]+c+ls[2]+d+"=7")) break
39
11
917
265
import sys s = eval(input()) a = int(s[0]) b = int(s[1]) c = int(s[2]) d = int(s[3]) ls = ["+", "-"] ans = a + b + c + d if ans == 7: print((str(a) + "+" + str(b) + "+" + str(c) + "+" + str(d) + "=7")) sys.exit() ans = a + b + c - d if ans == 7: print((str(a) + "+" + str(b) + "+" + str(c) + "-" + str(d) + ...
a, b, c, d = eval(input()) for i in range(3**2): ls = ["+", "+", "+"] for j in range(len(ls)): if (i >> j) & 1: ls[j] = "-" if eval(a + ls[0] + b + ls[1] + c + ls[2] + d) == 7: print((a + ls[0] + b + ls[1] + c + ls[2] + d + "=7")) break
false
71.794872
[ "-import sys", "-", "-s = eval(input())", "-a = int(s[0])", "-b = int(s[1])", "-c = int(s[2])", "-d = int(s[3])", "-ls = [\"+\", \"-\"]", "-ans = a + b + c + d", "-if ans == 7:", "- print((str(a) + \"+\" + str(b) + \"+\" + str(c) + \"+\" + str(d) + \"=7\"))", "- sys.exit()", "-ans = a ...
false
0.042118
0.036649
1.149227
[ "s591142557", "s893900232" ]
u071680334
p02955
python
s054096532
s993053908
332
230
3,064
9,168
Accepted
Accepted
30.72
from math import sqrt def Divisor_Set(n): s = set() for i in range(1, int(sqrt(n))+2): if n%i == 0: s.add(i) s.add(n//i) return s def main(): n, k = list(map(int, input().split())) a = list(map(int, input().split())) a_sum = sum(a) s = Divisor_Se...
from math import sqrt def Divisor_Set(n): s = set() for i in range(1, int(sqrt(n))+2): if n%i == 0: s.add(i) s.add(n//i) return s def main(): n, k = list(map(int, input().split())) a = list(map(int, input().split())) a_sum = sum(a) st = Divisor...
29
30
719
693
from math import sqrt def Divisor_Set(n): s = set() for i in range(1, int(sqrt(n)) + 2): if n % i == 0: s.add(i) s.add(n // i) return s def main(): n, k = list(map(int, input().split())) a = list(map(int, input().split())) a_sum = sum(a) s = Divisor_Set(a_...
from math import sqrt def Divisor_Set(n): s = set() for i in range(1, int(sqrt(n)) + 2): if n % i == 0: s.add(i) s.add(n // i) return s def main(): n, k = list(map(int, input().split())) a = list(map(int, input().split())) a_sum = sum(a) st = Divisor_Set(a...
false
3.333333
[ "- s = Divisor_Set(a_sum)", "+ st = Divisor_Set(a_sum)", "- for v in s:", "- a_mod = [x % v for x in a]", "- a_mod.sort()", "- for i in range(1, n):", "- a_mod[i] += a_mod[i - 1]", "- for i in range(n):", "- l, r = a_mod[i], v * (n - i - 1) ...
false
0.07405
0.007
10.578037
[ "s054096532", "s993053908" ]
u638456847
p03835
python
s162937008
s126269278
1,656
1,492
2,940
2,940
Accepted
Accepted
9.9
K,S=list(map(int, input().split())) ans=0 for x in range(K+1): for y in range(K+1): z=S-x-y if 0<=z and z<=K: ans+=1 print(ans)
K,S=list(map(int, input().split())) ans=0 for x in range(K+1): for y in range(K+1): z=S-x-y if 0<= z <=K: ans+=1 print(ans)
10
10
164
160
K, S = list(map(int, input().split())) ans = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if 0 <= z and z <= K: ans += 1 print(ans)
K, S = list(map(int, input().split())) ans = 0 for x in range(K + 1): for y in range(K + 1): z = S - x - y if 0 <= z <= K: ans += 1 print(ans)
false
0
[ "- if 0 <= z and z <= K:", "+ if 0 <= z <= K:" ]
false
0.035921
0.084814
0.423524
[ "s162937008", "s126269278" ]
u314906167
p03372
python
s414299681
s294283172
1,156
689
33,128
37,852
Accepted
Accepted
40.4
N, C = list(map(int, input().split())) x = [] v = [] for _ in range(N): xi, vi = list(map(int, input().split())) x.append(xi) v.append(vi) vsp = [0] * (N + 1) vsn = [0] * (N + 1) dprp = [0] * (N + 1) dprn = [0] * (N + 1) dpsp = [0] * (N + 1) dpsn = [0] * (N + 1) for i in range(N): vsp[i + ...
N, C = list(map(int, input().split())) x = [] v = [] for _ in range(N): xi, vi = list(map(int, input().split())) x.append(xi) v.append(vi) vsp = [0] * (N + 1) vsn = [0] * (N + 1) dprp = [0] * (N + 1) dprn = [0] * (N + 1) dpsp = [0] * (N + 1) dpsn = [0] * (N + 1) for i in range(N): vsp[i + ...
23
23
714
717
N, C = list(map(int, input().split())) x = [] v = [] for _ in range(N): xi, vi = list(map(int, input().split())) x.append(xi) v.append(vi) vsp = [0] * (N + 1) vsn = [0] * (N + 1) dprp = [0] * (N + 1) dprn = [0] * (N + 1) dpsp = [0] * (N + 1) dpsn = [0] * (N + 1) for i in range(N): vsp[i + 1] = vsp[i] + ...
N, C = list(map(int, input().split())) x = [] v = [] for _ in range(N): xi, vi = list(map(int, input().split())) x.append(xi) v.append(vi) vsp = [0] * (N + 1) vsn = [0] * (N + 1) dprp = [0] * (N + 1) dprn = [0] * (N + 1) dpsp = [0] * (N + 1) dpsn = [0] * (N + 1) for i in range(N): vsp[i + 1] = vsp[i] + ...
false
0
[ "-ans = max(max(dprp[i] + dpsn[N - i], dprn[i] + dpsp[N - i]) for i in range(N + 1))", "+ans = max([max(dprp[i] + dpsn[N - i], dprn[i] + dpsp[N - i]) for i in range(N + 1)])" ]
false
0.047371
0.046923
1.009561
[ "s414299681", "s294283172" ]
u562935282
p03574
python
s014758423
s716831036
30
26
3,188
3,444
Accepted
Accepted
13.33
h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] ans = [] for i in range(h): buf = [] for j in range(w): if s[i][j] == '.': cnt = 0 for r in range(max(0, i - 1), min(h, i + 2)): for c in range(max(0, j - 1), min(w, j + 2)): ...
def main(): H, W = map(int, input().split()) s = [input() for _ in range(H)] ctr = [[0] * W for _ in range(H)] for r, row in enumerate(s): for c, cell in enumerate(row): if cell == '#': for dr in (-1, 0, 1): for dc in (-1, 0, 1): ...
19
28
535
779
h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] ans = [] for i in range(h): buf = [] for j in range(w): if s[i][j] == ".": cnt = 0 for r in range(max(0, i - 1), min(h, i + 2)): for c in range(max(0, j - 1), min(w, j + 2)): ...
def main(): H, W = map(int, input().split()) s = [input() for _ in range(H)] ctr = [[0] * W for _ in range(H)] for r, row in enumerate(s): for c, cell in enumerate(row): if cell == "#": for dr in (-1, 0, 1): for dc in (-1, 0, 1): ...
false
32.142857
[ "-h, w = list(map(int, input().split()))", "-s = [eval(input()) for _ in range(h)]", "-ans = []", "-for i in range(h):", "- buf = []", "- for j in range(w):", "- if s[i][j] == \".\":", "- cnt = 0", "- for r in range(max(0, i - 1), min(h, i + 2)):", "- ...
false
0.044282
0.044771
0.989085
[ "s014758423", "s716831036" ]
u127499732
p03062
python
s160112856
s593785015
60
54
14,116
14,116
Accepted
Accepted
10
def main(): n, *a = list(map(int, open(0).read().split())) b = [i for i in a if i <= 0] *ab, = [abs(x) for x in a] c, d = sum(a), sum(b) if len(b) % 2 == 0: print((c - 2 * d)) else: print((c - 2 * d - 2 * min(ab))) if __name__ == '__main__': main()
def main(): n, *a = list(map(int, open(0).read().split())) b = [i for i in a if i <= 0] *ab, = list(map(abs, a)) c = sum(ab) if len(b) % 2 == 0: print(c) else: print((c - 2 * min(ab))) if __name__ == '__main__': main()
13
13
302
263
def main(): n, *a = list(map(int, open(0).read().split())) b = [i for i in a if i <= 0] (*ab,) = [abs(x) for x in a] c, d = sum(a), sum(b) if len(b) % 2 == 0: print((c - 2 * d)) else: print((c - 2 * d - 2 * min(ab))) if __name__ == "__main__": main()
def main(): n, *a = list(map(int, open(0).read().split())) b = [i for i in a if i <= 0] (*ab,) = list(map(abs, a)) c = sum(ab) if len(b) % 2 == 0: print(c) else: print((c - 2 * min(ab))) if __name__ == "__main__": main()
false
0
[ "- (*ab,) = [abs(x) for x in a]", "- c, d = sum(a), sum(b)", "+ (*ab,) = list(map(abs, a))", "+ c = sum(ab)", "- print((c - 2 * d))", "+ print(c)", "- print((c - 2 * d - 2 * min(ab)))", "+ print((c - 2 * min(ab)))" ]
false
0.038197
0.149243
0.255936
[ "s160112856", "s593785015" ]
u619785253
p03146
python
s301941415
s588873648
480
20
34,708
2,940
Accepted
Accepted
95.83
s = int(eval(input())) s_ = s x = [s] counter = 0 #while s != 1: for _ in range(1000000): if s%2 ==0: s = s/2 x.append(s) else: s = 3*s+1 x.append(s) # counter +=1 if s_ == 4 or s_ == 2 or s_ == 1: print((4)) else: print((x.index(4)+4)) #print(x)
s = int(eval(input())) s_ = s counter = 0 if s == 4 or s == 2 or s ==1: print((counter+4)) else: while s!=4: if s%2 ==0: s = s//2 counter +=1 else: s = 3*s+1 counter +=1 else: print((counter+4))
20
17
288
251
s = int(eval(input())) s_ = s x = [s] counter = 0 # while s != 1: for _ in range(1000000): if s % 2 == 0: s = s / 2 x.append(s) else: s = 3 * s + 1 x.append(s) # counter +=1 if s_ == 4 or s_ == 2 or s_ == 1: print((4)) else: print((x.index(4) + 4)) # print(x)
s = int(eval(input())) s_ = s counter = 0 if s == 4 or s == 2 or s == 1: print((counter + 4)) else: while s != 4: if s % 2 == 0: s = s // 2 counter += 1 else: s = 3 * s + 1 counter += 1 else: print((counter + 4))
false
15
[ "-x = [s]", "-# while s != 1:", "-for _ in range(1000000):", "- if s % 2 == 0:", "- s = s / 2", "- x.append(s)", "+if s == 4 or s == 2 or s == 1:", "+ print((counter + 4))", "+else:", "+ while s != 4:", "+ if s % 2 == 0:", "+ s = s // 2", "+ ...
false
0.957466
0.037483
25.543897
[ "s301941415", "s588873648" ]
u077291787
p03013
python
s044952340
s225726752
59
48
18,336
14,180
Accepted
Accepted
18.64
# ABC129C - Typical Stairs import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) A = set(map(int, [eval(input()) for _ in range(M)])) MOD = 10 ** 9 + 7 dp = [0] * (N + 1) dp[:2] = 1, 1 if 1 not in A else 0 for i in range(2, N + 1): if i not...
# ABC129C - Typical Stairs def main(): N, M, *A = list(map(int, open(0).read().split())) A = set(A) MOD = 10 ** 9 + 7 dp = [0] * (N + 1) dp[:2] = 1, 1 if 1 not in A else 0 for i in range(2, N + 1): if i not in A: dp[i] = (dp[i - 1] + dp[i - 2]) % MOD print((dp[-...
18
15
434
360
# ABC129C - Typical Stairs import sys input = sys.stdin.readline def main(): N, M = tuple(map(int, input().split())) A = set(map(int, [eval(input()) for _ in range(M)])) MOD = 10**9 + 7 dp = [0] * (N + 1) dp[:2] = 1, 1 if 1 not in A else 0 for i in range(2, N + 1): if i not in A: ...
# ABC129C - Typical Stairs def main(): N, M, *A = list(map(int, open(0).read().split())) A = set(A) MOD = 10**9 + 7 dp = [0] * (N + 1) dp[:2] = 1, 1 if 1 not in A else 0 for i in range(2, N + 1): if i not in A: dp[i] = (dp[i - 1] + dp[i - 2]) % MOD print((dp[-1])) if __...
false
16.666667
[ "-import sys", "-", "-input = sys.stdin.readline", "-", "-", "- N, M = tuple(map(int, input().split()))", "- A = set(map(int, [eval(input()) for _ in range(M)]))", "+ N, M, *A = list(map(int, open(0).read().split()))", "+ A = set(A)" ]
false
0.034679
0.036621
0.94696
[ "s044952340", "s225726752" ]
u368780724
p02956
python
s700505472
s005955735
1,703
1,135
120,828
170,208
Accepted
Accepted
33.35
import sys class BIT: #1-indexed def __init__(self, n): self.size = n self.tree = [0] * (n + 1) self.p = 2**(n.bit_length() - 1) self.dep = n.bit_length() def get(self, i): s = 0 while i > 0: s += self.tree[i] i -= i...
import sys readline = sys.stdin.readline class BIT: #1-indexed def __init__(self, n): self.size = n self.tree = [0] * (n + 1) self.p = 2**(n.bit_length() - 1) self.dep = n.bit_length() def get(self, i): s = 0 while i > 0: s += self.tr...
69
89
1,548
1,872
import sys class BIT: # 1-indexed def __init__(self, n): self.size = n self.tree = [0] * (n + 1) self.p = 2 ** (n.bit_length() - 1) self.dep = n.bit_length() def get(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & -i ...
import sys readline = sys.stdin.readline class BIT: # 1-indexed def __init__(self, n): self.size = n self.tree = [0] * (n + 1) self.p = 2 ** (n.bit_length() - 1) self.dep = n.bit_length() def get(self, i): s = 0 while i > 0: s += self.tree[i] ...
false
22.47191
[ "+", "+readline = sys.stdin.readline", "- C = {v: k for k, v in enumerate(L2, 1)}", "+ C = {v: k for k, v in enumerate(L2)}", "-N = int(eval(input()))", "-mod = 998244353", "-ans = N * pow(2, N - 1, mod) % mod", "-points = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]", "-p...
false
0.078978
0.936451
0.084338
[ "s700505472", "s005955735" ]
u417794477
p03252
python
s598553276
s858318726
141
124
3,632
3,632
Accepted
Accepted
12.06
s = input() t = input() s_memo = {} t_memo = {} for i in range(len(s)): c1 = s[i] c2 = t[i] if (c1 in s_memo and s_memo[c1] != c2) or \ (c2 in t_memo and t_memo[c2] != c1): print("No") exit() s_memo[c1] = c2 t_memo[c2] = c1 print("Yes")
S = eval(input()) T = eval(input()) Sdictionary = {} Tdictionary = {} ans = "Yes" for i in range(len(S)): if T[i] in Tdictionary: if Tdictionary[T[i]] == S[i]: continue else: ans = "No" else: Tdictionary[T[i]] = S[i] if S[i] in Sdictionary: ...
16
23
301
463
s = input() t = input() s_memo = {} t_memo = {} for i in range(len(s)): c1 = s[i] c2 = t[i] if (c1 in s_memo and s_memo[c1] != c2) or (c2 in t_memo and t_memo[c2] != c1): print("No") exit() s_memo[c1] = c2 t_memo[c2] = c1 print("Yes")
S = eval(input()) T = eval(input()) Sdictionary = {} Tdictionary = {} ans = "Yes" for i in range(len(S)): if T[i] in Tdictionary: if Tdictionary[T[i]] == S[i]: continue else: ans = "No" else: Tdictionary[T[i]] = S[i] if S[i] in Sdictionary: if Sdiction...
false
30.434783
[ "-s = input()", "-t = input()", "-s_memo = {}", "-t_memo = {}", "-for i in range(len(s)):", "- c1 = s[i]", "- c2 = t[i]", "- if (c1 in s_memo and s_memo[c1] != c2) or (c2 in t_memo and t_memo[c2] != c1):", "- print(\"No\")", "- exit()", "- s_memo[c1] = c2", "- t_me...
false
0.042782
0.099744
0.428912
[ "s598553276", "s858318726" ]
u367701763
p03409
python
s106039982
s895052843
175
103
38,212
74,912
Accepted
Accepted
41.14
import sys input = sys.stdin.readline from scipy.sparse import csr_matrix from scipy.sparse.csgraph import maximum_bipartite_matching import numpy as np N = int(eval(input())) X = [] Y = [] for i in range(N): X.append([int(i) for i in input().split()]) for i in range(N): Y.append([int(i) for ...
from collections import deque class MaxFlow: class Edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def __init__(self, node_size, inf): self._node = node_size self._inf = inf self._level = [-1] * self._node self...
35
95
827
3,106
import sys input = sys.stdin.readline from scipy.sparse import csr_matrix from scipy.sparse.csgraph import maximum_bipartite_matching import numpy as np N = int(eval(input())) X = [] Y = [] for i in range(N): X.append([int(i) for i in input().split()]) for i in range(N): Y.append([int(i) for i in input().spli...
from collections import deque class MaxFlow: class Edge: def __init__(self, to, cap, rev): self.to, self.cap, self.rev = to, cap, rev def __init__(self, node_size, inf): self._node = node_size self._inf = inf self._level = [-1] * self._node self._iter = [0]...
false
63.157895
[ "-import sys", "+from collections import deque", "-input = sys.stdin.readline", "-from scipy.sparse import csr_matrix", "-from scipy.sparse.csgraph import maximum_bipartite_matching", "-import numpy as np", "+class MaxFlow:", "+ class Edge:", "+ def __init__(self, to, cap, rev):", "+ ...
false
0.503208
0.037093
13.566094
[ "s106039982", "s895052843" ]
u695644361
p02726
python
s901149848
s237294051
1,352
1,188
3,444
3,444
Accepted
Accepted
12.13
n,x,y=list(map(int,input().split())) a=[0]*n z=y-x-1 for i in range(1,n): for j in range(i+1,n+1): p=min(j-i,abs(i-x)+1+abs(j-y)) a[p]+=1 for k in a[1:]: print(k)
n,x,y=list(map(int,input().split())) a=[0]*n for i in range(1,n): for j in range(i+1,n+1): a[min(j-i,abs(i-x)+1+abs(j-y))]+=1 for k in a[1:]: print(k)
9
7
171
155
n, x, y = list(map(int, input().split())) a = [0] * n z = y - x - 1 for i in range(1, n): for j in range(i + 1, n + 1): p = min(j - i, abs(i - x) + 1 + abs(j - y)) a[p] += 1 for k in a[1:]: print(k)
n, x, y = list(map(int, input().split())) a = [0] * n for i in range(1, n): for j in range(i + 1, n + 1): a[min(j - i, abs(i - x) + 1 + abs(j - y))] += 1 for k in a[1:]: print(k)
false
22.222222
[ "-z = y - x - 1", "- p = min(j - i, abs(i - x) + 1 + abs(j - y))", "- a[p] += 1", "+ a[min(j - i, abs(i - x) + 1 + abs(j - y))] += 1" ]
false
0.038915
0.088329
0.440572
[ "s901149848", "s237294051" ]
u729133443
p02657
python
s532689677
s812775269
60
29
61,664
8,992
Accepted
Accepted
51.67
print((eval(input().replace(' ','*'))))
print((eval(input().replace(*' *'))))
1
1
37
35
print((eval(input().replace(" ", "*"))))
print((eval(input().replace(*" *"))))
false
0
[ "-print((eval(input().replace(\" \", \"*\"))))", "+print((eval(input().replace(*\" *\"))))" ]
false
0.043292
0.036698
1.179673
[ "s532689677", "s812775269" ]
u167647458
p03127
python
s300258904
s991581975
131
79
14,252
16,296
Accepted
Accepted
39.69
def main(): n = int(eval(input())) a = list(map(int, input().split())) m = min(a) next_m = m count = 0 while count != n: m = next_m count = 0 pre = a[0] for i in range(n): if a[i] == pre: count += 1 a[i] %= m ...
from fractions import gcd def main(): n = int(eval(input())) a = list(map(int, input().split())) ans = a[0] for aa in a: ans = gcd(ans, aa) print(ans) if __name__ == '__main__': main()
23
15
511
245
def main(): n = int(eval(input())) a = list(map(int, input().split())) m = min(a) next_m = m count = 0 while count != n: m = next_m count = 0 pre = a[0] for i in range(n): if a[i] == pre: count += 1 a[i] %= m if ...
from fractions import gcd def main(): n = int(eval(input())) a = list(map(int, input().split())) ans = a[0] for aa in a: ans = gcd(ans, aa) print(ans) if __name__ == "__main__": main()
false
34.782609
[ "+from fractions import gcd", "+", "+", "- m = min(a)", "- next_m = m", "- count = 0", "- while count != n:", "- m = next_m", "- count = 0", "- pre = a[0]", "- for i in range(n):", "- if a[i] == pre:", "- count += 1", "- ...
false
0.042864
0.056824
0.754327
[ "s300258904", "s991581975" ]
u716529032
p03779
python
s306406312
s039829259
44
18
2,940
3,188
Accepted
Accepted
59.09
X = int(eval(input())) i = 1 while((i ** 2 + i) / 2 < X): i += 1 print(i)
from math import ceil x = int(eval(input())) print((ceil(((1 + 8 * x) ** 0.5 - 1) / 2)))
7
3
77
82
X = int(eval(input())) i = 1 while (i**2 + i) / 2 < X: i += 1 print(i)
from math import ceil x = int(eval(input())) print((ceil(((1 + 8 * x) ** 0.5 - 1) / 2)))
false
57.142857
[ "-X = int(eval(input()))", "-i = 1", "-while (i**2 + i) / 2 < X:", "- i += 1", "-print(i)", "+from math import ceil", "+", "+x = int(eval(input()))", "+print((ceil(((1 + 8 * x) ** 0.5 - 1) / 2)))" ]
false
0.041966
0.041738
1.005462
[ "s306406312", "s039829259" ]
u695811449
p03310
python
s267206616
s777200990
1,121
968
25,676
25,672
Accepted
Accepted
13.65
N=int(eval(input())) A=list(map(int,input().split())) cut_1=1 cut_2=2 cut_3=3 A_0=A[:cut_1] S_0=sum(A_0) A_1=A[cut_1:cut_2] S_1=sum(A_1) A_2=A[cut_2:cut_3] S_2=sum(A_2) A_3=A[cut_3:] S_3=sum(A_3) def irekae(S,T,i): if abs(S-T)>abs((S-A[i-1])-(T+A[i-1])): S=S-A[i-1] ...
N=int(eval(input())) A=list(map(int,input().split())) SUM=[0] for a in A: SUM.append(SUM[-1]+a) i=1 j=2 k=3 P=SUM[i] Q=SUM[j]-SUM[i] R=SUM[k]-SUM[j] S=SUM[N]-SUM[k] ANS=10**10 check=1 while j<N-1: check=1 while check==1: check=0 if i<j-1: if abs(P-Q)>...
57
46
991
772
N = int(eval(input())) A = list(map(int, input().split())) cut_1 = 1 cut_2 = 2 cut_3 = 3 A_0 = A[:cut_1] S_0 = sum(A_0) A_1 = A[cut_1:cut_2] S_1 = sum(A_1) A_2 = A[cut_2:cut_3] S_2 = sum(A_2) A_3 = A[cut_3:] S_3 = sum(A_3) def irekae(S, T, i): if abs(S - T) > abs((S - A[i - 1]) - (T + A[i - 1])): S = S - ...
N = int(eval(input())) A = list(map(int, input().split())) SUM = [0] for a in A: SUM.append(SUM[-1] + a) i = 1 j = 2 k = 3 P = SUM[i] Q = SUM[j] - SUM[i] R = SUM[k] - SUM[j] S = SUM[N] - SUM[k] ANS = 10**10 check = 1 while j < N - 1: check = 1 while check == 1: check = 0 if i < j - 1: ...
false
19.298246
[ "-cut_1 = 1", "-cut_2 = 2", "-cut_3 = 3", "-A_0 = A[:cut_1]", "-S_0 = sum(A_0)", "-A_1 = A[cut_1:cut_2]", "-S_1 = sum(A_1)", "-A_2 = A[cut_2:cut_3]", "-S_2 = sum(A_2)", "-A_3 = A[cut_3:]", "-S_3 = sum(A_3)", "-", "-", "-def irekae(S, T, i):", "- if abs(S - T) > abs((S - A[i - 1]) - (T...
false
0.084764
0.050554
1.676682
[ "s267206616", "s777200990" ]
u691874710
p02690
python
s154929994
s433275485
38
35
9,132
9,124
Accepted
Accepted
7.89
x=int(eval(input())) A=0 B=0 for a in range(-120, 120): a5 = a**5 for b in range(-120, 120): if a5 - b**5 == x: A = a B = b break print((A,B))
x=int(eval(input())) A = 0 B = 0 for a in range(-120, 120): a5 = a**5 for b in range(-120, 120): if (a5 < x and b >=0 ) or (a5 > x and b <= 0): continue if a5 - b**5 == x: A = a B = b break print((A, B))
11
13
196
279
x = int(eval(input())) A = 0 B = 0 for a in range(-120, 120): a5 = a**5 for b in range(-120, 120): if a5 - b**5 == x: A = a B = b break print((A, B))
x = int(eval(input())) A = 0 B = 0 for a in range(-120, 120): a5 = a**5 for b in range(-120, 120): if (a5 < x and b >= 0) or (a5 > x and b <= 0): continue if a5 - b**5 == x: A = a B = b break print((A, B))
false
15.384615
[ "+ if (a5 < x and b >= 0) or (a5 > x and b <= 0):", "+ continue" ]
false
0.062294
0.048736
1.278198
[ "s154929994", "s433275485" ]
u747703115
p03244
python
s300905097
s756773505
92
75
25,960
25,188
Accepted
Accepted
18.48
from collections import Counter n = int(eval(input())) V = list(map(int,input().split())) E = [] O = [] for i,v in enumerate(V): if i%2==0: O.append(v) else: E.append(v) cO = Counter(O).most_common(); cO.append((-1,0)) cE = Counter(E).most_common(); cE.append((-1,0)) if cO[0][0]==c...
from collections import Counter n = int(eval(input())) V = list(map(int,input().split())) cv1 = Counter(V[::2]).most_common() cv2 = Counter(V[1::2]).most_common() cv1.append((-1,0)); cv2.append((-1,0)) if cv1[0][0] != cv2[0][0]: print((n-cv1[0][1]-cv2[0][1])) else: print((min(n-cv1[1][1]-cv2[0][1], n-c...
18
10
430
331
from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) E = [] O = [] for i, v in enumerate(V): if i % 2 == 0: O.append(v) else: E.append(v) cO = Counter(O).most_common() cO.append((-1, 0)) cE = Counter(E).most_common() cE.append((-1, 0)) if cO[0][0] == cE[0][...
from collections import Counter n = int(eval(input())) V = list(map(int, input().split())) cv1 = Counter(V[::2]).most_common() cv2 = Counter(V[1::2]).most_common() cv1.append((-1, 0)) cv2.append((-1, 0)) if cv1[0][0] != cv2[0][0]: print((n - cv1[0][1] - cv2[0][1])) else: print((min(n - cv1[1][1] - cv2[0][1], n...
false
44.444444
[ "-E = []", "-O = []", "-for i, v in enumerate(V):", "- if i % 2 == 0:", "- O.append(v)", "- else:", "- E.append(v)", "-cO = Counter(O).most_common()", "-cO.append((-1, 0))", "-cE = Counter(E).most_common()", "-cE.append((-1, 0))", "-if cO[0][0] == cE[0][0]:", "- ans = ...
false
0.047327
0.048482
0.976164
[ "s300905097", "s756773505" ]
u796942881
p03087
python
s033347489
s730598638
244
225
31,504
14,292
Accepted
Accepted
7.79
from sys import stdin def main(): lines = stdin.readlines() S = lines[1] lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]] AC = [] pre = None cnt = 0 for c in S: if c == "A": pre = "A" elif pre == "A" and c == "C": cnt += 1 ...
from sys import stdin def iterate_tokens(): for line in stdin: for word in line.split(): yield word def main(): tokens = iterate_tokens() next(tokens) Q = int(next(tokens)) S = next(tokens) L = [] R = [] for i in range(Q): L.append(int(nex...
25
37
489
722
from sys import stdin def main(): lines = stdin.readlines() S = lines[1] lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]] AC = [] pre = None cnt = 0 for c in S: if c == "A": pre = "A" elif pre == "A" and c == "C": cnt += 1 pre = ...
from sys import stdin def iterate_tokens(): for line in stdin: for word in line.split(): yield word def main(): tokens = iterate_tokens() next(tokens) Q = int(next(tokens)) S = next(tokens) L = [] R = [] for i in range(Q): L.append(int(next(tokens)) - 1) ...
false
32.432432
[ "+def iterate_tokens():", "+ for line in stdin:", "+ for word in line.split():", "+ yield word", "+", "+", "- lines = stdin.readlines()", "- S = lines[1]", "- lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]]", "+ tokens = iterate_tokens()", "+ next(to...
false
0.092468
0.110318
0.838193
[ "s033347489", "s730598638" ]
u255673886
p03317
python
s026113387
s291852077
220
160
89,168
88,984
Accepted
Accepted
27.27
from collections import deque from heapq import heapify,heappop,heappush,heappushpop from copy import copy,deepcopy from itertools import product,permutations,combinations,combinations_with_replacement from collections import defaultdict,Counter from bisect import bisect_left,bisect_right from math import gcd,cei...
from collections import deque from heapq import heapify,heappop,heappush,heappushpop from copy import copy,deepcopy from itertools import product,permutations,combinations,combinations_with_replacement from collections import defaultdict,Counter from bisect import bisect_left,bisect_right from math import gcd,cei...
119
103
2,715
2,370
from collections import deque from heapq import heapify, heappop, heappush, heappushpop from copy import copy, deepcopy from itertools import product, permutations, combinations, combinations_with_replacement from collections import defaultdict, Counter from bisect import bisect_left, bisect_right from math import gcd,...
from collections import deque from heapq import heapify, heappop, heappush, heappushpop from copy import copy, deepcopy from itertools import product, permutations, combinations, combinations_with_replacement from collections import defaultdict, Counter from bisect import bisect_left, bisect_right from math import gcd,...
false
13.445378
[ "-ind = a.index(1)", "-ans = INF", "-if ind > (k - 1) and ind < (n - k):", "- for i in range(ind - k + 1, ind + k):", "- # print('i={}'.format(i))", "- m = 0", "- m += ceil(i / (k - 1))", "- m += ceil((n - i - 1) / (k - 1))", "- ans = min(ans, m)", "- #...
false
0.036599
0.037416
0.978176
[ "s026113387", "s291852077" ]
u254871849
p03369
python
s691904398
s697622243
21
17
3,060
2,940
Accepted
Accepted
19.05
# author: kagemeka # created: 2019-11-07 12:33:44(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator def main(): s = sys.stdin.read...
import sys s = sys.stdin.readline().rstrip() def main(): return 700 + 100 * s.count('o') if __name__ == '__main__': ans = main() print(ans)
23
10
473
163
# author: kagemeka # created: 2019-11-07 12:33:44(JST) import sys # import collections # import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator def main(): s = sys.stdin.readline().rstrip()...
import sys s = sys.stdin.readline().rstrip() def main(): return 700 + 100 * s.count("o") if __name__ == "__main__": ans = main() print(ans)
false
56.521739
[ "-# author: kagemeka", "-# created: 2019-11-07 12:33:44(JST)", "-# import collections", "-# import math", "-# import string", "-# import bisect", "-# import re", "-# import itertools", "-# import statistics", "-# import functools", "-# import oper...
false
0.055882
0.046188
1.209903
[ "s691904398", "s697622243" ]
u263830634
p02947
python
s880065443
s552561179
527
411
24,652
26,544
Accepted
Accepted
22.01
N = int(eval(input())) lst = [] for _ in range(N): tmp = list(eval(input())) tmp.sort() lst.append(tmp) lst.sort() tmp = lst[0] count = 1 ans = 0 for i in range(1, N): if tmp == lst[i]: count += 1 else: ans = ans + (count * (count - 1))//2 count = 1 ...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 9) MOD = 10 ** 9 + 7 from collections import defaultdict N = int(eval(input())) S = [list(eval(input())) for _ in range(N)] for i in range(N): S[i].sort() S.sort() ans = 0 count = 1 for i in range(1, N): if S[i - 1] == S[i]...
20
26
371
448
N = int(eval(input())) lst = [] for _ in range(N): tmp = list(eval(input())) tmp.sort() lst.append(tmp) lst.sort() tmp = lst[0] count = 1 ans = 0 for i in range(1, N): if tmp == lst[i]: count += 1 else: ans = ans + (count * (count - 1)) // 2 count = 1 tmp = lst[i] ans...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**9) MOD = 10**9 + 7 from collections import defaultdict N = int(eval(input())) S = [list(eval(input())) for _ in range(N)] for i in range(N): S[i].sort() S.sort() ans = 0 count = 1 for i in range(1, N): if S[i - 1] == S[i]: count += 1 ...
false
23.076923
[ "+import sys", "+", "+input = sys.stdin.readline", "+sys.setrecursionlimit(10**9)", "+MOD = 10**9 + 7", "+from collections import defaultdict", "+", "-lst = []", "-for _ in range(N):", "- tmp = list(eval(input()))", "- tmp.sort()", "- lst.append(tmp)", "-lst.sort()", "-tmp = lst[0...
false
0.055307
0.037199
1.486765
[ "s880065443", "s552561179" ]
u186838327
p03053
python
s170845098
s384701250
427
288
87,388
148,816
Accepted
Accepted
32.55
h, w = list(map(int, input().split())) A = [str(eval(input())) for _ in range(h)] from collections import deque q = deque() visit = [[-1]*w for _ in range(h)] for i in range(h): for j in range(w): if A[i][j] == '#': visit[i][j] = 0 q.append((i, j)) while q: y, ...
h, w = list(map(int, input().split())) A = [list(str(eval(input()))) for _ in range(h)] from collections import deque q = deque([]) visit = [[-1]*w for _ in range(h)] for i in range(h): for j in range(w): if A[i][j] == '#': q.append((i, j)) visit[i][j] = 0 while q: ...
27
25
678
673
h, w = list(map(int, input().split())) A = [str(eval(input())) for _ in range(h)] from collections import deque q = deque() visit = [[-1] * w for _ in range(h)] for i in range(h): for j in range(w): if A[i][j] == "#": visit[i][j] = 0 q.append((i, j)) while q: y, x = q.popleft() ...
h, w = list(map(int, input().split())) A = [list(str(eval(input()))) for _ in range(h)] from collections import deque q = deque([]) visit = [[-1] * w for _ in range(h)] for i in range(h): for j in range(w): if A[i][j] == "#": q.append((i, j)) visit[i][j] = 0 while q: y, x = q.po...
false
7.407407
[ "-A = [str(eval(input())) for _ in range(h)]", "+A = [list(str(eval(input()))) for _ in range(h)]", "-q = deque()", "+q = deque([])", "+ q.append((i, j))", "- q.append((i, j))", "- if 0 <= ny <= h - 1 and 0 <= nx <= w - 1 and visit[ny][nx] == -1:", "- visit[ny][...
false
0.034727
0.085822
0.404638
[ "s170845098", "s384701250" ]
u548545174
p04001
python
s346318599
s459490560
28
21
3,064
3,064
Accepted
Accepted
25
s = eval(input()) space = len(s) - 1 total = [] for i in range(2 ** space): pluses = [''] * space for j in range(space): if (i >> j) & 1: pluses[j] = '+' re = '' for a, b in zip(s, pluses + ['']): re += (a + b) total.append(eval(re)) ans = sum(total) print(an...
s = eval(input()) l = len(s) #全部で2**(l-1)パターンある ans = 0 for i in range(2 ** (l-1)): eq = s[0] for j in range(l-1): if i & (1<<j): eq += '+'+s[j+1] else: eq += s[j+1] tmp = list(map(int, eq.split('+'))) ans += sum([int(chr) for chr in tmp]) print(a...
14
16
316
317
s = eval(input()) space = len(s) - 1 total = [] for i in range(2**space): pluses = [""] * space for j in range(space): if (i >> j) & 1: pluses[j] = "+" re = "" for a, b in zip(s, pluses + [""]): re += a + b total.append(eval(re)) ans = sum(total) print(ans)
s = eval(input()) l = len(s) # 全部で2**(l-1)パターンある ans = 0 for i in range(2 ** (l - 1)): eq = s[0] for j in range(l - 1): if i & (1 << j): eq += "+" + s[j + 1] else: eq += s[j + 1] tmp = list(map(int, eq.split("+"))) ans += sum([int(chr) for chr in tmp]) print(ans)
false
12.5
[ "-space = len(s) - 1", "-total = []", "-for i in range(2**space):", "- pluses = [\"\"] * space", "- for j in range(space):", "- if (i >> j) & 1:", "- pluses[j] = \"+\"", "- re = \"\"", "- for a, b in zip(s, pluses + [\"\"]):", "- re += a + b", "- total.app...
false
0.04243
0.038971
1.088755
[ "s346318599", "s459490560" ]
u145950990
p03251
python
s141755078
s981804538
178
32
39,664
9,116
Accepted
Accepted
82.02
n,m,X,Y = list(map(int,input().split())) x = max(list(map(int,input().split()))) y = min(list(map(int,input().split()))) if X<x<y<=Y:print('No War') else:print('War')
n,m,x,y = list(map(int,input().split())) x_max = sorted(list(map(int,input().split())))[-1] y_min = sorted(list(map(int,input().split())))[0] if x<=x_max<y_min<=y: print('No War') else: print('War')
5
8
164
208
n, m, X, Y = list(map(int, input().split())) x = max(list(map(int, input().split()))) y = min(list(map(int, input().split()))) if X < x < y <= Y: print("No War") else: print("War")
n, m, x, y = list(map(int, input().split())) x_max = sorted(list(map(int, input().split())))[-1] y_min = sorted(list(map(int, input().split())))[0] if x <= x_max < y_min <= y: print("No War") else: print("War")
false
37.5
[ "-n, m, X, Y = list(map(int, input().split()))", "-x = max(list(map(int, input().split())))", "-y = min(list(map(int, input().split())))", "-if X < x < y <= Y:", "+n, m, x, y = list(map(int, input().split()))", "+x_max = sorted(list(map(int, input().split())))[-1]", "+y_min = sorted(list(map(int, input(...
false
0.039177
0.083117
0.471349
[ "s141755078", "s981804538" ]
u515740713
p03078
python
s462254048
s785722865
847
149
248,888
79,096
Accepted
Accepted
82.41
# -*- coding: utf-8 -*- #D - Cake 123 import sys from itertools import product read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines X, Y, Z, K = list(map(int, readline().split())) A = list(map(int,readline().split())) B = list(map(int,readline().split())) C...
# -*- coding: utf-8 -*- #D - Cake 123 import sys from heapq import * read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines X, Y, Z, K = map(int, readline().split()) A = list(map(int,readline().split())) B = list(map(int,readline().split())) C = list(map(int,...
24
37
576
982
# -*- coding: utf-8 -*- # D - Cake 123 import sys from itertools import product read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines X, Y, Z, K = list(map(int, readline().split())) A = list(map(int, readline().split())) B = list(map(int, readline().split())) C = list...
# -*- coding: utf-8 -*- # D - Cake 123 import sys from heapq import * read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines X, Y, Z, K = map(int, readline().split()) A = list(map(int, readline().split())) B = list(map(int, readline().split())) C = list(map(int, readli...
false
35.135135
[ "-from itertools import product", "+from heapq import *", "-X, Y, Z, K = list(map(int, readline().split()))", "+X, Y, Z, K = map(int, readline().split())", "-AB = []", "-for a, b in product(A, B):", "- AB.append(a + b)", "-AB = sorted(AB, reverse=True)[:K]", "-ABC = []", "-for ab, c in product(...
false
0.034502
0.076289
0.452259
[ "s462254048", "s785722865" ]
u644907318
p03048
python
s796566416
s706140468
262
70
40,300
66,400
Accepted
Accepted
73.28
R,G,B,N = list(map(int,input().split())) cnt = 0 for x in range(N//R+1): for y in range((N-x*R)//G+1): if (N-x*R-y*G)%B==0: cnt += 1 print(cnt)
R,G,B,N = list(map(int,input().split())) cnt = 0 for r in range(N//R+1): for g in range((N-r*R)//G+1): if (N-r*R-g*G)%B==0: cnt += 1 print(cnt)
7
7
167
167
R, G, B, N = list(map(int, input().split())) cnt = 0 for x in range(N // R + 1): for y in range((N - x * R) // G + 1): if (N - x * R - y * G) % B == 0: cnt += 1 print(cnt)
R, G, B, N = list(map(int, input().split())) cnt = 0 for r in range(N // R + 1): for g in range((N - r * R) // G + 1): if (N - r * R - g * G) % B == 0: cnt += 1 print(cnt)
false
0
[ "-for x in range(N // R + 1):", "- for y in range((N - x * R) // G + 1):", "- if (N - x * R - y * G) % B == 0:", "+for r in range(N // R + 1):", "+ for g in range((N - r * R) // G + 1):", "+ if (N - r * R - g * G) % B == 0:" ]
false
0.056091
0.074104
0.756917
[ "s796566416", "s706140468" ]
u785578220
p03557
python
s566856063
s431057286
678
327
51,164
23,360
Accepted
Accepted
51.77
def lma():return list(map(int, input().split()))#x or y a = int(eval(input())) k=[] s=[] c=0 s= [lma()] x2= lma() x3 = lma() s.append(x2) s.append(x3) res =0 r =0 for j in range(3): for i in range(a): k.append([j,s[j][i]]) k.sort(key=lambda x: x[1], reverse=True) for i in range(a*3): if...
from bisect import bisect_left,bisect_right n = int(eval(input())) A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) A.sort() B.sort() C.sort() ans = 0 cns = 0 for i in B: x = bisect_left(A,i) y = bisect_right(C,i) y = n - y ans += x...
25
19
444
333
def lma(): return list(map(int, input().split())) # x or y a = int(eval(input())) k = [] s = [] c = 0 s = [lma()] x2 = lma() x3 = lma() s.append(x2) s.append(x3) res = 0 r = 0 for j in range(3): for i in range(a): k.append([j, s[j][i]]) k.sort(key=lambda x: x[1], reverse=True) for i in range(a * 3): ...
from bisect import bisect_left, bisect_right n = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort() B.sort() C.sort() ans = 0 cns = 0 for i in B: x = bisect_left(A, i) y = bisect_right(C, i) y = n - y ans += x * y prin...
false
24
[ "-def lma():", "- return list(map(int, input().split())) # x or y", "+from bisect import bisect_left, bisect_right", "-", "-a = int(eval(input()))", "-k = []", "-s = []", "-c = 0", "-s = [lma()]", "-x2 = lma()", "-x3 = lma()", "-s.append(x2)", "-s.append(x3)", "-res = 0", "-r = 0", ...
false
0.051913
0.039877
1.30184
[ "s566856063", "s431057286" ]
u075012704
p03994
python
s495229050
s002664595
79
71
4,212
3,444
Accepted
Accepted
10.13
S = eval(input()) K = int(eval(input())) cost = [(ord("z") - ord(s) + 1) % 26 for s in S] A = [chr(ord("a") + i) for i in range(26)] ans = "" for i in range(len(S)-1): if cost[i] <= K: K -= cost[i] ans += "a" else: ans += S[i] ans += A[(A.index(S[-1]) + K) % 26] print(ans...
S = eval(input()) K = int(eval(input())) Costs = {chr(98 + i): (25 - i) for i in range(25)} Costs['a'] = 0 alphabets = [chr(97 + i) for i in range(26)] ans = "" for i in range(len(S) - 1): s = S[i] if K >= Costs[s]: K -= Costs[s] ans += 'a' else: ans += s ans...
15
21
310
369
S = eval(input()) K = int(eval(input())) cost = [(ord("z") - ord(s) + 1) % 26 for s in S] A = [chr(ord("a") + i) for i in range(26)] ans = "" for i in range(len(S) - 1): if cost[i] <= K: K -= cost[i] ans += "a" else: ans += S[i] ans += A[(A.index(S[-1]) + K) % 26] print(ans)
S = eval(input()) K = int(eval(input())) Costs = {chr(98 + i): (25 - i) for i in range(25)} Costs["a"] = 0 alphabets = [chr(97 + i) for i in range(26)] ans = "" for i in range(len(S) - 1): s = S[i] if K >= Costs[s]: K -= Costs[s] ans += "a" else: ans += s ans += alphabets[(alphabets....
false
28.571429
[ "-cost = [(ord(\"z\") - ord(s) + 1) % 26 for s in S]", "-A = [chr(ord(\"a\") + i) for i in range(26)]", "+Costs = {chr(98 + i): (25 - i) for i in range(25)}", "+Costs[\"a\"] = 0", "+alphabets = [chr(97 + i) for i in range(26)]", "- if cost[i] <= K:", "- K -= cost[i]", "+ s = S[i]", "+ ...
false
0.04801
0.047386
1.01317
[ "s495229050", "s002664595" ]
u681444474
p03795
python
s141042854
s415167921
176
26
38,256
9,052
Accepted
Accepted
85.23
N = int(eval(input())) print((800*N-(N//15)*200))
# coding: utf-8 N = int(eval(input())) ans = 800*N - N//15*200 print(ans)
2
5
42
72
N = int(eval(input())) print((800 * N - (N // 15) * 200))
# coding: utf-8 N = int(eval(input())) ans = 800 * N - N // 15 * 200 print(ans)
false
60
[ "+# coding: utf-8", "-print((800 * N - (N // 15) * 200))", "+ans = 800 * N - N // 15 * 200", "+print(ans)" ]
false
0.044752
0.047024
0.951683
[ "s141042854", "s415167921" ]
u554784585
p03408
python
s317742216
s125435884
30
27
9,072
9,088
Accepted
Accepted
10
N=int(eval(input())) ans=0 s=[] t=[] for i in range(N): s.append(eval(input())) M=int(eval(input())) for j in range(M): t.append(eval(input())) s.sort() t.sort() for i in range(N-1): if s[i]!=s[i+1]: sf=s.count(s[i+1]) tf=t.count(s[i+1]) if sf>tf: temp=s...
l={} N=int(eval(input())) for i in range(N): a=eval(input()) if a in l: l[a]+=1 else: l[a]=1 M=int(eval(input())) for j in range(M): b=eval(input()) if b in l: l[b]-=1 if max(l.values())<=0: print((0)) else: print((max(l.values())))
27
18
464
275
N = int(eval(input())) ans = 0 s = [] t = [] for i in range(N): s.append(eval(input())) M = int(eval(input())) for j in range(M): t.append(eval(input())) s.sort() t.sort() for i in range(N - 1): if s[i] != s[i + 1]: sf = s.count(s[i + 1]) tf = t.count(s[i + 1]) if sf > tf: ...
l = {} N = int(eval(input())) for i in range(N): a = eval(input()) if a in l: l[a] += 1 else: l[a] = 1 M = int(eval(input())) for j in range(M): b = eval(input()) if b in l: l[b] -= 1 if max(l.values()) <= 0: print((0)) else: print((max(l.values())))
false
33.333333
[ "+l = {}", "-ans = 0", "-s = []", "-t = []", "- s.append(eval(input()))", "+ a = eval(input())", "+ if a in l:", "+ l[a] += 1", "+ else:", "+ l[a] = 1", "- t.append(eval(input()))", "-s.sort()", "-t.sort()", "-for i in range(N - 1):", "- if s[i] != s[i + 1...
false
0.04618
0.044622
1.034918
[ "s317742216", "s125435884" ]
u759412327
p02989
python
s663602208
s663229507
76
69
14,428
20,664
Accepted
Accepted
9.21
a = int(eval(input())) b = list(map(int,input().split())) c = sorted(b) print((c[int(0.5*a)]-c[int(0.5*a-1)]))
N = int(eval(input())) D = sorted(map(int,input().split())) print((max(0,D[N//2]-D[N//2-1])))
4
3
105
87
a = int(eval(input())) b = list(map(int, input().split())) c = sorted(b) print((c[int(0.5 * a)] - c[int(0.5 * a - 1)]))
N = int(eval(input())) D = sorted(map(int, input().split())) print((max(0, D[N // 2] - D[N // 2 - 1])))
false
25
[ "-a = int(eval(input()))", "-b = list(map(int, input().split()))", "-c = sorted(b)", "-print((c[int(0.5 * a)] - c[int(0.5 * a - 1)]))", "+N = int(eval(input()))", "+D = sorted(map(int, input().split()))", "+print((max(0, D[N // 2] - D[N // 2 - 1])))" ]
false
0.038223
0.045948
0.831863
[ "s663602208", "s663229507" ]
u645250356
p03103
python
s303176900
s826068433
519
416
19,996
16,852
Accepted
Accepted
19.85
li_a = [] ans = 0 N,M = list(map(int,input().split())) for i in range(N): a,b = list(map(int,input().split())) li_a +=[[a,b]] li_a.sort() for i in range(N): if li_a[i][-1] >= M: ans += M * li_a[i][0] print(ans) break else: ans += li_a[i][-1] * li_a[i][0] ...
n,m = list(map(int,input().split())) ab = [0] * n ans = 0 for i in range(n): a,b = list(map(int,input().split())) ab[i]= (a,b) ab.sort() for i in range(n): if m > ab[i][1]: m -= ab[i][1] ans += ab[i][0] * ab[i][1] else: ans += ab[i][0] * m break print(an...
18
17
336
310
li_a = [] ans = 0 N, M = list(map(int, input().split())) for i in range(N): a, b = list(map(int, input().split())) li_a += [[a, b]] li_a.sort() for i in range(N): if li_a[i][-1] >= M: ans += M * li_a[i][0] print(ans) break else: ans += li_a[i][-1] * li_a[i][0] M -...
n, m = list(map(int, input().split())) ab = [0] * n ans = 0 for i in range(n): a, b = list(map(int, input().split())) ab[i] = (a, b) ab.sort() for i in range(n): if m > ab[i][1]: m -= ab[i][1] ans += ab[i][0] * ab[i][1] else: ans += ab[i][0] * m break print(ans)
false
5.555556
[ "-li_a = []", "+n, m = list(map(int, input().split()))", "+ab = [0] * n", "-N, M = list(map(int, input().split()))", "-for i in range(N):", "+for i in range(n):", "- li_a += [[a, b]]", "-li_a.sort()", "-for i in range(N):", "- if li_a[i][-1] >= M:", "- ans += M * li_a[i][0]", "- ...
false
0.049713
0.049439
1.005534
[ "s303176900", "s826068433" ]
u761989513
p03575
python
s142936901
s218312032
481
43
58,844
3,064
Accepted
Accepted
91.06
n, m = list(map(int, input().split())) d = [[float("inf")] * n for i in range(n)] edge = [] for i in range(m): a, b = list(map(int, input().split())) edge.append((a, b)) d[a - 1][b - 1] = 1 d[b - 1][a - 1] = 1 ans = 0 for a in range(m): d_s = [x[:] for x in d] x, y = edge[a] d_s[...
n, m = list(map(int, input().split())) edge = [list(map(int, input().split())) for i in range(m)] ans = 0 for i in edge: l = list(range(n)) for j in edge: if j != i: l = [l[j[0] - 1] if l[k] == l[j[1] - 1] else l[k] for k in range(n)] if len(set(l)) != 1: ans += 1 print...
29
11
780
319
n, m = list(map(int, input().split())) d = [[float("inf")] * n for i in range(n)] edge = [] for i in range(m): a, b = list(map(int, input().split())) edge.append((a, b)) d[a - 1][b - 1] = 1 d[b - 1][a - 1] = 1 ans = 0 for a in range(m): d_s = [x[:] for x in d] x, y = edge[a] d_s[x - 1][y - 1...
n, m = list(map(int, input().split())) edge = [list(map(int, input().split())) for i in range(m)] ans = 0 for i in edge: l = list(range(n)) for j in edge: if j != i: l = [l[j[0] - 1] if l[k] == l[j[1] - 1] else l[k] for k in range(n)] if len(set(l)) != 1: ans += 1 print(ans)
false
62.068966
[ "-d = [[float(\"inf\")] * n for i in range(n)]", "-edge = []", "-for i in range(m):", "- a, b = list(map(int, input().split()))", "- edge.append((a, b))", "- d[a - 1][b - 1] = 1", "- d[b - 1][a - 1] = 1", "+edge = [list(map(int, input().split())) for i in range(m)]", "-for a in range(m):...
false
0.057077
0.035916
1.589199
[ "s142936901", "s218312032" ]
u076917070
p02838
python
s416851393
s646469299
1,147
528
123,364
123,132
Accepted
Accepted
53.97
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) B = [0]*60 for a in A: for i in range(len(B)): if a & (2**i): B[i] += 1 ans = 0 for i, b in enumerate(B): ans += 2**i * b * (N-...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) B = [0]*60 for a in A: for i in range(len(B)): if (a >> i) & 1: B[i] += 1 ans = 0 for i, b in enumerate(B): ans += 2**i * b * (...
21
21
397
399
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) B = [0] * 60 for a in A: for i in range(len(B)): if a & (2**i): B[i] += 1 ans = 0 for i, b in enumerate(B): ans += 2**i * b * (N - b) an...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) B = [0] * 60 for a in A: for i in range(len(B)): if (a >> i) & 1: B[i] += 1 ans = 0 for i, b in enumerate(B): ans += 2**i * b * (N - b) ...
false
0
[ "- if a & (2**i):", "+ if (a >> i) & 1:" ]
false
0.0382
0.121393
0.314677
[ "s416851393", "s646469299" ]
u179169725
p03049
python
s519209710
s490399199
262
181
44,008
39,920
Accepted
Accepted
30.92
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_c import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate MOD = 10**9 + 7 INF = 2**31 # 2147483648 > 10**9 # default import from collections import defaultdict, Counter, deque from operator import itemget...
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def mina(*argv, sub=1): return list([x - sub for x in argv]) # 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと def read_a_int(): return int(read()) def read_ints(): return list(map(int, read().split())) def r...
55
95
1,478
2,098
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_c import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate MOD = 10**9 + 7 INF = 2**31 # 2147483648 > 10**9 # default import from collections import defaultdict, Counter, deque from operator import itemgetter from iterto...
import sys sys.setrecursionlimit(1 << 25) read = sys.stdin.readline ra = range enu = enumerate def mina(*argv, sub=1): return list([x - sub for x in argv]) # 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと def read_a_int(): return int(read()) def read_ints(): return list(map(int, read().split())) def read_...
false
42.105263
[ "-# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_c", "+", "+", "+def mina(*argv, sub=1):", "+ return list([x - sub for x in argv])", "+", "+", "+# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと", "+def read_a_int():", "+ return int(read())", "+", "+", "+def read_ints():", "+ ...
false
0.041027
0.036273
1.131056
[ "s519209710", "s490399199" ]
u531603069
p02787
python
s261270274
s406371850
1,538
433
46,812
42,220
Accepted
Accepted
71.85
import sys h, n = list(map(int, input().split())) # A = [0] * n # B = [0] * n # for i in range(n): # A[i], B[i] = map(int, input().split()) AB = [list(map(int, input().split())) for _ in range(n)] min_hp = h max_hp = h + max(a for a, b in (AB)) dp = [sys.maxsize] * (max_hp + 1) dp[0] = 0 for i in r...
import sys h, n = list(map(int, input().split())) # A = [0] * n # B = [0] * n AB = [list(map(int, input().split())) for _ in range(n)] # for i in range(n): # A[i], B[i] = map(int, input().split()) min_hp = h dp = [sys.maxsize] * (min_hp + 1) dp[0] = 0 for i in range(0, min_hp + 1): for ab in AB...
17
27
459
877
import sys h, n = list(map(int, input().split())) # A = [0] * n # B = [0] * n # for i in range(n): # A[i], B[i] = map(int, input().split()) AB = [list(map(int, input().split())) for _ in range(n)] min_hp = h max_hp = h + max(a for a, b in (AB)) dp = [sys.maxsize] * (max_hp + 1) dp[0] = 0 for i in range(1, max_hp +...
import sys h, n = list(map(int, input().split())) # A = [0] * n # B = [0] * n AB = [list(map(int, input().split())) for _ in range(n)] # for i in range(n): # A[i], B[i] = map(int, input().split()) min_hp = h dp = [sys.maxsize] * (min_hp + 1) dp[0] = 0 for i in range(0, min_hp + 1): for ab in AB: # type of spe...
false
37.037037
[ "+AB = [list(map(int, input().split())) for _ in range(n)]", "-AB = [list(map(int, input().split())) for _ in range(n)]", "-max_hp = h + max(a for a, b in (AB))", "-dp = [sys.maxsize] * (max_hp + 1)", "+dp = [sys.maxsize] * (min_hp + 1)", "-for i in range(1, max_hp + 1):", "- # dp[i] = min(dp[i - A[j...
false
0.050742
0.145949
0.347668
[ "s261270274", "s406371850" ]
u170201762
p03476
python
s616766829
s893726933
1,817
1,027
19,300
8,660
Accepted
Accepted
43.48
def eratosthenes(n): prime = [] limit = n**0.5 numbers = [i for i in range(2,n+1)] while True: p = numbers[0] if limit <= p: return prime + numbers prime.append(p) numbers = [i for i in numbers if i%p != 0] primes = eratosthenes(100000) numbers = ...
from collections import defaultdict from bisect import bisect,bisect_left def eratosthenes(n): prime = [] limit = n**0.5 numbers = [i for i in range(2,n+1)] while True: p = numbers[0] if limit <= p: return prime + numbers prime.append(p) numbers = [...
29
28
663
696
def eratosthenes(n): prime = [] limit = n**0.5 numbers = [i for i in range(2, n + 1)] while True: p = numbers[0] if limit <= p: return prime + numbers prime.append(p) numbers = [i for i in numbers if i % p != 0] primes = eratosthenes(100000) numbers = [(p + ...
from collections import defaultdict from bisect import bisect, bisect_left def eratosthenes(n): prime = [] limit = n**0.5 numbers = [i for i in range(2, n + 1)] while True: p = numbers[0] if limit <= p: return prime + numbers prime.append(p) numbers = [i for...
false
3.448276
[ "+from collections import defaultdict", "+from bisect import bisect, bisect_left", "+", "+", "+ return prime", "-primes = eratosthenes(100000)", "-numbers = [(p + 1) // 2 for p in primes]", "-alike = list(set(primes) & set(numbers))", "-alike = [2 * p - 1 for p in alike]", "-alike.sort()", "-...
false
0.456803
0.197595
2.311809
[ "s616766829", "s893726933" ]
u098994567
p03803
python
s117775332
s872334691
33
28
8,896
8,948
Accepted
Accepted
15.15
# AliceとBobは、2人で1枚ポーカーを行います。 # 1枚ポーカーは、トランプを用いて行う2人ゲームです。 # # 今回使用するトランプでは、各カードに 1 から 13 までの数が書かれています。 # カードの強さは、カードに書かれている数で決まり,強さの基準は以下の通りです。 # 弱 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 強 # # 1枚ポーカーは以下の手順で行います。 # # 各プレイヤーは、トランプからカードを1枚選んで、自分の手札とします。 # 両プレイヤーは、手札を見せ合います。強いカードを持っているプレイヤーが勝ちです。 ...
# AliceとBobは、2人で1枚ポーカーを行います。 # 1枚ポーカーは、トランプを用いて行う2人ゲームです。 # # 今回使用するトランプでは、各カードに 1 から 13 までの数が書かれています。 # カードの強さは、カードに書かれている数で決まり,強さの基準は以下の通りです。 # 弱 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 強 # # 1枚ポーカーは以下の手順で行います。 # # 各プレイヤーは、トランプからカードを1枚選んで、自分の手札とします。 # 両プレイヤーは、手札を見せ合います。強いカードを持っているプレイヤーが勝ちです。 ...
34
34
912
954
# AliceとBobは、2人で1枚ポーカーを行います。 # 1枚ポーカーは、トランプを用いて行う2人ゲームです。 # # 今回使用するトランプでは、各カードに 1 から 13 までの数が書かれています。 # カードの強さは、カードに書かれている数で決まり,強さの基準は以下の通りです。 # 弱 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 強 # # 1枚ポーカーは以下の手順で行います。 # # 各プレイヤーは、トランプからカードを1枚選んで、自分の手札とします。 # 両プレイヤーは、手札を見せ合います。強いカードを持っているプレイヤーが勝ちです。 # なお、両プレイヤー...
# AliceとBobは、2人で1枚ポーカーを行います。 # 1枚ポーカーは、トランプを用いて行う2人ゲームです。 # # 今回使用するトランプでは、各カードに 1 から 13 までの数が書かれています。 # カードの強さは、カードに書かれている数で決まり,強さの基準は以下の通りです。 # 弱 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 強 # # 1枚ポーカーは以下の手順で行います。 # # 各プレイヤーは、トランプからカードを1枚選んで、自分の手札とします。 # 両プレイヤーは、手札を見せ合います。強いカードを持っているプレイヤーが勝ちです。 # なお、両プレイヤー...
false
0
[ "-result = \"ret\"", "-if input_alice > input_bob:", "- if input_bob == 1: # Bobがエースなので勝ち~", "- result = \"Bob\"", "+result = \"ret\" # 結果格納用", "+if input_alice > input_bob: # Aの方がBより大きい", "+ if input_bob == 1:", "+ result = \"Bob\" # Bobがエースなので勝ち~", "-elif input_alice < inpu...
false
0.09934
0.03525
2.818143
[ "s117775332", "s872334691" ]
u225388820
p03504
python
s698877735
s010949701
589
335
105,512
135,036
Accepted
Accepted
43.12
n, C = list(map(int, input().split())) L = [tuple(map(int, input().split())) for _ in range(n)] L.sort() tmp = [[] for _ in range(C)] for s, t, c in L: if tmp[c - 1]: if tmp[c - 1][-1][1] == s: tmp[c - 1][-1][1] = t continue tmp[c - 1].append([s, t]) l = [] for v in tm...
# 解説 imos n, C = list(map(int, input().split())) L = [tuple(map(int, input().split())) for _ in range(n)] m = 2 * 10 ** 5 + 2 S = [0] * m for x in range(1, C + 1): T = [0] * m for s, t, c in L: if c == x: # 始点を奇数, 終点を偶数にするのうまい T[2 * s - 1] += 1 T[2 * t] -= ...
23
18
525
452
n, C = list(map(int, input().split())) L = [tuple(map(int, input().split())) for _ in range(n)] L.sort() tmp = [[] for _ in range(C)] for s, t, c in L: if tmp[c - 1]: if tmp[c - 1][-1][1] == s: tmp[c - 1][-1][1] = t continue tmp[c - 1].append([s, t]) l = [] for v in tmp: for ...
# 解説 imos n, C = list(map(int, input().split())) L = [tuple(map(int, input().split())) for _ in range(n)] m = 2 * 10**5 + 2 S = [0] * m for x in range(1, C + 1): T = [0] * m for s, t, c in L: if c == x: # 始点を奇数, 終点を偶数にするのうまい T[2 * s - 1] += 1 T[2 * t] -= 1 for i i...
false
21.73913
[ "+# 解説 imos", "-L.sort()", "-tmp = [[] for _ in range(C)]", "-for s, t, c in L:", "- if tmp[c - 1]:", "- if tmp[c - 1][-1][1] == s:", "- tmp[c - 1][-1][1] = t", "- continue", "- tmp[c - 1].append([s, t])", "-l = []", "-for v in tmp:", "- for i in v:", "-...
false
0.041766
0.311312
0.134162
[ "s698877735", "s010949701" ]
u638057737
p03160
python
s371959563
s575421494
134
121
13,924
13,928
Accepted
Accepted
9.7
N = int(eval(input())) stones = list(map(int,input().split())) min_jump = [1000000000000 for i in range(N)] min_jump[0] = 0 for i in range(1,N): min_jump[i] = min(abs(stones[i] - stones[i-1]) + min_jump[i-1],abs(stones[i] - stones[i-2]) + min_jump[i-2]) print((min_jump[N-1]))
N = int(eval(input())) X = list(map(int,input().split())) dp = [0,abs(X[1] - X[0])] for x in range(2,N): dp.append(min(dp[x-1] + abs(X[x-1]-X[x]), dp[x-2] + abs(X[x-2]-X[x]) ) ) print((dp[N-1]))
8
10
281
240
N = int(eval(input())) stones = list(map(int, input().split())) min_jump = [1000000000000 for i in range(N)] min_jump[0] = 0 for i in range(1, N): min_jump[i] = min( abs(stones[i] - stones[i - 1]) + min_jump[i - 1], abs(stones[i] - stones[i - 2]) + min_jump[i - 2], ) print((min_jump[N - 1]))
N = int(eval(input())) X = list(map(int, input().split())) dp = [0, abs(X[1] - X[0])] for x in range(2, N): dp.append(min(dp[x - 1] + abs(X[x - 1] - X[x]), dp[x - 2] + abs(X[x - 2] - X[x]))) print((dp[N - 1]))
false
20
[ "-stones = list(map(int, input().split()))", "-min_jump = [1000000000000 for i in range(N)]", "-min_jump[0] = 0", "-for i in range(1, N):", "- min_jump[i] = min(", "- abs(stones[i] - stones[i - 1]) + min_jump[i - 1],", "- abs(stones[i] - stones[i - 2]) + min_jump[i - 2],", "- )", ...
false
0.036654
0.037052
0.989259
[ "s371959563", "s575421494" ]
u276894499
p02726
python
s793361011
s963358647
1,974
1,209
3,444
3,444
Accepted
Accepted
38.75
n,x,y=list(map(int,input().split())) ans=[0]*n for i in range(1,n+1): for j in range(i+1,n+1): dist1=j-i dist2=abs(x-i)+abs(y-j)+1 dist3=abs(y-i)+abs(x-j)+1 d=min(dist1,dist2,dist3) ans[d]+=1 for i in range(1,n): print((ans[i]))
N,X,Y = list(map(int, input().split())) cnt = [0]*N for i in range(1,N+1): for j in range(i+1,N+1): if abs(X-i)+abs(j-Y)+1 < j-i: cnt[abs(X-i)+abs(j-Y)+1] += 1 else: cnt[j-i] += 1 for i in range(1,N): print((int(cnt[i])))
11
12
247
275
n, x, y = list(map(int, input().split())) ans = [0] * n for i in range(1, n + 1): for j in range(i + 1, n + 1): dist1 = j - i dist2 = abs(x - i) + abs(y - j) + 1 dist3 = abs(y - i) + abs(x - j) + 1 d = min(dist1, dist2, dist3) ans[d] += 1 for i in range(1, n): print((ans[...
N, X, Y = list(map(int, input().split())) cnt = [0] * N for i in range(1, N + 1): for j in range(i + 1, N + 1): if abs(X - i) + abs(j - Y) + 1 < j - i: cnt[abs(X - i) + abs(j - Y) + 1] += 1 else: cnt[j - i] += 1 for i in range(1, N): print((int(cnt[i])))
false
8.333333
[ "-n, x, y = list(map(int, input().split()))", "-ans = [0] * n", "-for i in range(1, n + 1):", "- for j in range(i + 1, n + 1):", "- dist1 = j - i", "- dist2 = abs(x - i) + abs(y - j) + 1", "- dist3 = abs(y - i) + abs(x - j) + 1", "- d = min(dist1, dist2, dist3)", "- ...
false
0.089762
0.0478
1.877874
[ "s793361011", "s963358647" ]
u868701750
p02773
python
s268607855
s018593150
575
494
35,572
35,940
Accepted
Accepted
14.09
def main(): from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) _max = max(c.values()) keys = [k for k, v in list(c.items()) if v == _max] for a in sorted(keys): print(a) if __name__ == '__main__': main...
def main(): from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) _max = max(c.values()) keys = [k for k, v in list(c.items()) if v == _max] print(('\n'.join(sorted(keys)))) if __name__ == '__main__': main()
17
14
304
291
def main(): from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) _max = max(c.values()) keys = [k for k, v in list(c.items()) if v == _max] for a in sorted(keys): print(a) if __name__ == "__main__": main()
def main(): from collections import Counter N = int(eval(input())) S = [eval(input()) for _ in range(N)] c = Counter(S) _max = max(c.values()) keys = [k for k, v in list(c.items()) if v == _max] print(("\n".join(sorted(keys)))) if __name__ == "__main__": main()
false
17.647059
[ "- for a in sorted(keys):", "- print(a)", "+ print((\"\\n\".join(sorted(keys))))" ]
false
0.045058
0.041022
1.098392
[ "s268607855", "s018593150" ]
u576432509
p02844
python
s798986718
s253895288
603
167
4,584
4,584
Accepted
Accepted
72.31
n=int(eval(input())) s=tuple(eval(input())) pin=set() m=[[] for i in range(10)] for i in range(n): m[int(s[i])].append(i) yn="" for i in range(0,1000): yn="" stri=format(i,"03d") mo=[0]*10 if len(m[int(stri[0])])>0: m01=m[int(stri[0])][0] else: continue ...
n=int(eval(input())) s=tuple(eval(input())) m=[[] for i in range(10)] for i in range(n): m[int(s[i])].append(i) yn="" icnt=0 for i in range(0,1000): yn="" stri=format(i,"03d") stri=list(map(int,stri)) if len(m[stri[0]])>0: m01=m[stri[0]][0] else: continue ...
39
40
868
727
n = int(eval(input())) s = tuple(eval(input())) pin = set() m = [[] for i in range(10)] for i in range(n): m[int(s[i])].append(i) yn = "" for i in range(0, 1000): yn = "" stri = format(i, "03d") mo = [0] * 10 if len(m[int(stri[0])]) > 0: m01 = m[int(stri[0])][0] else: continu...
n = int(eval(input())) s = tuple(eval(input())) m = [[] for i in range(10)] for i in range(n): m[int(s[i])].append(i) yn = "" icnt = 0 for i in range(0, 1000): yn = "" stri = format(i, "03d") stri = list(map(int, stri)) if len(m[stri[0]]) > 0: m01 = m[stri[0]][0] else: continue ...
false
2.5
[ "-pin = set()", "- yn = \"\"", "+yn = \"\"", "+icnt = 0", "- mo = [0] * 10", "- if len(m[int(stri[0])]) > 0:", "- m01 = m[int(stri[0])][0]", "+ stri = list(map(int, stri))", "+ if len(m[stri[0]]) > 0:", "+ m01 = m[stri[0]][0]", "- if len(m[int(stri[1])]) > 0:", ...
false
0.078492
0.074142
1.058667
[ "s798986718", "s253895288" ]
u759412327
p02947
python
s649415110
s773545554
342
219
19,752
24,084
Accepted
Accepted
35.96
from collections import Counter N = int(eval(input())) S = ["".join(sorted(eval(input()))) for i in range(N)] c = Counter(S) print((sum(i*(i-1)//2 for i in list(c.values()))))
from collections import Counter N = int(eval(input())) C = Counter(["".join(sorted(eval(input()))) for n in range(N)]) print((sum(n*(n-1)//2 for n in list(C.values()))))
5
4
159
152
from collections import Counter N = int(eval(input())) S = ["".join(sorted(eval(input()))) for i in range(N)] c = Counter(S) print((sum(i * (i - 1) // 2 for i in list(c.values()))))
from collections import Counter N = int(eval(input())) C = Counter(["".join(sorted(eval(input()))) for n in range(N)]) print((sum(n * (n - 1) // 2 for n in list(C.values()))))
false
20
[ "-S = [\"\".join(sorted(eval(input()))) for i in range(N)]", "-c = Counter(S)", "-print((sum(i * (i - 1) // 2 for i in list(c.values()))))", "+C = Counter([\"\".join(sorted(eval(input()))) for n in range(N)])", "+print((sum(n * (n - 1) // 2 for n in list(C.values()))))" ]
false
0.08918
0.082614
1.079473
[ "s649415110", "s773545554" ]
u170201762
p03713
python
s281383188
s648618293
356
235
3,064
43,888
Accepted
Accepted
33.99
from math import floor,ceil H,W = list(map(int,input().split())) if H%3==0 or W%3==0: print((0)) exit() ans = min(H,W) for i in range(1,W): M = max(i*H,floor(H/2)*(W-i),ceil(H/2)*(W-i)) m = min(i*H,floor(H/2)*(W-i),ceil(H/2)*(W-i)) if M-m<ans: ans = M-m for i in range(1,H): M...
H,W = list(map(int,input().split())) def split2(h,w): if h%2==0 or w%2==0: return h*w//2,h*w//2 else: h,w = max(h,w),min(h,w) return h//2*w,(h+1)//2*w ans = H*W for i in range(1,H): h = H-i w = W s1 = W*i s2,s3 = split2(h,w) ans = min(max(s1,s2,s3)-mi...
17
25
455
479
from math import floor, ceil H, W = list(map(int, input().split())) if H % 3 == 0 or W % 3 == 0: print((0)) exit() ans = min(H, W) for i in range(1, W): M = max(i * H, floor(H / 2) * (W - i), ceil(H / 2) * (W - i)) m = min(i * H, floor(H / 2) * (W - i), ceil(H / 2) * (W - i)) if M - m < ans: ...
H, W = list(map(int, input().split())) def split2(h, w): if h % 2 == 0 or w % 2 == 0: return h * w // 2, h * w // 2 else: h, w = max(h, w), min(h, w) return h // 2 * w, (h + 1) // 2 * w ans = H * W for i in range(1, H): h = H - i w = W s1 = W * i s2, s3 = split2(h, w)...
false
32
[ "-from math import floor, ceil", "+H, W = list(map(int, input().split()))", "-H, W = list(map(int, input().split()))", "-if H % 3 == 0 or W % 3 == 0:", "- print((0))", "- exit()", "-ans = min(H, W)", "+", "+def split2(h, w):", "+ if h % 2 == 0 or w % 2 == 0:", "+ return h * w // ...
false
0.211685
0.221891
0.954004
[ "s281383188", "s648618293" ]
u197457087
p04045
python
s095038311
s311021426
122
88
3,064
9,188
Accepted
Accepted
27.87
N, K = list(map(int,input().split())) D = list(map(int,input().split())) OK = [] for i in range(10): if i not in D: OK.append(str(i)) #print(OK) sn = str(N) l = len(sn) ans = N*1 Flag = 0 while Flag == 0: sans = str(ans) if all(sans[i] in OK for i in range(len(sans))): Flag = 1 else: ...
N,K = list(map(int,input().split())) A = set(map(int,input().split())) #A = set(A) ok = [] for i in range(10): if i not in A: ok.append(i) #print(ok) while True: nstr = str(N) nstr = list(nstr) #print(nstr) Flag = True for x in nstr: x = int(x) if x in A: Flag = False ...
22
25
353
404
N, K = list(map(int, input().split())) D = list(map(int, input().split())) OK = [] for i in range(10): if i not in D: OK.append(str(i)) # print(OK) sn = str(N) l = len(sn) ans = N * 1 Flag = 0 while Flag == 0: sans = str(ans) if all(sans[i] in OK for i in range(len(sans))): Flag = 1 else...
N, K = list(map(int, input().split())) A = set(map(int, input().split())) # A = set(A) ok = [] for i in range(10): if i not in A: ok.append(i) # print(ok) while True: nstr = str(N) nstr = list(nstr) # print(nstr) Flag = True for x in nstr: x = int(x) if x in A: ...
false
12
[ "-D = list(map(int, input().split()))", "-OK = []", "+A = set(map(int, input().split()))", "+# A = set(A)", "+ok = []", "- if i not in D:", "- OK.append(str(i))", "-# print(OK)", "-sn = str(N)", "-l = len(sn)", "-ans = N * 1", "-Flag = 0", "-while Flag == 0:", "- sans = str(an...
false
0.030137
0.077478
0.388971
[ "s095038311", "s311021426" ]
u077291787
p03038
python
s826964860
s680049398
473
294
23,244
23,244
Accepted
Accepted
37.84
# ABC127D - Integer Cards n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted([tuple(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x:x[1], reverse=True) ans = 0 idx = 0 flg = False for i, j in lst: for _ in range(i): ...
# ABC127D - Integer Cards import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted( [tuple(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x: x[1], ...
20
33
533
743
# ABC127D - Integer Cards n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted( [tuple(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x: x[1], reverse=True, ) ans = 0 idx = 0 flg = False for i, j in lst: for _ in range(i)...
# ABC127D - Integer Cards import sys input = sys.stdin.readline def main(): n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted( [tuple(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x: x[1], rever...
false
39.393939
[ "-n, m = list(map(int, input().rstrip().split()))", "-num = sorted(list(map(int, input().rstrip().split())))", "-lst = sorted(", "- [tuple(map(int, input().rstrip().split())) for _ in range(m)],", "- key=lambda x: x[1],", "- reverse=True,", "-)", "-ans = 0", "-idx = 0", "-flg = False", ...
false
0.039767
0.051924
0.765874
[ "s826964860", "s680049398" ]
u148551245
p03315
python
s648937540
s885003195
172
17
38,384
2,940
Accepted
Accepted
90.12
s = eval(input()) p = s.count("+") print((2 * p - 4))
s = eval(input()) n = 0 ans = 0 for o in s: if o == '+': ans += 1 else: ans -= 1 print(ans)
3
9
47
117
s = eval(input()) p = s.count("+") print((2 * p - 4))
s = eval(input()) n = 0 ans = 0 for o in s: if o == "+": ans += 1 else: ans -= 1 print(ans)
false
66.666667
[ "-p = s.count(\"+\")", "-print((2 * p - 4))", "+n = 0", "+ans = 0", "+for o in s:", "+ if o == \"+\":", "+ ans += 1", "+ else:", "+ ans -= 1", "+print(ans)" ]
false
0.122118
0.043442
2.811049
[ "s648937540", "s885003195" ]
u163421511
p03494
python
s881063860
s765228993
28
24
9,112
9,172
Accepted
Accepted
14.29
n = int(eval(input())) a = [int(x) for x in input().split()] boolean = True count = 0 while boolean: for i in range(n): if a[i] % 2 != 0: boolean = False else: a[i] = a[i] / 2 if boolean: count += 1 print(count)
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 while all(i % 2 == 0 for i in a): a = list([int(x/2) for x in a]) cnt += 1 print(cnt)
15
10
249
172
n = int(eval(input())) a = [int(x) for x in input().split()] boolean = True count = 0 while boolean: for i in range(n): if a[i] % 2 != 0: boolean = False else: a[i] = a[i] / 2 if boolean: count += 1 print(count)
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 while all(i % 2 == 0 for i in a): a = list([int(x / 2) for x in a]) cnt += 1 print(cnt)
false
33.333333
[ "-a = [int(x) for x in input().split()]", "-boolean = True", "-count = 0", "-while boolean:", "- for i in range(n):", "- if a[i] % 2 != 0:", "- boolean = False", "- else:", "- a[i] = a[i] / 2", "- if boolean:", "- count += 1", "-print(count)", ...
false
0.035895
0.072016
0.49843
[ "s881063860", "s765228993" ]
u811434779
p00430
python
s800821733
s256171554
100
90
6,272
6,320
Accepted
Accepted
10
l = [0]*31 pos = goal = 0 def solve(cur,sum): global pos, goal if cur == goal: print(" ".join(map(str,l[:pos]))) return for i in range(sum,0,-1): if cur + i <= goal: l[pos] = i pos += 1 solve(cur+i,i) pos -= 1 while True: ...
l = [0]*31 pos = goal = 0 def solve(sum,cur): global pos, goal if sum == goal: print(" ".join(map(str,l[:pos]))) return for i in range(cur,0,-1): if sum + i <= goal: l[pos] = i pos += 1 solve(sum+i,i) pos -= 1 while True: ...
17
17
390
390
l = [0] * 31 pos = goal = 0 def solve(cur, sum): global pos, goal if cur == goal: print(" ".join(map(str, l[:pos]))) return for i in range(sum, 0, -1): if cur + i <= goal: l[pos] = i pos += 1 solve(cur + i, i) pos -= 1 while True: ...
l = [0] * 31 pos = goal = 0 def solve(sum, cur): global pos, goal if sum == goal: print(" ".join(map(str, l[:pos]))) return for i in range(cur, 0, -1): if sum + i <= goal: l[pos] = i pos += 1 solve(sum + i, i) pos -= 1 while True: ...
false
0
[ "-def solve(cur, sum):", "+def solve(sum, cur):", "- if cur == goal:", "+ if sum == goal:", "- for i in range(sum, 0, -1):", "- if cur + i <= goal:", "+ for i in range(cur, 0, -1):", "+ if sum + i <= goal:", "- solve(cur + i, i)", "+ solve(sum + i, i...
false
0.101092
0.048424
2.087644
[ "s800821733", "s256171554" ]
u127499732
p02899
python
s510986917
s242807443
91
81
15,588
15,588
Accepted
Accepted
10.99
n=int(eval(input())) a=list(map(int,input().split())) b=[0]*n for index,number in enumerate(a): b[number-1]=str(index+1) print((" ".join(b)))
def main(): n=int(eval(input())) a=list(map(int,input().split())) b=[0]*n for index,number in enumerate(a): b[number-1]=str(index+1) print((" ".join(b))) if __name__=="__main__": main()
6
9
140
201
n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n for index, number in enumerate(a): b[number - 1] = str(index + 1) print((" ".join(b)))
def main(): n = int(eval(input())) a = list(map(int, input().split())) b = [0] * n for index, number in enumerate(a): b[number - 1] = str(index + 1) print((" ".join(b))) if __name__ == "__main__": main()
false
33.333333
[ "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-b = [0] * n", "-for index, number in enumerate(a):", "- b[number - 1] = str(index + 1)", "-print((\" \".join(b)))", "+def main():", "+ n = int(eval(input()))", "+ a = list(map(int, input().split()))", "+ b = [0] * n",...
false
0.07882
0.162359
0.485467
[ "s510986917", "s242807443" ]
u952708174
p03078
python
s591592823
s534260065
576
32
4,084
5,016
Accepted
Accepted
94.44
def d_cake_123_priority_queue(X, Y, Z, K, A, B, C): # editionalの解法3 import heapq # 数列A, B, Cを降順ソート a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True) def evaluation(x, y, z): # heapqは最小値を取り出す方式なので、符号を反転させないといけない return (-(a[x] + b[y] + c[z]),...
def d_cake_123_priority_queue(X, Y, Z, K, A, B, C): # editionalの解法3 import heapq # 数列A, B, Cを降順ソート a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True) def evaluation(x, y, z): # heapqは最小値を取り出す方式なので、符号を反転させないといけない return (-(a[x] + b[y] + c[z]),...
32
36
1,195
1,322
def d_cake_123_priority_queue(X, Y, Z, K, A, B, C): # editionalの解法3 import heapq # 数列A, B, Cを降順ソート a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True) def evaluation(x, y, z): # heapqは最小値を取り出す方式なので、符号を反転させないといけない return (-(a[x] + b[y] + c[z]), x, y, ...
def d_cake_123_priority_queue(X, Y, Z, K, A, B, C): # editionalの解法3 import heapq # 数列A, B, Cを降順ソート a, b, c = sorted(A, reverse=True), sorted(B, reverse=True), sorted(C, reverse=True) def evaluation(x, y, z): # heapqは最小値を取り出す方式なので、符号を反転させないといけない return (-(a[x] + b[y] + c[z]), x, y, ...
false
11.111111
[ "+ memo = {(0, 0, 0): True}", "- (e, x, y, z) = heapq.heappop(q)", "+ e, x, y, z = heapq.heappop(q)", "- if x + 1 < X and evaluation(x + 1, y, z) not in q:", "+ if x + 1 < X and (x + 1, y, z) not in memo:", "- if y + 1 < Y and evaluation(x, y + 1, z) not in q:", "+ ...
false
0.042004
0.037308
1.125871
[ "s591592823", "s534260065" ]
u505564549
p02720
python
s043311430
s094013059
216
83
74,732
74,904
Accepted
Accepted
61.57
import sys from collections import deque input = sys.stdin.readline n=int(eval(input())) L=deque(list(range(1,10))) if n<=9: ans = L[n-1] else: cnt = 9 for i in range(1,n): c=L.popleft() if c%10!=0: L.append(c*10+(c%10)-1) cnt+=1 ...
import sys from collections import deque input = sys.stdin.readline n=int(eval(input())) L=deque([i for i in range(1,10)]) if n<=9: ans = L[n-1] else: cnt = 9 for i in range(1,n): c=L.popleft() if c%10!=0: L.append(c*10+(c%10)-1) cnt+=1 ...
30
30
598
605
import sys from collections import deque input = sys.stdin.readline n = int(eval(input())) L = deque(list(range(1, 10))) if n <= 9: ans = L[n - 1] else: cnt = 9 for i in range(1, n): c = L.popleft() if c % 10 != 0: L.append(c * 10 + (c % 10) - 1) cnt += 1 ...
import sys from collections import deque input = sys.stdin.readline n = int(eval(input())) L = deque([i for i in range(1, 10)]) if n <= 9: ans = L[n - 1] else: cnt = 9 for i in range(1, n): c = L.popleft() if c % 10 != 0: L.append(c * 10 + (c % 10) - 1) cnt += 1 ...
false
0
[ "-L = deque(list(range(1, 10)))", "+L = deque([i for i in range(1, 10)])" ]
false
0.04026
0.039496
1.019348
[ "s043311430", "s094013059" ]
u203843959
p04013
python
s972305467
s353229181
410
317
93,660
93,020
Accepted
Accepted
22.68
N,A=list(map(int,input().split())) xlist=list(map(int,input().split())) dp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)] dp[0][0][0]=1 for i in range(1,N+1): dp[i][0][0]=1 for j in range(1,N+1): for k in range(1,sum(xlist)+1): dp[i][j][k]=dp[i-1][j][k] if k-xlist[i-1]>=0:...
N,A=list(map(int,input().split())) xlist=list(map(int,input().split())) dp=[[[0]*(sum(xlist)+1) for _ in range(N+1)] for _ in range(N+1)] dp[0][0][0]=1 for i in range(1,N+1): dp[i][0][0]=1 for j in range(1,i+1): for k in range(1,sum(xlist)+1): dp[i][j][k]=dp[i-1][j][k] if k-xlist[i-1]>=0:...
20
21
480
488
N, A = list(map(int, input().split())) xlist = list(map(int, input().split())) dp = [[[0] * (sum(xlist) + 1) for _ in range(N + 1)] for _ in range(N + 1)] dp[0][0][0] = 1 for i in range(1, N + 1): dp[i][0][0] = 1 for j in range(1, N + 1): for k in range(1, sum(xlist) + 1): dp[i][j][k] = dp[i...
N, A = list(map(int, input().split())) xlist = list(map(int, input().split())) dp = [[[0] * (sum(xlist) + 1) for _ in range(N + 1)] for _ in range(N + 1)] dp[0][0][0] = 1 for i in range(1, N + 1): dp[i][0][0] = 1 for j in range(1, i + 1): for k in range(1, sum(xlist) + 1): dp[i][j][k] = dp[i...
false
4.761905
[ "- for j in range(1, N + 1):", "+ for j in range(1, i + 1):", "-for i in range(1, N + 1):", "- if i * A <= sum(xlist):", "- answer += dp[N][i][i * A]", "+for j in range(1, N + 1):", "+ if j * A > sum(xlist):", "+ break", "+ answer += dp[N][j][j * A]" ]
false
0.049547
0.081621
0.60703
[ "s972305467", "s353229181" ]
u364862909
p03112
python
s736412359
s898651330
875
628
100,256
94,736
Accepted
Accepted
28.23
import bisect A, B, Q = list(map(int, input().split())) INF = float('inf') s = [-INF] + [int(eval(input())) for i in range(A)] + [INF] t = [-INF] + [int(eval(input())) for i in range(B)] + [INF] for i in range(Q): x = int(eval(input())) b = bisect.bisect_right(s, x) d = bisect.bisect_right(t, ...
#左右それぞれで一番近い神社 #その神社それぞれの左右それぞれで一番近い寺 #はい2ぶたん INF = 10**12 from bisect import bisect_right A,B,Q = list(map(int,input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] ans =[] for i in range(0,Q,1): tmpans = INF q = int(eval(input())) sr =...
18
47
513
1,041
import bisect A, B, Q = list(map(int, input().split())) INF = float("inf") s = [-INF] + [int(eval(input())) for i in range(A)] + [INF] t = [-INF] + [int(eval(input())) for i in range(B)] + [INF] for i in range(Q): x = int(eval(input())) b = bisect.bisect_right(s, x) d = bisect.bisect_right(t, x) ans = ...
# 左右それぞれで一番近い神社 # その神社それぞれの左右それぞれで一番近い寺 # はい2ぶたん INF = 10**12 from bisect import bisect_right A, B, Q = list(map(int, input().split())) s = [int(eval(input())) for i in range(A)] t = [int(eval(input())) for i in range(B)] ans = [] for i in range(0, Q, 1): tmpans = INF q = int(eval(input())) sr = bisect_rig...
false
61.702128
[ "-import bisect", "+# 左右それぞれで一番近い神社", "+# その神社それぞれの左右それぞれで一番近い寺", "+# はい2ぶたん", "+INF = 10**12", "+from bisect import bisect_right", "-INF = float(\"inf\")", "-s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]", "-t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]", "-for i in ra...
false
0.048693
0.108271
0.449733
[ "s736412359", "s898651330" ]
u494748969
p03307
python
s178407041
s206728828
30
27
9,100
9,116
Accepted
Accepted
10
import math n = int(eval(input())) print((2 // math.gcd(2, n) * n))
n = int(eval(input())) if n % 2 == 0: print(n) else: print((2 * n))
3
5
62
71
import math n = int(eval(input())) print((2 // math.gcd(2, n) * n))
n = int(eval(input())) if n % 2 == 0: print(n) else: print((2 * n))
false
40
[ "-import math", "-", "-print((2 // math.gcd(2, n) * n))", "+if n % 2 == 0:", "+ print(n)", "+else:", "+ print((2 * n))" ]
false
0.037261
0.036319
1.025934
[ "s178407041", "s206728828" ]
u912237403
p00158
python
s545692607
s384936651
20
10
4,192
4,192
Accepted
Accepted
50
while 1: n = int(input()) if n==0: break c=0 while n!=1: n=[n/2,n*3+1][n%2] c+=1 print(c)
while 1: n = eval(input()) if n==0: break c=0 while n>1: n = n*3+1 if n%2 else n/2 c += 1 print(c)
8
8
117
116
while 1: n = int(input()) if n == 0: break c = 0 while n != 1: n = [n / 2, n * 3 + 1][n % 2] c += 1 print(c)
while 1: n = eval(input()) if n == 0: break c = 0 while n > 1: n = n * 3 + 1 if n % 2 else n / 2 c += 1 print(c)
false
0
[ "- n = int(input())", "+ n = eval(input())", "- while n != 1:", "- n = [n / 2, n * 3 + 1][n % 2]", "+ while n > 1:", "+ n = n * 3 + 1 if n % 2 else n / 2" ]
false
0.037329
0.073801
0.505803
[ "s545692607", "s384936651" ]
u540762794
p03329
python
s964962333
s001748960
1,808
491
9,036
9,268
Accepted
Accepted
72.84
# -*- coding: utf-8 -*- def count(val1, val2): num = 1 while True: if val1 < (val2 ** num): break num += 1 cnt = 0 digit = num while True: if val1 >= val2 ** digit: val1 -= val2 ** digit cnt += 1 else: ...
# -*- coding: utf-8 -*- N = int(eval(input())) ans = N for i in range(N+1): n = i m = N - i res = 0 nine = 1 while nine*9 <= n: nine *= 9 while nine != 1: res += n // nine n %= nine nine /= 9 res += n six = 1 while six*6 <= m: ...
44
31
675
473
# -*- coding: utf-8 -*- def count(val1, val2): num = 1 while True: if val1 < (val2**num): break num += 1 cnt = 0 digit = num while True: if val1 >= val2**digit: val1 -= val2**digit cnt += 1 else: digit -= 1 if di...
# -*- coding: utf-8 -*- N = int(eval(input())) ans = N for i in range(N + 1): n = i m = N - i res = 0 nine = 1 while nine * 9 <= n: nine *= 9 while nine != 1: res += n // nine n %= nine nine /= 9 res += n six = 1 while six * 6 <= m: six *= 6 ...
false
29.545455
[ "-def count(val1, val2):", "- num = 1", "- while True:", "- if val1 < (val2**num):", "- break", "- num += 1", "- cnt = 0", "- digit = num", "- while True:", "- if val1 >= val2**digit:", "- val1 -= val2**digit", "- cnt += 1", ...
false
0.296859
0.179064
1.657839
[ "s964962333", "s001748960" ]
u260980560
p00855
python
s706266159
s858053489
1,460
460
44,972
35,008
Accepted
Accepted
68.49
M = 1299710 isPrime = [1]*M isPrime[0],isPrime[1] = 0,0 lp = [0]*M; p = [] b = 2 for i in range(2,M): if isPrime[i]: for j in range(i*i,M,i): isPrime[j] = 0 p.append(i) b = i lp[i] = b while 1: n = eval(input()) if n==0: break print(p[p.index(lp[n])...
M = 1299710 isPrime = [1]*M isPrime[0],isPrime[1] = 0,0 for i in range(2,M): if isPrime[i]: for j in range(i*i,M,i): isPrime[j] = 0 while 1: n = eval(input()) if n==0: break p = q = n if isPrime[n]: print(0) else: while isPrime[p]==0:p-=1 ...
17
18
351
365
M = 1299710 isPrime = [1] * M isPrime[0], isPrime[1] = 0, 0 lp = [0] * M p = [] b = 2 for i in range(2, M): if isPrime[i]: for j in range(i * i, M, i): isPrime[j] = 0 p.append(i) b = i lp[i] = b while 1: n = eval(input()) if n == 0: break print(p[p.index(l...
M = 1299710 isPrime = [1] * M isPrime[0], isPrime[1] = 0, 0 for i in range(2, M): if isPrime[i]: for j in range(i * i, M, i): isPrime[j] = 0 while 1: n = eval(input()) if n == 0: break p = q = n if isPrime[n]: print(0) else: while isPrime[p] == 0: ...
false
5.555556
[ "-lp = [0] * M", "-p = []", "-b = 2", "- p.append(i)", "- b = i", "- lp[i] = b", "- print(p[p.index(lp[n]) + 1] - lp[n] if lp[n] != n else \"0\")", "+ p = q = n", "+ if isPrime[n]:", "+ print(0)", "+ else:", "+ while isPrime[p] == 0:", "+ ...
false
0.680586
1.25347
0.542962
[ "s706266159", "s858053489" ]
u852690916
p03347
python
s326528789
s159916786
768
290
59,224
50,524
Accepted
Accepted
62.24
N=int(eval(input())) A=[int(eval(input())) for _ in range(N)] ans=0 if A[0]!=0: print((-1)) exit() for i in range(N-1,0,-1): l,a=A[i-1],A[i] if a>l+1: print((-1)) exit() elif a==l+1: ans+=1 elif a!=0: ans+=a print(ans)
import sys def main(): input = sys.stdin.readline N=int(eval(input())) A=[int(eval(input())) for _ in range(N)] if A[0]!=0: print((-1)) exit() ans=0 d=0 for i in range(1,N): if A[i]==0: continue if A[i]>d+1: print((-1)) ...
17
26
275
472
N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] ans = 0 if A[0] != 0: print((-1)) exit() for i in range(N - 1, 0, -1): l, a = A[i - 1], A[i] if a > l + 1: print((-1)) exit() elif a == l + 1: ans += 1 elif a != 0: ans += a print(ans)
import sys def main(): input = sys.stdin.readline N = int(eval(input())) A = [int(eval(input())) for _ in range(N)] if A[0] != 0: print((-1)) exit() ans = 0 d = 0 for i in range(1, N): if A[i] == 0: continue if A[i] > d + 1: print((-1...
false
34.615385
[ "-N = int(eval(input()))", "-A = [int(eval(input())) for _ in range(N)]", "-ans = 0", "-if A[0] != 0:", "- print((-1))", "- exit()", "-for i in range(N - 1, 0, -1):", "- l, a = A[i - 1], A[i]", "- if a > l + 1:", "+import sys", "+", "+", "+def main():", "+ input = sys.stdin....
false
0.045626
0.04524
1.008533
[ "s326528789", "s159916786" ]
u467736898
p02710
python
s626943710
s402951359
985
887
242,220
155,500
Accepted
Accepted
9.95
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(505050) N = int(eval(input())) C = [int(c)-1 for c in input().split()] G = [[] for _ in range(N)] for _ in range(N-1): a, b = list(map(int, input().split())) a -= 1 b -= 1 G[a].append(b) G[b].append(a) Cnt = [0] * N An...
def numba_compile(numba_config): import os, sys if sys.argv[-1] == "ONLINE_JUDGE": from numba import njit from numba.pycc import CC cc = CC("my_module") for func, signature in numba_config: globals()[func.__name__] = njit(signature)(func) cc.export...
50
73
1,023
2,190
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(505050) N = int(eval(input())) C = [int(c) - 1 for c in input().split()] G = [[] for _ in range(N)] for _ in range(N - 1): a, b = list(map(int, input().split())) a -= 1 b -= 1 G[a].append(b) G[b].append(a) Cnt = [0] * N Ans = [0] * ...
def numba_compile(numba_config): import os, sys if sys.argv[-1] == "ONLINE_JUDGE": from numba import njit from numba.pycc import CC cc = CC("my_module") for func, signature in numba_config: globals()[func.__name__] = njit(signature)(func) cc.export(func....
false
31.506849
[ "+def numba_compile(numba_config):", "+ import os, sys", "+", "+ if sys.argv[-1] == \"ONLINE_JUDGE\":", "+ from numba import njit", "+ from numba.pycc import CC", "+", "+ cc = CC(\"my_module\")", "+ for func, signature in numba_config:", "+ globals()[fu...
false
0.042565
0.531069
0.08015
[ "s626943710", "s402951359" ]
u672220554
p02889
python
s536836291
s357815139
1,689
1,393
75,352
77,272
Accepted
Accepted
17.53
n, m, l = list(map(int, input().split())) l1 = [[10 ** 15 for i in range(n)] for i in range(n)] for i in range(n): l1[i][i] = 0 for _ in range(m): a, b, c = list(map(int, input().split())) l1[a - 1][b - 1] = c l1[b - 1][a - 1] = c for i in range(n): for j in range(n): for k i...
def wf(l, n): for i in range(n): for j in range(n): for k in range(n): l[j][k] = min(l[j][k], l[j][i] + l[i][k]) return l def main(): n, m, l = list(map(int, input().split())) l1 = [[10 ** 15 for i in range(n)] for i in range(n)] for _ in range(m)...
41
43
933
920
n, m, l = list(map(int, input().split())) l1 = [[10**15 for i in range(n)] for i in range(n)] for i in range(n): l1[i][i] = 0 for _ in range(m): a, b, c = list(map(int, input().split())) l1[a - 1][b - 1] = c l1[b - 1][a - 1] = c for i in range(n): for j in range(n): for k in range(n): ...
def wf(l, n): for i in range(n): for j in range(n): for k in range(n): l[j][k] = min(l[j][k], l[j][i] + l[i][k]) return l def main(): n, m, l = list(map(int, input().split())) l1 = [[10**15 for i in range(n)] for i in range(n)] for _ in range(m): a, b, c...
false
4.651163
[ "-n, m, l = list(map(int, input().split()))", "-l1 = [[10**15 for i in range(n)] for i in range(n)]", "-for i in range(n):", "- l1[i][i] = 0", "-for _ in range(m):", "- a, b, c = list(map(int, input().split()))", "- l1[a - 1][b - 1] = c", "- l1[b - 1][a - 1] = c", "-for i in range(n):", ...
false
0.0376
0.037766
0.995613
[ "s536836291", "s357815139" ]
u195054737
p03163
python
s843473079
s307973411
378
221
21,908
14,796
Accepted
Accepted
41.53
import numpy as np n, w = list(map(int, input().split())) dp = np.zeros(w+1) for i in range(n): weight, value = list(map(int, input().split())) dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value) print((int(dp[-1])))
import numpy as np n, w = list(map(int, input().split())) dp = np.array([0] * (w+1)) for i in range(n): weight, value = list(map(int, input().split())) dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value) print((int(dp[-1])))
12
13
238
249
import numpy as np n, w = list(map(int, input().split())) dp = np.zeros(w + 1) for i in range(n): weight, value = list(map(int, input().split())) dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value) print((int(dp[-1])))
import numpy as np n, w = list(map(int, input().split())) dp = np.array([0] * (w + 1)) for i in range(n): weight, value = list(map(int, input().split())) dp[weight:] = np.maximum(dp[weight:], dp[:-weight] + value) print((int(dp[-1])))
false
7.692308
[ "-dp = np.zeros(w + 1)", "+dp = np.array([0] * (w + 1))" ]
false
0.235487
0.315364
0.746715
[ "s843473079", "s307973411" ]
u072053884
p02315
python
s313439578
s870572623
450
400
7,968
7,964
Accepted
Accepted
11.11
def knapsack(items, num, weight): C = [0] * (weight + 1) for i in items: item_v, item_w = i for w in range(weight, 0, -1): if item_w <= w: v1 = item_v + C[w - item_w] v2 = C[w] C[w] = max(v1, v2) return C[weight] import ...
def knapsack(items, num, weight): C = [0] * (weight + 1) for i in items: item_v, item_w = i for w in range(weight, item_w - 1, -1): v1 = item_v + C[w - item_w] v2 = C[w] C[w] = max(v1, v2) return C[weight] import sys file_input = sys.stdin ...
22
21
503
471
def knapsack(items, num, weight): C = [0] * (weight + 1) for i in items: item_v, item_w = i for w in range(weight, 0, -1): if item_w <= w: v1 = item_v + C[w - item_w] v2 = C[w] C[w] = max(v1, v2) return C[weight] import sys file_...
def knapsack(items, num, weight): C = [0] * (weight + 1) for i in items: item_v, item_w = i for w in range(weight, item_w - 1, -1): v1 = item_v + C[w - item_w] v2 = C[w] C[w] = max(v1, v2) return C[weight] import sys file_input = sys.stdin N, W = list(m...
false
4.545455
[ "- for w in range(weight, 0, -1):", "- if item_w <= w:", "- v1 = item_v + C[w - item_w]", "- v2 = C[w]", "- C[w] = max(v1, v2)", "+ for w in range(weight, item_w - 1, -1):", "+ v1 = item_v + C[w - item_w]", "+ ...
false
0.078477
0.082994
0.945582
[ "s313439578", "s870572623" ]
u608088992
p03040
python
s514185122
s239749364
898
765
19,336
19,304
Accepted
Accepted
14.81
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return b def sol...
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return b def sol...
49
41
1,719
1,320
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return...
import sys, math, collections, heapq, itertools from bisect import bisect_left F = sys.stdin def single_input(): return F.readline().strip("\n") def line_input(): return F.readline().strip("\n").split() def gcd(a, b): a, b = max(a, b), min(a, b) while a % b > 0: a, b = b, a % b return...
false
16.326531
[ "- left_upper = -1 * heapq.heappop(left)", "- right_lower = heapq.heappop(right)", "- if left_upper <= a <= right_lower:", "+ if -1 * left[0] <= a <= right[0]:", "- heapq.heappush(left, -1 * left_upper)", "- heapq.heappush(right, ri...
false
0.039069
0.041235
0.947454
[ "s514185122", "s239749364" ]
u497596438
p03682
python
s022724679
s539529513
1,719
1,541
133,508
128,420
Accepted
Accepted
10.35
class UnionFind: def __init__(self, n): self.par = [i for i in range(n+1)] self.rank = [0] * (n+1) self.size = [1] * (n+1) # 検索 def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) ...
class UnionFindNode(object): """ Union-Find構造 ノードのグループ併合や、所属グループ判定を高速に処理する """ def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.size_ = 1 def __str__(self): templa...
74
70
1,691
2,067
class UnionFind: def __init__(self, n): self.par = [i for i in range(n + 1)] self.rank = [0] * (n + 1) self.size = [1] * (n + 1) # 検索 def find(self, x): if self.par[x] == x: return x else: self.par[x] = self.find(self.par[x]) retur...
class UnionFindNode(object): """ Union-Find構造 ノードのグループ併合や、所属グループ判定を高速に処理する """ def __init__(self, group_id, parent=None, value=None): self.group_id_ = group_id self.parent_ = parent self.value = value self.size_ = 1 def __str__(self): template = "UnionFi...
false
5.405405
[ "-class UnionFind:", "- def __init__(self, n):", "- self.par = [i for i in range(n + 1)]", "- self.rank = [0] * (n + 1)", "- self.size = [1] * (n + 1)", "+class UnionFindNode(object):", "+ \"\"\"", "+ Union-Find構造", "+ ノードのグループ併合や、所属グループ判定を高速に処理する", "+ \"\"\"", ...
false
0.048635
0.049798
0.976641
[ "s022724679", "s539529513" ]
u216015528
p03557
python
s585442094
s287796813
257
217
31,128
29,124
Accepted
Accepted
15.56
#!/usr/bin/env python3 def main(): from bisect import bisect N = int(eval(input())) A = sorted([int(x) for x in input().split()]) B = sorted([int(x) for x in input().split()]) C = sorted([int(x) for x in input().split()]) lst = [N - bisect(C, b) for b in B] lst = lst[::-1] t...
#!/usr/bin/env python3 def main(): from bisect import bisect, bisect_left N = int(eval(input())) A = sorted([int(x) for x in input().split()]) B = sorted([int(x) for x in input().split()]) C = sorted([int(x) for x in input().split()]) print((sum([bisect_left(A, b) * (N - bisect(C, b))...
25
14
592
372
#!/usr/bin/env python3 def main(): from bisect import bisect N = int(eval(input())) A = sorted([int(x) for x in input().split()]) B = sorted([int(x) for x in input().split()]) C = sorted([int(x) for x in input().split()]) lst = [N - bisect(C, b) for b in B] lst = lst[::-1] tmp_lst = [ls...
#!/usr/bin/env python3 def main(): from bisect import bisect, bisect_left N = int(eval(input())) A = sorted([int(x) for x in input().split()]) B = sorted([int(x) for x in input().split()]) C = sorted([int(x) for x in input().split()]) print((sum([bisect_left(A, b) * (N - bisect(C, b)) for b in ...
false
44
[ "- from bisect import bisect", "+ from bisect import bisect, bisect_left", "- lst = [N - bisect(C, b) for b in B]", "- lst = lst[::-1]", "- tmp_lst = [lst[0]]", "- for i in lst[1:]:", "- tmp_lst.append(i + tmp_lst[-1])", "- tmp_lst = tmp_lst[::-1]", "- ans = 0", "- ...
false
0.047868
0.00789
6.067153
[ "s585442094", "s287796813" ]
u502389123
p03163
python
s143772167
s122766412
691
529
173,448
120,684
Accepted
Accepted
23.44
N, W = list(map(int, input().split())) w = [0] * N v = [0] * N for i in range(N): w[i], v[i] = list(map(int, input().split())) dp = [[0 for _ in range(W+1)] for _ in range(N+1)] for i in range(N): for sum_w in range(W+1): if w[i] <= sum_w: dp[i+1][sum_w] = max(dp[i][sum_w], dp[i...
N, W = list(map(int, input().split())) w = [0] * N v = [0] * N for i in range(N): w[i], v[i] = list(map(int, input().split())) dp = [[0] * (W+1) for i in range(N+1)] for i in range(1, N+1): for s in range(1, W+1): if w[i-1] <= s: dp[i][s] = max(dp[i][s], dp[i-1][s-w[i-1]] + v[i-1]...
15
14
408
375
N, W = list(map(int, input().split())) w = [0] * N v = [0] * N for i in range(N): w[i], v[i] = list(map(int, input().split())) dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)] for i in range(N): for sum_w in range(W + 1): if w[i] <= sum_w: dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i][sum...
N, W = list(map(int, input().split())) w = [0] * N v = [0] * N for i in range(N): w[i], v[i] = list(map(int, input().split())) dp = [[0] * (W + 1) for i in range(N + 1)] for i in range(1, N + 1): for s in range(1, W + 1): if w[i - 1] <= s: dp[i][s] = max(dp[i][s], dp[i - 1][s - w[i - 1]] + v...
false
6.666667
[ "-dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]", "-for i in range(N):", "- for sum_w in range(W + 1):", "- if w[i] <= sum_w:", "- dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - w[i]] + v[i])", "- dp[i + 1][sum_w] = max(dp[i][sum_w], dp[i + 1][sum_w])", "+dp = [[...
false
0.139145
0.138565
1.004183
[ "s143772167", "s122766412" ]
u227082700
p03095
python
s629925886
s274965836
33
26
4,340
4,212
Accepted
Accepted
21.21
from collections import Counter n,s=int(eval(input())),eval(input());c=[s[i]for i in range(n)];a=Counter(c);ans=1 for i in a:ans*=a[i]+1 print(((ans-1)%(10**9+7)))
n=int(eval(input())) s=eval(input()) from collections import Counter d=Counter(list(s)) ans=1 for i in d:ans*=d[i]+1 ans-=1 print((ans%(10**9+7)))
4
8
152
139
from collections import Counter n, s = int(eval(input())), eval(input()) c = [s[i] for i in range(n)] a = Counter(c) ans = 1 for i in a: ans *= a[i] + 1 print(((ans - 1) % (10**9 + 7)))
n = int(eval(input())) s = eval(input()) from collections import Counter d = Counter(list(s)) ans = 1 for i in d: ans *= d[i] + 1 ans -= 1 print((ans % (10**9 + 7)))
false
50
[ "+n = int(eval(input()))", "+s = eval(input())", "-n, s = int(eval(input())), eval(input())", "-c = [s[i] for i in range(n)]", "-a = Counter(c)", "+d = Counter(list(s))", "-for i in a:", "- ans *= a[i] + 1", "-print(((ans - 1) % (10**9 + 7)))", "+for i in d:", "+ ans *= d[i] + 1", "+ans ...
false
0.12047
0.043915
2.743243
[ "s629925886", "s274965836" ]
u039189422
p02819
python
s415365629
s337953175
271
29
2,940
3,064
Accepted
Accepted
89.3
x=int(eval(input())) ans=x-1 cnt=0 while cnt==0: cnt=1 ans+=1 for i in range(2,ans): if ans%i==0: cnt=0 print(ans)
x=int(eval(input())) ans=x-1 cnt=0 while cnt==0: cnt=1 ans+=1 for i in range(2,ans): if ans%i==0: cnt=0 break print(ans)
10
11
125
135
x = int(eval(input())) ans = x - 1 cnt = 0 while cnt == 0: cnt = 1 ans += 1 for i in range(2, ans): if ans % i == 0: cnt = 0 print(ans)
x = int(eval(input())) ans = x - 1 cnt = 0 while cnt == 0: cnt = 1 ans += 1 for i in range(2, ans): if ans % i == 0: cnt = 0 break print(ans)
false
9.090909
[ "+ break" ]
false
0.051761
0.035714
1.449335
[ "s415365629", "s337953175" ]
u581187895
p02814
python
s546743809
s872825481
484
229
13,024
14,292
Accepted
Accepted
52.69
import sys sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read inp = sys.stdin.buffer.readline def inputS(): return input().rstrip().decode() readlines = sys.stdin.buffer.readlines def gcd(a, b): while b: a, b = b, a%b return a def lcm(a, b): return a*b // gcd(a, b) def div2cnt(a...
def resolve(): def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) N, M = list(map(int, input().split())) A = list(map(int, input().split())) # Aは偶数。2*Bと書ける。少数をなくすため, B*(2p + 1)と式変形 # 2を使用した為、2で割る B = ...
45
38
774
868
import sys sys.setrecursionlimit(10**7) read = sys.stdin.buffer.read inp = sys.stdin.buffer.readline def inputS(): return input().rstrip().decode() readlines = sys.stdin.buffer.readlines def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) def div2...
def resolve(): def gcd(a, b): while b: a, b = b, a % b return a def lcm(a, b): return a * b // gcd(a, b) N, M = list(map(int, input().split())) A = list(map(int, input().split())) # Aは偶数。2*Bと書ける。少数をなくすため, B*(2p + 1)と式変形 # 2を使用した為、2で割る B = [a // 2 for a i...
false
15.555556
[ "-import sys", "+def resolve():", "+ def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "-sys.setrecursionlimit(10**7)", "-read = sys.stdin.buffer.read", "-inp = sys.stdin.buffer.readline", "+ def lcm(a, b):", "+ return a * b // gcd(a, b)", ...
false
0.037622
0.067148
0.560289
[ "s546743809", "s872825481" ]
u886142147
p02713
python
s152779494
s573031299
1,407
1,079
9,124
9,184
Accepted
Accepted
23.31
import math k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): tmp = math.gcd(i, j) for l in range(1, k + 1): ans = ans + math.gcd(tmp, l) print(ans)
from math import gcd k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): tmp = gcd(i, j) for l in range(1, k + 1): ans = ans + gcd(tmp, l) print(ans)
13
13
223
216
import math k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): tmp = math.gcd(i, j) for l in range(1, k + 1): ans = ans + math.gcd(tmp, l) print(ans)
from math import gcd k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): tmp = gcd(i, j) for l in range(1, k + 1): ans = ans + gcd(tmp, l) print(ans)
false
0
[ "-import math", "+from math import gcd", "- tmp = math.gcd(i, j)", "+ tmp = gcd(i, j)", "- ans = ans + math.gcd(tmp, l)", "+ ans = ans + gcd(tmp, l)" ]
false
0.040135
0.171921
0.233452
[ "s152779494", "s573031299" ]
u757117214
p02678
python
s403555667
s862620634
1,876
734
197,416
37,576
Accepted
Accepted
60.87
import networkx as nx N,M = list(map(int,input().split())) G = nx.Graph() for i in range(M): A,B = list(map(int,input().split())) G.add_edge(A,B) print("Yes") pre = nx.predecessor(G,1) for i in range(2,N+1): print((pre[i][0]))
from collections import deque N,M = list(map(int,input().split())) G = [[] for _ in range(N+1)] dist = [-1] * (N+1) pre = [1] * (N+1) dist[0:2] = [0,0] q = deque() for i in range(M): A,B = list(map(int,input().split())) G[A].append(B) G[B].append(A) #print(G) q.append(1) while q: v...
11
26
235
519
import networkx as nx N, M = list(map(int, input().split())) G = nx.Graph() for i in range(M): A, B = list(map(int, input().split())) G.add_edge(A, B) print("Yes") pre = nx.predecessor(G, 1) for i in range(2, N + 1): print((pre[i][0]))
from collections import deque N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] dist = [-1] * (N + 1) pre = [1] * (N + 1) dist[0:2] = [0, 0] q = deque() for i in range(M): A, B = list(map(int, input().split())) G[A].append(B) G[B].append(A) # print(G) q.append(1) while q: v = q.popl...
false
57.692308
[ "-import networkx as nx", "+from collections import deque", "-G = nx.Graph()", "+G = [[] for _ in range(N + 1)]", "+dist = [-1] * (N + 1)", "+pre = [1] * (N + 1)", "+dist[0:2] = [0, 0]", "+q = deque()", "- G.add_edge(A, B)", "+ G[A].append(B)", "+ G[B].append(A)", "+# print(G)", "+q...
false
0.10536
0.038173
2.760059
[ "s403555667", "s862620634" ]
u389910364
p02758
python
s369732263
s210452478
1,886
1,680
122,788
122,916
Accepted
Accepted
10.92
import bisect import operator import os import sys from functools import reduce class SegmentTree: # http://codeforces.com/blog/entry/18051 def __init__(self, values, op=operator.add): """ :param list values: :param callable op: 結合律を満たす二項演算 """ self._size ...
import bisect import operator import os import sys from functools import reduce class SegmentTree: # http://codeforces.com/blog/entry/18051 def __init__(self, values, op=operator.add): """ :param list values: :param callable op: 結合律を満たす二項演算 """ self._size ...
104
107
2,601
2,666
import bisect import operator import os import sys from functools import reduce class SegmentTree: # http://codeforces.com/blog/entry/18051 def __init__(self, values, op=operator.add): """ :param list values: :param callable op: 結合律を満たす二項演算 """ self._size = len(values) ...
import bisect import operator import os import sys from functools import reduce class SegmentTree: # http://codeforces.com/blog/entry/18051 def __init__(self, values, op=operator.add): """ :param list values: :param callable op: 結合律を満たす二項演算 """ self._size = len(values) ...
false
2.803738
[ "+ def get_values_copy(self):", "+ return self._tree[self._size :]", "+", "-R = [st.get(i) for i in range(N)]", "+R = st.get_values_copy()" ]
false
0.047055
0.047709
0.986302
[ "s369732263", "s210452478" ]
u102461423
p04049
python
s320802157
s600268083
1,030
202
3,948
74,340
Accepted
Accepted
80.39
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque N,K = list(map(int,readline().split())) m = list(map(int,read().split())) AB = list(zip(m,m)) graph = [[] for _ in range(N+1)] for a,b in AB: graph[a].app...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = list(map(int, readline().split())) m = list(map(int, read().split())) G = [[] for _ in range(N + 1)] for a, b in zip(m, m): G[a].append(b) G[b].append(a) ...
48
63
1,036
1,357
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque N, K = list(map(int, readline().split())) m = list(map(int, read().split())) AB = list(zip(m, m)) graph = [[] for _ in range(N + 1)] for a, b in AB: graph[a].append(b) ...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N, K = list(map(int, readline().split())) m = list(map(int, read().split())) G = [[] for _ in range(N + 1)] for a, b in zip(m, m): G[a].append(b) G[b].append(a) def dfs_order...
false
23.809524
[ "+import numpy as np", "-from collections import deque", "-", "-AB = list(zip(m, m))", "-graph = [[] for _ in range(N + 1)]", "-for a, b in AB:", "- graph[a].append(b)", "- graph[b].append(a)", "+G = [[] for _ in range(N + 1)]", "+for a, b in zip(m, m):", "+ G[a].append(b)", "+ G[b...
false
0.054433
0.18106
0.300635
[ "s320802157", "s600268083" ]
u784022244
p03147
python
s563129755
s623517826
329
156
21,400
12,492
Accepted
Accepted
52.58
N=int(eval(input())) H=list(map(int, input().split())) import numpy as np H=np.array(H) ans=0 for i in range(H.max()): #print(H) count=0 now=(H[0]==0) if not now: count+=1 for j in range(1,N): if now: if H[j]!=0: count+=1 ...
import numpy as np N=int(eval(input())) H=list(map(int, input().split())) H=np.array(H) MAX=H.max() ans=0 for i in range(MAX): nowzero=True count=0 for j in range(N): if nowzero: if H[j]>0: nowzero=False count+=1 else: ...
23
25
393
423
N = int(eval(input())) H = list(map(int, input().split())) import numpy as np H = np.array(H) ans = 0 for i in range(H.max()): # print(H) count = 0 now = H[0] == 0 if not now: count += 1 for j in range(1, N): if now: if H[j] != 0: count += 1 now =...
import numpy as np N = int(eval(input())) H = list(map(int, input().split())) H = np.array(H) MAX = H.max() ans = 0 for i in range(MAX): nowzero = True count = 0 for j in range(N): if nowzero: if H[j] > 0: nowzero = False count += 1 else: ...
false
8
[ "+import numpy as np", "+", "-import numpy as np", "-", "+MAX = H.max()", "-for i in range(H.max()):", "+for i in range(MAX):", "+ nowzero = True", "+ count = 0", "+ for j in range(N):", "+ if nowzero:", "+ if H[j] > 0:", "+ nowzero = False", "+ ...
false
0.239828
0.734487
0.326525
[ "s563129755", "s623517826" ]
u707808519
p02891
python
s537103185
s590136174
25
22
3,444
3,444
Accepted
Accepted
12
import copy S = list(eval(input())) K = int(eval(input())) def Scount(): cnt_S = 0 for i in range(len(S)-1): if S[i] == S[i+1]: S[i+1] = "1" cnt_S += 1 return cnt_S T = copy.copy(S) T.insert(0, T[len(T)-1]) cnt_T = 0 for i in range(len(T)-1): if T[i] =...
import copy S = list(eval(input())) K = int(eval(input())) def count(L): cnt = 0 for i in range(len(L)-1): if L[i] == L[i+1]: L[i+1] = "1" cnt += 1 return cnt T = copy.copy(S) T.insert(0, T[len(T)-1]) cnt_T = count(T) if T[-1] != "1": ans = count(S) ...
35
28
689
496
import copy S = list(eval(input())) K = int(eval(input())) def Scount(): cnt_S = 0 for i in range(len(S) - 1): if S[i] == S[i + 1]: S[i + 1] = "1" cnt_S += 1 return cnt_S T = copy.copy(S) T.insert(0, T[len(T) - 1]) cnt_T = 0 for i in range(len(T) - 1): if T[i] == T[i...
import copy S = list(eval(input())) K = int(eval(input())) def count(L): cnt = 0 for i in range(len(L) - 1): if L[i] == L[i + 1]: L[i + 1] = "1" cnt += 1 return cnt T = copy.copy(S) T.insert(0, T[len(T) - 1]) cnt_T = count(T) if T[-1] != "1": ans = count(S) + (cnt_T ...
false
20
[ "-def Scount():", "- cnt_S = 0", "- for i in range(len(S) - 1):", "- if S[i] == S[i + 1]:", "- S[i + 1] = \"1\"", "- cnt_S += 1", "- return cnt_S", "+def count(L):", "+ cnt = 0", "+ for i in range(len(L) - 1):", "+ if L[i] == L[i + 1]:", "+ ...
false
0.049084
0.11262
0.435836
[ "s537103185", "s590136174" ]
u218834617
p02762
python
s465890815
s250997492
702
398
147,476
139,592
Accepted
Accepted
43.3
N,M,K=list(map(int,input().split())) adj=[set() for _ in range(N)] for _ in range(M): A,B=list(map(int,input().split())) A,B=A-1,B-1 adj[A].add(B) adj[B].add(A) blk=[{*()} for _ in range(N)] for _ in range(K): A,B=list(map(int,input().split())) A,B=A-1,B-1 blk[A].add(B) b...
import sys ris=lambda:list(map(int,next(sys.stdin).split())) N,M,K=ris() adj=[set() for _ in range(N)] for _ in range(M): A,B=ris() A,B=A-1,B-1 adj[A].add(B) adj[B].add(A) colors=[-1]*N ct={} color=-1 for u in range(N): if colors[u]!=-1: continue color+=1 colo...
47
47
855
831
N, M, K = list(map(int, input().split())) adj = [set() for _ in range(N)] for _ in range(M): A, B = list(map(int, input().split())) A, B = A - 1, B - 1 adj[A].add(B) adj[B].add(A) blk = [{*()} for _ in range(N)] for _ in range(K): A, B = list(map(int, input().split())) A, B = A - 1, B - 1 bl...
import sys ris = lambda: list(map(int, next(sys.stdin).split())) N, M, K = ris() adj = [set() for _ in range(N)] for _ in range(M): A, B = ris() A, B = A - 1, B - 1 adj[A].add(B) adj[B].add(A) colors = [-1] * N ct = {} color = -1 for u in range(N): if colors[u] != -1: continue color += ...
false
0
[ "-N, M, K = list(map(int, input().split()))", "+import sys", "+", "+ris = lambda: list(map(int, next(sys.stdin).split()))", "+N, M, K = ris()", "- A, B = list(map(int, input().split()))", "+ A, B = ris()", "-blk = [{*()} for _ in range(N)]", "-for _ in range(K):", "- A, B = list(map(int, ...
false
0.076538
0.037419
2.045436
[ "s465890815", "s250997492" ]
u261103969
p02861
python
s960207866
s321821244
422
107
8,308
74,632
Accepted
Accepted
74.64
from itertools import permutations n = int(eval(input())) x = [0] * n y = [0] * n for i in range(n): x[i], y[i] = [int(j) for j in input().split()] root = list(permutations(list(range(0,n)))) dist = 0 for r in root: for i in range(1,n): dist += ((x[r[i]]-x[r[i-1]])**2 + (y[r[i]]-y[r[i-...
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): from itertools import permutations from math import factorial N = int(readline()) mat = [] s = 0 for _ in range(N): x, y = list(map(int, readline...
17
31
346
635
from itertools import permutations n = int(eval(input())) x = [0] * n y = [0] * n for i in range(n): x[i], y[i] = [int(j) for j in input().split()] root = list(permutations(list(range(0, n)))) dist = 0 for r in root: for i in range(1, n): dist += ((x[r[i]] - x[r[i - 1]]) ** 2 + (y[r[i]] - y[r[i - 1]]) ...
import sys readline = sys.stdin.readline MOD = 10**9 + 7 INF = float("INF") sys.setrecursionlimit(10**5) def main(): from itertools import permutations from math import factorial N = int(readline()) mat = [] s = 0 for _ in range(N): x, y = list(map(int, readline().split())) m...
false
45.16129
[ "-from itertools import permutations", "+import sys", "-n = int(eval(input()))", "-x = [0] * n", "-y = [0] * n", "-for i in range(n):", "- x[i], y[i] = [int(j) for j in input().split()]", "-root = list(permutations(list(range(0, n))))", "-dist = 0", "-for r in root:", "- for i in range(1, ...
false
0.046167
0.161152
0.286483
[ "s960207866", "s321821244" ]
u777283665
p03683
python
s288188321
s972852295
511
56
55,152
3,060
Accepted
Accepted
89.04
import math n, m = list(map(int, input().split())) mod = 10 ** 9 + 7 if abs(n-m) > 1: print((0)) exit() if abs(n-m) == 0: ans = math.factorial(n) * math.factorial(m) * 2 % mod print(ans) else: ans = math.factorial(n) % mod * math.factorial(m) % mod print(ans)
import math n, m = list(map(int, input().split())) mod = 10 ** 9 + 7 if abs(n-m) > 1: print((0)) else: ans = 1 for i in range(1, n+1): ans = ans * i % mod for j in range(1, m+1): ans = ans * j % mod if abs(n-m) == 0: print((2 * ans % mod)) else: ...
15
19
292
330
import math n, m = list(map(int, input().split())) mod = 10**9 + 7 if abs(n - m) > 1: print((0)) exit() if abs(n - m) == 0: ans = math.factorial(n) * math.factorial(m) * 2 % mod print(ans) else: ans = math.factorial(n) % mod * math.factorial(m) % mod print(ans)
import math n, m = list(map(int, input().split())) mod = 10**9 + 7 if abs(n - m) > 1: print((0)) else: ans = 1 for i in range(1, n + 1): ans = ans * i % mod for j in range(1, m + 1): ans = ans * j % mod if abs(n - m) == 0: print((2 * ans % mod)) else: print((ans ...
false
21.052632
[ "- exit()", "-if abs(n - m) == 0:", "- ans = math.factorial(n) * math.factorial(m) * 2 % mod", "- print(ans)", "- ans = math.factorial(n) % mod * math.factorial(m) % mod", "- print(ans)", "+ ans = 1", "+ for i in range(1, n + 1):", "+ ans = ans * i % mod", "+ for j i...
false
0.150104
0.057929
2.591181
[ "s288188321", "s972852295" ]
u678167152
p03103
python
s370158023
s940371369
432
340
27,756
27,480
Accepted
Accepted
21.3
def solve(): N, M = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(N)] A.sort() ans = 0 cnt = 0 for a in A: if cnt + a[1] <= M: ans += a[1]*a[0] cnt += a[1] else: ans += a[0]*(M-cnt) ...
from math import ceil def solve(): ans = 0 N, M = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(N)] A.sort() for i in range(N): if M<=A[i][1]: ans += M*A[i][0] break else: ans += A[i][0]*A[i][1] ...
15
15
351
367
def solve(): N, M = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(N)] A.sort() ans = 0 cnt = 0 for a in A: if cnt + a[1] <= M: ans += a[1] * a[0] cnt += a[1] else: ans += a[0] * (M - cnt) break ...
from math import ceil def solve(): ans = 0 N, M = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(N)] A.sort() for i in range(N): if M <= A[i][1]: ans += M * A[i][0] break else: ans += A[i][0] * A[i][1] ...
false
0
[ "+from math import ceil", "+", "+", "+ ans = 0", "- ans = 0", "- cnt = 0", "- for a in A:", "- if cnt + a[1] <= M:", "- ans += a[1] * a[0]", "- cnt += a[1]", "+ for i in range(N):", "+ if M <= A[i][1]:", "+ ans += M * A[i][0]", ...
false
0.040945
0.047818
0.856274
[ "s370158023", "s940371369" ]
u519339498
p02570
python
s371654529
s494061985
30
27
9,160
9,144
Accepted
Accepted
10
''' Created on 2020/08/29 @author: harurun ''' def main(): import sys pin=sys.stdin.readline pout=sys.stdout.write perr=sys.stderr.write D,T,S=list(map(int,pin().split())) if S*T>=D: print("Yes") else: print("No") return main()
a,b,c=list(map(int,input().split())) if a<=b*c:print("Yes") else:print("No") #連続acしなきゃ……
18
5
267
90
""" Created on 2020/08/29 @author: harurun """ def main(): import sys pin = sys.stdin.readline pout = sys.stdout.write perr = sys.stderr.write D, T, S = list(map(int, pin().split())) if S * T >= D: print("Yes") else: print("No") return main()
a, b, c = list(map(int, input().split())) if a <= b * c: print("Yes") else: print("No") # 連続acしなきゃ……
false
72.222222
[ "-\"\"\"", "-Created on 2020/08/29", "-@author: harurun", "-\"\"\"", "-", "-", "-def main():", "- import sys", "-", "- pin = sys.stdin.readline", "- pout = sys.stdout.write", "- perr = sys.stderr.write", "- D, T, S = list(map(int, pin().split()))", "- if S * T >= D:", "...
false
0.060483
0.036655
1.650052
[ "s371654529", "s494061985" ]
u390901183
p02887
python
s351941282
s867833179
1,528
43
4,084
3,316
Accepted
Accepted
97.19
N = int(eval(input())) S = eval(input()) l = list(S) i = 0 while i < len(l) - 1: if l[i] != l[i + 1]: i += 1 continue del l[i] print((len(l)))
N = int(eval(input())) S = eval(input()) ans = 1 for i in range(N - 1): if S[i] != S[i + 1]: ans += 1 print(ans)
13
9
168
123
N = int(eval(input())) S = eval(input()) l = list(S) i = 0 while i < len(l) - 1: if l[i] != l[i + 1]: i += 1 continue del l[i] print((len(l)))
N = int(eval(input())) S = eval(input()) ans = 1 for i in range(N - 1): if S[i] != S[i + 1]: ans += 1 print(ans)
false
30.769231
[ "-l = list(S)", "-i = 0", "-while i < len(l) - 1:", "- if l[i] != l[i + 1]:", "- i += 1", "- continue", "- del l[i]", "-print((len(l)))", "+ans = 1", "+for i in range(N - 1):", "+ if S[i] != S[i + 1]:", "+ ans += 1", "+print(ans)" ]
false
0.036118
0.035334
1.022192
[ "s351941282", "s867833179" ]
u977389981
p03029
python
s723804365
s818042387
170
17
38,384
2,940
Accepted
Accepted
90
A, P = list(map(int, input().split())) n = A * 3 print(((n + P) // 2))
a, p = list(map(int, input().split())) print((((a * 3) + p) // 2))
3
2
64
59
A, P = list(map(int, input().split())) n = A * 3 print(((n + P) // 2))
a, p = list(map(int, input().split())) print((((a * 3) + p) // 2))
false
33.333333
[ "-A, P = list(map(int, input().split()))", "-n = A * 3", "-print(((n + P) // 2))", "+a, p = list(map(int, input().split()))", "+print((((a * 3) + p) // 2))" ]
false
0.078739
0.03343
2.355366
[ "s723804365", "s818042387" ]
u603234915
p03651
python
s698082944
s555453596
199
67
14,224
14,096
Accepted
Accepted
66.33
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a%b return a S_possible = "POSSIBLE" S_impossible = "IMPOSSIBLE" if N == 1: if K == A[0]: print(S_possible) else: print(S_impossible) else: gcd_...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a%b return a S_possible = "POSSIBLE" S_impossible = "IMPOSSIBLE" b = 0 for a in A: b = gcd(a, b) if K % b or K > max(A): print(S_impossible) else: print(S_p...
27
21
582
323
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a % b return a S_possible = "POSSIBLE" S_impossible = "IMPOSSIBLE" if N == 1: if K == A[0]: print(S_possible) else: print(S_impossible) else: gcd_max = gcd(A[0], A...
N, K = list(map(int, input().split())) A = list(map(int, input().split())) def gcd(a, b): while b: a, b = b, a % b return a S_possible = "POSSIBLE" S_impossible = "IMPOSSIBLE" b = 0 for a in A: b = gcd(a, b) if K % b or K > max(A): print(S_impossible) else: print(S_possible)
false
22.222222
[ "-if N == 1:", "- if K == A[0]:", "- print(S_possible)", "- else:", "- print(S_impossible)", "+b = 0", "+for a in A:", "+ b = gcd(a, b)", "+if K % b or K > max(A):", "+ print(S_impossible)", "- gcd_max = gcd(A[0], A[1])", "- for i in range(N - 1):", "- ...
false
0.141746
0.062501
2.267901
[ "s698082944", "s555453596" ]
u392319141
p02556
python
s712624921
s100611251
1,287
856
36,048
36,016
Accepted
Accepted
33.49
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -10**10 ans = 0 for O in [(INF, INF), (-INF, INF), (INF, -INF), (-INF, -INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): ...
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -10**10 ans = 0 for O in [(INF, INF), (-INF, INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = xy O = S ...
21
21
461
434
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -(10**10) ans = 0 for O in [(INF, INF), (-INF, INF), (INF, -INF), (-INF, -INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = ...
N = int(eval(input())) def dist(A, B): return abs(A[0] - B[0]) + abs(A[1] - B[1]) XY = [tuple(map(int, input().split())) for _ in range(N)] INF = -(10**10) ans = 0 for O in [(INF, INF), (-INF, INF)]: S = XY[0] for xy in XY: if dist(O, S) < dist(O, xy): S = xy O = S for xy in ...
false
0
[ "-for O in [(INF, INF), (-INF, INF), (INF, -INF), (-INF, -INF)]:", "+for O in [(INF, INF), (-INF, INF)]:" ]
false
0.152892
0.036139
4.230633
[ "s712624921", "s100611251" ]
u103902792
p02787
python
s277404979
s883206426
650
437
43,228
42,568
Accepted
Accepted
32.77
h,n = list(map(int,input().split())) skills = [] for _ in range(n): a,b = list(map(int,input().split())) skills.append((a,b)) dp = [float('inf') for _ in range(h+max(skills,key=lambda x:x[1])[1] + 1)] dp[0] = 0 for i in range(len(dp)): if dp[i] ==float('inf'): continue for damage,mp in skills:...
h,n = list(map(int,input().split())) magic = [] maxa = 0 for _ in range(n): a,b = list(map(int,input().split())) maxa = max(maxa,a) magic.append((a,b)) #magic.sort() dp = [float('inf') for _ in range(h + maxa)] dp[0] = 0 for i in range(h): for a,b in magic: if i+a > h+maxa: continue ...
20
18
487
364
h, n = list(map(int, input().split())) skills = [] for _ in range(n): a, b = list(map(int, input().split())) skills.append((a, b)) dp = [float("inf") for _ in range(h + max(skills, key=lambda x: x[1])[1] + 1)] dp[0] = 0 for i in range(len(dp)): if dp[i] == float("inf"): continue for damage, mp i...
h, n = list(map(int, input().split())) magic = [] maxa = 0 for _ in range(n): a, b = list(map(int, input().split())) maxa = max(maxa, a) magic.append((a, b)) # magic.sort() dp = [float("inf") for _ in range(h + maxa)] dp[0] = 0 for i in range(h): for a, b in magic: if i + a > h + maxa: ...
false
10
[ "-skills = []", "+magic = []", "+maxa = 0", "- skills.append((a, b))", "-dp = [float(\"inf\") for _ in range(h + max(skills, key=lambda x: x[1])[1] + 1)]", "+ maxa = max(maxa, a)", "+ magic.append((a, b))", "+# magic.sort()", "+dp = [float(\"inf\") for _ in range(h + maxa)]", "-for i in r...
false
0.106407
0.120309
0.884446
[ "s277404979", "s883206426" ]
u380524497
p03450
python
s868117871
s526903443
1,531
1,320
85,700
79,764
Accepted
Accepted
13.78
from collections import defaultdict import sys input = sys.stdin.readline inf = float('INF') n, m = list(map(int, input().split())) if m == 0: print('Yes') exit() edges = defaultdict(list) for i in range(m): left, right, dist = list(map(int, input().split())) edges[left-1].append([right-1...
from collections import defaultdict import sys input = sys.stdin.readline n, m = list(map(int, input().split())) if m == 0: print('Yes') exit() edges = defaultdict(list) for i in range(m): left, right, dist = list(map(int, input().split())) edges[left-1].append((right-1, dist)) edge...
39
41
894
942
from collections import defaultdict import sys input = sys.stdin.readline inf = float("INF") n, m = list(map(int, input().split())) if m == 0: print("Yes") exit() edges = defaultdict(list) for i in range(m): left, right, dist = list(map(int, input().split())) edges[left - 1].append([right - 1, dist]) ...
from collections import defaultdict import sys input = sys.stdin.readline n, m = list(map(int, input().split())) if m == 0: print("Yes") exit() edges = defaultdict(list) for i in range(m): left, right, dist = list(map(int, input().split())) edges[left - 1].append((right - 1, dist)) edges[right - 1]...
false
4.878049
[ "-inf = float(\"INF\")", "- edges[left - 1].append([right - 1, dist])", "- edges[right - 1].append([left - 1, -dist])", "-seen = [inf] * n", "+ edges[left - 1].append((right - 1, dist))", "+ edges[right - 1].append((left - 1, -dist))", "+seen = [None] * n", "- if seen[node] != inf:", ...
false
0.041698
0.036698
1.136232
[ "s868117871", "s526903443" ]
u540761833
p03699
python
s579983691
s130099243
1,169
997
27,252
28,516
Accepted
Accepted
14.71
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) s.sort() ssum = sum(s) dp = [[-(10**5) for i in range(ssum+1)] for j in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): for j in range(ssum+1): if j-s[i-1] >= 0: dp[i][j] = max(dp[i-1][j],dp[i-1][j-s[i-1...
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) ssum = sum(s) dp = [[-(10**5) for i in range(ssum+1)] for j in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): for j in range(ssum+1): if j-s[i-1] >= 0: dp[i][j] = max(dp[i-1][j],dp[i-1][j-s[i-1]]+s[i-1...
25
25
577
569
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) s.sort() ssum = sum(s) dp = [[-(10**5) for i in range(ssum + 1)] for j in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): for j in range(ssum + 1): if j - s[i - 1] >= 0: dp[i][j] = max(dp[i - 1][j], dp[i - 1][...
N = int(eval(input())) s = [] for i in range(N): s.append(int(eval(input()))) ssum = sum(s) dp = [[-(10**5) for i in range(ssum + 1)] for j in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): for j in range(ssum + 1): if j - s[i - 1] >= 0: dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - s[i -...
false
0
[ "-s.sort()" ]
false
0.044533
0.116295
0.382935
[ "s579983691", "s130099243" ]
u352394527
p00748
python
s230882790
s594895827
19,140
17,290
13,160
13,152
Accepted
Accepted
9.67
def main(): INIT = 100 query = [] ans = [] while True: q = int(eval(input())) if q == 0: break query.append(q) MAX = max(query) table = [INIT] * (MAX + 1) table[0] = 0 all_item = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)] odd_item = [i for i in all_item ...
def main(): INIT = 100 query = [] ans = [] while True: q = int(eval(input())) if q == 0: break query.append(q) MAX = max(query) table = [INIT] * (MAX + 1) table[0] = 0 all_item = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)] odd_item = [i for i in all_item ...
37
37
796
784
def main(): INIT = 100 query = [] ans = [] while True: q = int(eval(input())) if q == 0: break query.append(q) MAX = max(query) table = [INIT] * (MAX + 1) table[0] = 0 all_item = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)] odd_item = [i for...
def main(): INIT = 100 query = [] ans = [] while True: q = int(eval(input())) if q == 0: break query.append(q) MAX = max(query) table = [INIT] * (MAX + 1) table[0] = 0 all_item = [i * (i + 1) * (i + 2) // 6 for i in range(1, 181)] odd_item = [i for...
false
0
[ "- if tjv < 5 and table[j] > tjv + 1:", "+ if table[j] > tjv + 1:" ]
false
0.092607
0.062437
1.483195
[ "s230882790", "s594895827" ]
u855775311
p02361
python
s506503204
s940285040
2,590
2,250
102,728
92,908
Accepted
Accepted
13.13
import heapq import math def main(): nvertices, nedges, s = list(map(int, input().split())) edges = [[] for i in range(nvertices)] for i in range(nedges): u, v, w = list(map(int, input().split())) edges[u].append((v, w)) INF = float('inf') hq = [] for i in range(nve...
import heapq import math def main(): nvertices, nedges, s = list(map(int, input().split())) edges = [[] for i in range(nvertices)] for i in range(nedges): u, v, w = list(map(int, input().split())) edges[u].append((v, w)) INF = float('inf') hq = [(0, s)] weights = [I...
31
28
805
699
import heapq import math def main(): nvertices, nedges, s = list(map(int, input().split())) edges = [[] for i in range(nvertices)] for i in range(nedges): u, v, w = list(map(int, input().split())) edges[u].append((v, w)) INF = float("inf") hq = [] for i in range(nvertices): ...
import heapq import math def main(): nvertices, nedges, s = list(map(int, input().split())) edges = [[] for i in range(nvertices)] for i in range(nedges): u, v, w = list(map(int, input().split())) edges[u].append((v, w)) INF = float("inf") hq = [(0, s)] weights = [INF] * nverti...
false
9.677419
[ "- hq = []", "- for i in range(nvertices):", "- heapq.heappush(hq, ((0 if i == s else INF), i))", "- heapq.heapify(hq)", "+ hq = [(0, s)]" ]
false
0.035108
0.036611
0.958941
[ "s506503204", "s940285040" ]
u970197315
p03095
python
s207615555
s313370531
39
33
3,444
3,444
Accepted
Accepted
15.38
# A - Colorful Subsequence from collections import defaultdict as dd n=int(eval(input())) s=eval(input()) mod=10**9+7 ans=1 c=dd(int) for ss in s: c[ord(ss)-97]+=1 for i in range(26): ans*=c[i]+1 ans%=mod print(((ans+mod-1)%mod))
from collections import defaultdict as dd n=int(eval(input())) s=eval(input()) mod=10**9+7 d=dd(int) for ss in s: d[ss]+=1 ans=1 for v in list(d.values()): ans*=(v+1) ans%=mod print(((ans+mod-1)%mod))
16
15
246
210
# A - Colorful Subsequence from collections import defaultdict as dd n = int(eval(input())) s = eval(input()) mod = 10**9 + 7 ans = 1 c = dd(int) for ss in s: c[ord(ss) - 97] += 1 for i in range(26): ans *= c[i] + 1 ans %= mod print(((ans + mod - 1) % mod))
from collections import defaultdict as dd n = int(eval(input())) s = eval(input()) mod = 10**9 + 7 d = dd(int) for ss in s: d[ss] += 1 ans = 1 for v in list(d.values()): ans *= v + 1 ans %= mod print(((ans + mod - 1) % mod))
false
6.25
[ "-# A - Colorful Subsequence", "+d = dd(int)", "+for ss in s:", "+ d[ss] += 1", "-c = dd(int)", "-for ss in s:", "- c[ord(ss) - 97] += 1", "-for i in range(26):", "- ans *= c[i] + 1", "+for v in list(d.values()):", "+ ans *= v + 1" ]
false
0.044801
0.04842
0.925254
[ "s207615555", "s313370531" ]
u034855798
p03547
python
s065853134
s811585837
70
61
61,860
61,744
Accepted
Accepted
12.86
X,Y = input().split() if X>Y: print(">") elif X<Y: print("<") else: print("=")
X,Y = input().split() if X>Y: print(">") if X<Y: print("<") if X==Y: print("=")
7
7
97
98
X, Y = input().split() if X > Y: print(">") elif X < Y: print("<") else: print("=")
X, Y = input().split() if X > Y: print(">") if X < Y: print("<") if X == Y: print("=")
false
0
[ "-elif X < Y:", "+if X < Y:", "-else:", "+if X == Y:" ]
false
0.046375
0.046874
0.989351
[ "s065853134", "s811585837" ]