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
u202560873
p02596
python
s950119507
s118698802
1,544
130
9,120
9,172
Accepted
Accepted
91.58
K = int(eval(input())) if K % 7 == 0: K //= 7 L = 9 * K ans = -1 r = 10 for i in range(L): r %= L if r == 1: ans = i + 1 break else: r = 10 * r print(ans)
def main(): K = int(eval(input())) work = 7 answer = -1 for i in range(1, K+1): i_mod = work % K if i_mod == 0 : answer = i break work = i_mod * 10 + 7 print(answer) main()
20
14
213
251
K = int(eval(input())) if K % 7 == 0: K //= 7 L = 9 * K ans = -1 r = 10 for i in range(L): r %= L if r == 1: ans = i + 1 break else: r = 10 * r print(ans)
def main(): K = int(eval(input())) work = 7 answer = -1 for i in range(1, K + 1): i_mod = work % K if i_mod == 0: answer = i break work = i_mod * 10 + 7 print(answer) main()
false
30
[ "-K = int(eval(input()))", "-if K % 7 == 0:", "- K //= 7", "-L = 9 * K", "-ans = -1", "-r = 10", "-for i in range(L):", "- r %= L", "- if r == 1:", "- ans = i + 1", "- break", "- else:", "- r = 10 * r", "-print(ans)", "+def main():", "+ K = int(eval(...
false
0.386429
0.080097
4.824541
[ "s950119507", "s118698802" ]
u934442292
p02781
python
s279368502
s348345519
128
32
27,152
9,196
Accepted
Accepted
75
import sys # import numba as nb import numpy as np input = sys.stdin.readline # @nb.njit("i8(i8[:],i8,i8)", cache=True) def solve(N, K, L): dp = np.zeros(shape=(L + 1, 2, K + 1), dtype=np.int64) dp[0][0][0] = 1 for i in range(L): D = N[i] for j in range(2): d_m...
import sys input = sys.stdin.readline def solve(N, K, L): dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(L + 1)] dp[0][0][0] = 1 for i in range(L): D = N[i] for j in range(2): d_max = 9 if j == 1 else D for k in range(K + 1): if...
38
34
862
763
import sys # import numba as nb import numpy as np input = sys.stdin.readline # @nb.njit("i8(i8[:],i8,i8)", cache=True) def solve(N, K, L): dp = np.zeros(shape=(L + 1, 2, K + 1), dtype=np.int64) dp[0][0][0] = 1 for i in range(L): D = N[i] for j in range(2): d_max = 9 if j == 1 ...
import sys input = sys.stdin.readline def solve(N, K, L): dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(L + 1)] dp[0][0][0] = 1 for i in range(L): D = N[i] for j in range(2): d_max = 9 if j == 1 else D for k in range(K + 1): if k < K: ...
false
10.526316
[ "-# import numba as nb", "-import numpy as np", "+input = sys.stdin.readline", "-input = sys.stdin.readline", "-# @nb.njit(\"i8(i8[:],i8,i8)\", cache=True)", "+", "- dp = np.zeros(shape=(L + 1, 2, K + 1), dtype=np.int64)", "+ dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(L + 1)]", "- ...
false
0.285296
0.007198
39.637017
[ "s279368502", "s348345519" ]
u362347649
p03295
python
s514702157
s579013074
474
386
16,988
18,204
Accepted
Accepted
18.57
N, M = list(map(int, input().split())) islands = [tuple(map(int, input().split())) for _ in range(M)] islands.sort() cnt = 0 l = 1 r = N for left, right in islands: if r <= left: cnt += 1 l = left r = right else: l = max(l, left) r = min(r, right) print(...
from operator import itemgetter N, M = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(M)] ab.sort(key=itemgetter(1)) east_island = ab[0][1] answer = 1 for i, j in ab: if i >= east_island: answer += 1 east_island = j print(answer)
17
14
320
299
N, M = list(map(int, input().split())) islands = [tuple(map(int, input().split())) for _ in range(M)] islands.sort() cnt = 0 l = 1 r = N for left, right in islands: if r <= left: cnt += 1 l = left r = right else: l = max(l, left) r = min(r, right) print((cnt + 1))
from operator import itemgetter N, M = list(map(int, input().split())) ab = [tuple(map(int, input().split())) for _ in range(M)] ab.sort(key=itemgetter(1)) east_island = ab[0][1] answer = 1 for i, j in ab: if i >= east_island: answer += 1 east_island = j print(answer)
false
17.647059
[ "+from operator import itemgetter", "+", "-islands = [tuple(map(int, input().split())) for _ in range(M)]", "-islands.sort()", "-cnt = 0", "-l = 1", "-r = N", "-for left, right in islands:", "- if r <= left:", "- cnt += 1", "- l = left", "- r = right", "- else:", ...
false
0.035297
0.034129
1.034219
[ "s514702157", "s579013074" ]
u476674388
p03162
python
s427936682
s975110762
867
632
59,392
44,192
Accepted
Accepted
27.1
#!/usr/bin/env python3 import sys import collections import itertools def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]"): dp = collections.defaultdict(int) for i,x in enumerate([a,b,c]): dp[0,i] = x[0] for i,abc in itertools.islice(enumerate(zip(a,b,c)),1,None): ...
#!/usr/bin/env python3 import sys def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]"): dp = [[0 for _ in range(3)] for _ in range(N)] H = list(zip(a,b,c)) for j in range(3): dp[0][j] = H[0][j] for i in range(1,N): for j in range(3): for k in r...
37
43
1,199
1,170
#!/usr/bin/env python3 import sys import collections import itertools def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]"): dp = collections.defaultdict(int) for i, x in enumerate([a, b, c]): dp[0, i] = x[0] for i, abc in itertools.islice(enumerate(zip(a, b, c)), 1, None): for...
#!/usr/bin/env python3 import sys def solve(N: int, a: "List[int]", b: "List[int]", c: "List[int]"): dp = [[0 for _ in range(3)] for _ in range(N)] H = list(zip(a, b, c)) for j in range(3): dp[0][j] = H[0][j] for i in range(1, N): for j in range(3): for k in range(3): ...
false
13.953488
[ "-import collections", "-import itertools", "- dp = collections.defaultdict(int)", "- for i, x in enumerate([a, b, c]):", "- dp[0, i] = x[0]", "- for i, abc in itertools.islice(enumerate(zip(a, b, c)), 1, None):", "- for p, q in ((p, q) for p in range(3) for q in range(3) if p != ...
false
0.034016
0.037183
0.914824
[ "s427936682", "s975110762" ]
u133936772
p03103
python
s954683368
s169386829
489
406
28,652
28,564
Accepted
Accepted
16.97
n,m = list(map(int,input().split())) ll = sorted([list(map(int,input().split())) for _ in range(n)]) ans = 0 for p, c in ll: ans += p*min(m,c) m -= c if m < 1: break print(ans)
import sys input = sys.stdin.readline f = lambda : list(map(int,input().split())) n,m = f() ll = sorted([list(f()) for _ in range(n)]) ans = 0 for p, c in ll: ans += p*min(m,c) m -= c if m < 1: break print(ans)
9
14
188
229
n, m = list(map(int, input().split())) ll = sorted([list(map(int, input().split())) for _ in range(n)]) ans = 0 for p, c in ll: ans += p * min(m, c) m -= c if m < 1: break print(ans)
import sys input = sys.stdin.readline f = lambda: list(map(int, input().split())) n, m = f() ll = sorted([list(f()) for _ in range(n)]) ans = 0 for p, c in ll: ans += p * min(m, c) m -= c if m < 1: break print(ans)
false
35.714286
[ "-n, m = list(map(int, input().split()))", "-ll = sorted([list(map(int, input().split())) for _ in range(n)])", "+import sys", "+", "+input = sys.stdin.readline", "+f = lambda: list(map(int, input().split()))", "+n, m = f()", "+ll = sorted([list(f()) for _ in range(n)])" ]
false
0.088336
0.044919
1.966572
[ "s954683368", "s169386829" ]
u850491413
p03085
python
s138650745
s021157456
175
160
38,384
38,256
Accepted
Accepted
8.57
import sys b = eval(input()) if b == 'A': print('T') elif b == 'T': print('A') elif b == 'G': print('C') elif b == 'C': print('G')
import sys input=sys.stdin.readline().strip b = eval(input()) if b == 'A': print('T') elif b == 'T': print('A') elif b == 'G': print('C') elif b == 'C': print('G')
11
12
139
173
import sys b = eval(input()) if b == "A": print("T") elif b == "T": print("A") elif b == "G": print("C") elif b == "C": print("G")
import sys input = sys.stdin.readline().strip b = eval(input()) if b == "A": print("T") elif b == "T": print("A") elif b == "G": print("C") elif b == "C": print("G")
false
8.333333
[ "+input = sys.stdin.readline().strip" ]
false
0.087351
0.085712
1.019119
[ "s138650745", "s021157456" ]
u507116804
p03803
python
s420834015
s920369834
20
18
3,060
3,064
Accepted
Accepted
10
a,b=list(map(int, input().split())) if a==1: k=14 else: k=a if b==1: m=14 else: m=b if k>m: print("Alice") elif k==m: print("Draw") else: print("Bob")
a , b =(list(map(int , input().split()))) if a==1: a=a+13 if b==1: b=b+13 if a>b : print("Alice") elif a<b: print("Bob") else: print("Draw")
17
17
178
170
a, b = list(map(int, input().split())) if a == 1: k = 14 else: k = a if b == 1: m = 14 else: m = b if k > m: print("Alice") elif k == m: print("Draw") else: print("Bob")
a, b = list(map(int, input().split())) if a == 1: a = a + 13 if b == 1: b = b + 13 if a > b: print("Alice") elif a < b: print("Bob") else: print("Draw")
false
0
[ "- k = 14", "+ a = a + 13", "+if b == 1:", "+ b = b + 13", "+if a > b:", "+ print(\"Alice\")", "+elif a < b:", "+ print(\"Bob\")", "- k = a", "-if b == 1:", "- m = 14", "-else:", "- m = b", "-if k > m:", "- print(\"Alice\")", "-elif k == m:", "-else:", "-...
false
0.093616
0.049197
1.902888
[ "s420834015", "s920369834" ]
u408260374
p00512
python
s823243116
s051633142
80
70
6,724
6,724
Accepted
Accepted
12.5
n = int(eval(input())) o = {} for i in range(n): p, m = input().split() o[p] = o.get(p, 0) + int(m) k = list(o.keys()) k = [(len(x), x) for x in k] k.sort() for i in k: print((i[1], o[i[1]]))
o={} for _ in range(int(eval(input()))):p,m=input().split();o[p]=o.get(p,0)+int(m) k=sorted([(len(x),x) for x in list(o.keys())]) for _,i in k:print((i,o[i]))
10
4
204
153
n = int(eval(input())) o = {} for i in range(n): p, m = input().split() o[p] = o.get(p, 0) + int(m) k = list(o.keys()) k = [(len(x), x) for x in k] k.sort() for i in k: print((i[1], o[i[1]]))
o = {} for _ in range(int(eval(input()))): p, m = input().split() o[p] = o.get(p, 0) + int(m) k = sorted([(len(x), x) for x in list(o.keys())]) for _, i in k: print((i, o[i]))
false
60
[ "-n = int(eval(input()))", "-for i in range(n):", "+for _ in range(int(eval(input()))):", "-k = list(o.keys())", "-k = [(len(x), x) for x in k]", "-k.sort()", "-for i in k:", "- print((i[1], o[i[1]]))", "+k = sorted([(len(x), x) for x in list(o.keys())])", "+for _, i in k:", "+ print((i, o...
false
0.034963
0.032774
1.066792
[ "s823243116", "s051633142" ]
u126232616
p03607
python
s738705965
s382000991
203
76
11,884
11,884
Accepted
Accepted
62.56
n = int(eval(input())) d = set() for i in range(n): a = int(eval(input())) if a in d: d.remove(a) else: d.add(a) print((len(d)))
import sys n = int(eval(input())) d = set() b = list(map(int,sys.stdin)) for a in b: if a in d: d.remove(a) else: d.add(a) print((len(d)))
9
10
150
157
n = int(eval(input())) d = set() for i in range(n): a = int(eval(input())) if a in d: d.remove(a) else: d.add(a) print((len(d)))
import sys n = int(eval(input())) d = set() b = list(map(int, sys.stdin)) for a in b: if a in d: d.remove(a) else: d.add(a) print((len(d)))
false
10
[ "+import sys", "+", "-for i in range(n):", "- a = int(eval(input()))", "+b = list(map(int, sys.stdin))", "+for a in b:" ]
false
0.092838
0.035179
2.639033
[ "s738705965", "s382000991" ]
u629540524
p02831
python
s308003415
s298333709
67
31
61,960
9,156
Accepted
Accepted
53.73
import math a,b = list(map(int,input().split())) print((a*b//math.gcd(a,b)))
import math a,b = list(map(int,input().split())) print(((a*b)//math.gcd(a,b)))
3
3
70
72
import math a, b = list(map(int, input().split())) print((a * b // math.gcd(a, b)))
import math a, b = list(map(int, input().split())) print(((a * b) // math.gcd(a, b)))
false
0
[ "-print((a * b // math.gcd(a, b)))", "+print(((a * b) // math.gcd(a, b)))" ]
false
0.03702
0.050689
0.73033
[ "s308003415", "s298333709" ]
u391819434
p02601
python
s711170817
s461426098
33
29
9,172
9,176
Accepted
Accepted
12.12
A,B,C=list(map(int,input().split())) K=int(eval(input())) i=0 while i<K: if A>=B: B*=2 elif B>=C: C*=2 i+=1 print(('Yes' if A<B<C else 'No'))
A,B,C=list(map(int,input().split())) K=int(eval(input())) i=0 while i<K: if A>=B: i+=1 B*=2 else: break while i<K: if B>=C: i+=1 C*=2 else: break print(('YNeos'[(A>=B)or(B>=C)::2]))
12
17
168
248
A, B, C = list(map(int, input().split())) K = int(eval(input())) i = 0 while i < K: if A >= B: B *= 2 elif B >= C: C *= 2 i += 1 print(("Yes" if A < B < C else "No"))
A, B, C = list(map(int, input().split())) K = int(eval(input())) i = 0 while i < K: if A >= B: i += 1 B *= 2 else: break while i < K: if B >= C: i += 1 C *= 2 else: break print(("YNeos"[(A >= B) or (B >= C) :: 2]))
false
29.411765
[ "+ i += 1", "- elif B >= C:", "+ else:", "+ break", "+while i < K:", "+ if B >= C:", "+ i += 1", "- i += 1", "-print((\"Yes\" if A < B < C else \"No\"))", "+ else:", "+ break", "+print((\"YNeos\"[(A >= B) or (B >= C) :: 2]))" ]
false
0.111232
0.102029
1.090192
[ "s711170817", "s461426098" ]
u281303342
p03805
python
s022081814
s348099303
28
25
3,064
3,064
Accepted
Accepted
10.71
from itertools import permutations N,M = list(map(int,input().split())) E = [[False for _ in range(N)] for _ in range(N)] for i in range(M): a,b = list(map(int,input().split())) E[a-1][b-1] = True E[b-1][a-1] = True P = permutations([i for i in range(1,N)]) ans = 0 for pp in P: l = len(pp)...
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # --------------------------------------...
27
39
512
887
from itertools import permutations N, M = list(map(int, input().split())) E = [[False for _ in range(N)] for _ in range(N)] for i in range(M): a, b = list(map(int, input().split())) E[a - 1][b - 1] = True E[b - 1][a - 1] = True P = permutations([i for i in range(1, N)]) ans = 0 for pp in P: l = len(pp)...
# Python3 (3.4.3) import sys input = sys.stdin.readline # ------------------------------------------------------------- # function # ------------------------------------------------------------- # ------------------------------------------------------------- # main # ---------------------------------------------------...
false
30.769231
[ "+# Python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# function", "+# main", "+N, M = list(map(int, input().split()))", "+AB = [tuple(map(int, input().split())) for _ in range(M)]", "+A = [[False for _ in range(N)] for _ in range(N)]", "+for a, b in AB:", "+ A[a - 1][b -...
false
0.13483
0.047735
2.824567
[ "s022081814", "s348099303" ]
u012694084
p02983
python
s700933688
s081989261
961
43
2,940
2,940
Accepted
Accepted
95.53
l, r = list(map(int, input().split())) result = None for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1): for j in range(i + 1, min(i + 2019, r) + 1): mod = i * j % 2019 if result is None or result > mod: result = mod print(result)
l, r = list(map(int, input().split())) result = None for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1): for j in range(i + 1, min(i + 2019, r) + 1): mod = i * j % 2019 if result is None or result > mod: result = mod if result == 0: break if...
9
13
270
358
l, r = list(map(int, input().split())) result = None for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1): for j in range(i + 1, min(i + 2019, r) + 1): mod = i * j % 2019 if result is None or result > mod: result = mod print(result)
l, r = list(map(int, input().split())) result = None for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1): for j in range(i + 1, min(i + 2019, r) + 1): mod = i * j % 2019 if result is None or result > mod: result = mod if result == 0: break if result == ...
false
30.769231
[ "+ if result == 0:", "+ break", "+ if result == 0:", "+ break" ]
false
0.087218
0.036246
2.406298
[ "s700933688", "s081989261" ]
u223646582
p03805
python
s089336471
s685470172
65
23
8,052
3,064
Accepted
Accepted
64.62
import itertools N,M=list(map(int,input().split())) route=[list(map(int,input().split())) for _ in range(M)] candidate=list(itertools.permutations(list(range(1,N+1)))) ans=0 for c in candidate: if c[0]==1: for i in range(N-1): l=sorted([c[i], c[i+1]]) if l not in route: break ...
import itertools N, M = list(map(int, input().split())) G = {k: set() for k in range(N+1)} for _ in range(M): a, b = list(map(int, input().split())) # 無向グラフ G[a].add(b) G[b].add(a) ans = 0 for p in itertools.permutations(list(range(2, N+1))): c = 1 for n in p: if n not in...
17
21
345
386
import itertools N, M = list(map(int, input().split())) route = [list(map(int, input().split())) for _ in range(M)] candidate = list(itertools.permutations(list(range(1, N + 1)))) ans = 0 for c in candidate: if c[0] == 1: for i in range(N - 1): l = sorted([c[i], c[i + 1]]) if l not ...
import itertools N, M = list(map(int, input().split())) G = {k: set() for k in range(N + 1)} for _ in range(M): a, b = list(map(int, input().split())) # 無向グラフ G[a].add(b) G[b].add(a) ans = 0 for p in itertools.permutations(list(range(2, N + 1))): c = 1 for n in p: if n not in G[c]: ...
false
19.047619
[ "-route = [list(map(int, input().split())) for _ in range(M)]", "-candidate = list(itertools.permutations(list(range(1, N + 1))))", "+G = {k: set() for k in range(N + 1)}", "+for _ in range(M):", "+ a, b = list(map(int, input().split()))", "+ # 無向グラフ", "+ G[a].add(b)", "+ G[b].add(a)", "...
false
0.07993
0.036412
2.195127
[ "s089336471", "s685470172" ]
u063052907
p02881
python
s697737971
s487997449
115
102
3,060
3,064
Accepted
Accepted
11.3
def main(): N = int(eval(input())) loop = int(N ** 0.5) ans = float("inf") for i in range(1, loop + 1): if N % i == 0: j = N // i tmp = i + j - 2 if tmp < ans: ans = tmp print(ans) if __name__ == "__main__": main()
def func(N): loop = int(N ** 0.5) ans = float("inf") for i in range(1, loop + 1): if N % i: continue j = N // i tmp = i + j - 2 ans = min(ans, tmp) return ans if __name__ == "__main__": N = int(eval(input())) print((func(N...
17
18
312
315
def main(): N = int(eval(input())) loop = int(N**0.5) ans = float("inf") for i in range(1, loop + 1): if N % i == 0: j = N // i tmp = i + j - 2 if tmp < ans: ans = tmp print(ans) if __name__ == "__main__": main()
def func(N): loop = int(N**0.5) ans = float("inf") for i in range(1, loop + 1): if N % i: continue j = N // i tmp = i + j - 2 ans = min(ans, tmp) return ans if __name__ == "__main__": N = int(eval(input())) print((func(N)))
false
5.555556
[ "-def main():", "- N = int(eval(input()))", "+def func(N):", "- if N % i == 0:", "- j = N // i", "- tmp = i + j - 2", "- if tmp < ans:", "- ans = tmp", "- print(ans)", "+ if N % i:", "+ continue", "+ j = N //...
false
0.048459
0.052086
0.930371
[ "s697737971", "s487997449" ]
u399298563
p04001
python
s803148194
s634325882
192
172
38,384
38,256
Accepted
Accepted
10.42
S = eval(input()) if len(S) == 1: print((int(S))) else: def count(n): a = 0 if len(n) == 1: return 0 else: for i in range(1, len(n)): a += int(n[:i]) * 2 ** (len(n) - 1 - i) + int(n[i:]) + count(n[i:]) return a print((int(S) + count(S)))
S = eval(input()) if len(S) == 1: print((int(S))) exit() else: def count(n): a = 0 if len(n) == 1: return 0 else: for i in range(1, len(n)): a += int(n[:i]) * 2 ** (len(n[i:]) - 1) + int(n[i:]) + count(n[i:]) return a print((int(S) + count(S)))
13
14
283
293
S = eval(input()) if len(S) == 1: print((int(S))) else: def count(n): a = 0 if len(n) == 1: return 0 else: for i in range(1, len(n)): a += int(n[:i]) * 2 ** (len(n) - 1 - i) + int(n[i:]) + count(n[i:]) return a print((int(S) + cou...
S = eval(input()) if len(S) == 1: print((int(S))) exit() else: def count(n): a = 0 if len(n) == 1: return 0 else: for i in range(1, len(n)): a += int(n[:i]) * 2 ** (len(n[i:]) - 1) + int(n[i:]) + count(n[i:]) return a print((i...
false
7.142857
[ "+ exit()", "- a += int(n[:i]) * 2 ** (len(n) - 1 - i) + int(n[i:]) + count(n[i:])", "+ a += int(n[:i]) * 2 ** (len(n[i:]) - 1) + int(n[i:]) + count(n[i:])" ]
false
0.046246
0.037465
1.234361
[ "s803148194", "s634325882" ]
u581511366
p02678
python
s857675575
s680565364
665
474
98,808
99,476
Accepted
Accepted
28.72
import queue def main(): n, m = list(map(int, input().split())) es = [[] for _ in range(n+1)] ans = [0 for _ in range(n+1)] for _ in range(m): a, b = list(map(int, input().split())) es[a].append(b) es[b].append(a) q = queue.Queue() q.put(1) while no...
from collections import deque def main(): n, m = list(map(int, input().split())) es = [[] for _ in range(n+1)] ans = [0 for _ in range(n+1)] for _ in range(m): a, b = list(map(int, input().split())) es[a].append(b) es[b].append(a) q = deque([1]) while le...
34
33
640
644
import queue def main(): n, m = list(map(int, input().split())) es = [[] for _ in range(n + 1)] ans = [0 for _ in range(n + 1)] for _ in range(m): a, b = list(map(int, input().split())) es[a].append(b) es[b].append(a) q = queue.Queue() q.put(1) while not q.empty(): ...
from collections import deque def main(): n, m = list(map(int, input().split())) es = [[] for _ in range(n + 1)] ans = [0 for _ in range(n + 1)] for _ in range(m): a, b = list(map(int, input().split())) es[a].append(b) es[b].append(a) q = deque([1]) while len(q) > 0: ...
false
2.941176
[ "-import queue", "+from collections import deque", "- q = queue.Queue()", "- q.put(1)", "- while not q.empty():", "- p = q.get()", "+ q = deque([1])", "+ while len(q) > 0:", "+ p = q.popleft()", "- q.put(t)", "+ q.append(t)" ]
false
0.119686
0.082284
1.454546
[ "s857675575", "s680565364" ]
u455354923
p03281
python
s946684070
s154400087
33
30
9,132
9,084
Accepted
Accepted
9.09
N=int(eval(input())) count = 0 count2 = 0 for i in range(1,N+1): #print(i,"i") for j in range(1,N+1): #print(j,"k") if i % j == 0 : count += 1 #print(count,"count") if count == 8 and i%2 != 0: count2 += 1 ans = count2 count = 0 print(ans)...
N=int(eval(input())) cnt = 0 ans = 0 for i in range(1,N+1): if i % 2 != 0: for j in range(1,i+1): if i%j == 0: cnt += 1 #print(j) if cnt == 8: ans += 1 cnt = 0 print(ans)
15
13
315
249
N = int(eval(input())) count = 0 count2 = 0 for i in range(1, N + 1): # print(i,"i") for j in range(1, N + 1): # print(j,"k") if i % j == 0: count += 1 # print(count,"count") if count == 8 and i % 2 != 0: count2 += 1 ans = count2 count = 0 print(ans)
N = int(eval(input())) cnt = 0 ans = 0 for i in range(1, N + 1): if i % 2 != 0: for j in range(1, i + 1): if i % j == 0: cnt += 1 # print(j) if cnt == 8: ans += 1 cnt = 0 print(ans)
false
13.333333
[ "-count = 0", "-count2 = 0", "+cnt = 0", "+ans = 0", "- # print(i,\"i\")", "- for j in range(1, N + 1):", "- # print(j,\"k\")", "- if i % j == 0:", "- count += 1", "- # print(count,\"count\")", "- if count == 8 and i % 2 != 0:", "- count2 += ...
false
0.049615
0.046431
1.06857
[ "s946684070", "s154400087" ]
u683134447
p03127
python
s411354459
s691700835
343
229
88,428
62,704
Accepted
Accepted
33.24
import fractions n = int(eval(input())) al = list(map(int,input().split())) ans = al[0] for a in al: ans = fractions.gcd(a,ans) print(ans)
n = int(eval(input())) al = list(map(int,input().split())) # a,bの最大公約数 def gcd(a, b): while b: a, b = b, a % b return a # a,bの最小公倍数 def lcm(a, b): return a * b // gcd(a, b) ans = al[0] for a in al: ans = gcd(a, ans) print(ans)
12
23
160
275
import fractions n = int(eval(input())) al = list(map(int, input().split())) ans = al[0] for a in al: ans = fractions.gcd(a, ans) print(ans)
n = int(eval(input())) al = list(map(int, input().split())) # a,bの最大公約数 def gcd(a, b): while b: a, b = b, a % b return a # a,bの最小公倍数 def lcm(a, b): return a * b // gcd(a, b) ans = al[0] for a in al: ans = gcd(a, ans) print(ans)
false
47.826087
[ "-import fractions", "-", "+# a,bの最大公約数", "+def gcd(a, b):", "+ while b:", "+ a, b = b, a % b", "+ return a", "+", "+", "+# a,bの最小公倍数", "+def lcm(a, b):", "+ return a * b // gcd(a, b)", "+", "+", "- ans = fractions.gcd(a, ans)", "+ ans = gcd(a, ans)" ]
false
0.096616
0.07181
1.345449
[ "s411354459", "s691700835" ]
u104922648
p03478
python
s945070462
s432826155
33
27
2,940
3,060
Accepted
Accepted
18.18
n, a, b = list(map(int, input().split())) result = 0 for i in range(1, n+1): total = 0 t = i for j in range(5): total += t%10 t = t // 10 if a <= total <= b: result += i print(result)
n, a, b = list(map(int, input().split())) total = 0 for i in range(1, n+1): n = i tmp = 0 while(n > 0): tmp += n % 10 n = n // 10 if a <= tmp <= b: total += i print(total)
11
11
214
201
n, a, b = list(map(int, input().split())) result = 0 for i in range(1, n + 1): total = 0 t = i for j in range(5): total += t % 10 t = t // 10 if a <= total <= b: result += i print(result)
n, a, b = list(map(int, input().split())) total = 0 for i in range(1, n + 1): n = i tmp = 0 while n > 0: tmp += n % 10 n = n // 10 if a <= tmp <= b: total += i print(total)
false
0
[ "-result = 0", "+total = 0", "- total = 0", "- t = i", "- for j in range(5):", "- total += t % 10", "- t = t // 10", "- if a <= total <= b:", "- result += i", "-print(result)", "+ n = i", "+ tmp = 0", "+ while n > 0:", "+ tmp += n % 10", "...
false
0.095218
0.085938
1.10799
[ "s945070462", "s432826155" ]
u867848444
p03163
python
s865439058
s549143199
582
524
121,068
120,172
Accepted
Accepted
9.97
n,w=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] #重さ、価値の順 dp=[[0]*(w+1) for i in range(n+1)] #配列のインデックスを重さに対応させる for i in range(n): for sum_w in range(w+1): if sum_w-l[i][0]>=0: dp[i+1][sum_w]=max(dp[i+1][sum_w],dp[i][sum_w-l[i][0]]+l[i...
#DP-C n,w=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] dp=[[0]*(w+1) for i in range(n+1)] for i in range(1,n+1): for sum_w in range(w+1): if sum_w-l[i-1][0]>=0: dp[i][sum_w]=max(dp[i-1][sum_w],dp[i-1][sum_w-l[i-1][0]]+l[i-1][1]) else: ...
15
15
433
376
n, w = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(n)] # 重さ、価値の順 dp = [[0] * (w + 1) for i in range(n + 1)] # 配列のインデックスを重さに対応させる for i in range(n): for sum_w in range(w + 1): if sum_w - l[i][0] >= 0: dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - l...
# DP-C n, w = list(map(int, input().split())) l = [list(map(int, input().split())) for i in range(n)] dp = [[0] * (w + 1) for i in range(n + 1)] for i in range(1, n + 1): for sum_w in range(w + 1): if sum_w - l[i - 1][0] >= 0: dp[i][sum_w] = max( dp[i - 1][sum_w], dp[i - 1][sum_w...
false
0
[ "+# DP-C", "-# 重さ、価値の順", "-# 配列のインデックスを重さに対応させる", "-for i in range(n):", "+for i in range(1, n + 1):", "- if sum_w - l[i][0] >= 0:", "- dp[i + 1][sum_w] = max(dp[i + 1][sum_w], dp[i][sum_w - l[i][0]] + l[i][1])", "- # l[i]を入れるとき", "- dp[i + 1][sum_w] = max(dp[i + 1][s...
false
0.054504
0.084308
0.646488
[ "s865439058", "s549143199" ]
u077291787
p03044
python
s439664465
s139026598
458
376
42,800
42,824
Accepted
Accepted
17.9
# ABC126D - Even Relation def dfs(r: int) -> None: stack = [r] while stack: v = stack.pop() for u, w in T[v]: if D[u] == -1: D[u] = (D[v] + w) % 2 stack += [u] def main(): global T, D N, *A = map(int, open(0).read().split()) ...
# ABC126D - Even Relation def main(): # same parity of distance from root <-> same group global T, D N, *A = map(int, open(0).read().split()) T = [[] for _ in range(N + 1)] for i in range(0, (N - 1) * 3, 3): v, u, w = A[i : i + 3] T[v] += [(u, w)] T[u] += [(v, w)] ...
27
24
649
692
# ABC126D - Even Relation def dfs(r: int) -> None: stack = [r] while stack: v = stack.pop() for u, w in T[v]: if D[u] == -1: D[u] = (D[v] + w) % 2 stack += [u] def main(): global T, D N, *A = map(int, open(0).read().split()) T = [[] for _...
# ABC126D - Even Relation def main(): # same parity of distance from root <-> same group global T, D N, *A = map(int, open(0).read().split()) T = [[] for _ in range(N + 1)] for i in range(0, (N - 1) * 3, 3): v, u, w = A[i : i + 3] T[v] += [(u, w)] T[u] += [(v, w)] D = [-1...
false
11.111111
[ "-def dfs(r: int) -> None:", "- stack = [r]", "- while stack:", "- v = stack.pop()", "- for u, w in T[v]:", "- if D[u] == -1:", "- D[u] = (D[v] + w) % 2", "- stack += [u]", "-", "-", "+ # same parity of distance from root <-> same g...
false
0.041802
0.042077
0.993459
[ "s439664465", "s139026598" ]
u394731058
p02802
python
s790290411
s696514987
352
283
5,560
5,528
Accepted
Accepted
19.6
n,m = list(map(int, input().split())) la = [] lw = [] lwa = [] for i in range(n): la.append(0) lw.append(0) lwa.append(0) for _ in range(m): q,a = input().split() if a == "WA" and la[int(q)-1] != 1: lw[int(q)-1] += 1 elif a == "AC" and la[int(q)-1] != 1: la[int(q)-1] = 1 lwa[int(q)...
n,m = list(map(int, input().split())) a = [] for _ in range(n): a.append(0) w = a.copy() x = a.copy() for _ in range(m): q,r = input().split() q = int(q)-1 if r == "WA" and a[q] != 1: w[q] += 1 elif r == "AC" and a[q] != 1: x[q] = w[q] a[q] = 1 print((sum(a), sum(x)))
17
15
364
296
n, m = list(map(int, input().split())) la = [] lw = [] lwa = [] for i in range(n): la.append(0) lw.append(0) lwa.append(0) for _ in range(m): q, a = input().split() if a == "WA" and la[int(q) - 1] != 1: lw[int(q) - 1] += 1 elif a == "AC" and la[int(q) - 1] != 1: la[int(q) - 1] = ...
n, m = list(map(int, input().split())) a = [] for _ in range(n): a.append(0) w = a.copy() x = a.copy() for _ in range(m): q, r = input().split() q = int(q) - 1 if r == "WA" and a[q] != 1: w[q] += 1 elif r == "AC" and a[q] != 1: x[q] = w[q] a[q] = 1 print((sum(a), sum(x)))
false
11.764706
[ "-la = []", "-lw = []", "-lwa = []", "-for i in range(n):", "- la.append(0)", "- lw.append(0)", "- lwa.append(0)", "+a = []", "+for _ in range(n):", "+ a.append(0)", "+w = a.copy()", "+x = a.copy()", "- q, a = input().split()", "- if a == \"WA\" and la[int(q) - 1] != 1:",...
false
0.065613
0.03951
1.660661
[ "s790290411", "s696514987" ]
u888337853
p03476
python
s205103180
s052979309
793
642
18,980
19,268
Accepted
Accepted
19.04
# import sys import math # import copy # import heapq # from collections import deque # import decimal # sys.setrecursionlimit(100001) # INF = sys.maxsize # ===CODE=== q = int(eval(input())) condition = 10 ** 5 data = [] for i in range(q): l, r = list(map(int, input().split())) data.appe...
# import sys import math # import copy # import heapq # from collections import deque # import decimal # sys.setrecursionlimit(100001) # INF = sys.maxsize # ===CODE=== q = int(eval(input())) condition = 10 ** 5 data = [] for i in range(q): l, r = list(map(int, input().split())) data.appe...
46
48
877
909
# import sys import math # import copy # import heapq # from collections import deque # import decimal # sys.setrecursionlimit(100001) # INF = sys.maxsize # ===CODE=== q = int(eval(input())) condition = 10**5 data = [] for i in range(q): l, r = list(map(int, input().split())) data.append((l, r)) kodoku = {2} f...
# import sys import math # import copy # import heapq # from collections import deque # import decimal # sys.setrecursionlimit(100001) # INF = sys.maxsize # ===CODE=== q = int(eval(input())) condition = 10**5 data = [] for i in range(q): l, r = list(map(int, input().split())) data.append((l, r)) kodoku = {2} k...
false
4.166667
[ "+kodoku_2 = [2]", "- for j in range(2, int(lim) + 1):", "- # if div > lim:", "- # break", "- if i % j == 0:", "+ for div in kodoku_2:", "+ if div > lim:", "+ break", "+ if i % div == 0:", "+ kodoku_2.append(i)" ]
false
0.422594
0.222726
1.897374
[ "s205103180", "s052979309" ]
u375616706
p03054
python
s804905239
s066163324
185
159
3,888
3,888
Accepted
Accepted
14.05
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H,W,N=list(map(int,input().split())) sr,sc=list(map(int,input().split())) S=input()[:-1] T=input()[:-1] left=0 right=W+1 up=0 down=H+1 ans="YES" for i,(s,t) in enumerate(zip(reversed(S),reversed(T))): ...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H,W,N=list(map(int,input().split())) sr,sc=list(map(int,input().split())) S=input()[:-1] T=input()[:-1] #gridのindexは入力値のまま扱う(grid=[1,1]~[H,W]) #left<x<rightの間が生存範囲(初めはグリッド全てが生存可能状態) left=0 right=W+1 up=0 ...
45
47
816
847
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H, W, N = list(map(int, input().split())) sr, sc = list(map(int, input().split())) S = input()[:-1] T = input()[:-1] left = 0 right = W + 1 up = 0 down = H + 1 ans = "YES" for i, (s, t) in enumerate(zip(reversed(S), rever...
# python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline H, W, N = list(map(int, input().split())) sr, sc = list(map(int, input().split())) S = input()[:-1] T = input()[:-1] # gridのindexは入力値のまま扱う(grid=[1,1]~[H,W]) # left<x<rightの間が生存範囲(初めはグリッド全てが生存可能状態) left = 0 right = W + 1 u...
false
4.255319
[ "+# gridのindexは入力値のまま扱う(grid=[1,1]~[H,W])", "+# left<x<rightの間が生存範囲(初めはグリッド全てが生存可能状態)", "-for i, (s, t) in enumerate(zip(reversed(S), reversed(T))):", "- if i != 0 or True:", "- if t == \"R\":", "- left = max(0, left - 1)", "- elif t == \"L\":", "- right = min(W ...
false
0.037422
0.036502
1.0252
[ "s804905239", "s066163324" ]
u761989513
p03999
python
s492972921
s573957447
21
19
3,188
3,060
Accepted
Accepted
9.52
s = eval(input()) ans = 0 for i in range(2 ** (len(s) - 1)): f = s[0] for j in range(len(s) - 1): if ((i >> j) & 1) == 1: f += "+" f += s[j + 1] ans += sum(map(int, f.split("+"))) print(ans)
def dfs(i, s, plus): if i == n - 1: b = list(map(int, s.split("+"))) return sum(b) return dfs(i + 1, s, plus) + dfs(i + 1, s[:i + plus + 1] + "+" + s[i + plus + 1:], plus + 1) s = eval(input()) n = len(s) print((dfs(0, s, 0)))
10
10
233
253
s = eval(input()) ans = 0 for i in range(2 ** (len(s) - 1)): f = s[0] for j in range(len(s) - 1): if ((i >> j) & 1) == 1: f += "+" f += s[j + 1] ans += sum(map(int, f.split("+"))) print(ans)
def dfs(i, s, plus): if i == n - 1: b = list(map(int, s.split("+"))) return sum(b) return dfs(i + 1, s, plus) + dfs( i + 1, s[: i + plus + 1] + "+" + s[i + plus + 1 :], plus + 1 ) s = eval(input()) n = len(s) print((dfs(0, s, 0)))
false
0
[ "+def dfs(i, s, plus):", "+ if i == n - 1:", "+ b = list(map(int, s.split(\"+\")))", "+ return sum(b)", "+ return dfs(i + 1, s, plus) + dfs(", "+ i + 1, s[: i + plus + 1] + \"+\" + s[i + plus + 1 :], plus + 1", "+ )", "+", "+", "-ans = 0", "-for i in range(2 ** (len...
false
0.045803
0.045668
1.002963
[ "s492972921", "s573957447" ]
u992910889
p03636
python
s199536409
s221436309
173
20
38,256
2,940
Accepted
Accepted
88.44
# import bisect # import copy # import fractions # import math # import numpy as np # from collections import Counter, deque # from itertools import accumulate,permutations, combinations,combinations_with_replacement,product def resolve(): s=str(eval(input())) print((s[0]+str(len(s)-2)+s[-1])) ...
def resolve(): s=str(eval(input())) print(('{}{}{}'.format(s[0],len(s)-2,s[-1]))) resolve()
15
6
322
98
# import bisect # import copy # import fractions # import math # import numpy as np # from collections import Counter, deque # from itertools import accumulate,permutations, combinations,combinations_with_replacement,product def resolve(): s = str(eval(input())) print((s[0] + str(len(s) - 2) + s[-1])) resolve...
def resolve(): s = str(eval(input())) print(("{}{}{}".format(s[0], len(s) - 2, s[-1]))) resolve()
false
60
[ "-# import bisect", "-# import copy", "-# import fractions", "-# import math", "-# import numpy as np", "-# from collections import Counter, deque", "-# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product", "- print((s[0] + str(len(s) - 2) + s[-1]))", ...
false
0.03689
0.042435
0.869327
[ "s199536409", "s221436309" ]
u764600134
p02882
python
s845947521
s594948396
32
22
3,828
3,064
Accepted
Accepted
31.25
# -*- coding: utf-8 -*- """ D - Water Bottle https://atcoder.jp/contests/abc144/tasks/abc144_d """ import sys from math import tan, radians, pi def is_ok(a, b, x, d): if b * tan(pi/2 - radians(d)) <= a: return (b * b * tan(pi/2 - radians(d)) * a) / 2 >= x else: return a * a * ...
# -*- coding: utf-8 -*- """ D - Water Bottle https://atcoder.jp/contests/abc144/tasks/abc144_d """ import sys from math import tan, radians, pi def is_ok(a, b, x, d): if b * tan(pi/2 - radians(d)) <= a: return (b * b * tan(pi/2 - radians(d)) * a) / 2 >= x else: return a * a * ...
37
37
770
769
# -*- coding: utf-8 -*- """ D - Water Bottle https://atcoder.jp/contests/abc144/tasks/abc144_d """ import sys from math import tan, radians, pi def is_ok(a, b, x, d): if b * tan(pi / 2 - radians(d)) <= a: return (b * b * tan(pi / 2 - radians(d)) * a) / 2 >= x else: return ( a * a *...
# -*- coding: utf-8 -*- """ D - Water Bottle https://atcoder.jp/contests/abc144/tasks/abc144_d """ import sys from math import tan, radians, pi def is_ok(a, b, x, d): if b * tan(pi / 2 - radians(d)) <= a: return (b * b * tan(pi / 2 - radians(d)) * a) / 2 >= x else: return ( a * a *...
false
0
[ "- return (lb + mid) / 2", "+ return (lb + ub) / 2" ]
false
0.037698
0.035197
1.071046
[ "s845947521", "s594948396" ]
u923668099
p02239
python
s768295617
s569272050
80
30
8,628
8,044
Accepted
Accepted
62.5
import sys def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def bfs(adj, nxt, dis, sumi, kyori): nnxt = [] for u in nxt: sumi[u] = True dis[u] = kyori ...
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def bfs(n, adj): dis = [-1] * n visited = [False] * n nxt = deque([0]) dis[...
45
44
903
903
import sys def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None def bfs(adj, nxt, dis, sumi, kyori): nnxt = [] for u in nxt: sumi[u] = True dis[u] = kyori for u in nxt:...
import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print("DEBUG:{} -> {}".format(name, val), file=sys.stderr) return None def bfs(n, adj): dis = [-1] * n visited = [False] * n nxt = deque([0]) dis[0] = 0 ...
false
2.222222
[ "+from collections import deque", "-def bfs(adj, nxt, dis, sumi, kyori):", "- nnxt = []", "- for u in nxt:", "- sumi[u] = True", "- dis[u] = kyori", "- for u in nxt:", "+def bfs(n, adj):", "+ dis = [-1] * n", "+ visited = [False] * n", "+ nxt = deque([0])", "+ ...
false
0.0399
0.127772
0.312275
[ "s768295617", "s569272050" ]
u793868662
p03212
python
s891928789
s865712947
261
64
45,148
12,424
Accepted
Accepted
75.48
def resolve(): from collections import deque n = int(eval(input())) ans = 0 num = deque([3,5,7]) while num[0] <= n: test = num.popleft() num.append(test * 10 + 3) num.append(test * 10 + 5) num.append(test * 10 + 7) if list(set([int(x) for x in list(s...
def resolve(): from collections import deque def checker(n): n = str(n) OK3 = False OK5 = False OK7 = False for i in n: if i == "3": OK3 = True elif i== "5": OK5 = True elif i == "7": ...
15
39
389
882
def resolve(): from collections import deque n = int(eval(input())) ans = 0 num = deque([3, 5, 7]) while num[0] <= n: test = num.popleft() num.append(test * 10 + 3) num.append(test * 10 + 5) num.append(test * 10 + 7) if list(set([int(x) for x in list(str(test...
def resolve(): from collections import deque def checker(n): n = str(n) OK3 = False OK5 = False OK7 = False for i in n: if i == "3": OK3 = True elif i == "5": OK5 = True elif i == "7": OK...
false
61.538462
[ "+ def checker(n):", "+ n = str(n)", "+ OK3 = False", "+ OK5 = False", "+ OK7 = False", "+ for i in n:", "+ if i == \"3\":", "+ OK3 = True", "+ elif i == \"5\":", "+ OK5 = True", "+ elif i == \"7...
false
0.04943
0.073736
0.670373
[ "s891928789", "s865712947" ]
u744920373
p03575
python
s572670178
s057945608
503
108
58,332
3,188
Accepted
Accepted
78.53
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
42
66
1,264
1,712
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
36.363636
[ "-import copy", "-", "+## UnionFind", "-D = dp2(float(\"inf\"), N, N)", "-cnt = 0", "+rel = [[] for i in range(N)]", "+# d = dp2(float('inf'), N, N)", "- D[s][t] = D[t][s] = 1", "+ rel[s].append(t)", "+ rel[t].append(s)", "+ # d[s][t] = d[t][s] = 1", "+# print(d)", "+def dfs(v):"...
false
0.051653
0.032015
1.613404
[ "s572670178", "s057945608" ]
u238940874
p02688
python
s383596503
s781560269
24
21
9,112
9,144
Accepted
Accepted
12.5
n,k=list(map(int,input().split())) sunuke=[0]*n for i in range(k): d=int(eval(input())) a=list(map(int,input().split())) for j in a: sunuke[j-1]+=1 print((sunuke.count(0)))
n,k=list(map(int,input().split())) snuke=[0]*n for i in range(k): d=int(eval(input())) a=list(map(int,input().split())) for j in a: snuke[j-1]+=1 print((snuke.count(0)))
8
8
185
182
n, k = list(map(int, input().split())) sunuke = [0] * n for i in range(k): d = int(eval(input())) a = list(map(int, input().split())) for j in a: sunuke[j - 1] += 1 print((sunuke.count(0)))
n, k = list(map(int, input().split())) snuke = [0] * n for i in range(k): d = int(eval(input())) a = list(map(int, input().split())) for j in a: snuke[j - 1] += 1 print((snuke.count(0)))
false
0
[ "-sunuke = [0] * n", "+snuke = [0] * n", "- sunuke[j - 1] += 1", "-print((sunuke.count(0)))", "+ snuke[j - 1] += 1", "+print((snuke.count(0)))" ]
false
0.044613
0.037143
1.201124
[ "s383596503", "s781560269" ]
u771383254
p02601
python
s281222816
s550857687
30
24
9,176
9,120
Accepted
Accepted
20
a, b, c = list(map(int, input().split())) k = int(eval(input())) flg = False for i in range(k+1): d = 2**i*b e = 2**(k-i)*c if a < d < e: flg = True break if flg: print('Yes') else: print('No')
a, b, c = list(map(int, input().split())) k = int(eval(input())) cnt = 0 while a >= b: b *= 2 cnt += 1 while b >= c: c *= 2 cnt += 1 if cnt <= k: print('Yes') else: print('No')
16
12
217
184
a, b, c = list(map(int, input().split())) k = int(eval(input())) flg = False for i in range(k + 1): d = 2**i * b e = 2 ** (k - i) * c if a < d < e: flg = True break if flg: print("Yes") else: print("No")
a, b, c = list(map(int, input().split())) k = int(eval(input())) cnt = 0 while a >= b: b *= 2 cnt += 1 while b >= c: c *= 2 cnt += 1 if cnt <= k: print("Yes") else: print("No")
false
25
[ "-flg = False", "-for i in range(k + 1):", "- d = 2**i * b", "- e = 2 ** (k - i) * c", "- if a < d < e:", "- flg = True", "- break", "-if flg:", "+cnt = 0", "+while a >= b:", "+ b *= 2", "+ cnt += 1", "+while b >= c:", "+ c *= 2", "+ cnt += 1", "+if c...
false
0.04105
0.0884
0.464374
[ "s281222816", "s550857687" ]
u556389276
p02756
python
s009382211
s894867765
490
422
8,436
8,564
Accepted
Accepted
13.88
from collections import deque s=deque(eval(input())) q=int(eval(input())) flag = 2 for i in range(q): query=input().split() if query[0] == "1": flag = 3 - flag elif int(query[1]) - flag : s.appendleft(query[2]) else: s.append(query[2]) if flag-2: s.reverse()...
from collections import deque s=deque(eval(input())) q=int(eval(input())) flag = True for i in range(q): query=input().split() if query[0] == "1": flag = not flag elif query[1] == "1" and flag or query[1] == "2" and not flag : s.appendleft(query[2]) else: s.append(q...
18
18
330
371
from collections import deque s = deque(eval(input())) q = int(eval(input())) flag = 2 for i in range(q): query = input().split() if query[0] == "1": flag = 3 - flag elif int(query[1]) - flag: s.appendleft(query[2]) else: s.append(query[2]) if flag - 2: s.reverse() print((""...
from collections import deque s = deque(eval(input())) q = int(eval(input())) flag = True for i in range(q): query = input().split() if query[0] == "1": flag = not flag elif query[1] == "1" and flag or query[1] == "2" and not flag: s.appendleft(query[2]) else: s.append(query[2])...
false
0
[ "-flag = 2", "+flag = True", "- flag = 3 - flag", "- elif int(query[1]) - flag:", "+ flag = not flag", "+ elif query[1] == \"1\" and flag or query[1] == \"2\" and not flag:", "-if flag - 2:", "+if not flag:" ]
false
0.076955
0.075947
1.013277
[ "s009382211", "s894867765" ]
u296518383
p02831
python
s395723117
s613851852
170
17
38,256
2,940
Accepted
Accepted
90
A, B = list(map(int, input().split())) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) print((A * B // gcd(A, B)))
A, B = list(map(int, input().split())) ### GCD ### def gcd(a, b): if b == 0: return a return gcd(b, a%b) ### LCM ### def lcm(a, b): return a * b // gcd(a, b) print((lcm(A, B)))
9
13
142
193
A, B = list(map(int, input().split())) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) print((A * B // gcd(A, B)))
A, B = list(map(int, input().split())) ### GCD ### def gcd(a, b): if b == 0: return a return gcd(b, a % b) ### LCM ### def lcm(a, b): return a * b // gcd(a, b) print((lcm(A, B)))
false
30.769231
[ "-", "-", "+### GCD ###", "- else:", "- return gcd(b, a % b)", "+ return gcd(b, a % b)", "-print((A * B // gcd(A, B)))", "+### LCM ###", "+def lcm(a, b):", "+ return a * b // gcd(a, b)", "+", "+", "+print((lcm(A, B)))" ]
false
0.044813
0.042827
1.046384
[ "s395723117", "s613851852" ]
u894114233
p02399
python
s490016025
s473591041
30
10
6,424
6,348
Accepted
Accepted
66.67
a,b = list(map(int,input().split())) print(a/b) print(a%b) print("%.5f" % (a/float(b)))
a,b = list(map(int,input().split())) print(a/b,a%b,"%.5f"%(float(a)/float(b)))
4
4
85
81
a, b = list(map(int, input().split())) print(a / b) print(a % b) print("%.5f" % (a / float(b)))
a, b = list(map(int, input().split())) print(a / b, a % b, "%.5f" % (float(a) / float(b)))
false
0
[ "-print(a / b)", "-print(a % b)", "-print(\"%.5f\" % (a / float(b)))", "+print(a / b, a % b, \"%.5f\" % (float(a) / float(b)))" ]
false
0.039879
0.061284
0.650728
[ "s490016025", "s473591041" ]
u086566114
p02266
python
s122614676
s794270298
20
10
6,964
7,000
Accepted
Accepted
50
# -*- coding: utf-8 -*- def main(): down_positions = [] ponds = [] for index, value in enumerate(input()): if value == '\\': down_positions.append(index) elif value == '/' and down_positions: right = index left = down_positions.pop() ...
# -*- coding: utf-8 -*- def main(): down_positions = [] ponds = [] for index, value in enumerate(input()): if value == '\\': down_positions.append(index) elif value == '/' and down_positions: right = index left = down_positions.pop() ...
26
29
751
867
# -*- coding: utf-8 -*- def main(): down_positions = [] ponds = [] for index, value in enumerate(input()): if value == "\\": down_positions.append(index) elif value == "/" and down_positions: right = index left = down_positions.pop() area = rig...
# -*- coding: utf-8 -*- def main(): down_positions = [] ponds = [] for index, value in enumerate(input()): if value == "\\": down_positions.append(index) elif value == "/" and down_positions: right = index left = down_positions.pop() area = rig...
false
10.344828
[ "- candidate_pond = []", "+ # candidate_pond = []", "+ area2 = 0", "- candidate_pond.append(ponds.pop(-1))", "- new_pond = (left, area + sum([x[1] for x in candidate_pond]))", "+ # candidate_pond.append(ponds.pop(-1))", "+ ...
false
0.040954
0.040119
1.02083
[ "s122614676", "s794270298" ]
u146803137
p02629
python
s654768952
s881877794
75
31
61,788
9,076
Accepted
Accepted
58.67
n = int(eval(input()))-1 q = [] while n >= 0: q.insert(0,n % 26) n = n // 26-1 ans = '' for i in q: ans += chr(ord('a') + i) print(ans)
ini = lambda : int(eval(input())) inm = lambda : list(map(int,input().split())) inl = lambda : list(map(int,input().split())) gcd = lambda x,y : gcd(y,x%y) if x%y else y n = ini() b = '' while n > 0: n -= 1 b += chr(ord('a') + n%26) n = n//26 print((b[::-1]))
9
11
149
280
n = int(eval(input())) - 1 q = [] while n >= 0: q.insert(0, n % 26) n = n // 26 - 1 ans = "" for i in q: ans += chr(ord("a") + i) print(ans)
ini = lambda: int(eval(input())) inm = lambda: list(map(int, input().split())) inl = lambda: list(map(int, input().split())) gcd = lambda x, y: gcd(y, x % y) if x % y else y n = ini() b = "" while n > 0: n -= 1 b += chr(ord("a") + n % 26) n = n // 26 print((b[::-1]))
false
18.181818
[ "-n = int(eval(input())) - 1", "-q = []", "-while n >= 0:", "- q.insert(0, n % 26)", "- n = n // 26 - 1", "-ans = \"\"", "-for i in q:", "- ans += chr(ord(\"a\") + i)", "-print(ans)", "+ini = lambda: int(eval(input()))", "+inm = lambda: list(map(int, input().split()))", "+inl = lambda...
false
0.033328
0.034483
0.966517
[ "s654768952", "s881877794" ]
u761320129
p03698
python
s080852897
s798224484
21
17
3,316
2,940
Accepted
Accepted
19.05
from collections import Counter S = eval(input()) ctr = Counter(S) m = ctr.most_common()[0][1] print(('yes' if m==1 else 'no'))
S = eval(input()) print(('yes' if len(S) == len(set(S)) else 'no'))
5
2
124
60
from collections import Counter S = eval(input()) ctr = Counter(S) m = ctr.most_common()[0][1] print(("yes" if m == 1 else "no"))
S = eval(input()) print(("yes" if len(S) == len(set(S)) else "no"))
false
60
[ "-from collections import Counter", "-", "-ctr = Counter(S)", "-m = ctr.most_common()[0][1]", "-print((\"yes\" if m == 1 else \"no\"))", "+print((\"yes\" if len(S) == len(set(S)) else \"no\"))" ]
false
0.068619
0.042039
1.632274
[ "s080852897", "s798224484" ]
u077291787
p02925
python
s904552730
s991822152
1,185
878
104,244
104,788
Accepted
Accepted
25.91
# ABC139E - League from collections import deque def main(): N, *A = list(map(int, open(0).read().split())) B = {} for i in range(N): x = i * (N - 1) B[i + 1] = deque(A[x : x + N - 1]) ans, cnt, matched = 0, 0, set() q = [i for i in range(1, N + 1)] while q: ...
# ABC139E - League from collections import deque def main(): N, *A = list(map(int, open(0).read().split())) B = {} for i in range(N): x = i * (N - 1) B[i + 1] = deque(A[x : x + N - 1]) cnt, cur, days = 0, [0] * (N + 1), [0] * (N + 1) q = deque(list(range(1, N + 1))) ...
38
30
1,050
942
# ABC139E - League from collections import deque def main(): N, *A = list(map(int, open(0).read().split())) B = {} for i in range(N): x = i * (N - 1) B[i + 1] = deque(A[x : x + N - 1]) ans, cnt, matched = 0, 0, set() q = [i for i in range(1, N + 1)] while q: ans += 1 ...
# ABC139E - League from collections import deque def main(): N, *A = list(map(int, open(0).read().split())) B = {} for i in range(N): x = i * (N - 1) B[i + 1] = deque(A[x : x + N - 1]) cnt, cur, days = 0, [0] * (N + 1), [0] * (N + 1) q = deque(list(range(1, N + 1))) while q: ...
false
21.052632
[ "- ans, cnt, matched = 0, 0, set()", "- q = [i for i in range(1, N + 1)]", "+ cnt, cur, days = 0, [0] * (N + 1), [0] * (N + 1)", "+ q = deque(list(range(1, N + 1)))", "- ans += 1", "- next_q = []", "- for i in q:", "- if i in B and i not in matched:", "- ...
false
0.037383
0.067137
0.556812
[ "s904552730", "s991822152" ]
u046187684
p03102
python
s679390181
s780784714
274
149
20,004
12,440
Accepted
Accepted
45.62
import numpy as np def solve(string): n, m, c, *ba = list(map(int, string.split())) b = np.asarray(ba[:m]) a = np.asarray(ba[m:]) a.resize((n, m)) return str(sum(np.dot(b, a.T) > -c)) if __name__ == '__main__': n, m, o = list(map(int, input().split())) print((solve('{} {} {}...
import numpy as np def solve(string): n, m, c, *ba = list(map(int, string.split())) b = np.asarray(ba[:m]) a = np.asarray(ba[m:]) a.resize((n, m)) return str(np.sum(np.dot(b, a.T) > -c)) if __name__ == '__main__': n, m, o = list(map(int, input().split())) print((solve('{} {}...
14
14
374
377
import numpy as np def solve(string): n, m, c, *ba = list(map(int, string.split())) b = np.asarray(ba[:m]) a = np.asarray(ba[m:]) a.resize((n, m)) return str(sum(np.dot(b, a.T) > -c)) if __name__ == "__main__": n, m, o = list(map(int, input().split())) print( ( solve(...
import numpy as np def solve(string): n, m, c, *ba = list(map(int, string.split())) b = np.asarray(ba[:m]) a = np.asarray(ba[m:]) a.resize((n, m)) return str(np.sum(np.dot(b, a.T) > -c)) if __name__ == "__main__": n, m, o = list(map(int, input().split())) print( ( sol...
false
0
[ "- return str(sum(np.dot(b, a.T) > -c))", "+ return str(np.sum(np.dot(b, a.T) > -c))" ]
false
0.152168
0.229586
0.662793
[ "s679390181", "s780784714" ]
u803617136
p03680
python
s337191832
s465915767
226
204
7,852
7,888
Accepted
Accepted
9.73
n = int(eval(input())) A = [int(eval(input())) - 1 for _ in range(n)] pushed = [False] * n q = [0] ans = 0 while q: b = q.pop() ans += 1 pushed[b] = True if pushed[A[b]]: ans = -1 break if A[b] == 1: break q.append(A[b]) print(ans)
n = int(eval(input())) buttons = [int(eval(input())) for _ in range(n)] pushed = [False] * n b = 0 ans = 0 while True: ans += 1 pushed[b] = True b = buttons[b] - 1 if pushed[b]: ans = -1 break if b == 1: break print(ans)
16
16
282
277
n = int(eval(input())) A = [int(eval(input())) - 1 for _ in range(n)] pushed = [False] * n q = [0] ans = 0 while q: b = q.pop() ans += 1 pushed[b] = True if pushed[A[b]]: ans = -1 break if A[b] == 1: break q.append(A[b]) print(ans)
n = int(eval(input())) buttons = [int(eval(input())) for _ in range(n)] pushed = [False] * n b = 0 ans = 0 while True: ans += 1 pushed[b] = True b = buttons[b] - 1 if pushed[b]: ans = -1 break if b == 1: break print(ans)
false
0
[ "-A = [int(eval(input())) - 1 for _ in range(n)]", "+buttons = [int(eval(input())) for _ in range(n)]", "-q = [0]", "+b = 0", "-while q:", "- b = q.pop()", "+while True:", "- if pushed[A[b]]:", "+ b = buttons[b] - 1", "+ if pushed[b]:", "- if A[b] == 1:", "+ if b == 1:", "-...
false
0.042637
0.076074
0.560471
[ "s337191832", "s465915767" ]
u103724957
p02706
python
s833046668
s597144134
24
21
10,016
9,480
Accepted
Accepted
12.5
n, m = [int(i) for i in input().split(' ')] a_list = [int(i) for i in input().split(' ')] result = n - sum(a_list) if result < 0: print((-1)) else: print(result)
n, m = list(map(int, input().split())) a_list = list(map(int, input().split())) result = n - sum(a_list) if result < 0: print((-1)) else: print(result)
9
9
178
156
n, m = [int(i) for i in input().split(" ")] a_list = [int(i) for i in input().split(" ")] result = n - sum(a_list) if result < 0: print((-1)) else: print(result)
n, m = list(map(int, input().split())) a_list = list(map(int, input().split())) result = n - sum(a_list) if result < 0: print((-1)) else: print(result)
false
0
[ "-n, m = [int(i) for i in input().split(\" \")]", "-a_list = [int(i) for i in input().split(\" \")]", "+n, m = list(map(int, input().split()))", "+a_list = list(map(int, input().split()))" ]
false
0.038386
0.039661
0.967857
[ "s833046668", "s597144134" ]
u797673668
p02235
python
s046264838
s028183127
2,850
2,210
7,684
7,648
Accepted
Accepted
22.46
n = int(eval(input())) for _ in range(n): a, b = eval(input()), eval(input()) indices = [] for cb in b: bgn_idx = 0 for i in range(len(indices) + 1): chr_idx = a.find(cb, bgn_idx) + 1 if chr_idx: if i < len(indices): bgn_i...
n = int(eval(input())) for _ in range(n): a, b = eval(input()), eval(input()) indices = [] for cb in b: bgn_idx = 0 for i, cur_idx in enumerate(indices): chr_idx = a.find(cb, bgn_idx) + 1 if not chr_idx: break if chr_idx < cur_idx...
18
18
541
525
n = int(eval(input())) for _ in range(n): a, b = eval(input()), eval(input()) indices = [] for cb in b: bgn_idx = 0 for i in range(len(indices) + 1): chr_idx = a.find(cb, bgn_idx) + 1 if chr_idx: if i < len(indices): bgn_idx = indic...
n = int(eval(input())) for _ in range(n): a, b = eval(input()), eval(input()) indices = [] for cb in b: bgn_idx = 0 for i, cur_idx in enumerate(indices): chr_idx = a.find(cb, bgn_idx) + 1 if not chr_idx: break if chr_idx < cur_idx: ...
false
0
[ "- for i in range(len(indices) + 1):", "+ for i, cur_idx in enumerate(indices):", "+ chr_idx = a.find(cb, bgn_idx) + 1", "+ if not chr_idx:", "+ break", "+ if chr_idx < cur_idx:", "+ indices[i] = chr_idx", "+ bgn_i...
false
0.110283
0.043363
2.543267
[ "s046264838", "s028183127" ]
u434088994
p02835
python
s868489251
s076937439
180
165
38,256
38,256
Accepted
Accepted
8.33
a1, a2, a3 = list(map(int, input().split())) if a1 + a2 + a3 >= 22: print('bust') else: print('win')
a = list(map(int, input().split())) if a[0] + a[1] + a[2] >= 22: print('bust') else: print('win')
6
6
115
112
a1, a2, a3 = list(map(int, input().split())) if a1 + a2 + a3 >= 22: print("bust") else: print("win")
a = list(map(int, input().split())) if a[0] + a[1] + a[2] >= 22: print("bust") else: print("win")
false
0
[ "-a1, a2, a3 = list(map(int, input().split()))", "-if a1 + a2 + a3 >= 22:", "+a = list(map(int, input().split()))", "+if a[0] + a[1] + a[2] >= 22:" ]
false
0.036808
0.03564
1.03276
[ "s868489251", "s076937439" ]
u276115223
p03109
python
s878494404
s250891966
19
17
2,940
2,940
Accepted
Accepted
10.53
# ABC 119: A – Still TBD s = eval(input()) parts = [int(c) for c in s.split('/')] print(('Heisei' if parts[0] < 2019 or (parts[0] == 2019 and parts[1] <= 4) else 'TBD'))
# ABC 119: A – Still TBD s = eval(input()) print(('Heisei' if s <= '2019/04/30' else 'TBD'))
4
3
164
86
# ABC 119: A – Still TBD s = eval(input()) parts = [int(c) for c in s.split("/")] print(("Heisei" if parts[0] < 2019 or (parts[0] == 2019 and parts[1] <= 4) else "TBD"))
# ABC 119: A – Still TBD s = eval(input()) print(("Heisei" if s <= "2019/04/30" else "TBD"))
false
25
[ "-parts = [int(c) for c in s.split(\"/\")]", "-print((\"Heisei\" if parts[0] < 2019 or (parts[0] == 2019 and parts[1] <= 4) else \"TBD\"))", "+print((\"Heisei\" if s <= \"2019/04/30\" else \"TBD\"))" ]
false
0.06284
0.063373
0.991598
[ "s878494404", "s250891966" ]
u652656291
p02859
python
s611573931
s541104708
20
18
3,316
2,940
Accepted
Accepted
10
r = int(eval(input())) V = r * r print(V)
r = int(eval(input())) print((r*r))
3
2
38
28
r = int(eval(input())) V = r * r print(V)
r = int(eval(input())) print((r * r))
false
33.333333
[ "-V = r * r", "-print(V)", "+print((r * r))" ]
false
0.041513
0.043653
0.950984
[ "s611573931", "s541104708" ]
u372144784
p02801
python
s394557809
s697682020
174
17
38,256
2,940
Accepted
Accepted
90.23
s = eval(input()) print((chr(ord(s)+1)))
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 s = readline().rstrip().decode('utf-8') print((chr(ord(s)+1)))
2
6
33
153
s = eval(input()) print((chr(ord(s) + 1)))
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n % 2 == 0 else 0 s = readline().rstrip().decode("utf-8") print((chr(ord(s) + 1)))
false
66.666667
[ "-s = eval(input())", "+import sys", "+", "+readline = sys.stdin.buffer.readline", "+", "+", "+def even(n):", "+ return 1 if n % 2 == 0 else 0", "+", "+", "+s = readline().rstrip().decode(\"utf-8\")" ]
false
0.04644
0.094962
0.48904
[ "s394557809", "s697682020" ]
u246401133
p02639
python
s144397329
s195102306
32
23
9,116
9,164
Accepted
Accepted
28.12
x1, x2, x3, x4, x5 = list(map(int, input().split())) if (x1 == 0): ans = 1 if (x2 == 0): ans = 2 if (x3 == 0): ans = 3 if (x4 == 0): ans = 4 if (x5 == 0): ans = 5 print((int(ans)))
x= list(map(int, input().split())) sum = 0 for i in x: sum = sum + i y = 15 - int(sum) print((int(y)))
12
6
203
109
x1, x2, x3, x4, x5 = list(map(int, input().split())) if x1 == 0: ans = 1 if x2 == 0: ans = 2 if x3 == 0: ans = 3 if x4 == 0: ans = 4 if x5 == 0: ans = 5 print((int(ans)))
x = list(map(int, input().split())) sum = 0 for i in x: sum = sum + i y = 15 - int(sum) print((int(y)))
false
50
[ "-x1, x2, x3, x4, x5 = list(map(int, input().split()))", "-if x1 == 0:", "- ans = 1", "-if x2 == 0:", "- ans = 2", "-if x3 == 0:", "- ans = 3", "-if x4 == 0:", "- ans = 4", "-if x5 == 0:", "- ans = 5", "-print((int(ans)))", "+x = list(map(int, input().split()))", "+sum = 0",...
false
0.042486
0.03823
1.111317
[ "s144397329", "s195102306" ]
u350997995
p02947
python
s248026092
s803723368
1,850
440
32,736
18,192
Accepted
Accepted
76.22
from collections import Counter from collections import defaultdict N = int(eval(input())) S = [eval(input()) for i in range(N)] d = defaultdict(lambda : 0) ans = 0 for s in S: c = sorted(Counter(s).items()) ans += d[str(c)] d[str(c)]+=1 print(ans)
from collections import defaultdict N = int(eval(input())) d = defaultdict(int) ans = 0 for i in range(N): S = list(eval(input())) S.sort() s = "".join(S) ans += d[s] d[s]+=1 print(ans)
11
11
258
203
from collections import Counter from collections import defaultdict N = int(eval(input())) S = [eval(input()) for i in range(N)] d = defaultdict(lambda: 0) ans = 0 for s in S: c = sorted(Counter(s).items()) ans += d[str(c)] d[str(c)] += 1 print(ans)
from collections import defaultdict N = int(eval(input())) d = defaultdict(int) ans = 0 for i in range(N): S = list(eval(input())) S.sort() s = "".join(S) ans += d[s] d[s] += 1 print(ans)
false
0
[ "-from collections import Counter", "-S = [eval(input()) for i in range(N)]", "-d = defaultdict(lambda: 0)", "+d = defaultdict(int)", "-for s in S:", "- c = sorted(Counter(s).items())", "- ans += d[str(c)]", "- d[str(c)] += 1", "+for i in range(N):", "+ S = list(eval(input()))", "+ ...
false
0.078911
0.046676
1.690614
[ "s248026092", "s803723368" ]
u186206732
p03476
python
s471899047
s857291162
811
682
16,804
12,584
Accepted
Accepted
15.91
# 全てを先に計算しておき、累積和を使って結果を表示する。 今度コソ累積和 # それにより、同じ計算を何度もしなくてすむ。最大10^5になるはず。 # import math from itertools import accumulate def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True # 2017に似た数 def is...
# ほんとうに全ての値を最初に計算し、累積和のリストを作成してしまおう。 # 計算時間は421msでOKだけど、答えが間違っている。=>なおした import math def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True # 2017に似た数 def is_like2017(n): if is_prime(n) and...
52
47
960
811
# 全てを先に計算しておき、累積和を使って結果を表示する。 今度コソ累積和 # それにより、同じ計算を何度もしなくてすむ。最大10^5になるはず。 # import math from itertools import accumulate def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True # 2017に似た数 def is_like2017(n): ...
# ほんとうに全ての値を最初に計算し、累積和のリストを作成してしまおう。 # 計算時間は421msでOKだけど、答えが間違っている。=>なおした import math def is_prime(n): if n == 1: return False for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True # 2017に似た数 def is_like2017(n): if is_prime(n) and is_prime((n + ...
false
9.615385
[ "-# 全てを先に計算しておき、累積和を使って結果を表示する。 今度コソ累積和", "-# それにより、同じ計算を何度もしなくてすむ。最大10^5になるはず。", "-#", "+# ほんとうに全ての値を最初に計算し、累積和のリストを作成してしまおう。", "+# 計算時間は421msでOKだけど、答えが間違っている。=>なおした", "-from itertools import accumulate", "-min_value = min(l_list)", "-max_value = max(r_list)", "-ans = []", "-for i in range(min_va...
false
0.047464
0.815431
0.058207
[ "s471899047", "s857291162" ]
u231122239
p03627
python
s214780476
s010201436
148
84
18,600
18,600
Accepted
Accepted
43.24
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) ans = [0, 0] for k in sorted(list(A.keys()), reverse=True): if A[k] >= 2: ans.append(k) if A[k] >= 4: ans.append(k) ans = sorted(ans) print((ans[-1]*ans[-2]))
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) A = {k: v for k, v in list(A.items()) if v >= 2} A = sorted(list(A.items()), key=lambda x: x[0], reverse=True) A.extend([(0, 0), (0, 0)]) if A[0][1] >= 4: print((A[0][0]**2)) else: print((A[0][0]*A[1][...
13
11
283
303
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) ans = [0, 0] for k in sorted(list(A.keys()), reverse=True): if A[k] >= 2: ans.append(k) if A[k] >= 4: ans.append(k) ans = sorted(ans) print((ans[-1] * ans[-2]))
from collections import Counter N = int(eval(input())) A = Counter(list(map(int, input().split()))) A = {k: v for k, v in list(A.items()) if v >= 2} A = sorted(list(A.items()), key=lambda x: x[0], reverse=True) A.extend([(0, 0), (0, 0)]) if A[0][1] >= 4: print((A[0][0] ** 2)) else: print((A[0][0] * A[1][0]))
false
15.384615
[ "-ans = [0, 0]", "-for k in sorted(list(A.keys()), reverse=True):", "- if A[k] >= 2:", "- ans.append(k)", "- if A[k] >= 4:", "- ans.append(k)", "-ans = sorted(ans)", "-print((ans[-1] * ans[-2]))", "+A = {k: v for k, v in list(A.items()) if v >= 2}", "+A = sorted(list(A.items())...
false
0.044143
0.057996
0.761139
[ "s214780476", "s010201436" ]
u287132915
p02779
python
s016360849
s630501824
151
96
25,936
36,660
Accepted
Accepted
36.42
n = int(eval(input())) a = list(map(int, input().split())) mou = set([]) for i in range(n): if a[i] not in mou: mou.add(a[i]) else: print('NO') exit() print('YES')
n = int(eval(input())) a = set(map(int, input().split())) if n == len(a): print('YES') else: print('NO')
11
7
200
113
n = int(eval(input())) a = list(map(int, input().split())) mou = set([]) for i in range(n): if a[i] not in mou: mou.add(a[i]) else: print("NO") exit() print("YES")
n = int(eval(input())) a = set(map(int, input().split())) if n == len(a): print("YES") else: print("NO")
false
36.363636
[ "-a = list(map(int, input().split()))", "-mou = set([])", "-for i in range(n):", "- if a[i] not in mou:", "- mou.add(a[i])", "- else:", "- print(\"NO\")", "- exit()", "-print(\"YES\")", "+a = set(map(int, input().split()))", "+if n == len(a):", "+ print(\"YES\")",...
false
0.116474
0.036821
3.163222
[ "s016360849", "s630501824" ]
u255595446
p02753
python
s853171956
s135349878
162
17
38,384
2,940
Accepted
Accepted
89.51
data = eval(input()) if 'A' in data and 'B' in data: print('Yes') else: print('No')
S = eval(input()) if ("A" in S) and ("B" in S): print("Yes") else: print("No")
5
5
85
84
data = eval(input()) if "A" in data and "B" in data: print("Yes") else: print("No")
S = eval(input()) if ("A" in S) and ("B" in S): print("Yes") else: print("No")
false
0
[ "-data = eval(input())", "-if \"A\" in data and \"B\" in data:", "+S = eval(input())", "+if (\"A\" in S) and (\"B\" in S):" ]
false
0.03609
0.035563
1.014827
[ "s853171956", "s135349878" ]
u646445992
p02659
python
s173236724
s799228587
61
55
61,868
61,840
Accepted
Accepted
9.84
A, B = list(map(float, input().split())) A = int(A) B = int(B * 1000) ans = A * B // 1000 print(ans)
A, B = input().split() A = int(A) B = int(B.replace('.', '')) print((A * B // 100))
7
4
102
84
A, B = list(map(float, input().split())) A = int(A) B = int(B * 1000) ans = A * B // 1000 print(ans)
A, B = input().split() A = int(A) B = int(B.replace(".", "")) print((A * B // 100))
false
42.857143
[ "-A, B = list(map(float, input().split()))", "+A, B = input().split()", "-B = int(B * 1000)", "-ans = A * B // 1000", "-print(ans)", "+B = int(B.replace(\".\", \"\"))", "+print((A * B // 100))" ]
false
0.036856
0.036368
1.013424
[ "s173236724", "s799228587" ]
u518042385
p03329
python
s422519077
s855699272
367
296
3,956
3,876
Accepted
Accepted
19.35
n=int(eval(input())) l6=[] l9=[] num6=6 num9=9 while num6<=n: l6.append(num6) num6*=6 while num9<=n: l9.append(num9) num9*=9 count=[0,1,2,3,4,5,1,2,3,1,2,3] for i in range(12,n+1): min=100000 for j in l6: if i-j<0: pass else: if min>count[i-j]+1: min=count[i-j]...
n=int(eval(input())) num6=6 num9=9 l=[] while num6<=n: l.append(num6) num6*=6 while num9<=n: l.append(num9) num9*=9 count=[0,1,2,3,4,5,1,2,3,1,2,3] for i in range(12,n+1): min=100000 for j in l: if i-j<0: pass else: if min>count[i-j]+1: min=count[i-j]+1 count...
28
21
462
344
n = int(eval(input())) l6 = [] l9 = [] num6 = 6 num9 = 9 while num6 <= n: l6.append(num6) num6 *= 6 while num9 <= n: l9.append(num9) num9 *= 9 count = [0, 1, 2, 3, 4, 5, 1, 2, 3, 1, 2, 3] for i in range(12, n + 1): min = 100000 for j in l6: if i - j < 0: pass else: ...
n = int(eval(input())) num6 = 6 num9 = 9 l = [] while num6 <= n: l.append(num6) num6 *= 6 while num9 <= n: l.append(num9) num9 *= 9 count = [0, 1, 2, 3, 4, 5, 1, 2, 3, 1, 2, 3] for i in range(12, n + 1): min = 100000 for j in l: if i - j < 0: pass else: if...
false
25
[ "-l6 = []", "-l9 = []", "+l = []", "- l6.append(num6)", "+ l.append(num6)", "- l9.append(num9)", "+ l.append(num9)", "- for j in l6:", "- if i - j < 0:", "- pass", "- else:", "- if min > count[i - j] + 1:", "- min = count[i - ...
false
0.146539
0.064728
2.263939
[ "s422519077", "s855699272" ]
u761320129
p03487
python
s083472185
s653362688
85
78
18,676
18,672
Accepted
Accepted
8.24
from collections import Counter N = int(eval(input())) src = list(map(int,input().split())) ctr = Counter(src) ans = 0 for k,v in list(ctr.items()): if k < v: ans += v-k elif k > v: ans += v print(ans)
from collections import Counter N = int(eval(input())) src = list(map(int,input().split())) ctr = Counter(src) ans = 0 for k,v in list(ctr.items()): ans += v if v<k else v-k print(ans)
12
8
226
183
from collections import Counter N = int(eval(input())) src = list(map(int, input().split())) ctr = Counter(src) ans = 0 for k, v in list(ctr.items()): if k < v: ans += v - k elif k > v: ans += v print(ans)
from collections import Counter N = int(eval(input())) src = list(map(int, input().split())) ctr = Counter(src) ans = 0 for k, v in list(ctr.items()): ans += v if v < k else v - k print(ans)
false
33.333333
[ "- if k < v:", "- ans += v - k", "- elif k > v:", "- ans += v", "+ ans += v if v < k else v - k" ]
false
0.035972
0.041243
0.872205
[ "s083472185", "s653362688" ]
u708255304
p02573
python
s829089484
s403260184
730
428
176,980
83,060
Accepted
Accepted
41.37
from collections import deque N, M = list(map(int, input().split())) tree = [[] for _ in range(N)] happend = set() for _ in range(M): a, b = [int(x)-1 for x in input().split()] if (a, b) not in happend and (b, a) not in happend: tree[a].append(b) tree[b].append(a) happend.add((a...
class UnionFind(): def __init__(self, n): self.n = n self.parents = [-1]*n # 根のノードは限らないので注意 def find(self, x): # あるノードの親を探すためのメソッド if self.parents[x] < 0: # 親の場合、要素の個数を負の値で保持している return x # 自身が親であるということ else: self.parents[x] = self.find(self....
33
58
833
1,880
from collections import deque N, M = list(map(int, input().split())) tree = [[] for _ in range(N)] happend = set() for _ in range(M): a, b = [int(x) - 1 for x in input().split()] if (a, b) not in happend and (b, a) not in happend: tree[a].append(b) tree[b].append(a) happend.add((a, b)) ...
class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n # 根のノードは限らないので注意 def find(self, x): # あるノードの親を探すためのメソッド if self.parents[x] < 0: # 親の場合、要素の個数を負の値で保持している return x # 自身が親であるということ else: self.parents[x] = self.find(self.parents[x...
false
43.103448
[ "-from collections import deque", "+class UnionFind:", "+ def __init__(self, n):", "+ self.n = n", "+ self.parents = [-1] * n # 根のノードは限らないので注意", "+", "+ def find(self, x): # あるノードの親を探すためのメソッド", "+ if self.parents[x] < 0: # 親の場合、要素の個数を負の値で保持している", "+ return x ...
false
0.038635
0.037458
1.031411
[ "s829089484", "s403260184" ]
u648881683
p02787
python
s531442596
s178829928
1,582
1,375
14,696
14,692
Accepted
Accepted
13.08
import numpy as np H, N = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for i in range(N)]) A = AB[:, 0] B = AB[:, 1] # インデックスはライフ 値はそれを以下にする最小MP # dp = np.array([0 for i in range(H+1)]) # dp = np.array([10**10 for i in range(H+1)]) dp = np.array([np.inf for i in range(H+1)]...
import numpy as np H, N = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for i in range(N)]) A = AB[:, 0] B = AB[:, 1] # インデックスはライフ 値はそれを以下にする最小MP dp = np.array([0 for i in range(H+1)]) for i in range(1, H+1): dp[i] = min(dp[np.maximum(i - A, 0)] + B) print((int(dp[-...
17
14
420
317
import numpy as np H, N = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for i in range(N)]) A = AB[:, 0] B = AB[:, 1] # インデックスはライフ 値はそれを以下にする最小MP # dp = np.array([0 for i in range(H+1)]) # dp = np.array([10**10 for i in range(H+1)]) dp = np.array([np.inf for i in range(H + 1)]) dp[0] =...
import numpy as np H, N = list(map(int, input().split())) AB = np.array([list(map(int, input().split())) for i in range(N)]) A = AB[:, 0] B = AB[:, 1] # インデックスはライフ 値はそれを以下にする最小MP dp = np.array([0 for i in range(H + 1)]) for i in range(1, H + 1): dp[i] = min(dp[np.maximum(i - A, 0)] + B) print((int(dp[-1])))
false
17.647059
[ "-# dp = np.array([0 for i in range(H+1)])", "-# dp = np.array([10**10 for i in range(H+1)])", "-dp = np.array([np.inf for i in range(H + 1)])", "-dp[0] = 0", "+dp = np.array([0 for i in range(H + 1)])" ]
false
0.395686
0.346776
1.141043
[ "s531442596", "s178829928" ]
u461833298
p02854
python
s653122075
s513039205
225
205
34,208
25,768
Accepted
Accepted
8.89
import numpy as np N = int(eval(input())) A = [int(x) for x in input().split()] A = np.array(A) Acum = A.cumsum() L = Acum[:-1] R = Acum[-1] - L print((abs(L-R).min()))
import itertools N = int(eval(input())) A = [int(x) for x in input().split()] reg = 10**12 Acum = list(itertools.accumulate(A)) for i in range(N): L = Acum[i] R = Acum[-1] - L tmp = abs(L-R) reg = min(reg, tmp) print(reg)
10
13
171
245
import numpy as np N = int(eval(input())) A = [int(x) for x in input().split()] A = np.array(A) Acum = A.cumsum() L = Acum[:-1] R = Acum[-1] - L print((abs(L - R).min()))
import itertools N = int(eval(input())) A = [int(x) for x in input().split()] reg = 10**12 Acum = list(itertools.accumulate(A)) for i in range(N): L = Acum[i] R = Acum[-1] - L tmp = abs(L - R) reg = min(reg, tmp) print(reg)
false
23.076923
[ "-import numpy as np", "+import itertools", "-A = np.array(A)", "-Acum = A.cumsum()", "-L = Acum[:-1]", "-R = Acum[-1] - L", "-print((abs(L - R).min()))", "+reg = 10**12", "+Acum = list(itertools.accumulate(A))", "+for i in range(N):", "+ L = Acum[i]", "+ R = Acum[-1] - L", "+ tmp =...
false
0.227109
0.04062
5.591054
[ "s653122075", "s513039205" ]
u816631826
p03331
python
s255008324
s963198857
83
17
3,064
3,064
Accepted
Accepted
79.52
line = eval(input()) num = [int(n) for n in line.split()][0] number_of_sums = num//2 + 1 + 1*num % 2 smallest_sum = 100000 for i in range(1, number_of_sums): first_number = i second_number = num-i summation = 0 while first_number and summation < smallest_sum: summation += first_number %...
n = int(eval(input())) x = n / 2 result = 0 if n <= 10: result = n elif (n <= 100 and not n % 10) or not x % 10: result = 0 while(x > 0): result += int(x % 10) x = x // 10 result = result* 2 else: if n % 10: x = n % 10 elif n % 10: x = n % ...
17
60
561
1,012
line = eval(input()) num = [int(n) for n in line.split()][0] number_of_sums = num // 2 + 1 + 1 * num % 2 smallest_sum = 100000 for i in range(1, number_of_sums): first_number = i second_number = num - i summation = 0 while first_number and summation < smallest_sum: summation += first_number % 10...
n = int(eval(input())) x = n / 2 result = 0 if n <= 10: result = n elif (n <= 100 and not n % 10) or not x % 10: result = 0 while x > 0: result += int(x % 10) x = x // 10 result = result * 2 else: if n % 10: x = n % 10 elif n % 10: x = n % 100 elif n % 1000: ...
false
71.666667
[ "-line = eval(input())", "-num = [int(n) for n in line.split()][0]", "-number_of_sums = num // 2 + 1 + 1 * num % 2", "-smallest_sum = 100000", "-for i in range(1, number_of_sums):", "- first_number = i", "- second_number = num - i", "- summation = 0", "- while first_number and summation ...
false
0.150432
0.171916
0.875034
[ "s255008324", "s963198857" ]
u185802209
p03215
python
s197214315
s783814318
594
535
27,420
27,440
Accepted
Accepted
9.93
n,k = list(map(int,input().split())) a = list(map(int,input().split())) b = [a[0]] for i in range(n-1): b.append(b[i]+a[i+1]) s = b for i in range(n-1): for j in range(i,n-1): s.append(b[j+1]-b[i]) s.sort(reverse=True) l = len(bin(s[0]))-2 d = 1<<l-1 t = 0 while d>0: s1 = [] if s[...
n,k = list(map(int,input().split())) a = list(map(int,input().split())) b = [a[0]] for i in range(n-1): b.append(b[i]+a[i+1]) s = b for i in range(n-1): for j in range(i,n-1): s.append(b[j+1]-b[i]) s.sort(reverse=True) l = len(bin(s[0]))-2 d = 1<<l-1 t = 0 while d>0: s1 = [] if s[...
32
39
673
797
n, k = list(map(int, input().split())) a = list(map(int, input().split())) b = [a[0]] for i in range(n - 1): b.append(b[i] + a[i + 1]) s = b for i in range(n - 1): for j in range(i, n - 1): s.append(b[j + 1] - b[i]) s.sort(reverse=True) l = len(bin(s[0])) - 2 d = 1 << l - 1 t = 0 while d > 0: s1 = [...
n, k = list(map(int, input().split())) a = list(map(int, input().split())) b = [a[0]] for i in range(n - 1): b.append(b[i] + a[i + 1]) s = b for i in range(n - 1): for j in range(i, n - 1): s.append(b[j + 1] - b[i]) s.sort(reverse=True) l = len(bin(s[0])) - 2 d = 1 << l - 1 t = 0 while d > 0: s1 = [...
false
17.948718
[ "- d2 = d - 1", "+ if len(s) < k:", "+ break", "- if s[i] > d2:", "- s[i] = s[i] & d2", "+ if s[i] >= d:", "+ s[i] -= d", "+ if len(s) == k:", "+ t2 = d - 1", "+ for i in s:", "+ t2 = t2 & i", "+ t = t | t2", ...
false
0.040776
0.097756
0.417121
[ "s197214315", "s783814318" ]
u697101155
p02726
python
s082941497
s002361081
1,830
281
14,440
46,300
Accepted
Accepted
84.64
import numpy as np N, X, Y = map(int, input().split()) X -= 1 Y -= 1 ans = [0 for _ in range(N - 1)] for i in range(N - 1): for j in range(i + 1, N): d1 = abs(j - i) d2 = abs(X - i) + 1 + abs(j - Y) ans[min(d1, d2) - 1] += 1 [print(ans[i]) for i in range(N - 1)]
N, X, Y = map(int, input().split()) X -= 1 Y -= 1 ans = [0 for _ in range(N - 1)] for i in range(N - 1): for j in range(i + 1, N): d1 = abs(j - i) d2 = abs(X - i) + 1 + abs(j - Y) ans[min(d1, d2) - 1] += 1 [print(ans[i]) for i in range(N - 1)]
15
13
309
287
import numpy as np N, X, Y = map(int, input().split()) X -= 1 Y -= 1 ans = [0 for _ in range(N - 1)] for i in range(N - 1): for j in range(i + 1, N): d1 = abs(j - i) d2 = abs(X - i) + 1 + abs(j - Y) ans[min(d1, d2) - 1] += 1 [print(ans[i]) for i in range(N - 1)]
N, X, Y = map(int, input().split()) X -= 1 Y -= 1 ans = [0 for _ in range(N - 1)] for i in range(N - 1): for j in range(i + 1, N): d1 = abs(j - i) d2 = abs(X - i) + 1 + abs(j - Y) ans[min(d1, d2) - 1] += 1 [print(ans[i]) for i in range(N - 1)]
false
13.333333
[ "-import numpy as np", "-" ]
false
0.106315
0.044035
2.414317
[ "s082941497", "s002361081" ]
u408620326
p02727
python
s369159776
s061112564
518
430
24,972
24,988
Accepted
Accepted
16.99
import sys import numpy as np sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline X, Y, A, B, C = [int(x) for x in input().strip().split()] p = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X] q = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y] r =...
import sys import numpy as np sys.setrecursionlimit(10 ** 6) input = sys.stdin.readline X, Y, A, B, C = [int(x) for x in input().strip().split()] p = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X] q = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y] r =...
19
12
593
473
import sys import numpy as np sys.setrecursionlimit(10**6) input = sys.stdin.readline X, Y, A, B, C = [int(x) for x in input().strip().split()] p = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X] q = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y] r = np.arra...
import sys import numpy as np sys.setrecursionlimit(10**6) input = sys.stdin.readline X, Y, A, B, C = [int(x) for x in input().strip().split()] p = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:X] q = np.array(sorted([int(x) for x in input().strip().split()], reverse=True))[:Y] r = np.arra...
false
36.842105
[ "-pq = np.hstack((p, q))", "+pq = np.hstack((p, q, r))", "-ri = 0", "-for i, t in enumerate(pq):", "- if t < r[ri]:", "- pq[i] = r[ri]", "- ri += 1", "- if ri == len(r):", "- break", "-print((sum(pq)))", "+print((sum(pq[-(X + Y) :])))" ]
false
0.289913
0.267014
1.085758
[ "s369159776", "s061112564" ]
u994521204
p02698
python
s483756189
s423515962
1,397
1,173
89,736
89,868
Accepted
Accepted
16.03
from bisect import bisect_left n = int(input()) A = [0] + list(map(int, input().split())) graph = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v = map(int, input().split()) graph[v].append(u) graph[u].append(v) start = 1 stack = [1] par = [-1] * (n + 1) ans = [0] * (n + 1) used = [...
from bisect import bisect_left import sys input = sys.stdin.buffer.readline n = int(input()) A = [0] + list(map(int, input().split())) graph = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v = map(int, input().split()) graph[v].append(u) graph[u].append(v) start = 1 stack = [1] pa...
49
52
1,022
1,071
from bisect import bisect_left n = int(input()) A = [0] + list(map(int, input().split())) graph = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v = map(int, input().split()) graph[v].append(u) graph[u].append(v) start = 1 stack = [1] par = [-1] * (n + 1) ans = [0] * (n + 1) used = [False] * (n + 1) ...
from bisect import bisect_left import sys input = sys.stdin.buffer.readline n = int(input()) A = [0] + list(map(int, input().split())) graph = [[] for _ in range(n + 1)] for _ in range(n - 1): u, v = map(int, input().split()) graph[v].append(u) graph[u].append(v) start = 1 stack = [1] par = [-1] * (n + 1) ...
false
5.769231
[ "+import sys", "+input = sys.stdin.buffer.readline" ]
false
0.043798
0.039912
1.097352
[ "s483756189", "s423515962" ]
u617037231
p03309
python
s894249857
s176823358
377
293
27,232
27,248
Accepted
Accepted
22.28
import math import statistics N = int(eval(input())) L = [i for i in map(int,input().split())] Q = [] for i in range(len(L)): Q.append(L[i] - (i+1)) b = statistics.median(Q) a = b - 1 c = b + 1 res = 0 res2 = 0 res3 = 0 for i in range(N): res += abs(L[i] - (i+1) - b) res2 += abs(L[i] - (i+1) - a) ...
import math import statistics N = int(eval(input())) L = [i for i in map(int,input().split())] Q = [] for i in range(len(L)): Q.append(L[i] - (i+1)) b = statistics.median(Q) res = 0 for i in range(N): res += abs(L[i] - (i+1) - b) print((int(res)))
18
12
377
255
import math import statistics N = int(eval(input())) L = [i for i in map(int, input().split())] Q = [] for i in range(len(L)): Q.append(L[i] - (i + 1)) b = statistics.median(Q) a = b - 1 c = b + 1 res = 0 res2 = 0 res3 = 0 for i in range(N): res += abs(L[i] - (i + 1) - b) res2 += abs(L[i] - (i + 1) - a) ...
import math import statistics N = int(eval(input())) L = [i for i in map(int, input().split())] Q = [] for i in range(len(L)): Q.append(L[i] - (i + 1)) b = statistics.median(Q) res = 0 for i in range(N): res += abs(L[i] - (i + 1) - b) print((int(res)))
false
33.333333
[ "-a = b - 1", "-c = b + 1", "-res2 = 0", "-res3 = 0", "- res2 += abs(L[i] - (i + 1) - a)", "- res3 += abs(L[i] - (i + 1) - c)", "-print((int(min(res, res2, res3))))", "+print((int(res)))" ]
false
0.139349
0.138361
1.007138
[ "s894249857", "s176823358" ]
u597374218
p02983
python
s035364025
s263952911
684
333
3,060
75,416
Accepted
Accepted
51.32
L,R=list(map(int,input().split())) if R-L>=2019: minimum=0 else: left,right=L%2019,R%2019 minimum=2018**2 for i in range(left,right+1): for j in range(i+1,right+1): minimum=min(minimum,i*j%2019) print(minimum)
L,R=list(map(int,input().split())) left,right=L%2019,R%2019 print((0 if R-L>=2019 else min([i*j%2019 for i in range(left,right+1) for j in range(i+1,right+1)])))
10
3
248
155
L, R = list(map(int, input().split())) if R - L >= 2019: minimum = 0 else: left, right = L % 2019, R % 2019 minimum = 2018**2 for i in range(left, right + 1): for j in range(i + 1, right + 1): minimum = min(minimum, i * j % 2019) print(minimum)
L, R = list(map(int, input().split())) left, right = L % 2019, R % 2019 print( ( 0 if R - L >= 2019 else min( [ i * j % 2019 for i in range(left, right + 1) for j in range(i + 1, right + 1) ] ) ) )
false
70
[ "-if R - L >= 2019:", "- minimum = 0", "-else:", "- left, right = L % 2019, R % 2019", "- minimum = 2018**2", "- for i in range(left, right + 1):", "- for j in range(i + 1, right + 1):", "- minimum = min(minimum, i * j % 2019)", "-print(minimum)", "+left, right = L % ...
false
0.155307
0.170703
0.909813
[ "s035364025", "s263952911" ]
u163320134
p02941
python
s299341644
s790498858
1,986
1,827
122,140
122,012
Accepted
Accepted
8.01
import heapq n=int(eval(input())) arr1=list(map(int,input().split())) arr2=list(map(int,input().split())) q=[] for i in range(n): if arr2[i]!=arr1[i]: heapq.heappush(q,(-arr2[i],i)) cnt=0 while q: val,pos=heapq.heappop(q) val*=-1 diff=arr2[pos-1]+arr2[(pos+1)%n] move,tmp=divmod(val-arr1[pos...
import heapq n=int(eval(input())) arr1=list(map(int,input().split())) arr2=list(map(int,input().split())) q=[] for i in range(n): if arr2[i]!=arr1[i]: heapq.heappush(q,(-arr2[i],i)) cnt=0 while q: val,pos=heapq.heappop(q) val*=-1 diff=arr2[pos-1]+arr2[(pos+1)%n] move=(val-arr1[pos])//diff ...
28
28
542
542
import heapq n = int(eval(input())) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) q = [] for i in range(n): if arr2[i] != arr1[i]: heapq.heappush(q, (-arr2[i], i)) cnt = 0 while q: val, pos = heapq.heappop(q) val *= -1 diff = arr2[pos - 1] + arr2[(pos + 1) % n] ...
import heapq n = int(eval(input())) arr1 = list(map(int, input().split())) arr2 = list(map(int, input().split())) q = [] for i in range(n): if arr2[i] != arr1[i]: heapq.heappush(q, (-arr2[i], i)) cnt = 0 while q: val, pos = heapq.heappop(q) val *= -1 diff = arr2[pos - 1] + arr2[(pos + 1) % n] ...
false
0
[ "- move, tmp = divmod(val - arr1[pos], diff)", "+ move = (val - arr1[pos]) // diff", "- tmp += arr1[pos]", "+ tmp = arr2[pos] - diff * move" ]
false
0.102216
0.091755
1.114013
[ "s299341644", "s790498858" ]
u509739538
p03951
python
s655283605
s749144905
32
28
9,312
9,368
Accepted
Accepted
12.5
from collections import defaultdict from collections import deque import itertools import math def readInt(): return int(eval(input())) def readInts(): return list(map(int, input().split())) def readChar(): return eval(input()) def readChars(): return input().split() n = readInt() s = eval(inpu...
from collections import defaultdict from collections import deque import itertools import math def readInt(): return int(eval(input())) def readInts(): return list(map(int, input().split())) def readChar(): return eval(input()) def readChars(): return input().split() n = readInt() s = eval(inpu...
31
28
531
480
from collections import defaultdict from collections import deque import itertools import math def readInt(): return int(eval(input())) def readInts(): return list(map(int, input().split())) def readChar(): return eval(input()) def readChars(): return input().split() n = readInt() s = eval(inp...
from collections import defaultdict from collections import deque import itertools import math def readInt(): return int(eval(input())) def readInts(): return list(map(int, input().split())) def readChar(): return eval(input()) def readChars(): return input().split() n = readInt() s = eval(inp...
false
9.677419
[ "-if s == t and len(s) >= n:", "- print((len(s)))", "- exit()" ]
false
0.039831
0.047153
0.844717
[ "s655283605", "s749144905" ]
u780475861
p03061
python
s343958766
s849352911
51
43
14,620
14,476
Accepted
Accepted
15.69
import sys from functools import lru_cache sys.setrecursionlimit(1000000) def main(): @lru_cache(maxsize=None) def gcd(a, b): if a % b == 0: return b else: return gcd(b, a % b) def cul(n,x): l=len(x) b=[x[i] for i in range(l)] ...
import sys sys.setrecursionlimit(1000000) def main(): def gcd(a, b): if a % b == 0: return b else: return gcd(b, a % b) def cul(n,x): l=len(x) b=[x[i] for i in range(l)] b.pop(n) tmp=b[0] for i in range(1,l-1): ...
32
30
646
583
import sys from functools import lru_cache sys.setrecursionlimit(1000000) def main(): @lru_cache(maxsize=None) def gcd(a, b): if a % b == 0: return b else: return gcd(b, a % b) def cul(n, x): l = len(x) b = [x[i] for i in range(l)] b.pop(n)...
import sys sys.setrecursionlimit(1000000) def main(): def gcd(a, b): if a % b == 0: return b else: return gcd(b, a % b) def cul(n, x): l = len(x) b = [x[i] for i in range(l)] b.pop(n) tmp = b[0] for i in range(1, l - 1): ...
false
6.25
[ "-from functools import lru_cache", "- @lru_cache(maxsize=None)" ]
false
0.127319
0.093132
1.367075
[ "s343958766", "s849352911" ]
u729133443
p03827
python
s582380595
s061425561
164
18
38,384
2,940
Accepted
Accepted
89.02
eval(input());a=[0] for x in eval(input()):a+=[a[-1]+((x>'D')or-1)] print((max(a)))
eval(input());a=b=0 for x in eval(input()):b+=x>'D'or-1;a=max(a,b) print(a)
3
3
71
65
eval(input()) a = [0] for x in eval(input()): a += [a[-1] + ((x > "D") or -1)] print((max(a)))
eval(input()) a = b = 0 for x in eval(input()): b += x > "D" or -1 a = max(a, b) print(a)
false
0
[ "-a = [0]", "+a = b = 0", "- a += [a[-1] + ((x > \"D\") or -1)]", "-print((max(a)))", "+ b += x > \"D\" or -1", "+ a = max(a, b)", "+print(a)" ]
false
0.084579
0.108332
0.780744
[ "s582380595", "s061425561" ]
u584174687
p03855
python
s044323597
s375133750
1,654
1,052
125,652
111,360
Accepted
Accepted
36.4
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline from math import factorial def union_r(node): global road_union if road_union[node] != node: road_union[node] = union_r(road_union[node]) return road_union[node] ...
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) input = sys.stdin.readline from math import factorial def union_r(node): global road_union if road_union[node] != node: road_union[node] = union_r(road_union[node]) return road_union[node] d...
67
67
1,688
1,686
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10**5 + 10) # input = sys.stdin.readline from math import factorial def union_r(node): global road_union if road_union[node] != node: road_union[node] = union_r(road_union[node]) return road_union[node] def union_t(no...
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10**5 + 10) input = sys.stdin.readline from math import factorial def union_r(node): global road_union if road_union[node] != node: road_union[node] = union_r(road_union[node]) return road_union[node] def union_t(node...
false
0
[ "-# input = sys.stdin.readline", "+input = sys.stdin.readline" ]
false
0.120399
0.04694
2.564954
[ "s044323597", "s375133750" ]
u766684188
p03078
python
s555578385
s924074013
999
419
148,588
60,504
Accepted
Accepted
58.06
x,y,z,k=list(map(int,input().split())) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) AB=[] for a in A: for b in B: AB.append(a+b) AB.sort(reverse=True) AB=AB[:k] ABC=[] for ab in AB: for c in C: ABC.append(ab+c) ABC.sort(reverse=...
import heapq x,y,z,k=list(map(int,input().split())) A=list(map(int,input().split())) B=list(map(int,input().split())) C=list(map(int,input().split())) A.sort(reverse=True);B.sort(reverse=True);C.sort(reverse=True) hq=[] heapq.heappush(hq,(-(A[0]+B[0]+C[0]),0,0,0)) searched={(0,0,0)} a,b,c=0,0,0 D=((1,0,0),(0,...
17
19
358
641
x, y, z, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) AB = [] for a in A: for b in B: AB.append(a + b) AB.sort(reverse=True) AB = AB[:k] ABC = [] for ab in AB: for c in C: ABC.append(ab + c) ABC.so...
import heapq x, y, z, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) A.sort(reverse=True) B.sort(reverse=True) C.sort(reverse=True) hq = [] heapq.heappush(hq, (-(A[0] + B[0] + C[0]), 0, 0, 0)) searched = {(0, 0, 0)} a, b, ...
false
10.526316
[ "+import heapq", "+", "-AB = []", "-for a in A:", "- for b in B:", "- AB.append(a + b)", "-AB.sort(reverse=True)", "-AB = AB[:k]", "-ABC = []", "-for ab in AB:", "- for c in C:", "- ABC.append(ab + c)", "-ABC.sort(reverse=True)", "-for i in range(k):", "- print((AB...
false
0.036269
0.035176
1.031072
[ "s555578385", "s924074013" ]
u314050667
p04001
python
s183527258
s713941802
25
17
3,064
3,060
Accepted
Accepted
32
s = list(map(str, eval(input()))) def Base_10_to_n(X, n): if (int(X/n)): return Base_10_to_n(int(X/n), n)+str(X%n) return str(X%n) ans = 0 for i in range(2**(len(s)-1)): if i == 0: ans += int("".join(s)) continue b = Base_10_to_n(i,2).rjust(len(s)-1, "0") ind = [j for j in ra...
S = list(map(int, eval(input()))) n = len(S) ans = [] def f(ind, cnt, keta): if ind == 0: ans.append(cnt) return f(ind-1, cnt+S[ind-1], 0) f(ind-1, cnt+S[ind-1]*(10**(keta+1)), keta+1) f(len(S)-1, S[-1], 0) print((sum(ans)))
39
16
813
243
s = list(map(str, eval(input()))) def Base_10_to_n(X, n): if int(X / n): return Base_10_to_n(int(X / n), n) + str(X % n) return str(X % n) ans = 0 for i in range(2 ** (len(s) - 1)): if i == 0: ans += int("".join(s)) continue b = Base_10_to_n(i, 2).rjust(len(s) - 1, "0") i...
S = list(map(int, eval(input()))) n = len(S) ans = [] def f(ind, cnt, keta): if ind == 0: ans.append(cnt) return f(ind - 1, cnt + S[ind - 1], 0) f(ind - 1, cnt + S[ind - 1] * (10 ** (keta + 1)), keta + 1) f(len(S) - 1, S[-1], 0) print((sum(ans)))
false
58.974359
[ "-s = list(map(str, eval(input())))", "+S = list(map(int, eval(input())))", "+n = len(S)", "+ans = []", "-def Base_10_to_n(X, n):", "- if int(X / n):", "- return Base_10_to_n(int(X / n), n) + str(X % n)", "- return str(X % n)", "+def f(ind, cnt, keta):", "+ if ind == 0:", "+ ...
false
0.038792
0.045272
0.856858
[ "s183527258", "s713941802" ]
u029000441
p03160
python
s194295240
s610002838
145
133
14,492
21,652
Accepted
Accepted
8.28
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush fr...
# coding: utf-8 # hello worldと表示する #float型を許すな #numpyはpythonで import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_l...
29
33
923
1,050
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bisect_right from heapq import heapify, heappop, heappush from mat...
# coding: utf-8 # hello worldと表示する # float型を許すな # numpyはpythonで import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left, bi...
false
12.121212
[ "+# coding: utf-8", "+# hello worldと表示する", "+# float型を許すな", "+# numpyはpythonで", "-from math import floor, ceil", "+from math import floor, ceil, pi, factorial", "-def MXI():", "- return [[LI()] for i in range(n)]", "+# def MXI(): return [LI() for i in range(n)]", "+def SI():", "+ return in...
false
0.075679
0.036586
2.068549
[ "s194295240", "s610002838" ]
u399280934
p03860
python
s152389740
s235196601
24
17
2,940
2,940
Accepted
Accepted
29.17
a=input().split() print(("A"+a[1][0]+"C"))
print(("A"+input()[8]+"C"))
2
1
42
25
a = input().split() print(("A" + a[1][0] + "C"))
print(("A" + input()[8] + "C"))
false
50
[ "-a = input().split()", "-print((\"A\" + a[1][0] + \"C\"))", "+print((\"A\" + input()[8] + \"C\"))" ]
false
0.045504
0.04605
0.988133
[ "s152389740", "s235196601" ]
u761320129
p03403
python
s255456738
s230454475
191
157
14,048
22,100
Accepted
Accepted
17.8
N = int(eval(input())) src = [0] + list(map(int,input().split())) + [0] cums = [0] for a,b in zip(src,src[1:]): cums.append(cums[-1] + abs(a-b)) for i in range(N): print((cums[i] + abs(src[i] - src[i+2]) - cums[i+2] + cums[-1]))
N = int(input()) A = [0] + list(map(int,input().split())) + [0] cuml = [0] for a,b in zip(A,A[1:]): cuml.append(cuml[-1] + abs(a-b)) cumr = [cuml[-1]-c for c in cuml[::-1]][::-1] ans = [cuml[i] + cumr[i+2] + abs(A[i] - A[i+2]) for i in range(N)] print(*ans, sep='\n')
8
9
239
280
N = int(eval(input())) src = [0] + list(map(int, input().split())) + [0] cums = [0] for a, b in zip(src, src[1:]): cums.append(cums[-1] + abs(a - b)) for i in range(N): print((cums[i] + abs(src[i] - src[i + 2]) - cums[i + 2] + cums[-1]))
N = int(input()) A = [0] + list(map(int, input().split())) + [0] cuml = [0] for a, b in zip(A, A[1:]): cuml.append(cuml[-1] + abs(a - b)) cumr = [cuml[-1] - c for c in cuml[::-1]][::-1] ans = [cuml[i] + cumr[i + 2] + abs(A[i] - A[i + 2]) for i in range(N)] print(*ans, sep="\n")
false
11.111111
[ "-N = int(eval(input()))", "-src = [0] + list(map(int, input().split())) + [0]", "-cums = [0]", "-for a, b in zip(src, src[1:]):", "- cums.append(cums[-1] + abs(a - b))", "-for i in range(N):", "- print((cums[i] + abs(src[i] - src[i + 2]) - cums[i + 2] + cums[-1]))", "+N = int(input())", "+A =...
false
0.0081
0.03819
0.212099
[ "s255456738", "s230454475" ]
u556589653
p02629
python
s222982214
s238544120
33
28
9,176
8,980
Accepted
Accepted
15.15
n = int(eval(input())) def num2alpha(num): if num<=26: return chr(64+num) elif num%26==0: return num2alpha(num//26-1)+chr(90) else: return num2alpha(num//26)+chr(64+num%26) print((num2alpha(n).lower()))
n = int(eval(input())) def sinsu(num): if num <= 26: return chr(64+num) elif num%26 == 0: return sinsu(num//26-1) + chr(90) else: return sinsu(num//26)+chr(64+num%26) print((sinsu(n).lower()))
9
9
238
210
n = int(eval(input())) def num2alpha(num): if num <= 26: return chr(64 + num) elif num % 26 == 0: return num2alpha(num // 26 - 1) + chr(90) else: return num2alpha(num // 26) + chr(64 + num % 26) print((num2alpha(n).lower()))
n = int(eval(input())) def sinsu(num): if num <= 26: return chr(64 + num) elif num % 26 == 0: return sinsu(num // 26 - 1) + chr(90) else: return sinsu(num // 26) + chr(64 + num % 26) print((sinsu(n).lower()))
false
0
[ "-def num2alpha(num):", "+def sinsu(num):", "- return num2alpha(num // 26 - 1) + chr(90)", "+ return sinsu(num // 26 - 1) + chr(90)", "- return num2alpha(num // 26) + chr(64 + num % 26)", "+ return sinsu(num // 26) + chr(64 + num % 26)", "-print((num2alpha(n).lower()))", "+...
false
0.032146
0.036147
0.889302
[ "s222982214", "s238544120" ]
u131984977
p02407
python
s887894057
s589558075
30
20
6,724
7,420
Accepted
Accepted
33.33
eval(input()) data = input().split() data.reverse() print((' '.join(data)))
eval(input()) a = input().split() a.reverse() print((" ".join(a)))
4
4
70
61
eval(input()) data = input().split() data.reverse() print((" ".join(data)))
eval(input()) a = input().split() a.reverse() print((" ".join(a)))
false
0
[ "-data = input().split()", "-data.reverse()", "-print((\" \".join(data)))", "+a = input().split()", "+a.reverse()", "+print((\" \".join(a)))" ]
false
0.046175
0.037609
1.227783
[ "s887894057", "s589558075" ]
u186838327
p03268
python
s382993897
s288403840
183
62
38,256
63,524
Accepted
Accepted
66.12
n, k = list(map(int, input().split())) if k%2 == 0: q1, r1 = divmod(n, k) if r1 < k//2: q2 = q1 else: q2 = q1+1 ans = q2**3 + q1**3 else: q1, r1 = divmod(n, k) ans = q1**3 #print(q1, q2) print(ans)
n, k = list(map(int, input().split())) if k%2 == 1: ans = (n//k)**3 print(ans) else: c = 0 for i in range(1, n+1): if i%k == k//2: c += 1 ans = c**3 ans += (n//k)**3 print(ans)
14
12
246
230
n, k = list(map(int, input().split())) if k % 2 == 0: q1, r1 = divmod(n, k) if r1 < k // 2: q2 = q1 else: q2 = q1 + 1 ans = q2**3 + q1**3 else: q1, r1 = divmod(n, k) ans = q1**3 # print(q1, q2) print(ans)
n, k = list(map(int, input().split())) if k % 2 == 1: ans = (n // k) ** 3 print(ans) else: c = 0 for i in range(1, n + 1): if i % k == k // 2: c += 1 ans = c**3 ans += (n // k) ** 3 print(ans)
false
14.285714
[ "-if k % 2 == 0:", "- q1, r1 = divmod(n, k)", "- if r1 < k // 2:", "- q2 = q1", "- else:", "- q2 = q1 + 1", "- ans = q2**3 + q1**3", "+if k % 2 == 1:", "+ ans = (n // k) ** 3", "+ print(ans)", "- q1, r1 = divmod(n, k)", "- ans = q1**3", "-# print(q1, q2)...
false
0.043204
0.044981
0.960504
[ "s382993897", "s288403840" ]
u796060588
p03611
python
s242689544
s809253400
284
113
35,636
27,092
Accepted
Accepted
60.21
# vim: set fileencoding=utf-8: from collections import Counter def main(): N = eval(input()) a = [int(ele) for ele in input().split()] a_plus = [ele + 1 for ele in a] a_minus = [ele - 1 for ele in a] ct = Counter(a) ct_plus = Counter(a_plus) ct_minus = Counter(a_minus) fo...
import collections def main(): N = int(eval(input())) a = [0] * (N * 3) i = 0 for ele in input().split(): ele = int(ele) a[i] = ele-1 i += 1 a[i] = ele i += 1 a[i] = ele+1 i += 1 ctr = collections.Counter(a) print((max(l...
24
22
503
377
# vim: set fileencoding=utf-8: from collections import Counter def main(): N = eval(input()) a = [int(ele) for ele in input().split()] a_plus = [ele + 1 for ele in a] a_minus = [ele - 1 for ele in a] ct = Counter(a) ct_plus = Counter(a_plus) ct_minus = Counter(a_minus) for k, v in list...
import collections def main(): N = int(eval(input())) a = [0] * (N * 3) i = 0 for ele in input().split(): ele = int(ele) a[i] = ele - 1 i += 1 a[i] = ele i += 1 a[i] = ele + 1 i += 1 ctr = collections.Counter(a) print((max(list(ctr.values...
false
8.333333
[ "-# vim: set fileencoding=utf-8:", "-from collections import Counter", "+import collections", "- N = eval(input())", "- a = [int(ele) for ele in input().split()]", "- a_plus = [ele + 1 for ele in a]", "- a_minus = [ele - 1 for ele in a]", "- ct = Counter(a)", "- ct_plus = Counter(a...
false
0.040193
0.030609
1.313123
[ "s242689544", "s809253400" ]
u562935282
p03274
python
s645430013
s054156080
117
93
14,544
14,252
Accepted
Accepted
20.51
# sys.stdin.readline() import sys input = sys.stdin.readline n, k = list(map(int, input().split())) x = list(map(int, input().split())) x_p = [0] + [p for p in x if p > 0]#正 x_z = x.count(0)#0 x_n = [(-1) * ng for ng in x if ng < 0]#負 x_n = [0] + sorted(x_n)#0から始まる絶対値 myK = k - x_z#左右に移動して点火するろうそく数 if...
n , k = list(map(int, input().split())) x = list(map(int, input().split())) ans = float('inf') for i in range(n - k + 1): ans = min( ans, abs(x[i]) + abs(x[i + k - 1] - x[i]), abs(x[i + k - 1]) + abs(x[i + k - 1] - x[i]) ) print(ans)
22
11
553
286
# sys.stdin.readline() import sys input = sys.stdin.readline n, k = list(map(int, input().split())) x = list(map(int, input().split())) x_p = [0] + [p for p in x if p > 0] # 正 x_z = x.count(0) # 0 x_n = [(-1) * ng for ng in x if ng < 0] # 負 x_n = [0] + sorted(x_n) # 0から始まる絶対値 myK = k - x_z # 左右に移動して点火するろうそく数 if m...
n, k = list(map(int, input().split())) x = list(map(int, input().split())) ans = float("inf") for i in range(n - k + 1): ans = min( ans, abs(x[i]) + abs(x[i + k - 1] - x[i]), abs(x[i + k - 1]) + abs(x[i + k - 1] - x[i]), ) print(ans)
false
50
[ "-# sys.stdin.readline()", "-import sys", "-", "-input = sys.stdin.readline", "-x_p = [0] + [p for p in x if p > 0] # 正", "-x_z = x.count(0) # 0", "-x_n = [(-1) * ng for ng in x if ng < 0] # 負", "-x_n = [0] + sorted(x_n) # 0から始まる絶対値", "-myK = k - x_z # 左右に移動して点火するろうそく数", "-if myK <= 0:", "-...
false
0.061519
0.156838
0.392245
[ "s645430013", "s054156080" ]
u401686269
p02658
python
s682353022
s712516627
79
56
21,568
21,768
Accepted
Accepted
29.11
N = int(eval(input())) A = list(map(int, input().split())) A.sort() prod = 1 for i in range(N): prod *= A[i] if prod > 10**18: prod = -1 break elif prod == 0: break print(prod)
N=int(eval(input())) *A,=list(map(int,input().split())) if min(A)==0: print((0)) exit() ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: print((-1)) exit() print(ans)
13
15
200
194
N = int(eval(input())) A = list(map(int, input().split())) A.sort() prod = 1 for i in range(N): prod *= A[i] if prod > 10**18: prod = -1 break elif prod == 0: break print(prod)
N = int(eval(input())) (*A,) = list(map(int, input().split())) if min(A) == 0: print((0)) exit() ans = 1 for i in range(N): ans *= A[i] if ans > 10**18: print((-1)) exit() print(ans)
false
13.333333
[ "-A = list(map(int, input().split()))", "-A.sort()", "-prod = 1", "+(*A,) = list(map(int, input().split()))", "+if min(A) == 0:", "+ print((0))", "+ exit()", "+ans = 1", "- prod *= A[i]", "- if prod > 10**18:", "- prod = -1", "- break", "- elif prod == 0:", "- ...
false
0.037618
0.098236
0.382932
[ "s682353022", "s712516627" ]
u492447501
p02773
python
s282341816
s799668434
779
682
32,096
32,096
Accepted
Accepted
12.45
N = int(eval(input())) d = {} max = 0 ans = [] for _ in range(N): key = eval(input()) if not(key in d): d[key] = 1 if max<d[key]: max = d[key] else: d[key] += 1 if max<d[key]: max = d[key] for key in d: if d[key]==max: a...
N = int(eval(input())) d = {} max = 0 for _ in range(N): S = eval(input()) if S in d: d[S] = d[S] + 1 if max < d[S]: max = d[S] continue d[S] = 1 if max < d[S]: max = d[S] ans = [] for key in d: if d[key]==max: ans.append(...
24
26
384
355
N = int(eval(input())) d = {} max = 0 ans = [] for _ in range(N): key = eval(input()) if not (key in d): d[key] = 1 if max < d[key]: max = d[key] else: d[key] += 1 if max < d[key]: max = d[key] for key in d: if d[key] == max: ans.append(key...
N = int(eval(input())) d = {} max = 0 for _ in range(N): S = eval(input()) if S in d: d[S] = d[S] + 1 if max < d[S]: max = d[S] continue d[S] = 1 if max < d[S]: max = d[S] ans = [] for key in d: if d[key] == max: ans.append(key) ans.sort() for a in...
false
7.692308
[ "+for _ in range(N):", "+ S = eval(input())", "+ if S in d:", "+ d[S] = d[S] + 1", "+ if max < d[S]:", "+ max = d[S]", "+ continue", "+ d[S] = 1", "+ if max < d[S]:", "+ max = d[S]", "-for _ in range(N):", "- key = eval(input())", "- i...
false
0.037577
0.03957
0.949637
[ "s282341816", "s799668434" ]
u077291787
p03038
python
s088631703
s109332261
413
333
33,628
23,224
Accepted
Accepted
19.37
# ABC127D - Integer Cards import sys input = sys.stdin.readline n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted([list(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x:x[1], reverse=True) ans = 0 idx = 0 flg = False for i,...
# ABC127D - Integer Cards import sys input = sys.stdin.readline 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...
23
23
574
575
# ABC127D - Integer Cards import sys input = sys.stdin.readline n, m = list(map(int, input().rstrip().split())) num = sorted(list(map(int, input().rstrip().split()))) lst = sorted( [list(map(int, input().rstrip().split())) for _ in range(m)], key=lambda x: x[1], reverse=True, ) ans = 0 idx = 0 flg = False ...
# ABC127D - Integer Cards import sys input = sys.stdin.readline 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
[ "- [list(map(int, input().rstrip().split())) for _ in range(m)],", "+ [tuple(map(int, input().rstrip().split())) for _ in range(m)]," ]
false
0.046086
0.042193
1.092278
[ "s088631703", "s109332261" ]
u312078744
p02990
python
s642904697
s562275086
880
32
14,752
3,444
Accepted
Accepted
96.36
from scipy.misc import comb # > comb(n, k, exact = True) nn, kk = list(map(int, input().split())) r = nn - kk b = kk p = 10 ** 9 + 7 # for nCk calculation ----------------------- ''' factorial = [0] * (nn + 1) factorial[0] = 1 for i in range(nn): factorial[i + 1] = factorial[i] * (i + 1) % p # 逆元 ...
nn, kk = list(map(int, input().split())) r = nn - kk b = kk p = 10 ** 9 + 7 # for nCk calculation ----------------------- factorial = [0] * (nn + 1) factorial[0] = 1 for i in range(nn): factorial[i + 1] = factorial[i] * (i + 1) % p # 逆元 def cmb(n, k): # if (n == 1 or k == 1): if (n == 0 ...
36
35
821
795
from scipy.misc import comb # > comb(n, k, exact = True) nn, kk = list(map(int, input().split())) r = nn - kk b = kk p = 10**9 + 7 # for nCk calculation ----------------------- """ factorial = [0] * (nn + 1) factorial[0] = 1 for i in range(nn): factorial[i + 1] = factorial[i] * (i + 1) % p # 逆元 def cmb(n, k): ...
nn, kk = list(map(int, input().split())) r = nn - kk b = kk p = 10**9 + 7 # for nCk calculation ----------------------- factorial = [0] * (nn + 1) factorial[0] = 1 for i in range(nn): factorial[i + 1] = factorial[i] * (i + 1) % p # 逆元 def cmb(n, k): # if (n == 1 or k == 1): if n == 0 or k == 0: retu...
false
2.777778
[ "-from scipy.misc import comb", "-", "-# > comb(n, k, exact = True)", "-\"\"\"", "- if (n == 0 or k == 0):", "+ if n == 0 or k == 0:", "- if (n < 0 or k < 0):", "+ if n < 0 or k < 0:", "- return factorial[n] * pow(factorial[n - k], p - 2, p) * pow(factorial[k], p - 2, p) % p", "-\"\...
false
0.412825
0.034804
11.861542
[ "s642904697", "s562275086" ]
u367701763
p02763
python
s783202076
s322601678
590
215
286,624
118,980
Accepted
Accepted
63.56
import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.n = n self.tree = [0]*(n+1) self.el = [0]*(n+1) self.depth = n.bit_length() - 1 def sum(self, i): """ 区間[0,i) の総和を求める """ s = 0 i -= 1 while i >= 0: ...
# https://atcoder.jp/contests/abc157/tasks/abc157_e import sys input = sys.stdin.readline class SegmentTree: def __init__(self, n, op, e): """ :param n: 要素数 :param op: 二項演算 :param e: 単位減 例) 区間最小値 SegmentTree(n, lambda a, b : a if a < b else b, 10 ** 18) ...
103
73
2,922
2,086
import sys input = sys.stdin.readline class Bit: def __init__(self, n): self.n = n self.tree = [0] * (n + 1) self.el = [0] * (n + 1) self.depth = n.bit_length() - 1 def sum(self, i): """区間[0,i) の総和を求める""" s = 0 i -= 1 while i >= 0: ...
# https://atcoder.jp/contests/abc157/tasks/abc157_e import sys input = sys.stdin.readline class SegmentTree: def __init__(self, n, op, e): """ :param n: 要素数 :param op: 二項演算 :param e: 単位減 例) 区間最小値 SegmentTree(n, lambda a, b : a if a < b else b, 10 ** 18) 区間和 ...
false
29.126214
[ "+# https://atcoder.jp/contests/abc157/tasks/abc157_e", "-class Bit:", "- def __init__(self, n):", "+class SegmentTree:", "+ def __init__(self, n, op, e):", "+ \"\"\"", "+ :param n: 要素数", "+ :param op: 二項演算", "+ :param e: 単位減", "+ 例) 区間最小値 SegmentTree(n, l...
false
0.053574
0.046437
1.153694
[ "s783202076", "s322601678" ]
u565204025
p03470
python
s177324586
s963346978
164
17
38,384
2,940
Accepted
Accepted
89.63
# -*- coding: utf-8 -*- n = int(eval(input())) d = [0] * n for i in range(n): d[i] = int(eval(input())) d = set(d) d = list(d) d.sort() print((len(d)))
# -*- coding: utf-8 -*- n = int(eval(input())) d = [0] * n for i in range(n): d[i] = int(eval(input())) d = set(d) d = list(d) print((len(d)))
12
11
156
146
# -*- coding: utf-8 -*- n = int(eval(input())) d = [0] * n for i in range(n): d[i] = int(eval(input())) d = set(d) d = list(d) d.sort() print((len(d)))
# -*- coding: utf-8 -*- n = int(eval(input())) d = [0] * n for i in range(n): d[i] = int(eval(input())) d = set(d) d = list(d) print((len(d)))
false
8.333333
[ "-d.sort()" ]
false
0.042566
0.041675
1.021389
[ "s177324586", "s963346978" ]
u564902833
p03048
python
s153475648
s621866543
237
209
41,580
40,812
Accepted
Accepted
11.81
R, G, B, N = list(map(int, input().split())) ans = sum( (N - r * R - g * G) >= 0 and (N - r * R - g * G) % B == 0 for r in range(N + 1) for g in range(N - r * R + 1) ) print(ans)
# 入力 R, G, B, N = list(map(int, input().split())) # とりうるすべてのr, gの組に関して、条件を満たすbが存在するかを数え上げる ans = sum( N - r * R - g * G >= 0 and (N - r * R - g * G) % B == 0 for r in range(N // R + 1) for g in range((N - r * R) // G + 1) ) # 出力 print(ans)
6
12
186
258
R, G, B, N = list(map(int, input().split())) ans = sum( (N - r * R - g * G) >= 0 and (N - r * R - g * G) % B == 0 for r in range(N + 1) for g in range(N - r * R + 1) ) print(ans)
# 入力 R, G, B, N = list(map(int, input().split())) # とりうるすべてのr, gの組に関して、条件を満たすbが存在するかを数え上げる ans = sum( N - r * R - g * G >= 0 and (N - r * R - g * G) % B == 0 for r in range(N // R + 1) for g in range((N - r * R) // G + 1) ) # 出力 print(ans)
false
50
[ "+# 入力", "+# とりうるすべてのr, gの組に関して、条件を満たすbが存在するかを数え上げる", "- (N - r * R - g * G) >= 0 and (N - r * R - g * G) % B == 0", "- for r in range(N + 1)", "- for g in range(N - r * R + 1)", "+ N - r * R - g * G >= 0 and (N - r * R - g * G) % B == 0", "+ for r in range(N // R + 1)", "+ for g in ...
false
0.209803
0.092386
2.270948
[ "s153475648", "s621866543" ]
u644907318
p02860
python
s979053822
s343603488
174
65
38,464
61,860
Accepted
Accepted
62.64
N = int(eval(input())) S = input().strip() if N%2==1: flag = "No" else: if S[:N//2]==S[N//2:]: flag = "Yes" else: flag = "No" print(flag)
N = int(eval(input())) S = input().strip() if N%2==1: print("No") else: if S[:N//2]==S[N//2:]: print("Yes") else: print("No")
10
9
168
155
N = int(eval(input())) S = input().strip() if N % 2 == 1: flag = "No" else: if S[: N // 2] == S[N // 2 :]: flag = "Yes" else: flag = "No" print(flag)
N = int(eval(input())) S = input().strip() if N % 2 == 1: print("No") else: if S[: N // 2] == S[N // 2 :]: print("Yes") else: print("No")
false
10
[ "- flag = \"No\"", "+ print(\"No\")", "- flag = \"Yes\"", "+ print(\"Yes\")", "- flag = \"No\"", "-print(flag)", "+ print(\"No\")" ]
false
0.040146
0.071611
0.560607
[ "s979053822", "s343603488" ]
u773265208
p02912
python
s016896307
s759215252
405
161
73,196
14,180
Accepted
Accepted
60.25
import heapq import math n,m = list(map(int,input().split())) a = list(map(int,input().split())) a = [-1*num for num in a] heapq.heapify(a) for i in range(m): maximum = heapq.heappop(a) add = math.trunc(maximum/2) heapq.heappush(a,add) print((-1 * sum(a)))
import heapq n,m = list(map(int,input().split())) a = list(map(int,input().split())) a = [-1*i for i in a] heapq.heapify(a) for i in range(m): max_a = -1 * heapq.heappop(a) heapq.heappush(a,-1 *(max_a // 2)) print((-1 * sum(a)))
16
14
272
241
import heapq import math n, m = list(map(int, input().split())) a = list(map(int, input().split())) a = [-1 * num for num in a] heapq.heapify(a) for i in range(m): maximum = heapq.heappop(a) add = math.trunc(maximum / 2) heapq.heappush(a, add) print((-1 * sum(a)))
import heapq n, m = list(map(int, input().split())) a = list(map(int, input().split())) a = [-1 * i for i in a] heapq.heapify(a) for i in range(m): max_a = -1 * heapq.heappop(a) heapq.heappush(a, -1 * (max_a // 2)) print((-1 * sum(a)))
false
12.5
[ "-import math", "-a = [-1 * num for num in a]", "+a = [-1 * i for i in a]", "- maximum = heapq.heappop(a)", "- add = math.trunc(maximum / 2)", "- heapq.heappush(a, add)", "+ max_a = -1 * heapq.heappop(a)", "+ heapq.heappush(a, -1 * (max_a // 2))" ]
false
0.071526
0.153235
0.466769
[ "s016896307", "s759215252" ]
u678167152
p02937
python
s838844631
s877773558
125
107
7,600
13,492
Accepted
Accepted
14.4
S = eval(input()) T = eval(input()) dic = {} for i,s in enumerate(S): if s not in dic: dic[s] = [i] else: dic[s].append(i) #print(dic) ind = -1 loop = 0 import bisect for t in T: if t not in dic: ans = -1 break if dic[t][-1]<=ind: loop += 1 ind = dic[t][0] else: ...
from bisect import * def alph_to_num(s): return ord(s)-ord('a') def solve(): ans = 0 S = eval(input()) T = eval(input()) lis = [[] for _ in range(26)] for i,s in enumerate(S): lis[alph_to_num(s)].append(i) ind = -1 for t in T: n = alph_to_num(t) if not len(lis[n]): return...
30
23
490
483
S = eval(input()) T = eval(input()) dic = {} for i, s in enumerate(S): if s not in dic: dic[s] = [i] else: dic[s].append(i) # print(dic) ind = -1 loop = 0 import bisect for t in T: if t not in dic: ans = -1 break if dic[t][-1] <= ind: loop += 1 ind = dic[...
from bisect import * def alph_to_num(s): return ord(s) - ord("a") def solve(): ans = 0 S = eval(input()) T = eval(input()) lis = [[] for _ in range(26)] for i, s in enumerate(S): lis[alph_to_num(s)].append(i) ind = -1 for t in T: n = alph_to_num(t) if not len(...
false
23.333333
[ "-S = eval(input())", "-T = eval(input())", "-dic = {}", "-for i, s in enumerate(S):", "- if s not in dic:", "- dic[s] = [i]", "- else:", "- dic[s].append(i)", "-# print(dic)", "-ind = -1", "-loop = 0", "-import bisect", "+from bisect import *", "-for t in T:", "- ...
false
0.034798
0.037534
0.927096
[ "s838844631", "s877773558" ]
u512212329
p02556
python
s676044013
s903622562
524
399
39,440
24,952
Accepted
Accepted
23.85
def main(): point_count = int(eval(input())) sums = set() diffs = set() for _ in range(point_count): x, y = [int(x) for x in input().split()] sums.add(x + y) diffs.add(x - y) pat_sum = max(sums) - min(sums) # max (Xi + Yi) - (Xj + Yj) pat_diff = max(diffs) - min...
def main(): point_count = int(eval(input())) sums = [] diffs = [] for _ in range(point_count): x, y = [int(x) for x in input().split()] sums.append(x + y) diffs.append(x - y) pat_sum = max(sums) - min(sums) # max (Xi + Yi) - (Xj + Yj) pat_diff = max(diffs) - min...
15
15
437
437
def main(): point_count = int(eval(input())) sums = set() diffs = set() for _ in range(point_count): x, y = [int(x) for x in input().split()] sums.add(x + y) diffs.add(x - y) pat_sum = max(sums) - min(sums) # max (Xi + Yi) - (Xj + Yj) pat_diff = max(diffs) - min(diffs) ...
def main(): point_count = int(eval(input())) sums = [] diffs = [] for _ in range(point_count): x, y = [int(x) for x in input().split()] sums.append(x + y) diffs.append(x - y) pat_sum = max(sums) - min(sums) # max (Xi + Yi) - (Xj + Yj) pat_diff = max(diffs) - min(diffs) ...
false
0
[ "- sums = set()", "- diffs = set()", "+ sums = []", "+ diffs = []", "- sums.add(x + y)", "- diffs.add(x - y)", "+ sums.append(x + y)", "+ diffs.append(x - y)" ]
false
0.053656
0.067342
0.796763
[ "s676044013", "s903622562" ]
u920543723
p04031
python
s291866800
s552785981
25
17
2,940
2,940
Accepted
Accepted
32
n = int(eval(input())) a = list(map(int, input().split())) cost = [0] * 201 for i in range(201): for j in a: cost[i] += ((i - 100) - j) ** 2 print((min(cost)))
n = int(eval(input())) A = [int(i) for i in input().split()] ave = round(sum(A) / n) ans = 0 for x in A: ans += (x-ave)**2 print(ans)
9
7
173
137
n = int(eval(input())) a = list(map(int, input().split())) cost = [0] * 201 for i in range(201): for j in a: cost[i] += ((i - 100) - j) ** 2 print((min(cost)))
n = int(eval(input())) A = [int(i) for i in input().split()] ave = round(sum(A) / n) ans = 0 for x in A: ans += (x - ave) ** 2 print(ans)
false
22.222222
[ "-a = list(map(int, input().split()))", "-cost = [0] * 201", "-for i in range(201):", "- for j in a:", "- cost[i] += ((i - 100) - j) ** 2", "-print((min(cost)))", "+A = [int(i) for i in input().split()]", "+ave = round(sum(A) / n)", "+ans = 0", "+for x in A:", "+ ans += (x - ave) **...
false
0.036499
0.12881
0.283356
[ "s291866800", "s552785981" ]
u639104973
p03060
python
s944192565
s926184497
150
17
12,488
3,060
Accepted
Accepted
88.67
import numpy as np N=int(eval(input())) vs=list(map(int, input().split())) cs=list(map(int, input().split())) s=[v-c for v,c in zip(vs,cs) if v-c>0] print((sum(s)))
N=int(eval(input())) vs=list(map(int, input().split())) cs=list(map(int, input().split())) s=[v-c for v,c in zip(vs,cs) if v-c>0] print((sum(s)))
6
5
161
141
import numpy as np N = int(eval(input())) vs = list(map(int, input().split())) cs = list(map(int, input().split())) s = [v - c for v, c in zip(vs, cs) if v - c > 0] print((sum(s)))
N = int(eval(input())) vs = list(map(int, input().split())) cs = list(map(int, input().split())) s = [v - c for v, c in zip(vs, cs) if v - c > 0] print((sum(s)))
false
16.666667
[ "-import numpy as np", "-" ]
false
0.037299
0.084889
0.439384
[ "s944192565", "s926184497" ]
u065137691
p02724
python
s953348643
s318761821
405
261
2,940
9,160
Accepted
Accepted
35.56
num = (int(eval(input()))) ans1 = 0 ans2 = 0 while num >= 500: ans1 += 1 num -= 500 while num >= 5: ans2 += 1 num -= 5 print(((ans1*1000)+(ans2*5)))
x = int(eval(input())) count = 0 while x >= 500: count += 1000 x -= 500 while x >= 5: count += 5 x -= 5 print(count)
12
12
169
140
num = int(eval(input())) ans1 = 0 ans2 = 0 while num >= 500: ans1 += 1 num -= 500 while num >= 5: ans2 += 1 num -= 5 print(((ans1 * 1000) + (ans2 * 5)))
x = int(eval(input())) count = 0 while x >= 500: count += 1000 x -= 500 while x >= 5: count += 5 x -= 5 print(count)
false
0
[ "-num = int(eval(input()))", "-ans1 = 0", "-ans2 = 0", "-while num >= 500:", "- ans1 += 1", "- num -= 500", "-while num >= 5:", "- ans2 += 1", "- num -= 5", "-print(((ans1 * 1000) + (ans2 * 5)))", "+x = int(eval(input()))", "+count = 0", "+while x >= 500:", "+ count += 1000"...
false
0.082975
0.161627
0.513374
[ "s953348643", "s318761821" ]
u078276601
p02607
python
s358068991
s807891609
34
24
9,100
9,160
Accepted
Accepted
29.41
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for i in range(N): if i%2 == 0 and A[i]%2 != 0: cnt += 1 else: continue print(cnt)
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for i in range(0, N, 2): if A[i]%2 != 0: cnt += 1 print(cnt)
11
8
179
140
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for i in range(N): if i % 2 == 0 and A[i] % 2 != 0: cnt += 1 else: continue print(cnt)
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for i in range(0, N, 2): if A[i] % 2 != 0: cnt += 1 print(cnt)
false
27.272727
[ "-for i in range(N):", "- if i % 2 == 0 and A[i] % 2 != 0:", "+for i in range(0, N, 2):", "+ if A[i] % 2 != 0:", "- else:", "- continue" ]
false
0.070117
0.036369
1.927969
[ "s358068991", "s807891609" ]
u393512980
p02949
python
s312034429
s930441516
1,272
1,083
63,964
61,532
Accepted
Accepted
14.86
import sys sys.setrecursionlimit(10000000) def input(): return sys.stdin.readline()[:-1] from bisect import * from collections import * from heapq import * from math import * from itertools import * INF = float('inf') def bellmanford(edges, s, t, se): N = len(edges) dist = [INF] * N dist[...
import sys sys.setrecursionlimit(10000000) def input(): return sys.stdin.readline()[:-1] from bisect import * from collections import * from heapq import * from math import * from itertools import * INF = float('inf') def bellmanford(edges, s, t, se): N = len(edges) dist = [INF] * N dist[...
58
58
1,438
1,441
import sys sys.setrecursionlimit(10000000) def input(): return sys.stdin.readline()[:-1] from bisect import * from collections import * from heapq import * from math import * from itertools import * INF = float("inf") def bellmanford(edges, s, t, se): N = len(edges) dist = [INF] * N dist[s] = 0 ...
import sys sys.setrecursionlimit(10000000) def input(): return sys.stdin.readline()[:-1] from bisect import * from collections import * from heapq import * from math import * from itertools import * INF = float("inf") def bellmanford(edges, s, t, se): N = len(edges) dist = [INF] * N dist[s] = 0 ...
false
0
[ "- if v in se and dist[v] == INF:", "+ if v not in se or dist[v] == INF:" ]
false
0.075305
0.079836
0.943252
[ "s312034429", "s930441516" ]
u879870653
p03370
python
s058996739
s406361472
358
17
2,940
2,940
Accepted
Accepted
95.25
N,X = list(map(int,input().split())) M = [] for i in range(N) : m = int(eval(input())) M.append(m) ans = N X -= sum(M) while X >= min(M) : ans += 1 X -= min(M) print(ans)
N,X = list(map(int,input().split())) M = [] for i in range(N) : M.append(int(eval(input()))) ans = ((X-sum(M))//min(M))+N print(ans)
12
8
187
139
N, X = list(map(int, input().split())) M = [] for i in range(N): m = int(eval(input())) M.append(m) ans = N X -= sum(M) while X >= min(M): ans += 1 X -= min(M) print(ans)
N, X = list(map(int, input().split())) M = [] for i in range(N): M.append(int(eval(input()))) ans = ((X - sum(M)) // min(M)) + N print(ans)
false
33.333333
[ "- m = int(eval(input()))", "- M.append(m)", "-ans = N", "-X -= sum(M)", "-while X >= min(M):", "- ans += 1", "- X -= min(M)", "+ M.append(int(eval(input())))", "+ans = ((X - sum(M)) // min(M)) + N" ]
false
0.078484
0.033574
2.337624
[ "s058996739", "s406361472" ]
u841621946
p03835
python
s300880864
s273922923
1,777
1,293
3,060
2,940
Accepted
Accepted
27.24
K, S = list(map(int,input().split())) ans = 0 for i in range(K+1): tmp = S - i if tmp >= 0: for j in range(K+1): if (S - i - j) >= 0 and (S - i -j) <= K: ans += 1 print(ans)
K, S = tmp = list(map(int,input().split())) ans = 0 for i in range(K+1): for j in range(K+1): if 0 <= S - i - j <= K: ans += 1 print(ans)
9
7
225
168
K, S = list(map(int, input().split())) ans = 0 for i in range(K + 1): tmp = S - i if tmp >= 0: for j in range(K + 1): if (S - i - j) >= 0 and (S - i - j) <= K: ans += 1 print(ans)
K, S = tmp = list(map(int, input().split())) ans = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= S - i - j <= K: ans += 1 print(ans)
false
22.222222
[ "-K, S = list(map(int, input().split()))", "+K, S = tmp = list(map(int, input().split()))", "- tmp = S - i", "- if tmp >= 0:", "- for j in range(K + 1):", "- if (S - i - j) >= 0 and (S - i - j) <= K:", "- ans += 1", "+ for j in range(K + 1):", "+ if 0...
false
0.006845
0.031899
0.214579
[ "s300880864", "s273922923" ]