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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u968166680 | p03030 | python | s922774134 | s452260626 | 25 | 18 | 3,564 | 3,064 | Accepted | Accepted | 28 | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N = int(readline())
d = defaultdict(list)
for i in range(N):
s, p = readline().strip().split()
... | import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
def main():
N = int(readline())
A = [0] * N
for i in range(N):
s, p = readline().strip().split()
p = i... | 28 | 28 | 573 | 533 | import sys
from collections import defaultdict
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N = int(readline())
d = defaultdict(list)
for i in range(N):
s, p = readline().strip().split()
p = int(... | import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
def main():
N = int(readline())
A = [0] * N
for i in range(N):
s, p = readline().strip().split()
p = int(p)
A[i... | false | 0 | [
"-from collections import defaultdict",
"+from operator import itemgetter",
"- d = defaultdict(list)",
"+ A = [0] * N",
"- d[s].append((p, i + 1))",
"- for city, points in sorted(d.items()):",
"- points = sorted(points, reverse=True)",
"- for _, i in points:",
"- ... | false | 0.065272 | 0.034918 | 1.869302 | [
"s922774134",
"s452260626"
] |
u094191970 | p02780 | python | s964170611 | s015703899 | 238 | 199 | 25,060 | 26,364 | Accepted | Accepted | 16.39 | n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
x=[]
for i in p:
x.append((i+1)/2)
b=[0]
for i in range(1,n+1):
b.append(b[i-1]+x[i-1])
ans=0
for i in range(n-k+1):
ans=max(ans,b[i+k]-b[i])
print(ans) | from itertools import accumulate
n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
x=[]
for i in p:
x.append((i+1)/2)
b=[0]+list(accumulate(x))
'''
bb=[0]
for i in range(1,n+1):
bb.append(bb[i-1]+x[i-1])
print(b)
print(bb)
'''
ans=0
for i in range(n-k+1):
ans=max(ans,b[i... | 16 | 25 | 236 | 337 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
x = []
for i in p:
x.append((i + 1) / 2)
b = [0]
for i in range(1, n + 1):
b.append(b[i - 1] + x[i - 1])
ans = 0
for i in range(n - k + 1):
ans = max(ans, b[i + k] - b[i])
print(ans)
| from itertools import accumulate
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
x = []
for i in p:
x.append((i + 1) / 2)
b = [0] + list(accumulate(x))
"""
bb=[0]
for i in range(1,n+1):
bb.append(bb[i-1]+x[i-1])
print(b)
print(bb)
"""
ans = 0
for i in range(n - k + 1):
ans = max(ans... | false | 36 | [
"+from itertools import accumulate",
"+",
"-b = [0]",
"-for i in range(1, n + 1):",
"- b.append(b[i - 1] + x[i - 1])",
"+b = [0] + list(accumulate(x))",
"+\"\"\"",
"+bb=[0]",
"+for i in range(1,n+1):",
"+ bb.append(bb[i-1]+x[i-1])",
"+print(b)",
"+print(bb)",
"+\"\"\""
] | false | 0.083057 | 0.044729 | 1.856864 | [
"s964170611",
"s015703899"
] |
u562935282 | p03569 | python | s047042957 | s934430518 | 46 | 39 | 3,316 | 3,316 | Accepted | Accepted | 15.22 | def solve():
s = eval(input())
n = len(s)
left = 0
right = n - 1
ret = 0
while left < right:
if s[left] == s[right]:
left += 1
right -= 1
elif s[left] == 'x':
ret += 1
left += 1
elif s[right] == 'x':
... | def main():
s = eval(input())
l = 0
r = len(s) - 1
ret = 0
while l < r:
lc, rc = s[l], s[r]
if lc == rc:
l += 1
r -= 1
continue
if lc == 'x':
ret += 1
l += 1
continue
if r... | 24 | 33 | 427 | 487 | def solve():
s = eval(input())
n = len(s)
left = 0
right = n - 1
ret = 0
while left < right:
if s[left] == s[right]:
left += 1
right -= 1
elif s[left] == "x":
ret += 1
left += 1
elif s[right] == "x":
ret += 1
... | def main():
s = eval(input())
l = 0
r = len(s) - 1
ret = 0
while l < r:
lc, rc = s[l], s[r]
if lc == rc:
l += 1
r -= 1
continue
if lc == "x":
ret += 1
l += 1
continue
if rc == "x":
ret... | false | 27.272727 | [
"-def solve():",
"+def main():",
"- n = len(s)",
"- left = 0",
"- right = n - 1",
"+ l = 0",
"+ r = len(s) - 1",
"- while left < right:",
"- if s[left] == s[right]:",
"- left += 1",
"- right -= 1",
"- elif s[left] == \"x\":",
"+ while ... | false | 0.034102 | 0.039592 | 0.861323 | [
"s047042957",
"s934430518"
] |
u863370423 | p02771 | python | s960604990 | s623180330 | 180 | 17 | 38,256 | 3,060 | Accepted | Accepted | 90.56 | def main():
a, b, c = list(map(int, input().split()))
if (a == b and c != a) or (a == c and b != c) or (b == c and a != b):
print("Yes")
else:
print("No")
if __name__ == '__main__':
main() | n = list(map(int,input().split()))
n.sort()
a,b,c = n
flag = False
if a == b and c != a:
flag = True
elif a == c and b != c:
flag = True
elif b == c and a != b:
flag = True
print(("Yes" if flag else "No")) | 9 | 11 | 223 | 226 | def main():
a, b, c = list(map(int, input().split()))
if (a == b and c != a) or (a == c and b != c) or (b == c and a != b):
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| n = list(map(int, input().split()))
n.sort()
a, b, c = n
flag = False
if a == b and c != a:
flag = True
elif a == c and b != c:
flag = True
elif b == c and a != b:
flag = True
print(("Yes" if flag else "No"))
| false | 18.181818 | [
"-def main():",
"- a, b, c = list(map(int, input().split()))",
"- if (a == b and c != a) or (a == c and b != c) or (b == c and a != b):",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"-",
"-",
"-if __name__ == \"__main__\":",
"- main()",
"+n = list(map(int, input()... | false | 0.089466 | 0.083866 | 1.06677 | [
"s960604990",
"s623180330"
] |
u047796752 | p02708 | python | s899743085 | s291286032 | 66 | 56 | 68,064 | 65,000 | Accepted | Accepted | 15.15 | import sys
input = sys.stdin.readline
from collections import *
from math import *
N, K = list(map(int, input().split()))
MOD = 10**9+7
ans = 0
for i in range(K, N+2):
c = ((2*N-i+1)*i)//2-i*(i-1)//2+1
ans += c
ans %= MOD
print(ans) | def f(s, e):
return (e-s+1)*(s+e)//2
N, K = list(map(int, input().split()))
ans = 0
MOD = 10**9+7
for i in range(K, N+2):
ans += f(N-i+1, N)-f(0, i-1)+1
ans %= MOD
print(ans) | 15 | 12 | 255 | 194 | import sys
input = sys.stdin.readline
from collections import *
from math import *
N, K = list(map(int, input().split()))
MOD = 10**9 + 7
ans = 0
for i in range(K, N + 2):
c = ((2 * N - i + 1) * i) // 2 - i * (i - 1) // 2 + 1
ans += c
ans %= MOD
print(ans)
| def f(s, e):
return (e - s + 1) * (s + e) // 2
N, K = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
for i in range(K, N + 2):
ans += f(N - i + 1, N) - f(0, i - 1) + 1
ans %= MOD
print(ans)
| false | 20 | [
"-import sys",
"+def f(s, e):",
"+ return (e - s + 1) * (s + e) // 2",
"-input = sys.stdin.readline",
"-from collections import *",
"-from math import *",
"+ans = 0",
"-ans = 0",
"- c = ((2 * N - i + 1) * i) // 2 - i * (i - 1) // 2 + 1",
"- ans += c",
"+ ans += f(N - i + 1, N) - f(0,... | false | 0.137289 | 0.221426 | 0.620022 | [
"s899743085",
"s291286032"
] |
u009961299 | p02390 | python | s101298635 | s115676818 | 30 | 20 | 6,724 | 5,588 | Accepted | Accepted | 33.33 | a = int ( eval(input ( )) )
h = a // 3600
m = ( a // 60 ) % 60
d = a % 60
print(( "%s:%s:%s" % ( h, m, d ) )) | S = int(eval(input()))
h = S // 3600
m = (S // 60) % 60
s = S % 60
print(("%d:%d:%d" % (h, m, s)))
| 6 | 7 | 108 | 99 | a = int(eval(input()))
h = a // 3600
m = (a // 60) % 60
d = a % 60
print(("%s:%s:%s" % (h, m, d)))
| S = int(eval(input()))
h = S // 3600
m = (S // 60) % 60
s = S % 60
print(("%d:%d:%d" % (h, m, s)))
| false | 14.285714 | [
"-a = int(eval(input()))",
"-h = a // 3600",
"-m = (a // 60) % 60",
"-d = a % 60",
"-print((\"%s:%s:%s\" % (h, m, d)))",
"+S = int(eval(input()))",
"+h = S // 3600",
"+m = (S // 60) % 60",
"+s = S % 60",
"+print((\"%d:%d:%d\" % (h, m, s)))"
] | false | 0.049298 | 0.048774 | 1.010726 | [
"s101298635",
"s115676818"
] |
u627600101 | p02901 | python | s834532020 | s105721531 | 144 | 121 | 77,048 | 76,552 | Accepted | Accepted | 15.97 | N, M = list(map(int, input().split()))
newcount = [float('inf') for _ in range(2**N)]
newcount[0] = 0
for k in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
bit = 0
for k in range(b):
bit += 2**(c[k]-1)
count = tuple(newcount)
for k in range(2**N):
... | N, M = list(map(int, input().split()))
newcount = [100000000 for _ in range(2**N)]
newcount[0] = 0
bi = [1,2,4,8,16,32,64,128,256,512,1024,2048]
for k in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
bit = 0
for k in range(b):
bit += bi[c[k]-1]
count = tupl... | 20 | 18 | 456 | 482 | N, M = list(map(int, input().split()))
newcount = [float("inf") for _ in range(2**N)]
newcount[0] = 0
for k in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
bit = 0
for k in range(b):
bit += 2 ** (c[k] - 1)
count = tuple(newcount)
for k in range(2**... | N, M = list(map(int, input().split()))
newcount = [100000000 for _ in range(2**N)]
newcount[0] = 0
bi = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
for k in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
bit = 0
for k in range(b):
bit += bi[c[k] - 1]... | false | 10 | [
"-newcount = [float(\"inf\") for _ in range(2**N)]",
"+newcount = [100000000 for _ in range(2**N)]",
"+bi = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]",
"- bit += 2 ** (c[k] - 1)",
"+ bit += bi[c[k] - 1]",
"-count = newcount",
"-if count[-1] < 10**6:",
"- print((count[-1]))",... | false | 0.037392 | 0.035435 | 1.055224 | [
"s834532020",
"s105721531"
] |
u860002137 | p03425 | python | s369644103 | s148346659 | 178 | 162 | 3,316 | 22,992 | Accepted | Accepted | 8.99 | from itertools import combinations
from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
tmp = eval(input())
if tmp[0] in ["M", "A", "R", "C", "H"]:
d[tmp[0]] += 1
li = list(combinations(list(d.keys()), 3))
ans = 0
for a, b, c in li:
an... | from itertools import combinations
n = int(eval(input()))
arr = [eval(input()) for _ in range(n)]
li = ["M", "A", "R", "C", "H"]
result = []
for s in li:
result.append(len(set([x for x in arr if x[0] == s])))
ans = 0
for x, y, z in combinations(result, 3):
ans += x * y * z
print(ans) | 18 | 16 | 339 | 300 | from itertools import combinations
from collections import defaultdict
n = int(eval(input()))
d = defaultdict(int)
for _ in range(n):
tmp = eval(input())
if tmp[0] in ["M", "A", "R", "C", "H"]:
d[tmp[0]] += 1
li = list(combinations(list(d.keys()), 3))
ans = 0
for a, b, c in li:
ans += d[a] * d[b] *... | from itertools import combinations
n = int(eval(input()))
arr = [eval(input()) for _ in range(n)]
li = ["M", "A", "R", "C", "H"]
result = []
for s in li:
result.append(len(set([x for x in arr if x[0] == s])))
ans = 0
for x, y, z in combinations(result, 3):
ans += x * y * z
print(ans)
| false | 11.111111 | [
"-from collections import defaultdict",
"-d = defaultdict(int)",
"-for _ in range(n):",
"- tmp = eval(input())",
"- if tmp[0] in [\"M\", \"A\", \"R\", \"C\", \"H\"]:",
"- d[tmp[0]] += 1",
"-li = list(combinations(list(d.keys()), 3))",
"+arr = [eval(input()) for _ in range(n)]",
"+li = [... | false | 0.044631 | 0.046889 | 0.95185 | [
"s369644103",
"s148346659"
] |
u111365362 | p02862 | python | s650235809 | s606349123 | 1,541 | 407 | 3,064 | 40,812 | Accepted | Accepted | 73.59 | x,y = list(map(int,input().split()))
if (x+y) % 3 != 0:
print((0))
elif x < 0 or y < 0:
print((0))
elif x/y > 2 or y/x > 2:
print((0))
else:
n = (x+y) // 3
m = x - n
mod = 10**9 + 7
def inv(x):
y = 1
while x != 1:
y *= mod//x + 1
y %= mod
x -= mod%x
return y
... | #17:23
x,y = list(map(int,input().split()))
if (x+y) % 3 != 0:
print((0))
elif x*2 < y or y*2 < x:
print((0))
else:
a = (x + y) // 3
b = y - a
mod = 10 ** 9 + 7
def inv(x):
y = 1
while x != 1:
y *= mod // x + 1
y %= mod
x -= mod % x
return y
ans = 1
for i ... | 27 | 24 | 458 | 407 | x, y = list(map(int, input().split()))
if (x + y) % 3 != 0:
print((0))
elif x < 0 or y < 0:
print((0))
elif x / y > 2 or y / x > 2:
print((0))
else:
n = (x + y) // 3
m = x - n
mod = 10**9 + 7
def inv(x):
y = 1
while x != 1:
y *= mod // x + 1
y %= mod
... | # 17:23
x, y = list(map(int, input().split()))
if (x + y) % 3 != 0:
print((0))
elif x * 2 < y or y * 2 < x:
print((0))
else:
a = (x + y) // 3
b = y - a
mod = 10**9 + 7
def inv(x):
y = 1
while x != 1:
y *= mod // x + 1
y %= mod
x -= mod % x
... | false | 11.111111 | [
"+# 17:23",
"-elif x < 0 or y < 0:",
"- print((0))",
"-elif x / y > 2 or y / x > 2:",
"+elif x * 2 < y or y * 2 < x:",
"- n = (x + y) // 3",
"- m = x - n",
"+ a = (x + y) // 3",
"+ b = y - a",
"- # print(inv(5))",
"- for i in range(m):",
"- ans *= n - i",
"+ fo... | false | 0.967094 | 1.142115 | 0.846757 | [
"s650235809",
"s606349123"
] |
u493491792 | p02935 | python | s119085559 | s752350518 | 313 | 18 | 24,048 | 3,060 | Accepted | Accepted | 94.25 | import numpy as np
n=int(eval(input()))
lista=list(map(int,input().split()))
lista.sort()
for i in range(n-1):
lista.append((lista[0]+lista[1])/2)
lista.pop(0)
lista.pop(0)
lista.sort()
print((lista[0])) | n=int(eval(input()))
lista=list(map(int,input().split()))
lista.sort()
for i in range(n-1):
lista.append((lista[0]+lista[1])/2)
lista.pop(0)
lista.pop(0)
lista.sort()
print((lista[0])) | 12 | 11 | 228 | 209 | import numpy as np
n = int(eval(input()))
lista = list(map(int, input().split()))
lista.sort()
for i in range(n - 1):
lista.append((lista[0] + lista[1]) / 2)
lista.pop(0)
lista.pop(0)
lista.sort()
print((lista[0]))
| n = int(eval(input()))
lista = list(map(int, input().split()))
lista.sort()
for i in range(n - 1):
lista.append((lista[0] + lista[1]) / 2)
lista.pop(0)
lista.pop(0)
lista.sort()
print((lista[0]))
| false | 8.333333 | [
"-import numpy as np",
"-"
] | false | 0.073526 | 0.035768 | 2.055645 | [
"s119085559",
"s752350518"
] |
u241159583 | p02784 | python | s664432204 | s023852140 | 89 | 43 | 13,964 | 13,836 | Accepted | Accepted | 51.69 | H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
for i in range(N):
H -= A[i]
print(("Yes" if H <= 0 else "No")) | H, N = list(map(int, input().split()))
A = [int(x) for x in input().split()]
print(("Yes" if H <= sum(A) else "No")) | 6 | 4 | 158 | 112 | H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
for i in range(N):
H -= A[i]
print(("Yes" if H <= 0 else "No"))
| H, N = list(map(int, input().split()))
A = [int(x) for x in input().split()]
print(("Yes" if H <= sum(A) else "No"))
| false | 33.333333 | [
"-A = list(map(int, input().split()))",
"-A.sort(reverse=True)",
"-for i in range(N):",
"- H -= A[i]",
"-print((\"Yes\" if H <= 0 else \"No\"))",
"+A = [int(x) for x in input().split()]",
"+print((\"Yes\" if H <= sum(A) else \"No\"))"
] | false | 0.040208 | 0.039172 | 1.026457 | [
"s664432204",
"s023852140"
] |
u830054172 | p03353 | python | s708693232 | s153953253 | 52 | 29 | 5,084 | 4,444 | Accepted | Accepted | 44.23 | s = eval(input())
l = int(eval(input()))
char = []
if len(s) == 1:
print(s)
else:
for i in range(len(s)):
char.append(s[i])
charset = set(char)
ans = []
for i in charset:
for j in range(len(s)):
if i == s[j]:
for k in range(1, 6):
... | s = eval(input())
l = int(eval(input()))
char = []
if len(s) == 1:
print(s)
else:
for i in range(len(s)):
char.append(s[i])
charset = sorted(list(set(char)))
ans = []
for i in charset:
if len(set(ans)) > 5:
break
for j in range(len(s)):
i... | 17 | 19 | 398 | 462 | s = eval(input())
l = int(eval(input()))
char = []
if len(s) == 1:
print(s)
else:
for i in range(len(s)):
char.append(s[i])
charset = set(char)
ans = []
for i in charset:
for j in range(len(s)):
if i == s[j]:
for k in range(1, 6):
ans.a... | s = eval(input())
l = int(eval(input()))
char = []
if len(s) == 1:
print(s)
else:
for i in range(len(s)):
char.append(s[i])
charset = sorted(list(set(char)))
ans = []
for i in charset:
if len(set(ans)) > 5:
break
for j in range(len(s)):
if i == s[j]:
... | false | 10.526316 | [
"- charset = set(char)",
"+ charset = sorted(list(set(char)))",
"+ if len(set(ans)) > 5:",
"+ break"
] | false | 0.121185 | 0.082486 | 1.469152 | [
"s708693232",
"s153953253"
] |
u962423738 | p03387 | python | s377351279 | s395998590 | 31 | 26 | 9,248 | 9,200 | Accepted | Accepted | 16.13 | a=list(map(int,input().split()))
a=sorted(a)
cnt=0
if a[0]==a[1] and a[1]==a[2]:
print((0))
elif a[0]==a[1]:
while True:
a[0]+=1
a[1]+=1
cnt+=1
if a[0]==a[2]:
print(cnt)
break
elif a[1]==a[2]:
while True:
a[0]+=2
cnt+=1
if a[0]==a[2]:
print(cnt)
break
elif a[0]>a[2]:
... | a=list(map(int,input().split()))
a.sort()
b=a[2]-a[1]
c=a[2]-a[0]
if (b+c)%2==0:
print(((b+c)//2))
else:
print((((b+c)//2)+2)) | 39 | 8 | 548 | 131 | a = list(map(int, input().split()))
a = sorted(a)
cnt = 0
if a[0] == a[1] and a[1] == a[2]:
print((0))
elif a[0] == a[1]:
while True:
a[0] += 1
a[1] += 1
cnt += 1
if a[0] == a[2]:
print(cnt)
break
elif a[1] == a[2]:
while True:
a[0] += 2
... | a = list(map(int, input().split()))
a.sort()
b = a[2] - a[1]
c = a[2] - a[0]
if (b + c) % 2 == 0:
print(((b + c) // 2))
else:
print((((b + c) // 2) + 2))
| false | 79.487179 | [
"-a = sorted(a)",
"-cnt = 0",
"-if a[0] == a[1] and a[1] == a[2]:",
"- print((0))",
"-elif a[0] == a[1]:",
"- while True:",
"- a[0] += 1",
"- a[1] += 1",
"- cnt += 1",
"- if a[0] == a[2]:",
"- print(cnt)",
"- break",
"-elif a[1] == a[2]... | false | 0.04185 | 0.04248 | 0.985164 | [
"s377351279",
"s395998590"
] |
u821588465 | p02861 | python | s343917001 | s564291266 | 126 | 25 | 27,136 | 9,020 | Accepted | Accepted | 80.16 | import numpy as np
from itertools import combinations
from itertools import permutations
from math import factorial
N = int(eval(input()))
xy = np.array([list(map(int, input().split())) for _ in range(N)])
cnt = 0
for i in xy:
for j in xy:
cnt += np.linalg.norm(i - j)
print((cnt / N)) | N = int(eval(input()))
D = [list(map(int, input().split())) for _ in range(N)]
from math import hypot, factorial
distance = []
for i, j in D:
for k, l in D:
distance.append(hypot(i-k, j-l))
print((sum(distance)/N))
| 14 | 11 | 305 | 232 | import numpy as np
from itertools import combinations
from itertools import permutations
from math import factorial
N = int(eval(input()))
xy = np.array([list(map(int, input().split())) for _ in range(N)])
cnt = 0
for i in xy:
for j in xy:
cnt += np.linalg.norm(i - j)
print((cnt / N))
| N = int(eval(input()))
D = [list(map(int, input().split())) for _ in range(N)]
from math import hypot, factorial
distance = []
for i, j in D:
for k, l in D:
distance.append(hypot(i - k, j - l))
print((sum(distance) / N))
| false | 21.428571 | [
"-import numpy as np",
"-from itertools import combinations",
"-from itertools import permutations",
"-from math import factorial",
"+N = int(eval(input()))",
"+D = [list(map(int, input().split())) for _ in range(N)]",
"+from math import hypot, factorial",
"-N = int(eval(input()))",
"-xy = np.array(... | false | 0.439217 | 0.056053 | 7.835763 | [
"s343917001",
"s564291266"
] |
u633068244 | p00129 | python | s345546294 | s799913946 | 40 | 30 | 4,400 | 4,400 | Accepted | Accepted | 25 | def inWall(x,y,x1,y1,r):
return True if ((x-x1)**2+(y-y1)**2)**0.5 <= r + 1e-9 else False
def isHide(x,y,r,a,b,c):
D = abs(a*x+b*y+c)/(a**2+b**2)**0.5
return True if D <= r + 1e-9 else False
def isBetween(x,y,tx,ty,sx,sy):
a,b,c = (x-tx)**2+(y-ty)**2,(x-sx)**2+(y-sy)**2,(sx-tx)**2+(sy-ty)**2
if c > b an... | def inWall(x,y,x1,y1,r):
return True if ((x-x1)**2+(y-y1)**2)**0.5 <= r + 1e-9 else False
def isHide(x,y,r,a,b,c):
D = abs(a*x+b*y+c)/(a**2+b**2)**0.5
return True if D <= r + 1e-9 else False
def isBetween(x,y,tx,ty,sx,sy):
a,b,c = (x-tx)**2+(y-ty)**2,(x-sx)**2+(y-sy)**2,(sx-tx)**2+(sy-ty)**2
if c > b an... | 27 | 27 | 844 | 844 | def inWall(x, y, x1, y1, r):
return True if ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5 <= r + 1e-9 else False
def isHide(x, y, r, a, b, c):
D = abs(a * x + b * y + c) / (a**2 + b**2) ** 0.5
return True if D <= r + 1e-9 else False
def isBetween(x, y, tx, ty, sx, sy):
a, b, c = (
(x - tx) ** 2 + (... | def inWall(x, y, x1, y1, r):
return True if ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5 <= r + 1e-9 else False
def isHide(x, y, r, a, b, c):
D = abs(a * x + b * y + c) / (a**2 + b**2) ** 0.5
return True if D <= r + 1e-9 else False
def isBetween(x, y, tx, ty, sx, sy):
a, b, c = (
(x - tx) ** 2 + (... | false | 0 | [
"+ and isHide(x, y, r, a, b, c)",
"- and isHide(x, y, r, a, b, c)"
] | false | 0.008337 | 0.123042 | 0.067758 | [
"s345546294",
"s799913946"
] |
u235210692 | p02695 | python | s502173360 | s494164556 | 1,119 | 286 | 21,724 | 93,892 | Accepted | Accepted | 74.44 | n,m,q=[int(i) for i in input().split()]
abcd=[]
import itertools
A=itertools.combinations_with_replacement(list(range(1,m+1)),n)
A=list(A)
for i in range(q):
abcd.append([int(i) for i in input().split()])
ans=0
for listA in A:
count=0
for kumi in abcd:
a,b,c,d=kumi
... | def return_d(A,abcds):
sum_d=0
for abcd in abcds:
a,b,c,d=abcd
if A[b]-A[a]==c:
sum_d+=d
return sum_d
n,m,q=[int(i) for i in input().split()]
abcds=[[int(i) for i in input().split()] for j in range(q)]
As=[]
for i_1 in range(1,m+1):
for i_2 in range(i_1, m + ... | 22 | 31 | 407 | 920 | n, m, q = [int(i) for i in input().split()]
abcd = []
import itertools
A = itertools.combinations_with_replacement(list(range(1, m + 1)), n)
A = list(A)
for i in range(q):
abcd.append([int(i) for i in input().split()])
ans = 0
for listA in A:
count = 0
for kumi in abcd:
a, b, c, d = kumi
if... | def return_d(A, abcds):
sum_d = 0
for abcd in abcds:
a, b, c, d = abcd
if A[b] - A[a] == c:
sum_d += d
return sum_d
n, m, q = [int(i) for i in input().split()]
abcds = [[int(i) for i in input().split()] for j in range(q)]
As = []
for i_1 in range(1, m + 1):
for i_2 in range... | false | 29.032258 | [
"+def return_d(A, abcds):",
"+ sum_d = 0",
"+ for abcd in abcds:",
"+ a, b, c, d = abcd",
"+ if A[b] - A[a] == c:",
"+ sum_d += d",
"+ return sum_d",
"+",
"+",
"-abcd = []",
"-import itertools",
"-",
"-A = itertools.combinations_with_replacement(list(range(1... | false | 0.180335 | 0.184119 | 0.979452 | [
"s502173360",
"s494164556"
] |
u604839890 | p02622 | python | s723518358 | s594800228 | 70 | 58 | 73,748 | 9,460 | Accepted | Accepted | 17.14 | s, t = [eval(input()) for i in range(2)]
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans) | s = eval(input())
t = eval(input())
cnt = 0
for i, j in zip(s, t):
if i != j:
cnt += 1
print(cnt) | 6 | 8 | 114 | 105 | s, t = [eval(input()) for i in range(2)]
ans = 0
for i in range(len(s)):
if s[i] != t[i]:
ans += 1
print(ans)
| s = eval(input())
t = eval(input())
cnt = 0
for i, j in zip(s, t):
if i != j:
cnt += 1
print(cnt)
| false | 25 | [
"-s, t = [eval(input()) for i in range(2)]",
"-ans = 0",
"-for i in range(len(s)):",
"- if s[i] != t[i]:",
"- ans += 1",
"-print(ans)",
"+s = eval(input())",
"+t = eval(input())",
"+cnt = 0",
"+for i, j in zip(s, t):",
"+ if i != j:",
"+ cnt += 1",
"+print(cnt)"
] | false | 0.041909 | 0.040297 | 1.040014 | [
"s723518358",
"s594800228"
] |
u903005414 | p03476 | python | s439256539 | s669902305 | 1,885 | 976 | 46,784 | 38,160 | Accepted | Accepted | 48.22 | import numpy as np
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
is_prime = np.zeros(10**5 + 1, dtype='bool')
for i in range(2, 10**5 + 1):
if not is_prime[i]:
for j in range(2, int(np.sqrt(i) + 1)):
if i % j == 0:
break
else:
... | import numpy as np
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
U = 10**5 * 1
is_prime = np.ones(U, dtype='bool')
is_prime[0:2] = False
for i in range(2, U):
if i * i > 10**5:
break
if is_prime[i]:
is_prime[i * 2::i] = False
like_2017 = np.zeros(... | 25 | 23 | 698 | 556 | import numpy as np
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
is_prime = np.zeros(10**5 + 1, dtype="bool")
for i in range(2, 10**5 + 1):
if not is_prime[i]:
for j in range(2, int(np.sqrt(i) + 1)):
if i % j == 0:
break
else:
... | import numpy as np
Q = int(eval(input()))
lr = [list(map(int, input().split())) for _ in range(Q)]
U = 10**5 * 1
is_prime = np.ones(U, dtype="bool")
is_prime[0:2] = False
for i in range(2, U):
if i * i > 10**5:
break
if is_prime[i]:
is_prime[i * 2 :: i] = False
like_2017 = np.zeros(U, dtype="bo... | false | 8 | [
"-is_prime = np.zeros(10**5 + 1, dtype=\"bool\")",
"-for i in range(2, 10**5 + 1):",
"- if not is_prime[i]:",
"- for j in range(2, int(np.sqrt(i) + 1)):",
"- if i % j == 0:",
"- break",
"- else:",
"- is_prime[i] = True",
"- # is_prime[... | false | 2.096595 | 0.821475 | 2.552232 | [
"s439256539",
"s669902305"
] |
u102461423 | p02936 | python | s654446618 | s310203597 | 1,665 | 1,299 | 285,828 | 124,240 | Accepted | Accepted | 21.98 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
# 遅延評価で加えてあげるだけ
N,Q = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
graph = [[] for _ in range(N+1)]
for a,b in AB:
graph[a].ap... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
# 遅延評価で加えてあげるだけ
N,Q = list(map(int,input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
graph = [[] for _ in range(N+1)]
for a,b in AB:
graph[a].ap... | 30 | 30 | 618 | 640 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
# 遅延評価で加えてあげるだけ
N, Q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N - 1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
# 遅延評価で加えてあげるだけ
N, Q = list(map(int, input().split()))
AB = [[int(x) for x in input().split()] for _ in range(N - 1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
graph = [[] for _ in range(N + 1)]
for a, b in AB:
graph[a].append(b)
... | false | 0 | [
"-",
"-",
"-def dfs(v, parent, add):",
"- value[v] += add",
"- for x in graph[v]:",
"- if x == parent:",
"+q = [(1, 0)]",
"+while q:",
"+ x, parent = q.pop()",
"+ value[x] += value[parent]",
"+ for y in graph[x]:",
"+ if y == parent:",
"- dfs(x, v, value[v... | false | 0.038518 | 0.03854 | 0.999428 | [
"s654446618",
"s310203597"
] |
u994521204 | p03212 | python | s262309084 | s467834799 | 120 | 18 | 6,756 | 3,064 | Accepted | Accepted | 85 | from itertools import product
n=int(eval(input()))
cnt=0
kazu=[3,5,7]
for j in range(3,10):
kumiawase = list(product(kazu, repeat=j))
for kumi in kumiawase:
suuji=''
for moji in kumi:
suuji+=str(moji)
if '3' not in suuji:
continue
if '5' not ... | #桁DP
s = eval(input())
n = int(s)
keta = len(s)
# dp[i][j][k][l][smaller][other]
dp = [
[[[[0] * 2 for _ in range(2)] for _ in range(2)] for _ in range(2)]
for _ in range(keta + 1)
]
dp[0][0][0][0][0] = 1
kazu = [0, 3, 5, 7]
for i in range(keta):
for j in range(2):
for k in range(2):
... | 20 | 41 | 481 | 1,408 | from itertools import product
n = int(eval(input()))
cnt = 0
kazu = [3, 5, 7]
for j in range(3, 10):
kumiawase = list(product(kazu, repeat=j))
for kumi in kumiawase:
suuji = ""
for moji in kumi:
suuji += str(moji)
if "3" not in suuji:
continue
if "5" not ... | # 桁DP
s = eval(input())
n = int(s)
keta = len(s)
# dp[i][j][k][l][smaller][other]
dp = [
[[[[0] * 2 for _ in range(2)] for _ in range(2)] for _ in range(2)]
for _ in range(keta + 1)
]
dp[0][0][0][0][0] = 1
kazu = [0, 3, 5, 7]
for i in range(keta):
for j in range(2):
for k in range(2):
fo... | false | 51.219512 | [
"-from itertools import product",
"-",
"-n = int(eval(input()))",
"-cnt = 0",
"-kazu = [3, 5, 7]",
"-for j in range(3, 10):",
"- kumiawase = list(product(kazu, repeat=j))",
"- for kumi in kumiawase:",
"- suuji = \"\"",
"- for moji in kumi:",
"- suuji += str(moji)",... | false | 0.771052 | 0.063602 | 12.123069 | [
"s262309084",
"s467834799"
] |
u645250356 | p02901 | python | s076243996 | s977682351 | 694 | 378 | 192,108 | 70,228 | Accepted | Accepted | 45.53 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.rea... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin... | 26 | 27 | 766 | 692 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
mod2 = 998244353
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(in... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map... | false | 3.703704 | [
"-import sys, bisect, math, itertools, fractions, pprint",
"+import sys, bisect, math, itertools, fractions",
"+from decimal import Decimal",
"-mod2 = 998244353",
"-def inpln(n):",
"- return list(int(sys.stdin.readline()) for i in range(n))",
"-",
"-",
"-dp = [[INF] * (2**n) for i in range(m + 5)... | false | 0.080272 | 0.046965 | 1.709193 | [
"s076243996",
"s977682351"
] |
u887207211 | p03774 | python | s907592395 | s130357577 | 20 | 18 | 3,064 | 3,064 | Accepted | Accepted | 10 | N, M = list(map(int,input().split()))
S = [list(map(int,input().split())) for _ in range(N)]
P = [list(map(int,input().split())) for _ in range(M)]
result = []
for s in S:
a = s[0]
b = s[1]
for p in P:
c = p[0]
d = p[1]
direct = abs(a-c)+abs(b-d)
result.append(direct)
point = min(r... | N, M = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(N)]
CD = [list(map(int,input().split())) for _ in range(M)]
result = []
for a, b in AB:
tmp = []
for c, d in CD:
tmp.append(abs(a-c) + abs(b-d))
result.append(tmp.index(min(tmp))+1)
for r in result:
print(r... | 16 | 12 | 369 | 315 | N, M = list(map(int, input().split()))
S = [list(map(int, input().split())) for _ in range(N)]
P = [list(map(int, input().split())) for _ in range(M)]
result = []
for s in S:
a = s[0]
b = s[1]
for p in P:
c = p[0]
d = p[1]
direct = abs(a - c) + abs(b - d)
result.append(direct... | N, M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(N)]
CD = [list(map(int, input().split())) for _ in range(M)]
result = []
for a, b in AB:
tmp = []
for c, d in CD:
tmp.append(abs(a - c) + abs(b - d))
result.append(tmp.index(min(tmp)) + 1)
for r in result:
... | false | 25 | [
"-S = [list(map(int, input().split())) for _ in range(N)]",
"-P = [list(map(int, input().split())) for _ in range(M)]",
"+AB = [list(map(int, input().split())) for _ in range(N)]",
"+CD = [list(map(int, input().split())) for _ in range(M)]",
"-for s in S:",
"- a = s[0]",
"- b = s[1]",
"- for ... | false | 0.035616 | 0.032721 | 1.088493 | [
"s907592395",
"s130357577"
] |
u137228327 | p03556 | python | s866055598 | s971647338 | 46 | 28 | 9,096 | 9,312 | Accepted | Accepted | 39.13 | import math
N = int(eval(input()))
mx = 0
for i in range(math.ceil(math.sqrt(N))+1):
if i**2 <= N and i**2 >= mx:
mx = i**2
print(mx) |
N = int(eval(input()))
sq = (int(N**(1/2))**2)
print(sq) | 8 | 4 | 155 | 54 | import math
N = int(eval(input()))
mx = 0
for i in range(math.ceil(math.sqrt(N)) + 1):
if i**2 <= N and i**2 >= mx:
mx = i**2
print(mx)
| N = int(eval(input()))
sq = int(N ** (1 / 2)) ** 2
print(sq)
| false | 50 | [
"-import math",
"-",
"-mx = 0",
"-for i in range(math.ceil(math.sqrt(N)) + 1):",
"- if i**2 <= N and i**2 >= mx:",
"- mx = i**2",
"-print(mx)",
"+sq = int(N ** (1 / 2)) ** 2",
"+print(sq)"
] | false | 0.098861 | 0.038091 | 2.595377 | [
"s866055598",
"s971647338"
] |
u604774382 | p02255 | python | s875656668 | s581921668 | 30 | 20 | 6,724 | 4,224 | Accepted | Accepted | 33.33 | def trace( nums ):
output = []
for num in nums:
output.append( str( num ) )
output.append( " " )
output.pop( )
print(( "".join( output ) ))
n = int( eval(input( )) )
nums = [ int( val ) for val in input( ).split( " " ) ]
trace( nums )
for i in range( 1, len( nums ) ):
key = nums[i]
j = i - 1
... | n = int( input( ) )
nums = [ int( val ) for val in input( ).split( " " ) ]
print(( " ".join( map( str, nums ) ) ))
for i in range( 1, len( nums ) ):
key = nums[i]
j = i - 1
while 0 <= j and key < nums[j]:
nums[ j+1 ] = nums[j]
j -= 1
nums[ j+1 ] = key
print(( " ".join( map( str, nums ) ) )) | 20 | 12 | 416 | 316 | def trace(nums):
output = []
for num in nums:
output.append(str(num))
output.append(" ")
output.pop()
print(("".join(output)))
n = int(eval(input()))
nums = [int(val) for val in input().split(" ")]
trace(nums)
for i in range(1, len(nums)):
key = nums[i]
j = i - 1
while 0 <=... | n = int(input())
nums = [int(val) for val in input().split(" ")]
print((" ".join(map(str, nums))))
for i in range(1, len(nums)):
key = nums[i]
j = i - 1
while 0 <= j and key < nums[j]:
nums[j + 1] = nums[j]
j -= 1
nums[j + 1] = key
print((" ".join(map(str, nums))))
| false | 40 | [
"-def trace(nums):",
"- output = []",
"- for num in nums:",
"- output.append(str(num))",
"- output.append(\" \")",
"- output.pop()",
"- print((\"\".join(output)))",
"-",
"-",
"-n = int(eval(input()))",
"+n = int(input())",
"-trace(nums)",
"+print((\" \".join(map(str... | false | 0.162146 | 0.056541 | 2.867771 | [
"s875656668",
"s581921668"
] |
u451012573 | p03805 | python | s015188324 | s995886331 | 31 | 25 | 3,064 | 3,064 | Accepted | Accepted | 19.35 | N, M = list(map(int, input().split()))
g = {}
n_path = 0
for i in range(N):
g[i] = []
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].append(b)
g[b].append(a)
def advance(v, passed):
global n_path
passed.append(v)
if len(passed) == N:
... | N, M = list(map(int, input().split()))
g = {}
n_path = 0
for i in range(N):
g[i] = set()
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a].add(b)
g[b].add(a)
dp = [[0 for _ in range(N)] for _ in range(1 << N)]
dp[1][0] = 1
for bit in range(1 << N):
... | 29 | 28 | 470 | 565 | N, M = list(map(int, input().split()))
g = {}
n_path = 0
for i in range(N):
g[i] = []
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].append(b)
g[b].append(a)
def advance(v, passed):
global n_path
passed.append(v)
if len(passed) == N:
n_path +... | N, M = list(map(int, input().split()))
g = {}
n_path = 0
for i in range(N):
g[i] = set()
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a].add(b)
g[b].add(a)
dp = [[0 for _ in range(N)] for _ in range(1 << N)]
dp[1][0] = 1
for bit in range(1 << N):
for v in range... | false | 3.448276 | [
"- g[i] = []",
"+ g[i] = set()",
"- g[a].append(b)",
"- g[b].append(a)",
"-",
"-",
"-def advance(v, passed):",
"- global n_path",
"- passed.append(v)",
"- if len(passed) == N:",
"- n_path += 1",
"- for n in g[v]:",
"- if n not in passed:",
"- ... | false | 0.055055 | 0.057901 | 0.950859 | [
"s015188324",
"s995886331"
] |
u868600519 | p03208 | python | s073280529 | s117088612 | 220 | 96 | 7,440 | 14,092 | Accepted | Accepted | 56.36 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = min(h[i + K - 1] - h[i] for i in range(N - K + 1))
print(m) | import sys
N, K, *h = list(map(int, sys.stdin.read().split()))
h.sort()
m = min(h[i + K - 1] - h[i] for i in range(N - K + 1))
print(m) | 6 | 7 | 148 | 137 | N, K = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(N)]
h.sort()
m = min(h[i + K - 1] - h[i] for i in range(N - K + 1))
print(m)
| import sys
N, K, *h = list(map(int, sys.stdin.read().split()))
h.sort()
m = min(h[i + K - 1] - h[i] for i in range(N - K + 1))
print(m)
| false | 14.285714 | [
"-N, K = list(map(int, input().split()))",
"-h = [int(eval(input())) for _ in range(N)]",
"+import sys",
"+",
"+N, K, *h = list(map(int, sys.stdin.read().split()))"
] | false | 0.036444 | 0.046268 | 0.787663 | [
"s073280529",
"s117088612"
] |
u729133443 | p02735 | python | s261723999 | s691587837 | 22 | 20 | 3,192 | 3,064 | Accepted | Accepted | 9.09 | def main():
import sys
buf=sys.stdin.buffer
h,w=list(map(int,buf.readline().split()))
c,*s,_=buf.readline()
a=b=x=y=c==35
d=[(b,a)]
for c in s:
f=c==35
b+=a^f
a=f
d+=(b,a),
for c,*s in buf.read().split():
f=c==35
y+=x^f
b=y
a=x=f
p=[(b,a)]
for i,... | def main():
import sys
buf=sys.stdin.buffer
h,w=list(map(int,buf.readline().split()))
s=buf.readline()
a=b=x=y=s[0]==35
d=[b]
e=[a]
for i in range(1,w):
f=s[i]==35
b+=a^f
a=f
d+=b,
e+=a,
for s in buf.read().split():
f=s[0]==35
y+=x^f
b=y
a=x=f
... | 29 | 33 | 473 | 510 | def main():
import sys
buf = sys.stdin.buffer
h, w = list(map(int, buf.readline().split()))
c, *s, _ = buf.readline()
a = b = x = y = c == 35
d = [(b, a)]
for c in s:
f = c == 35
b += a ^ f
a = f
d += ((b, a),)
for c, *s in buf.read().split():
f =... | def main():
import sys
buf = sys.stdin.buffer
h, w = list(map(int, buf.readline().split()))
s = buf.readline()
a = b = x = y = s[0] == 35
d = [b]
e = [a]
for i in range(1, w):
f = s[i] == 35
b += a ^ f
a = f
d += (b,)
e += (a,)
for s in buf.re... | false | 12.121212 | [
"- c, *s, _ = buf.readline()",
"- a = b = x = y = c == 35",
"- d = [(b, a)]",
"- for c in s:",
"- f = c == 35",
"+ s = buf.readline()",
"+ a = b = x = y = s[0] == 35",
"+ d = [b]",
"+ e = [a]",
"+ for i in range(1, w):",
"+ f = s[i] == 35",
"- d ... | false | 0.058172 | 0.067303 | 0.864334 | [
"s261723999",
"s691587837"
] |
u600402037 | p03244 | python | s734885509 | s581981065 | 152 | 100 | 22,096 | 21,944 | Accepted | Accepted | 34.21 | from collections import Counter
N = int(eval(input()))
V = list(map(int, input().split()))
s1 = Counter(V).most_common(2)[0]
s2 = Counter(V).most_common(2)[0]
V1 = V[0::2]
V2 = V[1::2]
c1 = c2 = c3 = c4 = 0
Z1 = Counter(V1)
Z2 = Counter(V2)
x1, c1 = Z1.most_common(1)[0]
x2, c2 = Z2.most_common(1)[0]
if ... | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 奇数番目の最頻値と偶数番目の最頻値が同じ時に注意
N = ir()
V = lr()
odd = V[::2]
even = V[1::2]
cnt_odd = Counter(odd)
cnt_even = Counter(even)
cnt_odd_most = ... | 23 | 31 | 519 | 831 | from collections import Counter
N = int(eval(input()))
V = list(map(int, input().split()))
s1 = Counter(V).most_common(2)[0]
s2 = Counter(V).most_common(2)[0]
V1 = V[0::2]
V2 = V[1::2]
c1 = c2 = c3 = c4 = 0
Z1 = Counter(V1)
Z2 = Counter(V2)
x1, c1 = Z1.most_common(1)[0]
x2, c2 = Z2.most_common(1)[0]
if len(Z1) > 1:
... | # coding: utf-8
import sys
from collections import Counter
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# 奇数番目の最頻値と偶数番目の最頻値が同じ時に注意
N = ir()
V = lr()
odd = V[::2]
even = V[1::2]
cnt_odd = Counter(odd)
cnt_even = Counter(even)
cnt_odd_most = cnt_odd.most_com... | false | 25.806452 | [
"+# coding: utf-8",
"+import sys",
"-N = int(eval(input()))",
"-V = list(map(int, input().split()))",
"-s1 = Counter(V).most_common(2)[0]",
"-s2 = Counter(V).most_common(2)[0]",
"-V1 = V[0::2]",
"-V2 = V[1::2]",
"-c1 = c2 = c3 = c4 = 0",
"-Z1 = Counter(V1)",
"-Z2 = Counter(V2)",
"-x1, c1 = Z1.... | false | 0.064856 | 0.03646 | 1.778798 | [
"s734885509",
"s581981065"
] |
u433375322 | p02641 | python | s780383823 | s651444259 | 30 | 27 | 9,208 | 9,208 | Accepted | Accepted | 10 | x,n=list(map(int,input().split()))
l=list(map(int,input().split()))
a=0
for i in range(100):
if x-i not in l:
ans=x-i
a=i+1
break
for i in range(100):
if x+i not in l:
ansb=x+i
ab=i+1
break
if a>ab:
print(ansb)
else:
print(ans) | x,n=list(map(int,input().split()))
l=list(map(int,input().split()))
flag=0
i=0
while flag==0:
if x-i not in l:
flag=1
ansa=x-i
i+=1
flag=0
i=0
while flag==0:
if x+i not in l:
flag=1
ansb=x+i
i+=1
if abs(ansa-x)<=abs(ansb-x):
print(ansa)
else:
pr... | 17 | 20 | 301 | 323 | x, n = list(map(int, input().split()))
l = list(map(int, input().split()))
a = 0
for i in range(100):
if x - i not in l:
ans = x - i
a = i + 1
break
for i in range(100):
if x + i not in l:
ansb = x + i
ab = i + 1
break
if a > ab:
print(ansb)
else:
print(an... | x, n = list(map(int, input().split()))
l = list(map(int, input().split()))
flag = 0
i = 0
while flag == 0:
if x - i not in l:
flag = 1
ansa = x - i
i += 1
flag = 0
i = 0
while flag == 0:
if x + i not in l:
flag = 1
ansb = x + i
i += 1
if abs(ansa - x) <= abs(ansb - x):
... | false | 15 | [
"-a = 0",
"-for i in range(100):",
"+flag = 0",
"+i = 0",
"+while flag == 0:",
"- ans = x - i",
"- a = i + 1",
"- break",
"-for i in range(100):",
"+ flag = 1",
"+ ansa = x - i",
"+ i += 1",
"+flag = 0",
"+i = 0",
"+while flag == 0:",
"+ fla... | false | 0.044378 | 0.044764 | 0.991378 | [
"s780383823",
"s651444259"
] |
u355726239 | p00445 | python | s122287362 | s865592515 | 40 | 30 | 6,748 | 7,352 | Accepted | Accepted | 25 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
try:
s = eval(input(''))
except:
break
n_joi = 0
n_ioi = 0
for i in range(len(s[:-2])):
cut_s = s[i:i+3]
if cut_s == 'JOI':
n_joi += 1
if cut_s == 'IOI':
n_ioi ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
try:
input_s = eval(input())
except:
break
s_list = [input_s[i:i+3] for i in range(len(input_s[:-2]))]
n_joi = 0
n_ioi = 0
for s in s_list:
if s == 'JOI':
n_joi += 1
if s == '... | 20 | 21 | 356 | 381 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
try:
s = eval(input(""))
except:
break
n_joi = 0
n_ioi = 0
for i in range(len(s[:-2])):
cut_s = s[i : i + 3]
if cut_s == "JOI":
n_joi += 1
if cut_s == "IOI":
n_ioi += 1
print... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
try:
input_s = eval(input())
except:
break
s_list = [input_s[i : i + 3] for i in range(len(input_s[:-2]))]
n_joi = 0
n_ioi = 0
for s in s_list:
if s == "JOI":
n_joi += 1
if s == "IOI":
... | false | 4.761905 | [
"- s = eval(input(\"\"))",
"+ input_s = eval(input())",
"+ s_list = [input_s[i : i + 3] for i in range(len(input_s[:-2]))]",
"- for i in range(len(s[:-2])):",
"- cut_s = s[i : i + 3]",
"- if cut_s == \"JOI\":",
"+ for s in s_list:",
"+ if s == \"JOI\":",
"... | false | 0.043095 | 0.042808 | 1.006703 | [
"s122287362",
"s865592515"
] |
u241159583 | p02881 | python | s482634945 | s787984533 | 197 | 160 | 2,940 | 9,424 | Accepted | Accepted | 18.78 | n = int(eval(input()))
x = int(n**0.5)
while n%x!=0:
x-=1
x,y = x-1, n//x -1
print((x+y)) | n = int(eval(input()))
x = int(n**0.5)
while n%x!=0: x-= 1
y = n//x
print((x-1+y-1)) | 6 | 5 | 90 | 80 | n = int(eval(input()))
x = int(n**0.5)
while n % x != 0:
x -= 1
x, y = x - 1, n // x - 1
print((x + y))
| n = int(eval(input()))
x = int(n**0.5)
while n % x != 0:
x -= 1
y = n // x
print((x - 1 + y - 1))
| false | 16.666667 | [
"-x, y = x - 1, n // x - 1",
"-print((x + y))",
"+y = n // x",
"+print((x - 1 + y - 1))"
] | false | 0.036132 | 0.037002 | 0.97647 | [
"s482634945",
"s787984533"
] |
u814986259 | p03044 | python | s910020260 | s167133852 | 788 | 429 | 55,304 | 52,372 | Accepted | Accepted | 45.56 | import collections
N = int(eval(input()))
d = [0]*N
route = [set() for i in range(N)]
for i in range(N-1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
route[u].add((v, w))
route[v].add((u, w))
d[u] += 1
d[v] += 1
d = d.index(max(d))
q = collections.deque()
q.append(... | import collections
def main():
import sys
input = sys.stdin.readline
N = int(input())
color = [-1]*N
G = [set() for i in range(N)]
for i in range(N-1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
G[u].add((v, w))
G[v].add((u, w))
... | 33 | 35 | 627 | 753 | import collections
N = int(eval(input()))
d = [0] * N
route = [set() for i in range(N)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
route[u].add((v, w))
route[v].add((u, w))
d[u] += 1
d[v] += 1
d = d.index(max(d))
q = collections.deque()
q.append((d, 0))
G... | import collections
def main():
import sys
input = sys.stdin.readline
N = int(input())
color = [-1] * N
G = [set() for i in range(N)]
for i in range(N - 1):
u, v, w = map(int, input().split())
u -= 1
v -= 1
G[u].add((v, w))
G[v].add((u, w))
root = 0
... | false | 5.714286 | [
"-N = int(eval(input()))",
"-d = [0] * N",
"-route = [set() for i in range(N)]",
"-for i in range(N - 1):",
"- u, v, w = list(map(int, input().split()))",
"- u -= 1",
"- v -= 1",
"- route[u].add((v, w))",
"- route[v].add((u, w))",
"- d[u] += 1",
"- d[v] += 1",
"-d = d.inde... | false | 0.042286 | 0.040012 | 1.056848 | [
"s910020260",
"s167133852"
] |
u476604182 | p03608 | python | s843045425 | s105926808 | 504 | 338 | 65,752 | 49,264 | Accepted | Accepted | 32.94 | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = [int(c)-1 for c in input().split()]
cost = [[float('inf')]*N for i in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
cost[a-1][b-1] = c
cost[b-1][a-1] = c
def warshall_floyd(d,n):
#d[i][j]: iからjへの... | from itertools import permutations
N, M, R, *L = list(map(int, open(0).read().split()))
city = L[:R]
inf = L[R:]
dist = [[10**10]*N for i in range(N)]
for x,y,c in zip(*[iter(inf)]*3):
dist[x-1][y-1] = c
dist[y-1][x-1] = c
for i in range(N):
dist[i][i] = 0
for k in range(N):
for i in range(N):
... | 28 | 24 | 688 | 543 | from itertools import permutations
N, M, R = list(map(int, input().split()))
r = [int(c) - 1 for c in input().split()]
cost = [[float("inf")] * N for i in range(N)]
for i in range(M):
a, b, c = list(map(int, input().split()))
cost[a - 1][b - 1] = c
cost[b - 1][a - 1] = c
def warshall_floyd(d, n):
# d... | from itertools import permutations
N, M, R, *L = list(map(int, open(0).read().split()))
city = L[:R]
inf = L[R:]
dist = [[10**10] * N for i in range(N)]
for x, y, c in zip(*[iter(inf)] * 3):
dist[x - 1][y - 1] = c
dist[y - 1][x - 1] = c
for i in range(N):
dist[i][i] = 0
for k in range(N):
for i in rang... | false | 14.285714 | [
"-N, M, R = list(map(int, input().split()))",
"-r = [int(c) - 1 for c in input().split()]",
"-cost = [[float(\"inf\")] * N for i in range(N)]",
"-for i in range(M):",
"- a, b, c = list(map(int, input().split()))",
"- cost[a - 1][b - 1] = c",
"- cost[b - 1][a - 1] = c",
"-",
"-",
"-def war... | false | 0.044099 | 0.038591 | 1.142715 | [
"s843045425",
"s105926808"
] |
u681773563 | p02707 | python | s625645505 | s285887925 | 135 | 118 | 40,236 | 40,228 | Accepted | Accepted | 12.59 | num = int(eval(input()))
boss = input().split()
ans_list = [0] * num
for i_boss in boss:
ans_list[int(i_boss)-1] += 1
a = list([str(x) for x in ans_list])
print(('\n'.join(a)))
| num = int(eval(input()))
boss = input().split()
ans_list = [0] * num
for i_boss in boss:
ans_list[int(i_boss)-1] += 1
print(('\n'.join(list(map(str, ans_list))))) | 9 | 6 | 189 | 163 | num = int(eval(input()))
boss = input().split()
ans_list = [0] * num
for i_boss in boss:
ans_list[int(i_boss) - 1] += 1
a = list([str(x) for x in ans_list])
print(("\n".join(a)))
| num = int(eval(input()))
boss = input().split()
ans_list = [0] * num
for i_boss in boss:
ans_list[int(i_boss) - 1] += 1
print(("\n".join(list(map(str, ans_list)))))
| false | 33.333333 | [
"-a = list([str(x) for x in ans_list])",
"-print((\"\\n\".join(a)))",
"+print((\"\\n\".join(list(map(str, ans_list)))))"
] | false | 0.081005 | 0.079366 | 1.020653 | [
"s625645505",
"s285887925"
] |
u197955752 | p02697 | python | s847013860 | s350554641 | 98 | 77 | 9,284 | 9,272 | Accepted | Accepted | 21.43 | import sys
N, M = [int(x) for x in input().split()]
s = []; e = [];
s.append(1)
e.append(2 * -(-M // 2)) # 2 * ceiling(M/2)
s.append(N - 2 * (M // 2))
e.append(N)
n = 0
while True:
for i in range(2):
if n >= M: sys.exit()
print((s[i], e[i]))
s[i] += 1
e[i] -= 1
... | import sys
N, M = [int(x) for x in input().split()]
s = 1
e = 2 * -(-M // 2)
for _ in range(M):
if s >= e:
s = N - 2 * (M // 2)
e = N
print((s, e))
s += 1
e -= 1 | 17 | 12 | 328 | 203 | import sys
N, M = [int(x) for x in input().split()]
s = []
e = []
s.append(1)
e.append(2 * -(-M // 2)) # 2 * ceiling(M/2)
s.append(N - 2 * (M // 2))
e.append(N)
n = 0
while True:
for i in range(2):
if n >= M:
sys.exit()
print((s[i], e[i]))
s[i] += 1
e[i] -= 1
n ... | import sys
N, M = [int(x) for x in input().split()]
s = 1
e = 2 * -(-M // 2)
for _ in range(M):
if s >= e:
s = N - 2 * (M // 2)
e = N
print((s, e))
s += 1
e -= 1
| false | 29.411765 | [
"-s = []",
"-e = []",
"-s.append(1)",
"-e.append(2 * -(-M // 2)) # 2 * ceiling(M/2)",
"-s.append(N - 2 * (M // 2))",
"-e.append(N)",
"-n = 0",
"-while True:",
"- for i in range(2):",
"- if n >= M:",
"- sys.exit()",
"- print((s[i], e[i]))",
"- s[i] += 1",
... | false | 0.037895 | 0.082479 | 0.459444 | [
"s847013860",
"s350554641"
] |
u063052907 | p03162 | python | s690611611 | s015353045 | 350 | 197 | 3,064 | 3,064 | Accepted | Accepted | 43.71 | # coding: utf-8
# import sys
# input = sys.stdin.readline
def dp_happiness(N):
yesterday_a, yesterday_b, yesterday_c = 0, 0, 0
for _ in range(N):
a, b, c = list(map(int, input().split()))
today_a = a + max(yesterday_b, yesterday_c)
today_b = b + max(yesterday_c, yesterday_a)
... | # coding: utf-8
import sys
input = sys.stdin.readline
def dp_happiness(N):
yesterday_a, yesterday_b, yesterday_c = 0, 0, 0
for _ in range(N):
a, b, c = list(map(int, input().split()))
today_a = a + max(yesterday_b, yesterday_c)
today_b = b + max(yesterday_c, yesterday_a)
... | 20 | 20 | 548 | 544 | # coding: utf-8
# import sys
# input = sys.stdin.readline
def dp_happiness(N):
yesterday_a, yesterday_b, yesterday_c = 0, 0, 0
for _ in range(N):
a, b, c = list(map(int, input().split()))
today_a = a + max(yesterday_b, yesterday_c)
today_b = b + max(yesterday_c, yesterday_a)
toda... | # coding: utf-8
import sys
input = sys.stdin.readline
def dp_happiness(N):
yesterday_a, yesterday_b, yesterday_c = 0, 0, 0
for _ in range(N):
a, b, c = list(map(int, input().split()))
today_a = a + max(yesterday_b, yesterday_c)
today_b = b + max(yesterday_c, yesterday_a)
today... | false | 0 | [
"-# import sys",
"-# input = sys.stdin.readline",
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.036747 | 0.06864 | 0.535352 | [
"s690611611",
"s015353045"
] |
u347600233 | p02953 | python | s454296707 | s529947699 | 87 | 72 | 20,472 | 20,496 | Accepted | Accepted | 17.24 | n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 'Yes'
for i in range(n - 1, 0, -1):
if h[i - 1] > h[i]:
h[i - 1] -= 1
if h[i - 1] > h[i]:
ans = 'No'
print(ans) | n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = 'Yes'
for i in range(n - 1, 0, -1):
d = h[i - 1] - h[i]
if d >= 2:
ans = 'No'
break
elif d == 1:
h[i - 1] -= 1
print(ans) | 9 | 11 | 204 | 228 | n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = "Yes"
for i in range(n - 1, 0, -1):
if h[i - 1] > h[i]:
h[i - 1] -= 1
if h[i - 1] > h[i]:
ans = "No"
print(ans)
| n = int(eval(input()))
h = [int(i) for i in input().split()]
ans = "Yes"
for i in range(n - 1, 0, -1):
d = h[i - 1] - h[i]
if d >= 2:
ans = "No"
break
elif d == 1:
h[i - 1] -= 1
print(ans)
| false | 18.181818 | [
"- if h[i - 1] > h[i]:",
"+ d = h[i - 1] - h[i]",
"+ if d >= 2:",
"+ ans = \"No\"",
"+ break",
"+ elif d == 1:",
"- if h[i - 1] > h[i]:",
"- ans = \"No\""
] | false | 0.040672 | 0.044147 | 0.921284 | [
"s454296707",
"s529947699"
] |
u633068244 | p00009 | python | s599155594 | s195763521 | 400 | 330 | 35,064 | 37,128 | Accepted | Accepted | 17.5 | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
for j in range(2*i+1,r,i+1):
p[j] = 0
for i in n:
print(sum(p[:i])) | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
if p[i]:
p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)]
for i in n:
print(sum(p[:i])) | 19 | 18 | 306 | 305 | import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n) + 1
sqrt = int(math.sqrt(r))
p = [1] * r
p[0] = 0
for i in range(1, sqrt):
if p[i]:
for j in range(2 * i + 1, r, i + 1):
p[j] = 0
for i in n:
print(sum(p[:i]))
| import math
n = []
while True:
try:
n.append(int(input()))
except:
break
r = max(n) + 1
sqrt = int(math.sqrt(r))
p = [1] * r
p[0] = 0
for i in range(1, sqrt):
if p[i]:
p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)]
for i in n:
print(sum(p[:i]))
| false | 5.263158 | [
"- for j in range(2 * i + 1, r, i + 1):",
"- p[j] = 0",
"+ p[2 * i + 1 :: i + 1] = [0 for x in range(2 * i + 1, r, i + 1)]"
] | false | 0.049036 | 0.070656 | 0.694014 | [
"s599155594",
"s195763521"
] |
u319410662 | p03836 | python | s203506840 | s126254620 | 11 | 10 | 2,692 | 2,692 | Accepted | Accepted | 9.09 | sx, sy, tx, ty = list(map(int, input().split()))
dx = tx-sx
dy = ty-sy
s = ""
s += "L" + "U"*(dy+1) + "R"*(dx+1) + "D"
s += "R" + "D"*(dy+1) + "L"*(dx+1) + "U"
s += "U"*dy + "R"*dx
s += "D"*dy + "L"*dx
print(s) | sx,sy,tx,ty = list(map(int, input().split()))
r = ""
r += "L"+"U"*(ty-sy+1)+"R"*(tx-sx+1)+"D"
r += "R"+"D"*(ty-sy+1)+"L"*(tx-sx+1)+"U"
r += "U"*(ty-sy)+"R"*(tx-sx)
r += "D"*(ty-sy)+"L"*(tx-sx)
print(r) | 9 | 7 | 215 | 204 | sx, sy, tx, ty = list(map(int, input().split()))
dx = tx - sx
dy = ty - sy
s = ""
s += "L" + "U" * (dy + 1) + "R" * (dx + 1) + "D"
s += "R" + "D" * (dy + 1) + "L" * (dx + 1) + "U"
s += "U" * dy + "R" * dx
s += "D" * dy + "L" * dx
print(s)
| sx, sy, tx, ty = list(map(int, input().split()))
r = ""
r += "L" + "U" * (ty - sy + 1) + "R" * (tx - sx + 1) + "D"
r += "R" + "D" * (ty - sy + 1) + "L" * (tx - sx + 1) + "U"
r += "U" * (ty - sy) + "R" * (tx - sx)
r += "D" * (ty - sy) + "L" * (tx - sx)
print(r)
| false | 22.222222 | [
"-dx = tx - sx",
"-dy = ty - sy",
"-s = \"\"",
"-s += \"L\" + \"U\" * (dy + 1) + \"R\" * (dx + 1) + \"D\"",
"-s += \"R\" + \"D\" * (dy + 1) + \"L\" * (dx + 1) + \"U\"",
"-s += \"U\" * dy + \"R\" * dx",
"-s += \"D\" * dy + \"L\" * dx",
"-print(s)",
"+r = \"\"",
"+r += \"L\" + \"U\" * (ty - sy + 1) ... | false | 0.064271 | 0.046935 | 1.369365 | [
"s203506840",
"s126254620"
] |
u844789719 | p03108 | python | s901774544 | s034255936 | 794 | 674 | 31,088 | 31,124 | Accepted | Accepted | 15.11 | N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
UF = list(range(N + 1))
SIZE = [0] + [1] * N # 1-indexed
def find(x):
if UF[x] != x:
UF[x] = find(UF[x])
return UF[x]
def unite(x, y):
m = min(find(x), find(y))
SIZE[m] = SIZE... | N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
UF = list(range(N + 1))
SIZE = [0] + [1] * N # 1-indexed
def find(x):
if UF[x] != x:
UF[x] = find(UF[x])
return UF[x]
def unite(x, y):
X, Y = find(x), find(y)
SX,SY=SIZE[X],SI... | 37 | 39 | 737 | 754 | N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
UF = list(range(N + 1))
SIZE = [0] + [1] * N # 1-indexed
def find(x):
if UF[x] != x:
UF[x] = find(UF[x])
return UF[x]
def unite(x, y):
m = min(find(x), find(y))
SIZE[m] = SIZE[find(x)] + SIZE... | N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
UF = list(range(N + 1))
SIZE = [0] + [1] * N # 1-indexed
def find(x):
if UF[x] != x:
UF[x] = find(UF[x])
return UF[x]
def unite(x, y):
X, Y = find(x), find(y)
SX, SY = SIZE[X], SIZE[Y]
m ... | false | 5.128205 | [
"- m = min(find(x), find(y))",
"- SIZE[m] = SIZE[find(x)] + SIZE[find(y)]",
"- UF[find(x)] = m",
"- UF[find(y)] = m",
"+ X, Y = find(x), find(y)",
"+ SX, SY = SIZE[X], SIZE[Y]",
"+ m = min(X, Y)",
"+ SIZE[m] = SX + SY",
"+ SIZE[X + Y - m] = 0",
"+ UF[X + Y - m] = m"
] | false | 0.036415 | 0.035954 | 1.012813 | [
"s901774544",
"s034255936"
] |
u393253137 | p03578 | python | s238018077 | s455921916 | 232 | 191 | 59,108 | 53,604 | Accepted | Accepted | 17.67 | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if d in dic:
dic[d] += 1
else:
dic[d] = 1
... | def main():
# D, Tは文字数カウントするだけだからint型にする必要なし.
n = int(eval(input()))
D = input().split()
m = int(eval(input()))
T = input().split()
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
# dic.get(d)と比べると, if in の方が速い.
if d in dic:
dic[d] += 1
... | 22 | 24 | 465 | 525 | def main():
n = int(eval(input()))
D = list(map(int, input().split()))
m = int(eval(input()))
T = list(map(int, input().split()))
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
if d in dic:
dic[d] += 1
else:
dic[d] = 1
for t in T:
if t n... | def main():
# D, Tは文字数カウントするだけだからint型にする必要なし.
n = int(eval(input()))
D = input().split()
m = int(eval(input()))
T = input().split()
dic = dict()
# 辞書はDだけで十分.Counterより速い.
for d in D:
# dic.get(d)と比べると, if in の方が速い.
if d in dic:
dic[d] += 1
else:
... | false | 8.333333 | [
"+ # D, Tは文字数カウントするだけだからint型にする必要なし.",
"- D = list(map(int, input().split()))",
"+ D = input().split()",
"- T = list(map(int, input().split()))",
"+ T = input().split()",
"+ # dic.get(d)と比べると, if in の方が速い."
] | false | 0.045928 | 0.133252 | 0.34467 | [
"s238018077",
"s455921916"
] |
u823585596 | p03106 | python | s798054864 | s020857073 | 31 | 28 | 9,160 | 9,152 | Accepted | Accepted | 9.68 | A,B,K=list(map(int,input().split()))
count=0
for i in range(max(A,B),0,-1):
if A%i==0 and B%i==0:
count+=1
if count==K:
print(i) | A,B,K=list(map(int,input().split()))
count=0
i=min(A,B)+1
while count<K:
i-=1
if A%i==0 and B%i==0:
count+=1
print(i) | 7 | 8 | 160 | 134 | A, B, K = list(map(int, input().split()))
count = 0
for i in range(max(A, B), 0, -1):
if A % i == 0 and B % i == 0:
count += 1
if count == K:
print(i)
| A, B, K = list(map(int, input().split()))
count = 0
i = min(A, B) + 1
while count < K:
i -= 1
if A % i == 0 and B % i == 0:
count += 1
print(i)
| false | 12.5 | [
"-for i in range(max(A, B), 0, -1):",
"+i = min(A, B) + 1",
"+while count < K:",
"+ i -= 1",
"- if count == K:",
"- print(i)",
"+print(i)"
] | false | 0.042972 | 0.081893 | 0.524733 | [
"s798054864",
"s020857073"
] |
u119148115 | p02834 | python | s234093961 | s969054651 | 280 | 253 | 90,216 | 89,080 | Accepted | Accepted | 9.64 | import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
N,u,v = LI()
Graph = [[] for i in range(N+1)]
for i in range(N-1):
a,b = LI()
Graph[a].append(b)
Graph[b].append(a)
from collections import deque
q1 = deque([u])
distance1 = [-1]*(N+1) # uから各頂点への最短距離... | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | 64 | 46 | 1,276 | 1,184 | import sys
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
N, u, v = LI()
Graph = [[] for i in range(N + 1)]
for i in range(N - 1):
a, b = LI()
Graph[a].append(b)
Graph[b].append(a)
from collections import deque
q1 = deque([u])
distance1 = [-1] * (N + 1) # uから各頂点への最短... | import sys
sys.setrecursionlimit(10**7)
def I():
return int(sys.stdin.readline().rstrip())
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def LI():
return list(map(int, sys.stdin.readline().rstrip().split())) # 空白あり
def LI2():
return list(map(int, sys.stdin.readline().r... | false | 28.125 | [
"+",
"+sys.setrecursionlimit(10**7)",
"+",
"+",
"+def I():",
"+ return int(sys.stdin.readline().rstrip())",
"+",
"+",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().rstrip().split()))",
"-N, u, v = LI()",
"-Graph = [[] for i in range(N + 1)]",
"+def LI2():",
"+ return ... | false | 0.049216 | 0.049229 | 0.999739 | [
"s234093961",
"s969054651"
] |
u018679195 | p02711 | python | s812919837 | s800717087 | 72 | 27 | 61,836 | 8,992 | Accepted | Accepted | 62.5 | n = int(eval(input()))
while n!=0:
if n%10 == 7:
print("Yes")
break
n//=10
else:
print("No") | N = eval(input())
condition = False
for i in str(N):
if (i=='7'):
condition = True
if condition:
print("Yes")
else:
print("No")
| 8 | 10 | 121 | 148 | n = int(eval(input()))
while n != 0:
if n % 10 == 7:
print("Yes")
break
n //= 10
else:
print("No")
| N = eval(input())
condition = False
for i in str(N):
if i == "7":
condition = True
if condition:
print("Yes")
else:
print("No")
| false | 20 | [
"-n = int(eval(input()))",
"-while n != 0:",
"- if n % 10 == 7:",
"- print(\"Yes\")",
"- break",
"- n //= 10",
"+N = eval(input())",
"+condition = False",
"+for i in str(N):",
"+ if i == \"7\":",
"+ condition = True",
"+if condition:",
"+ print(\"Yes\")"
] | false | 0.034846 | 0.040426 | 0.861972 | [
"s812919837",
"s800717087"
] |
u879870653 | p03207 | python | s297452272 | s217485144 | 40 | 17 | 3,060 | 2,940 | Accepted | Accepted | 57.5 | N = int(eval(input()))
L = []
for i in range(N) :
l = int(eval(input()))
L.append(l)
L = sorted(L)
L[-1] //= 2
print((sum(L)))
| N = int(eval(input()))
L = sorted([int(eval(input())) for i in range(N)])
ans = sum(L[:-1])+L[-1]//2
print(ans)
| 8 | 4 | 128 | 103 | N = int(eval(input()))
L = []
for i in range(N):
l = int(eval(input()))
L.append(l)
L = sorted(L)
L[-1] //= 2
print((sum(L)))
| N = int(eval(input()))
L = sorted([int(eval(input())) for i in range(N)])
ans = sum(L[:-1]) + L[-1] // 2
print(ans)
| false | 50 | [
"-L = []",
"-for i in range(N):",
"- l = int(eval(input()))",
"- L.append(l)",
"-L = sorted(L)",
"-L[-1] //= 2",
"-print((sum(L)))",
"+L = sorted([int(eval(input())) for i in range(N)])",
"+ans = sum(L[:-1]) + L[-1] // 2",
"+print(ans)"
] | false | 0.042125 | 0.037144 | 1.134114 | [
"s297452272",
"s217485144"
] |
u368796742 | p03645 | python | s224895427 | s856604117 | 704 | 595 | 61,016 | 18,892 | Accepted | Accepted | 15.48 | n,m = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(m)]
a = []
b = []
for i in l:
if i[0] == 1:
a.append(i[1])
if i[1] == n:
b.append(i[0])
print(("POSSIBLE" if len(set(a)&set(b)) > 0 else "IMPOSSIBLE")) | n,m = list(map(int,input().split()))
a = set()
b = set()
for i in range(m):
a_,b_ = list(map(int,input().split()))
if a_ == 1:
a.add(b_)
if b_ == n:
b.add(a_)
print(("POSSIBLE" if a&b else "IMPOSSIBLE")) | 12 | 10 | 268 | 226 | n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
a = []
b = []
for i in l:
if i[0] == 1:
a.append(i[1])
if i[1] == n:
b.append(i[0])
print(("POSSIBLE" if len(set(a) & set(b)) > 0 else "IMPOSSIBLE"))
| n, m = list(map(int, input().split()))
a = set()
b = set()
for i in range(m):
a_, b_ = list(map(int, input().split()))
if a_ == 1:
a.add(b_)
if b_ == n:
b.add(a_)
print(("POSSIBLE" if a & b else "IMPOSSIBLE"))
| false | 16.666667 | [
"-l = [list(map(int, input().split())) for i in range(m)]",
"-a = []",
"-b = []",
"-for i in l:",
"- if i[0] == 1:",
"- a.append(i[1])",
"- if i[1] == n:",
"- b.append(i[0])",
"-print((\"POSSIBLE\" if len(set(a) & set(b)) > 0 else \"IMPOSSIBLE\"))",
"+a = set()",
"+b = set()"... | false | 0.047395 | 0.042696 | 1.110062 | [
"s224895427",
"s856604117"
] |
u814271993 | p02614 | python | s312955793 | s095915203 | 79 | 52 | 74,192 | 9,096 | Accepted | Accepted | 34.18 | import itertools
H,W,K=list(map(int,input().split()))
C=[]
for i in range(H):
C.append(eval(input()))
ans=0
for i in range(H+1):
for j in range(W+1):
for n in itertools.combinations(list(range(H)),i):
for m in itertools.combinations(list(range(W)),j):
count = 0
for a in... | import itertools
h,w,n=list(map(int, input().split()))
l=[str(eval(input()))for _ in range(h)]
ans = 0
for i in list(itertools.product([0,1], repeat= h)):
for j in list(itertools.product([0,1], repeat= w)):
b = 0
for k in range(h):
for m in range(w):
if i[k] ==... | 21 | 15 | 448 | 425 | import itertools
H, W, K = list(map(int, input().split()))
C = []
for i in range(H):
C.append(eval(input()))
ans = 0
for i in range(H + 1):
for j in range(W + 1):
for n in itertools.combinations(list(range(H)), i):
for m in itertools.combinations(list(range(W)), j):
count = ... | import itertools
h, w, n = list(map(int, input().split()))
l = [str(eval(input())) for _ in range(h)]
ans = 0
for i in list(itertools.product([0, 1], repeat=h)):
for j in list(itertools.product([0, 1], repeat=w)):
b = 0
for k in range(h):
for m in range(w):
if i[k] == 0 ... | false | 28.571429 | [
"-H, W, K = list(map(int, input().split()))",
"-C = []",
"-for i in range(H):",
"- C.append(eval(input()))",
"+h, w, n = list(map(int, input().split()))",
"+l = [str(eval(input())) for _ in range(h)]",
"-for i in range(H + 1):",
"- for j in range(W + 1):",
"- for n in itertools.combinat... | false | 0.1112 | 0.049847 | 2.230841 | [
"s312955793",
"s095915203"
] |
u543954314 | p04028 | python | s895608807 | s467912282 | 964 | 632 | 229,640 | 229,640 | Accepted | Accepted | 34.44 | n = int(eval(input()))
s = len(eval(input()))
mod = 10**9+7
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
dp[i][0] = (dp[i-1][0] + dp[i-1][1])%mod
for j in range(1,n):
dp[i][j] = (dp[i-1][j-1]*2 + dp[i-1][j+1])%mod
dp[i][n] = dp[i-1][n-1]*2%mod
s2 = pow(2,s,mod)
rev = pow... | n = int(eval(input()))
s = len(eval(input()))
mod = 10**9+7
dp = [[0]*(n+1) for _ in range(n+1)]
dp[0][0] = 1
for i in range(1,n+1):
dp[i][0] = (dp[i-1][0] + dp[i-1][1])%mod
for j in range(1,min(n,i+1)):
dp[i][j] = (dp[i-1][j-1]*2 + dp[i-1][j+1])%mod
dp[i][n] = dp[i-1][n-1]*2%mod
s2 = pow(2,s,mod)
... | 13 | 13 | 348 | 357 | n = int(eval(input()))
s = len(eval(input()))
mod = 10**9 + 7
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % mod
for j in range(1, n):
dp[i][j] = (dp[i - 1][j - 1] * 2 + dp[i - 1][j + 1]) % mod
dp[i][n] = dp[i - 1][n - 1] ... | n = int(eval(input()))
s = len(eval(input()))
mod = 10**9 + 7
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(1, n + 1):
dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]) % mod
for j in range(1, min(n, i + 1)):
dp[i][j] = (dp[i - 1][j - 1] * 2 + dp[i - 1][j + 1]) % mod
dp[i][n] = dp[i ... | false | 0 | [
"- for j in range(1, n):",
"+ for j in range(1, min(n, i + 1)):"
] | false | 0.100769 | 0.073195 | 1.376719 | [
"s895608807",
"s467912282"
] |
u435974296 | p02887 | python | s745154540 | s069772537 | 794 | 54 | 9,956 | 9,940 | Accepted | Accepted | 93.2 | N=int(eval(input()))
S=list(map(str,eval(input())))
i=0
while i!=(len(S)-1):
if S[i]==S[i+1]:
S.pop(i+1)
else:
i+=1
print((len(S))) | N=int(eval(input()))
S=list(map(str,eval(input())))
ans=1
for i in range(N-1):
if S[i]!=S[i+1]:
ans+=1
print(ans) | 9 | 7 | 149 | 119 | N = int(eval(input()))
S = list(map(str, eval(input())))
i = 0
while i != (len(S) - 1):
if S[i] == S[i + 1]:
S.pop(i + 1)
else:
i += 1
print((len(S)))
| N = int(eval(input()))
S = list(map(str, eval(input())))
ans = 1
for i in range(N - 1):
if S[i] != S[i + 1]:
ans += 1
print(ans)
| false | 22.222222 | [
"-i = 0",
"-while i != (len(S) - 1):",
"- if S[i] == S[i + 1]:",
"- S.pop(i + 1)",
"- else:",
"- i += 1",
"-print((len(S)))",
"+ans = 1",
"+for i in range(N - 1):",
"+ if S[i] != S[i + 1]:",
"+ ans += 1",
"+print(ans)"
] | false | 0.060153 | 0.037573 | 1.600943 | [
"s745154540",
"s069772537"
] |
u802963389 | p03556 | python | s017988940 | s428853560 | 166 | 28 | 38,256 | 2,940 | Accepted | Accepted | 83.13 | import math
n = int(eval(input()))
print((int(math.floor(n ** .5) ** 2))) | n = int(eval(input()))
ans = 1
for i in range(int(n ** .5) + 1):
sq = i ** 2
if sq <= n:
ans = sq
print(ans) | 3 | 7 | 67 | 116 | import math
n = int(eval(input()))
print((int(math.floor(n**0.5) ** 2)))
| n = int(eval(input()))
ans = 1
for i in range(int(n**0.5) + 1):
sq = i**2
if sq <= n:
ans = sq
print(ans)
| false | 57.142857 | [
"-import math",
"-",
"-print((int(math.floor(n**0.5) ** 2)))",
"+ans = 1",
"+for i in range(int(n**0.5) + 1):",
"+ sq = i**2",
"+ if sq <= n:",
"+ ans = sq",
"+print(ans)"
] | false | 0.083416 | 0.130132 | 0.641015 | [
"s017988940",
"s428853560"
] |
u347600233 | p02785 | python | s478861145 | s469651120 | 163 | 111 | 26,180 | 31,544 | Accepted | Accepted | 31.9 | n , k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h.sort()
count = 0
if k >= n:
print((0))
else:
print((sum(h[0:n - k]))) | n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(sorted(h)[:max(0, n - k)]))) | 8 | 3 | 154 | 108 | n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h.sort()
count = 0
if k >= n:
print((0))
else:
print((sum(h[0 : n - k])))
| n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(sorted(h)[: max(0, n - k)])))
| false | 62.5 | [
"-h = [int(i) for i in input().split()]",
"-h.sort()",
"-count = 0",
"-if k >= n:",
"- print((0))",
"-else:",
"- print((sum(h[0 : n - k])))",
"+h = list(map(int, input().split()))",
"+print((sum(sorted(h)[: max(0, n - k)])))"
] | false | 0.036137 | 0.035602 | 1.015019 | [
"s478861145",
"s469651120"
] |
u704437220 | p02918 | python | s429748834 | s450270620 | 169 | 18 | 39,152 | 3,188 | Accepted | Accepted | 89.35 | if __name__ == '__main__':
N, K = list(map(int, input().split()))
S = eval(input())
# ans = 0
# for i in range(N-1):
# if S[i] == S[i+1]:
# ans += 1
ans = N - 1 - S.count('LR') - S.count('RL')
ans = min(N-1, ans+K*2)
print(ans)
| import sys
if __name__ == '__main__':
N, K = list(map(int, sys.stdin.readline().split()))
S = sys.stdin.readline()
# ans = 0
# for i in range(N-1):
# if S[i] == S[i+1]:
# ans += 1
ans = N - 1 - S.count('LR') - S.count('RL')
ans = min(N-1, ans+K*2)
print(ans)
| 10 | 12 | 273 | 313 | if __name__ == "__main__":
N, K = list(map(int, input().split()))
S = eval(input())
# ans = 0
# for i in range(N-1):
# if S[i] == S[i+1]:
# ans += 1
ans = N - 1 - S.count("LR") - S.count("RL")
ans = min(N - 1, ans + K * 2)
print(ans)
| import sys
if __name__ == "__main__":
N, K = list(map(int, sys.stdin.readline().split()))
S = sys.stdin.readline()
# ans = 0
# for i in range(N-1):
# if S[i] == S[i+1]:
# ans += 1
ans = N - 1 - S.count("LR") - S.count("RL")
ans = min(N - 1, ans + K * 2)
print(ans)
| false | 16.666667 | [
"+import sys",
"+",
"- N, K = list(map(int, input().split()))",
"- S = eval(input())",
"+ N, K = list(map(int, sys.stdin.readline().split()))",
"+ S = sys.stdin.readline()"
] | false | 0.102724 | 0.160004 | 0.642011 | [
"s429748834",
"s450270620"
] |
u240096083 | p02695 | python | s843905596 | s358091497 | 223 | 153 | 95,592 | 91,768 | Accepted | Accepted | 31.39 | from pprint import pprint
n,m,q = list(map(int, input().split()))
ql = [list(map(int,input().split())) for _ in range(q)]
#print(n)
#print(m)
#print(q)
#pprint(ls)
masterlist = []
minilist = [0] * n
i = 0
def saiki(before_a,i,minilist):
if i > n-1:
masterlist.append([minilist[j... | from pprint import pprint
import itertools
n,m,q = list(map(int, input().split()))
ql = [list(map(int,input().split())) for _ in range(q)]
a_lists = list(itertools.combinations_with_replacement(list(range(m)), n))
#print(a_lists)
dmax = 0
for a_mini in a_lists:
dtemp = 0
for ql_mini i... | 46 | 27 | 879 | 510 | from pprint import pprint
n, m, q = list(map(int, input().split()))
ql = [list(map(int, input().split())) for _ in range(q)]
# print(n)
# print(m)
# print(q)
# pprint(ls)
masterlist = []
minilist = [0] * n
i = 0
def saiki(before_a, i, minilist):
if i > n - 1:
masterlist.append([minilist[j] for j in range... | from pprint import pprint
import itertools
n, m, q = list(map(int, input().split()))
ql = [list(map(int, input().split())) for _ in range(q)]
a_lists = list(itertools.combinations_with_replacement(list(range(m)), n))
# print(a_lists)
dmax = 0
for a_mini in a_lists:
dtemp = 0
for ql_mini in ql:
if a_min... | false | 41.304348 | [
"+import itertools",
"-# print(n)",
"-# print(m)",
"-# print(q)",
"-# pprint(ls)",
"-masterlist = []",
"-minilist = [0] * n",
"-i = 0",
"-",
"-",
"-def saiki(before_a, i, minilist):",
"- if i > n - 1:",
"- masterlist.append([minilist[j] for j in range(n)])",
"- return",
... | false | 0.106285 | 0.049402 | 2.151411 | [
"s843905596",
"s358091497"
] |
u495903598 | p03290 | python | s349443652 | s635162578 | 36 | 29 | 3,444 | 3,064 | Accepted | Accepted | 19.44 | #!/usr/bin/env python
# coding: utf-8
# In[37]:
d, g = list(map(int, input().split()))
pcs = [list(map(int, input().split()))for _ in range(d)]
"""
2 700
3 500
5 800
2 2000
3 500
5 800
"""
# In[ ]:
"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score
総scoreが目標scoreを上回っている
-> 手数を保存
scoreを下回っている
... | #!/usr/bin/env python
# coding: utf-8
# In[37]:
d, g = list(map(int, input().split()))
pcs = [list(map(int, input().split()))for _ in range(d)]
"""
2 700
3 500
5 800
2 2000
3 500
5 800
"""
# In[ ]:
"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score
総scoreが目標scoreを上回っている
-> 手数を保存
scoreを下回っている
... | 91 | 91 | 1,695 | 1,674 | #!/usr/bin/env python
# coding: utf-8
# In[37]:
d, g = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(d)]
"""
2 700
3 500
5 800
2 2000
3 500
5 800
"""
# In[ ]:
"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score
総scoreが目標scoreを上回っている
-> 手数を保存
scoreを下回っている
-> 全く解いていない問題の中から 一つ選び、中途半端に解く
s... | #!/usr/bin/env python
# coding: utf-8
# In[37]:
d, g = list(map(int, input().split()))
pcs = [list(map(int, input().split())) for _ in range(d)]
"""
2 700
3 500
5 800
2 2000
3 500
5 800
"""
# In[ ]:
"""
完全に解くか、全くとかないかを総当たり
完全に解く問題の総score
総scoreが目標scoreを上回っている
-> 手数を保存
scoreを下回っている
-> 全く解いていない問題の中から 一つ選び、中途半端に解く
s... | false | 0 | [
"- temp_str += \"{}ten {}mon {}perf : total {}\\n\".format(",
"- (j + 1) * 100, pcs[j][0], pcs[j][1], score",
"- )",
"+ # temp_str += '{}ten {}mon {}perf : total {}\\n'.format((j+1)*100, pcs[j][0], pcs[j][1], score)",
"- score_judge = score + pcs[j]... | false | 0.035978 | 0.070198 | 0.51252 | [
"s349443652",
"s635162578"
] |
u544050502 | p03494 | python | s839051500 | s390642426 | 26 | 20 | 3,572 | 2,940 | Accepted | Accepted | 23.08 | ##いろいろやってみよう
import functools
def mod(a,b):
c=a%b
return c
N=int(eval(input()))
*A,=list(map(int,input().split()))
count=0
for j in range(len(bin(max(A)))-2):
if 1 in list(map(functools.partial(mod,b=2),A)):
break
else:
A=[A[i]//2 for i in range(N)]
count+=1
print(count) | a=int(eval(input()))
b=list(map(int,input().split()))
counter=0
exist_odd=False
while True:
count=0
while count<=a-1:
if b[count]%2==1:
exist_odd=True
break
else:
b[count]=b[count]//2
count+=1
if exist_odd:
break
else:
counter+=1
print(counter)
| 15 | 19 | 287 | 309 | ##いろいろやってみよう
import functools
def mod(a, b):
c = a % b
return c
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
count = 0
for j in range(len(bin(max(A))) - 2):
if 1 in list(map(functools.partial(mod, b=2), A)):
break
else:
A = [A[i] // 2 for i in range(N)]
coun... | a = int(eval(input()))
b = list(map(int, input().split()))
counter = 0
exist_odd = False
while True:
count = 0
while count <= a - 1:
if b[count] % 2 == 1:
exist_odd = True
break
else:
b[count] = b[count] // 2
count += 1
if exist_odd:
br... | false | 21.052632 | [
"-##いろいろやってみよう",
"-import functools",
"-",
"-",
"-def mod(a, b):",
"- c = a % b",
"- return c",
"-",
"-",
"-N = int(eval(input()))",
"-(*A,) = list(map(int, input().split()))",
"-count = 0",
"-for j in range(len(bin(max(A))) - 2):",
"- if 1 in list(map(functools.partial(mod, b=2),... | false | 0.042406 | 0.093289 | 0.454569 | [
"s839051500",
"s390642426"
] |
u098012509 | p03438 | python | s435136691 | s348228320 | 41 | 37 | 10,480 | 10,484 | Accepted | Accepted | 9.76 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def ceil(x, y):
return -(-x // y)
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
sa = sum(B) - sum(A)
x = 0
y = 0
for i in rang... | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
acnt = 0
bcnt = 0
for i in range(N):
if A[i] == B[i]:
continue
e... | 36 | 33 | 608 | 585 | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def ceil(x, y):
return -(-x // y)
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
sa = sum(B) - sum(A)
x = 0
y = 0
for i in range(N):
if A[i] == ... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
def main():
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
acnt = 0
bcnt = 0
for i in range(N):
if A[i] == B[i]:
continue
elif A[i] > B[i]:
... | false | 8.333333 | [
"-def ceil(x, y):",
"- return -(-x // y)",
"-",
"-",
"- sa = sum(B) - sum(A)",
"- x = 0",
"- y = 0",
"+ acnt = 0",
"+ bcnt = 0",
"- x += A[i] - B[i]",
"+ bcnt += A[i] - B[i]",
"- y += ceil(B[i] - A[i], 2)",
"- if x <= sa and y <= sa:",
... | false | 0.115409 | 0.047481 | 2.43064 | [
"s435136691",
"s348228320"
] |
u875291233 | p03164 | python | s365840601 | s934322677 | 397 | 328 | 45,916 | 68,172 | Accepted | Accepted | 17.38 | # coding: utf-8
# Your code here!
n,W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行
V=10**5
MAX=10**12
dp = [MAX]*(V+1)
dp[0]=0
newdp = [MAX]*(V+1)
for i in range(n):
w, v = wv[i]
for j in range(V+1):
newdp[j] = dp[j]
for j in ran... | # coding: utf-8
# Your code here!
n,W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行
V=10**5
MAX=10**12
dp = [MAX]*(V+1)
dp[0]=0
newdp = [MAX]*(V+1)
for i in range(n):
w, v = wv[i]
newdp = dp[:]
for j in range(V+1):
if j+v <= V:
... | 23 | 23 | 516 | 486 | # coding: utf-8
# Your code here!
n, W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行
V = 10**5
MAX = 10**12
dp = [MAX] * (V + 1)
dp[0] = 0
newdp = [MAX] * (V + 1)
for i in range(n):
w, v = wv[i]
for j in range(V + 1):
newdp[j] = dp[j]
for j i... | # coding: utf-8
# Your code here!
n, W = [int(i) for i in input().split()]
wv = [[int(i) for i in input().split()] for j in range(n)] # 縦「n」行
V = 10**5
MAX = 10**12
dp = [MAX] * (V + 1)
dp[0] = 0
newdp = [MAX] * (V + 1)
for i in range(n):
w, v = wv[i]
newdp = dp[:]
for j in range(V + 1):
if j + v <... | false | 0 | [
"- for j in range(V + 1):",
"- newdp[j] = dp[j]",
"+ newdp = dp[:]"
] | false | 0.634331 | 1.296324 | 0.489331 | [
"s365840601",
"s934322677"
] |
u102461423 | p02983 | python | s612266605 | s314039878 | 218 | 152 | 76,128 | 15,828 | Accepted | Accepted | 30.28 | import numpy as np
L,R = (int(x) for x in input().split())
if R - L > 3000:
print((0))
exit()
x = np.arange(L,R+1,dtype=np.int64)
y = x[:,None] * x[None,:] % 2019
for i in range(len(x)):
y[i,i] = 3000
answer = y.min()
print(answer) | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
L,R = list(map(int,read().split()))
if R-L > 1000:
print((0))
exit()
x = np.arange(L,R+1)
x = x[:,None] * x[None,:] % 2019
np.fill_diagonal(x,2019)
answer = x.... | 13 | 17 | 251 | 332 | import numpy as np
L, R = (int(x) for x in input().split())
if R - L > 3000:
print((0))
exit()
x = np.arange(L, R + 1, dtype=np.int64)
y = x[:, None] * x[None, :] % 2019
for i in range(len(x)):
y[i, i] = 3000
answer = y.min()
print(answer)
| import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
L, R = list(map(int, read().split()))
if R - L > 1000:
print((0))
exit()
x = np.arange(L, R + 1)
x = x[:, None] * x[None, :] % 2019
np.fill_diagonal(x, 2019)
answer = x.min()
... | false | 23.529412 | [
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"-L, R = (int(x) for x in input().split())",
"-if R - L > 3000:",
"+L, R = list(map(int, read().split()))",
"+if R - L > 1000:",
"-x = np.arange(L, R + 1, dtype=... | false | 0.590056 | 0.286923 | 2.056498 | [
"s612266605",
"s314039878"
] |
u814781830 | p02866 | python | s724424675 | s290450431 | 121 | 104 | 19,936 | 14,780 | Accepted | Accepted | 14.05 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
MOD = 998244353
def calc():
if D[0] != 0:
return 0
if sum(D) < N-1:
return 0
c = Counter(D)
ret = 1
tmpkey = 0
tmpvalue = 0
for key in sorted(c.keys()):
if... | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
MOD = 998244353
# 厳密にはmax(D)+1の長さがあれば正常系は通るが、余分に取っておく
count = [0] * N
for d in D:
count[d] += 1
def calc():
if D[0] != 0:
return 0
ret = 1
for i in range(N):
if i == 0:
... | 29 | 24 | 601 | 483 | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
MOD = 998244353
def calc():
if D[0] != 0:
return 0
if sum(D) < N - 1:
return 0
c = Counter(D)
ret = 1
tmpkey = 0
tmpvalue = 0
for key in sorted(c.keys()):
if key - tmpkey >= ... | from collections import Counter
N = int(eval(input()))
D = list(map(int, input().split()))
MOD = 998244353
# 厳密にはmax(D)+1の長さがあれば正常系は通るが、余分に取っておく
count = [0] * N
for d in D:
count[d] += 1
def calc():
if D[0] != 0:
return 0
ret = 1
for i in range(N):
if i == 0:
if count[i] >... | false | 17.241379 | [
"+# 厳密にはmax(D)+1の長さがあれば正常系は通るが、余分に取っておく",
"+count = [0] * N",
"+for d in D:",
"+ count[d] += 1",
"- if sum(D) < N - 1:",
"- return 0",
"- c = Counter(D)",
"- tmpkey = 0",
"- tmpvalue = 0",
"- for key in sorted(c.keys()):",
"- if key - tmpkey >= 2:",
"- ... | false | 0.121132 | 0.008668 | 13.97391 | [
"s724424675",
"s290450431"
] |
u905203728 | p02861 | python | s968553772 | s323255524 | 479 | 216 | 3,188 | 41,196 | Accepted | Accepted | 54.91 | from itertools import permutations
from math import factorial
n=int(eval(input()))
A=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in permutations(A,n):
for j in range(1,n):
cnt +=((i[j-1][0]-i[j][0])**2+(i[j-1][1]-i[j][1])**2)**0.5
print((cnt/factorial(n))) | from itertools import permutations
from math import factorial
n=int(eval(input()))
XY=[list(map(int,input().split())) for _ in range(n)]
ans=0
for A in permutations(XY,n):
cnt=0
for j in range(n-1):
cnt +=((A[j][0]-A[j+1][0])**2+(A[j][1]-A[j+1][1])**2)**0.5
ans +=cnt
print((ans/factorial... | 10 | 12 | 289 | 317 | from itertools import permutations
from math import factorial
n = int(eval(input()))
A = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in permutations(A, n):
for j in range(1, n):
cnt += ((i[j - 1][0] - i[j][0]) ** 2 + (i[j - 1][1] - i[j][1]) ** 2) ** 0.5
print((cnt / factorial(n)))
| from itertools import permutations
from math import factorial
n = int(eval(input()))
XY = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for A in permutations(XY, n):
cnt = 0
for j in range(n - 1):
cnt += ((A[j][0] - A[j + 1][0]) ** 2 + (A[j][1] - A[j + 1][1]) ** 2) ** 0.5
ans += cnt
p... | false | 16.666667 | [
"-A = [list(map(int, input().split())) for i in range(n)]",
"-cnt = 0",
"-for i in permutations(A, n):",
"- for j in range(1, n):",
"- cnt += ((i[j - 1][0] - i[j][0]) ** 2 + (i[j - 1][1] - i[j][1]) ** 2) ** 0.5",
"-print((cnt / factorial(n)))",
"+XY = [list(map(int, input().split())) for _ in ... | false | 0.03567 | 0.034758 | 1.026224 | [
"s968553772",
"s323255524"
] |
u745087332 | p03244 | python | s287629368 | s549458288 | 1,019 | 90 | 32,156 | 17,428 | Accepted | Accepted | 91.17 | # coding:utf-8
import numpy as np
INF = float('inf')
def inpl(): return list(map(int, input().split()))
N = int(eval(input()))
V = inpl()
A = [0 for _ in range(10**5+1)]
for i in range(0, N, 2):
A[V[i]] += 1
B = [0 for _ in range(10**5+1)]
for i in range(1, N, 2):
B[V[i]] += 1
A ... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))
def solve(N, V):
v_even = [V[i] for i in range(0, N, 2)]
v_odd = [V[i] for i in range(1, N, 2)]
# 出現回数の多い上位2つの要素と出現回数を取得
v_even_most = Counter(... | 36 | 38 | 548 | 954 | # coding:utf-8
import numpy as np
INF = float("inf")
def inpl():
return list(map(int, input().split()))
N = int(eval(input()))
V = inpl()
A = [0 for _ in range(10**5 + 1)]
for i in range(0, N, 2):
A[V[i]] += 1
B = [0 for _ in range(10**5 + 1)]
for i in range(1, N, 2):
B[V[i]] += 1
A = np.array(A)
B = n... | # coding:utf-8
import sys
from collections import Counter
input = sys.stdin.readline
def inpl():
return list(map(int, input().split()))
def solve(N, V):
v_even = [V[i] for i in range(0, N, 2)]
v_odd = [V[i] for i in range(1, N, 2)]
# 出現回数の多い上位2つの要素と出現回数を取得
v_even_most = Counter(v_even).most_com... | false | 5.263158 | [
"-import numpy as np",
"+import sys",
"+from collections import Counter",
"-INF = float(\"inf\")",
"+input = sys.stdin.readline",
"+def solve(N, V):",
"+ v_even = [V[i] for i in range(0, N, 2)]",
"+ v_odd = [V[i] for i in range(1, N, 2)]",
"+ # 出現回数の多い上位2つの要素と出現回数を取得",
"+ v_even_most =... | false | 0.355807 | 0.0464 | 7.668297 | [
"s287629368",
"s549458288"
] |
u179070318 | p02398 | python | s122963362 | s460779053 | 70 | 20 | 5,716 | 5,604 | Accepted | Accepted | 71.43 | a,b,c = [int(x) for x in input().split( )]
div = []
for x in range(1,c+1):
if c % x == 0:
div.append(x)
r = []
for x in range(a,b+1):
r.append(x)
answer = 0
for x in div:
for y in r:
if x == y:
answer += 1
print(answer)
| a,b,c = [int(x) for x in input().split( )]
count = 0
for number in range(a,b+1):
if c % number == 0:
count += 1
print(count)
| 14 | 6 | 273 | 142 | a, b, c = [int(x) for x in input().split()]
div = []
for x in range(1, c + 1):
if c % x == 0:
div.append(x)
r = []
for x in range(a, b + 1):
r.append(x)
answer = 0
for x in div:
for y in r:
if x == y:
answer += 1
print(answer)
| a, b, c = [int(x) for x in input().split()]
count = 0
for number in range(a, b + 1):
if c % number == 0:
count += 1
print(count)
| false | 57.142857 | [
"-div = []",
"-for x in range(1, c + 1):",
"- if c % x == 0:",
"- div.append(x)",
"-r = []",
"-for x in range(a, b + 1):",
"- r.append(x)",
"-answer = 0",
"-for x in div:",
"- for y in r:",
"- if x == y:",
"- answer += 1",
"-print(answer)",
"+count = 0",
... | false | 0.037168 | 0.079811 | 0.465694 | [
"s122963362",
"s460779053"
] |
u227082700 | p02788 | python | s995268982 | s536050412 | 1,699 | 1,490 | 102,744 | 62,872 | Accepted | Accepted | 12.3 | from bisect import bisect_right
n,d,a=list(map(int,input().split()))
xh=[list(map(int,input().split()))for _ in range(n)]
xh.sort()
x=[]
h=[]
for xx,hh in xh:
x.append(xx)
h.append(hh)
not_imos=[0]*(n+1)
atk_n=0
ans=0
for i in range(n):
atk_n-=not_imos[i]
h[i]-=atk_n*a
if h[i]<0:h[i]=0
atk... | n,d,a=list(map(int,input().split()))
d*=2
xh=[list(map(int,input().split()))for _ in range(n)]
xh.sort()
x=[i for i,j in xh]+[10**20]
h=[j for i,j in xh]
notimos=[0]*(n+1)
c=0
ans=0
from bisect import bisect_right
for i in range(n):
c+=notimos[i]
xx,hh=xh[i]
hh=max(0,hh-c*a)
m=0--hh//a
ans+=m
... | 22 | 19 | 414 | 368 | from bisect import bisect_right
n, d, a = list(map(int, input().split()))
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort()
x = []
h = []
for xx, hh in xh:
x.append(xx)
h.append(hh)
not_imos = [0] * (n + 1)
atk_n = 0
ans = 0
for i in range(n):
atk_n -= not_imos[i]
h[i] -= atk_n * a
... | n, d, a = list(map(int, input().split()))
d *= 2
xh = [list(map(int, input().split())) for _ in range(n)]
xh.sort()
x = [i for i, j in xh] + [10**20]
h = [j for i, j in xh]
notimos = [0] * (n + 1)
c = 0
ans = 0
from bisect import bisect_right
for i in range(n):
c += notimos[i]
xx, hh = xh[i]
hh = max(0, hh... | false | 13.636364 | [
"+n, d, a = list(map(int, input().split()))",
"+d *= 2",
"+xh = [list(map(int, input().split())) for _ in range(n)]",
"+xh.sort()",
"+x = [i for i, j in xh] + [10**20]",
"+h = [j for i, j in xh]",
"+notimos = [0] * (n + 1)",
"+c = 0",
"+ans = 0",
"-n, d, a = list(map(int, input().split()))",
"-x... | false | 0.045307 | 0.045825 | 0.988694 | [
"s995268982",
"s536050412"
] |
u922449550 | p02821 | python | s706848742 | s016056017 | 1,128 | 928 | 14,020 | 16,996 | Accepted | Accepted | 17.73 | import bisect
N, M = list(map(int, input().split()))
Al = list(map(int, input().split()))
Al.sort() # 左手で握手する人のリスト
Ar = Al.copy()[::-1] # 右手で握手する人のリスト
def count_large_2(L1, L2, x):
# L1.sort()
# L2.sort(reverse=True)
N1, N2 = len(L1), len(L2)
i = j = 0
c = 0
while i<N1 and j<N2:
if L1[... | import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# ある値以上のAiがいくつあるかの情報を累積和で保持
num_A_or_more = [0]*(10**5)
for a in A:
num_A_or_more[a-1] += 1
for i in range(1, 10**5):
j = 10**5 - i
num_A_or_more[j-1] += num_A_or_more[j]
# x以上となる手の組み合わせがM種類以上あ... | 58 | 66 | 1,054 | 1,188 | import bisect
N, M = list(map(int, input().split()))
Al = list(map(int, input().split()))
Al.sort() # 左手で握手する人のリスト
Ar = Al.copy()[::-1] # 右手で握手する人のリスト
def count_large_2(L1, L2, x):
# L1.sort()
# L2.sort(reverse=True)
N1, N2 = len(L1), len(L2)
i = j = 0
c = 0
while i < N1 and j < N2:
... | import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
# ある値以上のAiがいくつあるかの情報を累積和で保持
num_A_or_more = [0] * (10**5)
for a in A:
num_A_or_more[a - 1] += 1
for i in range(1, 10**5):
j = 10**5 - i
num_A_or_more[j - 1] += num_A_or_more[j]
# x以上となる手の組み合わせがM種類以上あるかどうかを判定
d... | false | 12.121212 | [
"-Al = list(map(int, input().split()))",
"-Al.sort() # 左手で握手する人のリスト",
"-Ar = Al.copy()[::-1] # 右手で握手する人のリスト",
"+A = list(map(int, input().split()))",
"+A.sort()",
"+# ある値以上のAiがいくつあるかの情報を累積和で保持",
"+num_A_or_more = [0] * (10**5)",
"+for a in A:",
"+ num_A_or_more[a - 1] += 1",
"+for i in range(... | false | 0.047231 | 0.111447 | 0.423793 | [
"s706848742",
"s016056017"
] |
u888092736 | p03487 | python | s142930522 | s537955035 | 84 | 72 | 18,676 | 22,124 | Accepted | Accepted | 14.29 | from collections import Counter
N = int(eval(input()))
cntr = Counter(list(map(int, input().split())))
ans = 0
for k, v in list(cntr.items()):
if k > v:
ans += v
else:
ans += v - k
print(ans)
| from collections import Counter
N, *A = list(map(int, open(0).read().split()))
cnt = Counter(A)
ans = 0
for k, v in list(cnt.items()):
if k > v:
ans += v
else:
ans += v - k
print(ans)
| 12 | 11 | 217 | 207 | from collections import Counter
N = int(eval(input()))
cntr = Counter(list(map(int, input().split())))
ans = 0
for k, v in list(cntr.items()):
if k > v:
ans += v
else:
ans += v - k
print(ans)
| from collections import Counter
N, *A = list(map(int, open(0).read().split()))
cnt = Counter(A)
ans = 0
for k, v in list(cnt.items()):
if k > v:
ans += v
else:
ans += v - k
print(ans)
| false | 8.333333 | [
"-N = int(eval(input()))",
"-cntr = Counter(list(map(int, input().split())))",
"+N, *A = list(map(int, open(0).read().split()))",
"+cnt = Counter(A)",
"-for k, v in list(cntr.items()):",
"+for k, v in list(cnt.items()):"
] | false | 0.039267 | 0.047944 | 0.819025 | [
"s142930522",
"s537955035"
] |
u536113865 | p03764 | python | s311705918 | s717957174 | 207 | 132 | 31,040 | 31,168 | Accepted | Accepted | 36.23 | ai = lambda: list(map(int, input().split()))
n,m = ai()
x = ai()
y = ai()
mod = 10**9+7
ans = 0
sx,ssx,sy,ssy = [x[0]], [x[-1]], [y[0]], [y[-1]]
for i in range(1, n):
sx.append(sx[-1] + x[i])
ssx.append(ssx[-1] + x[-i-1])
for i in range(1, m):
sy.append(sy[-1] + y[i])
ssy.append(ssy[-1] ... | ai = lambda: list(map(int, input().split()))
n,m = ai()
x = ai()
y = ai()
mod = 10**9+7
from itertools import accumulate as acc
sx = list(acc(x))
ssx = list(acc(x[::-1]))
sy = list(acc(y))
ssy = list(acc(y[::-1]))
a = sum(ssx[i] - sx[i] for i in range(n)) % mod
b = sum(ssy[i] - sy[i] for i in ran... | 21 | 18 | 461 | 352 | ai = lambda: list(map(int, input().split()))
n, m = ai()
x = ai()
y = ai()
mod = 10**9 + 7
ans = 0
sx, ssx, sy, ssy = [x[0]], [x[-1]], [y[0]], [y[-1]]
for i in range(1, n):
sx.append(sx[-1] + x[i])
ssx.append(ssx[-1] + x[-i - 1])
for i in range(1, m):
sy.append(sy[-1] + y[i])
ssy.append(ssy[-1] + y[-i -... | ai = lambda: list(map(int, input().split()))
n, m = ai()
x = ai()
y = ai()
mod = 10**9 + 7
from itertools import accumulate as acc
sx = list(acc(x))
ssx = list(acc(x[::-1]))
sy = list(acc(y))
ssy = list(acc(y[::-1]))
a = sum(ssx[i] - sx[i] for i in range(n)) % mod
b = sum(ssy[i] - sy[i] for i in range(m)) % mod
print(... | false | 14.285714 | [
"-ans = 0",
"-sx, ssx, sy, ssy = [x[0]], [x[-1]], [y[0]], [y[-1]]",
"-for i in range(1, n):",
"- sx.append(sx[-1] + x[i])",
"- ssx.append(ssx[-1] + x[-i - 1])",
"-for i in range(1, m):",
"- sy.append(sy[-1] + y[i])",
"- ssy.append(ssy[-1] + y[-i - 1])",
"+from itertools import accumulate... | false | 0.048575 | 0.123314 | 0.393916 | [
"s311705918",
"s717957174"
] |
u471078637 | p03163 | python | s719843361 | s001733422 | 651 | 596 | 171,528 | 171,400 | Accepted | Accepted | 8.45 | n,tw = list(map(int, input().split()))
wt = []; val = []
for i in range(n):
a,b = list(map(int, input().split()))
wt.append(a); val.append(b)
dp = [[0 for i in range(tw+1)] for j in range(n+1)]
for i in range(n):
for j in range(1,tw+1):
if j < wt[i]:
dp[i+1][j] = dp[i][j]
... | def ks(n, W, arr):
dp = [[0 for i in range(W+1)] for j in range(n+1)]
for i in range(1,n+1):
for j in range(1,W+1):
if arr[i-1][0] > j:
dp[i][j] = dp[i-1][j]
else:
dp[i][j] = max(dp[i-1][j], dp[i-1][j-arr[i-1][0]]+arr[i-1][1])
return dp... | 13 | 19 | 403 | 575 | n, tw = list(map(int, input().split()))
wt = []
val = []
for i in range(n):
a, b = list(map(int, input().split()))
wt.append(a)
val.append(b)
dp = [[0 for i in range(tw + 1)] for j in range(n + 1)]
for i in range(n):
for j in range(1, tw + 1):
if j < wt[i]:
dp[i + 1][j] = dp[i][j]
... | def ks(n, W, arr):
dp = [[0 for i in range(W + 1)] for j in range(n + 1)]
for i in range(1, n + 1):
for j in range(1, W + 1):
if arr[i - 1][0] > j:
dp[i][j] = dp[i - 1][j]
else:
dp[i][j] = max(
dp[i - 1][j], dp[i - 1][j - arr[i ... | false | 31.578947 | [
"-n, tw = list(map(int, input().split()))",
"-wt = []",
"-val = []",
"-for i in range(n):",
"- a, b = list(map(int, input().split()))",
"- wt.append(a)",
"- val.append(b)",
"-dp = [[0 for i in range(tw + 1)] for j in range(n + 1)]",
"-for i in range(n):",
"- for j in range(1, tw + 1):"... | false | 0.127678 | 0.091289 | 1.39862 | [
"s719843361",
"s001733422"
] |
u832039789 | p03846 | python | s278806225 | s626833995 | 117 | 93 | 14,260 | 14,004 | Accepted | Accepted | 20.51 | import itertools
n = int(eval(input()))
a = list(map(int,input().split()))
g = itertools.groupby(sorted(a))
for i,(k,v) in enumerate(g):
if n%2==1:
f1 = i==0 and k==0 and len(list(v))==1
f2 = i!=0 and k==i*2 and len(list(v))==2
if not (f1 or f2):
print((0))
... | n = int(eval(input()))
a = list(map(int,input().split()))
MOD = 10**9+7
arr = []
if n%2==0:
for i in range(1,n,2):
arr += [i,i]
else:
arr += [0]
for i in range(2,n,2):
arr += [i,i]
if sorted(a)!=sorted(arr):
print((0))
exit()
print((pow(2,n//2,MOD)))
| 16 | 18 | 443 | 297 | import itertools
n = int(eval(input()))
a = list(map(int, input().split()))
g = itertools.groupby(sorted(a))
for i, (k, v) in enumerate(g):
if n % 2 == 1:
f1 = i == 0 and k == 0 and len(list(v)) == 1
f2 = i != 0 and k == i * 2 and len(list(v)) == 2
if not (f1 or f2):
print((0))
... | n = int(eval(input()))
a = list(map(int, input().split()))
MOD = 10**9 + 7
arr = []
if n % 2 == 0:
for i in range(1, n, 2):
arr += [i, i]
else:
arr += [0]
for i in range(2, n, 2):
arr += [i, i]
if sorted(a) != sorted(arr):
print((0))
exit()
print((pow(2, n // 2, MOD)))
| false | 11.111111 | [
"-import itertools",
"-",
"-g = itertools.groupby(sorted(a))",
"-for i, (k, v) in enumerate(g):",
"- if n % 2 == 1:",
"- f1 = i == 0 and k == 0 and len(list(v)) == 1",
"- f2 = i != 0 and k == i * 2 and len(list(v)) == 2",
"- if not (f1 or f2):",
"- print((0))",
"... | false | 0.037385 | 0.079588 | 0.469727 | [
"s278806225",
"s626833995"
] |
u383828019 | p03240 | python | s830595334 | s859692548 | 676 | 37 | 3,956 | 3,064 | Accepted | Accepted | 94.53 | n = int(eval(input()))
points = []
center = True
centercount = 0
centers = []
for i in range(n):
points.append([int(x) for x in input().split()])
if n==1:
print((str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2])))
else:
iterator = 0
while iterator<len(points):
if points[iterator][2]!... | n = int(eval(input()))
points = []
center = True
for i in range(n):
points.append([int(x) for x in input().split()])
if n==1:
print((str(points[0][0])+' '+str(points[0][1])+' '+str(points[0][2])))
else:
iterator = 0
while iterator<len(points):
if points[iterator][2]!=0:
points[iterator], po... | 42 | 31 | 1,085 | 845 | n = int(eval(input()))
points = []
center = True
centercount = 0
centers = []
for i in range(n):
points.append([int(x) for x in input().split()])
if n == 1:
print((str(points[0][0]) + " " + str(points[0][1]) + " " + str(points[0][2])))
else:
iterator = 0
while iterator < len(points):
if points[i... | n = int(eval(input()))
points = []
center = True
for i in range(n):
points.append([int(x) for x in input().split()])
if n == 1:
print((str(points[0][0]) + " " + str(points[0][1]) + " " + str(points[0][2])))
else:
iterator = 0
while iterator < len(points):
if points[iterator][2] != 0:
... | false | 26.190476 | [
"-centercount = 0",
"-centers = []",
"- if (",
"- temph",
"- != abs(points[k][0] - i) + abs(points[k][1] - j) + points[k][2]",
"+ if points[k][2] != max(",
"+ 0, temph - abs(points[k][0] - i) - abs(points[k][1] - j)",... | false | 0.093662 | 0.007299 | 12.83278 | [
"s830595334",
"s859692548"
] |
u197955752 | p02744 | python | s491454822 | s199345990 | 548 | 191 | 166,636 | 22,772 | Accepted | Accepted | 65.15 | from collections import deque
N = int(eval(input()))
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
unvisited = deque(alphabet[0 : N])
visited = deque()
st = deque([["a", visited, unvisited]]) # stack
while len(st) > 0:
str, visited, unvisited = st.popleft()
if str[-1] not in visite... | from collections import deque
N = int(eval(input()))
alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])
while len(st) > 0:
str, visited = st.popleft()
if len(str) == N:
print(str)
else:
# すでに使った文字を使う
for x in alphabet[0 : visited]:
st.appen... | 25 | 19 | 708 | 459 | from collections import deque
N = int(eval(input()))
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
unvisited = deque(alphabet[0:N])
visited = deque()
st = deque([["a", visited, unvisited]]) # stack
while len(st) > 0:
str, visited, unvisited = st.popleft()
if str[-1] not in visited:
vis... | from collections import deque
N = int(eval(input()))
alphabet = "abcdefghij"
visited = 1
st = deque([["a", visited]])
while len(st) > 0:
str, visited = st.popleft()
if len(str) == N:
print(str)
else:
# すでに使った文字を使う
for x in alphabet[0:visited]:
st.append([str + x, visited... | false | 24 | [
"-alphabet = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"]",
"-unvisited = deque(alphabet[0:N])",
"-visited = deque()",
"-st = deque([[\"a\", visited, unvisited]]) # stack",
"+alphabet = \"abcdefghij\"",
"+visited = 1",
"+st = deque([[\"a\", visited]])",
"- str, visited, u... | false | 0.037435 | 0.044733 | 0.83686 | [
"s491454822",
"s199345990"
] |
u604774382 | p02388 | python | s912480254 | s512922599 | 30 | 20 | 6,720 | 4,188 | Accepted | Accepted | 33.33 | #coding:utf-8
x=int( eval(input()) )
x=x**3
print(x) | import sys
x = int( sys.stdin.readline() )
print(( "{}".format( x**3 ) )) | 4 | 4 | 49 | 75 | # coding:utf-8
x = int(eval(input()))
x = x**3
print(x)
| import sys
x = int(sys.stdin.readline())
print(("{}".format(x**3)))
| false | 0 | [
"-# coding:utf-8",
"-x = int(eval(input()))",
"-x = x**3",
"-print(x)",
"+import sys",
"+",
"+x = int(sys.stdin.readline())",
"+print((\"{}\".format(x**3)))"
] | false | 0.036949 | 0.042634 | 0.866658 | [
"s912480254",
"s512922599"
] |
u379142263 | p02630 | python | s116784781 | s531500487 | 503 | 443 | 21,336 | 21,416 | Accepted | Accepted | 11.93 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
if __name__ == "__main__":
n = int(eval(input()))
a = list(map(int,input().split()))
q = int(eval(input()))
cnt = [0]*(10**5+7)
... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
q = int(eval(input()))
cnt = [0]*(10**5+7)
for i in rang... | 24 | 27 | 565 | 594 | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify, heappop, heappush, heappushpop
import math
import collections
import copy
if __name__ == "__main__":
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
cnt = [0] * (10**5 + 7)
fo... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify, heappop, heappush, heappushpop
import math
import collections
import copy
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
cnt = [0] * (10**5 + 7)
for i in range(n... | false | 11.111111 | [
"-if __name__ == \"__main__\":",
"+",
"+def main():",
"- ruiseki = sum(a)",
"+ p = sum(a)",
"- e = d * (c - b)",
"+ e = cnt[c]",
"+ diff = d * (c - b)",
"+ p += diff",
"- ruiseki += e",
"- print(ruiseki)",
"+ print(p)",
"+",
"+",
"+i... | false | 0.046985 | 0.049523 | 0.948752 | [
"s116784781",
"s531500487"
] |
u432780056 | p03212 | python | s072031527 | s393865631 | 65 | 50 | 6,256 | 6,384 | Accepted | Accepted | 23.08 | UP = int(1e9)
s = set()
full = set('357')
def dfs(n):
if n > UP:
return
if set(str(n)) == full:
s.add(n)
dfs(n * 10 + 3)
dfs(n * 10 + 5)
dfs(n * 10 + 7)
dfs(0)
l = list(s)
l.sort()
n = int(eval(input()))
ans = 0
for i in l:
if i <= n:
ans += 1
... | UP = int(1e9)
s = set()
def dfs(n, f3, f5, f7):
if n > UP:
return
if f3 and f5 and f7:
s.add(n)
dfs(n * 10 + 3, True, f5, f7)
dfs(n * 10 + 5, f3, True, f7)
dfs(n * 10 + 7, f3, f5, True)
dfs(0, False, False, False)
l = list(s)
l.sort()
n = int(eval(input()))
ans ... | 26 | 25 | 350 | 403 | UP = int(1e9)
s = set()
full = set("357")
def dfs(n):
if n > UP:
return
if set(str(n)) == full:
s.add(n)
dfs(n * 10 + 3)
dfs(n * 10 + 5)
dfs(n * 10 + 7)
dfs(0)
l = list(s)
l.sort()
n = int(eval(input()))
ans = 0
for i in l:
if i <= n:
ans += 1
else:
break
... | UP = int(1e9)
s = set()
def dfs(n, f3, f5, f7):
if n > UP:
return
if f3 and f5 and f7:
s.add(n)
dfs(n * 10 + 3, True, f5, f7)
dfs(n * 10 + 5, f3, True, f7)
dfs(n * 10 + 7, f3, f5, True)
dfs(0, False, False, False)
l = list(s)
l.sort()
n = int(eval(input()))
ans = 0
for i in l:
... | false | 3.846154 | [
"-full = set(\"357\")",
"-def dfs(n):",
"+def dfs(n, f3, f5, f7):",
"- if set(str(n)) == full:",
"+ if f3 and f5 and f7:",
"- dfs(n * 10 + 3)",
"- dfs(n * 10 + 5)",
"- dfs(n * 10 + 7)",
"+ dfs(n * 10 + 3, True, f5, f7)",
"+ dfs(n * 10 + 5, f3, True, f7)",
"+ dfs(n * 10 + ... | false | 0.124251 | 0.090623 | 1.371078 | [
"s072031527",
"s393865631"
] |
u652656291 | p02861 | python | s285327341 | s179032427 | 21 | 17 | 3,188 | 3,060 | Accepted | Accepted | 19.05 | N=int(eval(input()))
import math
XY=[[int(x) for x in input().rstrip().split()] for i in range(N)]
ans=0
for i in range(N):
for j in range(N):
if i<j:
ans+=math.sqrt((XY[i][0]-XY[j][0])**2+(XY[i][1]-XY[j][1])**2)
bb=1
for i in range(1,N+1):
bb*=i
print((2*ans/N))
| N=int(eval(input()))
import math
XY=[[int(x) for x in input().rstrip().split()] for i in range(N)]
ans=0
for i in range(N):
for j in range(N):
if i<j:
ans+=math.sqrt((XY[i][0]-XY[j][0])**2+(XY[i][1]-XY[j][1])**2)
print((2*ans/N))
| 15 | 13 | 287 | 250 | N = int(eval(input()))
import math
XY = [[int(x) for x in input().rstrip().split()] for i in range(N)]
ans = 0
for i in range(N):
for j in range(N):
if i < j:
ans += math.sqrt((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2)
bb = 1
for i in range(1, N + 1):
bb *= i
print((2 * ans / ... | N = int(eval(input()))
import math
XY = [[int(x) for x in input().rstrip().split()] for i in range(N)]
ans = 0
for i in range(N):
for j in range(N):
if i < j:
ans += math.sqrt((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2)
print((2 * ans / N))
| false | 13.333333 | [
"-bb = 1",
"-for i in range(1, N + 1):",
"- bb *= i"
] | false | 0.044113 | 0.049607 | 0.889243 | [
"s285327341",
"s179032427"
] |
u355371431 | p03107 | python | s423095386 | s478462956 | 178 | 29 | 39,408 | 3,188 | Accepted | Accepted | 83.71 | S = eval(input())
one = 0
zero = 0
for i in S:
if i == "1":
one += 1
else:
zero += 1
print((min(one,zero)*2)) | S = eval(input())
cnt_0 = 0
cnt_1 = 0
for i in S:
if i == "0":
cnt_0 += 1
else:
cnt_1 +=1
print((min(cnt_0,cnt_1)*2)) | 9 | 9 | 133 | 141 | S = eval(input())
one = 0
zero = 0
for i in S:
if i == "1":
one += 1
else:
zero += 1
print((min(one, zero) * 2))
| S = eval(input())
cnt_0 = 0
cnt_1 = 0
for i in S:
if i == "0":
cnt_0 += 1
else:
cnt_1 += 1
print((min(cnt_0, cnt_1) * 2))
| false | 0 | [
"-one = 0",
"-zero = 0",
"+cnt_0 = 0",
"+cnt_1 = 0",
"- if i == \"1\":",
"- one += 1",
"+ if i == \"0\":",
"+ cnt_0 += 1",
"- zero += 1",
"-print((min(one, zero) * 2))",
"+ cnt_1 += 1",
"+print((min(cnt_0, cnt_1) * 2))"
] | false | 0.034505 | 0.034111 | 1.011549 | [
"s423095386",
"s478462956"
] |
u223646582 | p02727 | python | s797064991 | s720150297 | 342 | 254 | 23,456 | 23,200 | Accepted | Accepted | 25.73 | import heapq
X, Y, A, B, C = list(map(int, input().split()))
P = sorted([int(i) for i in input().split()], reverse=True)
Q = sorted([int(i) for i in input().split()], reverse=True)
R = sorted([int(i) for i in input().split()], reverse=True)
hq = P[:X]+Q[:Y]
ans = sum(hq)
heapq.heapify(hq) # リストhqのheap化
i... | X, Y, A, B, C = list(map(int, input().split()))
P = sorted([int(i) for i in input().split()], reverse=True)
Q = sorted([int(i) for i in input().split()], reverse=True)
R = sorted([int(i) for i in input().split()])
S = sorted(P[:X]+Q[:Y]+R, reverse=True)
print((sum(S[:X+Y])))
| 20 | 8 | 508 | 277 | import heapq
X, Y, A, B, C = list(map(int, input().split()))
P = sorted([int(i) for i in input().split()], reverse=True)
Q = sorted([int(i) for i in input().split()], reverse=True)
R = sorted([int(i) for i in input().split()], reverse=True)
hq = P[:X] + Q[:Y]
ans = sum(hq)
heapq.heapify(hq) # リストhqのheap化
i = 0
while ... | X, Y, A, B, C = list(map(int, input().split()))
P = sorted([int(i) for i in input().split()], reverse=True)
Q = sorted([int(i) for i in input().split()], reverse=True)
R = sorted([int(i) for i in input().split()])
S = sorted(P[:X] + Q[:Y] + R, reverse=True)
print((sum(S[: X + Y])))
| false | 60 | [
"-import heapq",
"-",
"-R = sorted([int(i) for i in input().split()], reverse=True)",
"-hq = P[:X] + Q[:Y]",
"-ans = sum(hq)",
"-heapq.heapify(hq) # リストhqのheap化",
"-i = 0",
"-while hq and i < len(R):",
"- t = heapq.heappop(hq) # heap化されたリストhqから最小値を削除&その最小値を出力",
"- if R[i] > t:",
"- ... | false | 0.040864 | 0.040585 | 1.006882 | [
"s797064991",
"s720150297"
] |
u514401521 | p02843 | python | s320049106 | s739301765 | 174 | 17 | 44,784 | 2,940 | Accepted | Accepted | 90.23 | X = int(input())
dp = [False for _ in range(100001)]
dp[0] = True
for i in range(100,106):
dp[i] = True
for i in range(107, X + 1):
if dp[i - 100] == True or dp[i - 101] == True or dp[i - 102] == True\
or dp[i - 103] == True or dp[i - 104] == True or dp[i - 105] == True:
dp[i] = True
... | import sys
x = int(eval(input()))
for i in range(1000):
if 100 * i <= x <= 105 * i:
print("1")
sys.exit(0)
print("0") | 14 | 8 | 372 | 139 | X = int(input())
dp = [False for _ in range(100001)]
dp[0] = True
for i in range(100, 106):
dp[i] = True
for i in range(107, X + 1):
if (
dp[i - 100] == True
or dp[i - 101] == True
or dp[i - 102] == True
or dp[i - 103] == True
or dp[i - 104] == True
or dp[i - 105]... | import sys
x = int(eval(input()))
for i in range(1000):
if 100 * i <= x <= 105 * i:
print("1")
sys.exit(0)
print("0")
| false | 42.857143 | [
"-X = int(input())",
"-dp = [False for _ in range(100001)]",
"-dp[0] = True",
"-for i in range(100, 106):",
"- dp[i] = True",
"-for i in range(107, X + 1):",
"- if (",
"- dp[i - 100] == True",
"- or dp[i - 101] == True",
"- or dp[i - 102] == True",
"- or dp[i - ... | false | 0.039132 | 0.036559 | 1.070388 | [
"s320049106",
"s739301765"
] |
u222668979 | p03283 | python | s976516180 | s097892907 | 618 | 528 | 130,244 | 125,400 | Accepted | Accepted | 14.56 | from copy import deepcopy
n, m, q = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]
cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
cnt[l][r] += 1
acc = deepcopy(cnt)
for i in range(n):
f... | n, m, q = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]
acc = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
acc[l][r] += 1
for i in range(n):
for j in range(n):
tmp = acc[i][j + 1] + acc... | 20 | 16 | 527 | 475 | from copy import deepcopy
n, m, q = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]
cnt = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
cnt[l][r] += 1
acc = deepcopy(cnt)
for i in range(n):
for j in range(... | n, m, q = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]
pq = [list(map(int, input().split())) for _ in range(q)]
acc = [[0] * (n + 1) for _ in range(n + 1)]
for l, r in lr:
acc[l][r] += 1
for i in range(n):
for j in range(n):
tmp = acc[i][j + 1] + acc[i + 1][j]... | false | 20 | [
"-from copy import deepcopy",
"-",
"-cnt = [[0] * (n + 1) for _ in range(n + 1)]",
"+acc = [[0] * (n + 1) for _ in range(n + 1)]",
"- cnt[l][r] += 1",
"-acc = deepcopy(cnt)",
"+ acc[l][r] += 1"
] | false | 0.039869 | 0.036126 | 1.103615 | [
"s976516180",
"s097892907"
] |
u358919705 | p00029 | python | s556061271 | s658873792 | 30 | 20 | 7,356 | 7,252 | Accepted | Accepted | 33.33 | words = input().split(' ')
print((sorted(words, key=words.count)[-1], sorted(words, key=len)[-1])) | words = input().split()
print((max(words, key=words.count), max(words, key=len))) | 2 | 2 | 97 | 80 | words = input().split(" ")
print((sorted(words, key=words.count)[-1], sorted(words, key=len)[-1]))
| words = input().split()
print((max(words, key=words.count), max(words, key=len)))
| false | 0 | [
"-words = input().split(\" \")",
"-print((sorted(words, key=words.count)[-1], sorted(words, key=len)[-1]))",
"+words = input().split()",
"+print((max(words, key=words.count), max(words, key=len)))"
] | false | 0.109378 | 0.040388 | 2.708191 | [
"s556061271",
"s658873792"
] |
u654470292 | p03274 | python | s006723254 | s797202728 | 222 | 114 | 62,576 | 95,840 | Accepted | Accepted | 48.65 | n,k=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=10000000000
j=0
for i in range(n-k+1):
if ans>min(abs(x[i])+abs(x[i+k-1]-x[i]), abs(x[i+k-1])+abs(x[i+k-1]-x[i])):
ans=min(abs(x[i])+abs(x[i+k-1]-x[i]), abs(x[i+k-1])+abs(x[i+k-1]-x[i]))
print(ans) | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 12 | 28 | 290 | 728 | n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = 10000000000
j = 0
for i in range(n - k + 1):
if ans > min(
abs(x[i]) + abs(x[i + k - 1] - x[i]),
abs(x[i + k - 1]) + abs(x[i + k - 1] - x[i]),
):
ans = min(
abs(x[i]) + abs(x[i + k - 1] - x[i]),
... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 57.142857 | [
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+",
"+def ruiseki(lst):",
"+ return... | false | 0.108684 | 0.047434 | 2.291276 | [
"s006723254",
"s797202728"
] |
u933722792 | p03160 | python | s599626809 | s874581065 | 161 | 139 | 20,808 | 20,928 | Accepted | Accepted | 13.66 | import math
N = int(eval(input()))
h = list(map(int, input().split()))
h += [math.inf, math.inf]
dp = list([math.inf for i in range(N + 2)]) # dpテーブル
dp[0] = 0
for i in range(N):
if dp[i + 1] > (dp[i] + abs(h[i] - h[i + 1])):
dp[i + 1] = (dp[i] + abs(h[i] - h[i + 1]))
else:
dp[i +... |
def chmin(a, b): return b if a > b else a
def chmax(a, b): return a if a > b else b
"""もらうDP"""
import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = list([math.inf for i in range(N)]) # dpテーブル
dp[0] = 0
for i in range(N):
dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i... | 19 | 21 | 492 | 419 | import math
N = int(eval(input()))
h = list(map(int, input().split()))
h += [math.inf, math.inf]
dp = list([math.inf for i in range(N + 2)]) # dpテーブル
dp[0] = 0
for i in range(N):
if dp[i + 1] > (dp[i] + abs(h[i] - h[i + 1])):
dp[i + 1] = dp[i] + abs(h[i] - h[i + 1])
else:
dp[i + 1] = dp[i + 1]... | def chmin(a, b):
return b if a > b else a
def chmax(a, b):
return a if a > b else b
"""もらうDP"""
import math
N = int(eval(input()))
h = list(map(int, input().split()))
dp = list([math.inf for i in range(N)]) # dpテーブル
dp[0] = 0
for i in range(N):
dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
... | false | 9.52381 | [
"+def chmin(a, b):",
"+ return b if a > b else a",
"+",
"+",
"+def chmax(a, b):",
"+ return a if a > b else b",
"+",
"+",
"+\"\"\"もらうDP\"\"\"",
"-h += [math.inf, math.inf]",
"-dp = list([math.inf for i in range(N + 2)]) # dpテーブル",
"+dp = list([math.inf for i in range(N)]) # dpテーブル",
... | false | 0.075867 | 0.039419 | 1.92463 | [
"s599626809",
"s874581065"
] |
u450956662 | p02971 | python | s864953901 | s028893481 | 467 | 359 | 15,604 | 19,076 | Accepted | Accepted | 23.13 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_a = max(A)
count = A.count(max_a)
if count > 1:
for n in range(N):
print(max_a)
else:
for n in range(N):
if A[n] == max_a:
print((max(A[:n] + A[n+1:])))
continue
print(max_a) | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A, reverse=True)
for a in A:
if a == B[0]:
print((B[1]))
else:
print((B[0])) | 14 | 8 | 300 | 168 | N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
max_a = max(A)
count = A.count(max_a)
if count > 1:
for n in range(N):
print(max_a)
else:
for n in range(N):
if A[n] == max_a:
print((max(A[:n] + A[n + 1 :])))
continue
print(max_a)
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
B = sorted(A, reverse=True)
for a in A:
if a == B[0]:
print((B[1]))
else:
print((B[0]))
| false | 42.857143 | [
"-max_a = max(A)",
"-count = A.count(max_a)",
"-if count > 1:",
"- for n in range(N):",
"- print(max_a)",
"-else:",
"- for n in range(N):",
"- if A[n] == max_a:",
"- print((max(A[:n] + A[n + 1 :])))",
"- continue",
"- print(max_a)",
"+B = sorted... | false | 0.04185 | 0.007348 | 5.695431 | [
"s864953901",
"s028893481"
] |
u517447467 | p02713 | python | s283990630 | s626499101 | 1,943 | 1,693 | 71,632 | 71,320 | Accepted | Accepted | 12.87 | import math
N = int(eval(input()))
all_gcd = []
for i in range(1, N+1):
for j in range(1, N+1):
x = math.gcd(i, j) if i != j else i
for m in range(1, N+1):
y = math.gcd(x, m) if x != m else x
all_gcd.append(y)
print((sum(all_gcd)))
| import math
N = int(eval(input()))
all_gcd = [math.gcd(math.gcd(i, j), m) for i in range(1, N+1) for j in range(1, N+1) for m in range(1, N+1)]
print((sum(all_gcd)))
| 11 | 4 | 257 | 161 | import math
N = int(eval(input()))
all_gcd = []
for i in range(1, N + 1):
for j in range(1, N + 1):
x = math.gcd(i, j) if i != j else i
for m in range(1, N + 1):
y = math.gcd(x, m) if x != m else x
all_gcd.append(y)
print((sum(all_gcd)))
| import math
N = int(eval(input()))
all_gcd = [
math.gcd(math.gcd(i, j), m)
for i in range(1, N + 1)
for j in range(1, N + 1)
for m in range(1, N + 1)
]
print((sum(all_gcd)))
| false | 63.636364 | [
"-all_gcd = []",
"-for i in range(1, N + 1):",
"- for j in range(1, N + 1):",
"- x = math.gcd(i, j) if i != j else i",
"- for m in range(1, N + 1):",
"- y = math.gcd(x, m) if x != m else x",
"- all_gcd.append(y)",
"+all_gcd = [",
"+ math.gcd(math.gcd(i, j), ... | false | 0.046271 | 0.15196 | 0.304494 | [
"s283990630",
"s626499101"
] |
u188827677 | p02971 | python | s112404899 | s684693573 | 525 | 364 | 13,316 | 18,976 | Accepted | Accepted | 30.67 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
num = sorted(a, reverse=True)[:2]
for i in a:
if i != num[0]:
print((num[0]))
else:
print((num[1])) | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
l = sorted(a, reverse=True)
x = l[0]
y = l[1]
for i in a:
if i != x: print(x)
else: print(y) | 9 | 9 | 170 | 159 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
num = sorted(a, reverse=True)[:2]
for i in a:
if i != num[0]:
print((num[0]))
else:
print((num[1]))
| n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
l = sorted(a, reverse=True)
x = l[0]
y = l[1]
for i in a:
if i != x:
print(x)
else:
print(y)
| false | 0 | [
"-num = sorted(a, reverse=True)[:2]",
"+l = sorted(a, reverse=True)",
"+x = l[0]",
"+y = l[1]",
"- if i != num[0]:",
"- print((num[0]))",
"+ if i != x:",
"+ print(x)",
"- print((num[1]))",
"+ print(y)"
] | false | 0.04129 | 0.036475 | 1.132018 | [
"s112404899",
"s684693573"
] |
u367130284 | p03032 | python | s267922975 | s536409149 | 64 | 59 | 5,356 | 5,200 | Accepted | Accepted | 7.81 | from heapq import*
n,k=list(map(int,input().split()))
*v,=list(map(int,input().split()))
motimono=[]
ans=[]
v*=2
for j in range(1,min(n,k)+1):
for i in range(n-j,n+1):
motimono=v[i:i+j]
ans.append(sum(motimono))
heapify(motimono)
for i in range(k-j):
if len(mo... | n,k,*v=list(map(int,open(0).read().split()))
motimono=[]
ans=[]
v*=2
for j in range(1,min(n,k)+1):
for i in range(n-j,n+1):
motimono=v[i:i+j]
ans.append(sum(motimono))
motimono.sort()
for i in range(k-j):
if len(motimono)>0:
del motimono[0]
... | 16 | 14 | 409 | 365 | from heapq import *
n, k = list(map(int, input().split()))
(*v,) = list(map(int, input().split()))
motimono = []
ans = []
v *= 2
for j in range(1, min(n, k) + 1):
for i in range(n - j, n + 1):
motimono = v[i : i + j]
ans.append(sum(motimono))
heapify(motimono)
for i in range(k - j):... | n, k, *v = list(map(int, open(0).read().split()))
motimono = []
ans = []
v *= 2
for j in range(1, min(n, k) + 1):
for i in range(n - j, n + 1):
motimono = v[i : i + j]
ans.append(sum(motimono))
motimono.sort()
for i in range(k - j):
if len(motimono) > 0:
d... | false | 12.5 | [
"-from heapq import *",
"-",
"-n, k = list(map(int, input().split()))",
"-(*v,) = list(map(int, input().split()))",
"+n, k, *v = list(map(int, open(0).read().split()))",
"- heapify(motimono)",
"+ motimono.sort()",
"- heappop(motimono)",
"+ del motimono[0]"... | false | 0.045189 | 0.007144 | 6.325266 | [
"s267922975",
"s536409149"
] |
u744920373 | p02658 | python | s375510066 | s858587268 | 101 | 63 | 23,392 | 23,516 | Accepted | Accepted | 37.62 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): ret... | 45 | 60 | 1,164 | 1,389 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
de... | false | 25 | [
"+\"\"\"",
"-inf = Decimal(\"1000000000000000000\")",
"+inf = Decimal('1000000000000000000')",
"- print((0))",
"+ print(0)",
"- print((-1))",
"+ print(-1)",
"+\"\"\"",
"+N = ii()",
"+A = li()",
"+if 0 in A:",
"+ print((0))",
"+ exit()",
"+a... | false | 0.087751 | 0.039443 | 2.224755 | [
"s375510066",
"s858587268"
] |
u797673668 | p02246 | python | s583253717 | s776298988 | 11,050 | 10,040 | 163,220 | 163,400 | Accepted | Accepted | 9.14 | from heapq import heappop, heappush
manhattan = [[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)] for i in range(16)]
movables = [{1, 4}, {0, 2, 5}, {1, 3, 6}, {2, 7}, {0, 5, 8}, {1, 4, 6, 9}, {2, 5, 7, 10}, {3, 6, 11},
{4, 9, 12}, {5, 8, 10, 13}, {6, 9, 11, 14}, {7, 10, 15}, {8, ... | from heapq import heappop, heappush
manhattan = [[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)] for i in range(16)]
movables = [{1, 4}, {0, 2, 5}, {1, 3, 6}, {2, 7}, {0, 5, 8}, {1, 4, 6, 9}, {2, 5, 7, 10}, {3, 6, 11},
{4, 9, 12}, {5, 8, 10, 13}, {6, 9, 11, 14}, {7, 10, 15}, {8, ... | 48 | 43 | 1,667 | 1,545 | from heapq import heappop, heappush
manhattan = [
[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)]
for i in range(16)
]
movables = [
{1, 4},
{0, 2, 5},
{1, 3, 6},
{2, 7},
{0, 5, 8},
{1, 4, 6, 9},
{2, 5, 7, 10},
{3, 6, 11},
{4, 9, 12},
{5, 8, 10, 13}... | from heapq import heappop, heappush
manhattan = [
[abs((i % 4) - (j % 4)) + abs((i // 4) - (j // 4)) for j in range(16)]
for i in range(16)
]
movables = [
{1, 4},
{0, 2, 5},
{1, 3, 6},
{2, 7},
{0, 5, 8},
{1, 4, 6, 9},
{2, 5, 7, 10},
{3, 6, 11},
{4, 9, 12},
{5, 8, 10, 13}... | false | 10.416667 | [
"-swap_cache = [",
"- [(1 << mf) - (1 << mt) for mt in range(0, 64, 4)] for mf in range(0, 64, 4)",
"-]",
"+swap_mul = [[(1 << mf) - (1 << mt) for mt in range(0, 64, 4)] for mf in range(0, 64, 4)]",
"-",
"-",
"-def swap(board, move_from, move_to):",
"- return board + swap_cache[move_from][move_t... | false | 0.040858 | 0.042892 | 0.952563 | [
"s583253717",
"s776298988"
] |
u368249389 | p02725 | python | s868746642 | s168251419 | 286 | 262 | 78,796 | 77,388 | Accepted | Accepted | 8.39 | # Problem C - Traveling Salesman around Lake
K, N = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
min_cost = 10**8
a_len = len(a_list)
for i in range(len(a_list)):
a = a_list[i]
ushiro_i = 0
mae_i = 0
# 1つ後ろを取る
if i-1<0:
ushiro_i ... | # Problem C - Traveling Salesman around Lake
# input
K, N = list(map(int, input().split()))
A_list = list(map(int, input().split()))
list_len = len(A_list)
# initialization
min_ans = 10**18
# search
for i in range(list_len):
mae_i = 0
if i==list_len-1:
mae_i = 0
else:
mae_... | 41 | 27 | 902 | 552 | # Problem C - Traveling Salesman around Lake
K, N = list(map(int, input().split()))
a_list = list(map(int, input().split()))
# initialization
min_cost = 10**8
a_len = len(a_list)
for i in range(len(a_list)):
a = a_list[i]
ushiro_i = 0
mae_i = 0
# 1つ後ろを取る
if i - 1 < 0:
ushiro_i = a_len - 1
... | # Problem C - Traveling Salesman around Lake
# input
K, N = list(map(int, input().split()))
A_list = list(map(int, input().split()))
list_len = len(A_list)
# initialization
min_ans = 10**18
# search
for i in range(list_len):
mae_i = 0
if i == list_len - 1:
mae_i = 0
else:
mae_i = i + 1
k... | false | 34.146341 | [
"+# input",
"-a_list = list(map(int, input().split()))",
"+A_list = list(map(int, input().split()))",
"+list_len = len(A_list)",
"-min_cost = 10**8",
"-a_len = len(a_list)",
"-for i in range(len(a_list)):",
"- a = a_list[i]",
"- ushiro_i = 0",
"+min_ans = 10**18",
"+# search",
"+for i in... | false | 0.043882 | 0.069582 | 0.630645 | [
"s868746642",
"s168251419"
] |
u394950523 | p02784 | python | s723669852 | s878861742 | 49 | 41 | 13,960 | 13,964 | Accepted | Accepted | 16.33 | H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
T = 0
for a in A: #for i in A だとAの要素を繰り返す
T += a
if T >= H:
print("Yes")
else:
print("No") | H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
if sum(A) >= H:
print("Yes")
else:
print("No") | 10 | 7 | 187 | 136 | H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
T = 0
for a in A: # for i in A だとAの要素を繰り返す
T += a
if T >= H:
print("Yes")
else:
print("No")
| H, N = list(map(int, input().split()))
A = list(map(int, input().split()))
if sum(A) >= H:
print("Yes")
else:
print("No")
| false | 30 | [
"-T = 0",
"-for a in A: # for i in A だとAの要素を繰り返す",
"- T += a",
"-if T >= H:",
"+if sum(A) >= H:"
] | false | 0.038525 | 0.042739 | 0.901404 | [
"s723669852",
"s878861742"
] |
u766684188 | p02793 | python | s264430969 | s182469184 | 1,090 | 359 | 71,896 | 44,912 | Accepted | Accepted | 67.06 | def gcd(x,y):
if x<y:
x,y=y,x
if y==0:
return x
return gcd(y,x%y)
def lcm(x,y):
return x*y//gcd(x,y)
def modinv(k,mod):
return pow(k,mod-2,mod)
def main():
mod=1000000007
n=int(eval(input()))
A=tuple(map(int,input().split()))
l=1
for a in A:
... | from collections import defaultdict
def lcm_dict(A):
pf_d=defaultdict(int)
for num in A:
for k in range(2,int(num**0.5)+1):
cnt=0
while num%k==0:
cnt+=1
num//=k
if cnt:
pf_d[k]=max(pf_d[k],cnt)
if nu... | 27 | 37 | 476 | 783 | def gcd(x, y):
if x < y:
x, y = y, x
if y == 0:
return x
return gcd(y, x % y)
def lcm(x, y):
return x * y // gcd(x, y)
def modinv(k, mod):
return pow(k, mod - 2, mod)
def main():
mod = 1000000007
n = int(eval(input()))
A = tuple(map(int, input().split()))
l = 1
... | from collections import defaultdict
def lcm_dict(A):
pf_d = defaultdict(int)
for num in A:
for k in range(2, int(num**0.5) + 1):
cnt = 0
while num % k == 0:
cnt += 1
num //= k
if cnt:
pf_d[k] = max(pf_d[k], cnt)
... | false | 27.027027 | [
"-def gcd(x, y):",
"- if x < y:",
"- x, y = y, x",
"- if y == 0:",
"- return x",
"- return gcd(y, x % y)",
"+from collections import defaultdict",
"-def lcm(x, y):",
"- return x * y // gcd(x, y)",
"+def lcm_dict(A):",
"+ pf_d = defaultdict(int)",
"+ for num in A... | false | 0.0797 | 0.063789 | 1.249443 | [
"s264430969",
"s182469184"
] |
u644907318 | p02881 | python | s200354451 | s432220942 | 190 | 78 | 40,300 | 64,092 | Accepted | Accepted | 58.95 | N=int(eval(input()))
dmin = 10**12+10
for i in range(1,int(N**0.5)+1):
if N%i==0:
n = N//i
dmin = min(dmin,i-1+n-1)
print(dmin) | N = int(eval(input()))
dmin = N+N
for i in range(1,int(N**0.5)+1):
if N%i==0:
dmin = min(dmin,i+N//i-2)
print(dmin) | 7 | 6 | 147 | 126 | N = int(eval(input()))
dmin = 10**12 + 10
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
n = N // i
dmin = min(dmin, i - 1 + n - 1)
print(dmin)
| N = int(eval(input()))
dmin = N + N
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
dmin = min(dmin, i + N // i - 2)
print(dmin)
| false | 14.285714 | [
"-dmin = 10**12 + 10",
"+dmin = N + N",
"- n = N // i",
"- dmin = min(dmin, i - 1 + n - 1)",
"+ dmin = min(dmin, i + N // i - 2)"
] | false | 0.04486 | 0.036861 | 1.217011 | [
"s200354451",
"s432220942"
] |
u105124953 | p02854 | python | s748267282 | s286781940 | 317 | 290 | 100,300 | 96,972 | Accepted | Accepted | 8.52 | n = int(eval(input()))
li = list(map(int,input().split()))
s = sum(li)
sum_li = []
for i,l in enumerate(li):
if i == 0:
sum_li.append(l)
continue
sum_li.append(sum_li[-1]+l)
all_li = []
for ii,ss in enumerate(sum_li):
if ii == len(sum_li)-1:
break
all_li.append(abs(s... | n = int(eval(input()))
li = list(map(int,input().split()))
s = sum(li)
sum_li = []
left = 0
right = s
for i,l in enumerate(li):
if i == len(li)-1:
break
left += l
right -= l
sum_li.append(abs(left-right))
print((min(sum_li))) | 16 | 13 | 357 | 253 | n = int(eval(input()))
li = list(map(int, input().split()))
s = sum(li)
sum_li = []
for i, l in enumerate(li):
if i == 0:
sum_li.append(l)
continue
sum_li.append(sum_li[-1] + l)
all_li = []
for ii, ss in enumerate(sum_li):
if ii == len(sum_li) - 1:
break
all_li.append(abs(s - 2 *... | n = int(eval(input()))
li = list(map(int, input().split()))
s = sum(li)
sum_li = []
left = 0
right = s
for i, l in enumerate(li):
if i == len(li) - 1:
break
left += l
right -= l
sum_li.append(abs(left - right))
print((min(sum_li)))
| false | 18.75 | [
"+left = 0",
"+right = s",
"- if i == 0:",
"- sum_li.append(l)",
"- continue",
"- sum_li.append(sum_li[-1] + l)",
"-all_li = []",
"-for ii, ss in enumerate(sum_li):",
"- if ii == len(sum_li) - 1:",
"+ if i == len(li) - 1:",
"- all_li.append(abs(s - 2 * ss))",
"-# p... | false | 0.048964 | 0.147683 | 0.33155 | [
"s748267282",
"s286781940"
] |
u983918956 | p03213 | python | s682366019 | s440375774 | 22 | 18 | 3,436 | 3,064 | Accepted | Accepted | 18.18 | # 因数を昇順に全列挙
from collections import Counter
import math
def com(n,r):
return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))
fac_list = []
def factoring(n):
for i in range(2,n+1):
if n % i == 0:
fac_list.append(i)
n = n // i
break
if n =... | def factoring(n):
for i in range(2, n+1):
while n % i == 0:
n //= i
d[i] += 1
N = int(eval(input()))
d = [0]*(N+1)
for n in range(2,N+1):
factoring(n)
def num(n):
return len([e for e in d if e >= n])
ans = num(74) + num(14)*(num(4)-1) + num(24)*(num(2)-1)... | 51 | 18 | 1,171 | 360 | # 因数を昇順に全列挙
from collections import Counter
import math
def com(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
fac_list = []
def factoring(n):
for i in range(2, n + 1):
if n % i == 0:
fac_list.append(i)
n = n // i
break
if n =... | def factoring(n):
for i in range(2, n + 1):
while n % i == 0:
n //= i
d[i] += 1
N = int(eval(input()))
d = [0] * (N + 1)
for n in range(2, N + 1):
factoring(n)
def num(n):
return len([e for e in d if e >= n])
ans = (
num(74)
+ num(14) * (num(4) - 1)
+ num(24... | false | 64.705882 | [
"-# 因数を昇順に全列挙",
"-from collections import Counter",
"-import math",
"+def factoring(n):",
"+ for i in range(2, n + 1):",
"+ while n % i == 0:",
"+ n //= i",
"+ d[i] += 1",
"-def com(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r... | false | 0.047224 | 0.046737 | 1.010413 | [
"s682366019",
"s440375774"
] |
u069838609 | p03222 | python | s762886147 | s449551880 | 280 | 53 | 19,664 | 3,064 | Accepted | Accepted | 81.07 | import numpy as np
MOD = 10**9 + 7
def powmod(mat, n, mod):
result = np.eye(len(mat), dtype=np.int64)
while n > 0:
if n & 1:
result = np.dot(result, mat) % mod
mat = np.dot(mat, mat) % mod
n >>= 1
return result
H, W, K = [int(elem) for elem in input().sp... | # time complexity: O(HW2^W)
# space complexity: O(HW)
def violates(w_flags):
prev_flag = w_flags & 1
for shift in range(1, W - 1):
flag = w_flags >> shift & 1
if flag and prev_flag:
return True
prev_flag = flag
return False
H, W, K = [int(elem) for elem in... | 47 | 48 | 1,297 | 1,297 | import numpy as np
MOD = 10**9 + 7
def powmod(mat, n, mod):
result = np.eye(len(mat), dtype=np.int64)
while n > 0:
if n & 1:
result = np.dot(result, mat) % mod
mat = np.dot(mat, mat) % mod
n >>= 1
return result
H, W, K = [int(elem) for elem in input().split()]
trans_... | # time complexity: O(HW2^W)
# space complexity: O(HW)
def violates(w_flags):
prev_flag = w_flags & 1
for shift in range(1, W - 1):
flag = w_flags >> shift & 1
if flag and prev_flag:
return True
prev_flag = flag
return False
H, W, K = [int(elem) for elem in input().split... | false | 2.083333 | [
"-import numpy as np",
"-",
"-MOD = 10**9 + 7",
"-",
"-",
"-def powmod(mat, n, mod):",
"- result = np.eye(len(mat), dtype=np.int64)",
"- while n > 0:",
"- if n & 1:",
"- result = np.dot(result, mat) % mod",
"- mat = np.dot(mat, mat) % mod",
"- n >>= 1",
... | false | 0.412008 | 0.045719 | 9.011726 | [
"s762886147",
"s449551880"
] |
u493520238 | p03045 | python | s414588534 | s538212472 | 468 | 314 | 7,860 | 81,840 | Accepted | Accepted | 32.91 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | 60 | 62 | 1,440 | 1,463 | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = se... | false | 3.225806 | [
"- N, M = list(map(int, input().split()))",
"- uf = UnionFind(N)",
"- for _ in range(M):",
"+ n, m = list(map(int, input().split()))",
"+ uf = UnionFind(n)",
"+ for _ in range(m):",
"+ # if z%2 == 0:"
] | false | 0.103179 | 0.135764 | 0.75999 | [
"s414588534",
"s538212472"
] |
u102461423 | p02680 | python | s544218306 | s231927059 | 643 | 376 | 150,860 | 86,164 | Accepted | Accepted | 41.52 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([A, B, D, [... | 108 | 107 | 2,620 | 2,596 | import sys
import numpy as np
from numba import njit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([... | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10**9 + 1
def precompute(N, M, data):
data = data.reshape(-1, 3)
A, B, C = data[:N].T
D, E, F = data[N:].T
X = np.unique(np.concatenate([A, B, D, [0, -INF, INF]... | false | 0.925926 | [
"-from numba import njit"
] | false | 0.215703 | 0.220755 | 0.977117 | [
"s544218306",
"s231927059"
] |
u298297089 | p03546 | python | s445946481 | s796870291 | 39 | 34 | 3,564 | 3,564 | Accepted | Accepted | 12.82 | # https://atcoder.jp/contests/abc079/tasks/abc079_d
from collections import Counter
from functools import reduce
def warshall(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
if d[i][k] + d[k][j] < d[i][j]:
d[i][j] = d[i][k] + d[k][j... | # https://atcoder.jp/contests/abc079/tasks/abc079_d
from collections import Counter
from functools import reduce
def warshall(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
if d[i][k] + d[k][j] < d[i][j]:
d[i][j] = d[i][k] + d[k][j... | 30 | 22 | 835 | 646 | # https://atcoder.jp/contests/abc079/tasks/abc079_d
from collections import Counter
from functools import reduce
def warshall(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
if d[i][k] + d[k][j] < d[i][j]:
d[i][j] = d[i][k] + d[k][j]
h, w =... | # https://atcoder.jp/contests/abc079/tasks/abc079_d
from collections import Counter
from functools import reduce
def warshall(d, n):
for k in range(n):
for i in range(n):
for j in range(n):
if d[i][k] + d[k][j] < d[i][j]:
d[i][j] = d[i][k] + d[k][j]
h, w =... | false | 26.666667 | [
"-counter = {i: 0 for i in range(10)}",
"+counter = Counter()",
"- for a in map(int, input().split()):",
"- if a > -1:",
"- counter[a] += 1",
"- # counter.update(Counter(map(int, input().split())))",
"+ counter.update(Counter(list(map(int, input().split()))))",
"-ans = 0",
... | false | 0.042094 | 0.039807 | 1.057447 | [
"s445946481",
"s796870291"
] |
u513081876 | p03659 | python | s133336120 | s823928344 | 226 | 174 | 24,832 | 31,348 | Accepted | Accepted | 23.01 | N = int(eval(input()))
a = [int(i) for i in input().split()]
sunuke = 0
arai = sum(a)
ans = float('inf')
for i in range(N-1):
sunuke += a[i]
arai -= a[i]
ans = min(ans, abs(arai-sunuke))
print(ans) | N = int(eval(input()))
a = [int(i) for i in input().split()]
sunuke = a[0]
arai = sum(a[1:])
if N == 2:
print((abs(a[0] - a[1])))
else:
ans = float('inf')
for i in range(1, N-1):
sunuke += a[i]
arai -= a[i]
ans = min(ans, abs(sunuke - arai))
print(ans) | 13 | 14 | 218 | 298 | N = int(eval(input()))
a = [int(i) for i in input().split()]
sunuke = 0
arai = sum(a)
ans = float("inf")
for i in range(N - 1):
sunuke += a[i]
arai -= a[i]
ans = min(ans, abs(arai - sunuke))
print(ans)
| N = int(eval(input()))
a = [int(i) for i in input().split()]
sunuke = a[0]
arai = sum(a[1:])
if N == 2:
print((abs(a[0] - a[1])))
else:
ans = float("inf")
for i in range(1, N - 1):
sunuke += a[i]
arai -= a[i]
ans = min(ans, abs(sunuke - arai))
print(ans)
| false | 7.142857 | [
"-sunuke = 0",
"-arai = sum(a)",
"-ans = float(\"inf\")",
"-for i in range(N - 1):",
"- sunuke += a[i]",
"- arai -= a[i]",
"- ans = min(ans, abs(arai - sunuke))",
"-print(ans)",
"+sunuke = a[0]",
"+arai = sum(a[1:])",
"+if N == 2:",
"+ print((abs(a[0] - a[1])))",
"+else:",
"+ ... | false | 0.038151 | 0.035667 | 1.069646 | [
"s133336120",
"s823928344"
] |
u022407960 | p02273 | python | s708121588 | s226303267 | 40 | 30 | 8,100 | 8,104 | Accepted | Accepted | 25 | # encoding: utf-8
import sys
import math
_input = sys.stdin.readlines()
depth = int(_input[0])
sin_60, cos_60 = math.sin(math.pi / 3), math.cos(math.pi / 3)
class Point(object):
def __init__(self, x=0.0, y=0.0):
"""
initialize the point
"""
self.x = float(x)
... | # encoding: utf-8
import sys
import math
_input = sys.stdin.readlines()
depth = int(_input[0])
sin_60, cos_60 = math.sin(math.pi / 3), math.cos(math.pi / 3)
class Point(object):
def __init__(self, x=0.0, y=0.0):
"""
initialize the point
"""
self.x = float(x)
... | 55 | 55 | 1,360 | 1,352 | # encoding: utf-8
import sys
import math
_input = sys.stdin.readlines()
depth = int(_input[0])
sin_60, cos_60 = math.sin(math.pi / 3), math.cos(math.pi / 3)
class Point(object):
def __init__(self, x=0.0, y=0.0):
"""
initialize the point
"""
self.x = float(x)
self.y = float... | # encoding: utf-8
import sys
import math
_input = sys.stdin.readlines()
depth = int(_input[0])
sin_60, cos_60 = math.sin(math.pi / 3), math.cos(math.pi / 3)
class Point(object):
def __init__(self, x=0.0, y=0.0):
"""
initialize the point
"""
self.x = float(x)
self.y = float... | false | 0 | [
"- print((format(p1_start.x, \".8f\"), \"\", format(p1_start.y, \".8f\")))",
"+ print((format(p1_start.x, \".8f\"), format(p1_start.y, \".8f\")))",
"- print((format(p2_end.x, \".8f\"), \"\", format(p2_end.y, \".8f\")))",
"+ print((format(p2_end.x, \".8f\"), format(p2_end.y, \".8f\")))"
] | false | 0.039734 | 0.045295 | 0.877238 | [
"s708121588",
"s226303267"
] |
u780342333 | p02421 | python | s070178118 | s792838851 | 30 | 20 | 7,660 | 5,600 | Accepted | Accepted | 33.33 | round = int(eval(input()))
points =[0, 0]
for r in range(round):
taro, hanako = input().split(" ")
if taro == hanako:
points[0] += 1
points[1] += 1
elif taro > hanako:
points[0] += 3
elif taro < hanako:
points[1] += 3
print((*points)) | def lexicographical_order(a, b):
if a > b:
return 0
elif a < b:
return 1
else:
return 2
if __name__ == "__main__":
n = int(eval(input()))
taro_point, hanako_point = 0, 0
for _ in range(n):
taro_hand, hanako_hand = input().split()
res = lexico... | 13 | 24 | 287 | 586 | round = int(eval(input()))
points = [0, 0]
for r in range(round):
taro, hanako = input().split(" ")
if taro == hanako:
points[0] += 1
points[1] += 1
elif taro > hanako:
points[0] += 3
elif taro < hanako:
points[1] += 3
print((*points))
| def lexicographical_order(a, b):
if a > b:
return 0
elif a < b:
return 1
else:
return 2
if __name__ == "__main__":
n = int(eval(input()))
taro_point, hanako_point = 0, 0
for _ in range(n):
taro_hand, hanako_hand = input().split()
res = lexicographical_or... | false | 45.833333 | [
"-round = int(eval(input()))",
"-points = [0, 0]",
"-for r in range(round):",
"- taro, hanako = input().split(\" \")",
"- if taro == hanako:",
"- points[0] += 1",
"- points[1] += 1",
"- elif taro > hanako:",
"- points[0] += 3",
"- elif taro < hanako:",
"- ... | false | 0.046093 | 0.047485 | 0.970675 | [
"s070178118",
"s792838851"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.