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
u440566786
p03183
python
s716943254
s245428440
491
274
135,560
41,072
Accepted
Accepted
44.2
import sys sys.setrecursionlimit(2147483647) INF=float("inf") MOD=10**9+7 input=lambda :sys.stdin.readline().rstrip() def resolve(): from functools import cmp_to_key n=int(eval(input())) B=[list(map(int,input().split())) for _ in range(n)] def cmp(a,b): va=min(a[1],b[1]-a[0]) ...
import sys sys.setrecursionlimit(2147483647) INF = 1 << 60 MOD = 10**9 + 7 # 998244353 input = lambda:sys.stdin.readline().rstrip() def resolve(): n = int(eval(input())) WSV = [tuple(map(int, input().split())) for _ in range(n)] WSV.sort(key = lambda tup:tup[0] + tup[1]) # dp[i][w] : i 番目まで...
27
32
743
893
import sys sys.setrecursionlimit(2147483647) INF = float("inf") MOD = 10**9 + 7 input = lambda: sys.stdin.readline().rstrip() def resolve(): from functools import cmp_to_key n = int(eval(input())) B = [list(map(int, input().split())) for _ in range(n)] def cmp(a, b): va = min(a[1], b[1] - a...
import sys sys.setrecursionlimit(2147483647) INF = 1 << 60 MOD = 10**9 + 7 # 998244353 input = lambda: sys.stdin.readline().rstrip() def resolve(): n = int(eval(input())) WSV = [tuple(map(int, input().split())) for _ in range(n)] WSV.sort(key=lambda tup: tup[0] + tup[1]) # dp[i][w] : i 番目まで見て、total ...
false
15.625
[ "-INF = float(\"inf\")", "-MOD = 10**9 + 7", "+INF = 1 << 60", "+MOD = 10**9 + 7 # 998244353", "- from functools import cmp_to_key", "-", "- B = [list(map(int, input().split())) for _ in range(n)]", "-", "- def cmp(a, b):", "- va = min(a[1], b[1] - a[0])", "- vb = min(b[1...
false
0.091759
0.116998
0.784282
[ "s716943254", "s245428440" ]
u112364985
p02682
python
s001271131
s318923958
60
23
61,772
9,040
Accepted
Accepted
61.67
a,b,c,k=list(map(int,input().split())) if a>=k: print(k) else: if a+b>=k: print(a) else: if a+b+c>=k: print((a-(k-(a+b))))
a,b,c,k=list(map(int,input().split())) if a>=k: print(k) elif a+b>=k: print(a) else: print((a-(k-(a+b))))
9
7
162
115
a, b, c, k = list(map(int, input().split())) if a >= k: print(k) else: if a + b >= k: print(a) else: if a + b + c >= k: print((a - (k - (a + b))))
a, b, c, k = list(map(int, input().split())) if a >= k: print(k) elif a + b >= k: print(a) else: print((a - (k - (a + b))))
false
22.222222
[ "+elif a + b >= k:", "+ print(a)", "- if a + b >= k:", "- print(a)", "- else:", "- if a + b + c >= k:", "- print((a - (k - (a + b))))", "+ print((a - (k - (a + b))))" ]
false
0.093449
0.137697
0.678656
[ "s001271131", "s318923958" ]
u901447859
p03012
python
s065489232
s385393789
20
18
3,060
2,940
Accepted
Accepted
10
n,*w=list(map(int,open(0).read().split())) min_val=None for i in range(n-1): y=abs(sum(w[:i+1]) - sum(w[i+1:])) if min_val is None or y < min_val: min_val = y print(min_val)
n,*w=list(map(int,open(0).read().split())) min_val=float('inf') for i in range(n-1): y=abs(sum(w[:i+1]) - sum(w[i+1:])) min_val = min(min_val, y) print(min_val)
8
7
183
165
n, *w = list(map(int, open(0).read().split())) min_val = None for i in range(n - 1): y = abs(sum(w[: i + 1]) - sum(w[i + 1 :])) if min_val is None or y < min_val: min_val = y print(min_val)
n, *w = list(map(int, open(0).read().split())) min_val = float("inf") for i in range(n - 1): y = abs(sum(w[: i + 1]) - sum(w[i + 1 :])) min_val = min(min_val, y) print(min_val)
false
12.5
[ "-min_val = None", "+min_val = float(\"inf\")", "- if min_val is None or y < min_val:", "- min_val = y", "+ min_val = min(min_val, y)" ]
false
0.034499
0.036263
0.951371
[ "s065489232", "s385393789" ]
u347640436
p03426
python
s655878908
s425713372
571
397
35,428
40,212
Accepted
Accepted
30.47
H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] d = {} for y in range(H): for x in range(W): d[A[y][x]] = (y, x) t = [[0] * (H * W // D + 1) for _ in range(D)] for i in range(D): ti = t[i] j = 0 if i == 0: j = 1 while ...
H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] d = {} for y in range(H): for x in range(W): d[A[y][x]] = (y, x) t = [[0] * (H * W // D + 1) for _ in range(D)] for i in range(D): j = 0 if i == 0: j = 1 while i + (j + 1) * D...
29
29
742
760
H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] d = {} for y in range(H): for x in range(W): d[A[y][x]] = (y, x) t = [[0] * (H * W // D + 1) for _ in range(D)] for i in range(D): ti = t[i] j = 0 if i == 0: j = 1 while i + (j + 1) * D ...
H, W, D = list(map(int, input().split())) A = [list(map(int, input().split())) for _ in range(H)] d = {} for y in range(H): for x in range(W): d[A[y][x]] = (y, x) t = [[0] * (H * W // D + 1) for _ in range(D)] for i in range(D): j = 0 if i == 0: j = 1 while i + (j + 1) * D <= H * W: ...
false
0
[ "- ti = t[i]", "- ti[j + 1] = abs(y1 - y2) + abs(x1 - x2)", "+ t[i][j + 1] = abs(y1 - y2) + abs(x1 - x2)", "- ti[j + 1] += ti[j]", "+ t[i][j + 1] += t[i][j]", "+# print(*result, sep='\\n')" ]
false
0.035522
0.035814
0.991845
[ "s655878908", "s425713372" ]
u459639226
p03127
python
s235580174
s328083359
94
81
14,252
16,276
Accepted
Accepted
13.83
N = int(eval(input())) A = list(map(int, input().split())) ans = min(A) while True: for i in range(len(A)): if A[i] % ans != 0: A[i] %= ans if min(A) < ans: ans = min(A) else: break print(ans)
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) N = int(eval(input())) A = list(map(int, input().split())) print((gcd_list(A)))
12
10
246
195
N = int(eval(input())) A = list(map(int, input().split())) ans = min(A) while True: for i in range(len(A)): if A[i] % ans != 0: A[i] %= ans if min(A) < ans: ans = min(A) else: break print(ans)
import fractions from functools import reduce def gcd_list(numbers): return reduce(fractions.gcd, numbers) N = int(eval(input())) A = list(map(int, input().split())) print((gcd_list(A)))
false
16.666667
[ "+import fractions", "+from functools import reduce", "+", "+", "+def gcd_list(numbers):", "+ return reduce(fractions.gcd, numbers)", "+", "+", "-ans = min(A)", "-while True:", "- for i in range(len(A)):", "- if A[i] % ans != 0:", "- A[i] %= ans", "- if min(A) < ...
false
0.036301
0.060036
0.604652
[ "s235580174", "s328083359" ]
u223646582
p03464
python
s183141020
s467408604
162
107
14,252
20,092
Accepted
Accepted
33.95
import math K = int(eval(input())) A = [int(i) for i in input().split()][::-1] if A[0] != 2: print((-1)) exit() ans_low = 2 ans_high = 3 for i in range(1, K): next_ans_high = ((ans_high//A[i])+1)*A[i]-1 next_ans_low = math.ceil(ans_low/A[i])*A[i] if (next_ans_high // A[i])*A[i] > ...
K = int(eval(input())) A = [int(i) for i in input().split()][::-1] cb, cu = 2, 2 for a in A: nb = ((cb+a-1)//a)*a nu = (cu//a+1)*a-1 if nb > cu: print((-1)) exit() cb, cu = nb, nu print((nb, nu))
25
12
517
230
import math K = int(eval(input())) A = [int(i) for i in input().split()][::-1] if A[0] != 2: print((-1)) exit() ans_low = 2 ans_high = 3 for i in range(1, K): next_ans_high = ((ans_high // A[i]) + 1) * A[i] - 1 next_ans_low = math.ceil(ans_low / A[i]) * A[i] if (next_ans_high // A[i]) * A[i] > ans_...
K = int(eval(input())) A = [int(i) for i in input().split()][::-1] cb, cu = 2, 2 for a in A: nb = ((cb + a - 1) // a) * a nu = (cu // a + 1) * a - 1 if nb > cu: print((-1)) exit() cb, cu = nb, nu print((nb, nu))
false
52
[ "-import math", "-", "-if A[0] != 2:", "- print((-1))", "- exit()", "-ans_low = 2", "-ans_high = 3", "-for i in range(1, K):", "- next_ans_high = ((ans_high // A[i]) + 1) * A[i] - 1", "- next_ans_low = math.ceil(ans_low / A[i]) * A[i]", "- if (next_ans_high // A[i]) * A[i] > ans_h...
false
0.03689
0.054835
0.67274
[ "s183141020", "s467408604" ]
u945181840
p02850
python
s951333310
s009870215
402
261
46,992
25,900
Accepted
Accepted
35.07
import sys from collections import deque read = sys.stdin.read N, *ab = list(map(int, read().split())) graph = [[] for _ in range(N + 1)] for a, b in zip(*[iter(ab)] * 2): graph[a].append(b) color = [0] * (N + 1) queue = deque([1]) color_v = [set() for _ in range(N + 1)] while queue: V = queu...
import sys from collections import deque read = sys.stdin.read N, *ab = list(map(int, read().split())) graph = [[] for _ in range(N + 1)] for a, b in zip(*[iter(ab)] * 2): graph[a].append(b) color = [0] * (N + 1) queue = deque([1]) while queue: V = queue.popleft() number = 1 for v in...
29
26
638
531
import sys from collections import deque read = sys.stdin.read N, *ab = list(map(int, read().split())) graph = [[] for _ in range(N + 1)] for a, b in zip(*[iter(ab)] * 2): graph[a].append(b) color = [0] * (N + 1) queue = deque([1]) color_v = [set() for _ in range(N + 1)] while queue: V = queue.popleft() nu...
import sys from collections import deque read = sys.stdin.read N, *ab = list(map(int, read().split())) graph = [[] for _ in range(N + 1)] for a, b in zip(*[iter(ab)] * 2): graph[a].append(b) color = [0] * (N + 1) queue = deque([1]) while queue: V = queue.popleft() number = 1 for v in graph[V]: ...
false
10.344828
[ "-color_v = [set() for _ in range(N + 1)]", "- if number in color_v[V]:", "+ if number == color[V]:", "- color_v[V].add(number)", "- color_v[v].add(number)" ]
false
0.058538
0.057192
1.023527
[ "s951333310", "s009870215" ]
u391066416
p02729
python
s328738617
s843626860
19
17
3,060
2,940
Accepted
Accepted
10.53
N,M=list(map(int,input().split())) print((int(1/2*N*(N-1)+1/2*M*(M-1))))
N,M=list(map(int,input().split())) print((N*(N-1)//2+M*(M-1)//2))
2
2
65
58
N, M = list(map(int, input().split())) print((int(1 / 2 * N * (N - 1) + 1 / 2 * M * (M - 1))))
N, M = list(map(int, input().split())) print((N * (N - 1) // 2 + M * (M - 1) // 2))
false
0
[ "-print((int(1 / 2 * N * (N - 1) + 1 / 2 * M * (M - 1))))", "+print((N * (N - 1) // 2 + M * (M - 1) // 2))" ]
false
0.041346
0.093238
0.443441
[ "s328738617", "s843626860" ]
u535423069
p03274
python
s762223385
s221685067
230
97
58,736
14,840
Accepted
Accepted
57.83
import sys stdin = sys.stdin mod = 1000000007 inf = 1 << 60 ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() nas = lambda: stdin.readline().split() n, k = na() x = na() ans = inf for i in range(n): if i + k - 1 < n: ...
import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y: [nf() for _ in range...
22
37
430
956
import sys stdin = sys.stdin mod = 1000000007 inf = 1 << 60 ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() nas = lambda: stdin.readline().split() n, k = na() x = na() ans = inf for i in range(n): if i + k - 1 < n: l, r = x[i], x[i + k - 1...
import sys stdin = sys.stdin inf = 1 << 60 mod = 1000000007 ni = lambda: int(ns()) nin = lambda y: [ni() for _ in range(y)] na = lambda: list(map(int, stdin.readline().split())) nan = lambda y: [na() for _ in range(y)] nf = lambda: float(ns()) nfn = lambda y: [nf() for _ in range(y)] nfa = lambda: list(map(float, stdi...
false
40.540541
[ "+inf = 1 << 60", "-inf = 1 << 60", "+nin = lambda y: [ni() for _ in range(y)]", "+nan = lambda y: [na() for _ in range(y)]", "+nf = lambda: float(ns())", "+nfn = lambda y: [nf() for _ in range(y)]", "+nfa = lambda: list(map(float, stdin.readline().split()))", "+nfan = lambda y: [nfa() for _ in range(...
false
0.165377
0.047985
3.446453
[ "s762223385", "s221685067" ]
u260980560
p00907
python
s720684662
s871793891
390
280
6,400
5,680
Accepted
Accepted
28.21
while 1: d = eval(input()) if d==0: break V = [float(input()) for i in range(d+3)] a = [0]*(d+3) cnts = [0]*(d+3) import itertools for K in itertools.combinations(list(range(d+3)), d+1): for k in K: res = 1 for j in K: if ...
from itertools import combinations def build(X, Y): A = [] for x in X: res = 1 for xi in X: if x == xi: continue res *= x - xi A.append(Y[x] / res) return A def calc(X, A, x): base = 1 for xi in X: base *= i - ...
28
43
755
873
while 1: d = eval(input()) if d == 0: break V = [float(input()) for i in range(d + 3)] a = [0] * (d + 3) cnts = [0] * (d + 3) import itertools for K in itertools.combinations(list(range(d + 3)), d + 1): for k in K: res = 1 for j in K: ...
from itertools import combinations def build(X, Y): A = [] for x in X: res = 1 for xi in X: if x == xi: continue res *= x - xi A.append(Y[x] / res) return A def calc(X, A, x): base = 1 for xi in X: base *= i - xi return ...
false
34.883721
[ "+from itertools import combinations", "+", "+", "+def build(X, Y):", "+ A = []", "+ for x in X:", "+ res = 1", "+ for xi in X:", "+ if x == xi:", "+ continue", "+ res *= x - xi", "+ A.append(Y[x] / res)", "+ return A", "+"...
false
0.1064
0.111929
0.950603
[ "s720684662", "s871793891" ]
u971091945
p02572
python
s968223633
s772987112
148
127
31,428
31,520
Accepted
Accepted
14.19
n = int(eval(input())) a = list(map(int, input().split())) su = sum(a) ans = 0 for i in range(n-1): su -= a[i] ans += (a[i]*su) ans %= 10**9+7 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) su = sum(a) ans = 0 for i in range(n-1): su -= a[i] ans += (a[i]*su) print((ans%(10**9+7)))
12
10
173
161
n = int(eval(input())) a = list(map(int, input().split())) su = sum(a) ans = 0 for i in range(n - 1): su -= a[i] ans += a[i] * su ans %= 10**9 + 7 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) su = sum(a) ans = 0 for i in range(n - 1): su -= a[i] ans += a[i] * su print((ans % (10**9 + 7)))
false
16.666667
[ "- ans %= 10**9 + 7", "-print(ans)", "+print((ans % (10**9 + 7)))" ]
false
0.041268
0.041702
0.989586
[ "s968223633", "s772987112" ]
u401487574
p02892
python
s929971612
s570957696
100
91
74,052
68,992
Accepted
Accepted
9
ma = lambda :map(int,input().split()) lma = lambda :list(map(int,input().split())) tma = lambda :tuple(map(int,input().split())) ni = lambda:int(input()) yn = lambda fl:print("Yes") if fl else print("No") import collections import math import itertools import heapq as hq n = ni() g = [[] for i in range(n)] ...
import collections n = int(eval(input())) g = [[] for i in range(n)] for i in range(n): S =eval(input()) for j in range(i+1,n): if S[j]=="1": g[i].append(j) g[j].append(i) def bfs(s): vis = [False]*n cnts=[0]*n que = collections.deque() cnt=1 q...
63
34
1,521
783
ma = lambda: map(int, input().split()) lma = lambda: list(map(int, input().split())) tma = lambda: tuple(map(int, input().split())) ni = lambda: int(input()) yn = lambda fl: print("Yes") if fl else print("No") import collections import math import itertools import heapq as hq n = ni() g = [[] for i in range(n)] for i ...
import collections n = int(eval(input())) g = [[] for i in range(n)] for i in range(n): S = eval(input()) for j in range(i + 1, n): if S[j] == "1": g[i].append(j) g[j].append(i) def bfs(s): vis = [False] * n cnts = [0] * n que = collections.deque() cnt = 1 ...
false
46.031746
[ "-ma = lambda: map(int, input().split())", "-lma = lambda: list(map(int, input().split()))", "-tma = lambda: tuple(map(int, input().split()))", "-ni = lambda: int(input())", "-yn = lambda fl: print(\"Yes\") if fl else print(\"No\")", "-import math", "-import itertools", "-import heapq as hq", "-n = ...
false
0.045328
0.152608
0.297026
[ "s929971612", "s570957696" ]
u498487134
p02833
python
s580865735
s263465436
209
66
38,384
62,124
Accepted
Accepted
68.42
N = int(eval(input())) ans=0 if N%2==1: print(ans) else: for i in range(1,40): a = 2*pow(5,i) ans+=(N//a) print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod=10**9+7 N=I() if N%2==1: print((0)) exit() ans=0 for i in range(1,100...
10
26
156
408
N = int(eval(input())) ans = 0 if N % 2 == 1: print(ans) else: for i in range(1, 40): a = 2 * pow(5, i) ans += N // a print(ans)
import sys input = sys.stdin.readline def I(): return int(eval(input())) def MI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) def main(): mod = 10**9 + 7 N = I() if N % 2 == 1: print((0)) exit() ans = 0 for i in range(...
false
61.538462
[ "-N = int(eval(input()))", "-ans = 0", "-if N % 2 == 1:", "- print(ans)", "-else:", "- for i in range(1, 40):", "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "+def I():", "+ return int(eval(input()))", "+", "+", "+def MI():", "+ return list(map(int, input()...
false
0.038241
0.046732
0.818295
[ "s580865735", "s263465436" ]
u761529120
p03426
python
s915306282
s172735456
1,106
388
57,692
56,536
Accepted
Accepted
64.92
def main(): H, W, D = list(map(int, input().split())) field = [list(map(int, input().split())) for _ in range(H)] c = [0] * (H * W) for i in range(H): for j in range(W): c[field[i][j] - 1] = (i, j) d = [0] * (H * W) for l in range(H * W - D): i, j = c...
import sys input = sys.stdin.readline def main(): H, W, D = list(map(int, input().split())) A = list(list(map(int, input().split())) for _ in range(H)) Q = int(eval(input())) B = [(0,0)] * (H * W + 5) for h in range(H): for w in range(W): B[A[h][w]] = (h+1, w+1) ...
22
27
527
651
def main(): H, W, D = list(map(int, input().split())) field = [list(map(int, input().split())) for _ in range(H)] c = [0] * (H * W) for i in range(H): for j in range(W): c[field[i][j] - 1] = (i, j) d = [0] * (H * W) for l in range(H * W - D): i, j = c[l] x, y ...
import sys input = sys.stdin.readline def main(): H, W, D = list(map(int, input().split())) A = list(list(map(int, input().split())) for _ in range(H)) Q = int(eval(input())) B = [(0, 0)] * (H * W + 5) for h in range(H): for w in range(W): B[A[h][w]] = (h + 1, w + 1) C = [...
false
18.518519
[ "+import sys", "+", "+input = sys.stdin.readline", "+", "+", "- field = [list(map(int, input().split())) for _ in range(H)]", "- c = [0] * (H * W)", "- for i in range(H):", "- for j in range(W):", "- c[field[i][j] - 1] = (i, j)", "- d = [0] * (H * W)", "- for l...
false
0.034361
0.057804
0.594439
[ "s915306282", "s172735456" ]
u790710233
p03240
python
s018822666
s306179279
540
27
3,064
3,064
Accepted
Accepted
95
n = int(eval(input())) dots = [] for _ in range(n): x, y, h = list(map(int, input().split())) dots.append((x, y, h)) x_, y_, h_ = sorted(dots, key=lambda x: x[2], reverse=True)[1] for cx in range(101): for cy in range(101): H = h_+abs(x_ - cx) + abs(y_ - cy) ans = [] ...
n = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(n)] x_, y_, h_ = sorted(xyh, key=lambda x: x[2], reverse=True)[1] for cx in range(101): for cy in range(101): H = h_+abs(x_ - cx) + abs(y_ - cy) for x, y, h in xyh: if max(H - abs(x-cx)-abs(y-cy), 0) !=...
21
13
502
405
n = int(eval(input())) dots = [] for _ in range(n): x, y, h = list(map(int, input().split())) dots.append((x, y, h)) x_, y_, h_ = sorted(dots, key=lambda x: x[2], reverse=True)[1] for cx in range(101): for cy in range(101): H = h_ + abs(x_ - cx) + abs(y_ - cy) ans = [] for x, y, h in...
n = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(n)] x_, y_, h_ = sorted(xyh, key=lambda x: x[2], reverse=True)[1] for cx in range(101): for cy in range(101): H = h_ + abs(x_ - cx) + abs(y_ - cy) for x, y, h in xyh: if max(H - abs(x - cx) - abs(y - cy), 0) != ...
false
38.095238
[ "-dots = []", "-for _ in range(n):", "- x, y, h = list(map(int, input().split()))", "- dots.append((x, y, h))", "-x_, y_, h_ = sorted(dots, key=lambda x: x[2], reverse=True)[1]", "+xyh = [list(map(int, input().split())) for _ in range(n)]", "+x_, y_, h_ = sorted(xyh, key=lambda x: x[2], reverse=Tr...
false
0.16027
0.03678
4.357596
[ "s018822666", "s306179279" ]
u251515715
p03309
python
s352728407
s949389970
718
324
137,088
104,092
Accepted
Accepted
54.87
n=int(eval(input())) a=list(map(int,input().split())) b_low=-1*(10**10) b_high=10**10 b_low_d=sum([abs(a[i]-(b_low+2+i)) for i in range(n)])-sum([abs(a[i]-(b_low+1+i)) for i in range(n)]) b_high_d=sum([abs(a[i]-(b_high+2+i)) for i in range(n)])-sum([abs(a[i]-(b_high+1+i)) for i in range(n)]) while b_high-b_lo...
n=int(eval(input())) a=list(map(int,input().split())) arr=sorted([a[i]-i-1 for i in range(n)]) if len(arr)%2==0: tmp=[arr[len(arr)//2-1],arr[len(arr)//2]] else: tmp=[arr[len(arr)//2]] ans=10**20 for b in tmp: ans=min(ans,sum([abs(a[i]-b-i-1) for i in range(n)])) print(ans)
21
14
630
289
n = int(eval(input())) a = list(map(int, input().split())) b_low = -1 * (10**10) b_high = 10**10 b_low_d = sum([abs(a[i] - (b_low + 2 + i)) for i in range(n)]) - sum( [abs(a[i] - (b_low + 1 + i)) for i in range(n)] ) b_high_d = sum([abs(a[i] - (b_high + 2 + i)) for i in range(n)]) - sum( [abs(a[i] - (b_high + 1...
n = int(eval(input())) a = list(map(int, input().split())) arr = sorted([a[i] - i - 1 for i in range(n)]) if len(arr) % 2 == 0: tmp = [arr[len(arr) // 2 - 1], arr[len(arr) // 2]] else: tmp = [arr[len(arr) // 2]] ans = 10**20 for b in tmp: ans = min(ans, sum([abs(a[i] - b - i - 1) for i in range(n)])) print(...
false
33.333333
[ "-b_low = -1 * (10**10)", "-b_high = 10**10", "-b_low_d = sum([abs(a[i] - (b_low + 2 + i)) for i in range(n)]) - sum(", "- [abs(a[i] - (b_low + 1 + i)) for i in range(n)]", "-)", "-b_high_d = sum([abs(a[i] - (b_high + 2 + i)) for i in range(n)]) - sum(", "- [abs(a[i] - (b_high + 1 + i)) for i in r...
false
0.04041
0.057916
0.697735
[ "s352728407", "s949389970" ]
u102461423
p02644
python
s078966519
s318409482
1,277
862
224,916
145,144
Accepted
Accepted
32.5
import sys import numpy as np from numba import njit from heapq import heappop, heappush read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit('(b1[:],i8,i8,i8,i8,i8)', cache=True) def main(C, H, W, S, T, K): INF = 10**18 N = H * W q = ...
import sys import numpy as np from heapq import heappop, heappush read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(C, H, W, S, T, K): INF = 10**18 N = H * W q = [5 * S] dist = np.full((5 * N), INF, np.int64) dist[5 * S] ...
66
72
1,816
1,956
import sys import numpy as np from numba import njit from heapq import heappop, heappush read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit("(b1[:],i8,i8,i8,i8,i8)", cache=True) def main(C, H, W, S, T, K): INF = 10**18 N = H * W q = [5 * S] ...
import sys import numpy as np from heapq import heappop, heappush read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def main(C, H, W, S, T, K): INF = 10**18 N = H * W q = [5 * S] dist = np.full((5 * N), INF, np.int64) dist[5 * S] = 0 move...
false
8.333333
[ "-from numba import njit", "-@njit(\"(b1[:],i8,i8,i8,i8,i8)\", cache=True)", "+if sys.argv[-1] == \"ONLINE_JUDGE\":", "+ from numba.pycc import CC", "+", "+ cc = CC(\"my_module\")", "+ cc.export(\"main\", \"(b1[:],i8,i8,i8,i8,i8)\")(main)", "+ cc.compile()", "+ exit()", "+from my_mo...
false
0.308141
0.318105
0.968678
[ "s078966519", "s318409482" ]
u075012704
p03007
python
s152988788
s577562504
284
199
23,208
25,200
Accepted
Accepted
29.93
N = int(eval(input())) A = sorted(list(map(int, input().split()))) M = A[-1] m = A[0] ans = [] for i, a in enumerate(A[1:-1]): if a > 0: ans.append([m, a]) m -= a else: ans.append([M, a]) M -= a print((M - m)) ans.append([M, m]) for a1, a2 in ans: print((...
from collections import deque N = int(eval(input())) A = deque(sorted(list(map(int, input().split())))) MAX, MIN = A.pop(), A.popleft() ans = [] while len(A): if A[0] < 0: x, y = MAX, A.popleft() ans.append([MAX, y]) MAX = MAX - y else: x, y = MIN, A.popleft() ...
19
20
319
438
N = int(eval(input())) A = sorted(list(map(int, input().split()))) M = A[-1] m = A[0] ans = [] for i, a in enumerate(A[1:-1]): if a > 0: ans.append([m, a]) m -= a else: ans.append([M, a]) M -= a print((M - m)) ans.append([M, m]) for a1, a2 in ans: print((a1, a2))
from collections import deque N = int(eval(input())) A = deque(sorted(list(map(int, input().split())))) MAX, MIN = A.pop(), A.popleft() ans = [] while len(A): if A[0] < 0: x, y = MAX, A.popleft() ans.append([MAX, y]) MAX = MAX - y else: x, y = MIN, A.popleft() ans.append...
false
5
[ "+from collections import deque", "+", "-A = sorted(list(map(int, input().split())))", "-M = A[-1]", "-m = A[0]", "+A = deque(sorted(list(map(int, input().split()))))", "+MAX, MIN = A.pop(), A.popleft()", "-for i, a in enumerate(A[1:-1]):", "- if a > 0:", "- ans.append([m, a])", "- ...
false
0.077
0.055733
1.381579
[ "s152988788", "s577562504" ]
u540631540
p02953
python
s159265857
s433091635
127
73
14,252
14,252
Accepted
Accepted
42.52
n = int(eval(input())) h = [int(i) for i in input().split()] x = True c = 0 for i in range(n): if i > 0 and h[i - 1] - h[i] >= 2: x = False break elif i > 0 and h[i - 1] - h[i] == 1: c += 1 elif i > 0 and h[i] > h[i - 1] and c == 1: c = 0 if c == 2: x...
n = int(eval(input())) h = [int(i) for i in input().split()] for i in range(n - 1, 0, -1): d = h[i - 1] - h[i] if d > 1: print("No") break if d == 1: h[i - 1] -= 1 else: print("Yes")
19
11
386
226
n = int(eval(input())) h = [int(i) for i in input().split()] x = True c = 0 for i in range(n): if i > 0 and h[i - 1] - h[i] >= 2: x = False break elif i > 0 and h[i - 1] - h[i] == 1: c += 1 elif i > 0 and h[i] > h[i - 1] and c == 1: c = 0 if c == 2: x = False ...
n = int(eval(input())) h = [int(i) for i in input().split()] for i in range(n - 1, 0, -1): d = h[i - 1] - h[i] if d > 1: print("No") break if d == 1: h[i - 1] -= 1 else: print("Yes")
false
42.105263
[ "-x = True", "-c = 0", "-for i in range(n):", "- if i > 0 and h[i - 1] - h[i] >= 2:", "- x = False", "+for i in range(n - 1, 0, -1):", "+ d = h[i - 1] - h[i]", "+ if d > 1:", "+ print(\"No\")", "- elif i > 0 and h[i - 1] - h[i] == 1:", "- c += 1", "- elif i ...
false
0.035325
0.058213
0.606829
[ "s159265857", "s433091635" ]
u124498235
p02659
python
s873372713
s593826696
26
22
10,028
9,156
Accepted
Accepted
15.38
from decimal import Decimal a, b = list(map(Decimal, input().split())) print((int(a*b)))
a, b = list(map(str, input().split())) a = int(a) b = int(b.replace(".","")) print(((a*b)//100))
3
4
83
92
from decimal import Decimal a, b = list(map(Decimal, input().split())) print((int(a * b)))
a, b = list(map(str, input().split())) a = int(a) b = int(b.replace(".", "")) print(((a * b) // 100))
false
25
[ "-from decimal import Decimal", "-", "-a, b = list(map(Decimal, input().split()))", "-print((int(a * b)))", "+a, b = list(map(str, input().split()))", "+a = int(a)", "+b = int(b.replace(\".\", \"\"))", "+print(((a * b) // 100))" ]
false
0.039181
0.036462
1.074574
[ "s873372713", "s593826696" ]
u225388820
p03363
python
s356764127
s930827013
200
168
36,372
41,488
Accepted
Accepted
16
n=int(eval(input())) a=list(map(int,input().split())) a=[0]+a for i in range(1,n+1): a[i]+=a[i-1] #print(a) dic={} for i in a: if i in dic: dic[i]+=1 else: dic[i]=1 ans=0 for i in list(dic.values()): #print(i) ans+=i*(i-1)//2 print(ans)
import itertools n=int(eval(input())) a=list(map(int,input().split())) b=[0]+[i for i in itertools.accumulate(a)] dic={} for i in b: if i in dic: dic[i]+=1 else: dic[i]=1 ans=0 for i in list(dic.values()): ans+=i*(i-1)//2 print(ans)
17
14
276
261
n = int(eval(input())) a = list(map(int, input().split())) a = [0] + a for i in range(1, n + 1): a[i] += a[i - 1] # print(a) dic = {} for i in a: if i in dic: dic[i] += 1 else: dic[i] = 1 ans = 0 for i in list(dic.values()): # print(i) ans += i * (i - 1) // 2 print(ans)
import itertools n = int(eval(input())) a = list(map(int, input().split())) b = [0] + [i for i in itertools.accumulate(a)] dic = {} for i in b: if i in dic: dic[i] += 1 else: dic[i] = 1 ans = 0 for i in list(dic.values()): ans += i * (i - 1) // 2 print(ans)
false
17.647059
[ "+import itertools", "+", "-a = [0] + a", "-for i in range(1, n + 1):", "- a[i] += a[i - 1]", "-# print(a)", "+b = [0] + [i for i in itertools.accumulate(a)]", "-for i in a:", "+for i in b:", "- # print(i)" ]
false
0.040778
0.048455
0.841577
[ "s356764127", "s930827013" ]
u315600877
p03469
python
s654121393
s830512695
19
17
3,060
2,940
Accepted
Accepted
10.53
S=eval(input()) S=S.replace("7","8",1) print(S)
S=eval(input()) print((S[:3]+"8"+S[4:]))
3
2
43
33
S = eval(input()) S = S.replace("7", "8", 1) print(S)
S = eval(input()) print((S[:3] + "8" + S[4:]))
false
33.333333
[ "-S = S.replace(\"7\", \"8\", 1)", "-print(S)", "+print((S[:3] + \"8\" + S[4:]))" ]
false
0.057622
0.061103
0.94303
[ "s654121393", "s830512695" ]
u403301154
p02990
python
s874720891
s392293920
219
50
56,144
8,344
Accepted
Accepted
77.17
n, k = list(map(int, input().split())) MAX = 2*10**5+1 MOD = 10**9+7 fact = [0 for i in range(MAX)] inv = [0 for i in range(MAX)] invfact = [0 for i in range(MAX)] def comb_build(n): fact[0] = inv[0] = invfact[0] = 1 fact[1] = inv[1] = invfact[1] = 1 for i in range(2, n): fact[i] = fact[i-1]*i%M...
n, k = list(map(int, input().split())) MAX = 2*10**5+1 MOD = 10**9+7 fact = [0 for i in range(MAX)] inv = [0 for i in range(MAX)] invfact = [0 for i in range(MAX)] def comb_build(n): fact[0] = inv[0] = invfact[0] = 1 fact[1] = inv[1] = invfact[1] = 1 for i in range(2, n): fact[i] = fact[i-1]*i%M...
28
25
652
610
n, k = list(map(int, input().split())) MAX = 2 * 10**5 + 1 MOD = 10**9 + 7 fact = [0 for i in range(MAX)] inv = [0 for i in range(MAX)] invfact = [0 for i in range(MAX)] def comb_build(n): fact[0] = inv[0] = invfact[0] = 1 fact[1] = inv[1] = invfact[1] = 1 for i in range(2, n): fact[i] = fact[i - ...
n, k = list(map(int, input().split())) MAX = 2 * 10**5 + 1 MOD = 10**9 + 7 fact = [0 for i in range(MAX)] inv = [0 for i in range(MAX)] invfact = [0 for i in range(MAX)] def comb_build(n): fact[0] = inv[0] = invfact[0] = 1 fact[1] = inv[1] = invfact[1] = 1 for i in range(2, n): fact[i] = fact[i - ...
false
10.714286
[ "- if i > n - k + 1:", "- print((0))", "- else:", "- print(((nCk(k - 1, i - 1) * nCk(n - (k - 1), i)) % MOD))", "+ print(((nCk(k - 1, i - 1) * nCk(n - k + 1, i)) % MOD))" ]
false
0.148678
0.074591
1.993245
[ "s874720891", "s392293920" ]
u612975321
p02839
python
s837043052
s871000845
131
93
89,588
26,408
Accepted
Accepted
29.01
h, w = list(map(int,input().split())) a = [list(map(int,input().split())) for i in range(h)] b = [list(map(int,input().split())) for i in range(h)] ab = [[0]*w for i in range(h)] for ch in range(h): for cw in range(w): ab[ch][cw] = abs(a[ch][cw] - b[ch][cw]) ab0 = ab[0][0] size = 80*(h+w) dp = ...
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline h, w = list(map(int,input().split())) a = [list(map(int,input().split())) for i in range(h)] b = [list(map(int,input().split())) for i in range(h)] ab = [[0]*w for i in range(h)] for ch in range(h): for cw in range(w): ab...
26
30
775
854
h, w = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(h)] b = [list(map(int, input().split())) for i in range(h)] ab = [[0] * w for i in range(h)] for ch in range(h): for cw in range(w): ab[ch][cw] = abs(a[ch][cw] - b[ch][cw]) ab0 = ab[0][0] size = 80 * (h + w) dp = [[0]...
import sys read = sys.stdin.buffer.read input = sys.stdin.buffer.readline h, w = list(map(int, input().split())) a = [list(map(int, input().split())) for i in range(h)] b = [list(map(int, input().split())) for i in range(h)] ab = [[0] * w for i in range(h)] for ch in range(h): for cw in range(w): ab[ch][cw...
false
13.333333
[ "+import sys", "+", "+read = sys.stdin.buffer.read", "+input = sys.stdin.buffer.readline" ]
false
0.094209
0.107436
0.876882
[ "s837043052", "s871000845" ]
u620084012
p02642
python
s046875257
s463978509
190
128
105,944
106,004
Accepted
Accepted
32.63
N = int(eval(input())) A = list(map(int,input().split())) U = [0]*(10**6+1) for e in A: U[e] += 1 ans = 0 for k in range(1,max(A)+1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2*k,10**6+1,k): if U[l] > 0: U[l] += 1 print(ans)
N = int(eval(input())) A = list(map(int,input().split())) m = max(A) U = [0]*(m+1) for e in A: U[e] += 1 ans = 0 for k in range(1,m+1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2*k,m+1,k): if U[l] > 0: U[l] += 1 print(ans)
14
15
298
297
N = int(eval(input())) A = list(map(int, input().split())) U = [0] * (10**6 + 1) for e in A: U[e] += 1 ans = 0 for k in range(1, max(A) + 1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2 * k, 10**6 + 1, k): if U[l] > 0: U[l] += 1 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) m = max(A) U = [0] * (m + 1) for e in A: U[e] += 1 ans = 0 for k in range(1, m + 1): if U[k] == 1: ans += 1 if U[k] > 0: for l in range(2 * k, m + 1, k): if U[l] > 0: U[l] += 1 print(ans)
false
6.666667
[ "-U = [0] * (10**6 + 1)", "+m = max(A)", "+U = [0] * (m + 1)", "-for k in range(1, max(A) + 1):", "+for k in range(1, m + 1):", "- for l in range(2 * k, 10**6 + 1, k):", "+ for l in range(2 * k, m + 1, k):" ]
false
0.246085
0.036708
6.703783
[ "s046875257", "s463978509" ]
u826188728
p02901
python
s504760462
s564980598
926
548
3,188
3,188
Accepted
Accepted
40.82
n, m = list(map(int, input().split())) p = 2 ** n inf = 10 ** 9 dp = [inf] * p dp[0] = 0 for i in range(m): a, b = list(map(int, input().split())) c = sum([2 ** (int(j) - 1) for j in list(input().split())]) for k in range(p): if dp[k|c] > dp[k] + a: dp[k|c] = dp[k] + a if dp[-1] == in...
def main(): N,M = list(map(int, input().split())) inf = 10**9 p = 2**N dp = [inf] * p dp[0] = 0 for i in range(M): a,b = list(map(int, input().split())) c = sum([2**(int(j)-1) for j in list(input().split())]) for k in range(p): if dp[k|c] > dp[...
16
20
347
471
n, m = list(map(int, input().split())) p = 2**n inf = 10**9 dp = [inf] * p dp[0] = 0 for i in range(m): a, b = list(map(int, input().split())) c = sum([2 ** (int(j) - 1) for j in list(input().split())]) for k in range(p): if dp[k | c] > dp[k] + a: dp[k | c] = dp[k] + a if dp[-1] == inf: ...
def main(): N, M = list(map(int, input().split())) inf = 10**9 p = 2**N dp = [inf] * p dp[0] = 0 for i in range(M): a, b = list(map(int, input().split())) c = sum([2 ** (int(j) - 1) for j in list(input().split())]) for k in range(p): if dp[k | c] > dp[k] + a: ...
false
20
[ "-n, m = list(map(int, input().split()))", "-p = 2**n", "-inf = 10**9", "-dp = [inf] * p", "-dp[0] = 0", "-for i in range(m):", "- a, b = list(map(int, input().split()))", "- c = sum([2 ** (int(j) - 1) for j in list(input().split())])", "- for k in range(p):", "- if dp[k | c] > dp[...
false
0.07606
0.04582
1.659995
[ "s504760462", "s564980598" ]
u004423772
p03416
python
s320333108
s168779816
81
56
3,060
3,064
Accepted
Accepted
30.86
A, B = list(map(int, input().split(' '))) def is_palindromic(n): sep_idx = len(n) // 2 if n[:sep_idx] == n[sep_idx+1:][::-1]: return True return False count = 0 for n in range(A, B+1): n_str = str(n) if is_palindromic(n_str): count += 1 print(count)
A, B = list(map(int, input().split(' '))) def is_palindromic(n): s, t = n % 10, (n // 10000) % 10 u, v = (n // 10) % 10, (n // 1000) % 10 if s == t and u == v: return True return False count = 0 for n in range(A, B+1): if is_palindromic(n): count += 1 print(count)
14
14
294
309
A, B = list(map(int, input().split(" "))) def is_palindromic(n): sep_idx = len(n) // 2 if n[:sep_idx] == n[sep_idx + 1 :][::-1]: return True return False count = 0 for n in range(A, B + 1): n_str = str(n) if is_palindromic(n_str): count += 1 print(count)
A, B = list(map(int, input().split(" "))) def is_palindromic(n): s, t = n % 10, (n // 10000) % 10 u, v = (n // 10) % 10, (n // 1000) % 10 if s == t and u == v: return True return False count = 0 for n in range(A, B + 1): if is_palindromic(n): count += 1 print(count)
false
0
[ "- sep_idx = len(n) // 2", "- if n[:sep_idx] == n[sep_idx + 1 :][::-1]:", "+ s, t = n % 10, (n // 10000) % 10", "+ u, v = (n // 10) % 10, (n // 1000) % 10", "+ if s == t and u == v:", "- n_str = str(n)", "- if is_palindromic(n_str):", "+ if is_palindromic(n):" ]
false
0.236543
0.044031
5.372181
[ "s320333108", "s168779816" ]
u379959788
p02744
python
s479659639
s855518635
255
200
4,412
4,412
Accepted
Accepted
21.57
# D N = int(eval(input())) al = [chr(ord('a') + i) for i in range(26)] def dfs(S, i): if len(S) == N: yield ''.join(S) return for j in range(i): for w in dfs(S + [al[j]], i): yield w for w in dfs(S + [al[i]], i + 1): yield w for w in dfs([], 0): ...
# D N = int(eval(input())) al = [chr(ord('a') + i) for i in range(26)] def dfs(S, i): if len(S) == N: yield S return for j in range(i): for w in dfs(S + al[j], i): yield w for w in dfs(S + al[i], i + 1): yield w for w in dfs('', 0): print(w)
17
17
327
314
# D N = int(eval(input())) al = [chr(ord("a") + i) for i in range(26)] def dfs(S, i): if len(S) == N: yield "".join(S) return for j in range(i): for w in dfs(S + [al[j]], i): yield w for w in dfs(S + [al[i]], i + 1): yield w for w in dfs([], 0): print(w)
# D N = int(eval(input())) al = [chr(ord("a") + i) for i in range(26)] def dfs(S, i): if len(S) == N: yield S return for j in range(i): for w in dfs(S + al[j], i): yield w for w in dfs(S + al[i], i + 1): yield w for w in dfs("", 0): print(w)
false
0
[ "- yield \"\".join(S)", "+ yield S", "- for w in dfs(S + [al[j]], i):", "+ for w in dfs(S + al[j], i):", "- for w in dfs(S + [al[i]], i + 1):", "+ for w in dfs(S + al[i], i + 1):", "-for w in dfs([], 0):", "+for w in dfs(\"\", 0):" ]
false
0.129906
0.035212
3.689211
[ "s479659639", "s855518635" ]
u412255932
p03835
python
s321927426
s850535417
1,781
258
2,940
66,468
Accepted
Accepted
85.51
K, S = list(map(int, input().split())) count = 0 for i in range(K+1): for j in range(K+1): if 0 <= S - i - j and S - i - j <= K: count += 1 print(count)
K, S = list(map(int, input().split())) res = 0 for X in range(min(S, K), -1, -1): for Y in range(min(K, S - X), -1, -1): if 0 <= S - X - Y <= K: res += 1 print(res)
7
9
176
192
K, S = list(map(int, input().split())) count = 0 for i in range(K + 1): for j in range(K + 1): if 0 <= S - i - j and S - i - j <= K: count += 1 print(count)
K, S = list(map(int, input().split())) res = 0 for X in range(min(S, K), -1, -1): for Y in range(min(K, S - X), -1, -1): if 0 <= S - X - Y <= K: res += 1 print(res)
false
22.222222
[ "-count = 0", "-for i in range(K + 1):", "- for j in range(K + 1):", "- if 0 <= S - i - j and S - i - j <= K:", "- count += 1", "-print(count)", "+res = 0", "+for X in range(min(S, K), -1, -1):", "+ for Y in range(min(K, S - X), -1, -1):", "+ if 0 <= S - X - Y <= K:"...
false
0.04653
0.044974
1.034602
[ "s321927426", "s850535417" ]
u312025627
p02582
python
s160476941
s654605659
96
64
61,664
61,772
Accepted
Accepted
33.33
def main(): S = eval(input()) if S == "RRR": print((3)) elif "RR" in S: print((2)) elif "R" in S: print((1)) else: print((0)) if __name__ == '__main__': main()
def main(): S = eval(input()) if "RRR" == S: print((3)) elif "RR" in S: print((2)) elif "R" in S: print((1)) else: print((0)) if __name__ == '__main__': main()
14
14
217
217
def main(): S = eval(input()) if S == "RRR": print((3)) elif "RR" in S: print((2)) elif "R" in S: print((1)) else: print((0)) if __name__ == "__main__": main()
def main(): S = eval(input()) if "RRR" == S: print((3)) elif "RR" in S: print((2)) elif "R" in S: print((1)) else: print((0)) if __name__ == "__main__": main()
false
0
[ "- if S == \"RRR\":", "+ if \"RRR\" == S:" ]
false
0.082954
0.085595
0.969138
[ "s160476941", "s654605659" ]
u460737328
p03000
python
s106106537
s921919299
20
18
3,060
3,064
Accepted
Accepted
10
n, x = list(map(int, input().split())) ls = list(map(int, input().split())) count = 0 prev = 0 now = 0 for l in ls: now = prev + l if now <= x: count += 1 else: break prev += l print((count + 1))
N, X = list(map(int, input().split())) L = list(map(int, input().split())) d, res = 0, 1 for l in L: d += l if d <= X: res += 1 else: break print(res)
15
11
235
184
n, x = list(map(int, input().split())) ls = list(map(int, input().split())) count = 0 prev = 0 now = 0 for l in ls: now = prev + l if now <= x: count += 1 else: break prev += l print((count + 1))
N, X = list(map(int, input().split())) L = list(map(int, input().split())) d, res = 0, 1 for l in L: d += l if d <= X: res += 1 else: break print(res)
false
26.666667
[ "-n, x = list(map(int, input().split()))", "-ls = list(map(int, input().split()))", "-count = 0", "-prev = 0", "-now = 0", "-for l in ls:", "- now = prev + l", "- if now <= x:", "- count += 1", "+N, X = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+d,...
false
0.037499
0.038892
0.964192
[ "s106106537", "s921919299" ]
u752907799
p02838
python
s725246630
s789576415
1,261
1,140
49,320
49,168
Accepted
Accepted
9.6
N,*A=list(map(int,open(0).read().split())) print((sum((b:=1<<i)*(z:=sum(1 for a in A if a&b==0))*(N-z)%(mod:=10**9+7) for i in range(60))%mod))
N,*A=list(map(int,open(0).read().split())) print((sum((b:=1<<i)*(N-(z:=sum(1 for a in A if a&b)))*z%(m:=10**9+7) for i in range(60))%m))
2
2
137
129
N, *A = list(map(int, open(0).read().split())) print( ( sum( (b := 1 << i) * (z := sum(1 for a in A if a & b == 0)) * (N - z) % (mod := 10**9 + 7) for i in range(60) ) % mod ) )
N, *A = list(map(int, open(0).read().split())) print( ( sum( (b := 1 << i) * (N - (z := sum(1 for a in A if a & b))) * z % (m := 10**9 + 7) for i in range(60) ) % m ) )
false
0
[ "- * (z := sum(1 for a in A if a & b == 0))", "- * (N - z)", "- % (mod := 10**9 + 7)", "+ * (N - (z := sum(1 for a in A if a & b)))", "+ * z", "+ % (m := 10**9 + 7)", "- % mod", "+ % m" ]
false
0.050485
0.047933
1.053249
[ "s725246630", "s789576415" ]
u945181840
p03457
python
s421168999
s169706195
423
242
28,148
35,904
Accepted
Accepted
42.79
N = int(eval(input())) txy = [[0, 0, 0]] txy.extend([list(map(int, input().split())) for i in range(N)]) for i in range(N): time = txy[i + 1][0] - txy[i][0] length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2]) if time >= length and time % 2 == length % 2: continue e...
import sys import numpy as np read = sys.stdin.read def main(): N, *txy = list(map(int, read().split())) t = np.array([0] + txy[::3], np.int64) x = np.array([0] + txy[1::3], np.int64) y = np.array([0] + txy[2::3], np.int64) time = t[1:] - t[:-1] length = np.abs(y[1:] - y[:-1]) + n...
13
21
369
494
N = int(eval(input())) txy = [[0, 0, 0]] txy.extend([list(map(int, input().split())) for i in range(N)]) for i in range(N): time = txy[i + 1][0] - txy[i][0] length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2]) if time >= length and time % 2 == length % 2: continue else: ...
import sys import numpy as np read = sys.stdin.read def main(): N, *txy = list(map(int, read().split())) t = np.array([0] + txy[::3], np.int64) x = np.array([0] + txy[1::3], np.int64) y = np.array([0] + txy[2::3], np.int64) time = t[1:] - t[:-1] length = np.abs(y[1:] - y[:-1]) + np.abs(x[1:] ...
false
38.095238
[ "-N = int(eval(input()))", "-txy = [[0, 0, 0]]", "-txy.extend([list(map(int, input().split())) for i in range(N)])", "-for i in range(N):", "- time = txy[i + 1][0] - txy[i][0]", "- length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])", "- if time >= length and time % 2 == le...
false
0.036825
0.245982
0.149706
[ "s421168999", "s169706195" ]
u413165887
p02803
python
s789173444
s131715723
1,487
446
13,008
3,316
Accepted
Accepted
70.01
from collections import deque import numpy as np h, w = list(map(int,input().split())) s = [eval(input()) for _ in range(h)] result = [] for xx in range(h): for yy in range(w): if s[xx][yy]==".": visit = np.array([np.array([-1 for _ in range(w)]) for __ in range(h)]) visit[x...
from collections import deque h, w = list(map(int,input().split())) s = [eval(input()) for _ in range(h)] result = [] for xx in range(h): for yy in range(w): if s[xx][yy]==".": visit = [[-1 for _ in range(w)] for __ in range(h)] visit[xx][yy] = 0 q = deque([[xx...
25
24
958
926
from collections import deque import numpy as np h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] result = [] for xx in range(h): for yy in range(w): if s[xx][yy] == ".": visit = np.array([np.array([-1 for _ in range(w)]) for __ in range(h)]) visit[xx][yy...
from collections import deque h, w = list(map(int, input().split())) s = [eval(input()) for _ in range(h)] result = [] for xx in range(h): for yy in range(w): if s[xx][yy] == ".": visit = [[-1 for _ in range(w)] for __ in range(h)] visit[xx][yy] = 0 q = deque([[xx, yy]])...
false
4
[ "-import numpy as np", "- visit = np.array([np.array([-1 for _ in range(w)]) for __ in range(h)])", "+ visit = [[-1 for _ in range(w)] for __ in range(h)]", "- result.append(max(visit.flatten()))", "+ result.append(max([max(i) for i in visit]))" ]
false
0.269041
0.037036
7.264342
[ "s789173444", "s131715723" ]
u319589470
p03161
python
s888725428
s992559867
1,892
225
22,836
85,520
Accepted
Accepted
88.11
import numpy as np n,k = list(map(int,input().split())) h = list(map(int,input().split())) dp = np.zeros(n,dtype = int) h = np.array(h) for i in range(1,n): start = max(0, i-k) dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i])) print((dp[-1]))
def I(): return int(eval(input())) def LI(): return list(map(int,input().split())) def MI(): return list(map(int,input().split())) def LLI(n): return [list(map(int, input().split())) for _ in range(n)] n,k = MI() h = [0]+ LI() #h[i]はi番目の高さ #0-indexedにしておくと考えにくいので1-indexedにしておく #dp[i]は足場iにいくのに必要な最小コスト dp = [1...
9
20
249
549
import numpy as np n, k = list(map(int, input().split())) h = list(map(int, input().split())) dp = np.zeros(n, dtype=int) h = np.array(h) for i in range(1, n): start = max(0, i - k) dp[i] = min(dp[start:i] + np.abs(h[i] - h[start:i])) print((dp[-1]))
def I(): return int(eval(input())) def LI(): return list(map(int, input().split())) def MI(): return list(map(int, input().split())) def LLI(n): return [list(map(int, input().split())) for _ in range(n)] n, k = MI() h = [0] + LI() # h[i]はi番目の高さ # 0-indexedにしておくと考えにくいので1-indexedにしておく # dp[i]は足場iに...
false
55
[ "-import numpy as np", "+def I():", "+ return int(eval(input()))", "-n, k = list(map(int, input().split()))", "-h = list(map(int, input().split()))", "-dp = np.zeros(n, dtype=int)", "-h = np.array(h)", "-for i in range(1, n):", "- start = max(0, i - k)", "- dp[i] = min(dp[start:i] + np.ab...
false
0.242514
0.085955
2.821414
[ "s888725428", "s992559867" ]
u268318377
p02630
python
s444466329
s338885102
370
341
33,788
33,832
Accepted
Accepted
7.84
#import numpy as np from collections import Counter from time import time import sys readline = sys.stdin.buffer.readline N = int(eval(input())) A = list(map(int, input().split())) #A = np.random.randint(1, 10 ** 5 + 1, 10 ** 5) S = sum(A) C = Counter(A) Q = int(eval(input())) #Q = 10 ** 5 ans =...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) Q = int(eval(input())) S = sum(A) C = Counter(A) ans = [] for _ in range(Q): b, c = list(map(int, input().split())) count = C[b] S += (c - b) * count C[b], C[c] = 0, C[c] + count ans.append...
35
19
623
340
# import numpy as np from collections import Counter from time import time import sys readline = sys.stdin.buffer.readline N = int(eval(input())) A = list(map(int, input().split())) # A = np.random.randint(1, 10 ** 5 + 1, 10 ** 5) S = sum(A) C = Counter(A) Q = int(eval(input())) # Q = 10 ** 5 ans = [] s = time() for _...
from collections import Counter N = int(eval(input())) A = list(map(int, input().split())) Q = int(eval(input())) S = sum(A) C = Counter(A) ans = [] for _ in range(Q): b, c = list(map(int, input().split())) count = C[b] S += (c - b) * count C[b], C[c] = 0, C[c] + count ans.append(S) print(("\n".joi...
false
45.714286
[ "-# import numpy as np", "-from time import time", "-import sys", "-readline = sys.stdin.buffer.readline", "-# A = np.random.randint(1, 10 ** 5 + 1, 10 ** 5)", "+Q = int(eval(input()))", "-Q = int(eval(input()))", "-# Q = 10 ** 5", "-s = time()", "- # b, c = np.random.randint(1, 10 ** 5 + 1, 2)...
false
0.044319
0.044191
1.002908
[ "s444466329", "s338885102" ]
u634046173
p03001
python
s295315718
s226328826
65
60
61,784
61,824
Accepted
Accepted
7.69
W,H,X,Y = list(map(int,input().split())) if W/2 == X and H/2 == Y: f = 1 else: f = 0 print((W*H/2, f))
W,H,X,Y = list(map(int,input().split())) if W == X*2 and H == Y*2: f = 1 else: f = 0 print((W*H/2, f))
6
6
108
108
W, H, X, Y = list(map(int, input().split())) if W / 2 == X and H / 2 == Y: f = 1 else: f = 0 print((W * H / 2, f))
W, H, X, Y = list(map(int, input().split())) if W == X * 2 and H == Y * 2: f = 1 else: f = 0 print((W * H / 2, f))
false
0
[ "-if W / 2 == X and H / 2 == Y:", "+if W == X * 2 and H == Y * 2:" ]
false
0.037618
0.091837
0.409614
[ "s295315718", "s226328826" ]
u026788530
p02990
python
s742377302
s529228460
992
239
20,852
27,148
Accepted
Accepted
75.91
MOD = 10**9+7 lim = 200000 inv_t = [-1 for i in range(lim+1)] factrial = [-1 for i in range(lim+1)] factrial_inv = [-1 for i in range(lim+1)] def set_inv(max=lim): inv_t[0] = 0 for i in range(1, max): inv_t[i] == mod_inv(i) def mod_inv(x, mod=MOD): y, u, v, _x = mod, 1, 0, x w...
MOD = 10**9+7 lim = 200000 inv_t = [-1 for i in range(lim+1)] factrial = [-1 for i in range(lim+1)] factrial_inv = [-1 for i in range(lim+1)] def mod_inv(x, mod=MOD): y, u, v, _x = mod, 1, 0, x while y: t = _x//y _x -= t*y _x, y = y, _x u -= t*v u, v = v, ...
59
52
1,173
1,169
MOD = 10**9 + 7 lim = 200000 inv_t = [-1 for i in range(lim + 1)] factrial = [-1 for i in range(lim + 1)] factrial_inv = [-1 for i in range(lim + 1)] def set_inv(max=lim): inv_t[0] = 0 for i in range(1, max): inv_t[i] == mod_inv(i) def mod_inv(x, mod=MOD): y, u, v, _x = mod, 1, 0, x while y:...
MOD = 10**9 + 7 lim = 200000 inv_t = [-1 for i in range(lim + 1)] factrial = [-1 for i in range(lim + 1)] factrial_inv = [-1 for i in range(lim + 1)] def mod_inv(x, mod=MOD): y, u, v, _x = mod, 1, 0, x while y: t = _x // y _x -= t * y _x, y = y, _x u -= t * v u, v = v, ...
false
11.864407
[ "-", "-", "-def set_inv(max=lim):", "- inv_t[0] = 0", "- for i in range(1, max):", "- inv_t[i] == mod_inv(i)", "-def set_factrial(max=lim, mod=MOD):", "- c = 1", "+def COMinit(max=lim, mod=MOD):", "- for i in range(1, max):", "- c *= i", "- c %= mod", "- ...
false
1.498953
0.558794
2.682477
[ "s742377302", "s529228460" ]
u513081876
p03681
python
s801632395
s084593016
704
47
5,192
3,060
Accepted
Accepted
93.32
from math import factorial N, M = list(map(int, input().split())) if abs(N-M) >= 2: print((0)) elif abs(N-M) == 1: print(((factorial(N)*factorial(M)) % (10**9+7))) elif abs(N-M) == 0: print(((factorial(N)*factorial(M)*2) % (10**9+7)))
N, M = list(map(int, input().split())) ans = 0 def fac(n): ans = 1 for i in range(1, n+1): ans *= i ans %= (10**9+7) return ans if abs(N-M) >= 2: ans = 0 else: if N == M: ans = fac(N) * fac(M) * 2 % (10**9+7) else: ans = fac(N) * fac(M) % (10**9 ...
9
19
243
332
from math import factorial N, M = list(map(int, input().split())) if abs(N - M) >= 2: print((0)) elif abs(N - M) == 1: print(((factorial(N) * factorial(M)) % (10**9 + 7))) elif abs(N - M) == 0: print(((factorial(N) * factorial(M) * 2) % (10**9 + 7)))
N, M = list(map(int, input().split())) ans = 0 def fac(n): ans = 1 for i in range(1, n + 1): ans *= i ans %= 10**9 + 7 return ans if abs(N - M) >= 2: ans = 0 else: if N == M: ans = fac(N) * fac(M) * 2 % (10**9 + 7) else: ans = fac(N) * fac(M) % (10**9 + 7) pri...
false
52.631579
[ "-from math import factorial", "+N, M = list(map(int, input().split()))", "+ans = 0", "-N, M = list(map(int, input().split()))", "+", "+def fac(n):", "+ ans = 1", "+ for i in range(1, n + 1):", "+ ans *= i", "+ ans %= 10**9 + 7", "+ return ans", "+", "+", "- print...
false
0.039768
0.038039
1.045472
[ "s801632395", "s084593016" ]
u608088992
p03627
python
s224885964
s560385843
111
76
17,960
17,988
Accepted
Accepted
31.53
def solve(): N = int(eval(input())) A = [int(a) for a in input().split()] A.sort() Adict = dict() for i, a in enumerate(A): if a in Adict: Adict[a] += 1 else: Adict[a] = 1 rect = 0 ri = -1 for i in reversed(list(range(N))): if Adict[A[i]] >= 4: ...
import sys from heapq import heapify, heappop, heappush def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] Anum = dict() for a in A: if a in Anum: Anum[a] += 1 else: Anum[a] = 1 q = [0, 0] for key in Anum: ...
29
25
667
529
def solve(): N = int(eval(input())) A = [int(a) for a in input().split()] A.sort() Adict = dict() for i, a in enumerate(A): if a in Adict: Adict[a] += 1 else: Adict[a] = 1 rect = 0 ri = -1 for i in reversed(list(range(N))): if Adict[A[i]] >...
import sys from heapq import heapify, heappop, heappush def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] Anum = dict() for a in A: if a in Anum: Anum[a] += 1 else: Anum[a] = 1 q = [0, 0] for key in ...
false
13.793103
[ "+import sys", "+from heapq import heapify, heappop, heappush", "+", "+", "+ input = sys.stdin.readline", "- A.sort()", "- Adict = dict()", "- for i, a in enumerate(A):", "- if a in Adict:", "- Adict[a] += 1", "+ Anum = dict()", "+ for a in A:", "+ ...
false
0.040906
0.043542
0.939458
[ "s224885964", "s560385843" ]
u709799578
p02887
python
s173506241
s898258341
55
30
3,316
4,644
Accepted
Accepted
45.45
n = int(eval(input())) s = eval(input()) ans = s[:1] for i in range(1, n): if ans[-1:] != s[i]: ans += s[i] print((len(ans)))
import itertools n = int(eval(input())) s = list(eval(input())) ans = [k for k, v in itertools.groupby(s)] print((len(ans)))
7
5
129
114
n = int(eval(input())) s = eval(input()) ans = s[:1] for i in range(1, n): if ans[-1:] != s[i]: ans += s[i] print((len(ans)))
import itertools n = int(eval(input())) s = list(eval(input())) ans = [k for k, v in itertools.groupby(s)] print((len(ans)))
false
28.571429
[ "+import itertools", "+", "-s = eval(input())", "-ans = s[:1]", "-for i in range(1, n):", "- if ans[-1:] != s[i]:", "- ans += s[i]", "+s = list(eval(input()))", "+ans = [k for k, v in itertools.groupby(s)]" ]
false
0.040968
0.040705
1.006464
[ "s173506241", "s898258341" ]
u254871849
p03762
python
s962902154
s517806428
235
215
20,672
37,364
Accepted
Accepted
8.51
# 予めsx, syを全て計算しておく # このとき漸化式を使えば毎回全ての話を求める必要がない mod = int(1e9+7) n, m = [int(num) for num in input().split()] x = [int(x) for x in input().split()] y = [int(y) for y in input().split()] sx = [0] * n sx[0] = x[0] for i in range(n-1): sx[i+1] = sx[i] + x[i+1] sxd = 0 for i in range(n-1): sx...
import sys import numpy as np MOD = 10 ** 9 + 7 I = np.array(sys.stdin.read().split(), dtype=np.int64) n, m = I[:2] x = I[2:2+n] y = I[2+n:] def main(): sx = np.cumsum(x) % MOD sy = np.cumsum(y) % MOD sdx = np.sum((sx[n-1] - sx[:n-1]) - x[:n-1] * ((n-1) - np.arange(n-1))) % MOD sdy =...
29
23
618
501
# 予めsx, syを全て計算しておく # このとき漸化式を使えば毎回全ての話を求める必要がない mod = int(1e9 + 7) n, m = [int(num) for num in input().split()] x = [int(x) for x in input().split()] y = [int(y) for y in input().split()] sx = [0] * n sx[0] = x[0] for i in range(n - 1): sx[i + 1] = sx[i] + x[i + 1] sxd = 0 for i in range(n - 1): sxd += (sx[n -...
import sys import numpy as np MOD = 10**9 + 7 I = np.array(sys.stdin.read().split(), dtype=np.int64) n, m = I[:2] x = I[2 : 2 + n] y = I[2 + n :] def main(): sx = np.cumsum(x) % MOD sy = np.cumsum(y) % MOD sdx = ( np.sum((sx[n - 1] - sx[: n - 1]) - x[: n - 1] * ((n - 1) - np.arange(n - 1))) ...
false
20.689655
[ "-# 予めsx, syを全て計算しておく", "-# このとき漸化式を使えば毎回全ての話を求める必要がない", "-mod = int(1e9 + 7)", "-n, m = [int(num) for num in input().split()]", "-x = [int(x) for x in input().split()]", "-y = [int(y) for y in input().split()]", "-sx = [0] * n", "-sx[0] = x[0]", "-for i in range(n - 1):", "- sx[i + 1] = sx[i] ...
false
0.050269
0.19695
0.255236
[ "s962902154", "s517806428" ]
u786020649
p03476
python
s272970538
s742388111
278
137
24,784
32,968
Accepted
Accepted
50.72
q=int(eval(input())) lr=[tuple(map(int,input().split())) for _ in range(q)] def main(): n=10**5 ansl=[] sieve=[1]*(n+1) sieve[0],sieve[1]=0,0 for i in range(2,n): if sieve[i]: sieve[2*i::i]=[0 for _ in range(2*i,n+1,i)] ans=[0]*(n+1) for i in range(3,n): if sieve[i]==1 and siev...
import sys from itertools import accumulate readline=sys.stdin.readline read=sys.stdin.read def main(): q,*lr=list(map(int,read().split())) n=10**5 ansl=[] sieve=[1]*(n+1) sieve[0],sieve[1]=0,0 for i in range(2,n): if sieve[i]: sieve[2*i::i]=[0 for _ in range(2*i,n+1,i)] ans=[0]...
23
29
478
599
q = int(eval(input())) lr = [tuple(map(int, input().split())) for _ in range(q)] def main(): n = 10**5 ansl = [] sieve = [1] * (n + 1) sieve[0], sieve[1] = 0, 0 for i in range(2, n): if sieve[i]: sieve[2 * i :: i] = [0 for _ in range(2 * i, n + 1, i)] ans = [0] * (n + 1) ...
import sys from itertools import accumulate readline = sys.stdin.readline read = sys.stdin.read def main(): q, *lr = list(map(int, read().split())) n = 10**5 ansl = [] sieve = [1] * (n + 1) sieve[0], sieve[1] = 0, 0 for i in range(2, n): if sieve[i]: sieve[2 * i :: i] = [0...
false
20.689655
[ "-q = int(eval(input()))", "-lr = [tuple(map(int, input().split())) for _ in range(q)]", "+import sys", "+from itertools import accumulate", "+", "+readline = sys.stdin.readline", "+read = sys.stdin.read", "+ q, *lr = list(map(int, read().split()))", "+ # ans[i]=1", "- for e in lr...
false
0.115243
0.137238
0.83973
[ "s272970538", "s742388111" ]
u687053495
p02793
python
s894209994
s933213146
1,896
698
5,596
14,476
Accepted
Accepted
63.19
import sys input = sys.stdin.readline N = int(eval(input())) A = list(map(int, input().split())) mod = 10 ** 9 + 7 from fractions import gcd from functools import reduce L = A[0] for i in range(1,N): L=(L*A[i])//gcd(L,A[i]) ans = 0 for i in range(N): ans += (L // A[i]) print((ans % mod))
# エラトステネスを素因数分解とlcm N = int(eval(input())) A = list(map(int, input().split())) mod = 10 ** 9 + 7 def inverse(a): #aに対し、a**(mod-2)、つまり逆元を返す T=[a] while 2**(len(T))<mod: #a**1,a**2.a**4,a**8,...を計算しておく T.append(T[-1]**2%mod) b=bin(mod-2) #mod-2を2進数表記にする ans=1 for i in range(len(b)-2): ...
21
61
312
1,141
import sys input = sys.stdin.readline N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 from fractions import gcd from functools import reduce L = A[0] for i in range(1, N): L = (L * A[i]) // gcd(L, A[i]) ans = 0 for i in range(N): ans += L // A[i] print((ans % mod))
# エラトステネスを素因数分解とlcm N = int(eval(input())) A = list(map(int, input().split())) mod = 10**9 + 7 def inverse(a): # aに対し、a**(mod-2)、つまり逆元を返す T = [a] while 2 ** (len(T)) < mod: # a**1,a**2.a**4,a**8,...を計算しておく T.append(T[-1] ** 2 % mod) b = bin(mod - 2) # mod-2を2進数表記にする ans = 1 for i in ran...
false
65.57377
[ "-import sys", "-", "-input = sys.stdin.readline", "+# エラトステネスを素因数分解とlcm", "-from fractions import gcd", "-from functools import reduce", "-L = A[0]", "-for i in range(1, N):", "- L = (L * A[i]) // gcd(L, A[i])", "-ans = 0", "+", "+def inverse(a): # aに対し、a**(mod-2)、つまり逆元を返す", "+ T = [...
false
0.046201
1.106247
0.041764
[ "s894209994", "s933213146" ]
u608088992
p03054
python
s367312081
s269332257
357
178
19,424
3,888
Accepted
Accepted
50.14
H, W, N = list(map(int, input().split())) sr, sc = list(map(int, input().split())) S = eval(input()) T = eval(input()) up = [0] * (N+1) down = [0] * (N+1) right = [0] * (N+1) left = [0] * (N+1) maxU, maxD, maxR, maxL = 0, 0, 0, 0 for i in range(N): if S[i] == "L": left[i+1] = left[i] + 1 ...
import sys def solve(): input = sys.stdin.readline H, W, N = list(map(int, input().split())) s, r = list(map(int, input().split())) S = input().strip("\n") T = input().strip("\n") Lb, Rb, Ub, Db = -1, W, -1, H for i in reversed(list(range(N))): if i != N - 1: ...
50
34
1,327
948
H, W, N = list(map(int, input().split())) sr, sc = list(map(int, input().split())) S = eval(input()) T = eval(input()) up = [0] * (N + 1) down = [0] * (N + 1) right = [0] * (N + 1) left = [0] * (N + 1) maxU, maxD, maxR, maxL = 0, 0, 0, 0 for i in range(N): if S[i] == "L": left[i + 1] = left[i] + 1 r...
import sys def solve(): input = sys.stdin.readline H, W, N = list(map(int, input().split())) s, r = list(map(int, input().split())) S = input().strip("\n") T = input().strip("\n") Lb, Rb, Ub, Db = -1, W, -1, H for i in reversed(list(range(N))): if i != N - 1: if T[i] ==...
false
32
[ "-H, W, N = list(map(int, input().split()))", "-sr, sc = list(map(int, input().split()))", "-S = eval(input())", "-T = eval(input())", "-up = [0] * (N + 1)", "-down = [0] * (N + 1)", "-right = [0] * (N + 1)", "-left = [0] * (N + 1)", "-maxU, maxD, maxR, maxL = 0, 0, 0, 0", "-for i in range(N):", ...
false
0.143763
0.079213
1.814891
[ "s367312081", "s269332257" ]
u119148115
p02756
python
s104895874
s687441326
609
134
36,700
100,892
Accepted
Accepted
78
S = list(eval(input())) Q = int(eval(input())) Query = [list(input().split()) for i in range(Q)] from collections import deque q = deque(S) r = 0 #反転の有無 for i in range(Q): if Query[i][0] == '1': r = 1-r else: if (r + int(Query[i][1])) % 2 == 1: q.appendleft(Query[...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし def ...
29
37
482
931
S = list(eval(input())) Q = int(eval(input())) Query = [list(input().split()) for i in range(Q)] from collections import deque q = deque(S) r = 0 # 反転の有無 for i in range(Q): if Query[i][0] == "1": r = 1 - r else: if (r + int(Query[i][1])) % 2 == 1: q.appendleft(Query[i][2]) ...
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり def LI2(): return list(map(int, sys.stdin.readline().r...
false
21.621622
[ "-S = list(eval(input()))", "-Q = int(eval(input()))", "-Query = [list(input().split()) for i in range(Q)]", "-from collections import deque", "+import sys", "-q = deque(S)", "-r = 0 # 反転の有無", "+sys.setrecursionlimit(10**7)", "+", "+", "+def I():", "+ return int(sys.stdin.readline().rstrip...
false
0.037352
0.036807
1.014801
[ "s104895874", "s687441326" ]
u077291787
p02787
python
s290933770
s056983444
290
262
39,920
39,792
Accepted
Accepted
9.66
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * (H + 10001) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for i in range(H): for a, b in zip(*[iter(AB)] * 2): dp[i + a] = ...
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * (H + 10001) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): dp[i + a] = ...
15
15
408
408
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * ( H + 10001 ) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for i in range(H): for a, b in zip(*[iter(AB)] * 2): dp[i + a...
# E - Crested Ibis vs Monster def main(): INF = 1 << 30 H, N, *AB = list(map(int, open(0).read().split())) dp = [INF] * ( H + 10001 ) # dp[i] := min magic points to decrease monster's health by i dp[0] = 0 for a, b in zip(*[iter(AB)] * 2): for i in range(H): dp[i + a...
false
0
[ "- for i in range(H):", "- for a, b in zip(*[iter(AB)] * 2):", "+ for a, b in zip(*[iter(AB)] * 2):", "+ for i in range(H):" ]
false
0.25389
0.088319
2.874699
[ "s290933770", "s056983444" ]
u731368968
p02684
python
s299620802
s619246769
928
126
247,748
32,376
Accepted
Accepted
86.42
N, K = list(map(int, input().split())) A = [[-1] * (N + 1) for i in range(100)] A[0] = [0] + list(map(int, input().split())) # nowから2**i先まで移動したとこ def double(now, i): global A if A[i][now] != -1: return A[i][now] # nowから2**(i-1)移動して、そこからさらに2**(i-1)移動する A[i][now] = double(double(now, ...
n, k = list(map(int, input().split())) A = [0] + list(map(int, input().split())) # 訪問順 B = [1] # 訪問済み C = [False] * (n + 1) C[1] = True while True: B.append(A[B[-1]]) if C[B[-1]]: break C[B[-1]] = True s = B.index(B[-1]) if k < s: print((B[k])) exit() B = B[B.in...
23
25
530
354
N, K = list(map(int, input().split())) A = [[-1] * (N + 1) for i in range(100)] A[0] = [0] + list(map(int, input().split())) # nowから2**i先まで移動したとこ def double(now, i): global A if A[i][now] != -1: return A[i][now] # nowから2**(i-1)移動して、そこからさらに2**(i-1)移動する A[i][now] = double(double(now, i - 1), i - 1...
n, k = list(map(int, input().split())) A = [0] + list(map(int, input().split())) # 訪問順 B = [1] # 訪問済み C = [False] * (n + 1) C[1] = True while True: B.append(A[B[-1]]) if C[B[-1]]: break C[B[-1]] = True s = B.index(B[-1]) if k < s: print((B[k])) exit() B = B[B.index(B[-1]) : -1] print((B[(k -...
false
8
[ "-N, K = list(map(int, input().split()))", "-A = [[-1] * (N + 1) for i in range(100)]", "-A[0] = [0] + list(map(int, input().split()))", "-# nowから2**i先まで移動したとこ", "-def double(now, i):", "- global A", "- if A[i][now] != -1:", "- return A[i][now]", "- # nowから2**(i-1)移動して、そこからさらに2**(i-1...
false
0.085517
0.045573
1.876492
[ "s299620802", "s619246769" ]
u761320129
p03470
python
s232024321
s184032228
227
17
3,700
2,940
Accepted
Accepted
92.51
from collections import Counter N = int(eval(input())) src = [int(eval(input())) for i in range(N)] ctr = Counter(src) print((len(list(ctr.items()))))
N = int(eval(input())) src = [int(eval(input())) for i in range(N)] print((len(set(src))))
5
3
135
78
from collections import Counter N = int(eval(input())) src = [int(eval(input())) for i in range(N)] ctr = Counter(src) print((len(list(ctr.items()))))
N = int(eval(input())) src = [int(eval(input())) for i in range(N)] print((len(set(src))))
false
40
[ "-from collections import Counter", "-", "-ctr = Counter(src)", "-print((len(list(ctr.items()))))", "+print((len(set(src))))" ]
false
0.034129
0.034108
1.000611
[ "s232024321", "s184032228" ]
u497596438
p03323
python
s599637525
s966004152
188
164
38,256
38,256
Accepted
Accepted
12.77
#S=input() #N=int(input()) A,B=list(map(int,input().split())) if A<=8 and B<=8: print("Yay!") else: print(":(")
A,B=list(map(int,input().split())) if A<9 and B<9: print("Yay!") else: print(":(")
7
5
119
89
# S=input() # N=int(input()) A, B = list(map(int, input().split())) if A <= 8 and B <= 8: print("Yay!") else: print(":(")
A, B = list(map(int, input().split())) if A < 9 and B < 9: print("Yay!") else: print(":(")
false
28.571429
[ "-# S=input()", "-# N=int(input())", "-if A <= 8 and B <= 8:", "+if A < 9 and B < 9:" ]
false
0.043433
0.04443
0.977561
[ "s599637525", "s966004152" ]
u257974487
p02786
python
s538547764
s673125479
19
17
3,060
2,940
Accepted
Accepted
10.53
hp = int(eval(input())) if hp == 0: print((1)) exit() attack = 0 monster = 1 p = 1 for i in range(999): if hp == 0: break else: attack += 1 hp = hp // 2 print((2 ** attack - 1))
hp = int(eval(input())) attack = 0 monster = 1 p = 1 for i in range(999): if hp == 0: break else: attack += 1 hp = hp // 2 print((2 ** attack - 1))
17
13
227
186
hp = int(eval(input())) if hp == 0: print((1)) exit() attack = 0 monster = 1 p = 1 for i in range(999): if hp == 0: break else: attack += 1 hp = hp // 2 print((2**attack - 1))
hp = int(eval(input())) attack = 0 monster = 1 p = 1 for i in range(999): if hp == 0: break else: attack += 1 hp = hp // 2 print((2**attack - 1))
false
23.529412
[ "-if hp == 0:", "- print((1))", "- exit()" ]
false
0.05115
0.050416
1.014556
[ "s538547764", "s673125479" ]
u063596417
p03435
python
s585729244
s693429434
73
64
62,212
62,104
Accepted
Accepted
12.33
c = [[int(cn) for cn in input().split()] for _ in range(3)] max_val = max(c[0]) ans = 'No' for a1 in range(max_val + 1): b = [c[0][i] - a1 for i in range(3)] correct = True for i in range(2): ai_cand = [] for j in range(3): cand = c[i + 1][j] - b[j] correct = cand >= 0 if corr...
c = [[int(cn) for cn in input().split()] for _ in range(3)] max_val = max(c[0]) ans = 'No' for a1 in range(max_val + 1): b = [c[0][i] - a1 for i in range(3)] correct = True for i in range(2): ai_cand = [] for j in range(3): cand = c[i + 1][j] - b[j] correct = cand >= 0 if corr...
25
22
588
555
c = [[int(cn) for cn in input().split()] for _ in range(3)] max_val = max(c[0]) ans = "No" for a1 in range(max_val + 1): b = [c[0][i] - a1 for i in range(3)] correct = True for i in range(2): ai_cand = [] for j in range(3): cand = c[i + 1][j] - b[j] correct = cand >= ...
c = [[int(cn) for cn in input().split()] for _ in range(3)] max_val = max(c[0]) ans = "No" for a1 in range(max_val + 1): b = [c[0][i] - a1 for i in range(3)] correct = True for i in range(2): ai_cand = [] for j in range(3): cand = c[i + 1][j] - b[j] correct = cand >= ...
false
12
[ "- if correct:", "- correct = ai_cand[0] == ai_cand[1] and ai_cand[1] == ai_cand[2]", "- if not correct:", "- break", "- else:", "+ correct = correct and (ai_cand[0] == ai_cand[1] and ai_cand[1] == ai_cand[2])", "+ if not correct:" ]
false
0.036863
0.039422
0.935091
[ "s585729244", "s693429434" ]
u223663729
p02736
python
s067979056
s565785636
423
341
20,460
13,636
Accepted
Accepted
19.39
N=int(eval(input())) A=[int(a)-1 for a in eval(input())] r=1 if 1 in A else 2 print((sum([1 if A[i]&r and (N-1&i)==i else 0 for i in range(N)])%2*r))
N=int(eval(input()));A=[int(a)-1 for a in eval(input())];print((sum([A[i] for i in range(N) if N-1&i==i])%(4>>int(1 in A))))
4
1
138
110
N = int(eval(input())) A = [int(a) - 1 for a in eval(input())] r = 1 if 1 in A else 2 print((sum([1 if A[i] & r and (N - 1 & i) == i else 0 for i in range(N)]) % 2 * r))
N = int(eval(input())) A = [int(a) - 1 for a in eval(input())] print((sum([A[i] for i in range(N) if N - 1 & i == i]) % (4 >> int(1 in A))))
false
75
[ "-r = 1 if 1 in A else 2", "-print((sum([1 if A[i] & r and (N - 1 & i) == i else 0 for i in range(N)]) % 2 * r))", "+print((sum([A[i] for i in range(N) if N - 1 & i == i]) % (4 >> int(1 in A))))" ]
false
0.045612
0.038333
1.189899
[ "s067979056", "s565785636" ]
u729133443
p03260
python
s506017335
s084068909
19
17
3,316
2,940
Accepted
Accepted
10.53
a,b=list(map(int,input().split())) if a*b%2:print('Yes') else:print('No')
print(('NYoe s'[eval(input().replace(' ','*'))%2::2]))
3
1
69
52
a, b = list(map(int, input().split())) if a * b % 2: print("Yes") else: print("No")
print(("NYoe s"[eval(input().replace(" ", "*")) % 2 :: 2]))
false
66.666667
[ "-a, b = list(map(int, input().split()))", "-if a * b % 2:", "- print(\"Yes\")", "-else:", "- print(\"No\")", "+print((\"NYoe s\"[eval(input().replace(\" \", \"*\")) % 2 :: 2]))" ]
false
0.059766
0.159802
0.374002
[ "s506017335", "s084068909" ]
u623819879
p02680
python
s875143620
s331350555
2,750
2,396
551,336
551,312
Accepted
Accepted
12.87
I=lambda:list(map(int,input().split()));F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=(f,F),(f,-F),;H=(F,f),(-F,f), for i in r(n):*a,c=I();R+=(a,c),;Y+=c,;X+=a for i in r(m):a,*b=I();H+=(a,b),;X+=a,;Y+=b def g(X):s=dict(enumerate(sorted(set(X))));return{s[i]:i for i in s},s,len(s) h,s,K=g(X);w,t,L=g(Y);V,U,v=[[[...
I=lambda:list(map(int,input().split()));F=1e21;r=range;n,m=I();f=[-F,F];X=[0]+f;Y=X[:];R=(f,F),(f,-F),;H=(F,f),(-F,f), for i in r(n):*a,c=I();R+=(a,c),;Y+=c,;X+=a for i in r(m):a,*b=I();H+=(a,b),;X+=a,;Y+=b def g(X):s=sorted(set(X));l=len(s);return{s[i]:i for i in r(l)},s,l h,s,K=g(X);w,t,L=g(Y);V,U,v=[[[0]*-~K for...
16
16
762
752
I = lambda: list(map(int, input().split())) F = 1e21 r = range n, m = I() f = [-F, F] X = [0] + f Y = X[:] R = ( (f, F), (f, -F), ) H = ( (F, f), (-F, f), ) for i in r(n): *a, c = I() R += ((a, c),) Y += (c,) X += a for i in r(m): a, *b = I() H += ((a, b),) X += (a,) Y +=...
I = lambda: list(map(int, input().split())) F = 1e21 r = range n, m = I() f = [-F, F] X = [0] + f Y = X[:] R = ( (f, F), (f, -F), ) H = ( (F, f), (-F, f), ) for i in r(n): *a, c = I() R += ((a, c),) Y += (c,) X += a for i in r(m): a, *b = I() H += ((a, b),) X += (a,) Y +=...
false
0
[ "- s = dict(enumerate(sorted(set(X))))", "- return {s[i]: i for i in s}, s, len(s)", "+ s = sorted(set(X))", "+ l = len(s)", "+ return {s[i]: i for i in r(l)}, s, l" ]
false
0.099636
0.037967
2.624258
[ "s875143620", "s331350555" ]
u678167152
p02713
python
s829124913
s413590096
187
59
67,764
64,608
Accepted
Accepted
68.45
import math k = int(eval(input())) ans = 0 for a in range(1, k+1): for b in range(1, k+1): m = math.gcd(a, b) for c in range(1, k+1): ans += math.gcd(m, c) print(ans)
K = int(eval(input())) from math import gcd sum_gcd = [0]*K for i in range(1,K+1): c = 0 for j in range(1,K+1): c += gcd(i,j) sum_gcd[i-1] = c ans = 0 for a in range(1,K+1): for b in range(1,K+1): ans += sum_gcd[gcd(a,b)-1] print(ans)
11
15
197
276
import math k = int(eval(input())) ans = 0 for a in range(1, k + 1): for b in range(1, k + 1): m = math.gcd(a, b) for c in range(1, k + 1): ans += math.gcd(m, c) print(ans)
K = int(eval(input())) from math import gcd sum_gcd = [0] * K for i in range(1, K + 1): c = 0 for j in range(1, K + 1): c += gcd(i, j) sum_gcd[i - 1] = c ans = 0 for a in range(1, K + 1): for b in range(1, K + 1): ans += sum_gcd[gcd(a, b) - 1] print(ans)
false
26.666667
[ "-import math", "+K = int(eval(input()))", "+from math import gcd", "-k = int(eval(input()))", "+sum_gcd = [0] * K", "+for i in range(1, K + 1):", "+ c = 0", "+ for j in range(1, K + 1):", "+ c += gcd(i, j)", "+ sum_gcd[i - 1] = c", "-for a in range(1, k + 1):", "- for b in ...
false
0.115075
0.08135
1.41457
[ "s829124913", "s413590096" ]
u703950586
p03215
python
s752977760
s960190386
510
396
71,544
67,832
Accepted
Accepted
22.35
import sys,queue,math,copy,itertools,bisect,collections,heapq sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()) N,K = LI() A = LI() sa...
import sys,queue,math,copy,itertools,bisect,collections,heapq LI = lambda : [int(x) for x in sys.stdin.readline().split()] N,K = LI() A = LI() sa = list(itertools.accumulate([0]+A)) b = [] for i in range(N): for j in range(i+1,N+1): b.append(sa[j]-sa[i]) #b.sort(reverse=True) max_b = max(b).bi...
32
24
712
537
import sys, queue, math, copy, itertools, bisect, collections, heapq sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda: [int(x) for x in sys.stdin.readline().split()] _LI = lambda: [int(x) - 1 for x in sys.stdin.readline().split()] NI = lambda: int(sys.stdin.readline()) N, K = LI() A = LI() sa = li...
import sys, queue, math, copy, itertools, bisect, collections, heapq LI = lambda: [int(x) for x in sys.stdin.readline().split()] N, K = LI() A = LI() sa = list(itertools.accumulate([0] + A)) b = [] for i in range(N): for j in range(i + 1, N + 1): b.append(sa[j] - sa[i]) # b.sort(reverse=True) max_b = max(b...
false
25
[ "-sys.setrecursionlimit(10**7)", "-INF = 10**18", "-MOD = 10**9 + 7", "-_LI = lambda: [int(x) - 1 for x in sys.stdin.readline().split()]", "-NI = lambda: int(sys.stdin.readline())", "-b.sort(reverse=True)", "-max_b = (max(b)).bit_length()", "+# b.sort(reverse=True)", "+max_b = max(b).bit_length()" ]
false
0.036025
0.036841
0.977867
[ "s752977760", "s960190386" ]
u340781749
p02816
python
s115987911
s580558628
1,788
394
143,284
66,896
Accepted
Accepted
77.96
def check(ccc, ddd, e, ans): m = 2147483647 g = 1000000007 for l in range(e): cl = ccc[l] if any(c != cl for c in ccc[l::e]): return dl = ddd[l] if any(d != dl for d in ddd[l::e]): return s = 0 for c in ccc[:e]: s = (s * g +...
def solve(n, aaa, bbb): ccc = [a1 ^ a2 for a1, a2 in zip(aaa, aaa[1:])] + [aaa[-1] ^ aaa[0]] ddd = [b1 ^ b2 for b1, b2 in zip(bbb, bbb[1:])] + [bbb[-1] ^ bbb[0]] ans = [] m = 2147483647 g = 1000000007 s = 0 for c in ccc: s = (s * g + c) % m t = 0 for d in ddd: ...
48
28
1,233
721
def check(ccc, ddd, e, ans): m = 2147483647 g = 1000000007 for l in range(e): cl = ccc[l] if any(c != cl for c in ccc[l::e]): return dl = ddd[l] if any(d != dl for d in ddd[l::e]): return s = 0 for c in ccc[:e]: s = (s * g + c) % m ...
def solve(n, aaa, bbb): ccc = [a1 ^ a2 for a1, a2 in zip(aaa, aaa[1:])] + [aaa[-1] ^ aaa[0]] ddd = [b1 ^ b2 for b1, b2 in zip(bbb, bbb[1:])] + [bbb[-1] ^ bbb[0]] ans = [] m = 2147483647 g = 1000000007 s = 0 for c in ccc: s = (s * g + c) % m t = 0 for d in ddd: t = (t ...
false
41.666667
[ "-def check(ccc, ddd, e, ans):", "- m = 2147483647", "- g = 1000000007", "- for l in range(e):", "- cl = ccc[l]", "- if any(c != cl for c in ccc[l::e]):", "- return", "- dl = ddd[l]", "- if any(d != dl for d in ddd[l::e]):", "- return", ...
false
0.037658
0.036677
1.026745
[ "s115987911", "s580558628" ]
u155174554
p03416
python
s975037188
s432884768
58
47
3,060
3,060
Accepted
Accepted
18.97
a, b = list(map(int, input().split())) nums = [x for x in range(a, b+1) if str(x)[0] == str(x)[-1] and str(x)[1] == str(x)[-2]] print((len(nums)))
a, b = list(map(int, input().split())) nums = [] for i in range(a, b+1): str_i = str(i) if str_i[0] == str_i[-1] and str_i[1] == str_i[-2]: nums.append(i) print((len(nums)))
4
10
142
193
a, b = list(map(int, input().split())) nums = [ x for x in range(a, b + 1) if str(x)[0] == str(x)[-1] and str(x)[1] == str(x)[-2] ] print((len(nums)))
a, b = list(map(int, input().split())) nums = [] for i in range(a, b + 1): str_i = str(i) if str_i[0] == str_i[-1] and str_i[1] == str_i[-2]: nums.append(i) print((len(nums)))
false
60
[ "-nums = [", "- x for x in range(a, b + 1) if str(x)[0] == str(x)[-1] and str(x)[1] == str(x)[-2]", "-]", "+nums = []", "+for i in range(a, b + 1):", "+ str_i = str(i)", "+ if str_i[0] == str_i[-1] and str_i[1] == str_i[-2]:", "+ nums.append(i)" ]
false
0.063486
0.063821
0.994758
[ "s975037188", "s432884768" ]
u252828980
p02912
python
s195610984
s687396075
195
157
14,224
14,180
Accepted
Accepted
19.49
a,b = list(map(int,input().split())) li = [-int(x) for x in input().split()] import heapq heapq.heapify(li) for i in range(b): c = heapq.heappop(li) heapq.heappush(li,c/2) li = [int(x) for x in li] print((-sum(li)))
import heapq a,b = list(map(int,input().split())) L = list(map(int,input().split())) L = [-x for x in L] heapq.heapify(L) for i in range(b): a =heapq.heappop(L) a= -(-a//2) heapq.heappush(L,a) L = [-x for x in L] print((sum(L)))
9
13
223
246
a, b = list(map(int, input().split())) li = [-int(x) for x in input().split()] import heapq heapq.heapify(li) for i in range(b): c = heapq.heappop(li) heapq.heappush(li, c / 2) li = [int(x) for x in li] print((-sum(li)))
import heapq a, b = list(map(int, input().split())) L = list(map(int, input().split())) L = [-x for x in L] heapq.heapify(L) for i in range(b): a = heapq.heappop(L) a = -(-a // 2) heapq.heappush(L, a) L = [-x for x in L] print((sum(L)))
false
30.769231
[ "-a, b = list(map(int, input().split()))", "-li = [-int(x) for x in input().split()]", "-heapq.heapify(li)", "+a, b = list(map(int, input().split()))", "+L = list(map(int, input().split()))", "+L = [-x for x in L]", "+heapq.heapify(L)", "- c = heapq.heappop(li)", "- heapq.heappush(li, c / 2)",...
false
0.040655
0.073796
0.550913
[ "s195610984", "s687396075" ]
u863370423
p03556
python
s298743328
s010592081
61
17
3,060
2,940
Accepted
Accepted
72.13
import math def is_integer(n): try: float(n) except ValueError: return False else: return float(n).is_integer() l = int(eval(input())) if is_integer(math.sqrt(l)): print(l) else: for i in range(l): l=l-1 if is_integer(math.sqrt(l)): ...
import math n=float(eval(input())) m=math.floor(math.sqrt(n)) print((m*m))
19
4
346
69
import math def is_integer(n): try: float(n) except ValueError: return False else: return float(n).is_integer() l = int(eval(input())) if is_integer(math.sqrt(l)): print(l) else: for i in range(l): l = l - 1 if is_integer(math.sqrt(l)): print(l...
import math n = float(eval(input())) m = math.floor(math.sqrt(n)) print((m * m))
false
78.947368
[ "-", "-def is_integer(n):", "- try:", "- float(n)", "- except ValueError:", "- return False", "- else:", "- return float(n).is_integer()", "-", "-", "-l = int(eval(input()))", "-if is_integer(math.sqrt(l)):", "- print(l)", "-else:", "- for i in range(l...
false
0.058423
0.040842
1.430486
[ "s298743328", "s010592081" ]
u102461423
p02564
python
s283862779
s953986878
2,189
1,384
176,816
178,436
Accepted
Accepted
36.77
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8), cache=True) def scc_dfs(N, G, idx, low, o...
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8), cache=True) def scc_dfs(N, G, idx, low, o...
71
74
2,185
2,240
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8), cache=True) def scc_dfs(N, G, idx, low, ord, ids, visited...
import sys import numpy as np import numba from numba import njit, b1, i4, i8, f8 read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines @njit((i8, i8[:, :], i8[:], i8[:], i8[:], i8[:], i8[:], i8, i8, i8, i8), cache=True) def scc_dfs(N, G, idx, low, ord, ids, visited...
false
4.054054
[ "+@njit((i8, i8[:, :]), cache=True)", "- print(len(V), \" \".join(map(str, V)))", "+ print(len(V))", "+ for v in V:", "+ print(v)" ]
false
0.042071
0.036369
1.156804
[ "s283862779", "s953986878" ]
u010075034
p03999
python
s991955257
s013726627
53
44
3,064
3,188
Accepted
Accepted
16.98
import itertools def spl(s, t): lst = list(s) for x in reversed(t): lst.insert(x, '+') return eval(''.join(lst)) def main(): nums = eval(input()) length = len(nums) total = 0 for i in range(length): for ts in itertools.combinations(list(range(1, length)), i):...
import itertools def split(xs, t): total = 0 tmp = [] for i, x in enumerate(xs): if i in t: total += int(''.join(tmp)) tmp = [x] else: tmp.append(x) if tmp: total += int(''.join(tmp)) return total def main(): nums = ...
20
27
405
562
import itertools def spl(s, t): lst = list(s) for x in reversed(t): lst.insert(x, "+") return eval("".join(lst)) def main(): nums = eval(input()) length = len(nums) total = 0 for i in range(length): for ts in itertools.combinations(list(range(1, length)), i): ...
import itertools def split(xs, t): total = 0 tmp = [] for i, x in enumerate(xs): if i in t: total += int("".join(tmp)) tmp = [x] else: tmp.append(x) if tmp: total += int("".join(tmp)) return total def main(): nums = list(eval(input(...
false
25.925926
[ "-def spl(s, t):", "- lst = list(s)", "- for x in reversed(t):", "- lst.insert(x, \"+\")", "- return eval(\"\".join(lst))", "+def split(xs, t):", "+ total = 0", "+ tmp = []", "+ for i, x in enumerate(xs):", "+ if i in t:", "+ total += int(\"\".join(tmp)...
false
0.037112
0.080273
0.462322
[ "s991955257", "s013726627" ]
u652068981
p02639
python
s599345635
s073921341
30
26
9,084
9,084
Accepted
Accepted
13.33
x=list(map(int,input().split())) print((x.index(0)+1))
print((input().find('0')//2+1))
2
1
54
29
x = list(map(int, input().split())) print((x.index(0) + 1))
print((input().find("0") // 2 + 1))
false
50
[ "-x = list(map(int, input().split()))", "-print((x.index(0) + 1))", "+print((input().find(\"0\") // 2 + 1))" ]
false
0.040665
0.0428
0.950131
[ "s599345635", "s073921341" ]
u198905553
p02959
python
s731977205
s667845933
292
268
82,020
82,148
Accepted
Accepted
8.22
n = int(eval(input())) a = [int(e) for e in input().split()] b = [int(e) for e in input().split()] result = 0 for i in range(n): if a[i] > b[i]: result += b[i] a[i] -= b[i] b[i] = 0 else: result += a[i] b[i] -= a[i] a[i] = 0 if a[i + 1] > b[i]: result += b[i] a...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) result = 0 for i in range(N): if B[i] >= A[i]: result += A[i] B[i] -= A[i] A[i] = 0 if B[i] >= A[i+1]: result += A[i+1] B[i] -= A[i+1]...
22
28
441
533
n = int(eval(input())) a = [int(e) for e in input().split()] b = [int(e) for e in input().split()] result = 0 for i in range(n): if a[i] > b[i]: result += b[i] a[i] -= b[i] b[i] = 0 else: result += a[i] b[i] -= a[i] a[i] = 0 if a[i + 1] > b[i]: ...
N = int(eval(input())) A = list(map(int, input().split())) B = list(map(int, input().split())) result = 0 for i in range(N): if B[i] >= A[i]: result += A[i] B[i] -= A[i] A[i] = 0 if B[i] >= A[i + 1]: result += A[i + 1] B[i] -= A[i + 1] A[i + 1] = 0...
false
21.428571
[ "-n = int(eval(input()))", "-a = [int(e) for e in input().split()]", "-b = [int(e) for e in input().split()]", "+N = int(eval(input()))", "+A = list(map(int, input().split()))", "+B = list(map(int, input().split()))", "-for i in range(n):", "- if a[i] > b[i]:", "- result += b[i]", "- ...
false
0.050075
0.050017
1.001163
[ "s731977205", "s667845933" ]
u905582793
p03854
python
s729500994
s036727974
73
24
3,244
6,516
Accepted
Accepted
67.12
s=input()[::-1] for i in range(10**5): if s[:5]=="maerd": s=s[5:] elif s[:7]=="remaerd": s=s[7:] elif s[:5]=="esare": s=s[5:] elif s[:6]=="resare": s=s[6:] elif s=="": print("YES") break else: print("NO") break
import re s = eval(input()) if re.fullmatch(r"(dream|dreamer|erase|eraser)+",s): print("YES") else: print("NO")
16
6
269
114
s = input()[::-1] for i in range(10**5): if s[:5] == "maerd": s = s[5:] elif s[:7] == "remaerd": s = s[7:] elif s[:5] == "esare": s = s[5:] elif s[:6] == "resare": s = s[6:] elif s == "": print("YES") break else: print("NO") break
import re s = eval(input()) if re.fullmatch(r"(dream|dreamer|erase|eraser)+", s): print("YES") else: print("NO")
false
62.5
[ "-s = input()[::-1]", "-for i in range(10**5):", "- if s[:5] == \"maerd\":", "- s = s[5:]", "- elif s[:7] == \"remaerd\":", "- s = s[7:]", "- elif s[:5] == \"esare\":", "- s = s[5:]", "- elif s[:6] == \"resare\":", "- s = s[6:]", "- elif s == \"\":", ...
false
0.045005
0.041107
1.094837
[ "s729500994", "s036727974" ]
u607865971
p02928
python
s273274490
s856545813
1,480
796
3,952
3,316
Accepted
Accepted
46.22
import sys, math, itertools, bisect, copy, re from collections import Counter, deque, defaultdict from itertools import accumulate, permutations, combinations, takewhile, compress, cycle from functools import reduce from math import ceil, floor, log10, log2, factorial from pprint import pprint # 10倍速いらしい inp...
N, K = [int(x) for x in input().split()] A = [int(x) for x in input().split()] z = 0 for i in range(N-1): for j in range(i+1, N): if A[i] > A[j]: z += 1 y = 0 for a1 in A: for a2 in A: if a1 > a2: y+=1 mod = 10**9 + 7 ans = z * (K) + y * (K) * (K-1)...
47
21
1,096
344
import sys, math, itertools, bisect, copy, re from collections import Counter, deque, defaultdict from itertools import accumulate, permutations, combinations, takewhile, compress, cycle from functools import reduce from math import ceil, floor, log10, log2, factorial from pprint import pprint # 10倍速いらしい input = sys.s...
N, K = [int(x) for x in input().split()] A = [int(x) for x in input().split()] z = 0 for i in range(N - 1): for j in range(i + 1, N): if A[i] > A[j]: z += 1 y = 0 for a1 in A: for a2 in A: if a1 > a2: y += 1 mod = 10**9 + 7 ans = z * (K) + y * (K) * (K - 1) // 2 print((an...
false
55.319149
[ "-import sys, math, itertools, bisect, copy, re", "-from collections import Counter, deque, defaultdict", "-from itertools import accumulate, permutations, combinations, takewhile, compress, cycle", "-from functools import reduce", "-from math import ceil, floor, log10, log2, factorial", "-from pprint imp...
false
0.052695
0.036038
1.462223
[ "s273274490", "s856545813" ]
u620084012
p02779
python
s892860524
s282748522
325
264
88,916
91,268
Accepted
Accepted
18.77
N = int(eval(input())) A = sorted(list(map(int,input().split()))) for k in range(1,N): if A[k-1] == A[k]: print("NO") exit(0) print("YES")
N = int(eval(input())) A = set(input().split()) if len(A) == N: print("YES") else: print("NO")
7
6
159
102
N = int(eval(input())) A = sorted(list(map(int, input().split()))) for k in range(1, N): if A[k - 1] == A[k]: print("NO") exit(0) print("YES")
N = int(eval(input())) A = set(input().split()) if len(A) == N: print("YES") else: print("NO")
false
14.285714
[ "-A = sorted(list(map(int, input().split())))", "-for k in range(1, N):", "- if A[k - 1] == A[k]:", "- print(\"NO\")", "- exit(0)", "-print(\"YES\")", "+A = set(input().split())", "+if len(A) == N:", "+ print(\"YES\")", "+else:", "+ print(\"NO\")" ]
false
0.098492
0.125451
0.7851
[ "s892860524", "s282748522" ]
u671060652
p02682
python
s040725866
s544086068
486
133
72,644
72,736
Accepted
Accepted
72.63
import itertools import math import fractions import functools a, b,c, k = list(map(int, input().split())) sum = 0 if k <= a: sum = k print(sum) quit() elif k > a: sum += a k = k - a if k <= b: print(sum) quit() elif k > b: k = k - b sum -= k * 1 print(su...
import itertools import math import fractions import functools a, b, c, k = list(map(int, input().split())) sum = 0 if k <= a: print(k) quit() else: sum = a k -= a if k <= b: print(sum) quit() else: k -= b print((sum-k))
25
19
317
260
import itertools import math import fractions import functools a, b, c, k = list(map(int, input().split())) sum = 0 if k <= a: sum = k print(sum) quit() elif k > a: sum += a k = k - a if k <= b: print(sum) quit() elif k > b: k = k - b sum -= k * 1 print(sum)
import itertools import math import fractions import functools a, b, c, k = list(map(int, input().split())) sum = 0 if k <= a: print(k) quit() else: sum = a k -= a if k <= b: print(sum) quit() else: k -= b print((sum - k))
false
24
[ "- sum = k", "- print(sum)", "+ print(k)", "-elif k > a:", "- sum += a", "- k = k - a", "+else:", "+ sum = a", "+ k -= a", "-elif k > b:", "- k = k - b", "- sum -= k * 1", "-print(sum)", "+else:", "+ k -= b", "+print((sum - k))" ]
false
0.036805
0.147558
0.24943
[ "s040725866", "s544086068" ]
u912237403
p02388
python
s530181313
s869782243
20
10
4,192
4,196
Accepted
Accepted
50
import sys for x in sys.stdin: print(int(x)**3)
for x in map(int, input().split()): print(int(x)**3)
3
2
52
60
import sys for x in sys.stdin: print(int(x) ** 3)
for x in map(int, input().split()): print(int(x) ** 3)
false
33.333333
[ "-import sys", "-", "-for x in sys.stdin:", "+for x in map(int, input().split()):" ]
false
0.037278
0.040645
0.917146
[ "s530181313", "s869782243" ]
u638902622
p02720
python
s789434759
s815270101
183
120
17,004
19,680
Accepted
Accepted
34.43
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque def main(): K = int(eval(input())) cnt = 0 dq = deque(['1','2','3','4','5','6','7','8','9']) while cnt < K: cnt += 1 d = dq.popleft() ...
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque def main(): K = int(eval(input())) # cnt = 0 # dq = deque(['1','2','3','4','5','6','7','8','9']) # while cnt < K: # cnt += 1 # d = dq.po...
28
39
661
1,070
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque def main(): K = int(eval(input())) cnt = 0 dq = deque(["1", "2", "3", "4", "5", "6", "7", "8", "9"]) while cnt < K: cnt += 1 d = dq.popleft() ...
import sys input = lambda: sys.stdin.readline().rstrip() input_nums = lambda: list(map(int, input().split())) from collections import deque def main(): K = int(eval(input())) # cnt = 0 # dq = deque(['1','2','3','4','5','6','7','8','9']) # while cnt < K: # cnt += 1 # d = dq.popleft() ...
false
28.205128
[ "- cnt = 0", "- dq = deque([\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"])", "- while cnt < K:", "- cnt += 1", "- d = dq.popleft()", "- a = int(d[-1])", "- if a == 0:", "- dq.append(d + str(0))", "- dq.append(d + str(1))", ...
false
0.062693
0.295466
0.212185
[ "s789434759", "s815270101" ]
u526603504
p03716
python
s033223243
s452953224
784
703
120,392
119,976
Accepted
Accepted
10.33
from collections import deque from heapq import heapify, heappop as pop, heappush as push N = int(eval(input())) a = list(map(int, input().split())) l = a[:N] m = deque(a[N:N*2]) r = [x * -1 for x in a[N*2:]] # 中身は負 heapify(l) heapify(r) ll = [sum(l)] for em in m: l_min = pop(l) if l_min < e...
from heapq import heapify, heappop as pop, heappush as push N = int(eval(input())) a = list(map(int, input().split())) l = a[:N] m = a[N:N*2] r = [x * -1 for x in a[N*2:]] # 中身は負 heapify(l) heapify(r) ll = [sum(l)] for em in m: l_min = pop(l) if l_min < em: ll.append(ll[-1] - l_min +...
34
33
720
683
from collections import deque from heapq import heapify, heappop as pop, heappush as push N = int(eval(input())) a = list(map(int, input().split())) l = a[:N] m = deque(a[N : N * 2]) r = [x * -1 for x in a[N * 2 :]] # 中身は負 heapify(l) heapify(r) ll = [sum(l)] for em in m: l_min = pop(l) if l_min < em: ...
from heapq import heapify, heappop as pop, heappush as push N = int(eval(input())) a = list(map(int, input().split())) l = a[:N] m = a[N : N * 2] r = [x * -1 for x in a[N * 2 :]] # 中身は負 heapify(l) heapify(r) ll = [sum(l)] for em in m: l_min = pop(l) if l_min < em: ll.append(ll[-1] - l_min + em) ...
false
2.941176
[ "-from collections import deque", "-m = deque(a[N : N * 2])", "+m = a[N : N * 2]" ]
false
0.040579
0.041709
0.972898
[ "s033223243", "s452953224" ]
u711539583
p03045
python
s187197085
s657177330
1,790
829
71,268
67,120
Accepted
Accepted
53.69
import sys from collections import deque sys.setrecursionlimit(10**9) input = sys.stdin.readline n, m = list(map(int, input().split())) memo = set(list(range(n))) E = [[] for i in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) E[x-1].append(y-1) E[y-1].append(x-1) def dfs(...
import sys from collections import deque sys.setrecursionlimit(10**9) input = sys.stdin.readline n, m = list(map(int, input().split())) memo = [1 for _ in range(n)] E = [[] for _ in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) E[x-1].append(y-1) E[y-1].append(x-1) def df...
25
25
633
627
import sys from collections import deque sys.setrecursionlimit(10**9) input = sys.stdin.readline n, m = list(map(int, input().split())) memo = set(list(range(n))) E = [[] for i in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) E[x - 1].append(y - 1) E[y - 1].append(x - 1) def dfs(...
import sys from collections import deque sys.setrecursionlimit(10**9) input = sys.stdin.readline n, m = list(map(int, input().split())) memo = [1 for _ in range(n)] E = [[] for _ in range(n)] for i in range(m): x, y, z = list(map(int, input().split())) E[x - 1].append(y - 1) E[y - 1].append(x - 1) def df...
false
0
[ "-memo = set(list(range(n)))", "-E = [[] for i in range(n)]", "+memo = [1 for _ in range(n)]", "+E = [[] for _ in range(n)]", "- memo.discard(cur)", "+ memo[cur] = 0", "- if e != pre and e in memo:", "+ if e != pre and memo[e]:", "- if i in memo:", "+ if m...
false
0.072525
0.052073
1.392759
[ "s187197085", "s657177330" ]
u303059352
p03807
python
s712496264
s179005021
51
40
14,108
11,104
Accepted
Accepted
21.57
eval(input());print((["YES","NO"][sum([1 if i%2 else 0 for i in list(map(int,input().split()))])%2]))
eval(input());print((["YES","NO"][sum(map(int,input().split()))%2]))
1
1
93
60
eval(input()) print( ( ["YES", "NO"][ sum([1 if i % 2 else 0 for i in list(map(int, input().split()))]) % 2 ] ) )
eval(input()) print((["YES", "NO"][sum(map(int, input().split())) % 2]))
false
0
[ "-print(", "- (", "- [\"YES\", \"NO\"][", "- sum([1 if i % 2 else 0 for i in list(map(int, input().split()))]) % 2", "- ]", "- )", "-)", "+print(([\"YES\", \"NO\"][sum(map(int, input().split())) % 2]))" ]
false
0.036681
0.037253
0.984665
[ "s712496264", "s179005021" ]
u503228842
p03837
python
s902427927
s523025346
503
293
48,604
48,300
Accepted
Accepted
41.75
N,M = list(map(int,input().split())) inf = float('inf') D = [[inf]*N for _ in range(N)] for i in range(N): D[i][i] = 0 edges = [] for _ in range(M): a,b,c = list(map(int,input().split())) a -= 1 b -= 1 D[a][b] = c D[b][a] = c edges.append([a,b,c]) for k in range(N): for...
N,M = list(map(int,input().split())) inf = float('inf') D = [[inf]*N for _ in range(N)] for i in range(N): D[i][i] = 0 edges = [] for _ in range(M): a,b,c = list(map(int,input().split())) a -= 1 b -= 1 D[a][b] = c D[b][a] = c edges.append([a,b,c]) for k in range(N): for...
31
30
684
638
N, M = list(map(int, input().split())) inf = float("inf") D = [[inf] * N for _ in range(N)] for i in range(N): D[i][i] = 0 edges = [] for _ in range(M): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 D[a][b] = c D[b][a] = c edges.append([a, b, c]) for k in range(N): for i in ran...
N, M = list(map(int, input().split())) inf = float("inf") D = [[inf] * N for _ in range(N)] for i in range(N): D[i][i] = 0 edges = [] for _ in range(M): a, b, c = list(map(int, input().split())) a -= 1 b -= 1 D[a][b] = c D[b][a] = c edges.append([a, b, c]) for k in range(N): for i in ran...
false
3.225806
[ "- for t in range(N):", "- if D[s][e[0]] + e[2] + D[e[1]][t] == D[s][t]:", "- used = True", "+ if D[s][e[0]] + e[2] == D[s][e[1]]:", "+ used = True" ]
false
0.043326
0.035912
1.20644
[ "s902427927", "s523025346" ]
u227082700
p03200
python
s505594169
s301994495
98
70
3,500
3,500
Accepted
Accepted
28.57
a,s,b=0,eval(input()),0 for i in range(len(s)):a+=i*(s[i]=="W");b+=(s[i]=="W") print((a-((b*(b-1))//2)))
a,s,b=0,eval(input()),0 for i in range(len(s)): if s[i]=="W":a+=i;b+=1 print((a-((b*(b-1))//2)))
3
4
98
93
a, s, b = 0, eval(input()), 0 for i in range(len(s)): a += i * (s[i] == "W") b += s[i] == "W" print((a - ((b * (b - 1)) // 2)))
a, s, b = 0, eval(input()), 0 for i in range(len(s)): if s[i] == "W": a += i b += 1 print((a - ((b * (b - 1)) // 2)))
false
25
[ "- a += i * (s[i] == \"W\")", "- b += s[i] == \"W\"", "+ if s[i] == \"W\":", "+ a += i", "+ b += 1" ]
false
0.03474
0.035629
0.975047
[ "s505594169", "s301994495" ]
u046158516
p02586
python
s872839076
s654179988
1,805
840
468,416
439,788
Accepted
Accepted
53.46
import os,io import sys input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline r,c,k=list(map(int,input().split())) dp = [[[0 for y in range(c)] for z in range(r)] for P in range(4)] m=[] for i in range(r): m.append([]) for j in range(c): m[i].append(0) for i in range(k): ri,ci,v=list(map(int,in...
import os,io import sys input=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline r,c,k=list(map(int,input().split())) dp = [0]*(r*c*4) m=[] for i in range(r): m.append([]) for j in range(c): m[i].append(0) for i in range(k): ri,ci,v=list(map(int,input().split())) m[ri-1][ci-1]=v dp[0*r*c+0*c+0...
31
31
973
1,045
import os, io import sys input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline r, c, k = list(map(int, input().split())) dp = [[[0 for y in range(c)] for z in range(r)] for P in range(4)] m = [] for i in range(r): m.append([]) for j in range(c): m[i].append(0) for i in range(k): ri, ci, v = ...
import os, io import sys input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline r, c, k = list(map(int, input().split())) dp = [0] * (r * c * 4) m = [] for i in range(r): m.append([]) for j in range(c): m[i].append(0) for i in range(k): ri, ci, v = list(map(int, input().split())) m[ri - 1...
false
0
[ "-dp = [[[0 for y in range(c)] for z in range(r)] for P in range(4)]", "+dp = [0] * (r * c * 4)", "-dp[0][0][0] = 0", "-dp[1][0][0] = m[0][0]", "-dp[2][0][0] = m[0][0]", "-dp[3][0][0] = m[0][0]", "+dp[0 * r * c + 0 * c + 0] = 0", "+dp[1 * r * c + 0 * c + 0] = m[0][0]", "+dp[2 * r * c + 0 * c + 0] = ...
false
0.035562
0.036865
0.964642
[ "s872839076", "s654179988" ]
u133886644
p03325
python
s297140437
s476125966
142
79
4,084
4,084
Accepted
Accepted
44.37
import sys input = sys.stdin.readline N = int(eval(input())) L = [int(v) for v in input().split()] ans = 0 for v in L: c = 0 while v % (2 ** (c + 1)) == 0: c += 1 ans += c print(ans)
import sys input = sys.stdin.readline N, = list(map(int, input().split())) L = [int(v) for v in input().split()] ans = 0 for v in L: while v % 2 == 0: ans += 1 v = v // 2 print(ans)
15
12
214
208
import sys input = sys.stdin.readline N = int(eval(input())) L = [int(v) for v in input().split()] ans = 0 for v in L: c = 0 while v % (2 ** (c + 1)) == 0: c += 1 ans += c print(ans)
import sys input = sys.stdin.readline (N,) = list(map(int, input().split())) L = [int(v) for v in input().split()] ans = 0 for v in L: while v % 2 == 0: ans += 1 v = v // 2 print(ans)
false
20
[ "-N = int(eval(input()))", "+(N,) = list(map(int, input().split()))", "- c = 0", "- while v % (2 ** (c + 1)) == 0:", "- c += 1", "- ans += c", "+ while v % 2 == 0:", "+ ans += 1", "+ v = v // 2" ]
false
0.04761
0.041849
1.137646
[ "s297140437", "s476125966" ]
u279493135
p02690
python
s596268747
s936481184
320
81
10,308
10,616
Accepted
Accepted
74.69
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement from operator import itemgetter, mul from copy import deepcopy ...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ...
26
27
942
901
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import ( accumulate, permutations, combinations, product, groupby, combinations_with_replacement, ) from operator import itemgetter, mul fro...
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians from itertools import accumulate, permutations, combinations, product, groupby from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_...
false
3.703704
[ "-from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd", "-from itertools import (", "- accumulate,", "- permutations,", "- combinations,", "- product,", "- groupby,", "- combinations_with_replacement,", "-)", "+from math import ceil, sqrt, hypot, factorial, ...
false
0.085931
0.178784
0.480643
[ "s596268747", "s936481184" ]
u581603131
p02711
python
s467416867
s827436659
22
20
9,032
9,028
Accepted
Accepted
9.09
N = eval(input()) print(('Yes' if '7' in N else 'No'))
print(('Yes' if '7' in eval(input()) else 'No'))
2
1
48
40
N = eval(input()) print(("Yes" if "7" in N else "No"))
print(("Yes" if "7" in eval(input()) else "No"))
false
50
[ "-N = eval(input())", "-print((\"Yes\" if \"7\" in N else \"No\"))", "+print((\"Yes\" if \"7\" in eval(input()) else \"No\"))" ]
false
0.061041
0.033549
1.819441
[ "s467416867", "s827436659" ]
u297574184
p02848
python
s983911953
s545196868
34
22
3,060
3,060
Accepted
Accepted
35.29
N = int(eval(input())) Ss = eval(input()) ordA = ord('A') ans = '' for S in Ss: i = ord(S) - ordA i = (i+N) % 26 ans += chr(ordA + i) print(ans)
ordA = ord('A') N = int(eval(input())) Ss = input().rstrip() anss = '' for S in Ss: S = ord(S) - ordA anss += chr(ordA + (S+N)%26) print(anss)
12
11
159
158
N = int(eval(input())) Ss = eval(input()) ordA = ord("A") ans = "" for S in Ss: i = ord(S) - ordA i = (i + N) % 26 ans += chr(ordA + i) print(ans)
ordA = ord("A") N = int(eval(input())) Ss = input().rstrip() anss = "" for S in Ss: S = ord(S) - ordA anss += chr(ordA + (S + N) % 26) print(anss)
false
8.333333
[ "+ordA = ord(\"A\")", "-Ss = eval(input())", "-ordA = ord(\"A\")", "-ans = \"\"", "+Ss = input().rstrip()", "+anss = \"\"", "- i = ord(S) - ordA", "- i = (i + N) % 26", "- ans += chr(ordA + i)", "-print(ans)", "+ S = ord(S) - ordA", "+ anss += chr(ordA + (S + N) % 26)", "+prin...
false
0.064284
0.036569
1.757851
[ "s983911953", "s545196868" ]
u426649993
p03986
python
s849630377
s767075364
303
67
3,756
3,500
Accepted
Accepted
77.89
if __name__ == "__main__": s = eval(input()) ans = '' for ss in s: if ss == 'S': ans += ss else: if len(ans) == 0: ans += ss elif ans[len(ans) - 1] == 'S': ans = ans[:-1] elif ans[len(ans) - 1] == ...
if __name__ == "__main__": x = eval(input()) count = 0 ans = len(x) for i in range(len(x)): if x[i] == 'S': count += 1 elif count > 0 and x[i] == 'T': ans -= 2 count -= 1 else: count = 0 print(ans)
17
15
369
300
if __name__ == "__main__": s = eval(input()) ans = "" for ss in s: if ss == "S": ans += ss else: if len(ans) == 0: ans += ss elif ans[len(ans) - 1] == "S": ans = ans[:-1] elif ans[len(ans) - 1] == "T": ...
if __name__ == "__main__": x = eval(input()) count = 0 ans = len(x) for i in range(len(x)): if x[i] == "S": count += 1 elif count > 0 and x[i] == "T": ans -= 2 count -= 1 else: count = 0 print(ans)
false
11.764706
[ "- s = eval(input())", "- ans = \"\"", "- for ss in s:", "- if ss == \"S\":", "- ans += ss", "+ x = eval(input())", "+ count = 0", "+ ans = len(x)", "+ for i in range(len(x)):", "+ if x[i] == \"S\":", "+ count += 1", "+ elif count...
false
0.037592
0.036723
1.023659
[ "s849630377", "s767075364" ]
u102461423
p03014
python
s811388393
s679519476
778
435
127,852
145,468
Accepted
Accepted
44.09
import numpy as np H,W = list(map(int,input().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H+2,W+2),dtype=np.bool) grid[1:-1,1:-1] = (np.array([list(eval(input())) for _ in range(H)]) == '.') L = grid.size # x軸方向の集計 def F(transpose): x = grid if transpose: x = x.T x = np.ravel(x) # to 1D ar...
import numpy as np import sys buf = sys.stdin.buffer H,W = list(map(int,buf.readline().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H+2,W+2),dtype=np.bool) grid[1:-1,1:] = (np.frombuffer(buf.read(H*(W+1)),dtype='S1') == b'.').reshape((H,W+1)) # x軸方向の集計 def F(transpose): x = grid if transpose: x...
31
32
754
817
import numpy as np H, W = list(map(int, input().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H + 2, W + 2), dtype=np.bool) grid[1:-1, 1:-1] = np.array([list(eval(input())) for _ in range(H)]) == "." L = grid.size # x軸方向の集計 def F(transpose): x = grid if transpose: x = x.T x = np.ravel(x) # to 1D ...
import numpy as np import sys buf = sys.stdin.buffer H, W = list(map(int, buf.readline().split())) # 周りに壁を、0,1化、壁を0で持つ grid = np.zeros((H + 2, W + 2), dtype=np.bool) grid[1:-1, 1:] = (np.frombuffer(buf.read(H * (W + 1)), dtype="S1") == b".").reshape( (H, W + 1) ) # x軸方向の集計 def F(transpose): x = grid if tra...
false
3.125
[ "+import sys", "-H, W = list(map(int, input().split()))", "+buf = sys.stdin.buffer", "+H, W = list(map(int, buf.readline().split()))", "-grid[1:-1, 1:-1] = np.array([list(eval(input())) for _ in range(H)]) == \".\"", "-L = grid.size", "+grid[1:-1, 1:] = (np.frombuffer(buf.read(H * (W + 1)), dtype=\"S1\"...
false
0.520589
0.466712
1.115439
[ "s811388393", "s679519476" ]
u600402037
p02996
python
s337317378
s111746924
948
783
55,252
53,696
Accepted
Accepted
17.41
a = [int(eval(input())) for i in range(1)] n = a[0] works = [list(map(int, input().split())) for i in range(n)] #print(works) works = sorted(works, key=lambda x: x[1]) work_time = 0 for w in works: work_time += w[0] if work_time > w[1]: print("No") break else: print("Yes")
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() AB = [lr() for _ in range(N)] AB.sort(key=lambda x: x[1]) answer = 'Yes' time = 0 for i in range(N): if time + AB[i][0] > AB[i][1]: answer = 'No' time += AB[i][...
13
17
296
340
a = [int(eval(input())) for i in range(1)] n = a[0] works = [list(map(int, input().split())) for i in range(n)] # print(works) works = sorted(works, key=lambda x: x[1]) work_time = 0 for w in works: work_time += w[0] if work_time > w[1]: print("No") break else: print("Yes")
import sys sr = lambda: sys.stdin.readline().rstrip() ir = lambda: int(sr()) lr = lambda: list(map(int, sr().split())) N = ir() AB = [lr() for _ in range(N)] AB.sort(key=lambda x: x[1]) answer = "Yes" time = 0 for i in range(N): if time + AB[i][0] > AB[i][1]: answer = "No" time += AB[i][0] print(answer...
false
23.529412
[ "-a = [int(eval(input())) for i in range(1)]", "-n = a[0]", "-works = [list(map(int, input().split())) for i in range(n)]", "-# print(works)", "-works = sorted(works, key=lambda x: x[1])", "-work_time = 0", "-for w in works:", "- work_time += w[0]", "- if work_time > w[1]:", "- print(...
false
0.039586
0.060365
0.655776
[ "s337317378", "s111746924" ]
u018679195
p02696
python
s784319965
s959022959
70
23
68,988
8,908
Accepted
Accepted
67.14
from sys import stdin, stdout from collections import defaultdict import math from queue import Queue a, b, n = list(map(int, stdin.readline().strip().split())) x = min(b - 1, n) ans = math.floor(a * x / b) - a * math.floor(x / b) stdout.writelines(str(ans) + '\n')
import math def eq_value(a, b, x): return math.floor(a * x / b) - a * math.floor(x / b) A, B, n = list(map(int, input().split())) print((eq_value(A, B, min(B-1, n))))
13
9
277
175
from sys import stdin, stdout from collections import defaultdict import math from queue import Queue a, b, n = list(map(int, stdin.readline().strip().split())) x = min(b - 1, n) ans = math.floor(a * x / b) - a * math.floor(x / b) stdout.writelines(str(ans) + "\n")
import math def eq_value(a, b, x): return math.floor(a * x / b) - a * math.floor(x / b) A, B, n = list(map(int, input().split())) print((eq_value(A, B, min(B - 1, n))))
false
30.769231
[ "-from sys import stdin, stdout", "-from collections import defaultdict", "-from queue import Queue", "-a, b, n = list(map(int, stdin.readline().strip().split()))", "-x = min(b - 1, n)", "-ans = math.floor(a * x / b) - a * math.floor(x / b)", "-stdout.writelines(str(ans) + \"\\n\")", "+", "+def eq_v...
false
0.139576
0.047193
2.957579
[ "s784319965", "s959022959" ]
u063052907
p03835
python
s552847184
s218407504
1,467
19
2,940
2,940
Accepted
Accepted
98.7
# coding: utf-8 K, S = list(map(int, input().split())) cnt=0 for x in range(K+1): yz = S - x if yz < 0: break elif yz > 2*K: continue else: for y in range(K+1): z = S - x - y if 0<...
# coding: utf-8 K, S = list(map(int, input().split())) cnt=0 for x in range(K+1): yz = S - x if yz < 0: break elif yz > 2*K: continue else: cnt += yz + 1 - 2 * max(0, yz - K) print(cnt)
15
12
373
271
# coding: utf-8 K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): yz = S - x if yz < 0: break elif yz > 2 * K: continue else: for y in range(K + 1): z = S - x - y if 0 <= z <= K: cnt += 1 print(cnt)
# coding: utf-8 K, S = list(map(int, input().split())) cnt = 0 for x in range(K + 1): yz = S - x if yz < 0: break elif yz > 2 * K: continue else: cnt += yz + 1 - 2 * max(0, yz - K) print(cnt)
false
20
[ "- for y in range(K + 1):", "- z = S - x - y", "- if 0 <= z <= K:", "- cnt += 1", "+ cnt += yz + 1 - 2 * max(0, yz - K)" ]
false
0.088937
0.008804
10.102301
[ "s552847184", "s218407504" ]
u054514819
p02742
python
s495058518
s191479724
19
17
2,940
3,060
Accepted
Accepted
10.53
H, W = list(map(int, input().split())) if H==1 or W==1: print((1)) else: print(((H*W+1)//2))
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) from math import ceil H, W = mapint() if H==1 or W==1: print((1)) else: print((ceil(H*W/2)))
5
11
90
243
H, W = list(map(int, input().split())) if H == 1 or W == 1: print((1)) else: print(((H * W + 1) // 2))
import sys def input(): return sys.stdin.readline().strip() def mapint(): return list(map(int, input().split())) sys.setrecursionlimit(10**9) from math import ceil H, W = mapint() if H == 1 or W == 1: print((1)) else: print((ceil(H * W / 2)))
false
54.545455
[ "-H, W = list(map(int, input().split()))", "+import sys", "+", "+", "+def input():", "+ return sys.stdin.readline().strip()", "+", "+", "+def mapint():", "+ return list(map(int, input().split()))", "+", "+", "+sys.setrecursionlimit(10**9)", "+from math import ceil", "+", "+H, W =...
false
0.102824
0.066601
1.543867
[ "s495058518", "s191479724" ]
u718949306
p02813
python
s143083688
s973176912
48
29
3,064
3,064
Accepted
Accepted
39.58
import itertools s = 1 a = 0 b = 0 N = int(eval(input())) p = list(map(int, input().split())) q = list(map(int, input().split())) ite = [x for x in range(1, N + 1)] ite = itertools.permutations(ite) for i in ite: if list(i) == p: a = s s += 1 s = 1 ite = [x for x in range(1, N + 1)] ite =...
import itertools N = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) ite = [x for x in range(1, N + 1)] ite = itertools.permutations(ite) a = 0 b = 0 s = 1 for i in ite: if i == p: a = s if i == q: b = s s += 1 if a > b: total ...
25
20
476
361
import itertools s = 1 a = 0 b = 0 N = int(eval(input())) p = list(map(int, input().split())) q = list(map(int, input().split())) ite = [x for x in range(1, N + 1)] ite = itertools.permutations(ite) for i in ite: if list(i) == p: a = s s += 1 s = 1 ite = [x for x in range(1, N + 1)] ite = itertools.per...
import itertools N = int(eval(input())) p = tuple(map(int, input().split())) q = tuple(map(int, input().split())) ite = [x for x in range(1, N + 1)] ite = itertools.permutations(ite) a = 0 b = 0 s = 1 for i in ite: if i == p: a = s if i == q: b = s s += 1 if a > b: total = a - b else: ...
false
20
[ "-s = 1", "+N = int(eval(input()))", "+p = tuple(map(int, input().split()))", "+q = tuple(map(int, input().split()))", "+ite = [x for x in range(1, N + 1)]", "+ite = itertools.permutations(ite)", "-N = int(eval(input()))", "-p = list(map(int, input().split()))", "-q = list(map(int, input().split()))...
false
0.040662
0.074814
0.543514
[ "s143083688", "s973176912" ]
u643679148
p02802
python
s230160833
s165042892
254
216
36,464
18,212
Accepted
Accepted
14.96
from collections import defaultdict as dic n, m = list(map(int, input().split())) ac = 0 pena = 0 d = dic(list) for i in range(m): pi, si = input().split() d[pi].append(si) for (k, v) in list(d.items()): pe = 0 flag = False for aw in v: if aw == 'WA': pe += 1 ...
# -*- coding: utf-8 -*- n, m = list(map(int, input().split())) ck = set() pe = 0 ac = 0 penalty = 0 cp = [0] * (n+1) for i in range(m): p, s = input().split() p = int(p) if p in ck: continue if s == 'WA': cp[p] += 1 else: penalty += cp[p] pe = 0 ...
24
22
438
368
from collections import defaultdict as dic n, m = list(map(int, input().split())) ac = 0 pena = 0 d = dic(list) for i in range(m): pi, si = input().split() d[pi].append(si) for (k, v) in list(d.items()): pe = 0 flag = False for aw in v: if aw == "WA": pe += 1 else: ...
# -*- coding: utf-8 -*- n, m = list(map(int, input().split())) ck = set() pe = 0 ac = 0 penalty = 0 cp = [0] * (n + 1) for i in range(m): p, s = input().split() p = int(p) if p in ck: continue if s == "WA": cp[p] += 1 else: penalty += cp[p] pe = 0 ac += 1 ...
false
8.333333
[ "-from collections import defaultdict as dic", "-", "+# -*- coding: utf-8 -*-", "+ck = set()", "+pe = 0", "-pena = 0", "-d = dic(list)", "+penalty = 0", "+cp = [0] * (n + 1)", "- pi, si = input().split()", "- d[pi].append(si)", "-for (k, v) in list(d.items()):", "- pe = 0", "- ...
false
0.04273
0.070704
0.604349
[ "s230160833", "s165042892" ]
u490553751
p02724
python
s260246230
s549223361
91
30
3,444
9,076
Accepted
Accepted
67.03
#template def inputlist(): return [int(j) for j in input().split()] from collections import Counter #template #issueから始める X = int(eval(input())) k = X //500 ans = 0 ans += 1000*k X -= 500*k l = X //5 ans += 5*l print(ans)
N = int(eval(input())) d = N // 500 mod = N % 500 d2 = mod // 5 print((d*1000+d2*5))
13
5
227
80
# template def inputlist(): return [int(j) for j in input().split()] from collections import Counter # template # issueから始める X = int(eval(input())) k = X // 500 ans = 0 ans += 1000 * k X -= 500 * k l = X // 5 ans += 5 * l print(ans)
N = int(eval(input())) d = N // 500 mod = N % 500 d2 = mod // 5 print((d * 1000 + d2 * 5))
false
61.538462
[ "-# template", "-def inputlist():", "- return [int(j) for j in input().split()]", "-", "-", "-from collections import Counter", "-", "-# template", "-# issueから始める", "-X = int(eval(input()))", "-k = X // 500", "-ans = 0", "-ans += 1000 * k", "-X -= 500 * k", "-l = X // 5", "-ans += 5...
false
0.03712
0.037987
0.97717
[ "s260246230", "s549223361" ]
u133936772
p03014
python
s277006814
s274631947
1,739
1,554
179,332
111,836
Accepted
Accepted
10.64
h,w=list(map(int,input().split())) f=lambda:[[0]*w for _ in range(h)] g=[eval(input()) for _ in range(h)] l,r=f(),f() for i in range(h): lc=rc=0 for j in range(w): if g[i][j]=='.': lc+=1; l[i][j]=lc else: lc=0 if g[i][-1-j]=='.': rc+=1; r[i][-1-j]=rc else: rc=0 d,u=f(),f() for i in range...
h,w=list(map(int,input().split())) g=[[c=='.'for c in eval(input())] for _ in range(h)] a=[[-3]*w for _ in range(h)] for i in range(h): l=r=0 for j in range(w): l=-~l*g[i][j]; a[i][j]+=l r=-~r*g[i][-1-j]; a[i][-1-j]+=r for i in range(w): d=u=0 for j in range(h): d=-~d*g[j][i]; a[j][i]+=d ...
20
14
546
401
h, w = list(map(int, input().split())) f = lambda: [[0] * w for _ in range(h)] g = [eval(input()) for _ in range(h)] l, r = f(), f() for i in range(h): lc = rc = 0 for j in range(w): if g[i][j] == ".": lc += 1 l[i][j] = lc else: lc = 0 if g[i][-1 - j] ...
h, w = list(map(int, input().split())) g = [[c == "." for c in eval(input())] for _ in range(h)] a = [[-3] * w for _ in range(h)] for i in range(h): l = r = 0 for j in range(w): l = -~l * g[i][j] a[i][j] += l r = -~r * g[i][-1 - j] a[i][-1 - j] += r for i in range(w): d = u =...
false
30
[ "-f = lambda: [[0] * w for _ in range(h)]", "-g = [eval(input()) for _ in range(h)]", "-l, r = f(), f()", "+g = [[c == \".\" for c in eval(input())] for _ in range(h)]", "+a = [[-3] * w for _ in range(h)]", "- lc = rc = 0", "+ l = r = 0", "- if g[i][j] == \".\":", "- lc += 1"...
false
0.060733
0.059397
1.022487
[ "s277006814", "s274631947" ]
u823885866
p03041
python
s805599520
s843133729
115
29
26,956
8,984
Accepted
Accepted
74.78
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: list(map(int, sys.stdin.buffer.readline().split())) rl = lambd...
import sys rr = lambda: sys.stdin.readline().rstrip() rm = lambda: list(map(int, sys.stdin.buffer.readline().split())) a, b = rm() s = rr() print((s[:b-1] + s[b-1].lower() + s[b:]))
19
6
465
179
import sys import math import itertools import collections import heapq import re import numpy as np rr = lambda: sys.stdin.readline().rstrip() rs = lambda: sys.stdin.buffer.readline().split() ri = lambda: int(sys.stdin.readline()) rm = lambda: list(map(int, sys.stdin.buffer.readline().split())) rl = lambda: list(map(...
import sys rr = lambda: sys.stdin.readline().rstrip() rm = lambda: list(map(int, sys.stdin.buffer.readline().split())) a, b = rm() s = rr() print((s[: b - 1] + s[b - 1].lower() + s[b:]))
false
68.421053
[ "-import math", "-import itertools", "-import collections", "-import heapq", "-import re", "-import numpy as np", "-rs = lambda: sys.stdin.buffer.readline().split()", "-ri = lambda: int(sys.stdin.readline())", "-rl = lambda: list(map(int, sys.stdin.readline().split()))", "-inf = float(\"inf\")", ...
false
0.091684
0.047645
1.924293
[ "s805599520", "s843133729" ]
u077291787
p02983
python
s971552985
s366013537
532
47
3,064
3,064
Accepted
Accepted
91.17
# ABC133C - Remainder Minimization 2019 def main(): L, R = list(map(int, input().rstrip().split())) MOD = 2019 if R - L + 1 >= MOD: # L <= 2019n <= R print((0)) else: # max: 2018 * 2017 patterns ans = float("inf") L, R = L % MOD, R % MOD for i in range(L, R): ...
# ABC133C - Remainder Minimization 2019 def main(): L, R = list(map(int, input().rstrip().split())) MOD = 2019 if R - L + 1 >= MOD: # L <= 2019n <= R print((0)) else: # max: 2018 * 2017 patterns ans = float("inf") L, R = L % MOD, R % MOD for i in range(L, R): ...
17
20
470
560
# ABC133C - Remainder Minimization 2019 def main(): L, R = list(map(int, input().rstrip().split())) MOD = 2019 if R - L + 1 >= MOD: # L <= 2019n <= R print((0)) else: # max: 2018 * 2017 patterns ans = float("inf") L, R = L % MOD, R % MOD for i in range(L, R): ...
# ABC133C - Remainder Minimization 2019 def main(): L, R = list(map(int, input().rstrip().split())) MOD = 2019 if R - L + 1 >= MOD: # L <= 2019n <= R print((0)) else: # max: 2018 * 2017 patterns ans = float("inf") L, R = L % MOD, R % MOD for i in range(L, R): ...
false
15
[ "+ if ans == 0:", "+ print(ans)", "+ return" ]
false
0.049176
0.037295
1.318572
[ "s971552985", "s366013537" ]
u945181840
p03240
python
s370588360
s438779725
1,041
32
3,064
3,064
Accepted
Accepted
96.93
import sys input = sys.stdin.readline N = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(N)] for i in range(101): for j in range(101): for x, y, h in xyh: if h != 0: H = h + abs(i - x) + abs(j - y) for x, y, h in xyh: ...
import sys input = sys.stdin.readline N = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(N)] xyh.sort(key=lambda i:i[2], reverse=True) x0, y0, h0 = xyh[0] for i in range(101): for j in range(101): H = h0 + abs(i - x0) + abs(j - y0) for x, y, h in xyh: ...
17
21
490
570
import sys input = sys.stdin.readline N = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(N)] for i in range(101): for j in range(101): for x, y, h in xyh: if h != 0: H = h + abs(i - x) + abs(j - y) for x, y, h in xyh: ...
import sys input = sys.stdin.readline N = int(eval(input())) xyh = [list(map(int, input().split())) for _ in range(N)] xyh.sort(key=lambda i: i[2], reverse=True) x0, y0, h0 = xyh[0] for i in range(101): for j in range(101): H = h0 + abs(i - x0) + abs(j - y0) for x, y, h in xyh: if h > 0...
false
19.047619
[ "+xyh.sort(key=lambda i: i[2], reverse=True)", "+x0, y0, h0 = xyh[0]", "+ H = h0 + abs(i - x0) + abs(j - y0)", "- if h != 0:", "- H = h + abs(i - x) + abs(j - y)", "- for x, y, h in xyh:", "- if h != max(H - abs(i - x) - abs(j - y), 0):"...
false
0.057398
0.040333
1.423085
[ "s370588360", "s438779725" ]
u767664985
p03533
python
s790221123
s414632139
22
17
3,188
2,940
Accepted
Accepted
22.73
import re l = re.compile("^A?KIHA?BA?RA?$").findall(eval(input())) if l: print("YES") else: print("NO")
S = eval(input()) strings = ["AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR", "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR", "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA", "KIHBR"] if S in strings: print("YES") else: print("NO")
6
6
105
254
import re l = re.compile("^A?KIHA?BA?RA?$").findall(eval(input())) if l: print("YES") else: print("NO")
S = eval(input()) strings = [ "AKIHABARA", "KIHABARA", "AKIHBARA", "AKIHABRA", "AKIHABAR", "KIHBARA", "KIHABRA", "KIHABAR", "AKIHBRA", "AKIHBAR", "AKIHABR", "AKIHBR", "KIHABR", "KIHBAR", "KIHBRA", "KIHBR", ] if S in strings: print("YES") else: prin...
false
0
[ "-import re", "-", "-l = re.compile(\"^A?KIHA?BA?RA?$\").findall(eval(input()))", "-if l:", "+S = eval(input())", "+strings = [", "+ \"AKIHABARA\",", "+ \"KIHABARA\",", "+ \"AKIHBARA\",", "+ \"AKIHABRA\",", "+ \"AKIHABAR\",", "+ \"KIHBARA\",", "+ \"KIHABRA\",", "+ \...
false
0.11797
0.04022
2.93312
[ "s790221123", "s414632139" ]
u573754721
p02885
python
s751108714
s704817724
175
18
38,384
2,940
Accepted
Accepted
89.71
a,b=list(map(int,input().split())) if 0>a-(2*b): print((0)) else: print((a-(2*b)))
a,b=list(map(int,input().split())) if a<2*b: print((0)) else: print((a-(2*b)))
5
5
85
76
a, b = list(map(int, input().split())) if 0 > a - (2 * b): print((0)) else: print((a - (2 * b)))
a, b = list(map(int, input().split())) if a < 2 * b: print((0)) else: print((a - (2 * b)))
false
0
[ "-if 0 > a - (2 * b):", "+if a < 2 * b:" ]
false
0.036056
0.03426
1.052421
[ "s751108714", "s704817724" ]
u150984829
p02279
python
s590338885
s531632404
870
660
55,916
52,936
Accepted
Accepted
24.14
def q(a,h): d[a]=str(h) for b in t[a]:q(b,h+1) t,p,d={},{},{} for _ in[0]*int(eval(input())): e=input().split() t[e[0]]=e[2:] for i in e[2:]:p[i]=e[0] r=(set(t)-set(p)).pop() p[r]='-1' q(r,0) for i in sorted(map(int,t)): i=str(i) f='root'if'-1'==p[i]else'internal node'if t[i]else'leaf' print(f'nod...
def q(a,h): d[a]=str(h) for b in t[a]:q(b,h+1) t,p,d={},{},{} for _ in[0]*int(eval(input())): e=input().split() t[e[0]]=e[2:] for i in e[2:]:p[i]=e[0] r=(set(t)-set(p)).pop() p[r]='-1' q(r,0) for i in sorted(map(int,t)):i=str(i);print(f"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'...
15
12
383
370
def q(a, h): d[a] = str(h) for b in t[a]: q(b, h + 1) t, p, d = {}, {}, {} for _ in [0] * int(eval(input())): e = input().split() t[e[0]] = e[2:] for i in e[2:]: p[i] = e[0] r = (set(t) - set(p)).pop() p[r] = "-1" q(r, 0) for i in sorted(map(int, t)): i = str(i) f = "root" ...
def q(a, h): d[a] = str(h) for b in t[a]: q(b, h + 1) t, p, d = {}, {}, {} for _ in [0] * int(eval(input())): e = input().split() t[e[0]] = e[2:] for i in e[2:]: p[i] = e[0] r = (set(t) - set(p)).pop() p[r] = "-1" q(r, 0) for i in sorted(map(int, t)): i = str(i) print( ...
false
20
[ "- f = \"root\" if \"-1\" == p[i] else \"internal node\" if t[i] else \"leaf\"", "- print(f\"node {i}: parent = {p[i]}, depth = {d[i]}, {f}, {list(map(int,t[i]))}\")", "+ print(", "+ f\"node {i}: parent = {p[i]}, depth = {d[i]}, {'root'if'-1'==p[i]else'internal node'if t[i]else'leaf'}, [{', '....
false
0.080417
0.082335
0.976698
[ "s590338885", "s531632404" ]
u189326411
p03013
python
s734014052
s257259508
618
468
464,164
460,056
Accepted
Accepted
24.27
n,m = list(map(int, input().split())) mod = 10**9+7 #フィボナッチ数列 dp = [0 for i in range(n+2)] dp[0] = 1 dp[1] = 1 for i in range(2,n+2): dp[i] = dp[i-1] + dp[i-2] #穴が無い場合 if m==0: print((dp[n]%mod)) exit() lst = [] for i in range(m): lst.append(int(eval(input()))) lst.sort() #2連続穴があ...
n,m = list(map(int, input().split())) mod = 10**9+7 lst = [] for i in range(m): lst.append(int(eval(input()))) lst.sort() #フィボナッチ数列 dp = [-1 for i in range(n+2)] dp[0] = 1 dp[1] = 1 for i in lst: dp[i] = 0 for i in range(2,n+2): if dp[i]<0: dp[i] = dp[i-1] + dp[i-2] # print(lst)...
42
22
669
355
n, m = list(map(int, input().split())) mod = 10**9 + 7 # フィボナッチ数列 dp = [0 for i in range(n + 2)] dp[0] = 1 dp[1] = 1 for i in range(2, n + 2): dp[i] = dp[i - 1] + dp[i - 2] # 穴が無い場合 if m == 0: print((dp[n] % mod)) exit() lst = [] for i in range(m): lst.append(int(eval(input()))) lst.sort() # 2連続穴がある場合 f...
n, m = list(map(int, input().split())) mod = 10**9 + 7 lst = [] for i in range(m): lst.append(int(eval(input()))) lst.sort() # フィボナッチ数列 dp = [-1 for i in range(n + 2)] dp[0] = 1 dp[1] = 1 for i in lst: dp[i] = 0 for i in range(2, n + 2): if dp[i] < 0: dp[i] = dp[i - 1] + dp[i - 2] # print(lst) # pri...
false
47.619048
[ "-# フィボナッチ数列", "-dp = [0 for i in range(n + 2)]", "-dp[0] = 1", "-dp[1] = 1", "-for i in range(2, n + 2):", "- dp[i] = dp[i - 1] + dp[i - 2]", "-# 穴が無い場合", "-if m == 0:", "- print((dp[n] % mod))", "- exit()", "-# 2連続穴がある場合", "-for i in range(len(lst) - 1):", "- if lst[i] + 1 == l...
false
0.083804
0.072854
1.150297
[ "s734014052", "s257259508" ]
u780475861
p03647
python
s557261339
s057655392
359
290
19,024
19,168
Accepted
Accepted
19.22
import sys n, m = list(map(int, sys.stdin.readline().split())) set1, setn = set(), set() for _ in range(m): i, j = list(map(int, sys.stdin.readline().split())) if i in [1, n] or j in [1, n]: if i == 1: set1.add(j) if i == n: setn.add(j) if j == 1: set1.add(i) if j == n:...
import sys def main(): n, m = list(map(int, sys.stdin.readline().split())) set1, setn = set(), set() for _ in range(m): i, j = list(map(int, sys.stdin.readline().split())) if i == 1: set1.add(j) if j == n: setn.add(i) if set1 & setn: print('POSSIBLE') else: pri...
18
20
396
366
import sys n, m = list(map(int, sys.stdin.readline().split())) set1, setn = set(), set() for _ in range(m): i, j = list(map(int, sys.stdin.readline().split())) if i in [1, n] or j in [1, n]: if i == 1: set1.add(j) if i == n: setn.add(j) if j == 1: set...
import sys def main(): n, m = list(map(int, sys.stdin.readline().split())) set1, setn = set(), set() for _ in range(m): i, j = list(map(int, sys.stdin.readline().split())) if i == 1: set1.add(j) if j == n: setn.add(i) if set1 & setn: print("POSSI...
false
10
[ "-n, m = list(map(int, sys.stdin.readline().split()))", "-set1, setn = set(), set()", "-for _ in range(m):", "- i, j = list(map(int, sys.stdin.readline().split()))", "- if i in [1, n] or j in [1, n]:", "+", "+def main():", "+ n, m = list(map(int, sys.stdin.readline().split()))", "+ set1,...
false
0.043717
0.040779
1.072047
[ "s557261339", "s057655392" ]
u110943895
p03447
python
s488335843
s609516040
19
17
2,940
2,940
Accepted
Accepted
10.53
cash = int(eval(input())) price_cake = int(eval(input())) price_donut = int(eval(input())) print(((cash-price_cake)%price_donut))
cash, price_cake, price_donut = [int(eval(input())) for i in range(3)] print(((cash-price_cake)%price_donut))
4
2
112
102
cash = int(eval(input())) price_cake = int(eval(input())) price_donut = int(eval(input())) print(((cash - price_cake) % price_donut))
cash, price_cake, price_donut = [int(eval(input())) for i in range(3)] print(((cash - price_cake) % price_donut))
false
50
[ "-cash = int(eval(input()))", "-price_cake = int(eval(input()))", "-price_donut = int(eval(input()))", "+cash, price_cake, price_donut = [int(eval(input())) for i in range(3)]" ]
false
0.037578
0.03627
1.036063
[ "s488335843", "s609516040" ]