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
u905895868
p03288
python
s132015231
s606233422
29
26
9,088
9,072
Accepted
Accepted
10.34
rating = int(eval(input())) if rating < 1200: print('ABC') elif 1200 <= rating < 2800: print('ARC') elif rating >= 2800: print('AGC')
r = int(eval(input())) if r < 1200: print('ABC') elif r < 2800: print('ARC') else: print('AGC')
8
8
148
110
rating = int(eval(input())) if rating < 1200: print("ABC") elif 1200 <= rating < 2800: print("ARC") elif rating >= 2800: print("AGC")
r = int(eval(input())) if r < 1200: print("ABC") elif r < 2800: print("ARC") else: print("AGC")
false
0
[ "-rating = int(eval(input()))", "-if rating < 1200:", "+r = int(eval(input()))", "+if r < 1200:", "-elif 1200 <= rating < 2800:", "+elif r < 2800:", "-elif rating >= 2800:", "+else:" ]
false
0.106369
0.045005
2.363518
[ "s132015231", "s606233422" ]
u165318982
p03835
python
s948109676
s633781343
1,401
991
9,136
9,116
Accepted
Accepted
29.26
K, S = list(map(int, input().split())) answer = 0 for i in range(K+1): for j in range(K+1): if S - (i + j) >= 0 and S - (i + j) <= K: answer += 1 print((str(answer)))
K, S = list(map(int, input().split())) answer = 0 for i in range(K+1): for j in range(K+1): if 0 <= S - (i + j) <= K: answer += 1 print(answer)
9
9
186
165
K, S = list(map(int, input().split())) answer = 0 for i in range(K + 1): for j in range(K + 1): if S - (i + j) >= 0 and S - (i + j) <= K: answer += 1 print((str(answer)))
K, S = list(map(int, input().split())) answer = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= S - (i + j) <= K: answer += 1 print(answer)
false
0
[ "- if S - (i + j) >= 0 and S - (i + j) <= K:", "+ if 0 <= S - (i + j) <= K:", "-print((str(answer)))", "+print(answer)" ]
false
0.094183
0.065383
1.440482
[ "s948109676", "s633781343" ]
u072717685
p03681
python
s725535124
s658070135
703
42
5,180
3,064
Accepted
Accepted
94.03
from math import factorial large_p = 10**9 + 7 def main(): n, m = list(map(int, input().split())) if (abs(n-m)) >= 2: print((0)) else: np = factorial(n) mp = factorial(m) if abs(n-m) == 1: r = (np * mp) % large_p print(r) else: ...
large_p = 10**9 + 7 def main(): n, m = list(map(int, input().split())) if (abs(n-m)) >= 2: print((0)) else: np = 1 for i in range(n,0,-1): np = (np * i) % large_p mp = 1 for i in range(m,0,-1): mp = (mp * i) % large_p ...
20
24
419
519
from math import factorial large_p = 10**9 + 7 def main(): n, m = list(map(int, input().split())) if (abs(n - m)) >= 2: print((0)) else: np = factorial(n) mp = factorial(m) if abs(n - m) == 1: r = (np * mp) % large_p print(r) else: ...
large_p = 10**9 + 7 def main(): n, m = list(map(int, input().split())) if (abs(n - m)) >= 2: print((0)) else: np = 1 for i in range(n, 0, -1): np = (np * i) % large_p mp = 1 for i in range(m, 0, -1): mp = (mp * i) % large_p if abs(n -...
false
16.666667
[ "-from math import factorial", "-", "- np = factorial(n)", "- mp = factorial(m)", "+ np = 1", "+ for i in range(n, 0, -1):", "+ np = (np * i) % large_p", "+ mp = 1", "+ for i in range(m, 0, -1):", "+ mp = (mp * i) % large_p" ]
false
0.075662
0.032538
2.325353
[ "s725535124", "s658070135" ]
u766684188
p03380
python
s627900143
s758660222
117
77
14,428
14,060
Accepted
Accepted
34.19
n=int(eval(input())) A=list(map(int,input().split())) A=sorted(A,reverse=True) p=A[0] c=p/2 q=0 for i in A[1:]: if abs(q-c)>=abs(i-c): q=i print((p,q))
n=int(eval(input())) A=list(map(int,input().split())) p=max(A) c=p/2 q=0 for i in A: if abs(q-c)>=abs(i-c): q=i print((p,q))
10
9
164
136
n = int(eval(input())) A = list(map(int, input().split())) A = sorted(A, reverse=True) p = A[0] c = p / 2 q = 0 for i in A[1:]: if abs(q - c) >= abs(i - c): q = i print((p, q))
n = int(eval(input())) A = list(map(int, input().split())) p = max(A) c = p / 2 q = 0 for i in A: if abs(q - c) >= abs(i - c): q = i print((p, q))
false
10
[ "-A = sorted(A, reverse=True)", "-p = A[0]", "+p = max(A)", "-for i in A[1:]:", "+for i in A:" ]
false
0.041217
0.042189
0.976953
[ "s627900143", "s758660222" ]
u285443936
p03165
python
s730323663
s957052467
546
456
112,988
112,092
Accepted
Accepted
16.48
s = eval(input()) t = eval(input()) Ls = len(s) Lt = len(t) dp = [[0]*(Ls+1) for i in range(Lt+1)] Lans = 0 for i in range(1,Lt+1): for j in range(1,Ls+1): if s[j-1] == t[i-1]: dp[i][j] = dp[i-1][j-1] + 1 else: dp[i][j] = max(dp[i-1][j], dp[i][j-1]) Lans = max(Lans,dp[i][j]) i...
s = eval(input()) t = eval(input()) ls = len(s) lt = len(t) dp = [[0]*(ls+1) for i in range(lt+1)] ans = "" for i in range(1,lt+1): for j in range(1,ls+1): if s[j-1] == t[i-1]: dp[i][j] = dp[i-1][j-1]+1 else: dp[i][j] = max(dp[i-1][j],dp[i][j-1]) i = lt j = ls ...
30
26
547
510
s = eval(input()) t = eval(input()) Ls = len(s) Lt = len(t) dp = [[0] * (Ls + 1) for i in range(Lt + 1)] Lans = 0 for i in range(1, Lt + 1): for j in range(1, Ls + 1): if s[j - 1] == t[i - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) ...
s = eval(input()) t = eval(input()) ls = len(s) lt = len(t) dp = [[0] * (ls + 1) for i in range(lt + 1)] ans = "" for i in range(1, lt + 1): for j in range(1, ls + 1): if s[j - 1] == t[i - 1]: dp[i][j] = dp[i - 1][j - 1] + 1 else: dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) i ...
false
13.333333
[ "-Ls = len(s)", "-Lt = len(t)", "-dp = [[0] * (Ls + 1) for i in range(Lt + 1)]", "-Lans = 0", "-for i in range(1, Lt + 1):", "- for j in range(1, Ls + 1):", "+ls = len(s)", "+lt = len(t)", "+dp = [[0] * (ls + 1) for i in range(lt + 1)]", "+ans = \"\"", "+for i in range(1, lt + 1):", "+ f...
false
0.007441
0.042528
0.174961
[ "s730323663", "s957052467" ]
u652656291
p02702
python
s979393144
s339648654
112
89
11,972
9,040
Accepted
Accepted
20.54
s = list(map(int,list(eval(input()))))[::-1] n = len(s) chk = [0]*2019 chk[0] = 1 t,m,ans = 1,0,0 for i in s: m = (m+t*i)%2019 ans += chk[m] chk[m] += 1 t = t*10%2019 print(ans)
def main(): S = eval(input()) u = 0 H = [0] * 2019 H[0] = 1 m = 1 r = 0 for s in reversed(S): u = (u + m * int(s)) % 2019 r += H[u] H[u] += 1 m = (m * 10) % 2019 return r print((main()))
11
16
198
260
s = list(map(int, list(eval(input()))))[::-1] n = len(s) chk = [0] * 2019 chk[0] = 1 t, m, ans = 1, 0, 0 for i in s: m = (m + t * i) % 2019 ans += chk[m] chk[m] += 1 t = t * 10 % 2019 print(ans)
def main(): S = eval(input()) u = 0 H = [0] * 2019 H[0] = 1 m = 1 r = 0 for s in reversed(S): u = (u + m * int(s)) % 2019 r += H[u] H[u] += 1 m = (m * 10) % 2019 return r print((main()))
false
31.25
[ "-s = list(map(int, list(eval(input()))))[::-1]", "-n = len(s)", "-chk = [0] * 2019", "-chk[0] = 1", "-t, m, ans = 1, 0, 0", "-for i in s:", "- m = (m + t * i) % 2019", "- ans += chk[m]", "- chk[m] += 1", "- t = t * 10 % 2019", "-print(ans)", "+def main():", "+ S = eval(input(...
false
0.079349
0.042054
1.886818
[ "s979393144", "s339648654" ]
u723583932
p03160
python
s181273551
s247578994
142
131
13,928
13,924
Accepted
Accepted
7.75
#dp educational contest a frog1 漸化式 n=int(eval(input())) h=list(map(int,input().split())) dp=[0]*n for i in range(1,n): if i==1: dp[i]=abs(h[i]-h[i-1]) #0番目と1番目の差 else: dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2])) ans=dp[n-1] print(ans)
#a n=int(eval(input())) h=list(map(int,input().split())) N=100010 dp=[0]*N for i in range(1,n): if i==1: dp[i]=dp[i-1]+abs(h[i-1]-h[i]) else: dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i])) print((dp[n-1]))
11
14
280
252
# dp educational contest a frog1 漸化式 n = int(eval(input())) h = list(map(int, input().split())) dp = [0] * n for i in range(1, n): if i == 1: dp[i] = abs(h[i] - h[i - 1]) # 0番目と1番目の差 else: dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2])) ans = dp[n - 1] print(ans)...
# a n = int(eval(input())) h = list(map(int, input().split())) N = 100010 dp = [0] * N for i in range(1, n): if i == 1: dp[i] = dp[i - 1] + abs(h[i - 1] - h[i]) else: dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i])) print((dp[n - 1]))
false
21.428571
[ "-# dp educational contest a frog1 漸化式", "+# a", "-dp = [0] * n", "+N = 100010", "+dp = [0] * N", "- dp[i] = abs(h[i] - h[i - 1]) # 0番目と1番目の差", "+ dp[i] = dp[i - 1] + abs(h[i - 1] - h[i])", "- dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))", "-a...
false
0.041248
0.129736
0.31794
[ "s181273551", "s247578994" ]
u280552586
p03639
python
s764055679
s169882260
82
67
14,252
20,000
Accepted
Accepted
18.29
n = int(eval(input())) A = list(map(int, input().split())) checker = [] for a in A: cnt = 0 if a % 2 == 0: cnt = 1 if a % 4 == 0: cnt += 1 checker.append(cnt) count_2 = checker.count(2) count_1 = checker.count(1) count_0 = checker.count(0) if (count_0 <= count_2+1 and ...
n = int(eval(input())) A = list(map(int, input().split())) cnt4 = 0 cnt2 = 0 other = 0 for a in A: if a % 4 == 0: cnt4 += 1 continue if a % 2 == 0: cnt2 += 1 else: other += 1 if cnt4+1 >= cnt2 + other or cnt4 >= other: print('Yes') else: print('No')
22
17
434
312
n = int(eval(input())) A = list(map(int, input().split())) checker = [] for a in A: cnt = 0 if a % 2 == 0: cnt = 1 if a % 4 == 0: cnt += 1 checker.append(cnt) count_2 = checker.count(2) count_1 = checker.count(1) count_0 = checker.count(0) if (count_0 <= count_2 + 1 and count_0 + count_1...
n = int(eval(input())) A = list(map(int, input().split())) cnt4 = 0 cnt2 = 0 other = 0 for a in A: if a % 4 == 0: cnt4 += 1 continue if a % 2 == 0: cnt2 += 1 else: other += 1 if cnt4 + 1 >= cnt2 + other or cnt4 >= other: print("Yes") else: print("No")
false
22.727273
[ "-checker = []", "+cnt4 = 0", "+cnt2 = 0", "+other = 0", "- cnt = 0", "+ if a % 4 == 0:", "+ cnt4 += 1", "+ continue", "- cnt = 1", "- if a % 4 == 0:", "- cnt += 1", "- checker.append(cnt)", "-count_2 = checker.count(2)", "-count_1 = checker.count(1)...
false
0.037224
0.080253
0.463832
[ "s764055679", "s169882260" ]
u515207244
p03157
python
s907360209
s905134238
1,197
367
214,876
59,608
Accepted
Accepted
69.34
from collections import * import sys sys.setrecursionlimit(10**6) H, W = list(map(int, input().split())) mas = [] for i in range(H): mas.append(eval(input())) color = [] for i in range(H): color.append([-1] * W) def DFS(node, c_color): x = node[0] y = node[1] nb = [[x, y-1], [...
from collections import deque H, W = list(map(int, input().split())) S = [] for i in range(H): s = eval(input()) temp = [] for j in range(W): temp.append(s[j]) S.append(temp) ret = 0 for i in range(H): for j in range(W): if S[i][j] != '?': q = deque() ...
57
37
1,506
978
from collections import * import sys sys.setrecursionlimit(10**6) H, W = list(map(int, input().split())) mas = [] for i in range(H): mas.append(eval(input())) color = [] for i in range(H): color.append([-1] * W) def DFS(node, c_color): x = node[0] y = node[1] nb = [[x, y - 1], [x, y + 1], [x + 1,...
from collections import deque H, W = list(map(int, input().split())) S = [] for i in range(H): s = eval(input()) temp = [] for j in range(W): temp.append(s[j]) S.append(temp) ret = 0 for i in range(H): for j in range(W): if S[i][j] != "?": q = deque() q.appen...
false
35.087719
[ "-from collections import *", "-import sys", "+from collections import deque", "-sys.setrecursionlimit(10**6)", "-mas = []", "+S = []", "- mas.append(eval(input()))", "-color = []", "-for i in range(H):", "- color.append([-1] * W)", "-", "-", "-def DFS(node, c_color):", "- x = nod...
false
0.081784
0.129897
0.629611
[ "s907360209", "s905134238" ]
u600402037
p03682
python
s430433214
s241056175
1,722
1,383
51,880
51,112
Accepted
Accepted
19.69
from heapq import * def find(x): parent = data[x] if parent < 0: return x root = find(parent) data[x] = root return root def union(x, y): root, second = find(x), find(y) if root == second: return False if height[root] < data[second]: second, root = root, second ...
from heapq import * def main(): def find(x): parent = data[x] if parent < 0: return x root = find(parent) data[x] = root return root def union(x, y): root, second = find(x), find(y) if root == second: return False if height[root] < d...
54
58
1,094
1,306
from heapq import * def find(x): parent = data[x] if parent < 0: return x root = find(parent) data[x] = root return root def union(x, y): root, second = find(x), find(y) if root == second: return False if height[root] < data[second]: second, root = root, secon...
from heapq import * def main(): def find(x): parent = data[x] if parent < 0: return x root = find(parent) data[x] = root return root def union(x, y): root, second = find(x), find(y) if root == second: return False if heig...
false
6.896552
[ "-def find(x):", "- parent = data[x]", "- if parent < 0:", "- return x", "- root = find(parent)", "- data[x] = root", "- return root", "+def main():", "+ def find(x):", "+ parent = data[x]", "+ if parent < 0:", "+ return x", "+ root = ...
false
0.048988
0.046195
1.060453
[ "s430433214", "s241056175" ]
u150984829
p02269
python
s320838415
s291490043
1,480
1,130
31,356
33,408
Accepted
Accepted
23.65
import sys d=set() eval(input()) for e in sys.stdin: c,g=e.split() if'i'==c[0]:d|=set([g]) else:print((['no','yes'][g in d]))
import sys d={} eval(input()) for e in sys.stdin: c,g=e.split() if'i'==c[0]:d[g]=0 else:print((['no','yes'][g in d]))
7
7
127
119
import sys d = set() eval(input()) for e in sys.stdin: c, g = e.split() if "i" == c[0]: d |= set([g]) else: print((["no", "yes"][g in d]))
import sys d = {} eval(input()) for e in sys.stdin: c, g = e.split() if "i" == c[0]: d[g] = 0 else: print((["no", "yes"][g in d]))
false
0
[ "-d = set()", "+d = {}", "- d |= set([g])", "+ d[g] = 0" ]
false
0.041246
0.042427
0.972168
[ "s320838415", "s291490043" ]
u562935282
p03150
python
s391179749
s843798181
22
18
3,188
2,940
Accepted
Accepted
18.18
import re s = eval(input()) t = 'keyence' for i in range(len(t)): ptn = '^' + t[:i] + '.*' + t[i:] + '$' # print(ptn) m = re.match(ptn, s) if m: break if m: print('YES') else: print('NO')
s = eval(input()) N = len(s) bl = False for i in range(N): for j in range(i, N): t = s[:i] + s[j:] if t == 'keyence': bl = True break print(('YES' if bl else 'NO'))
15
12
223
214
import re s = eval(input()) t = "keyence" for i in range(len(t)): ptn = "^" + t[:i] + ".*" + t[i:] + "$" # print(ptn) m = re.match(ptn, s) if m: break if m: print("YES") else: print("NO")
s = eval(input()) N = len(s) bl = False for i in range(N): for j in range(i, N): t = s[:i] + s[j:] if t == "keyence": bl = True break print(("YES" if bl else "NO"))
false
20
[ "-import re", "-", "-t = \"keyence\"", "-for i in range(len(t)):", "- ptn = \"^\" + t[:i] + \".*\" + t[i:] + \"$\"", "- # print(ptn)", "- m = re.match(ptn, s)", "- if m:", "- break", "-if m:", "- print(\"YES\")", "-else:", "- print(\"NO\")", "+N = len(s)", "+bl =...
false
0.128393
0.107705
1.192075
[ "s391179749", "s843798181" ]
u036104576
p02814
python
s507201235
s934732087
524
249
14,528
14,544
Accepted
Accepted
52.48
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10 ** 7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import reduce # from math import *...
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10 ** 7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import reduce # from math import *...
40
31
778
729
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10**7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import reduce # from math import * from fractions import *...
import sys import itertools # import numpy as np import time import math sys.setrecursionlimit(10**7) from collections import defaultdict read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import reduce # from math import * from fractions import *...
false
22.5
[ "-A = list([int(x) // 2 for x in readline().split()])", "-", "-", "-def f(n):", "- cnt = 0", "- while n % 2 == 0:", "- n //= 2", "- cnt += 1", "- return cnt", "-", "-", "-t = f(A[0])", "-for i in range(N):", "- if f(A[i]) != t:", "- print((0))", "- ...
false
0.051977
0.09238
0.562647
[ "s507201235", "s934732087" ]
u283929013
p04001
python
s425295873
s098853535
322
21
20,096
3,188
Accepted
Accepted
93.48
import numpy as np S = eval(input()) b = np.zeros(len(S)-1) num = 0 for i in range(2**(len(S)-1) -1): str = S[0] for k in range(len(S)-1): if b[k] == 0: str = str + S[k+1] else: str = str + "+" + S[k+1] num += eval(str) b[0] += 1 ...
S = eval(input()) allsum = 0 for i in range(2**(len(S)-1)): bi = format(i,"b") bi = "0" * (len(S) - len(bi) - 1) + bi st = S[0] stsum = 0 for k in range(len(S) - 1): if bi[k] == "0": stsum += int(st) st = S[k+1] else: st = st + S[k+1]...
32
17
611
372
import numpy as np S = eval(input()) b = np.zeros(len(S) - 1) num = 0 for i in range(2 ** (len(S) - 1) - 1): str = S[0] for k in range(len(S) - 1): if b[k] == 0: str = str + S[k + 1] else: str = str + "+" + S[k + 1] num += eval(str) b[0] += 1 for k in range(l...
S = eval(input()) allsum = 0 for i in range(2 ** (len(S) - 1)): bi = format(i, "b") bi = "0" * (len(S) - len(bi) - 1) + bi st = S[0] stsum = 0 for k in range(len(S) - 1): if bi[k] == "0": stsum += int(st) st = S[k + 1] else: st = st + S[k + 1] ...
false
46.875
[ "-import numpy as np", "-", "-b = np.zeros(len(S) - 1)", "-num = 0", "-for i in range(2 ** (len(S) - 1) - 1):", "- str = S[0]", "+allsum = 0", "+for i in range(2 ** (len(S) - 1)):", "+ bi = format(i, \"b\")", "+ bi = \"0\" * (len(S) - len(bi) - 1) + bi", "+ st = S[0]", "+ stsum ...
false
0.393196
0.037715
10.425579
[ "s425295873", "s098853535" ]
u021019433
p02866
python
s443093539
s037980142
183
168
22,636
22,636
Accepted
Accepted
8.2
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = i = 1 while True: x = c.get(i, 0) if x == 0: break r = r * pow(p, x, M) % M p = x; n -= p; i += 1 print(((r, 0)[...
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = i = 1 try: while True: x = c.get(i) r = r * pow(p, x, M) % M p = x; n -= p; i += 1 ...
16
17
315
351
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = i = 1 while True: x = c.get(i, 0) if x == 0: break r = r * pow(p, x, M) % M p = x n -= p ...
from collections import Counter M = 998244353 n = int(eval(input())) a = list(map(int, input().split())) x, c = next(a), Counter(a) r = 0 if x == c[0] == 0: r = p = i = 1 try: while True: x = c.get(i) r = r * pow(p, x, M) % M p = x n -= p i +=...
false
5.882353
[ "- while True:", "- x = c.get(i, 0)", "- if x == 0:", "- break", "- r = r * pow(p, x, M) % M", "- p = x", "- n -= p", "- i += 1", "+ try:", "+ while True:", "+ x = c.get(i)", "+ r = r * pow(p, x, M) % M", ...
false
0.04119
0.042969
0.958605
[ "s443093539", "s037980142" ]
u249218427
p02632
python
s895257974
s048023966
481
420
193,812
181,424
Accepted
Accepted
12.68
# -*- coding: utf-8 -*- K = int(eval(input())) S = len(eval(input())) mod = 10**9+7 N = K+S # mod上の逆元の計算 inverse = [0, 1] for i in range(2, N+1): inverse.append((-inverse[mod%i]*(mod//i))%mod) # 階乗とその逆元の計算 factorial = [1, 1] factorial_inv = [1, 1] for i in range(2, N+1): factorial.append((f...
K = int(eval(input())) S = len(eval(input())) mod = 10**9+7 N = K+S inverse = [0, 1] for i in range(2, N+1): inverse.append((-inverse[mod%i]*(mod//i))%mod) factorial = 1 factorial_inv = [1, 1] for i in range(2, N+1): factorial = (factorial*i)%mod factorial_inv.append((factorial_inv[-1]*inve...
29
26
606
556
# -*- coding: utf-8 -*- K = int(eval(input())) S = len(eval(input())) mod = 10**9 + 7 N = K + S # mod上の逆元の計算 inverse = [0, 1] for i in range(2, N + 1): inverse.append((-inverse[mod % i] * (mod // i)) % mod) # 階乗とその逆元の計算 factorial = [1, 1] factorial_inv = [1, 1] for i in range(2, N + 1): factorial.append((factor...
K = int(eval(input())) S = len(eval(input())) mod = 10**9 + 7 N = K + S inverse = [0, 1] for i in range(2, N + 1): inverse.append((-inverse[mod % i] * (mod // i)) % mod) factorial = 1 factorial_inv = [1, 1] for i in range(2, N + 1): factorial = (factorial * i) % mod factorial_inv.append((factorial_inv[-1] *...
false
10.344828
[ "-# -*- coding: utf-8 -*-", "-# mod上の逆元の計算", "-# 階乗とその逆元の計算", "-factorial = [1, 1]", "+factorial = 1", "- factorial.append((factorial[-1] * i) % mod)", "+ factorial = (factorial * i) % mod", "- answer = (", "- answer + pow * factorial[N] * factorial_inv[i] * factorial_inv[N - i]", ...
false
0.066503
0.042941
1.548681
[ "s895257974", "s048023966" ]
u226108478
p03474
python
s560077460
s658604086
20
17
3,188
2,940
Accepted
Accepted
15
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem B if __name__ == '__main__': import re A, B = list(map(str, input().split())) S = str(eval(input())) text = r'\d{' + A + '}\-\d{' + B + '}' result = re.match(text, S) if result: print("Yes") else: ...
# -*- coding: utf-8 -*- def main(): a, b = list(map(int, input().split())) s = eval(input()) if s[:a].isdigit() and s[a:a + 1] == '-' and s[a + 1:].isdigit(): print('Yes') else: print('No') if __name__ == '__main__': main()
18
15
330
267
# -*- coding: utf-8 -*- # AtCoder Beginner Contest # Problem B if __name__ == "__main__": import re A, B = list(map(str, input().split())) S = str(eval(input())) text = r"\d{" + A + "}\-\d{" + B + "}" result = re.match(text, S) if result: print("Yes") else: print("No")
# -*- coding: utf-8 -*- def main(): a, b = list(map(int, input().split())) s = eval(input()) if s[:a].isdigit() and s[a : a + 1] == "-" and s[a + 1 :].isdigit(): print("Yes") else: print("No") if __name__ == "__main__": main()
false
16.666667
[ "-# AtCoder Beginner Contest", "-# Problem B", "-if __name__ == \"__main__\":", "- import re", "-", "- A, B = list(map(str, input().split()))", "- S = str(eval(input()))", "- text = r\"\\d{\" + A + \"}\\-\\d{\" + B + \"}\"", "- result = re.match(text, S)", "- if result:", "+def...
false
0.152713
0.052678
2.899011
[ "s560077460", "s658604086" ]
u488127128
p02971
python
s015711180
s699780256
296
210
14,100
26,620
Accepted
Accepted
29.05
import sys input = sys.stdin.readline n = int(eval(input())) numbers = [int(eval(input())) for i in range(n)] m1,m2 = sorted(numbers, reverse=1)[:2] b = [m2 if x==m1 else m1 for x in numbers] for s in b: print(s)
import sys input = sys.stdin.readline n = int(eval(input())) numbers = [int(eval(input())) for i in range(n)] a1,a2 = sorted(numbers, reverse=1)[:2] b = [a2 if x==a1 else a1 for x in numbers] print(('\n'.join(map(str,b))))
12
9
219
218
import sys input = sys.stdin.readline n = int(eval(input())) numbers = [int(eval(input())) for i in range(n)] m1, m2 = sorted(numbers, reverse=1)[:2] b = [m2 if x == m1 else m1 for x in numbers] for s in b: print(s)
import sys input = sys.stdin.readline n = int(eval(input())) numbers = [int(eval(input())) for i in range(n)] a1, a2 = sorted(numbers, reverse=1)[:2] b = [a2 if x == a1 else a1 for x in numbers] print(("\n".join(map(str, b))))
false
25
[ "-m1, m2 = sorted(numbers, reverse=1)[:2]", "-b = [m2 if x == m1 else m1 for x in numbers]", "-for s in b:", "- print(s)", "+a1, a2 = sorted(numbers, reverse=1)[:2]", "+b = [a2 if x == a1 else a1 for x in numbers]", "+print((\"\\n\".join(map(str, b))))" ]
false
0.127533
0.063311
2.014394
[ "s015711180", "s699780256" ]
u707498674
p02866
python
s998417622
s616473654
186
150
14,004
19,936
Accepted
Accepted
19.35
MOD = 998244353 def beki(x, n): if n == 0: return 1 if n % 2 == 0: return beki(x * x % MOD, n // 2) % MOD else: return x * beki(x, n - 1) % MOD N = int(eval(input())) Orig = list(map(int, input().split())) D = sorted(Orig) ans = 1 cnt = 1 precnt = 1 if Orig[0] != 0: ans = ...
def mod_pow(x, n, MOD): if n == 0: return 1 if n % 2 == 0: result = mod_pow(x * x, n // 2, MOD) return result % MOD else: result = x * mod_pow(x, n - 1, MOD) return result % MOD from collections import Counter MOD = 998244353 N = int(eval(input(...
45
34
703
600
MOD = 998244353 def beki(x, n): if n == 0: return 1 if n % 2 == 0: return beki(x * x % MOD, n // 2) % MOD else: return x * beki(x, n - 1) % MOD N = int(eval(input())) Orig = list(map(int, input().split())) D = sorted(Orig) ans = 1 cnt = 1 precnt = 1 if Orig[0] != 0: ans = 0 i...
def mod_pow(x, n, MOD): if n == 0: return 1 if n % 2 == 0: result = mod_pow(x * x, n // 2, MOD) return result % MOD else: result = x * mod_pow(x, n - 1, MOD) return result % MOD from collections import Counter MOD = 998244353 N = int(eval(input())) D = list(map(int...
false
24.444444
[ "-MOD = 998244353", "-", "-", "-def beki(x, n):", "+def mod_pow(x, n, MOD):", "- return beki(x * x % MOD, n // 2) % MOD", "+ result = mod_pow(x * x, n // 2, MOD)", "+ return result % MOD", "- return x * beki(x, n - 1) % MOD", "+ result = x * mod_pow(x, n - 1, MOD...
false
0.170304
0.178182
0.955786
[ "s998417622", "s616473654" ]
u387774811
p03078
python
s206714384
s158692163
838
351
4,596
57,304
Accepted
Accepted
58.11
import heapq # heapqライブラリのimport 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) check=[[0,0,0]] lst =[(-(A[0]+B[0]+C[0]),0,0,0)] heapq.heapify(lst) for...
import heapq # heapqライブラリのimport 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) dic={} dic[(0,0,0)]=1 lst =[(-(A[0]+B[0]+C[0]),0,0,0)] heapq.heapify(ls...
29
30
795
774
import heapq # heapqライブラリのimport 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) check = [[0, 0, 0]] lst = [(-(A[0] + B[0] + C[0]), 0, 0, 0)] heapq.he...
import heapq # heapqライブラリのimport 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) dic = {} dic[(0, 0, 0)] = 1 lst = [(-(A[0] + B[0] + C[0]), 0, 0, 0)] ...
false
3.333333
[ "-check = [[0, 0, 0]]", "+dic = {}", "+dic[(0, 0, 0)] = 1", "- if [a + 1, b, c] not in check:", "+ if (a + 1, b, c) not in dic:", "- check.append([a + 1, b, c])", "+ dic[(a + 1, b, c)] = 1", "- if [a, b + 1, c] not in check:", "+ if (a, b + 1, c) not...
false
0.0435
0.042355
1.027019
[ "s206714384", "s158692163" ]
u036514535
p02660
python
s282450416
s217701957
249
169
9,116
9,204
Accepted
Accepted
32.13
import math N = int(eval(input())) if N == 1: print((0)) exit() div = {} i = 2 while i*i <= N: while N % i == 0: N = N // i if i in div: div[i] += 1 else: div[i] = 1 if N == 1: break i += 1 if N != 1: div[N] = 1 ans = 0 ...
import math N = int(eval(input())) if N == 1: print((0)) exit() div = {} for i in range(2, int(math.sqrt(N))+1): while N % i == 0: N = N // i if i in div: div[i] += 1 else: div[i] = 1 if N == 1: break if N != 1: div[N] = 1 ans ...
27
25
427
432
import math N = int(eval(input())) if N == 1: print((0)) exit() div = {} i = 2 while i * i <= N: while N % i == 0: N = N // i if i in div: div[i] += 1 else: div[i] = 1 if N == 1: break i += 1 if N != 1: div[N] = 1 ans = 0 for v in list(div...
import math N = int(eval(input())) if N == 1: print((0)) exit() div = {} for i in range(2, int(math.sqrt(N)) + 1): while N % i == 0: N = N // i if i in div: div[i] += 1 else: div[i] = 1 if N == 1: break if N != 1: div[N] = 1 ans = 0 for v in l...
false
7.407407
[ "-i = 2", "-while i * i <= N:", "+for i in range(2, int(math.sqrt(N)) + 1):", "- i += 1" ]
false
0.049928
0.135851
0.367522
[ "s282450416", "s217701957" ]
u411203878
p03545
python
s233420962
s005060674
180
74
38,568
61,872
Accepted
Accepted
58.89
import itertools s=eval(input()) moji = [] for i in s: moji.append(int(i)) ans = [] for j in itertools.product([1,-1], repeat=4): if moji[0]*j[0]+moji[1]*j[1]+moji[2]*j[2]+moji[3]*j[3] == 7: if j[0] == 1: ans.append(moji[0]) else: ans.append('-') ...
s = list(eval(input())) ans = [] for i in ['+', '-']: for j in ['+', '-']: for k in ['+', '-']: tmp = int(s[0]) if i == '+': tmp += int(s[1]) else: tmp -= int(s[1]) if j == '+': tmp += int(s[2]) ...
35
22
900
608
import itertools s = eval(input()) moji = [] for i in s: moji.append(int(i)) ans = [] for j in itertools.product([1, -1], repeat=4): if moji[0] * j[0] + moji[1] * j[1] + moji[2] * j[2] + moji[3] * j[3] == 7: if j[0] == 1: ans.append(moji[0]) else: ans.append("-") ...
s = list(eval(input())) ans = [] for i in ["+", "-"]: for j in ["+", "-"]: for k in ["+", "-"]: tmp = int(s[0]) if i == "+": tmp += int(s[1]) else: tmp -= int(s[1]) if j == "+": tmp += int(s[2]) else:...
false
37.142857
[ "-import itertools", "-", "-s = eval(input())", "-moji = []", "-for i in s:", "- moji.append(int(i))", "+s = list(eval(input()))", "-for j in itertools.product([1, -1], repeat=4):", "- if moji[0] * j[0] + moji[1] * j[1] + moji[2] * j[2] + moji[3] * j[3] == 7:", "- if j[0] == 1:", "-...
false
0.088912
0.04753
1.87064
[ "s233420962", "s005060674" ]
u105302073
p03285
python
s092933859
s259530269
19
17
3,064
2,940
Accepted
Accepted
10.53
N = int(eval(input())) ret = "No" for c_i in range(N + 1): for d_i in range(N + 1): total = 4 * c_i + 7 * d_i if total == N: ret = "Yes" break print(ret)
N = int(eval(input())) ret = "No" for c_i in range(N // 4 + 1): for d_i in range(N // 7 + 1): total = 4 * c_i + 7 * d_i if total == N: ret = "Yes" break print(ret)
9
9
200
210
N = int(eval(input())) ret = "No" for c_i in range(N + 1): for d_i in range(N + 1): total = 4 * c_i + 7 * d_i if total == N: ret = "Yes" break print(ret)
N = int(eval(input())) ret = "No" for c_i in range(N // 4 + 1): for d_i in range(N // 7 + 1): total = 4 * c_i + 7 * d_i if total == N: ret = "Yes" break print(ret)
false
0
[ "-for c_i in range(N + 1):", "- for d_i in range(N + 1):", "+for c_i in range(N // 4 + 1):", "+ for d_i in range(N // 7 + 1):" ]
false
0.041585
0.042616
0.975817
[ "s092933859", "s259530269" ]
u729939940
p04001
python
s686818923
s135359158
27
23
9,124
9,116
Accepted
Accepted
14.81
S = list(eval(input())) def dfs(s, i): if i == len(S) - 1: return sum(map(int, s.split("+"))) return dfs(s + S[i + 1], i + 1) + dfs(s + "+" + S[i + 1], i + 1) print((dfs(S[0], 0)))
S = eval(input()) def dfs(s, i): if i == len(S) - 1: return sum(map(int, s.split("+"))) return dfs(s + S[i + 1], i + 1) + dfs(f"{s} + {S[i + 1]}", i + 1) print((dfs(S[0], 0)))
7
6
187
180
S = list(eval(input())) def dfs(s, i): if i == len(S) - 1: return sum(map(int, s.split("+"))) return dfs(s + S[i + 1], i + 1) + dfs(s + "+" + S[i + 1], i + 1) print((dfs(S[0], 0)))
S = eval(input()) def dfs(s, i): if i == len(S) - 1: return sum(map(int, s.split("+"))) return dfs(s + S[i + 1], i + 1) + dfs(f"{s} + {S[i + 1]}", i + 1) print((dfs(S[0], 0)))
false
14.285714
[ "-S = list(eval(input()))", "+S = eval(input())", "- return dfs(s + S[i + 1], i + 1) + dfs(s + \"+\" + S[i + 1], i + 1)", "+ return dfs(s + S[i + 1], i + 1) + dfs(f\"{s} + {S[i + 1]}\", i + 1)" ]
false
0.06264
0.077048
0.812988
[ "s686818923", "s135359158" ]
u684305751
p02803
python
s151857191
s890447576
529
258
18,580
3,188
Accepted
Accepted
51.23
H,W=list(map(int,input().split())) f=H*W d=[[0]*f for _ in range(f)] s=[eval(input()) for _ in range(H)] for i in range(H): for j in range(W-1): cnt=W*i+j d[cnt+1][cnt]=s[i][j]==s[i][j+1]=="." d[cnt][cnt+1]=s[i][j]==s[i][j+1]=="." for i in range(H-1): for j...
H,W=list(map(int,input().split())) s=[eval(input()) for _ in range(H)] G=[["#"]*(W+2) for _ in range(H+2)] for i in range(H): for j in range(W): G[i+1][j+1]=s[i][j] def search(y,x): q=[(y,x)] d=[[-1]*(W+2) for _ in range(H+2)] d[y][x]=0 while q: y1,x1=q.pop(0) ...
34
27
786
663
H, W = list(map(int, input().split())) f = H * W d = [[0] * f for _ in range(f)] s = [eval(input()) for _ in range(H)] for i in range(H): for j in range(W - 1): cnt = W * i + j d[cnt + 1][cnt] = s[i][j] == s[i][j + 1] == "." d[cnt][cnt + 1] = s[i][j] == s[i][j + 1] == "." for i in range(H - ...
H, W = list(map(int, input().split())) s = [eval(input()) for _ in range(H)] G = [["#"] * (W + 2) for _ in range(H + 2)] for i in range(H): for j in range(W): G[i + 1][j + 1] = s[i][j] def search(y, x): q = [(y, x)] d = [[-1] * (W + 2) for _ in range(H + 2)] d[y][x] = 0 while q: y1...
false
20.588235
[ "-f = H * W", "-d = [[0] * f for _ in range(f)]", "+G = [[\"#\"] * (W + 2) for _ in range(H + 2)]", "- for j in range(W - 1):", "- cnt = W * i + j", "- d[cnt + 1][cnt] = s[i][j] == s[i][j + 1] == \".\"", "- d[cnt][cnt + 1] = s[i][j] == s[i][j + 1] == \".\"", "-for i in range(H ...
false
0.266129
0.03993
6.664821
[ "s151857191", "s890447576" ]
u536600145
p02630
python
s415894210
s938432877
523
466
89,580
89,552
Accepted
Accepted
10.9
from collections import defaultdict N = int(eval(input())) raw_numbers = list(map(int, input().split())) total = sum(raw_numbers) numbers = defaultdict(int) for num in raw_numbers: numbers[num] += 1 Q = int(eval(input())) for i in range(Q): a, b = list(map(int, input().split())) ta...
from collections import defaultdict N = int(eval(input())) raw_numbers = list(map(int, input().split())) Q = int(eval(input())) total = sum(raw_numbers) numbers = defaultdict(int) for num in raw_numbers: numbers[num] += 1 for _ in range(Q): a, b = list(map(int, input().split())) take...
22
21
435
433
from collections import defaultdict N = int(eval(input())) raw_numbers = list(map(int, input().split())) total = sum(raw_numbers) numbers = defaultdict(int) for num in raw_numbers: numbers[num] += 1 Q = int(eval(input())) for i in range(Q): a, b = list(map(int, input().split())) taken = numbers[a] tota...
from collections import defaultdict N = int(eval(input())) raw_numbers = list(map(int, input().split())) Q = int(eval(input())) total = sum(raw_numbers) numbers = defaultdict(int) for num in raw_numbers: numbers[num] += 1 for _ in range(Q): a, b = list(map(int, input().split())) taken = numbers[a] tota...
false
4.545455
[ "+Q = int(eval(input()))", "-Q = int(eval(input()))", "-for i in range(Q):", "+for _ in range(Q):" ]
false
0.041741
0.042932
0.972268
[ "s415894210", "s938432877" ]
u515802486
p03807
python
s960134700
s361449227
77
70
14,112
14,108
Accepted
Accepted
9.09
n = eval(input()) a = [int(i) for i in input().split()] c = 0 ans = "NO" for i in a: if i%2 == 1: c += 1 if c % 2 == 0: ans = "YES" print(ans)
n = eval(input()) a = [int(i) for i in input().split()] c = 0 ans = "NO" for i in a: c += i if c%2 == 0: ans = "YES" print(ans)
18
17
177
153
n = eval(input()) a = [int(i) for i in input().split()] c = 0 ans = "NO" for i in a: if i % 2 == 1: c += 1 if c % 2 == 0: ans = "YES" print(ans)
n = eval(input()) a = [int(i) for i in input().split()] c = 0 ans = "NO" for i in a: c += i if c % 2 == 0: ans = "YES" print(ans)
false
5.555556
[ "- if i % 2 == 1:", "- c += 1", "+ c += i" ]
false
0.044377
0.045706
0.970926
[ "s960134700", "s361449227" ]
u993435350
p03221
python
s017078637
s370744395
766
663
33,560
33,556
Accepted
Accepted
13.45
import bisect N,M = list(map(int,input().split())) pref = [[] for i in range(N)] id = [[]] * M for i in range(M): p,y = list(map(int,input().split())) id[i] = [p,y] pref[p - 1].append(y) #pref[p - 1] = sorted(pref[p - 1]) for i in range(N): pref[i] = sorted(pref[i]) orders = [0] * N for ...
import bisect def main(): N,M = list(map(int,input().split())) pref = [[] for i in range(N)] id = [[]] * M for i in range(M): p,y = list(map(int,input().split())) id[i] = [p,y] pref[p - 1].append(y) #pref[p - 1] = sorted(pref[p - 1]) for i in range(N): pref[i] = sorted...
25
29
525
623
import bisect N, M = list(map(int, input().split())) pref = [[] for i in range(N)] id = [[]] * M for i in range(M): p, y = list(map(int, input().split())) id[i] = [p, y] pref[p - 1].append(y) # pref[p - 1] = sorted(pref[p - 1]) for i in range(N): pref[i] = sorted(pref[i]) orders = [0] * N for i in ...
import bisect def main(): N, M = list(map(int, input().split())) pref = [[] for i in range(N)] id = [[]] * M for i in range(M): p, y = list(map(int, input().split())) id[i] = [p, y] pref[p - 1].append(y) # pref[p - 1] = sorted(pref[p - 1]) for i in range(N): ...
false
13.793103
[ "-N, M = list(map(int, input().split()))", "-pref = [[] for i in range(N)]", "-id = [[]] * M", "-for i in range(M):", "- p, y = list(map(int, input().split()))", "- id[i] = [p, y]", "- pref[p - 1].append(y)", "- # pref[p - 1] = sorted(pref[p - 1])", "-for i in range(N):", "- pref[i]...
false
0.045499
0.045639
0.996946
[ "s017078637", "s370744395" ]
u682672120
p03722
python
s489191327
s270183895
172
129
79,092
74,736
Accepted
Accepted
25
from collections import deque def fast_bellman_ford(n, s, graph, edge_n, init_val): #どう? d = [init_val] * n d[s] = 0 q = deque([s]) checker = [-1] * n for i in range(n): m = len(q) for _ in range(m): vf = q.popleft() for vt, w in graph[vf]: ...
def bellman_ford(n, s, edges, init_val = float('inf')): d = [init_val] * n d[s] = 0 for _ in range(n): updated = False for vf, vt, w in edges: if d[vf] != init_val and d[vt] > d[vf] + w: d[vt] = d[vf] + w updated = True if not upd...
46
26
1,299
774
from collections import deque def fast_bellman_ford(n, s, graph, edge_n, init_val): # どう? d = [init_val] * n d[s] = 0 q = deque([s]) checker = [-1] * n for i in range(n): m = len(q) for _ in range(m): vf = q.popleft() for vt, w in graph[vf]: ...
def bellman_ford(n, s, edges, init_val=float("inf")): d = [init_val] * n d[s] = 0 for _ in range(n): updated = False for vf, vt, w in edges: if d[vf] != init_val and d[vt] > d[vf] + w: d[vt] = d[vf] + w updated = True if not updated: ...
false
43.478261
[ "-from collections import deque", "-", "-", "-def fast_bellman_ford(n, s, graph, edge_n, init_val): # どう?", "+def bellman_ford(n, s, edges, init_val=float(\"inf\")):", "- q = deque([s])", "- checker = [-1] * n", "- for i in range(n):", "- m = len(q)", "- for _ in range(m):"...
false
0.049069
0.107473
0.456569
[ "s489191327", "s270183895" ]
u729133443
p03352
python
s113770749
s457521041
199
19
38,256
2,940
Accepted
Accepted
90.45
*r,=list(range(1,32));x=int(eval(input()));print((max(b**p*(b**p<=x)for p in r[1:]for b in r)))
r=list(range(1,32));x=int(eval(input()));print((max(b**p*(b**p<=x)for p in r[1:]for b in r)))
1
1
81
79
(*r,) = list(range(1, 32)) x = int(eval(input())) print((max(b**p * (b**p <= x) for p in r[1:] for b in r)))
r = list(range(1, 32)) x = int(eval(input())) print((max(b**p * (b**p <= x) for p in r[1:] for b in r)))
false
0
[ "-(*r,) = list(range(1, 32))", "+r = list(range(1, 32))" ]
false
0.048578
0.040405
1.202288
[ "s113770749", "s457521041" ]
u583507988
p03557
python
s295243642
s968757057
267
240
29,116
29,492
Accepted
Accepted
10.11
import bisect n = int(eval(input())) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) c = sorted(list(map(int, input().split()))) ans = 0 for i in b: x = bisect.bisect_left(a,i) y = bisect.bisect_right(c, i) #print(x, y) ans = ans+x*(n-y) print(ans)
import bisect n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() ans = 0 for i in b: x = bisect.bisect_left(a, i) y = bisect.bisect_right(c, i) ans = ans + (x * (n-y)) print(ans)
14
15
305
300
import bisect n = int(eval(input())) a = sorted(list(map(int, input().split()))) b = sorted(list(map(int, input().split()))) c = sorted(list(map(int, input().split()))) ans = 0 for i in b: x = bisect.bisect_left(a, i) y = bisect.bisect_right(c, i) # print(x, y) ans = ans + x * (n - y) print(ans)
import bisect n = int(eval(input())) a = list(map(int, input().split())) b = list(map(int, input().split())) c = list(map(int, input().split())) a.sort() b.sort() c.sort() ans = 0 for i in b: x = bisect.bisect_left(a, i) y = bisect.bisect_right(c, i) ans = ans + (x * (n - y)) print(ans)
false
6.666667
[ "-a = sorted(list(map(int, input().split())))", "-b = sorted(list(map(int, input().split())))", "-c = sorted(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()", "+b.sort()", "+c.sort()...
false
0.038485
0.03983
0.966222
[ "s295243642", "s968757057" ]
u077291787
p02579
python
s053450262
s634232542
384
240
220,748
96,700
Accepted
Accepted
37.5
# D - Wizard in Maze import sys from collections import deque from typing import List, Tuple class WarpableMaze: __slots__ = ["height", "width", "road", "wall", "unsearched", "grid"] def __init__( self, height: int, width: int, grid: List[bytes], road: st...
# D - Wizard in Maze import sys from collections import deque from typing import List, Tuple class WarpableMaze: __slots__ = ["height", "width", "unsearched", "dist"] def __init__( self, height: int, width: int, grid: List[bytes], road: str = ".", ) -> None: self.height = heig...
99
85
3,048
2,598
# D - Wizard in Maze import sys from collections import deque from typing import List, Tuple class WarpableMaze: __slots__ = ["height", "width", "road", "wall", "unsearched", "grid"] def __init__( self, height: int, width: int, grid: List[bytes], road: str = ".", ...
# D - Wizard in Maze import sys from collections import deque from typing import List, Tuple class WarpableMaze: __slots__ = ["height", "width", "unsearched", "dist"] def __init__( self, height: int, width: int, grid: List[bytes], road: str = ".", ) -> None: ...
false
14.141414
[ "- __slots__ = [\"height\", \"width\", \"road\", \"wall\", \"unsearched\", \"grid\"]", "+ __slots__ = [\"height\", \"width\", \"unsearched\", \"dist\"]", "- wall: str = \"#\",", "- self.road = road", "- self.wall = wall", "- self.grid = self._flatten_grid(grid)", "+ ...
false
0.046787
0.048871
0.957364
[ "s053450262", "s634232542" ]
u198336369
p03331
python
s015281246
s610141038
330
182
9,656
9,244
Accepted
Accepted
44.85
n = int(eval(input())) absum = [] for a in range(1,n): b = n-a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum+bsum) print((min(absum))...
n = int(eval(input())) absum = [] for a in range(1,n//2+1): b = n-a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum+bsum) print((min(ab...
14
14
313
318
n = int(eval(input())) absum = [] for a in range(1, n): b = n - a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum + bsum) print((min(absum)))
n = int(eval(input())) absum = [] for a in range(1, n // 2 + 1): b = n - a asum = 0 bsum = 0 astr = str(a) bstr = str(b) for j in range(len(astr)): asum = asum + int(astr[j]) for k in range(len(bstr)): bsum = bsum + int(bstr[k]) absum.append(asum + bsum) print((min(absum)...
false
0
[ "-for a in range(1, n):", "+for a in range(1, n // 2 + 1):" ]
false
0.099681
0.104902
0.950225
[ "s015281246", "s610141038" ]
u525065967
p02579
python
s893889535
s848349287
1,406
541
264,444
165,592
Accepted
Accepted
61.52
dhw = [(1,0),(0,-1),(0,1),(-1,0), ( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2), ( 1,-2),( 1,-1), ( 1, 1),( 1, 2), ( 0,-2), ( 0, 2), (-1,-2),(-1,-1), (-1, 1),(-1, 2), (-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)] H, W = list(map(int, input().split())) sh, sw = [int(x)-1 for x in input...
dhw = [(1,0),(0,-1),(0,1),(-1,0), ( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2), ( 1,-2),( 1,-1), ( 1, 1),( 1, 2), ( 0,-2), ( 0, 2), (-1,-2),(-1,-1), (-1, 1),(-1, 2), (-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)] H, W = list(map(int, input().split())) sh, sw = [int(x)-1 for x in input...
27
42
888
1,288
dhw = [ (1, 0), (0, -1), (0, 1), (-1, 0), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), (1, -2), (1, -1), (1, 1), (1, 2), (0, -2), (0, 2), (-1, -2), (-1, -1), (-1, 1), (-1, 2), (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), ] H,...
dhw = [ (1, 0), (0, -1), (0, 1), (-1, 0), (2, -2), (2, -1), (2, 0), (2, 1), (2, 2), (1, -2), (1, -1), (1, 1), (1, 2), (0, -2), (0, 2), (-1, -2), (-1, -1), (-1, 1), (-1, 2), (-2, -2), (-2, -1), (-2, 0), (-2, 1), (-2, 2), ] H,...
false
35.714286
[ "- if 0 <= h < H and 0 <= w < W and dst[h][w] < 0 and S[h][w] != \"#\":", "+ if dst[h][w] >= 0 or S[h][w] == \"#\":", "+ continue", "+ if dst[h][w] == -1 or d < dst[h][w]:", "- for i in range(4):", "- dq.appendleft((h + dhw[i][0], w + dhw[i][1], d))", "- for i in...
false
0.034216
0.034087
1.003805
[ "s893889535", "s848349287" ]
u840310460
p03495
python
s788488417
s197043461
198
178
39,040
39,312
Accepted
Accepted
10.1
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] dic = {} for i in A: if i in dic: dic[i] += 1 else: dic[i] = 1 dic_sort = sorted(list(dic.items()), key=lambda x:x[1], reverse=True) ans = [] for i in range(K, len(dic_sort)): ans.append(dic_sort[...
from collections import Counter N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] cou = sorted(list(Counter(A).items()), key=lambda x:x[1], reverse=True) ans = [cou[i][1] for i in range(K, len(cou))] print((sum(ans)))
17
8
339
247
N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] dic = {} for i in A: if i in dic: dic[i] += 1 else: dic[i] = 1 dic_sort = sorted(list(dic.items()), key=lambda x: x[1], reverse=True) ans = [] for i in range(K, len(dic_sort)): ans.append(dic_sort[i][1]) print((su...
from collections import Counter N, K = [int(i) for i in input().split()] A = [int(i) for i in input().split()] cou = sorted(list(Counter(A).items()), key=lambda x: x[1], reverse=True) ans = [cou[i][1] for i in range(K, len(cou))] print((sum(ans)))
false
52.941176
[ "+from collections import Counter", "+", "-dic = {}", "-for i in A:", "- if i in dic:", "- dic[i] += 1", "- else:", "- dic[i] = 1", "-dic_sort = sorted(list(dic.items()), key=lambda x: x[1], reverse=True)", "-ans = []", "-for i in range(K, len(dic_sort)):", "- ans.append...
false
0.148855
0.037876
3.930034
[ "s788488417", "s197043461" ]
u934246119
p03244
python
s550536747
s278965991
128
99
25,300
19,936
Accepted
Accepted
22.66
from collections import Counter n = int(eval(input())) v = [int(_) for _ in input().split()] v1 = [] v2 = [] for i in range(n): if i % 2 == 0: v1.append(v[i]) else: v2.append(v[i]) v_count = Counter(v) v1_count = Counter(v1) v2_count = Counter(v2) # print("v1_count", v1_count) # pr...
from collections import Counter n = int(eval(input())) v = [int(_) for _ in input().split()] # 最終的な2値をx, yとしたとき書き換える要素が最小の場合は、 # xは、書き換えが最も少ない数。つまり、もともと最も多い数 # yも同様。 # ただ、xとyがかぶる場合があるので、それに対処。 if len(Counter(v)) > 1: v1 = v[0:n+1:2] # print(v) # print(v1) v2 = v[1:n+2:2] # print(v2) ...
41
50
1,083
1,315
from collections import Counter n = int(eval(input())) v = [int(_) for _ in input().split()] v1 = [] v2 = [] for i in range(n): if i % 2 == 0: v1.append(v[i]) else: v2.append(v[i]) v_count = Counter(v) v1_count = Counter(v1) v2_count = Counter(v2) # print("v1_count", v1_count) # print("v2_count...
from collections import Counter n = int(eval(input())) v = [int(_) for _ in input().split()] # 最終的な2値をx, yとしたとき書き換える要素が最小の場合は、 # xは、書き換えが最も少ない数。つまり、もともと最も多い数 # yも同様。 # ただ、xとyがかぶる場合があるので、それに対処。 if len(Counter(v)) > 1: v1 = v[0 : n + 1 : 2] # print(v) # print(v1) v2 = v[1 : n + 2 : 2] # print(v2) ...
false
18
[ "-v1 = []", "-v2 = []", "-for i in range(n):", "- if i % 2 == 0:", "- v1.append(v[i])", "+# 最終的な2値をx, yとしたとき書き換える要素が最小の場合は、", "+# xは、書き換えが最も少ない数。つまり、もともと最も多い数", "+# yも同様。", "+# ただ、xとyがかぶる場合があるので、それに対処。", "+if len(Counter(v)) > 1:", "+ v1 = v[0 : n + 1 : 2]", "+ # print(v)", "...
false
0.041739
0.045955
0.908276
[ "s550536747", "s278965991" ]
u723792785
p02598
python
s722024991
s593253391
490
181
93,672
93,680
Accepted
Accepted
63.06
import math n,k = list(map(int,input().split())) a = list(map(int,input().split())) if k == 0: print((max(a))) exit() suki = 1000000000 kirai = 0 while int(suki) != int(kirai): targ = (suki+kirai)/2 cnt = 0 mode = 1 for i in range(n): cnt += (a[i]-1)//targ if cnt > k: mode = 0 break ...
import math n,k = list(map(int,input().split())) a = list(map(int,input().split())) if k == 0: print((max(a))) exit() suki = 1000000000 kirai = 0 while suki-kirai>1: targ = (suki+kirai)//2 cnt = 0 mode = 1 for i in range(n): cnt += -(-a[i]//targ)-1 if cnt > k: mode = 0 break if mod...
25
25
387
379
import math n, k = list(map(int, input().split())) a = list(map(int, input().split())) if k == 0: print((max(a))) exit() suki = 1000000000 kirai = 0 while int(suki) != int(kirai): targ = (suki + kirai) / 2 cnt = 0 mode = 1 for i in range(n): cnt += (a[i] - 1) // targ if cnt > k:...
import math n, k = list(map(int, input().split())) a = list(map(int, input().split())) if k == 0: print((max(a))) exit() suki = 1000000000 kirai = 0 while suki - kirai > 1: targ = (suki + kirai) // 2 cnt = 0 mode = 1 for i in range(n): cnt += -(-a[i] // targ) - 1 if cnt > k: ...
false
0
[ "-while int(suki) != int(kirai):", "- targ = (suki + kirai) / 2", "+while suki - kirai > 1:", "+ targ = (suki + kirai) // 2", "- cnt += (a[i] - 1) // targ", "+ cnt += -(-a[i] // targ) - 1" ]
false
0.186305
0.038103
4.889554
[ "s722024991", "s593253391" ]
u588341295
p03329
python
s148121175
s690902734
761
649
3,956
3,828
Accepted
Accepted
14.72
# -*- coding: utf-8 -*- N = int(eval(input())) # 解説動画通りにDPしてみる dp = [0] * 100001 # dp[0] = 0 for n in range(1, 100001): dp[n] = float("inf") power = 1 while power <= n: dp[n] = min(dp[n], dp[n-power] + 1) power *= 6 power = 1 while power <= n: dp[n] = min...
# -*- coding: utf-8 -*- N = int(eval(input())) # ちょっと自分でいじった版 dp = [0] * (N+1) for n in range(1, N+1): dp[n] = float("inf") power = 1 while power <= n: dp[n] = min(dp[n], dp[n-power] + 1) power *= 6 power = 1 while power <= n: dp[n] = min(dp[n], dp[n-power...
21
20
374
356
# -*- coding: utf-8 -*- N = int(eval(input())) # 解説動画通りにDPしてみる dp = [0] * 100001 # dp[0] = 0 for n in range(1, 100001): dp[n] = float("inf") power = 1 while power <= n: dp[n] = min(dp[n], dp[n - power] + 1) power *= 6 power = 1 while power <= n: dp[n] = min(dp[n], dp[n - powe...
# -*- coding: utf-8 -*- N = int(eval(input())) # ちょっと自分でいじった版 dp = [0] * (N + 1) for n in range(1, N + 1): dp[n] = float("inf") power = 1 while power <= n: dp[n] = min(dp[n], dp[n - power] + 1) power *= 6 power = 1 while power <= n: dp[n] = min(dp[n], dp[n - power] + 1) ...
false
4.761905
[ "-# 解説動画通りにDPしてみる", "-dp = [0] * 100001", "-# dp[0] = 0", "-for n in range(1, 100001):", "+# ちょっと自分でいじった版", "+dp = [0] * (N + 1)", "+for n in range(1, N + 1):" ]
false
1.506146
0.175368
8.588486
[ "s148121175", "s690902734" ]
u319410662
p03837
python
s723403283
s442720050
496
373
2,936
2,936
Accepted
Accepted
24.8
N, M = list(map(int, input().split())) A = [0]*M B = [0]*M C = [0]*M d = [] for i in range(N): d.append([1000000]*N) d[i][i]=0 for i in range(M): a, b, c = list(map(int, input().split())) A[i] = a-1 B[i] = b-1 C[i] = c d[a-1][b-1] = c d[b-1][a-1] = c for k in range(N): for i in range(N...
N, M = list(map(int, input().split())) D = [] for i in range(N): D.append([1000000]*N) D[i][i] = 0 A = [0]*M B = [0]*M C = [0]*M for i in range(M): a, b, C[i] = list(map(int, input().split())) A[i] = a-1 B[i] = b-1 D[A[i]][B[i]] = C[i] D[B[i]][A[i]] = C[i] for k in range(N): for i in rang...
25
23
490
468
N, M = list(map(int, input().split())) A = [0] * M B = [0] * M C = [0] * M d = [] for i in range(N): d.append([1000000] * N) d[i][i] = 0 for i in range(M): a, b, c = list(map(int, input().split())) A[i] = a - 1 B[i] = b - 1 C[i] = c d[a - 1][b - 1] = c d[b - 1][a - 1] = c for k in range(...
N, M = list(map(int, input().split())) D = [] for i in range(N): D.append([1000000] * N) D[i][i] = 0 A = [0] * M B = [0] * M C = [0] * M for i in range(M): a, b, C[i] = list(map(int, input().split())) A[i] = a - 1 B[i] = b - 1 D[A[i]][B[i]] = C[i] D[B[i]][A[i]] = C[i] for k in range(N): ...
false
8
[ "+D = []", "+for i in range(N):", "+ D.append([1000000] * N)", "+ D[i][i] = 0", "-d = []", "-for i in range(N):", "- d.append([1000000] * N)", "- d[i][i] = 0", "- a, b, c = list(map(int, input().split()))", "+ a, b, C[i] = list(map(int, input().split()))", "- C[i] = c", "-...
false
0.051347
0.057007
0.9007
[ "s723403283", "s442720050" ]
u979667682
p03074
python
s264181258
s771401072
358
216
51,036
45,404
Accepted
Accepted
39.66
from sys import stdin from collections import deque N, K = [int(x) for x in stdin.readline().rstrip().split()] S = deque([int(x) for x in stdin.readline().rstrip()]) # 0の始点と終点のインデックスリスト # 始点→終点→始点→終点→...の順 # 従って、必ず偶数個になる(インデックスが偶数の場合は始点で、奇数の場合は終点) index_list = [] if S[0] == 0: index_list.append(0) ...
from sys import stdin N, K = [int(x) for x in stdin.readline().rstrip().split()] # -1は終端 S = [int(x) for x in stdin.readline().rstrip()] + [-1] # 連続して立っている人のカウント straight_stand_cnt = 0 if S[0] == 0: straight_stand_cnt = 1 l = 0 r = 0 ans = -999 while r < N: # for DEBUG #print(l, r) ...
51
32
1,158
601
from sys import stdin from collections import deque N, K = [int(x) for x in stdin.readline().rstrip().split()] S = deque([int(x) for x in stdin.readline().rstrip()]) # 0の始点と終点のインデックスリスト # 始点→終点→始点→終点→...の順 # 従って、必ず偶数個になる(インデックスが偶数の場合は始点で、奇数の場合は終点) index_list = [] if S[0] == 0: index_list.append(0) res = [] for i i...
from sys import stdin N, K = [int(x) for x in stdin.readline().rstrip().split()] # -1は終端 S = [int(x) for x in stdin.readline().rstrip()] + [-1] # 連続して立っている人のカウント straight_stand_cnt = 0 if S[0] == 0: straight_stand_cnt = 1 l = 0 r = 0 ans = -999 while r < N: # for DEBUG # print(l, r) if straight_stand_c...
false
37.254902
[ "-from collections import deque", "-S = deque([int(x) for x in stdin.readline().rstrip()])", "-# 0の始点と終点のインデックスリスト", "-# 始点→終点→始点→終点→...の順", "-# 従って、必ず偶数個になる(インデックスが偶数の場合は始点で、奇数の場合は終点)", "-index_list = []", "+# -1は終端", "+S = [int(x) for x in stdin.readline().rstrip()] + [-1]", "+# 連続して立っている人のカウント", ...
false
0.041106
0.038992
1.054215
[ "s264181258", "s771401072" ]
u585482323
p03082
python
s624519826
s432067126
1,426
1,308
192,664
134,572
Accepted
Accepted
8.27
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdin.readline()...
50
70
1,288
1,848
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): return [list(x) for x in sys.stdin...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop import sys import math import bisect import random def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS(): return [list(x) for x in sys.stdin...
false
28.571429
[ "+# 空間の節約", "+def solve_1():", "+ n, x = LI()", "+ s = LI()", "+ s.sort()", "+ # dp = [[0]*(x+1) for i in range(n+1)] # dp[i][j] := スタート時点の値がjの時に最初のi個の順列すべてを試し、えられる総和", "+ dp = [j for j in range(x + 1)]", "+ for i in range(n):", "+ si = s[i]", "+ ndp = [0] * (x + 1)...
false
1.095548
0.45587
2.403204
[ "s624519826", "s432067126" ]
u078042885
p02379
python
s882516637
s282157192
30
20
7,508
7,616
Accepted
Accepted
33.33
from math import sqrt,pow x1,y1,x2,y2=list(map(float,input().split())) print(("{0}".format(sqrt(pow(x2-x1,2)+pow(y2-y1,2)))))
x,y,xx,yy=list(map(float, input().split())) print(('%5f'%((x-xx)**2+(y-yy)**2)**0.5))
3
2
119
78
from math import sqrt, pow x1, y1, x2, y2 = list(map(float, input().split())) print(("{0}".format(sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)))))
x, y, xx, yy = list(map(float, input().split())) print(("%5f" % ((x - xx) ** 2 + (y - yy) ** 2) ** 0.5))
false
33.333333
[ "-from math import sqrt, pow", "-", "-x1, y1, x2, y2 = list(map(float, input().split()))", "-print((\"{0}\".format(sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)))))", "+x, y, xx, yy = list(map(float, input().split()))", "+print((\"%5f\" % ((x - xx) ** 2 + (y - yy) ** 2) ** 0.5))" ]
false
0.042112
0.033291
1.264953
[ "s882516637", "s282157192" ]
u745087332
p03791
python
s316864101
s061274604
673
86
11,308
11,308
Accepted
Accepted
87.22
n = eval(input()) x = list(map(int, input().split())) MOD = 1000000007 j = 1 ans = 1 count = 0 for i in range(len(x)): if(x[i] >= 2*j-1): j += 1 continue else: ans *= j count += 1 for i in range(len(x)-count): ans = ans*(i+1)%MOD print(ans)
n = eval(input()) x = list(map(int, input().split())) MOD = 10**9+7 j = 1 ans = 1 count = 0 for i in range(len(x)): if(x[i] >= 2*j-1): j += 1 continue else: ans = ans*j%MOD count += 1 for i in range(len(x)-count): ans = ans*(i+1)%MOD print(ans)
20
20
300
304
n = eval(input()) x = list(map(int, input().split())) MOD = 1000000007 j = 1 ans = 1 count = 0 for i in range(len(x)): if x[i] >= 2 * j - 1: j += 1 continue else: ans *= j count += 1 for i in range(len(x) - count): ans = ans * (i + 1) % MOD print(ans)
n = eval(input()) x = list(map(int, input().split())) MOD = 10**9 + 7 j = 1 ans = 1 count = 0 for i in range(len(x)): if x[i] >= 2 * j - 1: j += 1 continue else: ans = ans * j % MOD count += 1 for i in range(len(x) - count): ans = ans * (i + 1) % MOD print(ans)
false
0
[ "-MOD = 1000000007", "+MOD = 10**9 + 7", "- ans *= j", "+ ans = ans * j % MOD" ]
false
0.042025
0.035882
1.171229
[ "s316864101", "s061274604" ]
u827202523
p03435
python
s739584973
s481057695
230
165
44,780
38,384
Accepted
Accepted
28.26
import sys input = sys.stdin.readline sys.setrecursionlimit(1000000) from collections import deque def getN(): return int(eval(input())) def getList(): return list(map(int, input().split())) import math import bisect from logging import getLogger, StreamHandler, DEBUG, WARNING logger = getLogger(__na...
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 bisect import heapq from collections import defaultdict, Counter, deque MOD = 10**9 + ...
53
47
1,328
853
import sys input = sys.stdin.readline sys.setrecursionlimit(1000000) from collections import deque def getN(): return int(eval(input())) def getList(): return list(map(int, input().split())) import math import bisect from logging import getLogger, StreamHandler, DEBUG, WARNING logger = getLogger(__name_...
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 bisect import heapq from collections import defaultdict, Counter, deque MOD = 10**9 + 7 IN...
false
11.320755
[ "-input = sys.stdin.readline", "-sys.setrecursionlimit(1000000)", "-from collections import deque", "-", "-", "+# input = sys.stdin.buffer.readline", "-def getList():", "+def getNM():", "+ return list(map(int, input().split()))", "+", "+", "+def getlist():", "-from logging import getLogge...
false
2.665389
0.042023
63.427512
[ "s739584973", "s481057695" ]
u638795007
p03658
python
s704542677
s246323038
174
26
38,384
3,956
Accepted
Accepted
85.06
def examB(): N, K = LI() L = LI(); L.sort(reverse = True) ans = sum(L[:K]) print(ans) import sys import copy import bisect import heapq from collections import Counter,defaultdict,deque def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) ...
def ABC67_B(): N, K = LI() L = LI() L.sort(reverse=True) ans = sum(L[:K]) print(ans) return def examB(): ans = 0 print(ans) return def examC(): ans = 0 print(ans) return def examD(): ans = 0 print(ans) return def examE(): ans = ...
20
57
461
1,081
def examB(): N, K = LI() L = LI() L.sort(reverse=True) ans = sum(L[:K]) print(ans) import sys import copy import bisect import heapq from collections import Counter, defaultdict, deque def I(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split()...
def ABC67_B(): N, K = LI() L = LI() L.sort(reverse=True) ans = sum(L[:K]) print(ans) return def examB(): ans = 0 print(ans) return def examC(): ans = 0 print(ans) return def examD(): ans = 0 print(ans) return def examE(): ans = 0 print(ans) ...
false
64.912281
[ "-def examB():", "+def ABC67_B():", "+ return", "-import sys", "-import copy", "-import bisect", "-import heapq", "+def examB():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def examC():", "+ ans = 0", "+ print(ans)", "+ return", "+", "+", "+def e...
false
0.042574
0.041888
1.016379
[ "s704542677", "s246323038" ]
u018679195
p02935
python
s353698913
s288502977
170
17
38,256
2,940
Accepted
Accepted
90
import bisect def main(): N = int(eval(input())) v = sorted(list(map(int, input().split()))) while len(v) > 1: num1 = v.pop(0) num2 = v.pop(0) avg = (num1 + num2) / 2 idx = bisect.bisect(v, avg) v.insert(idx, avg) print((v[0])) main()
n=int(eval(input())) v=list(map(int,input().split())) v.sort() a=(v[0]+v[1])/2 for i in range(2,n): a=(a+v[i])/2 print(a)
13
7
295
125
import bisect def main(): N = int(eval(input())) v = sorted(list(map(int, input().split()))) while len(v) > 1: num1 = v.pop(0) num2 = v.pop(0) avg = (num1 + num2) / 2 idx = bisect.bisect(v, avg) v.insert(idx, avg) print((v[0])) main()
n = int(eval(input())) v = list(map(int, input().split())) v.sort() a = (v[0] + v[1]) / 2 for i in range(2, n): a = (a + v[i]) / 2 print(a)
false
46.153846
[ "-import bisect", "-", "-", "-def main():", "- N = int(eval(input()))", "- v = sorted(list(map(int, input().split())))", "- while len(v) > 1:", "- num1 = v.pop(0)", "- num2 = v.pop(0)", "- avg = (num1 + num2) / 2", "- idx = bisect.bisect(v, avg)", "- ...
false
0.044279
0.03379
1.310428
[ "s353698913", "s288502977" ]
u623814058
p02658
python
s595673448
s338750298
54
49
19,232
19,352
Accepted
Accepted
9.26
def main(): N=int(eval(input())) X=input().split() if "0" in X: print((0)) return ans=1 for i in X: ans = int(i) * ans if 1e18<ans: print((-1)) return print(ans) main()
def main(): N=int(eval(input())) X=input().split() if "0" in X: print((0)) return ans=1 for i in X: ans = int(i) * ans if 1000000000000000000<ans: print((-1)) return print(ans) main()
14
14
251
266
def main(): N = int(eval(input())) X = input().split() if "0" in X: print((0)) return ans = 1 for i in X: ans = int(i) * ans if 1e18 < ans: print((-1)) return print(ans) main()
def main(): N = int(eval(input())) X = input().split() if "0" in X: print((0)) return ans = 1 for i in X: ans = int(i) * ans if 1000000000000000000 < ans: print((-1)) return print(ans) main()
false
0
[ "- if 1e18 < ans:", "+ if 1000000000000000000 < ans:" ]
false
0.03569
0.079649
0.448089
[ "s595673448", "s338750298" ]
u442030035
p02990
python
s462570680
s706604528
831
203
3,316
3,316
Accepted
Accepted
75.57
import math N, K = list(map(int, input().split())) mod = 1000000007 def nCr(n: int, r: int): if n == r: return 1 if r > n: return 0 return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) for i in range(1, K+1): print((nCr(N-K+1, i) * nCr(K-1, i-1) % mod...
import math N, K = list(map(int, input().split())) mod = 1000000007 def nCr(n: int, r: int): if n == r: return 1 if r > n: return 0 return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) for i in range(1, K+1): print((nCr(N-K+1, i) * nCr(K-1, i-1) % mod...
16
16
315
336
import math N, K = list(map(int, input().split())) mod = 1000000007 def nCr(n: int, r: int): if n == r: return 1 if r > n: return 0 return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) for i in range(1, K + 1): print((nCr(N - K + 1, i) * nCr(K - 1, i - 1) % mod))
import math N, K = list(map(int, input().split())) mod = 1000000007 def nCr(n: int, r: int): if n == r: return 1 if r > n: return 0 return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) for i in range(1, K + 1): print((nCr(N - K + 1, i) * nCr(K - 1, i - 1) % mod if...
false
0
[ "- print((nCr(N - K + 1, i) * nCr(K - 1, i - 1) % mod))", "+ print((nCr(N - K + 1, i) * nCr(K - 1, i - 1) % mod if N - K + 1 >= i else 0))" ]
false
0.040867
0.040622
1.006017
[ "s462570680", "s706604528" ]
u562016607
p03436
python
s947812636
s311303906
797
48
3,444
3,952
Accepted
Accepted
93.98
H, W = list(map(int, input().split())) s = [[i for i in eval(input())]for i in range(H)] maze = [[False for i in range(W)] for i in range(H)] bknum = 0 for i in range(H): for j in range(W): if s[i][j]==".": maze[i][j]=True else: maze[i][j]=False bknum +=...
import queue H,W=list(map(int,input().split())) s=[list(eval(input())) for i in range(H)] dist=[[-1 for i in range(W)] for i in range(H)] q=queue.Queue() q.put((0,0)) dist[0][0]=0 dx=[-1,1,0,0] dy=[0,0,1,-1] while(not(q.empty())): r=q.get() x,y=r for k in range(4): nx=x+dx[k] n...
46
32
1,140
721
H, W = list(map(int, input().split())) s = [[i for i in eval(input())] for i in range(H)] maze = [[False for i in range(W)] for i in range(H)] bknum = 0 for i in range(H): for j in range(W): if s[i][j] == ".": maze[i][j] = True else: maze[i][j] = False bknum += 1 ...
import queue H, W = list(map(int, input().split())) s = [list(eval(input())) for i in range(H)] dist = [[-1 for i in range(W)] for i in range(H)] q = queue.Queue() q.put((0, 0)) dist[0][0] = 0 dx = [-1, 1, 0, 0] dy = [0, 0, 1, -1] while not (q.empty()): r = q.get() x, y = r for k in range(4): nx = ...
false
30.434783
[ "+import queue", "+", "-s = [[i for i in eval(input())] for i in range(H)]", "-maze = [[False for i in range(W)] for i in range(H)]", "-bknum = 0", "+s = [list(eval(input())) for i in range(H)]", "+dist = [[-1 for i in range(W)] for i in range(H)]", "+q = queue.Queue()", "+q.put((0, 0))", "+dist[0...
false
0.038027
0.040063
0.949175
[ "s947812636", "s311303906" ]
u022407960
p02363
python
s869308661
s457033841
1,470
510
9,388
8,860
Accepted
Accepted
65.31
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import stdin def generate_adj_table(v_table): for each in v_table: start, end, weight = list(map(int, each)) init_adj_table[start][end] = weight return init_adj_table def floyd(): for k in _range: for i in _...
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import stdin from math import isinf def generate_adj_table(v_table, _init_adj_table): for each in v_table: start, end, weight = list(map(int, each)) _init_adj_table[start][end] = weight return _init_adj_table def floyd(_...
48
54
1,213
1,411
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import stdin def generate_adj_table(v_table): for each in v_table: start, end, weight = list(map(int, each)) init_adj_table[start][end] = weight return init_adj_table def floyd(): for k in _range: for i in _range: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from sys import stdin from math import isinf def generate_adj_table(v_table, _init_adj_table): for each in v_table: start, end, weight = list(map(int, each)) _init_adj_table[start][end] = weight return _init_adj_table def floyd(_adj_table): f...
false
11.111111
[ "+from math import isinf", "-def generate_adj_table(v_table):", "+def generate_adj_table(v_table, _init_adj_table):", "- init_adj_table[start][end] = weight", "- return init_adj_table", "+ _init_adj_table[start][end] = weight", "+ return _init_adj_table", "-def floyd():", "+def f...
false
0.041597
0.03643
1.141826
[ "s869308661", "s457033841" ]
u753803401
p03835
python
s376437490
s784468529
1,250
252
2,940
40,540
Accepted
Accepted
79.84
k, s = list(map(int, input().split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): if 0 <= s - i - j <= k: cnt += 1 print(cnt)
def slove(): import sys input = sys.stdin.readline k, s = list(map(int, input().rstrip('\n').split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): if i + j > s: break else: n = s - i - j if 0 <= n <=...
7
18
161
415
k, s = list(map(int, input().split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): if 0 <= s - i - j <= k: cnt += 1 print(cnt)
def slove(): import sys input = sys.stdin.readline k, s = list(map(int, input().rstrip("\n").split())) cnt = 0 for i in range(k + 1): for j in range(k + 1): if i + j > s: break else: n = s - i - j if 0 <= n <= k: ...
false
61.111111
[ "-k, s = list(map(int, input().split()))", "-cnt = 0", "-for i in range(k + 1):", "- for j in range(k + 1):", "- if 0 <= s - i - j <= k:", "- cnt += 1", "-print(cnt)", "+def slove():", "+ import sys", "+", "+ input = sys.stdin.readline", "+ k, s = list(map(int, in...
false
0.084562
0.03771
2.242448
[ "s376437490", "s784468529" ]
u263830634
p03171
python
s039689518
s166083431
587
206
176,392
12,516
Accepted
Accepted
64.91
N = int(eval(input())) A = list(map(int, input().split())) INF = 10 ** 12 dp1 = [[-INF] * (N + 1) for _ in range(N + 1)] #X - Yの最大値 dp2 = [[+INF] * (N + 1) for _ in range(N + 1)] #X - Yの最小値 if N % 2 == 0: #偶数-->最後の一個はY for i in range(N): dp2[i][i + 1] = -A[i] # print (dp2[i][i + 1], en...
import numpy as np N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A, dtype = np.int64) INF = 10 ** 12 dp1 = np.array([-INF] * (N + 1), dtype = np.int64) dp2 = np.array([+INF] * (N + 1), dtype = np.int64) if N % 2 == 0: dp2[1:] = -A[:] # print (dp2) for k in range(2...
45
36
1,514
1,105
N = int(eval(input())) A = list(map(int, input().split())) INF = 10**12 dp1 = [[-INF] * (N + 1) for _ in range(N + 1)] # X - Yの最大値 dp2 = [[+INF] * (N + 1) for _ in range(N + 1)] # X - Yの最小値 if N % 2 == 0: # 偶数-->最後の一個はY for i in range(N): dp2[i][i + 1] = -A[i] # print (dp2[i][i + 1], end =' ') ...
import numpy as np N = int(eval(input())) A = list(map(int, input().split())) A = np.array(A, dtype=np.int64) INF = 10**12 dp1 = np.array([-INF] * (N + 1), dtype=np.int64) dp2 = np.array([+INF] * (N + 1), dtype=np.int64) if N % 2 == 0: dp2[1:] = -A[:] # print (dp2) for k in range(2, N + 1): if k % ...
false
20
[ "+import numpy as np", "+", "+A = np.array(A, dtype=np.int64)", "-dp1 = [[-INF] * (N + 1) for _ in range(N + 1)] # X - Yの最大値", "-dp2 = [[+INF] * (N + 1) for _ in range(N + 1)] # X - Yの最小値", "-if N % 2 == 0: # 偶数-->最後の一個はY", "- for i in range(N):", "- dp2[i][i + 1] = -A[i]", "- # ...
false
0.047173
0.564109
0.083624
[ "s039689518", "s166083431" ]
u276204978
p03448
python
s111368883
s817620127
64
18
3,060
3,060
Accepted
Accepted
71.88
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A+1): for j in range(B+1): for k in range(C+1): ans += X == 500*i+100*j+50*k print(ans)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A+1): for j in range(B+1): c = (X-500*i-100*j)//50 if c >= 0 and c <= C: ans += 1 print(ans)
12
13
215
229
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A + 1): for j in range(B + 1): for k in range(C + 1): ans += X == 500 * i + 100 * j + 50 * k print(ans)
A = int(eval(input())) B = int(eval(input())) C = int(eval(input())) X = int(eval(input())) ans = 0 for i in range(A + 1): for j in range(B + 1): c = (X - 500 * i - 100 * j) // 50 if c >= 0 and c <= C: ans += 1 print(ans)
false
7.692308
[ "- for k in range(C + 1):", "- ans += X == 500 * i + 100 * j + 50 * k", "+ c = (X - 500 * i - 100 * j) // 50", "+ if c >= 0 and c <= C:", "+ ans += 1" ]
false
0.077864
0.037688
2.066014
[ "s111368883", "s817620127" ]
u708255304
p02676
python
s152921018
s374873129
25
20
9,156
9,104
Accepted
Accepted
20
K = int(eval(input())) S = str(eval(input())) if len(S) <= K: print(S) else: print((S[:K]+"..."))
K = int(eval(input())) S = str(eval(input())) if len(S) > K: print((S[:K] + "...")) else: print(S)
6
6
97
98
K = int(eval(input())) S = str(eval(input())) if len(S) <= K: print(S) else: print((S[:K] + "..."))
K = int(eval(input())) S = str(eval(input())) if len(S) > K: print((S[:K] + "...")) else: print(S)
false
0
[ "-if len(S) <= K:", "+if len(S) > K:", "+ print((S[:K] + \"...\"))", "+else:", "-else:", "- print((S[:K] + \"...\"))" ]
false
0.12269
0.043422
2.825541
[ "s152921018", "s374873129" ]
u729133443
p02703
python
s594545442
s910383518
1,241
778
117,800
122,848
Accepted
Accepted
37.31
def main(): from heapq import heappush,heappop (n,m,s),*t=[list(map(int,r.split()))for r in open(0)] e=[[]for _ in range(8**6)] for u,v,a,b in t[:m]: for i in range(2501-a): e[(i+a)*51+u]+=(b,i*51+v), e[(i+a)*51+v]+=(b,i*51+u), for i,(c,d)in enumerate(t[m:],1)...
from scipy.sparse import* (n,m,s,*D),*t=[list(map(int,t.split()))for t in open(0)] R,C=[],[] for u,v,a,b in t[:m]: for i in range(2501-a): R+=(i+a)*51+u,(i+a)*51+v C+=i*51+v,i*51+u D+=b,b for i,(c,d)in enumerate(t[m:],1): for j in range(2501-c): R+=j*51+i, C+=(...
22
15
667
459
def main(): from heapq import heappush, heappop (n, m, s), *t = [list(map(int, r.split())) for r in open(0)] e = [[] for _ in range(8**6)] for u, v, a, b in t[:m]: for i in range(2501 - a): e[(i + a) * 51 + u] += ((b, i * 51 + v),) e[(i + a) * 51 + v] += ((b, i * 51 + u)...
from scipy.sparse import * (n, m, s, *D), *t = [list(map(int, t.split())) for t in open(0)] R, C = [], [] for u, v, a, b in t[:m]: for i in range(2501 - a): R += (i + a) * 51 + u, (i + a) * 51 + v C += i * 51 + v, i * 51 + u D += b, b for i, (c, d) in enumerate(t[m:], 1): for j in range...
false
31.818182
[ "-def main():", "- from heapq import heappush, heappop", "+from scipy.sparse import *", "- (n, m, s), *t = [list(map(int, r.split())) for r in open(0)]", "- e = [[] for _ in range(8**6)]", "- for u, v, a, b in t[:m]:", "- for i in range(2501 - a):", "- e[(i + a) * 51 + u]...
false
0.264684
0.578479
0.457551
[ "s594545442", "s910383518" ]
u983918956
p03031
python
s160941702
s875778132
36
29
3,064
3,064
Accepted
Accepted
19.44
import sys input = sys.stdin.readline from itertools import product N,M = list(map(int,input().split())) S = [list(map(int,input().split()))[1:] for _ in range(M)] P = list(map(int,input().split())) ans = 0 for p in product([0,1],repeat=N): can = 0 for i in range(M): res = 0 for...
N,M = list(map(int,input().split())) S = [list(map(int,input().split()))[1:] for _ in range(M)] P = list(map(int,input().split())) ans = 0 for mask in range(0,1<<N): flag = True for i, line in enumerate(S): cnt = 0 for s in line: if ((mask >> (s-1) & 1)): ...
24
20
495
444
import sys input = sys.stdin.readline from itertools import product N, M = list(map(int, input().split())) S = [list(map(int, input().split()))[1:] for _ in range(M)] P = list(map(int, input().split())) ans = 0 for p in product([0, 1], repeat=N): can = 0 for i in range(M): res = 0 for s in S[i...
N, M = list(map(int, input().split())) S = [list(map(int, input().split()))[1:] for _ in range(M)] P = list(map(int, input().split())) ans = 0 for mask in range(0, 1 << N): flag = True for i, line in enumerate(S): cnt = 0 for s in line: if mask >> (s - 1) & 1: cnt += ...
false
16.666667
[ "-import sys", "-", "-input = sys.stdin.readline", "-from itertools import product", "-", "-for p in product([0, 1], repeat=N):", "- can = 0", "- for i in range(M):", "- res = 0", "- for s in S[i]:", "- if p[s - 1] == 1:", "- res += 1", "- ...
false
0.045118
0.123637
0.36492
[ "s160941702", "s875778132" ]
u531599639
p02623
python
s827008329
s809716554
283
168
47,560
133,992
Accepted
Accepted
40.64
n,m,k = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) a,b = [0],[0] for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) ans,j = 0,m for i in range(n+1): if a[i]>k: break while b[j]+a[i]>k: j -= 1 ans = m...
n,m,k = list(map(int,input().split())) A = list(map(int,input().split())) B = list(map(int,input().split())) a,b = [0],[0] for i in range(n): a.append(a[i]+A[i]) for i in range(m): b.append(b[i]+B[i]) ans,bi = 0,m for i in range(n+1): for j in range(bi,-1,-1): if a[i]+b[j]<=k: ans = max(...
19
17
339
361
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(n): a.append(a[i] + A[i]) for i in range(m): b.append(b[i] + B[i]) ans, j = 0, m for i in range(n + 1): if a[i] > k: break while b[j] + a[i] > k: ...
n, m, k = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) a, b = [0], [0] for i in range(n): a.append(a[i] + A[i]) for i in range(m): b.append(b[i] + B[i]) ans, bi = 0, m for i in range(n + 1): for j in range(bi, -1, -1): if a[i] + b[j] <= k: ...
false
10.526316
[ "-ans, j = 0, m", "+ans, bi = 0, m", "- if a[i] > k:", "- break", "- while b[j] + a[i] > k:", "- j -= 1", "- ans = max(ans, i + j)", "+ for j in range(bi, -1, -1):", "+ if a[i] + b[j] <= k:", "+ ans = max(ans, i + j)", "+ bi = j", "+ ...
false
0.068022
0.03656
1.860539
[ "s827008329", "s809716554" ]
u729133443
p02880
python
s169755545
s321547812
169
17
38,480
2,940
Accepted
Accepted
89.94
print((' YNeos'[int(eval(input()))in[a//10*(a%10)for a in range(100)]::2]))
print((' YNeos'[-int(eval(input()))in[a//~9*(a%10)for a in range(90)]::2]))
1
1
67
67
print((" YNeos"[int(eval(input())) in [a // 10 * (a % 10) for a in range(100)] :: 2]))
print((" YNeos"[-int(eval(input())) in [a // ~9 * (a % 10) for a in range(90)] :: 2]))
false
0
[ "-print((\" YNeos\"[int(eval(input())) in [a // 10 * (a % 10) for a in range(100)] :: 2]))", "+print((\" YNeos\"[-int(eval(input())) in [a // ~9 * (a % 10) for a in range(90)] :: 2]))" ]
false
0.114222
0.037115
3.077512
[ "s169755545", "s321547812" ]
u597374218
p02627
python
s195014476
s806139712
32
24
9,068
9,008
Accepted
Accepted
25
a=eval(input()) print(("a" if a.islower() else "A"))
a=eval(input()) print(("A" if a==a.upper() else "a"))
2
2
45
46
a = eval(input()) print(("a" if a.islower() else "A"))
a = eval(input()) print(("A" if a == a.upper() else "a"))
false
0
[ "-print((\"a\" if a.islower() else \"A\"))", "+print((\"A\" if a == a.upper() else \"a\"))" ]
false
0.045686
0.035892
1.272886
[ "s195014476", "s806139712" ]
u744920373
p03569
python
s100721112
s576044926
53
41
3,676
4,084
Accepted
Accepted
22.64
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def dp2(ini, i, j): ret...
92
69
2,324
1,736
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
import sys sys.setrecursionlimit(10**8) def ii(): return int(sys.stdin.readline()) def mi(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] de...
false
25
[ "-from collections import defaultdict # d = defaultdict(int) d[key] += value", "-", "-", "+# from collections import defaultdict #d = defaultdict(int) d[key] += value", "- if S == S[::-1]:", "- print((0))", "- exit()", "- st, end = 0, l - 1", "- l = len(T) % 2", "+ \"\"\...
false
0.102973
0.079228
1.299701
[ "s100721112", "s576044926" ]
u323045245
p03160
python
s337608828
s741101436
223
192
13,928
13,928
Accepted
Accepted
13.9
N = int(eval(input())) *h, = list(map(int, input().split())) dp = [float("inf") for _ in range(N)] dp[0] = 0 for i in range(N - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])) if i < N - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i])) print((dp[N - 1]))
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")]*N dp[0] = 0 for i in range(N - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])) if i < N - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i])) print((dp[N - 1]))
9
9
276
264
N = int(eval(input())) (*h,) = list(map(int, input().split())) dp = [float("inf") for _ in range(N)] dp[0] = 0 for i in range(N - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])) if i < N - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i])) print((dp[N - 1]))
N = int(eval(input())) h = list(map(int, input().split())) dp = [float("inf")] * N dp[0] = 0 for i in range(N - 1): dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i])) if i < N - 2: dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i])) print((dp[N - 1]))
false
0
[ "-(*h,) = list(map(int, input().split()))", "-dp = [float(\"inf\") for _ in range(N)]", "+h = list(map(int, input().split()))", "+dp = [float(\"inf\")] * N" ]
false
0.038573
0.038461
1.002928
[ "s337608828", "s741101436" ]
u992910889
p02947
python
s465019664
s879766748
616
347
73,816
64,220
Accepted
Accepted
43.67
# import bisect # import copy # import fractions # import math # import numpy as np from collections import Counter # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product def resolve(): N=int(eval(input())) S=[''.join(sorted(eval(input()))) for...
from collections import Counter, deque, OrderedDict # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # ...
20
34
415
887
# import bisect # import copy # import fractions # import math # import numpy as np from collections import Counter # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product def resolve(): N = int(eval(input())) S = ["".join(sorted(eval(input()))) for i in ...
from collections import Counter, deque, OrderedDict # from copy import copy, deepcopy # from functools import reduce # from heapq import heapify, heappop, heappush # from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product # import math # import numpy as np # Pytho...
false
41.176471
[ "-# import bisect", "-# import copy", "-# import fractions", "+from collections import Counter, deque, OrderedDict", "+", "+# from copy import copy, deepcopy", "+# from functools import reduce", "+# from heapq import heapify, heappop, heappush", "+# from itertools import accumulate, permutations, co...
false
0.035567
0.05314
0.66931
[ "s465019664", "s879766748" ]
u691018832
p03687
python
s659783869
s315987573
89
44
3,064
3,436
Accepted
Accepted
50.56
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) s = eval(input()) len_s = len(s) cnt = [0] * 26 al = [chr(ord('a') + i) for i in range(26)] ans = [''] * (len_s + 1) ans[0] = s for i in range(26): check =...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from copy import deepcopy def moji_list(a, b): # アルファベット小文字 → (97, 123) # アルファベット大文字 → (65, 91) # 半角数字 → (48, 58) # ひらがな → (12353, 12436) ...
33
32
900
775
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) s = eval(input()) len_s = len(s) cnt = [0] * 26 al = [chr(ord("a") + i) for i in range(26)] ans = [""] * (len_s + 1) ans[0] = s for i in range(26): check = list(s) if...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10**7) from copy import deepcopy def moji_list(a, b): # アルファベット小文字 → (97, 123) # アルファベット大文字 → (65, 91) # 半角数字 → (48, 58) # ひらがな → (12353, 12436) # カタカナ → (1244...
false
3.030303
[ "-s = eval(input())", "-len_s = len(s)", "-cnt = [0] * 26", "-al = [chr(ord(\"a\") + i) for i in range(26)]", "-ans = [\"\"] * (len_s + 1)", "-ans[0] = s", "-for i in range(26):", "- check = list(s)", "- if al[i] in check:", "- ans[0] = s", "- while any([al[i] != a for a in c...
false
0.042036
0.043719
0.961511
[ "s659783869", "s315987573" ]
u232852711
p03418
python
s678021006
s336121586
118
91
3,060
3,060
Accepted
Accepted
22.88
n, k = list(map(int, input().split())) if k == 0: print((n**2)) exit() ans = 0 for b in range(k+1, n+1): ans_bk = (n-k)//b+1 ans_b = ans_bk*(b-k) mod_k_max = ((n-k)//b)*b+k if n-mod_k_max+1 < b-k: ans_b -= ((b-k) - (n-mod_k_max+1)) # print(ans_b) ans += ...
n, k = list(map(int, input().split())) if k == 0: print((n**2)) exit() ans = 0 for b in range(k+1, n+1): p = n//b r = n%b ans += p*(b-k) ans += max(0, r-k+1) print(ans)
18
14
350
194
n, k = list(map(int, input().split())) if k == 0: print((n**2)) exit() ans = 0 for b in range(k + 1, n + 1): ans_bk = (n - k) // b + 1 ans_b = ans_bk * (b - k) mod_k_max = ((n - k) // b) * b + k if n - mod_k_max + 1 < b - k: ans_b -= (b - k) - (n - mod_k_max + 1) # print(ans_b) a...
n, k = list(map(int, input().split())) if k == 0: print((n**2)) exit() ans = 0 for b in range(k + 1, n + 1): p = n // b r = n % b ans += p * (b - k) ans += max(0, r - k + 1) print(ans)
false
22.222222
[ "- ans_bk = (n - k) // b + 1", "- ans_b = ans_bk * (b - k)", "- mod_k_max = ((n - k) // b) * b + k", "- if n - mod_k_max + 1 < b - k:", "- ans_b -= (b - k) - (n - mod_k_max + 1)", "- # print(ans_b)", "- ans += ans_b", "+ p = n // b", "+ r = n % b", "+ ans += p * (...
false
0.082835
0.040233
2.058904
[ "s678021006", "s336121586" ]
u879870653
p02999
python
s484255549
s056221159
185
17
38,384
2,940
Accepted
Accepted
90.81
x,a = list(map(int,input().split())) if x < a : print((0)) else : print((10))
X,A = list(map(int,input().split())) print((0 if X < A else 10))
8
3
86
59
x, a = list(map(int, input().split())) if x < a: print((0)) else: print((10))
X, A = list(map(int, input().split())) print((0 if X < A else 10))
false
62.5
[ "-x, a = list(map(int, input().split()))", "-if x < a:", "- print((0))", "-else:", "- print((10))", "+X, A = list(map(int, input().split()))", "+print((0 if X < A else 10))" ]
false
0.043725
0.043718
1.000153
[ "s484255549", "s056221159" ]
u392319141
p03450
python
s016092613
s243715264
1,744
1,256
77,864
65,956
Accepted
Accepted
27.98
class UnionFind: def __init__(self, size): self.parent = list(range(size)) self.height = [0] * size self.size = [1] * size self.component = size def root(self, index): if self.parent[index] == index: # 根の場合 return index rootIndex = self.roo...
N, M = list(map(int, input().split())) edges = [[] for _ in range(N)] for _ in range(M): fr, to, dist = list(map(int, input().split())) fr -= 1 to -= 1 edges[fr].append((to, dist)) edges[to].append((fr, -dist)) INF = 10**18 minDist = [INF] * N for s in range(N): if minDist[s] < IN...
77
29
2,088
706
class UnionFind: def __init__(self, size): self.parent = list(range(size)) self.height = [0] * size self.size = [1] * size self.component = size def root(self, index): if self.parent[index] == index: # 根の場合 return index rootIndex = self.root(self.par...
N, M = list(map(int, input().split())) edges = [[] for _ in range(N)] for _ in range(M): fr, to, dist = list(map(int, input().split())) fr -= 1 to -= 1 edges[fr].append((to, dist)) edges[to].append((fr, -dist)) INF = 10**18 minDist = [INF] * N for s in range(N): if minDist[s] < INF: cont...
false
62.337662
[ "-class UnionFind:", "- def __init__(self, size):", "- self.parent = list(range(size))", "- self.height = [0] * size", "- self.size = [1] * size", "- self.component = size", "-", "- def root(self, index):", "- if self.parent[index] == index: # 根の場合", "- ...
false
0.037597
0.038511
0.976262
[ "s016092613", "s243715264" ]
u176796545
p03455
python
s552029492
s023112651
20
17
3,316
2,940
Accepted
Accepted
15
a,b=list(map(int,input().split())) print(("Even" if a%2==0 or b%2==0 else "Odd"))
a, b=list(map(int, input().split())) print(("Even" if a*b%2==0 else "Odd"))
2
2
74
68
a, b = list(map(int, input().split())) print(("Even" if a % 2 == 0 or b % 2 == 0 else "Odd"))
a, b = list(map(int, input().split())) print(("Even" if a * b % 2 == 0 else "Odd"))
false
0
[ "-print((\"Even\" if a % 2 == 0 or b % 2 == 0 else \"Odd\"))", "+print((\"Even\" if a * b % 2 == 0 else \"Odd\"))" ]
false
0.038785
0.037543
1.033086
[ "s552029492", "s023112651" ]
u883048396
p03339
python
s782398963
s533371886
253
209
17,740
15,264
Accepted
Accepted
17.39
def 解(): iN = int(eval(input())) sS = input().rstrip() aE= [0]*iN #東向かされる人 aW= [0]*iN #西向かされる人 for i in range(1,iN): if sS[i-1] == "W": aE[i] = aE[i-1]+1 else: aE[i] = aE[i-1] iMinCost = aE[iN-1] for i in range(iN-2,-1,-1): if sS[...
def 解(): iN = int(eval(input())) sS = input().rstrip() aE= [0]*iN #東向かされる人 for i in range(1,iN): if sS[i-1] == "W": aE[i] = aE[i-1]+1 else: aE[i] = aE[i-1] iMinCost = aE[iN-1] iW = 0 #西向かされる人 for i in range(iN-2,-1,-1): if sS[i+1]...
21
19
474
413
def 解(): iN = int(eval(input())) sS = input().rstrip() aE = [0] * iN # 東向かされる人 aW = [0] * iN # 西向かされる人 for i in range(1, iN): if sS[i - 1] == "W": aE[i] = aE[i - 1] + 1 else: aE[i] = aE[i - 1] iMinCost = aE[iN - 1] for i in range(iN - 2, -1, -1): ...
def 解(): iN = int(eval(input())) sS = input().rstrip() aE = [0] * iN # 東向かされる人 for i in range(1, iN): if sS[i - 1] == "W": aE[i] = aE[i - 1] + 1 else: aE[i] = aE[i - 1] iMinCost = aE[iN - 1] iW = 0 # 西向かされる人 for i in range(iN - 2, -1, -1): if...
false
9.52381
[ "- aW = [0] * iN # 西向かされる人", "+ iW = 0 # 西向かされる人", "- aW[i] = aW[i + 1] + 1", "- else:", "- aW[i] = aW[i + 1]", "- iMinCost = min(iMinCost, aW[i] + aE[i])", "+ iW += 1", "+ iMinCost = min(iMinCost, iW + aE[i])" ]
false
0.070479
0.039683
1.776054
[ "s782398963", "s533371886" ]
u816872429
p02969
python
s515182259
s978487575
179
24
38,384
2,940
Accepted
Accepted
86.59
r = int(eval(input())) print((3 * r * r))
r = int(eval(input())) print((r * r * 3))
2
2
35
34
r = int(eval(input())) print((3 * r * r))
r = int(eval(input())) print((r * r * 3))
false
0
[ "-print((3 * r * r))", "+print((r * r * 3))" ]
false
0.05217
0.076382
0.683011
[ "s515182259", "s978487575" ]
u729133443
p02889
python
s760973626
s876070968
551
348
36,252
36,304
Accepted
Accepted
36.84
import sys from scipy.sparse.csgraph import floyd_warshall as f def main(): n,m,l,*t=list(map(int,sys.stdin.buffer.read().split())) d=[[0]*(n+1)for _ in range(n+1)] for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c d=f(f(d,0)<=l)-1 d[d>n]=-1 d=d.astype('i2') print(('\n'.join(map(str,[d[i]for i in zi...
import sys import scipy.sparse.csgraph as s f=s.floyd_warshall def main(): n,m,l,*t=list(map(int,sys.stdin.buffer.read().split())) d=[[0]*(n+1)for _ in range(n+1)] for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=c d=f(f(d,0)<=l)-1 d[d>n]=-1 print(('\n'.join(map(str,list(map(int,[d[i]for i in zip(*[ite...
11
11
348
337
import sys from scipy.sparse.csgraph import floyd_warshall as f def main(): n, m, l, *t = list(map(int, sys.stdin.buffer.read().split())) d = [[0] * (n + 1) for _ in range(n + 1)] for a, b, c in zip(*[iter(t[: m * 3])] * 3): d[a][b] = c d = f(f(d, 0) <= l) - 1 d[d > n] = -1 d = d.astyp...
import sys import scipy.sparse.csgraph as s f = s.floyd_warshall def main(): n, m, l, *t = list(map(int, sys.stdin.buffer.read().split())) d = [[0] * (n + 1) for _ in range(n + 1)] for a, b, c in zip(*[iter(t[: m * 3])] * 3): d[a][b] = c d = f(f(d, 0) <= l) - 1 d[d > n] = -1 print( ...
false
0
[ "-from scipy.sparse.csgraph import floyd_warshall as f", "+import scipy.sparse.csgraph as s", "+", "+f = s.floyd_warshall", "- d = d.astype(\"i2\")", "- print((\"\\n\".join(map(str, [d[i] for i in zip(*[iter(t[m * 3 + 1 :])] * 2)]))))", "+ print(", "+ (", "+ \"\\n\".join("...
false
0.253659
0.265991
0.953635
[ "s760973626", "s876070968" ]
u862108688
p02899
python
s209832603
s800900688
281
238
19,380
23,352
Accepted
Accepted
15.3
n = int(input()) a = list(map(int, input().split())) p = zip(a,[i for i in range(1,n+1)]) s = sorted(p) for i in s: print(i[1],end=" ")
n = int(input()) L= sorted([(i+1, int(j)) for i,j in enumerate(input().split())],key= lambda x: x[1]) for i in L: print(i[0], end=' ')
6
4
144
141
n = int(input()) a = list(map(int, input().split())) p = zip(a, [i for i in range(1, n + 1)]) s = sorted(p) for i in s: print(i[1], end=" ")
n = int(input()) L = sorted([(i + 1, int(j)) for i, j in enumerate(input().split())], key=lambda x: x[1]) for i in L: print(i[0], end=" ")
false
33.333333
[ "-a = list(map(int, input().split()))", "-p = zip(a, [i for i in range(1, n + 1)])", "-s = sorted(p)", "-for i in s:", "- print(i[1], end=\" \")", "+L = sorted([(i + 1, int(j)) for i, j in enumerate(input().split())], key=lambda x: x[1])", "+for i in L:", "+ print(i[0], end=\" \")" ]
false
0.116938
0.114302
1.023068
[ "s209832603", "s800900688" ]
u671060652
p03085
python
s756726071
s435879489
278
62
63,980
61,856
Accepted
Accepted
77.7
import itertools import math import fractions import functools import copy b = eval(input()) if b == "A": print("T") if b == "T": print("A") if b == "C": print("G") if b == "G": print("C")
def main(): # n = int(input()) # n, m = map(int, input().split()) # a = list(map(int, input().split())) s = eval(input()) # h = [int(input()) for _ in rane(n)] if s == "A": print("T") if s == "T": print("A") if s == "C": print("G") if s == "G": ...
14
18
212
375
import itertools import math import fractions import functools import copy b = eval(input()) if b == "A": print("T") if b == "T": print("A") if b == "C": print("G") if b == "G": print("C")
def main(): # n = int(input()) # n, m = map(int, input().split()) # a = list(map(int, input().split())) s = eval(input()) # h = [int(input()) for _ in rane(n)] if s == "A": print("T") if s == "T": print("A") if s == "C": print("G") if s == "G": print("...
false
22.222222
[ "-import itertools", "-import math", "-import fractions", "-import functools", "-import copy", "+def main():", "+ # n = int(input())", "+ # n, m = map(int, input().split())", "+ # a = list(map(int, input().split()))", "+ s = eval(input())", "+ # h = [int(input()) for _ in rane(n)]...
false
0.044571
0.076726
0.580914
[ "s756726071", "s435879489" ]
u454670021
p02781
python
s800758734
s097211905
29
18
3,940
3,064
Accepted
Accepted
37.93
from functools import lru_cache @lru_cache(maxsize=10000) def calc(n, k): # print(n, k) if n < 10: if k > 1: # print('1:return 0') return 0 elif k == 1: # print('2:return ' + str(n)) return n else: return 1 ...
n = eval(input()) K = int(eval(input())) L = len(n) dp = [[[0] * (K + 2) for _ in range(2)] for __ in range(L + 1)] dp[0][1][0] = 1 for i in range(L): d = int(n[i]) for j in [0, 1]: for k in range(K + 1): if j == 0: dp[i + 1][j][k] += dp[i][j][k] ...
29
25
644
684
from functools import lru_cache @lru_cache(maxsize=10000) def calc(n, k): # print(n, k) if n < 10: if k > 1: # print('1:return 0') return 0 elif k == 1: # print('2:return ' + str(n)) return n else: return 1 else: i...
n = eval(input()) K = int(eval(input())) L = len(n) dp = [[[0] * (K + 2) for _ in range(2)] for __ in range(L + 1)] dp[0][1][0] = 1 for i in range(L): d = int(n[i]) for j in [0, 1]: for k in range(K + 1): if j == 0: dp[i + 1][j][k] += dp[i][j][k] dp[i + 1][j][...
false
13.793103
[ "-from functools import lru_cache", "-", "-", "-@lru_cache(maxsize=10000)", "-def calc(n, k):", "- # print(n, k)", "- if n < 10:", "- if k > 1:", "- # print('1:return 0')", "- return 0", "- elif k == 1:", "- # print('2:return ' + str(n))", ...
false
0.04498
0.037223
1.208405
[ "s800758734", "s097211905" ]
u545368057
p03785
python
s567603340
s622049438
242
99
8,076
71,488
Accepted
Accepted
59.09
n,c,k = list(map(int, input().split())) Ts = [int(eval(input())) for i in range(n)] + [10**10] Ts = sorted(Ts) ans = 0 cnt = 1 flg = 0 prev = Ts[0] for i in range(1,len(Ts)): now = Ts[i] if now - prev <= k: cnt += 1 else: ans += 1 cnt = 1 prev = Ts[i] if ...
import sys input = sys.stdin.readline n,c,k = list(map(int, input().split())) ts = [int(eval(input())) for i in range(n)] ts.sort() cnt = 0 ans = 0 end = -1 for i, t in enumerate(ts): if end < t: cnt = 1 ans += 1 end = t + k else: # t <= end cnt += 1 if cnt > ...
23
21
428
388
n, c, k = list(map(int, input().split())) Ts = [int(eval(input())) for i in range(n)] + [10**10] Ts = sorted(Ts) ans = 0 cnt = 1 flg = 0 prev = Ts[0] for i in range(1, len(Ts)): now = Ts[i] if now - prev <= k: cnt += 1 else: ans += 1 cnt = 1 prev = Ts[i] if cnt > c: ...
import sys input = sys.stdin.readline n, c, k = list(map(int, input().split())) ts = [int(eval(input())) for i in range(n)] ts.sort() cnt = 0 ans = 0 end = -1 for i, t in enumerate(ts): if end < t: cnt = 1 ans += 1 end = t + k else: # t <= end cnt += 1 if cnt > c: c...
false
8.695652
[ "+import sys", "+", "+input = sys.stdin.readline", "-Ts = [int(eval(input())) for i in range(n)] + [10**10]", "-Ts = sorted(Ts)", "+ts = [int(eval(input())) for i in range(n)]", "+ts.sort()", "+cnt = 0", "-cnt = 1", "-flg = 0", "-prev = Ts[0]", "-for i in range(1, len(Ts)):", "- now = Ts[...
false
0.035216
0.035665
0.987395
[ "s567603340", "s622049438" ]
u735335967
p02819
python
s527694659
s774624697
103
18
5,400
3,060
Accepted
Accepted
82.52
import math x = int(eval(input())) def prime_get(): if x <= 1: return [] prime = [2] limit = int(math.sqrt(x)) data = [i+1 for i in range(2,100004,2)] while limit >= data[0]: prime.append(data[0]) data = [j for j in data if j % data[0] != 0] return prime+data...
import math x = int(eval(input())) def prime(x): if x == 2: return True elif x % 2 == 0: return False elif x > 2: for i in range(3, math.floor(math.sqrt(x))+1,2): if x % i == 0: return False return True while prime(x) != True : x...
17
16
385
330
import math x = int(eval(input())) def prime_get(): if x <= 1: return [] prime = [2] limit = int(math.sqrt(x)) data = [i + 1 for i in range(2, 100004, 2)] while limit >= data[0]: prime.append(data[0]) data = [j for j in data if j % data[0] != 0] return prime + data a...
import math x = int(eval(input())) def prime(x): if x == 2: return True elif x % 2 == 0: return False elif x > 2: for i in range(3, math.floor(math.sqrt(x)) + 1, 2): if x % i == 0: return False return True while prime(x) != True: x += 1 pr...
false
5.882353
[ "-def prime_get():", "- if x <= 1:", "- return []", "- prime = [2]", "- limit = int(math.sqrt(x))", "- data = [i + 1 for i in range(2, 100004, 2)]", "- while limit >= data[0]:", "- prime.append(data[0])", "- data = [j for j in data if j % data[0] != 0]", "- r...
false
0.057043
0.036543
1.560968
[ "s527694659", "s774624697" ]
u600402037
p03215
python
s215987753
s424642508
394
221
36,176
25,320
Accepted
Accepted
43.91
import sys import numpy as np import itertools sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() A = np.array([0] + lr()) A_cum = A.cumsum().tolist() beauties = [] for i, j in itertools.combinations(list(range(N+1)), 2): beauties.a...
import sys import numpy as np import itertools sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() A = np.array([0] + lr()) Acum = A.cumsum() sum_range = Acum[:, None] - Acum[None, :] sum_range = sum_range[sum_range>0] def check(x): ...
27
24
563
486
import sys import numpy as np import itertools sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() A = np.array([0] + lr()) A_cum = A.cumsum().tolist() beauties = [] for i, j in itertools.combinations(list(range(N + 1)), 2): beauties.append(A_cum[...
import sys import numpy as np import itertools sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N, K = lr() A = np.array([0] + lr()) Acum = A.cumsum() sum_range = Acum[:, None] - Acum[None, :] sum_range = sum_range[sum_range > 0] def check(x): return np....
false
11.111111
[ "-A_cum = A.cumsum().tolist()", "-beauties = []", "-for i, j in itertools.combinations(list(range(N + 1)), 2):", "- beauties.append(A_cum[j] - A_cum[i])", "-beauties = np.array(beauties)", "-j = 0", "+Acum = A.cumsum()", "+sum_range = Acum[:, None] - Acum[None, :]", "+sum_range = sum_range[sum_ra...
false
0.176175
0.258894
0.680491
[ "s215987753", "s424642508" ]
u716530146
p02996
python
s575450210
s254542207
710
563
76,764
31,832
Accepted
Accepted
20.7
import sys input = lambda: sys.stdin.readline()[:-1] n=int(eval(input())) data=[tuple(map(int,input().split())) for i in range(n)] data.sort(key=lambda tup:tup[1]) time=0 for offer in data: time+=offer[0] if time > offer[1]: print('No') break else:print('Yes')
#!/usr/bin/env python3 import sys input = lambda: sys.stdin.readline()[:-1] sys.setrecursionlimit(10**8) n=int(eval(input())) ab=[] for i in range(n): ab.append(tuple(map(int,input().split()))) ab.sort(key=lambda tup:tup[1]) time=0 for a,b in ab: time+=a if time>b: print('No') ...
12
17
272
336
import sys input = lambda: sys.stdin.readline()[:-1] n = int(eval(input())) data = [tuple(map(int, input().split())) for i in range(n)] data.sort(key=lambda tup: tup[1]) time = 0 for offer in data: time += offer[0] if time > offer[1]: print("No") break else: print("Yes")
#!/usr/bin/env python3 import sys input = lambda: sys.stdin.readline()[:-1] sys.setrecursionlimit(10**8) n = int(eval(input())) ab = [] for i in range(n): ab.append(tuple(map(int, input().split()))) ab.sort(key=lambda tup: tup[1]) time = 0 for a, b in ab: time += a if time > b: print("No") ...
false
29.411765
[ "+#!/usr/bin/env python3", "+sys.setrecursionlimit(10**8)", "-data = [tuple(map(int, input().split())) for i in range(n)]", "-data.sort(key=lambda tup: tup[1])", "+ab = []", "+for i in range(n):", "+ ab.append(tuple(map(int, input().split())))", "+ab.sort(key=lambda tup: tup[1])", "-for offer in ...
false
0.037878
0.042995
0.880978
[ "s575450210", "s254542207" ]
u157020659
p02820
python
s676812164
s447597927
109
99
9,460
9,460
Accepted
Accepted
9.17
import sys n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) win_choice = {'s':'r', 'p':'s', 'r':'p'} janken_point = {'r':r, 's':s, 'p':p} dp = [] # a: 相手の手, x:自分が出せない手 def point(a, x=None): if x == win_choice[a]: return 0 else: return janken_poin...
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) point = {'s':r, 'p':s, 'r':p} score = 0 flag = [('0', 1)] * k for i in range(n): if flag[i % k][0] != t[i]: score += point[t[i]] flag[i % k] = (t[i], -1) elif flag[i % k][0] == t[i] a...
28
19
653
449
import sys n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) win_choice = {"s": "r", "p": "s", "r": "p"} janken_point = {"r": r, "s": s, "p": p} dp = [] # a: 相手の手, x:自分が出せない手 def point(a, x=None): if x == win_choice[a]: return 0 else: return jank...
n, k = list(map(int, input().split())) r, s, p = list(map(int, input().split())) t = eval(input()) point = {"s": r, "p": s, "r": p} score = 0 flag = [("0", 1)] * k for i in range(n): if flag[i % k][0] != t[i]: score += point[t[i]] flag[i % k] = (t[i], -1) elif flag[i % k][0] == t[i] and flag[i %...
false
32.142857
[ "-import sys", "-", "-win_choice = {\"s\": \"r\", \"p\": \"s\", \"r\": \"p\"}", "-janken_point = {\"r\": r, \"s\": s, \"p\": p}", "-dp = []", "-# a: 相手の手, x:自分が出せない手", "-def point(a, x=None):", "- if x == win_choice[a]:", "- return 0", "- else:", "- return janken_point[win_ch...
false
0.042211
0.096717
0.43644
[ "s676812164", "s447597927" ]
u150984829
p00458
python
s335501593
s727937110
630
370
5,716
5,724
Accepted
Accepted
41.27
def s(): def b(M,x,y,n=0): if M[x][y]==0:return n M[x][y]=0 a=max(b(M,x+s,y+t,n+1)for s,t in[(-1,0),(0,-1),(1,0),(0,1)]) M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(eval(input())) P=[[0]*(n+2)for _ in[0]*(m+2)] for i in range(m):P[i+1][1:-1]=list(map(int,input().split())) ...
def s(): def b(M,x,y,n=0): if M[x][y]==0:return n M[x][y]=0 a=max(b(M,x-1,y,n+1),b(M,x,y-1,n+1),b(M,x+1,y,n+1),b(M,x,y+1,n+1)) M[x][y]=1 return a for e in iter(input,'0'): n,m=int(e),int(eval(input())) P=[[0]*(n+2)for _ in[0]*(m+2)] for i in range(m):P[i+1][1:-1]=list(map(int,input().split()...
13
13
399
405
def s(): def b(M, x, y, n=0): if M[x][y] == 0: return n M[x][y] = 0 a = max( b(M, x + s, y + t, n + 1) for s, t in [(-1, 0), (0, -1), (1, 0), (0, 1)] ) M[x][y] = 1 return a for e in iter(input, "0"): n, m = int(e), int(eval(input()...
def s(): def b(M, x, y, n=0): if M[x][y] == 0: return n M[x][y] = 0 a = max( b(M, x - 1, y, n + 1), b(M, x, y - 1, n + 1), b(M, x + 1, y, n + 1), b(M, x, y + 1, n + 1), ) M[x][y] = 1 return a for e in it...
false
0
[ "- b(M, x + s, y + t, n + 1) for s, t in [(-1, 0), (0, -1), (1, 0), (0, 1)]", "+ b(M, x - 1, y, n + 1),", "+ b(M, x, y - 1, n + 1),", "+ b(M, x + 1, y, n + 1),", "+ b(M, x, y + 1, n + 1)," ]
false
0.060933
0.042118
1.446732
[ "s335501593", "s727937110" ]
u989345508
p02792
python
s422400956
s602235146
271
213
3,064
3,060
Accepted
Accepted
21.4
n=int(eval(input())) check1=[[i,i,0] for i in range(1,10)] check2=[[i,j,0] for i in range(1,10) for j in range(i+1,10)] l=len(check2) check3=[[check2[i][1],check2[i][0],0] for i in range(l)] for i in range(1,n+1): s=str(i) s1=int(s[0]) s2=int(s[-1]) if s2!=0: if s1==s2: ...
n=int(eval(input())) check=[[0]*9 for i in range(9)] for i in range(1,n+1): s=str(i) s1=int(s[0])-1 s2=int(s[-1])-1 if s2==-1:continue check[s1][s2]+=1 cnt=0 for i in range(9): for j in range(9): cnt+=check[i][j]*check[j][i] print(cnt)
25
13
676
274
n = int(eval(input())) check1 = [[i, i, 0] for i in range(1, 10)] check2 = [[i, j, 0] for i in range(1, 10) for j in range(i + 1, 10)] l = len(check2) check3 = [[check2[i][1], check2[i][0], 0] for i in range(l)] for i in range(1, n + 1): s = str(i) s1 = int(s[0]) s2 = int(s[-1]) if s2 != 0: if s...
n = int(eval(input())) check = [[0] * 9 for i in range(9)] for i in range(1, n + 1): s = str(i) s1 = int(s[0]) - 1 s2 = int(s[-1]) - 1 if s2 == -1: continue check[s1][s2] += 1 cnt = 0 for i in range(9): for j in range(9): cnt += check[i][j] * check[j][i] print(cnt)
false
48
[ "-check1 = [[i, i, 0] for i in range(1, 10)]", "-check2 = [[i, j, 0] for i in range(1, 10) for j in range(i + 1, 10)]", "-l = len(check2)", "-check3 = [[check2[i][1], check2[i][0], 0] for i in range(l)]", "+check = [[0] * 9 for i in range(9)]", "- s1 = int(s[0])", "- s2 = int(s[-1])", "- if s...
false
0.054242
0.047241
1.148197
[ "s422400956", "s602235146" ]
u821624310
p02256
python
s608920058
s911242250
30
20
7,652
7,668
Accepted
Accepted
33.33
x, y = input().split() x = int(x) y = int(y) r = 1 while r > 0: if x >= y: r = x % y else: r = y % x if r != 0: x = y y = r else: print(y)
def gcd(x, y): if y == 0: print(x) return x return gcd(y, x%y) x, y = list(map(int, input().split())) if y > x: t = y y = x x = t gcd(x, y)
15
12
209
181
x, y = input().split() x = int(x) y = int(y) r = 1 while r > 0: if x >= y: r = x % y else: r = y % x if r != 0: x = y y = r else: print(y)
def gcd(x, y): if y == 0: print(x) return x return gcd(y, x % y) x, y = list(map(int, input().split())) if y > x: t = y y = x x = t gcd(x, y)
false
20
[ "-x, y = input().split()", "-x = int(x)", "-y = int(y)", "-r = 1", "-while r > 0:", "- if x >= y:", "- r = x % y", "- else:", "- r = y % x", "- if r != 0:", "- x = y", "- y = r", "- else:", "- print(y)", "+def gcd(x, y):", "+ if y == 0:...
false
0.041033
0.047319
0.86715
[ "s608920058", "s911242250" ]
u325956328
p03038
python
s518202360
s990339560
514
447
33,092
27,208
Accepted
Accepted
13.04
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N, M = list(map(int, input().split())) H = [] for i in list(map(int, input().split())): heapq.heappush(H, [-i, 1]) for i in range(M): b, c = list(map(int, input().split())) ...
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def main(): N, M = list(map(int, input().split())) H = [] for i in list(map(int, input().split())): heapq.heappush(H, (-i, 1)) for i in range(M): b, c = list(map(int, input().split())) ...
34
34
618
618
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): N, M = list(map(int, input().split())) H = [] for i in list(map(int, input().split())): heapq.heappush(H, [-i, 1]) for i in range(M): b, c = list(map(int, input().split())) heapq.heappu...
import sys import heapq input = sys.stdin.readline sys.setrecursionlimit(10**7) def main(): N, M = list(map(int, input().split())) H = [] for i in list(map(int, input().split())): heapq.heappush(H, (-i, 1)) for i in range(M): b, c = list(map(int, input().split())) heapq.heappu...
false
0
[ "- heapq.heappush(H, [-i, 1])", "+ heapq.heappush(H, (-i, 1))", "- heapq.heappush(H, [-c, b])", "+ heapq.heappush(H, (-c, b))", "- heapq.heappush(H, [-c, b])", "+ heapq.heappush(H, (-c, b))" ]
false
0.055804
0.03655
1.526795
[ "s518202360", "s990339560" ]
u225388820
p02786
python
s878877893
s594616013
19
17
2,940
2,940
Accepted
Accepted
10.53
h=int(eval(input())) i=0 ans=0 while h>0: ans+=(1<<i) h//=2 i+=1 print(ans)
h=int(eval(input())) i=0 while h>0: h//=2 i+=1 print(((1<<i)-1))
8
6
88
70
h = int(eval(input())) i = 0 ans = 0 while h > 0: ans += 1 << i h //= 2 i += 1 print(ans)
h = int(eval(input())) i = 0 while h > 0: h //= 2 i += 1 print(((1 << i) - 1))
false
25
[ "-ans = 0", "- ans += 1 << i", "-print(ans)", "+print(((1 << i) - 1))" ]
false
0.049907
0.050118
0.995791
[ "s878877893", "s594616013" ]
u632413369
p02700
python
s458800923
s217303745
65
56
61,956
61,836
Accepted
Accepted
13.85
A, B, C, D = list(map(int, input().split())) count = 0 while A > 0 and C > 0: count += 1 if count % 2 == 1: C -= B else: A -= D if count % 2 == 1: print('Yes') else: print('No')
A, B, C, D = list(map(int, input().split())) a = True while a: C -= B A -= D if C <= 0: print('Yes') break elif A <= 0: print('No') break
12
11
218
189
A, B, C, D = list(map(int, input().split())) count = 0 while A > 0 and C > 0: count += 1 if count % 2 == 1: C -= B else: A -= D if count % 2 == 1: print("Yes") else: print("No")
A, B, C, D = list(map(int, input().split())) a = True while a: C -= B A -= D if C <= 0: print("Yes") break elif A <= 0: print("No") break
false
8.333333
[ "-count = 0", "-while A > 0 and C > 0:", "- count += 1", "- if count % 2 == 1:", "- C -= B", "- else:", "- A -= D", "-if count % 2 == 1:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+a = True", "+while a:", "+ C -= B", "+ A -= D", "+ if C <=...
false
0.039042
0.046749
0.835147
[ "s458800923", "s217303745" ]
u655048024
p02731
python
s806516680
s515821423
19
17
3,188
2,940
Accepted
Accepted
10.53
L = int(eval(input())) K = (L/3)**3 print(K)
print(((int(eval(input()))/3)**3))
4
1
43
26
L = int(eval(input())) K = (L / 3) ** 3 print(K)
print(((int(eval(input())) / 3) ** 3))
false
75
[ "-L = int(eval(input()))", "-K = (L / 3) ** 3", "-print(K)", "+print(((int(eval(input())) / 3) ** 3))" ]
false
0.039362
0.039963
0.984969
[ "s806516680", "s515821423" ]
u469281291
p03037
python
s241722331
s891112014
326
278
3,060
3,060
Accepted
Accepted
14.72
n, m = list(map(int, input().split())) l = 0 r = n for i in range(m): lt, rt = list(map(int, input().split())) l = max(l, lt) r = min(r, rt) if(l<=r): print((r - l + 1)) else: print((0))
n, m = list(map(int, input().split())) l = 0 r = n for i in range(m): lt, rt = list(map(int, input().split())) if (lt > l): l = lt if (rt < r): r = rt if (r <l): print((0)) else: print((r-l+1))
11
13
201
226
n, m = list(map(int, input().split())) l = 0 r = n for i in range(m): lt, rt = list(map(int, input().split())) l = max(l, lt) r = min(r, rt) if l <= r: print((r - l + 1)) else: print((0))
n, m = list(map(int, input().split())) l = 0 r = n for i in range(m): lt, rt = list(map(int, input().split())) if lt > l: l = lt if rt < r: r = rt if r < l: print((0)) else: print((r - l + 1))
false
15.384615
[ "- l = max(l, lt)", "- r = min(r, rt)", "-if l <= r:", "+ if lt > l:", "+ l = lt", "+ if rt < r:", "+ r = rt", "+if r < l:", "+ print((0))", "+else:", "-else:", "- print((0))" ]
false
0.041803
0.040594
1.029778
[ "s241722331", "s891112014" ]
u350248178
p02824
python
s058188354
s579281087
669
342
14,964
14,964
Accepted
Accepted
48.88
n,m,v,p=[int(j) for j in input().split()] a=[int(j) for j in input().split()] a.sort(reverse=True) def f(x): if x>n-1: return False if x<p: return True if a[x]+m<a[p-1]: return False tmp=m*(p+n-x-1) for i in range(p-1,x): tmp+=min(m,a[x]+m-a[i]) if ...
n,m,v,p=[int(j) for j in input().split()] a=[int(j) for j in input().split()] a.sort(reverse=True) def f(x): if x>n-1: return False if x<p: return True if a[x]+m<a[p-1]: return False tmp=m*(p+n-x-1) for i in range(p-1,x): tmp+=a[x]+m-a[i] if tmp>=m*...
26
28
511
508
n, m, v, p = [int(j) for j in input().split()] a = [int(j) for j in input().split()] a.sort(reverse=True) def f(x): if x > n - 1: return False if x < p: return True if a[x] + m < a[p - 1]: return False tmp = m * (p + n - x - 1) for i in range(p - 1, x): tmp += min(m...
n, m, v, p = [int(j) for j in input().split()] a = [int(j) for j in input().split()] a.sort(reverse=True) def f(x): if x > n - 1: return False if x < p: return True if a[x] + m < a[p - 1]: return False tmp = m * (p + n - x - 1) for i in range(p - 1, x): tmp += a[x] ...
false
7.142857
[ "- tmp += min(m, a[x] + m - a[i])", "+ tmp += a[x] + m - a[i]", "-left = -1", "+left = 0" ]
false
0.089033
0.124096
0.717452
[ "s058188354", "s579281087" ]
u413165887
p03050
python
s862540837
s297365745
142
126
2,940
3,060
Accepted
Accepted
11.27
n = int(eval(input())) result = 0 for i in range(1, int(n**(1/2)+1)): if n%i==0: x = n//i -1 if x > i: result += x print(result)
n = int(eval(input())) print((sum([n//i-1 for i in range(1, int(n**(1/2))+1) if (n%i==0) and (n//i-1 > i)])))
9
2
163
102
n = int(eval(input())) result = 0 for i in range(1, int(n ** (1 / 2) + 1)): if n % i == 0: x = n // i - 1 if x > i: result += x print(result)
n = int(eval(input())) print( ( sum( [ n // i - 1 for i in range(1, int(n ** (1 / 2)) + 1) if (n % i == 0) and (n // i - 1 > i) ] ) ) )
false
77.777778
[ "-result = 0", "-for i in range(1, int(n ** (1 / 2) + 1)):", "- if n % i == 0:", "- x = n // i - 1", "- if x > i:", "- result += x", "-print(result)", "+print(", "+ (", "+ sum(", "+ [", "+ n // i - 1", "+ for i in...
false
0.188984
0.170121
1.110875
[ "s862540837", "s297365745" ]
u075012704
p03762
python
s050748363
s055043291
173
145
19,580
18,624
Accepted
Accepted
16.18
# D - 井井井 / ### # 問題URL:http://abc058.contest.atcoder.jp/tasks/arc071_b n , m = list(map(int, input().split())) X = [int(i) for i in input().split()] Y = [int(i) for i in input().split()] x_sum = 0 y_sum =0 for i in range(1,n+1): x_sum += (X[i-1] * (i - 1)) - (X[i-1] * (n - i)) for i in range(1...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) Y = list(map(int, input().split())) mod = 10 ** 9 + 7 XS = 0 for i, x in enumerate(X, start=1): XS += (x * ((i - 1) - (N - i))) % mod YS = 0 for i, y in enumerate(Y, start=1): YS += (y * ((i - 1) - (M - i))) % mod print((XS...
17
13
411
326
# D - 井井井 / ### # 問題URL:http://abc058.contest.atcoder.jp/tasks/arc071_b n, m = list(map(int, input().split())) X = [int(i) for i in input().split()] Y = [int(i) for i in input().split()] x_sum = 0 y_sum = 0 for i in range(1, n + 1): x_sum += (X[i - 1] * (i - 1)) - (X[i - 1] * (n - i)) for i in range(1, m + 1): ...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) Y = list(map(int, input().split())) mod = 10**9 + 7 XS = 0 for i, x in enumerate(X, start=1): XS += (x * ((i - 1) - (N - i))) % mod YS = 0 for i, y in enumerate(Y, start=1): YS += (y * ((i - 1) - (M - i))) % mod print((XS * YS % mod))
false
23.529412
[ "-# D - 井井井 / ###", "-# 問題URL:http://abc058.contest.atcoder.jp/tasks/arc071_b", "-n, m = list(map(int, input().split()))", "-X = [int(i) for i in input().split()]", "-Y = [int(i) for i in input().split()]", "-x_sum = 0", "-y_sum = 0", "-for i in range(1, n + 1):", "- x_sum += (X[i - 1] * (i - 1))...
false
0.04108
0.042798
0.959862
[ "s050748363", "s055043291" ]
u875449556
p02732
python
s836317135
s574418097
455
414
27,036
24,744
Accepted
Accepted
9.01
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) c = Counter(a) d = {} sum = 0 for i in c: k = c[i] sum += k * (k - 1) / 2 for i in range(n): print((int(sum - c[a[i]] + 1)))
N = int(eval(input())) L = list(map(int, input().split())) from collections import Counter c = Counter(L) d = {} sum = 0 for i in c: k = c[i] sum += k * (k-1) //2 for i in range(N): print((int(sum - c[L[i]] + 1)))
11
14
229
234
from collections import Counter n = int(eval(input())) a = list(map(int, input().split())) c = Counter(a) d = {} sum = 0 for i in c: k = c[i] sum += k * (k - 1) / 2 for i in range(n): print((int(sum - c[a[i]] + 1)))
N = int(eval(input())) L = list(map(int, input().split())) from collections import Counter c = Counter(L) d = {} sum = 0 for i in c: k = c[i] sum += k * (k - 1) // 2 for i in range(N): print((int(sum - c[L[i]] + 1)))
false
21.428571
[ "+N = int(eval(input()))", "+L = list(map(int, input().split()))", "-n = int(eval(input()))", "-a = list(map(int, input().split()))", "-c = Counter(a)", "+c = Counter(L)", "- sum += k * (k - 1) / 2", "-for i in range(n):", "- print((int(sum - c[a[i]] + 1)))", "+ sum += k * (k - 1) // 2", ...
false
0.043423
0.043321
1.002358
[ "s836317135", "s574418097" ]
u564105430
p02265
python
s808212766
s341446428
4,940
4,220
69,664
69,732
Accepted
Accepted
14.57
from collections import deque def pr(A,n): for i in range(n): if i!=n-1: print(A[i],end=" ") else: print(A[i]) n=int(input()) que_r=deque() data=deque() for i in range(n): s=input() l=len(s) if s[0]=="i": que_r.appendleft(s[7:]) el...
from collections import deque n=int(eval(input())) que_r=deque() for i in range(n): s=eval(input()) l=len(s) if s[0]=="i": que_r.appendleft(s[7:]) elif s[6]==" ": try: que_r.remove(s[7:]) except: pass elif l>10: que_r.popleft() elif l...
28
20
504
350
from collections import deque def pr(A, n): for i in range(n): if i != n - 1: print(A[i], end=" ") else: print(A[i]) n = int(input()) que_r = deque() data = deque() for i in range(n): s = input() l = len(s) if s[0] == "i": que_r.appendleft(s[7:]) e...
from collections import deque n = int(eval(input())) que_r = deque() for i in range(n): s = eval(input()) l = len(s) if s[0] == "i": que_r.appendleft(s[7:]) elif s[6] == " ": try: que_r.remove(s[7:]) except: pass elif l > 10: que_r.popleft() ...
false
28.571429
[ "-", "-def pr(A, n):", "- for i in range(n):", "- if i != n - 1:", "- print(A[i], end=\" \")", "- else:", "- print(A[i])", "-", "-", "-n = int(input())", "+n = int(eval(input()))", "-data = deque()", "- s = input()", "+ s = eval(input())", "-p...
false
0.047018
0.046152
1.018774
[ "s808212766", "s341446428" ]
u379692329
p03014
python
s263756723
s233388895
901
660
219,860
178,564
Accepted
Accepted
26.75
import numpy as np H, W = list(map(int, input().split())) S = np.array([list(eval(input())) for _ in range(H)]) == '.' up = np.zeros((H, W), dtype=int) down = np.zeros((H, W), dtype=int) left = np.zeros((H, W), dtype=int) right = np.zeros((H, W), dtype=int) for i in range(H): up[i] = (up[i-1] + 1) * S[...
H, W = list(map(int, input().split())) S = [eval(input()) for _ in range(H)] up = [[0]*(W+2) for _ in range(H+2)] down = [[0]*(W+2) for _ in range(H+2)] left = [[0]*(W+2) for _ in range(H+2)] right = [[0]*(W+2) for _ in range(H+2)] for i in range(1, H+1): for j in range(1, W+1): if S[i-1]...
18
23
515
695
import numpy as np H, W = list(map(int, input().split())) S = np.array([list(eval(input())) for _ in range(H)]) == "." up = np.zeros((H, W), dtype=int) down = np.zeros((H, W), dtype=int) left = np.zeros((H, W), dtype=int) right = np.zeros((H, W), dtype=int) for i in range(H): up[i] = (up[i - 1] + 1) * S[i] dow...
H, W = list(map(int, input().split())) S = [eval(input()) for _ in range(H)] up = [[0] * (W + 2) for _ in range(H + 2)] down = [[0] * (W + 2) for _ in range(H + 2)] left = [[0] * (W + 2) for _ in range(H + 2)] right = [[0] * (W + 2) for _ in range(H + 2)] for i in range(1, H + 1): for j in range(1, W + 1): ...
false
21.73913
[ "-import numpy as np", "-", "-S = np.array([list(eval(input())) for _ in range(H)]) == \".\"", "-up = np.zeros((H, W), dtype=int)", "-down = np.zeros((H, W), dtype=int)", "-left = np.zeros((H, W), dtype=int)", "-right = np.zeros((H, W), dtype=int)", "-for i in range(H):", "- up[i] = (up[i - 1] + ...
false
0.22239
0.042547
5.226902
[ "s263756723", "s233388895" ]
u192154323
p03162
python
s712941022
s681976910
624
243
34,632
101,288
Accepted
Accepted
61.06
n = int(eval(input())) a_ls = [0] * n b_ls = [0] * n c_ls = [0] * n for i in range(n): a,b,c = list(map(int,input().split())) a_ls[i] = a b_ls[i] = b c_ls[i] = c dp = [[0]*3 for _ in range(n+1)] dp[1] = [a_ls[0], b_ls[0], c_ls[0]] for i in range(1,n): dp[i+1][0] = max(dp[i+1][0], dp[i]...
n = int(eval(input())) days_ls = [0] * n for i in range(n): days_ls[i] = list(map(int, input().split())) dp = [[0]*3 for _ in range(n)] dp[0] = days_ls[0] for i in range(1,n): dp[i][0] = max(dp[i-1][1],dp[i-1][2]) + days_ls[i][0] dp[i][1] = max(dp[i-1][0],dp[i-1][2]) + days_ls[i][1] dp[i][2] ...
18
12
512
378
n = int(eval(input())) a_ls = [0] * n b_ls = [0] * n c_ls = [0] * n for i in range(n): a, b, c = list(map(int, input().split())) a_ls[i] = a b_ls[i] = b c_ls[i] = c dp = [[0] * 3 for _ in range(n + 1)] dp[1] = [a_ls[0], b_ls[0], c_ls[0]] for i in range(1, n): dp[i + 1][0] = max(dp[i + 1][0], dp[i][1...
n = int(eval(input())) days_ls = [0] * n for i in range(n): days_ls[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(n)] dp[0] = days_ls[0] for i in range(1, n): dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + days_ls[i][0] dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + days_ls[i][1] dp[i][2...
false
33.333333
[ "-a_ls = [0] * n", "-b_ls = [0] * n", "-c_ls = [0] * n", "+days_ls = [0] * n", "- a, b, c = list(map(int, input().split()))", "- a_ls[i] = a", "- b_ls[i] = b", "- c_ls[i] = c", "-dp = [[0] * 3 for _ in range(n + 1)]", "-dp[1] = [a_ls[0], b_ls[0], c_ls[0]]", "+ days_ls[i] = list(ma...
false
0.043995
0.04403
0.999192
[ "s712941022", "s681976910" ]
u745514010
p02954
python
s674523864
s000355425
197
92
5,616
10,756
Accepted
Accepted
53.3
s = input() lst = [0 for _ in range(len(s))] count = 0 num_lst = [] lr = "R" for i in s: if i == lr: count += 1 else: num_lst.append(count) count = 1 lr = i num_lst.append(count) count = 0 for i, num in enumerate(num_lst): if i % 2 == 0: count += n...
string = eval(input()) r_cnt = 0 l_cnt = 0 flg = False ans = [0 for _ in range(len(string))] for i, s in enumerate(string): if s == "R": if flg: ans[pos - 1] += l_cnt // 2 ans[pos] += (l_cnt + 1) // 2 l_cnt = 0 flg = False r_cnt += 1 e...
27
25
545
578
s = input() lst = [0 for _ in range(len(s))] count = 0 num_lst = [] lr = "R" for i in s: if i == lr: count += 1 else: num_lst.append(count) count = 1 lr = i num_lst.append(count) count = 0 for i, num in enumerate(num_lst): if i % 2 == 0: count += num lst[count...
string = eval(input()) r_cnt = 0 l_cnt = 0 flg = False ans = [0 for _ in range(len(string))] for i, s in enumerate(string): if s == "R": if flg: ans[pos - 1] += l_cnt // 2 ans[pos] += (l_cnt + 1) // 2 l_cnt = 0 flg = False r_cnt += 1 else: ...
false
7.407407
[ "-s = input()", "-lst = [0 for _ in range(len(s))]", "-count = 0", "-num_lst = []", "-lr = \"R\"", "-for i in s:", "- if i == lr:", "- count += 1", "+string = eval(input())", "+r_cnt = 0", "+l_cnt = 0", "+flg = False", "+ans = [0 for _ in range(len(string))]", "+for i, s in enume...
false
0.048327
0.046736
1.034033
[ "s674523864", "s000355425" ]
u060938295
p02727
python
s187716652
s968162964
363
244
105,444
23,328
Accepted
Accepted
32.78
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys #import numpy as np sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 #N = int(input()) X, Y, A, B, C = list(map(int,input().split())) r = list(map(int,input().split())) g = l...
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys #import numpy as np sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 #N = int(input()) X, Y, A, B, C = list(map(int,input().split())) r = list(map(int,input().split())) g = l...
48
32
930
516
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys # import numpy as np sys.setrecursionlimit(10**9) # def input(): # return sys.stdin.readline()[:-1] mod = 10**9 + 7 # N = int(input()) X, Y, A, B, C = list(map(int, input().split())) r = list(map(int, input().split())) g = list(map(int, ...
# -*- coding: utf-8 -*- """ Created on Tue Apr 28 22:12:42 2020 """ import sys # import numpy as np sys.setrecursionlimit(10**9) # def input(): # return sys.stdin.readline()[:-1] mod = 10**9 + 7 # N = int(input()) X, Y, A, B, C = list(map(int, input().split())) r = list(map(int, input().split())) g = list(map(int, ...
false
33.333333
[ "-n.sort()", "-x, y = A - X, B - Y", "-z = C - 1", "-ans = 0", "-ans += sum(r[x:])", "-ans += sum(g[y:])", "-g.append(10**10)", "-# print(x,y,z,r[x],g[y],n[z],ans)", "-while z >= 0:", "- # print(x,y,z,r[x],g[y],n[z],ans)", "- flg = True", "- if x < A and r[x] < n[z] and r[x] < g[y]...
false
0.032955
0.041916
0.786202
[ "s187716652", "s968162964" ]
u529012223
p03037
python
s022744275
s122146845
323
288
3,188
3,060
Accepted
Accepted
10.84
N, M = list(map(int, input().split())) L = 0 R = N for i in range(M): l, r = list(map(int, input().split())) L = max(L, l) R = min(R, r) print((max(0, R - L + 1)))
N, M = list(map(int, input().split())) L_largest = 0 R_min = N for m in range(M): L, R = list(map(int, input().split())) if L >= L_largest: L_largest = L if R <= R_min: R_min = R print((max(0, R_min - L_largest + 1)))
9
12
170
244
N, M = list(map(int, input().split())) L = 0 R = N for i in range(M): l, r = list(map(int, input().split())) L = max(L, l) R = min(R, r) print((max(0, R - L + 1)))
N, M = list(map(int, input().split())) L_largest = 0 R_min = N for m in range(M): L, R = list(map(int, input().split())) if L >= L_largest: L_largest = L if R <= R_min: R_min = R print((max(0, R_min - L_largest + 1)))
false
25
[ "-L = 0", "-R = N", "-for i in range(M):", "- l, r = list(map(int, input().split()))", "- L = max(L, l)", "- R = min(R, r)", "-print((max(0, R - L + 1)))", "+L_largest = 0", "+R_min = N", "+for m in range(M):", "+ L, R = list(map(int, input().split()))", "+ if L >= L_largest:", ...
false
0.041919
0.040812
1.027101
[ "s022744275", "s122146845" ]
u911153222
p03013
python
s250979695
s921779412
476
73
460,020
11,884
Accepted
Accepted
84.66
import sys def typical_stairs(): n, m = list(map(int, input().split())) dangerous = set(int(sys.stdin.readline()) for _ in range(m)) mod = 1000000007 dp = [0] * (n + 1) dp[0] = 1 if 1 not in dangerous: dp[1] = 1 for i in range(2, n + 1): if i not in dangerous: ...
import sys input = sys.stdin.readline def typical_stairs(): n, m = list(map(int, input().split())) dangerous = set(int(eval(input())) for _ in range(m)) mod = 1000000007 dp = [0] * (n + 1) dp[0] = 1 if 1 not in dangerous: dp[1] = 1 for i in range(2, n + 1): if ...
19
20
435
452
import sys def typical_stairs(): n, m = list(map(int, input().split())) dangerous = set(int(sys.stdin.readline()) for _ in range(m)) mod = 1000000007 dp = [0] * (n + 1) dp[0] = 1 if 1 not in dangerous: dp[1] = 1 for i in range(2, n + 1): if i not in dangerous: d...
import sys input = sys.stdin.readline def typical_stairs(): n, m = list(map(int, input().split())) dangerous = set(int(eval(input())) for _ in range(m)) mod = 1000000007 dp = [0] * (n + 1) dp[0] = 1 if 1 not in dangerous: dp[1] = 1 for i in range(2, n + 1): if i not in dan...
false
5
[ "+", "+input = sys.stdin.readline", "- dangerous = set(int(sys.stdin.readline()) for _ in range(m))", "+ dangerous = set(int(eval(input())) for _ in range(m))", "- dp[i] = dp[i - 2] + dp[i - 1]", "- print((dp[-1] % mod))", "+ dp[i] = (dp[i - 2] + dp[i - 1]) % mod", "+ ...
false
0.154817
0.037411
4.138258
[ "s250979695", "s921779412" ]
u647766105
p02346
python
s842326929
s762214981
1,930
1,190
8,640
9,844
Accepted
Accepted
38.34
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0 for _ in range(self.size*2-1)] def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0...
class BIT(object): def __init__(self, size, init_data=None): self.size = size if init_data is None: init_data = [0] * (size + 1) self.data = init_data def sum(self, idx): ret = 0 while idx > 0: ret += self.data[idx] ...
39
29
1,100
799
class RangeSumQuery(object): def __init__(self, size): self.size = 1 while self.size <= size: self.size *= 2 self.data = [0 for _ in range(self.size * 2 - 1)] def add(self, idx, value): k = idx + self.size - 1 self.data[k] += value while k > 0: ...
class BIT(object): def __init__(self, size, init_data=None): self.size = size if init_data is None: init_data = [0] * (size + 1) self.data = init_data def sum(self, idx): ret = 0 while idx > 0: ret += self.data[idx] idx -= idx & -idx ...
false
25.641026
[ "-class RangeSumQuery(object):", "- def __init__(self, size):", "- self.size = 1", "- while self.size <= size:", "- self.size *= 2", "- self.data = [0 for _ in range(self.size * 2 - 1)]", "+class BIT(object):", "+ def __init__(self, size, init_data=None):", "+ ...
false
0.035674
0.035835
0.995514
[ "s842326929", "s762214981" ]
u027165539
p03478
python
s048493064
s388641047
35
32
2,940
2,940
Accepted
Accepted
8.57
N, A, B = list(map(int, input().split())) s = 0 for n in range(N + 1): d_sum = 0 for d in str(n): d_sum += int(d) if d_sum >= A and d_sum <= B: s += n print(s)
N, A, B = list(map(int, input().split())) s = 0 for n in range(N+1): if A <= sum([int(i) for i in str(n)]) <= B: s += n print(s)
12
8
187
141
N, A, B = list(map(int, input().split())) s = 0 for n in range(N + 1): d_sum = 0 for d in str(n): d_sum += int(d) if d_sum >= A and d_sum <= B: s += n print(s)
N, A, B = list(map(int, input().split())) s = 0 for n in range(N + 1): if A <= sum([int(i) for i in str(n)]) <= B: s += n print(s)
false
33.333333
[ "- d_sum = 0", "- for d in str(n):", "- d_sum += int(d)", "- if d_sum >= A and d_sum <= B:", "+ if A <= sum([int(i) for i in str(n)]) <= B:" ]
false
0.1121
0.036587
3.063969
[ "s048493064", "s388641047" ]
u840247626
p02258
python
s221304054
s141979860
610
230
5,620
28,272
Accepted
Accepted
62.3
s_max = -float('inf') s = 0 for i in range(int(eval(input()))): r = int(eval(input())) if i: s = max(s, 0) + r - prev s_max = max(s, s_max) prev = r print(s_max)
import sys s_max = -float('inf') s = 0 n = int(eval(input())) r = list(map(int, sys.stdin.read().split())) for i in range(1, n): s = max(s, 0) + r[i] - r[i-1] s_max = max(s, s_max) print(s_max)
9
9
165
198
s_max = -float("inf") s = 0 for i in range(int(eval(input()))): r = int(eval(input())) if i: s = max(s, 0) + r - prev s_max = max(s, s_max) prev = r print(s_max)
import sys s_max = -float("inf") s = 0 n = int(eval(input())) r = list(map(int, sys.stdin.read().split())) for i in range(1, n): s = max(s, 0) + r[i] - r[i - 1] s_max = max(s, s_max) print(s_max)
false
0
[ "+import sys", "+", "-for i in range(int(eval(input()))):", "- r = int(eval(input()))", "- if i:", "- s = max(s, 0) + r - prev", "- s_max = max(s, s_max)", "- prev = r", "+n = int(eval(input()))", "+r = list(map(int, sys.stdin.read().split()))", "+for i in range(1, n):", ...
false
0.039165
0.046009
0.851245
[ "s221304054", "s141979860" ]