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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u021019433 | p02996 | python | s927460046 | s281598395 | 945 | 800 | 29,516 | 31,972 | Accepted | Accepted | 15.34 | from operator import itemgetter
from itertools import accumulate
n = int(eval(input()))
a = sorted(tuple(map(int, reversed(input().split()))) for _ in range(n))
c, d = (list(map(itemgetter(i), a)) for i in (0, 1))
print(('YNeos'[any(x < y for x, y in zip(c, accumulate(d)))::2]))
| from operator import itemgetter
from itertools import accumulate
n = int(eval(input()))
a = sorted((tuple(map(int, input().split())) for _ in range(n)),
key=itemgetter(1))
c, d = (list(map(itemgetter(i), a)) for i in (0, 1))
print(('YNeos'[any(x > y for x, y in zip(accumulate(c), d))::2])) | 7 | 8 | 294 | 296 | from operator import itemgetter
from itertools import accumulate
n = int(eval(input()))
a = sorted(tuple(map(int, reversed(input().split()))) for _ in range(n))
c, d = (list(map(itemgetter(i), a)) for i in (0, 1))
print(("YNeos"[any(x < y for x, y in zip(c, accumulate(d))) :: 2]))
| from operator import itemgetter
from itertools import accumulate
n = int(eval(input()))
a = sorted((tuple(map(int, input().split())) for _ in range(n)), key=itemgetter(1))
c, d = (list(map(itemgetter(i), a)) for i in (0, 1))
print(("YNeos"[any(x > y for x, y in zip(accumulate(c), d)) :: 2]))
| false | 12.5 | [
"-a = sorted(tuple(map(int, reversed(input().split()))) for _ in range(n))",
"+a = sorted((tuple(map(int, input().split())) for _ in range(n)), key=itemgetter(1))",
"-print((\"YNeos\"[any(x < y for x, y in zip(c, accumulate(d))) :: 2]))",
"+print((\"YNeos\"[any(x > y for x, y in zip(accumulate(c), d)) :: 2]))... | false | 0.041637 | 0.03607 | 1.154328 | [
"s927460046",
"s281598395"
] |
u631277801 | p03488 | python | s924059573 | s848034101 | 1,922 | 19 | 3,816 | 3,188 | Accepted | Accepted | 99.01 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.rea... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.rea... | 46 | 44 | 1,052 | 915 | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 4.347826 | [
"-ud = set()",
"-lr = set()",
"-lr.add(len(command[0]))",
"-ud.add(0)",
"-for i, cm in enumerate(command[1:]):",
"- if i % 2 == 1:",
"- new_lr = set()",
"- for element in lr:",
"- new_lr.add(element + len(cm))",
"- new_lr.add(element - len(cm))",
"- ... | false | 0.049697 | 0.05025 | 0.988995 | [
"s924059573",
"s848034101"
] |
u767664985 | p03000 | python | s462356531 | s041662131 | 20 | 17 | 3,060 | 3,060 | Accepted | Accepted | 15 | N, X = list(map(int, input().split()))
*L, = list(map(int, input().split()))
sum_L = [0] * (N + 1)
for i in range(N):
sum_L[i + 1] = sum_L[i] + L[i]
ans = len([j for j in sum_L if j <= X])
print(ans)
| N, X = list(map(int, input().split()))
*L, = list(map(int, input().split()))
D = [0] * (N + 1)
for i in range(N):
D[i + 1] = D[i] + L[i]
ans = len([j for j in D if j <= X])
print(ans)
| 7 | 7 | 195 | 179 | N, X = list(map(int, input().split()))
(*L,) = list(map(int, input().split()))
sum_L = [0] * (N + 1)
for i in range(N):
sum_L[i + 1] = sum_L[i] + L[i]
ans = len([j for j in sum_L if j <= X])
print(ans)
| N, X = list(map(int, input().split()))
(*L,) = list(map(int, input().split()))
D = [0] * (N + 1)
for i in range(N):
D[i + 1] = D[i] + L[i]
ans = len([j for j in D if j <= X])
print(ans)
| false | 0 | [
"-sum_L = [0] * (N + 1)",
"+D = [0] * (N + 1)",
"- sum_L[i + 1] = sum_L[i] + L[i]",
"-ans = len([j for j in sum_L if j <= X])",
"+ D[i + 1] = D[i] + L[i]",
"+ans = len([j for j in D if j <= X])"
] | false | 0.038275 | 0.040611 | 0.942491 | [
"s462356531",
"s041662131"
] |
u481250941 | p02880 | python | s953696114 | s768930105 | 223 | 75 | 6,428 | 16,116 | Accepted | Accepted | 66.37 | #
# abc144 b
#
import unittest
from io import StringIO
import sys
def input():
return sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
for i in range(1, 10):
for j in range(1, 10):
if i*j == N:
print("Yes")
exit()... | #
# abc144 b
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
ou... | 52 | 52 | 1,124 | 1,124 | #
# abc144 b
#
import unittest
from io import StringIO
import sys
def input():
return sys.stdin.readline().rstrip()
def resolve():
N = int(eval(input()))
for i in range(1, 10):
for j in range(1, 10):
if i * j == N:
print("Yes")
exit()
print("No")
... | #
# abc144 b
#
import sys
from io import StringIO
import unittest
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.seek(0)
out = sys.stdout.r... | false | 0 | [
"+import sys",
"+from io import StringIO",
"-from io import StringIO",
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"-def resolve():",
"- N = int(eval(input()))",
"- for i in range(1, 10):",
"- for j in range(1, 10):",
"- ... | false | 0.09679 | 0.095429 | 1.014262 | [
"s953696114",
"s768930105"
] |
u332906195 | p02720 | python | s004642897 | s956934197 | 399 | 186 | 121,196 | 42,864 | Accepted | Accepted | 53.38 | import copy
K = int(eval(input()))
ans, nex = [i for i in range(1, 10)], [i for i in range(1, 10)]
for i in range(10):
pre, nex = copy.deepcopy(nex), []
for p in pre:
if p % 10 != 0:
ans.append(p * 10 + p % 10 - 1)
nex.append(p * 10 + p % 10 - 1)
ans.append(p * 1... | from collections import deque
d = deque([9, 8, 7, 6, 5, 4, 3, 2, 1])
K = int(eval(input()))
for _ in range(K - 1):
i = d.pop()
if i % 10 != 0:
d.appendleft(i * 10 + i % 10 - 1)
d.appendleft(i * 10 + i % 10)
if i % 10 != 9:
d.appendleft(i * 10 + i % 10 + 1)
print((d.pop()))
| 17 | 12 | 511 | 310 | import copy
K = int(eval(input()))
ans, nex = [i for i in range(1, 10)], [i for i in range(1, 10)]
for i in range(10):
pre, nex = copy.deepcopy(nex), []
for p in pre:
if p % 10 != 0:
ans.append(p * 10 + p % 10 - 1)
nex.append(p * 10 + p % 10 - 1)
ans.append(p * 10 + p % ... | from collections import deque
d = deque([9, 8, 7, 6, 5, 4, 3, 2, 1])
K = int(eval(input()))
for _ in range(K - 1):
i = d.pop()
if i % 10 != 0:
d.appendleft(i * 10 + i % 10 - 1)
d.appendleft(i * 10 + i % 10)
if i % 10 != 9:
d.appendleft(i * 10 + i % 10 + 1)
print((d.pop()))
| false | 29.411765 | [
"-import copy",
"+from collections import deque",
"+d = deque([9, 8, 7, 6, 5, 4, 3, 2, 1])",
"-ans, nex = [i for i in range(1, 10)], [i for i in range(1, 10)]",
"-for i in range(10):",
"- pre, nex = copy.deepcopy(nex), []",
"- for p in pre:",
"- if p % 10 != 0:",
"- ans.appen... | false | 0.833591 | 0.10901 | 7.646934 | [
"s004642897",
"s956934197"
] |
u969850098 | p03103 | python | s507594379 | s904730137 | 337 | 250 | 27,756 | 16,988 | Accepted | Accepted | 25.82 | import sys
readline = sys.stdin.readline
def main():
N, M = list(map(int, readline().rstrip().split()))
AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
AB.sort()
pro = 0
cost = 0
for a, b in AB:
if pro + b >= M:
cost += (M - pro) * a
... | import sys
readline = sys.stdin.readline
def main():
N, M = list(map(int, readline().rstrip().split()))
AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]
AB.sort()
pro = 0
cost = 0
for a, b in AB:
if pro + b >= M:
cost += (M - pro) * a
... | 21 | 21 | 431 | 432 | import sys
readline = sys.stdin.readline
def main():
N, M = list(map(int, readline().rstrip().split()))
AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]
AB.sort()
pro = 0
cost = 0
for a, b in AB:
if pro + b >= M:
cost += (M - pro) * a
break
... | import sys
readline = sys.stdin.readline
def main():
N, M = list(map(int, readline().rstrip().split()))
AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]
AB.sort()
pro = 0
cost = 0
for a, b in AB:
if pro + b >= M:
cost += (M - pro) * a
break... | false | 0 | [
"- AB = [list(map(int, readline().rstrip().split())) for _ in range(N)]",
"+ AB = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]"
] | false | 0.035684 | 0.088839 | 0.401672 | [
"s507594379",
"s904730137"
] |
u655761160 | p03160 | python | s301640472 | s583081697 | 160 | 124 | 13,980 | 13,980 | Accepted | Accepted | 22.5 | def ch_min(a, b):
if (a > b):
a = b
return a
if __name__ == "__main__":
N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10 ** 10
dp = [INF] * 100010
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = ch_min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1])... | N = int(eval(input()))
h = list(map(int, input().split()))
x = [0] * N
x[1] = x[0] + abs(h[1] - h[0])
for i in range(2, N):
x[i] = min(x[i - 1] + abs(h[i] - h[i - 1]),
x[i - 2] + abs(h[i] - h[i - 2]))
print((x[N-1]))
| 17 | 8 | 436 | 235 | def ch_min(a, b):
if a > b:
a = b
return a
if __name__ == "__main__":
N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**10
dp = [INF] * 100010
dp[0] = 0
for i in range(N - 1):
dp[i + 1] = ch_min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
if i < ... | N = int(eval(input()))
h = list(map(int, input().split()))
x = [0] * N
x[1] = x[0] + abs(h[1] - h[0])
for i in range(2, N):
x[i] = min(x[i - 1] + abs(h[i] - h[i - 1]), x[i - 2] + abs(h[i] - h[i - 2]))
print((x[N - 1]))
| false | 52.941176 | [
"-def ch_min(a, b):",
"- if a > b:",
"- a = b",
"- return a",
"-",
"-",
"-if __name__ == \"__main__\":",
"- N = int(eval(input()))",
"- h = list(map(int, input().split()))",
"- INF = 10**10",
"- dp = [INF] * 100010",
"- dp[0] = 0",
"- for i in range(N - 1):",
... | false | 0.24129 | 0.048338 | 4.991752 | [
"s301640472",
"s583081697"
] |
u485319545 | p02912 | python | s954259799 | s357503341 | 184 | 137 | 14,180 | 19,992 | Accepted | Accepted | 25.54 | import heapq
n,m = list(map(int,input().split()))
prod = list(map(int,input().split()))
prod = list([x*(-1) for x in prod])
heapq.heapify(prod)
for _ in range(m):
a = heapq.heappop(prod)*(-1)
a = a//2
heapq.heappush(prod,(-1)*a)
ans = list([(-1)*x for x in prod])
print((sum(ans))) | n,m=list(map(int,input().split()))
a = list(map(int,input().split()))
for i in range(n):
a[i]*=-1
import heapq,math
heapq.heapify(a)
for _ in range(m):
b=heapq.heappop(a)*(-1)
b //=2
heapq.heappush(a,b*(-1))
print((sum(a)*(-1))) | 19 | 17 | 319 | 258 | import heapq
n, m = list(map(int, input().split()))
prod = list(map(int, input().split()))
prod = list([x * (-1) for x in prod])
heapq.heapify(prod)
for _ in range(m):
a = heapq.heappop(prod) * (-1)
a = a // 2
heapq.heappush(prod, (-1) * a)
ans = list([(-1) * x for x in prod])
print((sum(ans)))
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
a[i] *= -1
import heapq, math
heapq.heapify(a)
for _ in range(m):
b = heapq.heappop(a) * (-1)
b //= 2
heapq.heappush(a, b * (-1))
print((sum(a) * (-1)))
| false | 10.526316 | [
"-import heapq",
"+n, m = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"+for i in range(n):",
"+ a[i] *= -1",
"+import heapq, math",
"-n, m = list(map(int, input().split()))",
"-prod = list(map(int, input().split()))",
"-prod = list([x * (-1) for x in prod])",
"-hea... | false | 0.007145 | 0.146677 | 0.048713 | [
"s954259799",
"s357503341"
] |
u969850098 | p03053 | python | s468137901 | s840393370 | 544 | 471 | 134,224 | 134,224 | Accepted | Accepted | 13.42 | import sys
readline = sys.stdin.readline
from collections import deque
directions = ((-1, 0), (1, 0), (0, -1), (0, 1))
def main():
H, W = list(map(int, readline().rstrip().split()))
mat = [list(readline().rstrip()) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
... | import sys
readline = sys.stdin.readline
from collections import deque
directions = ((-1, 0), (1, 0), (0, -1), (0, 1))
def main():
H, W = list(map(int, readline().rstrip().split()))
mat = [list(readline().rstrip()) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
... | 37 | 36 | 926 | 896 | import sys
readline = sys.stdin.readline
from collections import deque
directions = ((-1, 0), (1, 0), (0, -1), (0, 1))
def main():
H, W = list(map(int, readline().rstrip().split()))
mat = [list(readline().rstrip()) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
... | import sys
readline = sys.stdin.readline
from collections import deque
directions = ((-1, 0), (1, 0), (0, -1), (0, 1))
def main():
H, W = list(map(int, readline().rstrip().split()))
mat = [list(readline().rstrip()) for _ in range(H)]
start = []
for h in range(H):
for w in range(W):
... | false | 2.702703 | [
"- next_que = []",
"- while que:",
"- h, w = que.popleft()",
"+ next_que = deque()",
"+ for h, w in que:",
"- que = deque(next_que)",
"+ que = next_que"
] | false | 0.047679 | 0.09277 | 0.513947 | [
"s468137901",
"s840393370"
] |
u440566786 | p03164 | python | s712978956 | s415436180 | 427 | 345 | 115,668 | 70,988 | Accepted | Accepted | 19.2 | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,W=list(map(int,input().split()))
w,v=[0]*n,[0]*n
for i in range(n):
w[i],v[i]=list(map(int,input().split()))
V=sum(v)
dp=[INF]*(V+1)
dp[0]=0
... | import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
n,W=list(map(int,input().split()))
WV=[tuple(map(int,input().split())) for _ in range(n)]
V=100000
dp=[INF]*(V+1)
dp[0]=0
for w,v in WV:
fo... | 24 | 23 | 596 | 515 | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, W = list(map(int, input().split()))
w, v = [0] * n, [0] * n
for i in range(n):
w[i], v[i] = list(map(int, input().split()))
V = sum(v)
dp = [INF]... | import sys
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, W = list(map(int, input().split()))
WV = [tuple(map(int, input().split())) for _ in range(n)]
V = 100000
dp = [INF] * (V + 1)
dp[0] = 0
for w, v in W... | false | 4.166667 | [
"- w, v = [0] * n, [0] * n",
"- for i in range(n):",
"- w[i], v[i] = list(map(int, input().split()))",
"- V = sum(v)",
"+ WV = [tuple(map(int, input().split())) for _ in range(n)]",
"+ V = 100000",
"- for i in range(n):",
"- newdp = dp[:]",
"- for x in range(V ... | false | 0.039156 | 0.726959 | 0.053862 | [
"s712978956",
"s415436180"
] |
u226155577 | p03082 | python | s429506159 | s265054992 | 1,337 | 1,185 | 86,652 | 43,116 | Accepted | Accepted | 11.37 | N, X = list(map(int, input().split()))
*V, = list(map(int, input().split()))
MOD = 10**9 + 7
fact = [1]*(X+1)
rfact = [1]*(X+1)
for i in range(X):
fact[i+1] = r = fact[i] * (i+1) % MOD
rfact[i+1] = pow(r, MOD-2, MOD)
V.sort()
S = [0]*(X+1)
S[X] = 1
for i in range(N-1, -1, -1):
T = [0]*(X... | N, X = list(map(int, input().split()))
*V, = list(map(int, input().split()))
MOD = 10**9 + 7
V.sort()
S = [0]*(X+1)
S[X] = 1
T = [0]*(X+1)
zeros = [0]*(X+1)
for i in range(N-1, -1, -1):
T[:] = zeros
for k in range(X+1):
S[k] %= MOD
T[k] += S[k] * i % MOD
T[k % V[i]] +=... | 23 | 19 | 483 | 383 | N, X = list(map(int, input().split()))
(*V,) = list(map(int, input().split()))
MOD = 10**9 + 7
fact = [1] * (X + 1)
rfact = [1] * (X + 1)
for i in range(X):
fact[i + 1] = r = fact[i] * (i + 1) % MOD
rfact[i + 1] = pow(r, MOD - 2, MOD)
V.sort()
S = [0] * (X + 1)
S[X] = 1
for i in range(N - 1, -1, -1):
T = [0... | N, X = list(map(int, input().split()))
(*V,) = list(map(int, input().split()))
MOD = 10**9 + 7
V.sort()
S = [0] * (X + 1)
S[X] = 1
T = [0] * (X + 1)
zeros = [0] * (X + 1)
for i in range(N - 1, -1, -1):
T[:] = zeros
for k in range(X + 1):
S[k] %= MOD
T[k] += S[k] * i % MOD
T[k % V[i]] += ... | false | 17.391304 | [
"-fact = [1] * (X + 1)",
"-rfact = [1] * (X + 1)",
"-for i in range(X):",
"- fact[i + 1] = r = fact[i] * (i + 1) % MOD",
"- rfact[i + 1] = pow(r, MOD - 2, MOD)",
"+T = [0] * (X + 1)",
"+zeros = [0] * (X + 1)",
"- T = [0] * (X + 1)",
"+ T[:] = zeros",
"- S = T",
"+ S, T = T, S"
... | false | 0.338002 | 0.83346 | 0.405541 | [
"s429506159",
"s265054992"
] |
u745087332 | p03310 | python | s230982041 | s991877962 | 847 | 581 | 25,676 | 25,668 | Accepted | Accepted | 31.4 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
B = A[:]
# 累積和
for i in range(1, N):
B[i] = B[i] + B[i - 1]
ans = INF
mid_l = 0
mid_r = 2
t = B[-1]
for mid in range(1, N - 1):
while mid_l < mid and abs(2 * B[mid... | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
B = A[:]
# 累積和
for i in range(1, N):
B[i] = B[i] + B[i - 1]
ans = INF
mid_l = 0
mid_r = 2
t = B[-1]
for mid in range(1, N - 1):
while B[mid] > B[mid_l] + B[mid_l +... | 35 | 35 | 661 | 568 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
B = A[:]
# 累積和
for i in range(1, N):
B[i] = B[i] + B[i - 1]
ans = INF
mid_l = 0
mid_r = 2
t = B[-1]
for mid in range(1, N - 1):
while mid_l < mid and abs(2 * B[mid_l] - B[mid]) >= abs(2... | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
A = inpl()
B = A[:]
# 累積和
for i in range(1, N):
B[i] = B[i] + B[i - 1]
ans = INF
mid_l = 0
mid_r = 2
t = B[-1]
for mid in range(1, N - 1):
while B[mid] > B[mid_l] + B[mid_l + 1]:
mid_l += ... | false | 0 | [
"- while mid_l < mid and abs(2 * B[mid_l] - B[mid]) >= abs(2 * B[mid_l + 1] - B[mid]):",
"+ while B[mid] > B[mid_l] + B[mid_l + 1]:",
"- while mid_r < N - 1 and abs(2 * B[mid_r] - B[mid] - t) >= abs(",
"- 2 * B[mid_r + 1] - B[mid] - t",
"- ):",
"+ while t > B[mid_r] + B[mid_r + 1] - ... | false | 0.109265 | 0.08035 | 1.359853 | [
"s230982041",
"s991877962"
] |
u054825571 | p02960 | python | s965332580 | s255090300 | 514 | 268 | 43,244 | 74,552 | Accepted | Accepted | 47.86 | MOD = 10**9+7
S=eval(input())
dp_old=[0]*13
dp_new=[0]*13
dp_old[0]=1
for c in S:
if c == '?':
for i in range(10):
for j in range(13):
dp_new[(j*10+i)%13]+=dp_old[j]
else:
for i in range(13):
dp_new[(i*10+int(c))%13]+=dp_old[i]
dp_old = [i... | MOD=10**9+7
S=eval(input())
old=[0]*13
old[0]=1
n=1
for c in S:
dp=[0]*13
if c=='?':
for j in range(10):
for i in range(13):
dp[(i*10+j)%13]+=old[i]
dp[(i*10+j)%13]%=MOD
else:
c=int(c)
for i in range(13):
dp[(i*10+c)%13]+=old[i]
dp[(i*10+c)%13]%=MOD
... | 16 | 20 | 375 | 350 | MOD = 10**9 + 7
S = eval(input())
dp_old = [0] * 13
dp_new = [0] * 13
dp_old[0] = 1
for c in S:
if c == "?":
for i in range(10):
for j in range(13):
dp_new[(j * 10 + i) % 13] += dp_old[j]
else:
for i in range(13):
dp_new[(i * 10 + int(c)) % 13] += dp_old[i... | MOD = 10**9 + 7
S = eval(input())
old = [0] * 13
old[0] = 1
n = 1
for c in S:
dp = [0] * 13
if c == "?":
for j in range(10):
for i in range(13):
dp[(i * 10 + j) % 13] += old[i]
dp[(i * 10 + j) % 13] %= MOD
else:
c = int(c)
for i in range(13... | false | 20 | [
"-dp_old = [0] * 13",
"-dp_new = [0] * 13",
"-dp_old[0] = 1",
"+old = [0] * 13",
"+old[0] = 1",
"+n = 1",
"+ dp = [0] * 13",
"- for i in range(10):",
"- for j in range(13):",
"- dp_new[(j * 10 + i) % 13] += dp_old[j]",
"+ for j in range(10):",
"+ ... | false | 0.03704 | 0.037097 | 0.998461 | [
"s965332580",
"s255090300"
] |
u747602774 | p03014 | python | s457639016 | s962663929 | 999 | 664 | 221,704 | 103,384 | Accepted | Accepted | 33.53 | H,W = list(map(int,input().split()))
g = [list(eval(input())) for i in range(H)]
c = [[0 for w in range(W)] for h in range(H)]
hs = [0 for i in range(W)]
for h in range(H):
ws = 0
for w in range(W):
if g[h][w] == '#':
for i in range(ws,w):
c[h][i] += w-ws-1
... | H,W = list(map(int,input().split()))
g = [eval(input()) for i in range(H)]
c = [[0 for w in range(W)] for h in range(H)]
hs = [0 for i in range(W)]
for h in range(H):
ws = 0
for w in range(W):
if g[h][w] == '#':
for i in range(ws,w):
c[h][i] += w-ws-1
... | 60 | 60 | 1,284 | 1,284 | H, W = list(map(int, input().split()))
g = [list(eval(input())) for i in range(H)]
c = [[0 for w in range(W)] for h in range(H)]
hs = [0 for i in range(W)]
for h in range(H):
ws = 0
for w in range(W):
if g[h][w] == "#":
for i in range(ws, w):
c[h][i] += w - ws - 1
... | H, W = list(map(int, input().split()))
g = [eval(input()) for i in range(H)]
c = [[0 for w in range(W)] for h in range(H)]
hs = [0 for i in range(W)]
for h in range(H):
ws = 0
for w in range(W):
if g[h][w] == "#":
for i in range(ws, w):
c[h][i] += w - ws - 1
ws = ... | false | 0 | [
"-g = [list(eval(input())) for i in range(H)]",
"+g = [eval(input()) for i in range(H)]"
] | false | 0.088307 | 0.04325 | 2.041776 | [
"s457639016",
"s962663929"
] |
u762420987 | p03160 | python | s461789925 | s597243143 | 514 | 137 | 22,760 | 13,980 | Accepted | Accepted | 73.35 | import numpy as np
N = int(eval(input()))
hlist = list(map(int, input().split()))
inf = float("inf")
dp = np.full(N, inf, dtype=int)
dp[0] = 0
dp[1] = abs(hlist[1] - hlist[0])
for i in range(2, N):
dp[i] = min(dp[i - 2] + abs(hlist[i - 2] - hlist[i]), dp[i - 1] + abs(hlist[i - 1] - hlist[i]))
print((dp[-1]... | N = int(eval(input()))
hlist = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0
dp[1] = abs(hlist[0] - hlist[1])
for i in range(2, N):
cost1 = dp[i - 1] + abs(hlist[i] - hlist[i - 1])
cost2 = dp[i - 2] + abs(hlist[i] - hlist[i - 2])
dp[i] = min(cost1, cost2)
print((dp[-1]))
| 10 | 11 | 315 | 296 | import numpy as np
N = int(eval(input()))
hlist = list(map(int, input().split()))
inf = float("inf")
dp = np.full(N, inf, dtype=int)
dp[0] = 0
dp[1] = abs(hlist[1] - hlist[0])
for i in range(2, N):
dp[i] = min(
dp[i - 2] + abs(hlist[i - 2] - hlist[i]),
dp[i - 1] + abs(hlist[i - 1] - hlist[i]),
... | N = int(eval(input()))
hlist = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0
dp[1] = abs(hlist[0] - hlist[1])
for i in range(2, N):
cost1 = dp[i - 1] + abs(hlist[i] - hlist[i - 1])
cost2 = dp[i - 2] + abs(hlist[i] - hlist[i - 2])
dp[i] = min(cost1, cost2)
print((dp[-1]))
| false | 9.090909 | [
"-import numpy as np",
"-",
"-inf = float(\"inf\")",
"-dp = np.full(N, inf, dtype=int)",
"+dp = [0] * N",
"-dp[1] = abs(hlist[1] - hlist[0])",
"+dp[1] = abs(hlist[0] - hlist[1])",
"- dp[i] = min(",
"- dp[i - 2] + abs(hlist[i - 2] - hlist[i]),",
"- dp[i - 1] + abs(hlist[i - 1] - hl... | false | 0.622094 | 0.036032 | 17.264975 | [
"s461789925",
"s597243143"
] |
u796942881 | p03317 | python | s942418836 | s167204831 | 43 | 18 | 13,940 | 2,940 | Accepted | Accepted | 58.14 | input = open(0).read
N, K, *An = list(map(int, input().split()))
def main():
num = (N - 1) / (K - 1)
print((int(num) + 1 if num != int(num) else int(num)))
return
main()
| import math
N, K = list(map(int, input().split()))
def main():
print((math.ceil((N - 1) / (K - 1))))
return
main()
| 12 | 11 | 190 | 130 | input = open(0).read
N, K, *An = list(map(int, input().split()))
def main():
num = (N - 1) / (K - 1)
print((int(num) + 1 if num != int(num) else int(num)))
return
main()
| import math
N, K = list(map(int, input().split()))
def main():
print((math.ceil((N - 1) / (K - 1))))
return
main()
| false | 8.333333 | [
"-input = open(0).read",
"-N, K, *An = list(map(int, input().split()))",
"+import math",
"+",
"+N, K = list(map(int, input().split()))",
"- num = (N - 1) / (K - 1)",
"- print((int(num) + 1 if num != int(num) else int(num)))",
"+ print((math.ceil((N - 1) / (K - 1))))"
] | false | 0.151502 | 0.152753 | 0.991816 | [
"s942418836",
"s167204831"
] |
u970899068 | p03108 | python | s863842180 | s374625582 | 1,148 | 873 | 116,184 | 111,836 | Accepted | Accepted | 23.95 | # ユニオンファインド
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(... | import sys
input = sys.stdin.readline
# ユニオンファインド
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
... | 80 | 73 | 1,892 | 1,718 | # ユニオンファインド
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | import sys
input = sys.stdin.readline
# ユニオンファインド
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.pa... | false | 8.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-def cmb(n, r):",
"- if r < 0 or r > n:",
"- return 0",
"- r = min(r, n - r)",
"- return g1[n] * g2[r] * g2[n - r] % mod",
"-",
"-",
"-def comb(n):",
"- x = 1",
"- y = 1",
"- for i in range(2):",
"- x *= ... | false | 0.043738 | 0.084266 | 0.519042 | [
"s863842180",
"s374625582"
] |
u380524497 | p02788 | python | s821678572 | s578414073 | 1,213 | 876 | 45,244 | 45,372 | Accepted | Accepted | 27.78 | from collections import deque
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp in monsters:
whi... | from collections import deque
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
an... | 35 | 37 | 784 | 824 | from collections import deque
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp in monsters:
while bomb_area:
... | from collections import deque
import sys
input = sys.stdin.readline
n, d, a = list(map(int, input().split()))
monsters = []
for _ in range(n):
pos, hp = list(map(int, input().split()))
monsters.append([pos, hp])
monsters.sort()
bomb_area = deque([])
bomb_power = deque([])
total_damage = 0
ans = 0
for pos, hp i... | false | 5.405405 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.072311 | 0.037875 | 1.909226 | [
"s821678572",
"s578414073"
] |
u737321654 | p03478 | python | s013926084 | s558286159 | 33 | 29 | 3,188 | 2,940 | Accepted | Accepted | 12.12 | N,A,B = list(map(int,input().split()))
ans = 0
for i in range(1, N+1):
r = (i - i % 10000)
s = (i - i % 1000)
t = (i - i % 100)
u = (i - i % 10)
v = i % 10
u = (u - t) / 10
t = (t - s) / 100
s = (s - r) / 1000
r = r / 10000
if A <= s+t+u+v+r and r+s+t+u+... | N,A,B = list(map(int,input().split()))
ans = 0
for i in range(1, N+1):
j = i
tmp = 0
while j != 0:
tmp += j % 10
j = j // 10
if A <= tmp and tmp <= B:
ans += i
print(ans) | 19 | 13 | 358 | 226 | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
r = i - i % 10000
s = i - i % 1000
t = i - i % 100
u = i - i % 10
v = i % 10
u = (u - t) / 10
t = (t - s) / 100
s = (s - r) / 1000
r = r / 10000
if A <= s + t + u + v + r and r + s + t + u + v <= B:
... | N, A, B = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
j = i
tmp = 0
while j != 0:
tmp += j % 10
j = j // 10
if A <= tmp and tmp <= B:
ans += i
print(ans)
| false | 31.578947 | [
"- r = i - i % 10000",
"- s = i - i % 1000",
"- t = i - i % 100",
"- u = i - i % 10",
"- v = i % 10",
"- u = (u - t) / 10",
"- t = (t - s) / 100",
"- s = (s - r) / 1000",
"- r = r / 10000",
"- if A <= s + t + u + v + r and r + s + t + u + v <= B:",
"+ j = i",
"... | false | 0.107689 | 0.043675 | 2.465674 | [
"s013926084",
"s558286159"
] |
u067983636 | p03108 | python | s783346000 | s291798058 | 656 | 438 | 47,060 | 49,116 | Accepted | Accepted | 33.23 | import sys
import itertools
input = sys.stdin.readline
def read_values():
return list(map(int, input().split()))
def read_list():
return list(read_values())
def read_lists(N):
return [read_list() for n in range(N)]
def root(P, C, a):
if P[a] == a:
return a
r = a
... | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_list():
return list(read_values())
def read_lists(N):
return [read_list() for n in range(N)]
def root(P, C, a):
if P[a] == a:
... | 58 | 55 | 1,022 | 1,019 | import sys
import itertools
input = sys.stdin.readline
def read_values():
return list(map(int, input().split()))
def read_list():
return list(read_values())
def read_lists(N):
return [read_list() for n in range(N)]
def root(P, C, a):
if P[a] == a:
return a
r = a
while P[r] != r:... | import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(100000)
def read_values():
return list(map(int, input().split()))
def read_list():
return list(read_values())
def read_lists(N):
return [read_list() for n in range(N)]
def root(P, C, a):
if P[a] == a:
return a
... | false | 5.172414 | [
"+sys.setrecursionlimit(100000)",
"- r = a",
"- while P[r] != r:",
"- r = P[r]",
"+ r = root(P, C, P[a])"
] | false | 0.047881 | 0.051431 | 0.930977 | [
"s783346000",
"s291798058"
] |
u911575040 | p03033 | python | s656067498 | s653781436 | 1,685 | 1,443 | 54,640 | 62,568 | Accepted | Accepted | 14.36 | import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
for i in range(q):
d=int(input())
while a and a[-1][0]<=d:
e=a.pop()
heappush(heap,(e[2],e[1... | import sys
from heapq import heappush, heappop
n,q=map(int,input().split())
a=sorted(((s-x, t-x, x) for _ in range(n) for s, t, x in (map(int, sys.stdin.readline().split()),)), reverse=True)
heap=[]
ans=[]
z=list(map(int,sys.stdin))
for d in z:
while a and a[-1][0]<=d:
e=a.pop()
heappush(heap,(e[2],... | 20 | 20 | 472 | 475 | import sys
from heapq import heappush, heappop
n, q = map(int, input().split())
a = sorted(
(
(s - x, t - x, x)
for _ in range(n)
for s, t, x in (map(int, sys.stdin.readline().split()),)
),
reverse=True,
)
heap = []
ans = []
for i in range(q):
d = int(input())
while a and a[... | import sys
from heapq import heappush, heappop
n, q = map(int, input().split())
a = sorted(
(
(s - x, t - x, x)
for _ in range(n)
for s, t, x in (map(int, sys.stdin.readline().split()),)
),
reverse=True,
)
heap = []
ans = []
z = list(map(int, sys.stdin))
for d in z:
while a and ... | false | 0 | [
"-for i in range(q):",
"- d = int(input())",
"+z = list(map(int, sys.stdin))",
"+for d in z:"
] | false | 0.049591 | 0.036852 | 1.34566 | [
"s656067498",
"s653781436"
] |
u648315264 | p02639 | python | s190548202 | s747140059 | 26 | 23 | 9,048 | 8,948 | Accepted | Accepted | 11.54 | n = list(input().split())
for i in range(len(n)):
if n[i] == "0":
print((int(i)+1))
| n = list(input().split())
print((n.index("0")+1))
| 5 | 3 | 99 | 51 | n = list(input().split())
for i in range(len(n)):
if n[i] == "0":
print((int(i) + 1))
| n = list(input().split())
print((n.index("0") + 1))
| false | 40 | [
"-for i in range(len(n)):",
"- if n[i] == \"0\":",
"- print((int(i) + 1))",
"+print((n.index(\"0\") + 1))"
] | false | 0.116905 | 0.171484 | 0.681725 | [
"s190548202",
"s747140059"
] |
u506132575 | p00069 | python | s543472229 | s618538884 | 40 | 30 | 4,460 | 4,464 | Accepted | Accepted | 25 | import sys
import itertools
def one_step(lo,lis):
nu = [ e for e in lis ]
for j in range(len(nu)):
if lo[0][j] == 1:
nu[j],nu[j+1] = nu[j+1],nu[j]
return lo[1:],nu
def solve(lo,lis):
if len(lo) == 0:
return lis
nu = [ e for e in lis]
lo2,nu2 = one_step... | import sys
import itertools
def one_step(lo,lis):
nu = [ e for e in lis ]
for j in range(len(nu)):
if lo[0][j] == 1:
nu[j],nu[j+1] = nu[j+1],nu[j]
return lo[1:],nu
def solve(lo,lis):
if len(lo) == 0:
return lis
nu = [ e for e in lis]
lo2,nu2 = one_step... | 34 | 40 | 889 | 1,046 | import sys
import itertools
def one_step(lo, lis):
nu = [e for e in lis]
for j in range(len(nu)):
if lo[0][j] == 1:
nu[j], nu[j + 1] = nu[j + 1], nu[j]
return lo[1:], nu
def solve(lo, lis):
if len(lo) == 0:
return lis
nu = [e for e in lis]
lo2, nu2 = one_step(lo, ... | import sys
import itertools
def one_step(lo, lis):
nu = [e for e in lis]
for j in range(len(nu)):
if lo[0][j] == 1:
nu[j], nu[j + 1] = nu[j + 1], nu[j]
return lo[1:], nu
def solve(lo, lis):
if len(lo) == 0:
return lis
nu = [e for e in lis]
lo2, nu2 = one_step(lo, ... | false | 15 | [
"+def func(lots, lis, n, m, star, d):",
"+ for i in range(d):",
"+ for j in range(1, n):",
"+ if lots[0][j - 1] + lots[0][j] + lots[0][j + 1] == 0:",
"+ lots[0][j] = 1",
"+ if solve(lots, lis)[star] == m:",
"+ print(i + 1, j)",
"+ ... | false | 0.090341 | 0.039964 | 2.260539 | [
"s543472229",
"s618538884"
] |
u596276291 | p03573 | python | s524497292 | s226250835 | 174 | 33 | 3,700 | 4,084 | Accepted | Accepted | 81.03 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
def main():
A, B, C = list(map(int, input().split()))
... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 21 | 34 | 462 | 796 | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
def main():
A, B, C = list(map(int, input().split()))
if A == ... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 38.235294 | [
"+from string import ascii_lowercase",
"+from functools import lru_cache",
"+import sys",
"+sys.setrecursionlimit(10000)",
"+YES, Yes, yes, NO, No, no = \"YES\", \"Yes\", \"yes\", \"NO\", \"No\", \"no\"",
"+dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]",
"+",
"+",
"+def inside(y, x, H, W):",
"+ retur... | false | 0.052299 | 0.039295 | 1.330934 | [
"s524497292",
"s226250835"
] |
u535803878 | p02794 | python | s935955684 | s579656635 | 621 | 551 | 75,828 | 78,632 | Accepted | Accepted | 11.27 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
uv2e = {}
for i in range(n-1):
u,v = list(map(int, input().split()))
ns[u-1]... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
uv2e = {}
for i in range(n-1):
u,v = list(map(int, input().split()))
ns[u-1]... | 67 | 71 | 1,376 | 1,424 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
uv2e = {}
for i in range(n - 1):
u, v = list(map(int, input().split()))
ns[u - 1].add(v... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
from collections import defaultdict
n = int(eval(input()))
ns = defaultdict(set)
uv2e = {}
for i in range(n - 1):
u, v = list(map(int, input().split()))
ns[u - 1].add(v... | false | 5.633803 | [
"- dfs(l + [0], s)",
"+ l.append(0)",
"+ dfs(l, s)",
"+ l.pop()",
"- dfs(l + [1], s | p)",
"+ l.append(1)",
"+ dfs(l, s | p)",
"+ l.pop()"
] | false | 0.039896 | 0.040152 | 0.993627 | [
"s935955684",
"s579656635"
] |
u127499732 | p02899 | python | s399911886 | s205848786 | 78 | 71 | 16,180 | 15,528 | Accepted | Accepted | 8.97 | def main():
import sys
n=int(eval(input()))
l=[0]*n
i=1
for o in map(int,sys.stdin.readline().split()):
l[o-1]=str(i)
i+=1
print((" ".join(l)))
if __name__=="__main__":
main() | def main():
import sys
n=int(eval(input()))
a=tuple(map(int,sys.stdin.readline().split()))
b=[0]*n
i=1
for index in a:
b[index-1]=str(i)
i+=1
print((" ".join(b)))
if __name__=="__main__":
main() | 11 | 12 | 199 | 221 | def main():
import sys
n = int(eval(input()))
l = [0] * n
i = 1
for o in map(int, sys.stdin.readline().split()):
l[o - 1] = str(i)
i += 1
print((" ".join(l)))
if __name__ == "__main__":
main()
| def main():
import sys
n = int(eval(input()))
a = tuple(map(int, sys.stdin.readline().split()))
b = [0] * n
i = 1
for index in a:
b[index - 1] = str(i)
i += 1
print((" ".join(b)))
if __name__ == "__main__":
main()
| false | 8.333333 | [
"- l = [0] * n",
"+ a = tuple(map(int, sys.stdin.readline().split()))",
"+ b = [0] * n",
"- for o in map(int, sys.stdin.readline().split()):",
"- l[o - 1] = str(i)",
"+ for index in a:",
"+ b[index - 1] = str(i)",
"- print((\" \".join(l)))",
"+ print((\" \".join(b)... | false | 0.042076 | 0.042401 | 0.992338 | [
"s399911886",
"s205848786"
] |
u860829879 | p02844 | python | s748105094 | s347761453 | 196 | 77 | 39,280 | 66,844 | Accepted | Accepted | 60.71 | N=int(eval(input()))
S=eval(input())
ret=0
for i in range(1000):
pin="{:0>3}".format(i)
pos=0
begin=0
while pos<3:
begin=S.find(pin[pos],begin)+1
if begin==0:
break
pos+=1
else:
ret+=1
print(ret)
| n=int(eval(input()))
s=eval(input())
ans=0
for i in range(1000):
cs=str(i).zfill(3)
p=0
for c in cs:
p=s.find(c,p)
if p==-1:
break
p+=1
else:
ans+=1
print(ans) | 20 | 18 | 276 | 228 | N = int(eval(input()))
S = eval(input())
ret = 0
for i in range(1000):
pin = "{:0>3}".format(i)
pos = 0
begin = 0
while pos < 3:
begin = S.find(pin[pos], begin) + 1
if begin == 0:
break
pos += 1
else:
ret += 1
print(ret)
| n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
cs = str(i).zfill(3)
p = 0
for c in cs:
p = s.find(c, p)
if p == -1:
break
p += 1
else:
ans += 1
print(ans)
| false | 10 | [
"-N = int(eval(input()))",
"-S = eval(input())",
"-ret = 0",
"+n = int(eval(input()))",
"+s = eval(input())",
"+ans = 0",
"- pin = \"{:0>3}\".format(i)",
"- pos = 0",
"- begin = 0",
"- while pos < 3:",
"- begin = S.find(pin[pos], begin) + 1",
"- if begin == 0:",
"+ ... | false | 0.037795 | 0.037325 | 1.012596 | [
"s748105094",
"s347761453"
] |
u633255271 | p02574 | python | s409653438 | s908247086 | 581 | 291 | 197,232 | 202,544 | Accepted | Accepted | 49.91 | # 入力
N = int(eval(input()))
A = list(map(int, input().split()))
R = max(A)
prime_factor_counter = [0]*(R+1)
# D[x]にxを割り切れる最初の素数を格納
# 次に行う素因数分解で試し割りのムダを削減するための前準備
D = [0]*(R+1)
for i in range(2, R+1):
if D[i]:
continue
n = i
while n < R+1:
if D[n] == 0:
D[n] = i
... | N = int(eval(input()))
A = [0]*(1000001)
for a in list(map(int, input().split())):
A[a] += 1
# MFPF = Most Frequent Prime Factor
MFPF_n = 0
seen_prime_factor = [0]*(1000001)
for i in range(2, 1000001):
if seen_prime_factor[i]:
continue
n = i
tmp = 0
while n < 1000001:
... | 36 | 25 | 764 | 543 | # 入力
N = int(eval(input()))
A = list(map(int, input().split()))
R = max(A)
prime_factor_counter = [0] * (R + 1)
# D[x]にxを割り切れる最初の素数を格納
# 次に行う素因数分解で試し割りのムダを削減するための前準備
D = [0] * (R + 1)
for i in range(2, R + 1):
if D[i]:
continue
n = i
while n < R + 1:
if D[n] == 0:
D[n] = i
... | N = int(eval(input()))
A = [0] * (1000001)
for a in list(map(int, input().split())):
A[a] += 1
# MFPF = Most Frequent Prime Factor
MFPF_n = 0
seen_prime_factor = [0] * (1000001)
for i in range(2, 1000001):
if seen_prime_factor[i]:
continue
n = i
tmp = 0
while n < 1000001:
tmp += A[n]... | false | 30.555556 | [
"-# 入力",
"-A = list(map(int, input().split()))",
"-R = max(A)",
"-prime_factor_counter = [0] * (R + 1)",
"-# D[x]にxを割り切れる最初の素数を格納",
"-# 次に行う素因数分解で試し割りのムダを削減するための前準備",
"-D = [0] * (R + 1)",
"-for i in range(2, R + 1):",
"- if D[i]:",
"+A = [0] * (1000001)",
"+for a in list(map(int, input().spl... | false | 0.04412 | 1.997567 | 0.022087 | [
"s409653438",
"s908247086"
] |
u562935282 | p03806 | python | s696918602 | s328835675 | 153 | 34 | 3,188 | 3,700 | Accepted | Accepted | 77.78 | def main():
INF = 100 * 40 + 1
MX = 4000
N, Ma, Mb = list(map(int, input().split()))
dp = [[INF] * (MX * 2 + 1) for _ in range(2)]
i, j = 0, 1
for _ in range(N):
ai, bi, ci = list(map(int, input().split()))
x = Ma * bi - Mb * ai # Σai:Σbi=Ma:Mb<->Ma*Σbi-Mb*Σai=0
... | # https://atcoder.jp/contests/abc054/submissions/4360181
def main():
from collections import defaultdict
INF = 40 * 100 + 1
N, Ma, Mb = list(map(int, input().split()))
memo = defaultdict(lambda: INF)
for _ in range(N):
ai, bi, ci = list(map(int, input().split()))
x ... | 29 | 27 | 690 | 668 | def main():
INF = 100 * 40 + 1
MX = 4000
N, Ma, Mb = list(map(int, input().split()))
dp = [[INF] * (MX * 2 + 1) for _ in range(2)]
i, j = 0, 1
for _ in range(N):
ai, bi, ci = list(map(int, input().split()))
x = Ma * bi - Mb * ai # Σai:Σbi=Ma:Mb<->Ma*Σbi-Mb*Σai=0
for k in... | # https://atcoder.jp/contests/abc054/submissions/4360181
def main():
from collections import defaultdict
INF = 40 * 100 + 1
N, Ma, Mb = list(map(int, input().split()))
memo = defaultdict(lambda: INF)
for _ in range(N):
ai, bi, ci = list(map(int, input().split()))
x = Ma * bi - Mb * ... | false | 6.896552 | [
"+# https://atcoder.jp/contests/abc054/submissions/4360181",
"- INF = 100 * 40 + 1",
"- MX = 4000",
"+ from collections import defaultdict",
"+",
"+ INF = 40 * 100 + 1",
"- dp = [[INF] * (MX * 2 + 1) for _ in range(2)]",
"- i, j = 0, 1",
"+ memo = defaultdict(lambda: INF)",
"-... | false | 0.053835 | 0.035881 | 1.500362 | [
"s696918602",
"s328835675"
] |
u941047297 | p03262 | python | s420772861 | s550519577 | 89 | 75 | 16,276 | 20,736 | Accepted | Accepted | 15.73 | import fractions
from functools import reduce
def gcd_list(l):
return reduce(fractions.gcd, l)
n, x0 = list(map(int, input().split()))
X = list(map(int, input().split()))
X = [abs(x - x0) for x in X]
print((gcd_list(X))) | from functools import reduce
import math
def main():
n, s = list(map(int, input().split()))
X = list([abs(int(x) - s) for x in input().split()])
ans = reduce(lambda x, y :math.gcd(x, y), X, X[0])
print(ans)
if __name__ == '__main__':
main()
| 8 | 10 | 229 | 269 | import fractions
from functools import reduce
def gcd_list(l):
return reduce(fractions.gcd, l)
n, x0 = list(map(int, input().split()))
X = list(map(int, input().split()))
X = [abs(x - x0) for x in X]
print((gcd_list(X)))
| from functools import reduce
import math
def main():
n, s = list(map(int, input().split()))
X = list([abs(int(x) - s) for x in input().split()])
ans = reduce(lambda x, y: math.gcd(x, y), X, X[0])
print(ans)
if __name__ == "__main__":
main()
| false | 20 | [
"-import fractions",
"+import math",
"-def gcd_list(l):",
"- return reduce(fractions.gcd, l)",
"+def main():",
"+ n, s = list(map(int, input().split()))",
"+ X = list([abs(int(x) - s) for x in input().split()])",
"+ ans = reduce(lambda x, y: math.gcd(x, y), X, X[0])",
"+ print(ans)",
... | false | 0.043368 | 0.035869 | 1.209067 | [
"s420772861",
"s550519577"
] |
u687044304 | p02936 | python | s903367338 | s603298783 | 1,955 | 1,609 | 350,252 | 268,404 | Accepted | Accepted | 17.7 | import sys
sys.setrecursionlimit(1000000)
N, Q = list(map(int, sys.stdin.readline().split()))
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
rin = [[] for _ in range(N)]
for v in a_b:
rin[v[0]-1].append(v[1]-1)... | # -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(1000000)
"""解説
いもす法っぽいことする
[入力例]
4 3
1 2
2 3
2 4
2 10
1 100
3 1
[出力例]
"""
def solve():
N, Q = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(N)] # 木
for _ in range(N-1):
a, b = list(map(int, sys.s... | 25 | 50 | 610 | 897 | import sys
sys.setrecursionlimit(1000000)
N, Q = list(map(int, sys.stdin.readline().split()))
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
rin = [[] for _ in range(N)]
for v in a_b:
rin[v[0] - 1].append(v[1] - 1)
... | # -*- coding:utf-8 -*-
import sys
sys.setrecursionlimit(1000000)
"""解説
いもす法っぽいことする
[入力例]
4 3
1 2
2 3
2 4
2 10
1 100
3 1
[出力例]
"""
def solve():
N, Q = list(map(int, sys.stdin.readline().split()))
to = [[] for _ in range(N)] # 木
for _ in range(N - 1):
a, b = list(map(int, sys.stdin.readline().spli... | false | 50 | [
"+# -*- coding:utf-8 -*-",
"-N, Q = list(map(int, sys.stdin.readline().split()))",
"-a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(N - 1)]",
"-p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]",
"-rin = [[] for _ in range(N)]",
"-for v in a_b:",
"- rin[v[0] -... | false | 0.084952 | 0.083435 | 1.018183 | [
"s903367338",
"s603298783"
] |
u389910364 | p02699 | python | s831259237 | s806500159 | 103 | 19 | 27,136 | 9,240 | Accepted | Accepted | 81.55 | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math impor... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
S, W = list(map(int, sys.stdin.buffer.readline().split()))
if S <= W:
print('unsafe')
else:
print('safe')
| 35 | 18 | 692 | 318 | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import lru_cache, reduce
from math import gcd
from oper... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
S, W = list(map(int, sys.stdin.buffer.readline().split()))
if S <= W:
print("unsafe")
else:
print("safe")
| false | 48.571429 | [
"-import bisect",
"-import cmath",
"-import heapq",
"-import itertools",
"-import math",
"-import operator",
"-import random",
"-import re",
"-import string",
"-from collections import Counter, defaultdict, deque",
"-from copy import deepcopy",
"-from decimal import Decimal",
"-from functool... | false | 0.036602 | 0.03227 | 1.13423 | [
"s831259237",
"s806500159"
] |
u952708174 | p03504 | python | s996084076 | s165570876 | 1,991 | 1,518 | 30,160 | 26,808 | Accepted | Accepted | 23.76 | def d_recording(N, C, R):
"""
N:録画する番組の数
C:テレビが受信できるチャンネルの数
R:録画する番組の情報 [開始時刻s,終了時刻t,チャンネルc]
"""
s = [row[0] for row in R]
t = [row[1] for row in R]
c = [row[2] for row in R]
# いつまで録画機を動かすか。0.5を単位時間とするので*2
# 時刻を0からスタートさせるので+2
l = max(t) * 2 + 2
sm = [0 for _... | def d_recording(N, C, R):
# N:録画する番組の数
# C:テレビが受信できるチャンネルの数
# R:録画する番組の情報 [開始時刻s,終了時刻t,チャンネルc]
from itertools import accumulate
start = [row[0] for row in R]
end = [row[1] for row in R]
channel_num = [row[2] for row in R]
# いつまで録画機を動かすか。0.5を単位時間とするので*2
# 時刻を0からスタートさせるので+2
... | 36 | 34 | 1,046 | 1,149 | def d_recording(N, C, R):
"""
N:録画する番組の数
C:テレビが受信できるチャンネルの数
R:録画する番組の情報 [開始時刻s,終了時刻t,チャンネルc]
"""
s = [row[0] for row in R]
t = [row[1] for row in R]
c = [row[2] for row in R]
# いつまで録画機を動かすか。0.5を単位時間とするので*2
# 時刻を0からスタートさせるので+2
l = max(t) * 2 + 2
sm = [0 for _ in range(l)] ... | def d_recording(N, C, R):
# N:録画する番組の数
# C:テレビが受信できるチャンネルの数
# R:録画する番組の情報 [開始時刻s,終了時刻t,チャンネルc]
from itertools import accumulate
start = [row[0] for row in R]
end = [row[1] for row in R]
channel_num = [row[2] for row in R]
# いつまで録画機を動かすか。0.5を単位時間とするので*2
# 時刻を0からスタートさせるので+2
l = ma... | false | 5.555556 | [
"- \"\"\"",
"- N:録画する番組の数",
"- C:テレビが受信できるチャンネルの数",
"- R:録画する番組の情報 [開始時刻s,終了時刻t,チャンネルc]",
"- \"\"\"",
"- s = [row[0] for row in R]",
"- t = [row[1] for row in R]",
"- c = [row[2] for row in R]",
"+ # N:録画する番組の数",
"+ # C:テレビが受信できるチャンネルの数",
"+ # R:録画する番組の情報 [開始時刻s,... | false | 0.059203 | 0.061845 | 0.957286 | [
"s996084076",
"s165570876"
] |
u550574002 | p03658 | python | s011676162 | s475853124 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n,k=list(map(int,input().split()))
print((sum(sorted(map(int,input().split()))[n-k:]))) | k=int(input().split()[1])
print((sum(sorted(map(int,input().split()))[-k:]))) | 2 | 2 | 80 | 76 | n, k = list(map(int, input().split()))
print((sum(sorted(map(int, input().split()))[n - k :])))
| k = int(input().split()[1])
print((sum(sorted(map(int, input().split()))[-k:])))
| false | 0 | [
"-n, k = list(map(int, input().split()))",
"-print((sum(sorted(map(int, input().split()))[n - k :])))",
"+k = int(input().split()[1])",
"+print((sum(sorted(map(int, input().split()))[-k:])))"
] | false | 0.042856 | 0.044029 | 0.973356 | [
"s011676162",
"s475853124"
] |
u761320129 | p03599 | python | s584384399 | s188506629 | 92 | 79 | 3,188 | 3,188 | Accepted | Accepted | 14.13 | A,B,C,D,E,F = list(map(int,input().split()))
waters = set()
for wb in range(0,F+1,100*B):
wa = 0
while wa + wb <= F:
waters.add(wa + wb)
wa += 100*A
waters.remove(0)
sugars = set()
for sd in range(0,F+1,D):
sc = 0
while sc + sd <= F:
sugars.add(sc + sd)
s... | A,B,C,D,E,F = list(map(int,input().split()))
waters = set()
for w1 in range(0,F+1,B):
if w1*100 > F: break
for w2 in range(0,F+1,A):
w = (w1+w2)*100
if w > F: break
if w==0: continue
waters.add(w)
sugars = set()
for s1 in range(0,F+1,D):
if s1 > F: break
f... | 29 | 32 | 622 | 721 | A, B, C, D, E, F = list(map(int, input().split()))
waters = set()
for wb in range(0, F + 1, 100 * B):
wa = 0
while wa + wb <= F:
waters.add(wa + wb)
wa += 100 * A
waters.remove(0)
sugars = set()
for sd in range(0, F + 1, D):
sc = 0
while sc + sd <= F:
sugars.add(sc + sd)
... | A, B, C, D, E, F = list(map(int, input().split()))
waters = set()
for w1 in range(0, F + 1, B):
if w1 * 100 > F:
break
for w2 in range(0, F + 1, A):
w = (w1 + w2) * 100
if w > F:
break
if w == 0:
continue
waters.add(w)
sugars = set()
for s1 in rang... | false | 9.375 | [
"-for wb in range(0, F + 1, 100 * B):",
"- wa = 0",
"- while wa + wb <= F:",
"- waters.add(wa + wb)",
"- wa += 100 * A",
"-waters.remove(0)",
"+for w1 in range(0, F + 1, B):",
"+ if w1 * 100 > F:",
"+ break",
"+ for w2 in range(0, F + 1, A):",
"+ w = (w1 +... | false | 0.05301 | 0.158086 | 0.335324 | [
"s584384399",
"s188506629"
] |
u809819902 | p02754 | python | s113733627 | s452062992 | 31 | 27 | 9,028 | 9,108 | Accepted | Accepted | 12.9 | n, a, b = list(map(int, input().split()))
c = a + b
if n % c == 0:
ans = a * (n // c)
elif n % c <= a:
ans = a * (n // c) + n % c
else:
ans = a * (n // c +1)
print(ans)
| n,a,b=list(map(int,input().split()))
t=a+b
if n%t<=a:
diff=n%t
else:
diff=a
print((a*(n//t)+diff)) | 10 | 7 | 185 | 104 | n, a, b = list(map(int, input().split()))
c = a + b
if n % c == 0:
ans = a * (n // c)
elif n % c <= a:
ans = a * (n // c) + n % c
else:
ans = a * (n // c + 1)
print(ans)
| n, a, b = list(map(int, input().split()))
t = a + b
if n % t <= a:
diff = n % t
else:
diff = a
print((a * (n // t) + diff))
| false | 30 | [
"-c = a + b",
"-if n % c == 0:",
"- ans = a * (n // c)",
"-elif n % c <= a:",
"- ans = a * (n // c) + n % c",
"+t = a + b",
"+if n % t <= a:",
"+ diff = n % t",
"- ans = a * (n // c + 1)",
"-print(ans)",
"+ diff = a",
"+print((a * (n // t) + diff))"
] | false | 0.041641 | 0.041416 | 1.005436 | [
"s113733627",
"s452062992"
] |
u261103969 | p02773 | python | s018492861 | s663492572 | 716 | 455 | 45,040 | 148,304 | Accepted | Accepted | 36.45 | import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
c = collections.Counter(s)
count = c.most_common()[0][1]
s2 = [i[0] for i in list(c.items()) if i[1] == count]
s2 = sorted(s2)
for i in range(len(s2)):
print((s2[i])) | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
from collections import Counter
N = int(readline())
c = Counter()
for _ in range(N):
s = eval(input())
c[s] += 1
_, cnt = c.most_common(1)[... | 13 | 33 | 246 | 519 | import collections
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
c = collections.Counter(s)
count = c.most_common()[0][1]
s2 = [i[0] for i in list(c.items()) if i[1] == count]
s2 = sorted(s2)
for i in range(len(s2)):
print((s2[i]))
| import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
from collections import Counter
N = int(readline())
c = Counter()
for _ in range(N):
s = eval(input())
c[s] += 1
_, cnt = c.most_common(1)[0]
res = []
for ... | false | 60.606061 | [
"-import collections",
"+import sys",
"-n = int(eval(input()))",
"-s = [eval(input()) for i in range(n)]",
"-c = collections.Counter(s)",
"-count = c.most_common()[0][1]",
"-s2 = [i[0] for i in list(c.items()) if i[1] == count]",
"-s2 = sorted(s2)",
"-for i in range(len(s2)):",
"- print((s2[i])... | false | 0.04227 | 0.04621 | 0.914742 | [
"s018492861",
"s663492572"
] |
u620755587 | p02917 | python | s437671062 | s061501303 | 19 | 17 | 3,064 | 2,940 | Accepted | Accepted | 10.53 | N = int(eval(input()))
B = list(map(int, input().split()))
A = [0]*(len(B)+1)
A[0] = B[0]
A[1] = B[0]
cnt = 0
for i, x in enumerate(B):
if i != 0:
A[i + 1] = B[i]
A[i] = min(A[i], B[i])
cnt += A[i]
cnt += A[-1]
print(cnt) | n = int(eval(input()))
b = list(map(int, input().split()))
cnt = b[0]
for i in range(1, n-1):
cnt += min(b[i-1], b[i])
print((cnt + b[-1])) | 13 | 6 | 251 | 138 | N = int(eval(input()))
B = list(map(int, input().split()))
A = [0] * (len(B) + 1)
A[0] = B[0]
A[1] = B[0]
cnt = 0
for i, x in enumerate(B):
if i != 0:
A[i + 1] = B[i]
A[i] = min(A[i], B[i])
cnt += A[i]
cnt += A[-1]
print(cnt)
| n = int(eval(input()))
b = list(map(int, input().split()))
cnt = b[0]
for i in range(1, n - 1):
cnt += min(b[i - 1], b[i])
print((cnt + b[-1]))
| false | 53.846154 | [
"-N = int(eval(input()))",
"-B = list(map(int, input().split()))",
"-A = [0] * (len(B) + 1)",
"-A[0] = B[0]",
"-A[1] = B[0]",
"-cnt = 0",
"-for i, x in enumerate(B):",
"- if i != 0:",
"- A[i + 1] = B[i]",
"- A[i] = min(A[i], B[i])",
"- cnt += A[i]",
"-cnt += A[-1]",
"-pri... | false | 0.061744 | 0.050381 | 1.225538 | [
"s437671062",
"s061501303"
] |
u972892985 | p03795 | python | s320445335 | s505601069 | 21 | 17 | 3,060 | 2,940 | Accepted | Accepted | 19.05 | n = int(eval(input()))
print(((n*800)-((n//15)*200))) | n = int(eval(input()))
print(((n*800)-(n//15*200))) | 2 | 2 | 46 | 44 | n = int(eval(input()))
print(((n * 800) - ((n // 15) * 200)))
| n = int(eval(input()))
print(((n * 800) - (n // 15 * 200)))
| false | 0 | [
"-print(((n * 800) - ((n // 15) * 200)))",
"+print(((n * 800) - (n // 15 * 200)))"
] | false | 0.040367 | 0.062188 | 0.649107 | [
"s320445335",
"s505601069"
] |
u489959379 | p03945 | python | s913827121 | s748558464 | 208 | 32 | 46,064 | 3,188 | Accepted | Accepted | 84.62 | s = eval(input())
S = []
for i in range(len(s)):
if i == 0:
S.append(s[i])
else:
if S[-1] != s[i]:
S.append(s[i])
print((len(S) - 1)) | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
s = eval(input())
n = len(s)
res = 0
for i in range(1, n):
if s[i - 1] != s[i]:
res += 1
print(res)
if __name__ == '__main__':
resolve()
| 11 | 20 | 173 | 296 | s = eval(input())
S = []
for i in range(len(s)):
if i == 0:
S.append(s[i])
else:
if S[-1] != s[i]:
S.append(s[i])
print((len(S) - 1))
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
s = eval(input())
n = len(s)
res = 0
for i in range(1, n):
if s[i - 1] != s[i]:
res += 1
print(res)
if __name__ == "__main__":
resolve()
| false | 45 | [
"-s = eval(input())",
"-S = []",
"-for i in range(len(s)):",
"- if i == 0:",
"- S.append(s[i])",
"- else:",
"- if S[-1] != s[i]:",
"- S.append(s[i])",
"-print((len(S) - 1))",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+f_inf = float(\"inf\")",
"+mo... | false | 0.087417 | 0.062581 | 1.396863 | [
"s913827121",
"s748558464"
] |
u497596438 | p03315 | python | s665950113 | s282565828 | 198 | 179 | 38,384 | 38,384 | Accepted | Accepted | 9.6 | S=eval(input())
#N=int(input())
#A1,A2,A3=map(int,input().split())
sum=0
for i in S:
if i=="+":
sum+=1
else:
sum-=1
print(sum) | S=eval(input())
ans=0
for i in S:
if i=="+":
ans+=1
else:
ans-=1
print(ans)
| 10 | 8 | 153 | 101 | S = eval(input())
# N=int(input())
# A1,A2,A3=map(int,input().split())
sum = 0
for i in S:
if i == "+":
sum += 1
else:
sum -= 1
print(sum)
| S = eval(input())
ans = 0
for i in S:
if i == "+":
ans += 1
else:
ans -= 1
print(ans)
| false | 20 | [
"-# N=int(input())",
"-# A1,A2,A3=map(int,input().split())",
"-sum = 0",
"+ans = 0",
"- sum += 1",
"+ ans += 1",
"- sum -= 1",
"-print(sum)",
"+ ans -= 1",
"+print(ans)"
] | false | 0.036001 | 0.036322 | 0.991185 | [
"s665950113",
"s282565828"
] |
u135454978 | p03752 | python | s786148918 | s254748888 | 247 | 45 | 3,064 | 3,064 | Accepted | Accepted | 81.78 | # Square869120Contest #4 B - Buildings are Colorful!
# 全探探索 ver
import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
a = list(map(int, sys.stdin.readline().strip().split()))
ans = float('inf')
for i in range(2 ** (N - 1)):
bit = [(i >> j) & 1 for j in range(N - 1)] # 左から2番目以降で見える... | # Square869120Contest #4 B - Buildings are Colorful!
# 分割統治法 ver
import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
a = list(map(int, sys.stdin.readline().strip().split()))
if K == 0:
sys.exit()
def dfs(height=a[0], cost=0, target=K, can_see=1, i=1):
if can_see >= target:
... | 32 | 39 | 810 | 1,073 | # Square869120Contest #4 B - Buildings are Colorful!
# 全探探索 ver
import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
a = list(map(int, sys.stdin.readline().strip().split()))
ans = float("inf")
for i in range(2 ** (N - 1)):
bit = [(i >> j) & 1 for j in range(N - 1)] # 左から2番目以降で見えるようにするビルを選択
c... | # Square869120Contest #4 B - Buildings are Colorful!
# 分割統治法 ver
import sys
N, K = list(map(int, sys.stdin.readline().strip().split()))
a = list(map(int, sys.stdin.readline().strip().split()))
if K == 0:
sys.exit()
def dfs(height=a[0], cost=0, target=K, can_see=1, i=1):
if can_see >= target:
# print(... | false | 17.948718 | [
"-# 全探探索 ver",
"+# 分割統治法 ver",
"-ans = float(\"inf\")",
"-for i in range(2 ** (N - 1)):",
"- bit = [(i >> j) & 1 for j in range(N - 1)] # 左から2番目以降で見えるようにするビルを選択",
"- can_see = 0",
"- cost = 0",
"- height = a[0]",
"- for j, b in enumerate(bit):",
"- if (b == 1) & (height >= a... | false | 0.079874 | 0.11645 | 0.685912 | [
"s786148918",
"s254748888"
] |
u222668979 | p02548 | python | s851538359 | s293602023 | 130 | 82 | 62,876 | 72,904 | Accepted | Accepted | 36.92 | n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += (n - 1) // a
print(ans)
| n = int(eval(input()))
print((sum((n-1)//a for a in range(1,n))))
| 6 | 2 | 88 | 59 | n = int(eval(input()))
ans = 0
for a in range(1, n):
ans += (n - 1) // a
print(ans)
| n = int(eval(input()))
print((sum((n - 1) // a for a in range(1, n))))
| false | 66.666667 | [
"-ans = 0",
"-for a in range(1, n):",
"- ans += (n - 1) // a",
"-print(ans)",
"+print((sum((n - 1) // a for a in range(1, n))))"
] | false | 0.058831 | 0.07296 | 0.806349 | [
"s851538359",
"s293602023"
] |
u340781749 | p02564 | python | s941851642 | s841041085 | 3,354 | 2,342 | 310,160 | 246,256 | Accepted | Accepted | 30.17 | import os
import sys
import numpy as np
def solve(inp):
def dfs(links, s, checked, postorder):
stack = [0, s]
while stack:
i, v = stack[-2:]
if i == 0 and checked[v]:
stack.pop()
stack.pop()
continue
... | import os
import sys
import numpy as np
def solve(inp):
def dfs(links, s, checked, postorder):
stack = [0, s]
while stack:
i, v = stack[-2:]
if i == 0 and checked[v]:
stack.pop()
stack.pop()
continue
... | 99 | 97 | 2,350 | 2,244 | import os
import sys
import numpy as np
def solve(inp):
def dfs(links, s, checked, postorder):
stack = [0, s]
while stack:
i, v = stack[-2:]
if i == 0 and checked[v]:
stack.pop()
stack.pop()
continue
checked[v] = 1... | import os
import sys
import numpy as np
def solve(inp):
def dfs(links, s, checked, postorder):
stack = [0, s]
while stack:
i, v = stack[-2:]
if i == 0 and checked[v]:
stack.pop()
stack.pop()
continue
checked[v] = 1... | false | 2.020202 | [
"- links = [list(set(link)) for link in links]",
"- rev_links = [list(set(link)) for link in rev_links]"
] | false | 0.328159 | 0.222238 | 1.476613 | [
"s941851642",
"s841041085"
] |
u672475305 | p03326 | python | s446054287 | s781146345 | 242 | 210 | 40,304 | 39,024 | Accepted | Accepted | 13.22 | n,m = list(map(int,input().split()))
lst0, lst1, lst2, lst3, lst4, lst5, lst6, lst7 =[],[],[],[],[],[],[],[]
for i in range(n):
x,y,z = list(map(int,input().split()))
lst0.append(x+y+z)
lst1.append(x+y-z)
lst2.append(x-y+z)
lst3.append(x-y-z)
lst4.append(-x+y+z)
lst5.append(-x+y-z)
... | n,m = list(map(int,input().split()))
lst = [[] for _ in range(8)]
for i in range(n):
x,y,z = list(map(int,input().split()))
lst[0].append(x+y+z)
lst[1].append(x+y-z)
lst[2].append(x-y+z)
lst[3].append(x-y-z)
lst[4].append(-x+y+z)
lst[5].append(-x+y-z)
lst[6].append(-x-y+z)
... | 31 | 18 | 802 | 461 | n, m = list(map(int, input().split()))
lst0, lst1, lst2, lst3, lst4, lst5, lst6, lst7 = [], [], [], [], [], [], [], []
for i in range(n):
x, y, z = list(map(int, input().split()))
lst0.append(x + y + z)
lst1.append(x + y - z)
lst2.append(x - y + z)
lst3.append(x - y - z)
lst4.append(-x + y + z)
... | n, m = list(map(int, input().split()))
lst = [[] for _ in range(8)]
for i in range(n):
x, y, z = list(map(int, input().split()))
lst[0].append(x + y + z)
lst[1].append(x + y - z)
lst[2].append(x - y + z)
lst[3].append(x - y - z)
lst[4].append(-x + y + z)
lst[5].append(-x + y - z)
lst[6].... | false | 41.935484 | [
"-lst0, lst1, lst2, lst3, lst4, lst5, lst6, lst7 = [], [], [], [], [], [], [], []",
"+lst = [[] for _ in range(8)]",
"- lst0.append(x + y + z)",
"- lst1.append(x + y - z)",
"- lst2.append(x - y + z)",
"- lst3.append(x - y - z)",
"- lst4.append(-x + y + z)",
"- lst5.append(-x + y - z)... | false | 0.045226 | 0.035119 | 1.28778 | [
"s446054287",
"s781146345"
] |
u163320134 | p02614 | python | s716837542 | s345556242 | 64 | 56 | 9,188 | 9,116 | Accepted | Accepted | 12.5 | h,w,k=list(map(int,input().split()))
board=[list(eval(input())) for _ in range(h)]
ans=0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt=0
for i in range(h):
for j in range(w):
if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
if board[i][j]=='#':
cnt+=1
... | import itertools
h,w,k=list(map(int,input().split()))
board=[list(eval(input())) for _ in range(h)]
ans=0
for bit_col in itertools.product(list(range(2)),repeat=h):
for bit_row in itertools.product(list(range(2)),repeat=w):
cnt=0
for i in range(h):
for j in range(w):
if bit_col[i]==0 ... | 14 | 15 | 346 | 395 | h, w, k = list(map(int, input().split()))
board = [list(eval(input())) for _ in range(h)]
ans = 0
for paint_h in range(2**h):
for paint_w in range(2**w):
cnt = 0
for i in range(h):
for j in range(w):
if (paint_h >> i) & 1 == 0 and (paint_w >> j) & 1 == 0:
... | import itertools
h, w, k = list(map(int, input().split()))
board = [list(eval(input())) for _ in range(h)]
ans = 0
for bit_col in itertools.product(list(range(2)), repeat=h):
for bit_row in itertools.product(list(range(2)), repeat=w):
cnt = 0
for i in range(h):
for j in range(w):
... | false | 6.666667 | [
"+import itertools",
"+",
"-for paint_h in range(2**h):",
"- for paint_w in range(2**w):",
"+for bit_col in itertools.product(list(range(2)), repeat=h):",
"+ for bit_row in itertools.product(list(range(2)), repeat=w):",
"- if (paint_h >> i) & 1 == 0 and (paint_w >> j) & 1 == 0:",
... | false | 0.067015 | 0.120559 | 0.555864 | [
"s716837542",
"s345556242"
] |
u109617871 | p03416 | python | s739071359 | s636185918 | 62 | 56 | 3,064 | 3,060 | Accepted | Accepted | 9.68 | A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]]))) | A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i)[0] == str(i)[-1]
and str(i)[1] == str(i)[-2]]))) | 2 | 3 | 100 | 141 | A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]])))
| A, B = list(map(int, input().split()))
print(
(
sum(
[
1
for i in range(A, B + 1)
if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]
]
)
)
)
| false | 33.333333 | [
"-print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]])))",
"+print(",
"+ (",
"+ sum(",
"+ [",
"+ 1",
"+ for i in range(A, B + 1)",
"+ if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]",
"+ ]",
"+ ... | false | 0.049353 | 0.048814 | 1.011056 | [
"s739071359",
"s636185918"
] |
u493520238 | p02991 | python | s854800941 | s833742013 | 364 | 319 | 23,824 | 106,352 | Accepted | Accepted | 12.36 | from collections import deque
def bfs(start, goal, g, n, visited):
visited1 = [False]*(n+1)
visited2 = [False]*(n+1)
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
if curr_node == goal:
return
for next1_node in g[curr_node]:
... | from collections import deque
def bfs(start, g, visited, goal):
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
for next_node in g[curr_node]:
if visited[next_node] >= 0: continue
visited[next_node] = visited[curr_node] + 1
... | 42 | 26 | 1,135 | 706 | from collections import deque
def bfs(start, goal, g, n, visited):
visited1 = [False] * (n + 1)
visited2 = [False] * (n + 1)
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
if curr_node == goal:
return
for next1_node in g[curr_node]:
... | from collections import deque
def bfs(start, g, visited, goal):
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
for next_node in g[curr_node]:
if visited[next_node] >= 0:
continue
visited[next_node] = visited[curr_node] + 1
... | false | 38.095238 | [
"-def bfs(start, goal, g, n, visited):",
"- visited1 = [False] * (n + 1)",
"- visited2 = [False] * (n + 1)",
"+def bfs(start, g, visited, goal):",
"- if curr_node == goal:",
"- return",
"- for next1_node in g[curr_node]:",
"- if visited1[next1_node]:",
"+ ... | false | 0.04473 | 0.090613 | 0.493633 | [
"s854800941",
"s833742013"
] |
u968166680 | p03546 | python | s439181616 | s525802879 | 31 | 27 | 6,308 | 5,924 | Accepted | Accepted | 12.9 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
C = [list(map(int, readline().split())) for _ in range(10)]
A = li... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
C = [list(map(int, readline().split())) for _ in range(10)]
A = list(map(int, read().split()))
... | 34 | 31 | 749 | 652 | import sys
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
C = [list(map(int, readline().split())) for _ in range(10)]
A = list(map(int, rea... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
C = [list(map(int, readline().split())) for _ in range(10)]
A = list(map(int, read().split()))
for k in range... | false | 8.823529 | [
"-from collections import Counter",
"- counter = Counter(A)",
"- for n, freq in list(counter.items()):",
"- if n not in (-1, 1):",
"- ans += C[n][1] * freq",
"+ for n in A:",
"+ if n != -1:",
"+ ans += C[n][1]"
] | false | 0.088397 | 0.037868 | 2.334342 | [
"s439181616",
"s525802879"
] |
u886633618 | p02948 | python | s924293173 | s356128147 | 817 | 564 | 72,024 | 31,976 | Accepted | Accepted | 30.97 | N, M = list(map(int, input().split()))
AB_array = [list(map(int, input().split())) for _ in range(N)]
AB_array = sorted(AB_array, key=lambda x: -x[1])
# print(AB_array)
used_array = [0] * M
next_array = [i for i in range(M)]
ans = 0
for AB in AB_array:
A, B = AB
# print(A, B)
ok_flag =... | import heapq
N, M = list(map(int, input().split()))
AB_array = [list(map(int, input().split())) for _ in range(N)]
AB_array = sorted(AB_array, key=lambda x: x[0])
h = []
ab_index = 0
ans = 0
for m in range(1, M+1):
while ab_index != N:
if AB_array[ab_index][0] == m:
heapq.h... | 34 | 25 | 723 | 477 | N, M = list(map(int, input().split()))
AB_array = [list(map(int, input().split())) for _ in range(N)]
AB_array = sorted(AB_array, key=lambda x: -x[1])
# print(AB_array)
used_array = [0] * M
next_array = [i for i in range(M)]
ans = 0
for AB in AB_array:
A, B = AB
# print(A, B)
ok_flag = 0
start = M - A
... | import heapq
N, M = list(map(int, input().split()))
AB_array = [list(map(int, input().split())) for _ in range(N)]
AB_array = sorted(AB_array, key=lambda x: x[0])
h = []
ab_index = 0
ans = 0
for m in range(1, M + 1):
while ab_index != N:
if AB_array[ab_index][0] == m:
heapq.heappush(h, -AB_arra... | false | 26.470588 | [
"+import heapq",
"+",
"-AB_array = sorted(AB_array, key=lambda x: -x[1])",
"-# print(AB_array)",
"-used_array = [0] * M",
"-next_array = [i for i in range(M)]",
"+AB_array = sorted(AB_array, key=lambda x: x[0])",
"+h = []",
"+ab_index = 0",
"-for AB in AB_array:",
"- A, B = AB",
"- # pri... | false | 0.035455 | 0.06457 | 0.549095 | [
"s924293173",
"s356128147"
] |
u102461423 | p02758 | python | s722107673 | s207385215 | 1,349 | 937 | 128,732 | 132,692 | Accepted | Accepted | 30.54 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect_left
MOD = 998244353
N = int(readline())
m = list(map(int,read().split()))
XD = sorted(zip(m,m))
X, D = list(zip(*XD))
class MaxSegTree():
def __init__(self,... | import sys
import numpy as np
import numba
from numba import njit
from numba.types import Omitted
i4 = numba.int32
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 998_244_353
@njit((numba.types.optional(i8), ) * 2, cache=Tr... | 79 | 85 | 1,932 | 1,946 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect_left
MOD = 998244353
N = int(readline())
m = list(map(int, read().split()))
XD = sorted(zip(m, m))
X, D = list(zip(*XD))
class MaxSegTree:
def __init__(self, raw_data):
... | import sys
import numpy as np
import numba
from numba import njit
from numba.types import Omitted
i4 = numba.int32
i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
MOD = 998_244_353
@njit((numba.types.optional(i8),) * 2, cache=True)
def seg_f(x... | false | 7.058824 | [
"+import numpy as np",
"+import numba",
"+from numba import njit",
"+from numba.types import Omitted",
"+i4 = numba.int32",
"+i8 = numba.int64",
"-from bisect import bisect_left",
"-",
"-MOD = 998244353",
"-N = int(readline())",
"-m = list(map(int, read().split()))",
"-XD = sorted(zip(m, m))",... | false | 0.037068 | 0.391503 | 0.09468 | [
"s722107673",
"s207385215"
] |
u023077142 | p03317 | python | s912893997 | s831605844 | 45 | 17 | 13,880 | 3,060 | Accepted | Accepted | 62.22 | N, K = [int(c) for c in input().split()]
As = [int(c) for c in input().split()]
t = 1 if (N - 1) % (K - 1) else 0
print(((N - 1) // (K - 1) + t)) | (lambda N, K, t: print((N - 1) // (K - 1) + t))(*((lambda N, K: [N, K, 1 if (N - 1) % (K - 1) else 0])(*[int(c) for c in input().split()])))
| 4 | 1 | 146 | 140 | N, K = [int(c) for c in input().split()]
As = [int(c) for c in input().split()]
t = 1 if (N - 1) % (K - 1) else 0
print(((N - 1) // (K - 1) + t))
| (lambda N, K, t: print((N - 1) // (K - 1) + t))(
*(
(lambda N, K: [N, K, 1 if (N - 1) % (K - 1) else 0])(
*[int(c) for c in input().split()]
)
)
)
| false | 75 | [
"-N, K = [int(c) for c in input().split()]",
"-As = [int(c) for c in input().split()]",
"-t = 1 if (N - 1) % (K - 1) else 0",
"-print(((N - 1) // (K - 1) + t))",
"+(lambda N, K, t: print((N - 1) // (K - 1) + t))(",
"+ *(",
"+ (lambda N, K: [N, K, 1 if (N - 1) % (K - 1) else 0])(",
"+ ... | false | 0.077642 | 0.075877 | 1.023263 | [
"s912893997",
"s831605844"
] |
u525065967 | p02579 | python | s858038198 | s545532215 | 579 | 529 | 89,260 | 93,104 | Accepted | Accepted | 8.64 | dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1), ( 1, 1),( 1, 2),
( 0,-2), ( 0, 2),
(-1,-2),(-1,-1), (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]
H, W = list(map(int, input().split()))
sh, sw = [int(x)-1 for x in input... | dhw = [(1,0),(0,-1),(0,1),(-1,0),
( 2,-2),( 2,-1),( 2, 0),( 2, 1),( 2, 2),
( 1,-2),( 1,-1), ( 1, 1),( 1, 2),
( 0,-2), ( 0, 2),
(-1,-2),(-1,-1), (-1, 1),(-1, 2),
(-2,-2),(-2,-1),(-2, 0),(-2, 1),(-2, 2)]
H, W = list(map(int, input().split()))
sh, sw = [int(x)-1 for x in input... | 42 | 38 | 1,334 | 1,187 | dhw = [
(1, 0),
(0, -1),
(0, 1),
(-1, 0),
(2, -2),
(2, -1),
(2, 0),
(2, 1),
(2, 2),
(1, -2),
(1, -1),
(1, 1),
(1, 2),
(0, -2),
(0, 2),
(-1, -2),
(-1, -1),
(-1, 1),
(-1, 2),
(-2, -2),
(-2, -1),
(-2, 0),
(-2, 1),
(-2, 2),
]
H,... | dhw = [
(1, 0),
(0, -1),
(0, 1),
(-1, 0),
(2, -2),
(2, -1),
(2, 0),
(2, 1),
(2, 2),
(1, -2),
(1, -1),
(1, 1),
(1, 2),
(0, -2),
(0, 2),
(-1, -2),
(-1, -1),
(-1, 1),
(-1, 2),
(-2, -2),
(-2, -1),
(-2, 0),
(-2, 1),
(-2, 2),
]
H,... | false | 9.52381 | [
"-dst[sh][sw] = 0",
"-dq = deque([(sh, sw)])",
"+dq = deque([(sh, sw, 0)])",
"- h, w = dq.popleft()",
"+ h, w, d = dq.popleft()",
"- if dst[nh][nw] == -1 or dst[h][w] < dst[nh][nw]:",
"- dst[nh][nw] = dst[h][w]",
"- dq.appendleft((nh, nw))",
"+ if dst[nh][nw... | false | 0.043156 | 0.043268 | 0.997399 | [
"s858038198",
"s545532215"
] |
u912237403 | p02396 | python | s362609570 | s987543337 | 100 | 40 | 4,200 | 4,204 | Accepted | Accepted | 60 | c = 0
while True:
a = eval(input())
if a == 0: break
c += 1
print('Case %d: %d' %(c, a)) | c = 0
while True:
a = int(input())
if a == 0: break
c += 1
print('Case %d: %d' %(c, a)) | 6 | 6 | 102 | 111 | c = 0
while True:
a = eval(input())
if a == 0:
break
c += 1
print("Case %d: %d" % (c, a))
| c = 0
while True:
a = int(input())
if a == 0:
break
c += 1
print("Case %d: %d" % (c, a))
| false | 0 | [
"- a = eval(input())",
"+ a = int(input())"
] | false | 0.037213 | 0.036666 | 1.014921 | [
"s362609570",
"s987543337"
] |
u539517139 | p03380 | python | s772815837 | s665744594 | 118 | 80 | 14,428 | 14,052 | Accepted | Accepted | 32.2 | n=int(eval(input()))
a=sorted(list(map(int,input().split())))
m=a[n-1]
a=a[:n]
h=m/2
d=abs(a[0]-h)
x=0
for i in range(1,n-1):
if abs(a[i]-h)<d:
x=i
d=abs(a[i]-h)
print((m,a[x])) | n=int(eval(input()))
a=sorted(list(map(int,input().split())))
if len(a)==2:
print((*a[::-1]))
else:
m=a[n-1]
a=a[:n-1]
h=m/2
import bisect as bi
x=bi.bisect_left(a,h)
print((m,a[x-(a[x]-h>h-a[x-1])])) | 12 | 11 | 190 | 214 | n = int(eval(input()))
a = sorted(list(map(int, input().split())))
m = a[n - 1]
a = a[:n]
h = m / 2
d = abs(a[0] - h)
x = 0
for i in range(1, n - 1):
if abs(a[i] - h) < d:
x = i
d = abs(a[i] - h)
print((m, a[x]))
| n = int(eval(input()))
a = sorted(list(map(int, input().split())))
if len(a) == 2:
print((*a[::-1]))
else:
m = a[n - 1]
a = a[: n - 1]
h = m / 2
import bisect as bi
x = bi.bisect_left(a, h)
print((m, a[x - (a[x] - h > h - a[x - 1])]))
| false | 8.333333 | [
"-m = a[n - 1]",
"-a = a[:n]",
"-h = m / 2",
"-d = abs(a[0] - h)",
"-x = 0",
"-for i in range(1, n - 1):",
"- if abs(a[i] - h) < d:",
"- x = i",
"- d = abs(a[i] - h)",
"-print((m, a[x]))",
"+if len(a) == 2:",
"+ print((*a[::-1]))",
"+else:",
"+ m = a[n - 1]",
"+ ... | false | 0.087184 | 0.038744 | 2.25025 | [
"s772815837",
"s665744594"
] |
u968166680 | p02972 | python | s371932499 | s137324779 | 339 | 285 | 33,688 | 33,700 | Accepted | Accepted | 15.93 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp ... | 31 | 31 | 600 | 605 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp = 0
for j in... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
N, *A = list(map(int, read().split()))
B = [False] * (N + 1)
for i, a in reversed(list(enumerate(A, 1))):
tmp = 0
for j in... | false | 0 | [
"- tmp ^= B[j]",
"- B[i] = a ^ tmp",
"+ tmp += B[j]",
"+ B[i] = tmp % 2 != a"
] | false | 0.037595 | 0.092565 | 0.406142 | [
"s371932499",
"s137324779"
] |
u251828455 | p03390 | python | s453169666 | s100477158 | 1,082 | 265 | 2,760 | 2,696 | Accepted | Accepted | 75.51 | def getKth(x, a, k):
if(k < a):
return k
return k + 1
def getRKth(x, a, k):
if(x < a):
return x - k + 1
if(k < (x - a)):
return x - k + 1
return x - k
def NB(x, b):
if(x < b):
return x
return x + 1
def f(x, a, b):
mv = 25
half = (x + 1)... | def getKth(x, a, k):
if(k < a):
return k
return k + 1
def getRKth(x, a, k):
if(x < a):
return x - k + 1
if(k < (x - a)):
return x - k + 1
return x - k
def NB(x, b):
if(x < b):
return x
return x + 1
def f(x, a, b):
mv = 5
half = (x + 1) ... | 52 | 52 | 1,494 | 1,493 | def getKth(x, a, k):
if k < a:
return k
return k + 1
def getRKth(x, a, k):
if x < a:
return x - k + 1
if k < (x - a):
return x - k + 1
return x - k
def NB(x, b):
if x < b:
return x
return x + 1
def f(x, a, b):
mv = 25
half = (x + 1) / 2
rep =... | def getKth(x, a, k):
if k < a:
return k
return k + 1
def getRKth(x, a, k):
if x < a:
return x - k + 1
if k < (x - a):
return x - k + 1
return x - k
def NB(x, b):
if x < b:
return x
return x + 1
def f(x, a, b):
mv = 5
half = (x + 1) / 2
rep = ... | false | 0 | [
"- mv = 25",
"+ mv = 5"
] | false | 0.332013 | 0.094229 | 3.523485 | [
"s453169666",
"s100477158"
] |
u732061897 | p03547 | python | s244129240 | s138804955 | 27 | 23 | 9,084 | 9,000 | Accepted | Accepted | 14.81 | X, Y = input().split()
alphabet = ['A', 'B', 'C', 'D', 'E', 'F']
x_i = 0
y_i = 0
for i in range(6):
if alphabet[i] == X:
x_i = i
if alphabet[i] == Y:
y_i = i
if x_i < y_i:
print('<')
elif x_i > y_i:
print('>')
else:
print('=')
| X, Y = input().split()
x_i = ord(X)
y_i = ord(Y)
if x_i < y_i:
print('<')
elif x_i > y_i:
print('>')
else:
print('=')
| 15 | 9 | 277 | 138 | X, Y = input().split()
alphabet = ["A", "B", "C", "D", "E", "F"]
x_i = 0
y_i = 0
for i in range(6):
if alphabet[i] == X:
x_i = i
if alphabet[i] == Y:
y_i = i
if x_i < y_i:
print("<")
elif x_i > y_i:
print(">")
else:
print("=")
| X, Y = input().split()
x_i = ord(X)
y_i = ord(Y)
if x_i < y_i:
print("<")
elif x_i > y_i:
print(">")
else:
print("=")
| false | 40 | [
"-alphabet = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"]",
"-x_i = 0",
"-y_i = 0",
"-for i in range(6):",
"- if alphabet[i] == X:",
"- x_i = i",
"- if alphabet[i] == Y:",
"- y_i = i",
"+x_i = ord(X)",
"+y_i = ord(Y)"
] | false | 0.074681 | 0.096124 | 0.776931 | [
"s244129240",
"s138804955"
] |
u631277801 | p03672 | python | s937291682 | s103200407 | 25 | 18 | 3,064 | 3,064 | Accepted | Accepted | 28 | import sys
stdin = sys.stdin
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li(): return list(map(int, stdin.readline().split()))
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return list(map(float, stdin.readline().split()))
def ls(): return stdin.readline().split()
def ns(): return stdin.re... | 21 | 27 | 548 | 617 | import sys
stdin = sys.stdin
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
return stdin.readline().r... | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**5)
def li():
return list(map(int, stdin.readline().split()))
def li_():
return [int(x) - 1 for x in stdin.readline().split()]
def lf():
return list(map(float, stdin.readline().split()))
def ls():
return stdin.readline().split()
def ns():
... | false | 22.222222 | [
"+sys.setrecursionlimit(10**5)",
"+n = len(s)",
"-for n in range(len(s) // 2 - 1, -1, -1):",
"- if s[:n] == s[n : 2 * n]:",
"- ans = n",
"- break",
"-print((2 * ans))",
"+for i in range(1, n // 2):",
"+ first = s[:i]",
"+ second = s[i : 2 * i]",
"+ if first == second:",... | false | 0.081774 | 0.081825 | 0.999387 | [
"s937291682",
"s103200407"
] |
u716530146 | p02859 | python | s922861844 | s179507410 | 199 | 21 | 38,256 | 3,316 | Accepted | Accepted | 89.45 | #!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0
r=int(eval(input()))
print((r**2)) | r=int(eval(input()))
print((r**2)) | 9 | 2 | 204 | 27 | #!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
sys.setrecursionlimit(10**8)
inf = float("inf")
ans = count = 0
r = int(eval(input()))
print((r**2))
| r = int(eval(input()))
print((r**2))
| false | 77.777778 | [
"-#!/usr/bin/env python3",
"-import sys, math",
"-",
"-input = lambda: sys.stdin.buffer.readline().rstrip().decode(\"utf-8\")",
"-sys.setrecursionlimit(10**8)",
"-inf = float(\"inf\")",
"-ans = count = 0"
] | false | 0.128942 | 0.128265 | 1.005283 | [
"s922861844",
"s179507410"
] |
u623819879 | p03291 | python | s698262979 | s174938334 | 949 | 800 | 16,188 | 27,636 | Accepted | Accepted | 15.7 | import sys
sys.setrecursionlimit(1000000)
#def input():
# return sys.stdin.readline()[:-1]
'''
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), ... | import sys
sys.setrecursionlimit(1000000)
#def input():
# return sys.stdin.readline()[:-1]
'''
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), ... | 105 | 93 | 2,511 | 2,271 | import sys
sys.setrecursionlimit(1000000)
# def input():
# return sys.stdin.readline()[:-1]
"""
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), (1, "b", 3),... | import sys
sys.setrecursionlimit(1000000)
# def input():
# return sys.stdin.readline()[:-1]
"""
n=int(input())
for i in range(n):
a[i]=int(input())
a[i],b[i]=map(int,input().split())
a=[int(x) for x in input().split()]
n,m=map(int,input.split())
from operator import itemgetter
a = [(1, "c", 1), (1, "b", 3),... | false | 11.428571 | [
"-lc_a = [0] * n",
"-lc_c = [0] * n",
"-lc_w = [0] * n",
"-rc_a = [0] * n",
"-rc_c = [0] * n",
"-rc_w = [0] * n",
"-rc_a0 = s.count(\"A\")",
"-rc_c0 = s.count(\"C\")",
"-rc_w0 = s.count(\"?\")",
"-c_a = 0",
"-c_c = 0",
"-c_w = 0",
"-for i in range(n - 1):",
"- ch = s[i]",
"- if ch ... | false | 0.053387 | 0.055542 | 0.961201 | [
"s698262979",
"s174938334"
] |
u557792847 | p03633 | python | s589218701 | s553309327 | 148 | 36 | 12,408 | 5,048 | Accepted | Accepted | 75.68 | import sys
import numpy as np
# N 時計の数
n = int(eval(input()))
# Ti 各時計が1周する秒数
t = []
for i in range(n):
t.append(int(eval(input())))
# 最大公約数を求める
def gcb(a, b):
if b == 0:
return a
return int(gcb(b, a % b))
def lcm(a, b):
g = gcb(a, b)
return a * b // g
if (n == ... | import sys
import fractions
from functools import reduce
# N 時計の数
n = int(eval(input()))
# Ti 各時計が1周する秒数
t = [int(eval(input())) for i in range(n)]
# 最小公倍数を求める
def lcm_base(a, b):
return (a * b) // fractions.gcd(a, b)
def lcm(*num_list):
return reduce(lcm_base, num_list, 1)
print((lcm(*t))... | 28 | 18 | 418 | 307 | import sys
import numpy as np
# N 時計の数
n = int(eval(input()))
# Ti 各時計が1周する秒数
t = []
for i in range(n):
t.append(int(eval(input())))
# 最大公約数を求める
def gcb(a, b):
if b == 0:
return a
return int(gcb(b, a % b))
def lcm(a, b):
g = gcb(a, b)
return a * b // g
if n == 1:
print((t[0]))
else:... | import sys
import fractions
from functools import reduce
# N 時計の数
n = int(eval(input()))
# Ti 各時計が1周する秒数
t = [int(eval(input())) for i in range(n)]
# 最小公倍数を求める
def lcm_base(a, b):
return (a * b) // fractions.gcd(a, b)
def lcm(*num_list):
return reduce(lcm_base, num_list, 1)
print((lcm(*t)))
| false | 35.714286 | [
"-import numpy as np",
"+import fractions",
"+from functools import reduce",
"-t = []",
"-for i in range(n):",
"- t.append(int(eval(input())))",
"-# 最大公約数を求める",
"-def gcb(a, b):",
"- if b == 0:",
"- return a",
"- return int(gcb(b, a % b))",
"+t = [int(eval(input())) for i in ra... | false | 0.056319 | 0.044782 | 1.257614 | [
"s589218701",
"s553309327"
] |
u375695365 | p02995 | python | s875269265 | s426286234 | 35 | 26 | 5,048 | 9,144 | Accepted | Accepted | 25.71 | #二回目
import fractions
a,b,c,d=list(map(int,input().split()))
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
ans1=b
a-=1
ans2=0
ans1-=b//c
ans1-=b//d
ans1+=b//(lcm(c,d))
#print(ans1)
ans2+=a//c
ans2+=a//d
ans2-=a//(lcm(c,d))
print((ans1-(a-ans2))) | import math
a,b,c,d = list(map(int,input().split()))
def lcm(x, y):
return (x * y) // math.gcd(x, y)
a-=1
e=lcm(c,d)
ansb=0
ansb += b//c
ansb += b//d
ansb -= b//e
ansa=0
ansa += a//c
ansa += a//d
ansa -= a//e
print(((b-a)-(ansb-ansa))) | 20 | 20 | 271 | 256 | # 二回目
import fractions
a, b, c, d = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
ans1 = b
a -= 1
ans2 = 0
ans1 -= b // c
ans1 -= b // d
ans1 += b // (lcm(c, d))
# print(ans1)
ans2 += a // c
ans2 += a // d
ans2 -= a // (lcm(c, d))
print((ans1 - (a - ans2)))
| import math
a, b, c, d = list(map(int, input().split()))
def lcm(x, y):
return (x * y) // math.gcd(x, y)
a -= 1
e = lcm(c, d)
ansb = 0
ansb += b // c
ansb += b // d
ansb -= b // e
ansa = 0
ansa += a // c
ansa += a // d
ansa -= a // e
print(((b - a) - (ansb - ansa)))
| false | 0 | [
"-# 二回目",
"-import fractions",
"+import math",
"- return (x * y) // fractions.gcd(x, y)",
"+ return (x * y) // math.gcd(x, y)",
"-ans1 = b",
"-ans2 = 0",
"-ans1 -= b // c",
"-ans1 -= b // d",
"-ans1 += b // (lcm(c, d))",
"-# print(ans1)",
"-ans2 += a // c",
"-ans2 += a // d",
"-ans2 ... | false | 0.13297 | 0.038823 | 3.425051 | [
"s875269265",
"s426286234"
] |
u047393579 | p03682 | python | s755069790 | s541159180 | 1,563 | 1,300 | 63,892 | 75,648 | Accepted | Accepted | 16.83 | import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict
import collections
import itertools
import operator
class UnionFind:
def __init__(self, elems=None):
class KeyDict(dict):
def __missing__(self, key):
self[key] = key
retur... | import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict
def init(n):
return list(range(n+1))
def find(lis, x):
if lis[x] == x:
return x
else:
lis[x] = find(lis, lis[x])
return lis[x]
def sameset(lis, x, y):
return find(lis, x) == find(lis, y)... | 108 | 59 | 2,610 | 1,349 | import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict
import collections
import itertools
import operator
class UnionFind:
def __init__(self, elems=None):
class KeyDict(dict):
def __missing__(self, key):
self[key] = key
return key
... | import sys
sys.setrecursionlimit(10**7)
from collections import defaultdict
def init(n):
return list(range(n + 1))
def find(lis, x):
if lis[x] == x:
return x
else:
lis[x] = find(lis, lis[x])
return lis[x]
def sameset(lis, x, y):
return find(lis, x) == find(lis, y)
def un... | false | 45.37037 | [
"-import collections",
"-import itertools",
"-import operator",
"-class UnionFind:",
"- def __init__(self, elems=None):",
"- class KeyDict(dict):",
"- def __missing__(self, key):",
"- self[key] = key",
"- return key",
"-",
"- self.parent ... | false | 0.044175 | 0.038194 | 1.156605 | [
"s755069790",
"s541159180"
] |
u554781254 | p02711 | python | s853661679 | s145131170 | 76 | 23 | 66,788 | 9,568 | Accepted | Accepted | 69.74 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
def number2digits(number):
return list(map(int, str(number)))
def main():
N = int(eval(input... | import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float('inf')
NIL = - 1
N = input()... | 27 | 16 | 471 | 409 | import sys
input = sys.stdin.readline
from itertools import *
from functools import *
from collections import *
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
def number2digits(number):
return list(map(int, str(number)))
def main():
N = int(eval(input()))
num_ls ... | import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
from itertools import permutations, combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop
INF = float("inf")
NIL = -1
N = input().rstrip()
n_digit... | false | 40.740741 | [
"+sys.setrecursionlimit(10**9)",
"-from itertools import *",
"+from itertools import permutations, combinations, accumulate",
"-from collections import *",
"+from collections import deque, defaultdict, Counter",
"-",
"-",
"-def number2digits(number):",
"- return list(map(int, str(number)))",
"-... | false | 0.086998 | 0.046405 | 1.874761 | [
"s853661679",
"s145131170"
] |
u979552932 | p02972 | python | s148046263 | s166906216 | 566 | 151 | 96,036 | 12,344 | Accepted | Accepted | 73.32 | from sys import stdin
def main():
input = stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
p = []
for i in reversed(list(range(n))):
if a[i]:
p.append(i + 1)
u = 1
v = i + 1
while u * u <= v:
... | from sys import stdin
def main():
input = stdin.readline
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
for i in range(n, 0, -1):
a[i] = sum(a[i::i]) % 2
print((sum(a)))
for i in range(1, n + 1):
if a[i] == 1:
print(i)
main() | 24 | 13 | 564 | 300 | from sys import stdin
def main():
input = stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
p = []
for i in reversed(list(range(n))):
if a[i]:
p.append(i + 1)
u = 1
v = i + 1
while u * u <= v:
if v % u ... | from sys import stdin
def main():
input = stdin.readline
n = int(eval(input()))
a = [0] + list(map(int, input().split()))
for i in range(n, 0, -1):
a[i] = sum(a[i::i]) % 2
print((sum(a)))
for i in range(1, n + 1):
if a[i] == 1:
print(i)
main()
| false | 45.833333 | [
"- a = list(map(int, input().split()))",
"- p = []",
"- for i in reversed(list(range(n))):",
"- if a[i]:",
"- p.append(i + 1)",
"- u = 1",
"- v = i + 1",
"- while u * u <= v:",
"- if v % u == 0:",
"- a[u ... | false | 0.007666 | 0.041872 | 0.183094 | [
"s148046263",
"s166906216"
] |
u368882459 | p03835 | python | s360248784 | s123159425 | 1,249 | 18 | 2,940 | 3,060 | Accepted | Accepted | 98.56 | 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 <= K:
count += 1
print(count) | K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
if 0 <= S - i < K:
count += S - i + 1
elif K <= S - i <= 2 * K:
count += 2 * K - S + i + 1
else:
continue
print(count) | 7 | 10 | 166 | 229 | 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 <= K:
count += 1
print(count)
| K, S = list(map(int, input().split()))
count = 0
for i in range(K + 1):
if 0 <= S - i < K:
count += S - i + 1
elif K <= S - i <= 2 * K:
count += 2 * K - S + i + 1
else:
continue
print(count)
| false | 30 | [
"- for j in range(K + 1):",
"- if 0 <= S - i - j <= K:",
"- count += 1",
"+ if 0 <= S - i < K:",
"+ count += S - i + 1",
"+ elif K <= S - i <= 2 * K:",
"+ count += 2 * K - S + i + 1",
"+ else:",
"+ continue"
] | false | 0.046632 | 0.047031 | 0.991513 | [
"s360248784",
"s123159425"
] |
u191874006 | p02838 | python | s365450585 | s984190096 | 723 | 300 | 123,084 | 120,928 | Accepted | Accepted | 58.51 | #!/usr/bin/env python3
#ABC147 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Count... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 36 | 32 | 836 | 793 | #!/usr/bin/env python3
# ABC147 D
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from c... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 11.111111 | [
"-# ABC147 D",
"-sys.setrecursionlimit(1000000)",
"+sys.setrecursionlimit(2147483647)",
"-b = [0] * 60",
"-for i in range(n):",
"- for j in range(a[i].bit_length()):",
"- if (a[i] >> j) & 1:",
"- b[j] += 1",
"+cnt = [0] * 61",
"+for i in a:",
"+ for j in range(61):",
"+... | false | 0.037405 | 0.044241 | 0.845484 | [
"s365450585",
"s984190096"
] |
u645250356 | p02983 | python | s118975735 | s841959109 | 1,745 | 133 | 5,240 | 77,084 | Accepted | Accepted | 92.38 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 17 | 19 | 504 | 534 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 10.526316 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush",
"-r = min(r, l + 3000)",
"-res = INF",
"-for i in range(l, r):",
"- for j in range(i + 1, r + 1):",
"- res = min(res, (i * j) % 2019)",
"-print(res)",
"+if r - l > 2019:",
"+ print((0))",
"+else... | false | 0.039775 | 0.057103 | 0.696549 | [
"s118975735",
"s841959109"
] |
u075012704 | p03534 | python | s101954548 | s400352894 | 31 | 19 | 3,188 | 3,188 | Accepted | Accepted | 38.71 | S = eval(input())
C = {'a': 0, 'b': 0, 'c': 0}
for s in S:
C[s] += 1
if max(C.values()) - min(C.values()) <= 1:
print('YES')
else:
print('NO')
| S = eval(input())
A, B, C = S.count('a'), S.count('b'), S.count('c')
if max(A, B, C) - min(A, B, C) <= 1:
print('YES')
else:
print('NO')
| 12 | 7 | 164 | 146 | S = eval(input())
C = {"a": 0, "b": 0, "c": 0}
for s in S:
C[s] += 1
if max(C.values()) - min(C.values()) <= 1:
print("YES")
else:
print("NO")
| S = eval(input())
A, B, C = S.count("a"), S.count("b"), S.count("c")
if max(A, B, C) - min(A, B, C) <= 1:
print("YES")
else:
print("NO")
| false | 41.666667 | [
"-C = {\"a\": 0, \"b\": 0, \"c\": 0}",
"-for s in S:",
"- C[s] += 1",
"-if max(C.values()) - min(C.values()) <= 1:",
"+A, B, C = S.count(\"a\"), S.count(\"b\"), S.count(\"c\")",
"+if max(A, B, C) - min(A, B, C) <= 1:"
] | false | 0.034399 | 0.038113 | 0.902557 | [
"s101954548",
"s400352894"
] |
u260980560 | p02317 | python | s588927982 | s579349894 | 800 | 120 | 9,448 | 16,636 | Accepted | Accepted | 85 | from bisect import *
n = eval(input())
dp = [10**10]*(n+1)
dp[0] = -1
for i in range(n):
a = eval(input())
idx = bisect(dp, a-1)
dp[idx] = min(a, dp[idx])
print(bisect(dp, 10**10-1)-1) | from bisect import *
import sys
def solve(N, A):
INF = 10**10
dp = [INF]*(N+1)
dp[0] = -1
for a in A:
idx = bisect(dp, a-1)
dp[idx] = min(a, dp[idx])
return max(i for i in range(N+1) if dp[i] < INF)
N, *A = list(map(int, sys.stdin.read().split()))
sys.stdout.write("%... | 9 | 15 | 192 | 334 | from bisect import *
n = eval(input())
dp = [10**10] * (n + 1)
dp[0] = -1
for i in range(n):
a = eval(input())
idx = bisect(dp, a - 1)
dp[idx] = min(a, dp[idx])
print(bisect(dp, 10**10 - 1) - 1)
| from bisect import *
import sys
def solve(N, A):
INF = 10**10
dp = [INF] * (N + 1)
dp[0] = -1
for a in A:
idx = bisect(dp, a - 1)
dp[idx] = min(a, dp[idx])
return max(i for i in range(N + 1) if dp[i] < INF)
N, *A = list(map(int, sys.stdin.read().split()))
sys.stdout.write("%d\n" ... | false | 40 | [
"+import sys",
"-n = eval(input())",
"-dp = [10**10] * (n + 1)",
"-dp[0] = -1",
"-for i in range(n):",
"- a = eval(input())",
"- idx = bisect(dp, a - 1)",
"- dp[idx] = min(a, dp[idx])",
"-print(bisect(dp, 10**10 - 1) - 1)",
"+",
"+def solve(N, A):",
"+ INF = 10**10",
"+ dp = [... | false | 0.05573 | 0.056211 | 0.991447 | [
"s588927982",
"s579349894"
] |
u811733736 | p02346 | python | s513746888 | s085529474 | 2,210 | 760 | 13,916 | 10,136 | Accepted | Accepted | 65.61 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class RSQ(object):
INT_MAX = 2**31 - 1
def __init__(self, nn, init_val=0):
self.val = [init_val] * (nn+1)
self.n = 1... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
... | 72 | 51 | 2,241 | 1,086 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class RSQ(object):
INT_MAX = 2**31 - 1
def __init__(self, nn, init_val=0):
self.val = [init_val] * (nn + 1)
self.n = 1
whil... | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
"""
import sys
from sys import stdin
input = stdin.readline
class BIT(object):
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
# ??????????... | false | 29.166667 | [
"-class RSQ(object):",
"- INT_MAX = 2**31 - 1",
"+class BIT(object):",
"+ def __init__(self, n):",
"+ self.n = n",
"+ self.bit = [0] * (n + 1)",
"- def __init__(self, nn, init_val=0):",
"- self.val = [init_val] * (nn + 1)",
"- self.n = 1",
"- while self.... | false | 0.034576 | 0.036461 | 0.948298 | [
"s513746888",
"s085529474"
] |
u652656291 | p03805 | python | s917484606 | s647730783 | 66 | 33 | 8,052 | 3,064 | Accepted | Accepted | 50 | import itertools
N,M=list(map(int,input().split()))
ab=list(list(map(int,input().split())) for _ in range(M))
l=list(l for l in range(1,N+1))
numlist=list(itertools.permutations(l))
ans=0
for I in numlist:
if I[0]==1 and all(sorted([I[j],I[j+1]]) in ab for j in range(N-1)):
ans+=1
print(ans)
| import itertools
n, m = list(map(int, input().split()))
path = [[False] * n for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
path[a][b] = True
path[b][a] = True
ans = 0
for i in itertools.permutations(list(range(n)), n):
if i[0] == 0:
... | 10 | 21 | 308 | 479 | import itertools
N, M = list(map(int, input().split()))
ab = list(list(map(int, input().split())) for _ in range(M))
l = list(l for l in range(1, N + 1))
numlist = list(itertools.permutations(l))
ans = 0
for I in numlist:
if I[0] == 1 and all(sorted([I[j], I[j + 1]]) in ab for j in range(N - 1)):
ans += 1
... | import itertools
n, m = list(map(int, input().split()))
path = [[False] * n for i in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
path[a][b] = True
path[b][a] = True
ans = 0
for i in itertools.permutations(list(range(n)), n):
if i[0] == 0:
for j in r... | false | 52.380952 | [
"-N, M = list(map(int, input().split()))",
"-ab = list(list(map(int, input().split())) for _ in range(M))",
"-l = list(l for l in range(1, N + 1))",
"-numlist = list(itertools.permutations(l))",
"+n, m = list(map(int, input().split()))",
"+path = [[False] * n for i in range(n)]",
"+for i in range(m):",
... | false | 0.108374 | 0.085077 | 1.273837 | [
"s917484606",
"s647730783"
] |
u038021590 | p04020 | python | s846636059 | s303856941 | 562 | 316 | 47,960 | 70,380 | Accepted | Accepted | 43.77 | N = int(eval(input()))
ans = 0
tmp = 0
for _ in range(N):
a = int(eval(input()))
if a != 0:
tmp += a
else:
ans += tmp // 2
tmp = 0
ans += tmp//2
print(ans) | N = int(eval(input()))
tmp = 0
ans = 0
for _ in range(N):
a = int(eval(input()))
if a != 0:
tmp += a
else:
ans += tmp // 2
tmp = 0
ans += tmp // 2
print(ans)
| 13 | 12 | 192 | 193 | N = int(eval(input()))
ans = 0
tmp = 0
for _ in range(N):
a = int(eval(input()))
if a != 0:
tmp += a
else:
ans += tmp // 2
tmp = 0
ans += tmp // 2
print(ans)
| N = int(eval(input()))
tmp = 0
ans = 0
for _ in range(N):
a = int(eval(input()))
if a != 0:
tmp += a
else:
ans += tmp // 2
tmp = 0
ans += tmp // 2
print(ans)
| false | 7.692308 | [
"+tmp = 0",
"-tmp = 0"
] | false | 0.072725 | 0.037789 | 1.924505 | [
"s846636059",
"s303856941"
] |
u328099989 | p03163 | python | s890725268 | s298570469 | 1,277 | 429 | 130,524 | 118,768 | Accepted | Accepted | 66.41 | #!/usr/bin/env python3
import sys
def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
dp = [[0] * (N + 1) for _ in range(W+1)]
for i in range(1, W+1):
for j in range(N):
if i - w[j] >= 0:
dp[i][j+1] = max(dp[i][j], dp[i-1][j], dp[i-w[j]][j] + v[j])
... | #!/usr/bin/env python3
import sys
def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
for j in range(1, W+1):
if j - w[i] >= 0:
dp[i+1][j] = max(
dp[i][j],
dp... | 35 | 38 | 914 | 996 | #!/usr/bin/env python3
import sys
def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
dp = [[0] * (N + 1) for _ in range(W + 1)]
for i in range(1, W + 1):
for j in range(N):
if i - w[j] >= 0:
dp[i][j + 1] = max(dp[i][j], dp[i - 1][j], dp[i - w[j]][j] + v[j])
... | #!/usr/bin/env python3
import sys
def solve(N: int, W: int, w: "List[int]", v: "List[int]"):
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(1, W + 1):
if j - w[i] >= 0:
dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - 1], dp[i][j - w[i]] + v[i])
... | false | 7.894737 | [
"- dp = [[0] * (N + 1) for _ in range(W + 1)]",
"- for i in range(1, W + 1):",
"- for j in range(N):",
"- if i - w[j] >= 0:",
"- dp[i][j + 1] = max(dp[i][j], dp[i - 1][j], dp[i - w[j]][j] + v[j])",
"+ dp = [[0] * (W + 1) for _ in range(N + 1)]",
"+ for i in r... | false | 0.038277 | 0.109899 | 0.348294 | [
"s890725268",
"s298570469"
] |
u612721349 | p03361 | python | s491437153 | s912617813 | 25 | 20 | 3,064 | 3,064 | Accepted | Accepted | 20 | h, w = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
visited = [["." for _ in range(w)] for _ in range(h)]
mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
for j in range(w):
if table[i][j] == "#":
for k in range(4):
tx, ty = j + mx[k], i + my[k]... | h, w = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
for j in range(w):
if table[i][j] == "#":
for k in range(4):
tx, ty = j + mx[k], i + my[k]
if 0 <= tx < w and 0 <= ty < h and table[ty][... | 20 | 16 | 554 | 402 | h, w = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
visited = [["." for _ in range(w)] for _ in range(h)]
mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
for j in range(w):
if table[i][j] == "#":
for k in range(4):
tx, ty = j + mx[k], i... | h, w = list(map(int, input().split()))
table = [list(eval(input())) for _ in range(h)]
mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
for j in range(w):
if table[i][j] == "#":
for k in range(4):
tx, ty = j + mx[k], i + my[k]
if 0 <= tx < w and 0 <= ty < ... | false | 20 | [
"-visited = [[\".\" for _ in range(w)] for _ in range(h)]",
"- visited[i][j] = visited[ty][tx] = \"#\"",
"-for i in range(h):",
"- for j in range(w):",
"- if table[i][j] != visited[i][j]:",
"- print(\"No\")",
"- exit(0)",
"+ break",... | false | 0.093332 | 0.038015 | 2.455156 | [
"s491437153",
"s912617813"
] |
u867848444 | p02936 | python | s325100443 | s537945712 | 1,961 | 762 | 105,236 | 93,716 | Accepted | Accepted | 61.14 | def Graph():
G=[[] for i in range(n)]
#up_G=[0]*n#up_G[i]=頂点iの親
for _ in range(n-1):
a,b=list(map(int,input().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
return G
from collections import deque
def bfs(G,v,p):
#(G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)
#vの子の頂点を決めて、vを... | from collections import deque
import sys
def solve():
input=sys.stdin.readline
n,q=list(map(int, input().split()))
G=[[] for i in range(n)]
#up_G=[0]*n#up_G[i]=頂点iの親
for _ in range(n-1):
a,b=list(map(int,input().split()))
G[a-1].append(b-1)
G[b-1].append(a-1)
... | 30 | 30 | 699 | 722 | def Graph():
G = [[] for i in range(n)]
# up_G=[0]*n#up_G[i]=頂点iの親
for _ in range(n - 1):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append(a - 1)
return G
from collections import deque
def bfs(G, v, p):
# (G,v,p)=(グラフ(木の情報),探索中の頂点,vの親)
# v... | from collections import deque
import sys
def solve():
input = sys.stdin.readline
n, q = list(map(int, input().split()))
G = [[] for i in range(n)]
# up_G=[0]*n#up_G[i]=頂点iの親
for _ in range(n - 1):
a, b = list(map(int, input().split()))
G[a - 1].append(b - 1)
G[b - 1].append... | false | 0 | [
"-def Graph():",
"+from collections import deque",
"+import sys",
"+",
"+",
"+def solve():",
"+ input = sys.stdin.readline",
"+ n, q = list(map(int, input().split()))",
"- return G",
"-",
"-",
"-from collections import deque",
"-",
"-",
"-def bfs(G, v, p):",
"+ ans = [0] * ... | false | 0.047024 | 0.043257 | 1.087093 | [
"s325100443",
"s537945712"
] |
u102461423 | p03809 | python | s284798018 | s045400365 | 569 | 365 | 125,216 | 41,376 | Accepted | Accepted | 35.85 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x)-1 for x in row.split()] for row in sys.stdin.readlines()]
if N == 2:
x,y = A
answer = 'YES' if x == y else 'NO'
print(answer)
exit()
graph = [[] ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = (0, ) + tuple(map(int, readline().split()))
m = list(map(int, read().split()))
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
G[a].append(b)
G[b].appen... | 48 | 51 | 927 | 1,289 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(eval(input()))
A = [int(x) for x in input().split()]
UV = [[int(x) - 1 for x in row.split()] for row in sys.stdin.readlines()]
if N == 2:
x, y = A
answer = "YES" if x == y else "NO"
print(answer)
exit()
graph = [[] for _ in rang... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = (0,) + tuple(map(int, readline().split()))
m = list(map(int, read().split()))
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
G[a].append(b)
G[b].append(a)
def dfs... | false | 5.882353 | [
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**7)",
"-N = int(eval(input()))",
"-A = [int(x) for x in input().split()]",
"-UV = [[int(x) - 1 for x in row.split()] for row in sys.stdin.readlines()]",
"-if N == 2:",
"- x, y = A",
"- answer = \"YES\" if x == y else \"NO\"",
"- prin... | false | 0.135403 | 0.047381 | 2.857772 | [
"s284798018",
"s045400365"
] |
u732061897 | p02683 | python | s551854260 | s657681621 | 89 | 75 | 9,628 | 9,164 | Accepted | Accepted | 15.73 | N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools
targets = list(itertools.product([0, 1], repeat=N))
#print(targets)
answer = 10 ** 9
for target in targets:
result = [0] * (M + 1)
for i, t in enumerate(target):
if t == 1... | '''
productでrepeatすればいいよ、
0,1リスト生成
minでとれたね
enumerateは手前がindex,valueの順
'''
N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools
#print(targets)
answer = 10 ** 9
for i in range(0,1 << N):
result = [0] * (M + 1)
for j in range(N... | 22 | 28 | 576 | 609 | N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools
targets = list(itertools.product([0, 1], repeat=N))
# print(targets)
answer = 10**9
for target in targets:
result = [0] * (M + 1)
for i, t in enumerate(target):
if t == 1:
... | """
productでrepeatすればいいよ、
0,1リスト生成
minでとれたね
enumerateは手前がindex,valueの順
"""
N, M, X = list(map(int, input().split()))
C_list = [list(map(int, input().split())) for i in range(N)]
import itertools
# print(targets)
answer = 10**9
for i in range(0, 1 << N):
result = [0] * (M + 1)
for j in range(N):
if (i >... | false | 21.428571 | [
"+\"\"\"",
"+productでrepeatすればいいよ、",
"+0,1リスト生成",
"+minでとれたね",
"+enumerateは手前がindex,valueの順",
"+\"\"\"",
"-targets = list(itertools.product([0, 1], repeat=N))",
"-for target in targets:",
"+for i in range(0, 1 << N):",
"- for i, t in enumerate(target):",
"- if t == 1:",
"- ... | false | 0.036974 | 0.042924 | 0.861361 | [
"s551854260",
"s657681621"
] |
u223646582 | p03290 | python | s343750459 | s358203678 | 47 | 25 | 3,064 | 3,064 | Accepted | Accepted | 46.81 | D,G=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(D)]
ans=1000
for i in range(1<<D):
# print(bin(i))
score=0
problem=0
highest=0
for j in range(D):
if ((i>>j)&1)==1:
score+=l[j][1]+(j+1)*l[j][0]*100 # 素点
# print('compl... | import math
D, G = list(map(int, input().split()))
P = []
for _ in range(D):
p, c = list(map(int, input().split()))
P.append((p, c))
ans = 10000
for i in range(2 ** D):
score = 0
solve = 0
maxj = -1
for j in range(D): # このループが一番のポイント
if ((i >> j) & 1): # 順に右にシフトさせ最下位bit... | 33 | 29 | 957 | 756 | D, G = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(D)]
ans = 1000
for i in range(1 << D):
# print(bin(i))
score = 0
problem = 0
highest = 0
for j in range(D):
if ((i >> j) & 1) == 1:
score += l[j][1] + (j + 1) * l[j][0] * 100 # 素点
... | import math
D, G = list(map(int, input().split()))
P = []
for _ in range(D):
p, c = list(map(int, input().split()))
P.append((p, c))
ans = 10000
for i in range(2**D):
score = 0
solve = 0
maxj = -1
for j in range(D): # このループが一番のポイント
if (i >> j) & 1: # 順に右にシフトさせ最下位bitのチェックを行う
... | false | 12.121212 | [
"+import math",
"+",
"-l = [list(map(int, input().split())) for i in range(D)]",
"-ans = 1000",
"-for i in range(1 << D):",
"- # print(bin(i))",
"+P = []",
"+for _ in range(D):",
"+ p, c = list(map(int, input().split()))",
"+ P.append((p, c))",
"+ans = 10000",
"+for i in range(2**D):"... | false | 0.165844 | 0.039412 | 4.207942 | [
"s343750459",
"s358203678"
] |
u498620941 | p02983 | python | s505722874 | s667618806 | 661 | 578 | 75,428 | 3,064 | Accepted | Accepted | 12.56 | L,R = list(map(int,input().split()))
mod = 2019
d = R - L + 1
c = d // mod
a = L % mod
b = R % mod
if c >= 2 :
print((0))
else :
if a > b :
print((0))
else :
amari = []
for i in range(L,R+1):
for j in range(i+1,R+1):
amari.append(i*j%mod)
... | L,R = list(map(int,input().split()))
if R - L >= 2019 :
print((0))
else:
K = []
for i in range(L,R+1,1):
a = i % 2019
K.append(a)
ans = 10**9+7
size = len(K)
for x in range(size):
for y in range(x+1,size):
o = K[x] * K[y] % 2019
if o <... | 18 | 16 | 338 | 359 | L, R = list(map(int, input().split()))
mod = 2019
d = R - L + 1
c = d // mod
a = L % mod
b = R % mod
if c >= 2:
print((0))
else:
if a > b:
print((0))
else:
amari = []
for i in range(L, R + 1):
for j in range(i + 1, R + 1):
amari.append(i * j % mod)
... | L, R = list(map(int, input().split()))
if R - L >= 2019:
print((0))
else:
K = []
for i in range(L, R + 1, 1):
a = i % 2019
K.append(a)
ans = 10**9 + 7
size = len(K)
for x in range(size):
for y in range(x + 1, size):
o = K[x] * K[y] % 2019
if o < an... | false | 11.111111 | [
"-mod = 2019",
"-d = R - L + 1",
"-c = d // mod",
"-a = L % mod",
"-b = R % mod",
"-if c >= 2:",
"+if R - L >= 2019:",
"- if a > b:",
"- print((0))",
"- else:",
"- amari = []",
"- for i in range(L, R + 1):",
"- for j in range(i + 1, R + 1):",
"- ... | false | 0.160334 | 0.102633 | 1.562208 | [
"s505722874",
"s667618806"
] |
u778814286 | p03160 | python | s352654226 | s142063173 | 213 | 163 | 51,328 | 51,324 | Accepted | Accepted | 23.47 | n = int(eval(input()))
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス
#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
import sys
sys.setrecursionlimit(10000000)
#足場x(0~n-1)にたどり着くまでの最小コストを返す関数。
def getdp(x):
global dp #これでいいのか?
if dp[x] != float("... | n = int(eval(input()))
h = list(map(int, input().split()))
#高さ。0~n-1でアクセス
#足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [-1] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
import sys
sys.setrecursionlimit(10000000)
#足場x(0~n-1)にたどり着くまでの最小コストを返す関数。
def getdp(x):
global dp #これでいいのか?
if dp[x] != -1: return dp[x] ... | 21 | 21 | 508 | 488 | n = int(eval(input()))
h = list(map(int, input().split()))
# 高さ。0~n-1でアクセス
# 足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
import sys
sys.setrecursionlimit(10000000)
# 足場x(0~n-1)にたどり着くまでの最小コストを返す関数。
def getdp(x):
global dp # これでいいのか?
if dp[x] != float("inf"):
... | n = int(eval(input()))
h = list(map(int, input().split()))
# 高さ。0~n-1でアクセス
# 足場Nにたどり着くまでの最小コストを格納。アクセスは[N-1]
dp = [-1] * n
dp[0] = 0
dp[1] = abs(h[0] - h[1])
import sys
sys.setrecursionlimit(10000000)
# 足場x(0~n-1)にたどり着くまでの最小コストを返す関数。
def getdp(x):
global dp # これでいいのか?
if dp[x] != -1:
return dp[x] # 0... | false | 0 | [
"-dp = [float(\"inf\")] * n",
"+dp = [-1] * n",
"- if dp[x] != float(\"inf\"):",
"+ if dp[x] != -1:"
] | false | 0.044159 | 0.04378 | 1.008669 | [
"s352654226",
"s142063173"
] |
u978313283 | p03162 | python | s859846161 | s507445586 | 1,030 | 806 | 44,108 | 56,468 | Accepted | Accepted | 21.75 | N=int(eval(input()))
abc=[[0 for i in range(3)] for j in range(N)]
for i in range(N):
A=list(map(int,input().split()))
for j in range(3):
abc[i][j]=A[j]
dp=[[0,0,0] for i in range(N+1)]
for i in range(N):
for j in range(3):
buf=[]
for h in range(3):
if h!=j:
... | import numpy as np
N=int(eval(input()))
ABC=[]
for i in range(N):
ABC.append(list(map(int,input().split())))
dp=[[0,0,0] for i in range(N)]
dp[0]=ABC[0]
for i in range(1,N):
for j in range(3):
dp[i][j]=max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+ABC[i][j]
print((max(dp[N-1]))) | 15 | 11 | 408 | 290 | N = int(eval(input()))
abc = [[0 for i in range(3)] for j in range(N)]
for i in range(N):
A = list(map(int, input().split()))
for j in range(3):
abc[i][j] = A[j]
dp = [[0, 0, 0] for i in range(N + 1)]
for i in range(N):
for j in range(3):
buf = []
for h in range(3):
if h ... | import numpy as np
N = int(eval(input()))
ABC = []
for i in range(N):
ABC.append(list(map(int, input().split())))
dp = [[0, 0, 0] for i in range(N)]
dp[0] = ABC[0]
for i in range(1, N):
for j in range(3):
dp[i][j] = max(dp[i - 1][(j + 1) % 3], dp[i - 1][(j + 2) % 3]) + ABC[i][j]
print((max(dp[N - 1])))... | false | 26.666667 | [
"+import numpy as np",
"+",
"-abc = [[0 for i in range(3)] for j in range(N)]",
"+ABC = []",
"- A = list(map(int, input().split()))",
"+ ABC.append(list(map(int, input().split())))",
"+dp = [[0, 0, 0] for i in range(N)]",
"+dp[0] = ABC[0]",
"+for i in range(1, N):",
"- abc[i][j] = A[j... | false | 0.113515 | 0.048213 | 2.354477 | [
"s859846161",
"s507445586"
] |
u853185302 | p02898 | python | s898629515 | s115572387 | 48 | 44 | 11,908 | 11,916 | Accepted | Accepted | 8.33 | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
count = 0
for i in h:
if i >= k:
count += 1
print(count) | n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
print((len([i for i in h if i >= k]))) | 8 | 3 | 140 | 104 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
count = 0
for i in h:
if i >= k:
count += 1
print(count)
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
print((len([i for i in h if i >= k])))
| false | 62.5 | [
"-count = 0",
"-for i in h:",
"- if i >= k:",
"- count += 1",
"-print(count)",
"+print((len([i for i in h if i >= k])))"
] | false | 0.043871 | 0.092197 | 0.475838 | [
"s898629515",
"s115572387"
] |
u747602774 | p02899 | python | s601238529 | s396367835 | 367 | 154 | 62,764 | 13,880 | Accepted | Accepted | 58.04 | N=int(eval(input()))
li=list(map(int,input().split()))
ans=sorted(list(range(N)), key=lambda k: li[k])
for n in range(N):
ans[n]+=1
print((*ans)) | N=int(eval(input()))
li=list(map(int,input().split()))
ans=sorted(list(range(N)), key=lambda a: li[a])
for n in range(N):
ans[n]+=1
print((*ans)) | 10 | 10 | 155 | 155 | N = int(eval(input()))
li = list(map(int, input().split()))
ans = sorted(list(range(N)), key=lambda k: li[k])
for n in range(N):
ans[n] += 1
print((*ans))
| N = int(eval(input()))
li = list(map(int, input().split()))
ans = sorted(list(range(N)), key=lambda a: li[a])
for n in range(N):
ans[n] += 1
print((*ans))
| false | 0 | [
"-ans = sorted(list(range(N)), key=lambda k: li[k])",
"+ans = sorted(list(range(N)), key=lambda a: li[a])"
] | false | 0.038643 | 0.119185 | 0.32423 | [
"s601238529",
"s396367835"
] |
u263830634 | p03472 | python | s040024448 | s922954372 | 251 | 220 | 11,360 | 11,296 | Accepted | Accepted | 12.35 | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
A = []
A_append = A.append
B = []
B_append = B.append
for i in range(N):
a, b = list(map(int, input().split()))
A_append(a)
B_append(b)
A.sort(reverse = True)
B.sort(reverse = True)
# print (A)
# print (B)
co... | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse = True)
B.sort(reverse = True)
ans = 0
maxA = A[0] #複数回使える最大ダメージ
for b in B:
if b <= maxA:
... | 28 | 30 | 469 | 486 | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
A = []
A_append = A.append
B = []
B_append = B.append
for i in range(N):
a, b = list(map(int, input().split()))
A_append(a)
B_append(b)
A.sort(reverse=True)
B.sort(reverse=True)
# print (A)
# print (B)
count = 0
b = 0
while b < N ... | import sys
input = sys.stdin.readline
N, H = list(map(int, input().split()))
A = []
B = []
for _ in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
ans = 0
maxA = A[0] # 複数回使える最大ダメージ
for b in B:
if b <= maxA:
break
else:
... | false | 6.666667 | [
"-A_append = A.append",
"-B_append = B.append",
"-for i in range(N):",
"+for _ in range(N):",
"- A_append(a)",
"- B_append(b)",
"+ A.append(a)",
"+ B.append(b)",
"-# print (A)",
"-# print (B)",
"-count = 0",
"-b = 0",
"-while b < N and B[b] > A[0] and H > 0:",
"- count += 1"... | false | 0.043054 | 0.03859 | 1.115682 | [
"s040024448",
"s922954372"
] |
u094999522 | p04034 | python | s738269126 | s999798900 | 176 | 153 | 29,192 | 28,596 | Accepted | Accepted | 13.07 | #!/usr/bin/env python3
(n, m), *q = [[*list(map(int, i.split()))] for i in open(0)]
b = [1] + [0] * (n - 1)
c = [1] * n
for x, y in q:
c[x - 1] -= 1
c[y - 1] += 1
b[y - 1] |= b[x - 1]
b[x - 1] *= c[x - 1] > 0
print((sum(b)))
| (n, m), *q = [[*list(map(int, i.split()))] for i in open(0)]
b = [0] * (n + 1)
b[1] = 1
c = [1] * (n + 1)
for x, y in q:
c[x] -= 1
c[y] += 1
b[y] |= b[x]
b[x] *= c[x] > 0
print((sum(b)))
| 10 | 10 | 242 | 204 | #!/usr/bin/env python3
(n, m), *q = [[*list(map(int, i.split()))] for i in open(0)]
b = [1] + [0] * (n - 1)
c = [1] * n
for x, y in q:
c[x - 1] -= 1
c[y - 1] += 1
b[y - 1] |= b[x - 1]
b[x - 1] *= c[x - 1] > 0
print((sum(b)))
| (n, m), *q = [[*list(map(int, i.split()))] for i in open(0)]
b = [0] * (n + 1)
b[1] = 1
c = [1] * (n + 1)
for x, y in q:
c[x] -= 1
c[y] += 1
b[y] |= b[x]
b[x] *= c[x] > 0
print((sum(b)))
| false | 0 | [
"-#!/usr/bin/env python3",
"-b = [1] + [0] * (n - 1)",
"-c = [1] * n",
"+b = [0] * (n + 1)",
"+b[1] = 1",
"+c = [1] * (n + 1)",
"- c[x - 1] -= 1",
"- c[y - 1] += 1",
"- b[y - 1] |= b[x - 1]",
"- b[x - 1] *= c[x - 1] > 0",
"+ c[x] -= 1",
"+ c[y] += 1",
"+ b[y] |= b[x]",
... | false | 0.122334 | 0.03807 | 3.213421 | [
"s738269126",
"s999798900"
] |
u759651152 | p03814 | python | s533192588 | s126974902 | 29 | 23 | 3,516 | 4,840 | Accepted | Accepted | 20.69 | #-*-coding:utf-8-*-
def main():
s = eval(input())
for i in range(len(s)):
if s[i] == 'A':
start = i
break
for j in range(len(s)-1, -1, -1):
if s[j] == 'Z':
end = j
break
print((end - start + 1))
if __name__ == '__main__':
... | #-*-coding:utf-8-*-
def main():
s = list(eval(input()))
start = s.index('A')
s.reverse()
end = len(s) - s.index('Z')
print((end - start))
if __name__ == '__main__':
main() | 17 | 11 | 323 | 199 | # -*-coding:utf-8-*-
def main():
s = eval(input())
for i in range(len(s)):
if s[i] == "A":
start = i
break
for j in range(len(s) - 1, -1, -1):
if s[j] == "Z":
end = j
break
print((end - start + 1))
if __name__ == "__main__":
main()
| # -*-coding:utf-8-*-
def main():
s = list(eval(input()))
start = s.index("A")
s.reverse()
end = len(s) - s.index("Z")
print((end - start))
if __name__ == "__main__":
main()
| false | 35.294118 | [
"- s = eval(input())",
"- for i in range(len(s)):",
"- if s[i] == \"A\":",
"- start = i",
"- break",
"- for j in range(len(s) - 1, -1, -1):",
"- if s[j] == \"Z\":",
"- end = j",
"- break",
"- print((end - start + 1))",
"+ s... | false | 0.037353 | 0.045646 | 0.818326 | [
"s533192588",
"s126974902"
] |
u253681061 | p03127 | python | s757849104 | s565098086 | 98 | 85 | 16,240 | 16,296 | Accepted | Accepted | 13.27 | import fractions
n = int(eval(input()))
a = [int(x) for x in input().split()]
ans = a[0]
for i in range(1,n):
ans = fractions.gcd(ans, a[i])
print(ans) | from fractions import gcd
from functools import reduce
n = int(eval(input()))
a = [int(x) for x in input().split()]
def gcd_list(l):
return reduce(gcd, l)
print((gcd_list(a))) | 10 | 9 | 161 | 181 | import fractions
n = int(eval(input()))
a = [int(x) for x in input().split()]
ans = a[0]
for i in range(1, n):
ans = fractions.gcd(ans, a[i])
print(ans)
| from fractions import gcd
from functools import reduce
n = int(eval(input()))
a = [int(x) for x in input().split()]
def gcd_list(l):
return reduce(gcd, l)
print((gcd_list(a)))
| false | 10 | [
"-import fractions",
"+from fractions import gcd",
"+from functools import reduce",
"-ans = a[0]",
"-for i in range(1, n):",
"- ans = fractions.gcd(ans, a[i])",
"-print(ans)",
"+",
"+",
"+def gcd_list(l):",
"+ return reduce(gcd, l)",
"+",
"+",
"+print((gcd_list(a)))"
] | false | 0.044846 | 0.048259 | 0.929278 | [
"s757849104",
"s565098086"
] |
u254871849 | p03317 | python | s968070697 | s532011022 | 45 | 40 | 14,324 | 13,940 | Accepted | Accepted | 11.11 | # author: kagemeka
# created: 2019-11-08 13:38:56(JST)
## internal modules
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modu... | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
def main():
return ((n - 1) + (k - 1) - 1) // (k - 1)
if __name__ == '__main__':
ans = main()
print(ans) | 44 | 10 | 1,122 | 185 | # author: kagemeka
# created: 2019-11-08 13:38:56(JST)
## internal modules
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import ... | import sys
n, k, *a = list(map(int, sys.stdin.read().split()))
def main():
return ((n - 1) + (k - 1) - 1) // (k - 1)
if __name__ == "__main__":
ans = main()
print(ans)
| false | 77.272727 | [
"-# author: kagemeka",
"-# created: 2019-11-08 13:38:56(JST)",
"-## internal modules",
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"-# import fun... | false | 0.040216 | 0.11967 | 0.336059 | [
"s968070697",
"s532011022"
] |
u133936772 | p02725 | python | s234023246 | s654804706 | 130 | 98 | 32,380 | 31,800 | Accepted | Accepted | 24.62 | f=lambda:[*list(map(int,input().split()))]
k,n=f()
l=f()
l+=[l[0]+k]
a=0
for i in range(n):
a=max(a,l[i+1]-l[i])
print((k-a)) | k,n,*l=list(map(int,open(0).read().split()))
l+=[l[0]+k]
print((k-max(l[i+1]-l[i] for i in range(n)))) | 8 | 3 | 126 | 96 | f = lambda: [*list(map(int, input().split()))]
k, n = f()
l = f()
l += [l[0] + k]
a = 0
for i in range(n):
a = max(a, l[i + 1] - l[i])
print((k - a))
| k, n, *l = list(map(int, open(0).read().split()))
l += [l[0] + k]
print((k - max(l[i + 1] - l[i] for i in range(n))))
| false | 62.5 | [
"-f = lambda: [*list(map(int, input().split()))]",
"-k, n = f()",
"-l = f()",
"+k, n, *l = list(map(int, open(0).read().split()))",
"-a = 0",
"-for i in range(n):",
"- a = max(a, l[i + 1] - l[i])",
"-print((k - a))",
"+print((k - max(l[i + 1] - l[i] for i in range(n))))"
] | false | 0.150162 | 0.042819 | 3.506859 | [
"s234023246",
"s654804706"
] |
u562935282 | p03283 | python | s099648550 | s509988884 | 1,629 | 642 | 13,376 | 20,148 | Accepted | Accepted | 60.59 | N, M, Q = list(map(int, input().split()))
tbl = [[0] * (N + 1) for _ in range(N + 1)]
# tbl[L][R] = 累積和
# 1-indexed
for _ in range(M):
l, r = list(map(int, input().split()))
tbl[l][r] += 1
for p in range(1, N + 1):
for q in range(1, N + 1):
tbl[p][q] += tbl[p][q - 1]
tbl[p][q... | def main():
import sys
input = sys.stdin.readline
def build_table(h, w, a):
ret = [[0] * (w + 1) for _ in range(h + 1)]
for r in range(h):
for c in range(w):
ret[r + 1][c + 1] = ret[r + 1][c] + ret[r][c + 1] - ret[r][c] + a[r][c]
return ret
... | 20 | 34 | 517 | 877 | N, M, Q = list(map(int, input().split()))
tbl = [[0] * (N + 1) for _ in range(N + 1)]
# tbl[L][R] = 累積和
# 1-indexed
for _ in range(M):
l, r = list(map(int, input().split()))
tbl[l][r] += 1
for p in range(1, N + 1):
for q in range(1, N + 1):
tbl[p][q] += tbl[p][q - 1]
tbl[p][q] += tbl[p - 1][... | def main():
import sys
input = sys.stdin.readline
def build_table(h, w, a):
ret = [[0] * (w + 1) for _ in range(h + 1)]
for r in range(h):
for c in range(w):
ret[r + 1][c + 1] = ret[r + 1][c] + ret[r][c + 1] - ret[r][c] + a[r][c]
return ret
def get(... | false | 41.176471 | [
"-N, M, Q = list(map(int, input().split()))",
"-tbl = [[0] * (N + 1) for _ in range(N + 1)]",
"-# tbl[L][R] = 累積和",
"-# 1-indexed",
"-for _ in range(M):",
"- l, r = list(map(int, input().split()))",
"- tbl[l][r] += 1",
"-for p in range(1, N + 1):",
"- for q in range(1, N + 1):",
"- ... | false | 0.041883 | 0.038106 | 1.099132 | [
"s099648550",
"s509988884"
] |
u888092736 | p03687 | python | s054337753 | s531133328 | 70 | 19 | 3,896 | 3,060 | Accepted | Accepted | 72.86 | from copy import copy
from string import ascii_lowercase
s = list(eval(input()))
ans = len(s)
for c in ascii_lowercase:
t = copy(s)
for i in range(len(s), 0, -1):
if t == [c] * i:
ans = min(ans, len(s) - i)
break
u = copy(t[:-1])
for j in range(i - ... | s = list(eval(input()))
ans = len(s)
for c in s:
dist = 0
dists = []
for d in s:
if c != d:
dist += 1
else:
dists.append(dist)
dist = 0
ans = min(ans, max(dists + [dist]))
print(ans) | 20 | 13 | 462 | 256 | from copy import copy
from string import ascii_lowercase
s = list(eval(input()))
ans = len(s)
for c in ascii_lowercase:
t = copy(s)
for i in range(len(s), 0, -1):
if t == [c] * i:
ans = min(ans, len(s) - i)
break
u = copy(t[:-1])
for j in range(i - 1):
... | s = list(eval(input()))
ans = len(s)
for c in s:
dist = 0
dists = []
for d in s:
if c != d:
dist += 1
else:
dists.append(dist)
dist = 0
ans = min(ans, max(dists + [dist]))
print(ans)
| false | 35 | [
"-from copy import copy",
"-from string import ascii_lowercase",
"-",
"-for c in ascii_lowercase:",
"- t = copy(s)",
"- for i in range(len(s), 0, -1):",
"- if t == [c] * i:",
"- ans = min(ans, len(s) - i)",
"- break",
"- u = copy(t[:-1])",
"- for ... | false | 0.167047 | 0.037208 | 4.489542 | [
"s054337753",
"s531133328"
] |
u794544096 | p02836 | python | s628642455 | s082896960 | 172 | 72 | 38,384 | 61,436 | Accepted | Accepted | 58.14 | s = eval(input())
n = len(s)
cnt = 0
for i in range(n//2):
if s[i] != s[n-i-1]:
cnt += 1
print(cnt) | s = eval(input())
n = len(s)
count = 0
for i in range(n // 2):
if s[i] != s[n - i - 1]:
count += 1
print(count) | 9 | 9 | 123 | 135 | s = eval(input())
n = len(s)
cnt = 0
for i in range(n // 2):
if s[i] != s[n - i - 1]:
cnt += 1
print(cnt)
| s = eval(input())
n = len(s)
count = 0
for i in range(n // 2):
if s[i] != s[n - i - 1]:
count += 1
print(count)
| false | 0 | [
"-cnt = 0",
"+count = 0",
"- cnt += 1",
"-print(cnt)",
"+ count += 1",
"+print(count)"
] | false | 0.067087 | 0.043782 | 1.53231 | [
"s628642455",
"s082896960"
] |
u327179339 | p02889 | python | s256065123 | s989752953 | 1,946 | 1,015 | 60,280 | 56,156 | Accepted | Accepted | 47.84 | N, M, L = list(map(int, input().split()))
dist = [[10**12] * N for _ in range(N)]
for i in range(N):
dist[i][i] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
if c <= L:
dist[a-1][b-1] = dist[b-1][a-1] = c
for k in range(N):
for i in range(N):
for j in ra... | #juppy's code for testing run time only.
def main():
import sys
input = sys.stdin.readline
n,m,l = list(map(int,input().split()))
d = [[10**12]*n for _ in [0]*n]
for i in range(m):
a,b,c = list(map(int,input().split()))
if l >= c:
d[a-1][b-1] = d[b-1][a-1] = c
... | 33 | 39 | 869 | 1,052 | N, M, L = list(map(int, input().split()))
dist = [[10**12] * N for _ in range(N)]
for i in range(N):
dist[i][i] = 0
for _ in range(M):
a, b, c = list(map(int, input().split()))
if c <= L:
dist[a - 1][b - 1] = dist[b - 1][a - 1] = c
for k in range(N):
for i in range(N):
for j in range(N):... | # juppy's code for testing run time only.
def main():
import sys
input = sys.stdin.readline
n, m, l = list(map(int, input().split()))
d = [[10**12] * n for _ in [0] * n]
for i in range(m):
a, b, c = list(map(int, input().split()))
if l >= c:
d[a - 1][b - 1] = d[b - 1][a ... | false | 15.384615 | [
"-N, M, L = list(map(int, input().split()))",
"-dist = [[10**12] * N for _ in range(N)]",
"-for i in range(N):",
"- dist[i][i] = 0",
"-for _ in range(M):",
"- a, b, c = list(map(int, input().split()))",
"- if c <= L:",
"- dist[a - 1][b - 1] = dist[b - 1][a - 1] = c",
"-for k in range... | false | 0.055328 | 0.091298 | 0.606017 | [
"s256065123",
"s989752953"
] |
u020390084 | p04045 | python | s848339530 | s809019992 | 89 | 59 | 3,064 | 3,064 | Accepted | Accepted | 33.71 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
while True:
for d in D:
strn=str(N)
if str(d) in strn:
break
else:
print(N)
return
N+=1
return
def main():
def ite... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
D = list(map(str,D))
while True:
for d in D:
if d in str(N):
N += 1
break
else:
print(N)
break
return
def main():
d... | 31 | 31 | 675 | 681 | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
while True:
for d in D:
strn = str(N)
if str(d) in strn:
break
else:
print(N)
return
N += 1
return
def main():
def iterate_tokens():
... | #!/usr/bin/env python3
import sys
def solve(N: int, K: int, D: "List[int]"):
D = list(map(str, D))
while True:
for d in D:
if d in str(N):
N += 1
break
else:
print(N)
break
return
def main():
def iterate_tokens():
... | false | 0 | [
"+ D = list(map(str, D))",
"- strn = str(N)",
"- if str(d) in strn:",
"+ if d in str(N):",
"+ N += 1",
"- return",
"- N += 1",
"+ break"
] | false | 0.047689 | 0.042291 | 1.127628 | [
"s848339530",
"s809019992"
] |
u721316601 | p03325 | python | s060055133 | s181796838 | 84 | 59 | 4,148 | 4,084 | Accepted | Accepted | 29.76 | ans = 0
N = int(eval(input()))
a = list(map(int, input().split()))
for n in a:
while not n % 2:
ans += 1
n //= 2
print(ans) | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
ans = 0
for a in list(map(int, input().split())):
while not a % 2:
ans += 1
a //= 2
print(ans)
if __name__ == '__main__':
main()
| 8 | 17 | 144 | 281 | ans = 0
N = int(eval(input()))
a = list(map(int, input().split()))
for n in a:
while not n % 2:
ans += 1
n //= 2
print(ans)
| import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
ans = 0
for a in list(map(int, input().split())):
while not a % 2:
ans += 1
a //= 2
print(ans)
if __name__ == "__main__":
main()
| false | 52.941176 | [
"-ans = 0",
"-N = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-for n in a:",
"- while not n % 2:",
"- ans += 1",
"- n //= 2",
"-print(ans)",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"+def main():",
"+ N = int(eval(input()))",
"+... | false | 0.043964 | 0.062653 | 0.7017 | [
"s060055133",
"s181796838"
] |
u077291787 | p03111 | python | s955374490 | s133580985 | 74 | 19 | 3,064 | 3,064 | Accepted | Accepted | 74.32 | # ABC119C - Synthetic Kadomatsu
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for i in range(N)]
INF = float('inf')
def dfs(cursor=0, a=0, b=0, c=0): # cursor:カーソル a,b,c:現在の竹の長さ
if cursor == N: # cursorが最後まで行ったら終了する。
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(... | n, *goals = list(map(int, input().split()))
bamboos = list(map(int, [input().rstrip() for _ in range(n)]))
def get_best(li, goal):
bam_mp_lis = {0: (-10, tuple())}
li.sort()
for i, v in enumerate(li):
tmp = bam_mp_lis.copy()
for bam, (mp, lis) in list(tmp.items()):
b0... | 30 | 44 | 1,168 | 1,164 | # ABC119C - Synthetic Kadomatsu
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for i in range(N)]
INF = float("inf")
def dfs(cursor=0, a=0, b=0, c=0): # cursor:カーソル a,b,c:現在の竹の長さ
if cursor == N: # cursorが最後まで行ったら終了する。
return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c)... | n, *goals = list(map(int, input().split()))
bamboos = list(map(int, [input().rstrip() for _ in range(n)]))
def get_best(li, goal):
bam_mp_lis = {0: (-10, tuple())}
li.sort()
for i, v in enumerate(li):
tmp = bam_mp_lis.copy()
for bam, (mp, lis) in list(tmp.items()):
b0 = bam + v... | false | 31.818182 | [
"-# ABC119C - Synthetic Kadomatsu",
"-N, A, B, C = list(map(int, input().split()))",
"-L = [int(eval(input())) for i in range(N)]",
"-INF = float(\"inf\")",
"+n, *goals = list(map(int, input().split()))",
"+bamboos = list(map(int, [input().rstrip() for _ in range(n)]))",
"-def dfs(cursor=0, a=0, b=0, c=... | false | 0.092386 | 0.038743 | 2.384585 | [
"s955374490",
"s133580985"
] |
u124498235 | p03127 | python | s142222779 | s714879605 | 92 | 68 | 16,280 | 14,252 | Accepted | Accepted | 26.09 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[0]
for i in range(n):
b = gcd(b, a[i])
print (b) | n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
while y:
x, y = y, x%y
return x
def lcm(x,y):
return (x * y) // gcd(x,y)
c = a[0]
for i in a:
c = gcd(c,i)
print (c)
| 7 | 15 | 140 | 208 | from fractions import gcd
n = int(eval(input()))
a = list(map(int, input().split()))
b = a[0]
for i in range(n):
b = gcd(b, a[i])
print(b)
| n = int(eval(input()))
a = list(map(int, input().split()))
def gcd(x, y):
while y:
x, y = y, x % y
return x
def lcm(x, y):
return (x * y) // gcd(x, y)
c = a[0]
for i in a:
c = gcd(c, i)
print(c)
| false | 53.333333 | [
"-from fractions import gcd",
"-",
"-b = a[0]",
"-for i in range(n):",
"- b = gcd(b, a[i])",
"-print(b)",
"+",
"+",
"+def gcd(x, y):",
"+ while y:",
"+ x, y = y, x % y",
"+ return x",
"+",
"+",
"+def lcm(x, y):",
"+ return (x * y) // gcd(x, y)",
"+",
"+",
"+c =... | false | 0.045264 | 0.145423 | 0.311259 | [
"s142222779",
"s714879605"
] |
u600402037 | p03305 | python | s064881280 | s464762934 | 1,531 | 1,309 | 78,384 | 82,856 | Accepted | Accepted | 14.5 | import sys
sys.setrecursionlimit(10 ** 7)
import numpy as np
from heapq import *
N, M, S, T = list(map(int, input().split()))
INF = 10 ** 15
graph = [[] for _ in range(N+1)] # graph[0]は使わない
for i in range(M):
u, v, a, b = list(map(int, input().split()))
graph[u].append((v, a, b))
graph[v].ap... | import sys
from heapq import heappop, heappush
import numpy as np
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces
N, M, S, T = rl()
graph = [[] for _ in range(N+1)] #0使... | 37 | 40 | 951 | 1,099 | import sys
sys.setrecursionlimit(10**7)
import numpy as np
from heapq import *
N, M, S, T = list(map(int, input().split()))
INF = 10**15
graph = [[] for _ in range(N + 1)] # graph[0]は使わない
for i in range(M):
u, v, a, b = list(map(int, input().split()))
graph[u].append((v, a, b))
graph[v].append((u, a, b))... | import sys
from heapq import heappop, heappush
import numpy as np
stdin = sys.stdin
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip() # ignore trailing spaces
N, M, S, T = rl()
graph = [[] for _ in range(N + 1)] # 0使わず
for _... | false | 7.5 | [
"+from heapq import heappop, heappush",
"+import numpy as np",
"-sys.setrecursionlimit(10**7)",
"-import numpy as np",
"-from heapq import *",
"-",
"-N, M, S, T = list(map(int, input().split()))",
"-INF = 10**15",
"-graph = [[] for _ in range(N + 1)] # graph[0]は使わない",
"-for i in range(M):",
"- ... | false | 0.342391 | 0.629864 | 0.543595 | [
"s064881280",
"s464762934"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.