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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u716530146 | p03774 | python | s771257828 | s703165877 | 176 | 22 | 39,408 | 3,316 | Accepted | Accepted | 87.5 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1
n,m=list(map(int,input().split()))
ab=[tuple(map(int,input().split())) for i in range(n)]
cd=[tuple(map(int,input().split()... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n,m = list(map(int,input().split()))
CD = [tuple(map(int,input().split())) for i in range(n)]
AB... | 22 | 12 | 554 | 462 | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
ans = 0
count = 0
pro = 1
n, m = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(n)]
cd = [tuple(map(int, input().split()... | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, m = list(map(int, input().split()))
CD = [tuple(map(int, input().split())) for i in range(n)]
AB = [tup... | false | 45.454545 | [
"+mod = 10**9 + 7",
"+mans = inf",
"-ab = [tuple(map(int, input().split())) for i in range(n)]",
"-cd = [tuple(map(int, input().split())) for i in range(m)]",
"-for a, b in ab:",
"- tmp = inf",
"- candi = 0",
"- for j in range(m):",
"- c = cd[j][0]",
"- d = cd[j][1]",
"- ... | false | 0.086542 | 0.035523 | 2.436202 | [
"s771257828",
"s703165877"
] |
u726615467 | p02969 | python | s685048020 | s594607543 | 20 | 17 | 3,316 | 2,940 | Accepted | Accepted | 15 | import sys
# input = sys.stdin.readline
inf = 10 ** 18
P = 10 ** 9 + 7
print(( 3 * (int(eval(input())) ** 2) )) | r = int(eval(input()))
print((3 * r * r)) | 6 | 3 | 109 | 36 | import sys
# input = sys.stdin.readline
inf = 10**18
P = 10**9 + 7
print((3 * (int(eval(input())) ** 2)))
| r = int(eval(input()))
print((3 * r * r))
| false | 50 | [
"-import sys",
"-",
"-# input = sys.stdin.readline",
"-inf = 10**18",
"-P = 10**9 + 7",
"-print((3 * (int(eval(input())) ** 2)))",
"+r = int(eval(input()))",
"+print((3 * r * r))"
] | false | 0.051049 | 0.051333 | 0.994466 | [
"s685048020",
"s594607543"
] |
u587518324 | p02645 | python | s620557193 | s680545325 | 25 | 22 | 8,952 | 9,096 | Accepted | Accepted | 12 | #!/usr/bin/env python
def main():
S = eval(input())
print((S[0:3]))
if __name__ == '__main__':
main()
| #!/usr/bin/env python
"""AtCoder Grand Contest 044: A - Nickname
https://atcoder.jp/contests/agc044/tasks/agc044_a
"""
def main():
S = eval(input())
print((S[0:3]))
if __name__ == '__main__':
main()
| 10 | 13 | 119 | 219 | #!/usr/bin/env python
def main():
S = eval(input())
print((S[0:3]))
if __name__ == "__main__":
main()
| #!/usr/bin/env python
"""AtCoder Grand Contest 044: A - Nickname
https://atcoder.jp/contests/agc044/tasks/agc044_a
"""
def main():
S = eval(input())
print((S[0:3]))
if __name__ == "__main__":
main()
| false | 23.076923 | [
"+\"\"\"AtCoder Grand Contest 044: A - Nickname",
"+https://atcoder.jp/contests/agc044/tasks/agc044_a",
"+\"\"\"",
"+",
"+"
] | false | 0.034578 | 0.032904 | 1.050865 | [
"s620557193",
"s680545325"
] |
u794173881 | p03819 | python | s521916676 | s932775009 | 1,423 | 1,219 | 128,348 | 125,916 | Accepted | Accepted | 14.34 | from operator import itemgetter
import sys
input = sys.stdin.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答えるデータ構造"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while i > 0:
self.bit[i] += val
i -= i ... | from operator import itemgetter
import sys
input = sys.stdin.buffer.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答えるデータ構造"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while i > 0:
self.bit[i] += val
... | 57 | 57 | 1,307 | 1,314 | from operator import itemgetter
import sys
input = sys.stdin.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答えるデータ構造"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while i > 0:
self.bit[i] += val
i -= i & -i
de... | from operator import itemgetter
import sys
input = sys.stdin.buffer.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答えるデータ構造"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while i > 0:
self.bit[i] += val
i -= i & -i
... | false | 0 | [
"-input = sys.stdin.readline",
"+input = sys.stdin.buffer.readline"
] | false | 0.03391 | 0.036055 | 0.940505 | [
"s521916676",
"s932775009"
] |
u340781749 | p03064 | python | s372096698 | s957151824 | 1,537 | 1,358 | 17,224 | 17,992 | Accepted | Accepted | 11.65 | import sys
import numpy as np
n = int(eval(input()))
aaa = list(map(int, sys.stdin))
MOD = 998244353
s = sum(aaa)
dp1 = np.zeros(s + 1, dtype=np.int64)
dp2 = np.zeros(s + 1, dtype=np.int64)
dp1[0] = 1
dp2[0] = 1
for a in aaa:
dp1a = np.roll(dp1, a)
dp1 *= 2
dp1 %= MOD
dp1 += dp1a
... | import sys
import numpy as np
n = int(eval(input()))
aaa = list(map(int, sys.stdin))
MOD = 998244353
s = sum(aaa)
dp1 = np.zeros(s + 1, dtype=np.int64)
dp2 = np.zeros(s + 1, dtype=np.int64)
dp1[0] = 1
dp2[0] = 1
for a in aaa:
dp1 = (dp1 * 2 + np.roll(dp1, a)) % MOD
dp2 = (dp2 + np.roll(dp2, a)) ... | 27 | 21 | 505 | 454 | import sys
import numpy as np
n = int(eval(input()))
aaa = list(map(int, sys.stdin))
MOD = 998244353
s = sum(aaa)
dp1 = np.zeros(s + 1, dtype=np.int64)
dp2 = np.zeros(s + 1, dtype=np.int64)
dp1[0] = 1
dp2[0] = 1
for a in aaa:
dp1a = np.roll(dp1, a)
dp1 *= 2
dp1 %= MOD
dp1 += dp1a
dp1 %= MOD
dp2... | import sys
import numpy as np
n = int(eval(input()))
aaa = list(map(int, sys.stdin))
MOD = 998244353
s = sum(aaa)
dp1 = np.zeros(s + 1, dtype=np.int64)
dp2 = np.zeros(s + 1, dtype=np.int64)
dp1[0] = 1
dp2[0] = 1
for a in aaa:
dp1 = (dp1 * 2 + np.roll(dp1, a)) % MOD
dp2 = (dp2 + np.roll(dp2, a)) % MOD
h = (s + ... | false | 22.222222 | [
"- dp1a = np.roll(dp1, a)",
"- dp1 *= 2",
"- dp1 %= MOD",
"- dp1 += dp1a",
"- dp1 %= MOD",
"- dp2 += np.roll(dp2, a)",
"- dp2 %= MOD",
"+ dp1 = (dp1 * 2 + np.roll(dp1, a)) % MOD",
"+ dp2 = (dp2 + np.roll(dp2, a)) % MOD"
] | false | 0.007934 | 0.283096 | 0.028026 | [
"s372096698",
"s957151824"
] |
u576917603 | p03160 | python | s010499872 | s981964565 | 226 | 175 | 52,208 | 13,980 | Accepted | Accepted | 22.57 | n=int(eval(input()))
a=list(map(int,input().split()))
dp=[10**9]*(n)
dp[0]=0
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]))
if i==1:
continue
dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]))
print((dp[n-1])) | n=int(eval(input()))
a=list(map(int,input().split()))
dp=[float('inf')]*n
dp[0]=0
for i in range(1,n):
dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]))
if i==1:
continue
dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]))
print((dp[-1])) | 10 | 10 | 238 | 241 | n = int(eval(input()))
a = list(map(int, input().split()))
dp = [10**9] * (n)
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]))
if i == 1:
continue
dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]))
print((dp[n - 1]))
| n = int(eval(input()))
a = list(map(int, input().split()))
dp = [float("inf")] * n
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]))
if i == 1:
continue
dp[i] = min(dp[i], dp[i - 2] + abs(a[i] - a[i - 2]))
print((dp[-1]))
| false | 0 | [
"-dp = [10**9] * (n)",
"+dp = [float(\"inf\")] * n",
"-print((dp[n - 1]))",
"+print((dp[-1]))"
] | false | 0.067878 | 0.035048 | 1.936715 | [
"s010499872",
"s981964565"
] |
u345966487 | p03835 | python | s744809556 | s908052310 | 1,458 | 892 | 2,940 | 2,940 | Accepted | Accepted | 38.82 | K,S=list(map(int,input().split()))
cnt=0
for x in range(K+1):
for y in range(K+1):
z = S - x - y
if 0 <= z <= K:
cnt+=1
print(cnt) | K,S=list(map(int,input().split()))
print((sum(1for x in range(K+1)for y in range(K+1)if 0<=S-x-y<=K))) | 8 | 2 | 147 | 95 | K, S = list(map(int, input().split()))
cnt = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z <= K:
cnt += 1
print(cnt)
| K, S = list(map(int, input().split()))
print((sum(1 for x in range(K + 1) for y in range(K + 1) if 0 <= S - x - y <= K)))
| false | 75 | [
"-cnt = 0",
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z <= K:",
"- cnt += 1",
"-print(cnt)",
"+print((sum(1 for x in range(K + 1) for y in range(K + 1) if 0 <= S - x - y <= K)))"
] | false | 0.03721 | 0.036074 | 1.03148 | [
"s744809556",
"s908052310"
] |
u816631826 | p03145 | python | s952598778 | s060263321 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | entrada = [int(x) for x in input().split()]
entrada.sort()
cat1 = entrada[0]
cat2 = entrada[1]
print((int(cat1*cat2/2)))
| triangulo = eval(input())
lados = triangulo.split()
AB = lados[0]
BC = lados[1]
area = (int(AB) * int(BC))/2
print(("%.0f" % area)) | 5 | 6 | 123 | 128 | entrada = [int(x) for x in input().split()]
entrada.sort()
cat1 = entrada[0]
cat2 = entrada[1]
print((int(cat1 * cat2 / 2)))
| triangulo = eval(input())
lados = triangulo.split()
AB = lados[0]
BC = lados[1]
area = (int(AB) * int(BC)) / 2
print(("%.0f" % area))
| false | 16.666667 | [
"-entrada = [int(x) for x in input().split()]",
"-entrada.sort()",
"-cat1 = entrada[0]",
"-cat2 = entrada[1]",
"-print((int(cat1 * cat2 / 2)))",
"+triangulo = eval(input())",
"+lados = triangulo.split()",
"+AB = lados[0]",
"+BC = lados[1]",
"+area = (int(AB) * int(BC)) / 2",
"+print((\"%.0f\" % ... | false | 0.06602 | 0.065833 | 1.002847 | [
"s952598778",
"s060263321"
] |
u600402037 | p02888 | python | s476157984 | s602531986 | 1,286 | 814 | 3,188 | 3,188 | Accepted | Accepted | 36.7 | import sys
from bisect import bisect_left
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
L = lr()
L.sort()
answer = 0
for i in range(N-2):
for j in range(i+1, N-1):
index = bisect_left(L, (L[i]+L[j]))
answer += ind... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
L = lr()
L.sort()
answer = 0
for i in range(N-1, -1, -1):
# iが一番大きい辺
x = L[i]
left = 0
right = i - 1
while left < right:
if L[left] + L[right] <= ... | 17 | 23 | 348 | 439 | import sys
from bisect import bisect_left
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
L = lr()
L.sort()
answer = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
index = bisect_left(L, (L[i] + L[j]))
answer += index - j ... | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
L = lr()
L.sort()
answer = 0
for i in range(N - 1, -1, -1):
# iが一番大きい辺
x = L[i]
left = 0
right = i - 1
while left < right:
if L[left] + L[right] <= x:
... | false | 26.086957 | [
"-from bisect import bisect_left",
"-for i in range(N - 2):",
"- for j in range(i + 1, N - 1):",
"- index = bisect_left(L, (L[i] + L[j]))",
"- answer += index - j - 1",
"+for i in range(N - 1, -1, -1):",
"+ # iが一番大きい辺",
"+ x = L[i]",
"+ left = 0",
"+ right = i - 1",
... | false | 0.047777 | 0.108214 | 0.441504 | [
"s476157984",
"s602531986"
] |
u808427016 | p03208 | python | s452622715 | s895947777 | 262 | 219 | 8,256 | 8,280 | Accepted | Accepted | 16.41 | N, K = [int(_) for _ in input().split()]
h = [int(eval(input())) for i in range(N)]
xs = sorted(h)
result = xs[-1]
for i in range(N - K + 1):
r = xs[i + K - 1] - xs[i]
result = min(result, r)
print(result) | N, K = [int(_) for _ in input().split()]
h = [int(eval(input())) for i in range(N)]
xs = sorted(h)
result = min(xs[i + K - 1] - xs[i] for i in range(N - K + 1))
print(result) | 10 | 7 | 218 | 176 | N, K = [int(_) for _ in input().split()]
h = [int(eval(input())) for i in range(N)]
xs = sorted(h)
result = xs[-1]
for i in range(N - K + 1):
r = xs[i + K - 1] - xs[i]
result = min(result, r)
print(result)
| N, K = [int(_) for _ in input().split()]
h = [int(eval(input())) for i in range(N)]
xs = sorted(h)
result = min(xs[i + K - 1] - xs[i] for i in range(N - K + 1))
print(result)
| false | 30 | [
"-result = xs[-1]",
"-for i in range(N - K + 1):",
"- r = xs[i + K - 1] - xs[i]",
"- result = min(result, r)",
"+result = min(xs[i + K - 1] - xs[i] for i in range(N - K + 1))"
] | false | 0.007264 | 0.040361 | 0.179966 | [
"s452622715",
"s895947777"
] |
u620945921 | p03485 | python | s532973364 | s404458438 | 21 | 18 | 3,060 | 2,940 | Accepted | Accepted | 14.29 | a, b = (int(i) for i in input().split())
#print(a,b)
c=-(-(a+b)//2)
print(c) | a, b = (int(i) for i in input().split())
#print(a,b)
c=(a+b+(2-1))//2
print(c) | 5 | 5 | 81 | 83 | a, b = (int(i) for i in input().split())
# print(a,b)
c = -(-(a + b) // 2)
print(c)
| a, b = (int(i) for i in input().split())
# print(a,b)
c = (a + b + (2 - 1)) // 2
print(c)
| false | 0 | [
"-c = -(-(a + b) // 2)",
"+c = (a + b + (2 - 1)) // 2"
] | false | 0.048768 | 0.046116 | 1.057502 | [
"s532973364",
"s404458438"
] |
u865383026 | p02879 | python | s153269749 | s367558280 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | I = input().split()
print((-1 if int(I[0]) > 9 or int(I[1]) > 9 else int(I[0]) * int(I[1]))) | I = input().split()
A = int(I[0])
B = int(I[1])
print((-1 if A > 9 or B > 9 else A * B)) | 2 | 4 | 91 | 89 | I = input().split()
print((-1 if int(I[0]) > 9 or int(I[1]) > 9 else int(I[0]) * int(I[1])))
| I = input().split()
A = int(I[0])
B = int(I[1])
print((-1 if A > 9 or B > 9 else A * B))
| false | 50 | [
"-print((-1 if int(I[0]) > 9 or int(I[1]) > 9 else int(I[0]) * int(I[1])))",
"+A = int(I[0])",
"+B = int(I[1])",
"+print((-1 if A > 9 or B > 9 else A * B))"
] | false | 0.043743 | 0.043895 | 0.996524 | [
"s153269749",
"s367558280"
] |
u411203878 | p03588 | python | s981790854 | s970307500 | 733 | 434 | 66,264 | 85,692 | Accepted | Accepted | 40.79 | n=int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: -x[0])
print((ab[0][0]+ab[0][1])) | N = int(eval(input()))
AB = [list(map(int,input().split())) for _ in range(N)]
AB.sort(reverse=True)
print((sum(AB[0]))) | 7 | 7 | 176 | 121 | n = int(eval(input()))
ab = []
for _ in range(n):
a, b = (int(x) for x in input().split())
ab.append([a, b])
ab = sorted(ab, key=lambda x: -x[0])
print((ab[0][0] + ab[0][1]))
| N = int(eval(input()))
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(reverse=True)
print((sum(AB[0])))
| false | 0 | [
"-n = int(eval(input()))",
"-ab = []",
"-for _ in range(n):",
"- a, b = (int(x) for x in input().split())",
"- ab.append([a, b])",
"-ab = sorted(ab, key=lambda x: -x[0])",
"-print((ab[0][0] + ab[0][1]))",
"+N = int(eval(input()))",
"+AB = [list(map(int, input().split())) for _ in range(N)]",
... | false | 0.038783 | 0.065633 | 0.590903 | [
"s981790854",
"s970307500"
] |
u365686736 | p02396 | python | s445744934 | s476531704 | 130 | 60 | 7,576 | 7,396 | Accepted | Accepted | 53.85 | i=1
x=int(eval(input()))
while x!=0:
print(("Case {}: {}".format(i,x)))
i+=1
x=int(eval(input())) | import sys
i=1
for l in sys.stdin:
x=l.rstrip('\r\n')
if x=="0":break
print(("Case {}: {}".format(i,x)))
i+=1 | 6 | 7 | 100 | 129 | i = 1
x = int(eval(input()))
while x != 0:
print(("Case {}: {}".format(i, x)))
i += 1
x = int(eval(input()))
| import sys
i = 1
for l in sys.stdin:
x = l.rstrip("\r\n")
if x == "0":
break
print(("Case {}: {}".format(i, x)))
i += 1
| false | 14.285714 | [
"+import sys",
"+",
"-x = int(eval(input()))",
"-while x != 0:",
"+for l in sys.stdin:",
"+ x = l.rstrip(\"\\r\\n\")",
"+ if x == \"0\":",
"+ break",
"- x = int(eval(input()))"
] | false | 0.043118 | 0.043785 | 0.984772 | [
"s445744934",
"s476531704"
] |
u509621775 | p02936 | python | s352159433 | s273363611 | 1,821 | 999 | 266,880 | 62,232 | Accepted | Accepted | 45.14 | from sys import stdin, setrecursionlimit
def main():
def walk(p, c):
if visited[p]:
return
visited[p] = True
cnt[p] += c
for n in tree[p]:
walk(n, cnt[p])
setrecursionlimit(2000001)
n, q = [int(x) for x in stdin.readline().split()]
... | from sys import stdin
from collections import deque
def main():
_map, _input, _int = map, stdin.readline, int
n, q = _map(_int, _input().split())
values = [0] * n
links = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = _map(_int, _input().split())
if a >= b:
return
links[a - ... | 35 | 27 | 759 | 677 | from sys import stdin, setrecursionlimit
def main():
def walk(p, c):
if visited[p]:
return
visited[p] = True
cnt[p] += c
for n in tree[p]:
walk(n, cnt[p])
setrecursionlimit(2000001)
n, q = [int(x) for x in stdin.readline().split()]
tree = [[] fo... | from sys import stdin
from collections import deque
def main():
_map, _input, _int = map, stdin.readline, int
n, q = _map(_int, _input().split())
values = [0] * n
links = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = _map(_int, _input().split())
if a >= b:
return... | false | 22.857143 | [
"-from sys import stdin, setrecursionlimit",
"+from sys import stdin",
"+from collections import deque",
"- def walk(p, c):",
"- if visited[p]:",
"+ _map, _input, _int = map, stdin.readline, int",
"+ n, q = _map(_int, _input().split())",
"+ values = [0] * n",
"+ links = [[] for... | false | 0.035118 | 0.036025 | 0.974818 | [
"s352159433",
"s273363611"
] |
u920103253 | p03557 | python | s896201696 | s813127323 | 461 | 367 | 113,124 | 24,684 | Accepted | Accepted | 20.39 | def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(eval(input())) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
n=n0()
a=n1()
b=n1()
c=n1()
a.sort()
b.sort()
c.sort()
from bisect import bisect_left,bisec... |
def s0():return eval(input())
def s1():return input().split()
def s2(n):return [eval(input()) for x in range(n)]
def s3(n):return [[input().split()] for _ in range(n)]
def n0():return int(eval(input()))
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(eval(input())) for _ in range(n)]
de... | 29 | 34 | 526 | 688 | def n0():
return int(eval(input()))
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [int(eval(input())) for _ in range(n)]
def n3(n):
return [[int(x) for x in input().split()] for _ in range(n)]
n = n0()
a = n1()
b = n1()
c = n1()
a.sort()
b.sort()
c.sort()
from bisect impor... | def s0():
return eval(input())
def s1():
return input().split()
def s2(n):
return [eval(input()) for x in range(n)]
def s3(n):
return [[input().split()] for _ in range(n)]
def n0():
return int(eval(input()))
def n1():
return [int(x) for x in input().split()]
def n2(n):
return [in... | false | 14.705882 | [
"+def s0():",
"+ return eval(input())",
"+",
"+",
"+def s1():",
"+ return input().split()",
"+",
"+",
"+def s2(n):",
"+ return [eval(input()) for x in range(n)]",
"+",
"+",
"+def s3(n):",
"+ return [[input().split()] for _ in range(n)]",
"+",
"+"
] | false | 0.117203 | 0.04302 | 2.724387 | [
"s896201696",
"s813127323"
] |
u753803401 | p03243 | python | s556464851 | s325789686 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | n = eval(input())
if int(n) > int(n[0] * 3):
print((str(int(n[0]) + 1) * 3))
else:
print((n[0] * 3))
| n = int(eval(input()))
n = (n + 110) // 111 * 111
print(n)
| 5 | 3 | 103 | 55 | n = eval(input())
if int(n) > int(n[0] * 3):
print((str(int(n[0]) + 1) * 3))
else:
print((n[0] * 3))
| n = int(eval(input()))
n = (n + 110) // 111 * 111
print(n)
| false | 40 | [
"-n = eval(input())",
"-if int(n) > int(n[0] * 3):",
"- print((str(int(n[0]) + 1) * 3))",
"-else:",
"- print((n[0] * 3))",
"+n = int(eval(input()))",
"+n = (n + 110) // 111 * 111",
"+print(n)"
] | false | 0.049994 | 0.05078 | 0.984513 | [
"s556464851",
"s325789686"
] |
u753803401 | p02898 | python | s948820592 | s205946679 | 219 | 202 | 51,440 | 51,440 | Accepted | Accepted | 7.76 | def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip('\n').split()))
h = list(map(int, input().rstrip('\n').split()))
cnt = 0
for i in range(n):
cnt += 1 if h[i] >= k else 0
print(cnt)
if __name__ == '__main__':
slove()
| def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip('\n').split()))
h = list(map(int, input().rstrip('\n').split()))
cnt = 0
for i in range(n):
if h[i] >= k:
cnt += 1
print(cnt)
if __name__ == '__main__':
slove()
| 13 | 14 | 308 | 315 | def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip("\n").split()))
h = list(map(int, input().rstrip("\n").split()))
cnt = 0
for i in range(n):
cnt += 1 if h[i] >= k else 0
print(cnt)
if __name__ == "__main__":
slove()
| def slove():
import sys
input = sys.stdin.readline
n, k = list(map(int, input().rstrip("\n").split()))
h = list(map(int, input().rstrip("\n").split()))
cnt = 0
for i in range(n):
if h[i] >= k:
cnt += 1
print(cnt)
if __name__ == "__main__":
slove()
| false | 7.142857 | [
"- cnt += 1 if h[i] >= k else 0",
"+ if h[i] >= k:",
"+ cnt += 1"
] | false | 0.165659 | 0.0831 | 1.993488 | [
"s948820592",
"s205946679"
] |
u366482170 | p02787 | python | s157038250 | s287961527 | 337 | 304 | 40,944 | 41,328 | Accepted | Accepted | 9.79 | #import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
import itertools
#import bisect
import copy
def sosuhante(n):
for k in range(2, int(math.sqrt(n))+1):
if n% k ==0:
return False
return True
def cmb(n, r):
if n - r < r: r = n ... | #import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
import itertools
#import bisect
import copy
from functools import lru_cache
def sosuhante(n):
for k in range(2, int(math.sqrt(n))+1):
if n% k ==0:
return False
return True
def cmb(n,... | 79 | 76 | 1,659 | 1,611 | # import sys
MOD = 10**9 + 7
INFI = 10**10
# input = sys.stdin.readline
import math
import itertools
# import bisect
import copy
def sosuhante(n):
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
def cmb(n, r):
if n - r < r:
r = n - r
if ... | # import sys
MOD = 10**9 + 7
INFI = 10**10
# input = sys.stdin.readline
import math
import itertools
# import bisect
import copy
from functools import lru_cache
def sosuhante(n):
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
def cmb(n, r):
if n - ... | false | 3.797468 | [
"+from functools import lru_cache",
"- a = []",
"- b = []",
"- for i in range(n):",
"- x, y = list(map(int, input().split()))",
"- a.append(x)",
"- b.append(y)",
"- dp = [INFI for i in range(h + 1)]",
"+ ab = [list(map(int, input().split())) for i in range(n)]",
... | false | 0.07809 | 0.063485 | 1.230049 | [
"s157038250",
"s287961527"
] |
u806403461 | p02755 | python | s769411886 | s338222541 | 20 | 17 | 3,064 | 2,940 | Accepted | Accepted | 15 | A, B = list(map(int, input().split()))
ans = -1
for x in range(10001):
if int(x*0.08) == A and int(x*0.1) == B:
ans = x
break
print(ans)
| A, B = list(map(int, input().split()))
ans = -1
for x in range(1010):
if int(x*0.08) == A and int(x*0.1) == B:
ans = x
break
print(ans)
| 8 | 8 | 159 | 158 | A, B = list(map(int, input().split()))
ans = -1
for x in range(10001):
if int(x * 0.08) == A and int(x * 0.1) == B:
ans = x
break
print(ans)
| A, B = list(map(int, input().split()))
ans = -1
for x in range(1010):
if int(x * 0.08) == A and int(x * 0.1) == B:
ans = x
break
print(ans)
| false | 0 | [
"-for x in range(10001):",
"+for x in range(1010):"
] | false | 0.055588 | 0.073573 | 0.755544 | [
"s769411886",
"s338222541"
] |
u731235119 | p00774 | python | s947038259 | s596940203 | 170 | 150 | 4,292 | 4,280 | Accepted | Accepted | 11.76 | while 1:
H = int(input())
if H == 0:
break
Board = [[0 for j in range(H+1)] for i in range(6)]
for j in range(H):
inputs = list(map(int,input().split(" ")))
for i in range(5):
Board[i][H-j] = inputs[i]
total_score = 0
tmp_score = -1
while tmp_score != 0:
tmp_score = 0
tmpBoard = [[0] fo... | while 1:
H = int(input())
if H == 0:
break
Board = [[0 for j in range(H+1)] for i in range(6)]
for j in range(H):
inputs = list(map(int,input().split(" ")))
for i in range(5):
Board[i][H-j] = inputs[i]
total_score = 0
tmp_score = -1
while tmp_score != 0:
tmp_score = 0
tmpBoard = [[0 for... | 31 | 31 | 806 | 789 | while 1:
H = int(input())
if H == 0:
break
Board = [[0 for j in range(H + 1)] for i in range(6)]
for j in range(H):
inputs = list(map(int, input().split(" ")))
for i in range(5):
Board[i][H - j] = inputs[i]
total_score = 0
tmp_score = -1
while tmp_score !=... | while 1:
H = int(input())
if H == 0:
break
Board = [[0 for j in range(H + 1)] for i in range(6)]
for j in range(H):
inputs = list(map(int, input().split(" ")))
for i in range(5):
Board[i][H - j] = inputs[i]
total_score = 0
tmp_score = -1
while tmp_score !=... | false | 0 | [
"- tmpBoard = [[0] for i in range(6)]",
"+ tmpBoard = [[0 for j in range(H + 1)] for i in range(6)]",
"- tmpBoard[i - 1 - h].append(Board[i - 1 - h][j])",
"+ tmpBoard[i - 1 - h][tmpBoard[i - 1 - h][0]] = Board[",
"+ ... | false | 0.047151 | 0.043465 | 1.084796 | [
"s947038259",
"s596940203"
] |
u644778646 | p03569 | python | s528662846 | s474818331 | 369 | 199 | 83,308 | 49,392 | Accepted | Accepted | 46.07 | from fractions import gcd
from datetime import date
from math import factorial
import functools
from heapq import*
from collections import deque
import collections
import math
from collections import defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
inf = float("inf")
def... | def main():
s = list(eval(input()))
n = len(s)
ans = 0
l, r = 0, n-1
while l < r:
if s[l] == "x" or s[r] == "x":
if s[l] == "x" and s[r] == "x":
l += 1
r -= 1
elif s[l] == "x":
l += 1
ans +=... | 43 | 28 | 922 | 584 | from fractions import gcd
from datetime import date
from math import factorial
import functools
from heapq import *
from collections import deque
import collections
import math
from collections import defaultdict, Counter
import sys
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
inf = float("inf")
def main():
s = ... | def main():
s = list(eval(input()))
n = len(s)
ans = 0
l, r = 0, n - 1
while l < r:
if s[l] == "x" or s[r] == "x":
if s[l] == "x" and s[r] == "x":
l += 1
r -= 1
elif s[l] == "x":
l += 1
ans += 1
... | false | 34.883721 | [
"-from fractions import gcd",
"-from datetime import date",
"-from math import factorial",
"-import functools",
"-from heapq import *",
"-from collections import deque",
"-import collections",
"-import math",
"-from collections import defaultdict, Counter",
"-import sys",
"-",
"-sys.setrecursi... | false | 0.083964 | 0.036799 | 2.281722 | [
"s528662846",
"s474818331"
] |
u859897687 | p02970 | python | s192919791 | s509570793 | 170 | 17 | 38,384 | 2,940 | Accepted | Accepted | 90 | n,d=list(map(int,input().split()))
print((n//(2*d+1)+(n%(2*d+1)>0))) | n,d=list(map(int,input().split()))
print((n//(d+d+1)+(n%(d+d+1)>0))) | 2 | 2 | 61 | 61 | n, d = list(map(int, input().split()))
print((n // (2 * d + 1) + (n % (2 * d + 1) > 0)))
| n, d = list(map(int, input().split()))
print((n // (d + d + 1) + (n % (d + d + 1) > 0)))
| false | 0 | [
"-print((n // (2 * d + 1) + (n % (2 * d + 1) > 0)))",
"+print((n // (d + d + 1) + (n % (d + d + 1) > 0)))"
] | false | 0.039943 | 0.03724 | 1.072598 | [
"s192919791",
"s509570793"
] |
u726615467 | p02901 | python | s064506983 | s961938826 | 1,824 | 1,571 | 154,456 | 3,424 | Accepted | Accepted | 13.87 | N, M = list(map(int, input().split()))
a = []
b = []
c = []
import sys
sys.setrecursionlimit(2000)
for i in range(M):
ai, bi = list(map(int, input().split()))
a.append(ai)
b.append(bi)
ci = list(map(int, input().split()))
c.append(ci)
c_bin = [0] * M
for j in range(M):
for k ... | N, M = list(map(int, input().split()))
a = []
b = []
c = []
MY_INF = 1000000007
for _ in range(M):
a_tmp, b_tmp = list(map(int, input().split()))
a.append(a_tmp)
b.append(b_tmp)
c.append(list(map(int, input().split())))
c_bin = []
for i in range(M):
c_bin.append(sum([1 << (cij - 1)... | 47 | 38 | 1,092 | 771 | N, M = list(map(int, input().split()))
a = []
b = []
c = []
import sys
sys.setrecursionlimit(2000)
for i in range(M):
ai, bi = list(map(int, input().split()))
a.append(ai)
b.append(bi)
ci = list(map(int, input().split()))
c.append(ci)
c_bin = [0] * M
for j in range(M):
for k in range(b[j]):
... | N, M = list(map(int, input().split()))
a = []
b = []
c = []
MY_INF = 1000000007
for _ in range(M):
a_tmp, b_tmp = list(map(int, input().split()))
a.append(a_tmp)
b.append(b_tmp)
c.append(list(map(int, input().split())))
c_bin = []
for i in range(M):
c_bin.append(sum([1 << (cij - 1) for cij in c[i]])... | false | 19.148936 | [
"-import sys",
"+MY_INF = 1000000007",
"+for _ in range(M):",
"+ a_tmp, b_tmp = list(map(int, input().split()))",
"+ a.append(a_tmp)",
"+ b.append(b_tmp)",
"+ c.append(list(map(int, input().split())))",
"+c_bin = []",
"+for i in range(M):",
"+ c_bin.append(sum([1 << (cij - 1) for ci... | false | 0.035315 | 0.036455 | 0.968736 | [
"s064506983",
"s961938826"
] |
u989345508 | p03713 | python | s064393705 | s690956393 | 1,076 | 541 | 34,724 | 18,924 | Accepted | Accepted | 49.72 | h,w=list(map(int,input().split()))
if h%3==0 or w%3==0:
print((0))
else:
x=[]
for i in range(1,w):
sub=[]
sub.append([h*i,h*((w-i)//2),h*(w-i)-h*((w-i)//2)])
sub.append([h*i,h*((w-i)//2+1),h*(w-i)-h*((w-i)//2+1)])
sub.append([h*i,(w-i)*(h//2),h*(w-i)-(w-i)*(h//2)])
... | h,w=list(map(int,input().split()))
if h%3==0 or w%3==0:
print((0))
else:
x=[]
for i in range(1,w):
sub=[]
sub.append([h*i,h*((w-i)//2),h*(w-i)-h*((w-i)//2)])
#sub.append([h*i,h*((w-i)//2+1),h*(w-i)-h*((w-i)//2+1)])
sub.append([h*i,(w-i)*(h//2),h*(w-i)-(w-i)*(h//2)])
... | 22 | 22 | 809 | 813 | h, w = list(map(int, input().split()))
if h % 3 == 0 or w % 3 == 0:
print((0))
else:
x = []
for i in range(1, w):
sub = []
sub.append([h * i, h * ((w - i) // 2), h * (w - i) - h * ((w - i) // 2)])
sub.append(
[h * i, h * ((w - i) // 2 + 1), h * (w - i) - h * ((w - i) // 2... | h, w = list(map(int, input().split()))
if h % 3 == 0 or w % 3 == 0:
print((0))
else:
x = []
for i in range(1, w):
sub = []
sub.append([h * i, h * ((w - i) // 2), h * (w - i) - h * ((w - i) // 2)])
# sub.append([h*i,h*((w-i)//2+1),h*(w-i)-h*((w-i)//2+1)])
sub.append([h * i, (w... | false | 0 | [
"- sub.append(",
"- [h * i, h * ((w - i) // 2 + 1), h * (w - i) - h * ((w - i) // 2 + 1)]",
"- )",
"+ # sub.append([h*i,h*((w-i)//2+1),h*(w-i)-h*((w-i)//2+1)])",
"- sub.append(",
"- [h * i, (w - i) * (h // 2 + 1), h * (w - i) - (w - i) * (h // 2 + 1)]",
... | false | 1.021155 | 0.524644 | 1.946376 | [
"s064393705",
"s690956393"
] |
u326609687 | p03087 | python | s449358352 | s918555614 | 410 | 335 | 30,432 | 32,276 | Accepted | Accepted | 18.29 | import bisect
import re
import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
r = re.compile('AC')
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
... | import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
a = [0] * N
for i in range(N - 1):
a[i + 1] = a[i] + int(S[i] == 'A' and S[i + 1] == 'C')
for q in P:
print((a[q[1] - 1] - a[q[0] - 1])) | 19 | 12 | 417 | 294 | import bisect
import re
import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
r = re.compile("AC")
a = [x.start() for x in r.finditer(S)]
if a:
for q in P:
p1 = bisect.bisect_left(a, q[0] - 1)
p2 = bisect.bise... | import sys
N, Q = list(map(int, input().split()))
S = sys.stdin.readline()
P = [list(map(int, sys.stdin.readline().split())) for _ in range(Q)]
a = [0] * N
for i in range(N - 1):
a[i + 1] = a[i] + int(S[i] == "A" and S[i + 1] == "C")
for q in P:
print((a[q[1] - 1] - a[q[0] - 1]))
| false | 36.842105 | [
"-import bisect",
"-import re",
"-r = re.compile(\"AC\")",
"-a = [x.start() for x in r.finditer(S)]",
"-if a:",
"- for q in P:",
"- p1 = bisect.bisect_left(a, q[0] - 1)",
"- p2 = bisect.bisect_right(a, q[1] - 2)",
"- print((p2 - p1))",
"-else:",
"- for q in P:",
"- ... | false | 0.19334 | 0.044097 | 4.3844 | [
"s449358352",
"s918555614"
] |
u531436689 | p03112 | python | s632373329 | s880365987 | 686 | 616 | 18,720 | 19,240 | Accepted | Accepted | 10.2 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): r... | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): r... | 69 | 98 | 2,050 | 2,839 | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def ... | import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7
DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def ... | false | 29.591837 | [
"+ # ダミー境界を加える",
"+ s = [-inf] + s + [inf]",
"+ t = [-inf] + t + [inf]",
"+ for pos in x:",
"+ l_s = bisect.bisect_left(s, pos)",
"+ l_t = bisect.bisect_left(t, pos)",
"+ left_shrine = s[l_s - 1]",
"+ right_shrine = s[l_s]",
"+ left_temple = t[l_t - 1]"... | false | 0.045685 | 0.047592 | 0.959925 | [
"s632373329",
"s880365987"
] |
u600402037 | p02678 | python | s484547630 | s670448311 | 872 | 294 | 42,112 | 97,024 | Accepted | Accepted | 66.28 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# ダイクストラ法、自分の部屋から行けるところの中から最小の距離の部屋
N, M = lr()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(M):
a, b = lr... | # coding: utf-8
import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
graph = [[] for _ in range(N+1)] # 1-indexed
for _ in range(M):
a, b = lr()
graph[a].append(b)
graph[b].append(a)
... | 47 | 33 | 1,051 | 744 | # coding: utf-8
import sys
from heapq import heapify, heappop, heappush
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# ダイクストラ法、自分の部屋から行けるところの中から最小の距離の部屋
N, M = lr()
graph = [[] for _ in range(N + 1)] # 1-indexed
for _ in range(M):
a, b = lr()
grap... | # coding: utf-8
import sys
from collections import deque
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
graph = [[] for _ in range(N + 1)] # 1-indexed
for _ in range(M):
a, b = lr()
graph[a].append(b)
graph[b].append(a)
def bfs(x):... | false | 29.787234 | [
"-from heapq import heapify, heappop, heappush",
"+from collections import deque",
"-# ダイクストラ法、自分の部屋から行けるところの中から最小の距離の部屋",
"-INF = 10**15",
"-def dijkstra(start):",
"- dist = [INF] * (N + 1)",
"- dist[start] = 0",
"- que = [(0, start)]",
"+def bfs(x):",
"+ dist = [None] * (N + 1)",
"... | false | 0.037187 | 0.045375 | 0.819534 | [
"s484547630",
"s670448311"
] |
u075595666 | p03033 | python | s541236065 | s725303443 | 1,642 | 1,198 | 138,716 | 115,292 | Accepted | Accepted | 27.04 | import sys
from bisect import bisect_left
n,q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
s,t,x = map(int, line.split())
c.append((x,s,t))
c.sort()
d = list(map(int,lines[n:]))
ans = [-1] * q
skip = [-1] * q
for x,s,t in c:
ss = bisect_left(d,s-x)... | import sys
input = sys.stdin.readline
from bisect import bisect_left
class SegmentTree:
def __init__(self, n, ele, segfun):
#####単位元######要設定0or1orinf
self.ide_ele = ele
self.segfun = segfun
####################
self.n = n
self.N0 = 1 << n.bit_length()
... | 25 | 67 | 535 | 1,671 | import sys
from bisect import bisect_left
n, q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
s, t, x = map(int, line.split())
c.append((x, s, t))
c.sort()
d = list(map(int, lines[n:]))
ans = [-1] * q
skip = [-1] * q
for x, s, t in c:
ss = bisect_left(d, s - x)
... | import sys
input = sys.stdin.readline
from bisect import bisect_left
class SegmentTree:
def __init__(self, n, ele, segfun):
#####単位元######要設定0or1orinf
self.ide_ele = ele
self.segfun = segfun
####################
self.n = n
self.N0 = 1 << n.bit_length()
self... | false | 62.686567 | [
"+",
"+input = sys.stdin.readline",
"-n, q = map(int, input().split())",
"-lines = sys.stdin.readlines()",
"-c = []",
"-for line in lines[:n]:",
"- s, t, x = map(int, line.split())",
"- c.append((x, s, t))",
"-c.sort()",
"-d = list(map(int, lines[n:]))",
"-ans = [-1] * q",
"-skip = [-1] ... | false | 0.058701 | 0.038116 | 1.540093 | [
"s541236065",
"s725303443"
] |
u796942881 | p03409 | python | s809011031 | s542240043 | 21 | 19 | 3,316 | 3,064 | Accepted | Accepted | 9.52 | from operator import itemgetter
def main():
N = int(eval(input()))
ab = [tuple(int(j) for j in input().split()) for i in range(N)]
cd = [tuple(int(j) for j in input().split()) for i in range(N)]
# y 降順
ab.sort(key=itemgetter(1), reverse=True)
# x 昇順
cd.sort(key=itemgetter(0))
... | from operator import itemgetter
def main():
N = int(eval(input()))
ab = [tuple(int(j) for j in input().split()) for i in range(N)]
cd = [tuple(int(j) for j in input().split()) for i in range(N)]
# y 降順
ab.sort(key=itemgetter(1), reverse=True)
# x 昇順
cd.sort()
# ペアになった赤
... | 23 | 23 | 537 | 563 | from operator import itemgetter
def main():
N = int(eval(input()))
ab = [tuple(int(j) for j in input().split()) for i in range(N)]
cd = [tuple(int(j) for j in input().split()) for i in range(N)]
# y 降順
ab.sort(key=itemgetter(1), reverse=True)
# x 昇順
cd.sort(key=itemgetter(0))
ans = 0
... | from operator import itemgetter
def main():
N = int(eval(input()))
ab = [tuple(int(j) for j in input().split()) for i in range(N)]
cd = [tuple(int(j) for j in input().split()) for i in range(N)]
# y 降順
ab.sort(key=itemgetter(1), reverse=True)
# x 昇順
cd.sort()
# ペアになった赤
done = [Fals... | false | 0 | [
"- cd.sort(key=itemgetter(0))",
"- ans = 0",
"+ cd.sort()",
"+ # ペアになった赤",
"+ done = [False] * N",
"- for rx, ry in ab:",
"- if rx < bx and ry < by:",
"- ab.remove((rx, ry))",
"- ans += 1",
"+ for k, ((rx, ry), d) in enumerate(z... | false | 0.044908 | 0.047064 | 0.954201 | [
"s809011031",
"s542240043"
] |
u561083515 | p02900 | python | s352950866 | s380950192 | 200 | 130 | 3,188 | 5,564 | Accepted | Accepted | 35 | def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
if not i in arr:
arr.append(i)
if temp!=1:
if not temp... | def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
if not i in arr:
arr.append(i)
if temp!=1:
if not temp... | 21 | 21 | 492 | 480 | def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
if not i in arr:
arr.append(i)
if temp != 1:
if no... | def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
if not i in arr:
arr.append(i)
if temp != 1:
if no... | false | 0 | [
"+from fractions import gcd",
"+",
"-common = len(set(factorization(A)) & set(factorization(B)))",
"-print((common + 1))",
"+print((len(factorization(gcd(A, B))) + 1))"
] | false | 0.035538 | 0.047874 | 0.742335 | [
"s352950866",
"s380950192"
] |
u994988729 | p02684 | python | s481726516 | s621704391 | 1,176 | 264 | 207,096 | 123,892 | Accepted | Accepted | 77.55 | def main():
N, K = list(map(int, input().split()))
D = K.bit_length()
to = [[0] * D for _ in range(N)]
for i, a in enumerate(map(int, input().split())):
to[i][0] = a - 1
for j in range(D - 1):
for i in range(N):
to[i][j+1] = to[to[i][j]][j]
v = 0
f... | def doubling_numpy():
import numpy as np
N, K = list(map(int, input().split()))
D = K.bit_length()
U = N + 1
dbl = np.zeros((D, U), dtype=np.int64)
dbl[0, 1:] = np.array(input().split(), dtype=np.int64)
for d in range(D - 1):
dbl[d+1] = dbl[d, dbl[d]]
v = 1
for ... | 22 | 20 | 457 | 459 | def main():
N, K = list(map(int, input().split()))
D = K.bit_length()
to = [[0] * D for _ in range(N)]
for i, a in enumerate(map(int, input().split())):
to[i][0] = a - 1
for j in range(D - 1):
for i in range(N):
to[i][j + 1] = to[to[i][j]][j]
v = 0
for i in revers... | def doubling_numpy():
import numpy as np
N, K = list(map(int, input().split()))
D = K.bit_length()
U = N + 1
dbl = np.zeros((D, U), dtype=np.int64)
dbl[0, 1:] = np.array(input().split(), dtype=np.int64)
for d in range(D - 1):
dbl[d + 1] = dbl[d, dbl[d]]
v = 1
for i in revers... | false | 9.090909 | [
"-def main():",
"+def doubling_numpy():",
"+ import numpy as np",
"+",
"- to = [[0] * D for _ in range(N)]",
"- for i, a in enumerate(map(int, input().split())):",
"- to[i][0] = a - 1",
"- for j in range(D - 1):",
"- for i in range(N):",
"- to[i][j + 1] = to[to... | false | 0.084544 | 0.43739 | 0.193292 | [
"s481726516",
"s621704391"
] |
u223133214 | p02792 | python | s811828316 | s448112294 | 293 | 195 | 43,372 | 3,060 | Accepted | Accepted | 33.45 | n = int(eval(input()))
m = len(str(n))
ans = 0
for i in range(n + 1):
A = str(i)
first = A[0]
end = A[-1]
if end == '0':
continue
if first == end:
ans += 1
if m >= 3:
for j in range(m - 2):
ans += 10 ** (j)
mini = int(end + '0' * ... | n=int(eval(input()))
l=[[0]*10 for i in range(10)]
for i in range(n):
t=str(i+1)
l[int(t[0])][int(t[-1])]+=1
a=0
for i in range(10):
for j in range(10):
a+=l[i][j]*l[j][i]
print(a) | 37 | 10 | 745 | 203 | n = int(eval(input()))
m = len(str(n))
ans = 0
for i in range(n + 1):
A = str(i)
first = A[0]
end = A[-1]
if end == "0":
continue
if first == end:
ans += 1
if m >= 3:
for j in range(m - 2):
ans += 10 ** (j)
mini = int(end + "0" * (m - 2) + first)
maxi ... | n = int(eval(input()))
l = [[0] * 10 for i in range(10)]
for i in range(n):
t = str(i + 1)
l[int(t[0])][int(t[-1])] += 1
a = 0
for i in range(10):
for j in range(10):
a += l[i][j] * l[j][i]
print(a)
| false | 72.972973 | [
"-m = len(str(n))",
"-ans = 0",
"-for i in range(n + 1):",
"- A = str(i)",
"- first = A[0]",
"- end = A[-1]",
"- if end == \"0\":",
"- continue",
"- if first == end:",
"- ans += 1",
"- if m >= 3:",
"- for j in range(m - 2):",
"- ans += 10 ** ... | false | 0.137137 | 0.069006 | 1.987309 | [
"s811828316",
"s448112294"
] |
u314050667 | p02883 | python | s901283007 | s045592950 | 530 | 421 | 119,500 | 37,164 | Accepted | Accepted | 20.57 |
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse = True)
F.sort()
max_f = A[0] * F[-1]
def binary_search(min_f, max_f):
if min_f == max_f:
return min_f
mid_f = min_f + (max_f - min_f)//2
tmp = 0
for i in range(N):
... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())), dtype = np.int64)
F = np.array(list(map(int, input().split())), dtype = np.int64)
A.sort()
F.sort()
F = F[::-... | 25 | 36 | 487 | 597 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort(reverse=True)
F.sort()
max_f = A[0] * F[-1]
def binary_search(min_f, max_f):
if min_f == max_f:
return min_f
mid_f = min_f + (max_f - min_f) // 2
tmp = 0
for i in range(N):
... | import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())), dtype=np.int64)
F = np.array(list(map(int, input().split())), dtype=np.int64)
A.sort()
F.sort()
F = F[::-1]
l = 0
r = 10... | false | 30.555556 | [
"+import numpy as np",
"+import sys",
"+",
"+read = sys.stdin.read",
"+readline = sys.stdin.readline",
"+readlines = sys.stdin.readlines",
"-A = list(map(int, input().split()))",
"-F = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"+A = np.array(list(map(int, input().split())), dtype=... | false | 0.037308 | 0.21231 | 0.175723 | [
"s901283007",
"s045592950"
] |
u701644092 | p03163 | python | s114535806 | s567305560 | 297 | 130 | 148,404 | 28,928 | Accepted | Accepted | 56.23 | N,W = list(map(int,input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
w,v = list(map(int,input().split()))
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
if j + w >= len(dp[i]):
... | import numpy as np
N,W = list(map(int,input().split()))
dp = np.zeros(W + 1, dtype = int)
for i in range(N):
w,v = list(map(int,input().split()))
np.maximum(dp[:-w] + v,dp[w:],out = dp[w:])
print((dp.max())) | 16 | 10 | 404 | 211 | N, W = list(map(int, input().split()))
dp = [[-1] * (W + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
w, v = list(map(int, input().split()))
for j in range(len(dp[i]) - 2, -1, -1):
if dp[i][j] == -1:
continue
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])
if j + w >=... | import numpy as np
N, W = list(map(int, input().split()))
dp = np.zeros(W + 1, dtype=int)
for i in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp.max()))
| false | 37.5 | [
"+import numpy as np",
"+",
"-dp = [[-1] * (W + 1) for i in range(N + 1)]",
"-dp[0][0] = 0",
"+dp = np.zeros(W + 1, dtype=int)",
"- for j in range(len(dp[i]) - 2, -1, -1):",
"- if dp[i][j] == -1:",
"- continue",
"- dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])",
"- ... | false | 0.04179 | 0.194778 | 0.21455 | [
"s114535806",
"s567305560"
] |
u644907318 | p03546 | python | s769753260 | s915702493 | 189 | 94 | 40,284 | 73,864 | Accepted | Accepted | 50.26 | INFTY = 10**5
H,W = list(map(int,input().split()))
C = [list(map(int,input().split())) for _ in range(10)]
A = [list(map(int,input().split())) for _ in range(H)]
dist = [[INFTY for _ in range(10)] for _ in range(10)]
for i in range(10):
dist[i][i] = 0
for i in range(10):
for j in range(10):
dis... | INFTY = 10**4+10
H,W = list(map(int,input().split()))
C = [list(map(int,input().split())) for _ in range(10)]
cost = [[INFTY for _ in range(10)] for _ in range(10)]
for i in range(10):
for j in range(10):
cost[i][j] = C[i][j]
for k in range(10):
for i in range(10):
for j in range(10):
... | 21 | 18 | 606 | 577 | INFTY = 10**5
H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
dist = [[INFTY for _ in range(10)] for _ in range(10)]
for i in range(10):
dist[i][i] = 0
for i in range(10):
for j in range(10):
dist[i][... | INFTY = 10**4 + 10
H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
cost = [[INFTY for _ in range(10)] for _ in range(10)]
for i in range(10):
for j in range(10):
cost[i][j] = C[i][j]
for k in range(10):
for i in range(10):
for j in range(10):
... | false | 14.285714 | [
"-INFTY = 10**5",
"+INFTY = 10**4 + 10",
"-A = [list(map(int, input().split())) for _ in range(H)]",
"-dist = [[INFTY for _ in range(10)] for _ in range(10)]",
"-for i in range(10):",
"- dist[i][i] = 0",
"+cost = [[INFTY for _ in range(10)] for _ in range(10)]",
"- dist[i][j] = C[i][j]",
"... | false | 0.041312 | 0.037672 | 1.096639 | [
"s769753260",
"s915702493"
] |
u947883560 | p03209 | python | s143373109 | s580278934 | 25 | 23 | 3,572 | 3,684 | Accepted | Accepted | 8 | #!/usr/bin/env python3
import sys
import functools
INF = float("inf")
@functools.lru_cache(None)
def hight(n):
return 2**(n+2)-3
@functools.lru_cache(None)
def paty(n):
return 2**(n+1)-1
def rec(n, x):
# print(n, x)
if n == 0:
if x == 0:
return 0
el... | #!/usr/bin/env python3
import sys
import functools
INF = float("inf")
@functools.lru_cache(None)
def hight(n):
if n == 0:
return 1
else:
return 2*hight(n-1)+3
@functools.lru_cache(None)
def paty(n):
if n == 0:
return 1
else:
return 2*paty(n-1)+1
... | 57 | 63 | 1,018 | 1,123 | #!/usr/bin/env python3
import sys
import functools
INF = float("inf")
@functools.lru_cache(None)
def hight(n):
return 2 ** (n + 2) - 3
@functools.lru_cache(None)
def paty(n):
return 2 ** (n + 1) - 1
def rec(n, x):
# print(n, x)
if n == 0:
if x == 0:
return 0
else:
... | #!/usr/bin/env python3
import sys
import functools
INF = float("inf")
@functools.lru_cache(None)
def hight(n):
if n == 0:
return 1
else:
return 2 * hight(n - 1) + 3
@functools.lru_cache(None)
def paty(n):
if n == 0:
return 1
else:
return 2 * paty(n - 1) + 1
def rec... | false | 9.52381 | [
"- return 2 ** (n + 2) - 3",
"+ if n == 0:",
"+ return 1",
"+ else:",
"+ return 2 * hight(n - 1) + 3",
"- return 2 ** (n + 1) - 1",
"+ if n == 0:",
"+ return 1",
"+ else:",
"+ return 2 * paty(n - 1) + 1"
] | false | 0.037055 | 0.036574 | 1.01316 | [
"s143373109",
"s580278934"
] |
u604839890 | p02880 | python | s752055955 | s270177945 | 32 | 25 | 9,152 | 9,116 | Accepted | Accepted | 21.88 | n = int(eval(input()))
for i in range(1, 10):
for j in range(i, 10):
if n == i*j:
print('Yes')
exit()
print('No') | n = int(eval(input()))
s = set()
for i in range(10):
for j in range(i, 10):
s.add(i*j)
print(('Yes' if n in s else 'No')) | 7 | 6 | 149 | 130 | n = int(eval(input()))
for i in range(1, 10):
for j in range(i, 10):
if n == i * j:
print("Yes")
exit()
print("No")
| n = int(eval(input()))
s = set()
for i in range(10):
for j in range(i, 10):
s.add(i * j)
print(("Yes" if n in s else "No"))
| false | 14.285714 | [
"-for i in range(1, 10):",
"+s = set()",
"+for i in range(10):",
"- if n == i * j:",
"- print(\"Yes\")",
"- exit()",
"-print(\"No\")",
"+ s.add(i * j)",
"+print((\"Yes\" if n in s else \"No\"))"
] | false | 0.080313 | 0.068656 | 1.169784 | [
"s752055955",
"s270177945"
] |
u609922073 | p02576 | python | s919392171 | s547219652 | 30 | 26 | 9,124 | 9,100 | Accepted | Accepted | 13.33 | import math
tako = list(map(int, input().split()))
if tako[0] % tako[1] != 0:
print((math.floor(tako[0]/tako[1])*tako[2]+tako[2]))
else:
print((math.floor(tako[0]/tako[1])*tako[2])) | tako = list(map(int, input().split()))
if tako[0] % tako[1] != 0:
print((tako[0]//tako[1]*tako[2]+tako[2]))
else:
print((tako[0]//tako[1]*tako[2])) | 7 | 5 | 188 | 151 | import math
tako = list(map(int, input().split()))
if tako[0] % tako[1] != 0:
print((math.floor(tako[0] / tako[1]) * tako[2] + tako[2]))
else:
print((math.floor(tako[0] / tako[1]) * tako[2]))
| tako = list(map(int, input().split()))
if tako[0] % tako[1] != 0:
print((tako[0] // tako[1] * tako[2] + tako[2]))
else:
print((tako[0] // tako[1] * tako[2]))
| false | 28.571429 | [
"-import math",
"-",
"- print((math.floor(tako[0] / tako[1]) * tako[2] + tako[2]))",
"+ print((tako[0] // tako[1] * tako[2] + tako[2]))",
"- print((math.floor(tako[0] / tako[1]) * tako[2]))",
"+ print((tako[0] // tako[1] * tako[2]))"
] | false | 0.034932 | 0.03475 | 1.005249 | [
"s919392171",
"s547219652"
] |
u488636998 | p02935 | python | s633166177 | s679530253 | 174 | 18 | 13,520 | 2,940 | Accepted | Accepted | 89.66 | import numpy as np
N=int(eval(input()))
str_list = input().split(' ')
A = [int(x) for x in str_list]
A = np.array(A)
while len(A)>1:
first_min = A[A.argmin()]
#print(first_min)
A = np.delete(A, A.argmin())
second_min = A[A.argmin()]
#print(second_min)
A = np.delete(A, A.argmin())
... | N=int(eval(input()))
str_list = input().split(' ')
v = [int(x) for x in str_list]
while len(v)>1:
v.sort(reverse=True)
val1 = v.pop()
val2 = v.pop()
mean = (val1 + val2) / 2.0
v.append(mean)
print((v[0]))
| 18 | 11 | 409 | 228 | import numpy as np
N = int(eval(input()))
str_list = input().split(" ")
A = [int(x) for x in str_list]
A = np.array(A)
while len(A) > 1:
first_min = A[A.argmin()]
# print(first_min)
A = np.delete(A, A.argmin())
second_min = A[A.argmin()]
# print(second_min)
A = np.delete(A, A.argmin())
mean... | N = int(eval(input()))
str_list = input().split(" ")
v = [int(x) for x in str_list]
while len(v) > 1:
v.sort(reverse=True)
val1 = v.pop()
val2 = v.pop()
mean = (val1 + val2) / 2.0
v.append(mean)
print((v[0]))
| false | 38.888889 | [
"-import numpy as np",
"-",
"-A = [int(x) for x in str_list]",
"-A = np.array(A)",
"-while len(A) > 1:",
"- first_min = A[A.argmin()]",
"- # print(first_min)",
"- A = np.delete(A, A.argmin())",
"- second_min = A[A.argmin()]",
"- # print(second_min)",
"- A = np.delete(A, A.argmi... | false | 0.371368 | 0.007456 | 49.806839 | [
"s633166177",
"s679530253"
] |
u937782958 | p02682 | python | s981828922 | s471633136 | 23 | 21 | 9,160 | 9,124 | Accepted | Accepted | 8.7 | a,b,c,k = list(map(int,input().split()))
xa = min(a,k)
k -= xa
xb = min(b, k)
k -= xb
xc = k
print((xa-xc))
| a,b,c,k = list(map(int,input().split()))
if a+b >= k:
print((min(a,k)))
else:
print((a-(k-a-b)))
| 8 | 5 | 108 | 99 | a, b, c, k = list(map(int, input().split()))
xa = min(a, k)
k -= xa
xb = min(b, k)
k -= xb
xc = k
print((xa - xc))
| a, b, c, k = list(map(int, input().split()))
if a + b >= k:
print((min(a, k)))
else:
print((a - (k - a - b)))
| false | 37.5 | [
"-xa = min(a, k)",
"-k -= xa",
"-xb = min(b, k)",
"-k -= xb",
"-xc = k",
"-print((xa - xc))",
"+if a + b >= k:",
"+ print((min(a, k)))",
"+else:",
"+ print((a - (k - a - b)))"
] | false | 0.036888 | 0.036859 | 1.000779 | [
"s981828922",
"s471633136"
] |
u786325650 | p02659 | python | s713674370 | s009370053 | 27 | 24 | 10,076 | 9,064 | Accepted | Accepted | 11.11 | from decimal import Decimal
a,b=list(map(str, input().split()))
A=Decimal(a)
B=Decimal(b)
print((int(A*B)))
#b=int(B*100)
#ans100bai=A*b
#if len(str(ans100bai))>2:
# print(str(ans100bai)[:-2])
#else:
# print(0)
# 2darray [[0] * 4 for i in range(3)]
| a,b=list(map(str, input().split()))
A=int(a)
B=int(b.replace(".",""))
print((A*B//100))
| 15 | 5 | 258 | 85 | from decimal import Decimal
a, b = list(map(str, input().split()))
A = Decimal(a)
B = Decimal(b)
print((int(A * B)))
# b=int(B*100)
# ans100bai=A*b
# if len(str(ans100bai))>2:
# print(str(ans100bai)[:-2])
# else:
# print(0)
# 2darray [[0] * 4 for i in range(3)]
| a, b = list(map(str, input().split()))
A = int(a)
B = int(b.replace(".", ""))
print((A * B // 100))
| false | 66.666667 | [
"-from decimal import Decimal",
"-",
"-A = Decimal(a)",
"-B = Decimal(b)",
"-print((int(A * B)))",
"-# b=int(B*100)",
"-# ans100bai=A*b",
"-# if len(str(ans100bai))>2:",
"-# \tprint(str(ans100bai)[:-2])",
"-# else:",
"-# \tprint(0)",
"-# 2darray [[0] * 4 for i in range(3)]",
"+A = int(a)",
... | false | 0.048357 | 0.137626 | 0.351362 | [
"s713674370",
"s009370053"
] |
u692054751 | p02898 | python | s943510848 | s899398496 | 511 | 77 | 20,892 | 11,892 | Accepted | Accepted | 84.93 | import numpy as np
N,K = [int(s) for s in input().split()]
heights = np.array([int(s) for s in input().split()])
print((sum(heights >= K))) | def LI():
return [int(s) for s in input().split()]
N,K = LI()
h_s = LI()
h_s.sort(reverse = True)
count = 0
for h in h_s:
if h < K:
break
count+=1
print(count)
| 6 | 16 | 146 | 193 | import numpy as np
N, K = [int(s) for s in input().split()]
heights = np.array([int(s) for s in input().split()])
print((sum(heights >= K)))
| def LI():
return [int(s) for s in input().split()]
N, K = LI()
h_s = LI()
h_s.sort(reverse=True)
count = 0
for h in h_s:
if h < K:
break
count += 1
print(count)
| false | 62.5 | [
"-import numpy as np",
"+def LI():",
"+ return [int(s) for s in input().split()]",
"-N, K = [int(s) for s in input().split()]",
"-heights = np.array([int(s) for s in input().split()])",
"-print((sum(heights >= K)))",
"+",
"+N, K = LI()",
"+h_s = LI()",
"+h_s.sort(reverse=True)",
"+count = 0",... | false | 0.208974 | 0.037289 | 5.604155 | [
"s943510848",
"s899398496"
] |
u820560680 | p03379 | python | s672284751 | s066218586 | 1,058 | 310 | 34,148 | 25,624 | Accepted | Accepted | 70.7 | import numpy as np
N = int(eval(input()))
X = np.array(list(map(int, input().split())))
A = np.sort(X)
m1 = A[ N // 2 - 1]
m2 = A[ N // 2]
ans = []
for i in range(N):
if X[i] < m2:
print(m2)
else:
print(m1)
| N = int(eval(input()))
X = list(map(int, input().split()))
A = sorted(X)
m1 = A[ N // 2 - 1]
m2 = A[ N // 2]
for i in range(N):
if X[i] < m2:
print(m2)
else:
print(m1)
| 14 | 11 | 240 | 197 | import numpy as np
N = int(eval(input()))
X = np.array(list(map(int, input().split())))
A = np.sort(X)
m1 = A[N // 2 - 1]
m2 = A[N // 2]
ans = []
for i in range(N):
if X[i] < m2:
print(m2)
else:
print(m1)
| N = int(eval(input()))
X = list(map(int, input().split()))
A = sorted(X)
m1 = A[N // 2 - 1]
m2 = A[N // 2]
for i in range(N):
if X[i] < m2:
print(m2)
else:
print(m1)
| false | 21.428571 | [
"-import numpy as np",
"-",
"-X = np.array(list(map(int, input().split())))",
"-A = np.sort(X)",
"+X = list(map(int, input().split()))",
"+A = sorted(X)",
"-ans = []"
] | false | 0.669105 | 0.045389 | 14.741461 | [
"s672284751",
"s066218586"
] |
u905203728 | p03026 | python | s692307568 | s288482019 | 385 | 161 | 59,864 | 85,208 | Accepted | Accepted | 58.18 | import sys
sys.setrecursionlimit(10**6)
def DFS(num,pre):
global point
if color[num]=="white":
ans[num]=C.pop()
point +=min(ans[num],pre)
color[num]="black"
for i in T[num]:
DFS(i,ans[num])
n=int(eval(input()))
AB=[list(map(int,input().split())) for... | import sys
sys.setrecursionlimit(10**6)
def DFS(num,pre):
global point
if color[num]=="white":
A[num]=C.pop()
point +=min(A[num],pre)
color[num]="black"
for i in tree[num]:
DFS(i,A[num])
n=int(eval(input()))
AB=[list(map(int,input().split())) for _ ... | 30 | 30 | 577 | 581 | import sys
sys.setrecursionlimit(10**6)
def DFS(num, pre):
global point
if color[num] == "white":
ans[num] = C.pop()
point += min(ans[num], pre)
color[num] = "black"
for i in T[num]:
DFS(i, ans[num])
n = int(eval(input()))
AB = [list(map(int, input().split())) fo... | import sys
sys.setrecursionlimit(10**6)
def DFS(num, pre):
global point
if color[num] == "white":
A[num] = C.pop()
point += min(A[num], pre)
color[num] = "black"
for i in tree[num]:
DFS(i, A[num])
n = int(eval(input()))
AB = [list(map(int, input().split())) for _... | false | 0 | [
"- ans[num] = C.pop()",
"- point += min(ans[num], pre)",
"+ A[num] = C.pop()",
"+ point += min(A[num], pre)",
"- for i in T[num]:",
"- DFS(i, ans[num])",
"+ for i in tree[num]:",
"+ DFS(i, A[num])",
"-color = [\"white\" for _ in range(n... | false | 0.036698 | 0.035367 | 1.037654 | [
"s692307568",
"s288482019"
] |
u773265208 | p02873 | python | s257716522 | s878497460 | 1,770 | 308 | 453,904 | 8,092 | Accepted | Accepted | 82.6 | import sys
iter_num = 5 * (10**5) + 10
sys.setrecursionlimit(iter_num)
s = eval(input())
n = len(s) + 1
a = [0 for _ in range(n)]
next_num=0
def solve(num):
global next_num
if num == 0:
if s[0] == '<':
a[num] = 0
next_num = 1
return 0
else:
next_num = 1
a[num] = solve(num+1)... | s = list(eval(input()))
n = len(s) + 1
i = 0
left = 0
right = 0
ans = 0
tmp = 0
while i < n-1:
if s[i] == '<':
break
i += 1
tmp += 1
ans += tmp * (tmp + 1) // 2
while i < n-1:
if i == n-2:
if s[i] == '>':
right += 1
break
else:
left += 1
break
if s[i] == '<' and s[i+1] ==... | 53 | 44 | 951 | 756 | import sys
iter_num = 5 * (10**5) + 10
sys.setrecursionlimit(iter_num)
s = eval(input())
n = len(s) + 1
a = [0 for _ in range(n)]
next_num = 0
def solve(num):
global next_num
if num == 0:
if s[0] == "<":
a[num] = 0
next_num = 1
return 0
else:
ne... | s = list(eval(input()))
n = len(s) + 1
i = 0
left = 0
right = 0
ans = 0
tmp = 0
while i < n - 1:
if s[i] == "<":
break
i += 1
tmp += 1
ans += tmp * (tmp + 1) // 2
while i < n - 1:
if i == n - 2:
if s[i] == ">":
right += 1
break
else:
left += 1
... | false | 16.981132 | [
"-import sys",
"-",
"-iter_num = 5 * (10**5) + 10",
"-sys.setrecursionlimit(iter_num)",
"-s = eval(input())",
"+s = list(eval(input()))",
"-a = [0 for _ in range(n)]",
"-next_num = 0",
"-",
"-",
"-def solve(num):",
"- global next_num",
"- if num == 0:",
"- if s[0] == \"<\":",
... | false | 0.041585 | 0.043255 | 0.961389 | [
"s257716522",
"s878497460"
] |
u989345508 | p02644 | python | s429283937 | s415697795 | 349 | 318 | 93,840 | 93,820 | Accepted | Accepted | 8.88 | h,w,k=map(int,input().split())
r,s,t,u=map(lambda x:int(x)-1,input().split())
b=[input()for _ in range(h)]
l=[[-1]*w for _ in range(h)]
l[r][s]=0
from collections import*
d=deque([(r,s)])
while d:
x,y=d.popleft()
if(x==t)&(y==u):exit(print(l[x][y]))
for e,f in [[1,0],[-1,0],[0,-1],[0,1]]:
for i in ... | h,w,k=map(int,input().split())
r,s,t,u=map(lambda x:int(x)-1,input().split())
b=[input()for _ in range(h)]
l=[[-1]*w for _ in range(h)]
l[r][s]=0
from collections import*
d=deque([(r,s)])
while d:
x,y=d.popleft()
if(x==t)&(y==u):exit(print(l[x][y]))
for e,f in[[1,0],[-1,0],[0,-1],[0,1]]:
for i in r... | 18 | 17 | 515 | 507 | h, w, k = map(int, input().split())
r, s, t, u = map(lambda x: int(x) - 1, input().split())
b = [input() for _ in range(h)]
l = [[-1] * w for _ in range(h)]
l[r][s] = 0
from collections import *
d = deque([(r, s)])
while d:
x, y = d.popleft()
if (x == t) & (y == u):
exit(print(l[x][y]))
for e, f in... | h, w, k = map(int, input().split())
r, s, t, u = map(lambda x: int(x) - 1, input().split())
b = [input() for _ in range(h)]
l = [[-1] * w for _ in range(h)]
l[r][s] = 0
from collections import *
d = deque([(r, s)])
while d:
x, y = d.popleft()
if (x == t) & (y == u):
exit(print(l[x][y]))
for e, f in... | false | 5.555556 | [
"- if not (0 <= p < h and 0 <= q < w) or b[p][q] == \"@\":",
"+ if not ((0 <= p < h) & (0 <= q < w)) or b[p][q] == \"@\":",
"- l[p][q] = l[x][y] + 1",
"+ l[p][q] = l[x][y] + 1"
] | false | 0.088471 | 0.045077 | 1.962665 | [
"s429283937",
"s415697795"
] |
u993622994 | p03106 | python | s835945353 | s371048000 | 24 | 18 | 3,316 | 3,064 | Accepted | Accepted | 25 | a, b, k = list(map(int, input().split()))
ab = []
if a >= b:
i = b
else:
i = a
while i > 0:
if a % i == 0 and b % i == 0:
ab.append(i)
i -= 1
print((ab[k - 1])) | a, b, k = list(map(int, input().split()))
l = []
for i in range(max(a, b)+1, 0, -1):
if a % i == 0 and b % i == 0:
l.append(i)
print((l[k-1])) | 14 | 8 | 192 | 155 | a, b, k = list(map(int, input().split()))
ab = []
if a >= b:
i = b
else:
i = a
while i > 0:
if a % i == 0 and b % i == 0:
ab.append(i)
i -= 1
print((ab[k - 1]))
| a, b, k = list(map(int, input().split()))
l = []
for i in range(max(a, b) + 1, 0, -1):
if a % i == 0 and b % i == 0:
l.append(i)
print((l[k - 1]))
| false | 42.857143 | [
"-ab = []",
"-if a >= b:",
"- i = b",
"-else:",
"- i = a",
"-while i > 0:",
"+l = []",
"+for i in range(max(a, b) + 1, 0, -1):",
"- ab.append(i)",
"- i -= 1",
"-print((ab[k - 1]))",
"+ l.append(i)",
"+print((l[k - 1]))"
] | false | 0.100491 | 0.060657 | 1.656711 | [
"s835945353",
"s371048000"
] |
u394482932 | p03264 | python | s034411161 | s551797780 | 38 | 17 | 2,940 | 2,940 | Accepted | Accepted | 55.26 | a=int(eval(input()))/2;print((int(a**2))) | print((int((int(eval(input()))/2)**2))) | 1 | 1 | 33 | 31 | a = int(eval(input())) / 2
print((int(a**2)))
| print((int((int(eval(input())) / 2) ** 2)))
| false | 0 | [
"-a = int(eval(input())) / 2",
"-print((int(a**2)))",
"+print((int((int(eval(input())) / 2) ** 2)))"
] | false | 0.038441 | 0.086541 | 0.444193 | [
"s034411161",
"s551797780"
] |
u363421241 | p02600 | python | s981195318 | s292341307 | 32 | 29 | 9,232 | 8,708 | Accepted | Accepted | 9.38 | x = int(eval(input()))
if (400 <= x) and (x <= 599):
print((8))
elif (600 <= x) and (x <= 799):
print((7))
elif (800 <= x) and (x <= 999):
print((6))
elif (1000 <= x) and (x <= 1199):
print((5))
elif (1200 <= x) and (x <= 1399):
print((4))
elif (1400 <= x) and (x <= 1599):
print((3... | x = int(eval(input()))
rl = 400
for i in range(8, 0, -1):
if (rl <= x) and (x <= rl+199):
print(i)
rl += 200 | 18 | 8 | 402 | 127 | x = int(eval(input()))
if (400 <= x) and (x <= 599):
print((8))
elif (600 <= x) and (x <= 799):
print((7))
elif (800 <= x) and (x <= 999):
print((6))
elif (1000 <= x) and (x <= 1199):
print((5))
elif (1200 <= x) and (x <= 1399):
print((4))
elif (1400 <= x) and (x <= 1599):
print((3))
elif (1600 ... | x = int(eval(input()))
rl = 400
for i in range(8, 0, -1):
if (rl <= x) and (x <= rl + 199):
print(i)
rl += 200
| false | 55.555556 | [
"-if (400 <= x) and (x <= 599):",
"- print((8))",
"-elif (600 <= x) and (x <= 799):",
"- print((7))",
"-elif (800 <= x) and (x <= 999):",
"- print((6))",
"-elif (1000 <= x) and (x <= 1199):",
"- print((5))",
"-elif (1200 <= x) and (x <= 1399):",
"- print((4))",
"-elif (1400 <= x) ... | false | 0.036569 | 0.0368 | 0.993734 | [
"s981195318",
"s292341307"
] |
u349091349 | p02623 | python | s603343679 | s615558634 | 242 | 193 | 131,236 | 132,116 | Accepted | Accepted | 20.25 | from itertools import accumulate
import bisect
n,m,k=list(map(int,input().split()))
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
A=list(accumulate(a))
B=list(accumulate(b))
ans = max(bisect.bisect_right(B,k),bisect.bisect_right(A,k))
for i in range(len(a)):
r = (k-A[i])
... | from itertools import accumulate
import bisect
n,m,k=list(map(int,input().split()))
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
A=list(accumulate(a))
B=list(accumulate(b))
ans=bisect.bisect_right(B,k)
for i in range(len(a)):
r = (k-A[i])
if r<0:
break
#print... | 30 | 17 | 781 | 441 | from itertools import accumulate
import bisect
n, m, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
A = list(accumulate(a))
B = list(accumulate(b))
ans = max(bisect.bisect_right(B, k), bisect.bisect_right(A, k))
for i in range(len(a)):
r = k - A[i]
... | from itertools import accumulate
import bisect
n, m, k = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
A = list(accumulate(a))
B = list(accumulate(b))
ans = bisect.bisect_right(B, k)
for i in range(len(a)):
r = k - A[i]
if r < 0:
break
#... | false | 43.333333 | [
"-ans = max(bisect.bisect_right(B, k), bisect.bisect_right(A, k))",
"+ans = bisect.bisect_right(B, k)",
"- # print(i+1,r,i+1+bisect.bisect_right(B,r))",
"-for i in range(len(b)):",
"- r = k - B[i]",
"- if r < 0:",
"- break",
"- # print(r,bisect.bisect_left(B,r))",
"- # print(B[... | false | 0.04035 | 0.038408 | 1.050551 | [
"s603343679",
"s615558634"
] |
u135454978 | p02644 | python | s506667851 | s482471309 | 2,076 | 1,851 | 45,192 | 44,976 | Accepted | Accepted | 10.84 | from collections import deque
import sys
def bfs(xs, ys):
queue = deque([[xs, ys]])
M[xs][ys] = 0
while queue:
# queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
x1, y1 = queue.popleft() # queueに入っていたものを消す。
if [x1, y1] == [xg, yg]: # もしゴールについていたならば、そのときの手数を出す。
... | from collections import deque
import sys
def bfs(xs, ys, d):
queue = deque()
queue.append((xs, ys, d))
M[xs][ys] = d
while queue:
# queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
x1, y1, d = queue.popleft() # queueに入っていたものを消す。
if [x1, y1] == [xg, yg]: # もしゴールについてい... | 44 | 45 | 1,307 | 1,276 | from collections import deque
import sys
def bfs(xs, ys):
queue = deque([[xs, ys]])
M[xs][ys] = 0
while queue:
# queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
x1, y1 = queue.popleft() # queueに入っていたものを消す。
if [x1, y1] == [xg, yg]: # もしゴールについていたならば、そのときの手数を出す。
return M... | from collections import deque
import sys
def bfs(xs, ys, d):
queue = deque()
queue.append((xs, ys, d))
M[xs][ys] = d
while queue:
# queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
x1, y1, d = queue.popleft() # queueに入っていたものを消す。
if [x1, y1] == [xg, yg]: # もしゴールについていたならば、そのときの手... | false | 2.222222 | [
"-def bfs(xs, ys):",
"- queue = deque([[xs, ys]])",
"- M[xs][ys] = 0",
"+def bfs(xs, ys, d):",
"+ queue = deque()",
"+ queue.append((xs, ys, d))",
"+ M[xs][ys] = d",
"- x1, y1 = queue.popleft() # queueに入っていたものを消す。",
"+ x1, y1, d = queue.popleft() # queueに入っていたものを消す。",
... | false | 0.046152 | 0.043191 | 1.068543 | [
"s506667851",
"s482471309"
] |
u528470578 | p03127 | python | s538589503 | s850149076 | 140 | 113 | 14,480 | 14,228 | Accepted | Accepted | 19.29 | N = int(eval(input()))
A = list(map(int, input().split()))
As = sorted(A)
As = [a%As[0] if a%As[0] != 0 else As[0] for a in As]
As = sorted(As)
def judge(tmp_one, tmp_two):
flg = 1
while flg:
if tmp_two%tmp_one == 0:
tmp_two = tmp_one
else:
tmp_two = tmp_... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(n, m):
if n < m:
temp = n
n = m
m = temp
def ecd(n, m):
if n % m == 0:
return m
else:
temp = n % m
a = ecd(m, temp)
return a
... | 35 | 25 | 719 | 433 | N = int(eval(input()))
A = list(map(int, input().split()))
As = sorted(A)
As = [a % As[0] if a % As[0] != 0 else As[0] for a in As]
As = sorted(As)
def judge(tmp_one, tmp_two):
flg = 1
while flg:
if tmp_two % tmp_one == 0:
tmp_two = tmp_one
else:
tmp_two = tmp_two % tmp... | N = int(eval(input()))
A = list(map(int, input().split()))
def gcd(n, m):
if n < m:
temp = n
n = m
m = temp
def ecd(n, m):
if n % m == 0:
return m
else:
temp = n % m
a = ecd(m, temp)
return a
return ecd(n, m)
temp = gc... | false | 28.571429 | [
"-As = sorted(A)",
"-As = [a % As[0] if a % As[0] != 0 else As[0] for a in As]",
"-As = sorted(As)",
"-def judge(tmp_one, tmp_two):",
"- flg = 1",
"- while flg:",
"- if tmp_two % tmp_one == 0:",
"- tmp_two = tmp_one",
"+def gcd(n, m):",
"+ if n < m:",
"+ temp = ... | false | 0.043575 | 0.042732 | 1.019715 | [
"s538589503",
"s850149076"
] |
u561083515 | p03108 | python | s398094945 | s209371635 | 941 | 736 | 29,112 | 30,728 | Accepted | Accepted | 21.79 | class UnionFind():
# コンストラクタ
def __init__(self, n):
# 要素数
self.n = n
# parents[i]: 要素iの親要素の番号
# 要素iが根の場合、parents[i] = -(そのグループの要素数)
self.parents = [-1] * n
# 要素xが属するグループの根を返す
# 経路圧縮
def find(self, x):
if self.parents[x] < 0:
r... | class UnionFind():
# コンストラクタ
def __init__(self, n):
# 要素数
self.n = n
# parents[i]: 要素iの親要素の番号
# 要素iが根の場合、parents[i] = -(そのグループの要素数)
self.parents = [-1] * n
# 要素xが属するグループの根を返す
# 経路圧縮
def find(self, x):
if self.parents[x] < 0:
r... | 81 | 59 | 2,034 | 1,353 | class UnionFind:
# コンストラクタ
def __init__(self, n):
# 要素数
self.n = n
# parents[i]: 要素iの親要素の番号
# 要素iが根の場合、parents[i] = -(そのグループの要素数)
self.parents = [-1] * n
# 要素xが属するグループの根を返す
# 経路圧縮
def find(self, x):
if self.parents[x] < 0:
return x
... | class UnionFind:
# コンストラクタ
def __init__(self, n):
# 要素数
self.n = n
# parents[i]: 要素iの親要素の番号
# 要素iが根の場合、parents[i] = -(そのグループの要素数)
self.parents = [-1] * n
# 要素xが属するグループの根を返す
# 経路圧縮
def find(self, x):
if self.parents[x] < 0:
return x
... | false | 27.160494 | [
"- # 要素xが属するグループに属する要素をリストで返す",
"- def members(self, x):",
"- root = self.find(x)",
"- return [i for i in range(self.n) if self.find(i) == root]",
"- # 全ての根の要素をリストで返す",
"- def roots(self):",
"- return [i for i, x in enumerate(self.parents) if x < 0]",
"-",
"- # グル... | false | 0.045717 | 0.039442 | 1.159098 | [
"s398094945",
"s209371635"
] |
u968166680 | p03014 | python | s895201213 | s681225749 | 547 | 504 | 204,620 | 204,148 | Accepted | Accepted | 7.86 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for ... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for ... | 62 | 62 | 1,449 | 1,430 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
H, W = list(map(int, readline().split()))
S = [readline().strip() for _ in range(H)]
L = [[0] * W for _ in range(H)]
R = [[0] * W for _ in range(H)]
... | false | 0 | [
"- if S[i][j] == \".\" and ans < L[i][j] + R[i][j] + U[i][j] + D[i][j] + 1:",
"+ if ans < L[i][j] + R[i][j] + U[i][j] + D[i][j] + 1:"
] | false | 0.093721 | 0.045292 | 2.069274 | [
"s895201213",
"s681225749"
] |
u059210959 | p02678 | python | s904418475 | s015195519 | 943 | 703 | 63,860 | 62,440 | Accepted | Accepted | 25.45 | #!/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... | 121 | 121 | 2,653 | 2,673 | #!/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 | 0 | [
"-uf = UnionFind(N)",
"-for a, b in AB:",
"- uf.Unite(a, b)",
"-ans = True",
"-for i in range(N):",
"- if not uf.isSameGroup(0, i):",
"- ans = False",
"-if ans == False:",
"- print(\"No\")",
"- sys.exit()",
"+# uf = UnionFind(N)",
"+# for a,b in AB:",
"+# uf.Unite(a,b)... | false | 0.09972 | 0.085912 | 1.16073 | [
"s904418475",
"s015195519"
] |
u466143662 | p03109 | python | s357907108 | s193003467 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | s = int(input().replace("/",""))
if s<= 20190430:
print("Heisei")
else:
print("TBD") | y, m, d = list(map(int, input().split("/")))
if y < 2019:
print("Heisei")
elif y == 2019 and m <= 4:
print("Heisei")
else:
print("TBD") | 5 | 8 | 92 | 155 | s = int(input().replace("/", ""))
if s <= 20190430:
print("Heisei")
else:
print("TBD")
| y, m, d = list(map(int, input().split("/")))
if y < 2019:
print("Heisei")
elif y == 2019 and m <= 4:
print("Heisei")
else:
print("TBD")
| false | 37.5 | [
"-s = int(input().replace(\"/\", \"\"))",
"-if s <= 20190430:",
"+y, m, d = list(map(int, input().split(\"/\")))",
"+if y < 2019:",
"+ print(\"Heisei\")",
"+elif y == 2019 and m <= 4:"
] | false | 0.059501 | 0.056243 | 1.057929 | [
"s357907108",
"s193003467"
] |
u991542950 | p02582 | python | s079016908 | s326851708 | 75 | 64 | 61,628 | 61,856 | Accepted | Accepted | 14.67 | n = list(eval(input()))
n_r = len([i for i in n if i == "R"])
if n_r == 2:
if n[1] == "S":
print((1))
else:
print((2))
else:
print(n_r)
| S = eval(input())
R_check = lambda x: 1 if x=="R" else 0
rain_flg = list(map(R_check, S))
if sum(rain_flg) == 2:
if rain_flg[1] == 0:
print((1))
else:
print((2))
else:
print((sum(rain_flg))) | 10 | 10 | 150 | 201 | n = list(eval(input()))
n_r = len([i for i in n if i == "R"])
if n_r == 2:
if n[1] == "S":
print((1))
else:
print((2))
else:
print(n_r)
| S = eval(input())
R_check = lambda x: 1 if x == "R" else 0
rain_flg = list(map(R_check, S))
if sum(rain_flg) == 2:
if rain_flg[1] == 0:
print((1))
else:
print((2))
else:
print((sum(rain_flg)))
| false | 0 | [
"-n = list(eval(input()))",
"-n_r = len([i for i in n if i == \"R\"])",
"-if n_r == 2:",
"- if n[1] == \"S\":",
"+S = eval(input())",
"+R_check = lambda x: 1 if x == \"R\" else 0",
"+rain_flg = list(map(R_check, S))",
"+if sum(rain_flg) == 2:",
"+ if rain_flg[1] == 0:",
"- print(n_r)",
... | false | 0.061339 | 0.044452 | 1.379878 | [
"s079016908",
"s326851708"
] |
u150984829 | p00458 | python | s334636108 | s182206091 | 260 | 220 | 5,720 | 5,728 | Accepted | Accepted | 15.38 | def s():
def b(M,x,y,n=1):
M[x][y]=0;a=n
for p,q in[(-1,0),(0,-1),(1,0),(0,1)]:
if M[x+p][y+q]:
t=b(M,x+p,y+q,n+1)
if a<t:a=t
M[x][y]=1
return a
for e in iter(input,'0'):
n,m=int(e),int(eval(input()))
P=[[0]*(n+2)for _ in[0]*(m+2)]
for i in range(m):P[i+1][1:-1]=list(map(int,input... | def s():
def b(M,x,y,n=1):
M[x][y]=0;a=n
if M[x-1][y]:
t=b(M,x-1,y,n+1)
if a<t:a=t
if M[x][y-1]:
t=b(M,x,y-1,n+1)
if a<t:a=t
if M[x+1][y]:
t=b(M,x+1,y,n+1)
if a<t:a=t
if M[x][y+1]:
t=b(M,x,y+1,n+1)
if a<t:a=t
M[x][y]=1
return a
for e in iter(input,'0'):
n,m=in... | 15 | 29 | 425 | 582 | def s():
def b(M, x, y, n=1):
M[x][y] = 0
a = n
for p, q in [(-1, 0), (0, -1), (1, 0), (0, 1)]:
if M[x + p][y + q]:
t = b(M, x + p, y + q, n + 1)
if a < t:
a = t
M[x][y] = 1
return a
for e in iter(input, "0"... | def s():
def b(M, x, y, n=1):
M[x][y] = 0
a = n
if M[x - 1][y]:
t = b(M, x - 1, y, n + 1)
if a < t:
a = t
if M[x][y - 1]:
t = b(M, x, y - 1, n + 1)
if a < t:
a = t
if M[x + 1][y]:
t = ... | false | 48.275862 | [
"- for p, q in [(-1, 0), (0, -1), (1, 0), (0, 1)]:",
"- if M[x + p][y + q]:",
"- t = b(M, x + p, y + q, n + 1)",
"- if a < t:",
"- a = t",
"+ if M[x - 1][y]:",
"+ t = b(M, x - 1, y, n + 1)",
"+ if a < t:",
... | false | 0.048858 | 0.044881 | 1.088593 | [
"s334636108",
"s182206091"
] |
u997641430 | p03325 | python | s187972022 | s337668277 | 107 | 79 | 4,148 | 4,148 | Accepted | Accepted | 26.17 | N=int(eval(input()))
A=list(map(int,input().split()))
count=0
for a in A:
while a%2==0:
a=int(a/2)
count+=1
print(count) | n = int(eval(input()))
*A, = list(map(int, input().split()))
c = 0
for a in A:
while a % 2 == 0:
a = a//2
c += 1
print(c)
| 8 | 8 | 141 | 137 | N = int(eval(input()))
A = list(map(int, input().split()))
count = 0
for a in A:
while a % 2 == 0:
a = int(a / 2)
count += 1
print(count)
| n = int(eval(input()))
(*A,) = list(map(int, input().split()))
c = 0
for a in A:
while a % 2 == 0:
a = a // 2
c += 1
print(c)
| false | 0 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-count = 0",
"+n = int(eval(input()))",
"+(*A,) = list(map(int, input().split()))",
"+c = 0",
"- a = int(a / 2)",
"- count += 1",
"-print(count)",
"+ a = a // 2",
"+ c += 1",
"+print(c)"
] | false | 0.040519 | 0.040846 | 0.991988 | [
"s187972022",
"s337668277"
] |
u508273185 | p02898 | python | s474196831 | s030892610 | 56 | 49 | 11,912 | 11,916 | Accepted | Accepted | 12.5 | n , k = list(map(int, input().split()))
h = list(map(int,input().split()))
count = 0
for i in range(n):
if k <= h[i]:
count += 1
print(count) | #別回答
n , k = list(map(int, input().split()))
h = list(map(int,input().split()))
count = 0
for i in h:
#print(i)
if i >= k:
count += 1
print(count) | 8 | 10 | 155 | 166 | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
count = 0
for i in range(n):
if k <= h[i]:
count += 1
print(count)
| # 別回答
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
count = 0
for i in h:
# print(i)
if i >= k:
count += 1
print(count)
| false | 20 | [
"+# 別回答",
"-for i in range(n):",
"- if k <= h[i]:",
"+for i in h:",
"+ # print(i)",
"+ if i >= k:"
] | false | 0.038695 | 0.042513 | 0.910193 | [
"s474196831",
"s030892610"
] |
u348805958 | p02651 | python | s759047105 | s635296127 | 70 | 56 | 9,080 | 9,232 | Accepted | Accepted | 20 | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
X = (10**18).bit_length()
def f(a, s, n):
if s[-1] == "1":
return 1
B = [None] * X
for i in range(n-1, -1, -1):
ai, si = a[i], s[i]
if si == "0":
while True:
... | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
def f(a, s, n):
if s[-1] == "1":
return 1
X = max(a).bit_length()
B = [None] * X
for i in range(n-1, -1, -1):
ai, si = a[i], s[i]
if si == "0":
while True:
... | 48 | 50 | 1,001 | 1,095 | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
X = (10**18).bit_length()
def f(a, s, n):
if s[-1] == "1":
return 1
B = [None] * X
for i in range(n - 1, -1, -1):
ai, si = a[i], s[i]
if si == "0":
while True:
x = ai.bit... | #!python3
import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())
def f(a, s, n):
if s[-1] == "1":
return 1
X = max(a).bit_length()
B = [None] * X
for i in range(n - 1, -1, -1):
ai, si = a[i], s[i]
if si == "0":
while True:
x = ai.b... | false | 4 | [
"-X = (10**18).bit_length()",
"+ X = max(a).bit_length()",
"+ X -= 1",
"+ if X == 0:",
"+ return 0"
] | false | 0.041664 | 0.048041 | 0.867269 | [
"s759047105",
"s635296127"
] |
u169138653 | p02781 | python | s902921557 | s004252580 | 185 | 19 | 40,304 | 3,064 | Accepted | Accepted | 89.73 | n=eval(input())
k=int(eval(input()))
lenn=len(n)
dp=[[[0]*2 for i in range(k+1)] for j in range(lenn)]
for i in range(int(n[0])+1):
keta=int(n[0])
if i<keta:
if i==0:
dp[0][0][1]+=1
else:
dp[0][1][1]+=1
elif i==keta:
dp[0][1][0]+=1
for i in range(1,lenn):
keta=int(n[i])
... | n=eval(input())
k=int(eval(input()))
lenn=len(n)
dp=[[[0]*2 for i in range(k+1)] for j in range(lenn)]
dp[0][1][1]+=int(n[0])-1
dp[0][0][1]+=1
dp[0][1][0]+=1
for i in range(1,lenn):
keta=int(n[i])
for j in range(k):
dp[i][j+1][1]+=dp[i-1][j][1]*9
dp[i][j][1]+=dp[i-1][j][1]
if keta>0:
... | 37 | 24 | 876 | 619 | n = eval(input())
k = int(eval(input()))
lenn = len(n)
dp = [[[0] * 2 for i in range(k + 1)] for j in range(lenn)]
for i in range(int(n[0]) + 1):
keta = int(n[0])
if i < keta:
if i == 0:
dp[0][0][1] += 1
else:
dp[0][1][1] += 1
elif i == keta:
dp[0][1][0] += 1
... | n = eval(input())
k = int(eval(input()))
lenn = len(n)
dp = [[[0] * 2 for i in range(k + 1)] for j in range(lenn)]
dp[0][1][1] += int(n[0]) - 1
dp[0][0][1] += 1
dp[0][1][0] += 1
for i in range(1, lenn):
keta = int(n[i])
for j in range(k):
dp[i][j + 1][1] += dp[i - 1][j][1] * 9
dp[i][j][1] += dp[... | false | 35.135135 | [
"-for i in range(int(n[0]) + 1):",
"- keta = int(n[0])",
"- if i < keta:",
"- if i == 0:",
"- dp[0][0][1] += 1",
"- else:",
"- dp[0][1][1] += 1",
"- elif i == keta:",
"- dp[0][1][0] += 1",
"+dp[0][1][1] += int(n[0]) - 1",
"+dp[0][0][1] += 1",
... | false | 0.047749 | 0.042553 | 1.122101 | [
"s902921557",
"s004252580"
] |
u814781830 | p03212 | python | s018560322 | s308148424 | 302 | 270 | 48,604 | 48,476 | Accepted | Accepted | 10.6 | N = eval(input())
D = len(N)
N = int(N)
ans = 0
def dfs(v):
global ans
if v > N: return 0
if len(set(str(v))) == 3: ans += 1
for i in (3,5,7):
dfs(v*10+i)
dfs(0)
print(ans)
| N = int(eval(input()))
ans = 0
def dfs(v):
global ans
if v > N: return 0
if len(set(str(v))) == 3: ans += 1
for i in (3,5,7):
dfs(v*10+i)
dfs(0)
print(ans)
| 13 | 10 | 204 | 183 | N = eval(input())
D = len(N)
N = int(N)
ans = 0
def dfs(v):
global ans
if v > N:
return 0
if len(set(str(v))) == 3:
ans += 1
for i in (3, 5, 7):
dfs(v * 10 + i)
dfs(0)
print(ans)
| N = int(eval(input()))
ans = 0
def dfs(v):
global ans
if v > N:
return 0
if len(set(str(v))) == 3:
ans += 1
for i in (3, 5, 7):
dfs(v * 10 + i)
dfs(0)
print(ans)
| false | 23.076923 | [
"-N = eval(input())",
"-D = len(N)",
"-N = int(N)",
"+N = int(eval(input()))"
] | false | 0.04286 | 0.051223 | 0.836718 | [
"s018560322",
"s308148424"
] |
u078042885 | p00183 | python | s181857039 | s692837305 | 30 | 20 | 7,424 | 7,436 | Accepted | Accepted | 33.33 | def f(a):
for x in ['b','w']:
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=eval(input())
if a=='0':break
a+=eval(input())+eval(input())
print((... | def f(a):
for x in ['b','w']:
if a[0::4].count(x)==3 or a[2:7:2].count(x)==3:return x
for i in range(3):
if a[i*3:i*3+3].count(x)==3 or a[i::3].count(x)==3:return x
return 'NA'
while 1:
a=eval(input())
if a=='0':break
print((f(a+eval(input())+eval(input())))) | 12 | 11 | 312 | 298 | def f(a):
for x in ["b", "w"]:
if a[0::4].count(x) == 3 or a[2:7:2].count(x) == 3:
return x
for i in range(3):
if a[i * 3 : i * 3 + 3].count(x) == 3 or a[i::3].count(x) == 3:
return x
return "NA"
while 1:
a = eval(input())
if a == "0":
br... | def f(a):
for x in ["b", "w"]:
if a[0::4].count(x) == 3 or a[2:7:2].count(x) == 3:
return x
for i in range(3):
if a[i * 3 : i * 3 + 3].count(x) == 3 or a[i::3].count(x) == 3:
return x
return "NA"
while 1:
a = eval(input())
if a == "0":
br... | false | 8.333333 | [
"- a += eval(input()) + eval(input())",
"- print((f(list(a))))",
"+ print((f(a + eval(input()) + eval(input()))))"
] | false | 0.225704 | 0.043397 | 5.200902 | [
"s181857039",
"s692837305"
] |
u911856499 | p03048 | python | s181812193 | s289578902 | 1,617 | 66 | 27,132 | 67,368 | Accepted | Accepted | 95.92 | import sys
import copy
import math
import itertools
import numpy as np
import re
R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
for g in range((N-r*R)//G+1):
if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
cnt += 1
print(cnt) | R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
for g in range((N-r*R)//G+1):
if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
cnt += 1
print(cnt) | 14 | 7 | 284 | 195 | import sys
import copy
import math
import itertools
import numpy as np
import re
R, G, B, N = [int(c) for c in input().split()]
cnt = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
if r * R + g * G <= N and (N - r * R - g * G) % B == 0:
cnt += 1
print(cnt)
| R, G, B, N = [int(c) for c in input().split()]
cnt = 0
for r in range(N // R + 1):
for g in range((N - r * R) // G + 1):
if r * R + g * G <= N and (N - r * R - g * G) % B == 0:
cnt += 1
print(cnt)
| false | 50 | [
"-import sys",
"-import copy",
"-import math",
"-import itertools",
"-import numpy as np",
"-import re",
"-"
] | false | 0.290693 | 0.067279 | 4.320706 | [
"s181812193",
"s289578902"
] |
u254871849 | p04045 | python | s848377980 | s374833679 | 74 | 27 | 3,060 | 3,824 | Accepted | Accepted | 63.51 | n, k = list(map(int, input().split()))
dis = input().split()
m = n
while True:
m = str(m)
for d in dis:
if d in m:
break
else:
print(m)
exit()
m = int(m) + 1 | import sys
from string import digits
from itertools import product
from bisect import bisect_left as bi_l
n, k, *dislikes = sys.stdin.read().split()
def main():
likes = sorted(set(digits) - set(dislikes))
cand = product(likes, repeat=len(n))
*cand, = [int(''.join(x)) for x in cand]
cand.sor... | 13 | 25 | 216 | 623 | n, k = list(map(int, input().split()))
dis = input().split()
m = n
while True:
m = str(m)
for d in dis:
if d in m:
break
else:
print(m)
exit()
m = int(m) + 1
| import sys
from string import digits
from itertools import product
from bisect import bisect_left as bi_l
n, k, *dislikes = sys.stdin.read().split()
def main():
likes = sorted(set(digits) - set(dislikes))
cand = product(likes, repeat=len(n))
(*cand,) = [int("".join(x)) for x in cand]
cand.sort()
... | false | 48 | [
"-n, k = list(map(int, input().split()))",
"-dis = input().split()",
"-m = n",
"-while True:",
"- m = str(m)",
"- for d in dis:",
"- if d in m:",
"- break",
"+import sys",
"+from string import digits",
"+from itertools import product",
"+from bisect import bisect_left a... | false | 0.043494 | 0.044443 | 0.978638 | [
"s848377980",
"s374833679"
] |
u186838327 | p02873 | python | s470940488 | s520016571 | 239 | 97 | 77,800 | 85,860 | Accepted | Accepted | 59.41 | s = str(eval(input()))
n = len(s)
cnt = 0
l = []
for i in range(n):
l.append(cnt)
if s[i] == '<':
cnt += 1
else:
cnt = 0
else:
l.append(cnt)
#print(l)
r = []
cnt = 0
for i in reversed(list(range(n))):
r.append(cnt)
if s[i] == '>':
cnt += 1
else:
... | s = str(eval(input()))
n = len(s)
L = [0]*(n+1)
cnt = 0
for i in range(n):
if s[i] == '<':
cnt += 1
else:
cnt = 0
L[i+1] = cnt
R = [0]*(n+1)
cnt = 0
for i in reversed(list(range(n))):
if s[i] == '>':
cnt += 1
else:
cnt = 0
R[i] = cnt
A ... | 31 | 27 | 460 | 385 | s = str(eval(input()))
n = len(s)
cnt = 0
l = []
for i in range(n):
l.append(cnt)
if s[i] == "<":
cnt += 1
else:
cnt = 0
else:
l.append(cnt)
# print(l)
r = []
cnt = 0
for i in reversed(list(range(n))):
r.append(cnt)
if s[i] == ">":
cnt += 1
else:
cnt = 0
else:... | s = str(eval(input()))
n = len(s)
L = [0] * (n + 1)
cnt = 0
for i in range(n):
if s[i] == "<":
cnt += 1
else:
cnt = 0
L[i + 1] = cnt
R = [0] * (n + 1)
cnt = 0
for i in reversed(list(range(n))):
if s[i] == ">":
cnt += 1
else:
cnt = 0
R[i] = cnt
A = [0] * (n + 1)
fo... | false | 12.903226 | [
"+L = [0] * (n + 1)",
"-l = []",
"- l.append(cnt)",
"-else:",
"- l.append(cnt)",
"-# print(l)",
"-r = []",
"+ L[i + 1] = cnt",
"+R = [0] * (n + 1)",
"- r.append(cnt)",
"-else:",
"- r.append(cnt)",
"-r.reverse()",
"-# print(r)",
"-A = [0] * len(l)",
"-for i in range(len(A... | false | 0.03476 | 0.03481 | 0.998577 | [
"s470940488",
"s520016571"
] |
u609814378 | p02873 | python | s536067702 | s082085086 | 385 | 330 | 23,336 | 27,184 | Accepted | Accepted | 14.29 | S = eval(input())
N = len(S) + 1
t = [0] * N
for i in range(N - 1):
if S[i] == '<':
t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
if S[i] == '>':
t[i] = max(t[i], t[i + 1] + 1)
print((sum(t))) | import sys
S = list(eval(input()))
lis = [0] * (len(S)+1)
if len(S) == 1:
print((1))
sys.exit()
#最初は < を処理する
for i in range(len(S)):
if S[i] == "<":
lis[i+1] = lis[i] + 1
for j in range(len(S)-1,-1,-1):
if S[j] == ">":
lis[j] = max(lis[j],lis[j+1] + 1)
... | 11 | 24 | 224 | 335 | S = eval(input())
N = len(S) + 1
t = [0] * N
for i in range(N - 1):
if S[i] == "<":
t[i + 1] = t[i] + 1
for i in range(N - 2, -1, -1):
if S[i] == ">":
t[i] = max(t[i], t[i + 1] + 1)
print((sum(t)))
| import sys
S = list(eval(input()))
lis = [0] * (len(S) + 1)
if len(S) == 1:
print((1))
sys.exit()
# 最初は < を処理する
for i in range(len(S)):
if S[i] == "<":
lis[i + 1] = lis[i] + 1
for j in range(len(S) - 1, -1, -1):
if S[j] == ">":
lis[j] = max(lis[j], lis[j + 1] + 1)
print((sum(lis)))
| false | 54.166667 | [
"-S = eval(input())",
"-N = len(S) + 1",
"-t = [0] * N",
"-for i in range(N - 1):",
"+import sys",
"+",
"+S = list(eval(input()))",
"+lis = [0] * (len(S) + 1)",
"+if len(S) == 1:",
"+ print((1))",
"+ sys.exit()",
"+# 最初は < を処理する",
"+for i in range(len(S)):",
"- t[i + 1] = t[i]... | false | 0.03973 | 0.041352 | 0.960787 | [
"s536067702",
"s082085086"
] |
u047102107 | p02936 | python | s166724700 | s784681879 | 1,319 | 1,133 | 204,624 | 206,928 | Accepted | Accepted | 14.1 | from collections import deque, defaultdict, Counter
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]
# build tree
tree = defaultdict(list)
for a, b in ab:
tr... | from collections import deque, defaultdict, Counter
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]
# build tree
tree = defaultdict(list)
for a, b in ab:
tr... | 33 | 34 | 696 | 713 | from collections import deque, defaultdict, Counter
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]
# build tree
tree = defaultdict(list)
for a, b in ab:
tree[a - 1].ap... | from collections import deque, defaultdict, Counter
import sys
input = sys.stdin.readline
N, Q = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(N - 1)]
px = [list(map(int, input().split())) for _ in range(Q)]
# build tree
tree = defaultdict(list)
for a, b in ab:
tree[a - 1].ap... | false | 2.941176 | [
"+# 同じノードがきたらまとめておく",
"+# (複数回DFSしない)",
"-checked = [0] * N",
"-checked[0] = 1",
"+checked = [False] * N",
"- n = q.popleft()",
"+ n = q.pop()",
"+ checked[n] = True",
"- checked[u] = 1"
] | false | 0.036424 | 0.091891 | 0.396376 | [
"s166724700",
"s784681879"
] |
u796942881 | p03244 | python | s549570842 | s695800909 | 85 | 64 | 18,604 | 14,324 | Accepted | Accepted | 24.71 | from collections import Counter
input = open(0).read
n, *v = list(map(int, input().split()))
def main():
e = Counter(v[::2])
o = Counter(v[1::2])
em = e.most_common(2)
om = o.most_common(2)
# 要素は最低でも 2 つ
em.append((0, 0))
om.append((0, 0))
if em[0][0] == om[0][0]... | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
if be.index(max(be)) == bo.index(max(bo)):
ve = max(be)
vo = max(bo)
be[be.index(ve)] = ... | 27 | 19 | 463 | 475 | from collections import Counter
input = open(0).read
n, *v = list(map(int, input().split()))
def main():
e = Counter(v[::2])
o = Counter(v[1::2])
em = e.most_common(2)
om = o.most_common(2)
# 要素は最低でも 2 つ
em.append((0, 0))
om.append((0, 0))
if em[0][0] == om[0][0]:
print((min(n... | def main():
n, *v = list(map(int, open(0).read().split()))
be = [0] * int(1e5)
bo = [0] * int(1e5)
for e, o in zip(*[iter(v)] * 2):
be[e - 1] += 1
bo[o - 1] += 1
if be.index(max(be)) == bo.index(max(bo)):
ve = max(be)
vo = max(bo)
be[be.index(ve)] = 0
... | false | 29.62963 | [
"-from collections import Counter",
"-",
"-input = open(0).read",
"-n, *v = list(map(int, input().split()))",
"-",
"-",
"- e = Counter(v[::2])",
"- o = Counter(v[1::2])",
"- em = e.most_common(2)",
"- om = o.most_common(2)",
"- # 要素は最低でも 2 つ",
"- em.append((0, 0))",
"- o... | false | 0.093947 | 0.175017 | 0.536789 | [
"s549570842",
"s695800909"
] |
u072053884 | p02385 | python | s575118527 | s391130365 | 60 | 50 | 7,672 | 7,620 | Accepted | Accepted | 16.67 | class Dice:
same_dice_index = ((0, 1, 2, 3, 4, 5), (0, 2, 4, 1, 3, 5), (0, 3, 1, 4, 2, 5),
(0, 4, 3, 2, 1, 5), (1, 0, 3, 2, 5, 4), (1, 2, 0, 5, 3, 4),
(1, 3, 5, 0, 2, 4), (1, 5, 2, 3, 0, 4), (2, 0, 1, 4, 5, 3),
(2, 1, 5, 0, 4, 3), (2, 4, 0, 5,... | class Dice:
same_dice_index = ((0, 1, 2, 3, 4, 5), (0, 2, 4, 1, 3, 5), (0, 3, 1, 4, 2, 5),
(0, 4, 3, 2, 1, 5), (1, 0, 3, 2, 5, 4), (1, 2, 0, 5, 3, 4),
(1, 3, 5, 0, 2, 4), (1, 5, 2, 3, 0, 4), (2, 0, 1, 4, 5, 3),
(2, 1, 5, 0, 4, 3), (2, 4, 0, 5,... | 33 | 30 | 1,203 | 1,164 | class Dice:
same_dice_index = (
(0, 1, 2, 3, 4, 5),
(0, 2, 4, 1, 3, 5),
(0, 3, 1, 4, 2, 5),
(0, 4, 3, 2, 1, 5),
(1, 0, 3, 2, 5, 4),
(1, 2, 0, 5, 3, 4),
(1, 3, 5, 0, 2, 4),
(1, 5, 2, 3, 0, 4),
(2, 0, 1, 4, 5, 3),
(2, 1, 5, 0, 4, 3),
... | class Dice:
same_dice_index = (
(0, 1, 2, 3, 4, 5),
(0, 2, 4, 1, 3, 5),
(0, 3, 1, 4, 2, 5),
(0, 4, 3, 2, 1, 5),
(1, 0, 3, 2, 5, 4),
(1, 2, 0, 5, 3, 4),
(1, 3, 5, 0, 2, 4),
(1, 5, 2, 3, 0, 4),
(2, 0, 1, 4, 5, 3),
(2, 1, 5, 0, 4, 3),
... | false | 9.090909 | [
"- return True",
"- return False",
"+ return \"Yes\"",
"+ return \"No\"",
"-if dice1.is_same(dice2):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((dice1.is_same(dice2)))"
] | false | 0.035555 | 0.042401 | 0.838527 | [
"s575118527",
"s391130365"
] |
u930705402 | p02850 | python | s923798868 | s061580703 | 1,189 | 1,057 | 92,080 | 97,084 | Accepted | Accepted | 11.1 | import sys
sys.setrecursionlimit(10**6)
def dfs(G,v,p,color):
cnt=1
for nv in G[v]:
if(nv==p):
continue
if cnt in liset[v]:
while(cnt in liset[v]):
cnt+=1
liset[v].add(cnt)
liset[nv].add(cnt)
dic[str(v)+'t'+str(nv)]=cnt
... | import sys
sys.setrecursionlimit(10**6)
def dfs(G,v,p,color):
cnt=1
for nv in G[v]:
if(nv==p):
continue
while(cnt in s[v]):
cnt+=1
s[v].add(cnt)
s[nv].add(cnt)
dic[tuple(sorted([v,nv]))]=cnt
dfs(G,nv,v,cnt)
N=int(... | 34 | 31 | 819 | 665 | import sys
sys.setrecursionlimit(10**6)
def dfs(G, v, p, color):
cnt = 1
for nv in G[v]:
if nv == p:
continue
if cnt in liset[v]:
while cnt in liset[v]:
cnt += 1
liset[v].add(cnt)
liset[nv].add(cnt)
dic[str(v) + "t" + str(nv)] = ... | import sys
sys.setrecursionlimit(10**6)
def dfs(G, v, p, color):
cnt = 1
for nv in G[v]:
if nv == p:
continue
while cnt in s[v]:
cnt += 1
s[v].add(cnt)
s[nv].add(cnt)
dic[tuple(sorted([v, nv]))] = cnt
dfs(G, nv, v, cnt)
N = int(eval(in... | false | 8.823529 | [
"- if cnt in liset[v]:",
"- while cnt in liset[v]:",
"- cnt += 1",
"- liset[v].add(cnt)",
"- liset[nv].add(cnt)",
"- dic[str(v) + \"t\" + str(nv)] = cnt",
"+ while cnt in s[v]:",
"+ cnt += 1",
"+ s[v].add(cnt)",
"+ ... | false | 0.037211 | 0.037599 | 0.989691 | [
"s923798868",
"s061580703"
] |
u359358631 | p02572 | python | s404763898 | s811157865 | 142 | 127 | 102,000 | 94,256 | Accepted | Accepted | 10.56 | def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
sum_list = [0 for _ in range(n)]
sum_list[0] = sum(a_list)
ans = 0
for i in range(1, n):
sum_list[i] = sum_list[i - 1] - a_list[i - 1]
for i in range(n - 1):
ans += a_list[i] * sum_list... | def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
mod = 10 ** 9 + 7
sum_a = sum(a_list)
ans = 0
for i in range(n - 1):
sum_a -= a_list[i]
ans += (a_list[i] * sum_a) % mod
print((ans % mod))
if __name__ == "__main__":
main()
| 19 | 16 | 416 | 309 | def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
sum_list = [0 for _ in range(n)]
sum_list[0] = sum(a_list)
ans = 0
for i in range(1, n):
sum_list[i] = sum_list[i - 1] - a_list[i - 1]
for i in range(n - 1):
ans += a_list[i] * sum_list[i + 1] % (10**... | def main():
n = int(eval(input()))
a_list = list(map(int, input().split()))
mod = 10**9 + 7
sum_a = sum(a_list)
ans = 0
for i in range(n - 1):
sum_a -= a_list[i]
ans += (a_list[i] * sum_a) % mod
print((ans % mod))
if __name__ == "__main__":
main()
| false | 15.789474 | [
"- sum_list = [0 for _ in range(n)]",
"- sum_list[0] = sum(a_list)",
"+ mod = 10**9 + 7",
"+ sum_a = sum(a_list)",
"- for i in range(1, n):",
"- sum_list[i] = sum_list[i - 1] - a_list[i - 1]",
"- ans += a_list[i] * sum_list[i + 1] % (10**9 + 7)",
"- print((ans % (10**9 ... | false | 0.042106 | 0.041986 | 1.002839 | [
"s404763898",
"s811157865"
] |
u340781749 | p02599 | python | s606359771 | s244087707 | 695 | 598 | 97,924 | 97,716 | Accepted | Accepted | 13.96 | import os
import sys
import numpy as np
def solve(inp):
def bit_add(arr, n, i, x):
while i <= n:
arr[i] += x
i += i & -i
def bit_sum(arr, i):
result = 0
while i > 0:
result += arr[i]
i ^= i & -i
return result
... | import os
import sys
import numpy as np
def solve(inp):
def bit_add(arr, n, i, x):
while i <= n:
arr[i] += x
i += i & -i
def bit_sum(arr, i):
result = 0
while i > 0:
result += arr[i]
i ^= i & -i
return result
... | 69 | 65 | 1,558 | 1,508 | import os
import sys
import numpy as np
def solve(inp):
def bit_add(arr, n, i, x):
while i <= n:
arr[i] += x
i += i & -i
def bit_sum(arr, i):
result = 0
while i > 0:
result += arr[i]
i ^= i & -i
return result
n = inp[0]
... | import os
import sys
import numpy as np
def solve(inp):
def bit_add(arr, n, i, x):
while i <= n:
arr[i] += x
i += i & -i
def bit_sum(arr, i):
result = 0
while i > 0:
result += arr[i]
i ^= i & -i
return result
n = inp[0]
... | false | 5.797101 | [
"- ccc = inp[2 : 2 + n]",
"+ ccc = inp[2 : 2 + n] - 1",
"- just_left = {}",
"- segments = []",
"- for i in range(n):",
"- c = ccc[i]",
"- if c in just_left:",
"- segments.append((i, 0, just_left[c], 0))",
"- just_left[c] = i",
"- for i in range(q):... | false | 0.588661 | 0.456894 | 1.288398 | [
"s606359771",
"s244087707"
] |
u535010493 | p02983 | python | s900171633 | s856003550 | 943 | 785 | 3,060 | 2,940 | Accepted | Accepted | 16.76 | l,r=list(map(int,input().split()))
if l//2019!=r//2019:
print((0))
exit()
ans=2019
for i in range(l,r):
for k in range(i+1,r+1):
ans=min(ans,(i%2019)*(k%2019)%2019)
print(ans) | l,r=list(map(int,input().split()))
if l//2019!=r//2019:
print((0))
exit()
ans=2019
for i in range(l,r):
for k in range(i+1,r+1):
ans=min(ans,i*k%2019)
print(ans) | 10 | 10 | 197 | 183 | l, r = list(map(int, input().split()))
if l // 2019 != r // 2019:
print((0))
exit()
ans = 2019
for i in range(l, r):
for k in range(i + 1, r + 1):
ans = min(ans, (i % 2019) * (k % 2019) % 2019)
print(ans)
| l, r = list(map(int, input().split()))
if l // 2019 != r // 2019:
print((0))
exit()
ans = 2019
for i in range(l, r):
for k in range(i + 1, r + 1):
ans = min(ans, i * k % 2019)
print(ans)
| false | 0 | [
"- ans = min(ans, (i % 2019) * (k % 2019) % 2019)",
"+ ans = min(ans, i * k % 2019)"
] | false | 0.084045 | 0.040656 | 2.067227 | [
"s900171633",
"s856003550"
] |
u677312543 | p03243 | python | s703719650 | s298386249 | 22 | 19 | 3,316 | 2,940 | Accepted | Accepted | 13.64 | import re
import sys
n = int(eval(input()))
for i in range(n, 1000):
if re.match('^([0-9])\\1+$', str(i)):
print(i)
sys.exit(0) | n = int(eval(input()))
for i in range(1, 10):
if n <= i*111:
print((i*111))
exit()
| 9 | 6 | 151 | 101 | import re
import sys
n = int(eval(input()))
for i in range(n, 1000):
if re.match("^([0-9])\\1+$", str(i)):
print(i)
sys.exit(0)
| n = int(eval(input()))
for i in range(1, 10):
if n <= i * 111:
print((i * 111))
exit()
| false | 33.333333 | [
"-import re",
"-import sys",
"-",
"-for i in range(n, 1000):",
"- if re.match(\"^([0-9])\\\\1+$\", str(i)):",
"- print(i)",
"- sys.exit(0)",
"+for i in range(1, 10):",
"+ if n <= i * 111:",
"+ print((i * 111))",
"+ exit()"
] | false | 0.048993 | 0.037046 | 1.322508 | [
"s703719650",
"s298386249"
] |
u698176039 | p03338 | python | s735415599 | s217698450 | 29 | 18 | 3,064 | 3,060 | Accepted | Accepted | 37.93 | N = int(eval(input()))
S = eval(input())
sets = set(S)
ans = 0
for i in range(1,N):
cnt = 0
for s in sets:
l = 0
r = 0
for j in S[:i]:
if j ==s :
l=1
break
for j in S[i:N]:
if j == s :
... | N = int(eval(input()))
S = list(eval(input()))
#%%
ans= 0
for i in range(1,N):
set1 = set()
set2 = set()
for s in S[:i]:
set1.add(s)
for s in S[i:]:
set2.add(s)
sets = set1 & set2
ans = max(ans,len(list(sets)))
print(ans)
| 23 | 21 | 421 | 300 | N = int(eval(input()))
S = eval(input())
sets = set(S)
ans = 0
for i in range(1, N):
cnt = 0
for s in sets:
l = 0
r = 0
for j in S[:i]:
if j == s:
l = 1
break
for j in S[i:N]:
if j == s:
r = 1
... | N = int(eval(input()))
S = list(eval(input()))
#%%
ans = 0
for i in range(1, N):
set1 = set()
set2 = set()
for s in S[:i]:
set1.add(s)
for s in S[i:]:
set2.add(s)
sets = set1 & set2
ans = max(ans, len(list(sets)))
print(ans)
| false | 8.695652 | [
"-S = eval(input())",
"-sets = set(S)",
"+S = list(eval(input()))",
"+#%%",
"- cnt = 0",
"- for s in sets:",
"- l = 0",
"- r = 0",
"- for j in S[:i]:",
"- if j == s:",
"- l = 1",
"- break",
"- for j in S[i:N]:",
"- ... | false | 0.067653 | 0.069616 | 0.971798 | [
"s735415599",
"s217698450"
] |
u046187684 | p03112 | python | s767784344 | s886644022 | 1,709 | 846 | 14,056 | 42,644 | Accepted | Accepted | 50.5 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10 ** 18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res = I... | from bisect import bisect_left
def solve(string):
a, b, q, *stx = list(map(int, string.split()))
s = [-10**10] + stx[:a] + [2 * 10**10]
t = [-10**10] + stx[a:a + b] + [2 * 10**10]
x = dict([])
i_s = 0
i_t = 0
for _x in sorted(set(stx[-q:])):
"""
while s[i_s] < _... | 14 | 32 | 489 | 968 | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
x = int(eval(input()))
b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
res = INF
fo... | from bisect import bisect_left
def solve(string):
a, b, q, *stx = list(map(int, string.split()))
s = [-(10**10)] + stx[:a] + [2 * 10**10]
t = [-(10**10)] + stx[a : a + b] + [2 * 10**10]
x = dict([])
i_s = 0
i_t = 0
for _x in sorted(set(stx[-q:])):
"""
while s[i_s] < _x:
... | false | 56.25 | [
"-import bisect",
"+from bisect import bisect_left",
"-A, B, Q = list(map(int, input().split()))",
"-INF = 10**18",
"-s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]",
"-t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]",
"-for q in range(Q):",
"- x = int(eval(input()))",
"-... | false | 0.078966 | 0.037727 | 2.09309 | [
"s767784344",
"s886644022"
] |
u337626942 | p03319 | python | s042067877 | s188823889 | 49 | 39 | 14,004 | 13,812 | Accepted | Accepted | 20.41 | n, k=list(map(int, input().split()))
a=list(map(int, input().split()))
cnt=k
ans=1
while cnt<n:
cnt+=k-1
ans+=1
print(ans) | import math
n, k=list(map(int, input().split()))
a=list(map(int, input().split()))
print((1+math.ceil((n-k)/(k-1)))) | 10 | 5 | 135 | 113 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = k
ans = 1
while cnt < n:
cnt += k - 1
ans += 1
print(ans)
| import math
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
print((1 + math.ceil((n - k) / (k - 1))))
| false | 50 | [
"+import math",
"+",
"-cnt = k",
"-ans = 1",
"-while cnt < n:",
"- cnt += k - 1",
"- ans += 1",
"-print(ans)",
"+print((1 + math.ceil((n - k) / (k - 1))))"
] | false | 0.044706 | 0.045892 | 0.974152 | [
"s042067877",
"s188823889"
] |
u197615397 | p02363 | python | s105664681 | s943930322 | 320 | 170 | 6,236 | 6,220 | Accepted | Accepted | 46.88 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, (_, c3) in [x for x in enumerate(zip(matrix[j], matrix[i])) if x[1][0] > c2+x[1][1]]:
matrix[j][k] = c2+c3
return matrix
... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, c1, c3 in zip(list(range(v_count)), matrix[j], matrix[i]):
if c1 > c2+c3:
matrix[j][k] = c2+c3
return mat... | 27 | 28 | 821 | 821 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, (_, c3) in [
x
for x in enumerate(zip(matrix[j], matrix[i]))
if x[1][0] > c2 + x[1][1]
]:
... | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, c1, c3 in zip(list(range(v_count)), matrix[j], matrix[i]):
if c1 > c2 + c3:
matrix[j][k] = c2 + c3
return matrix... | false | 3.571429 | [
"- for k, (_, c3) in [",
"- x",
"- for x in enumerate(zip(matrix[j], matrix[i]))",
"- if x[1][0] > c2 + x[1][1]",
"- ]:",
"- matrix[j][k] = c2 + c3",
"+ for k, c1, c3 in zip(list(range(v_count)), matrix[j], matr... | false | 0.054075 | 0.036176 | 1.494787 | [
"s105664681",
"s943930322"
] |
u425177436 | p03095 | python | s501839871 | s312902219 | 34 | 20 | 3,956 | 3,188 | Accepted | Accepted | 41.18 | eval(input())
s = list(eval(input()))
d = {chr(i):1 for i in range(97, 123)}
for c in s:
d[c] += 1
ans = 1
for i in list(d.values()):
ans *= i
print(((ans-1) % (10**9+7))) | eval(input())
s = eval(input())
ans = 1
for i in range(97, 123):
ans *= s.count(chr(i)) + 1
print(((ans-1) % (10**9+7))) | 9 | 6 | 167 | 115 | eval(input())
s = list(eval(input()))
d = {chr(i): 1 for i in range(97, 123)}
for c in s:
d[c] += 1
ans = 1
for i in list(d.values()):
ans *= i
print(((ans - 1) % (10**9 + 7)))
| eval(input())
s = eval(input())
ans = 1
for i in range(97, 123):
ans *= s.count(chr(i)) + 1
print(((ans - 1) % (10**9 + 7)))
| false | 33.333333 | [
"-s = list(eval(input()))",
"-d = {chr(i): 1 for i in range(97, 123)}",
"-for c in s:",
"- d[c] += 1",
"+s = eval(input())",
"-for i in list(d.values()):",
"- ans *= i",
"+for i in range(97, 123):",
"+ ans *= s.count(chr(i)) + 1"
] | false | 0.087732 | 0.037612 | 2.332551 | [
"s501839871",
"s312902219"
] |
u864197622 | p02736 | python | s721226170 | s175500537 | 33 | 25 | 6,748 | 6,112 | Accepted | Accepted | 24.24 | def popcount_parity(x):
x ^= x >> 1
x ^= x >> 2
x ^= x >> 4
x ^= x >> 8
x ^= x >> 16
x ^= x >> 32
x ^= x >> 64
x ^= x >> 128
x ^= x >> 256
x ^= x >> 512
x ^= x >> 1024
x ^= x >> 2048
x ^= x >> 4096
x ^= x >> 8192
x ^= x >> 16384
x ^= x >> 3... | def popcount_parity(x, a):
x ^= x >> 2
x ^= x >> 4
x ^= x >> 8
x ^= x >> 16
x ^= x >> 32
x ^= x >> 64
x ^= x >> 128
x ^= x >> 256
x ^= x >> 512
x ^= x >> 1024
x ^= x >> 2048
x ^= x >> 4096
x ^= x >> 8192
x ^= x >> 16384
x ^= x >> 32768
x ^=... | 37 | 37 | 753 | 687 | def popcount_parity(x):
x ^= x >> 1
x ^= x >> 2
x ^= x >> 4
x ^= x >> 8
x ^= x >> 16
x ^= x >> 32
x ^= x >> 64
x ^= x >> 128
x ^= x >> 256
x ^= x >> 512
x ^= x >> 1024
x ^= x >> 2048
x ^= x >> 4096
x ^= x >> 8192
x ^= x >> 16384
x ^= x >> 32768
x ^= x ... | def popcount_parity(x, a):
x ^= x >> 2
x ^= x >> 4
x ^= x >> 8
x ^= x >> 16
x ^= x >> 32
x ^= x >> 64
x ^= x >> 128
x ^= x >> 256
x ^= x >> 512
x ^= x >> 1024
x ^= x >> 2048
x ^= x >> 4096
x ^= x >> 8192
x ^= x >> 16384
x ^= x >> 32768
x ^= x >> 65536
... | false | 0 | [
"-def popcount_parity(x):",
"- x ^= x >> 1",
"+def popcount_parity(x, a):",
"- return x & 1",
"+ x ^= x >> 1048576",
"+ return x & a",
"-N = int(eval(input())) - 1",
"+N = int(eval(input())) - 1 << 1",
"- a = int(A.replace(\"1\", \"0\").replace(\"3\", \"0\").replace(\"2\", \"1\"), 2)"... | false | 0.035796 | 0.03747 | 0.955342 | [
"s721226170",
"s175500537"
] |
u714642969 | p03161 | python | s118446660 | s649791217 | 1,275 | 328 | 56,928 | 53,984 | Accepted | Accepted | 74.27 | import heapq
N,K=list(map(int,input().split()))
h=list(map(int,input().split()))
dp=[0]*N
for i in range(N):
he=[]
if i == 0:
dp[i] = 0
else:
for j in range(K):
heapq.heappush(he, dp[i-(j+1)]+abs(h[i]-h[i-(j+1)]) if i-(j+1) >= 0 else float('inf'))
dp[i] = hea... | import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()
def main():
N,K=list(map(int,input().split()))
h=list(map(int,input().split()))+[INF]*K
dp=[INF]*(2*10**5)
dp[0]=0
for i in range(N):
for k in range(1,K+1):
... | 14 | 18 | 345 | 424 | import heapq
N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [0] * N
for i in range(N):
he = []
if i == 0:
dp[i] = 0
else:
for j in range(K):
heapq.heappush(
he,
dp[i - (j + 1)] + abs(h[i] - h[i - (j + 1)])
... | import sys
sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
def input():
return sys.stdin.readline().rstrip()
def main():
N, K = list(map(int, input().split()))
h = list(map(int, input().split())) + [INF] * K
dp = [INF] * (2 * 10**5)
dp[0] = 0
for i in range(N):
for k in ra... | false | 22.222222 | [
"-import heapq",
"+import sys",
"-N, K = list(map(int, input().split()))",
"-h = list(map(int, input().split()))",
"-dp = [0] * N",
"-for i in range(N):",
"- he = []",
"- if i == 0:",
"- dp[i] = 0",
"- else:",
"- for j in range(K):",
"- heapq.heappush(",
"- ... | false | 0.142767 | 0.047577 | 3.000734 | [
"s118446660",
"s649791217"
] |
u935558307 | p02793 | python | s270179079 | s108576366 | 1,547 | 213 | 74,212 | 79,804 | Accepted | Accepted | 86.23 | """
最小公倍数LCMを求めて、LCMを各Aで除した商を合計すればよい
"""
from math import gcd
def lcm(a,b):
return a*b//gcd(a,b)
def main():
mod = 10**9 +7
N = int(eval(input()))
A = list(map(int,input().split()))
l = A[0]
for i in range(1,N):
l = lcm(l,A[i])
ans = 0
for a in A:
ans += ... | from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
memo = []
for i in range(N):
tmp = []
a = A[i]
d = 2
while d*d <= a:
while a%d == 0:
tmp.append(d)
a //= d
d += 1
if a!=1:
tmp.append(a)
memo.a... | 19 | 34 | 346 | 671 | """
最小公倍数LCMを求めて、LCMを各Aで除した商を合計すればよい
"""
from math import gcd
def lcm(a, b):
return a * b // gcd(a, b)
def main():
mod = 10**9 + 7
N = int(eval(input()))
A = list(map(int, input().split()))
l = A[0]
for i in range(1, N):
l = lcm(l, A[i])
ans = 0
for a in A:
ans += l /... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
memo = []
for i in range(N):
tmp = []
a = A[i]
d = 2
while d * d <= a:
while a % d == 0:
tmp.append(d)
a //= d
d += 1
if a != 1:
tmp.append(a)
memo.append(C... | false | 44.117647 | [
"-\"\"\"",
"-最小公倍数LCMを求めて、LCMを各Aで除した商を合計すればよい",
"-\"\"\"",
"-from math import gcd",
"+from collections import Counter",
"-",
"-def lcm(a, b):",
"- return a * b // gcd(a, b)",
"-",
"-",
"-def main():",
"- mod = 10**9 + 7",
"- N = int(eval(input()))",
"- A = list(map(int, input()... | false | 0.08569 | 0.038643 | 2.217486 | [
"s270179079",
"s108576366"
] |
u653485478 | p03807 | python | s139752098 | s601737955 | 54 | 43 | 14,112 | 14,108 | Accepted | Accepted | 20.37 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in a:
if i % 2 != 0:
count += 1
if count % 2 != 0:
print("NO")
else:
print("YES") | n = int(eval(input()))
a = list(map(int, input().split()))
if sum(a) % 2 == 0:
print("YES")
else:
print("NO") | 12 | 7 | 183 | 118 | n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
for i in a:
if i % 2 != 0:
count += 1
if count % 2 != 0:
print("NO")
else:
print("YES")
| n = int(eval(input()))
a = list(map(int, input().split()))
if sum(a) % 2 == 0:
print("YES")
else:
print("NO")
| false | 41.666667 | [
"-count = 0",
"-for i in a:",
"- if i % 2 != 0:",
"- count += 1",
"-if count % 2 != 0:",
"+if sum(a) % 2 == 0:",
"+ print(\"YES\")",
"+else:",
"-else:",
"- print(\"YES\")"
] | false | 0.046303 | 0.06399 | 0.723593 | [
"s139752098",
"s601737955"
] |
u579699847 | p03160 | python | s763509750 | s805606381 | 163 | 133 | 13,904 | 13,980 | Accepted | Accepted | 18.4 | def main(N, h):
dp = [2**31-1] * N
dp[0] = 0
for i in range(N):
if i+1 <= N-1:
dp[i+1] = min(dp[i+1], dp[i] + (abs(h[i+1] - h[i])))
if i+2 <= N-1:
dp[i+2] = min(dp[i+2], dp[i] + (abs(h[i+2] - h[i])))
return dp[-1]
N =int(eval(input()))
h = list(map(int... | def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
N = I()
h = LI()
dp = [float('INF')]*N
dp[0],dp[1] = 0,abs(h[1]-h[0])
for i in range(2,N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1])) | 13 | 9 | 351 | 256 | def main(N, h):
dp = [2**31 - 1] * N
dp[0] = 0
for i in range(N):
if i + 1 <= N - 1:
dp[i + 1] = min(dp[i + 1], dp[i] + (abs(h[i + 1] - h[i])))
if i + 2 <= N - 1:
dp[i + 2] = min(dp[i + 2], dp[i] + (abs(h[i + 2] - h[i])))
return dp[-1]
N = int(eval(input()))
h =... | def I():
return int(eval(input()))
def LI():
return list(map(int, input().split()))
N = I()
h = LI()
dp = [float("INF")] * N
dp[0], dp[1] = 0, abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 30.769231 | [
"-def main(N, h):",
"- dp = [2**31 - 1] * N",
"- dp[0] = 0",
"- for i in range(N):",
"- if i + 1 <= N - 1:",
"- dp[i + 1] = min(dp[i + 1], dp[i] + (abs(h[i + 1] - h[i])))",
"- if i + 2 <= N - 1:",
"- dp[i + 2] = min(dp[i + 2], dp[i] + (abs(h[i + 2] - h[i]))... | false | 0.045774 | 0.038778 | 1.180409 | [
"s763509750",
"s805606381"
] |
u565149926 | p03775 | python | s921263951 | s396932248 | 33 | 30 | 2,940 | 2,940 | Accepted | Accepted | 9.09 | import math
N = int(eval(input()))
ans = 10
for i in range(1, math.floor(math.sqrt(N))+1):
if N % i == 0:
ans = min(ans, len(str(max(N // i, i))))
print(ans)
| N = int(eval(input()))
ans = 10
for i in range(1, int(N ** 0.5) + 1):
if N % i == 0:
ans = min(ans, len(str(max(N // i, i))))
print(ans)
| 8 | 6 | 172 | 148 | import math
N = int(eval(input()))
ans = 10
for i in range(1, math.floor(math.sqrt(N)) + 1):
if N % i == 0:
ans = min(ans, len(str(max(N // i, i))))
print(ans)
| N = int(eval(input()))
ans = 10
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
ans = min(ans, len(str(max(N // i, i))))
print(ans)
| false | 25 | [
"-import math",
"-",
"-for i in range(1, math.floor(math.sqrt(N)) + 1):",
"+for i in range(1, int(N**0.5) + 1):"
] | false | 0.041425 | 0.096746 | 0.428188 | [
"s921263951",
"s396932248"
] |
u729133443 | p02735 | python | s780003727 | s394434007 | 29 | 25 | 3,188 | 3,188 | Accepted | Accepted | 13.79 | def main():
import sys
input=sys.stdin.buffer.readline
h,w=list(map(int,input().split()))
s=[c<46and 1or 0for _ in range(h)for c in input()[:w]]
dp=[10**9]*h*w
dp[0]=s[0]
for i in range(h*w):
j,k=i//w,i%w
for y,x in((j+1,k),(j,k+1)):
if y<h and x<w:
z=y*w+x
t=dp[i... | def main():
import sys
input=sys.stdin.buffer.readline
h,w=list(map(int,input().split()))
s=[c//8for _ in range(h)for c in input()[:w]]
dp=[10**9]*h*w
dp[0]=5-s[0]
for i in range(h):
for j in range(w):
k=i*w+j
if j+1<w:
t=dp[k]+(s[k]^s[k+1])
if dp[k+1]>t:dp[k+1]... | 16 | 18 | 385 | 426 | def main():
import sys
input = sys.stdin.buffer.readline
h, w = list(map(int, input().split()))
s = [c < 46 and 1 or 0 for _ in range(h) for c in input()[:w]]
dp = [10**9] * h * w
dp[0] = s[0]
for i in range(h * w):
j, k = i // w, i % w
for y, x in ((j + 1, k), (j, k + 1)):
... | def main():
import sys
input = sys.stdin.buffer.readline
h, w = list(map(int, input().split()))
s = [c // 8 for _ in range(h) for c in input()[:w]]
dp = [10**9] * h * w
dp[0] = 5 - s[0]
for i in range(h):
for j in range(w):
k = i * w + j
if j + 1 < w:
... | false | 11.111111 | [
"- s = [c < 46 and 1 or 0 for _ in range(h) for c in input()[:w]]",
"+ s = [c // 8 for _ in range(h) for c in input()[:w]]",
"- dp[0] = s[0]",
"- for i in range(h * w):",
"- j, k = i // w, i % w",
"- for y, x in ((j + 1, k), (j, k + 1)):",
"- if y < h and x < w:",
... | false | 0.091016 | 0.045321 | 2.008236 | [
"s780003727",
"s394434007"
] |
u794173881 | p03634 | python | s303802756 | s647927784 | 1,736 | 1,377 | 138,784 | 123,608 | Accepted | Accepted | 20.68 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
tree= [[] for i in range(n)]
for i in range(n-1):
a,b,c = list(map(int,input().split()))
a = a-1
b = b-1
tree[a].append([b,c])
tree[b].append([a,c])
q,k = list(map(int, input().split()))
k = k-1
depth=[0]*n
visited=[False f... | from collections import deque
class UnionFindWeighted:
"""ポテンシャル付きUnionFind"""
def __init__(self, n):
self.parent = [-1] * n
self.weight = [0] * n
self.cnt = n
self.INF = 10 ** 18
def root(self, x):
"""頂点xの根を求める"""
if self.parent[x] < 0:
... | 32 | 90 | 603 | 2,424 | import sys
sys.setrecursionlimit(1000000)
n = int(eval(input()))
tree = [[] for i in range(n)]
for i in range(n - 1):
a, b, c = list(map(int, input().split()))
a = a - 1
b = b - 1
tree[a].append([b, c])
tree[b].append([a, c])
q, k = list(map(int, input().split()))
k = k - 1
depth = [0] * n
visited ... | from collections import deque
class UnionFindWeighted:
"""ポテンシャル付きUnionFind"""
def __init__(self, n):
self.parent = [-1] * n
self.weight = [0] * n
self.cnt = n
self.INF = 10**18
def root(self, x):
"""頂点xの根を求める"""
if self.parent[x] < 0:
return x... | false | 64.444444 | [
"-import sys",
"-",
"-sys.setrecursionlimit(1000000)",
"-n = int(eval(input()))",
"-tree = [[] for i in range(n)]",
"-for i in range(n - 1):",
"- a, b, c = list(map(int, input().split()))",
"- a = a - 1",
"- b = b - 1",
"- tree[a].append([b, c])",
"- tree[b].append([a, c])",
"-q... | false | 0.116653 | 0.04299 | 2.713498 | [
"s303802756",
"s647927784"
] |
u562935282 | p03040 | python | s658947051 | s668029706 | 856 | 707 | 11,284 | 11,296 | Accepted | Accepted | 17.41 | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
# print(f'al:{al}, sl:{sl}')
# print(f'ar:{ar},sr:{sr}')
# print(f'b:{b}')
# print()
s = tuple(map(int, input(... | from heapq import heappush, heappushpop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
# print(f'al:{al}, sl:{sl}')
# print(f'ar:{ar},sr:{sr}')
# print(f'b:{b}')
# print()
s = tuple(map(int, in... | 49 | 43 | 1,202 | 1,101 | from heapq import heappush, heappop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
# print(f'al:{al}, sl:{sl}')
# print(f'ar:{ar},sr:{sr}')
# print(f'b:{b}')
# print()
s = tuple(map(int, input().split()))
if s... | from heapq import heappush, heappushpop
import sys
input = sys.stdin.readline
Q = int(eval(input()))
update_count = 0
al = []
sl = 0
ar = []
sr = 0
b = 0
for _ in range(Q):
# print(f'al:{al}, sl:{sl}')
# print(f'ar:{ar},sr:{sr}')
# print(f'b:{b}')
# print()
s = tuple(map(int, input().split()))
... | false | 12.244898 | [
"-from heapq import heappush, heappop",
"+from heapq import heappush, heappushpop",
"- if update_count % 2 == 0:",
"- # 左に追加",
"- heappush(ar, s[1]) # 右に追加",
"- sr += s[1]",
"- x = heappop(ar) # 右の最小値",
"- sr -= x",
"- heappu... | false | 0.038014 | 0.204835 | 0.185581 | [
"s658947051",
"s668029706"
] |
u318127926 | p02947 | python | s781127430 | s602624668 | 722 | 641 | 46,016 | 43,020 | Accepted | Accepted | 11.22 | from scipy.misc import comb
n = int(eval(input()))
dic = {}
for _ in range(n):
s = eval(input())
tmp = [0]*26
for i in s:
tmp[ord(i)-97] += 1
tmp = tuple(tmp)
if tmp in dic:
dic[tmp] += 1
else:
dic[tmp] = 1
total = 0
for i in list(dic.values()):
if i<2:
continue
total +=... | n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
di = {}
for i in s:
tmp = [0]*26
for c in i:
tmp[ord(c)-ord('a')] += 1
tmp = tuple(tmp)
if tmp in di:
di[tmp] += 1
else:
di[tmp] = 1
ans = 0
for i in list(di.values()):
ans += i... | 19 | 19 | 339 | 324 | from scipy.misc import comb
n = int(eval(input()))
dic = {}
for _ in range(n):
s = eval(input())
tmp = [0] * 26
for i in s:
tmp[ord(i) - 97] += 1
tmp = tuple(tmp)
if tmp in dic:
dic[tmp] += 1
else:
dic[tmp] = 1
total = 0
for i in list(dic.values()):
if i < 2:
... | n = int(eval(input()))
s = []
for _ in range(n):
s.append(eval(input()))
di = {}
for i in s:
tmp = [0] * 26
for c in i:
tmp[ord(c) - ord("a")] += 1
tmp = tuple(tmp)
if tmp in di:
di[tmp] += 1
else:
di[tmp] = 1
ans = 0
for i in list(di.values()):
ans += i * (i - 1) // ... | false | 0 | [
"-from scipy.misc import comb",
"-",
"-dic = {}",
"+s = []",
"- s = eval(input())",
"+ s.append(eval(input()))",
"+di = {}",
"+for i in s:",
"- for i in s:",
"- tmp[ord(i) - 97] += 1",
"+ for c in i:",
"+ tmp[ord(c) - ord(\"a\")] += 1",
"- if tmp in dic:",
"- ... | false | 0.257434 | 0.039093 | 6.585235 | [
"s781127430",
"s602624668"
] |
u102461423 | p02710 | python | s786754936 | s439881217 | 1,750 | 1,166 | 164,128 | 105,740 | Accepted | Accepted | 33.37 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict
N = int(readline())
C = (0,) + tuple(map(int, readline().split()))
m = map(int, read().split())
AB = zip(m, m)
graph = [[] for _ in range(N + 1)]
for a, b... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def EulerTour(graph, root=1):
N = len(graph) - 1
parent = [0] * (N + 1)
stack = [-root, root]
tour = []
ind_L = [0] * (N + 1)
ind_R = [0] * (N + 1)
i = -1
w... | 63 | 61 | 1,366 | 1,529 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict
N = int(readline())
C = (0,) + tuple(map(int, readline().split()))
m = map(int, read().split())
AB = zip(m, m)
graph = [[] for _ in range(N + 1)]
for a, b in AB:
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def EulerTour(graph, root=1):
N = len(graph) - 1
parent = [0] * (N + 1)
stack = [-root, root]
tour = []
ind_L = [0] * (N + 1)
ind_R = [0] * (N + 1)
i = -1
while stack:
... | false | 3.174603 | [
"-from collections import defaultdict",
"+",
"+",
"+def EulerTour(graph, root=1):",
"+ N = len(graph) - 1",
"+ parent = [0] * (N + 1)",
"+ stack = [-root, root]",
"+ tour = []",
"+ ind_L = [0] * (N + 1)",
"+ ind_R = [0] * (N + 1)",
"+ i = -1",
"+ while stack:",
"+ ... | false | 0.072088 | 0.045664 | 1.578647 | [
"s786754936",
"s439881217"
] |
u802963389 | p02733 | python | s109271135 | s006258002 | 1,569 | 533 | 3,316 | 55,260 | Accepted | Accepted | 66.03 | from itertools import combinations
h, w, k = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(h)]
ans = 10 ** 9
# Hが10なので横の割り方は決め打ち、縦は貪欲にKを見る。最小の数が答え。
for i in range(2 ** (h - 1)):
# 割った後の各かたまりの白チョコ数を入れる箱
box = [[0] * w]
# bcnt: 横に割ったかたまりの番地を数える数
bcnt = 0
b... | h, w, k = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(h)]
ans = 10 ** 9
# Hが10なので横の割り方は決め打ち、縦は貪欲にKを見る。最小の数が答え。
for i in range(2 ** (h - 1)):
# box: 割った後の各かたまりの白チョコ数を入れる箱
box = [[0] * w]
# bcnt: 横に割ったかたまりの番地を数える数
bcnt = 0
box[bcnt] = [s + b for s, b in z... | 37 | 39 | 902 | 977 | from itertools import combinations
h, w, k = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(h)]
ans = 10**9
# Hが10なので横の割り方は決め打ち、縦は貪欲にKを見る。最小の数が答え。
for i in range(2 ** (h - 1)):
# 割った後の各かたまりの白チョコ数を入れる箱
box = [[0] * w]
# bcnt: 横に割ったかたまりの番地を数える数
bcnt = 0
box[bc... | h, w, k = list(map(int, input().split()))
S = [list(map(int, list(eval(input())))) for _ in range(h)]
ans = 10**9
# Hが10なので横の割り方は決め打ち、縦は貪欲にKを見る。最小の数が答え。
for i in range(2 ** (h - 1)):
# box: 割った後の各かたまりの白チョコ数を入れる箱
box = [[0] * w]
# bcnt: 横に割ったかたまりの番地を数える数
bcnt = 0
box[bcnt] = [s + b for s, b in zip(S[... | false | 5.128205 | [
"-from itertools import combinations",
"-",
"- # 割った後の各かたまりの白チョコ数を入れる箱",
"+ # box: 割った後の各かたまりの白チョコ数を入れる箱",
"+ # cutcnt: 分割回数。最小値がansとなる。",
"+ # cnt: そのかたまりでのホワイトチョコの数を数える箱。毎回更新する。(直近分しか保持しない)",
"+ # 一つでもkを超えたら縦に割る。"
] | false | 0.061081 | 0.1316 | 0.464137 | [
"s109271135",
"s006258002"
] |
u440566786 | p03304 | python | s957664968 | s079227301 | 74 | 61 | 61,868 | 61,824 | Accepted | Accepted | 17.57 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n, m, d = list(map(int, input().split()))
ans = (m - 1) / n
if d > 0 and 2 * d + 1 <= n:
ans *= 1 + (n - 2 * d) / n
print(ans)
resolve() | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
n, m, d = list(map(int, input().split()))
if d == 0:
print(((m - 1) / n))
else:
print((2 * (m - 1) * (n - d) / (n * n)))
resolve() | 12 | 12 | 313 | 306 | import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, m, d = list(map(int, input().split()))
ans = (m - 1) / n
if d > 0 and 2 * d + 1 <= n:
ans *= 1 + (n - 2 * d) / n
print(ans)
resolve()
| import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.readline().rstrip()
def resolve():
n, m, d = list(map(int, input().split()))
if d == 0:
print(((m - 1) / n))
else:
print((2 * (m - 1) * (n - d) / (n * n)))
resolve()
| false | 0 | [
"- ans = (m - 1) / n",
"- if d > 0 and 2 * d + 1 <= n:",
"- ans *= 1 + (n - 2 * d) / n",
"- print(ans)",
"+ if d == 0:",
"+ print(((m - 1) / n))",
"+ else:",
"+ print((2 * (m - 1) * (n - d) / (n * n)))"
] | false | 0.007848 | 0.04089 | 0.19194 | [
"s957664968",
"s079227301"
] |
u707498674 | p02732 | python | s683698446 | s767008530 | 425 | 361 | 32,028 | 37,500 | Accepted | Accepted | 15.06 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
def fac2(n):
if n < 2:
return 0
ans = n * (n-1) // 2
return ans
d = {key:fac2(val) for key, val in list(c.items())}
sum_val = sum(d.values())
for a in A:
ans = sum_val - d[a]... | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {}
def fac2(n):
if n < 2:
return 0
ans = n * (n-1) // 2
return ans
for key, val in c.items():
d[key] = fac2(val)
d = {key:fac2(val) for key, val in c.items()}
sum_val = sum(... | 16 | 19 | 339 | 405 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter(A)
def fac2(n):
if n < 2:
return 0
ans = n * (n - 1) // 2
return ans
d = {key: fac2(val) for key, val in list(c.items())}
sum_val = sum(d.values())
for a in A:
ans = sum_val - d[a] + fac2(... | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
d = {}
def fac2(n):
if n < 2:
return 0
ans = n * (n - 1) // 2
return ans
for key, val in c.items():
d[key] = fac2(val)
d = {key: fac2(val) for key, val in c.items()}
sum_val = sum(d.values())... | false | 15.789474 | [
"-N = int(eval(input()))",
"+N = int(input())",
"+d = {}",
"-d = {key: fac2(val) for key, val in list(c.items())}",
"+for key, val in c.items():",
"+ d[key] = fac2(val)",
"+d = {key: fac2(val) for key, val in c.items()}",
"-for a in A:",
"- ans = sum_val - d[a] + fac2(c[a] - 1)",
"- print... | false | 0.065107 | 0.042432 | 1.534412 | [
"s683698446",
"s767008530"
] |
u921168761 | p02714 | python | s262861439 | s703123463 | 255 | 208 | 68,652 | 73,988 | Accepted | Accepted | 18.43 | n = int(eval(input()))
s = eval(input())
s = s.replace('R', '0')
s = s.replace('G', '1')
s = s.replace('B', '2')
s0 = [0] * (n + 5)
s1 = [0] * (n + 5)
s2 = [0] * (n + 5)
for i in range(n):
s0[i + 1] = s0[i] + (s[i] == '0')
s1[i + 1] = s1[i] + (s[i] == '1')
s2[i + 1] = s2[i] + (s[i] == '2')
... | n = int(eval(input()))
s = eval(input())
s = s.replace('R', '0')
s = s.replace('G', '1')
s = s.replace('B', '2')
t = [[0] * (n + 5) for _ in range(3)]
for i in range(n):
for j in range(3):
t[j][i + 1] = t[j][i] + (s[i] == chr(48 + j))
ans = 0
for i in range(n):
for j in range(i + 1, n)... | 35 | 20 | 879 | 500 | n = int(eval(input()))
s = eval(input())
s = s.replace("R", "0")
s = s.replace("G", "1")
s = s.replace("B", "2")
s0 = [0] * (n + 5)
s1 = [0] * (n + 5)
s2 = [0] * (n + 5)
for i in range(n):
s0[i + 1] = s0[i] + (s[i] == "0")
s1[i + 1] = s1[i] + (s[i] == "1")
s2[i + 1] = s2[i] + (s[i] == "2")
# print(s0)
# pri... | n = int(eval(input()))
s = eval(input())
s = s.replace("R", "0")
s = s.replace("G", "1")
s = s.replace("B", "2")
t = [[0] * (n + 5) for _ in range(3)]
for i in range(n):
for j in range(3):
t[j][i + 1] = t[j][i] + (s[i] == chr(48 + j))
ans = 0
for i in range(n):
for j in range(i + 1, n):
if s[i] ... | false | 42.857143 | [
"-s0 = [0] * (n + 5)",
"-s1 = [0] * (n + 5)",
"-s2 = [0] * (n + 5)",
"+t = [[0] * (n + 5) for _ in range(3)]",
"- s0[i + 1] = s0[i] + (s[i] == \"0\")",
"- s1[i + 1] = s1[i] + (s[i] == \"1\")",
"- s2[i + 1] = s2[i] + (s[i] == \"2\")",
"-# print(s0)",
"-# print(s1)",
"-# print(s2)",
"+ ... | false | 0.067447 | 0.046867 | 1.439106 | [
"s262861439",
"s703123463"
] |
u690536347 | p03148 | python | s687870858 | s779191729 | 961 | 481 | 88,792 | 30,100 | Accepted | Accepted | 49.95 | from collections import defaultdict as dd
from heapq import heappop, heappush
N, K = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x:-x[1])
used = set()
q1 = dd(list)
q2, q3 = [], []
score, kind = 0, 0
for t, d in l[:K]:
score += d
if... | from collections import defaultdict as dd
from heapq import heappop, heappush
N, K = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x:-x[1])
used = set()
q1 = dd(list)
q2, q3 = [], []
score, kind = 0, 0
for t, d in l[:K]:
score += d
if... | 36 | 34 | 718 | 692 | from collections import defaultdict as dd
from heapq import heappop, heappush
N, K = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x: -x[1])
used = set()
q1 = dd(list)
q2, q3 = [], []
score, kind = 0, 0
for t, d in l[:K]:
score += d
if t in used:
... | from collections import defaultdict as dd
from heapq import heappop, heappush
N, K = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for _ in range(N)]
l.sort(key=lambda x: -x[1])
used = set()
q1 = dd(list)
q2, q3 = [], []
score, kind = 0, 0
for t, d in l[:K]:
score += d
if t in used:
... | false | 5.555556 | [
"- d1 = heappop(q2)",
"- d2 = heappop(q3)",
"- score -= d1 + d2",
"+ score -= heappop(q2) + heappop(q3)"
] | false | 0.046222 | 0.049844 | 0.927321 | [
"s687870858",
"s779191729"
] |
u343251190 | p02379 | python | s848205162 | s093249216 | 50 | 20 | 7,640 | 7,636 | Accepted | Accepted | 60 | import math
x1, y1, x2, y2 = list(map(float, input().split()))
distance = math.sqrt((x1-x2)**2 + (y1-y2)**2)
print(distance) | import math
x1, y1, x2, y2 = list(map(float, input().split()))
distance = math.sqrt((x2-x1)**2 + (y2-y1)**2)
print(distance) | 4 | 4 | 121 | 121 | import math
x1, y1, x2, y2 = list(map(float, input().split()))
distance = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
print(distance)
| import math
x1, y1, x2, y2 = list(map(float, input().split()))
distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print(distance)
| false | 0 | [
"-distance = math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)",
"+distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)"
] | false | 0.035531 | 0.035121 | 1.011659 | [
"s848205162",
"s093249216"
] |
u729133443 | p02571 | python | s883591286 | s024627309 | 78 | 45 | 73,428 | 9,148 | Accepted | Accepted | 42.31 | s,t=open(0)
print((min(sum(x!=y for x,y in zip(s[i:],t[:-1]))for i in range(len(s)-len(t)+1)))) | s,(*t,_)=open(0)
print((min(sum(x!=y for x,y in zip(s[i:],t))for i in range(len(s)-len(t))))) | 2 | 2 | 94 | 92 | s, t = open(0)
print(
(
min(
sum(x != y for x, y in zip(s[i:], t[:-1]))
for i in range(len(s) - len(t) + 1)
)
)
)
| s, (*t, _) = open(0)
print((min(sum(x != y for x, y in zip(s[i:], t)) for i in range(len(s) - len(t)))))
| false | 0 | [
"-s, t = open(0)",
"-print(",
"- (",
"- min(",
"- sum(x != y for x, y in zip(s[i:], t[:-1]))",
"- for i in range(len(s) - len(t) + 1)",
"- )",
"- )",
"-)",
"+s, (*t, _) = open(0)",
"+print((min(sum(x != y for x, y in zip(s[i:], t)) for i in range(len(s) ... | false | 0.037869 | 0.037025 | 1.022799 | [
"s883591286",
"s024627309"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.