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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u481250941 | p03835 | python | s684730742 | s261137257 | 812 | 690 | 5,876 | 16,240 | Accepted | Accepted | 15.02 | #
# abc051 b
#
import unittest
from io import StringIO
import sys
def input():
return sys.stdin.readline().rstrip()
def resolve():
K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
for y in range(K+1):
z = S - x - y
if z >= 0 and ... | #
# abc051 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 ... | 48 | 42 | 1,034 | 944 | #
# abc051 b
#
import unittest
from io import StringIO
import sys
def input():
return sys.stdin.readline().rstrip()
def resolve():
K, S = list(map(int, input().split()))
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if z >= 0 and z <= K:
... | #
# abc051 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 | 12.5 | [
"+import sys",
"+from io import StringIO",
"-from io import StringIO",
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline().rstrip()",
"-",
"-",
"-def resolve():",
"- K, S = list(map(int, input().split()))",
"- ans = 0",
"- for x in range(K + 1):",
"- ... | false | 0.155479 | 0.379902 | 0.409261 | [
"s684730742",
"s261137257"
] |
u378691508 | p02787 | python | s939036759 | s021302130 | 580 | 471 | 229,068 | 217,288 | Accepted | Accepted | 18.79 | H, N = list(map(int, input().split()))
A=[]
B=[]
for i in range(N):
a,b = list(map(int, input().split()))
A.append(a)
B.append(b)
#dp[i+1][h] := i番目の魔法まで見て、ライフをh以上削った時の最小魔力コスト
dp=[[float("inf")]*(H+1) for _ in range(N+1)]
for i in range(N):
for h in range(H+1):
if A[i]>=h:
dp[i+1][h] = min(dp[i][... | H, N = list(map(int, input().split()))
A=[]
B=[]
for i in range(N):
a,b = list(map(int, input().split()))
A.append(a)
B.append(b)
#dp[i+1][h] := i番目の魔法まで見て、ライフをh以上削った時の最小魔力コスト
dp=[[float("inf")]*(H+1) for _ in range(N+1)]
for i in range(N):
for h in range(H+1):
if A[i]>=h:
dp[i+1][h] = min(dp[i][... | 17 | 17 | 398 | 418 | H, N = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# dp[i+1][h] := i番目の魔法まで見て、ライフをh以上削った時の最小魔力コスト
dp = [[float("inf")] * (H + 1) for _ in range(N + 1)]
for i in range(N):
for h in range(H + 1):
if A[i] >= h:
... | H, N = list(map(int, input().split()))
A = []
B = []
for i in range(N):
a, b = list(map(int, input().split()))
A.append(a)
B.append(b)
# dp[i+1][h] := i番目の魔法まで見て、ライフをh以上削った時の最小魔力コスト
dp = [[float("inf")] * (H + 1) for _ in range(N + 1)]
for i in range(N):
for h in range(H + 1):
if A[i] >= h:
... | false | 0 | [
"- dp[i + 1][h] = min(dp[i][h], dp[i + 1][h - A[i]] + B[i])",
"+ dp[i + 1][h] = min(",
"+ dp[i][h], dp[i + 1][h - A[i]] + B[i], dp[i][h - A[i]] + B[i]",
"+ )"
] | false | 0.224301 | 0.113874 | 1.969722 | [
"s939036759",
"s021302130"
] |
u480138356 | p03160 | python | s384157200 | s227717813 | 618 | 130 | 24,876 | 13,928 | Accepted | Accepted | 78.96 | import sys
import numpy as np
input = sys.stdin.readline
def main():
N = int(eval(input()))
h = list(map(int, input().split()))
h += [0, 0]
dp = np.full(N+2, int(1e15))
dp[0] = 0
for i in range(N):
dp[i+1] = min(dp[i+1], dp[i] + abs(h[i] - h[i+1]))
dp[i+2] = min(dp... | N = int(eval(input()))
h = list(map(int, input().split()))
# dp[i] := iからN-1までいく最小コスト
dp = [-1] * N
dp[N-1] = 0
dp[N-2] = abs(h[N-1] - h[N-2])
for i in range(N-3, -1, -1):
dp[i] = min(abs(h[i] - h[i+1]) + dp[i+1], abs(h[i] - h[i+2]) + dp[i+2])
print((dp[0])) | 19 | 13 | 432 | 268 | import sys
import numpy as np
input = sys.stdin.readline
def main():
N = int(eval(input()))
h = list(map(int, input().split()))
h += [0, 0]
dp = np.full(N + 2, int(1e15))
dp[0] = 0
for i in range(N):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]))
dp[i + 2] = min(dp[i... | N = int(eval(input()))
h = list(map(int, input().split()))
# dp[i] := iからN-1までいく最小コスト
dp = [-1] * N
dp[N - 1] = 0
dp[N - 2] = abs(h[N - 1] - h[N - 2])
for i in range(N - 3, -1, -1):
dp[i] = min(abs(h[i] - h[i + 1]) + dp[i + 1], abs(h[i] - h[i + 2]) + dp[i + 2])
print((dp[0]))
| false | 31.578947 | [
"-import sys",
"-import numpy as np",
"-",
"-input = sys.stdin.readline",
"-",
"-",
"-def main():",
"- N = int(eval(input()))",
"- h = list(map(int, input().split()))",
"- h += [0, 0]",
"- dp = np.full(N + 2, int(1e15))",
"- dp[0] = 0",
"- for i in range(N):",
"- d... | false | 0.31277 | 0.040511 | 7.720709 | [
"s384157200",
"s227717813"
] |
u673361376 | p03001 | python | s184724491 | s171938646 | 21 | 17 | 2,940 | 2,940 | Accepted | Accepted | 19.05 | import sys
import math
w, h, x, y = list(map(int, sys.stdin.readline().split()))
S = w*h/2
if x == w/2 and y == h/2:
print((S,1))
else:
print((S, 0)) | W, H, x, y = list(map(int,input().split()))
cg = [W/2, H/2]
if [x, y] == cg:
print(( W * H / 2, 1))
else:
print((W * H / 2, 0)) | 9 | 6 | 152 | 130 | import sys
import math
w, h, x, y = list(map(int, sys.stdin.readline().split()))
S = w * h / 2
if x == w / 2 and y == h / 2:
print((S, 1))
else:
print((S, 0))
| W, H, x, y = list(map(int, input().split()))
cg = [W / 2, H / 2]
if [x, y] == cg:
print((W * H / 2, 1))
else:
print((W * H / 2, 0))
| false | 33.333333 | [
"-import sys",
"-import math",
"-",
"-w, h, x, y = list(map(int, sys.stdin.readline().split()))",
"-S = w * h / 2",
"-if x == w / 2 and y == h / 2:",
"- print((S, 1))",
"+W, H, x, y = list(map(int, input().split()))",
"+cg = [W / 2, H / 2]",
"+if [x, y] == cg:",
"+ print((W * H / 2, 1))",
... | false | 0.008022 | 0.035709 | 0.224653 | [
"s184724491",
"s171938646"
] |
u313291636 | p03290 | python | s868774083 | s808612372 | 235 | 98 | 44,400 | 74,744 | Accepted | Accepted | 58.3 | import math
d, g = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(d)]
ans = float('inf')
for i in range(2 ** d):
sum = 0
count = 0
s = set(_ for _ in range(1, d + 1))
for j in range(d):
if (i >> j) & 1 == 1:
sum += l[j][0] * (j + 1) ... | import math
d, g = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(d)]
ans = float('inf')
for i in range(2 ** d):
sum = 0
count = 0
s = set(k for k in range(1, d + 1))
for j in range(d):
if (i >> j) & 1 == 1:
sum += l[j][0] * (j + 1) ... | 23 | 23 | 600 | 604 | import math
d, g = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(d)]
ans = float("inf")
for i in range(2**d):
sum = 0
count = 0
s = set(_ for _ in range(1, d + 1))
for j in range(d):
if (i >> j) & 1 == 1:
sum += l[j][0] * (j + 1) * 100 + l[j][1]... | import math
d, g = list(map(int, input().split()))
l = [list(map(int, input().split())) for _ in range(d)]
ans = float("inf")
for i in range(2**d):
sum = 0
count = 0
s = set(k for k in range(1, d + 1))
for j in range(d):
if (i >> j) & 1 == 1:
sum += l[j][0] * (j + 1) * 100 + l[j][1]... | false | 0 | [
"- s = set(_ for _ in range(1, d + 1))",
"+ s = set(k for k in range(1, d + 1))",
"- n = min(l[t - 1][0], math.ceil((g - sum) / (t * 100)))",
"+ n = min(l[t - 1][0] - 1, math.ceil((g - sum) / (t * 100)))"
] | false | 0.038161 | 0.036016 | 1.059561 | [
"s868774083",
"s808612372"
] |
u788137651 | p03241 | python | s422151268 | s323744130 | 381 | 289 | 69,740 | 64,236 | Accepted | Accepted | 24.15 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import... | 72 | 63 | 1,946 | 1,723 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.readline
from math import floor, sqrt, factorial, hypot, log # log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter, defa... | false | 12.5 | [
"-# 素因数分解",
"-def prime_factorization(n):",
"- fact = []",
"- for i in range(2, int(sqrt(n)) + 1):",
"- while n % i == 0:",
"- n //= i",
"- fact.append(i)",
"- if n != 1:",
"- fact.append(n)",
"- return fact",
"-",
"-",
"- D = find_divisor(M... | false | 0.039747 | 0.039521 | 1.005714 | [
"s422151268",
"s323744130"
] |
u254871849 | p02843 | python | s581983274 | s511274369 | 60 | 18 | 3,828 | 2,940 | Accepted | Accepted | 70 | import sys
payable = [False] * (10 ** 5 + 1)
payable[0] = True
for i in range(100,106):
payable[i] = True
for i in range(106, 10 ** 5 + 1):
payable[i] = any(payable[i-105:i-99])
def main():
x = int(sys.stdin.readline().rstrip())
print((payable[x] & 1))
if __name__ == '__main__':
m... | import sys
def main():
x = int(sys.stdin.readline().rstrip())
q, r = divmod(x, 100)
if 5 * q >= r:
ans = 1
else:
ans = 0
print(ans)
if __name__ == '__main__':
main() | 16 | 15 | 323 | 223 | import sys
payable = [False] * (10**5 + 1)
payable[0] = True
for i in range(100, 106):
payable[i] = True
for i in range(106, 10**5 + 1):
payable[i] = any(payable[i - 105 : i - 99])
def main():
x = int(sys.stdin.readline().rstrip())
print((payable[x] & 1))
if __name__ == "__main__":
main()
| import sys
def main():
x = int(sys.stdin.readline().rstrip())
q, r = divmod(x, 100)
if 5 * q >= r:
ans = 1
else:
ans = 0
print(ans)
if __name__ == "__main__":
main()
| false | 6.25 | [
"-",
"-payable = [False] * (10**5 + 1)",
"-payable[0] = True",
"-for i in range(100, 106):",
"- payable[i] = True",
"-for i in range(106, 10**5 + 1):",
"- payable[i] = any(payable[i - 105 : i - 99])",
"- print((payable[x] & 1))",
"+ q, r = divmod(x, 100)",
"+ if 5 * q >= r:",
"+ ... | false | 0.099217 | 0.040602 | 2.443649 | [
"s581983274",
"s511274369"
] |
u844005364 | p03170 | python | s593579340 | s652482745 | 1,982 | 114 | 3,828 | 3,828 | Accepted | Accepted | 94.25 |
n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp = [False] * (k + 1)
for i in range(1, k+1):
for a in arr:
if i - a >= 0 and not dp[i - a]:
dp[i] = True
print(("First" if dp[k] else "Second"))
| n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp = [False] * (k + 1)
for i in range(k + 1):
if not dp[i]:
for a in arr:
if i + a > k:
break
dp[i + a] = True
print(("First" if dp[k] else "Second"))
| 13 | 12 | 257 | 285 | n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp = [False] * (k + 1)
for i in range(1, k + 1):
for a in arr:
if i - a >= 0 and not dp[i - a]:
dp[i] = True
print(("First" if dp[k] else "Second"))
| n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp = [False] * (k + 1)
for i in range(k + 1):
if not dp[i]:
for a in arr:
if i + a > k:
break
dp[i + a] = True
print(("First" if dp[k] else "Second"))
| false | 7.692308 | [
"-for i in range(1, k + 1):",
"- for a in arr:",
"- if i - a >= 0 and not dp[i - a]:",
"- dp[i] = True",
"+for i in range(k + 1):",
"+ if not dp[i]:",
"+ for a in arr:",
"+ if i + a > k:",
"+ break",
"+ dp[i + a] = True"
] | false | 0.048659 | 0.039898 | 1.21957 | [
"s593579340",
"s652482745"
] |
u254871849 | p03681 | python | s992444178 | s151885058 | 947 | 332 | 121,844 | 74,940 | Accepted | Accepted | 64.94 | import sys
MOD = 10 ** 9 + 7
U = 10 ** 6
def make_fac_ifac(n=U, p=MOD):
fac = [None] * (n + 1)
fac[0] = 1
for i in range(n): fac[i+1] = fac[i] * (i + 1) % p
ifac = [None] * (n + 1)
ifac[n] = pow(fac[n], p - 2, p)
for i in range(n, 0, -1): ifac[i-1] = ifac[i] * i % p
return fac, ifac
fac, if... | import sys
import numpy as np
MOD = 10 ** 9 + 7
U = 10 ** 6
def mod_cumprod(a, p=MOD):
l = len(a); sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql**2).reshape(sql, sql)
for i in range(sql - 1): a[:, i+1] *= a[:, i]; a[:, i+1] %= p
for i in range(sql - 1): a[i+1] *= a[i, -1]; a[i+1] %= p
return np.ra... | 42 | 44 | 1,009 | 1,190 | import sys
MOD = 10**9 + 7
U = 10**6
def make_fac_ifac(n=U, p=MOD):
fac = [None] * (n + 1)
fac[0] = 1
for i in range(n):
fac[i + 1] = fac[i] * (i + 1) % p
ifac = [None] * (n + 1)
ifac[n] = pow(fac[n], p - 2, p)
for i in range(n, 0, -1):
ifac[i - 1] = ifac[i] * i % p
return... | import sys
import numpy as np
MOD = 10**9 + 7
U = 10**6
def mod_cumprod(a, p=MOD):
l = len(a)
sql = int(np.sqrt(l) + 1)
a = np.resize(a, sql**2).reshape(sql, sql)
for i in range(sql - 1):
a[:, i + 1] *= a[:, i]
a[:, i + 1] %= p
for i in range(sql - 1):
a[i + 1] *= a[i, -1]... | false | 4.545455 | [
"+import numpy as np",
"+def mod_cumprod(a, p=MOD):",
"+ l = len(a)",
"+ sql = int(np.sqrt(l) + 1)",
"+ a = np.resize(a, sql**2).reshape(sql, sql)",
"+ for i in range(sql - 1):",
"+ a[:, i + 1] *= a[:, i]",
"+ a[:, i + 1] %= p",
"+ for i in range(sql - 1):",
"+ ... | false | 1.067502 | 0.961714 | 1.11 | [
"s992444178",
"s151885058"
] |
u788068140 | p02947 | python | s138202211 | s653160788 | 343 | 248 | 24,980 | 29,144 | Accepted | Accepted | 27.7 | def ccc(n):
#c(n,2)
result = (n * (n-1))//2
return result
def sortString(a):
a = list(a)
a.sort()
return "".join(a)
def calculate(arr):
if len(arr) == 0:
return 0
dict = {}
for i in range(len(arr)):
s = sortString(arr[i])
if dict.get(... | N = 3
SRR = [
"acornistnt",
"peanutbomb",
"constraint",
]
N = 5
SRR = [
"abaaaaaaaa",
"oneplustwo",
"aaaaaaaaba",
"twoplusone",
"aaaabaaaaa",
]
N = int(eval(input()))
SRR = []
for i in range(N):
SRR.append(eval(input()))
def calculate(n,arr):
dict = {}
... | 43 | 41 | 641 | 680 | def ccc(n):
# c(n,2)
result = (n * (n - 1)) // 2
return result
def sortString(a):
a = list(a)
a.sort()
return "".join(a)
def calculate(arr):
if len(arr) == 0:
return 0
dict = {}
for i in range(len(arr)):
s = sortString(arr[i])
if dict.get(s) == None:
... | N = 3
SRR = [
"acornistnt",
"peanutbomb",
"constraint",
]
N = 5
SRR = [
"abaaaaaaaa",
"oneplustwo",
"aaaaaaaaba",
"twoplusone",
"aaaabaaaaa",
]
N = int(eval(input()))
SRR = []
for i in range(N):
SRR.append(eval(input()))
def calculate(n, arr):
dict = {}
for i in range(n):
... | false | 4.651163 | [
"-def ccc(n):",
"- # c(n,2)",
"- result = (n * (n - 1)) // 2",
"- return result",
"+N = 3",
"+SRR = [",
"+ \"acornistnt\",",
"+ \"peanutbomb\",",
"+ \"constraint\",",
"+]",
"+N = 5",
"+SRR = [",
"+ \"abaaaaaaaa\",",
"+ \"oneplustwo\",",
"+ \"aaaaaaaaba\",",
"... | false | 0.07004 | 0.038209 | 1.833075 | [
"s138202211",
"s653160788"
] |
u597455618 | p04045 | python | s336932876 | s833351283 | 246 | 153 | 9,076 | 9,212 | Accepted | Accepted | 37.8 | def dfs(A: list):
if len(A) > len(str(n))+1:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = list(map(int, ... | def dfs(A: list):
if len(A) > nn:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = list(map(int, input().spl... | 20 | 21 | 447 | 455 | def dfs(A: list):
if len(A) > len(str(n)) + 1:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = list(map(int, input().split(... | def dfs(A: list):
if len(A) > nn:
return
if len(A) and (x := int("".join(A))) >= n and ans[0] > x:
ans[0] = x
return
for v in d:
if v == "0" and len(A) == 0:
next
A.append(v)
dfs(A)
A.pop()
n, k = list(map(int, input().split()))
d = sorte... | false | 4.761905 | [
"- if len(A) > len(str(n)) + 1:",
"+ if len(A) > nn:",
"-ans = [10**10]",
"+nn = len(str(n)) + 1",
"+ans = [10**7]"
] | false | 0.080316 | 0.085229 | 0.942359 | [
"s336932876",
"s833351283"
] |
u525065967 | p03634 | python | s059609262 | s265907886 | 1,605 | 1,471 | 52,924 | 59,008 | Accepted | Accepted | 8.35 | # abc070d: Transit Tree Path
n = int(eval(input()))
T = [[] for _ in range(n)]
for _ in range(n-1):
v1,v2,d = list(map(int, input().split()))
v1,v2 = v1-1,v2-1
T[v1].append([v1,v2,d])
T[v2].append([v2,v1,d])
q,k = list(map(int, input().split()))
visit = [False]*(n)
depth = [0]*(n)
sta... | ## abc070d: Transit Tree Path
n = int(eval(input()))
T = [{} for _ in range(n)]
for _ in range(n-1):
v1,v2,d = list(map(int, input().split()))
T[v1-1][v2-1] = d
T[v2-1][v1-1] = d
q,k = list(map(int, input().split()))
visit = [False]*n
depth = [0]*n
stack = [[-1,k-1,0]]
while stack:
p... | 28 | 27 | 635 | 603 | # abc070d: Transit Tree Path
n = int(eval(input()))
T = [[] for _ in range(n)]
for _ in range(n - 1):
v1, v2, d = list(map(int, input().split()))
v1, v2 = v1 - 1, v2 - 1
T[v1].append([v1, v2, d])
T[v2].append([v2, v1, d])
q, k = list(map(int, input().split()))
visit = [False] * (n)
depth = [0] * (n)
sta... | ## abc070d: Transit Tree Path
n = int(eval(input()))
T = [{} for _ in range(n)]
for _ in range(n - 1):
v1, v2, d = list(map(int, input().split()))
T[v1 - 1][v2 - 1] = d
T[v2 - 1][v1 - 1] = d
q, k = list(map(int, input().split()))
visit = [False] * n
depth = [0] * n
stack = [[-1, k - 1, 0]]
while stack:
... | false | 3.571429 | [
"-# abc070d: Transit Tree Path",
"+## abc070d: Transit Tree Path",
"-T = [[] for _ in range(n)]",
"+T = [{} for _ in range(n)]",
"- v1, v2 = v1 - 1, v2 - 1",
"- T[v1].append([v1, v2, d])",
"- T[v2].append([v2, v1, d])",
"+ T[v1 - 1][v2 - 1] = d",
"+ T[v2 - 1][v1 - 1] = d",
"-visit =... | false | 0.050241 | 0.042937 | 1.170117 | [
"s059609262",
"s265907886"
] |
u169138653 | p03044 | python | s325533044 | s351623580 | 703 | 636 | 39,060 | 39,144 | Accepted | Accepted | 9.53 | from collections import deque
n=int(eval(input()))
edge=[[] for i in range(n)]
if n==1:
print((0))
exit()
col=[-1 for i in range(n)]
for i in range(n-1):
u,v,w=list(map(int,input().split()))
u-=1
v-=1
edge[u].append((v,w))
edge[v].append((u,w))
def dfs(edge,col):
stack=deque([0])
col[0]... | from collections import deque
n=int(eval(input()))
edges=[[] for _ in range(n)]
visited=[-1 for _ in range(n)]
for i in range(n-1):
u,v,w=list(map(int,input().split()))
edges[u-1].append((v-1,w))
edges[v-1].append((u-1,w))
def dfs(edges,visited):
stack=deque([0])
visited[0]=0
while stack:
x=... | 26 | 23 | 525 | 571 | from collections import deque
n = int(eval(input()))
edge = [[] for i in range(n)]
if n == 1:
print((0))
exit()
col = [-1 for i in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
edge[u].append((v, w))
edge[v].append((u, w))
def dfs(edge, col):
... | from collections import deque
n = int(eval(input()))
edges = [[] for _ in range(n)]
visited = [-1 for _ in range(n)]
for i in range(n - 1):
u, v, w = list(map(int, input().split()))
edges[u - 1].append((v - 1, w))
edges[v - 1].append((u - 1, w))
def dfs(edges, visited):
stack = deque([0])
visited... | false | 11.538462 | [
"-edge = [[] for i in range(n)]",
"-if n == 1:",
"- print((0))",
"- exit()",
"-col = [-1 for i in range(n)]",
"+edges = [[] for _ in range(n)]",
"+visited = [-1 for _ in range(n)]",
"- u -= 1",
"- v -= 1",
"- edge[u].append((v, w))",
"- edge[v].append((u, w))",
"+ edges[u ... | false | 0.045224 | 0.041556 | 1.088266 | [
"s325533044",
"s351623580"
] |
u844005364 | p03290 | python | s505721243 | s738223701 | 1,234 | 443 | 3,316 | 3,064 | Accepted | Accepted | 64.1 | difficulties, goal = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(difficulties)]
dp = [[0] * 1102 for _ in range(difficulties + 1)]
total_problem = 0
for d, pc in enumerate(pcs, 1):
problem, complete = pc
total_problem += problem
score = {x: x*100*d fo... | difficulties, goal = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(difficulties)]
total_problem = 0
new_dp = [0] * 1001
for d, pc in enumerate(pcs, 1):
dp = new_dp[:]
problem, complete = pc
total_problem += problem
score = {x: x*100*d for x in ra... | 25 | 27 | 739 | 687 | difficulties, goal = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(difficulties)]
dp = [[0] * 1102 for _ in range(difficulties + 1)]
total_problem = 0
for d, pc in enumerate(pcs, 1):
problem, complete = pc
total_problem += problem
score = {x: x * 100 * d for x in rang... | difficulties, goal = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(difficulties)]
total_problem = 0
new_dp = [0] * 1001
for d, pc in enumerate(pcs, 1):
dp = new_dp[:]
problem, complete = pc
total_problem += problem
score = {x: x * 100 * d for x in range(problem)}
... | false | 7.407407 | [
"-dp = [[0] * 1102 for _ in range(difficulties + 1)]",
"+new_dp = [0] * 1001",
"+ dp = new_dp[:]",
"- dp[d][i] = max(dp[d][i], dp[d - 1][j])",
"+ continue",
"- dp[d][i] = max(dp[d][i], dp[d - 1][j] + score[i - j])",
"-for i, a in enumerate(dp[difficulties]... | false | 0.05207 | 0.037191 | 1.40006 | [
"s505721243",
"s738223701"
] |
u077291787 | p03163 | python | s718467581 | s638299609 | 474 | 257 | 118,256 | 39,664 | Accepted | Accepted | 45.78 | # dpD - Knapsack 1
import sys
input = sys.stdin.readline
def main():
n, w = tuple(map(int, input().rstrip().split()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
dp = [[0] * (w + 1) for i in range(n)]
for i in range(n):
for j in range(w + 1):
if ... | # dpD
import sys
input = sys.stdin.readline
def main():
N, W = tuple(map(int, input().rstrip().split()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(N))
dp = [0] * (W + 1)
for i in range(N):
for j in range(W, A[i][0] - 1, -1):
dp[j] = max(dp[j], dp[j... | 19 | 16 | 540 | 405 | # dpD - Knapsack 1
import sys
input = sys.stdin.readline
def main():
n, w = tuple(map(int, input().rstrip().split()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
dp = [[0] * (w + 1) for i in range(n)]
for i in range(n):
for j in range(w + 1):
if j < A[i]... | # dpD
import sys
input = sys.stdin.readline
def main():
N, W = tuple(map(int, input().rstrip().split()))
A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(N))
dp = [0] * (W + 1)
for i in range(N):
for j in range(W, A[i][0] - 1, -1):
dp[j] = max(dp[j], dp[j - A[i][... | false | 15.789474 | [
"-# dpD - Knapsack 1",
"+# dpD",
"- n, w = tuple(map(int, input().rstrip().split()))",
"- A = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))",
"- dp = [[0] * (w + 1) for i in range(n)]",
"- for i in range(n):",
"- for j in range(w + 1):",
"- if j < A[i... | false | 0.037612 | 0.041835 | 0.899054 | [
"s718467581",
"s638299609"
] |
u562016607 | p03295 | python | s586441244 | s393447218 | 1,986 | 454 | 23,472 | 21,424 | Accepted | Accepted | 77.14 | N,M=list(map(int, input().split()))
G=[list() for i in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
a-=1
b-=1
G[a].append(b)
G[b].append(a)
ans=0
index=-1
for i in range(1,N):
for p in G[i]:
if index<p<i:
ans+=1
index=i-1
import t... | N,M=list(map(int, input().split()))
G=[list() for i in range(N)]
for i in range(M):
a,b=list(map(int,input().split()))
a-=1
b-=1
G[a].append(b)
G[b].append(a)
ans=0
index=-1
for i in range(1,N):
for p in G[i]:
if index<p<i:
ans+=1
index=i-1
... | 18 | 17 | 342 | 330 | N, M = list(map(int, input().split()))
G = [list() for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
ans = 0
index = -1
for i in range(1, N):
for p in G[i]:
if index < p < i:
ans += 1
index = i... | N, M = list(map(int, input().split()))
G = [list() for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
G[a].append(b)
G[b].append(a)
ans = 0
index = -1
for i in range(1, N):
for p in G[i]:
if index < p < i:
ans += 1
index = i... | false | 5.555556 | [
"-import time",
"-",
"-time.sleep(1.54)",
"+ break"
] | false | 1.244056 | 0.045043 | 27.619259 | [
"s586441244",
"s393447218"
] |
u672220554 | p02683 | python | s831809013 | s226448565 | 93 | 85 | 68,752 | 68,788 | Accepted | Accepted | 8.6 | N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
B = list(map(int, input().split()))
C.append(B[0])
L.append(B[1:])
res = 10 ** 9
for i in range(2 ** N):
c = 0
s = [0 for _ in range(M)]
for j in range(N):
if i >> j & 1:
c += C[j]
... | N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
B = list(map(int, input().split()))
C.append(B[0])
L.append(B[1:])
res = 10 ** 9
for i in range(2 ** N):
c = 0
s = [0 for _ in range(M)]
for j in range(N):
if i >> j & 1:
c += C[j]
... | 29 | 27 | 567 | 537 | N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
B = list(map(int, input().split()))
C.append(B[0])
L.append(B[1:])
res = 10**9
for i in range(2**N):
c = 0
s = [0 for _ in range(M)]
for j in range(N):
if i >> j & 1:
c += C[j]
for k in ran... | N, M, X = list(map(int, input().split()))
C = []
L = []
for i in range(N):
B = list(map(int, input().split()))
C.append(B[0])
L.append(B[1:])
res = 10**9
for i in range(2**N):
c = 0
s = [0 for _ in range(M)]
for j in range(N):
if i >> j & 1:
c += C[j]
for k in ran... | false | 6.896552 | [
"- f = 1",
"- f = 0",
"- if f:",
"+ else:"
] | false | 0.039113 | 0.046952 | 0.833049 | [
"s831809013",
"s226448565"
] |
u562935282 | p03078 | python | s184299527 | s031270401 | 1,884 | 571 | 208,700 | 8,692 | Accepted | Accepted | 69.69 | import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
d = [aa + bb for aa in a[:k] for bb in b[:k]]
d.sort(r... | import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
d = []
for ai, aa in enumerate(a, 1):
for bi, bb ... | 20 | 26 | 431 | 624 | import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
d = [aa + bb for aa in a[:k] for bb in b[:k]]
d.sort(reverse=True)
e = ... | import sys
input = sys.stdin.readline
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
d = []
for ai, aa in enumerate(a, 1):
for bi, bb in enumerate(b, 1)... | false | 23.076923 | [
"-d = [aa + bb for aa in a[:k] for bb in b[:k]]",
"+d = []",
"+for ai, aa in enumerate(a, 1):",
"+ for bi, bb in enumerate(b, 1):",
"+ for ci, cc in enumerate(c, 1):",
"+ if ai * bi * ci > k:",
"+ break",
"+ # (ai,bi,ci)より合計の大きい選び方がk通り以上存在する",
"+ ... | false | 0.066251 | 0.037574 | 1.763219 | [
"s184299527",
"s031270401"
] |
u089230684 | p02778 | python | s344887167 | s969175023 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | s = list(eval(input()))
for x in s:
s[s.index(x)] = "x"
s = str(s).replace(",", "").replace("'", "").replace("[", "").replace("]", "").replace(" ","")
print(s)
| str1=eval(input())
str2=list(str1)
print(('x'*len(str2))) | 5 | 4 | 162 | 53 | s = list(eval(input()))
for x in s:
s[s.index(x)] = "x"
s = (
str(s)
.replace(",", "")
.replace("'", "")
.replace("[", "")
.replace("]", "")
.replace(" ", "")
)
print(s)
| str1 = eval(input())
str2 = list(str1)
print(("x" * len(str2)))
| false | 20 | [
"-s = list(eval(input()))",
"-for x in s:",
"- s[s.index(x)] = \"x\"",
"-s = (",
"- str(s)",
"- .replace(\",\", \"\")",
"- .replace(\"'\", \"\")",
"- .replace(\"[\", \"\")",
"- .replace(\"]\", \"\")",
"- .replace(\" \", \"\")",
"-)",
"-print(s)",
"+str1 = eval(input())",... | false | 0.038531 | 0.03951 | 0.97521 | [
"s344887167",
"s969175023"
] |
u671060652 | p03210 | python | s768835265 | s892350995 | 255 | 67 | 63,852 | 61,840 | Accepted | Accepted | 73.73 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
if n ==7 or n ==5 or n == 3:
print("YES")
else: print("NO") | def main():
n = int(eval(input()))
# t, a = map(int, input().split())
# h = list(map(int, input().split()))
# s = input()
if n == 7 or n == 5 or n==3 :
print("YES")
else: print("NO")
if __name__ == '__main__':
main()
| 10 | 13 | 165 | 262 | import itertools
import math
import fractions
import functools
import copy
n = int(eval(input()))
if n == 7 or n == 5 or n == 3:
print("YES")
else:
print("NO")
| def main():
n = int(eval(input()))
# t, a = map(int, input().split())
# h = list(map(int, input().split()))
# s = input()
if n == 7 or n == 5 or n == 3:
print("YES")
else:
print("NO")
if __name__ == "__main__":
main()
| false | 23.076923 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ n = int(eval(input()))",
"+ # t, a = map(int, input().split())",
"+ # h = list(map(int, input().split()))",
"+ # s = input()",
"+ if n == 7 or n == 5 or n == 3:",
"+... | false | 0.045769 | 0.045317 | 1.009962 | [
"s768835265",
"s892350995"
] |
u695154284 | p00033 | python | s136147104 | s079878070 | 130 | 50 | 7,544 | 7,608 | Accepted | Accepted | 61.54 | N = int(eval(input()))
for testCase in range(N):
A = list(map(int, input().split()))
ok = False
for i in range(2 ** 10):
x = []
y = []
for j in range(10):
if i & (1 << j):
x.append(A[j])
else:
y.append(A[j])
... | def dfs(i, b, c):
if i == 11:
return (b == sorted(b) and c == sorted(c))
if dfs(i + 1, b + [balls[i - 1]], c):
return True
if dfs(i + 1, b, c + [balls[i - 1]]):
return True
return False
if __name__ == '__main__':
N = int(eval(input()))
for i in range(N... | 19 | 21 | 442 | 459 | N = int(eval(input()))
for testCase in range(N):
A = list(map(int, input().split()))
ok = False
for i in range(2**10):
x = []
y = []
for j in range(10):
if i & (1 << j):
x.append(A[j])
else:
y.append(A[j])
if x == sorted... | def dfs(i, b, c):
if i == 11:
return b == sorted(b) and c == sorted(c)
if dfs(i + 1, b + [balls[i - 1]], c):
return True
if dfs(i + 1, b, c + [balls[i - 1]]):
return True
return False
if __name__ == "__main__":
N = int(eval(input()))
for i in range(N):
balls = l... | false | 9.52381 | [
"-N = int(eval(input()))",
"-for testCase in range(N):",
"- A = list(map(int, input().split()))",
"- ok = False",
"- for i in range(2**10):",
"- x = []",
"- y = []",
"- for j in range(10):",
"- if i & (1 << j):",
"- x.append(A[j])",
"- ... | false | 0.167271 | 0.071743 | 2.331538 | [
"s136147104",
"s079878070"
] |
u119982147 | p03545 | python | s038377432 | s202246878 | 19 | 17 | 3,188 | 3,060 | Accepted | Accepted | 10.53 | N = list(eval(input()))
if int(N[0]) + int(N[1]) + int(N[2]) + int(N[3]) == 7:
print((N[0]+"+"+N[1]+"+"+N[2]+"+"+N[3]+"=7"))
elif int(N[0]) - int(N[1]) + int(N[2]) + int(N[3]) == 7:
print((N[0]+"-"+N[1]+"+"+N[2]+"+"+N[3]+"=7"))
elif int(N[0]) + int(N[1]) - int(N[2]) + int(N[3]) == 7:
print((N[0]+"+"... | s = str(eval(input()))
ans = 0
for i in range(1 << (len(s)-1)):
si = s[0]
for j in range(len(s)-1):
if i & (1 << j):
si += "+"+s[j+1]
else:
si += "-"+s[j+1]
if eval(si) == 7:
break
print((si+"=7")) | 20 | 13 | 890 | 262 | N = list(eval(input()))
if int(N[0]) + int(N[1]) + int(N[2]) + int(N[3]) == 7:
print((N[0] + "+" + N[1] + "+" + N[2] + "+" + N[3] + "=7"))
elif int(N[0]) - int(N[1]) + int(N[2]) + int(N[3]) == 7:
print((N[0] + "-" + N[1] + "+" + N[2] + "+" + N[3] + "=7"))
elif int(N[0]) + int(N[1]) - int(N[2]) + int(N[3]) == 7:... | s = str(eval(input()))
ans = 0
for i in range(1 << (len(s) - 1)):
si = s[0]
for j in range(len(s) - 1):
if i & (1 << j):
si += "+" + s[j + 1]
else:
si += "-" + s[j + 1]
if eval(si) == 7:
break
print((si + "=7"))
| false | 35 | [
"-N = list(eval(input()))",
"-if int(N[0]) + int(N[1]) + int(N[2]) + int(N[3]) == 7:",
"- print((N[0] + \"+\" + N[1] + \"+\" + N[2] + \"+\" + N[3] + \"=7\"))",
"-elif int(N[0]) - int(N[1]) + int(N[2]) + int(N[3]) == 7:",
"- print((N[0] + \"-\" + N[1] + \"+\" + N[2] + \"+\" + N[3] + \"=7\"))",
"-elif... | false | 0.049169 | 0.048958 | 1.004304 | [
"s038377432",
"s202246878"
] |
u498487134 | p03166 | python | s970326323 | s415950432 | 652 | 497 | 136,028 | 59,008 | Accepted | Accepted | 23.77 | import sys
sys.setrecursionlimit(10**5+5)
input = sys.stdin.readline
N,M=list(map(int,input().split()))
adj=[[] for _ in range(N)]
for i in range(M):
x,y=list(map(int,input().split()))
x-=1
y-=1
adj[x].append(y)
dp=[-1]*N#i番目絡みた最長経路
for i in range(N):
if len(adj[i])==0:
... | import sys
sys.setrecursionlimit(10**5+5)
input = sys.stdin.readline
N,M=list(map(int,input().split()))
adj=[[] for _ in range(N)]
for i in range(M):
x,y=list(map(int,input().split()))
x-=1
y-=1
adj[x].append(y)
dp=[0]*N#i番目絡みた最長経路
def rec(ii):
new=0
if len(adj[ii])==0:
... | 32 | 31 | 573 | 553 | import sys
sys.setrecursionlimit(10**5 + 5)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
adj[x].append(y)
dp = [-1] * N # i番目絡みた最長経路
for i in range(N):
if len(adj[i]) == 0:
... | import sys
sys.setrecursionlimit(10**5 + 5)
input = sys.stdin.readline
N, M = list(map(int, input().split()))
adj = [[] for _ in range(N)]
for i in range(M):
x, y = list(map(int, input().split()))
x -= 1
y -= 1
adj[x].append(y)
dp = [0] * N # i番目絡みた最長経路
def rec(ii):
new = 0
if len(adj[ii]) =... | false | 3.125 | [
"-dp = [-1] * N # i番目絡みた最長経路",
"-for i in range(N):",
"- if len(adj[i]) == 0:",
"- dp[i] = 0",
"+dp = [0] * N # i番目絡みた最長経路",
"+ if len(adj[ii]) == 0:",
"+ return 0",
"- if dp[to] != -1:",
"+ if dp[to] != 0:"
] | false | 0.037449 | 0.036144 | 1.036113 | [
"s970326323",
"s415950432"
] |
u492749916 | p02582 | python | s691259936 | s875847294 | 31 | 24 | 9,036 | 9,044 | Accepted | Accepted | 22.58 | S = str(eval(input()))
if S =="RRR":
ans = 3
elif S =="SRR" or S == "RRS":
ans = 2
else:
S = list(S)
if "R" in S:
ans = 1
else:
ans = 0
print(ans) | S= str(eval(input()))
if "RRR" in S:
print("3")
elif "RR" in S:
print("2")
elif "R" in S:
print("1")
else:
print("0") | 13 | 10 | 171 | 129 | S = str(eval(input()))
if S == "RRR":
ans = 3
elif S == "SRR" or S == "RRS":
ans = 2
else:
S = list(S)
if "R" in S:
ans = 1
else:
ans = 0
print(ans)
| S = str(eval(input()))
if "RRR" in S:
print("3")
elif "RR" in S:
print("2")
elif "R" in S:
print("1")
else:
print("0")
| false | 23.076923 | [
"-if S == \"RRR\":",
"- ans = 3",
"-elif S == \"SRR\" or S == \"RRS\":",
"- ans = 2",
"+if \"RRR\" in S:",
"+ print(\"3\")",
"+elif \"RR\" in S:",
"+ print(\"2\")",
"+elif \"R\" in S:",
"+ print(\"1\")",
"- S = list(S)",
"- if \"R\" in S:",
"- ans = 1",
"- el... | false | 0.036618 | 0.064009 | 0.572082 | [
"s691259936",
"s875847294"
] |
u089230684 | p02879 | python | s216287895 | s142966622 | 339 | 30 | 76,116 | 9,100 | Accepted | Accepted | 91.15 | s = input()
s = s.split(' ')
a, b = int(s[0]), int(s[1])
if 1 <= a <= 9 and 1 <= b <= 9:
print(a*b)
else:
print(-1)
| A,B=list(map(int,input().split()))
if A <=9 and B<=9 :
print((A*B))
else:
print((-1)) | 9 | 5 | 136 | 83 | s = input()
s = s.split(" ")
a, b = int(s[0]), int(s[1])
if 1 <= a <= 9 and 1 <= b <= 9:
print(a * b)
else:
print(-1)
| A, B = list(map(int, input().split()))
if A <= 9 and B <= 9:
print((A * B))
else:
print((-1))
| false | 44.444444 | [
"-s = input()",
"-s = s.split(\" \")",
"-a, b = int(s[0]), int(s[1])",
"-if 1 <= a <= 9 and 1 <= b <= 9:",
"- print(a * b)",
"+A, B = list(map(int, input().split()))",
"+if A <= 9 and B <= 9:",
"+ print((A * B))",
"- print(-1)",
"+ print((-1))"
] | false | 0.108306 | 0.034875 | 3.105548 | [
"s216287895",
"s142966622"
] |
u282228874 | p03061 | python | s121843002 | s951710844 | 1,503 | 213 | 14,196 | 16,152 | Accepted | Accepted | 85.83 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float('inf')
MOD = 10**9+7
n = int(eval(input()))
A = list(map(int,input().split()))
ass = set()
def div(x):
for i in range(1,int(x**0.5)+1):
if x%i == 0:
ass.add(i)
ass.add(x//i)
return ass
... | from fractions import gcd
N = int(eval(input()))
A = list(map(int,input().split()))
Gleft = [A[0]]
Gright = [A[-1]]
for i in range(1,N):
Gleft.append(gcd(Gleft[-1],A[i]))
Gright.append(gcd(Gright[-1],A[-1-i]))
Gright = Gright[::-1]
res = max(Gright[1],Gleft[-2])
for i in range(1,N-1):
res = max(r... | 28 | 13 | 511 | 357 | import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")
MOD = 10**9 + 7
n = int(eval(input()))
A = list(map(int, input().split()))
ass = set()
def div(x):
for i in range(1, int(x**0.5) + 1):
if x % i == 0:
ass.add(i)
ass.add(x // i)
return ass
a... | from fractions import gcd
N = int(eval(input()))
A = list(map(int, input().split()))
Gleft = [A[0]]
Gright = [A[-1]]
for i in range(1, N):
Gleft.append(gcd(Gleft[-1], A[i]))
Gright.append(gcd(Gright[-1], A[-1 - i]))
Gright = Gright[::-1]
res = max(Gright[1], Gleft[-2])
for i in range(1, N - 1):
res = max(r... | false | 53.571429 | [
"-import sys",
"+from fractions import gcd",
"-sys.setrecursionlimit(10**7)",
"-input = sys.stdin.readline",
"-INF = float(\"inf\")",
"-MOD = 10**9 + 7",
"-n = int(eval(input()))",
"+N = int(eval(input()))",
"-ass = set()",
"-",
"-",
"-def div(x):",
"- for i in range(1, int(x**0.5) + 1):"... | false | 0.037654 | 0.054999 | 0.684633 | [
"s121843002",
"s951710844"
] |
u059210959 | p02600 | python | s035641910 | s895729940 | 48 | 42 | 10,924 | 10,900 | Accepted | Accepted | 12.5 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.de... | 35 | 38 | 696 | 781 | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect # bisect_left これで二部探索の大小検索が行える
import fractions # 最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9 + 7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
... | false | 7.894737 | [
"+# X = int(input())",
"+# if 599 >= X:",
"+# ans = 8",
"+# elif 600 <= X <= 799:",
"+# ans = 7",
"+# elif 800 <= X <= 999:",
"+# ans = 6",
"+# elif 1000 <= X <= 1199:",
"+# ans = 5",
"+# elif 1200 <= X <= 1399:",
"+# ans = 4",
"+# elif 1400 <= X <= 1599:",
"+# ans = ... | false | 0.087708 | 0.096934 | 0.904822 | [
"s035641910",
"s895729940"
] |
u129749062 | p02695 | python | s474239262 | s544391668 | 1,825 | 1,363 | 9,196 | 74,164 | Accepted | Accepted | 25.32 | import itertools
N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for A in itertools.combinations_with_replacement(list(range(1, M+1)), N):
score = 0
for i in range(Q):
a = abcd[i][0]
b = abcd[i][1]
c = abcd[i][2]
d = abcd[i][3]
... | import itertools
N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for i in range(Q)]
total = []
for A in itertools.combinations_with_replacement(list(range(1, M+1)), N):
score = 0
for a,b,c,d in abcd:
if A[b-1]-A[a-1] == c:
score += d
total.append(score)
prin... | 15 | 11 | 389 | 322 | import itertools
N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for i in range(Q)]
ans = 0
for A in itertools.combinations_with_replacement(list(range(1, M + 1)), N):
score = 0
for i in range(Q):
a = abcd[i][0]
b = abcd[i][1]
c = abcd[i][2]
d =... | import itertools
N, M, Q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for i in range(Q)]
total = []
for A in itertools.combinations_with_replacement(list(range(1, M + 1)), N):
score = 0
for a, b, c, d in abcd:
if A[b - 1] - A[a - 1] == c:
score += d
tota... | false | 26.666667 | [
"-ans = 0",
"+total = []",
"- for i in range(Q):",
"- a = abcd[i][0]",
"- b = abcd[i][1]",
"- c = abcd[i][2]",
"- d = abcd[i][3]",
"+ for a, b, c, d in abcd:",
"- ans = max(ans, score)",
"-print(ans)",
"+ total.append(score)",
"+print((max(total)))"
... | false | 0.083315 | 0.049791 | 1.673272 | [
"s474239262",
"s544391668"
] |
u912237403 | p00067 | python | s760017320 | s513991938 | 20 | 10 | 4,280 | 4,300 | Accepted | Accepted | 50 | import sys
A=list(range(12))
m=[[0 for i in A] for j in A]
def f(y,x,d):
P=[]
x+=d[0]
y+=d[1]
if 0<=x<12 and 0<=y<12 and m[y][x]==1:
m[y][x]=c
P=[[y,x]]
return P
def v1(buf):
global c
while buf!=[]:
y,x=buf.pop()
m[y][x]=c
for e in [(-1... | import sys
A=list(range(14))
m=[[0 for i in A] for j in A]
def f(y,x):
if m[y][x]==1:
m[y][x]=0
f(y,x+1)
f(y,x-1)
f(y+1,x)
f(y-1,x)
return
def solve():
c=2
for i in A:
while m[i].count(1)>0:
f(i,m[i].index(1))
c+=1
... | 33 | 26 | 630 | 470 | import sys
A = list(range(12))
m = [[0 for i in A] for j in A]
def f(y, x, d):
P = []
x += d[0]
y += d[1]
if 0 <= x < 12 and 0 <= y < 12 and m[y][x] == 1:
m[y][x] = c
P = [[y, x]]
return P
def v1(buf):
global c
while buf != []:
y, x = buf.pop()
m[y][x] = ... | import sys
A = list(range(14))
m = [[0 for i in A] for j in A]
def f(y, x):
if m[y][x] == 1:
m[y][x] = 0
f(y, x + 1)
f(y, x - 1)
f(y + 1, x)
f(y - 1, x)
return
def solve():
c = 2
for i in A:
while m[i].count(1) > 0:
f(i, m[i].index(1))
... | false | 21.212121 | [
"-A = list(range(12))",
"+A = list(range(14))",
"-def f(y, x, d):",
"- P = []",
"- x += d[0]",
"- y += d[1]",
"- if 0 <= x < 12 and 0 <= y < 12 and m[y][x] == 1:",
"- m[y][x] = c",
"- P = [[y, x]]",
"- return P",
"-",
"-",
"-def v1(buf):",
"- global c",
"-... | false | 0.007917 | 0.039375 | 0.201057 | [
"s760017320",
"s513991938"
] |
u018679195 | p03481 | python | s759103361 | s399308922 | 21 | 18 | 3,188 | 2,940 | Accepted | Accepted | 14.29 | import re
c=eval(input())
clist=re.findall("\d+",c)
a=int(clist[0])
b=int(clist[1])
for i in range(1,b+1):
if a*(2**i)<=b:
continue
else:
print(i)
break | x, y = list(map(int, input().split()))
cnt = 0;
while x <= y:
cnt += 1
x *= 2
print(cnt) | 12 | 6 | 190 | 95 | import re
c = eval(input())
clist = re.findall("\d+", c)
a = int(clist[0])
b = int(clist[1])
for i in range(1, b + 1):
if a * (2**i) <= b:
continue
else:
print(i)
break
| x, y = list(map(int, input().split()))
cnt = 0
while x <= y:
cnt += 1
x *= 2
print(cnt)
| false | 50 | [
"-import re",
"-",
"-c = eval(input())",
"-clist = re.findall(\"\\d+\", c)",
"-a = int(clist[0])",
"-b = int(clist[1])",
"-for i in range(1, b + 1):",
"- if a * (2**i) <= b:",
"- continue",
"- else:",
"- print(i)",
"- break",
"+x, y = list(map(int, input().split())... | false | 0.054473 | 0.045464 | 1.198155 | [
"s759103361",
"s399308922"
] |
u094191970 | p02678 | python | s840906965 | s865097501 | 538 | 479 | 34,732 | 34,892 | Accepted | Accepted | 10.97 | from collections import deque
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
ans=[-1 for i in range(n)]
ans[0]=0
dq=deque()
dq.append(0)
while dq:
... | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque
n,m=nii()
tree=[[] for i in range(n)]
for i in range(m):
a,b=nii()
a-=1
b-=1
tree[a].append(b)
tree[b].append(a)
ans=[-1 for i in range(n... | 29 | 34 | 456 | 559 | from collections import deque
from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
ans = [-1 for i in range(n)]
ans[0] = 0
dq = deque()
dq.append(0)
w... | from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
from collections import deque
n, m = nii()
tree = [[] for i in range(n)]
for i in range(m):
a, b = nii()
a -= 1
b -= 1
tree[a].append(b)
tree[b].append(a)
ans = [-1 ... | false | 14.705882 | [
"-from collections import deque",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"+from collections import deque",
"+",
"-ans[0] = 0",
"-dq = deque()",
"-dq.append(0)",
"-while dq:",
"- x = dq.popleft()",
"+ans[0] = 1",
"+que = deque()",
"+que.append(0)",
"+while que:",
"+ ... | false | 0.037682 | 0.044166 | 0.853185 | [
"s840906965",
"s865097501"
] |
u562935282 | p03364 | python | s827262677 | s785119947 | 1,594 | 434 | 138,152 | 40,816 | Accepted | Accepted | 72.77 | def is_good_grid():
for r in range(n):
for c in range(r):
if t[r][c] != t[c][r]:
return False
return True
n = int(eval(input()))
s = tuple(eval(input()) for _ in range(n))
# (0,0)==(1,1)==...==(n-1,n-1)
# colのオフセットだけ変化させる
# それぞれのループで、n個の状態(0,k)==(1,k+1)==...を扱... | def is_good_grid(sft):
for r in range(n):
r_ = (r - sft) % n # 減算に直した
for c in range(r):
c_ = (c - sft) % n # 減算に直した
if s[r][c_] != s[c][r_]:
# kマス列シフトした後の(r,c)と(c,r)の一致を見るには、
# (r,c)と(c,r)それぞれの列シフト前、つまり列-sftの座標を見る必要がある
... | 24 | 25 | 526 | 634 | def is_good_grid():
for r in range(n):
for c in range(r):
if t[r][c] != t[c][r]:
return False
return True
n = int(eval(input()))
s = tuple(eval(input()) for _ in range(n))
# (0,0)==(1,1)==...==(n-1,n-1)
# colのオフセットだけ変化させる
# それぞれのループで、n個の状態(0,k)==(1,k+1)==...を扱う
ans = 0
for ... | def is_good_grid(sft):
for r in range(n):
r_ = (r - sft) % n # 減算に直した
for c in range(r):
c_ = (c - sft) % n # 減算に直した
if s[r][c_] != s[c][r_]:
# kマス列シフトした後の(r,c)と(c,r)の一致を見るには、
# (r,c)と(c,r)それぞれの列シフト前、つまり列-sftの座標を見る必要がある
# r_を用... | false | 4 | [
"-def is_good_grid():",
"+def is_good_grid(sft):",
"+ r_ = (r - sft) % n # 減算に直した",
"- if t[r][c] != t[c][r]:",
"+ c_ = (c - sft) % n # 減算に直した",
"+ if s[r][c_] != s[c][r_]:",
"+ # kマス列シフトした後の(r,c)と(c,r)の一致を見るには、",
"+ # (r,c)と(c,r)... | false | 0.036953 | 0.040414 | 0.914351 | [
"s827262677",
"s785119947"
] |
u941407962 | p02763 | python | s407267460 | s205605071 | 1,008 | 920 | 164,636 | 164,952 | Accepted | Accepted | 8.73 | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
... | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
... | 51 | 49 | 1,175 | 1,107 | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(sel... | import sys
input = sys.stdin.readline
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
if i == 0:
return 0
s = 0
while i > 0:
s += self.tree[i]
i -= i & -i
return s
def add(sel... | false | 3.921569 | [
"-S = list(input().strip())",
"+S = [\" \"] + list(input().strip())",
"-MX = 5 * 10**5 + 2",
"- cbt[c] = Bit(MX)",
"+ cbt[c] = Bit(N)",
"+ if i == 0:",
"+ continue",
"- cbt[c].add(i + 1, 1)",
"+ cbt[c].add(i, 1)",
"- if S[i - 1] != c:",
"- ... | false | 0.574904 | 0.116716 | 4.925653 | [
"s407267460",
"s205605071"
] |
u994988729 | p03352 | python | s166442805 | s427855049 | 23 | 17 | 2,940 | 2,940 | Accepted | Accepted | 26.09 | X = int(eval(input()))
ans = 0
for i in range(1, 100):
for j in range(2, 100):
if i ** j <= X:
ans = max(ans, i ** j)
print(ans)
| X = int(eval(input()))
ans = 1
for b in range(2, 40):
p = 2
while True:
val = b ** p
if val > X:
break
ans = max(ans, val)
p += 1
print(ans)
| 9 | 13 | 157 | 201 | X = int(eval(input()))
ans = 0
for i in range(1, 100):
for j in range(2, 100):
if i**j <= X:
ans = max(ans, i**j)
print(ans)
| X = int(eval(input()))
ans = 1
for b in range(2, 40):
p = 2
while True:
val = b**p
if val > X:
break
ans = max(ans, val)
p += 1
print(ans)
| false | 30.769231 | [
"-ans = 0",
"-for i in range(1, 100):",
"- for j in range(2, 100):",
"- if i**j <= X:",
"- ans = max(ans, i**j)",
"+ans = 1",
"+for b in range(2, 40):",
"+ p = 2",
"+ while True:",
"+ val = b**p",
"+ if val > X:",
"+ break",
"+ ans =... | false | 0.056359 | 0.045433 | 1.240486 | [
"s166442805",
"s427855049"
] |
u389910364 | p03779 | python | s583002598 | s825949196 | 176 | 160 | 13,664 | 13,596 | Accepted | Accepted | 9.09 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator imp... | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator imp... | 34 | 37 | 637 | 712 | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter... | import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter... | false | 8.108108 | [
"-ans = 0",
"-x = 1",
"-s = 0",
"-while s < X:",
"- s += x",
"- x += 1",
"-print((x - 1))",
"+print((int(math.ceil((-1 + math.sqrt(1 + 8 * X)) / 2))))",
"+# ans = 0",
"+# x = 1",
"+# s = 0",
"+# while s < X:",
"+# s += x",
"+# x += 1",
"+# print(x - 1)",
"+#"
] | false | 0.042075 | 0.045413 | 0.926496 | [
"s583002598",
"s825949196"
] |
u324314500 | p03036 | python | s009902607 | s218686504 | 186 | 167 | 38,384 | 38,256 | Accepted | Accepted | 10.22 | import sys
#import numpy as np
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for ... | import sys
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss ... | 20 | 19 | 522 | 573 | import sys
# import numpy as np
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in ran... | import sys
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambd... | false | 5 | [
"-# import numpy as np",
"+ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]",
"- for _ in range(10):",
"- x = (r * x) - D",
"+ for i in range(10):",
"+ x = r * x - D"
] | false | 0.051389 | 0.047741 | 1.076415 | [
"s009902607",
"s218686504"
] |
u767664985 | p03524 | python | s344764877 | s518470864 | 26 | 18 | 3,444 | 3,188 | Accepted | Accepted | 30.77 | from collections import Counter
S = eval(input())
c = Counter(S)
if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:
print("YES")
elif len(c) == 2 and len(S) == 2:
print("YES")
elif len(c) == 1 and len(S) == 1:
print("YES")
else:
print("NO")
| S = eval(input())
x = (S.count("a"), S.count("b"), S.count("c"))
if max(x) - min(x) >= 2:
print("NO")
else:
print("YES")
| 13 | 7 | 273 | 130 | from collections import Counter
S = eval(input())
c = Counter(S)
if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:
print("YES")
elif len(c) == 2 and len(S) == 2:
print("YES")
elif len(c) == 1 and len(S) == 1:
print("YES")
else:
print("NO")
| S = eval(input())
x = (S.count("a"), S.count("b"), S.count("c"))
if max(x) - min(x) >= 2:
print("NO")
else:
print("YES")
| false | 46.153846 | [
"-from collections import Counter",
"-",
"-c = Counter(S)",
"-if len(c) == 3 and max(c.values()) - min(c.values()) <= 1:",
"+x = (S.count(\"a\"), S.count(\"b\"), S.count(\"c\"))",
"+if max(x) - min(x) >= 2:",
"+ print(\"NO\")",
"+else:",
"-elif len(c) == 2 and len(S) == 2:",
"- print(\"YES\"... | false | 0.084288 | 0.079732 | 1.05714 | [
"s344764877",
"s518470864"
] |
u634159866 | p03013 | python | s804660337 | s648743115 | 476 | 181 | 460,020 | 7,824 | Accepted | Accepted | 61.97 | N, M = list(map(int, input().split()))
List = [int(eval(input())) for _ in range(M)]
P = 10**9+7
dp = [1]*(N+1)
for i in List:
dp[i]=0
for j in range(1, N):
if dp[j+1]!=0:
dp[j+1] = dp[j]+dp[j-1]
print((dp[N]%P)) | N, M = list(map(int, input().split()))
List = [int(eval(input())) for _ in range(M)]
P = 10**9+7
dp = [1]*(N+1)
for i in List:
dp[i]=0
for j in range(1, N):
if dp[j+1]!=0:
dp[j+1] = (dp[j]+dp[j-1])%P
print((dp[N])) | 14 | 14 | 239 | 241 | N, M = list(map(int, input().split()))
List = [int(eval(input())) for _ in range(M)]
P = 10**9 + 7
dp = [1] * (N + 1)
for i in List:
dp[i] = 0
for j in range(1, N):
if dp[j + 1] != 0:
dp[j + 1] = dp[j] + dp[j - 1]
print((dp[N] % P))
| N, M = list(map(int, input().split()))
List = [int(eval(input())) for _ in range(M)]
P = 10**9 + 7
dp = [1] * (N + 1)
for i in List:
dp[i] = 0
for j in range(1, N):
if dp[j + 1] != 0:
dp[j + 1] = (dp[j] + dp[j - 1]) % P
print((dp[N]))
| false | 0 | [
"- dp[j + 1] = dp[j] + dp[j - 1]",
"-print((dp[N] % P))",
"+ dp[j + 1] = (dp[j] + dp[j - 1]) % P",
"+print((dp[N]))"
] | false | 0.040529 | 0.03695 | 1.096862 | [
"s804660337",
"s648743115"
] |
u932465688 | p03221 | python | s184009728 | s882884195 | 867 | 709 | 36,228 | 36,840 | Accepted | Accepted | 18.22 | N,M = list(map(int,input().split()))
L = []
for i in range(M):
L.append(list(map(int,input().split())))
for j in range(M):
L[j].append(j)
L.sort()
l = L[0][0]
cnt = 0
for k in range(M):
if l == L[k][0]:
cnt += 1
L[k].append(cnt)
else:
l = L[k][0]
cnt = 1
L[k].append(cnt)
L =... | N,M = list(map(int,input().split()))
L = []
for i in range(M):
L.append(list(map(int,input().split())))
for i in range(M):
L[i].append(i)
cnt = [0]*N
L = sorted(L, key = lambda x:x[1])
for i in range(M):
L[i].append(cnt[L[i][0]-1])
cnt[L[i][0]-1] += 1
L = sorted(L, key = lambda x:x[2])
for i in rang... | 20 | 15 | 454 | 386 | N, M = list(map(int, input().split()))
L = []
for i in range(M):
L.append(list(map(int, input().split())))
for j in range(M):
L[j].append(j)
L.sort()
l = L[0][0]
cnt = 0
for k in range(M):
if l == L[k][0]:
cnt += 1
L[k].append(cnt)
else:
l = L[k][0]
cnt = 1
L[k].a... | N, M = list(map(int, input().split()))
L = []
for i in range(M):
L.append(list(map(int, input().split())))
for i in range(M):
L[i].append(i)
cnt = [0] * N
L = sorted(L, key=lambda x: x[1])
for i in range(M):
L[i].append(cnt[L[i][0] - 1])
cnt[L[i][0] - 1] += 1
L = sorted(L, key=lambda x: x[2])
for i in r... | false | 25 | [
"-for j in range(M):",
"- L[j].append(j)",
"-L.sort()",
"-l = L[0][0]",
"-cnt = 0",
"-for k in range(M):",
"- if l == L[k][0]:",
"- cnt += 1",
"- L[k].append(cnt)",
"- else:",
"- l = L[k][0]",
"- cnt = 1",
"- L[k].append(cnt)",
"+for i in range(M... | false | 0.154334 | 0.158239 | 0.975321 | [
"s184009728",
"s882884195"
] |
u497805118 | p02713 | python | s044282568 | s005714945 | 1,034 | 524 | 9,148 | 67,728 | Accepted | Accepted | 49.32 | import itertools
import math
k = int(eval(input()))
x = 0
for v in itertools.combinations_with_replacement(list(range(1, k+1)), 3):
a, b, c = v
x = x + math.gcd(math.gcd(a,b), c)
y = 0
for v in itertools.combinations(list(range(1, k+1)), 3):
a, b, c = v
y = y + math.gcd(math.gcd(a,b), c)
... | import math
k = int(eval(input()))
cache = {}
ans = 0
for a in range(1, k+1):
for b in range(1, k+1):
for c in range(1, k+1):
ans = ans + cache.get( (a,b,c), math.gcd(math.gcd(a, b), c))
print(ans) | 16 | 11 | 374 | 229 | import itertools
import math
k = int(eval(input()))
x = 0
for v in itertools.combinations_with_replacement(list(range(1, k + 1)), 3):
a, b, c = v
x = x + math.gcd(math.gcd(a, b), c)
y = 0
for v in itertools.combinations(list(range(1, k + 1)), 3):
a, b, c = v
y = y + math.gcd(math.gcd(a, b), c)
z = k * ... | import math
k = int(eval(input()))
cache = {}
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans = ans + cache.get((a, b, c), math.gcd(math.gcd(a, b), c))
print(ans)
| false | 31.25 | [
"-import itertools",
"-x = 0",
"-for v in itertools.combinations_with_replacement(list(range(1, k + 1)), 3):",
"- a, b, c = v",
"- x = x + math.gcd(math.gcd(a, b), c)",
"-y = 0",
"-for v in itertools.combinations(list(range(1, k + 1)), 3):",
"- a, b, c = v",
"- y = y + math.gcd(math.gcd(... | false | 0.094674 | 0.090429 | 1.046935 | [
"s044282568",
"s005714945"
] |
u562015767 | p03673 | python | s129906610 | s335810865 | 175 | 153 | 42,908 | 117,048 | Accepted | Accepted | 12.57 | n = int(eval(input()))
l = list(map(int,input().split()))
if n == 1:
l = list(map(str,l))
print((" ".join(l)))
exit()
2
ans = []
if n%2 == 0:
tmp = n
for j in range(n//2-1):
ans.append(tmp)
tmp -= 2
ans.append(tmp)
ans.append(1)
tmp = 1
for j in ... | n = int(eval(input()))
l = list(map(int,input().split()))
if n == 1:
l = list(map(str,l))
print((" ".join(l)))
exit()
ans = []
if n%2 == 0:
tmp = n
for j in range(n//2-1):
ans.append(tmp)
tmp -= 2
ans.append(tmp)
ans.append(1)
tmp = 1
for j in ran... | 41 | 40 | 673 | 671 | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 1:
l = list(map(str, l))
print((" ".join(l)))
exit()
2
ans = []
if n % 2 == 0:
tmp = n
for j in range(n // 2 - 1):
ans.append(tmp)
tmp -= 2
ans.append(tmp)
ans.append(1)
tmp = 1
for j in range(n // 2 -... | n = int(eval(input()))
l = list(map(int, input().split()))
if n == 1:
l = list(map(str, l))
print((" ".join(l)))
exit()
ans = []
if n % 2 == 0:
tmp = n
for j in range(n // 2 - 1):
ans.append(tmp)
tmp -= 2
ans.append(tmp)
ans.append(1)
tmp = 1
for j in range(n // 2 - 1... | false | 2.439024 | [
"-2"
] | false | 0.043133 | 0.113425 | 0.380275 | [
"s129906610",
"s335810865"
] |
u533232830 | p02948 | python | s813525789 | s608908509 | 479 | 304 | 26,016 | 88,740 | Accepted | Accepted | 36.53 | import heapq
n, m = list(map(int, input().split()))
dic = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a >= m+1:
continue
if a in list(dic.keys()):
dic[a].append(b)
else:
dic[a] = [b]
ans = 0
l = []
heapq.heapify(l)
for j in range(1, m+1):
... | import heapq
n, m = list(map(int, input().split()))
memo = [[] for _ in range(m+1)]
for _ in range(n):
a, b = list(map(int ,input().split()))
if a <= m:
memo[a].append(-b)
ans = 0
HQ = []
heapq.heapify(HQ)
for i in range(1, m+1):
for j in memo[i]:
heapq.heappush(HQ, j)
... | 26 | 20 | 459 | 364 | import heapq
n, m = list(map(int, input().split()))
dic = {}
for i in range(n):
a, b = list(map(int, input().split()))
if a >= m + 1:
continue
if a in list(dic.keys()):
dic[a].append(b)
else:
dic[a] = [b]
ans = 0
l = []
heapq.heapify(l)
for j in range(1, m + 1):
if j in list... | import heapq
n, m = list(map(int, input().split()))
memo = [[] for _ in range(m + 1)]
for _ in range(n):
a, b = list(map(int, input().split()))
if a <= m:
memo[a].append(-b)
ans = 0
HQ = []
heapq.heapify(HQ)
for i in range(1, m + 1):
for j in memo[i]:
heapq.heappush(HQ, j)
if HQ:
... | false | 23.076923 | [
"-dic = {}",
"-for i in range(n):",
"+memo = [[] for _ in range(m + 1)]",
"+for _ in range(n):",
"- if a >= m + 1:",
"- continue",
"- if a in list(dic.keys()):",
"- dic[a].append(b)",
"- else:",
"- dic[a] = [b]",
"+ if a <= m:",
"+ memo[a].append(-b)",
... | false | 0.061319 | 0.075921 | 0.807674 | [
"s813525789",
"s608908509"
] |
u745087332 | p03290 | python | s013116495 | s797279196 | 46 | 23 | 3,064 | 3,064 | Accepted | Accepted | 50 | # coding:utf-8
INF = float('inf')
def inpl(): return list(map(int, input().split()))
D, G = inpl()
P, C = [], []
for i in range(D):
p, c = inpl()
P.append(p)
C.append(c + 100 * (i + 1) * p)
ans = INF
for i in range(2 ** D):
point = 0
cnt = 0
rest_max = 0
for shift i... | # coding:utf-8
import sys
INF = float('inf')
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return eval(i... | 39 | 51 | 718 | 1,028 | # coding:utf-8
INF = float("inf")
def inpl():
return list(map(int, input().split()))
D, G = inpl()
P, C = [], []
for i in range(D):
p, c = inpl()
P.append(p)
C.append(c + 100 * (i + 1) * p)
ans = INF
for i in range(2**D):
point = 0
cnt = 0
rest_max = 0
for shift in range(D):
... | # coding:utf-8
import sys
INF = float("inf")
MOD = 10**9 + 7
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def LI_():
return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS():
return sys.stdin.readline().split()
def II():
return int(sys.stdin.readline())
def SI():
... | false | 23.529412 | [
"+import sys",
"+",
"+MOD = 10**9 + 7",
"-def inpl():",
"- return list(map(int, input().split()))",
"+def LI():",
"+ return [int(x) for x in sys.stdin.readline().split()]",
"-D, G = inpl()",
"-P, C = [], []",
"-for i in range(D):",
"- p, c = inpl()",
"- P.append(p)",
"- C.appe... | false | 0.047435 | 0.039771 | 1.192714 | [
"s013116495",
"s797279196"
] |
u285681431 | p03599 | python | s319030237 | s213642287 | 143 | 131 | 18,332 | 18,312 | Accepted | Accepted | 8.39 | # 35行目. >だと1ケース通らずWA, >=だとAC. なんで?????
A, B, C, D, E, F = list(map(int, input().split()))
# 可能な水の総量
water_list = []
A_max = F // (100 * A)
B_max = F // (100 * B)
for i in range(A_max + 1):
for j in range(B_max + 1):
temp = 100 * A * i + 100 * B * j
if temp <= F:
water_list.... | A, B, C, D, E, F = list(map(int, input().split()))
# 可能な水の総量
water_list = []
A_max = F // (100 * A)
B_max = F // (100 * B)
for i in range(A_max + 1):
for j in range(B_max + 1):
temp = 100 * A * i + 100 * B * j
if temp <= F:
water_list.append(temp)
water_list = list(set(water_... | 41 | 40 | 1,128 | 1,141 | # 35行目. >だと1ケース通らずWA, >=だとAC. なんで?????
A, B, C, D, E, F = list(map(int, input().split()))
# 可能な水の総量
water_list = []
A_max = F // (100 * A)
B_max = F // (100 * B)
for i in range(A_max + 1):
for j in range(B_max + 1):
temp = 100 * A * i + 100 * B * j
if temp <= F:
water_list.append(temp)
w... | A, B, C, D, E, F = list(map(int, input().split()))
# 可能な水の総量
water_list = []
A_max = F // (100 * A)
B_max = F // (100 * B)
for i in range(A_max + 1):
for j in range(B_max + 1):
temp = 100 * A * i + 100 * B * j
if temp <= F:
water_list.append(temp)
water_list = list(set(water_list))
# 可能な... | false | 2.439024 | [
"-# 35行目. >だと1ケース通らずWA, >=だとAC. なんで?????",
"-max_conc = 0",
"-max_conc_water = 0",
"-max_conc_sugar = 0",
"+# max_conc=0から始めると0%の場合を拾えなくなる. あるいは34行目で等号をつけても良い.",
"+max_conc = -1",
"+max_conc_water = -1",
"+max_conc_sugar = -1",
"- if conc >= max_conc:",
"+ if conc > max_conc:... | false | 0.070876 | 0.074207 | 0.955122 | [
"s319030237",
"s213642287"
] |
u223663729 | p02697 | python | s704718201 | s963285974 | 94 | 79 | 18,780 | 9,212 | Accepted | Accepted | 15.96 | N, M = list(map(int, input().split()))
A = list(range(M))
B = list(range(M, 2*M))[::-1]
B = [-2-i for i in range(M//2)] + B[M//2:]
for a, b in zip(A, B):
print((a % N + 1, b % N + 1))
| N, M = list(map(int, input().split()))
if M & 1:
print((M, M+1))
m=M//2
for i in range(m):
print((i+1, (-2-i)%N+1))
print((i+m+1, 2*M-m-i))
| 8 | 7 | 189 | 146 | N, M = list(map(int, input().split()))
A = list(range(M))
B = list(range(M, 2 * M))[::-1]
B = [-2 - i for i in range(M // 2)] + B[M // 2 :]
for a, b in zip(A, B):
print((a % N + 1, b % N + 1))
| N, M = list(map(int, input().split()))
if M & 1:
print((M, M + 1))
m = M // 2
for i in range(m):
print((i + 1, (-2 - i) % N + 1))
print((i + m + 1, 2 * M - m - i))
| false | 12.5 | [
"-A = list(range(M))",
"-B = list(range(M, 2 * M))[::-1]",
"-B = [-2 - i for i in range(M // 2)] + B[M // 2 :]",
"-for a, b in zip(A, B):",
"- print((a % N + 1, b % N + 1))",
"+if M & 1:",
"+ print((M, M + 1))",
"+m = M // 2",
"+for i in range(m):",
"+ print((i + 1, (-2 - i) % N + 1))",
... | false | 0.036368 | 0.039342 | 0.924407 | [
"s704718201",
"s963285974"
] |
u483005329 | p03030 | python | s527051469 | s723075273 | 19 | 17 | 3,064 | 3,064 | Accepted | Accepted | 10.53 | def irekae(array2):
return [array2[1],array2[0],array2[2]]
n=int(eval(input()))
l=[input().split() for i in range(n)]
"""
# print(l)
for i in range(len(l)):
l[i].append(i+1)
l[i][1]=int(l[i][1])
# print(l)
l.sort()
# print(l)
for i in range(len(l)):
l[i]=irekae(l[i])
# print(l)
lsort=[]... | def irekae(array2):
return [array2[1],array2[0],array2[2]]
n=int(eval(input()))
l=[input().split() for i in range(n)]
for i in range(len(l)):
l[i].append(i+1)
l[i][1]=int(l[i][1])
for i in range(len(l)):
l[i]=irekae(l[i])
l.sort(reverse=True)
for i in range(len(l)):
l[i]=irekae(l[i])
lx=... | 35 | 15 | 655 | 389 | def irekae(array2):
return [array2[1], array2[0], array2[2]]
n = int(eval(input()))
l = [input().split() for i in range(n)]
"""
# print(l)
for i in range(len(l)):
l[i].append(i+1)
l[i][1]=int(l[i][1])
# print(l)
l.sort()
# print(l)
for i in range(len(l)):
l[i]=irekae(l[i])
# print(l)
lsort=[]
while l!... | def irekae(array2):
return [array2[1], array2[0], array2[2]]
n = int(eval(input()))
l = [input().split() for i in range(n)]
for i in range(len(l)):
l[i].append(i + 1)
l[i][1] = int(l[i][1])
for i in range(len(l)):
l[i] = irekae(l[i])
l.sort(reverse=True)
for i in range(len(l)):
l[i] = irekae(l[i])... | false | 57.142857 | [
"-\"\"\"",
"-# print(l)",
"-for i in range(len(l)):",
"- l[i].append(i+1)",
"- l[i][1]=int(l[i][1])",
"-# print(l)",
"-l.sort()",
"-# print(l)",
"-for i in range(len(l)):",
"- l[i]=irekae(l[i])",
"-# print(l)",
"-lsort=[]",
"-while l!=[]:",
"- \"\"\"",
"-# print(l)",
"-# pr... | false | 0.037459 | 0.03797 | 0.986544 | [
"s527051469",
"s723075273"
] |
u057109575 | p02630 | python | s275355833 | s266888674 | 370 | 332 | 105,912 | 107,624 | Accepted | Accepted | 10.27 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
Q = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(Q)]
ctr = Counter(A)
ans = sum(A)
for b, c in X:
v = ctr[b]
ans = ans - b * v + c * v
ctr[b] -= v
ctr[c] += v
print(an... |
from collections import Counter
N = int(eval(input()))
X = list(map(int, input().split()))
Q = int(eval(input()))
Y = [list(map(int, input().split())) for _ in range(Q)]
ctr = Counter(X)
ans = sum(X)
for b, c in Y:
n = ctr[b]
ctr[b] = 0
ctr[c] += n
ans = ans - b * n + c * n
print(a... | 15 | 16 | 311 | 312 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
Q = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(Q)]
ctr = Counter(A)
ans = sum(A)
for b, c in X:
v = ctr[b]
ans = ans - b * v + c * v
ctr[b] -= v
ctr[c] += v
print(ans)
| from collections import Counter
N = int(eval(input()))
X = list(map(int, input().split()))
Q = int(eval(input()))
Y = [list(map(int, input().split())) for _ in range(Q)]
ctr = Counter(X)
ans = sum(X)
for b, c in Y:
n = ctr[b]
ctr[b] = 0
ctr[c] += n
ans = ans - b * n + c * n
print(ans)
| false | 6.25 | [
"-A = list(map(int, input().split()))",
"+X = list(map(int, input().split()))",
"-X = [list(map(int, input().split())) for _ in range(Q)]",
"-ctr = Counter(A)",
"-ans = sum(A)",
"-for b, c in X:",
"- v = ctr[b]",
"- ans = ans - b * v + c * v",
"- ctr[b] -= v",
"- ctr[c] += v",
"+Y = ... | false | 0.051262 | 0.0723 | 0.709025 | [
"s275355833",
"s266888674"
] |
u729133443 | p03177 | python | s802565247 | s590296334 | 1,876 | 1,478 | 75,740 | 15,824 | Accepted | Accepted | 21.22 | M=10**9+7
(n,k),*a=[list(map(int,t.split()))for t in open(0)]
r=a if k&1else[[i==j for j in range(n)]for i in range(n)]
d=a
for i in range(1,k.bit_length()):
p=[]
for y in d:
q=[0]*n
for x,s in zip(y,d):
for j,t in enumerate(s):
q[j]+=t*x%M
p+=q,
d=p
if 1<<i&k:
p=[]
... | from numpy import*
(n,k),*a=[list(map(int,t.split()))for t in open(0)]
a=matrix(a,'O')
M=10**9+7
s=1
while k:s*=~k%2or a;k//=2;a=a*a%M
print((sum(s)%M)) | 23 | 7 | 496 | 156 | M = 10**9 + 7
(n, k), *a = [list(map(int, t.split())) for t in open(0)]
r = a if k & 1 else [[i == j for j in range(n)] for i in range(n)]
d = a
for i in range(1, k.bit_length()):
p = []
for y in d:
q = [0] * n
for x, s in zip(y, d):
for j, t in enumerate(s):
q[j] += ... | from numpy import *
(n, k), *a = [list(map(int, t.split())) for t in open(0)]
a = matrix(a, "O")
M = 10**9 + 7
s = 1
while k:
s *= ~k % 2 or a
k //= 2
a = a * a % M
print((sum(s) % M))
| false | 69.565217 | [
"+from numpy import *",
"+",
"+(n, k), *a = [list(map(int, t.split())) for t in open(0)]",
"+a = matrix(a, \"O\")",
"-(n, k), *a = [list(map(int, t.split())) for t in open(0)]",
"-r = a if k & 1 else [[i == j for j in range(n)] for i in range(n)]",
"-d = a",
"-for i in range(1, k.bit_length()):",
"-... | false | 0.119903 | 0.776747 | 0.154366 | [
"s802565247",
"s590296334"
] |
u536034761 | p02888 | python | s556362577 | s934221473 | 1,106 | 983 | 9,492 | 9,372 | Accepted | Accepted | 11.12 | import bisect
from copy import deepcopy
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(N):
for j in range(i + 1, N - 1):
b = L[j] + L[i]
x = bisect.bisect_left(L, b) - j - 1
if x > 0:
ans += x
print(ans)
| import bisect
n = int(eval(input()))
L = sorted(map(int, input().split()))
m = L[-1]
ans = 0
for i in range(n):
for j in range(i + 1, n):
k = L[i] + L[j]
ans += bisect.bisect_left(L, k) - j-1
print(ans)
| 14 | 10 | 290 | 226 | import bisect
from copy import deepcopy
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(N):
for j in range(i + 1, N - 1):
b = L[j] + L[i]
x = bisect.bisect_left(L, b) - j - 1
if x > 0:
ans += x
print(ans)
| import bisect
n = int(eval(input()))
L = sorted(map(int, input().split()))
m = L[-1]
ans = 0
for i in range(n):
for j in range(i + 1, n):
k = L[i] + L[j]
ans += bisect.bisect_left(L, k) - j - 1
print(ans)
| false | 28.571429 | [
"-from copy import deepcopy",
"-N = int(eval(input()))",
"+n = int(eval(input()))",
"+m = L[-1]",
"-for i in range(N):",
"- for j in range(i + 1, N - 1):",
"- b = L[j] + L[i]",
"- x = bisect.bisect_left(L, b) - j - 1",
"- if x > 0:",
"- ans += x",
"+for i in ra... | false | 0.081291 | 0.065214 | 1.246528 | [
"s556362577",
"s934221473"
] |
u581187895 | p02971 | python | s463925439 | s437235747 | 568 | 519 | 14,112 | 15,748 | Accepted | Accepted | 8.63 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
for i in range(N):
if A[i] == B[-1]:
print((B[-2]))
else:
print((B[-1])) | N = int(input())
A = [int(input()) for _ in range(N)]
second, first = sorted(A)[-2:]
ans = [second if a==first else first for a in A]
[print(a) for a in ans]
| 9 | 6 | 157 | 163 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A)
for i in range(N):
if A[i] == B[-1]:
print((B[-2]))
else:
print((B[-1]))
| N = int(input())
A = [int(input()) for _ in range(N)]
second, first = sorted(A)[-2:]
ans = [second if a == first else first for a in A]
[print(a) for a in ans]
| false | 33.333333 | [
"-N = int(eval(input()))",
"-A = [int(eval(input())) for _ in range(N)]",
"-B = sorted(A)",
"-for i in range(N):",
"- if A[i] == B[-1]:",
"- print((B[-2]))",
"- else:",
"- print((B[-1]))",
"+N = int(input())",
"+A = [int(input()) for _ in range(N)]",
"+second, first = sorted(... | false | 0.068891 | 0.056334 | 1.222908 | [
"s463925439",
"s437235747"
] |
u334712262 | p02834 | python | s951807363 | s666617601 | 630 | 329 | 119,768 | 141,560 | Accepted | Accepted | 47.78 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, produc... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 116 | 119 | 2,273 | 2,210 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permut... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 2.521008 | [
"-import sys",
"+from fractions import Fraction",
"-from itertools import combinations, combinations_with_replacement, product, permutations",
"-from operator import add, mul, sub",
"+from itertools import (",
"+ combinations,",
"+ combinations_with_replacement,",
"+ product,",
"+ permut... | false | 0.068736 | 0.063741 | 1.078363 | [
"s951807363",
"s666617601"
] |
u588341295 | p03608 | python | s358033743 | s892886977 | 570 | 438 | 73,304 | 54,236 | Accepted | Accepted | 23.16 | # -*- coding: utf-8 -*-
from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
G = [[float('inf')] * (N) for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
# 経路情報は隣接行列に保持する(無向グラフなので両方向)
G[a-1][b-1] = c
G[... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 32 | 67 | 796 | 1,938 | # -*- coding: utf-8 -*-
from itertools import permutations
N, M, R = list(map(int, input().split()))
r = list(map(int, input().split()))
G = [[float("inf")] * (N) for _ in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
# 経路情報は隣接行列に保持する(無向グラフなので両方向)
G[a - 1][b - 1] = c
G[b - 1][a... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 52.238806 | [
"-from itertools import permutations",
"+import sys",
"-N, M, R = list(map(int, input().split()))",
"-r = list(map(int, input().split()))",
"-G = [[float(\"inf\")] * (N) for _ in range(N)]",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def list2d(a, b, c):",
"+... | false | 0.036695 | 0.16204 | 0.226455 | [
"s358033743",
"s892886977"
] |
u864090097 | p02584 | python | s834653689 | s012566716 | 31 | 28 | 9,168 | 9,160 | Accepted | Accepted | 9.68 | X, K, D = list(map(int ,input().split()))
X = abs(X)
if X // D > K:
ans = X - K * D
else:
if X // D % 2 == K % 2:
ans = X % D
else:
ans = abs(X % D - D)
print(ans)
| X, K, D = list(map(int ,input().split()))
X = abs(X)
if X / D > K:
ans = X - K * D
else:
if X // D % 2 == K % 2:
ans = X % D
else:
ans = abs(X % D - D)
print(ans) | 11 | 11 | 197 | 195 | X, K, D = list(map(int, input().split()))
X = abs(X)
if X // D > K:
ans = X - K * D
else:
if X // D % 2 == K % 2:
ans = X % D
else:
ans = abs(X % D - D)
print(ans)
| X, K, D = list(map(int, input().split()))
X = abs(X)
if X / D > K:
ans = X - K * D
else:
if X // D % 2 == K % 2:
ans = X % D
else:
ans = abs(X % D - D)
print(ans)
| false | 0 | [
"-if X // D > K:",
"+if X / D > K:"
] | false | 0.087106 | 0.046983 | 1.853977 | [
"s834653689",
"s012566716"
] |
u811841526 | p02400 | python | s644205909 | s419125572 | 30 | 20 | 7,532 | 5,640 | Accepted | Accepted | 33.33 | from math import pi
r = float(eval(input()))
area = pi * r**2
circumference = 2 * pi * r
print((area, circumference)) | import math
r = float(eval(input()))
area = math.pi * r**2
diameter = 2 * math.pi * r
print((area, diameter))
| 5 | 9 | 114 | 115 | from math import pi
r = float(eval(input()))
area = pi * r**2
circumference = 2 * pi * r
print((area, circumference))
| import math
r = float(eval(input()))
area = math.pi * r**2
diameter = 2 * math.pi * r
print((area, diameter))
| false | 44.444444 | [
"-from math import pi",
"+import math",
"-area = pi * r**2",
"-circumference = 2 * pi * r",
"-print((area, circumference))",
"+area = math.pi * r**2",
"+diameter = 2 * math.pi * r",
"+print((area, diameter))"
] | false | 0.04163 | 0.046649 | 0.892395 | [
"s644205909",
"s419125572"
] |
u700929101 | p02860 | python | s953825437 | s846261993 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | n = int(eval(input()))
s = str(eval(input()))
t = int(n/2)
s_1half = s[:t]
s_2half = s[t:]
if n % 2 == 1:
print("No")
elif s_1half == s_2half:
print("Yes")
elif s_1half != s_2half:
print("No") | n = int(eval(input()))
s = str(eval(input()))
t = int(n/2)
if n % 2 == 1:
print("No")
else:
for i in range(t):
if s[i] == s[i+t]:
continue
else:
print("No")
exit()
print("Yes") | 13 | 14 | 206 | 242 | n = int(eval(input()))
s = str(eval(input()))
t = int(n / 2)
s_1half = s[:t]
s_2half = s[t:]
if n % 2 == 1:
print("No")
elif s_1half == s_2half:
print("Yes")
elif s_1half != s_2half:
print("No")
| n = int(eval(input()))
s = str(eval(input()))
t = int(n / 2)
if n % 2 == 1:
print("No")
else:
for i in range(t):
if s[i] == s[i + t]:
continue
else:
print("No")
exit()
print("Yes")
| false | 7.142857 | [
"-s_1half = s[:t]",
"-s_2half = s[t:]",
"-elif s_1half == s_2half:",
"+else:",
"+ for i in range(t):",
"+ if s[i] == s[i + t]:",
"+ continue",
"+ else:",
"+ print(\"No\")",
"+ exit()",
"-elif s_1half != s_2half:",
"- print(\"No\")"
] | false | 0.039917 | 0.041204 | 0.968761 | [
"s953825437",
"s846261993"
] |
u800258529 | p03798 | python | s194214198 | s642830410 | 340 | 311 | 6,740 | 5,364 | Accepted | Accepted | 8.53 | n=int(input())
s=input()
for i in range(4):
a=[i%2,i//2]+[1]*n
for i in range(2,n+2):a[i]^=a[i-2]^a[i-1]^(s[(i-1)%n]=='o')
if a[:2]==a[-2:]:
for i in range(n):print('SW'[a[i]],end='')
exit()
print(-1)
| n=int(input());s=input()
for i in range(4):
a=[i%2,i//2];i=1
while i<=n:a.append(a[-2]^a[-1]^(s[i%n]=='x'));i+=1
if a[:2]==a[-2:]:
for i in range(n):print('SW'[a[i]],end='')
exit()
print(-1)
| 9 | 8 | 236 | 225 | n = int(input())
s = input()
for i in range(4):
a = [i % 2, i // 2] + [1] * n
for i in range(2, n + 2):
a[i] ^= a[i - 2] ^ a[i - 1] ^ (s[(i - 1) % n] == "o")
if a[:2] == a[-2:]:
for i in range(n):
print("SW"[a[i]], end="")
exit()
print(-1)
| n = int(input())
s = input()
for i in range(4):
a = [i % 2, i // 2]
i = 1
while i <= n:
a.append(a[-2] ^ a[-1] ^ (s[i % n] == "x"))
i += 1
if a[:2] == a[-2:]:
for i in range(n):
print("SW"[a[i]], end="")
exit()
print(-1)
| false | 11.111111 | [
"- a = [i % 2, i // 2] + [1] * n",
"- for i in range(2, n + 2):",
"- a[i] ^= a[i - 2] ^ a[i - 1] ^ (s[(i - 1) % n] == \"o\")",
"+ a = [i % 2, i // 2]",
"+ i = 1",
"+ while i <= n:",
"+ a.append(a[-2] ^ a[-1] ^ (s[i % n] == \"x\"))",
"+ i += 1"
] | false | 0.033079 | 0.033792 | 0.978901 | [
"s194214198",
"s642830410"
] |
u225388820 | p02558 | python | s898805304 | s942960987 | 991 | 711 | 88,472 | 80,228 | Accepted | Accepted | 28.25 | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x ==... | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x ==... | 58 | 58 | 1,680 | 1,664 | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x == y:
... | from typing import List
class DSU:
def __init__(self, n: int) -> None:
self._n = n
self.parent_or_size = [-1] * n
def merge(self, a: int, b: int) -> int:
assert 0 <= a <= self._n
assert 0 <= b <= self._n
x, y = self.leader(a), self.leader(b)
if x == y:
... | false | 0 | [
"- result = self.leader(self.parent_or_size[a])",
"- self.parent_or_size[a] = result",
"- return result",
"+ while self.parent_or_size[a] >= 0:",
"+ a = self.parent_or_size[a]",
"+ return a"
] | false | 0.041147 | 0.051247 | 0.802915 | [
"s898805304",
"s942960987"
] |
u083960235 | p03038 | python | s668091650 | s153417374 | 561 | 457 | 35,664 | 34,800 | Accepted | Accepted | 18.54 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upp... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 42 | 45 | 1,162 | 1,223 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 6.666667 | [
"-import sys, re",
"+import sys, re, os",
"-from itertools import accumulate, permutations, combinations, product",
"+from itertools import permutations, combinations, product, accumulate",
"-from bisect import bisect, bisect_left",
"-from fractions import gcd",
"-from heapq import heappush, heappop, he... | false | 0.09069 | 0.078408 | 1.156648 | [
"s668091650",
"s153417374"
] |
u951401193 | p02845 | python | s316340544 | s295907882 | 153 | 81 | 10,644 | 13,980 | Accepted | Accepted | 47.06 | N=int(eval(input()))
A=list(map(int,input().split()))
m=10**9+7
r=1
C=[0,0,0]
for a in A:
try:
i=C.index(a)
r=r*sum([1 if c==a else 0 for c in C])%m
C[i]+=1
except:
print((0))
exit()
print(r)
| n , *a_s = list(map(int,open(0).read().split()))
tmp = [3] + [0 for _ in range(n+1)]
ans = 1
for a in a_s:
ans = ans * tmp[a] % 1000000007
tmp[a] -= 1
tmp[a+1] += 1
print(ans) | 14 | 9 | 239 | 186 | N = int(eval(input()))
A = list(map(int, input().split()))
m = 10**9 + 7
r = 1
C = [0, 0, 0]
for a in A:
try:
i = C.index(a)
r = r * sum([1 if c == a else 0 for c in C]) % m
C[i] += 1
except:
print((0))
exit()
print(r)
| n, *a_s = list(map(int, open(0).read().split()))
tmp = [3] + [0 for _ in range(n + 1)]
ans = 1
for a in a_s:
ans = ans * tmp[a] % 1000000007
tmp[a] -= 1
tmp[a + 1] += 1
print(ans)
| false | 35.714286 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-m = 10**9 + 7",
"-r = 1",
"-C = [0, 0, 0]",
"-for a in A:",
"- try:",
"- i = C.index(a)",
"- r = r * sum([1 if c == a else 0 for c in C]) % m",
"- C[i] += 1",
"- except:",
"- print((0))",
"... | false | 0.03327 | 0.041297 | 0.805612 | [
"s316340544",
"s295907882"
] |
u083960235 | p03103 | python | s670852251 | s296019224 | 522 | 412 | 26,888 | 28,600 | Accepted | Accepted | 21.07 | n,m=list(map(int,input().split()))
a=[]
b=[]
c=[]
for i in range(n):
A,B=list(map(int,input().split()))
a.append(A)
b.append(B)
c=list(zip(a,b))
c.sort()
a,b=list(zip(*c))
a=list(a)
b=list(b)
#sprint(a,b)
M=m
for i in range(n):
if m>=0:
m=m-b[i]
#print(i)
I=i
... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 33 | 37 | 439 | 976 | n, m = list(map(int, input().split()))
a = []
b = []
c = []
for i in range(n):
A, B = list(map(int, input().split()))
a.append(A)
b.append(B)
c = list(zip(a, b))
c.sort()
a, b = list(zip(*c))
a = list(a)
b = list(b)
# sprint(a,b)
M = m
for i in range(n):
if m >= 0:
m = m - b[i]
# print(i... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 10.810811 | [
"-n, m = list(map(int, input().split()))",
"-a = []",
"-b = []",
"-c = []",
"-for i in range(n):",
"- A, B = list(map(int, input().split()))",
"- a.append(A)",
"- b.append(B)",
"-c = list(zip(a, b))",
"-c.sort()",
"-a, b = list(zip(*c))",
"-a = list(a)",
"-b = list(b)",
"-# sprint... | false | 0.087941 | 0.045204 | 1.9454 | [
"s670852251",
"s296019224"
] |
u102461423 | p02680 | python | s081697181 | s487305861 | 1,321 | 784 | 180,808 | 165,764 | Accepted | Accepted | 40.65 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np... | 95 | 96 | 2,303 | 2,400 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([... | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([... | false | 1.041667 | [
"- DX, DY = np.diff(X), np.diff(Y)",
"- return A, B, C, D, E, F, X, Y, DX, DY",
"+ return A, B, C, D, E, F, X, Y",
"-@njit(cache=True)",
"+@njit(\"(i8[:],i8[:],i8[:],i8[:],i8[:],i8[:],i8,i8)\", cache=True)",
"-@njit(cache=True)",
"-def solve(A, B, C, D, E, F, X, Y, DX, DY):",
"+@njit(\"(i8[:]... | false | 0.499446 | 0.193416 | 2.582237 | [
"s081697181",
"s487305861"
] |
u185948224 | p03476 | python | s773428761 | s084422176 | 1,982 | 566 | 33,420 | 32,280 | Accepted | Accepted | 71.44 | import bisect
from operator import itemgetter
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
rmax = max(lr, key=itemgetter(1))[1]
primes = list(range(rmax+1))
primes [1] = 0
for i in range(2, int(rmax**0.5)+ 2):
for j in range(2 * i, rmax+1, i):
primes[j] = 0
... | import bisect
from operator import itemgetter
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
rmax = max(lr, key=itemgetter(1))[1]
primes = list(range(rmax+1))
primes [1] = 0
for i in range(2, int(rmax**0.5)+ 2):
for j in range(2 * i, rmax+1, i):
primes[j] = 0
... | 21 | 20 | 554 | 546 | import bisect
from operator import itemgetter
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
rmax = max(lr, key=itemgetter(1))[1]
primes = list(range(rmax + 1))
primes[1] = 0
for i in range(2, int(rmax**0.5) + 2):
for j in range(2 * i, rmax + 1, i):
primes[j] = 0
primes = [... | import bisect
from operator import itemgetter
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
rmax = max(lr, key=itemgetter(1))[1]
primes = list(range(rmax + 1))
primes[1] = 0
for i in range(2, int(rmax**0.5) + 2):
for j in range(2 * i, rmax + 1, i):
primes[j] = 0
primess = ... | false | 4.761905 | [
"-primes = [prime for prime in primes[:] if prime != 0]",
"-lst2017 = [x for x in primes if x != 2 and (x + 1) // 2 in primes]",
"+primess = [prime for prime in primes[:] if prime != 0]",
"+lst2017 = [x for x in primess if primes[(x + 1) // 2] != 0]"
] | false | 0.052103 | 0.137099 | 0.380043 | [
"s773428761",
"s084422176"
] |
u949338836 | p02256 | python | s308125143 | s436456051 | 30 | 20 | 6,724 | 7,744 | Accepted | Accepted | 33.33 | #coding:utf-8
x,y = list(map(int,input().split()))
while x%y != 0:
x,y = y,x%y
print(y) | #coding:utf-8
#1_1_B
def gcd(x, y):
while x%y != 0:
x, y = y, x%y
return y
x, y = list(map(int, input().split()))
print((gcd(x, y))) | 6 | 9 | 91 | 149 | # coding:utf-8
x, y = list(map(int, input().split()))
while x % y != 0:
x, y = y, x % y
print(y)
| # coding:utf-8
# 1_1_B
def gcd(x, y):
while x % y != 0:
x, y = y, x % y
return y
x, y = list(map(int, input().split()))
print((gcd(x, y)))
| false | 33.333333 | [
"+# 1_1_B",
"+def gcd(x, y):",
"+ while x % y != 0:",
"+ x, y = y, x % y",
"+ return y",
"+",
"+",
"-while x % y != 0:",
"- x, y = y, x % y",
"-print(y)",
"+print((gcd(x, y)))"
] | false | 0.035408 | 0.035519 | 0.996888 | [
"s308125143",
"s436456051"
] |
u594956556 | p03487 | python | s317545748 | s748053217 | 108 | 89 | 18,676 | 17,780 | Accepted | Accepted | 17.59 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for key in c:
if c[key] >= key:
ans += (c[key] - key)
else:
ans += c[key]
print(ans) | N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for ai in a:
if ai in d:
d[ai] += 1
else:
d[ai] = 1
ans = 0
for key in d:
if d[key] >= key:
ans += (d[key] - key)
else:
ans += d[key]
print(ans)
| 13 | 17 | 218 | 249 | from collections import Counter
N = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
for key in c:
if c[key] >= key:
ans += c[key] - key
else:
ans += c[key]
print(ans)
| N = int(eval(input()))
a = list(map(int, input().split()))
d = {}
for ai in a:
if ai in d:
d[ai] += 1
else:
d[ai] = 1
ans = 0
for key in d:
if d[key] >= key:
ans += d[key] - key
else:
ans += d[key]
print(ans)
| false | 23.529412 | [
"-from collections import Counter",
"-",
"-c = Counter(a)",
"+d = {}",
"+for ai in a:",
"+ if ai in d:",
"+ d[ai] += 1",
"+ else:",
"+ d[ai] = 1",
"-for key in c:",
"- if c[key] >= key:",
"- ans += c[key] - key",
"+for key in d:",
"+ if d[key] >= key:",
"... | false | 0.042928 | 0.107055 | 0.400987 | [
"s317545748",
"s748053217"
] |
u193264896 | p02762 | python | s729247674 | s552687089 | 1,175 | 1,021 | 30,256 | 18,764 | Accepted | Accepted | 13.11 | from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce
from collections import deque, Counter, defaultdict
from itertools import product, permu... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.pa... | 105 | 85 | 2,648 | 1,873 | from scipy.sparse.csgraph import (
shortest_path,
floyd_warshall,
dijkstra,
bellman_ford,
johnson,
minimum_spanning_tree,
)
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce
from collections import deque, Counter, defaultdict
from itertoo... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.pa... | false | 19.047619 | [
"-from scipy.sparse.csgraph import (",
"- shortest_path,",
"- floyd_warshall,",
"- dijkstra,",
"- bellman_ford,",
"- johnson,",
"- minimum_spanning_tree,",
"-)",
"-from scipy.sparse import csr_matrix, coo_matrix, lil_matrix",
"-import numpy as np",
"-from functools import reduc... | false | 0.096599 | 0.053189 | 1.816146 | [
"s729247674",
"s552687089"
] |
u627234757 | p02993 | python | s528382172 | s529934105 | 31 | 26 | 9,092 | 9,016 | Accepted | Accepted | 16.13 | S = eval(input())
n = len(S)
flag = False
for i in range(1, n):
if S[i] == S[i-1]:
flag = True
if flag == True:
print('Bad')
else:
print('Good') | S = eval(input())
flag = False
tmp = ''
for s in S:
if tmp == s:
flag = True
tmp = s
if flag == True:
print('Bad')
else:
print('Good') | 10 | 11 | 157 | 150 | S = eval(input())
n = len(S)
flag = False
for i in range(1, n):
if S[i] == S[i - 1]:
flag = True
if flag == True:
print("Bad")
else:
print("Good")
| S = eval(input())
flag = False
tmp = ""
for s in S:
if tmp == s:
flag = True
tmp = s
if flag == True:
print("Bad")
else:
print("Good")
| false | 9.090909 | [
"-n = len(S)",
"-for i in range(1, n):",
"- if S[i] == S[i - 1]:",
"+tmp = \"\"",
"+for s in S:",
"+ if tmp == s:",
"+ tmp = s"
] | false | 0.045263 | 0.038957 | 1.161854 | [
"s528382172",
"s529934105"
] |
u562935282 | p02996 | python | s851944362 | s249244375 | 752 | 419 | 33,824 | 31,872 | Accepted | Accepted | 44.28 | def solve(n: int, ab: 'list(Task)') -> bool:
from operator import attrgetter
ab.sort(key=attrgetter('limit'))
cur = 0
for ab_ in ab:
cur += ab_.cost
if cur > ab_.limit:
return False
return True
if __name__ == '__main__':
from collections import namedtupl... | def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N = int(eval(input()))
tasks = []
for _ in range(N):
tasks.append(tuple(map(int, input().split()))) # (A,B)
tasks.sort(key=itemgetter(1))
t = 0
cond = True
for a, b in task... | 23 | 25 | 622 | 479 | def solve(n: int, ab: "list(Task)") -> bool:
from operator import attrgetter
ab.sort(key=attrgetter("limit"))
cur = 0
for ab_ in ab:
cur += ab_.cost
if cur > ab_.limit:
return False
return True
if __name__ == "__main__":
from collections import namedtuple
impor... | def main():
from operator import itemgetter
import sys
input = sys.stdin.readline
N = int(eval(input()))
tasks = []
for _ in range(N):
tasks.append(tuple(map(int, input().split()))) # (A,B)
tasks.sort(key=itemgetter(1))
t = 0
cond = True
for a, b in tasks:
t += ... | false | 8 | [
"-def solve(n: int, ab: \"list(Task)\") -> bool:",
"- from operator import attrgetter",
"+def main():",
"+ from operator import itemgetter",
"+ import sys",
"- ab.sort(key=attrgetter(\"limit\"))",
"- cur = 0",
"- for ab_ in ab:",
"- cur += ab_.cost",
"- if cur > ab_... | false | 0.03597 | 0.033083 | 1.087254 | [
"s851944362",
"s249244375"
] |
u676264453 | p03633 | python | s097197148 | s167329320 | 25 | 17 | 3,572 | 3,060 | Accepted | Accepted | 32 | from functools import reduce
#def gcd(a, b):
# while b:
# a, b = b, a % b
# return a
def gcd(m, n):
r = m % n
return gcd(n, r) if r else n
def lcm(a, b):
return a * b // gcd(a,b)
N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
c = lcm(c, int(eval(input())))
... | def gcd(a, b):
while b:
a, b = b, a % b
return a
#def gcd(m, n):
# r = m % n
# return gcd(n, r) if r else n
def lcm(a, b):
return a * b // gcd(a,b)
N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
c = lcm(c, int(eval(input())))
print((int(c)))
| 21 | 19 | 322 | 289 | from functools import reduce
# def gcd(a, b):
# while b:
# a, b = b, a % b
# return a
def gcd(m, n):
r = m % n
return gcd(n, r) if r else n
def lcm(a, b):
return a * b // gcd(a, b)
N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
c = lcm(c, int(eval(input())))
print((int(c)))
| def gcd(a, b):
while b:
a, b = b, a % b
return a
# def gcd(m, n):
# r = m % n
# return gcd(n, r) if r else n
def lcm(a, b):
return a * b // gcd(a, b)
N = int(eval(input()))
Ts = []
c = 1
for i in range(N):
c = lcm(c, int(eval(input())))
print((int(c)))
| false | 9.52381 | [
"-from functools import reduce",
"-",
"-# def gcd(a, b):",
"-# while b:",
"-# a, b = b, a % b",
"-# return a",
"-def gcd(m, n):",
"- r = m % n",
"- return gcd(n, r) if r else n",
"+def gcd(a, b):",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+# def gcd... | false | 0.037376 | 0.07614 | 0.490883 | [
"s097197148",
"s167329320"
] |
u020373088 | p03361 | python | s433359350 | s225120706 | 23 | 21 | 3,064 | 3,064 | Accepted | Accepted | 8.7 | h, w = list(map(int, input().split()))
s = [eval(input()) for i in range(h)]
flag = True
for i in range(h):
for j in range(w):
if s[i][j] == "#":
top = max(0, i-1)
bottom = min(h-1, i+1)
right = min(w-1, j+1)
left = max(0, j-1)
if s[i][right] != "#" and s[i][left] != "#" ... | h, w = list(map(int, input().split()))
s = [eval(input()) for i in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#":
top = max(0, i-1)
bottom = min(h-1, i+1)
right = min(w-1, j+1)
left = max(0, j-1)
if s[i][right] != "#" and s[i][left] != "#" and s[top][j]... | 21 | 15 | 472 | 393 | h, w = list(map(int, input().split()))
s = [eval(input()) for i in range(h)]
flag = True
for i in range(h):
for j in range(w):
if s[i][j] == "#":
top = max(0, i - 1)
bottom = min(h - 1, i + 1)
right = min(w - 1, j + 1)
left = max(0, j - 1)
if (
... | h, w = list(map(int, input().split()))
s = [eval(input()) for i in range(h)]
for i in range(h):
for j in range(w):
if s[i][j] == "#":
top = max(0, i - 1)
bottom = min(h - 1, i + 1)
right = min(w - 1, j + 1)
left = max(0, j - 1)
if (
... | false | 28.571429 | [
"-flag = True",
"- flag = False",
"- break",
"- if flag == False:",
"- break",
"-if flag:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+ print(\"No\")",
"+ exit()",
"+print(\"Yes\")"
] | false | 0.058058 | 0.033797 | 1.717856 | [
"s433359350",
"s225120706"
] |
u179169725 | p03503 | python | s191701261 | s857270811 | 435 | 253 | 21,376 | 13,340 | Accepted | Accepted | 41.84 | # https://atcoder.jp/contests/abc080/tasks/abc080_c
# 普通にbit全探索では?
N = int(eval(input()))
F = []
for _ in range(N):
F.append(list(map(int, input().split())))
P = []
for _ in range(N):
P.append(list(map(int, input().split())))
bitlen = 10
# def ret_score(n: int):
# # 営業時間かぶり計算
# C = [... | # https://atcoder.jp/contests/abc080/tasks/abc080_c
# 普通にbit全探索では?
N = int(eval(input()))
F = []
for _ in range(N):
F.append(list(map(int, input().split())))
P = []
for _ in range(N):
P.append(list(map(int, input().split())))
bitlen = 10
# def ret_score(n: int):
# # 営業時間かぶり計算
# C = [... | 61 | 61 | 1,200 | 1,236 | # https://atcoder.jp/contests/abc080/tasks/abc080_c
# 普通にbit全探索では?
N = int(eval(input()))
F = []
for _ in range(N):
F.append(list(map(int, input().split())))
P = []
for _ in range(N):
P.append(list(map(int, input().split())))
bitlen = 10
# def ret_score(n: int):
# # 営業時間かぶり計算
# C = []
# for i in ran... | # https://atcoder.jp/contests/abc080/tasks/abc080_c
# 普通にbit全探索では?
N = int(eval(input()))
F = []
for _ in range(N):
F.append(list(map(int, input().split())))
P = []
for _ in range(N):
P.append(list(map(int, input().split())))
bitlen = 10
# def ret_score(n: int):
# # 営業時間かぶり計算
# C = []
# for i in ran... | false | 0 | [
"-def ret_score(n: int):",
"+def ret_score(n: int, F, bitshifter, P):",
"- ans = max(ans, ret_score(n))",
"+ ans = max(ans, ret_score(n, F, bitshifter, P))"
] | false | 0.334109 | 0.376824 | 0.886646 | [
"s191701261",
"s857270811"
] |
u623687794 | p02936 | python | s464507131 | s850668559 | 1,988 | 1,183 | 133,188 | 68,368 | Accepted | Accepted | 40.49 | import sys
from collections import deque
sys.setrecursionlimit(500000)
n,q=list(map(int,input().split()))
edge=[[] for i in range(n)]
cost=[0]*n
for i in range(n-1):
p,s=list(map(int,input().split()))
p-=1;s-=1
edge[p].append(s)
edge[s].append(p)
for i in range(q):
x,c=list(map(int,input().split()... | import sys
from collections import deque
sys.setrecursionlimit(500000)
input=sys.stdin.readline
n,q=list(map(int,input().split()))
edge=[[] for i in range(n)]
cost=[0]*n
for i in range(n-1):
p,s=list(map(int,input().split()))
p-=1;s-=1
edge[p].append(s)
edge[s].append(p)
for i in range(q):
x,c=li... | 28 | 29 | 609 | 636 | import sys
from collections import deque
sys.setrecursionlimit(500000)
n, q = list(map(int, input().split()))
edge = [[] for i in range(n)]
cost = [0] * n
for i in range(n - 1):
p, s = list(map(int, input().split()))
p -= 1
s -= 1
edge[p].append(s)
edge[s].append(p)
for i in range(q):
x, c = li... | import sys
from collections import deque
sys.setrecursionlimit(500000)
input = sys.stdin.readline
n, q = list(map(int, input().split()))
edge = [[] for i in range(n)]
cost = [0] * n
for i in range(n - 1):
p, s = list(map(int, input().split()))
p -= 1
s -= 1
edge[p].append(s)
edge[s].append(p)
for i... | false | 3.448276 | [
"+input = sys.stdin.readline"
] | false | 0.078679 | 0.121227 | 0.649028 | [
"s464507131",
"s850668559"
] |
u379720557 | p02702 | python | s625258228 | s828704518 | 124 | 111 | 9,304 | 9,372 | Accepted | Accepted | 10.48 | S = input()[::-1]
m = 2019
cnt = [0] * m
cnt[0] = 1
total = 0
x = 1
ans = 0
for i in range(len(S)):
total += int(S[i])*x
total %= m
cnt[total] += 1
x = 10*x
x %= m
for i in range(2019):
ans += cnt[i]*(cnt[i]-1)//2
print(ans) | S = input()[::-1]
cnt = [0] * 2019
cnt[0] = 1
total = 0
x = 1
ans = 0
for a in S:
total += int(a) * x
total %= 2019
cnt[total] += 1
x = x*10
x %= 2019
for i in range(2019):
ans += cnt[i]*(cnt[i]-1)//2
print(ans) | 20 | 19 | 271 | 261 | S = input()[::-1]
m = 2019
cnt = [0] * m
cnt[0] = 1
total = 0
x = 1
ans = 0
for i in range(len(S)):
total += int(S[i]) * x
total %= m
cnt[total] += 1
x = 10 * x
x %= m
for i in range(2019):
ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)
| S = input()[::-1]
cnt = [0] * 2019
cnt[0] = 1
total = 0
x = 1
ans = 0
for a in S:
total += int(a) * x
total %= 2019
cnt[total] += 1
x = x * 10
x %= 2019
for i in range(2019):
ans += cnt[i] * (cnt[i] - 1) // 2
print(ans)
| false | 5 | [
"-m = 2019",
"-cnt = [0] * m",
"+cnt = [0] * 2019",
"-for i in range(len(S)):",
"- total += int(S[i]) * x",
"- total %= m",
"+for a in S:",
"+ total += int(a) * x",
"+ total %= 2019",
"- x = 10 * x",
"- x %= m",
"+ x = x * 10",
"+ x %= 2019"
] | false | 0.068398 | 0.040542 | 1.687073 | [
"s625258228",
"s828704518"
] |
u981931040 | p03457 | python | s610411466 | s885280059 | 386 | 227 | 3,064 | 8,952 | Accepted | Accepted | 41.19 | N = int(eval(input()))
now_x = 0
now_y = 0
now_t = 0
Flag = False
for i in range(N):
t , x, y = list(map(int,input().split()))
dx = abs(x - now_x)
dy = abs(y - now_y)
dt = abs(t - now_t)
if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):
Flag = True
now_x = x
now_y = y
... | N = int(eval(input()))
now_t, now_x, now_y = 0, 0, 0
for i in range(N):
next_t, next_x, next_y = list(map(int, input().split()))
distance = abs(next_x - now_x) + abs(next_y - now_y)
spent_time = next_t - now_t
if spent_time < distance or distance % 2 != spent_time % 2:
print('No')
... | 16 | 11 | 350 | 380 | N = int(eval(input()))
now_x = 0
now_y = 0
now_t = 0
Flag = False
for i in range(N):
t, x, y = list(map(int, input().split()))
dx = abs(x - now_x)
dy = abs(y - now_y)
dt = abs(t - now_t)
if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):
Flag = True
now_x = x
now_y = y
now_t = t
pri... | N = int(eval(input()))
now_t, now_x, now_y = 0, 0, 0
for i in range(N):
next_t, next_x, next_y = list(map(int, input().split()))
distance = abs(next_x - now_x) + abs(next_y - now_y)
spent_time = next_t - now_t
if spent_time < distance or distance % 2 != spent_time % 2:
print("No")
exit()... | false | 31.25 | [
"-now_x = 0",
"-now_y = 0",
"-now_t = 0",
"-Flag = False",
"+now_t, now_x, now_y = 0, 0, 0",
"- t, x, y = list(map(int, input().split()))",
"- dx = abs(x - now_x)",
"- dy = abs(y - now_y)",
"- dt = abs(t - now_t)",
"- if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):",
"- Fla... | false | 0.041098 | 0.040927 | 1.00417 | [
"s610411466",
"s885280059"
] |
u083960235 | p02847 | python | s590671380 | s672702845 | 93 | 39 | 5,972 | 5,144 | Accepted | Accepted | 58.06 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 41 | 33 | 981 | 930 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 19.512195 | [
"-s = eval(input())",
"-# n = INT()",
"-# print(a, b)",
"-if s == \"SUN\":",
"- print((7))",
"-elif s == \"MON\":",
"- print((6))",
"-elif s == \"TUE\":",
"- print((5))",
"-elif s == \"WED\":",
"- print((4))",
"-elif s == \"THU\":",
"- print((3))",
"-elif s == \"FRI\":",
"... | false | 0.038517 | 0.057229 | 0.673038 | [
"s590671380",
"s672702845"
] |
u353919145 | p03834 | python | s998372821 | s336736557 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | import sys
lines = sys.stdin.readlines()
for linea in lines:
c = linea.split()
c = list(map(str,c))
list(c)
sent_str= c[0]
x = sent_str.replace(",", " ")
print(x) | #!/usr/bin/env python
s = input()
print((s.replace(",", " "))) | 9 | 3 | 178 | 67 | import sys
lines = sys.stdin.readlines()
for linea in lines:
c = linea.split()
c = list(map(str, c))
list(c)
sent_str = c[0]
x = sent_str.replace(",", " ")
print(x)
| #!/usr/bin/env python
s = input()
print((s.replace(",", " ")))
| false | 66.666667 | [
"-import sys",
"-",
"-lines = sys.stdin.readlines()",
"-for linea in lines:",
"- c = linea.split()",
"- c = list(map(str, c))",
"-list(c)",
"-sent_str = c[0]",
"-x = sent_str.replace(\",\", \" \")",
"-print(x)",
"+#!/usr/bin/env python",
"+s = input()",
"+print((s.replace(\",\", \" \")... | false | 0.062813 | 0.037422 | 1.678512 | [
"s998372821",
"s336736557"
] |
u357630630 | p03624 | python | s349345378 | s480779042 | 38 | 20 | 4,084 | 3,956 | Accepted | Accepted | 47.37 | L = "".join([chr(i) for i in range(97, 97 + 26)])
for i in list(eval(input())):
L = L.replace(i, "")
if L == "":
print("None")
else:
print((L[0]))
| L = "".join([chr(i) for i in range(97, 97 + 26)])
for i in set(list(eval(input()))):
L = L.replace(i, "")
if L == "":
print("None")
else:
print((L[0]))
| 7 | 7 | 157 | 162 | L = "".join([chr(i) for i in range(97, 97 + 26)])
for i in list(eval(input())):
L = L.replace(i, "")
if L == "":
print("None")
else:
print((L[0]))
| L = "".join([chr(i) for i in range(97, 97 + 26)])
for i in set(list(eval(input()))):
L = L.replace(i, "")
if L == "":
print("None")
else:
print((L[0]))
| false | 0 | [
"-for i in list(eval(input())):",
"+for i in set(list(eval(input()))):"
] | false | 0.040728 | 0.036742 | 1.108461 | [
"s349345378",
"s480779042"
] |
u777207626 | p03078 | python | s907024201 | s144866732 | 800 | 672 | 151,388 | 8,712 | Accepted | Accepted | 16 | x,y,z,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True),b.sort(reverse=True),c.sort(reverse=True)
ab = []
for i in range(x):
for j in range(y):
ab.append(a[i]+b[j])
ab.sort(reverse=Tr... | x,y,z,k = list(map(int,input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True),b.sort(reverse=True),c.sort(reverse=True)
abc = []
for i in range(x):
for j in range(y):
for l in range(z):
if... | 20 | 20 | 458 | 452 | x, y, z, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True), b.sort(reverse=True), c.sort(reverse=True)
ab = []
for i in range(x):
for j in range(y):
ab.append(a[i] + b[j])
ab.sort(reverse... | x, y, z, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True), b.sort(reverse=True), c.sort(reverse=True)
abc = []
for i in range(x):
for j in range(y):
for l in range(z):
if (i ... | false | 0 | [
"-ab = []",
"+abc = []",
"- ab.append(a[i] + b[j])",
"-ab.sort(reverse=True)",
"-ab = ab[0:k]",
"-abc = []",
"-for i in ab:",
"- for j in c:",
"- abc.append(i + j)",
"+ for l in range(z):",
"+ if (i + 1) * (j + 1) * (l + 1) > k:",
"+ break",
... | false | 0.043796 | 0.120577 | 0.363218 | [
"s907024201",
"s144866732"
] |
u192154323 | p02720 | python | s637594839 | s769497160 | 219 | 199 | 13,368 | 13,436 | Accepted | Accepted | 9.13 | k = int(eval(input()))
lun_ls = []
def change_to_num(ls):
ls = list(map(str, ls))
strnum = ''.join(ls)
return int(strnum)
def lun(num):
'''
渡された数が上限行ってなければlun_lsに追加して、次の数で再帰呼出
'''
if num > 3234566667:
return
lun_ls.append(num)
last = num % 10
for nex in ... | k = int(eval(input()))
# やっぱり一旦はglobalで書こ
total_ls = []
def dfs(A):
if int(A) > 3234566667:
return
global total_ls
total_ls.append(int(A))
last = int(A[-1])
if last == 0:
nex = [1,0]
elif last == 9:
nex = [8,9]
else:
nex = [last-1,last,last+1]
... | 26 | 27 | 551 | 479 | k = int(eval(input()))
lun_ls = []
def change_to_num(ls):
ls = list(map(str, ls))
strnum = "".join(ls)
return int(strnum)
def lun(num):
"""
渡された数が上限行ってなければlun_lsに追加して、次の数で再帰呼出
"""
if num > 3234566667:
return
lun_ls.append(num)
last = num % 10
for nex in range(last - 1... | k = int(eval(input()))
# やっぱり一旦はglobalで書こ
total_ls = []
def dfs(A):
if int(A) > 3234566667:
return
global total_ls
total_ls.append(int(A))
last = int(A[-1])
if last == 0:
nex = [1, 0]
elif last == 9:
nex = [8, 9]
else:
nex = [last - 1, last, last + 1]
fo... | false | 3.703704 | [
"-lun_ls = []",
"+# やっぱり一旦はglobalで書こ",
"+total_ls = []",
"-def change_to_num(ls):",
"- ls = list(map(str, ls))",
"- strnum = \"\".join(ls)",
"- return int(strnum)",
"+def dfs(A):",
"+ if int(A) > 3234566667:",
"+ return",
"+ global total_ls",
"+ total_ls.append(int(A))... | false | 0.352551 | 0.59345 | 0.594069 | [
"s637594839",
"s769497160"
] |
u704001626 | p02954 | python | s489194905 | s601945279 | 184 | 134 | 14,692 | 11,260 | Accepted | Accepted | 27.17 | # -*- coding: utf-8 -*-
S = eval(input())
len_S = len(S)
#Rは右方向に最も近いL,Lは左方向に最も近いRを探す
S_asshuku = []
min_lens = []
ret_list = [0] * len_S
cnt = 1
for i in range(1,len_S):
if S[i]==S[i-1]:
cnt+=1
else:
S_asshuku.append(cnt)
cnt = 1
S_asshuku.append(cnt)
for i,v in enumerate(... | s = eval(input())
ss = []
s1 ="R"
cnt = 0
for i in s:
if i == s1:
cnt+=1
else:
ss.append(cnt)
cnt = 1
if s1=="R":
s1="L"
else:
s1="R"
ss.append(cnt)
ret = [0] * len(s)
v_total = 0
for i,v in enumerate(ss):
v_total += v
i... | 26 | 26 | 622 | 497 | # -*- coding: utf-8 -*-
S = eval(input())
len_S = len(S)
# Rは右方向に最も近いL,Lは左方向に最も近いRを探す
S_asshuku = []
min_lens = []
ret_list = [0] * len_S
cnt = 1
for i in range(1, len_S):
if S[i] == S[i - 1]:
cnt += 1
else:
S_asshuku.append(cnt)
cnt = 1
S_asshuku.append(cnt)
for i, v in enumerate(S_assh... | s = eval(input())
ss = []
s1 = "R"
cnt = 0
for i in s:
if i == s1:
cnt += 1
else:
ss.append(cnt)
cnt = 1
if s1 == "R":
s1 = "L"
else:
s1 = "R"
ss.append(cnt)
ret = [0] * len(s)
v_total = 0
for i, v in enumerate(ss):
v_total += v
if i % 2 ==... | false | 0 | [
"-# -*- coding: utf-8 -*-",
"-S = eval(input())",
"-len_S = len(S)",
"-# Rは右方向に最も近いL,Lは左方向に最も近いRを探す",
"-S_asshuku = []",
"-min_lens = []",
"-ret_list = [0] * len_S",
"-cnt = 1",
"-for i in range(1, len_S):",
"- if S[i] == S[i - 1]:",
"+s = eval(input())",
"+ss = []",
"+s1 = \"R\"",
"+cn... | false | 0.036499 | 0.03551 | 1.027864 | [
"s489194905",
"s601945279"
] |
u392319141 | p02788 | python | s959800094 | s937803741 | 1,741 | 1,065 | 91,352 | 44,624 | Accepted | Accepted | 38.83 | from bisect import bisect_right
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
X = [x for x, _ in XH]
ans = 0
ims = [0] * (N + 1)
cnt = 0
for now, (x, h) in enumerate(XH):
cnt += ims[now]
if cnt * A >= h:
continue
nes... | from collections import deque
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
cnt = 0
que = deque()
for x, h in XH:
while que and que[0][0] <= x:
cnt -= que.popleft()[1]
h -= cnt * A
if h <= 0:
contin... | 25 | 25 | 468 | 429 | from bisect import bisect_right
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
X = [x for x, _ in XH]
ans = 0
ims = [0] * (N + 1)
cnt = 0
for now, (x, h) in enumerate(XH):
cnt += ims[now]
if cnt * A >= h:
continue
ness = -(-(h - cnt * A... | from collections import deque
N, D, A = list(map(int, input().split()))
XH = [tuple(map(int, input().split())) for _ in range(N)]
XH.sort()
ans = 0
cnt = 0
que = deque()
for x, h in XH:
while que and que[0][0] <= x:
cnt -= que.popleft()[1]
h -= cnt * A
if h <= 0:
continue
ness = -(-h //... | false | 0 | [
"-from bisect import bisect_right",
"+from collections import deque",
"-X = [x for x, _ in XH]",
"-ims = [0] * (N + 1)",
"-for now, (x, h) in enumerate(XH):",
"- cnt += ims[now]",
"- if cnt * A >= h:",
"+que = deque()",
"+for x, h in XH:",
"+ while que and que[0][0] <= x:",
"+ cn... | false | 0.09191 | 0.04818 | 1.907622 | [
"s959800094",
"s937803741"
] |
u816631826 | p03845 | python | s825367277 | s190410803 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 |
n=int(eval(input()))
t=eval(input())
t=t.split()
m=int(eval(input()))
px=[]
su=[]
for i in range(m):
px.append(input().split())
o=t[int(px[-1][0])-1]
t[int(px[-1][0])-1]=int(px[-1][1])
temp=0
for i in t:
temp=temp+int(i)
su.append(temp)
t[int(px[-1][0])-1]=o
... | def sumArray(n):
sum = 0
for i in range(len(n)):
sum += n[i]
return sum
n = int(eval(input()))
t = list(map(int, input().rstrip().split()))
m = int(eval(input()))
sum = sumArray(t)
temp = sum
for i in range(m):
data = list(map(int, input().split()))
sum = sum - t[data[0] - 1] +... | 22 | 16 | 341 | 348 | n = int(eval(input()))
t = eval(input())
t = t.split()
m = int(eval(input()))
px = []
su = []
for i in range(m):
px.append(input().split())
o = t[int(px[-1][0]) - 1]
t[int(px[-1][0]) - 1] = int(px[-1][1])
temp = 0
for i in t:
temp = temp + int(i)
su.append(temp)
t[int(px[-1][0]) - 1]... | def sumArray(n):
sum = 0
for i in range(len(n)):
sum += n[i]
return sum
n = int(eval(input()))
t = list(map(int, input().rstrip().split()))
m = int(eval(input()))
sum = sumArray(t)
temp = sum
for i in range(m):
data = list(map(int, input().split()))
sum = sum - t[data[0] - 1] + data[1]
... | false | 27.272727 | [
"+def sumArray(n):",
"+ sum = 0",
"+ for i in range(len(n)):",
"+ sum += n[i]",
"+ return sum",
"+",
"+",
"-t = eval(input())",
"-t = t.split()",
"+t = list(map(int, input().rstrip().split()))",
"-px = []",
"-su = []",
"+sum = sumArray(t)",
"+temp = sum",
"- px.append(... | false | 0.035222 | 0.036665 | 0.960622 | [
"s825367277",
"s190410803"
] |
u391589398 | p03166 | python | s978550181 | s282376020 | 623 | 529 | 59,056 | 23,088 | Accepted | Accepted | 15.09 | import sys
sys.setrecursionlimit(500000)
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
x, y = [int(x)-1 for x in input().split()]
G[x].append(y)
# iを始点としたときの有効パスの最大長さ
dp = [-1] * n
def rec(s):
if dp[s] != -1:
return dp[s]
ret = 0
for... | n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
deg = [0] * n # 各頂点の入力次数
for _ in range(m):
x, y = [int(x)-1 for x in input().split()]
G[x].append(y)
deg[y] += 1
from collections import deque
# 入力次数が0の頂点をBFSの開始点とする
q = deque([])
for i in range(n):
if deg[i] == 0:
... | 25 | 27 | 470 | 564 | import sys
sys.setrecursionlimit(500000)
n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
G[x].append(y)
# iを始点としたときの有効パスの最大長さ
dp = [-1] * n
def rec(s):
if dp[s] != -1:
return dp[s]
ret = 0
for ns in G[s]:
... | n, m = list(map(int, input().split()))
G = [[] for _ in range(n)]
deg = [0] * n # 各頂点の入力次数
for _ in range(m):
x, y = [int(x) - 1 for x in input().split()]
G[x].append(y)
deg[y] += 1
from collections import deque
# 入力次数が0の頂点をBFSの開始点とする
q = deque([])
for i in range(n):
if deg[i] == 0:
q.append(i... | false | 7.407407 | [
"-import sys",
"-",
"-sys.setrecursionlimit(500000)",
"+deg = [0] * n # 各頂点の入力次数",
"-# iを始点としたときの有効パスの最大長さ",
"-dp = [-1] * n",
"+ deg[y] += 1",
"+from collections import deque",
"-",
"-def rec(s):",
"- if dp[s] != -1:",
"- return dp[s]",
"- ret = 0",
"- for ns in G[s]:"... | false | 0.03645 | 0.047398 | 0.769019 | [
"s978550181",
"s282376020"
] |
u926046014 | p02694 | python | s917249617 | s292837153 | 34 | 30 | 10,064 | 9,060 | Accepted | Accepted | 11.76 | from decimal import Decimal
x=int(eval(input()))
n=Decimal("100")
ans=0
while True:
ans+=1
n*=Decimal("1.01")
n//=1
if n>=x:
print(ans)
break | x=int(eval(input()))
n=100
ans=0
while True:
ans+=1
n+=n//100
if n>=x:
print(ans)
break | 11 | 9 | 177 | 117 | from decimal import Decimal
x = int(eval(input()))
n = Decimal("100")
ans = 0
while True:
ans += 1
n *= Decimal("1.01")
n //= 1
if n >= x:
print(ans)
break
| x = int(eval(input()))
n = 100
ans = 0
while True:
ans += 1
n += n // 100
if n >= x:
print(ans)
break
| false | 18.181818 | [
"-from decimal import Decimal",
"-",
"-n = Decimal(\"100\")",
"+n = 100",
"- n *= Decimal(\"1.01\")",
"- n //= 1",
"+ n += n // 100"
] | false | 0.04652 | 0.07041 | 0.660696 | [
"s917249617",
"s292837153"
] |
u353919145 | p03556 | python | s525629116 | s066705904 | 59 | 18 | 3,060 | 2,940 | Accepted | Accepted | 69.49 | import math
n = int(eval(input()))
for i in range(n):
sqrt = int(math.sqrt(n-i))
if(sqrt**2 == (n-i)):
print((n-i))
break | import math
n = int(eval(input()))
print((int(math.floor(n**0.5))**2)) | 9 | 5 | 147 | 68 | import math
n = int(eval(input()))
for i in range(n):
sqrt = int(math.sqrt(n - i))
if sqrt**2 == (n - i):
print((n - i))
break
| import math
n = int(eval(input()))
print((int(math.floor(n**0.5)) ** 2))
| false | 44.444444 | [
"-for i in range(n):",
"- sqrt = int(math.sqrt(n - i))",
"- if sqrt**2 == (n - i):",
"- print((n - i))",
"- break",
"+print((int(math.floor(n**0.5)) ** 2))"
] | false | 0.053561 | 0.12562 | 0.426373 | [
"s525629116",
"s066705904"
] |
u373047809 | p02803 | python | s948815060 | s913142539 | 426 | 294 | 29,496 | 21,996 | Accepted | Accepted | 30.99 | #!/usr/bin/env python3
from scipy.sparse.csgraph import floyd_warshall
INF = float("inf")
h, w = list(map(int, input().split()))
M = [eval(input()) for _ in [0]*h]
E = [[0]*h*w for _ in [0]*h*w]
D = [(1, 0), (0, 1), (-1, 0), (0, -1)]
def point(x, y):
return w * x + y
for i in range(h):
for j in ... | from scipy.sparse import*
_,*s=open(0)
r=s+["#"*20]
*g,=eval("[0]*500,"*500)
i=-1
for t in s:
i+=1;j=0
for u in t:k=i*20+j;g[k][k+1]=u>'#'<t[j+1];g[k][k+20]=u>'#'<r[i+1][j];j+=1
a=csgraph.johnson(csr_matrix(g),0)
print((int(max(a[a<999])))) | 22 | 10 | 579 | 249 | #!/usr/bin/env python3
from scipy.sparse.csgraph import floyd_warshall
INF = float("inf")
h, w = list(map(int, input().split()))
M = [eval(input()) for _ in [0] * h]
E = [[0] * h * w for _ in [0] * h * w]
D = [(1, 0), (0, 1), (-1, 0), (0, -1)]
def point(x, y):
return w * x + y
for i in range(h):
for j in r... | from scipy.sparse import *
_, *s = open(0)
r = s + ["#" * 20]
(*g,) = eval("[0]*500," * 500)
i = -1
for t in s:
i += 1
j = 0
for u in t:
k = i * 20 + j
g[k][k + 1] = u > "#" < t[j + 1]
g[k][k + 20] = u > "#" < r[i + 1][j]
j += 1
a = csgraph.johnson(csr_matrix(g), 0)
print((i... | false | 54.545455 | [
"-#!/usr/bin/env python3",
"-from scipy.sparse.csgraph import floyd_warshall",
"+from scipy.sparse import *",
"-INF = float(\"inf\")",
"-h, w = list(map(int, input().split()))",
"-M = [eval(input()) for _ in [0] * h]",
"-E = [[0] * h * w for _ in [0] * h * w]",
"-D = [(1, 0), (0, 1), (-1, 0), (0, -1)]... | false | 0.564681 | 0.42164 | 1.339251 | [
"s948815060",
"s913142539"
] |
u609061751 | p03435 | python | s120518630 | s723609646 | 887 | 74 | 3,060 | 69,516 | Accepted | Accepted | 91.66 | import sys
input = sys.stdin.readline
c = [[int(x) for x in input().split()] for _ in range(3)]
for i in range(101):
for j in range(101):
for k in range(101):
b1, b2, b3 = [x - i for x in c[0]]
if [b1 + j, b2 + j, b3 + j] == c[1] and [b1 + k, b2 + k, b3 + k] == c[2]:
... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
c = [[int(x) for x in input().split()] for _ in range(3)]
flag = 1
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if c[0][0] - a1 == c[1][0] - a2 and c[1][0] - a2 == c[2][0] - a3:
if c... | 14 | 20 | 388 | 559 | import sys
input = sys.stdin.readline
c = [[int(x) for x in input().split()] for _ in range(3)]
for i in range(101):
for j in range(101):
for k in range(101):
b1, b2, b3 = [x - i for x in c[0]]
if [b1 + j, b2 + j, b3 + j] == c[1] and [b1 + k, b2 + k, b3 + k] == c[2]:
... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
c = [[int(x) for x in input().split()] for _ in range(3)]
flag = 1
for a1 in range(101):
for a2 in range(101):
for a3 in range(101):
if c[0][0] - a1 == c[1][0] - a2 and c[1][0] - a2 == c[2][0] - a3:
if c[0][1] - a1 =... | false | 30 | [
"-input = sys.stdin.readline",
"+input = lambda: sys.stdin.readline().rstrip(\"\\r\\n\")",
"-for i in range(101):",
"- for j in range(101):",
"- for k in range(101):",
"- b1, b2, b3 = [x - i for x in c[0]]",
"- if [b1 + j, b2 + j, b3 + j] == c[1] and [b1 + k, b2 + k, b3 +... | false | 0.308618 | 0.38965 | 0.79204 | [
"s120518630",
"s723609646"
] |
u562935282 | p03149 | python | s203242024 | s545547919 | 21 | 18 | 3,316 | 2,940 | Accepted | Accepted | 14.29 | n = list(map(int, input().split()))
bl = True
for v in 1, 9, 7, 4:
if v not in n:
bl = False
break
print(('YES' if bl else 'NO'))
| n = list(map(int, input().split()))
n = sorted(n)
bl = (n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9)
print(('YES' if bl else 'NO'))
| 9 | 5 | 158 | 143 | n = list(map(int, input().split()))
bl = True
for v in 1, 9, 7, 4:
if v not in n:
bl = False
break
print(("YES" if bl else "NO"))
| n = list(map(int, input().split()))
n = sorted(n)
bl = n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9
print(("YES" if bl else "NO"))
| false | 44.444444 | [
"-bl = True",
"-for v in 1, 9, 7, 4:",
"- if v not in n:",
"- bl = False",
"- break",
"+n = sorted(n)",
"+bl = n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9"
] | false | 0.035419 | 0.037581 | 0.942477 | [
"s203242024",
"s545547919"
] |
u419877586 | p02783 | python | s196796525 | s464106850 | 165 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.7 | H, A=list(map(int, input().split()))
print(((H-1)//A+1))
| import math
H, A = list(map(int, input().split()))
print((math.ceil(H/A))) | 2 | 4 | 50 | 70 | H, A = list(map(int, input().split()))
print(((H - 1) // A + 1))
| import math
H, A = list(map(int, input().split()))
print((math.ceil(H / A)))
| false | 50 | [
"+import math",
"+",
"-print(((H - 1) // A + 1))",
"+print((math.ceil(H / A)))"
] | false | 0.0918 | 0.039505 | 2.323766 | [
"s196796525",
"s464106850"
] |
u761320129 | p04033 | python | s289293672 | s945042612 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A,B = list(map(int,input().split()))
if A <= 0 <= B:
print('Zero')
exit()
if 0 < A:
print('Positive')
elif B < 0:
c = B-A+1
print(('Negative' if c%2 else 'Positive'))
else:
c = -A
print(('Negative' if c%2 else 'Positive')) | a,b = list(map(int,input().split()))
if a <= 0 <= b:
print('Zero')
elif a > 0:
print('Positive')
else:
k = b-a + 1
print(('Negative' if k%2 else 'Positive')) | 13 | 8 | 253 | 172 | A, B = list(map(int, input().split()))
if A <= 0 <= B:
print("Zero")
exit()
if 0 < A:
print("Positive")
elif B < 0:
c = B - A + 1
print(("Negative" if c % 2 else "Positive"))
else:
c = -A
print(("Negative" if c % 2 else "Positive"))
| a, b = list(map(int, input().split()))
if a <= 0 <= b:
print("Zero")
elif a > 0:
print("Positive")
else:
k = b - a + 1
print(("Negative" if k % 2 else "Positive"))
| false | 38.461538 | [
"-A, B = list(map(int, input().split()))",
"-if A <= 0 <= B:",
"+a, b = list(map(int, input().split()))",
"+if a <= 0 <= b:",
"- exit()",
"-if 0 < A:",
"+elif a > 0:",
"-elif B < 0:",
"- c = B - A + 1",
"- print((\"Negative\" if c % 2 else \"Positive\"))",
"- c = -A",
"- print((... | false | 0.04281 | 0.043465 | 0.984928 | [
"s289293672",
"s945042612"
] |
u373047809 | p02787 | python | s133579654 | s117803153 | 202 | 142 | 74,408 | 74,276 | Accepted | Accepted | 29.7 | def chmin(dp, i, *x):
dp[i] = min(dp[i], *x)
INF = float("inf")
# dp[i] := min 消耗する魔力 to H -= i
h, n = list(map(int, input().split()))
dp = [0] + [INF]*h
for _ in [None]*n:
a, b = list(map(int, input().split()))
for j in range(h + 1):
chmin(dp, min(j + a, h), dp[j] + b)
print((dp[h])) | (h,n),*t=[list(map(int,o.split()))for o in open(0)]
d=[0]+[9e9]*h
for a,b in t:
for j in range(h+1):d[j]=min(d[j],d[max(0,j-a)]+b)
print((d[h])) | 12 | 5 | 293 | 141 | def chmin(dp, i, *x):
dp[i] = min(dp[i], *x)
INF = float("inf")
# dp[i] := min 消耗する魔力 to H -= i
h, n = list(map(int, input().split()))
dp = [0] + [INF] * h
for _ in [None] * n:
a, b = list(map(int, input().split()))
for j in range(h + 1):
chmin(dp, min(j + a, h), dp[j] + b)
print((dp[h]))
| (h, n), *t = [list(map(int, o.split())) for o in open(0)]
d = [0] + [9e9] * h
for a, b in t:
for j in range(h + 1):
d[j] = min(d[j], d[max(0, j - a)] + b)
print((d[h]))
| false | 58.333333 | [
"-def chmin(dp, i, *x):",
"- dp[i] = min(dp[i], *x)",
"-",
"-",
"-INF = float(\"inf\")",
"-# dp[i] := min 消耗する魔力 to H -= i",
"-h, n = list(map(int, input().split()))",
"-dp = [0] + [INF] * h",
"-for _ in [None] * n:",
"- a, b = list(map(int, input().split()))",
"+(h, n), *t = [list(map(int... | false | 0.155666 | 0.110451 | 1.40936 | [
"s133579654",
"s117803153"
] |
u936985471 | p03061 | python | s140210278 | s045007407 | 186 | 170 | 14,076 | 14,196 | Accepted | Accepted | 8.6 | N=int(eval(input()))
A=list(map(int,input().split()))
# 1,7,6,8,1,
# L[i]=A[i]
def gcd(a,b):
if a<b:
a,b=b,a
while a%b>0:
a,b=b,a%b
return b
L=[1]*len(A)
L[0]=A[0]
for i in range(len(A)-1):
L[i+1]=gcd(L[i],A[i+1])
R=[1]*len(A)
R[-1]=A[-1]
for i in range(len(A)-1,0,-1):
R[i-1]=... | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int,readline().split()))
if N == 2:
print((max(A)))
exit(0)
def gcd(a,b):
if a < b:
a,b = b,a
while a%b > 0:
a,b = b,a%b
return b
left = [None] * N
left[0] = A[0]
for i in range(1, len(A)):
left[i] = gc... | 35 | 33 | 549 | 592 | N = int(eval(input()))
A = list(map(int, input().split()))
# 1,7,6,8,1,
# L[i]=A[i]
def gcd(a, b):
if a < b:
a, b = b, a
while a % b > 0:
a, b = b, a % b
return b
L = [1] * len(A)
L[0] = A[0]
for i in range(len(A) - 1):
L[i + 1] = gcd(L[i], A[i + 1])
R = [1] * len(A)
R[-1] = A[-1]
for ... | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))
if N == 2:
print((max(A)))
exit(0)
def gcd(a, b):
if a < b:
a, b = b, a
while a % b > 0:
a, b = b, a % b
return b
left = [None] * N
left[0] = A[0]
for i in range(1, len(A)):
l... | false | 5.714286 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-# 1,7,6,8,1,",
"-# L[i]=A[i]",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+A = list(map(int, readline().split()))",
"+if N == 2:",
"+ print((max(A)))",
"+ exit(0)",
"+",
"+",
"-... | false | 0.049162 | 0.045531 | 1.079751 | [
"s140210278",
"s045007407"
] |
u560867850 | p02850 | python | s601215923 | s970817514 | 463 | 410 | 53,140 | 53,892 | Accepted | Accepted | 11.45 | import sys
input = sys.stdin.readline
from collections import deque
def readlines(n):
for _ in range(n):
a, b = list(map(int, input().split()))
yield a, b
def main():
N = int(eval(input()))
edges = list(readlines(N-1))
tree = {i:[] for i in range(N)}
for a, b in edges:... | import sys
input = sys.stdin.readline
from collections import deque
def main():
N = int(eval(input()))
tree = {i:[] for i in range(N)}
edges = []
for _ in range(N-1):
a, b = list(map(int, input().split()))
edges.append((a, b))
tree[a].append(b)
ans = {}
fr... | 34 | 31 | 778 | 729 | import sys
input = sys.stdin.readline
from collections import deque
def readlines(n):
for _ in range(n):
a, b = list(map(int, input().split()))
yield a, b
def main():
N = int(eval(input()))
edges = list(readlines(N - 1))
tree = {i: [] for i in range(N)}
for a, b in edges:
... | import sys
input = sys.stdin.readline
from collections import deque
def main():
N = int(eval(input()))
tree = {i: [] for i in range(N)}
edges = []
for _ in range(N - 1):
a, b = list(map(int, input().split()))
edges.append((a, b))
tree[a].append(b)
ans = {}
frontier = d... | false | 8.823529 | [
"-def readlines(n):",
"- for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- yield a, b",
"-",
"-",
"- edges = list(readlines(N - 1))",
"- for a, b in edges:",
"+ edges = []",
"+ for _ in range(N - 1):",
"+ a, b = list(map(int, input().split())... | false | 0.041083 | 0.033226 | 1.236459 | [
"s601215923",
"s970817514"
] |
u530786533 | p02881 | python | s721937317 | s851828640 | 152 | 114 | 3,064 | 3,688 | Accepted | Accepted | 25 | n = int(eval(input()))
t = []
for i in range(1, int(n**0.5+1)):
if n % i == 0:
t.append(int(i+n/i))
print((min(t) - 2))
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append([i, n // i])
return divisors
n = int(eval(input()))
divisors = make_divisors(n)
print((min([sum(x)-2 for x in divisors])))
| 8 | 13 | 130 | 256 | n = int(eval(input()))
t = []
for i in range(1, int(n**0.5 + 1)):
if n % i == 0:
t.append(int(i + n / i))
print((min(t) - 2))
| def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
divisors.append([i, n // i])
return divisors
n = int(eval(input()))
divisors = make_divisors(n)
print((min([sum(x) - 2 for x in divisors])))
| false | 38.461538 | [
"+def make_divisors(n):",
"+ divisors = []",
"+ for i in range(1, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ divisors.append([i, n // i])",
"+ return divisors",
"+",
"+",
"-t = []",
"-for i in range(1, int(n**0.5 + 1)):",
"- if n % i == 0:",
"- t.append(int... | false | 0.045252 | 0.040265 | 1.123843 | [
"s721937317",
"s851828640"
] |
u579170193 | p03738 | python | s877386574 | s736939410 | 17 | 10 | 2,940 | 2,568 | Accepted | Accepted | 41.18 | a=int(eval(input()))-int(eval(input()));print((a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')) | a=eval(input());b=eval(input());print(a<b and'LESS'or a>b and'GREATER'or'EQUAL') | 1 | 1 | 76 | 67 | a = int(eval(input())) - int(eval(input()))
print((a > 0 and "GREATER" or a < 0 and "LESS" or "EQUAL"))
| a = eval(input())
b = eval(input())
print(a < b and "LESS" or a > b and "GREATER" or "EQUAL")
| false | 0 | [
"-a = int(eval(input())) - int(eval(input()))",
"-print((a > 0 and \"GREATER\" or a < 0 and \"LESS\" or \"EQUAL\"))",
"+a = eval(input())",
"+b = eval(input())",
"+print(a < b and \"LESS\" or a > b and \"GREATER\" or \"EQUAL\")"
] | false | 0.037373 | 0.037013 | 1.009749 | [
"s877386574",
"s736939410"
] |
u671060652 | p03145 | python | s988212855 | s044916181 | 283 | 71 | 63,980 | 61,716 | Accepted | Accepted | 74.91 | import itertools
import math
import fractions
import functools
import copy
ab, bc, ca = list(map(int, input().split()))
print((ab*bc//2)) | def main():
# n = int(input())
a, b, c = list(map(int, input().split()))
# h = list(map(int, input().split()))
# s = input()
print((a*b//2))
if __name__ == '__main__':
main()
| 8 | 11 | 137 | 204 | import itertools
import math
import fractions
import functools
import copy
ab, bc, ca = list(map(int, input().split()))
print((ab * bc // 2))
| def main():
# n = int(input())
a, b, c = list(map(int, input().split()))
# h = list(map(int, input().split()))
# s = input()
print((a * b // 2))
if __name__ == "__main__":
main()
| false | 27.272727 | [
"-import itertools",
"-import math",
"-import fractions",
"-import functools",
"-import copy",
"+def main():",
"+ # n = int(input())",
"+ a, b, c = list(map(int, input().split()))",
"+ # h = list(map(int, input().split()))",
"+ # s = input()",
"+ print((a * b // 2))",
"-ab, bc, ... | false | 0.035861 | 0.03676 | 0.97553 | [
"s988212855",
"s044916181"
] |
u173072656 | p03476 | python | s486353470 | s882673151 | 818 | 733 | 33,188 | 14,772 | Accepted | Accepted | 10.39 | q = int(eval(input()))
a = [list(map(int, input().split())) for i in range(q)]
s = [0]*(2*10**5+2)
s[3] = 1
for i in range(3, 10**5):
for j in range(2, int((2*i)**0.5)+2):
if (i > j and i % j == 0) or (2*i-1) % j == 0:
b = 0
break
else:
b = 1
s[2*i-... | import math
from itertools import accumulate
def is_prime(n):
if n == 1:
return 0
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return 0
return 1
Q = int(eval(input()))
L = [0]*Q
R = [0]*Q
for i in range(Q):
L[i], R[i] = list(map(int, inp... | 18 | 39 | 456 | 676 | q = int(eval(input()))
a = [list(map(int, input().split())) for i in range(q)]
s = [0] * (2 * 10**5 + 2)
s[3] = 1
for i in range(3, 10**5):
for j in range(2, int((2 * i) ** 0.5) + 2):
if (i > j and i % j == 0) or (2 * i - 1) % j == 0:
b = 0
break
else:
b = 1
s[2 * i -... | import math
from itertools import accumulate
def is_prime(n):
if n == 1:
return 0
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return 0
return 1
Q = int(eval(input()))
L = [0] * Q
R = [0] * Q
for i in range(Q):
L[i], R[i] = list(map(int, input().split()))
min_... | false | 53.846154 | [
"-q = int(eval(input()))",
"-a = [list(map(int, input().split())) for i in range(q)]",
"-s = [0] * (2 * 10**5 + 2)",
"-s[3] = 1",
"-for i in range(3, 10**5):",
"- for j in range(2, int((2 * i) ** 0.5) + 2):",
"- if (i > j and i % j == 0) or (2 * i - 1) % j == 0:",
"- b = 0",
"- ... | false | 0.677834 | 0.048532 | 13.966756 | [
"s486353470",
"s882673151"
] |
u852690916 | p03045 | python | s039664844 | s529840132 | 669 | 368 | 71,456 | 56,792 | Accepted | Accepted | 44.99 | N,M=list(map(int, input().split()))
E=[[] for _ in range(N)]
for _ in range(M):
x,y,z=[int(i)-1 for i in input().split()]
E[x].append(y)
E[y].append(x)
#情報のつながりがあるカードでグルーピングする
#グループIDのリスト(0は未割り当て)
G=[0]*(N+1)
def dfs(root,g):
stack=[root]
G[root]=g
while stack:
node=stac... | import sys
def main():
input = sys.stdin.readline
N,M=list(map(int, input().split()))
uf = UnionFindTree(N)
for _ in range(M):
x,y,z=list(map(int, input().split()))
uf.union(x-1,y-1)
c=set([uf.find(i) for i in range(N)])
print((len(c)))
class UnionFindTree:
d... | 28 | 34 | 535 | 835 | N, M = list(map(int, input().split()))
E = [[] for _ in range(N)]
for _ in range(M):
x, y, z = [int(i) - 1 for i in input().split()]
E[x].append(y)
E[y].append(x)
# 情報のつながりがあるカードでグルーピングする
# グループIDのリスト(0は未割り当て)
G = [0] * (N + 1)
def dfs(root, g):
stack = [root]
G[root] = g
while stack:
... | import sys
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
uf = UnionFindTree(N)
for _ in range(M):
x, y, z = list(map(int, input().split()))
uf.union(x - 1, y - 1)
c = set([uf.find(i) for i in range(N)])
print((len(c)))
class UnionFindTree:
... | false | 17.647059 | [
"-N, M = list(map(int, input().split()))",
"-E = [[] for _ in range(N)]",
"-for _ in range(M):",
"- x, y, z = [int(i) - 1 for i in input().split()]",
"- E[x].append(y)",
"- E[y].append(x)",
"-# 情報のつながりがあるカードでグルーピングする",
"-# グループIDのリスト(0は未割り当て)",
"-G = [0] * (N + 1)",
"+import sys",
"-def... | false | 0.045911 | 0.088393 | 0.519396 | [
"s039664844",
"s529840132"
] |
u389910364 | p03112 | python | s673626085 | s375603537 | 1,722 | 1,102 | 12,092 | 47,504 | Accepted | Accepted | 36 | import bisect
s_len, t_len, q = list(map(int, input().split()))
shrines = []
temples = []
for _ in range(s_len):
shrines.append(int(eval(input())))
for _ in range(t_len):
temples.append(int(eval(input())))
def distance(s_i, t_i, x):
"""
s_i と t_i を最短でまわる距離。無効なインデックスなら inf を返す
"""
... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
fro... | 42 | 70 | 966 | 1,657 | import bisect
s_len, t_len, q = list(map(int, input().split()))
shrines = []
temples = []
for _ in range(s_len):
shrines.append(int(eval(input())))
for _ in range(t_len):
temples.append(int(eval(input())))
def distance(s_i, t_i, x):
"""
s_i と t_i を最短でまわる距離。無効なインデックスなら inf を返す
"""
if 0 <= s_i ... | import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator impo... | false | 40 | [
"+import cmath",
"+import heapq",
"+import itertools",
"+import math",
"+import operator",
"+import os",
"+import re",
"+import string",
"+import sys",
"+from collections import Counter, deque, defaultdict",
"+from copy import deepcopy",
"+from decimal import Decimal",
"+from fractions impor... | false | 0.03893 | 0.221105 | 0.176068 | [
"s673626085",
"s375603537"
] |
u067975558 | p02412 | python | s552436539 | s507210699 | 630 | 580 | 6,724 | 6,724 | Accepted | Accepted | 7.94 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
for k in range(j + 1, n + 1):
if i + j + k == x:
count += 1
print(count) | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
for k in range(j + 1, n + 1):
if x - (i + j + k) == 0:
count += 1
if x ... | 11 | 13 | 309 | 383 | while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
for k in range(j + 1, n + 1):
if i + j + k == x:
count += 1
print(count)
| while True:
(n, x) = [int(i) for i in input().split()]
if n == x == 0:
break
count = 0
for i in range(1, n + 1):
for j in range(i + 1, n + 1):
for k in range(j + 1, n + 1):
if x - (i + j + k) == 0:
count += 1
if x - (i + j +... | false | 15.384615 | [
"- if i + j + k == x:",
"+ if x - (i + j + k) == 0:",
"+ if x - (i + j + k) < 0:",
"+ break"
] | false | 0.045019 | 0.044121 | 1.020344 | [
"s552436539",
"s507210699"
] |
u573754721 | p02951 | python | s894494508 | s745081365 | 163 | 21 | 38,256 | 3,316 | Accepted | Accepted | 87.12 | lis = list(map(int, input().split()))
if lis[2] - (lis[0] - lis[1]) > 0:
print((lis[2] - (lis[0] - lis[1])))
else:
print((0)) | a,b,c=list(map(int,input().split()))
print((c-(a-b) if c-(a-b)>0 else 0)) | 6 | 2 | 135 | 66 | lis = list(map(int, input().split()))
if lis[2] - (lis[0] - lis[1]) > 0:
print((lis[2] - (lis[0] - lis[1])))
else:
print((0))
| a, b, c = list(map(int, input().split()))
print((c - (a - b) if c - (a - b) > 0 else 0))
| false | 66.666667 | [
"-lis = list(map(int, input().split()))",
"-if lis[2] - (lis[0] - lis[1]) > 0:",
"- print((lis[2] - (lis[0] - lis[1])))",
"-else:",
"- print((0))",
"+a, b, c = list(map(int, input().split()))",
"+print((c - (a - b) if c - (a - b) > 0 else 0))"
] | false | 0.040593 | 0.036082 | 1.125039 | [
"s894494508",
"s745081365"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.