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
u729133443
p03731
python
s382027154
s766317229
272
131
99,404
25,132
Accepted
Accepted
51.84
n,T,*t=list(map(int,open(0).read().split()));print((T+sum(min(j-i,T)for i,j in zip(t,t[1:]))))
_,T,b,*t=list(map(int,open(0).read().split())) a=T for i in t:a+=min(i-b,T);b=i print(a)
1
4
86
85
n, T, *t = list(map(int, open(0).read().split())) print((T + sum(min(j - i, T) for i, j in zip(t, t[1:]))))
_, T, b, *t = list(map(int, open(0).read().split())) a = T for i in t: a += min(i - b, T) b = i print(a)
false
75
[ "-n, T, *t = list(map(int, open(0).read().split()))", "-print((T + sum(min(j - i, T) for i, j in zip(t, t[1:]))))", "+_, T, b, *t = list(map(int, open(0).read().split()))", "+a = T", "+for i in t:", "+ a += min(i - b, T)", "+ b = i", "+print(a)" ]
false
0.123183
0.04079
3.019951
[ "s382027154", "s766317229" ]
u934442292
p02899
python
s349719606
s749253541
89
77
15,588
24,364
Accepted
Accepted
13.48
N = int(eval(input())) A = [int(i) for i in input().split()] res = [""] * N for i in range(N): res[A[i]-1] = str(i+1) print((" ".join(res)))
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for i, a in enumerate(A, 1): ans[a - 1] = i print((" ".join(map(str, ans)))) if __name__ == "__main__": main()
8
18
144
282
N = int(eval(input())) A = [int(i) for i in input().split()] res = [""] * N for i in range(N): res[A[i] - 1] = str(i + 1) print((" ".join(res)))
import sys input = sys.stdin.readline def main(): N = int(eval(input())) A = list(map(int, input().split())) ans = [0] * N for i, a in enumerate(A, 1): ans[a - 1] = i print((" ".join(map(str, ans)))) if __name__ == "__main__": main()
false
55.555556
[ "-N = int(eval(input()))", "-A = [int(i) for i in input().split()]", "-res = [\"\"] * N", "-for i in range(N):", "- res[A[i] - 1] = str(i + 1)", "-print((\" \".join(res)))", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def main():", "+ N = int(eval(input()))", "+ ...
false
0.041799
0.042073
0.993483
[ "s349719606", "s749253541" ]
u724687935
p03014
python
s309570445
s053399769
960
715
179,332
179,332
Accepted
Accepted
25.52
H, W = list(map(int, input().split())) grid = [eval(input()) for _ in range(H)] light = [0] * 4 * (W + 1) * (H + 1) row = 4 * (W + 1) col = 4 for h in range(H): for w in range(W): if grid[h][w] == '.': here = row * h + col * w light[row * (h + 1) + col * w + 1] = light...
H, W = list(map(int, input().split())) grid = [eval(input()) for _ in range(H)] L = [[0] * (W + 1) for _ in range(H + 1)] R = [[0] * (W + 1) for _ in range(H + 1)] A = [[0] * (W + 1) for _ in range(H + 1)] B = [[0] * (W + 1) for _ in range(H + 1)] for h in range(H): for w in range(W): if grid[h]...
25
26
755
736
H, W = list(map(int, input().split())) grid = [eval(input()) for _ in range(H)] light = [0] * 4 * (W + 1) * (H + 1) row = 4 * (W + 1) col = 4 for h in range(H): for w in range(W): if grid[h][w] == ".": here = row * h + col * w light[row * (h + 1) + col * w + 1] = light[here + 1] + 1 ...
H, W = list(map(int, input().split())) grid = [eval(input()) for _ in range(H)] L = [[0] * (W + 1) for _ in range(H + 1)] R = [[0] * (W + 1) for _ in range(H + 1)] A = [[0] * (W + 1) for _ in range(H + 1)] B = [[0] * (W + 1) for _ in range(H + 1)] for h in range(H): for w in range(W): if grid[h][w] == ".": ...
false
3.846154
[ "-light = [0] * 4 * (W + 1) * (H + 1)", "-row = 4 * (W + 1)", "-col = 4", "+L = [[0] * (W + 1) for _ in range(H + 1)]", "+R = [[0] * (W + 1) for _ in range(H + 1)]", "+A = [[0] * (W + 1) for _ in range(H + 1)]", "+B = [[0] * (W + 1) for _ in range(H + 1)]", "- here = row * h + col * w", "...
false
0.087809
0.105224
0.83449
[ "s309570445", "s053399769" ]
u484229314
p03854
python
s304537086
s988259423
76
32
3,188
3,188
Accepted
Accepted
57.89
S = input()[::-1] W = [] for w in ['dreamer', 'eraser', 'erase', 'dream']: W.append(w[::-1]) while 1: flg = False for w in W: if S.startswith(w): S = S[len(w):] flg = True if not flg: print('NO') exit() if not S: break print(...
S = input()[::-1] W = [] for w in ['dreamer', 'eraser', 'erase', 'dream']: W.append(w[::-1]) idx = 0 while 1: flg = False for w in W: if S.startswith(w, idx): idx += len(w) flg = True if not flg: print('NO') exit() if len(S) <= idx: ...
18
19
327
348
S = input()[::-1] W = [] for w in ["dreamer", "eraser", "erase", "dream"]: W.append(w[::-1]) while 1: flg = False for w in W: if S.startswith(w): S = S[len(w) :] flg = True if not flg: print("NO") exit() if not S: break print("YES")
S = input()[::-1] W = [] for w in ["dreamer", "eraser", "erase", "dream"]: W.append(w[::-1]) idx = 0 while 1: flg = False for w in W: if S.startswith(w, idx): idx += len(w) flg = True if not flg: print("NO") exit() if len(S) <= idx: break print...
false
5.263158
[ "+idx = 0", "- if S.startswith(w):", "- S = S[len(w) :]", "+ if S.startswith(w, idx):", "+ idx += len(w)", "- if not S:", "+ if len(S) <= idx:" ]
false
0.048838
0.048908
0.998578
[ "s304537086", "s988259423" ]
u018258333
p02712
python
s875366206
s162029088
175
157
29,768
9,148
Accepted
Accepted
10.29
n = int(eval(input())) l = [] for i in range(1,n+1): if i % 3 == 0: continue elif i % 5 == 0: continue else: l.append(i) print((sum(l)))
n = int(eval(input())) l = 0 for i in range(1,n+1): if i % 3 == 0 or i % 5 == 0: continue else: l+=i print(l)
12
9
159
124
n = int(eval(input())) l = [] for i in range(1, n + 1): if i % 3 == 0: continue elif i % 5 == 0: continue else: l.append(i) print((sum(l)))
n = int(eval(input())) l = 0 for i in range(1, n + 1): if i % 3 == 0 or i % 5 == 0: continue else: l += i print(l)
false
25
[ "-l = []", "+l = 0", "- if i % 3 == 0:", "- continue", "- elif i % 5 == 0:", "+ if i % 3 == 0 or i % 5 == 0:", "- l.append(i)", "-print((sum(l)))", "+ l += i", "+print(l)" ]
false
0.162943
0.167748
0.971355
[ "s875366206", "s162029088" ]
u254871849
p03222
python
s082183844
s106872265
24
18
3,064
3,188
Accepted
Accepted
25
import sys MOD = 10 ** 9 + 7 h, w, k = list(map(int, sys.stdin.readline().split())) def main(): ok = [] for i in range(2 ** (w - 1)): prev = False for j in range(w-1): if i >> j & 1: if prev: break else: ...
import sys MOD = 10 ** 9 + 7 h, w, k = list(map(int, sys.stdin.readline().split())) def main(): if w == 1: return 1 ok = [] for i in range(2 ** (w - 1)): prev = False for j in range(w-1): if i >> j & 1: if prev: ...
44
57
983
1,379
import sys MOD = 10**9 + 7 h, w, k = list(map(int, sys.stdin.readline().split())) def main(): ok = [] for i in range(2 ** (w - 1)): prev = False for j in range(w - 1): if i >> j & 1: if prev: break else: prev ...
import sys MOD = 10**9 + 7 h, w, k = list(map(int, sys.stdin.readline().split())) def main(): if w == 1: return 1 ok = [] for i in range(2 ** (w - 1)): prev = False for j in range(w - 1): if i >> j & 1: if prev: break ...
false
22.807018
[ "+ if w == 1:", "+ return 1", "+ lcr = [(letter, 0) for letter in \"lcr\"]", "+ a = [dict(lcr) for _ in range(w)]", "+ for i in ok:", "+ j = 0", "+ while j < w:", "+ if i >> j & 1:", "+ a[j][\"r\"] += 1", "+ a[j + 1][\"l\"] ...
false
0.033712
0.034967
0.964105
[ "s082183844", "s106872265" ]
u150984829
p00481
python
s819298959
s381011728
2,470
2,150
14,944
14,952
Accepted
Accepted
12.96
from collections import deque H,W,N=list(map(int,input().split())) e='X'*(W+2) M=e+''.join('X'+eval(input())+'X'for _ in[0]*H)+e m=(1,-1,W+2,-W-2) def f(s,g): p,t=s,0 q=deque() b=[1]*len(M);b[s]=0 while 1: for d in m: n=p+d if'X'!=M[n]and b[n]: if M[n]==g:return(n,t+1) b[n]=0;q.append(...
def v(): from collections import deque H,W,N=list(map(int,input().split())) e='X'*(W+2) M=e+''.join('X'+eval(input())+'X'for _ in[0]*H)+e m=(1,-1,W+2,-W-2) def f(s,g): p,t=s,0 q=deque() b=[1]*len(M);b[s]=0 while 1: for d in m: n=p+d if'X'!=M[n]and b[n]: if M[n]==g:return(n,t+...
22
24
415
475
from collections import deque H, W, N = list(map(int, input().split())) e = "X" * (W + 2) M = e + "".join("X" + eval(input()) + "X" for _ in [0] * H) + e m = (1, -1, W + 2, -W - 2) def f(s, g): p, t = s, 0 q = deque() b = [1] * len(M) b[s] = 0 while 1: for d in m: n = p + d ...
def v(): from collections import deque H, W, N = list(map(int, input().split())) e = "X" * (W + 2) M = e + "".join("X" + eval(input()) + "X" for _ in [0] * H) + e m = (1, -1, W + 2, -W - 2) def f(s, g): p, t = s, 0 q = deque() b = [1] * len(M) b[s] = 0 w...
false
8.333333
[ "-from collections import deque", "+def v():", "+ from collections import deque", "-H, W, N = list(map(int, input().split()))", "-e = \"X\" * (W + 2)", "-M = e + \"\".join(\"X\" + eval(input()) + \"X\" for _ in [0] * H) + e", "-m = (1, -1, W + 2, -W - 2)", "+ H, W, N = list(map(int, input().spli...
false
0.039475
0.038734
1.019124
[ "s819298959", "s381011728" ]
u527848444
p02408
python
s413105275
s132221010
40
30
6,724
6,724
Accepted
Accepted
25
data = { 'S': [int(x) for x in range(1,14)], 'H': [int(x) for x in range(1,14)], 'C': [int(x) for x in range(1,14)], 'D': [int(x) for x in range(1,14)] } count = int(eval(input())) for c in range(count): (s, r) = input().split() r = int(r) del data[...
cards = { 'S': [0 for _ in range(13)], 'H': [0 for _ in range(13)], 'C': [0 for _ in range(13)], 'D': [0 for _ in range(13)], } n = int(eval(input())) for _ in range(n): (s, r) = input().split() cards[s][int(r) - 1] = 1 for s in ('S', 'H', 'C', 'D'): for r in ra...
19
15
416
381
data = { "S": [int(x) for x in range(1, 14)], "H": [int(x) for x in range(1, 14)], "C": [int(x) for x in range(1, 14)], "D": [int(x) for x in range(1, 14)], } count = int(eval(input())) for c in range(count): (s, r) = input().split() r = int(r) del data[s][data[s].index(r)] for i in ("S", "H...
cards = { "S": [0 for _ in range(13)], "H": [0 for _ in range(13)], "C": [0 for _ in range(13)], "D": [0 for _ in range(13)], } n = int(eval(input())) for _ in range(n): (s, r) = input().split() cards[s][int(r) - 1] = 1 for s in ("S", "H", "C", "D"): for r in range(13): if cards[s][r...
false
21.052632
[ "-data = {", "- \"S\": [int(x) for x in range(1, 14)],", "- \"H\": [int(x) for x in range(1, 14)],", "- \"C\": [int(x) for x in range(1, 14)],", "- \"D\": [int(x) for x in range(1, 14)],", "+cards = {", "+ \"S\": [0 for _ in range(13)],", "+ \"H\": [0 for _ in range(13)],", "+ \...
false
0.042259
0.035946
1.175622
[ "s413105275", "s132221010" ]
u156815136
p03986
python
s939027221
s849393107
82
68
10,500
10,516
Accepted
Accepted
17.07
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Counte...
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdi...
38
41
847
936
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate # (string,3) 3回 # from collections import deque from collections import deque, defaultdict, Co...
# from statistics import median # import collections # aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations, permutations, accumulate, product # (string,3) 3回 # from collections import deque from collections import deque, defaul...
false
7.317073
[ "-from itertools import combinations, permutations, accumulate # (string,3) 3回", "+from itertools import combinations, permutations, accumulate, product # (string,3) 3回", "+import decimal", "+import re", "+# my_round_int = lambda x:np.round((x*2 + 1)//2)", "+# 四捨五入g", "-mod = 10**9 + 7", "+# mod = 1...
false
0.038229
0.103513
0.36932
[ "s939027221", "s849393107" ]
u931636178
p03337
python
s530746760
s540012668
19
17
3,316
2,940
Accepted
Accepted
10.53
A, B = list(map(int,input().split(" "))) print((max(A+B,A-B,A*B)))
a,b = list(map(int,input().split())) print((max(a+b,a-b,a*b)))
2
2
59
55
A, B = list(map(int, input().split(" "))) print((max(A + B, A - B, A * B)))
a, b = list(map(int, input().split())) print((max(a + b, a - b, a * b)))
false
0
[ "-A, B = list(map(int, input().split(\" \")))", "-print((max(A + B, A - B, A * B)))", "+a, b = list(map(int, input().split()))", "+print((max(a + b, a - b, a * b)))" ]
false
0.042574
0.042953
0.991158
[ "s530746760", "s540012668" ]
u073549161
p03563
python
s655317540
s279745259
169
17
38,256
2,940
Accepted
Accepted
89.94
r = int(eval(input())) g = int(eval(input())) x = (2*g) - r print(x)
r = int(eval(input())) g = int(eval(input())) print((r + (g-r)*2))
4
3
59
54
r = int(eval(input())) g = int(eval(input())) x = (2 * g) - r print(x)
r = int(eval(input())) g = int(eval(input())) print((r + (g - r) * 2))
false
25
[ "-x = (2 * g) - r", "-print(x)", "+print((r + (g - r) * 2))" ]
false
0.142093
0.043484
3.26773
[ "s655317540", "s279745259" ]
u058433718
p02393
python
s742104163
s805199166
40
20
7,744
5,608
Accepted
Accepted
50
import sys data = sys.stdin.readline().strip().split(' ') nums = [int(i) for i in data] nums.sort() print((' '.join([str(i) for i in nums])))
data = eval(input()) nums = [int(i) for i in data.split()] max_idx = len(nums) for i in range(1, max_idx): for j in range(max_idx-i): if nums[j] > nums[j+1]: nums[j], nums[j+1] = nums[j+1], nums[j] print((' '.join([str(i) for i in nums])))
6
10
145
266
import sys data = sys.stdin.readline().strip().split(" ") nums = [int(i) for i in data] nums.sort() print((" ".join([str(i) for i in nums])))
data = eval(input()) nums = [int(i) for i in data.split()] max_idx = len(nums) for i in range(1, max_idx): for j in range(max_idx - i): if nums[j] > nums[j + 1]: nums[j], nums[j + 1] = nums[j + 1], nums[j] print((" ".join([str(i) for i in nums])))
false
40
[ "-import sys", "-", "-data = sys.stdin.readline().strip().split(\" \")", "-nums = [int(i) for i in data]", "-nums.sort()", "+data = eval(input())", "+nums = [int(i) for i in data.split()]", "+max_idx = len(nums)", "+for i in range(1, max_idx):", "+ for j in range(max_idx - i):", "+ if ...
false
0.111958
0.04504
2.485742
[ "s742104163", "s805199166" ]
u288786530
p03478
python
s699095755
s092072382
36
33
3,316
2,940
Accepted
Accepted
8.33
n,a,b=list(map(int,input().split())) ans = 0 l = list(range(1, n+1)) def digitSum(n): # 数値を文字列に変換 s = str(n) # 1文字ずつ数値化し配列にする。 array = list(map(int, s)) # 合計値を返す return sum(array) # print(digitSum(123)) # => 6 # print(digitSum(35829)) # => 27 for i in l: if a <= digitSum...
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n+1): if a <= sum([int(c) for c in str(i)]) <= b: ans += i print(ans)
23
6
363
149
n, a, b = list(map(int, input().split())) ans = 0 l = list(range(1, n + 1)) def digitSum(n): # 数値を文字列に変換 s = str(n) # 1文字ずつ数値化し配列にする。 array = list(map(int, s)) # 合計値を返す return sum(array) # print(digitSum(123)) # => 6 # print(digitSum(35829)) # => 27 for i in l: if a <= digitSum(i) <= b: ...
n, a, b = list(map(int, input().split())) ans = 0 for i in range(1, n + 1): if a <= sum([int(c) for c in str(i)]) <= b: ans += i print(ans)
false
73.913043
[ "-l = list(range(1, n + 1))", "-", "-", "-def digitSum(n):", "- # 数値を文字列に変換", "- s = str(n)", "- # 1文字ずつ数値化し配列にする。", "- array = list(map(int, s))", "- # 合計値を返す", "- return sum(array)", "-", "-", "-# print(digitSum(123))", "-# => 6", "-# print(digitSum(35829))", "-# =>...
false
0.035866
0.061131
0.586704
[ "s699095755", "s092072382" ]
u754022296
p02720
python
s154918064
s167600012
311
118
11,000
10,876
Accepted
Accepted
62.06
import sys sys.setrecursionlimit(10**7) L = [] def lunlun(x, cnt, c): if cnt == 10: L.append(int(x)) return e = int(x[-1]) if c: for i in range(max(e-1, 0), min(e+2, 10)): lunlun(x+str(i), cnt+1, 1) else: lunlun(x+"0", cnt+1, 0) for i in range(1, 10): lunlun(x+str(i...
from collections import deque que = deque() L = [] k = int(eval(input())) for i in range(1, 10): L.append(str(i)) que.append(str(i)) while len(L) < k: top = que.popleft() e = int(top[-1]) for i in range(max(e-1, 0), min(e+2, 10)): x = top + str(i) L.append(x) que.append(x) ans = L[k-...
22
16
443
328
import sys sys.setrecursionlimit(10**7) L = [] def lunlun(x, cnt, c): if cnt == 10: L.append(int(x)) return e = int(x[-1]) if c: for i in range(max(e - 1, 0), min(e + 2, 10)): lunlun(x + str(i), cnt + 1, 1) else: lunlun(x + "0", cnt + 1, 0) for i in...
from collections import deque que = deque() L = [] k = int(eval(input())) for i in range(1, 10): L.append(str(i)) que.append(str(i)) while len(L) < k: top = que.popleft() e = int(top[-1]) for i in range(max(e - 1, 0), min(e + 2, 10)): x = top + str(i) L.append(x) que.append(...
false
27.272727
[ "-import sys", "+from collections import deque", "-sys.setrecursionlimit(10**7)", "+que = deque()", "-", "-", "-def lunlun(x, cnt, c):", "- if cnt == 10:", "- L.append(int(x))", "- return", "- e = int(x[-1])", "- if c:", "- for i in range(max(e - 1, 0), min(e + ...
false
0.566257
0.10932
5.179816
[ "s154918064", "s167600012" ]
u672475305
p02988
python
s382642184
s030259295
20
17
3,060
3,060
Accepted
Accepted
15
cnt = 0 n = int(eval(input())) lst = [int(i) for i in input().split()] for i in range(n-2): a,b,c = lst[i],lst[i+1],lst[i+2] if (a<b and b<c) or (c<b and b<a): cnt += 1 print(cnt)
n = int(eval(input())) lst = list(map(int,input().split())) cnt = 0 for i in range(1,n-1): x,y,z = lst[i-1],lst[i],lst[i+1] if x<=y<=z or z<=y<=x: cnt += 1 print(cnt)
8
8
196
183
cnt = 0 n = int(eval(input())) lst = [int(i) for i in input().split()] for i in range(n - 2): a, b, c = lst[i], lst[i + 1], lst[i + 2] if (a < b and b < c) or (c < b and b < a): cnt += 1 print(cnt)
n = int(eval(input())) lst = list(map(int, input().split())) cnt = 0 for i in range(1, n - 1): x, y, z = lst[i - 1], lst[i], lst[i + 1] if x <= y <= z or z <= y <= x: cnt += 1 print(cnt)
false
0
[ "+n = int(eval(input()))", "+lst = list(map(int, input().split()))", "-n = int(eval(input()))", "-lst = [int(i) for i in input().split()]", "-for i in range(n - 2):", "- a, b, c = lst[i], lst[i + 1], lst[i + 2]", "- if (a < b and b < c) or (c < b and b < a):", "+for i in range(1, n - 1):", "+ ...
false
0.07438
0.046458
1.601
[ "s382642184", "s030259295" ]
u541610817
p03565
python
s868340898
s615503303
24
21
3,188
3,188
Accepted
Accepted
12.5
import re s = input().replace('?', '.') t = eval(input()) lst = [] for i in range(len(s)-len(t)+1): if re.match(s[i:i+len(t)], t): lst.append(s[:i].replace('.','a')+t+s[i+len(t):].replace('.','a')) if lst: print((min(lst))) else: print('UNRESTORABLE')
import re s = input().replace('?', '.')[::-1] t = input()[::-1] for i in range(len(s)-len(t)+1): if re.match(s[i:i+len(t)], t): print(((s[:i].replace('.','a')+t+s[i+len(t):].replace('.','a'))[::-1])) break else: print('UNRESTORABLE')
11
9
263
251
import re s = input().replace("?", ".") t = eval(input()) lst = [] for i in range(len(s) - len(t) + 1): if re.match(s[i : i + len(t)], t): lst.append(s[:i].replace(".", "a") + t + s[i + len(t) :].replace(".", "a")) if lst: print((min(lst))) else: print("UNRESTORABLE")
import re s = input().replace("?", ".")[::-1] t = input()[::-1] for i in range(len(s) - len(t) + 1): if re.match(s[i : i + len(t)], t): print(((s[:i].replace(".", "a") + t + s[i + len(t) :].replace(".", "a"))[::-1])) break else: print("UNRESTORABLE")
false
18.181818
[ "-s = input().replace(\"?\", \".\")", "-t = eval(input())", "-lst = []", "+s = input().replace(\"?\", \".\")[::-1]", "+t = input()[::-1]", "- lst.append(s[:i].replace(\".\", \"a\") + t + s[i + len(t) :].replace(\".\", \"a\"))", "-if lst:", "- print((min(lst)))", "+ print(((s[:i].rep...
false
0.046036
0.08289
0.555379
[ "s868340898", "s615503303" ]
u119456964
p02409
python
s679677656
s286079197
40
10
6,460
6,472
Accepted
Accepted
75
s = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = list(map(int, input().split())) s[b-1][f-1][r-1] += v for b in range(4): for f in range(3): print((" " + " ".join(map(str, s[b][f])))) if b != 3: print(("#"*20))
n = int(input()) ans = "" room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] for i in range(n): b, f, r, v = list(map(int, input().split())) room[b-1][f-1][r-1] += v for i in range(4): for j in range(3): for k in range(10): ans += " %d" % (room[i][j][k...
10
17
316
405
s = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] n = int(input()) for i in range(n): b, f, r, v = list(map(int, input().split())) s[b - 1][f - 1][r - 1] += v for b in range(4): for f in range(3): print((" " + " ".join(map(str, s[b][f])))) if b != 3: print(("#" * 20))
n = int(input()) ans = "" room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)] for i in range(n): b, f, r, v = list(map(int, input().split())) room[b - 1][f - 1][r - 1] += v for i in range(4): for j in range(3): for k in range(10): ans += " %d" % (room[i][j][k]) ...
false
41.176471
[ "-s = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]", "+ans = \"\"", "+room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]", "- s[b - 1][f - 1][r - 1] += v", "-for b in range(4):", "- for f in range(3):", "- print((\" \" + \" \".join(map(str, s[b][f]))))",...
false
0.044478
0.040041
1.110814
[ "s679677656", "s286079197" ]
u733814820
p03733
python
s962525021
s971277391
105
96
25,196
30,676
Accepted
Accepted
8.57
def resolve(): N, T = list(map(int, input().split())) tt = list(map(int, input().split())) ans = 0 last = 0 for t in tt: if t >= last: ans += T last = t + T else: ans += t + T - last last = t + T print(ans) return if __name__ == "__main__": resolve(...
def resolve(): N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 till = 0 for now in t: if till > now: ans -= till - now till = now + T ans += T print(ans) return if __name__ == "__main__": resolve()
20
15
316
276
def resolve(): N, T = list(map(int, input().split())) tt = list(map(int, input().split())) ans = 0 last = 0 for t in tt: if t >= last: ans += T last = t + T else: ans += t + T - last last = t + T print(ans) return if __name__ ...
def resolve(): N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 till = 0 for now in t: if till > now: ans -= till - now till = now + T ans += T print(ans) return if __name__ == "__main__": resolve()
false
25
[ "- tt = list(map(int, input().split()))", "+ t = list(map(int, input().split()))", "- last = 0", "- for t in tt:", "- if t >= last:", "- ans += T", "- last = t + T", "- else:", "- ans += t + T - last", "- last = t + T", "+ ...
false
0.035086
0.036081
0.972413
[ "s962525021", "s971277391" ]
u623819879
p02925
python
s105822733
s627018304
1,969
822
72,792
73,560
Accepted
Accepted
58.25
from heapq import heappush, heappop from collections import deque,defaultdict,Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts=time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return lis...
from heapq import heappush, heappop from collections import deque,defaultdict,Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts=time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return lis...
71
76
1,514
1,711
from heapq import heappush, heappop from collections import deque, defaultdict, Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts = time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return list(map...
from heapq import heappush, heappop from collections import deque, defaultdict, Counter import itertools from itertools import permutations import sys import bisect import string import math import time ts = time.time() sys.setrecursionlimit(10**6) def SI(): return input().split() def MI(): return list(map...
false
6.578947
[ "- ans = n * (n - 1) // 2", "+ ans = 0 # n*(n-1)//2", "+ n_yet = []", "+ # print('Day',ans,IsMatch,nx)", "+ # print('Day',ans,'Match',c1,'vs',c2)", "+ n_yet.append(c1)", "- n_yet.remove(c1)", "+ n_yet.append(c2)", "- ...
false
0.035989
0.03604
0.998575
[ "s105822733", "s627018304" ]
u271469978
p03379
python
s998391705
s491121042
525
331
25,472
25,556
Accepted
Accepted
36.95
n = int(eval(input())) x = list(map(int, input().split())) def median(L): L = sorted(L) n = len(L) m = int(n/2) if n % 2 == 0: return (L[m - 1] + L[m]) / 2 else: return L[(n - 1) // 2] x_median = median(x) l = median(sorted(x)[:-1]) r = median(sorted(x)[1:]) for i in ran...
n = int(eval(input())) x = list(map(int, input().split())) x_sort = sorted(x) def median(L): #L = sorted(L) n = len(L) m = int(n/2) if n % 2 == 0: return (L[m - 1] + L[m]) / 2 else: return L[(n - 1) // 2] x_median = median(x_sort) l = median(x_sort[:-1]) r = median(x_sor...
18
19
392
412
n = int(eval(input())) x = list(map(int, input().split())) def median(L): L = sorted(L) n = len(L) m = int(n / 2) if n % 2 == 0: return (L[m - 1] + L[m]) / 2 else: return L[(n - 1) // 2] x_median = median(x) l = median(sorted(x)[:-1]) r = median(sorted(x)[1:]) for i in range(n): ...
n = int(eval(input())) x = list(map(int, input().split())) x_sort = sorted(x) def median(L): # L = sorted(L) n = len(L) m = int(n / 2) if n % 2 == 0: return (L[m - 1] + L[m]) / 2 else: return L[(n - 1) // 2] x_median = median(x_sort) l = median(x_sort[:-1]) r = median(x_sort[1:])...
false
5.263158
[ "+x_sort = sorted(x)", "- L = sorted(L)", "+ # L = sorted(L)", "-x_median = median(x)", "-l = median(sorted(x)[:-1])", "-r = median(sorted(x)[1:])", "+x_median = median(x_sort)", "+l = median(x_sort[:-1])", "+r = median(x_sort[1:])" ]
false
0.044449
0.045463
0.977715
[ "s998391705", "s491121042" ]
u745561510
p03017
python
s079758157
s824567927
543
462
104,396
104,456
Accepted
Accepted
14.92
import sys sys.setrecursionlimit(100000000) N, A, B, C, D = list(map(int, input().split())) s = list(eval(input())) A -= 1 B -= 1 C -= 1 D -= 1 for i in range(len(s)): if i == len(s) - 1: continue else: if s[i] == '#' and s[i+1] == '#' and max(C, D) < i and i <= C: ...
import sys sys.setrecursionlimit(100000000) N, A, B, C, D = list(map(int, input().split())) s = list(eval(input())) A -= 1 B -= 1 C -= 1 D -= 1 if D < C: tmp = 0 for i in range(len(s)): if i == len(s) - 2 or i == len(s) - 1: continue else: if s[i]...
53
46
1,096
899
import sys sys.setrecursionlimit(100000000) N, A, B, C, D = list(map(int, input().split())) s = list(eval(input())) A -= 1 B -= 1 C -= 1 D -= 1 for i in range(len(s)): if i == len(s) - 1: continue else: if s[i] == "#" and s[i + 1] == "#" and max(C, D) < i and i <= C: print("No") ...
import sys sys.setrecursionlimit(100000000) N, A, B, C, D = list(map(int, input().split())) s = list(eval(input())) A -= 1 B -= 1 C -= 1 D -= 1 if D < C: tmp = 0 for i in range(len(s)): if i == len(s) - 2 or i == len(s) - 1: continue else: if s[i] == "." and s[i + 1] == ...
false
13.207547
[ "-for i in range(len(s)):", "- if i == len(s) - 1:", "- continue", "- else:", "- if s[i] == \"#\" and s[i + 1] == \"#\" and max(C, D) < i and i <= C:", "- print(\"No\")", "- exit()" ]
false
0.038311
0.065563
0.584328
[ "s079758157", "s824567927" ]
u855775311
p02362
python
s879451929
s636102279
900
620
8,136
8,164
Accepted
Accepted
31.11
def main(): nvertices, nedges, s = list(map(int, input().split())) E = [] for i in range(nedges): u, v, w = list(map(int, input().split())) E.append((u, v, w)) INF = 1000000000 d = [INF] * nvertices d[s] = 0 for i in range(nvertices - 1): for u, v, w in E:...
import math def main(): nvertices, nedges, s = list(map(int, input().split())) E = [] for i in range(nedges): u, v, w = list(map(int, input().split())) E.append((u, v, w)) INF = float('inf') d = [INF] * nvertices d[s] = 0 for i in range(nvertices - 1): ...
33
32
769
683
def main(): nvertices, nedges, s = list(map(int, input().split())) E = [] for i in range(nedges): u, v, w = list(map(int, input().split())) E.append((u, v, w)) INF = 1000000000 d = [INF] * nvertices d[s] = 0 for i in range(nvertices - 1): for u, v, w in E: ...
import math def main(): nvertices, nedges, s = list(map(int, input().split())) E = [] for i in range(nedges): u, v, w = list(map(int, input().split())) E.append((u, v, w)) INF = float("inf") d = [INF] * nvertices d[s] = 0 for i in range(nvertices - 1): for u, v, w i...
false
3.030303
[ "+import math", "+", "+", "- INF = 1000000000", "+ INF = float(\"inf\")", "- if d[u] == INF:", "- continue", "- if d[v] == INF:", "- continue", "- if val >= INF:", "+ if math.isinf(val):" ]
false
0.058217
0.043339
1.3433
[ "s879451929", "s636102279" ]
u604839890
p02621
python
s394616290
s955438596
65
27
61,684
9,048
Accepted
Accepted
58.46
a = int(eval(input())) print((a+a*a+a**3))
a = int(eval(input())) print((a + a*a + a*a*a))
2
2
35
40
a = int(eval(input())) print((a + a * a + a**3))
a = int(eval(input())) print((a + a * a + a * a * a))
false
0
[ "-print((a + a * a + a**3))", "+print((a + a * a + a * a * a))" ]
false
0.040357
0.034202
1.179977
[ "s394616290", "s955438596" ]
u994988729
p03993
python
s253996471
s980797365
304
67
23,384
13,880
Accepted
Accepted
77.96
import numpy as np n = int(eval(input())) A = np.array(list(map(int, input().split()))) A -= 1 ans = 0 seen = [0] * n for i, ai in enumerate(A): if seen[i]: continue seen[i] = 1 if A[ai] == i: ans += 1 seen[ai] = 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i, a in enumerate(A): if A[a - 1] == i + 1: ans += 1 ans //= 2 print(ans)
16
9
273
160
import numpy as np n = int(eval(input())) A = np.array(list(map(int, input().split()))) A -= 1 ans = 0 seen = [0] * n for i, ai in enumerate(A): if seen[i]: continue seen[i] = 1 if A[ai] == i: ans += 1 seen[ai] = 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i, a in enumerate(A): if A[a - 1] == i + 1: ans += 1 ans //= 2 print(ans)
false
43.75
[ "-import numpy as np", "-", "-n = int(eval(input()))", "-A = np.array(list(map(int, input().split())))", "-A -= 1", "+N = int(eval(input()))", "+A = list(map(int, input().split()))", "-seen = [0] * n", "-for i, ai in enumerate(A):", "- if seen[i]:", "- continue", "- seen[i] = 1", ...
false
0.294884
0.0372
7.927064
[ "s253996471", "s980797365" ]
u724687935
p03061
python
s234451336
s586612673
1,945
1,749
16,128
16,128
Accepted
Accepted
10.08
# operator.add(a, b) # operator.mul(a, b) class SegmentTree(): """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(sel...
# operator.add(a, b) # operator.mul(a, b) class SegmentTree(): """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(sel...
114
115
2,760
2,707
# operator.add(a, b) # operator.mul(a, b) class SegmentTree: """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(self, A, dot, e): ...
# operator.add(a, b) # operator.mul(a, b) class SegmentTree: """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(self, A, dot, e): ...
false
0.869565
[ "- self.__node = [e] * (2 * n - 1)", "+ self.__node = [e] * (2 * n)", "- self.__node[i + n - 1] = A[i]", "- for i in range(n - 2, -1, -1):", "- self.__node[i] = self.__dot(self.__node[2 * i + 1], self.__node[2 * i + 2])", "+ self.__node[i + n] = A[i]",...
false
0.056301
0.045255
1.244078
[ "s234451336", "s586612673" ]
u241159583
p03835
python
s736940393
s782004379
1,927
1,619
2,940
2,940
Accepted
Accepted
15.98
k, s = list(map(int, input().split())) ans = 0 for i in range(k + 1): for j in range(k + 1): if i + j == s: ans += 1 elif 0 <= s - (i + j) <= k: ans += 1 print(ans)
k,s = list(map(int, input().split())) ans = 0 for x in range(k+1): for y in range(k+1): if x + y > s: break if s - x - y <= k: ans += 1 print(ans)
10
7
185
156
k, s = list(map(int, input().split())) ans = 0 for i in range(k + 1): for j in range(k + 1): if i + j == s: ans += 1 elif 0 <= s - (i + j) <= k: ans += 1 print(ans)
k, s = list(map(int, input().split())) ans = 0 for x in range(k + 1): for y in range(k + 1): if x + y > s: break if s - x - y <= k: ans += 1 print(ans)
false
30
[ "-for i in range(k + 1):", "- for j in range(k + 1):", "- if i + j == s:", "- ans += 1", "- elif 0 <= s - (i + j) <= k:", "+for x in range(k + 1):", "+ for y in range(k + 1):", "+ if x + y > s:", "+ break", "+ if s - x - y <= k:" ]
false
0.111129
0.048509
2.290894
[ "s736940393", "s782004379" ]
u113107956
p02627
python
s622705966
s486404651
26
24
9,084
9,028
Accepted
Accepted
7.69
a=eval(input()) Flag=a.islower() if Flag: print('a') else: print('A')
a=eval(input()) if a.isupper(): print('A') else: print('a')
6
5
76
65
a = eval(input()) Flag = a.islower() if Flag: print("a") else: print("A")
a = eval(input()) if a.isupper(): print("A") else: print("a")
false
16.666667
[ "-Flag = a.islower()", "-if Flag:", "+if a.isupper():", "+ print(\"A\")", "+else:", "-else:", "- print(\"A\")" ]
false
0.042002
0.036869
1.139236
[ "s622705966", "s486404651" ]
u905715926
p03986
python
s630612415
s923031608
61
37
3,500
3,500
Accepted
Accepted
39.34
s = eval(input()) sums = 0 sumt = 0 ans = 0 for i in s: if i == 'S': if sumt == 0: sums += 1 else: if sums > 0: sums -= 1 ans += 2 print((len(s)-ans))
def solve(s): sums = 0 sumt = 0 ans = 0 for i in s: if i == 'S': sums += 1 else: if sums > 0: sums -= 1 ans += 2 return len(s)-ans if __name__ == '__main__': s = eval(input()) print((solve(s)))
14
16
225
302
s = eval(input()) sums = 0 sumt = 0 ans = 0 for i in s: if i == "S": if sumt == 0: sums += 1 else: if sums > 0: sums -= 1 ans += 2 print((len(s) - ans))
def solve(s): sums = 0 sumt = 0 ans = 0 for i in s: if i == "S": sums += 1 else: if sums > 0: sums -= 1 ans += 2 return len(s) - ans if __name__ == "__main__": s = eval(input()) print((solve(s)))
false
12.5
[ "-s = eval(input())", "-sums = 0", "-sumt = 0", "-ans = 0", "-for i in s:", "- if i == \"S\":", "- if sumt == 0:", "+def solve(s):", "+ sums = 0", "+ sumt = 0", "+ ans = 0", "+ for i in s:", "+ if i == \"S\":", "- else:", "- if sums > 0:", "- ...
false
0.037244
0.037162
1.00221
[ "s630612415", "s923031608" ]
u891635666
p03380
python
s743007857
s955212009
148
103
21,220
14,056
Accepted
Accepted
30.41
n = int(eval(input())) ls = sorted(map(int, input().split())) res = [ls[-1]] ds = [(i, abs(x - ls[-1] / 2)) for i, x in enumerate(ls[:-1])] ds.sort(key=lambda x: x[1]) res.append(ls[ds[0][0]]) print((*res))
n = int(eval(input())) ls = sorted(map(int, input().split())) ds = [abs(x - ls[-1] / 2) for x in ls[:-1]] print((ls[-1], ls[ds.index(min(ds))]))
7
4
204
139
n = int(eval(input())) ls = sorted(map(int, input().split())) res = [ls[-1]] ds = [(i, abs(x - ls[-1] / 2)) for i, x in enumerate(ls[:-1])] ds.sort(key=lambda x: x[1]) res.append(ls[ds[0][0]]) print((*res))
n = int(eval(input())) ls = sorted(map(int, input().split())) ds = [abs(x - ls[-1] / 2) for x in ls[:-1]] print((ls[-1], ls[ds.index(min(ds))]))
false
42.857143
[ "-res = [ls[-1]]", "-ds = [(i, abs(x - ls[-1] / 2)) for i, x in enumerate(ls[:-1])]", "-ds.sort(key=lambda x: x[1])", "-res.append(ls[ds[0][0]])", "-print((*res))", "+ds = [abs(x - ls[-1] / 2) for x in ls[:-1]]", "+print((ls[-1], ls[ds.index(min(ds))]))" ]
false
0.034652
0.036231
0.956416
[ "s743007857", "s955212009" ]
u773981351
p03379
python
s525018066
s114618764
692
288
55,060
26,180
Accepted
Accepted
58.38
def medians(nums): n = len(nums) num_orig_pos = list(zip(nums, list(range(n)))) nums_sorted = sorted(num_orig_pos) medians = [] med_left = nums_sorted[(n + 1)//2][0] med_right = nums_sorted[(n + 1)//2 - 1][0] for i in range((n + 1)//2): medians.append((med_left, nums_sorted[i...
def medians(nums, n): median_left = nums[(n + 1)//2] median_right = nums[(n + 1)//2 - 1] return median_left, median_right if __name__ == '__main__': n = int(input()) nums = list(map(int, input().split())) median_left, median_right = medians(sorted(nums), n) for i in nums: ...
19
12
621
384
def medians(nums): n = len(nums) num_orig_pos = list(zip(nums, list(range(n)))) nums_sorted = sorted(num_orig_pos) medians = [] med_left = nums_sorted[(n + 1) // 2][0] med_right = nums_sorted[(n + 1) // 2 - 1][0] for i in range((n + 1) // 2): medians.append((med_left, nums_sorted[i][...
def medians(nums, n): median_left = nums[(n + 1) // 2] median_right = nums[(n + 1) // 2 - 1] return median_left, median_right if __name__ == "__main__": n = int(input()) nums = list(map(int, input().split())) median_left, median_right = medians(sorted(nums), n) for i in nums: print...
false
36.842105
[ "-def medians(nums):", "- n = len(nums)", "- num_orig_pos = list(zip(nums, list(range(n))))", "- nums_sorted = sorted(num_orig_pos)", "- medians = []", "- med_left = nums_sorted[(n + 1) // 2][0]", "- med_right = nums_sorted[(n + 1) // 2 - 1][0]", "- for i in range((n + 1) // 2):",...
false
0.043993
0.147682
0.297893
[ "s525018066", "s114618764" ]
u827202523
p02763
python
s194619237
s892913520
1,902
1,161
436,200
440,536
Accepted
Accepted
38.96
import sys # input = sys.stdin.buffer.readline def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getlist(): return list(map(int, input().split())) import math import heapq import bisect from collections import defaultdict, Counter, deque MOD = 10**9 + ...
import sys from collections import defaultdict, deque, Counter import math # import copy from bisect import bisect_left, bisect_right # import heapq # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(eval(input())) getList...
131
103
2,743
2,497
import sys # input = sys.stdin.buffer.readline def getN(): return int(eval(input())) def getNM(): return list(map(int, input().split())) def getlist(): return list(map(int, input().split())) import math import heapq import bisect from collections import defaultdict, Counter, deque MOD = 10**9 + 7 IN...
import sys from collections import defaultdict, deque, Counter import math # import copy from bisect import bisect_left, bisect_right # import heapq # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = lambda: input().strip() getN = lambda: int(eval(input())) getList = lambda: list(map(i...
false
21.374046
[ "+from collections import defaultdict, deque, Counter", "+import math", "-# input = sys.stdin.buffer.readline", "-def getN():", "- return int(eval(input()))", "+# import copy", "+from bisect import bisect_left, bisect_right", "-", "-def getNM():", "- return list(map(int, input().split()))", ...
false
0.119896
0.041402
2.895921
[ "s194619237", "s892913520" ]
u047796752
p02792
python
s652867638
s102748094
265
230
42,220
40,428
Accepted
Accepted
13.21
N = int(eval(input())) if len(str(N))<4: ans = 0 for i in range(1, N+1): for j in range(1, N+1): if str(i)[0]==str(j)[-1] and str(i)[-1]==str(j)[0]: ans += 1 print(ans) exit() L = len(str(N)) n = int(str(N)[1:]) ans = 0 F = int(str(...
N = int(eval(input())) cnt = [[0]*10 for _ in range(10)] for i in range(1, N+1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += cnt[i][j]*cnt[j][i] print(ans)
57
15
1,067
262
N = int(eval(input())) if len(str(N)) < 4: ans = 0 for i in range(1, N + 1): for j in range(1, N + 1): if str(i)[0] == str(j)[-1] and str(i)[-1] == str(j)[0]: ans += 1 print(ans) exit() L = len(str(N)) n = int(str(N)[1:]) ans = 0 F = int(str(N)[0]) L2 = int(str(N)[-1]...
N = int(eval(input())) cnt = [[0] * 10 for _ in range(10)] for i in range(1, N + 1): f = int(str(i)[0]) l = int(str(i)[-1]) cnt[f][l] += 1 ans = 0 for i in range(1, 10): for j in range(1, 10): ans += cnt[i][j] * cnt[j][i] print(ans)
false
73.684211
[ "-if len(str(N)) < 4:", "- ans = 0", "- for i in range(1, N + 1):", "- for j in range(1, N + 1):", "- if str(i)[0] == str(j)[-1] and str(i)[-1] == str(j)[0]:", "- ans += 1", "- print(ans)", "- exit()", "-L = len(str(N))", "-n = int(str(N)[1:])", "-ans...
false
0.219556
0.086951
2.525057
[ "s652867638", "s102748094" ]
u044964932
p02615
python
s686229930
s695968555
252
233
31,460
31,592
Accepted
Accepted
7.54
import heapq def main(): n = int(eval(input())) As = list(map(int, input().split())) As_sort = sorted(As, reverse=True) ans = 0 q = [] heapq.heappush(q, -As_sort[0]) for i in range(1, n): tmp = heapq.heappop(q) tmp *= -1 ans += tmp heapq.heappu...
import heapq def main(): n = int(eval(input())) As = sorted(list(map(int, input().split())))[::-1] ans = 0 q = [] heapq.heappush(q, -As[0]) for i in range(1, n): tmp = -heapq.heappop(q) ans += tmp heapq.heappush(q, -As[i]) heapq.heappush(q, -As[i]) ...
21
19
433
374
import heapq def main(): n = int(eval(input())) As = list(map(int, input().split())) As_sort = sorted(As, reverse=True) ans = 0 q = [] heapq.heappush(q, -As_sort[0]) for i in range(1, n): tmp = heapq.heappop(q) tmp *= -1 ans += tmp heapq.heappush(q, -As_sort...
import heapq def main(): n = int(eval(input())) As = sorted(list(map(int, input().split())))[::-1] ans = 0 q = [] heapq.heappush(q, -As[0]) for i in range(1, n): tmp = -heapq.heappop(q) ans += tmp heapq.heappush(q, -As[i]) heapq.heappush(q, -As[i]) print(ans...
false
9.52381
[ "- As = list(map(int, input().split()))", "- As_sort = sorted(As, reverse=True)", "+ As = sorted(list(map(int, input().split())))[::-1]", "- heapq.heappush(q, -As_sort[0])", "+ heapq.heappush(q, -As[0])", "- tmp = heapq.heappop(q)", "- tmp *= -1", "+ tmp = -heapq.he...
false
0.043508
0.049146
0.885287
[ "s686229930", "s695968555" ]
u394721319
p02819
python
s122129948
s769242654
150
17
12,428
2,940
Accepted
Accepted
88.67
import numpy as np X = int(eval(input())) def checkprime(N): for i in range(2,int(np.sqrt(N))+1): if N%i == 0: return False return True while True: if checkprime(X): print(X) exit() X += 1
from math import floor, sqrt X = int(eval(input())) def isprime(n): for i in range(2,floor(sqrt(n))+1): if n%i == 0: return False return True while True: if isprime(X): print(X) exit() else: X += 1
15
16
252
270
import numpy as np X = int(eval(input())) def checkprime(N): for i in range(2, int(np.sqrt(N)) + 1): if N % i == 0: return False return True while True: if checkprime(X): print(X) exit() X += 1
from math import floor, sqrt X = int(eval(input())) def isprime(n): for i in range(2, floor(sqrt(n)) + 1): if n % i == 0: return False return True while True: if isprime(X): print(X) exit() else: X += 1
false
6.25
[ "-import numpy as np", "+from math import floor, sqrt", "-def checkprime(N):", "- for i in range(2, int(np.sqrt(N)) + 1):", "- if N % i == 0:", "+def isprime(n):", "+ for i in range(2, floor(sqrt(n)) + 1):", "+ if n % i == 0:", "- if checkprime(X):", "+ if isprime(X):", ...
false
0.510213
0.037802
13.496833
[ "s122129948", "s769242654" ]
u913565745
p02577
python
s254121772
s067287147
202
71
9,220
10,512
Accepted
Accepted
64.85
N = int(eval(input())) if N%9 == 0: print('Yes') else: print('No')
from sys import stdin test = list(stdin.readline().rstrip()) result=0 for i in test: result = result + int(i) if (result % 9) == 0: print('Yes') else: print('No')
6
13
70
187
N = int(eval(input())) if N % 9 == 0: print("Yes") else: print("No")
from sys import stdin test = list(stdin.readline().rstrip()) result = 0 for i in test: result = result + int(i) if (result % 9) == 0: print("Yes") else: print("No")
false
53.846154
[ "-N = int(eval(input()))", "-if N % 9 == 0:", "+from sys import stdin", "+", "+test = list(stdin.readline().rstrip())", "+result = 0", "+for i in test:", "+ result = result + int(i)", "+if (result % 9) == 0:" ]
false
0.007395
0.066564
0.111101
[ "s254121772", "s067287147" ]
u755801379
p02768
python
s731543189
s591416699
204
181
38,672
38,640
Accepted
Accepted
11.27
n,a,b=list(map(int, input().split())) def comb(n, r,MOD): p, q = 1, 1 for i in range(r): p = p * (n-i) % MOD q = q * (i+1) % MOD return p * pow(q, MOD-2, MOD) % MOD mod=10**9+7 A=comb(n,a,mod) B=comb(n,b,mod) C=pow(2,n,mod) if n==2: print((0)) else: print...
n,a,b=list(map(int, input().split())) def comb(n, r,MOD): p, q = 1, 1 for i in range(r): p = p * (n-i) % MOD q = q * (i+1) % MOD return p * pow(q, MOD-2, MOD) % MOD mod=10**9+7 if n==2: print((0)) else: print(((pow(2,n,mod)-1-comb(n,a,mod)-comb(n,b,mod))%mod))
19
15
327
304
n, a, b = list(map(int, input().split())) def comb(n, r, MOD): p, q = 1, 1 for i in range(r): p = p * (n - i) % MOD q = q * (i + 1) % MOD return p * pow(q, MOD - 2, MOD) % MOD mod = 10**9 + 7 A = comb(n, a, mod) B = comb(n, b, mod) C = pow(2, n, mod) if n == 2: print((0)) else: p...
n, a, b = list(map(int, input().split())) def comb(n, r, MOD): p, q = 1, 1 for i in range(r): p = p * (n - i) % MOD q = q * (i + 1) % MOD return p * pow(q, MOD - 2, MOD) % MOD mod = 10**9 + 7 if n == 2: print((0)) else: print(((pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mo...
false
21.052632
[ "-A = comb(n, a, mod)", "-B = comb(n, b, mod)", "-C = pow(2, n, mod)", "- print(((C - 1 - A - B) % mod))", "+ print(((pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod)) % mod))" ]
false
0.087316
0.197155
0.442882
[ "s731543189", "s591416699" ]
u597374218
p02678
python
s002713118
s520261985
748
691
36,868
36,976
Accepted
Accepted
7.62
from collections import deque N,M=list(map(int,input().split())) graph=[[] for i in range(N)] for i in range(M): A,B=list(map(int,input().split())) graph[A-1].append(B-1) graph[B-1].append(A-1) queue=deque([0]) distance=[0]*N while queue: value=queue.popleft() for i in graph[value]: ...
from collections import deque N,M=list(map(int,input().split())) graph=[[] for i in range(N)] for i in range(M): A,B=list(map(int,input().split())) graph[A-1].append(B-1) graph[B-1].append(A-1) queue=deque([0]) distance=[0]*N while queue: que=queue.popleft() for value in graph[que]: ...
21
21
506
517
from collections import deque N, M = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(M): A, B = list(map(int, input().split())) graph[A - 1].append(B - 1) graph[B - 1].append(A - 1) queue = deque([0]) distance = [0] * N while queue: value = queue.popleft() for i in gra...
from collections import deque N, M = list(map(int, input().split())) graph = [[] for i in range(N)] for i in range(M): A, B = list(map(int, input().split())) graph[A - 1].append(B - 1) graph[B - 1].append(A - 1) queue = deque([0]) distance = [0] * N while queue: que = queue.popleft() for value in g...
false
0
[ "- value = queue.popleft()", "- for i in graph[value]:", "- if distance[i] < 1:", "- distance[i] = value + 1", "- queue.append(i)", "+ que = queue.popleft()", "+ for value in graph[que]:", "+ if distance[value] == 0:", "+ distance[value] = q...
false
0.040254
0.039594
1.016676
[ "s002713118", "s520261985" ]
u729133443
p03110
python
s602054058
s378340758
165
17
38,384
2,940
Accepted
Accepted
89.7
c=0 for _ in[0]*int(eval(input())):s=eval(input());n=float(s[:-3]);c+=n*380000*(s[-3]<'J')or n print(c)
c=0 for s in open(0).readlines()[1:]:n=float(s[:-4]);c+=n*380000*(s[-4]<'J')or n print(c)
3
3
93
91
c = 0 for _ in [0] * int(eval(input())): s = eval(input()) n = float(s[:-3]) c += n * 380000 * (s[-3] < "J") or n print(c)
c = 0 for s in open(0).readlines()[1:]: n = float(s[:-4]) c += n * 380000 * (s[-4] < "J") or n print(c)
false
0
[ "-for _ in [0] * int(eval(input())):", "- s = eval(input())", "- n = float(s[:-3])", "- c += n * 380000 * (s[-3] < \"J\") or n", "+for s in open(0).readlines()[1:]:", "+ n = float(s[:-4])", "+ c += n * 380000 * (s[-4] < \"J\") or n" ]
false
0.043811
0.04542
0.964591
[ "s602054058", "s378340758" ]
u968404618
p02681
python
s847777893
s946794860
23
21
9,040
9,000
Accepted
Accepted
8.7
S = eval(input()) T = eval(input()) for i in range(len(S)): if S[i] != T[i]: print("No") exit() print("Yes")
def main(): ## IMPORT MODULE #import sys #sys.setrecursionlimit(100000) #input=lambda :sys.stdin.readline().rstrip() #f_inf=float("inf") #MOD=10**9+7 if 'get_ipython' in globals(): ## SAMPLE INPUT S = "chokudai" T = "chokudaiz" else: ##INPUT #n = input() ...
8
31
132
543
S = eval(input()) T = eval(input()) for i in range(len(S)): if S[i] != T[i]: print("No") exit() print("Yes")
def main(): ## IMPORT MODULE # import sys # sys.setrecursionlimit(100000) # input=lambda :sys.stdin.readline().rstrip() # f_inf=float("inf") # MOD=10**9+7 if "get_ipython" in globals(): ## SAMPLE INPUT S = "chokudai" T = "chokudaiz" else: ##INPUT #...
false
74.193548
[ "-S = eval(input())", "-T = eval(input())", "-for i in range(len(S)):", "- if S[i] != T[i]:", "- print(\"No\")", "- exit()", "-print(\"Yes\")", "+def main():", "+ ## IMPORT MODULE", "+ # import sys", "+ # sys.setrecursionlimit(100000)", "+ # input=lambda :sys.stdin...
false
0.04133
0.182394
0.226598
[ "s847777893", "s946794860" ]
u183422236
p02659
python
s123416605
s787841026
445
56
71,276
61,880
Accepted
Accepted
87.42
from decimal import Decimal a, b = input().split() a = int(a) b = Decimal(b) print((int(a * b)))
a, b = input().split() a = int(a) b = int(float(b) * 100 + 0.5) print((a * b // 100))
5
4
98
86
from decimal import Decimal a, b = input().split() a = int(a) b = Decimal(b) print((int(a * b)))
a, b = input().split() a = int(a) b = int(float(b) * 100 + 0.5) print((a * b // 100))
false
20
[ "-from decimal import Decimal", "-", "-b = Decimal(b)", "-print((int(a * b)))", "+b = int(float(b) * 100 + 0.5)", "+print((a * b // 100))" ]
false
0.061741
0.039243
1.573311
[ "s123416605", "s787841026" ]
u816631826
p03450
python
s199934340
s475905012
1,745
806
67,604
90,428
Accepted
Accepted
53.81
n, m = list(map(int, input().split())) inf = 10**10 G = [{} for i in range(n)] for i in range(m): l, r, d = list(map(int, input().split())) G[l-1][r-1] = d G[r-1][l-1] = -d V = [False for i in range(n)] D = [inf for i in range(n)] for i in range(n): if V[i]: continue Q = [i] ...
#!/usr/bin/env python3 from collections import deque import sys try: from typing import Deque, Dict, List, Tuple except ImportError: pass YESS = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, L: "List[int]", R: "List[int]", D: "List[int]"): G = [[] for _ in range(N...
26
60
632
1,609
n, m = list(map(int, input().split())) inf = 10**10 G = [{} for i in range(n)] for i in range(m): l, r, d = list(map(int, input().split())) G[l - 1][r - 1] = d G[r - 1][l - 1] = -d V = [False for i in range(n)] D = [inf for i in range(n)] for i in range(n): if V[i]: continue Q = [i] D[i]...
#!/usr/bin/env python3 from collections import deque import sys try: from typing import Deque, Dict, List, Tuple except ImportError: pass YESS = "Yes" # type: str NO = "No" # type: str def solve(N: int, M: int, L: "List[int]", R: "List[int]", D: "List[int]"): G = [[] for _ in range(N)] # type: List[Li...
false
56.666667
[ "-n, m = list(map(int, input().split()))", "-inf = 10**10", "-G = [{} for i in range(n)]", "-for i in range(m):", "- l, r, d = list(map(int, input().split()))", "- G[l - 1][r - 1] = d", "- G[r - 1][l - 1] = -d", "-V = [False for i in range(n)]", "-D = [inf for i in range(n)]", "-for i in ...
false
0.062139
0.043172
1.439335
[ "s199934340", "s475905012" ]
u658033920
p03250
python
s198351278
s621891104
12
11
2,820
2,568
Accepted
Accepted
8.33
values = input() values = [int(i) for i in values.split(" ")] values = sorted(values) print((str(int(str(values[2])+str(values[1]))+values[0])))
values = input() values = [int(i) for i in values.split(" ")] values = sorted(values, reverse=True) print((int(str(values[0])+str(values[1]))+values[-1]))
4
4
149
159
values = input() values = [int(i) for i in values.split(" ")] values = sorted(values) print((str(int(str(values[2]) + str(values[1])) + values[0])))
values = input() values = [int(i) for i in values.split(" ")] values = sorted(values, reverse=True) print((int(str(values[0]) + str(values[1])) + values[-1]))
false
0
[ "-values = sorted(values)", "-print((str(int(str(values[2]) + str(values[1])) + values[0])))", "+values = sorted(values, reverse=True)", "+print((int(str(values[0]) + str(values[1])) + values[-1]))" ]
false
0.035692
0.032299
1.105029
[ "s198351278", "s621891104" ]
u254871849
p02899
python
s761298005
s158295439
232
170
18,668
19,684
Accepted
Accepted
26.72
# 2019-11-18 23:58:23(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import a...
import sys n, *a = map(int, sys.stdin.read().split()) def main(): res = [x[0] for x in sorted(enumerate(a, 1), key=lambda x: x[1])] print(*res, sep=' ') if __name__ == '__main__': main()
25
10
629
211
# 2019-11-18 23:58:23(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import array # fro...
import sys n, *a = map(int, sys.stdin.read().split()) def main(): res = [x[0] for x in sorted(enumerate(a, 1), key=lambda x: x[1])] print(*res, sep=" ") if __name__ == "__main__": main()
false
60
[ "-# 2019-11-18 23:58:23(JST)", "-# import collections", "-# import math", "-# from string import ascii_lowercase, ascii_uppercase, digits", "-# from bisect import bisect_left as bi_l, bisect_right as bi_r", "-# import itertools", "-# from functools import reduce", "-# import operator as op", "-# imp...
false
0.0461
0.040855
1.128367
[ "s761298005", "s158295439" ]
u747602774
p03147
python
s171677856
s879157815
44
17
3,060
2,940
Accepted
Accepted
61.36
N = int(eval(input())) h = list(map(int,input().split())) ans = 0 while True: if not sum(h): break for l in range(N): if h[l]: break for r in range(l,N): if not h[r]: r -= 1 break for i in range(l,r+1): h[i] -= 1 ...
N = int(eval(input())) h = list(map(int,input().split())) ans = h[0] for i in range(N-1): ans += max(0,h[i+1]-h[i]) print(ans)
20
11
337
140
N = int(eval(input())) h = list(map(int, input().split())) ans = 0 while True: if not sum(h): break for l in range(N): if h[l]: break for r in range(l, N): if not h[r]: r -= 1 break for i in range(l, r + 1): h[i] -= 1 ans += 1 print...
N = int(eval(input())) h = list(map(int, input().split())) ans = h[0] for i in range(N - 1): ans += max(0, h[i + 1] - h[i]) print(ans)
false
45
[ "-ans = 0", "-while True:", "- if not sum(h):", "- break", "- for l in range(N):", "- if h[l]:", "- break", "- for r in range(l, N):", "- if not h[r]:", "- r -= 1", "- break", "- for i in range(l, r + 1):", "- h[i] -= 1...
false
0.063075
0.036765
1.715607
[ "s171677856", "s879157815" ]
u285443936
p04044
python
s231166276
s603585404
19
17
3,060
3,060
Accepted
Accepted
10.53
N, L = list(map(int,input().split())) S = [eval(input()) for i in range(N)] S = sorted(S) ans = "" for i in S: ans += i print(ans)
N, L = list(map(int,input().split())) S = [eval(input()) for i in range(N)] S.sort() ans = "" for s in S: ans += s print(ans)
11
7
142
121
N, L = list(map(int, input().split())) S = [eval(input()) for i in range(N)] S = sorted(S) ans = "" for i in S: ans += i print(ans)
N, L = list(map(int, input().split())) S = [eval(input()) for i in range(N)] S.sort() ans = "" for s in S: ans += s print(ans)
false
36.363636
[ "-S = sorted(S)", "+S.sort()", "-for i in S:", "- ans += i", "+for s in S:", "+ ans += s" ]
false
0.04519
0.046629
0.969136
[ "s231166276", "s603585404" ]
u226155577
p02913
python
s731057057
s427047319
67
41
3,848
3,800
Accepted
Accepted
38.81
def solve(): N = int(eval(input())) S = eval(input()) def rolling_hash(s, mod, base = 37): l = len(s) h = [0]*(l + 1) v = 0 for i in range(l): h[i+1] = v = (v * base + ord(s[i])) % mod pw = [1]*(l + 1) v = 1 for i in range(l): ...
def solve(): N = int(eval(input())) S = eval(input()) def rolling_hash(s, mod, base = 37): l = len(s) h = [0]*(l + 1) v = 0 for i in range(l): h[i+1] = v = (v * base + ord(s[i])) % mod pw = [1]*(l + 1) v = 1 for i in range(l): ...
42
40
1,133
1,075
def solve(): N = int(eval(input())) S = eval(input()) def rolling_hash(s, mod, base=37): l = len(s) h = [0] * (l + 1) v = 0 for i in range(l): h[i + 1] = v = (v * base + ord(s[i])) % mod pw = [1] * (l + 1) v = 1 for i in range(l): ...
def solve(): N = int(eval(input())) S = eval(input()) def rolling_hash(s, mod, base=37): l = len(s) h = [0] * (l + 1) v = 0 for i in range(l): h[i + 1] = v = (v * base + ord(s[i])) % mod pw = [1] * (l + 1) v = 1 for i in range(l): ...
false
4.761905
[ "- res1 = chk(S, 10**9 + 9)", "- res2 = chk(S, 10**9 + 7)", "- print((min(res1, res2)))", "+ print((chk(S, 10**9 + 9)))" ]
false
0.068328
0.047856
1.42777
[ "s731057057", "s427047319" ]
u063346608
p02628
python
s502820084
s753717335
92
30
9,144
9,232
Accepted
Accepted
67.39
N,K = list(map(int,input().split())) P = list(map(int,input().split())) def bubblesort(l): for index in range(len(l)-1, 0, -1): for low in range(index): if l[low] > l[low+1]: tmp = l[low+1] l[low+1] = l[low] l[low] = tmp return l ...
N,K = list(map(int,input().split())) p = list(map(int,input().split())) p.sort() #print(p) sum = 0 for i in range(K): sum = sum + p[i] print(sum)
17
10
393
151
N, K = list(map(int, input().split())) P = list(map(int, input().split())) def bubblesort(l): for index in range(len(l) - 1, 0, -1): for low in range(index): if l[low] > l[low + 1]: tmp = l[low + 1] l[low + 1] = l[low] l[low] = tmp return l ...
N, K = list(map(int, input().split())) p = list(map(int, input().split())) p.sort() # print(p) sum = 0 for i in range(K): sum = sum + p[i] print(sum)
false
41.176471
[ "-P = list(map(int, input().split()))", "-", "-", "-def bubblesort(l):", "- for index in range(len(l) - 1, 0, -1):", "- for low in range(index):", "- if l[low] > l[low + 1]:", "- tmp = l[low + 1]", "- l[low + 1] = l[low]", "- l[low]...
false
0.036799
0.044507
0.826824
[ "s502820084", "s753717335" ]
u863370423
p03827
python
s717428481
s451471029
18
11
3,060
2,568
Accepted
Accepted
38.89
n=int(eval(input())) s=eval(input()) x=0 mayor=0 for i in range(n): if s[i]=="I": x+=1 elif s[i]=="D": x-=1 if x>mayor: mayor=x print(mayor)
#!/usr/bin/env python count = input() s = input() max, sum = 0, 0 for each_char in s: if each_char == 'I': sum += 1 else: sum -= 1 if max < sum: max = sum print(max)
12
13
157
195
n = int(eval(input())) s = eval(input()) x = 0 mayor = 0 for i in range(n): if s[i] == "I": x += 1 elif s[i] == "D": x -= 1 if x > mayor: mayor = x print(mayor)
#!/usr/bin/env python count = input() s = input() max, sum = 0, 0 for each_char in s: if each_char == "I": sum += 1 else: sum -= 1 if max < sum: max = sum print(max)
false
7.692308
[ "-n = int(eval(input()))", "-s = eval(input())", "-x = 0", "-mayor = 0", "-for i in range(n):", "- if s[i] == \"I\":", "- x += 1", "- elif s[i] == \"D\":", "- x -= 1", "- if x > mayor:", "- mayor = x", "-print(mayor)", "+#!/usr/bin/env python", "+count = input...
false
0.096956
0.04756
2.038614
[ "s717428481", "s451471029" ]
u557729026
p02713
python
s491247045
s876482352
1,998
524
9,032
67,860
Accepted
Accepted
73.77
from math import gcd k=int(eval(input())) ans=0 for i in range(1,k+1): for j in range(1,k+1): for l in range(1,k+1): ans+=(gcd(i,gcd(j,l))) print(ans)
import math k=int(eval(input())) ans=0 for i in range(1,k+1): for j in range(1,k+1): for l in range(1,k+1): ans+=(math.gcd(i,math.gcd(j,l))) print(ans)
9
9
177
179
from math import gcd k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): for l in range(1, k + 1): ans += gcd(i, gcd(j, l)) print(ans)
import math k = int(eval(input())) ans = 0 for i in range(1, k + 1): for j in range(1, k + 1): for l in range(1, k + 1): ans += math.gcd(i, math.gcd(j, l)) print(ans)
false
0
[ "-from math import gcd", "+import math", "- ans += gcd(i, gcd(j, l))", "+ ans += math.gcd(i, math.gcd(j, l))" ]
false
0.039073
0.079976
0.488565
[ "s491247045", "s876482352" ]
u644907318
p03705
python
s558455382
s247363324
169
67
38,384
61,600
Accepted
Accepted
60.36
N,A,B = list(map(int,input().split())) if A>B: ans = 0 elif N==1 and A!=B: ans = 0 elif N==1 and A==B: ans = 1 else: ans = (N-2)*(B-A)+1 print(ans)
N,A,B = list(map(int,input().split())) X = A*(N-1)+B Y = A+B*(N-1) print((max(Y-X+1,0)))
10
4
166
83
N, A, B = list(map(int, input().split())) if A > B: ans = 0 elif N == 1 and A != B: ans = 0 elif N == 1 and A == B: ans = 1 else: ans = (N - 2) * (B - A) + 1 print(ans)
N, A, B = list(map(int, input().split())) X = A * (N - 1) + B Y = A + B * (N - 1) print((max(Y - X + 1, 0)))
false
60
[ "-if A > B:", "- ans = 0", "-elif N == 1 and A != B:", "- ans = 0", "-elif N == 1 and A == B:", "- ans = 1", "-else:", "- ans = (N - 2) * (B - A) + 1", "-print(ans)", "+X = A * (N - 1) + B", "+Y = A + B * (N - 1)", "+print((max(Y - X + 1, 0)))" ]
false
0.045742
0.037726
1.212467
[ "s558455382", "s247363324" ]
u560867850
p02721
python
s500780070
s192103968
189
157
19,556
24,048
Accepted
Accepted
16.93
def main(): n, k, c = map(int, input().split()) s = input() def f(r): interval = 0 count = k for i in r: if count == 0: break if interval > 0: interval -= 1 continue if s[i] == 'o': ...
def main(): n, k, c = list(map(int, input().split())) s = eval(input()) def f(r): interval = 0 count = k for i in r: if count == 0: break if interval > 0: interval -= 1 continue if s[i] ...
24
24
551
556
def main(): n, k, c = map(int, input().split()) s = input() def f(r): interval = 0 count = k for i in r: if count == 0: break if interval > 0: interval -= 1 continue if s[i] == "o": y...
def main(): n, k, c = list(map(int, input().split())) s = eval(input()) def f(r): interval = 0 count = k for i in r: if count == 0: break if interval > 0: interval -= 1 continue if s[i] == "o": ...
false
0
[ "- n, k, c = map(int, input().split())", "- s = input()", "+ n, k, c = list(map(int, input().split()))", "+ s = eval(input())", "- for i, j in zip(f(range(0, n)), reversed(list(f(range(n - 1, -1, -1))))):", "+ for i, j in zip(", "+ f(list(range(0, n))), reversed(list(f(list(rang...
false
0.044986
0.03582
1.255891
[ "s500780070", "s192103968" ]
u353895424
p03424
python
s654288456
s446729761
174
18
38,384
2,940
Accepted
Accepted
89.66
n = int(input()) s = list(map(str, input().split())) print("Four") if "Y" in s else print("Three")
n = int(eval(input())) s = list(map(str, input().split())) s = len(list(set(s))) if s == 3: print("Three") else: print("Four")
3
9
101
138
n = int(input()) s = list(map(str, input().split())) print("Four") if "Y" in s else print("Three")
n = int(eval(input())) s = list(map(str, input().split())) s = len(list(set(s))) if s == 3: print("Three") else: print("Four")
false
66.666667
[ "-n = int(input())", "+n = int(eval(input()))", "-print(\"Four\") if \"Y\" in s else print(\"Three\")", "+s = len(list(set(s)))", "+if s == 3:", "+ print(\"Three\")", "+else:", "+ print(\"Four\")" ]
false
0.041578
0.037581
1.106357
[ "s654288456", "s446729761" ]
u015593272
p03338
python
s196058403
s936101917
22
17
3,316
3,064
Accepted
Accepted
22.73
import collections N = int(eval(input())) s = eval(input()) maxx = 0 for i in range(N - 1): left = s[: i + 1] right = s[i + 1 :] CNT_left = collections.Counter(left) CNT_right = collections.Counter(right) cnt = 0 for k in list(CNT_left.keys()): num = CN...
N = int(eval(input())) s = eval(input()) maxx = 0 for i in range(N - 1): left = s[: i + 1] right = s[i + 1 :] and_LR = set(left) & set(right) cnt = len(and_LR) maxx = max(maxx, cnt) print(maxx)
25
15
421
233
import collections N = int(eval(input())) s = eval(input()) maxx = 0 for i in range(N - 1): left = s[: i + 1] right = s[i + 1 :] CNT_left = collections.Counter(left) CNT_right = collections.Counter(right) cnt = 0 for k in list(CNT_left.keys()): num = CNT_right[k] if num >= 1: ...
N = int(eval(input())) s = eval(input()) maxx = 0 for i in range(N - 1): left = s[: i + 1] right = s[i + 1 :] and_LR = set(left) & set(right) cnt = len(and_LR) maxx = max(maxx, cnt) print(maxx)
false
40
[ "-import collections", "-", "- CNT_left = collections.Counter(left)", "- CNT_right = collections.Counter(right)", "- cnt = 0", "- for k in list(CNT_left.keys()):", "- num = CNT_right[k]", "- if num >= 1:", "- cnt += 1", "+ and_LR = set(left) & set(right)", ...
false
0.114496
0.04846
2.362663
[ "s196058403", "s936101917" ]
u787562674
p03339
python
s750436104
s381512434
152
102
3,828
3,784
Accepted
Accepted
32.89
N = int(eval(input())) S = eval(input()) if S[0] == "E": count = S.count("E") -1 result = count for i in range(1,N): if S[i-1] == "W" and S[i] == "W": count += 1 elif S[i-1] == "E" and S[i] == "E": count -= 1 if result > count: ...
N = int(eval(input())) S = eval(input()) def cal(data, r, c): for i in range(1,N): if data[i-1] == "W" and data[i] == "W": c += 1 elif data[i-1] == "E" and data[i] == "E": c -= 1 if r > c: r = c return r if S[0] == "E": coun...
25
24
619
492
N = int(eval(input())) S = eval(input()) if S[0] == "E": count = S.count("E") - 1 result = count for i in range(1, N): if S[i - 1] == "W" and S[i] == "W": count += 1 elif S[i - 1] == "E" and S[i] == "E": count -= 1 if result > count: result...
N = int(eval(input())) S = eval(input()) def cal(data, r, c): for i in range(1, N): if data[i - 1] == "W" and data[i] == "W": c += 1 elif data[i - 1] == "E" and data[i] == "E": c -= 1 if r > c: r = c return r if S[0] == "E": count = S.c...
false
4
[ "+", "+", "+def cal(data, r, c):", "+ for i in range(1, N):", "+ if data[i - 1] == \"W\" and data[i] == \"W\":", "+ c += 1", "+ elif data[i - 1] == \"E\" and data[i] == \"E\":", "+ c -= 1", "+ if r > c:", "+ r = c", "+ return r"...
false
0.0391
0.043773
0.893231
[ "s750436104", "s381512434" ]
u556594202
p02829
python
s809000041
s874085021
27
24
9,096
9,000
Accepted
Accepted
11.11
s=[1,2,3] for _ in range(2): s.remove(int(eval(input()))) print((s[0]))
print((6-int(eval(input()))-int(eval(input()))))
4
1
67
34
s = [1, 2, 3] for _ in range(2): s.remove(int(eval(input()))) print((s[0]))
print((6 - int(eval(input())) - int(eval(input()))))
false
75
[ "-s = [1, 2, 3]", "-for _ in range(2):", "- s.remove(int(eval(input())))", "-print((s[0]))", "+print((6 - int(eval(input())) - int(eval(input()))))" ]
false
0.043038
0.044293
0.971664
[ "s809000041", "s874085021" ]
u628158887
p02918
python
s300659912
s251134974
42
37
4,636
3,956
Accepted
Accepted
11.9
n,k = list(map(int,input().split())) s = [1 if ele=="L" else 0 for ele in eval(input())] if s[0]==0: s=[(1-ele) for ele in s] before = s[0] cnt=0 for si in s: if si != before: cnt += 1 before = si score_max = len(s)-1 print((min(score_max, score_max-cnt+k*2)))
n,k = list(map(int,input().split())) s = [1 if ele=="L" else 0 for ele in eval(input())] before = s[0] cnt=0 for si in s: if si != before: cnt += 1 before = si score_max = len(s)-1 print((min(score_max, score_max-cnt+k*2)))
15
13
283
240
n, k = list(map(int, input().split())) s = [1 if ele == "L" else 0 for ele in eval(input())] if s[0] == 0: s = [(1 - ele) for ele in s] before = s[0] cnt = 0 for si in s: if si != before: cnt += 1 before = si score_max = len(s) - 1 print((min(score_max, score_max - cnt + k * 2)))
n, k = list(map(int, input().split())) s = [1 if ele == "L" else 0 for ele in eval(input())] before = s[0] cnt = 0 for si in s: if si != before: cnt += 1 before = si score_max = len(s) - 1 print((min(score_max, score_max - cnt + k * 2)))
false
13.333333
[ "-if s[0] == 0:", "- s = [(1 - ele) for ele in s]" ]
false
0.036267
0.035814
1.012654
[ "s300659912", "s251134974" ]
u882209234
p03078
python
s462291769
s983434128
655
570
8,708
3,828
Accepted
Accepted
12.98
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) ans = [] for i in range(X): for j in range(Y): for k in range(Z): if (i+...
from heapq import heappop,heappush 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) q = [] heappush(q,(-(A[0]+B[0]+C[0]),0,0,0)) for i in range(K)...
17
27
444
694
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) ans = [] for i in range(X): for j in range(Y): for k in range(Z): if (i + 1) * (...
from heapq import heappop, heappush 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) q = [] heappush(q, (-(A[0] + B[0] + C[0]), 0, 0, 0)) for i in range...
false
37.037037
[ "+from heapq import heappop, heappush", "+", "-ans = []", "-for i in range(X):", "- for j in range(Y):", "- for k in range(Z):", "- if (i + 1) * (j + 1) * (k + 1) <= K:", "- ans.append(A[i] + B[j] + C[k])", "- else:", "- break", "-ans...
false
0.036711
0.038289
0.958769
[ "s462291769", "s983434128" ]
u441175813
p02766
python
s496737768
s839503527
492
63
80,044
61,788
Accepted
Accepted
87.2
n, k = list(map(int, input().split())) ans = 1 while n >= k: ans += 1 n = n // k print(ans)
n, k = list(map(int, input().split())) ans = 0 while n > 0: ans += 1 n = n // k print(ans)
7
7
100
99
n, k = list(map(int, input().split())) ans = 1 while n >= k: ans += 1 n = n // k print(ans)
n, k = list(map(int, input().split())) ans = 0 while n > 0: ans += 1 n = n // k print(ans)
false
0
[ "-ans = 1", "-while n >= k:", "+ans = 0", "+while n > 0:" ]
false
0.045046
0.036502
1.234098
[ "s496737768", "s839503527" ]
u143492911
p04031
python
s296007669
s569966703
19
17
2,940
2,940
Accepted
Accepted
10.53
n=int(eval(input())) a=list(map(int,input().split())) ave=round(sum(a)/n) a=[(x-ave)**2 for x in a] print((sum(a)))
n=int(eval(input())) a=list(map(int,input().split())) avg=round(sum(a)/n) ans=0 for i in range(n): ans+=(a[i]-avg)**2 print(ans)
5
8
112
135
n = int(eval(input())) a = list(map(int, input().split())) ave = round(sum(a) / n) a = [(x - ave) ** 2 for x in a] print((sum(a)))
n = int(eval(input())) a = list(map(int, input().split())) avg = round(sum(a) / n) ans = 0 for i in range(n): ans += (a[i] - avg) ** 2 print(ans)
false
37.5
[ "-ave = round(sum(a) / n)", "-a = [(x - ave) ** 2 for x in a]", "-print((sum(a)))", "+avg = round(sum(a) / n)", "+ans = 0", "+for i in range(n):", "+ ans += (a[i] - avg) ** 2", "+print(ans)" ]
false
0.042534
0.043342
0.981352
[ "s296007669", "s569966703" ]
u905203728
p03363
python
s096877249
s232388289
270
158
25,976
37,248
Accepted
Accepted
41.48
N=int(eval(input())) num=[0]+list(map(int,input().split())) for i in range(N): num[i+1]=num[i]+num[i+1] num=sorted(num)+[-1] count,n=0,0 flag=num[0] for i in num: if i==flag: n +=1 else: count +=(n*(n-1))//2 flag=i n=1 print(count)
from collections import Counter n=int(eval(input())) A=[0]+list(map(int,input().split())) for i in range(1,n+1): A[i] +=A[i-1] ans=0 for m in list(Counter(A).values()): if m==1:continue else: ans +=(m*(m-1))//2 print(ans)
15
13
283
243
N = int(eval(input())) num = [0] + list(map(int, input().split())) for i in range(N): num[i + 1] = num[i] + num[i + 1] num = sorted(num) + [-1] count, n = 0, 0 flag = num[0] for i in num: if i == flag: n += 1 else: count += (n * (n - 1)) // 2 flag = i n = 1 print(count)
from collections import Counter n = int(eval(input())) A = [0] + list(map(int, input().split())) for i in range(1, n + 1): A[i] += A[i - 1] ans = 0 for m in list(Counter(A).values()): if m == 1: continue else: ans += (m * (m - 1)) // 2 print(ans)
false
13.333333
[ "-N = int(eval(input()))", "-num = [0] + list(map(int, input().split()))", "-for i in range(N):", "- num[i + 1] = num[i] + num[i + 1]", "-num = sorted(num) + [-1]", "-count, n = 0, 0", "-flag = num[0]", "-for i in num:", "- if i == flag:", "- n += 1", "+from collections import Count...
false
0.046057
0.03706
1.242783
[ "s096877249", "s232388289" ]
u729133443
p02744
python
s946224727
s851069901
371
99
14,496
14,728
Accepted
Accepted
73.32
def solve(s): if len(s)==n: a.append(''.join(chr(c+97)for c in s)) return for i in range(max(s)+2): solve(s+[i]) n=int(eval(input())) a=[] solve([0]) print((*a))
a='a' exec('a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];'*~-int(eval(input()))) print((*a))
10
3
194
97
def solve(s): if len(s) == n: a.append("".join(chr(c + 97) for c in s)) return for i in range(max(s) + 2): solve(s + [i]) n = int(eval(input())) a = [] solve([0]) print((*a))
a = "a" exec("a=[s+chr(c)for s in a for c in range(97,ord(max(s))+2)];" * ~-int(eval(input()))) print((*a))
false
70
[ "-def solve(s):", "- if len(s) == n:", "- a.append(\"\".join(chr(c + 97) for c in s))", "- return", "- for i in range(max(s) + 2):", "- solve(s + [i])", "-", "-", "-n = int(eval(input()))", "-a = []", "-solve([0])", "+a = \"a\"", "+exec(\"a=[s+chr(c)for s in a for ...
false
0.038573
0.083328
0.462907
[ "s946224727", "s851069901" ]
u185034753
p02924
python
s988080580
s468547881
19
10
3,060
2,568
Accepted
Accepted
47.37
n = int(eval(input())) print((n*(n-1)//2))
n=int(eval(input()));print(n*~-n/2)
2
1
35
28
n = int(eval(input())) print((n * (n - 1) // 2))
n = int(eval(input())) print(n * ~-n / 2)
false
50
[ "-print((n * (n - 1) // 2))", "+print(n * ~-n / 2)" ]
false
0.060396
0.081207
0.743736
[ "s988080580", "s468547881" ]
u228223940
p02948
python
s050236438
s892691909
929
541
79,576
25,720
Accepted
Accepted
41.77
import heapq n,m = list(map(int,input().split())) AB = [[int(i) for i in input().split()] for j in range(n)] #ab.sort() AB = sorted(AB, key=lambda x: x[0]) #print(ab) tmp = 0 hq = [] ans = 0 for i in range(1,m+1): while tmp <= n-1 and AB[tmp][0] <= i: heapq.heappush(hq,-AB[tmp][1]) ...
from heapq import heappop,heappush n,m = list(map(int,input().split())) AB = [[int(i) for i in input().split()] for j in range(n)] #ab.sort() AB = sorted(AB, key=lambda x: x[0]) #print(ab) tmp = 0 hq = [] ans = 0 for i in range(1,m+1): while tmp <= n-1 and AB[tmp][0] <= i: heappush(...
24
24
409
419
import heapq n, m = list(map(int, input().split())) AB = [[int(i) for i in input().split()] for j in range(n)] # ab.sort() AB = sorted(AB, key=lambda x: x[0]) # print(ab) tmp = 0 hq = [] ans = 0 for i in range(1, m + 1): while tmp <= n - 1 and AB[tmp][0] <= i: heapq.heappush(hq, -AB[tmp][1]) tmp +=...
from heapq import heappop, heappush n, m = list(map(int, input().split())) AB = [[int(i) for i in input().split()] for j in range(n)] # ab.sort() AB = sorted(AB, key=lambda x: x[0]) # print(ab) tmp = 0 hq = [] ans = 0 for i in range(1, m + 1): while tmp <= n - 1 and AB[tmp][0] <= i: heappush(hq, -AB[tmp][1...
false
0
[ "-import heapq", "+from heapq import heappop, heappush", "- heapq.heappush(hq, -AB[tmp][1])", "+ heappush(hq, -AB[tmp][1])", "- ans += -heapq.heappop(hq)", "+ ans += -heappop(hq)" ]
false
0.111211
0.007816
14.228414
[ "s050236438", "s892691909" ]
u374103100
p03700
python
s437294308
s682077120
1,314
845
11,396
73,176
Accepted
Accepted
35.69
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): ...
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): ...
44
44
870
866
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): for i in ran...
# https://atcoder.jp/contests/abc063/tasks/arc075_b import sys import itertools from collections import Counter from collections import defaultdict from collections import deque import bisect from heapq import heappush, heappop import math sys.setrecursionlimit(12345678) def can_delete(ml, t, a, b): for i in ran...
false
0
[ "- if can_delete(monsters.copy(), m, a, b):", "+ if can_delete(monsters[:], m, a, b):" ]
false
0.071293
0.037218
1.915558
[ "s437294308", "s682077120" ]
u572144347
p03457
python
s420530434
s801568044
661
442
62,808
48,780
Accepted
Accepted
33.13
#!/mnt/c/Users/moiki/bash/env/bin/python N = int(eval(input())) from collections import defaultdict, Counter t = [ list(map(int, input().split())) for _ in range(N)] diff = lambda a,b : abs(a[0] - b[0]) + abs(a[1] - b[1]) pos = (0,0) tim = 0 for i in range(N): distance = diff(pos, t[i][1:]) dis_t...
N=int(eval(input())) nt=0 np=(0,0) ok=True for t,x,y in [list(map(int,input().split())) for _ in range(N)]: el,nt=t-nt,t dist=abs(np[0]-x)+abs(np[1]-y) if el<dist: ok=False break if (el-dist)%2!=0: ok=False break np=(x,y) if ok: print("Yes") else: print("No")
41
19
869
301
#!/mnt/c/Users/moiki/bash/env/bin/python N = int(eval(input())) from collections import defaultdict, Counter t = [list(map(int, input().split())) for _ in range(N)] diff = lambda a, b: abs(a[0] - b[0]) + abs(a[1] - b[1]) pos = (0, 0) tim = 0 for i in range(N): distance = diff(pos, t[i][1:]) dis_time = t[i][0] ...
N = int(eval(input())) nt = 0 np = (0, 0) ok = True for t, x, y in [list(map(int, input().split())) for _ in range(N)]: el, nt = t - nt, t dist = abs(np[0] - x) + abs(np[1] - y) if el < dist: ok = False break if (el - dist) % 2 != 0: ok = False break np = (x, y) if ok...
false
53.658537
[ "-#!/mnt/c/Users/moiki/bash/env/bin/python", "-from collections import defaultdict, Counter", "-", "-t = [list(map(int, input().split())) for _ in range(N)]", "-diff = lambda a, b: abs(a[0] - b[0]) + abs(a[1] - b[1])", "-pos = (0, 0)", "-tim = 0", "-for i in range(N):", "- distance = diff(pos, t[...
false
0.080374
0.080057
1.003967
[ "s420530434", "s801568044" ]
u048800107
p02689
python
s636125470
s906444093
256
165
20,944
21,336
Accepted
Accepted
35.55
import copy n,m = list(map(int,input().split())) h = list(map(int,input().split())) p = copy.copy(h) # path = list(list(map(int,input().split())) for x in range(m)) for i in range(m): x,y = list(map(int,input().split())) if h[x-1] > h[y-1]: p[y-1] = 0 elif h[x-1] < h[y-1]: p[x ...
import copy from sys import stdin input = stdin.readline n,m = list(map(int,input().split())) h = list(map(int,input().split())) p = copy.copy(h) # path = list(list(map(int,input().split())) for x in range(m)) for i in range(m): x,y = list(map(int,input().split())) if h[x-1] > h[y-1]: p[y-...
22
24
464
511
import copy n, m = list(map(int, input().split())) h = list(map(int, input().split())) p = copy.copy(h) # path = list(list(map(int,input().split())) for x in range(m)) for i in range(m): x, y = list(map(int, input().split())) if h[x - 1] > h[y - 1]: p[y - 1] = 0 elif h[x - 1] < h[y - 1]: p[...
import copy from sys import stdin input = stdin.readline n, m = list(map(int, input().split())) h = list(map(int, input().split())) p = copy.copy(h) # path = list(list(map(int,input().split())) for x in range(m)) for i in range(m): x, y = list(map(int, input().split())) if h[x - 1] > h[y - 1]: p[y - 1]...
false
8.333333
[ "+from sys import stdin", "+input = stdin.readline" ]
false
0.03813
0.037152
1.02632
[ "s636125470", "s906444093" ]
u718949306
p02646
python
s991615159
s510791316
22
19
9,196
9,152
Accepted
Accepted
13.64
A, V = list(map(int, input().split())) B, W = list(map(int, input().split())) T = int(eval(input())) res = False if B > A: A = A + V*T B = B + W*T if A >= B: print('YES') else: print('NO') else: A = A - V*T B = B - W*T if A <= B: print('YES') else:...
A, V = list(map(int, input().split())) B, W = list(map(int, input().split())) T = int(eval(input())) if B > A: A = A + V*T B = B + W*T if A >= B: print('YES') else: print('NO') else: A = A - V*T B = B - W*T if A <= B: print('YES') else: pri...
18
17
323
310
A, V = list(map(int, input().split())) B, W = list(map(int, input().split())) T = int(eval(input())) res = False if B > A: A = A + V * T B = B + W * T if A >= B: print("YES") else: print("NO") else: A = A - V * T B = B - W * T if A <= B: print("YES") else: ...
A, V = list(map(int, input().split())) B, W = list(map(int, input().split())) T = int(eval(input())) if B > A: A = A + V * T B = B + W * T if A >= B: print("YES") else: print("NO") else: A = A - V * T B = B - W * T if A <= B: print("YES") else: print("NO")...
false
5.555556
[ "-res = False" ]
false
0.046608
0.041764
1.115997
[ "s991615159", "s510791316" ]
u253681061
p03785
python
s435962633
s399157758
252
233
7,384
7,384
Accepted
Accepted
7.54
n,c,k = [int(x) for x in input().split()] t = [] for _ in range(n): t.append(int(eval(input()))) t.sort() ans = 0 tmp = {"f": 0, "num": c} for x in t: if tmp["f"] >= x and tmp["num"] > 0: tmp["num"] -= 1 else: ans += 1 tmp["num"] = c-1 tmp["f"] = x+k pri...
n,c,k = [int(x) for x in input().split()] t = [int(eval(input())) for _ in range(n)] t.sort() bus = c f_bus = 0 ans = 0 for i in range(n): if t[i] > f_bus or bus == 0: ans += 1 f_bus = t[i]+k bus = c-1 else: bus -= 1 print(ans)
19
15
322
276
n, c, k = [int(x) for x in input().split()] t = [] for _ in range(n): t.append(int(eval(input()))) t.sort() ans = 0 tmp = {"f": 0, "num": c} for x in t: if tmp["f"] >= x and tmp["num"] > 0: tmp["num"] -= 1 else: ans += 1 tmp["num"] = c - 1 tmp["f"] = x + k print(ans)
n, c, k = [int(x) for x in input().split()] t = [int(eval(input())) for _ in range(n)] t.sort() bus = c f_bus = 0 ans = 0 for i in range(n): if t[i] > f_bus or bus == 0: ans += 1 f_bus = t[i] + k bus = c - 1 else: bus -= 1 print(ans)
false
21.052632
[ "-t = []", "-for _ in range(n):", "- t.append(int(eval(input())))", "+t = [int(eval(input())) for _ in range(n)]", "+bus = c", "+f_bus = 0", "-tmp = {\"f\": 0, \"num\": c}", "-for x in t:", "- if tmp[\"f\"] >= x and tmp[\"num\"] > 0:", "- tmp[\"num\"] -= 1", "+for i in range(n):", ...
false
0.04723
0.039129
1.207033
[ "s435962633", "s399157758" ]
u163320134
p02975
python
s701821703
s421191014
542
65
14,212
14,212
Accepted
Accepted
88.01
n=int(eval(input())) arr=list(map(int,input().split())) cnt=[0]*40 for val in arr: tbit=format(val,'b')[::-1] for i in range(len(tbit)): if tbit[i]=='1': cnt[i]+=1 for val in cnt: if val%2==1: print('No') break else: print('Yes')
n=int(eval(input())) arr=list(map(int,input().split())) dic={} for val in arr: if val not in dic: dic[val]=1 else: dic[val]+=1 l=len(dic) if l==1: if 0 in dic: print('Yes') else: print('No') elif l==2: if n%3==0: if 0 in dic: if dic[0]==n//3: print('Yes') ...
14
40
262
733
n = int(eval(input())) arr = list(map(int, input().split())) cnt = [0] * 40 for val in arr: tbit = format(val, "b")[::-1] for i in range(len(tbit)): if tbit[i] == "1": cnt[i] += 1 for val in cnt: if val % 2 == 1: print("No") break else: print("Yes")
n = int(eval(input())) arr = list(map(int, input().split())) dic = {} for val in arr: if val not in dic: dic[val] = 1 else: dic[val] += 1 l = len(dic) if l == 1: if 0 in dic: print("Yes") else: print("No") elif l == 2: if n % 3 == 0: if 0 in dic: i...
false
65
[ "-cnt = [0] * 40", "+dic = {}", "- tbit = format(val, \"b\")[::-1]", "- for i in range(len(tbit)):", "- if tbit[i] == \"1\":", "- cnt[i] += 1", "-for val in cnt:", "- if val % 2 == 1:", "+ if val not in dic:", "+ dic[val] = 1", "+ else:", "+ dic[v...
false
0.038676
0.038787
0.997137
[ "s701821703", "s421191014" ]
u545368057
p03328
python
s486209893
s740352006
20
17
2,940
2,940
Accepted
Accepted
15
a,b = list(map(int, input().split())) diff = b-a H = diff*(diff-1)//2 print((H-a))
a,b = list(map(int, input().split())) n = b-a print((n*(n+1)//2-b))
5
3
80
62
a, b = list(map(int, input().split())) diff = b - a H = diff * (diff - 1) // 2 print((H - a))
a, b = list(map(int, input().split())) n = b - a print((n * (n + 1) // 2 - b))
false
40
[ "-diff = b - a", "-H = diff * (diff - 1) // 2", "-print((H - a))", "+n = b - a", "+print((n * (n + 1) // 2 - b))" ]
false
0.090269
0.121467
0.743151
[ "s486209893", "s740352006" ]
u562935282
p03050
python
s240395172
s602251672
186
160
39,664
3,828
Accepted
Accepted
13.98
def make_divisors(n): res = set() for i in range(1, int(n ** 0.5) + 1): if n % i == 0: res.add(i) res.add(n // i) return res N = int(eval(input())) s = make_divisors(N) # print(s) ans = 0 for ss in s: ss -= 1 if ss <= 1: continue k, r = divmod(N,...
N = int(eval(input())) st = set() for d in range(1, int(pow(N, 0.5)) + 1): if N % d == 0: st.add(d) st.add(N // d) # 約数集合 # k(m+1)を満たすmなので、 # Nの約数から1引いた数のうち、 # 実際にNを割って余りがkになるもの # m正よりm>0 # Nを割り切るmや # m<=kとなるmは不適 ans = 0 for dd in st: dd -= 1 if dd == 0: continue q...
21
24
397
381
def make_divisors(n): res = set() for i in range(1, int(n**0.5) + 1): if n % i == 0: res.add(i) res.add(n // i) return res N = int(eval(input())) s = make_divisors(N) # print(s) ans = 0 for ss in s: ss -= 1 if ss <= 1: continue k, r = divmod(N, ss) i...
N = int(eval(input())) st = set() for d in range(1, int(pow(N, 0.5)) + 1): if N % d == 0: st.add(d) st.add(N // d) # 約数集合 # k(m+1)を満たすmなので、 # Nの約数から1引いた数のうち、 # 実際にNを割って余りがkになるもの # m正よりm>0 # Nを割り切るmや # m<=kとなるmは不適 ans = 0 for dd in st: dd -= 1 if dd == 0: continue q, r = divmod(N,...
false
12.5
[ "-def make_divisors(n):", "- res = set()", "- for i in range(1, int(n**0.5) + 1):", "- if n % i == 0:", "- res.add(i)", "- res.add(n // i)", "- return res", "-", "-", "-s = make_divisors(N)", "-# print(s)", "+st = set()", "+for d in range(1, int(pow(N, 0...
false
0.139399
0.188243
0.740528
[ "s240395172", "s602251672" ]
u591143370
p03166
python
s078899618
s242068551
432
345
61,120
120,620
Accepted
Accepted
20.14
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for i in range(M): x, y = list(map(int, input().split())) G[x] += [y] # print(G) dp = [-1] * (N + 1) def func(n): if dp[n] != -1: return dp[n] cnt = 0 # 先...
#G import sys sys.setrecursionlimit(10**9) N,M = list(map(int, input().split())) x = [0] * M y = [0] * M edge=[[] for j in range(N+1)] for i in range(M): x[i], y[i] = list(map(int, input().split())) edge[x[i]]+=[y[i]] dp=[0]*(N+1) def f(x): if dp[x]!=0: return dp[x] num=0 ...
32
29
522
507
import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) G = [[] for _ in range(N + 1)] for i in range(M): x, y = list(map(int, input().split())) G[x] += [y] # print(G) dp = [-1] * (N + 1) def func(n): if dp[n] != -1: return dp[n] cnt = 0 # 先にノードが存在する場合 # ノードが存在し...
# G import sys sys.setrecursionlimit(10**9) N, M = list(map(int, input().split())) x = [0] * M y = [0] * M edge = [[] for j in range(N + 1)] for i in range(M): x[i], y[i] = list(map(int, input().split())) edge[x[i]] += [y[i]] dp = [0] * (N + 1) def f(x): if dp[x] != 0: return dp[x] num = 0 ...
false
9.375
[ "+# G", "-G = [[] for _ in range(N + 1)]", "+x = [0] * M", "+y = [0] * M", "+edge = [[] for j in range(N + 1)]", "- x, y = list(map(int, input().split()))", "- G[x] += [y]", "-# print(G)", "-dp = [-1] * (N + 1)", "+ x[i], y[i] = list(map(int, input().split()))", "+ edge[x[i]] += [y[i...
false
0.043227
0.107428
0.402381
[ "s078899618", "s242068551" ]
u918276501
p02269
python
s216842524
s709153800
1,170
920
112,100
112,320
Accepted
Accepted
21.37
import sys eval(input()) rl = sys.stdin.readlines() d = {} for i in rl: c, s = i.split() #if i[0] == 'i': if c[0] == 'i': #d[i[7:]] = 0 d[s] = 0 else: #if i[5:] in d: if s in d: print('yes') else: print('no')
import sys eval(input()) r = sys.stdin.readlines() d = {} for i in r: if i[0] == 'i': d[i[7:]] = 0 else: print(('yes' if i[5:] in d else 'no'))
17
10
299
169
import sys eval(input()) rl = sys.stdin.readlines() d = {} for i in rl: c, s = i.split() # if i[0] == 'i': if c[0] == "i": # d[i[7:]] = 0 d[s] = 0 else: # if i[5:] in d: if s in d: print("yes") else: print("no")
import sys eval(input()) r = sys.stdin.readlines() d = {} for i in r: if i[0] == "i": d[i[7:]] = 0 else: print(("yes" if i[5:] in d else "no"))
false
41.176471
[ "-rl = sys.stdin.readlines()", "+r = sys.stdin.readlines()", "-for i in rl:", "- c, s = i.split()", "- # if i[0] == 'i':", "- if c[0] == \"i\":", "- # d[i[7:]] = 0", "- d[s] = 0", "+for i in r:", "+ if i[0] == \"i\":", "+ d[i[7:]] = 0", "- # if i[5:] in ...
false
0.049065
0.047899
1.024351
[ "s216842524", "s709153800" ]
u992910889
p03575
python
s550718037
s302116227
469
261
27,888
17,680
Accepted
Accepted
44.35
from scipy.sparse.csgraph import connected_components # https://note.nkmk.me/python-scipy-connected-components/ from scipy.sparse import csr_matrix N, M = list(map(int, input().split())) # 頂点数、辺数 A, B, C = [0] * M, [0] * M, [1] * (M-1) for i in range(M): A[i], B[i] = list(map(int, input().split())) A...
from scipy.sparse.csgraph import connected_components # Pythonのみ! # ↑cf. https://note.nkmk.me/python-scipy-connected-components/ from scipy.sparse import csr_matrix # import string import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): from scipy...
17
34
528
1,074
from scipy.sparse.csgraph import ( connected_components, ) # https://note.nkmk.me/python-scipy-connected-components/ from scipy.sparse import csr_matrix N, M = list(map(int, input().split())) # 頂点数、辺数 A, B, C = [0] * M, [0] * M, [1] * (M - 1) for i in range(M): A[i], B[i] = list(map(int, input().split())) ...
from scipy.sparse.csgraph import connected_components # Pythonのみ! # ↑cf. https://note.nkmk.me/python-scipy-connected-components/ from scipy.sparse import csr_matrix # import string import sys sys.setrecursionlimit(10**5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): from scipy.sp...
false
50
[ "-from scipy.sparse.csgraph import (", "- connected_components,", "-) # https://note.nkmk.me/python-scipy-connected-components/", "+from scipy.sparse.csgraph import connected_components # Pythonのみ!", "+", "+# ↑cf. https://note.nkmk.me/python-scipy-connected-components/", "-N, M = list(map(int, inp...
false
0.311905
0.565994
0.551074
[ "s550718037", "s302116227" ]
u380524497
p02582
python
s165758685
s226942251
31
28
9,100
9,024
Accepted
Accepted
9.68
import sys input = sys.stdin.readline def main(): S = input().rstrip() if S == "RRR": print((3)) elif S == "RRS": print((2)) elif S == "SRR": print((2)) elif S == "SSS": print((0)) else: print((1)) if __name__ == "__main__": main...
import sys input = sys.stdin.readline def main(): s = input().rstrip() rs = s.split("S") print((len(max(rs)))) if __name__ == "__main__": main()
20
12
313
174
import sys input = sys.stdin.readline def main(): S = input().rstrip() if S == "RRR": print((3)) elif S == "RRS": print((2)) elif S == "SRR": print((2)) elif S == "SSS": print((0)) else: print((1)) if __name__ == "__main__": main()
import sys input = sys.stdin.readline def main(): s = input().rstrip() rs = s.split("S") print((len(max(rs)))) if __name__ == "__main__": main()
false
40
[ "- S = input().rstrip()", "- if S == \"RRR\":", "- print((3))", "- elif S == \"RRS\":", "- print((2))", "- elif S == \"SRR\":", "- print((2))", "- elif S == \"SSS\":", "- print((0))", "- else:", "- print((1))", "+ s = input().rstrip()", ...
false
0.052229
0.035341
1.477883
[ "s165758685", "s226942251" ]
u729939940
p02791
python
s515110685
s448404240
125
90
24,744
32,196
Accepted
Accepted
28
N = int(eval(input())) P = list(map(int, input().split())) cnt = 1 min = P[0] for i in range(1, N): if P[i] <= min: min = P[i] cnt += 1 print(cnt)
N = int(eval(input())) P = list(map(int, input().split())) cnt = 1 min = P[0] for p in P: if p < min: min = p cnt += 1 print(cnt)
9
9
158
141
N = int(eval(input())) P = list(map(int, input().split())) cnt = 1 min = P[0] for i in range(1, N): if P[i] <= min: min = P[i] cnt += 1 print(cnt)
N = int(eval(input())) P = list(map(int, input().split())) cnt = 1 min = P[0] for p in P: if p < min: min = p cnt += 1 print(cnt)
false
0
[ "-for i in range(1, N):", "- if P[i] <= min:", "- min = P[i]", "+for p in P:", "+ if p < min:", "+ min = p" ]
false
0.043127
0.043592
0.989318
[ "s515110685", "s448404240" ]
u276115223
p03796
python
s429933491
s420640182
230
34
3,984
2,940
Accepted
Accepted
85.22
# ABC 055: B – Training Camp from math import factorial n = int(eval(input())) print((factorial(n) % (10 ** 9 + 7)))
# ABC 055: B – Training Camp from math import factorial n = int(eval(input())) power = 1 for i in range(1, n + 1): power = (i * power) % (10 ** 9 + 7) print(power)
6
10
115
173
# ABC 055: B – Training Camp from math import factorial n = int(eval(input())) print((factorial(n) % (10**9 + 7)))
# ABC 055: B – Training Camp from math import factorial n = int(eval(input())) power = 1 for i in range(1, n + 1): power = (i * power) % (10**9 + 7) print(power)
false
40
[ "-print((factorial(n) % (10**9 + 7)))", "+power = 1", "+for i in range(1, n + 1):", "+ power = (i * power) % (10**9 + 7)", "+print(power)" ]
false
0.200006
0.042848
4.667828
[ "s429933491", "s420640182" ]
u875291233
p03722
python
s794127565
s698138776
1,062
573
3,316
3,316
Accepted
Accepted
46.05
# coding: utf-8 # Your code here! def Bellman_Ford(g,start): n = len(g) dist = [float("inf")]*n dist[start] = 0 a0 = float("inf") for i in range(n<<1): updated = False for v in range(n): for to, cost in g[v]: if dist[to] <= dist[v] +...
""" Bellman-Ford 始点と終点が決められているとき、 経由する閉路のみを確認する必要がある。 """ def Bellman_Ford2(g,start,goal): n = len(g) dist = [float("inf")]*n dist[start] = 0 a0 = float("inf") for i in range(2*n): updated = False for v in range(n): for to, cost in g[v]: ...
39
41
918
1,063
# coding: utf-8 # Your code here! def Bellman_Ford(g, start): n = len(g) dist = [float("inf")] * n dist[start] = 0 a0 = float("inf") for i in range(n << 1): updated = False for v in range(n): for to, cost in g[v]: if dist[to] <= dist[v] + cost: ...
""" Bellman-Ford 始点と終点が決められているとき、 経由する閉路のみを確認する必要がある。 """ def Bellman_Ford2(g, start, goal): n = len(g) dist = [float("inf")] * n dist[start] = 0 a0 = float("inf") for i in range(2 * n): updated = False for v in range(n): for to, cost in g[v]: if dist[to...
false
4.878049
[ "-# coding: utf-8", "-# Your code here!", "-def Bellman_Ford(g, start):", "+\"\"\"", "+Bellman-Ford", "+始点と終点が決められているとき、", "+経由する閉路のみを確認する必要がある。", "+\"\"\"", "+", "+", "+def Bellman_Ford2(g, start, goal):", "- for i in range(n << 1):", "+ for i in range(2 * n):", "- di...
false
0.03636
0.036051
1.008578
[ "s794127565", "s698138776" ]
u897328029
p02873
python
s338574792
s073759031
1,224
796
79,296
31,900
Accepted
Accepted
34.97
#!/usr/bin/env python3 S = eval(input()) s_list = list(S) w_list = [0] min_n = 0 s_l = len(s_list) totsu_list = [False] if s_list[0] == "<": ou_list = [True] else: ou_list = [False] t_list = [] if ou_list[0]: t_list = ["ou"] else: t_list = ["totsu"] for i, char in enumerate(s_lis...
#!/usr/bin/env python3 S = eval(input()) s_list = list(S) s_l = len(s_list) N = s_l + 1 t_list = ["ou"] if s_list[0] == "<" else ["totsu"] # 1回目のループ: 凹凸↗︎↘︎を判定する for i, char in enumerate(s_list): # 凹であるかどうか is_ou = False is_totsu = False if i == s_l - 1: if char == ">": ...
96
68
2,003
1,511
#!/usr/bin/env python3 S = eval(input()) s_list = list(S) w_list = [0] min_n = 0 s_l = len(s_list) totsu_list = [False] if s_list[0] == "<": ou_list = [True] else: ou_list = [False] t_list = [] if ou_list[0]: t_list = ["ou"] else: t_list = ["totsu"] for i, char in enumerate(s_list): # 凹であるかどうか i...
#!/usr/bin/env python3 S = eval(input()) s_list = list(S) s_l = len(s_list) N = s_l + 1 t_list = ["ou"] if s_list[0] == "<" else ["totsu"] # 1回目のループ: 凹凸↗︎↘︎を判定する for i, char in enumerate(s_list): # 凹であるかどうか is_ou = False is_totsu = False if i == s_l - 1: if char == ">": is_ou = True ...
false
29.166667
[ "-w_list = [0]", "-min_n = 0", "-totsu_list = [False]", "-if s_list[0] == \"<\":", "- ou_list = [True]", "-else:", "- ou_list = [False]", "-t_list = []", "-if ou_list[0]:", "- t_list = [\"ou\"]", "-else:", "- t_list = [\"totsu\"]", "+N = s_l + 1", "+t_list = [\"ou\"] if s_list[...
false
0.037574
0.038137
0.985256
[ "s338574792", "s073759031" ]
u788137651
p03475
python
s550469650
s732220205
199
60
40,560
3,700
Accepted
Accepted
69.85
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import ...
# #    ⋀_⋀  #   (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input=sys.stdin.readline from math import floor,ceil,sqrt,factorial,log #log2ないyp from heapq import heappop, heappush, heappushpop from collections import ...
59
59
1,659
1,637
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defau...
# #    ⋀_⋀ #    (・ω・) # ./ U ∽ U\ # │* 合 *│ # │* 格 *│ # │* 祈 *│ # │* 願 *│ # │*   *│ #  ̄ # import sys sys.setrecursionlimit(10**6) input = sys.stdin.readline from math import floor, ceil, sqrt, factorial, log # log2ないyp from heapq import heappop, heappush, heappushpop from collections import Counter, defau...
false
0
[ "- for i, (c, s, f) in enumerate(CSF):", "- if now <= s: # そのまま最速で乗れる", "- now = s + c", "- continue", "+ for c, s, f in CSF:", "+ if now <= s:", "+ now = s", "- if now % f != 0:", "- ...
false
0.039073
0.03904
1.000842
[ "s550469650", "s732220205" ]
u346395915
p02873
python
s648771132
s414322334
213
197
7,836
7,836
Accepted
Accepted
7.51
s = list(eval(input())) memo = "" cnt = 0 before_cnt = 0 ans = 0 for x in s: if memo == "": memo = x if memo == x: cnt += 1 else: ans += cnt * (cnt+1) // 2 if before_cnt < cnt: if memo == ">": ans -= before_cnt else...
s = list(eval(input())) #不等号の向きを記録する memo = "" #不等号の連続した個数を記録する cnt = 0 #1つ前に数えた不等号の連続した個数を記録する before_cnt = 0 #出力する答え ans = 0 #文字列Sの連続した不等号の向きを数える for x in s: #初めはmemoが空白なので,memoに不等号の向きを記録 if memo == "": memo = x #不等号の向きが同じ場合は、数を1カウントしてループに戻る if memo == x: ...
36
49
662
862
s = list(eval(input())) memo = "" cnt = 0 before_cnt = 0 ans = 0 for x in s: if memo == "": memo = x if memo == x: cnt += 1 else: ans += cnt * (cnt + 1) // 2 if before_cnt < cnt: if memo == ">": ans -= before_cnt else: if memo =...
s = list(eval(input())) # 不等号の向きを記録する memo = "" # 不等号の連続した個数を記録する cnt = 0 # 1つ前に数えた不等号の連続した個数を記録する before_cnt = 0 # 出力する答え ans = 0 # 文字列Sの連続した不等号の向きを数える for x in s: # 初めはmemoが空白なので,memoに不等号の向きを記録 if memo == "": memo = x # 不等号の向きが同じ場合は、数を1カウントしてループに戻る if memo == x: cnt += 1 # 不等号の向きが異...
false
26.530612
[ "+# 不等号の向きを記録する", "+# 不等号の連続した個数を記録する", "+# 1つ前に数えた不等号の連続した個数を記録する", "+# 出力する答え", "+# 文字列Sの連続した不等号の向きを数える", "+ # 初めはmemoが空白なので,memoに不等号の向きを記録", "+ # 不等号の向きが同じ場合は、数を1カウントしてループに戻る", "+ # 不等号の向きが異なる場合", "+ # ansに和を加算する", "- if before_cnt < cnt:", "- if memo == \">\...
false
0.042104
0.048649
0.865473
[ "s648771132", "s414322334" ]
u952708174
p03546
python
s858077548
s685311065
452
288
23,736
18,440
Accepted
Accepted
36.28
def d_wall(H, W, C, A): import scipy.sparse # cost[i][j]:数字iからjに移行するための最小コスト(float64で格納される) cost = scipy.sparse.csgraph.floyd_warshall(C) # 壁の各数字ごとにコストの値を参照、和を取る ans = 0 for h in range(H): for w in range(W): if A[h][w] != -1: ans += cost[A[h][w]][1]...
def d_wall(H, W, C, A): import scipy.sparse # cost[i][j]:数字iからjに移行するための最小コスト(float64で格納される) cost = scipy.sparse.csgraph.floyd_warshall(C) # 壁の各数字ごとに、その数字から1へ変えるための最小コストを計算し、和を取る return int(sum(cost[A[h][w]][1] for h in range(H) for w in range(W) if A[h][w] != -1)) H, W = [int(i) for i in inp...
17
11
553
479
def d_wall(H, W, C, A): import scipy.sparse # cost[i][j]:数字iからjに移行するための最小コスト(float64で格納される) cost = scipy.sparse.csgraph.floyd_warshall(C) # 壁の各数字ごとにコストの値を参照、和を取る ans = 0 for h in range(H): for w in range(W): if A[h][w] != -1: ans += cost[A[h][w]][1] # 壁の数字から...
def d_wall(H, W, C, A): import scipy.sparse # cost[i][j]:数字iからjに移行するための最小コスト(float64で格納される) cost = scipy.sparse.csgraph.floyd_warshall(C) # 壁の各数字ごとに、その数字から1へ変えるための最小コストを計算し、和を取る return int( sum(cost[A[h][w]][1] for h in range(H) for w in range(W) if A[h][w] != -1) ) H, W = [int(i) for...
false
35.294118
[ "- # 壁の各数字ごとにコストの値を参照、和を取る", "- ans = 0", "- for h in range(H):", "- for w in range(W):", "- if A[h][w] != -1:", "- ans += cost[A[h][w]][1] # 壁の数字から1へ変えるための最小コスト", "- return int(ans)", "+ # 壁の各数字ごとに、その数字から1へ変えるための最小コストを計算し、和を取る", "+ return int(", ...
false
0.35581
0.541529
0.657047
[ "s858077548", "s685311065" ]
u729133443
p03729
python
s124991085
s624177512
162
17
38,384
3,064
Accepted
Accepted
89.51
a,b,c=input().split();print(('YNEOS'[a[::-1][0]!=b[0]or b[::-1][0]!=c[0]::2]))
a,b,c=input().split();print(('YNEOS'[a[-1]!=b[0]or b[-1]!=c[0]::2]))
1
1
76
66
a, b, c = input().split() print(("YNEOS"[a[::-1][0] != b[0] or b[::-1][0] != c[0] :: 2]))
a, b, c = input().split() print(("YNEOS"[a[-1] != b[0] or b[-1] != c[0] :: 2]))
false
0
[ "-print((\"YNEOS\"[a[::-1][0] != b[0] or b[::-1][0] != c[0] :: 2]))", "+print((\"YNEOS\"[a[-1] != b[0] or b[-1] != c[0] :: 2]))" ]
false
0.039705
0.034496
1.151012
[ "s124991085", "s624177512" ]
u046187684
p02719
python
s943819043
s258469773
23
21
9,048
9,104
Accepted
Accepted
8.7
def solve(string): n, k = list(map(int, string.split())) n %= k while n > abs(n - k): n = abs(n - k) return str(n) if __name__ == '__main__': import sys print((solve(sys.stdin.read().strip())))
def solve(string): n, k = list(map(int, string.split())) n %= k return str(min(n, abs(n - k))) if __name__ == '__main__': import sys print((solve(sys.stdin.read().strip())))
11
9
230
196
def solve(string): n, k = list(map(int, string.split())) n %= k while n > abs(n - k): n = abs(n - k) return str(n) if __name__ == "__main__": import sys print((solve(sys.stdin.read().strip())))
def solve(string): n, k = list(map(int, string.split())) n %= k return str(min(n, abs(n - k))) if __name__ == "__main__": import sys print((solve(sys.stdin.read().strip())))
false
18.181818
[ "- while n > abs(n - k):", "- n = abs(n - k)", "- return str(n)", "+ return str(min(n, abs(n - k)))" ]
false
0.04823
0.04433
1.08797
[ "s943819043", "s258469773" ]
u814986259
p03031
python
s744714499
s429593204
44
34
3,064
3,064
Accepted
Accepted
22.73
N, M = list(map(int, input().split())) k = [0]*M s = [""]*M for i in range(M): tmp = list(map(int, input().split())) k[i] = tmp[0] s[i] = tmp[1:] p = list(map(int, input().split())) ans = 0 for i in range(2**N): global_count = 0 for j in range(M): local_count = 0 for x...
N, M = list(map(int, input().split())) K = [[0]*N for i in range(M)] for i in range(M): tmp = list(map(int, input().split())) for j in tmp[1:]: K[i][j-1] = 1 p = list(map(int, input().split())) ans = 0 for i in range(2**N): tmp = [0]*M for j in range(N): if (i >> j) % ...
25
26
571
524
N, M = list(map(int, input().split())) k = [0] * M s = [""] * M for i in range(M): tmp = list(map(int, input().split())) k[i] = tmp[0] s[i] = tmp[1:] p = list(map(int, input().split())) ans = 0 for i in range(2**N): global_count = 0 for j in range(M): local_count = 0 for x in s[j]: ...
N, M = list(map(int, input().split())) K = [[0] * N for i in range(M)] for i in range(M): tmp = list(map(int, input().split())) for j in tmp[1:]: K[i][j - 1] = 1 p = list(map(int, input().split())) ans = 0 for i in range(2**N): tmp = [0] * M for j in range(N): if (i >> j) % 2 == 1: ...
false
3.846154
[ "-k = [0] * M", "-s = [\"\"] * M", "+K = [[0] * N for i in range(M)]", "- k[i] = tmp[0]", "- s[i] = tmp[1:]", "+ for j in tmp[1:]:", "+ K[i][j - 1] = 1", "- global_count = 0", "+ tmp = [0] * M", "+ for j in range(N):", "+ if (i >> j) % 2 == 1:", "+ fo...
false
0.035703
0.112066
0.31859
[ "s744714499", "s429593204" ]
u214617707
p03575
python
s038701283
s737266204
22
18
3,316
3,064
Accepted
Accepted
18.18
from collections import defaultdict n, m = list(map(int, input().split())) G = defaultdict(list) s = [] for i in range(m): a, b = list(map(int, input().split())) G[a - 1].append(b - 1) G[b - 1].append(a - 1) s.append((a - 1, b - 1)) def dfs(cur, pre, NG, k): global used used[cur] ...
N, M = list(map(int, input().split())) G = [[] for i in range(N)] E = [] for i in range(M): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) E.append((a, b)) def dfs(v, pre, s, ng): if used[v]: return used[v] = 1 s.add(v) ...
29
33
614
596
from collections import defaultdict n, m = list(map(int, input().split())) G = defaultdict(list) s = [] for i in range(m): a, b = list(map(int, input().split())) G[a - 1].append(b - 1) G[b - 1].append(a - 1) s.append((a - 1, b - 1)) def dfs(cur, pre, NG, k): global used used[cur] = 1 for ...
N, M = list(map(int, input().split())) G = [[] for i in range(N)] E = [] for i in range(M): a, b = list(map(int, input().split())) a, b = a - 1, b - 1 G[a].append(b) G[b].append(a) E.append((a, b)) def dfs(v, pre, s, ng): if used[v]: return used[v] = 1 s.add(v) for u in G[v...
false
12.121212
[ "-from collections import defaultdict", "-", "-n, m = list(map(int, input().split()))", "-G = defaultdict(list)", "-s = []", "-for i in range(m):", "+N, M = list(map(int, input().split()))", "+G = [[] for i in range(N)]", "+E = []", "+for i in range(M):", "- G[a - 1].append(b - 1)", "- G...
false
0.111936
0.111003
1.008408
[ "s038701283", "s737266204" ]
u779293207
p02572
python
s067574206
s452686659
157
139
31,552
31,644
Accepted
Accepted
11.46
N = int(eval(input())) A = list(map(int, input().split())) c=0 d=sum(A) for i in range(0,N-1): d-=A[i] c+=A[i]*d if(c>10**9+7): c%=(10**9+7) print(c)
N=int(eval(input())) A=list(map(int,input().split())) A2=0 for i in range(len(A)): A2+=A[i]**2 c=(sum(A))**2-A2 print((c//2%(10**9+7)))
11
8
175
138
N = int(eval(input())) A = list(map(int, input().split())) c = 0 d = sum(A) for i in range(0, N - 1): d -= A[i] c += A[i] * d if c > 10**9 + 7: c %= 10**9 + 7 print(c)
N = int(eval(input())) A = list(map(int, input().split())) A2 = 0 for i in range(len(A)): A2 += A[i] ** 2 c = (sum(A)) ** 2 - A2 print((c // 2 % (10**9 + 7)))
false
27.272727
[ "-c = 0", "-d = sum(A)", "-for i in range(0, N - 1):", "- d -= A[i]", "- c += A[i] * d", "- if c > 10**9 + 7:", "- c %= 10**9 + 7", "-print(c)", "+A2 = 0", "+for i in range(len(A)):", "+ A2 += A[i] ** 2", "+c = (sum(A)) ** 2 - A2", "+print((c // 2 % (10**9 + 7)))" ]
false
0.03628
0.038816
0.934663
[ "s067574206", "s452686659" ]
u948524308
p03733
python
s901102883
s958358366
144
130
25,200
26,708
Accepted
Accepted
9.72
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 for i in range(1, N): if t[i] - t[i - 1] >= T: ans += T else: ans += t[i] - t[i - 1] print((ans + T))
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 for i in range(1, N): d=t[i]-t[i-1] if d >= T: ans += T else: ans += d print((ans + T))
11
12
213
204
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 for i in range(1, N): if t[i] - t[i - 1] >= T: ans += T else: ans += t[i] - t[i - 1] print((ans + T))
N, T = list(map(int, input().split())) t = list(map(int, input().split())) ans = 0 for i in range(1, N): d = t[i] - t[i - 1] if d >= T: ans += T else: ans += d print((ans + T))
false
8.333333
[ "- if t[i] - t[i - 1] >= T:", "+ d = t[i] - t[i - 1]", "+ if d >= T:", "- ans += t[i] - t[i - 1]", "+ ans += d" ]
false
0.034304
0.055215
0.621275
[ "s901102883", "s958358366" ]
u780025254
p02407
python
s617851321
s223588215
40
20
7,504
5,596
Accepted
Accepted
50
eval(input()) print((' '.join(input().split()[::-1])))
eval(input()) n = list(map(int, input().split())) print((*n[::-1]))
2
3
47
62
eval(input()) print((" ".join(input().split()[::-1])))
eval(input()) n = list(map(int, input().split())) print((*n[::-1]))
false
33.333333
[ "-print((\" \".join(input().split()[::-1])))", "+n = list(map(int, input().split()))", "+print((*n[::-1]))" ]
false
0.03579
0.035959
0.99531
[ "s617851321", "s223588215" ]
u089116225
p01137
python
s155653815
s277093560
820
710
5,720
5,720
Accepted
Accepted
13.41
while True: e = int(eval(input())) if e == 0: break z, ans = 0, float('inf') for z in range(e): if z ** 3 > e: break else: r = e - z ** 3 y = int(r ** 0.5) x = r - y ** 2 ans = min(ans, x + y + z) print(...
while True: e = int(eval(input())) if e == 0: break z, ans = 0, float('inf') while z ** 3 <= e: r = e - z ** 3 y = int(r ** 0.5) x = r - y ** 2 ans = min(ans, x + y + z) z += 1 print(ans)
14
12
319
261
while True: e = int(eval(input())) if e == 0: break z, ans = 0, float("inf") for z in range(e): if z**3 > e: break else: r = e - z**3 y = int(r**0.5) x = r - y**2 ans = min(ans, x + y + z) print(ans)
while True: e = int(eval(input())) if e == 0: break z, ans = 0, float("inf") while z**3 <= e: r = e - z**3 y = int(r**0.5) x = r - y**2 ans = min(ans, x + y + z) z += 1 print(ans)
false
14.285714
[ "- for z in range(e):", "- if z**3 > e:", "- break", "- else:", "- r = e - z**3", "- y = int(r**0.5)", "- x = r - y**2", "- ans = min(ans, x + y + z)", "+ while z**3 <= e:", "+ r = e - z**3", "+ y = int(r**0...
false
0.037336
0.037288
1.001285
[ "s155653815", "s277093560" ]
u197300773
p03318
python
s441016981
s072083915
54
34
3,948
3,316
Accepted
Accepted
37.04
def f(n): s=str(n) return sum([int(s[i]) for i in range(len(s))]) sunuke=[] for i in range(16): for j in range(1,500): sunuke.append(j*(10**i)-1) sunuke=list(set(sunuke)) sunuke.sort() sunuke.pop(0) L=len(sunuke) tmp1,tmp2=sunuke[L-1],f(sunuke[L-1]) ans=[sunuke[L-1]] for i in rang...
def f(n): s=str(n) return sum([int(s[i]) for i in range(len(s))]) sunuke=[] for i in range(16): for j in range(1,200): sunuke.append(j*(10**i)-1) sunuke=list(set(sunuke)) sunuke.sort() sunuke.pop(0) L=len(sunuke) tmp1,tmp2=sunuke[L-1],f(sunuke[L-1]) ans=[sunuke[L-1]] for i in rang...
28
28
510
510
def f(n): s = str(n) return sum([int(s[i]) for i in range(len(s))]) sunuke = [] for i in range(16): for j in range(1, 500): sunuke.append(j * (10**i) - 1) sunuke = list(set(sunuke)) sunuke.sort() sunuke.pop(0) L = len(sunuke) tmp1, tmp2 = sunuke[L - 1], f(sunuke[L - 1]) ans = [sunuke[L - 1]] for i...
def f(n): s = str(n) return sum([int(s[i]) for i in range(len(s))]) sunuke = [] for i in range(16): for j in range(1, 200): sunuke.append(j * (10**i) - 1) sunuke = list(set(sunuke)) sunuke.sort() sunuke.pop(0) L = len(sunuke) tmp1, tmp2 = sunuke[L - 1], f(sunuke[L - 1]) ans = [sunuke[L - 1]] for i...
false
0
[ "- for j in range(1, 500):", "+ for j in range(1, 200):" ]
false
0.097487
0.057454
1.696778
[ "s441016981", "s072083915" ]
u281303342
p03846
python
s613400343
s056411151
102
78
13,812
16,280
Accepted
Accepted
23.53
N = int(eval(input())) A = list(map(int,input().split())) A.sort() ans = 1 mod = 10**9+7 if len(A)%2==0: for i in range(N//2): if A[i*2] == A[i*2+1] == i*2+1: ans *= 2 ans %= mod else: ans = 0 break else: for i in range((N-1)//2):...
# python3 (3.4.3) import sys input = sys.stdin.readline # main from collections import Counter N = int(eval(input())) A = list(map(int,input().split())) mod = 10**9+7 C = dict(Counter(A)) ans = 1 if N%2==0: for i in range(N//2): if C.get(i*2+1) == 2: ans *= 2 ans ...
27
34
508
630
N = int(eval(input())) A = list(map(int, input().split())) A.sort() ans = 1 mod = 10**9 + 7 if len(A) % 2 == 0: for i in range(N // 2): if A[i * 2] == A[i * 2 + 1] == i * 2 + 1: ans *= 2 ans %= mod else: ans = 0 break else: for i in range((N - 1) /...
# python3 (3.4.3) import sys input = sys.stdin.readline # main from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 C = dict(Counter(A)) ans = 1 if N % 2 == 0: for i in range(N // 2): if C.get(i * 2 + 1) == 2: ans *= 2 ans %= mo...
false
20.588235
[ "+# python3 (3.4.3)", "+import sys", "+", "+input = sys.stdin.readline", "+# main", "+from collections import Counter", "+", "-A.sort()", "+mod = 10**9 + 7", "+C = dict(Counter(A))", "-mod = 10**9 + 7", "-if len(A) % 2 == 0:", "+if N % 2 == 0:", "- if A[i * 2] == A[i * 2 + 1] == i *...
false
0.085161
0.04544
1.874127
[ "s613400343", "s056411151" ]
u804711544
p02622
python
s602518918
s748965045
85
44
12,356
13,644
Accepted
Accepted
48.24
import sys sys.setrecursionlimit(10**7) s = list(eval(input())) t = list(eval(input())) if s == t: print((0), sys.exit()) cnt = 0 for i in range(len(s)): if t[i] != s[i]: t[i] = s[i] cnt += 1 print(cnt)
import sys s = list(eval(input())) t = list(eval(input())) if s == t: print((0), sys.exit()) """ cnt = 0 for i in range(len(s)): if t[i] != s[i]: # t[i] = s[i] # いらない cnt += 1 print(cnt) """ # zip関数での別解 res = len([1 for i, j in zip(s, t) if i != j]) print(res)
13
19
222
290
import sys sys.setrecursionlimit(10**7) s = list(eval(input())) t = list(eval(input())) if s == t: print((0), sys.exit()) cnt = 0 for i in range(len(s)): if t[i] != s[i]: t[i] = s[i] cnt += 1 print(cnt)
import sys s = list(eval(input())) t = list(eval(input())) if s == t: print((0), sys.exit()) """ cnt = 0 for i in range(len(s)): if t[i] != s[i]: # t[i] = s[i] # いらない cnt += 1 print(cnt) """ # zip関数での別解 res = len([1 for i, j in zip(s, t) if i != j]) print(res)
false
31.578947
[ "-sys.setrecursionlimit(10**7)", "+\"\"\"", "- t[i] = s[i]", "+ # t[i] = s[i] # いらない", "+\"\"\"", "+# zip関数での別解", "+res = len([1 for i, j in zip(s, t) if i != j])", "+print(res)" ]
false
0.057084
0.081287
0.702254
[ "s602518918", "s748965045" ]
u324090406
p02678
python
s626700854
s087408869
951
739
91,356
40,856
Accepted
Accepted
22.29
from collections import deque n, m = list(map(int, input().split())) root_dict = {} for _ in range(m): a, b = list(map(int, input().split())) if a not in root_dict: root_dict[a] = deque([b]) else: root_dict[a].append(b) if b not in root_dict: root_dict[b] = deque([a...
from collections import deque n, m = list(map(int, input().split())) root_dict = {} for _ in range(m): a, b = list(map(int, input().split())) if a not in root_dict: root_dict[a] = [b] else: root_dict[a].append(b) if b not in root_dict: root_dict[b] = [a] else: ...
34
33
724
676
from collections import deque n, m = list(map(int, input().split())) root_dict = {} for _ in range(m): a, b = list(map(int, input().split())) if a not in root_dict: root_dict[a] = deque([b]) else: root_dict[a].append(b) if b not in root_dict: root_dict[b] = deque([a]) else: ...
from collections import deque n, m = list(map(int, input().split())) root_dict = {} for _ in range(m): a, b = list(map(int, input().split())) if a not in root_dict: root_dict[a] = [b] else: root_dict[a].append(b) if b not in root_dict: root_dict[b] = [a] else: root_d...
false
2.941176
[ "- root_dict[a] = deque([b])", "+ root_dict[a] = [b]", "- root_dict[b] = deque([a])", "+ root_dict[b] = [a]", "- while root_dict[x]:", "- i = root_dict[x].popleft()", "+ for i in root_dict[x]:" ]
false
0.084987
0.080393
1.05715
[ "s626700854", "s087408869" ]
u729133443
p03546
python
s498525942
s878683416
311
202
21,824
16,704
Accepted
Accepted
35.05
from scipy.sparse import* h,w,*a=list(map(int,open(0).read().split())) c=csgraph.dijkstra(csr_matrix([a[i*10:-~i*10]for i in range(10)])) print((int(sum([c[i][1]for i in a[100:]if i>=0]))))
from scipy.sparse import* h,w,*a=list(map(int,open(0).read().split())) c=csgraph.dijkstra(csr_matrix([a[i*10:-~i*10]for i in range(10)])) print((int(sum(c[i][1]for i in a[100:]if i>=0))))
4
4
184
182
from scipy.sparse import * h, w, *a = list(map(int, open(0).read().split())) c = csgraph.dijkstra(csr_matrix([a[i * 10 : -~i * 10] for i in range(10)])) print((int(sum([c[i][1] for i in a[100:] if i >= 0]))))
from scipy.sparse import * h, w, *a = list(map(int, open(0).read().split())) c = csgraph.dijkstra(csr_matrix([a[i * 10 : -~i * 10] for i in range(10)])) print((int(sum(c[i][1] for i in a[100:] if i >= 0))))
false
0
[ "-print((int(sum([c[i][1] for i in a[100:] if i >= 0]))))", "+print((int(sum(c[i][1] for i in a[100:] if i >= 0))))" ]
false
0.345465
0.996586
0.346648
[ "s498525942", "s878683416" ]
u970308980
p02614
python
s950872412
s934109939
164
64
9,296
9,104
Accepted
Accepted
60.98
from copy import deepcopy H, W, K = list(map(int, input().split())) C = [] for i in range(H): C.append(list(input().strip())) ans = 0 for h in range(1<<H): for w in range(1<<W): # print('h={}, w={}'.format(h, w)) C2 = deepcopy(C) for i in range(H): if h >> i ...
H, W, K = list(map(int, input().split())) C = [] for i in range(H): c = list(input().strip()) C.append(c) ans = 0 for h in range(1 << H): for w in range(1 << W): cnt = 0 for i in range(H): for j in range(W): if h >> i & 1: continu...
31
22
723
502
from copy import deepcopy H, W, K = list(map(int, input().split())) C = [] for i in range(H): C.append(list(input().strip())) ans = 0 for h in range(1 << H): for w in range(1 << W): # print('h={}, w={}'.format(h, w)) C2 = deepcopy(C) for i in range(H): if h >> i & 1: ...
H, W, K = list(map(int, input().split())) C = [] for i in range(H): c = list(input().strip()) C.append(c) ans = 0 for h in range(1 << H): for w in range(1 << W): cnt = 0 for i in range(H): for j in range(W): if h >> i & 1: continue ...
false
29.032258
[ "-from copy import deepcopy", "-", "- C.append(list(input().strip()))", "+ c = list(input().strip())", "+ C.append(c)", "- # print('h={}, w={}'.format(h, w))", "- C2 = deepcopy(C)", "- for i in range(H):", "- if h >> i & 1:", "- for j in rang...
false
0.043746
0.072465
0.603683
[ "s950872412", "s934109939" ]
u238940874
p02802
python
s239962667
s097334313
301
274
27,460
33,676
Accepted
Accepted
8.97
n,m=list(map(int,input().split())) ps=list(list(input().split()) for _ in range(m)) wal=[0]*n acl=[0]*n for p,s in ps: p=int(p)-1 if s=='AC' and acl[p] ==0: acl[p]+=1 elif s=='WA' and acl[p] ==0: wal[p]+=1 wa=0 for i,ac in enumerate(acl): if ac == 1: wa+=wal[i]...
n,m=list(map(int,input().split())) ps=[input().split() for i in range(m)] acl=[0]*n wal=[0]*n for p,s in ps: p=int(p)-1 if s=='AC' and acl[p]==0: acl[p]+=1 elif s=='WA' and acl[p]==0: wal[p]+=1 wa=0 for i,ac in enumerate(acl): if ac==1: wa+=wal[i] print((sum(acl...
19
17
344
318
n, m = list(map(int, input().split())) ps = list(list(input().split()) for _ in range(m)) wal = [0] * n acl = [0] * n for p, s in ps: p = int(p) - 1 if s == "AC" and acl[p] == 0: acl[p] += 1 elif s == "WA" and acl[p] == 0: wal[p] += 1 wa = 0 for i, ac in enumerate(acl): if ac == 1: ...
n, m = list(map(int, input().split())) ps = [input().split() for i in range(m)] acl = [0] * n wal = [0] * n for p, s in ps: p = int(p) - 1 if s == "AC" and acl[p] == 0: acl[p] += 1 elif s == "WA" and acl[p] == 0: wal[p] += 1 wa = 0 for i, ac in enumerate(acl): if ac == 1: wa += w...
false
10.526316
[ "-ps = list(list(input().split()) for _ in range(m))", "+ps = [input().split() for i in range(m)]", "+acl = [0] * n", "-acl = [0] * n" ]
false
0.048686
0.163253
0.298221
[ "s239962667", "s097334313" ]
u077291787
p02952
python
s115297922
s532481560
167
17
38,256
3,064
Accepted
Accepted
89.82
# ABC136B - Uneven Numbers def main(): n = int(eval(input())) d = len(str(n)) if d == 6: ans = 9 + 900 + 90000 elif d == 5: ans = 9 + 900 + n - 9999 elif d == 4: ans = 9 + 900 elif d == 3: ans = 9 + n - 99 elif d == 2: ans = 9 elif d ...
# ABC136B - Uneven Numbers def main(): n = int(eval(input())) d = len(str(n)) if d == 6: ans = 90909 elif d in (4, 5): ans = 909 + max(0, n - 9999) elif d in (2, 3): ans = 9 + max(0, n - 99) else: ans = n print(ans) if __name__ == "__main__": ...
21
17
396
325
# ABC136B - Uneven Numbers def main(): n = int(eval(input())) d = len(str(n)) if d == 6: ans = 9 + 900 + 90000 elif d == 5: ans = 9 + 900 + n - 9999 elif d == 4: ans = 9 + 900 elif d == 3: ans = 9 + n - 99 elif d == 2: ans = 9 elif d == 1: ...
# ABC136B - Uneven Numbers def main(): n = int(eval(input())) d = len(str(n)) if d == 6: ans = 90909 elif d in (4, 5): ans = 909 + max(0, n - 9999) elif d in (2, 3): ans = 9 + max(0, n - 99) else: ans = n print(ans) if __name__ == "__main__": main()
false
19.047619
[ "- ans = 9 + 900 + 90000", "- elif d == 5:", "- ans = 9 + 900 + n - 9999", "- elif d == 4:", "- ans = 9 + 900", "- elif d == 3:", "- ans = 9 + n - 99", "- elif d == 2:", "- ans = 9", "- elif d == 1:", "+ ans = 90909", "+ elif d in (4,...
false
0.042614
0.039994
1.065524
[ "s115297922", "s532481560" ]
u638282348
p03074
python
s872003367
s771691229
122
101
4,340
4,340
Accepted
Accepted
17.21
_, K = list(map(int, input().split())) S = eval(input()) offset = not (int(S[0]) ^ (K & 1)) runs = [] prev = S[0] run = 0 for c in S: if c != prev: runs.append(run) run = 0 prev = c run += 1 runs.append(run) L = len(runs) candidates = [] prev = sum(runs[max(0, offset -...
_, K = list(map(int, input().split())) S = eval(input()) offset = not (int(S[0]) ^ (K & 1)) runs = [] prev = S[0] run = 0 for c in S: if c != prev: runs.append(run) run = 0 prev = c run += 1 runs.append(run) L = len(runs) candidates = [] prev = sum(runs[max(0, offset -...
38
39
754
768
_, K = list(map(int, input().split())) S = eval(input()) offset = not (int(S[0]) ^ (K & 1)) runs = [] prev = S[0] run = 0 for c in S: if c != prev: runs.append(run) run = 0 prev = c run += 1 runs.append(run) L = len(runs) candidates = [] prev = sum(runs[max(0, offset - K) : min(L, offset + K...
_, K = list(map(int, input().split())) S = eval(input()) offset = not (int(S[0]) ^ (K & 1)) runs = [] prev = S[0] run = 0 for c in S: if c != prev: runs.append(run) run = 0 prev = c run += 1 runs.append(run) L = len(runs) candidates = [] prev = sum(runs[max(0, offset - K) : min(L, offset + K...
false
2.564103
[ "- answer = max(answer, prev)", "+ if prev > answer:", "+ answer = prev" ]
false
0.007454
0.054652
0.136399
[ "s872003367", "s771691229" ]
u074220993
p03611
python
s903682048
s025093312
186
107
24,212
32,028
Accepted
Accepted
42.47
N = int(eval(input())) A = [int(x) for x in input().split()] data = {} for a in A: for i in range(3): #a-1,a,a+1をカウント if a-1+i in data: data[a-1+i] += 1 else: data[a-1+i] = 1 #カウントしたものの最大値が答え ans = 0 for d in list(data.values()): ans = max(ans,...
from collections import Counter with open(0) as f: N, *a = list(map(int, f.read().split())) data = [x-1 for x in a] + [x for x in a] + [x+1 for x in a] ans = Counter(data).most_common(1)[0][1] print(ans)
16
6
323
206
N = int(eval(input())) A = [int(x) for x in input().split()] data = {} for a in A: for i in range(3): # a-1,a,a+1をカウント if a - 1 + i in data: data[a - 1 + i] += 1 else: data[a - 1 + i] = 1 # カウントしたものの最大値が答え ans = 0 for d in list(data.values()): ans = max(ans, d) print(ans...
from collections import Counter with open(0) as f: N, *a = list(map(int, f.read().split())) data = [x - 1 for x in a] + [x for x in a] + [x + 1 for x in a] ans = Counter(data).most_common(1)[0][1] print(ans)
false
62.5
[ "-N = int(eval(input()))", "-A = [int(x) for x in input().split()]", "-data = {}", "-for a in A:", "- for i in range(3): # a-1,a,a+1をカウント", "- if a - 1 + i in data:", "- data[a - 1 + i] += 1", "- else:", "- data[a - 1 + i] = 1", "-# カウントしたものの最大値が答え", "-ans...
false
0.040256
0.059335
0.678446
[ "s903682048", "s025093312" ]