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
u285681431
p02762
python
s171060301
s976101420
980
672
124,500
160,228
Accepted
Accepted
31.43
from collections import deque N, M, K = list(map(int, input().split())) friend = [list(map(int, input().split())) for _ in range(M)] block = [list(map(int, input().split())) for _ in range(K)] f = [set() for _ in range(N + 1)] b = [set() for _ in range(N + 1)] for i, j in friend: f[i].add(j) f[j]....
from collections import deque N, M, K = list(map(int, input().split())) f = [set() for _ in range(N + 1)] b = [set() for _ in range(N + 1)] for _ in range(M): f1, f2 = list(map(int, input().split())) f[f1].add(f2) f[f2].add(f1) for _ in range(K): b1, b2 = list(map(int, input().split()))...
42
50
1,002
1,039
from collections import deque N, M, K = list(map(int, input().split())) friend = [list(map(int, input().split())) for _ in range(M)] block = [list(map(int, input().split())) for _ in range(K)] f = [set() for _ in range(N + 1)] b = [set() for _ in range(N + 1)] for i, j in friend: f[i].add(j) f[j].add(i) for i,...
from collections import deque N, M, K = list(map(int, input().split())) f = [set() for _ in range(N + 1)] b = [set() for _ in range(N + 1)] for _ in range(M): f1, f2 = list(map(int, input().split())) f[f1].add(f2) f[f2].add(f1) for _ in range(K): b1, b2 = list(map(int, input().split())) b[b1].add(b...
false
16
[ "-friend = [list(map(int, input().split())) for _ in range(M)]", "-block = [list(map(int, input().split())) for _ in range(K)]", "-for i, j in friend:", "- f[i].add(j)", "- f[j].add(i)", "-for i, j in block:", "- b[i].add(j)", "- b[j].add(i)", "-stack = deque()", "+for _ in range(M):",...
false
0.106204
0.069209
1.534544
[ "s171060301", "s976101420" ]
u391066416
p03273
python
s391293199
s760373566
22
19
3,188
3,188
Accepted
Accepted
13.64
H, W = list(map(int, input().split())) matrix = [] hd = [] wd = [] for i in range(H): h = list(eval(input())) matrix.append(h) if h == ["."] * W: continue hd.append(i) for i in range(W): w = [list(w_[i]) for w_ in matrix] if w == [["."]] * H: continue wd.app...
H, W = list(map(int, input().split())) matrix = [] ans = [] for i in range(H): h = list(eval(input())) if "#" in h: matrix.append(h) for j in range(W): w = [w_[j] for w_ in matrix] if "#" in w: ans.append(w) for k in range(len(ans[0])): print(("".join([r[k] for r in ans])...
28
13
505
308
H, W = list(map(int, input().split())) matrix = [] hd = [] wd = [] for i in range(H): h = list(eval(input())) matrix.append(h) if h == ["."] * W: continue hd.append(i) for i in range(W): w = [list(w_[i]) for w_ in matrix] if w == [["."]] * H: continue wd.append(i) ansmatrix =...
H, W = list(map(int, input().split())) matrix = [] ans = [] for i in range(H): h = list(eval(input())) if "#" in h: matrix.append(h) for j in range(W): w = [w_[j] for w_ in matrix] if "#" in w: ans.append(w) for k in range(len(ans[0])): print(("".join([r[k] for r in ans])))
false
53.571429
[ "-hd = []", "-wd = []", "+ans = []", "- matrix.append(h)", "- if h == [\".\"] * W:", "- continue", "- hd.append(i)", "-for i in range(W):", "- w = [list(w_[i]) for w_ in matrix]", "- if w == [[\".\"]] * H:", "- continue", "- wd.append(i)", "-ansmatrix = []", ...
false
0.098832
0.109604
0.901713
[ "s391293199", "s760373566" ]
u493520238
p03241
python
s380132273
s488102081
168
78
38,640
63,764
Accepted
Accepted
53.57
import bisect n,m = list(map(int, input().split())) n_facs_s = [] n_facs_l = [] for i in range(1, int(-(-m**0.5//1))+1): if m%i == 0: n_facs_s.append(i) n_facs_l.append(m//i) n_faces = n_facs_s + n_facs_l[::-1] ind = bisect.bisect_right(n_faces, n) if n_faces[ind-1] == n: ind-...
n,m = list(map(int, input().split())) ans = 1 for i in range(1,10**5): if m%i == 0: v = i cnt = m//i if cnt >= n: ans = max(ans,v) v = m//i cnt = i if cnt >= n: ans = max(ans,v) print(ans)
17
16
341
276
import bisect n, m = list(map(int, input().split())) n_facs_s = [] n_facs_l = [] for i in range(1, int(-(-(m**0.5) // 1)) + 1): if m % i == 0: n_facs_s.append(i) n_facs_l.append(m // i) n_faces = n_facs_s + n_facs_l[::-1] ind = bisect.bisect_right(n_faces, n) if n_faces[ind - 1] == n: ind -= 1 ...
n, m = list(map(int, input().split())) ans = 1 for i in range(1, 10**5): if m % i == 0: v = i cnt = m // i if cnt >= n: ans = max(ans, v) v = m // i cnt = i if cnt >= n: ans = max(ans, v) print(ans)
false
5.882353
[ "-import bisect", "-", "-n_facs_s = []", "-n_facs_l = []", "-for i in range(1, int(-(-(m**0.5) // 1)) + 1):", "+ans = 1", "+for i in range(1, 10**5):", "- n_facs_s.append(i)", "- n_facs_l.append(m // i)", "-n_faces = n_facs_s + n_facs_l[::-1]", "-ind = bisect.bisect_right(n_faces, ...
false
0.040595
0.066678
0.608816
[ "s380132273", "s488102081" ]
u901582103
p03107
python
s421495153
s896530885
27
19
3,444
3,188
Accepted
Accepted
29.63
from collections import Counter s=eval(input()) if len(set(s))==1: print((0)) else: c=Counter(s).most_common() print((c[1][1]*2))
s=eval(input()) n=len(s) if len(set(s))==1: print((0)) else: c=s.count('1') print((min(c,n-c)*2))
7
7
137
105
from collections import Counter s = eval(input()) if len(set(s)) == 1: print((0)) else: c = Counter(s).most_common() print((c[1][1] * 2))
s = eval(input()) n = len(s) if len(set(s)) == 1: print((0)) else: c = s.count("1") print((min(c, n - c) * 2))
false
0
[ "-from collections import Counter", "-", "+n = len(s)", "- c = Counter(s).most_common()", "- print((c[1][1] * 2))", "+ c = s.count(\"1\")", "+ print((min(c, n - c) * 2))" ]
false
0.123237
0.052033
2.368458
[ "s421495153", "s896530885" ]
u788703383
p03775
python
s825512839
s270662091
46
30
2,940
2,940
Accepted
Accepted
34.78
n = int(eval(input())) ans = 10 def F(a,b): return max(len(str(a)),len(str(b))) i = 1 while i * i <= n: if n%i == 0: ans = min(ans,F(i,n//i)) #print(i,n//i) i += 1 print(ans)
import math n = int(eval(input())) s = int(math.sqrt(n)) ans = 10**11 for i in range(1,s+1): if n%i == 0: z = n//i ans = min(ans,len(str(z))) print(ans)
14
12
193
181
n = int(eval(input())) ans = 10 def F(a, b): return max(len(str(a)), len(str(b))) i = 1 while i * i <= n: if n % i == 0: ans = min(ans, F(i, n // i)) # print(i,n//i) i += 1 print(ans)
import math n = int(eval(input())) s = int(math.sqrt(n)) ans = 10**11 for i in range(1, s + 1): if n % i == 0: z = n // i ans = min(ans, len(str(z))) print(ans)
false
14.285714
[ "+import math", "+", "-ans = 10", "-", "-", "-def F(a, b):", "- return max(len(str(a)), len(str(b)))", "-", "-", "-i = 1", "-while i * i <= n:", "+s = int(math.sqrt(n))", "+ans = 10**11", "+for i in range(1, s + 1):", "- ans = min(ans, F(i, n // i))", "- # print(i,n//i...
false
0.080671
0.04284
1.883075
[ "s825512839", "s270662091" ]
u102461423
p04027
python
s767954875
s838288702
2,392
687
16,220
22,036
Accepted
Accepted
71.28
import sys input = sys.stdin.readline import numpy as np MOD = 10 ** 9 + 7 N,C = list(map(int,input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] # (i,j) に j^i を入れる kth_pow = np.ones((C+1, 401), dtype=np.int64) rng = np.arange(401, dtype=np.int64) for i in range...
import sys input = sys.stdin.readline import numpy as np MOD = 10 ** 9 + 7 N,C = list(map(int,input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] # (i,j) に j^i を入れる kth_pow = np.ones((1024, 401), dtype=np.int64) rng = np.arange(401, dtype=np.int64) for i in rang...
30
41
728
1,033
import sys input = sys.stdin.readline import numpy as np MOD = 10**9 + 7 N, C = list(map(int, input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] # (i,j) に j^i を入れる kth_pow = np.ones((C + 1, 401), dtype=np.int64) rng = np.arange(401, dtype=np.int64) for i in range(1, C + 1): ...
import sys input = sys.stdin.readline import numpy as np MOD = 10**9 + 7 N, C = list(map(int, input().split())) A = [int(x) for x in input().split()] B = [int(x) for x in input().split()] # (i,j) に j^i を入れる kth_pow = np.ones((1024, 401), dtype=np.int64) rng = np.arange(401, dtype=np.int64) for i in range(1, C + 1): ...
false
26.829268
[ "-kth_pow = np.ones((C + 1, 401), dtype=np.int64)", "+kth_pow = np.ones((1024, 401), dtype=np.int64)", "-dp = np.zeros((C + 1), dtype=np.int64) # これまで配った個数、合計点", "+kth_pow_cum[C + 1 :] = 0", "+", "+", "+def convolve(A, B, n=32):", "+ if n == 8:", "+ return np.rint(np.fft.irfft(np.fft.rfft...
false
0.175805
0.208646
0.842599
[ "s767954875", "s838288702" ]
u794173881
p03332
python
s278234322
s964156999
536
319
64,992
115,824
Accepted
Accepted
40.49
class Combination: ''' 計算量:階乗・逆元テーブルの作成O(N) nCkを求めるO(1) ''' def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)] ...
class Combination: """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う""" def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [0] * (n + 1) self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD) ...
39
58
1,031
1,691
class Combination: """ 計算量:階乗・逆元テーブルの作成O(N) nCkを求めるO(1) """ def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)] sel...
class Combination: """階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う""" def __init__(self, n, MOD): self.fact = [1] for i in range(1, n + 1): self.fact.append(self.fact[-1] * i % MOD) self.inv_fact = [0] * (n + 1) self.inv_fact[n] = pow(self.fact[n], MOD - 2, MOD) ...
false
32.758621
[ "- \"\"\"", "- 計算量:階乗・逆元テーブルの作成O(N)", "- nCkを求めるO(1)", "- \"\"\"", "+ \"\"\"階乗とその逆元のテーブルをO(N)で事前作成し、組み合わせの計算をO(1)で行う\"\"\"", "- self.inv_fact = [pow(self.fact[i], MOD - 2, MOD) for i in range(n + 1)]", "+ self.inv_fact = [0] * (n + 1)", "+ self.inv_fact[n] =...
false
0.339469
1.993072
0.170325
[ "s278234322", "s964156999" ]
u422590714
p03044
python
s007586652
s124503443
1,014
533
65,160
100,360
Accepted
Accepted
47.44
import copy import sys sys.setrecursionlimit(10 ** 7) N = int(eval(input())) uvw = [list(map(int, input().split(' '))) for _ in range(N - 1)] # 適当に最初の色を決める # その点を親として、 # 親からの距離が偶数だったら親と同じ色 # 親からの距離が奇数だったら親と違う色 children = [[] for _ in range(N + 1)] for e in uvw: children[e[0]].append([e[1], e[2]...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10 ** 7) def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"): res = [0 for i in range(N)] G = [[] for i in range(N)] for i, j, k in zip(u, v, w): # print(i, j, k) i -= 1 j -= 1 # print(i, j, k)...
41
55
902
1,449
import copy import sys sys.setrecursionlimit(10**7) N = int(eval(input())) uvw = [list(map(int, input().split(" "))) for _ in range(N - 1)] # 適当に最初の色を決める # その点を親として、 # 親からの距離が偶数だったら親と同じ色 # 親からの距離が奇数だったら親と違う色 children = [[] for _ in range(N + 1)] for e in uvw: children[e[0]].append([e[1], e[2]]) children[e[1]]....
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**7) def solve(N: int, u: "List[int]", v: "List[int]", w: "List[int]"): res = [0 for i in range(N)] G = [[] for i in range(N)] for i, j, k in zip(u, v, w): # print(i, j, k) i -= 1 j -= 1 # print(i, j, k) G[i...
false
25.454545
[ "-import copy", "+#!/usr/bin/env python3", "-N = int(eval(input()))", "-uvw = [list(map(int, input().split(\" \"))) for _ in range(N - 1)]", "-# 適当に最初の色を決める", "-# その点を親として、", "-# 親からの距離が偶数だったら親と同じ色", "-# 親からの距離が奇数だったら親と違う色", "-children = [[] for _ in range(N + 1)]", "-for e in uvw:", "- child...
false
0.037795
0.042015
0.89956
[ "s007586652", "s124503443" ]
u599114793
p03607
python
s285141672
s608888419
241
200
15,072
16,604
Accepted
Accepted
17.01
n = int(eval(input())) ans = 0 d = dict() for i in range(n): a = int(eval(input())) if a not in d: d[a] = 0 d[a] += 1 da = list(d.values()) for i in range(len(da)): if da[i] % 2 == 1: ans += 1 print(ans)
import collections n = int(eval(input())) a = [int(eval(input())) for i in range(n)] a = collections.Counter(a) a = list(a.values()) cnt = 0 for i in range(len(a)): if a[i] % 2 == 1: cnt += 1 print(cnt)
13
11
236
214
n = int(eval(input())) ans = 0 d = dict() for i in range(n): a = int(eval(input())) if a not in d: d[a] = 0 d[a] += 1 da = list(d.values()) for i in range(len(da)): if da[i] % 2 == 1: ans += 1 print(ans)
import collections n = int(eval(input())) a = [int(eval(input())) for i in range(n)] a = collections.Counter(a) a = list(a.values()) cnt = 0 for i in range(len(a)): if a[i] % 2 == 1: cnt += 1 print(cnt)
false
15.384615
[ "+import collections", "+", "-ans = 0", "-d = dict()", "-for i in range(n):", "- a = int(eval(input()))", "- if a not in d:", "- d[a] = 0", "- d[a] += 1", "-da = list(d.values())", "-for i in range(len(da)):", "- if da[i] % 2 == 1:", "- ans += 1", "-print(ans)", ...
false
0.083511
0.104434
0.799657
[ "s285141672", "s608888419" ]
u867378674
p03910
python
s662904636
s952499937
1,522
22
3,572
3,572
Accepted
Accepted
98.55
n = int(input()) def calc(n): mx = 1 while True: if n <= mx * (mx + 1) // 2: break mx += 1 return mx ans = [] while n > 0: x = calc(n) ans.append(x) n -= x print(*ans, sep="\n")
N = int(input()) x = 1 for _ in range(100000): if (x + 2) * (x + 1) // 2 > N: break x += 1 H = [i for i in range(x, 0, -1)] dif = N - sum(H) for i in range(dif): H[(i) % len(H)] += 1 print(*sorted(H), sep="\n")
19
14
253
246
n = int(input()) def calc(n): mx = 1 while True: if n <= mx * (mx + 1) // 2: break mx += 1 return mx ans = [] while n > 0: x = calc(n) ans.append(x) n -= x print(*ans, sep="\n")
N = int(input()) x = 1 for _ in range(100000): if (x + 2) * (x + 1) // 2 > N: break x += 1 H = [i for i in range(x, 0, -1)] dif = N - sum(H) for i in range(dif): H[(i) % len(H)] += 1 print(*sorted(H), sep="\n")
false
26.315789
[ "-n = int(input())", "-", "-", "-def calc(n):", "- mx = 1", "- while True:", "- if n <= mx * (mx + 1) // 2:", "- break", "- mx += 1", "- return mx", "-", "-", "-ans = []", "-while n > 0:", "- x = calc(n)", "- ans.append(x)", "- n -= x", "-...
false
0.090796
0.0491
1.849195
[ "s662904636", "s952499937" ]
u865741247
p03078
python
s956846173
s617136070
1,942
474
167,928
71,256
Accepted
Accepted
75.59
from datetime import datetime as dt X,Y,Z,K = list(map(int,input().split(" "))) As = list(map(int,input().split(" "))) Bs = list(map(int,input().split(" "))) Cs = list(map(int,input().split(" "))) As.sort(reverse = True ) Bs.sort(reverse = True ) ABs = [] for a in As: for b in Bs: ABs.append(a...
from datetime import datetime as dt import heapq X,Y,Z,K = list(map(int,input().split(" "))) As = list(map(int,input().split(" "))) As.sort(reverse=True) Bs = list(map(int,input().split(" "))) Bs.sort(reverse=True) Cs = list(map(int,input().split(" "))) Cs.sort(reverse=True) a = 0 b = 0 c = 0 se = set() ...
25
41
535
1,011
from datetime import datetime as dt X, Y, Z, K = list(map(int, input().split(" "))) As = list(map(int, input().split(" "))) Bs = list(map(int, input().split(" "))) Cs = list(map(int, input().split(" "))) As.sort(reverse=True) Bs.sort(reverse=True) ABs = [] for a in As: for b in Bs: ABs.append(a + b) ABs.so...
from datetime import datetime as dt import heapq X, Y, Z, K = list(map(int, input().split(" "))) As = list(map(int, input().split(" "))) As.sort(reverse=True) Bs = list(map(int, input().split(" "))) Bs.sort(reverse=True) Cs = list(map(int, input().split(" "))) Cs.sort(reverse=True) a = 0 b = 0 c = 0 se = set() nums = ...
false
39.02439
[ "+import heapq", "+As.sort(reverse=True)", "+Bs.sort(reverse=True)", "-As.sort(reverse=True)", "-Bs.sort(reverse=True)", "-ABs = []", "-for a in As:", "- for b in Bs:", "- ABs.append(a + b)", "-ABs.sort(reverse=True)", "-upper = min(len(ABs), K)", "-ABs = ABs[:upper]", "-ans = []",...
false
0.074297
0.053476
1.389334
[ "s956846173", "s617136070" ]
u724687935
p03946
python
s425314925
s141449664
669
56
78,596
14,252
Accepted
Accepted
91.63
class SegmentTree(): """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(self, A, dot, e): """ Parameters ...
def main(): import sys readline = sys.stdin.readline # readlines = sys.stdin.readlines N, T = list(map(int, input().split())) A = list(map(int, readline().split())) L = float('inf') cnt = 0 profit = 0 for a in A: if a - L > profit: cnt = 1 ...
96
25
2,244
498
class SegmentTree: """ update, get を提供するSegmentTree Attributes ---------- __n : int 葉の数。2 ^ i - 1 __dot : Segment function __e: int 単位元 __node: list Segment Tree """ def __init__(self, A, dot, e): """ Parameters ---------- ...
def main(): import sys readline = sys.stdin.readline # readlines = sys.stdin.readlines N, T = list(map(int, input().split())) A = list(map(int, readline().split())) L = float("inf") cnt = 0 profit = 0 for a in A: if a - L > profit: cnt = 1 profit = a ...
false
73.958333
[ "-class SegmentTree:", "- \"\"\"", "- update, get を提供するSegmentTree", "- Attributes", "- __n : int", "- 葉の数。2 ^ i - 1", "- __dot :", "- Segment function", "- __e: int", "- 単位元", "- __node: list", "- Segment Tree", "- \"\"\"", "-", "- ...
false
0.082
0.041071
1.996529
[ "s425314925", "s141449664" ]
u753803401
p03472
python
s039336350
s166287957
327
298
49,884
47,068
Accepted
Accepted
8.87
import sys def solve(): input = sys.stdin.readline mod = 10 ** 9 + 7 n, h = list(map(int, input().rstrip('\n').split())) al = 0 bl = [] for i in range(n): a, b = list(map(int, input().rstrip('\n').split())) al = max(al, a) bl.append(b) bl.sort() cn...
import sys def solve(): input = sys.stdin.readline mod = 10 ** 9 + 7 n, h = list(map(int, input().rstrip('\n').split())) md = 0 dl = [] for i in range(n): a, b = list(map(int, input().rstrip('\n').split())) md = max(md, a) dl.append(b) dl.sort(reverse=T...
38
31
900
640
import sys def solve(): input = sys.stdin.readline mod = 10**9 + 7 n, h = list(map(int, input().rstrip("\n").split())) al = 0 bl = [] for i in range(n): a, b = list(map(int, input().rstrip("\n").split())) al = max(al, a) bl.append(b) bl.sort() cnt = 0 while ...
import sys def solve(): input = sys.stdin.readline mod = 10**9 + 7 n, h = list(map(int, input().rstrip("\n").split())) md = 0 dl = [] for i in range(n): a, b = list(map(int, input().rstrip("\n").split())) md = max(md, a) dl.append(b) dl.sort(reverse=True) cnt = ...
false
18.421053
[ "- al = 0", "- bl = []", "+ md = 0", "+ dl = []", "- al = max(al, a)", "- bl.append(b)", "- bl.sort()", "+ md = max(md, a)", "+ dl.append(b)", "+ dl.sort(reverse=True)", "- while True:", "- if len(bl) != 0:", "- b = bl.pop()"...
false
0.073605
0.116248
0.633172
[ "s039336350", "s166287957" ]
u094191970
p02838
python
s214928179
s175021474
309
277
124,560
68,856
Accepted
Accepted
10.36
n=int(eval(input())) a=list(map(int,input().split())) mod=10**9+7 ans=0 for i in range(60): on=0 off=0 for j in a: if (j>>i)&1: on+=1 else: off+=1 ans+=(on*off)*(2**i) ans%=mod print(ans)
import numpy as np n=int(eval(input())) a=np.array(list(map(int,input().split()))) mod=10**9+7 s=0 for i in range(60): bit = np.count_nonzero(a & 1) s += bit*(n-bit)*(2**i) a >>= 1 print((s % mod))
18
12
231
214
n = int(eval(input())) a = list(map(int, input().split())) mod = 10**9 + 7 ans = 0 for i in range(60): on = 0 off = 0 for j in a: if (j >> i) & 1: on += 1 else: off += 1 ans += (on * off) * (2**i) ans %= mod print(ans)
import numpy as np n = int(eval(input())) a = np.array(list(map(int, input().split()))) mod = 10**9 + 7 s = 0 for i in range(60): bit = np.count_nonzero(a & 1) s += bit * (n - bit) * (2**i) a >>= 1 print((s % mod))
false
33.333333
[ "+import numpy as np", "+", "-a = list(map(int, input().split()))", "+a = np.array(list(map(int, input().split())))", "-ans = 0", "+s = 0", "- on = 0", "- off = 0", "- for j in a:", "- if (j >> i) & 1:", "- on += 1", "- else:", "- off += 1", "- ...
false
0.045446
0.314158
0.144661
[ "s214928179", "s175021474" ]
u729133443
p02732
python
s238658508
s218863330
283
194
27,148
29,592
Accepted
Accepted
31.45
c=[0]*8**6 _,a=open(0) *a,=list(map(int,a.split())) for i in a:c[i]+=1 s=sum(i*~-i//2for i in c) for i in a:print((s-c[i]+1))
c=[0]*8**6 _,a=open(0) *a,=list(map(int,a.split())) for i in a:c[i]+=1 s=sum(i*~-i//2for i in c) print((' '.join(str(s-c[i]+1)for i in a)))
6
6
122
136
c = [0] * 8**6 _, a = open(0) (*a,) = list(map(int, a.split())) for i in a: c[i] += 1 s = sum(i * ~-i // 2 for i in c) for i in a: print((s - c[i] + 1))
c = [0] * 8**6 _, a = open(0) (*a,) = list(map(int, a.split())) for i in a: c[i] += 1 s = sum(i * ~-i // 2 for i in c) print((" ".join(str(s - c[i] + 1) for i in a)))
false
0
[ "-for i in a:", "- print((s - c[i] + 1))", "+print((\" \".join(str(s - c[i] + 1) for i in a)))" ]
false
0.187975
0.094515
1.988842
[ "s238658508", "s218863330" ]
u626000772
p02947
python
s523842752
s124753542
684
348
67,416
19,404
Accepted
Accepted
49.12
#import sys # import math def modc(a, b, m): c = 1 for i in range(b): c = c * (a - i) % m c = c * modinv(i + 1, m) % m return c def egcd(a, b): (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, las...
N = int(eval(input())) S = [''.join(sorted(eval(input()))) for _ in range(N)] D = {} count = 0 for s in S : if s in D : count += D[s] D[s] += 1 else : D[s] = 1 print(count)
46
11
892
203
# import sys # import math def modc(a, b, m): c = 1 for i in range(b): c = c * (a - i) % m c = c * modinv(i + 1, m) % m return c def egcd(a, b): (x, lastx) = (0, 1) (y, lasty) = (1, 0) while b != 0: q = a // b (a, b) = (b, a % b) (x, lastx) = (lastx - q ...
N = int(eval(input())) S = ["".join(sorted(eval(input()))) for _ in range(N)] D = {} count = 0 for s in S: if s in D: count += D[s] D[s] += 1 else: D[s] = 1 print(count)
false
76.086957
[ "-# import sys", "-# import math", "-def modc(a, b, m):", "- c = 1", "- for i in range(b):", "- c = c * (a - i) % m", "- c = c * modinv(i + 1, m) % m", "- return c", "-", "-", "-def egcd(a, b):", "- (x, lastx) = (0, 1)", "- (y, lasty) = (1, 0)", "- while b !...
false
0.080428
0.08676
0.927016
[ "s523842752", "s124753542" ]
u580697892
p03061
python
s819479048
s541495501
361
204
89,580
16,144
Accepted
Accepted
43.49
# coding: utf-8 from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) l1, l2 = [0] * N, [0] * N # 左からGCD for i in range(1, N): l1[i] = gcd(l1[i-1], A[i-1]) # 右からGCD for i in range(N-1)[::-1]: l2[i] = gcd(l2[i+1], A[i+1]) ll = [] ans = 0 for i in range(N): ans = m...
# coding: utf-8 from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) l1 = [0] * N l2 = [0] * N for i in range(1, N): l1[i] = gcd(l1[i-1], A[i-1]) for i in range(N-1)[::-1]: l2[i] = gcd(l2[i+1], A[i+1]) ans = 0 for i in range(N): ans = max(ans, gcd(l1[i], l2[i])) ...
18
14
357
324
# coding: utf-8 from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) l1, l2 = [0] * N, [0] * N # 左からGCD for i in range(1, N): l1[i] = gcd(l1[i - 1], A[i - 1]) # 右からGCD for i in range(N - 1)[::-1]: l2[i] = gcd(l2[i + 1], A[i + 1]) ll = [] ans = 0 for i in range(N): ans = max(...
# coding: utf-8 from fractions import gcd N = int(eval(input())) A = list(map(int, input().split())) l1 = [0] * N l2 = [0] * N for i in range(1, N): l1[i] = gcd(l1[i - 1], A[i - 1]) for i in range(N - 1)[::-1]: l2[i] = gcd(l2[i + 1], A[i + 1]) ans = 0 for i in range(N): ans = max(ans, gcd(l1[i], l2[i])) pr...
false
22.222222
[ "-l1, l2 = [0] * N, [0] * N", "-# 左からGCD", "+l1 = [0] * N", "+l2 = [0] * N", "-# 右からGCD", "-ll = []" ]
false
0.076552
0.074176
1.032039
[ "s819479048", "s541495501" ]
u833436666
p02726
python
s145483400
s316111881
1,878
1,195
83,192
3,444
Accepted
Accepted
36.37
n,x,y=list(map(int,input().split())) ans=[[1000000]*n for i in range(n)] for i in range(n-1): for j in range(i+1,n): ans[i][j]=min(j-i,abs(x-1-i)+1+abs(y-1-j)) _ans=[0]*(n-1) for i in range(n-1): for j in range(i+1,n): _ans[ans[i][j]-1]+=1 for i in range(n-1): print((_ans[i]))
N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 out = [0] * N for i in range(N-1): for j in range(i+1, N): out[min(j-i, abs(i-X)+1+abs(j-Y))] += 1 for i in range(1, N): print((out[i]))
11
9
307
200
n, x, y = list(map(int, input().split())) ans = [[1000000] * n for i in range(n)] for i in range(n - 1): for j in range(i + 1, n): ans[i][j] = min(j - i, abs(x - 1 - i) + 1 + abs(y - 1 - j)) _ans = [0] * (n - 1) for i in range(n - 1): for j in range(i + 1, n): _ans[ans[i][j] - 1] += 1 for i in r...
N, X, Y = list(map(int, input().split())) X -= 1 Y -= 1 out = [0] * N for i in range(N - 1): for j in range(i + 1, N): out[min(j - i, abs(i - X) + 1 + abs(j - Y))] += 1 for i in range(1, N): print((out[i]))
false
18.181818
[ "-n, x, y = list(map(int, input().split()))", "-ans = [[1000000] * n for i in range(n)]", "-for i in range(n - 1):", "- for j in range(i + 1, n):", "- ans[i][j] = min(j - i, abs(x - 1 - i) + 1 + abs(y - 1 - j))", "-_ans = [0] * (n - 1)", "-for i in range(n - 1):", "- for j in range(i + 1,...
false
0.037369
0.037922
0.985417
[ "s145483400", "s316111881" ]
u312025627
p02599
python
s105069169
s502135469
1,314
1,203
242,516
237,712
Accepted
Accepted
8.45
SHIFT = 1 << 20 def main(): N, Q = (int(i) for i in input().split()) C = [int(i) for i in input().split()] Query = [] for j in range(Q): le, ri = (int(i) for i in input().split()) Query.append(ri << 40 | le << 20 | j) Query.sort() # Query復元 for i in range(Q): ...
SHIFT = 1 << 20 class fenwick_tree: """ 区間の一点更新と,区間和の取得がO(log n)で可能なデータ構造 1-indexedで実装 """ def __init__(self, N): self.size = N self.tree = [0] * (N+1) def sum_until(self, i): s = 0 while i > 0: s += self.tree[i] i -= i...
54
71
1,247
1,608
SHIFT = 1 << 20 def main(): N, Q = (int(i) for i in input().split()) C = [int(i) for i in input().split()] Query = [] for j in range(Q): le, ri = (int(i) for i in input().split()) Query.append(ri << 40 | le << 20 | j) Query.sort() # Query復元 for i in range(Q): j = Qu...
SHIFT = 1 << 20 class fenwick_tree: """ 区間の一点更新と,区間和の取得がO(log n)で可能なデータ構造 1-indexedで実装 """ def __init__(self, N): self.size = N self.tree = [0] * (N + 1) def sum_until(self, i): s = 0 while i > 0: s += self.tree[i] i -= i & (-i) ...
false
23.943662
[ "+", "+", "+class fenwick_tree:", "+ \"\"\"", "+ 区間の一点更新と,区間和の取得がO(log n)で可能なデータ構造", "+ 1-indexedで実装", "+ \"\"\"", "+", "+ def __init__(self, N):", "+ self.size = N", "+ self.tree = [0] * (N + 1)", "+", "+ def sum_until(self, i):", "+ s = 0", "+ ...
false
0.036395
0.035669
1.020358
[ "s105069169", "s502135469" ]
u353895424
p03294
python
s377891230
s164499098
410
171
67,036
5,348
Accepted
Accepted
58.29
import fractions n = int(eval(input())) a = list(map(int, input().split())) LCM = a[0] for i in range(1, n): LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) ans = 0 for i in range(n): ans += (LCM - 1)%a[i] print(ans)
import fractions def lcm(a): LCM = a[0] for i in range(1, n): LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) return LCM n = int(eval(input())) a = list(map(int, input().split())) m = lcm(a) - 1 ans = 0 for i in range(n): ans += m%a[i] print(ans)
12
17
232
281
import fractions n = int(eval(input())) a = list(map(int, input().split())) LCM = a[0] for i in range(1, n): LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) ans = 0 for i in range(n): ans += (LCM - 1) % a[i] print(ans)
import fractions def lcm(a): LCM = a[0] for i in range(1, n): LCM = LCM * a[i] // fractions.gcd(LCM, a[i]) return LCM n = int(eval(input())) a = list(map(int, input().split())) m = lcm(a) - 1 ans = 0 for i in range(n): ans += m % a[i] print(ans)
false
29.411765
[ "+", "+", "+def lcm(a):", "+ LCM = a[0]", "+ for i in range(1, n):", "+ LCM = LCM * a[i] // fractions.gcd(LCM, a[i])", "+ return LCM", "+", "-LCM = a[0]", "-for i in range(1, n):", "- LCM = LCM * a[i] // fractions.gcd(LCM, a[i])", "+m = lcm(a) - 1", "- ans += (LCM - 1) ...
false
0.053468
0.087746
0.609347
[ "s377891230", "s164499098" ]
u751485759
p02682
python
s135174155
s152682169
64
56
61,844
61,796
Accepted
Accepted
12.5
a,b,c,k = list(map(int,input().split())) out = min(a,k) - max(0,k-a-b) print(out)
A,B,C,K = list(map(int,input().split())) out = min(A,K) - max(0,K-A-B) print(out)
4
4
80
80
a, b, c, k = list(map(int, input().split())) out = min(a, k) - max(0, k - a - b) print(out)
A, B, C, K = list(map(int, input().split())) out = min(A, K) - max(0, K - A - B) print(out)
false
0
[ "-a, b, c, k = list(map(int, input().split()))", "-out = min(a, k) - max(0, k - a - b)", "+A, B, C, K = list(map(int, input().split()))", "+out = min(A, K) - max(0, K - A - B)" ]
false
0.040022
0.038505
1.039398
[ "s135174155", "s152682169" ]
u242031676
p03427
python
s281863190
s616503587
787
18
3,064
3,064
Accepted
Accepted
97.71
n = list(map(int, list(input()[::-1]))) l = len(n) ans = dec = 0 for i in range(1<<l): cnt = 0 for j in range(l): if j==l-1: cnt += n[j] - dec break if((i>>j)&1): cnt += 9 ...
n = eval(input()) l = len(n) dp = [[0]*2 for i in range(l+1)] dp[l] = [0,0] for i in range(l): dp[l-i-1][0] = max(dp[l-i][0]+int(n[l-i-1]), dp[l-i][1]+int(n[l-i-1])-1) dp[l-i-1][1] = max(dp[l-i][0]+9, dp[l-i][1]+9) dp[0][1] = max(dp[1][0]+int(n[0]), dp[1][1]+int(n[0])-1) print((max(dp[0])))
18
10
483
301
n = list(map(int, list(input()[::-1]))) l = len(n) ans = dec = 0 for i in range(1 << l): cnt = 0 for j in range(l): if j == l - 1: cnt += n[j] - dec break if (i >> j) & 1: cnt += 9 dec = True else: cnt += n[j] - dec ...
n = eval(input()) l = len(n) dp = [[0] * 2 for i in range(l + 1)] dp[l] = [0, 0] for i in range(l): dp[l - i - 1][0] = max( dp[l - i][0] + int(n[l - i - 1]), dp[l - i][1] + int(n[l - i - 1]) - 1 ) dp[l - i - 1][1] = max(dp[l - i][0] + 9, dp[l - i][1] + 9) dp[0][1] = max(dp[1][0] + int(n[0]), dp[1][1...
false
44.444444
[ "-n = list(map(int, list(input()[::-1])))", "+n = eval(input())", "-ans = dec = 0", "-for i in range(1 << l):", "- cnt = 0", "- for j in range(l):", "- if j == l - 1:", "- cnt += n[j] - dec", "- break", "- if (i >> j) & 1:", "- cnt += 9", "-...
false
0.391847
0.032856
11.926113
[ "s281863190", "s616503587" ]
u340781749
p02796
python
s147292723
s824490819
313
250
18,288
18,260
Accepted
Accepted
20.13
import sys from bisect import bisect from operator import itemgetter n = int(eval(input())) robots = [] for line in sys.stdin: X, L = list(map(int, line.split())) l, r = X - L, X + L robots.append((l, r)) robots.sort(key=itemgetter(1)) dp = [-(10 ** 18)] for l, r in robots: i = bisect(dp...
import sys from operator import itemgetter n = int(eval(input())) robots = [] for line in sys.stdin: X, L = list(map(int, line.split())) l, r = X - L, X + L robots.append((l, r)) robots.sort(key=itemgetter(1)) curr = -(10 ** 10) ans = 0 for l, r in robots: if curr > l: continue ...
20
19
419
348
import sys from bisect import bisect from operator import itemgetter n = int(eval(input())) robots = [] for line in sys.stdin: X, L = list(map(int, line.split())) l, r = X - L, X + L robots.append((l, r)) robots.sort(key=itemgetter(1)) dp = [-(10**18)] for l, r in robots: i = bisect(dp, l) if len(d...
import sys from operator import itemgetter n = int(eval(input())) robots = [] for line in sys.stdin: X, L = list(map(int, line.split())) l, r = X - L, X + L robots.append((l, r)) robots.sort(key=itemgetter(1)) curr = -(10**10) ans = 0 for l, r in robots: if curr > l: continue ans += 1 c...
false
5
[ "-from bisect import bisect", "-dp = [-(10**18)]", "+curr = -(10**10)", "+ans = 0", "- i = bisect(dp, l)", "- if len(dp) == i:", "- dp.append(r)", "- else:", "- dp[i] = min(dp[i], r)", "-print((len(dp) - 1))", "+ if curr > l:", "+ continue", "+ ans += 1", ...
false
0.045887
0.038876
1.180346
[ "s147292723", "s824490819" ]
u312025627
p04005
python
s192051956
s436313628
160
71
38,384
61,928
Accepted
Accepted
55.62
def main(): A = [int(i) for i in input().split()] if any(a % 2 == 0 for a in A): return print(0) A.sort() print(A[0]*A[1]) if __name__ == '__main__': main()
def main(): a, b, c = (int(i) for i in input().split()) ans = [] v = (0--a//2 - a//2) * b * c ans.append(v) v = (0--b//2 - b//2) * c * a ans.append(v) v = (0--c//2 - c//2) * a * b ans.append(v) print((min(ans))) if __name__ == '__main__': main()
10
14
196
299
def main(): A = [int(i) for i in input().split()] if any(a % 2 == 0 for a in A): return print(0) A.sort() print(A[0] * A[1]) if __name__ == "__main__": main()
def main(): a, b, c = (int(i) for i in input().split()) ans = [] v = (0 - -a // 2 - a // 2) * b * c ans.append(v) v = (0 - -b // 2 - b // 2) * c * a ans.append(v) v = (0 - -c // 2 - c // 2) * a * b ans.append(v) print((min(ans))) if __name__ == "__main__": main()
false
28.571429
[ "- A = [int(i) for i in input().split()]", "- if any(a % 2 == 0 for a in A):", "- return print(0)", "- A.sort()", "- print(A[0] * A[1])", "+ a, b, c = (int(i) for i in input().split())", "+ ans = []", "+ v = (0 - -a // 2 - a // 2) * b * c", "+ ans.append(v)", "+ v...
false
0.036442
0.036628
0.994918
[ "s192051956", "s436313628" ]
u836939578
p02781
python
s925810942
s326305245
211
191
41,072
40,944
Accepted
Accepted
9.48
N = int(eval(input())) K = int(eval(input())) X = str(N) dp = [[[0] * (K+1) for _ in range(2)] for _ in range(len(X)+1)] dp[0][0][0] = 1 for i in range(len(X)): D = int(X[i]) for j in range(2): for k in range(K + 1): for d in range((9 if j == 1 else D) + 1): i...
N = int(eval(input())) K = int(eval(input())) X = str(N) dp = [[[0] * (K+1) for _ in range(2)] for _ in range(len(X)+1)] dp[0][0][0] = 1 for i in range(len(X)): digit = int(X[i]) for j in range(2): for k in range(K+1): for d in range(10 if j == 1 else digit+1): ...
16
16
444
443
N = int(eval(input())) K = int(eval(input())) X = str(N) dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(len(X) + 1)] dp[0][0][0] = 1 for i in range(len(X)): D = int(X[i]) for j in range(2): for k in range(K + 1): for d in range((9 if j == 1 else D) + 1): if k + int(d ...
N = int(eval(input())) K = int(eval(input())) X = str(N) dp = [[[0] * (K + 1) for _ in range(2)] for _ in range(len(X) + 1)] dp[0][0][0] = 1 for i in range(len(X)): digit = int(X[i]) for j in range(2): for k in range(K + 1): for d in range(10 if j == 1 else digit + 1): if k +...
false
0
[ "- D = int(X[i])", "+ digit = int(X[i])", "- for d in range((9 if j == 1 else D) + 1):", "+ for d in range(10 if j == 1 else digit + 1):", "- dp[i + 1][j | (d < D)][k + int(d != 0)] += dp[i][j][k]", "+ dp[i + 1][j | (d < digit)][k + (d != 0...
false
0.048281
0.048504
0.995407
[ "s925810942", "s326305245" ]
u392319141
p03137
python
s071923512
s103739354
123
95
13,960
20,440
Accepted
Accepted
22.76
N , M = list(map(int,input().split())) X = list(map(int,input().split())) X.sort() # 隣接点の間の距離が長い順で分割する # おけるコマの個数-1だけ辺を取り除ける maxDist = X[-1] - X[0] dist = [0] * (M-1) # 間の距離を計算 for i in range(M-1) : dist[i] = X[i+1] - X[i] dist.sort(reverse=True) for i in range(min(N-1,M-1)) : maxDis...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() D = [r - l for l, r in zip(X, X[1:])] D.sort() ans = sum(D) while D and N > 1: N -= 1 ans -= D.pop() print(ans)
23
12
344
211
N, M = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() # 隣接点の間の距離が長い順で分割する # おけるコマの個数-1だけ辺を取り除ける maxDist = X[-1] - X[0] dist = [0] * (M - 1) # 間の距離を計算 for i in range(M - 1): dist[i] = X[i + 1] - X[i] dist.sort(reverse=True) for i in range(min(N - 1, M - 1)): maxDist -= dist[i] print...
N, M = list(map(int, input().split())) X = list(map(int, input().split())) X.sort() D = [r - l for l, r in zip(X, X[1:])] D.sort() ans = sum(D) while D and N > 1: N -= 1 ans -= D.pop() print(ans)
false
47.826087
[ "-# 隣接点の間の距離が長い順で分割する", "-# おけるコマの個数-1だけ辺を取り除ける", "-maxDist = X[-1] - X[0]", "-dist = [0] * (M - 1)", "-# 間の距離を計算", "-for i in range(M - 1):", "- dist[i] = X[i + 1] - X[i]", "-dist.sort(reverse=True)", "-for i in range(min(N - 1, M - 1)):", "- maxDist -= dist[i]", "-print(maxDist)", "+D ...
false
0.040518
0.040456
1.001521
[ "s071923512", "s103739354" ]
u977389981
p03378
python
s972743274
s146024115
19
17
2,940
2,940
Accepted
Accepted
10.53
n, m, x = list(map(int, input().split())) A = [int(i) for i in input().split() if int(i) < x] print((min(len(A), m - len(A))))
n, m, x = list(map(int, input().split())) A = [int(i) for i in input().split() if int(i) < x] print((len(A) if m - len(A) > len(A) else m - len(A)))
3
3
120
143
n, m, x = list(map(int, input().split())) A = [int(i) for i in input().split() if int(i) < x] print((min(len(A), m - len(A))))
n, m, x = list(map(int, input().split())) A = [int(i) for i in input().split() if int(i) < x] print((len(A) if m - len(A) > len(A) else m - len(A)))
false
0
[ "-print((min(len(A), m - len(A))))", "+print((len(A) if m - len(A) > len(A) else m - len(A)))" ]
false
0.090188
0.083738
1.077031
[ "s972743274", "s146024115" ]
u924406834
p03425
python
s922366779
s226772547
518
467
43,496
43,496
Accepted
Accepted
9.85
n = int(eval(input())) ls = {'M':0,'A':0,'R':0,'C':0,'H':0} head = set(["M","A","R","C","H"]) for i in range(n): s = eval(input()) if s[0] in head: ls[s[0]] += 1 head = list(head) ans = 0 for i in range(5): for j in range(i+1,5): for k in range(j+1,5): ans += ls[h...
n = int(eval(input())) check = {v:0 for v in "MARCH"} for i in range(n): s = eval(input()) if s[0] in check: check[s[0]] += 1 ans = 0 kijyun = "MARCH" for a in range(5): for b in range(a+1,5): for c in range(b+1,5): ans += check[kijyun[a]] * check[kijyun[b]] * ch...
16
17
351
336
n = int(eval(input())) ls = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0} head = set(["M", "A", "R", "C", "H"]) for i in range(n): s = eval(input()) if s[0] in head: ls[s[0]] += 1 head = list(head) ans = 0 for i in range(5): for j in range(i + 1, 5): for k in range(j + 1, 5): ans += l...
n = int(eval(input())) check = {v: 0 for v in "MARCH"} for i in range(n): s = eval(input()) if s[0] in check: check[s[0]] += 1 ans = 0 kijyun = "MARCH" for a in range(5): for b in range(a + 1, 5): for c in range(b + 1, 5): ans += check[kijyun[a]] * check[kijyun[b]] * check[kijyun...
false
5.882353
[ "-ls = {\"M\": 0, \"A\": 0, \"R\": 0, \"C\": 0, \"H\": 0}", "-head = set([\"M\", \"A\", \"R\", \"C\", \"H\"])", "+check = {v: 0 for v in \"MARCH\"}", "- if s[0] in head:", "- ls[s[0]] += 1", "-head = list(head)", "+ if s[0] in check:", "+ check[s[0]] += 1", "-for i in range(5):",...
false
0.048225
0.046738
1.03181
[ "s922366779", "s226772547" ]
u661290476
p00740
python
s007668628
s237401370
4,620
3,720
7,664
7,624
Accepted
Accepted
19.48
while True: n, p = list(map(int, input().split())) pp = p if n == p == 0: break stones = [0] * n i = 0 while True: er = i % n if p == 1 and stones[er] == pp - 1: print(er) break if p >= 1: stones[er] += 1 ...
while True: n, p = list(map(int, input().split())) pp = p if n == p == 0: break stones = [0] * n for i in range(1000000): er = i % n if p >= 1: stones[er] += 1 p -= 1 if p == 0 and stones[er] == pp: print(er) ...
19
17
411
404
while True: n, p = list(map(int, input().split())) pp = p if n == p == 0: break stones = [0] * n i = 0 while True: er = i % n if p == 1 and stones[er] == pp - 1: print(er) break if p >= 1: stones[er] += 1 p -= 1 ...
while True: n, p = list(map(int, input().split())) pp = p if n == p == 0: break stones = [0] * n for i in range(1000000): er = i % n if p >= 1: stones[er] += 1 p -= 1 if p == 0 and stones[er] == pp: print(er) ...
false
10.526316
[ "- i = 0", "- while True:", "+ for i in range(1000000):", "- if p == 1 and stones[er] == pp - 1:", "- print(er)", "- break", "+ if p == 0 and stones[er] == pp:", "+ print(er)", "+ break", "- p += stones[er]",...
false
0.703998
0.706567
0.996365
[ "s007668628", "s237401370" ]
u620084012
p03617
python
s751506927
s541940200
168
17
38,384
2,940
Accepted
Accepted
89.88
Q, H, S, D = list(map(int,input().split())) N = int(eval(input())) print((min(D,2*S,4*H,8*Q)*(N//2)+min(S,2*H,4*Q)*(N%2)))
import sys def input(): return sys.stdin.readline()[:-1] def main(): Q, H, S, D = list(map(int,input().split())) N = int(eval(input())) print(((N//2)*min(Q*8,H*4,S*2,D)+(N%2)*min(Q*4,H*2,S))) if __name__ == '__main__': main()
3
10
111
246
Q, H, S, D = list(map(int, input().split())) N = int(eval(input())) print((min(D, 2 * S, 4 * H, 8 * Q) * (N // 2) + min(S, 2 * H, 4 * Q) * (N % 2)))
import sys def input(): return sys.stdin.readline()[:-1] def main(): Q, H, S, D = list(map(int, input().split())) N = int(eval(input())) print(((N // 2) * min(Q * 8, H * 4, S * 2, D) + (N % 2) * min(Q * 4, H * 2, S))) if __name__ == "__main__": main()
false
70
[ "-Q, H, S, D = list(map(int, input().split()))", "-N = int(eval(input()))", "-print((min(D, 2 * S, 4 * H, 8 * Q) * (N // 2) + min(S, 2 * H, 4 * Q) * (N % 2)))", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline()[:-1]", "+", "+", "+def main():", "+ Q, H, S, D = list(...
false
0.038172
0.041184
0.92686
[ "s751506927", "s541940200" ]
u130900604
p02793
python
s593762206
s410093884
2,000
966
264,672
6,200
Accepted
Accepted
51.7
#逆元しない場合 from fractions import gcd n=int(eval(input())) a=list(map(int,input().split())) mod=10**9+7 L=a[0] def lcm(x,y): return x//gcd(x,y)*y for i in a: L=lcm(L,i) print((sum([L//i for i in a])%mod))
#逆元 from fractions import gcd n=int(eval(input())) a=list(map(int,input().split())) mod=10**9+7 b=0 for i in a: b+=pow(i,mod-2,mod) L=a[0] def lcm(x,y): return x//gcd(x,y)*y for i in a: L=lcm(L,i) print((L*b%mod))
21
23
231
248
# 逆元しない場合 from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) mod = 10**9 + 7 L = a[0] def lcm(x, y): return x // gcd(x, y) * y for i in a: L = lcm(L, i) print((sum([L // i for i in a]) % mod))
# 逆元 from fractions import gcd n = int(eval(input())) a = list(map(int, input().split())) mod = 10**9 + 7 b = 0 for i in a: b += pow(i, mod - 2, mod) L = a[0] def lcm(x, y): return x // gcd(x, y) * y for i in a: L = lcm(L, i) print((L * b % mod))
false
8.695652
[ "-# 逆元しない場合", "+# 逆元", "+b = 0", "+for i in a:", "+ b += pow(i, mod - 2, mod)", "-print((sum([L // i for i in a]) % mod))", "+print((L * b % mod))" ]
false
0.119243
0.128837
0.925533
[ "s593762206", "s410093884" ]
u934442292
p03162
python
s899730439
s212078738
261
237
50,780
51,044
Accepted
Accepted
9.2
import sys input = sys.stdin.readline def main(): N = int(eval(input())) abc = [0] * N for i in range(N): abc[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(N)] dp[0] = abc[0] for i, (a, b, c) in enumerate(abc[1:], start=1): dp[i][0] = max(dp[...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) abc = [0] * N for i in range(N): abc[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(N)] dp[0] = abc[0] for i, (a, b, c) in enumerate(abc[1:], start=1): dp_i = dp[i] ...
24
26
540
562
import sys input = sys.stdin.readline def main(): N = int(eval(input())) abc = [0] * N for i in range(N): abc[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(N)] dp[0] = abc[0] for i, (a, b, c) in enumerate(abc[1:], start=1): dp[i][0] = max(dp[i - 1][1], dp[i...
import sys input = sys.stdin.readline def main(): N = int(eval(input())) abc = [0] * N for i in range(N): abc[i] = list(map(int, input().split())) dp = [[0] * 3 for _ in range(N)] dp[0] = abc[0] for i, (a, b, c) in enumerate(abc[1:], start=1): dp_i = dp[i] dp_im = dp[i...
false
7.692308
[ "- dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a", "- dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b", "- dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c", "+ dp_i = dp[i]", "+ dp_im = dp[i - 1]", "+ dp_i[0] = max(dp_im[1], dp_im[2]) + a", "+ dp_i[1] = ma...
false
0.037851
0.035733
1.059258
[ "s899730439", "s212078738" ]
u023958502
p03013
python
s711262406
s343706721
365
189
460,040
11,884
Accepted
Accepted
48.22
n,m = list(map(int,input().split())) stair = [0,1] + [0 for i in range(n)] ba = 2 for i in range(m): a = int(eval(input())) + 1 for j in range(ba,a): stair[j] = stair[j - 1] + stair[j - 2] ba = a + 1 for i in range(ba,n + 2): stair[i] = stair[i - 1] + stair[i - 2] print((stair[n + 1] % 1000000007))
N, M = list(map(int,input().split())) a = set() for _ in range(M): A = int(eval(input())) a.add(A) dp = [0 for _ in range(N + 2)] dp[0] = 1 for i in range(N): if i in a: continue dp[i + 1] += dp[i] dp[i + 2] += dp[i] if dp[i + 1] > 1000000007: dp[i + 1] %= 1000000007...
11
16
301
368
n, m = list(map(int, input().split())) stair = [0, 1] + [0 for i in range(n)] ba = 2 for i in range(m): a = int(eval(input())) + 1 for j in range(ba, a): stair[j] = stair[j - 1] + stair[j - 2] ba = a + 1 for i in range(ba, n + 2): stair[i] = stair[i - 1] + stair[i - 2] print((stair[n + 1] % 1000...
N, M = list(map(int, input().split())) a = set() for _ in range(M): A = int(eval(input())) a.add(A) dp = [0 for _ in range(N + 2)] dp[0] = 1 for i in range(N): if i in a: continue dp[i + 1] += dp[i] dp[i + 2] += dp[i] if dp[i + 1] > 1000000007: dp[i + 1] %= 1000000007 dp[...
false
31.25
[ "-n, m = list(map(int, input().split()))", "-stair = [0, 1] + [0 for i in range(n)]", "-ba = 2", "-for i in range(m):", "- a = int(eval(input())) + 1", "- for j in range(ba, a):", "- stair[j] = stair[j - 1] + stair[j - 2]", "- ba = a + 1", "-for i in range(ba, n + 2):", "- stair...
false
0.037173
0.037926
0.980141
[ "s711262406", "s343706721" ]
u729535891
p02725
python
s675932861
s770283152
250
134
26,444
26,060
Accepted
Accepted
46.4
k, n = list(map(int, input().split())) lst = list(map(int, input().split())) min_num = k for i in range(len(lst)): if i == 0: tmp = min(lst[0] + (k - lst[1]), lst[-1] - lst[0]) elif i == n - 1: tmp = min(lst[-1] - lst[0], (k - lst[-1]) + lst[n - 2]) else: tmp = min(lst[i] + ...
k, n = list(map(int, input().split())) A = list(map(int, input().split())) dis = [0] * n for i in range(n): if i == n - 1: l = k + A[0] - A[i] dis[i] = l else: l = A[i + 1] - A[i] dis[i] = l print((k - max(dis)))
14
12
422
256
k, n = list(map(int, input().split())) lst = list(map(int, input().split())) min_num = k for i in range(len(lst)): if i == 0: tmp = min(lst[0] + (k - lst[1]), lst[-1] - lst[0]) elif i == n - 1: tmp = min(lst[-1] - lst[0], (k - lst[-1]) + lst[n - 2]) else: tmp = min(lst[i] + (k - lst[...
k, n = list(map(int, input().split())) A = list(map(int, input().split())) dis = [0] * n for i in range(n): if i == n - 1: l = k + A[0] - A[i] dis[i] = l else: l = A[i + 1] - A[i] dis[i] = l print((k - max(dis)))
false
14.285714
[ "-lst = list(map(int, input().split()))", "-min_num = k", "-for i in range(len(lst)):", "- if i == 0:", "- tmp = min(lst[0] + (k - lst[1]), lst[-1] - lst[0])", "- elif i == n - 1:", "- tmp = min(lst[-1] - lst[0], (k - lst[-1]) + lst[n - 2])", "+A = list(map(int, input().split()))",...
false
0.057397
0.035925
1.597706
[ "s675932861", "s770283152" ]
u564902833
p03108
python
s089035071
s723866421
977
856
57,472
57,464
Accepted
Accepted
12.38
N, M = list(map(int, input().split())) A, B = list(zip(*(list(map(int, input().split())) for _ in range(M)))) class UFT: def __init__(self, n): self.sizes = [1] * n self.par = list(range(n)) def find(self, x): if x == self.par[x]: return x self.par[x] =...
# 入力 N, M = list(map(int, input().split())) A, B = ( list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else ((), ()) ) class UnionFindTree: def __init__(self, n): self.p = [i for i in range(n + 1)] self.r = [1 for _ in range(n + 1)] def find(self, x): ...
41
46
989
1,104
N, M = list(map(int, input().split())) A, B = list(zip(*(list(map(int, input().split())) for _ in range(M)))) class UFT: def __init__(self, n): self.sizes = [1] * n self.par = list(range(n)) def find(self, x): if x == self.par[x]: return x self.par[x] = self.find(s...
# 入力 N, M = list(map(int, input().split())) A, B = ( list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else ((), ()) ) class UnionFindTree: def __init__(self, n): self.p = [i for i in range(n + 1)] self.r = [1 for _ in range(n + 1)] def find(self, x): if self.p[...
false
10.869565
[ "+# 入力", "-A, B = list(zip(*(list(map(int, input().split())) for _ in range(M))))", "+A, B = (", "+ list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else ((), ())", "+)", "-class UFT:", "+class UnionFindTree:", "- self.sizes = [1] * n", "- self.par = list(range(n...
false
0.046285
0.047336
0.977797
[ "s089035071", "s723866421" ]
u072717685
p02585
python
s780917969
s846521380
2,222
245
222,372
69,720
Accepted
Accepted
88.97
import sys read = sys.stdin.read readlines = sys.stdin.readlines from itertools import accumulate from collections import deque, defaultdict def main(): n, ko = list(map(int, input().split())) p = tuple(map(int, input().split())) c = tuple(map(int, input().split())) scores_all = deque() ...
import sys read = sys.stdin.read readlines = sys.stdin.readlines from itertools import accumulate def main(): n, k = list(map(int, input().split())) p = tuple(map(int, input().split())) c = tuple(map(int, input().split())) if k == 1: print((max(c))) sys.exit() seen = [0]...
49
49
1,447
1,379
import sys read = sys.stdin.read readlines = sys.stdin.readlines from itertools import accumulate from collections import deque, defaultdict def main(): n, ko = list(map(int, input().split())) p = tuple(map(int, input().split())) c = tuple(map(int, input().split())) scores_all = deque() for k1 in...
import sys read = sys.stdin.read readlines = sys.stdin.readlines from itertools import accumulate def main(): n, k = list(map(int, input().split())) p = tuple(map(int, input().split())) c = tuple(map(int, input().split())) if k == 1: print((max(c))) sys.exit() seen = [0] * n c...
false
0
[ "-from collections import deque, defaultdict", "- n, ko = list(map(int, input().split()))", "+ n, k = list(map(int, input().split()))", "- scores_all = deque()", "- for k1 in range(n):", "- scores = deque()", "- kita = defaultdict(int)", "- kita[k1] = ko", "- ...
false
0.085211
0.038427
2.217472
[ "s780917969", "s846521380" ]
u285443936
p03164
python
s873743520
s731097839
480
411
120,028
119,916
Accepted
Accepted
14.37
import sys input = sys.stdin.readline N, W = list(map(int, input().split())) table = [] for i in range(N): w,v = list(map(int, input().split())) table.append((w,v)) INF = W+1 dp = [[INF]*(10**3*N+1) for i in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): for k in range(10**3*N+1): w,v = table[i...
import sys input = sys.stdin.readline N, W = list(map(int, input().split())) table = [] for i in range(N): w,v = list(map(int, input().split())) table.append((w,v)) dp = [[W+1]*(10**3*N+1) for i in range(N+1)] dp[0][0] = 0 for i in range(1,N+1): w,v = table[i-1] for j in range(10**3*N+1): dp...
22
22
510
470
import sys input = sys.stdin.readline N, W = list(map(int, input().split())) table = [] for i in range(N): w, v = list(map(int, input().split())) table.append((w, v)) INF = W + 1 dp = [[INF] * (10**3 * N + 1) for i in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): for k in range(10**3 * N + 1): ...
import sys input = sys.stdin.readline N, W = list(map(int, input().split())) table = [] for i in range(N): w, v = list(map(int, input().split())) table.append((w, v)) dp = [[W + 1] * (10**3 * N + 1) for i in range(N + 1)] dp[0][0] = 0 for i in range(1, N + 1): w, v = table[i - 1] for j in range(10**3 *...
false
0
[ "-INF = W + 1", "-dp = [[INF] * (10**3 * N + 1) for i in range(N + 1)]", "+dp = [[W + 1] * (10**3 * N + 1) for i in range(N + 1)]", "- for k in range(10**3 * N + 1):", "- w, v = table[i - 1]", "- dp[i][k] = dp[i - 1][k]", "- if v <= k and dp[i - 1][k - v] <= INF:", "- ...
false
0.074192
0.059916
1.23827
[ "s873743520", "s731097839" ]
u472696272
p02785
python
s798707601
s256859486
181
154
25,768
26,180
Accepted
Accepted
14.92
n, k = list(map(int, input().split())) num = list(map(int, input().split())) count = 0 if k<n: num = sorted(num) num = num[::-1] for i in range(k,n): count = count + num[i] print(count) exit() print(count)
n,k = list(map(int,input().split())) h = list(map(int,input().split())) h = sorted(h) h = h[::-1] if k>=n: print((0)) else: print((sum(h[k:n])))
12
8
225
146
n, k = list(map(int, input().split())) num = list(map(int, input().split())) count = 0 if k < n: num = sorted(num) num = num[::-1] for i in range(k, n): count = count + num[i] print(count) exit() print(count)
n, k = list(map(int, input().split())) h = list(map(int, input().split())) h = sorted(h) h = h[::-1] if k >= n: print((0)) else: print((sum(h[k:n])))
false
33.333333
[ "-num = list(map(int, input().split()))", "-count = 0", "-if k < n:", "- num = sorted(num)", "- num = num[::-1]", "- for i in range(k, n):", "- count = count + num[i]", "- print(count)", "- exit()", "-print(count)", "+h = list(map(int, input().split()))", "+h = sorted(h)"...
false
0.078788
0.041104
1.916803
[ "s798707601", "s256859486" ]
u600402037
p03272
python
s707910127
s562168680
19
17
2,940
2,940
Accepted
Accepted
10.53
n,i=list(map(int,input().split())) print((n-i+1))
print((eval(input().replace(' ', '-')) + 1))
2
1
42
42
n, i = list(map(int, input().split())) print((n - i + 1))
print((eval(input().replace(" ", "-")) + 1))
false
50
[ "-n, i = list(map(int, input().split()))", "-print((n - i + 1))", "+print((eval(input().replace(\" \", \"-\")) + 1))" ]
false
0.048367
0.05056
0.956622
[ "s707910127", "s562168680" ]
u094102716
p02613
python
s848355954
s888800950
142
30
16,224
9,352
Accepted
Accepted
78.87
a = int(eval(input())) b = [eval(input()) for i in range(a)] c =["AC", "WA", "TLE", "RE"] for i in c: print((i+str(" x ")+str(b.count(i))))
c=open(0).read().count for s in'AC','WA','TLE','RE':print((s, 'x',c(s)))
5
3
131
74
a = int(eval(input())) b = [eval(input()) for i in range(a)] c = ["AC", "WA", "TLE", "RE"] for i in c: print((i + str(" x ") + str(b.count(i))))
c = open(0).read().count for s in "AC", "WA", "TLE", "RE": print((s, "x", c(s)))
false
40
[ "-a = int(eval(input()))", "-b = [eval(input()) for i in range(a)]", "-c = [\"AC\", \"WA\", \"TLE\", \"RE\"]", "-for i in c:", "- print((i + str(\" x \") + str(b.count(i))))", "+c = open(0).read().count", "+for s in \"AC\", \"WA\", \"TLE\", \"RE\":", "+ print((s, \"x\", c(s)))" ]
false
0.038577
0.039031
0.98835
[ "s848355954", "s888800950" ]
u175034939
p02873
python
s157887637
s092585974
256
228
11,476
8,220
Accepted
Accepted
10.94
S = eval(input()) n = len(S)+1 lr = [] num = [] a = S[0] cnt = 0 for s in S: if s == a: cnt += 1 else: num.append(cnt) if a == '<': lr.append(1) else: lr.append(0) a = s cnt = 1 num.append(cnt) if a == '<': lr.appen...
S = eval(input()) num = [] pre = S[0] cnt = 0 for s in S: if s == pre: cnt += 1 else: num.append(cnt) pre = s cnt = 1 num.append(cnt) if S[0] == '>': num = [1] + num if S[-1] == '<': num += [1] ans = 0 for i in range(0, len(num), 2): b = max(num[...
49
24
941
410
S = eval(input()) n = len(S) + 1 lr = [] num = [] a = S[0] cnt = 0 for s in S: if s == a: cnt += 1 else: num.append(cnt) if a == "<": lr.append(1) else: lr.append(0) a = s cnt = 1 num.append(cnt) if a == "<": lr.append(1) else: lr.a...
S = eval(input()) num = [] pre = S[0] cnt = 0 for s in S: if s == pre: cnt += 1 else: num.append(cnt) pre = s cnt = 1 num.append(cnt) if S[0] == ">": num = [1] + num if S[-1] == "<": num += [1] ans = 0 for i in range(0, len(num), 2): b = max(num[i], num[i + 1]) c ...
false
51.020408
[ "-n = len(S) + 1", "-lr = []", "-a = S[0]", "+pre = S[0]", "- if s == a:", "+ if s == pre:", "- if a == \"<\":", "- lr.append(1)", "- else:", "- lr.append(0)", "- a = s", "+ pre = s", "-if a == \"<\":", "- lr.append(1)", "-else:"...
false
0.044336
0.046736
0.948656
[ "s157887637", "s092585974" ]
u923668099
p02343
python
s848495771
s623871998
1,980
500
11,144
14,132
Accepted
Accepted
74.75
import sys def solve(): n, q = map(int, sys.stdin.readline().split()) ds = [[i] for i in range(n)] n2s = [i for i in range(n)] ans = [] for lp in range(q): c, x, y = map(int, sys.stdin.readline().split()) if c == 0: merge(ds, n2s, x, y) else: ...
import sys sys.setrecursionlimit(10**5) def solve(): n, q = map(int, sys.stdin.readline().split()) uf = UnionFind(n) ans = [] for lp in range(q): c, x, y = map(int, sys.stdin.readline().split()) if c == 0: uf.unite(x, y) else: ans.append...
38
49
806
1,124
import sys def solve(): n, q = map(int, sys.stdin.readline().split()) ds = [[i] for i in range(n)] n2s = [i for i in range(n)] ans = [] for lp in range(q): c, x, y = map(int, sys.stdin.readline().split()) if c == 0: merge(ds, n2s, x, y) else: ans.app...
import sys sys.setrecursionlimit(10**5) def solve(): n, q = map(int, sys.stdin.readline().split()) uf = UnionFind(n) ans = [] for lp in range(q): c, x, y = map(int, sys.stdin.readline().split()) if c == 0: uf.unite(x, y) else: ans.append(1 if uf.is_same...
false
22.44898
[ "+", "+sys.setrecursionlimit(10**5)", "- ds = [[i] for i in range(n)]", "- n2s = [i for i in range(n)]", "+ uf = UnionFind(n)", "- merge(ds, n2s, x, y)", "+ uf.unite(x, y)", "- ans.append(1 if n2s[x] == n2s[y] else 0)", "+ ans.append(1 if uf.is_sa...
false
0.036179
0.035939
1.006666
[ "s848495771", "s623871998" ]
u837286475
p03026
python
s098767771
s040148627
86
79
9,460
9,976
Accepted
Accepted
8.14
# https://atcoder.jp/contests/m-solutions2019/submissions/5738704 from collections import deque, _heapq n = int(eval(input())) g = [{"num":0,"neighber":[]} for _ in range(n+1) ] for _ in range(n-1): a, b = list(map(int, input().split())) g[a]["neighber"].append(b) g[b]["neighber"].a...
#https://atcoder.jp/contests/m-solutions2019/submissions/5730635 #x = [1,2,3] #while x: # if x : # print(x) # x.pop() n = int(eval(input())) abn = [list(map(int,input().split())) for _ in range(n-1)] cn = list( map(int, input().split()) ) cn.sort(reverse = True) links = [...
50
61
733
1,003
# https://atcoder.jp/contests/m-solutions2019/submissions/5738704 from collections import deque, _heapq n = int(eval(input())) g = [{"num": 0, "neighber": []} for _ in range(n + 1)] for _ in range(n - 1): a, b = list(map(int, input().split())) g[a]["neighber"].append(b) g[b]["neighber"].append(a) c = sorte...
# https://atcoder.jp/contests/m-solutions2019/submissions/5730635 # x = [1,2,3] # while x: # if x : # print(x) # x.pop() n = int(eval(input())) abn = [list(map(int, input().split())) for _ in range(n - 1)] cn = list(map(int, input().split())) cn.sort(reverse=True) links = [set() for _ in range(n)] for ...
false
18.032787
[ "-# https://atcoder.jp/contests/m-solutions2019/submissions/5738704", "-from collections import deque, _heapq", "-", "+# https://atcoder.jp/contests/m-solutions2019/submissions/5730635", "+# x = [1,2,3]", "+# while x:", "+# if x :", "+# print(x)", "+# x.pop()", "-g = [{\"num\": 0,...
false
0.047853
0.046192
1.03596
[ "s098767771", "s040148627" ]
u633068244
p01202
python
s197124880
s921303246
60
20
7,448
4,380
Accepted
Accepted
66.67
for i in range(eval(input())): step=input() flag=0 for j in range(len(step)-1): if step[j]==step[j+1]: print("No") break else: print("Yes")
for i in range(eval(input())): step=input().replace("LL","1").replace("UU","1").replace("DD","1").replace("RR","1") print("No" if "1" in step else "Yes")
9
3
157
154
for i in range(eval(input())): step = input() flag = 0 for j in range(len(step) - 1): if step[j] == step[j + 1]: print("No") break else: print("Yes")
for i in range(eval(input())): step = ( input() .replace("LL", "1") .replace("UU", "1") .replace("DD", "1") .replace("RR", "1") ) print("No" if "1" in step else "Yes")
false
66.666667
[ "- step = input()", "- flag = 0", "- for j in range(len(step) - 1):", "- if step[j] == step[j + 1]:", "- print(\"No\")", "- break", "- else:", "- print(\"Yes\")", "+ step = (", "+ input()", "+ .replace(\"LL\", \"1\")", "+ ...
false
0.035616
0.035327
1.008206
[ "s197124880", "s921303246" ]
u521020719
p03494
python
s747032384
s241354028
184
166
39,152
38,768
Accepted
Accepted
9.78
eval(input()) numbers = list(map(int, input().split())) counter = 0 while all(number % 2 == 0 for number in numbers): numbers = [number / 2 for number in numbers] counter += 1 print(counter)
N = int(eval(input())) numbers = list(map(int, input().split())) counter = 0 while all(number % 2 == 0 for number in numbers): numbers = [number / 2 for number in numbers] counter += 1 print(counter)
10
11
205
216
eval(input()) numbers = list(map(int, input().split())) counter = 0 while all(number % 2 == 0 for number in numbers): numbers = [number / 2 for number in numbers] counter += 1 print(counter)
N = int(eval(input())) numbers = list(map(int, input().split())) counter = 0 while all(number % 2 == 0 for number in numbers): numbers = [number / 2 for number in numbers] counter += 1 print(counter)
false
9.090909
[ "-eval(input())", "+N = int(eval(input()))" ]
false
0.043408
0.044726
0.970543
[ "s747032384", "s241354028" ]
u312025627
p02951
python
s619139309
s524028162
168
18
38,384
2,940
Accepted
Accepted
89.29
a, b, c = list(map(int,input().split())) if a - b > 0: a = a - b else: a = a - a if c - a > 0: print((c-a)) else: print((0))
def main(): a, b, c = (int(i) for i in input().split()) d = a-b print((max(0, c - d))) if __name__ == '__main__': main()
10
8
140
144
a, b, c = list(map(int, input().split())) if a - b > 0: a = a - b else: a = a - a if c - a > 0: print((c - a)) else: print((0))
def main(): a, b, c = (int(i) for i in input().split()) d = a - b print((max(0, c - d))) if __name__ == "__main__": main()
false
20
[ "-a, b, c = list(map(int, input().split()))", "-if a - b > 0:", "- a = a - b", "-else:", "- a = a - a", "-if c - a > 0:", "- print((c - a))", "-else:", "- print((0))", "+def main():", "+ a, b, c = (int(i) for i in input().split())", "+ d = a - b", "+ print((max(0, c - d)...
false
0.079942
0.039219
2.038318
[ "s619139309", "s524028162" ]
u325227960
p03305
python
s963157825
s768194770
1,895
692
148,940
97,500
Accepted
Accepted
63.48
import sys input = sys.stdin.readline n, m, s, t = list(map(int,input().split())) C = [list(map(int,input().split())) for i in range(m)] s -= 1 t -= 1 # O((V + E)log(V)) # Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト M = [[] for i in range(n)] for i in range(len(C)): M[C[i][0]-1].append([C[i][1]-1, C[i][2]]) ...
# 「C[i][0]から1を引くのを別のループでやらない」「大きい値にはinfでなく10**16を使う」 # この2つはTLEしないために必須。それでも数回に1回、TLEすることがある import sys input = sys.stdin.readline n, m, s, t = list(map(int,input().split())) C = [list(map(int,input().split())) for i in range(m)] s -= 1 t -= 1 # O((V + E)log(V)) # Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト # ...
65
96
1,592
2,650
import sys input = sys.stdin.readline n, m, s, t = list(map(int, input().split())) C = [list(map(int, input().split())) for i in range(m)] s -= 1 t -= 1 # O((V + E)log(V)) # Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト M = [[] for i in range(n)] for i in range(len(C)): M[C[i][0] - 1].append([C[i][1] - 1, C[i][2]]) # 無向グラフな...
# 「C[i][0]から1を引くのを別のループでやらない」「大きい値にはinfでなく10**16を使う」 # この2つはTLEしないために必須。それでも数回に1回、TLEすることがある import sys input = sys.stdin.readline n, m, s, t = list(map(int, input().split())) C = [list(map(int, input().split())) for i in range(m)] s -= 1 t -= 1 # O((V + E)log(V)) # Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト # M = [[] for i i...
false
32.291667
[ "+# 「C[i][0]から1を引くのを別のループでやらない」「大きい値にはinfでなく10**16を使う」", "+# この2つはTLEしないために必須。それでも数回に1回、TLEすることがある", "+# M = [[] for i in range(n)]", "+# for i in range(len(C)):", "+# M[C[i][0]-1].append([C[i][1]-1, C[i][2]]) # 無向グラフなら両方追加", "+# M[C[i][1]-1].append([C[i][0]-1, C[i][2]]) # 無向グラフなら両方追加", "+# N ...
false
0.121296
0.148004
0.819543
[ "s963157825", "s768194770" ]
u325704929
p02902
python
s270112338
s366823744
28
24
4,212
3,316
Accepted
Accepted
14.29
from collections import deque def dfs(N, AB): status = [-1] * N for i in range(N): if status[i] == 1: continue stack = [i] status[i] = 0 while stack: v = stack[-1] if AB[v]: n = AB[v].popleft() ...
def dfs(N, AB): status = [-1] * N for i in range(N): if status[i] == 1: continue stack = [i] status[i] = 0 while stack: v = stack[-1] if AB[v]: n = AB[v].pop() if status[n] == -1: ...
62
61
1,556
1,496
from collections import deque def dfs(N, AB): status = [-1] * N for i in range(N): if status[i] == 1: continue stack = [i] status[i] = 0 while stack: v = stack[-1] if AB[v]: n = AB[v].popleft() if status[n] == ...
def dfs(N, AB): status = [-1] * N for i in range(N): if status[i] == 1: continue stack = [i] status[i] = 0 while stack: v = stack[-1] if AB[v]: n = AB[v].pop() if status[n] == -1: stack.append...
false
1.612903
[ "-from collections import deque", "-", "-", "- n = AB[v].popleft()", "+ n = AB[v].pop()", "- else:", "- if n in stack:", "- idx = stack.index(n)", "- cycle = stack[idx:]", "- ...
false
0.048933
0.034728
1.409028
[ "s270112338", "s366823744" ]
u179169725
p02573
python
s972987501
s397682262
146
77
20,256
19,972
Accepted
Accepted
47.26
mycode = r''' # distutils: language=c++ # cython: language_level=3, boundscheck=False, wraparound=False # cython: cdivision=True # False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。 ctypedef long l...
mycode = r''' # distutils: language=c++ # cython: language_level=3, boundscheck=False, wraparound=False # cython: cdivision=True # False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。 ctypedef long l...
89
80
2,210
2,111
mycode = r""" # distutils: language=c++ # cython: language_level=3, boundscheck=False, wraparound=False # cython: cdivision=True # False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。 ctypedef long long LL ...
mycode = r""" # distutils: language=c++ # cython: language_level=3, boundscheck=False, wraparound=False # cython: cdivision=True # False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。 ctypedef long long LL ...
false
10.11236
[ "+from libc.stdio cimport scanf, printf", "-import sys", "-readline = sys.stdin.buffer.readline", "-read = sys.stdin.readline #文字列読み込む時はこっち", "-def ints(): return map(int,readline().split())", "- public LL N,n_groups", "- public vec parent", "+ LL N,n_groups", "+ vec pare...
false
0.07145
0.125289
0.570276
[ "s972987501", "s397682262" ]
u422104747
p03286
python
s136567782
s207407697
303
165
117,872
38,512
Accepted
Accepted
45.54
import bisect def put(a, b): # 結果の表示 l = max(len(a), len(b)) # aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく a = "0" * l + a b = "0" * l + b s = "" for i in range(-1, -l-1, -1): # 長さの偶奇を考えたくないので逆順に生成してあとで反転 s += a[i] + b[i] s = s[-1::-1] # 反転 print((s[s.find("1"):])) # 頭にたくさんつ...
def solve(n): ret = "" i = 0 # n%2が元の何ビット目にあたるか while True: if i % 2 == 1 and n % 2 == 1: # 奇数ビットが1のとき n += 2 ret += str(n % 2) n //= 2 # 1ビット右にずらす i += 1 if n == 0: break return ret[-1::-1] # 逆順に結合されているので反転 n = int(eval...
35
22
829
454
import bisect def put(a, b): # 結果の表示 l = max(len(a), len(b)) # aとbの長さが違うときに壊れるので以下で十分な長さの0を結合しておく a = "0" * l + a b = "0" * l + b s = "" for i in range(-1, -l - 1, -1): # 長さの偶奇を考えたくないので逆順に生成してあとで反転 s += a[i] + b[i] s = s[-1::-1] # 反転 print((s[s.find("1") :])) # 頭にたくさんついている0を除い...
def solve(n): ret = "" i = 0 # n%2が元の何ビット目にあたるか while True: if i % 2 == 1 and n % 2 == 1: # 奇数ビットが1のとき n += 2 ret += str(n % 2) n //= 2 # 1ビット右にずらす i += 1 if n == 0: break return ret[-1::-1] # 逆順に結合されているので反転 n = int(eval(input())) if ...
false
37.142857
[ "-import bisect", "+def solve(n):", "+ ret = \"\"", "+ i = 0 # n%2が元の何ビット目にあたるか", "+ while True:", "+ if i % 2 == 1 and n % 2 == 1: # 奇数ビットが1のとき", "+ n += 2", "+ ret += str(n % 2)", "+ n //= 2 # 1ビット右にずらす", "+ i += 1", "+ if n == 0:", "...
false
0.649332
0.036761
17.663537
[ "s136567782", "s207407697" ]
u227082700
p03127
python
s988152903
s008257096
1,560
70
15,020
14,224
Accepted
Accepted
95.51
def gcd(a,b): if min(a,b)==a: if b%a==0:return a else:b%=a while 1: if a%b==0:break a%=b if b%a==0:break b%=a return min(a,b) n=int(eval(input())) a=list(map(int,input().split())) for oAo in range(len(a)-1): a[0]=gcd(a[0],a[1]) del a[1] print((a[0]))
def gcd(a,b): while b:a,b=b,a%b return a n=int(eval(input())) a=list(map(int,input().split())) ans=a[0] for i in a[1:]:ans=gcd(ans,i) print(ans)
16
8
291
149
def gcd(a, b): if min(a, b) == a: if b % a == 0: return a else: b %= a while 1: if a % b == 0: break a %= b if b % a == 0: break b %= a return min(a, b) n = int(eval(input())) a = list(map(int, input().split())...
def gcd(a, b): while b: a, b = b, a % b return a n = int(eval(input())) a = list(map(int, input().split())) ans = a[0] for i in a[1:]: ans = gcd(ans, i) print(ans)
false
50
[ "- if min(a, b) == a:", "- if b % a == 0:", "- return a", "- else:", "- b %= a", "- while 1:", "- if a % b == 0:", "- break", "- a %= b", "- if b % a == 0:", "- break", "- b %= a", "- return min(a,...
false
0.043084
0.035727
1.205896
[ "s988152903", "s008257096" ]
u626891113
p02924
python
s789394231
s249018485
1,360
30
62,460
9,100
Accepted
Accepted
97.79
n = int(eval(input())) ans = 0 for i in range(n): ans += i print(ans)
n = int(eval(input())) - 1 ans = (1 + n)*n//2 print(ans)
6
4
73
54
n = int(eval(input())) ans = 0 for i in range(n): ans += i print(ans)
n = int(eval(input())) - 1 ans = (1 + n) * n // 2 print(ans)
false
33.333333
[ "-n = int(eval(input()))", "-ans = 0", "-for i in range(n):", "- ans += i", "+n = int(eval(input())) - 1", "+ans = (1 + n) * n // 2" ]
false
0.114642
0.040496
2.830951
[ "s789394231", "s249018485" ]
u073852194
p03215
python
s012857423
s759119140
303
150
66,044
117,400
Accepted
Accepted
50.5
N,K = list(map(int,input().split())) A = list(map(int,input().split())) S = [0] beauties = [] ans = 0 for i in range(N): S.append(S[-1]+A[i]) for i in range(N): for j in range(i+1,N+1): beauties.append(S[j]-S[i]) for i in reversed(list(range(64))): tmp = [] for j in range(len(b...
from itertools import accumulate N, K = list(map(int, input().split())) A = list(map(int, input().split())) C = [0] + list(accumulate(A)) S = [] for i in range(N): for j in range(i + 1, N + 1): S.append(C[j] - C[i]) for i in range(64)[::-1]: tmp = [] for s in S: if (s >> i...
23
27
475
464
N, K = list(map(int, input().split())) A = list(map(int, input().split())) S = [0] beauties = [] ans = 0 for i in range(N): S.append(S[-1] + A[i]) for i in range(N): for j in range(i + 1, N + 1): beauties.append(S[j] - S[i]) for i in reversed(list(range(64))): tmp = [] for j in range(len(beautie...
from itertools import accumulate N, K = list(map(int, input().split())) A = list(map(int, input().split())) C = [0] + list(accumulate(A)) S = [] for i in range(N): for j in range(i + 1, N + 1): S.append(C[j] - C[i]) for i in range(64)[::-1]: tmp = [] for s in S: if (s >> i) & 1: ...
false
14.814815
[ "+from itertools import accumulate", "+", "-S = [0]", "-beauties = []", "-ans = 0", "-for i in range(N):", "- S.append(S[-1] + A[i])", "+C = [0] + list(accumulate(A))", "+S = []", "- beauties.append(S[j] - S[i])", "-for i in reversed(list(range(64))):", "+ S.append(C[j] - C[i]...
false
0.035772
0.037009
0.966574
[ "s012857423", "s759119140" ]
u186838327
p03565
python
s474833024
s722606653
80
62
69,184
61,808
Accepted
Accepted
22.5
s_ = list(str(eval(input()))) t = list(str(eval(input()))) n = len(s_) m = len(t) if m > n: print('UNRESTORABLE') exit() import copy ans = [] for i in range(n-m+1): if s_[i] == t[0] or s_[i] == '?': temp = copy.copy(s_) for j in range(i, i+m): #print(i, temp) ...
s = str(eval(input())) t = str(eval(input())) n = len(s) m = len(t) if m > n: print('UNRESTORABLE') exit() ans = [] for i in range(n-m+1): flag = True for j in range(m): if s[i+j] != t[j]: if s[i+j] != '?': flag = False if flag: p = s[:i...
33
27
709
491
s_ = list(str(eval(input()))) t = list(str(eval(input()))) n = len(s_) m = len(t) if m > n: print("UNRESTORABLE") exit() import copy ans = [] for i in range(n - m + 1): if s_[i] == t[0] or s_[i] == "?": temp = copy.copy(s_) for j in range(i, i + m): # print(i, temp) ...
s = str(eval(input())) t = str(eval(input())) n = len(s) m = len(t) if m > n: print("UNRESTORABLE") exit() ans = [] for i in range(n - m + 1): flag = True for j in range(m): if s[i + j] != t[j]: if s[i + j] != "?": flag = False if flag: p = s[:i] q...
false
18.181818
[ "-s_ = list(str(eval(input())))", "-t = list(str(eval(input())))", "-n = len(s_)", "+s = str(eval(input()))", "+t = str(eval(input()))", "+n = len(s)", "-import copy", "-", "- if s_[i] == t[0] or s_[i] == \"?\":", "- temp = copy.copy(s_)", "- for j in range(i, i + m):", "- ...
false
0.040186
0.046569
0.862939
[ "s474833024", "s722606653" ]
u905203728
p03393
python
s231482158
s816185497
21
18
3,316
3,064
Accepted
Accepted
14.29
from collections import defaultdict S = eval(input()) alphabet = "abcdefghijklmnopqrstuvxyz" if S == "zyxwvutsrqponmlkjihgfedcba": print((-1)) exit() dict = defaultdict(int) for s in S: dict[s] += 1 if len(S) < len(alphabet): for a in alphabet: if dict[a] == 0: prin...
s=eval(input()) alp="".join([chr(i) for i in range(97,97+26)]) if len(s)<26: for i in alp: if i not in s: print((s+i)) exit() else: if s=="".join([chr(i) for i in range(97,97+26)][::-1]): print((-1)) exit() else: for i in range(24,-1,-1): ...
24
17
518
444
from collections import defaultdict S = eval(input()) alphabet = "abcdefghijklmnopqrstuvxyz" if S == "zyxwvutsrqponmlkjihgfedcba": print((-1)) exit() dict = defaultdict(int) for s in S: dict[s] += 1 if len(S) < len(alphabet): for a in alphabet: if dict[a] == 0: print((S + a)) ...
s = eval(input()) alp = "".join([chr(i) for i in range(97, 97 + 26)]) if len(s) < 26: for i in alp: if i not in s: print((s + i)) exit() else: if s == "".join([chr(i) for i in range(97, 97 + 26)][::-1]): print((-1)) exit() else: for i in range(24, -1, ...
false
29.166667
[ "-from collections import defaultdict", "-", "-S = eval(input())", "-alphabet = \"abcdefghijklmnopqrstuvxyz\"", "-if S == \"zyxwvutsrqponmlkjihgfedcba\":", "- print((-1))", "- exit()", "-dict = defaultdict(int)", "-for s in S:", "- dict[s] += 1", "-if len(S) < len(alphabet):", "- f...
false
0.033014
0.035542
0.928866
[ "s231482158", "s816185497" ]
u102461423
p02599
python
s701561192
s081132084
1,016
610
193,016
113,792
Accepted
Accepted
39.96
import sys import numpy as np import numba from numba import njit from numba.types import Omitted i4 = numba.int32 i8 = numba.int64 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8[:], i8), cache=True) def get_sum(bit, i): s = 0 ...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def get_sum(bit, i): s = 0 while i: s += bit[i] i -= i & -i return s def add(bit, i, x): while i < len(bit): bit[i] += x ...
56
65
1,409
1,649
import sys import numpy as np import numba from numba import njit from numba.types import Omitted i4 = numba.int32 i8 = numba.int64 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8[:], i8), cache=True) def get_sum(bit, i): s = 0 while i: ...
import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def get_sum(bit, i): s = 0 while i: s += bit[i] i -= i & -i return s def add(bit, i, x): while i < len(bit): bit[i] += x i += i & -i...
false
13.846154
[ "-import numba", "-from numba import njit", "-from numba.types import Omitted", "-i4 = numba.int32", "-i8 = numba.int64", "-@njit((i8[:], i8), cache=True)", "-@njit((i8[:], i8, i8), cache=True)", "-@njit((i8[:], i8[:]), cache=True)", "+if sys.argv[-1] == \"ONLINE_JUDGE\":", "+ import numba", ...
false
0.2952
0.243034
1.214646
[ "s701561192", "s081132084" ]
u141610915
p02863
python
s465745622
s831211147
508
127
114,780
74,664
Accepted
Accepted
75
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) a = [] for _ in range(N): w, v = list(map(int, input().split())) a.append((w, v)) a.sort() dp = [[0] * (T + 1) for _ in range(N + 1)] for i in range(N): w, v = a[i] for j in range(T): if j + w >= T: dp[i + 1][T] ...
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) t = [tuple(map(int, input().split())) for _ in range(N)] t.sort() dp = [0] * (T + 1) for a, b in t: for i in range(T - 1, -1, -1): if i + a < T: dp[i + a] = max(dp[i + a], dp[i] + b) else: dp[-1] = max(dp[-1], dp[i] + b) p...
19
11
528
327
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) a = [] for _ in range(N): w, v = list(map(int, input().split())) a.append((w, v)) a.sort() dp = [[0] * (T + 1) for _ in range(N + 1)] for i in range(N): w, v = a[i] for j in range(T): if j + w >= T: dp[i + ...
import sys input = sys.stdin.readline N, T = list(map(int, input().split())) t = [tuple(map(int, input().split())) for _ in range(N)] t.sort() dp = [0] * (T + 1) for a, b in t: for i in range(T - 1, -1, -1): if i + a < T: dp[i + a] = max(dp[i + a], dp[i] + b) else: dp[-1] = ...
false
42.105263
[ "-a = []", "-for _ in range(N):", "- w, v = list(map(int, input().split()))", "- a.append((w, v))", "-a.sort()", "-dp = [[0] * (T + 1) for _ in range(N + 1)]", "-for i in range(N):", "- w, v = a[i]", "- for j in range(T):", "- if j + w >= T:", "- dp[i + 1][T] = max(...
false
0.047831
0.088841
0.538392
[ "s465745622", "s831211147" ]
u912237403
p00114
python
s574306676
s607017309
310
230
5,260
4,224
Accepted
Accepted
25.81
def f(a,b): p,q=a,b while q!=0: p,q=q,p%q return a/p*b while 1: x=list(map(int,input().split())) if any(x)==0: break A=[] for i in range(0,6,2): a,b=x[i:i+2] c=1 for j in range(1,b): c=(c*a)%b if c==1: break A.append(j) a,b,c=A print(f(f(a,b),c))
def f(a,b): p,q=a,b while q!=0: p,q=q,p%q return a/p*b def g(a,b): c,i=a%b,1 while c!=1: i,c=i+1,(c*a)%b return i while 1: x=list(map(int,input().split())) if any(x)==0: break a,b,c=[g(x[i],x[i+1]) for i in range(0,6,2)] print(f(f(a,b),c))
18
15
309
274
def f(a, b): p, q = a, b while q != 0: p, q = q, p % q return a / p * b while 1: x = list(map(int, input().split())) if any(x) == 0: break A = [] for i in range(0, 6, 2): a, b = x[i : i + 2] c = 1 for j in range(1, b): c = (c * a) % b ...
def f(a, b): p, q = a, b while q != 0: p, q = q, p % q return a / p * b def g(a, b): c, i = a % b, 1 while c != 1: i, c = i + 1, (c * a) % b return i while 1: x = list(map(int, input().split())) if any(x) == 0: break a, b, c = [g(x[i], x[i + 1]) for i in r...
false
16.666667
[ "+def g(a, b):", "+ c, i = a % b, 1", "+ while c != 1:", "+ i, c = i + 1, (c * a) % b", "+ return i", "+", "+", "- A = []", "- for i in range(0, 6, 2):", "- a, b = x[i : i + 2]", "- c = 1", "- for j in range(1, b):", "- c = (c * a) % b", ...
false
0.050322
0.04803
1.047711
[ "s574306676", "s607017309" ]
u600402037
p03361
python
s839879492
s274264864
182
148
39,280
14,488
Accepted
Accepted
18.68
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W = lr() S = [sr() for _ in range(H)] bl = True for i in range(H): for j in range(W): if S[i][j] == '.': continue for dy, dx in zip([0...
# coding: utf-8 import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W = lr() S = np.array([list(sr()) for _ in range(H)]) black = S == '#' is_ok = np.zeros_like(S, dtype=np.bool) is_ok[1:, :] |= black[:-1, :] is_ok[:...
24
18
582
482
# coding: utf-8 import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W = lr() S = [sr() for _ in range(H)] bl = True for i in range(H): for j in range(W): if S[i][j] == ".": continue for dy, dx in zip([0, 1, 0, -1], [1...
# coding: utf-8 import sys import numpy as np sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) H, W = lr() S = np.array([list(sr()) for _ in range(H)]) black = S == "#" is_ok = np.zeros_like(S, dtype=np.bool) is_ok[1:, :] |= black[:-1, :] is_ok[:-1, :] |= blac...
false
25
[ "+import numpy as np", "-S = [sr() for _ in range(H)]", "-bl = True", "-for i in range(H):", "- for j in range(W):", "- if S[i][j] == \".\":", "- continue", "- for dy, dx in zip([0, 1, 0, -1], [1, 0, -1, 0]):", "- ny = i + dy", "- nx = j + dx", "...
false
0.037066
0.213159
0.173892
[ "s839879492", "s274264864" ]
u701644092
p03013
python
s199477894
s789682220
192
167
17,432
17,188
Accepted
Accepted
13.02
N,M = list(map(int, input().split())) ng = set() for i in range(M): ng.add(int(eval(input()))) dp = [0] * (N + 5) dp[0] = 1 for i in range(N): for j in range(1, 3): if (i + j) not in ng: dp[i + j] += dp[i] dp[i + j] %= 1000000007 print((dp[N]))
N,M = list(map(int, input().split())) ng = set() for i in range(M): ng.add(int(eval(input()))) dp = [0] * (N + 5) dp[0] = 1 for i in range(N): if i + 1 not in ng: dp[i + 1] += dp[i] dp[i + 1] %= 1000000007 if i + 2 not in ng: dp[i + 2] += dp[i] dp[i + 2] %= 1000000007 print((d...
15
17
269
312
N, M = list(map(int, input().split())) ng = set() for i in range(M): ng.add(int(eval(input()))) dp = [0] * (N + 5) dp[0] = 1 for i in range(N): for j in range(1, 3): if (i + j) not in ng: dp[i + j] += dp[i] dp[i + j] %= 1000000007 print((dp[N]))
N, M = list(map(int, input().split())) ng = set() for i in range(M): ng.add(int(eval(input()))) dp = [0] * (N + 5) dp[0] = 1 for i in range(N): if i + 1 not in ng: dp[i + 1] += dp[i] dp[i + 1] %= 1000000007 if i + 2 not in ng: dp[i + 2] += dp[i] dp[i + 2] %= 1000000007 print(...
false
11.764706
[ "- for j in range(1, 3):", "- if (i + j) not in ng:", "- dp[i + j] += dp[i]", "- dp[i + j] %= 1000000007", "+ if i + 1 not in ng:", "+ dp[i + 1] += dp[i]", "+ dp[i + 1] %= 1000000007", "+ if i + 2 not in ng:", "+ dp[i + 2] += dp[i]", "+ ...
false
0.038113
0.038089
1.000611
[ "s199477894", "s789682220" ]
u601575292
p03624
python
s787553014
s676974357
29
26
9,116
9,036
Accepted
Accepted
10.34
s = eval(input()) for c in 'abcdefghijklmnopqrstuvwxyz': if s.find(c) == -1: print(c) exit() print('None')
s = eval(input()) for i in range(97, 123): if s.find(chr(i)) == -1: print((chr(i))) exit() print('None')
7
7
131
127
s = eval(input()) for c in "abcdefghijklmnopqrstuvwxyz": if s.find(c) == -1: print(c) exit() print("None")
s = eval(input()) for i in range(97, 123): if s.find(chr(i)) == -1: print((chr(i))) exit() print("None")
false
0
[ "-for c in \"abcdefghijklmnopqrstuvwxyz\":", "- if s.find(c) == -1:", "- print(c)", "+for i in range(97, 123):", "+ if s.find(chr(i)) == -1:", "+ print((chr(i)))" ]
false
0.043668
0.044241
0.987048
[ "s787553014", "s676974357" ]
u189023301
p02613
python
s434917170
s148815361
146
47
9,204
17,048
Accepted
Accepted
67.81
n = int(eval(input())) dic = dict() dic["AC"] = 0 dic["WA"] = 0 dic["TLE"] = 0 dic["RE"] = 0 for i in range(n): x = eval(input()) dic[x] += 1 print(("AC x", dic["AC"])) print(("WA x", dic["WA"])) print(("TLE x", dic["TLE"])) print(("RE x", dic["RE"]))
from collections import Counter import sys input = sys.stdin.read def main(): n = int(sys.stdin.readline()) A = input().split() C = Counter(A) for i in ["AC", "WA", "TLE", "RE"]: n = C[i] print(("{} x {}".format(i, n))) if __name__ == '__main__': main()
14
12
253
299
n = int(eval(input())) dic = dict() dic["AC"] = 0 dic["WA"] = 0 dic["TLE"] = 0 dic["RE"] = 0 for i in range(n): x = eval(input()) dic[x] += 1 print(("AC x", dic["AC"])) print(("WA x", dic["WA"])) print(("TLE x", dic["TLE"])) print(("RE x", dic["RE"]))
from collections import Counter import sys input = sys.stdin.read def main(): n = int(sys.stdin.readline()) A = input().split() C = Counter(A) for i in ["AC", "WA", "TLE", "RE"]: n = C[i] print(("{} x {}".format(i, n))) if __name__ == "__main__": main()
false
14.285714
[ "-n = int(eval(input()))", "-dic = dict()", "-dic[\"AC\"] = 0", "-dic[\"WA\"] = 0", "-dic[\"TLE\"] = 0", "-dic[\"RE\"] = 0", "-for i in range(n):", "- x = eval(input())", "- dic[x] += 1", "-print((\"AC x\", dic[\"AC\"]))", "-print((\"WA x\", dic[\"WA\"]))", "-print((\"TLE x\", dic[\"TLE\...
false
0.034981
0.073705
0.474605
[ "s434917170", "s148815361" ]
u933096856
p00027
python
s735666000
s438980265
40
20
9,048
6,996
Accepted
Accepted
50
import sys from datetime import * from time import * day = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] while True: try: user_input_date = '2004/'+'/'.join(input().split()) if user_input_date == '2004/0/0': break else: ...
import sys from datetime import * from time import * day = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ] while True: try: user_input_date = '2004/'+'/'.join(input().split()) if user_input_date == '2004/0/0': break else: ...
18
18
469
472
import sys from datetime import * from time import * day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] while True: try: user_input_date = "2004/" + "/".join(input().split()) if user_input_date == "2004/0/0": break else: a = datetime...
import sys from datetime import * from time import * day = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] while True: try: user_input_date = "2004/" + "/".join(input().split()) if user_input_date == "2004/0/0": break else: a = datetime...
false
0
[ "- print((day[a.weekday()]))", "+ print(day[a.weekday()])" ]
false
0.050624
0.0512
0.988747
[ "s735666000", "s438980265" ]
u811434779
p02468
python
s769971247
s871651043
20
10
6,400
6,404
Accepted
Accepted
50
def power(a, n, M): if n == 0: return 1 tmp = power(a*a%M, n/2, M) if n % 2 == 1: tmp = tmp * a % M return tmp m, n = list(map(int, input().split())) print(power(m, n, 1000000007))
def power(a, n, M): res = 1 if n > 0: res = power(a*a%M, n/2, M) if n % 2 == 1: res = res * a % M return res m, n = list(map(int, input().split())) print(power(m, n, 1000000007))
8
9
208
223
def power(a, n, M): if n == 0: return 1 tmp = power(a * a % M, n / 2, M) if n % 2 == 1: tmp = tmp * a % M return tmp m, n = list(map(int, input().split())) print(power(m, n, 1000000007))
def power(a, n, M): res = 1 if n > 0: res = power(a * a % M, n / 2, M) if n % 2 == 1: res = res * a % M return res m, n = list(map(int, input().split())) print(power(m, n, 1000000007))
false
11.111111
[ "- if n == 0:", "- return 1", "- tmp = power(a * a % M, n / 2, M)", "- if n % 2 == 1:", "- tmp = tmp * a % M", "- return tmp", "+ res = 1", "+ if n > 0:", "+ res = power(a * a % M, n / 2, M)", "+ if n % 2 == 1:", "+ res = res * a % M", "...
false
0.04107
0.043019
0.954698
[ "s769971247", "s871651043" ]
u401686269
p02956
python
s996811181
s324007635
1,487
1,093
208,496
198,148
Accepted
Accepted
26.5
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int,input().split())) for _ in range(N)] mod = 998244353 class BIT: '''https://tjkendev.github.io/procon-library/python/range_query/bit.html''' def __init__(self...
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int,input().split())) for _ in range(N)] mod = 998244353 class BIT: '''https://tjkendev.github.io/procon-library/python/range_query/bit.html''' def __init__(self...
103
86
2,173
1,912
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int, input().split())) for _ in range(N)] mod = 998244353 class BIT: """https://tjkendev.github.io/procon-library/python/range_query/bit.html""" def __init__(self, n): ...
# 解説放送の方針 # 平面走査をし、各点について、左上、左下、右上、右下にある点を数え、計算する。 # 解説放送ではBITを2本使っていたが、座標圧縮の結果を利用してBIT1本で済むようにした N = int(eval(input())) xy = [tuple(map(int, input().split())) for _ in range(N)] mod = 998244353 class BIT: """https://tjkendev.github.io/procon-library/python/range_query/bit.html""" def __init__(self, n): ...
false
16.504854
[ "+# ソート後の復元+座標圧縮用の辞書作成", "+# 座標圧縮: 小さいyから順に1,2,3...と値を割り振る。", "+Y = []", "- x += 10**9", "- y += 10**9", "- xy2.append(y << 80 | x << 40 | i)", "-# ソート後の復元+座標圧縮用の辞書作成", "-# 座標圧縮: 小さいyから順に1,2,3...と値を割り振る。", "-xy2 = sorted(xy2)", "-mask = (1 << 40) - 1", "-y_order = [0] * N", "-y_compre...
false
0.073991
0.059709
1.239192
[ "s996811181", "s324007635" ]
u496407619
p03273
python
s263284583
s672463742
1,661
155
19,308
12,880
Accepted
Accepted
90.67
import numpy as np inputs = input().replace("\n", "") H, W = list(map(int, inputs.split(" "))) lines = np.asarray([list(input().replace("\n", "")) for h in range(H)]) h_indexs, w_indexs = list(map(set, np.where(lines == "#"))) outlines = lines[list(h_indexs), :][:, list(w_indexs)] for outline in outlines:...
import numpy as np H, W = list(map(int, input().split(" "))) lines = np.asarray([list(input().replace("\n", "")) for h in range(H)]) h_indexs, w_indexs = list(map(set, np.where(lines == "#"))) outlines = lines[list(h_indexs), :][:, list(w_indexs)] for outline in outlines: print(("".join(outline)))
12
11
345
302
import numpy as np inputs = input().replace("\n", "") H, W = list(map(int, inputs.split(" "))) lines = np.asarray([list(input().replace("\n", "")) for h in range(H)]) h_indexs, w_indexs = list(map(set, np.where(lines == "#"))) outlines = lines[list(h_indexs), :][:, list(w_indexs)] for outline in outlines: print(""...
import numpy as np H, W = list(map(int, input().split(" "))) lines = np.asarray([list(input().replace("\n", "")) for h in range(H)]) h_indexs, w_indexs = list(map(set, np.where(lines == "#"))) outlines = lines[list(h_indexs), :][:, list(w_indexs)] for outline in outlines: print(("".join(outline)))
false
8.333333
[ "-inputs = input().replace(\"\\n\", \"\")", "-H, W = list(map(int, inputs.split(\" \")))", "+H, W = list(map(int, input().split(\" \")))", "- print(\"\".join(outline))", "+ print((\"\".join(outline)))" ]
false
0.473094
0.280219
1.688302
[ "s263284583", "s672463742" ]
u698919163
p02628
python
s057510681
s541592630
33
27
9,204
9,080
Accepted
Accepted
18.18
N,K = list(map(int,input().split())) p = list(map(int,input().split())) p.sort() ans = 0 for i in range(K): ans += p[i] print(ans)
N,K = list(map(int,input().split())) p = list(map(int,input().split())) p.sort() print((sum(p[:K])))
8
5
136
97
N, K = list(map(int, input().split())) p = list(map(int, input().split())) p.sort() ans = 0 for i in range(K): ans += p[i] print(ans)
N, K = list(map(int, input().split())) p = list(map(int, input().split())) p.sort() print((sum(p[:K])))
false
37.5
[ "-ans = 0", "-for i in range(K):", "- ans += p[i]", "-print(ans)", "+print((sum(p[:K])))" ]
false
0.035676
0.036551
0.976067
[ "s057510681", "s541592630" ]
u899909022
p03013
python
s952517225
s121442627
1,928
189
6,900
6,876
Accepted
Accepted
90.2
n,m=list(map(int,input().split())) MOD = 1000000007 D=[0] * (n+2) D[0] = 1 for _ in range(m): D[int(eval(input()))] = -1 for i in range(n): if D[i] == -1: continue if D[i+1] != -1: D[i+1] += D[i] if D[i+2] != -1: D[i+2] += D[i] D[i]%=MOD print((D[n] % MOD))
n,m=list(map(int,input().split())) MOD = 1000000007 D=[0] * (n + 1) for _ in range(m): D[int(eval(input()))] = -1 for i in range(n+1): if D[i] == -1: continue if i in (0, 1): D[i] = 1 continue if D[i-1] != -1: D[i] += D[i-1] if D[i-2] != -1: D[i...
15
17
302
353
n, m = list(map(int, input().split())) MOD = 1000000007 D = [0] * (n + 2) D[0] = 1 for _ in range(m): D[int(eval(input()))] = -1 for i in range(n): if D[i] == -1: continue if D[i + 1] != -1: D[i + 1] += D[i] if D[i + 2] != -1: D[i + 2] += D[i] D[i] %= MOD print((D[n] % MOD))
n, m = list(map(int, input().split())) MOD = 1000000007 D = [0] * (n + 1) for _ in range(m): D[int(eval(input()))] = -1 for i in range(n + 1): if D[i] == -1: continue if i in (0, 1): D[i] = 1 continue if D[i - 1] != -1: D[i] += D[i - 1] if D[i - 2] != -1: D[i]...
false
11.764706
[ "-D = [0] * (n + 2)", "-D[0] = 1", "+D = [0] * (n + 1)", "-for i in range(n):", "+for i in range(n + 1):", "- if D[i + 1] != -1:", "- D[i + 1] += D[i]", "- if D[i + 2] != -1:", "- D[i + 2] += D[i]", "+ if i in (0, 1):", "+ D[i] = 1", "+ continue", "+ i...
false
0.104182
0.036791
2.831719
[ "s952517225", "s121442627" ]
u955248595
p02571
python
s967029200
s479793181
54
49
9,056
8,916
Accepted
Accepted
9.26
S = eval(input()) T = eval(input()) MIS = len(S) for TS in range(0,len(S)-len(T)+1): LS = S[TS:TS+len(T)] Count = 0 for TT in range(0,len(T)): if LS[TT]!=T[TT]: Count += 1 MIS = min(MIS,Count) print(MIS)
S = eval(input()) T = eval(input()) MIS = len(S) for TS in range(0,len(S)-len(T)+1): LS = S[TS:TS+len(T)] Count = sum(True if LS[TT]!=T[TT] else False for TT in range(0,len(T))) MIS = min(MIS,Count) print(MIS)
11
8
237
216
S = eval(input()) T = eval(input()) MIS = len(S) for TS in range(0, len(S) - len(T) + 1): LS = S[TS : TS + len(T)] Count = 0 for TT in range(0, len(T)): if LS[TT] != T[TT]: Count += 1 MIS = min(MIS, Count) print(MIS)
S = eval(input()) T = eval(input()) MIS = len(S) for TS in range(0, len(S) - len(T) + 1): LS = S[TS : TS + len(T)] Count = sum(True if LS[TT] != T[TT] else False for TT in range(0, len(T))) MIS = min(MIS, Count) print(MIS)
false
27.272727
[ "- Count = 0", "- for TT in range(0, len(T)):", "- if LS[TT] != T[TT]:", "- Count += 1", "+ Count = sum(True if LS[TT] != T[TT] else False for TT in range(0, len(T)))" ]
false
0.037136
0.035992
1.031786
[ "s967029200", "s479793181" ]
u133936772
p03062
python
s819164731
s211239702
74
66
20,132
20,020
Accepted
Accepted
10.81
n=int(eval(input())) l=[*list(map(int,input().split()))] c=0 for e,i in enumerate(l): if i<0: c+=1 l[e]=-i print((sum(l)-[0,min(l)*2][c%2]))
n=int(eval(input())) a=[*list(map(int,input().split()))] l=[*list(map(abs,a))] print((sum(l)-sum(i<0 for i in a)%2*min(l)*2))
8
4
143
108
n = int(eval(input())) l = [*list(map(int, input().split()))] c = 0 for e, i in enumerate(l): if i < 0: c += 1 l[e] = -i print((sum(l) - [0, min(l) * 2][c % 2]))
n = int(eval(input())) a = [*list(map(int, input().split()))] l = [*list(map(abs, a))] print((sum(l) - sum(i < 0 for i in a) % 2 * min(l) * 2))
false
50
[ "-l = [*list(map(int, input().split()))]", "-c = 0", "-for e, i in enumerate(l):", "- if i < 0:", "- c += 1", "- l[e] = -i", "-print((sum(l) - [0, min(l) * 2][c % 2]))", "+a = [*list(map(int, input().split()))]", "+l = [*list(map(abs, a))]", "+print((sum(l) - sum(i < 0 for i in a)...
false
0.074942
0.038554
1.943816
[ "s819164731", "s211239702" ]
u936985471
p03786
python
s276862873
s926340577
112
96
14,224
20,244
Accepted
Accepted
14.29
N=int(eval(input())) A=sorted(list(map(int,input().split()))) # そこまでの累計(の2倍)より大きければ、そこまでに現れた数字はすべてNG sums=0 least=0 for i in range(N): if A[i]>sums*2: least=i sums+=A[i] print((N-least))
import sys readline = sys.stdin.readline N = int(readline()) A = list(map(int,readline().split())) A = sorted(A) cur = 0 ng = 0 for i in range(N): if A[i] > cur * 2: ng = i cur += A[i] print((N - ng))
11
16
198
227
N = int(eval(input())) A = sorted(list(map(int, input().split()))) # そこまでの累計(の2倍)より大きければ、そこまでに現れた数字はすべてNG sums = 0 least = 0 for i in range(N): if A[i] > sums * 2: least = i sums += A[i] print((N - least))
import sys readline = sys.stdin.readline N = int(readline()) A = list(map(int, readline().split())) A = sorted(A) cur = 0 ng = 0 for i in range(N): if A[i] > cur * 2: ng = i cur += A[i] print((N - ng))
false
31.25
[ "-N = int(eval(input()))", "-A = sorted(list(map(int, input().split())))", "-# そこまでの累計(の2倍)より大きければ、そこまでに現れた数字はすべてNG", "-sums = 0", "-least = 0", "+import sys", "+", "+readline = sys.stdin.readline", "+N = int(readline())", "+A = list(map(int, readline().split()))", "+A = sorted(A)", "+cur = 0"...
false
0.04363
0.043716
0.998025
[ "s276862873", "s926340577" ]
u644907318
p03660
python
s643836112
s907153724
578
442
28,868
124,596
Accepted
Accepted
23.53
from collections import deque N = int(eval(input())) G = {} for i in range(N-1): a,b = list(map(int,input().split())) if a not in G: G[a] = [] G[a].append(b) if b not in G: G[b] = [] G[b].append(a) hist = [-1 for _ in range(N+1)] heapF = deque([(1,0)]) hist[1] = 0 heapS...
from collections import deque N = int(eval(input())) G = {i:[] for i in range(1,N+1)} for _ in range(N-1): a,b = list(map(int,input().split())) G[a].append(b) G[b].append(a) dist = [0 for _ in range(N+1)] que = deque([(1,0)]) hist = [0 for _ in range(N+1)] hist[1] = 1 while que: x,d = que.po...
47
83
1,168
1,673
from collections import deque N = int(eval(input())) G = {} for i in range(N - 1): a, b = list(map(int, input().split())) if a not in G: G[a] = [] G[a].append(b) if b not in G: G[b] = [] G[b].append(a) hist = [-1 for _ in range(N + 1)] heapF = deque([(1, 0)]) hist[1] = 0 heapS = deq...
from collections import deque N = int(eval(input())) G = {i: [] for i in range(1, N + 1)} for _ in range(N - 1): a, b = list(map(int, input().split())) G[a].append(b) G[b].append(a) dist = [0 for _ in range(N + 1)] que = deque([(1, 0)]) hist = [0 for _ in range(N + 1)] hist[1] = 1 while que: x, d = que...
false
43.373494
[ "-G = {}", "-for i in range(N - 1):", "+G = {i: [] for i in range(1, N + 1)}", "+for _ in range(N - 1):", "- if a not in G:", "- G[a] = []", "- if b not in G:", "- G[b] = []", "-hist = [-1 for _ in range(N + 1)]", "-heapF = deque([(1, 0)])", "-hist[1] = 0", "-heapS = deque(...
false
0.045033
0.046869
0.960821
[ "s643836112", "s907153724" ]
u602740328
p02844
python
s874212784
s047954653
817
24
3,828
3,060
Accepted
Accepted
97.06
N = int(eval(input())) S = list(eval(input())) n = 0 for i in range(1000): ps = "%03d"%(i) s = S is_ok = True for j in list(ps): if j in s: s = s[s.index(j)+1:] else: is_ok = False break if is_ok: n+=1 print(n)
N = int(eval(input())) S = eval(input()) n = 0 for i in range(1000): ps_i = "%03d"%(i) s = S ps_i_ok = True for j in ps_i: if j in s: s = s[s.index(j)+1:] else: ps_i_ok = False break if ps_i_ok: n+=1 print(n)
14
14
241
239
N = int(eval(input())) S = list(eval(input())) n = 0 for i in range(1000): ps = "%03d" % (i) s = S is_ok = True for j in list(ps): if j in s: s = s[s.index(j) + 1 :] else: is_ok = False break if is_ok: n += 1 print(n)
N = int(eval(input())) S = eval(input()) n = 0 for i in range(1000): ps_i = "%03d" % (i) s = S ps_i_ok = True for j in ps_i: if j in s: s = s[s.index(j) + 1 :] else: ps_i_ok = False break if ps_i_ok: n += 1 print(n)
false
0
[ "-S = list(eval(input()))", "+S = eval(input())", "- ps = \"%03d\" % (i)", "+ ps_i = \"%03d\" % (i)", "- is_ok = True", "- for j in list(ps):", "+ ps_i_ok = True", "+ for j in ps_i:", "- is_ok = False", "+ ps_i_ok = False", "- if is_ok:", "+ if ps_...
false
0.103854
0.036728
2.827692
[ "s874212784", "s047954653" ]
u133936772
p03828
python
s052785651
s135753300
32
28
2,940
2,940
Accepted
Accepted
12.5
d={} for i in range(int(eval(input()))+1): for j in d: while i>j-1 and i%j<1: d[j]+=1; i//=j if i>1: d[i]=2 a=1 for v in list(d.values()): a=a*v%(10**9+7) print(a)
d={} for i in range(int(eval(input()))+1): for j in d: while i%j<1: d[j]+=1; i//=j if i>1: d[i]=2 a=1 for v in list(d.values()): a=a*v%(10**9+7) print(a)
8
8
166
156
d = {} for i in range(int(eval(input())) + 1): for j in d: while i > j - 1 and i % j < 1: d[j] += 1 i //= j if i > 1: d[i] = 2 a = 1 for v in list(d.values()): a = a * v % (10**9 + 7) print(a)
d = {} for i in range(int(eval(input())) + 1): for j in d: while i % j < 1: d[j] += 1 i //= j if i > 1: d[i] = 2 a = 1 for v in list(d.values()): a = a * v % (10**9 + 7) print(a)
false
0
[ "- while i > j - 1 and i % j < 1:", "+ while i % j < 1:" ]
false
0.039452
0.04569
0.863484
[ "s052785651", "s135753300" ]
u366482170
p02900
python
s538082228
s092475675
485
257
5,088
5,044
Accepted
Accepted
47.01
#import sys #input = sys.stdin.readline #import heapq import math import fractions def sosuhante(n): for k in range(2, int(math.sqrt(n))+1): if n% k ==0: return False return True def main(): # h,w,a,b = map(int, input().split()) a,b=list(map(int,input().split())) ...
#import sys #input = sys.stdin.readline #import heapq import math import fractions def sosuhante(n): for k in range(2, int(math.sqrt(n))+1): if n% k ==0: return False return True def main(): # h,w,a,b = map(int, input().split()) a,b=list(map(int,input().split())) ...
88
59
1,659
1,080
# import sys # input = sys.stdin.readline # import heapq import math import fractions def sosuhante(n): for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True def main(): # h,w,a,b = map(int, input().split()) a, b = list(map(int, input().split())) ...
# import sys # input = sys.stdin.readline # import heapq import math import fractions def sosuhante(n): for k in range(2, int(math.sqrt(n)) + 1): if n % k == 0: return False return True def main(): # h,w,a,b = map(int, input().split()) a, b = list(map(int, input().split())) ...
false
32.954545
[ "- m = 4", "- k = 1", "- count = 1", "- sosub = set()", "- # a = fractions.gcd(a,b)", "- if b % 2 == 0:", "- sosub.add(2)", "- while b % 2 == 0:", "- b //= 2", "- if b % 3 == 0:", "- sosub.add(3)", "- while b % 3 == 0:", "- ...
false
0.038673
0.037783
1.023552
[ "s538082228", "s092475675" ]
u411203878
p02787
python
s563312569
s028233219
1,488
461
3,552
44,552
Accepted
Accepted
69.02
w, h = (int(x) for x in input().split()) ab = [] for _ in range(h): a, b = (int(x) for x in input().split()) ab.append([a, b]) dp = [0] * (w + max(a for a, b in ab)) for j in range(1, w+1): dp[j] = min(dp[j-a]+b for a, b in ab) print((dp[w]))
w, h = (int(x) for x in input().split()) ab = [] for _ in range(h): a, b = (int(x) for x in input().split()) ab.append([a, b]) dp = [10000000000000 for i in range(w+1)] for j in range(w+1): for i in range(h): if j <= ab[i][0]: dp[j] = min(dp[j], ab[i][1]) else: ...
12
16
266
391
w, h = (int(x) for x in input().split()) ab = [] for _ in range(h): a, b = (int(x) for x in input().split()) ab.append([a, b]) dp = [0] * (w + max(a for a, b in ab)) for j in range(1, w + 1): dp[j] = min(dp[j - a] + b for a, b in ab) print((dp[w]))
w, h = (int(x) for x in input().split()) ab = [] for _ in range(h): a, b = (int(x) for x in input().split()) ab.append([a, b]) dp = [10000000000000 for i in range(w + 1)] for j in range(w + 1): for i in range(h): if j <= ab[i][0]: dp[j] = min(dp[j], ab[i][1]) else: dp...
false
25
[ "-dp = [0] * (w + max(a for a, b in ab))", "-for j in range(1, w + 1):", "- dp[j] = min(dp[j - a] + b for a, b in ab)", "+dp = [10000000000000 for i in range(w + 1)]", "+for j in range(w + 1):", "+ for i in range(h):", "+ if j <= ab[i][0]:", "+ dp[j] = min(dp[j], ab[i][1])", ...
false
0.050018
0.076928
0.650188
[ "s563312569", "s028233219" ]
u761087127
p02773
python
s125858279
s342856533
892
607
62,688
35,816
Accepted
Accepted
31.95
from collections import Counter N = int(input()) S = [input() for _ in range(N)] c = Counter(S) m = max(c.values()) ans = sorted([(k,v) for k,v in c.items() if m==v], key=lambda x: (-x[1], x[0])) [print(k[0])for k in ans]
from collections import Counter N = int(input()) S = [input() for _ in range(N)] c = Counter(S) m = max(c.values()) ans = sorted([k for k,v in c.items() if m==v]) [print(k) for k in ans]
8
8
229
194
from collections import Counter N = int(input()) S = [input() for _ in range(N)] c = Counter(S) m = max(c.values()) ans = sorted([(k, v) for k, v in c.items() if m == v], key=lambda x: (-x[1], x[0])) [print(k[0]) for k in ans]
from collections import Counter N = int(input()) S = [input() for _ in range(N)] c = Counter(S) m = max(c.values()) ans = sorted([k for k, v in c.items() if m == v]) [print(k) for k in ans]
false
0
[ "-ans = sorted([(k, v) for k, v in c.items() if m == v], key=lambda x: (-x[1], x[0]))", "-[print(k[0]) for k in ans]", "+ans = sorted([k for k, v in c.items() if m == v])", "+[print(k) for k in ans]" ]
false
0.080884
0.044037
1.836739
[ "s125858279", "s342856533" ]
u102461423
p04018
python
s463378735
s864508924
450
293
71,684
72,196
Accepted
Accepted
34.89
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines W = read().rstrip() N = len(W) def Z_algorithm(S): # 共通接頭辞の長さを返す N=len(S) arr = [0]*N arr[0] = N i,j = 1,0 while i<N: while i+j<N and S[j]==S[i+j]: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines W = read().rstrip() N = len(W) def Z_algorithm(S): # 共通接頭辞の長さを返す N=len(S) arr = [0]*N arr[0] = N i,j = 1,0 while i<N: while i+j<N and S[j]==S[i+j]: ...
51
53
1,102
1,153
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines W = read().rstrip() N = len(W) def Z_algorithm(S): # 共通接頭辞の長さを返す N = len(S) arr = [0] * N arr[0] = N i, j = 1, 0 while i < N: while i + j < N and S[j] == S[i + j]: ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines W = read().rstrip() N = len(W) def Z_algorithm(S): # 共通接頭辞の長さを返す N = len(S) arr = [0] * N arr[0] = N i, j = 1, 0 while i < N: while i + j < N and S[j] == S[i + j]: ...
false
3.773585
[ "- for p in range(1, N // 2 + 10):", "+ for p in range(1, N // 2 + 1):", "+ if is_periodic[p - 1]:", "+ continue" ]
false
0.038852
0.08418
0.461535
[ "s463378735", "s864508924" ]
u112364985
p02813
python
s770139979
s949155057
54
38
12,788
13,956
Accepted
Accepted
29.63
import itertools N=int(eval(input())) P=list(map(int,input().split())) Q=list(map(int,input().split())) list_a = list(range(1,N+1)) tuple_a = tuple(list_a) ptr = list(itertools.permutations(tuple_a)) ptr_num = len(list(itertools.permutations(tuple_a))) for i in range(0,ptr_num): if ptr[i] == tuple(P): P...
import itertools n=int(eval(input())) p=tuple(map(int,input().split())) q=tuple(map(int,input().split())) jyunretsu=list(itertools.permutations(list(range(1,n+1)))) print((abs(jyunretsu.index(p)-jyunretsu.index(q))))
14
6
389
213
import itertools N = int(eval(input())) P = list(map(int, input().split())) Q = list(map(int, input().split())) list_a = list(range(1, N + 1)) tuple_a = tuple(list_a) ptr = list(itertools.permutations(tuple_a)) ptr_num = len(list(itertools.permutations(tuple_a))) for i in range(0, ptr_num): if ptr[i] == tuple(P): ...
import itertools n = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) jyunretsu = list(itertools.permutations(list(range(1, n + 1)))) print((abs(jyunretsu.index(p) - jyunretsu.index(q))))
false
57.142857
[ "-N = int(eval(input()))", "-P = list(map(int, input().split()))", "-Q = list(map(int, input().split()))", "-list_a = list(range(1, N + 1))", "-tuple_a = tuple(list_a)", "-ptr = list(itertools.permutations(tuple_a))", "-ptr_num = len(list(itertools.permutations(tuple_a)))", "-for i in range(0, ptr_num...
false
0.045236
0.043543
1.038889
[ "s770139979", "s949155057" ]
u810356688
p03173
python
s580432132
s768897396
628
354
80,248
41,712
Accepted
Accepted
43.63
import sys def input(): return sys.stdin.readline().rstrip() # 単位元とseg_funcを設定する from fractions import gcd class seg(): def __init__(self,init_val): self.n=len(init_val) self.ide_ele=0 #単位元 self.num=2**(self.n-1).bit_length() #n以上の最小の2のべき乗 self.seg=[self.ide_ele]*2*self.num ...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n=int(eval(input())) A=list(map(int,input().split())) cum_A=[0]*(n+1) #Aの[0,i)の和 for i in range(1,n+1): cum_A[i]=cum_A[i-1]+A[i-1] dp=[[0]*n for _ in range(n)] #[i,j]をまとめるために必要なコストの最小値 for length in range(...
60
21
1,972
629
import sys def input(): return sys.stdin.readline().rstrip() # 単位元とseg_funcを設定する from fractions import gcd class seg: def __init__(self, init_val): self.n = len(init_val) self.ide_ele = 0 # 単位元 self.num = 2 ** (self.n - 1).bit_length() # n以上の最小の2のべき乗 self.seg = [self.ide_...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n = int(eval(input())) A = list(map(int, input().split())) cum_A = [0] * (n + 1) # Aの[0,i)の和 for i in range(1, n + 1): cum_A[i] = cum_A[i - 1] + A[i - 1] dp = [[0] * n for _ in range(n)] # [i,j]をまとめるために必要なコストの...
false
65
[ "-# 単位元とseg_funcを設定する", "-from fractions import gcd", "-", "-", "-class seg:", "- def __init__(self, init_val):", "- self.n = len(init_val)", "- self.ide_ele = 0 # 単位元", "- self.num = 2 ** (self.n - 1).bit_length() # n以上の最小の2のべき乗", "- self.seg = [self.ide_ele] * 2 ...
false
0.113546
0.036578
3.104228
[ "s580432132", "s768897396" ]
u794544096
p02718
python
s587685872
s996104930
307
178
79,492
62,808
Accepted
Accepted
42.02
n, m = list(map(int, input().split())) a = list(map(int, input().split())) count = 0 for i in range(n): if a[i] >= sum(a)/(4*m): count += 1 if count >= m: print('Yes') else: print('No')
n,m = list(map(int, input().split())) a = list(map(int ,input().split())) cnt = 0 for i in range(n): if a[i] >= sum(a)/(4*m): cnt += 1 if cnt >= m: print('Yes') else: print('No')
13
12
215
206
n, m = list(map(int, input().split())) a = list(map(int, input().split())) count = 0 for i in range(n): if a[i] >= sum(a) / (4 * m): count += 1 if count >= m: print("Yes") else: print("No")
n, m = list(map(int, input().split())) a = list(map(int, input().split())) cnt = 0 for i in range(n): if a[i] >= sum(a) / (4 * m): cnt += 1 if cnt >= m: print("Yes") else: print("No")
false
7.692308
[ "-count = 0", "+cnt = 0", "- count += 1", "-if count >= m:", "+ cnt += 1", "+if cnt >= m:" ]
false
0.11133
0.140953
0.78984
[ "s587685872", "s996104930" ]
u820560680
p03290
python
s394623350
s435479420
865
27
3,316
3,064
Accepted
Accepted
96.88
D, G = list(map(int, input().split())) problem = [] bonus_score = [] for i in range(D): pi, ci = list(map(int, input().split())) problem.append(pi) bonus_score.append(ci) total_problem = sum(problem) dp= [[0 for k in range(total_problem + 1)] for i in range(D+1)] for i in range(D): for k in ...
D, G = list(map(int, input().split())) problem = [] bonus = [] for i in range(D): pi, ci = list(map(int, input().split())) problem.append(pi) bonus.append(ci) ans = float('inf') for S in range(1 << D): # Sは2^Dの元 score = sum([(problem[j] * 100 * (j + 1) + bonus[j]) * ((S >> j) & 1) for j in ran...
19
19
566
703
D, G = list(map(int, input().split())) problem = [] bonus_score = [] for i in range(D): pi, ci = list(map(int, input().split())) problem.append(pi) bonus_score.append(ci) total_problem = sum(problem) dp = [[0 for k in range(total_problem + 1)] for i in range(D + 1)] for i in range(D): for k in range(tot...
D, G = list(map(int, input().split())) problem = [] bonus = [] for i in range(D): pi, ci = list(map(int, input().split())) problem.append(pi) bonus.append(ci) ans = float("inf") for S in range(1 << D): # Sは2^Dの元 score = sum( [(problem[j] * 100 * (j + 1) + bonus[j]) * ((S >> j) & 1) for j in ran...
false
0
[ "-bonus_score = []", "+bonus = []", "- bonus_score.append(ci)", "-total_problem = sum(problem)", "-dp = [[0 for k in range(total_problem + 1)] for i in range(D + 1)]", "-for i in range(D):", "- for k in range(total_problem + 1):", "- for j in range(min(problem[i], k) + 1):", "- ...
false
0.156346
0.037474
4.172164
[ "s394623350", "s435479420" ]
u562935282
p03087
python
s594755213
s158882195
900
229
6,152
13,460
Accepted
Accepted
74.56
n, q = list(map(int, input().split())) s = eval(input()) c = [0] flg = False cnt = 0 for ss in s: if ss == 'C' and flg: cnt += 1 flg = (ss == 'A') c.append(cnt) # print(c) for _ in range(q): l, r = list(map(int, input().split())) # [l,r] res = c[r] - c[l - 1] if l >=...
def main(): import sys input = sys.stdin.readline N, Q = map(int, input().split()) s = input().rstrip() imos = [0] * (N + 1) for i in range(N - 1): if s[i:i + 2] == 'AC': imos[i + 2] += 1 for i in range(N): imos[i + 1] += imos[i] ans = [] ...
19
33
363
693
n, q = list(map(int, input().split())) s = eval(input()) c = [0] flg = False cnt = 0 for ss in s: if ss == "C" and flg: cnt += 1 flg = ss == "A" c.append(cnt) # print(c) for _ in range(q): l, r = list(map(int, input().split())) # [l,r] res = c[r] - c[l - 1] if l >= 2 and s[l - 2 : l]...
def main(): import sys input = sys.stdin.readline N, Q = map(int, input().split()) s = input().rstrip() imos = [0] * (N + 1) for i in range(N - 1): if s[i : i + 2] == "AC": imos[i + 2] += 1 for i in range(N): imos[i + 1] += imos[i] ans = [] for _ in range...
false
42.424242
[ "-n, q = list(map(int, input().split()))", "-s = eval(input())", "-c = [0]", "-flg = False", "-cnt = 0", "-for ss in s:", "- if ss == \"C\" and flg:", "- cnt += 1", "- flg = ss == \"A\"", "- c.append(cnt)", "-# print(c)", "-for _ in range(q):", "- l, r = list(map(int, inpu...
false
0.083266
0.044611
1.866467
[ "s594755213", "s158882195" ]
u802234211
p02571
python
s159136515
s185327798
75
60
9,176
9,024
Accepted
Accepted
20
s = eval(input()) t = eval(input()) stri = [] for i in range(len(s)-len(t)+1): j = i+ len(t) stri.append(s[i:j]) maxcount = 0 for i in range(len(stri)): count = 0 for j in range(len(t)): if(stri[i][j] ==t[j]): count+= 1 maxcount = max(maxcount,count) print((len(t)...
s = eval(input()) t = eval(input()) stri = [] mincount = 1e9 for i in range(len(s)-len(t)+1): count = 0 for j in range(len(t)): if(s[i+j] != t[j]): count+= 1 mincount = min(mincount,count) print(mincount)
15
12
317
237
s = eval(input()) t = eval(input()) stri = [] for i in range(len(s) - len(t) + 1): j = i + len(t) stri.append(s[i:j]) maxcount = 0 for i in range(len(stri)): count = 0 for j in range(len(t)): if stri[i][j] == t[j]: count += 1 maxcount = max(maxcount, count) print((len(t) - maxcou...
s = eval(input()) t = eval(input()) stri = [] mincount = 1e9 for i in range(len(s) - len(t) + 1): count = 0 for j in range(len(t)): if s[i + j] != t[j]: count += 1 mincount = min(mincount, count) print(mincount)
false
20
[ "+mincount = 1e9", "- j = i + len(t)", "- stri.append(s[i:j])", "-maxcount = 0", "-for i in range(len(stri)):", "- if stri[i][j] == t[j]:", "+ if s[i + j] != t[j]:", "- maxcount = max(maxcount, count)", "-print((len(t) - maxcount))", "+ mincount = min(mincount, count)", ...
false
0.042187
0.04856
0.868776
[ "s159136515", "s185327798" ]
u347640436
p02901
python
s920009022
s013812965
1,283
862
35,876
3,300
Accepted
Accepted
32.81
def read_key(): a, _ = list(map(int, input().split())) m = 0 for c in map(int, input().split()): m |= 1 << (c - 1) return (a, m) def main(): INF = float('inf') N, M = list(map(int, input().split())) keys = [read_key() for _ in range(M)] dp = [[INF] * (1 << N) fo...
def read_key(): a, _ = list(map(int, input().split())) m = 0 for c in map(int, input().split()): m |= 1 << (c - 1) return (a, m) INF = float('inf') N, M = list(map(int, input().split())) keys = [read_key() for _ in range(M)] dp = [INF] * (1 << N) dp[0] = 0 for i in range(M):...
36
28
802
570
def read_key(): a, _ = list(map(int, input().split())) m = 0 for c in map(int, input().split()): m |= 1 << (c - 1) return (a, m) def main(): INF = float("inf") N, M = list(map(int, input().split())) keys = [read_key() for _ in range(M)] dp = [[INF] * (1 << N) for _ in range(M +...
def read_key(): a, _ = list(map(int, input().split())) m = 0 for c in map(int, input().split()): m |= 1 << (c - 1) return (a, m) INF = float("inf") N, M = list(map(int, input().split())) keys = [read_key() for _ in range(M)] dp = [INF] * (1 << N) dp[0] = 0 for i in range(M): a, m = keys[i]...
false
22.222222
[ "-def main():", "- INF = float(\"inf\")", "- N, M = list(map(int, input().split()))", "- keys = [read_key() for _ in range(M)]", "- dp = [[INF] * (1 << N) for _ in range(M + 1)]", "- dp[0][0] = 0", "- for i in range(M):", "- a, m = keys[i]", "- dpi = dp[i]", "- ...
false
0.038004
0.069839
0.54416
[ "s920009022", "s013812965" ]
u687044304
p02702
python
s569774776
s909654294
147
134
23,304
23,488
Accepted
Accepted
8.84
# -*- coding:utf-8 -*- def solve(): MOD = 2019 S = eval(input()) """解説AC""" # A列を作成 As = [] d = 1 for moji in S[::-1]: a = (int(moji)*d)%MOD As.append(a) d = (d*10)%MOD # 累積和を作成 ruiseki = [0] for i, a in enumerate(As): r = (rui...
# -*- coding:utf-8 -*- def solve(): MOD = 2019 S = eval(input()) """解説AC""" # A列を作成 As = [] d = 1 for moji in S[::-1]: a = (int(moji)*d)%MOD As.append(a) d = (d*10)%MOD # 累積和を作成 ruiseki = [0] for i, a in enumerate(As): r = (rui...
37
87
707
1,824
# -*- coding:utf-8 -*- def solve(): MOD = 2019 S = eval(input()) """解説AC""" # A列を作成 As = [] d = 1 for moji in S[::-1]: a = (int(moji) * d) % MOD As.append(a) d = (d * 10) % MOD # 累積和を作成 ruiseki = [0] for i, a in enumerate(As): r = (ruiseki[i] + a) ...
# -*- coding:utf-8 -*- def solve(): MOD = 2019 S = eval(input()) """解説AC""" # A列を作成 As = [] d = 1 for moji in S[::-1]: a = (int(moji) * d) % MOD As.append(a) d = (d * 10) % MOD # 累積和を作成 ruiseki = [0] for i, a in enumerate(As): r = (ruiseki[i] + a) ...
false
57.471264
[ "+def solve2():", "+ MOD = 2019", "+ S = eval(input())", "+ \"\"\"解説AC\"\"\"", "+ # A列を作成", "+ As = []", "+ d = 1", "+ for moji in S[::-1]:", "+ a = (int(moji) * d) % MOD", "+ As.append(a)", "+ d = (d * 10) % MOD", "+ # 累積和を作成", "+ ruiseki = [0...
false
0.044211
0.038259
1.155573
[ "s569774776", "s909654294" ]
u982591663
p02923
python
s477870221
s783306383
107
81
14,224
14,252
Accepted
Accepted
24.3
#ABC-139-C N = int(eval(input())) H = list(map(int, input().split())) i = 0 ans = 0 max_ans = 0 while i + 1 <= N-1: if H[i] >= H[i+1]: ans += 1 max_ans = max(max_ans, ans) else: max_ans = max(max_ans, ans) ans = 0 i += 1 print(max_ans)
N = int(eval(input())) H = list(map(int, input().split())) before_H = H[0] ans = 0 tmp = 0 for i in range(1, N): if before_H >= H[i]: tmp += 1 before_H = H[i] else: ans = max(ans, tmp) tmp = 0 before_H = H[i] if tmp > 0: ans = max(ans, tmp) prin...
18
20
294
321
# ABC-139-C N = int(eval(input())) H = list(map(int, input().split())) i = 0 ans = 0 max_ans = 0 while i + 1 <= N - 1: if H[i] >= H[i + 1]: ans += 1 max_ans = max(max_ans, ans) else: max_ans = max(max_ans, ans) ans = 0 i += 1 print(max_ans)
N = int(eval(input())) H = list(map(int, input().split())) before_H = H[0] ans = 0 tmp = 0 for i in range(1, N): if before_H >= H[i]: tmp += 1 before_H = H[i] else: ans = max(ans, tmp) tmp = 0 before_H = H[i] if tmp > 0: ans = max(ans, tmp) print(ans)
false
10
[ "-# ABC-139-C", "-i = 0", "+before_H = H[0]", "-max_ans = 0", "-while i + 1 <= N - 1:", "- if H[i] >= H[i + 1]:", "- ans += 1", "- max_ans = max(max_ans, ans)", "+tmp = 0", "+for i in range(1, N):", "+ if before_H >= H[i]:", "+ tmp += 1", "+ before_H = H[i]"...
false
0.053712
0.034334
1.564389
[ "s477870221", "s783306383" ]
u013629972
p03076
python
s026330768
s508843565
58
43
6,480
5,464
Accepted
Accepted
25.86
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10 ** 20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] d...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10 ** 20 eps = 1.0 / 10**10 mod = 10**9+7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] d...
43
29
1,377
1,027
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI...
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9 + 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)] def LI...
false
32.55814
[ "-v = []", "-for i in range(5):", "- v.append(I())", "-# 全探索?", "-# 1の位が一に一番近いものを求める", "-str_v = [str(i) for i in v]", "-min_first_digit = None", "-for sidx, s in enumerate(str_v):", "- if s[-1] == \"0\":", "- continue", "- if min_first_digit == None:", "- min_first_digi...
false
0.037424
0.035642
1.049984
[ "s026330768", "s508843565" ]
u017415492
p02780
python
s068339700
s703666702
171
125
30,276
25,152
Accepted
Accepted
26.9
from itertools import accumulate N, K = list(map(int, input().split())) C = list(map(int, input().split())) A=[] for i in range(N): A.append((C[i]+1)/2) B = [0] + A B = list(accumulate(B)) ans = [] for i in range(N-K+1): ans.append(B[i+K]-B[i]) print((max(ans)))
import itertools n,k=list(map(int,input().split())) #4317 p=list(map(int,input().split())) def keisan(x): return (k+x)/2 ans=0 zzz=list(itertools.accumulate(p)) zzz.insert(0,0) han=0 for i in range(k,len(zzz)): if han<zzz[i]-zzz[i-k]: han=zzz[i]-zzz[i-k] print((keisan(han)))
13
14
279
288
from itertools import accumulate N, K = list(map(int, input().split())) C = list(map(int, input().split())) A = [] for i in range(N): A.append((C[i] + 1) / 2) B = [0] + A B = list(accumulate(B)) ans = [] for i in range(N - K + 1): ans.append(B[i + K] - B[i]) print((max(ans)))
import itertools n, k = list(map(int, input().split())) # 4317 p = list(map(int, input().split())) def keisan(x): return (k + x) / 2 ans = 0 zzz = list(itertools.accumulate(p)) zzz.insert(0, 0) han = 0 for i in range(k, len(zzz)): if han < zzz[i] - zzz[i - k]: han = zzz[i] - zzz[i - k] print((keisa...
false
7.142857
[ "-from itertools import accumulate", "+import itertools", "-N, K = list(map(int, input().split()))", "-C = list(map(int, input().split()))", "-A = []", "-for i in range(N):", "- A.append((C[i] + 1) / 2)", "-B = [0] + A", "-B = list(accumulate(B))", "-ans = []", "-for i in range(N - K + 1):", ...
false
0.036512
0.03692
0.988973
[ "s068339700", "s703666702" ]
u279605379
p02297
python
s164222526
s589786186
30
20
7,732
7,728
Accepted
Accepted
33.33
n = int(eval(input())) P =[] s = 0 for i in range(n):P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n): a = P[i][0] ; b = P[i][1]; c = P[i+1][0] ; d = P[i+1][1] s += a * d - b * c print((abs(s)*0.5))
n = int(eval(input())) P =[] s = 0 x0,y0 = [int(i) for i in input().split()] for i in range(n-1): x,y = [int(i) for i in input().split()] P.append([x-x0,y-y0]) for i in range(n-2): s += P[i][0]*P[i+1][1] - P[i][1]*P[i+1][0] print((abs(s)*0.5))
9
10
234
256
n = int(eval(input())) P = [] s = 0 for i in range(n): P.append([int(i) for i in input().split()]) P.append(P[0]) for i in range(n): a = P[i][0] b = P[i][1] c = P[i + 1][0] d = P[i + 1][1] s += a * d - b * c print((abs(s) * 0.5))
n = int(eval(input())) P = [] s = 0 x0, y0 = [int(i) for i in input().split()] for i in range(n - 1): x, y = [int(i) for i in input().split()] P.append([x - x0, y - y0]) for i in range(n - 2): s += P[i][0] * P[i + 1][1] - P[i][1] * P[i + 1][0] print((abs(s) * 0.5))
false
10
[ "-for i in range(n):", "- P.append([int(i) for i in input().split()])", "-P.append(P[0])", "-for i in range(n):", "- a = P[i][0]", "- b = P[i][1]", "- c = P[i + 1][0]", "- d = P[i + 1][1]", "- s += a * d - b * c", "+x0, y0 = [int(i) for i in input().split()]", "+for i in range(...
false
0.043057
0.043452
0.990898
[ "s164222526", "s589786186" ]
u576432509
p04045
python
s488470660
s304882673
99
79
3,060
2,940
Accepted
Accepted
20.2
n,k=list(map(int,input().split())) d=list(map(int,input().split())) nmax=100000 for nn in range(n,nmax): ns=list(str(nn)) yn="yes" for nsi in ns: # print(nn,nsi,(nsi in d)) if int(nsi) in d: yn="no" break if yn=="no": continue else: ...
n,k=list(map(int,input().split())) d=set(input().split()) for nn in range(n,10*n+1): if len(set(str(nn)) & d)==0: print(nn) break
19
8
356
156
n, k = list(map(int, input().split())) d = list(map(int, input().split())) nmax = 100000 for nn in range(n, nmax): ns = list(str(nn)) yn = "yes" for nsi in ns: # print(nn,nsi,(nsi in d)) if int(nsi) in d: yn = "no" break if yn == "no": continue ...
n, k = list(map(int, input().split())) d = set(input().split()) for nn in range(n, 10 * n + 1): if len(set(str(nn)) & d) == 0: print(nn) break
false
57.894737
[ "-d = list(map(int, input().split()))", "-nmax = 100000", "-for nn in range(n, nmax):", "- ns = list(str(nn))", "- yn = \"yes\"", "- for nsi in ns:", "- # print(nn,nsi,(nsi in d))", "- if int(nsi) in d:", "- yn = \"no\"", "- break", "- if yn...
false
0.225576
0.118445
1.904484
[ "s488470660", "s304882673" ]
u744920373
p02658
python
s858587268
s228046111
63
55
23,516
23,456
Accepted
Accepted
12.7
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 i 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 i in range(N)] def dp2(ini, i, j): ret...
60
62
1,389
1,462
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 i 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 i in range(N)] de...
false
3.225806
[ "- if ans < (10**18 + 1) / num or ans == 10**18 // num:", "+ # print(ans, 10**18 / num, 10**18//num)", "+ # if ans < (10**18+1) / num or ans == 10**18//num:", "+ if ans <= 10**18 // num:" ]
false
0.039443
0.037828
1.0427
[ "s858587268", "s228046111" ]
u883621917
p03297
python
s237906041
s255096844
77
71
67,960
67,872
Accepted
Accepted
7.79
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) import math for i in range(int(eval(input()))): a, b, c, d = list(map(int, input().split())) if a < b: print('No') conti...
import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) import math for i in range(int(eval(input()))): a, b, c, d = list(map(int, input().split())) if a < b: print('No') conti...
35
37
629
707
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) import math for i in range(int(eval(input()))): a, b, c, d = list(map(int, input().split())) if a < b: print("No") continue if b > d:...
import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) import math for i in range(int(eval(input()))): a, b, c, d = list(map(int, input().split())) if a < b: print("No") continue if b > d:...
false
5.405405
[ "- # _max = (math.ceil((b - r) / g) - 1) * g + r", "- _max = ((b - r + g - 1) // g) * g + r - g", "+ # _max = int(math.ceil((b - r) / g) - 1) * g + r", "+ _max = b + r - g", "+ # _max = ((math.ceil((b - r) / g)) * g) + r - g", "+ # _max = ((b - r + g - 1)//g) * g + r - g" ]
false
0.040647
0.100038
0.406321
[ "s237906041", "s255096844" ]
u028973125
p02909
python
s859128009
s497226391
168
23
38,384
9,096
Accepted
Accepted
86.31
import sys from pprint import pprint def solve(s): w = ["Sunny", "Cloudy", "Rainy"] print((w[(w.index(s) + 1) % 3])) if __name__ == '__main__': s = sys.stdin.readline().strip() solve(s)
import sys S = sys.stdin.readline().strip() weathers = ["Sunny", "Cloudy", "Rainy"] print((weathers[(weathers.index(S) + 1) % 3]))
10
5
210
133
import sys from pprint import pprint def solve(s): w = ["Sunny", "Cloudy", "Rainy"] print((w[(w.index(s) + 1) % 3])) if __name__ == "__main__": s = sys.stdin.readline().strip() solve(s)
import sys S = sys.stdin.readline().strip() weathers = ["Sunny", "Cloudy", "Rainy"] print((weathers[(weathers.index(S) + 1) % 3]))
false
50
[ "-from pprint import pprint", "-", "-def solve(s):", "- w = [\"Sunny\", \"Cloudy\", \"Rainy\"]", "- print((w[(w.index(s) + 1) % 3]))", "-", "-", "-if __name__ == \"__main__\":", "- s = sys.stdin.readline().strip()", "- solve(s)", "+S = sys.stdin.readline().strip()", "+weathers = [\...
false
0.139061
0.038907
3.574154
[ "s859128009", "s497226391" ]
u539367121
p02900
python
s742413451
s662080238
165
88
9,084
9,192
Accepted
Accepted
46.67
import math a,b=list(map(int,input().split())) gcd=math.gcd(a,b) def prime_factorization(n): i=2 prime=[] while i*i<=n and n>1: if n%i: i+=1 else: n//=i prime.append(i) while n%i==0: n//=i if n>1: prime.append(n) return prime print((len(prime_fa...
import math a,b=list(map(int,input().split())) gcd=math.gcd(a,b) def prime_factorization(n): i=2 prime=[] if n%i==0: n//=i prime.append(2) while n%i==0: n//=i i+=1 while i*i<=n: if n%i: i+=2 else: n//=i prime.append(i) while n%i==0: ...
21
26
367
411
import math a, b = list(map(int, input().split())) gcd = math.gcd(a, b) def prime_factorization(n): i = 2 prime = [] while i * i <= n and n > 1: if n % i: i += 1 else: n //= i prime.append(i) while n % i == 0: n //= i if ...
import math a, b = list(map(int, input().split())) gcd = math.gcd(a, b) def prime_factorization(n): i = 2 prime = [] if n % i == 0: n //= i prime.append(2) while n % i == 0: n //= i i += 1 while i * i <= n: if n % i: i += 2 else: ...
false
19.230769
[ "- while i * i <= n and n > 1:", "+ if n % i == 0:", "+ n //= i", "+ prime.append(2)", "+ while n % i == 0:", "+ n //= i", "+ i += 1", "+ while i * i <= n:", "- i += 1", "+ i += 2", "-# print(prime_factorization(gcd))" ]
false
0.036514
0.056885
0.641901
[ "s742413451", "s662080238" ]
u514493433
p02682
python
s085380360
s248878683
61
22
61,804
9,204
Accepted
Accepted
63.93
A, B, C, K = list(map(int, input().split())) sum=0 if A>K: sum += K K = 0 else: sum += A K = K-A if B>K: K = 0 else: K = K-B if C>K: sum -= K K = 0 else: sum -= C K = K-C print(sum)
A, B, C, K = list(map(int, input().split())) sum = 0 X_a = min(A,K) sum += X_a K -= X_a X_b = min(B,K) K -= X_b X_c = min(C,K) sum -= X_c print(sum)
24
15
243
161
A, B, C, K = list(map(int, input().split())) sum = 0 if A > K: sum += K K = 0 else: sum += A K = K - A if B > K: K = 0 else: K = K - B if C > K: sum -= K K = 0 else: sum -= C K = K - C print(sum)
A, B, C, K = list(map(int, input().split())) sum = 0 X_a = min(A, K) sum += X_a K -= X_a X_b = min(B, K) K -= X_b X_c = min(C, K) sum -= X_c print(sum)
false
37.5
[ "-if A > K:", "- sum += K", "- K = 0", "-else:", "- sum += A", "- K = K - A", "-if B > K:", "- K = 0", "-else:", "- K = K - B", "-if C > K:", "- sum -= K", "- K = 0", "-else:", "- sum -= C", "- K = K - C", "+X_a = min(A, K)", "+sum += X_a", "+K -= X_...
false
0.055589
0.067029
0.829331
[ "s085380360", "s248878683" ]
u020604402
p03999
python
s296943238
s365116502
27
20
3,188
3,060
Accepted
Accepted
25.93
S = eval(input()) n = len(S) if n == 1: print(S) quit() import itertools as it def sum_insert(x,S): z = list(zip(S,x)) L = [] for x in z: L.append(x[0]) if x[1] == '1': L.append('+') L.append(S[-1]) s = ''.join(L) return eval(s) ans = 0 varia...
S = eval(input()) cand = [0 for _ in range(2 **(len(S) - 1))] for i in range(2 ** (len(S) - 1)): now = 0 tmp = [] for k in range(len(S) - 1): if i & (1 << k): tmp.append(S[now:k + 1]) now = k + 1 tmp.append(S[now:]) for x in tmp: if x == '': ...
26
16
461
393
S = eval(input()) n = len(S) if n == 1: print(S) quit() import itertools as it def sum_insert(x, S): z = list(zip(S, x)) L = [] for x in z: L.append(x[0]) if x[1] == "1": L.append("+") L.append(S[-1]) s = "".join(L) return eval(s) ans = 0 variation = [] fo...
S = eval(input()) cand = [0 for _ in range(2 ** (len(S) - 1))] for i in range(2 ** (len(S) - 1)): now = 0 tmp = [] for k in range(len(S) - 1): if i & (1 << k): tmp.append(S[now : k + 1]) now = k + 1 tmp.append(S[now:]) for x in tmp: if x == "": con...
false
38.461538
[ "-n = len(S)", "-if n == 1:", "- print(S)", "- quit()", "-import itertools as it", "-", "-", "-def sum_insert(x, S):", "- z = list(zip(S, x))", "- L = []", "- for x in z:", "- L.append(x[0])", "- if x[1] == \"1\":", "- L.append(\"+\")", "- L.app...
false
0.111532
0.037234
2.995458
[ "s296943238", "s365116502" ]
u562935282
p03054
python
s016320237
s331161124
133
117
4,024
4,024
Accepted
Accepted
12.03
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == 'U': d = min(d + 1, h - 1) if tt == 'D': u...
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == 'U': d = min(d + 1, h - 1) el...
34
42
764
886
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == "U": d = min(d + 1, h - 1) if tt == "D": ...
def main(): h, w, n = list(map(int, input().split())) y, x = list(map(int, input().split())) y -= 1 x -= 1 s, t = eval(input()), eval(input()) u, d, l, r = 0, h - 1, 0, w - 1 for ss, tt in zip(s[::-1], t[::-1]): if tt == "U": d = min(d + 1, h - 1) elif tt == "D": ...
false
19.047619
[ "- if tt == \"D\":", "+ elif tt == \"D\":", "- if tt == \"L\":", "+ elif tt == \"L\":", "- if tt == \"R\":", "- l = max(l - 1, 0)", "+ else:", "+ l = max(l - 1, 0) # tt == 'R'", "- if ss == \"D\":", "+ elif ss == \"D\":...
false
0.069417
0.066835
1.038646
[ "s016320237", "s331161124" ]
u888092736
p03593
python
s934861144
s787988271
35
32
9,472
9,480
Accepted
Accepted
8.57
from collections import Counter def solve(): YES, NO = "Yes", "No" if H % 2 and W % 2: if rems[1] == 0 and rems[3] == 1: rems[1] += 1 rems[2] += 1 rems[3] = 0 if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2: return NO ...
from collections import Counter H, W = map(int, input().split()) cntr = Counter() [cntr.update(Counter(input())) for _ in range(H)] if H % 2 and W % 2: has_one = False twos = 0 for v in cntr.values(): if v % 2: if has_one: print("No") exit()...
33
33
809
876
from collections import Counter def solve(): YES, NO = "Yes", "No" if H % 2 and W % 2: if rems[1] == 0 and rems[3] == 1: rems[1] += 1 rems[2] += 1 rems[3] = 0 if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2: return NO else: ...
from collections import Counter H, W = map(int, input().split()) cntr = Counter() [cntr.update(Counter(input())) for _ in range(H)] if H % 2 and W % 2: has_one = False twos = 0 for v in cntr.values(): if v % 2: if has_one: print("No") exit() e...
false
0
[ "-", "-def solve():", "- YES, NO = \"Yes\", \"No\"", "- if H % 2 and W % 2:", "- if rems[1] == 0 and rems[3] == 1:", "- rems[1] += 1", "- rems[2] += 1", "- rems[3] = 0", "- if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2:", "- ...
false
0.046685
0.091165
0.512099
[ "s934861144", "s787988271" ]
u588794534
p02844
python
s171962400
s635001815
273
241
42,176
41,836
Accepted
Accepted
11.72
from collections import Counter x=int(eval(input())) n=str(eval(input())) #print(countN) #abc aaa=set([]) result=0 for i in range(x-2): a=n[i] if a not in aaa: aaa.add(a) bbb=set([]) for j in range(i+1,x-1): b=n[j] if b not in bbb: ...
from collections import Counter x=int(eval(input())) n=str(eval(input())) #print(countN) #abc aaa=set([]) result=0 for i in range(x-2): a=n[i] if a not in aaa: aaa.add(a) bbb=set([]) for j in range(i+1,x-1): b=n[j] if b not in bbb: ...
37
42
624
768
from collections import Counter x = int(eval(input())) n = str(eval(input())) # print(countN) # abc aaa = set([]) result = 0 for i in range(x - 2): a = n[i] if a not in aaa: aaa.add(a) bbb = set([]) for j in range(i + 1, x - 1): b = n[j] if b not in bbb: ...
from collections import Counter x = int(eval(input())) n = str(eval(input())) # print(countN) # abc aaa = set([]) result = 0 for i in range(x - 2): a = n[i] if a not in aaa: aaa.add(a) bbb = set([]) for j in range(i + 1, x - 1): b = n[j] if b not in bbb: ...
false
11.904762
[ "+ if len(ccc) == 10:", "+ break", "+ if len(bbb) == 10:", "+ break" ]
false
0.04396
0.04376
1.004564
[ "s171962400", "s635001815" ]