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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u123756661 | p02918 | python | s941382385 | s302368607 | 213 | 196 | 46,028 | 45,552 | Accepted | Accepted | 7.98 | n,k=list(map(int,input().split()))
s=eval(input())
t=s[0]
c=[-1,1][s[0]=="R"]
d=[0]
for i in range(1,n):
if t!=s[i]:
d.append(c)
c=0
t=s[i]
c+=[-1,1][s[i]=="R"]
d.append(c)
c=len(d)
if c>2:
for i in range(1,k+1):
if i*2>=c: break
d[i*2]*=-1
chk=0
ans... | n,k=list(map(int,input().split()))
s=eval(input())
t=s[0]
c=[-1,1][s[0]=="R"]
d=[]
for i in range(1,n):
if t!=s[i]:
d.append(c)
c=0
t=s[i]
c+=[-1,1][s[i]=="R"]
d.append(c)
c=len(d)
for i in range(k):
if i*2+1>=c: break
d[i*2+1]*=-1
chk=0
ans=0
for i in d:
if ... | 29 | 27 | 473 | 448 | n, k = list(map(int, input().split()))
s = eval(input())
t = s[0]
c = [-1, 1][s[0] == "R"]
d = [0]
for i in range(1, n):
if t != s[i]:
d.append(c)
c = 0
t = s[i]
c += [-1, 1][s[i] == "R"]
d.append(c)
c = len(d)
if c > 2:
for i in range(1, k + 1):
if i * 2 >= c:
break
... | n, k = list(map(int, input().split()))
s = eval(input())
t = s[0]
c = [-1, 1][s[0] == "R"]
d = []
for i in range(1, n):
if t != s[i]:
d.append(c)
c = 0
t = s[i]
c += [-1, 1][s[i] == "R"]
d.append(c)
c = len(d)
for i in range(k):
if i * 2 + 1 >= c:
break
d[i * 2 + 1] *= -1
chk... | false | 6.896552 | [
"-d = [0]",
"+d = []",
"-if c > 2:",
"- for i in range(1, k + 1):",
"- if i * 2 >= c:",
"- break",
"- d[i * 2] *= -1",
"+for i in range(k):",
"+ if i * 2 + 1 >= c:",
"+ break",
"+ d[i * 2 + 1] *= -1"
] | false | 0.046461 | 0.047329 | 0.98167 | [
"s941382385",
"s302368607"
] |
u790012205 | p03160 | python | s544121393 | s732228060 | 196 | 178 | 13,924 | 13,924 | Accepted | Accepted | 9.18 | N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10 ** 9
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
if i == 1:
dp[i] = abs(h[i] - h[i - 1])
else:
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
pri... | N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10 ** 9
dp = [INF] * N
dp[0] = 0
for i in range(N - 1):
if i == N - 2:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
else:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i... | 13 | 14 | 324 | 367 | N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
if i == 1:
dp[i] = abs(h[i] - h[i - 1])
else:
dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
dp[i] = min(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
for i in range(N - 1):
if i == N - 2:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
else:
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i + 2], dp[i] +... | false | 7.142857 | [
"-for i in range(1, N):",
"- if i == 1:",
"- dp[i] = abs(h[i] - h[i - 1])",
"+for i in range(N - 1):",
"+ if i == N - 2:",
"+ dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))",
"- dp[i] = min(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))",
"- dp[i] = min(dp[i], dp[... | false | 0.115495 | 0.045082 | 2.561898 | [
"s544121393",
"s732228060"
] |
u146685294 | p02923 | python | s290069919 | s201993023 | 63 | 57 | 14,480 | 15,020 | Accepted | Accepted | 9.52 | n = int(eval(input()))
count = 0
max_count = 0
pre_height = -1
for height in list(map(int, input().split())):
if (pre_height < height):
if (max_count < count):
max_count = count
count = 0
pre_height = height
continue
count += 1
pre_... | n = int(eval(input()))
h_list = list(map(int, input().split()))
count = 0
max_count = 0
pre_height = -1
for height in h_list:
if (pre_height < height):
if (max_count < count):
max_count = count
count = 0
pre_height = height
continue
cou... | 22 | 23 | 399 | 416 | n = int(eval(input()))
count = 0
max_count = 0
pre_height = -1
for height in list(map(int, input().split())):
if pre_height < height:
if max_count < count:
max_count = count
count = 0
pre_height = height
continue
count += 1
pre_height = height
if max_count < count... | n = int(eval(input()))
h_list = list(map(int, input().split()))
count = 0
max_count = 0
pre_height = -1
for height in h_list:
if pre_height < height:
if max_count < count:
max_count = count
count = 0
pre_height = height
continue
count += 1
pre_height = height
if m... | false | 4.347826 | [
"+h_list = list(map(int, input().split()))",
"-for height in list(map(int, input().split())):",
"+for height in h_list:"
] | false | 0.101562 | 0.047818 | 2.12392 | [
"s290069919",
"s201993023"
] |
u497596438 | p03008 | python | s889854647 | s737329028 | 1,800 | 1,531 | 231,064 | 229,404 | Accepted | Accepted | 14.94 | N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
dp=[N]*(N+1)
#dp[i];=i個目まで選んで交換したときの最大
C=[B[i]-A[i] for i in range(3)]
for i in range(N):
dp[i+1]=max(dp[i+1],dp[i])
for j in range(3):
if i+1-A[j]>=0:
dp[i+1]=max(dp[i+1],dp[i+1-A[j]]+C[j])
M=d... | def main():
N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
dp=[N]*(N+1)
#dp[i];=i個目まで選んで交換したときの最大
C=[B[i]-A[i] for i in range(3)]
for i in range(N):
dp[i+1]=max(dp[i+1],dp[i])
for j in range(3):
if i+1-A[j]>=0:
... | 30 | 33 | 703 | 878 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp = [N] * (N + 1)
# dp[i];=i個目まで選んで交換したときの最大
C = [B[i] - A[i] for i in range(3)]
for i in range(N):
dp[i + 1] = max(dp[i + 1], dp[i])
for j in range(3):
if i + 1 - A[j] >= 0:
dp[i + 1] = max(dp[i ... | def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dp = [N] * (N + 1)
# dp[i];=i個目まで選んで交換したときの最大
C = [B[i] - A[i] for i in range(3)]
for i in range(N):
dp[i + 1] = max(dp[i + 1], dp[i])
for j in range(3):
if ... | false | 9.090909 | [
"-N = int(eval(input()))",
"-A = list(map(int, input().split()))",
"-B = list(map(int, input().split()))",
"-dp = [N] * (N + 1)",
"-# dp[i];=i個目まで選んで交換したときの最大",
"-C = [B[i] - A[i] for i in range(3)]",
"-for i in range(N):",
"- dp[i + 1] = max(dp[i + 1], dp[i])",
"- for j in range(3):",
"- ... | false | 0.038815 | 0.038657 | 1.004096 | [
"s889854647",
"s737329028"
] |
u294385082 | p03998 | python | s353016758 | s523075630 | 21 | 18 | 3,316 | 3,064 | Accepted | Accepted | 14.29 | from collections import deque
sa = deque(list(eval(input())))
sb = deque(list(eval(input())))
sc = deque(list(eval(input())))
turn = 1
for i in range(10**10):
if turn == 1:
if len(sa) == 0:
print('A')
exit()
tmp =sa.popleft()
if tmp == 'b':
turn = 2
elif ... | sa = [i for i in eval(input())]
sb = [i for i in eval(input())]
sc = [i for i in eval(input())]
d = {"a":sa, "b":sb, "c":sc}#おのおのの手札をdictで表す
turn = "a"
while(True):#breakするまで続く
if len(d[turn]) == 0:
break
turn = d[turn].pop(0)#一枚減らしつつ,turn替え
print((turn.upper()))#upperは大文字にするやつ | 41 | 10 | 697 | 283 | from collections import deque
sa = deque(list(eval(input())))
sb = deque(list(eval(input())))
sc = deque(list(eval(input())))
turn = 1
for i in range(10**10):
if turn == 1:
if len(sa) == 0:
print("A")
exit()
tmp = sa.popleft()
if tmp == "b":
turn = 2
... | sa = [i for i in eval(input())]
sb = [i for i in eval(input())]
sc = [i for i in eval(input())]
d = {"a": sa, "b": sb, "c": sc} # おのおのの手札をdictで表す
turn = "a"
while True: # breakするまで続く
if len(d[turn]) == 0:
break
turn = d[turn].pop(0) # 一枚減らしつつ,turn替え
print((turn.upper())) # upperは大文字にするやつ
| false | 75.609756 | [
"-from collections import deque",
"-",
"-sa = deque(list(eval(input())))",
"-sb = deque(list(eval(input())))",
"-sc = deque(list(eval(input())))",
"-turn = 1",
"-for i in range(10**10):",
"- if turn == 1:",
"- if len(sa) == 0:",
"- print(\"A\")",
"- exit()",
"- ... | false | 0.040184 | 0.038801 | 1.035634 | [
"s353016758",
"s523075630"
] |
u198069342 | p00538 | python | s115605120 | s272853465 | 5,170 | 1,670 | 86,800 | 6,576 | Accepted | Accepted | 67.7 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dp = [[a[i] if i==j else max(a[i],a[(i+1)%n]) if (i+1)%n==j else 0 for j in range(n)] for i in range(n)]
for i in range(3 if n%2==0 else 2,n,2):
for l in range(n):
r = (l+i)%n
pat = []
for x,nextl,nextr in [(l,(l+1)... | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dp = [0 for _ in range(n)]
for i in range(n):
if i%2 == n%2:
dp = [ dp[(l+1)%n] if a[l]>a[(l+i)%n] else dp[l] for l in range(n)]
else:
dp = [ max( a[l]+dp[(l+1)%n], a[(l+i)%n]+dp[l] ) for l in range(n)]
print((max(dp... | 19 | 11 | 591 | 309 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dp = [
[
a[i] if i == j else max(a[i], a[(i + 1) % n]) if (i + 1) % n == j else 0
for j in range(n)
]
for i in range(n)
]
for i in range(3 if n % 2 == 0 else 2, n, 2):
for l in range(n):
r = (l + i) % n
pat... | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
dp = [0 for _ in range(n)]
for i in range(n):
if i % 2 == n % 2:
dp = [dp[(l + 1) % n] if a[l] > a[(l + i) % n] else dp[l] for l in range(n)]
else:
dp = [max(a[l] + dp[(l + 1) % n], a[(l + i) % n] + dp[l]) for l in range(n)]
print... | false | 42.105263 | [
"-dp = [",
"- [",
"- a[i] if i == j else max(a[i], a[(i + 1) % n]) if (i + 1) % n == j else 0",
"- for j in range(n)",
"- ]",
"- for i in range(n)",
"-]",
"-for i in range(3 if n % 2 == 0 else 2, n, 2):",
"- for l in range(n):",
"- r = (l + i) % n",
"- pat... | false | 0.036933 | 0.041898 | 0.881496 | [
"s115605120",
"s272853465"
] |
u054514819 | p03283 | python | s766708577 | s121350953 | 2,428 | 1,612 | 18,276 | 26,180 | Accepted | Accepted | 33.61 | N, M, Q = list(map(int, input().split()))
import numpy as np
LR = [[0]*(N+1) for _ in range(N+1)]
for i in range(1, M+1):
l, r = list(map(int, input().split()))
LR[l][r] += 1
cLR = np.cumsum(np.cumsum(LR, axis=0), axis=1)
for _ in range(Q):
p, q = list(map(int, input().split()))
ans = cLR[N... | N, M, Q = list(map(int, input().split()))
wa = [[0]*(N+1) for _ in range(N+1)]
import numpy as np
for _ in range(M):
l, r = list(map(int, input().split()))
wa[l][r] += 1
cwa = np.cumsum(np.cumsum(wa, axis=0), axis=1).tolist()
for i in range(Q):
p, q = list(map(int, input().split()))
ans = c... | 13 | 13 | 336 | 339 | N, M, Q = list(map(int, input().split()))
import numpy as np
LR = [[0] * (N + 1) for _ in range(N + 1)]
for i in range(1, M + 1):
l, r = list(map(int, input().split()))
LR[l][r] += 1
cLR = np.cumsum(np.cumsum(LR, axis=0), axis=1)
for _ in range(Q):
p, q = list(map(int, input().split()))
ans = cLR[N][q]... | N, M, Q = list(map(int, input().split()))
wa = [[0] * (N + 1) for _ in range(N + 1)]
import numpy as np
for _ in range(M):
l, r = list(map(int, input().split()))
wa[l][r] += 1
cwa = np.cumsum(np.cumsum(wa, axis=0), axis=1).tolist()
for i in range(Q):
p, q = list(map(int, input().split()))
ans = cwa[N][... | false | 0 | [
"+wa = [[0] * (N + 1) for _ in range(N + 1)]",
"-LR = [[0] * (N + 1) for _ in range(N + 1)]",
"-for i in range(1, M + 1):",
"+for _ in range(M):",
"- LR[l][r] += 1",
"-cLR = np.cumsum(np.cumsum(LR, axis=0), axis=1)",
"-for _ in range(Q):",
"+ wa[l][r] += 1",
"+cwa = np.cumsum(np.cumsum(wa, axi... | false | 0.335389 | 0.250357 | 1.339645 | [
"s766708577",
"s121350953"
] |
u513081876 | p03673 | python | s856462347 | s742265496 | 66 | 50 | 27,044 | 27,204 | Accepted | Accepted | 24.24 | n = int(eval(input()))
a = list(map(str, input().split()))
if n % 2 == 0:
ki = a[::2]
gu = a[1::2]
gu = gu[::-1]
ans = gu+ki
else:
ki = a[::2]
ki = ki[::-1]
gu = a[1::2]
ans = ki+gu
print((' '.join(ans))) | n = int(eval(input()))
a = list(input().split())
if n % 2 == 0:
ans = a[::-2]+a[::2]
else:
ans = a[::-2]+a[1::2]
print((' '.join(ans))) | 14 | 7 | 246 | 141 | n = int(eval(input()))
a = list(map(str, input().split()))
if n % 2 == 0:
ki = a[::2]
gu = a[1::2]
gu = gu[::-1]
ans = gu + ki
else:
ki = a[::2]
ki = ki[::-1]
gu = a[1::2]
ans = ki + gu
print((" ".join(ans)))
| n = int(eval(input()))
a = list(input().split())
if n % 2 == 0:
ans = a[::-2] + a[::2]
else:
ans = a[::-2] + a[1::2]
print((" ".join(ans)))
| false | 50 | [
"-a = list(map(str, input().split()))",
"+a = list(input().split())",
"- ki = a[::2]",
"- gu = a[1::2]",
"- gu = gu[::-1]",
"- ans = gu + ki",
"+ ans = a[::-2] + a[::2]",
"- ki = a[::2]",
"- ki = ki[::-1]",
"- gu = a[1::2]",
"- ans = ki + gu",
"+ ans = a[::-2] + a... | false | 0.039837 | 0.039299 | 1.013701 | [
"s856462347",
"s742265496"
] |
u597455618 | p02984 | python | s862680617 | s425230833 | 137 | 101 | 19,340 | 19,904 | Accepted | Accepted | 26.28 | import sys
n = int(eval(input()))
a = [ 2*int(i) for i in sys.stdin.readline().split()]
ans = [0 for i in range(n)]
for i in range(1, n):
ans[i] = a[i-1] - ans[i-1]
ans[0] = (a[n-1] - ans[n-1])//2
for i in range(1, n):
ans[i] += ans[0]*(-1)**(i%2)
print((" ".join(map(str, ans))))
| import sys
n = int(eval(input()))
a = [ 2*int(i) for i in sys.stdin.readline().split()]
f = (sum(a) - 2* sum(a[1::2]))//2
ans = [f] + [0 for i in range(n-1)]
for i in range(n-1):
ans[i+1] = a[i] - ans[i]
print((" ".join(map(str, ans))))
| 10 | 8 | 291 | 241 | import sys
n = int(eval(input()))
a = [2 * int(i) for i in sys.stdin.readline().split()]
ans = [0 for i in range(n)]
for i in range(1, n):
ans[i] = a[i - 1] - ans[i - 1]
ans[0] = (a[n - 1] - ans[n - 1]) // 2
for i in range(1, n):
ans[i] += ans[0] * (-1) ** (i % 2)
print((" ".join(map(str, ans))))
| import sys
n = int(eval(input()))
a = [2 * int(i) for i in sys.stdin.readline().split()]
f = (sum(a) - 2 * sum(a[1::2])) // 2
ans = [f] + [0 for i in range(n - 1)]
for i in range(n - 1):
ans[i + 1] = a[i] - ans[i]
print((" ".join(map(str, ans))))
| false | 20 | [
"-ans = [0 for i in range(n)]",
"-for i in range(1, n):",
"- ans[i] = a[i - 1] - ans[i - 1]",
"-ans[0] = (a[n - 1] - ans[n - 1]) // 2",
"-for i in range(1, n):",
"- ans[i] += ans[0] * (-1) ** (i % 2)",
"+f = (sum(a) - 2 * sum(a[1::2])) // 2",
"+ans = [f] + [0 for i in range(n - 1)]",
"+for i i... | false | 0.036144 | 0.055828 | 0.647421 | [
"s862680617",
"s425230833"
] |
u294385082 | p02936 | python | s865852839 | s994234846 | 1,773 | 1,137 | 56,088 | 56,080 | Accepted | Accepted | 35.87 | from collections import deque
def bfs():
d.append(0)
trace[0] = 1
while d:
now = d.pop()
for next in g[now]:
if trace[next] == 0:
trace[next] = 1
score[next] += score[now]
d.append(next)
n,q = list(map(int,input().split()))
g = [[] for i in range(n)]
... | #上流からスコアが流れてくるイメージ
from sys import stdin
from collections import deque
input = stdin.readline
def bfs():
d.append(0)
trace[0] = 1
while d:
now = d.pop()
for next in g[now]:
if trace[next] == 0:
trace[next] = 1
score[next] += score[now]
d.append(next)
... | 39 | 42 | 612 | 679 | from collections import deque
def bfs():
d.append(0)
trace[0] = 1
while d:
now = d.pop()
for next in g[now]:
if trace[next] == 0:
trace[next] = 1
score[next] += score[now]
d.append(next)
n, q = list(map(int, input().split()))
g ... | # 上流からスコアが流れてくるイメージ
from sys import stdin
from collections import deque
input = stdin.readline
def bfs():
d.append(0)
trace[0] = 1
while d:
now = d.pop()
for next in g[now]:
if trace[next] == 0:
trace[next] = 1
score[next] += score[now]
... | false | 7.142857 | [
"+# 上流からスコアが流れてくるイメージ",
"+from sys import stdin",
"+",
"+input = stdin.readline"
] | false | 0.065694 | 0.042265 | 1.554321 | [
"s865852839",
"s994234846"
] |
u301984327 | p02781 | python | s725015003 | s324088768 | 229 | 184 | 44,272 | 38,384 | Accepted | Accepted | 19.65 | n = int(eval(input()))
k = int(eval(input()))
keta = len(str(n))
dp = [[[0 for j in range(keta+2)] for _ in range(2)] for i in range(keta)]
s = str(n)
#dp[何桁目か][未満フラグ 0 = 未満][ゼロ以外のの個数]
x = int(s[0])
if x == 1:
dp[0][1][0] = 1
else:
dp[0][1][0] += 1
dp[0][0][0] += x - 1
for index... | n = int(eval(input()))
k = int(eval(input()))
keta = len(str(n))
dp = [[[0 for j in range(keta+2)] for _ in range(2)] for i in range(keta)]
s = str(n)
#dp[何桁目か][未満フラグ 0 = 未満][ゼロ以外のの個数]
x = int(s[0])
if x == 1:
dp[0][1][0] = 1
else:
dp[0][1][0] += 1
dp[0][0][0] += x - 1
for index... | 43 | 42 | 937 | 932 | n = int(eval(input()))
k = int(eval(input()))
keta = len(str(n))
dp = [[[0 for j in range(keta + 2)] for _ in range(2)] for i in range(keta)]
s = str(n)
# dp[何桁目か][未満フラグ 0 = 未満][ゼロ以外のの個数]
x = int(s[0])
if x == 1:
dp[0][1][0] = 1
else:
dp[0][1][0] += 1
dp[0][0][0] += x - 1
for index, c in enumerate(s[1:]):
... | n = int(eval(input()))
k = int(eval(input()))
keta = len(str(n))
dp = [[[0 for j in range(keta + 2)] for _ in range(2)] for i in range(keta)]
s = str(n)
# dp[何桁目か][未満フラグ 0 = 未満][ゼロ以外のの個数]
x = int(s[0])
if x == 1:
dp[0][1][0] = 1
else:
dp[0][1][0] += 1
dp[0][0][0] += x - 1
for index, c in enumerate(s[1:]):
... | false | 2.325581 | [
"- for j in range(keta + 1):",
"+ for j in range(k + 1):"
] | false | 0.039281 | 0.058892 | 0.666991 | [
"s725015003",
"s324088768"
] |
u864013199 | p03450 | python | s933732846 | s956038473 | 1,221 | 899 | 10,180 | 91,440 | Accepted | Accepted | 26.37 | #http://at274.hatenablog.com/entry/2018/02/03/140504
#重み付きUnion-Find木
class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
# 根への距離を管理
self.weight = [0] * (n+1)
# 検索
def find(self, x):
if self.par[x] =... | #http://at274.hatenablog.com/entry/2018/02/03/140504
#重み付きUnion-Find木
class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i in range(n+1)]
self.rank = [0] * (n+1)
# 根への距離を管理
self.weight = [0] * (n+1)
# 検索
def find(self, x):
if self.par[x] =... | 59 | 62 | 1,559 | 1,614 | # http://at274.hatenablog.com/entry/2018/02/03/140504
# 重み付きUnion-Find木
class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
# 根への距離を管理
self.weight = [0] * (n + 1)
# 検索
def find(self, x):
if self.par[x] == x:
... | # http://at274.hatenablog.com/entry/2018/02/03/140504
# 重み付きUnion-Find木
class WeightedUnionFind:
def __init__(self, n):
self.par = [i for i in range(n + 1)]
self.rank = [0] * (n + 1)
# 根への距離を管理
self.weight = [0] * (n + 1)
# 検索
def find(self, x):
if self.par[x] == x:
... | false | 4.83871 | [
"+import sys",
"+",
"+input = sys.stdin.readline # 文字列入力では注意!"
] | false | 0.042074 | 0.040525 | 1.038228 | [
"s933732846",
"s956038473"
] |
u584790715 | p02781 | python | s498628382 | s815585102 | 909 | 17 | 3,064 | 3,064 | Accepted | Accepted | 98.13 | from math import factorial
def nCr(n, r):
if r <= 0:
return 0
if n >= r:
return factorial(n) // (factorial(n - r) * factorial(r))
else:
return 0
def main():
N = eval(input())
K = int(eval(input()))
ans = func(N, K)
print(ans)
def func(N, K):... | from math import factorial
def nCr(n, r):
if r <= 0:
return 0
if n >= r:
return factorial(n) // (factorial(n - r) * factorial(r))
else:
return 0
N = eval(input())
K = int(eval(input()))
def rec(n, k, smaller):
n = n.lstrip('0')
if k == 0:
retu... | 55 | 43 | 895 | 700 | from math import factorial
def nCr(n, r):
if r <= 0:
return 0
if n >= r:
return factorial(n) // (factorial(n - r) * factorial(r))
else:
return 0
def main():
N = eval(input())
K = int(eval(input()))
ans = func(N, K)
print(ans)
def func(N, K):
N = N.lstrip("0"... | from math import factorial
def nCr(n, r):
if r <= 0:
return 0
if n >= r:
return factorial(n) // (factorial(n - r) * factorial(r))
else:
return 0
N = eval(input())
K = int(eval(input()))
def rec(n, k, smaller):
n = n.lstrip("0")
if k == 0:
return 1
if len(n) ... | false | 21.818182 | [
"-def main():",
"- N = eval(input())",
"- K = int(eval(input()))",
"- ans = func(N, K)",
"- print(ans)",
"+N = eval(input())",
"+K = int(eval(input()))",
"-def func(N, K):",
"- N = N.lstrip(\"0\")",
"- if len(N) < K:",
"+def rec(n, k, smaller):",
"+ n = n.lstrip(\"0\")",
... | false | 0.07391 | 0.048861 | 1.512652 | [
"s498628382",
"s815585102"
] |
u936985471 | p02820 | python | s811966094 | s850470800 | 121 | 60 | 4,084 | 4,084 | Accepted | Accepted | 50.41 | N,K=list(map(int,input().split()))
R,S,P=list(map(int,input().split()))
T=input().replace("s","R").replace("p","S").replace("r","P")
ans=0
def win(type):
if type=="R":
return R
elif type=="S":
return S
elif type=="P":
return P
return 0
yaku=set(["R","S","P"])
def rest(a,b):
re=... | import sys
readline = sys.stdin.readline
N,K = list(map(int,readline().split()))
R,S,P = list(map(int,readline().split()))
T = list(readline().rstrip())
P = {"r":P,"s":R,"p":S}
ans = 0
for i in range(len(T)):
if i < K:
ans += P[T[i]]
continue
if T[i] == T[i - K]:
T[i] = "x"
else:
... | 45 | 18 | 791 | 335 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = input().replace("s", "R").replace("p", "S").replace("r", "P")
ans = 0
def win(type):
if type == "R":
return R
elif type == "S":
return S
elif type == "P":
return P
return 0
yaku = set(["R", "... | import sys
readline = sys.stdin.readline
N, K = list(map(int, readline().split()))
R, S, P = list(map(int, readline().split()))
T = list(readline().rstrip())
P = {"r": P, "s": R, "p": S}
ans = 0
for i in range(len(T)):
if i < K:
ans += P[T[i]]
continue
if T[i] == T[i - K]:
T[i] = "x"
... | false | 60 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = input().replace(\"s\", \"R\").replace(\"p\", \"S\").replace(\"r\", \"P\")",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N, K = list(map(int, readline().split()))",
"+R, S, P = list(map(int, readl... | false | 0.041665 | 0.041145 | 1.012649 | [
"s811966094",
"s850470800"
] |
u677523557 | p02989 | python | s765918524 | s420686106 | 77 | 68 | 14,428 | 20,616 | Accepted | Accepted | 11.69 | N = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)
m = d[N // 2 - 1]
l = d[N // 2]
print((l-m)) | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
print((A[N//2]-A[N//2-1])) | 9 | 7 | 120 | 131 | N = int(eval(input()))
d = list(map(int, input().split()))
d = sorted(d)
m = d[N // 2 - 1]
l = d[N // 2]
print((l - m))
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
print((A[N // 2] - A[N // 2 - 1]))
| false | 22.222222 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-d = list(map(int, input().split()))",
"-d = sorted(d)",
"-m = d[N // 2 - 1]",
"-l = d[N // 2]",
"-print((l - m))",
"+A = list(map(int, input().split()))",
"+A.sort()",
"+print((A[N // 2] - A[N // 2 - 1]))"
] | false | 0.036092 | 0.035276 | 1.023125 | [
"s765918524",
"s420686106"
] |
u566924053 | p03611 | python | s439270293 | s968037721 | 168 | 152 | 26,588 | 26,596 | Accepted | Accepted | 9.52 | n = int(eval(input()))
ls = list(map(int, input().split()))
ls_plus1 = list([x + 1 for x in ls])
ls_minus1 = list([x - 1 for x in ls])
dic = {}
for a in ls_minus1 + ls + ls_plus1:
dic[a] = dic.get(a, 0) + 1
print((sorted(dic.values())[-1]))
| n = int(eval(input()))
ls = list(map(int, input().split()))
ls_plus1 = list([x + 1 for x in ls])
ls_minus1 = list([x - 1 for x in ls])
dic = {}
for a in ls_minus1 + ls + ls_plus1:
dic[a] = dic.get(a, 0) + 1
print((max(dic.values())))
| 9 | 9 | 261 | 254 | n = int(eval(input()))
ls = list(map(int, input().split()))
ls_plus1 = list([x + 1 for x in ls])
ls_minus1 = list([x - 1 for x in ls])
dic = {}
for a in ls_minus1 + ls + ls_plus1:
dic[a] = dic.get(a, 0) + 1
print((sorted(dic.values())[-1]))
| n = int(eval(input()))
ls = list(map(int, input().split()))
ls_plus1 = list([x + 1 for x in ls])
ls_minus1 = list([x - 1 for x in ls])
dic = {}
for a in ls_minus1 + ls + ls_plus1:
dic[a] = dic.get(a, 0) + 1
print((max(dic.values())))
| false | 0 | [
"-print((sorted(dic.values())[-1]))",
"+print((max(dic.values())))"
] | false | 0.03481 | 0.042862 | 0.812148 | [
"s439270293",
"s968037721"
] |
u013513417 | p03163 | python | s277268243 | s869207544 | 715 | 450 | 197,684 | 180,504 | Accepted | Accepted | 37.06 |
N,W=list(map(int,input().split()))
#S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合S
weight=[0]*110
value=[0]*110
S = [[0 for j in range(3)] for i in range(100010)]
DP= [[0 for j in range(100100)] for i in range(110)]
for i in range(N):
A,B=list(map(int,input().split()))
weight[i]=A
... | N,W=list(map(int,input().split()))
S = [[0 for j in range(2)] for i in range(N+1)]
DP= [[0 for j in range(100010)] for i in range(110)]
def chmax(a,b):
if a>b:
return a
else:
return b
for i in range(N):
w,v=list(map(int,input().split()))
S[i][0]=w
S[i][1]=v
for ... | 25 | 27 | 532 | 539 | N, W = list(map(int, input().split()))
# S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合S
weight = [0] * 110
value = [0] * 110
S = [[0 for j in range(3)] for i in range(100010)]
DP = [[0 for j in range(100100)] for i in range(110)]
for i in range(N):
A, B = list(map(int, input().split()))
weight[i] = A
... | N, W = list(map(int, input().split()))
S = [[0 for j in range(2)] for i in range(N + 1)]
DP = [[0 for j in range(100010)] for i in range(110)]
def chmax(a, b):
if a > b:
return a
else:
return b
for i in range(N):
w, v = list(map(int, input().split()))
S[i][0] = w
S[i][1] = v
for ... | false | 7.407407 | [
"-# S = [[0 for j in range(3)] for i in range(2)] 2行3列の場合S",
"-weight = [0] * 110",
"-value = [0] * 110",
"-S = [[0 for j in range(3)] for i in range(100010)]",
"-DP = [[0 for j in range(100100)] for i in range(110)]",
"+S = [[0 for j in range(2)] for i in range(N + 1)]",
"+DP = [[0 for j in range(10001... | false | 0.5499 | 0.578722 | 0.950197 | [
"s277268243",
"s869207544"
] |
u814986259 | p03700 | python | s915166288 | s993878297 | 1,813 | 827 | 7,120 | 7,088 | Accepted | Accepted | 54.38 | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
l = 0
r = math.ceil(max(H))
ans = 0
d = A-B
while(1):
if l+1 == r:
ans = r
break
else:
m = (l+r) // 2
count = 0
for i in range(N):
if (H[i] - m*B) >... |
def main():
import math
N, A, B = list(map(int, input().split()))
h = [int(eval(input())) for i in range(N)]
d = A - B
l = 1
r = max(h)
while(l+1 < r):
m = (l+r)//2
t = m*B
count = 0
for x in h:
if x > t:
count += m... | 22 | 25 | 453 | 431 | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for i in range(N)]
l = 0
r = math.ceil(max(H))
ans = 0
d = A - B
while 1:
if l + 1 == r:
ans = r
break
else:
m = (l + r) // 2
count = 0
for i in range(N):
if (H[i] - m * B) > 0:
... | def main():
import math
N, A, B = list(map(int, input().split()))
h = [int(eval(input())) for i in range(N)]
d = A - B
l = 1
r = max(h)
while l + 1 < r:
m = (l + r) // 2
t = m * B
count = 0
for x in h:
if x > t:
count += math.ceil(... | false | 12 | [
"-import math",
"+def main():",
"+ import math",
"-N, A, B = list(map(int, input().split()))",
"-H = [int(eval(input())) for i in range(N)]",
"-l = 0",
"-r = math.ceil(max(H))",
"-ans = 0",
"-d = A - B",
"-while 1:",
"- if l + 1 == r:",
"- ans = r",
"- break",
"- els... | false | 0.037617 | 0.043181 | 0.871147 | [
"s915166288",
"s993878297"
] |
u761320129 | p03283 | python | s298363356 | s962848485 | 1,714 | 1,221 | 50,656 | 49,948 | Accepted | Accepted | 28.76 | N,M,Q = map(int,input().split())
src = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(M)]
src.sort(reverse=True)
qs = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(Q)]
q_arr = [[] for i in range(N)]
for i,(l,r) in enumerate(qs):
q_arr[l].append((r,i))
bit = [0] * (N+2)
def... | N,M,Q = map(int,input().split())
src = [tuple(map(int,input().split())) for i in range(M)]
qs = [tuple(map(int,input().split())) for i in range(Q)]
imos = [[0]*(N+1) for i in range(N+1)]
for l,r in src:
imos[l][r] += 1
for i in range(N+1):
for j in range(N):
imos[i][j+1] += imos[i][j]
for i i... | 39 | 18 | 852 | 519 | N, M, Q = map(int, input().split())
src = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(M)]
src.sort(reverse=True)
qs = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(Q)]
q_arr = [[] for i in range(N)]
for i, (l, r) in enumerate(qs):
q_arr[l].append((r, i))
bit = [0] * (N + 2)... | N, M, Q = map(int, input().split())
src = [tuple(map(int, input().split())) for i in range(M)]
qs = [tuple(map(int, input().split())) for i in range(Q)]
imos = [[0] * (N + 1) for i in range(N + 1)]
for l, r in src:
imos[l][r] += 1
for i in range(N + 1):
for j in range(N):
imos[i][j + 1] += imos[i][j]
fo... | false | 53.846154 | [
"-src = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(M)]",
"-src.sort(reverse=True)",
"-qs = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(Q)]",
"-q_arr = [[] for i in range(N)]",
"-for i, (l, r) in enumerate(qs):",
"- q_arr[l].append((r, i))",
"-bit = [0] * (... | false | 0.049781 | 0.091058 | 0.546693 | [
"s298363356",
"s962848485"
] |
u540761833 | p03734 | python | s913814211 | s984435564 | 475 | 302 | 3,064 | 3,064 | Accepted | Accepted | 36.42 | N,W = list(map(int,input().split()))
w = [[] for i in range(4)]
w1,v1 = list(map(int,input().split()))
w[0].append(v1)
for i in range(N-1):
wi,vi = list(map(int,input().split()))
w[wi-w1].append(vi)
num = []
for i in range(4):
w[i].sort(reverse= 1)
num.append(len(w[i]))
ans = 0
for n1 in ran... | from itertools import accumulate
N,W = list(map(int,input().split()))
w = [[] for i in range(4)]
w1,v1 = list(map(int,input().split()))
w[0].append(v1)
for i in range(N-1):
wi,vi = list(map(int,input().split()))
w[wi-w1].append(vi)
num = []
for i in range(4):
w[i].sort(reverse= 1)
w[i] = [0]+... | 22 | 24 | 657 | 698 | N, W = list(map(int, input().split()))
w = [[] for i in range(4)]
w1, v1 = list(map(int, input().split()))
w[0].append(v1)
for i in range(N - 1):
wi, vi = list(map(int, input().split()))
w[wi - w1].append(vi)
num = []
for i in range(4):
w[i].sort(reverse=1)
num.append(len(w[i]))
ans = 0
for n1 in range(... | from itertools import accumulate
N, W = list(map(int, input().split()))
w = [[] for i in range(4)]
w1, v1 = list(map(int, input().split()))
w[0].append(v1)
for i in range(N - 1):
wi, vi = list(map(int, input().split()))
w[wi - w1].append(vi)
num = []
for i in range(4):
w[i].sort(reverse=1)
w[i] = [0] +... | false | 8.333333 | [
"+from itertools import accumulate",
"+",
"+ w[i] = [0] + list(accumulate(w[i]))",
"-for n1 in range(num[0] + 1):",
"- for n2 in range(num[1] + 1):",
"- for n3 in range(num[2] + 1):",
"- for n4 in range(num[3] + 1):",
"+for n1 in range(num[0]):",
"+ for n2 in range(num[1])... | false | 0.078279 | 0.073361 | 1.067041 | [
"s913814211",
"s984435564"
] |
u436634575 | p02265 | python | s299445016 | s723939977 | 1,930 | 1,740 | 103,484 | 103,336 | Accepted | Accepted | 9.84 | from sys import stdin
n = int(stdin.readline())
q = []
bottom = 0
for i in range(n):
cmd = stdin.readline()[:-1]
if cmd[0] == 'i':
q.append(cmd[7:])
elif cmd[6] == ' ':
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == 'F':
... | import sys
from collections import deque
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
cmd = sys.stdin.readline()[:-1]
if cmd[0] == 'i':
q.appendleft(cmd[7:])
elif cmd[6] == ' ':
try:
q.remove(cmd[7:])
except:
pass
elif cmd[6]... | 20 | 20 | 402 | 399 | from sys import stdin
n = int(stdin.readline())
q = []
bottom = 0
for i in range(n):
cmd = stdin.readline()[:-1]
if cmd[0] == "i":
q.append(cmd[7:])
elif cmd[6] == " ":
try:
q.pop(~q[::-1].index(cmd[7:]))
except:
pass
elif cmd[6] == "F":
q.pop()
... | import sys
from collections import deque
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
cmd = sys.stdin.readline()[:-1]
if cmd[0] == "i":
q.appendleft(cmd[7:])
elif cmd[6] == " ":
try:
q.remove(cmd[7:])
except:
pass
elif cmd[6] == "F":
... | false | 0 | [
"-from sys import stdin",
"+import sys",
"+from collections import deque",
"-n = int(stdin.readline())",
"-q = []",
"-bottom = 0",
"+n = int(sys.stdin.readline())",
"+q = deque()",
"- cmd = stdin.readline()[:-1]",
"+ cmd = sys.stdin.readline()[:-1]",
"- q.append(cmd[7:])",
"+ ... | false | 0.093163 | 0.037202 | 2.504266 | [
"s299445016",
"s723939977"
] |
u075595666 | p02948 | python | s018322519 | s407056336 | 506 | 455 | 59,364 | 91,472 | Accepted | Accepted | 10.08 | from heapq import*
(N,M),*t=[list(map(int,s.split()))for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
for j in i:heappush(q,-j)
z-=heappop(q)
print(z)
| from heapq import*
(n,m),*t=[list(map(int,s.split()))for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:m]:
for j in i:heappush(q,-j)
z-=heappop(q)
print(z) | 10 | 10 | 198 | 199 | from heapq import *
(N, M), *t = [list(map(int, s.split())) for s in open(0)]
q = [0] * 7**6
v = [[] for _ in q]
z = 0
for a, b in t:
v[a - 1] += [b]
for i in v[:M]:
for j in i:
heappush(q, -j)
z -= heappop(q)
print(z)
| from heapq import *
(n, m), *t = [list(map(int, s.split())) for s in open(0)]
q = [0] * 7**6
v = [[] for _ in q]
z = 0
for a, b in t:
v[a - 1] += [b]
for i in v[:m]:
for j in i:
heappush(q, -j)
z -= heappop(q)
print(z)
| false | 0 | [
"-(N, M), *t = [list(map(int, s.split())) for s in open(0)]",
"+(n, m), *t = [list(map(int, s.split())) for s in open(0)]",
"-for i in v[:M]:",
"+for i in v[:m]:"
] | false | 0.10739 | 0.085959 | 1.249311 | [
"s018322519",
"s407056336"
] |
u191874006 | p02973 | python | s528722144 | s853419438 | 573 | 328 | 54,872 | 50,652 | Accepted | Accepted | 42.76 | #!/usr/bin/env python3
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools... | #!/usr/bin/env python3
#ABC134 E
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
fro... | 23 | 27 | 557 | 677 | #!/usr/bin/env python3
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import perm... | #!/usr/bin/env python3
# ABC134 E
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools ... | false | 14.814815 | [
"+# ABC134 E",
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-dp = [float(\"inf\")] * n",
"-for i in range(n):",
"- x = bisect.bisect_right(dp, -a[i])",
"- dp[x] = -a[i]",
"-c = dp.count(float(\"inf\"))",
"-print((n - c))",
"+",
"+",
"+def I():",
"+ retu... | false | 0.069518 | 0.041671 | 1.668268 | [
"s528722144",
"s853419438"
] |
u200887663 | p02689 | python | s453216378 | s782506203 | 312 | 265 | 19,828 | 20,048 | Accepted | Accepted | 15.06 | #n=int(input())
n,m=list(map(int,input().split()))
hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
dic={}
for i in range(m):
a,b=list(map(int,input().split()))
if hl[a-1]<=hl[b-1]:
dic[a]=False
if hl[b-1]<=hl[a-1]:
dic[b]=False
print((n-le... | #n = int(input())
n, m = list(map(int, input().split()))
hl = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]
isgood = [True for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
if hl[a-1] <= hl[b-1]:
isgood[a-1] = False
if hl[b-1] <= hl[a-1... | 13 | 14 | 315 | 367 | # n=int(input())
n, m = list(map(int, input().split()))
hl = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
dic = {}
for i in range(m):
a, b = list(map(int, input().split()))
if hl[a - 1] <= hl[b - 1]:
dic[a] = False
if hl[b - 1] <= hl[a - 1]:
dic[b] =... | # n = int(input())
n, m = list(map(int, input().split()))
hl = list(map(int, input().split()))
# al=[list(input()) for i in range(n)]
isgood = [True for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
if hl[a - 1] <= hl[b - 1]:
isgood[a - 1] = False
if hl[b - 1] <= hl[a - 1]... | false | 7.142857 | [
"-# n=int(input())",
"+# n = int(input())",
"-# l=[list(map(int,input().split())) for i in range(n)]",
"-dic = {}",
"+# al=[list(input()) for i in range(n)]",
"+isgood = [True for _ in range(n)]",
"- dic[a] = False",
"+ isgood[a - 1] = False",
"- dic[b] = False",
"-print((n - ... | false | 0.037624 | 0.041659 | 0.903143 | [
"s453216378",
"s782506203"
] |
u903005414 | p03387 | python | s726886616 | s636421130 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A, B, C = list(map(int, input().split()))
A, B, C = sorted([A, B, C])
ans = 0
if (B - A) % 2 == 0:
ans = (B - A) // 2
ans += C - B
elif (C - A) % 2 == 0:
ans = (C - A) // 2
# if (C - B) % 2 == 0:
# ans += (C - B) // 2
# else:
# ans += (C + 1 - B) // 2
ans += (C - B)... | A, B, C = list(map(int, input().split()))
A, B, C = sorted([A, B, C])
if (A + B + C) % 2 == (C * 3) % 2:
ans = (C - A + C - B) // 2
else:
ans = (C + 1 - A + C - B) // 2 + 1
print(ans)
| 19 | 8 | 447 | 194 | A, B, C = list(map(int, input().split()))
A, B, C = sorted([A, B, C])
ans = 0
if (B - A) % 2 == 0:
ans = (B - A) // 2
ans += C - B
elif (C - A) % 2 == 0:
ans = (C - A) // 2
# if (C - B) % 2 == 0:
# ans += (C - B) // 2
# else:
# ans += (C + 1 - B) // 2
ans += (C - B) // 2 + 2
else... | A, B, C = list(map(int, input().split()))
A, B, C = sorted([A, B, C])
if (A + B + C) % 2 == (C * 3) % 2:
ans = (C - A + C - B) // 2
else:
ans = (C + 1 - A + C - B) // 2 + 1
print(ans)
| false | 57.894737 | [
"-ans = 0",
"-if (B - A) % 2 == 0:",
"- ans = (B - A) // 2",
"- ans += C - B",
"-elif (C - A) % 2 == 0:",
"- ans = (C - A) // 2",
"- # if (C - B) % 2 == 0:",
"- # ans += (C - B) // 2",
"- # else:",
"- # ans += (C + 1 - B) // 2",
"- ans += (C - B) // 2 + 2",
"-el... | false | 0.045122 | 0.044641 | 1.010783 | [
"s726886616",
"s636421130"
] |
u692746605 | p03073 | python | s458638956 | s143084077 | 68 | 48 | 3,188 | 3,188 | Accepted | Accepted | 29.41 | s = eval(input())
c1,c2 = 0, 0
for x in range(len(s)):
c1 += 1 if s[x] != ('0' if x%2 else '1') else 0
c2 += 1 if s[x] != ('1' if x%2 else '0') else 0
print((min(c1,c2)))
| s = eval(input())
c = 0
for x in range(len(s)):
c += 1 if s[x] != ('0' if x%2 else '1') else 0
print((c if c < x+1-c else x+1-c))
| 8 | 7 | 180 | 134 | s = eval(input())
c1, c2 = 0, 0
for x in range(len(s)):
c1 += 1 if s[x] != ("0" if x % 2 else "1") else 0
c2 += 1 if s[x] != ("1" if x % 2 else "0") else 0
print((min(c1, c2)))
| s = eval(input())
c = 0
for x in range(len(s)):
c += 1 if s[x] != ("0" if x % 2 else "1") else 0
print((c if c < x + 1 - c else x + 1 - c))
| false | 12.5 | [
"-c1, c2 = 0, 0",
"+c = 0",
"- c1 += 1 if s[x] != (\"0\" if x % 2 else \"1\") else 0",
"- c2 += 1 if s[x] != (\"1\" if x % 2 else \"0\") else 0",
"-print((min(c1, c2)))",
"+ c += 1 if s[x] != (\"0\" if x % 2 else \"1\") else 0",
"+print((c if c < x + 1 - c else x + 1 - c))"
] | false | 0.036577 | 0.03244 | 1.127532 | [
"s458638956",
"s143084077"
] |
u863370423 | p02958 | python | s993233195 | s433325163 | 164 | 95 | 38,512 | 61,692 | Accepted | Accepted | 42.07 | eval(input())
g = eval(input())
a = list(map(str, g.split()))
b = list(map(int, g.split()))
if sorted(b) == b:
print("YES")
else:
m = 0
for i in range(len(b)):
if b[i] == sorted(b)[i]:
m+=1
if m==len(b)-2:
print("YES")
else:
print("NO") | n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i]!=i+1:
c+=1
if c>2:
print("NO")
else:
print("YES") | 15 | 10 | 294 | 164 | eval(input())
g = eval(input())
a = list(map(str, g.split()))
b = list(map(int, g.split()))
if sorted(b) == b:
print("YES")
else:
m = 0
for i in range(len(b)):
if b[i] == sorted(b)[i]:
m += 1
if m == len(b) - 2:
print("YES")
else:
print("NO")
| n = int(eval(input()))
p = list(map(int, input().split()))
c = 0
for i in range(n):
if p[i] != i + 1:
c += 1
if c > 2:
print("NO")
else:
print("YES")
| false | 33.333333 | [
"-eval(input())",
"-g = eval(input())",
"-a = list(map(str, g.split()))",
"-b = list(map(int, g.split()))",
"-if sorted(b) == b:",
"+n = int(eval(input()))",
"+p = list(map(int, input().split()))",
"+c = 0",
"+for i in range(n):",
"+ if p[i] != i + 1:",
"+ c += 1",
"+if c > 2:",
"+... | false | 0.04164 | 0.055127 | 0.755354 | [
"s993233195",
"s433325163"
] |
u197300773 | p03061 | python | s028803762 | s199633190 | 175 | 104 | 14,436 | 14,588 | Accepted | Accepted | 40.57 | def gcd(x, y):
if y > x:
x, y = y, x
while y:
x, y = y, x % y
return x
N=int(eval(input()))
a=list(map(int,input().split()))
l=[0]*N
l[0]=a[0]
for i in range(1,N):
l[i]=gcd(l[i-1],a[i])
r=[0]*N
r[N-1]=a[N-1]
for i in range(N-2,-1,-1):
r[i]=gcd(r[i+1],a[i])
ans... | def gcd(a,b):
if b>a:
a,b=b,a
while b:
a,b=b, a%b
return a
def cul(n,x):
l=len(x)
b=[x[i] for i in range(l)]
b.pop(n)
tmp=b[0]
for i in range(1,l-1):
tmp=gcd(tmp,b[i])
return tmp
import sys
import math
p=100
N=int(eval(input()))
a=list(... | 26 | 48 | 422 | 710 | def gcd(x, y):
if y > x:
x, y = y, x
while y:
x, y = y, x % y
return x
N = int(eval(input()))
a = list(map(int, input().split()))
l = [0] * N
l[0] = a[0]
for i in range(1, N):
l[i] = gcd(l[i - 1], a[i])
r = [0] * N
r[N - 1] = a[N - 1]
for i in range(N - 2, -1, -1):
r[i] = gcd(r[i +... | def gcd(a, b):
if b > a:
a, b = b, a
while b:
a, b = b, a % b
return a
def cul(n, x):
l = len(x)
b = [x[i] for i in range(l)]
b.pop(n)
tmp = b[0]
for i in range(1, l - 1):
tmp = gcd(tmp, b[i])
return tmp
import sys
import math
p = 100
N = int(eval(input()... | false | 45.833333 | [
"-def gcd(x, y):",
"- if y > x:",
"- x, y = y, x",
"- while y:",
"- x, y = y, x % y",
"- return x",
"+def gcd(a, b):",
"+ if b > a:",
"+ a, b = b, a",
"+ while b:",
"+ a, b = b, a % b",
"+ return a",
"+def cul(n, x):",
"+ l = len(x)",
"+ ... | false | 0.037976 | 0.055655 | 0.682344 | [
"s028803762",
"s199633190"
] |
u620868411 | p03044 | python | s089690601 | s751619158 | 780 | 514 | 45,976 | 47,332 | Accepted | Accepted | 34.1 | # -*- coding: utf-8 -*-
from collections import defaultdict
n = int(eval(input()))
e = defaultdict(lambda: [])
for _ in range(n-1):
v,u,w = list(map(int, input().split()))
v -= 1
u -= 1
e[v].append((u,w))
e[u].append((v,w))
col = [-1]*n
q = [0]
col[0] = 0
while len(q)>0:
v = q.... | n = int(eval(input()))
e = [[] for _ in range(n)]
for _ in range(n-1):
u,v,w = list(map(int, input().split()))
u -= 1
v -= 1
e[u].append((v,w))
e[v].append((u,w))
res = [-1]*n
res[0] = 0
q = [0]
while len(q):
v = q.pop()
for u,w in e[v]:
if res[u]>=0:
con... | 26 | 22 | 512 | 395 | # -*- coding: utf-8 -*-
from collections import defaultdict
n = int(eval(input()))
e = defaultdict(lambda: [])
for _ in range(n - 1):
v, u, w = list(map(int, input().split()))
v -= 1
u -= 1
e[v].append((u, w))
e[u].append((v, w))
col = [-1] * n
q = [0]
col[0] = 0
while len(q) > 0:
v = q.pop()
... | n = int(eval(input()))
e = [[] for _ in range(n)]
for _ in range(n - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
e[u].append((v, w))
e[v].append((u, w))
res = [-1] * n
res[0] = 0
q = [0]
while len(q):
v = q.pop()
for u, w in e[v]:
if res[u] >= 0:
continue
... | false | 15.384615 | [
"-# -*- coding: utf-8 -*-",
"-from collections import defaultdict",
"-",
"-e = defaultdict(lambda: [])",
"+e = [[] for _ in range(n)]",
"- v, u, w = list(map(int, input().split()))",
"+ u, v, w = list(map(int, input().split()))",
"+ u -= 1",
"- u -= 1",
"+ e[u].append((v, w))",
"-... | false | 0.044329 | 0.049855 | 0.889148 | [
"s089690601",
"s751619158"
] |
u488401358 | p02562 | python | s547995572 | s273723081 | 4,236 | 809 | 103,736 | 73,308 | Accepted | Accepted | 80.9 | from heapq import heappush, heappop
class MinCostFlow:
INF = 10**18
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap, cost):
forward = [to, cap, cost, None]
backward = forward[3] = [fr, 0, -cost, forward]
se... | from heapq import heappush, heappop
class MinCostFlow:
INF = 10**18
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap, cost):
forward = [to, cap, cost, None]
backward = forward[3] = [fr, 0, -cost, forward]
se... | 94 | 89 | 2,458 | 2,306 | from heapq import heappush, heappop
class MinCostFlow:
INF = 10**18
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap, cost):
forward = [to, cap, cost, None]
backward = forward[3] = [fr, 0, -cost, forward]
self.G[fr].... | from heapq import heappush, heappop
class MinCostFlow:
INF = 10**18
def __init__(self, N):
self.N = N
self.G = [[] for i in range(N)]
def add_edge(self, fr, to, cap, cost):
forward = [to, cap, cost, None]
backward = forward[3] = [fr, 0, -cost, forward]
self.G[fr].... | false | 5.319149 | [
"-G = MinCostFlow(N**2 + 2 * N + 3)",
"-G.add_edge(0, N**2 + 2 * N + 2, 10**18, 0)",
"-G.add_edge(N**2 + 2 * N + 2, N**2 + 2 * N + 1, 10**18, 0)",
"+G = MinCostFlow(2 * N + 3)",
"+G.add_edge(0, 2 * N + 2, 10**18, 0)",
"+G.add_edge(2 * N + 2, 2 * N + 1, 10**18, 0)",
"- node = N * i + j + 2 * N + 1... | false | 0.251982 | 0.049376 | 5.103359 | [
"s547995572",
"s273723081"
] |
u503228842 | p02609 | python | s170473910 | s712147268 | 616 | 441 | 12,824 | 30,216 | Accepted | Accepted | 28.41 | n = int(eval(input()))
x = eval(input())
x_popcnt = x.count('1')
one_popcnt = x_popcnt - 1
zero_popcnt = x_popcnt + 1
one_mod = 0
zero_mod = 0
for b in x:
if one_popcnt != 0:
one_mod = (one_mod*2 + int(b)) % one_popcnt
zero_mod = (zero_mod*2 + int(b)) % zero_popcnt
f = [0]*220000
popcnt ... | n = int(eval(input()))
x = eval(input())
x_popcnt = x.count('1')
one_popcnt = x_popcnt - 1
zero_popcnt = x_popcnt + 1
one_mod = 0
zero_mod = 0
for b in x:
if one_popcnt != 0:
one_mod = (one_mod*2 + int(b)) % one_popcnt
zero_mod = (zero_mod*2 + int(b)) % zero_popcnt
f = [0]*220000
popcnt ... | 33 | 40 | 813 | 1,016 | n = int(eval(input()))
x = eval(input())
x_popcnt = x.count("1")
one_popcnt = x_popcnt - 1
zero_popcnt = x_popcnt + 1
one_mod = 0
zero_mod = 0
for b in x:
if one_popcnt != 0:
one_mod = (one_mod * 2 + int(b)) % one_popcnt
zero_mod = (zero_mod * 2 + int(b)) % zero_popcnt
f = [0] * 220000
popcnt = [0] * 22... | n = int(eval(input()))
x = eval(input())
x_popcnt = x.count("1")
one_popcnt = x_popcnt - 1
zero_popcnt = x_popcnt + 1
one_mod = 0
zero_mod = 0
for b in x:
if one_popcnt != 0:
one_mod = (one_mod * 2 + int(b)) % one_popcnt
zero_mod = (zero_mod * 2 + int(b)) % zero_popcnt
f = [0] * 220000
popcnt = [0] * 22... | false | 17.5 | [
"+onepow2 = [1] * 220000",
"+if one_popcnt != 0:",
"+ for i in range(1, 220000):",
"+ onepow2[i] = 2 * onepow2[i - 1] % one_popcnt",
"+zeropow2 = [1] * 220000",
"+for i in range(1, 220000):",
"+ zeropow2[i] = 2 * zeropow2[i - 1] % zero_popcnt",
"- nxt -= pow(2, i, one_popcnt)",... | false | 0.046114 | 0.039262 | 1.174511 | [
"s170473910",
"s712147268"
] |
u113971909 | p03829 | python | s474033025 | s228189102 | 295 | 94 | 21,556 | 14,252 | Accepted | Accepted | 68.14 | N,A,B=list(map(int,input().split()))
X=list(map(int,input().split()))
import numpy as np
X=np.array(X)
print((sum(np.minimum((X[1:]-X[:N-1])*A , B)))) | N,A,B=list(map(int,input().split()))
X=list(map(int,input().split()))
ret = 0
for i in range(1,N):
ret += min(B, A*(X[i]-X[i-1]))
print(ret) | 5 | 6 | 146 | 141 | N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
import numpy as np
X = np.array(X)
print((sum(np.minimum((X[1:] - X[: N - 1]) * A, B))))
| N, A, B = list(map(int, input().split()))
X = list(map(int, input().split()))
ret = 0
for i in range(1, N):
ret += min(B, A * (X[i] - X[i - 1]))
print(ret)
| false | 16.666667 | [
"-import numpy as np",
"-",
"-X = np.array(X)",
"-print((sum(np.minimum((X[1:] - X[: N - 1]) * A, B))))",
"+ret = 0",
"+for i in range(1, N):",
"+ ret += min(B, A * (X[i] - X[i - 1]))",
"+print(ret)"
] | false | 0.183001 | 0.032178 | 5.68717 | [
"s474033025",
"s228189102"
] |
u537976628 | p02714 | python | s840534108 | s373137679 | 531 | 489 | 9,644 | 9,764 | Accepted | Accepted | 7.91 | n = int(eval(input()))
s = eval(input())
r, g, b = [], [], []
cnt = 1
for i in s:
if i == 'R':
r.append(cnt)
elif i == 'G':
g.append(cnt)
else:
b.append(cnt)
cnt += 1
rd = set([x * 2 for x in r])
gd = set([x * 2 for x in g])
bd = set([x * 2 for x in b])
ddc = 0
fo... | n = int(eval(input()))
s = eval(input())
r, g, b = [], [], []
cnt = 1
for i in s:
if i == 'R':
r.append(cnt)
elif i == 'G':
g.append(cnt)
else:
b.append(cnt)
cnt += 1
rd = set([x * 2 for x in r]) #以下2つ目の条件を満たさないもの(j - i = k - j)の数え上げ
gd = set([x * 2 for x in g])
bd ... | 29 | 29 | 589 | 660 | n = int(eval(input()))
s = eval(input())
r, g, b = [], [], []
cnt = 1
for i in s:
if i == "R":
r.append(cnt)
elif i == "G":
g.append(cnt)
else:
b.append(cnt)
cnt += 1
rd = set([x * 2 for x in r])
gd = set([x * 2 for x in g])
bd = set([x * 2 for x in b])
ddc = 0
for i in r:
fo... | n = int(eval(input()))
s = eval(input())
r, g, b = [], [], []
cnt = 1
for i in s:
if i == "R":
r.append(cnt)
elif i == "G":
g.append(cnt)
else:
b.append(cnt)
cnt += 1
rd = set([x * 2 for x in r]) # 以下2つ目の条件を満たさないもの(j - i = k - j)の数え上げ
gd = set([x * 2 for x in g])
bd = set([x * 2... | false | 0 | [
"-rd = set([x * 2 for x in r])",
"+rd = set([x * 2 for x in r]) # 以下2つ目の条件を満たさないもの(j - i = k - j)の数え上げ",
"-print((len(r) * len(g) * len(b) - ddc))",
"+print((len(r) * len(g) * len(b) - ddc)) # 1つ目の条件を満たすモノから2つ目の条件を満たさないものを引く"
] | false | 0.045965 | 0.045834 | 1.002855 | [
"s840534108",
"s373137679"
] |
u371763408 | p03575 | python | s363595598 | s332987267 | 171 | 103 | 3,064 | 3,064 | Accepted | Accepted | 39.77 | class UnionFind:
def __init__(self, num):
self.rank = [0]*num
self.par = [i for i in range(num)] #基準(par = parentのpar)
self.n = num
self.size = [1]*num
#親を探す
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
... | class UnionFind:
def __init__(self, num):
self.rank = [0]*num
self.par = [i for i in range(num)] #基準(par = parentのpar)
self.n = num
self.size = [1]*num
#親を探す
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x]) #自分じゃなきゃ親を探す
... | 74 | 60 | 1,691 | 1,245 | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)] # 基準(par = parentのpar)
self.n = num
self.size = [1] * num
# 親を探す
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = s... | class UnionFind:
def __init__(self, num):
self.rank = [0] * num
self.par = [i for i in range(num)] # 基準(par = parentのpar)
self.n = num
self.size = [1] * num
# 親を探す
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = s... | false | 18.918919 | [
"-# edges=[[0]*n for i in range(n)]",
"-# uf=UnionFind(n)",
"+uf = UnionFind(n)",
"-# ab=[]",
"-# for i in range(m):",
"-# a,b=map(int,input().split())",
"-# ab.append([a,b])",
"-# uf.union(a-1,b-1)",
"-# for i in range(m):",
"-# uf1=UnionFind(n)",
"-# for j in range(m):",
"-# a,... | false | 0.03717 | 0.042719 | 0.870098 | [
"s363595598",
"s332987267"
] |
u644907318 | p03724 | python | s909334805 | s054054333 | 602 | 255 | 54,896 | 87,648 | Accepted | Accepted | 57.64 | N,M = list(map(int,input().split()))
k = 0
while True:
if 2**k>=N:
break
k += 1
A = [0 for i in range(2**k+1)]
for _ in range(M):
a,b = list(map(int,input().split()))
if b<a:
a,b = b,a
A[a] += 1
A[b] -= 1
B = [0 for i in range(2**k+2)]
for i in range(2**k+1):
B... | N,M = list(map(int,input().split()))
C = {i:0 for i in range(1,N+1)}
for _ in range(M):
a,b = list(map(int,input().split()))
C[a] = (C[a]+1)%2
C[b] = (C[b]+1)%2
flag = 0
for i in range(1,N+1):
if C[i]==1:
flag = 1
break
if flag==0:
print("YES")
else:
print("NO") | 25 | 15 | 467 | 304 | N, M = list(map(int, input().split()))
k = 0
while True:
if 2**k >= N:
break
k += 1
A = [0 for i in range(2**k + 1)]
for _ in range(M):
a, b = list(map(int, input().split()))
if b < a:
a, b = b, a
A[a] += 1
A[b] -= 1
B = [0 for i in range(2**k + 2)]
for i in range(2**k + 1):
... | N, M = list(map(int, input().split()))
C = {i: 0 for i in range(1, N + 1)}
for _ in range(M):
a, b = list(map(int, input().split()))
C[a] = (C[a] + 1) % 2
C[b] = (C[b] + 1) % 2
flag = 0
for i in range(1, N + 1):
if C[i] == 1:
flag = 1
break
if flag == 0:
print("YES")
else:
print(... | false | 40 | [
"-k = 0",
"-while True:",
"- if 2**k >= N:",
"- break",
"- k += 1",
"-A = [0 for i in range(2**k + 1)]",
"+C = {i: 0 for i in range(1, N + 1)}",
"- if b < a:",
"- a, b = b, a",
"- A[a] += 1",
"- A[b] -= 1",
"-B = [0 for i in range(2**k + 2)]",
"-for i in range(2*... | false | 0.088559 | 0.036621 | 2.418233 | [
"s909334805",
"s054054333"
] |
u414980766 | p02888 | python | s821158153 | s390179105 | 1,417 | 1,006 | 3,188 | 3,188 | Accepted | Accepted | 29 | import bisect
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, - 1):
for j in range(i - 1, 0, - 1):
k = L[i] - L[j] + 1
if k > L[j - 1]:
break
res += j - bisect.bisect_left(L, k)
print(res) | N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, - 1):
j = i - 1
k = 0
while j > k:
while j > k and L[i] >= L[j] + L[k]:
k += 1
res += j - k
j -= 1
print(res) | 11 | 12 | 284 | 262 | import bisect
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, -1):
for j in range(i - 1, 0, -1):
k = L[i] - L[j] + 1
if k > L[j - 1]:
break
res += j - bisect.bisect_left(L, k)
print(res)
| N = int(eval(input()))
L = sorted(list(map(int, input().split())))
res = 0
for i in range(N - 1, 1, -1):
j = i - 1
k = 0
while j > k:
while j > k and L[i] >= L[j] + L[k]:
k += 1
res += j - k
j -= 1
print(res)
| false | 8.333333 | [
"-import bisect",
"-",
"- for j in range(i - 1, 0, -1):",
"- k = L[i] - L[j] + 1",
"- if k > L[j - 1]:",
"- break",
"- res += j - bisect.bisect_left(L, k)",
"+ j = i - 1",
"+ k = 0",
"+ while j > k:",
"+ while j > k and L[i] >= L[j] + L[k]:",
... | false | 0.034712 | 0.054567 | 0.636138 | [
"s821158153",
"s390179105"
] |
u821251381 | p03574 | python | s781889704 | s555955238 | 586 | 35 | 37,148 | 3,444 | Accepted | Accepted | 94.03 | import numpy as np
import scipy as sp
from scipy import signal
H,W = map(int,input().split())
A = []
for i in range(H):
A.append(list(input()))
B = np.array(A)
B = np.where(B=="#",1,B)
B = np.where(B==".",0,B)
B = B.astype("int32")
s = np.ones(9).reshape(3,3)
s[1][1]=0
C = sp.signal.convolve2d(B,... | H,W = map(int,input().split())
A = []
for i in range(H):
A.append(list(input()))
for h in range(H):
for w in range(W):
if A[h][w] == "#":
print("#",end="")
elif A[h][w] == ".":
c = 0
for i in range(-1,2):
for j in range(-1,2):
if 0<=h+i<=H-1 and 0<=w+j<=W-1... | 26 | 17 | 506 | 396 | import numpy as np
import scipy as sp
from scipy import signal
H, W = map(int, input().split())
A = []
for i in range(H):
A.append(list(input()))
B = np.array(A)
B = np.where(B == "#", 1, B)
B = np.where(B == ".", 0, B)
B = B.astype("int32")
s = np.ones(9).reshape(3, 3)
s[1][1] = 0
C = sp.signal.convolve2d(B, s, "... | H, W = map(int, input().split())
A = []
for i in range(H):
A.append(list(input()))
for h in range(H):
for w in range(W):
if A[h][w] == "#":
print("#", end="")
elif A[h][w] == ".":
c = 0
for i in range(-1, 2):
for j in range(-1, 2):
... | false | 34.615385 | [
"-import numpy as np",
"-import scipy as sp",
"-from scipy import signal",
"-",
"-B = np.array(A)",
"-B = np.where(B == \"#\", 1, B)",
"-B = np.where(B == \".\", 0, B)",
"-B = B.astype(\"int32\")",
"-s = np.ones(9).reshape(3, 3)",
"-s[1][1] = 0",
"-C = sp.signal.convolve2d(B, s, \"same\").astype... | false | 1.046889 | 0.034266 | 30.552069 | [
"s781889704",
"s555955238"
] |
u974485376 | p02639 | python | s116782363 | s481510165 | 29 | 25 | 9,096 | 8,992 | Accepted | Accepted | 13.79 | m =list(map(int, input().split()))
for i in range(5):
if m[i] == 0:
print((i + 1)) | m =list(map(int, input().split()))
for i in range(len(m)):
if m[i] == 0:
print((i + 1)) | 4 | 4 | 95 | 100 | m = list(map(int, input().split()))
for i in range(5):
if m[i] == 0:
print((i + 1))
| m = list(map(int, input().split()))
for i in range(len(m)):
if m[i] == 0:
print((i + 1))
| false | 0 | [
"-for i in range(5):",
"+for i in range(len(m)):"
] | false | 0.040728 | 0.147247 | 0.276597 | [
"s116782363",
"s481510165"
] |
u197300260 | p03416 | python | s551599087 | s484117671 | 136 | 39 | 3,064 | 3,064 | Accepted | Accepted | 71.32 | # Problem:
# Python Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
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()))
... | # Problem: https://atcoder.jp/contests/abc090/tasks/abc090_b
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): retu... | 46 | 35 | 953 | 790 | # Problem:
# Python Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
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 LLI(... | # Problem: https://atcoder.jp/contests/abc090/tasks/abc090_b
# Python 2nd Try
import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return li... | false | 23.913043 | [
"-# Problem:",
"-# Python Try",
"+# Problem: https://atcoder.jp/contests/abc090/tasks/abc090_b",
"+# Python 2nd Try",
"-def palindromic(Num):",
"- result = False",
"- strNum = str(Num)",
"- strRevNum = strNum[::-1]",
"- checkDigit = 0",
"- for j in range(0, len(strNum)):",
"- ... | false | 0.059258 | 0.042233 | 1.403122 | [
"s551599087",
"s484117671"
] |
u203383537 | p02720 | python | s258143003 | s768567936 | 134 | 55 | 11,080 | 7,156 | Accepted | Accepted | 58.96 | k=int(eval(input()))
a=[]
for i in range(1,10):
a.append(i)
while True:
if k<=len(a):
print((a[k-1]))
break
k-=len(a)
old=[]
old,a=a,old
for x in old:
for i in range(-1,2):
d=x%10+i
if d<0 or d>9:
continue
... | k=int(eval(input()))
a=[i for i in range(1,10)]
for x in a:
if k<=len(a):
break
if x%10!=0:
a.append(10*x+(x%10)-1)
a.append(10*x+(x%10))
if x%10!=9:
a.append(10*x+(x%10)+1)
print((a[k-1])) | 21 | 15 | 361 | 251 | k = int(eval(input()))
a = []
for i in range(1, 10):
a.append(i)
while True:
if k <= len(a):
print((a[k - 1]))
break
k -= len(a)
old = []
old, a = a, old
for x in old:
for i in range(-1, 2):
d = x % 10 + i
if d < 0 or d > 9:
continu... | k = int(eval(input()))
a = [i for i in range(1, 10)]
for x in a:
if k <= len(a):
break
if x % 10 != 0:
a.append(10 * x + (x % 10) - 1)
a.append(10 * x + (x % 10))
if x % 10 != 9:
a.append(10 * x + (x % 10) + 1)
print((a[k - 1]))
| false | 28.571429 | [
"-a = []",
"-for i in range(1, 10):",
"- a.append(i)",
"-while True:",
"+a = [i for i in range(1, 10)]",
"+for x in a:",
"- print((a[k - 1]))",
"- k -= len(a)",
"- old = []",
"- old, a = a, old",
"- for x in old:",
"- for i in range(-1, 2):",
"- d = x ... | false | 0.006938 | 0.035801 | 0.193784 | [
"s258143003",
"s768567936"
] |
u411203878 | p03775 | python | s653354317 | s804249076 | 169 | 64 | 38,640 | 63,692 | Accepted | Accepted | 62.13 | n=int(eval(input()))
halfn=int(2+n**0.5)
for i in range(1,halfn):
if n%i==0:
memo = i
ans = max(len(str(n//memo)), len(str(memo)))
print(ans) | N = int(eval(input()))
ans = 0
for i in range(1,int(N**0.5)+1):
if N%i==0:
ans = i
ans_len = max(len(str(ans)), len(str(N//ans)))
print(ans_len) | 10 | 11 | 159 | 164 | n = int(eval(input()))
halfn = int(2 + n**0.5)
for i in range(1, halfn):
if n % i == 0:
memo = i
ans = max(len(str(n // memo)), len(str(memo)))
print(ans)
| N = int(eval(input()))
ans = 0
for i in range(1, int(N**0.5) + 1):
if N % i == 0:
ans = i
ans_len = max(len(str(ans)), len(str(N // ans)))
print(ans_len)
| false | 9.090909 | [
"-n = int(eval(input()))",
"-halfn = int(2 + n**0.5)",
"-for i in range(1, halfn):",
"- if n % i == 0:",
"- memo = i",
"-ans = max(len(str(n // memo)), len(str(memo)))",
"-print(ans)",
"+N = int(eval(input()))",
"+ans = 0",
"+for i in range(1, int(N**0.5) + 1):",
"+ if N % i == 0:",... | false | 0.050992 | 0.042253 | 1.206811 | [
"s653354317",
"s804249076"
] |
u104171359 | p02384 | python | s062576039 | s260099370 | 30 | 20 | 7,840 | 7,720 | Accepted | Accepted | 33.33 | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
tmp = int()
if direction == 'N':
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
... | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == 'N':
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = s... | 102 | 101 | 2,642 | 2,621 | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
tmp = int()
if direction == "N":
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5... | #!usr/bin/env python3
import sys
class Die:
def __init__(self, pips):
self.pips = pips
def move_die(self, direction):
if direction == "N":
tmp = self.pips[0]
self.pips[0] = self.pips[1]
self.pips[1] = self.pips[5]
self.pips[5] = self.pips[4]
... | false | 0.980392 | [
"- tmp = int()"
] | false | 0.050429 | 0.105019 | 0.480193 | [
"s062576039",
"s260099370"
] |
u353919145 | p02819 | python | s634653867 | s212488956 | 282 | 18 | 2,940 | 3,064 | Accepted | Accepted | 93.62 | a = int(eval(input()))
flag = 0
j = 0
while(flag != 1):
count =0
temp = a+j
for i in range(2, temp):
if(temp %i == 0):
count +=1
if(count == 0):
flag =1
print(temp)
j+=1 | import math
def isPrime(n):
if(n <= 1):
return False
if(n <= 3):
return True
if(n % 2 == 0 or n % 3 == 0):
return False
for i in range(5,int(math.sqrt(n) + 1), 6):
if(n % i == 0 or n % (i + 2) == 0):
return False
re... | 13 | 36 | 231 | 619 | a = int(eval(input()))
flag = 0
j = 0
while flag != 1:
count = 0
temp = a + j
for i in range(2, temp):
if temp % i == 0:
count += 1
if count == 0:
flag = 1
print(temp)
j += 1
| import math
def isPrime(n):
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
for i in range(5, int(math.sqrt(n) + 1), 6):
if n % i == 0 or n % (i + 2) == 0:
return False
return True
def nextPrime(N):
if N <= ... | false | 63.888889 | [
"-a = int(eval(input()))",
"-flag = 0",
"-j = 0",
"-while flag != 1:",
"- count = 0",
"- temp = a + j",
"- for i in range(2, temp):",
"- if temp % i == 0:",
"- count += 1",
"- if count == 0:",
"- flag = 1",
"- print(temp)",
"- j += 1",
"+impor... | false | 0.215109 | 0.036516 | 5.890791 | [
"s634653867",
"s212488956"
] |
u111365362 | p02834 | python | s719553290 | s304686023 | 835 | 765 | 75,552 | 75,040 | Accepted | Accepted | 8.38 | n,u,v = list(map(int,input().split()))
inf = 10 ** 6
u -= 1
v -= 1
peer = [[] for _ in range(n)]
for _ in range(n-1):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
peer[a].append(b)
peer[b].append(a)
seen = [0 for _ in range(n)]
rank = [0 for _ in range(n)]
seen[v] = 1
now = [v]
pst = [[] ... | n,u,v = list(map(int,input().split()))
u -= 1
v -= 1
peer = [[] for _ in range(n)]
for _ in range(n-1):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
peer[a].append(b)
peer[b].append(a)
rank = [10**6 for _ in range(n)]
seen = [0 for _ in range(n)]
pre = [10**6 for _ in range(n)]
pst = [[] fo... | 61 | 46 | 1,219 | 892 | n, u, v = list(map(int, input().split()))
inf = 10**6
u -= 1
v -= 1
peer = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
peer[a].append(b)
peer[b].append(a)
seen = [0 for _ in range(n)]
rank = [0 for _ in range(n)]
seen[v] = 1
now = [v]
pst = [[] ... | n, u, v = list(map(int, input().split()))
u -= 1
v -= 1
peer = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
peer[a].append(b)
peer[b].append(a)
rank = [10**6 for _ in range(n)]
seen = [0 for _ in range(n)]
pre = [10**6 for _ in range(n)]
pst = [[... | false | 24.590164 | [
"-inf = 10**6",
"+rank = [10**6 for _ in range(n)]",
"-rank = [0 for _ in range(n)]",
"+pre = [10**6 for _ in range(n)]",
"+pst = [[] for _ in range(n)]",
"+rank[v] = 0",
"-pst = [[] for _ in range(n)]",
"-pre = [inf for _ in range(n)]",
"- seen[y] = 1",
"+ seen[y] +=... | false | 0.040478 | 0.135778 | 0.298117 | [
"s719553290",
"s304686023"
] |
u888092736 | p02947 | python | s823398707 | s981110247 | 540 | 421 | 15,328 | 18,236 | Accepted | Accepted | 22.04 | N = int(input())
strings = sorted(str(sorted(input())) for _ in range(N))
ans = 0
cnt = 1
for i in range(N - 1):
if strings[i] == strings[i + 1]:
cnt += 1
else:
if cnt > 1:
ans += cnt * (cnt - 1) // 2
cnt = 1
print(ans) if cnt <= 1 else print(ans + cnt * (cnt - 1... | from collections import defaultdict
N = int(eval(input()))
dic = defaultdict(int)
ans = 0
for _ in range(N):
elem = ''.join(sorted(eval(input())))
ans += dic[elem]
dic[elem] += 1
print(ans)
| 13 | 11 | 328 | 202 | N = int(input())
strings = sorted(str(sorted(input())) for _ in range(N))
ans = 0
cnt = 1
for i in range(N - 1):
if strings[i] == strings[i + 1]:
cnt += 1
else:
if cnt > 1:
ans += cnt * (cnt - 1) // 2
cnt = 1
print(ans) if cnt <= 1 else print(ans + cnt * (cnt - 1) // 2)
| from collections import defaultdict
N = int(eval(input()))
dic = defaultdict(int)
ans = 0
for _ in range(N):
elem = "".join(sorted(eval(input())))
ans += dic[elem]
dic[elem] += 1
print(ans)
| false | 15.384615 | [
"-N = int(input())",
"-strings = sorted(str(sorted(input())) for _ in range(N))",
"+from collections import defaultdict",
"+",
"+N = int(eval(input()))",
"+dic = defaultdict(int)",
"-cnt = 1",
"-for i in range(N - 1):",
"- if strings[i] == strings[i + 1]:",
"- cnt += 1",
"- else:",
... | false | 0.042405 | 0.075823 | 0.559257 | [
"s823398707",
"s981110247"
] |
u456879806 | p03826 | python | s301544226 | s717630910 | 26 | 24 | 9,108 | 9,132 | Accepted | Accepted | 7.69 | A, B, C, D = list(map(int,input().split()))
if A * B == C * D:
print((A * B))
else:
print((max(A * B, C * D))) | a, b, c, d = list(map(int,input().split()))
print((max(a * b, c * d))) | 6 | 2 | 114 | 63 | A, B, C, D = list(map(int, input().split()))
if A * B == C * D:
print((A * B))
else:
print((max(A * B, C * D)))
| a, b, c, d = list(map(int, input().split()))
print((max(a * b, c * d)))
| false | 66.666667 | [
"-A, B, C, D = list(map(int, input().split()))",
"-if A * B == C * D:",
"- print((A * B))",
"-else:",
"- print((max(A * B, C * D)))",
"+a, b, c, d = list(map(int, input().split()))",
"+print((max(a * b, c * d)))"
] | false | 0.095514 | 0.084284 | 1.133236 | [
"s301544226",
"s717630910"
] |
u153665391 | p02267 | python | s847637241 | s810127419 | 70 | 20 | 8,536 | 8,544 | Accepted | Accepted | 71.43 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
cnt = 0
for i in T:
for j in S:
if i == j:
cnt += 1
break
print(cnt) | n = int(eval(input()))
S = set([int(i) for i in input().split()])
q = int(eval(input()))
T = set([int(i) for i in input().split()])
print((len( S & T ))) | 12 | 5 | 222 | 143 | N = int(eval(input()))
S = list(map(int, input().split()))
Q = int(eval(input()))
T = list(map(int, input().split()))
cnt = 0
for i in T:
for j in S:
if i == j:
cnt += 1
break
print(cnt)
| n = int(eval(input()))
S = set([int(i) for i in input().split()])
q = int(eval(input()))
T = set([int(i) for i in input().split()])
print((len(S & T)))
| false | 58.333333 | [
"-N = int(eval(input()))",
"-S = list(map(int, input().split()))",
"-Q = int(eval(input()))",
"-T = list(map(int, input().split()))",
"-cnt = 0",
"-for i in T:",
"- for j in S:",
"- if i == j:",
"- cnt += 1",
"- break",
"-print(cnt)",
"+n = int(eval(input()))",
... | false | 0.038636 | 0.038338 | 1.007776 | [
"s847637241",
"s810127419"
] |
u361826811 | p03485 | python | s230865579 | s095104364 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | """
author : halo2halo
date : 24,Oct,2019
"""
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)
n, a = list(map(int, readline().rstrip().split()))
ans = int((n+a+1)/2)
print(ans)
| """
author : halo2halo
date : 29, Jan, 2020
"""
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B = list(map(int, readline().split()))
print(((A+B+1)//2))
| 16 | 17 | 247 | 277 | """
author : halo2halo
date : 24,Oct,2019
"""
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**7)
n, a = list(map(int, readline().rstrip().split()))
ans = int((n + a + 1) / 2)
print(ans)
| """
author : halo2halo
date : 29, Jan, 2020
"""
import sys
import itertools
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
A, B = list(map(int, readline().split()))
print(((A + B + 1) // 2))
| false | 5.882353 | [
"-date : 24,Oct,2019",
"+date : 29, Jan, 2020",
"+import itertools",
"-readline = sys.stdin.readline",
"-readlines = sys.stdin.readlines",
"-sys.setrecursionlimit(10**7)",
"-n, a = list(map(int, readline().rstrip().split()))",
"-ans = int((n + a + 1) / 2)",
"-print(ans)",
"+# import numpy as np",
... | false | 0.086798 | 0.08602 | 1.009044 | [
"s230865579",
"s095104364"
] |
u315485238 | p02844 | python | s400918340 | s905132987 | 1,658 | 21 | 15,260 | 3,060 | Accepted | Accepted | 98.73 | N = int(eval(input()))
S = list(eval(input()))
S = [int(s) for s in S]
left = [[0]*10 for _ in range(N)]
right = [[0]*10 for _ in range(N+1)]
ans = [0]*1000 #ans[000]~[999]=Bool
for i,s in enumerate(S):
for j in range(10):
left[i][j] = left[i-1][j]
left[i][s] = 1
for i,s in enumerate(S[::-1]... | N = int(eval(input()))
S = eval(input())
from itertools import product
p = product([str(i) for i in range(10)], repeat=3)
ans = 0
for i,j,k in p:
x = S.find(i)
if x<0:
continue
y = S[x+1:].find(j)
if y<0:
continue
z = S[x+y+2:].find(k)
if z<0:
continue
#print(i,j,k, S, S[x... | 28 | 22 | 626 | 353 | N = int(eval(input()))
S = list(eval(input()))
S = [int(s) for s in S]
left = [[0] * 10 for _ in range(N)]
right = [[0] * 10 for _ in range(N + 1)]
ans = [0] * 1000 # ans[000]~[999]=Bool
for i, s in enumerate(S):
for j in range(10):
left[i][j] = left[i - 1][j]
left[i][s] = 1
for i, s in enumerate(S[::-... | N = int(eval(input()))
S = eval(input())
from itertools import product
p = product([str(i) for i in range(10)], repeat=3)
ans = 0
for i, j, k in p:
x = S.find(i)
if x < 0:
continue
y = S[x + 1 :].find(j)
if y < 0:
continue
z = S[x + y + 2 :].find(k)
if z < 0:
continue
... | false | 21.428571 | [
"-S = list(eval(input()))",
"-S = [int(s) for s in S]",
"-left = [[0] * 10 for _ in range(N)]",
"-right = [[0] * 10 for _ in range(N + 1)]",
"-ans = [0] * 1000 # ans[000]~[999]=Bool",
"-for i, s in enumerate(S):",
"- for j in range(10):",
"- left[i][j] = left[i - 1][j]",
"- left[i][s] ... | false | 0.050145 | 0.048751 | 1.0286 | [
"s400918340",
"s905132987"
] |
u350248178 | p03699 | python | s664600788 | s026056587 | 19 | 17 | 3,060 | 3,064 | Accepted | Accepted | 10.53 | n=int(eval(input()))
s=[]
w=0
m=1000
for i in range(n):
a=int(eval(input()))
s.append(a)
w+=a
if a%10!=0:
m=min(m,a)
if m==1000:
print((0))
elif w%10!=0:
print(w)
else:
print((w-m))
| n=int(eval(input()))
s=[]
l=[]
for i in range(n):
p=int(eval(input()))
s.append(p)
if p%10!=0:
l.append(p)
ans=sum(s)
if ans%10==0:
if l==[]:
print((0))
else:
print((ans-min(l)))
else:
print(ans)
| 19 | 19 | 223 | 249 | n = int(eval(input()))
s = []
w = 0
m = 1000
for i in range(n):
a = int(eval(input()))
s.append(a)
w += a
if a % 10 != 0:
m = min(m, a)
if m == 1000:
print((0))
elif w % 10 != 0:
print(w)
else:
print((w - m))
| n = int(eval(input()))
s = []
l = []
for i in range(n):
p = int(eval(input()))
s.append(p)
if p % 10 != 0:
l.append(p)
ans = sum(s)
if ans % 10 == 0:
if l == []:
print((0))
else:
print((ans - min(l)))
else:
print(ans)
| false | 0 | [
"-w = 0",
"-m = 1000",
"+l = []",
"- a = int(eval(input()))",
"- s.append(a)",
"- w += a",
"- if a % 10 != 0:",
"- m = min(m, a)",
"-if m == 1000:",
"- print((0))",
"-elif w % 10 != 0:",
"- print(w)",
"+ p = int(eval(input()))",
"+ s.append(p)",
"+ if p ... | false | 0.042721 | 0.03687 | 1.158688 | [
"s664600788",
"s026056587"
] |
u488401358 | p02821 | python | s617615855 | s322914383 | 317 | 283 | 56,356 | 53,436 | Accepted | Accepted | 10.73 | import sys
input=sys.stdin.readline
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
def condition(num):
count=0
s=N-1
t=0
while N-1>=t and s>=0:
if num>A[s]+A[t]:
t+=1
else:
count+=N-t
s-=1
return c... | N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
def condition(num):
count=0
s=N-1
t=0
while N-1>=t and s>=0:
if num>A[s]+A[t]:
t+=1
else:
count+=N-t
s-=1
return count>=M
subans=0
start=1
end=2*A[N-1]... | 50 | 46 | 802 | 761 | import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
def condition(num):
count = 0
s = N - 1
t = 0
while N - 1 >= t and s >= 0:
if num > A[s] + A[t]:
t += 1
else:
count += N - t
s ... | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
def condition(num):
count = 0
s = N - 1
t = 0
while N - 1 >= t and s >= 0:
if num > A[s] + A[t]:
t += 1
else:
count += N - t
s -= 1
return count >= M
subans = 0... | false | 8 | [
"-import sys",
"-",
"-input = sys.stdin.readline"
] | false | 0.046006 | 0.04491 | 1.024404 | [
"s617615855",
"s322914383"
] |
u334712262 | p02685 | python | s911663665 | s317527573 | 195 | 132 | 120,244 | 109,588 | Accepted | Accepted | 32.31 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutati... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def read_float():
retu... | 128 | 117 | 2,624 | 2,284 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2**62 - 1
def read_int():
return int(buff_readline())
def read_int_n():
return list(map(int, buff_readline().split()))
def read_float():
return float(buff_re... | false | 8.59375 | [
"-import bisect",
"-import heapq",
"-import math",
"-import random",
"-from collections import Counter, defaultdict, deque",
"-from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal",
"-from functools import lru_cache, reduce",
"-from itertools import combinations, combinations_with_replacement, pr... | false | 0.115858 | 0.442142 | 0.262039 | [
"s911663665",
"s317527573"
] |
u733814820 | p02928 | python | s363551611 | s420351094 | 530 | 448 | 3,188 | 9,276 | Accepted | Accepted | 15.47 | MOD = 10**9+7
def resolve():
ans = 0
q1 = 0
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
c = [0] * n # 自分より小さい値が全体に何個あるか
for i in range(n):
for j in range(i, n):
if a[i] > a[j]:
q1 += 1
ans = q1 * k % MOD
q2 = 0
for i in range(n):
... | def resolve():
mod = 1000000007
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 0
# A の転倒数を求める
for i in range(n):
for j in range(i+1, n):
if a[i] > a[j]:
x += 1
# A のすべての数字に対して,A内に自分より小さいものが何個あるか
y = 0
for i in range(n):
for j in range(... | 31 | 26 | 526 | 522 | MOD = 10**9 + 7
def resolve():
ans = 0
q1 = 0
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
c = [0] * n # 自分より小さい値が全体に何個あるか
for i in range(n):
for j in range(i, n):
if a[i] > a[j]:
q1 += 1
ans = q1 * k % MOD
q2 = 0
f... | def resolve():
mod = 1000000007
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 0
# A の転倒数を求める
for i in range(n):
for j in range(i + 1, n):
if a[i] > a[j]:
x += 1
# A のすべての数字に対して,A内に自分より小さいものが何個あるか
y = 0
for i in rang... | false | 16.129032 | [
"-MOD = 10**9 + 7",
"-",
"-",
"- ans = 0",
"- q1 = 0",
"+ mod = 1000000007",
"- c = [0] * n # 自分より小さい値が全体に何個あるか",
"+ x = 0",
"+ # A の転倒数を求める",
"- for j in range(i, n):",
"+ for j in range(i + 1, n):",
"- q1 += 1",
"- ans = q1 * k % MOD",
"... | false | 0.035546 | 0.035477 | 1.001949 | [
"s363551611",
"s420351094"
] |
u392319141 | p02948 | python | s016403876 | s930189439 | 743 | 497 | 66,464 | 27,676 | Accepted | Accepted | 33.11 | import heapq
N, M = list(map(int, input().split()))
arb = [[] for _ in range(M + 1)]
for _ in range(N) :
a, b = list(map(int, input().split()))
if a <= M :
arb[a].append(-b)
arbList = []
ans = 0
for day in range(M + 1) :
for b in arb[day] :
heapq.heappush(arbList, b)
... | from collections import defaultdict
import heapq
N, M = list(map(int, input().split()))
arbList = defaultdict(lambda: [])
for _ in range(N):
a, b = list(map(int, input().split()))
arbList[a].append(-b)
arb = []
ans = 0
for day in range(M + 1):
for b in arbList[day]:
heapq.heappu... | 20 | 21 | 374 | 381 | import heapq
N, M = list(map(int, input().split()))
arb = [[] for _ in range(M + 1)]
for _ in range(N):
a, b = list(map(int, input().split()))
if a <= M:
arb[a].append(-b)
arbList = []
ans = 0
for day in range(M + 1):
for b in arb[day]:
heapq.heappush(arbList, b)
if arbList:
ans... | from collections import defaultdict
import heapq
N, M = list(map(int, input().split()))
arbList = defaultdict(lambda: [])
for _ in range(N):
a, b = list(map(int, input().split()))
arbList[a].append(-b)
arb = []
ans = 0
for day in range(M + 1):
for b in arbList[day]:
heapq.heappush(arb, b)
if ar... | false | 4.761905 | [
"+from collections import defaultdict",
"-arb = [[] for _ in range(M + 1)]",
"+arbList = defaultdict(lambda: [])",
"- if a <= M:",
"- arb[a].append(-b)",
"-arbList = []",
"+ arbList[a].append(-b)",
"+arb = []",
"- for b in arb[day]:",
"- heapq.heappush(arbList, b)",
"- ... | false | 0.156213 | 0.038705 | 4.035982 | [
"s016403876",
"s930189439"
] |
u707124227 | p02807 | python | s011570509 | s403918962 | 472 | 174 | 25,956 | 111,648 | Accepted | Accepted | 63.14 | n=int(eval(input()))
x=list(map(int,input().split()))
mod=pow(10,9)+7
def cmb(n,r,mod):
if (r<0 or r>n):
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
g1=[1,1] # g1[i]=i! % mod :階乗
g2=[1,1] # g2[i]=(i!)^(-1) % mod :階乗の逆元
inverse=[0,1]
for i in range(2,n+1):
g1.append((g1[-1]*i)%mod)
... | n=int(eval(input()))
x=list(map(int,input().split()))
mod=10**9+7
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n,r,mod):
if (r<0 or r>n):
return 0
r=min(r,n-r)
return g1[n]*g2[r]*g2[n-r]%mod
g1=[1,1] # g1[i]=i! % mod :階乗
g2=[1,1] # g2[i]=(i!)^(-1) % mod :階乗の逆元
inverse=[0,1]
for i in ran... | 21 | 31 | 502 | 647 | n = int(eval(input()))
x = list(map(int, input().split()))
mod = pow(10, 9) + 7
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
g1 = [1, 1] # g1[i]=i! % mod :階乗
g2 = [1, 1] # g2[i]=(i!)^(-1) % mod :階乗の逆元
inverse = [0, 1]
for i in range(2... | n = int(eval(input()))
x = list(map(int, input().split()))
mod = 10**9 + 7
# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる
def cmb(n, r, mod):
if r < 0 or r > n:
return 0
r = min(r, n - r)
return g1[n] * g2[r] * g2[n - r] % mod
g1 = [1, 1] # g1[i]=i! % mod :階乗
g2 = [1, 1] # g2[i]=(i!)^(-1) % mod :... | false | 32.258065 | [
"-mod = pow(10, 9) + 7",
"-",
"-",
"+mod = 10**9 + 7",
"+# コンビネーション、さらに高速。あらかじめO(N)の計算をすることでのちの計算が早くなる",
"+nn = [g1[n - 1]]",
"+tmp = g1[n - 1]",
"+for i in range(2, n):",
"+ tmp += g1[n - 1] * pow(i, mod - 2, mod)",
"+ tmp %= mod",
"+ nn.append(tmp)",
"- ans += (x[n - 1] - x[i]) *... | false | 0.037188 | 0.036334 | 1.023503 | [
"s011570509",
"s403918962"
] |
u832039789 | p03294 | python | s570935588 | s334209611 | 43 | 18 | 3,188 | 3,316 | Accepted | Accepted | 58.14 | print((-int(eval(input()))+sum(map(int,input().split())))) | eval(input());print((sum([x-1 for x in list(map(int,input().split()))]))) | 1 | 1 | 50 | 68 | print((-int(eval(input())) + sum(map(int, input().split()))))
| eval(input())
print((sum([x - 1 for x in list(map(int, input().split()))])))
| false | 0 | [
"-print((-int(eval(input())) + sum(map(int, input().split()))))",
"+eval(input())",
"+print((sum([x - 1 for x in list(map(int, input().split()))])))"
] | false | 0.038443 | 0.103212 | 0.372472 | [
"s570935588",
"s334209611"
] |
u301624971 | p03835 | python | s224452832 | s640964733 | 1,671 | 248 | 2,940 | 40,940 | Accepted | Accepted | 85.16 | K,S = list(map(int,input().split()))
counter = 0
for x in range(K+1):
for y in range(K+1):
z = S - x - y
if(0 <= z and z<= K):
counter += 1
print(counter)
| def myAnswer(K:int,S:int) -> int:
ans = 0
for x in range(K+1):
for y in range(K+1):
z = S - (x + y)
if 0 <= z and z <= K:
ans += 1
return ans
def modelAnswer():
return
def main():
K,S = list(map(int,input().split()))
print((myAnswer(K,S)))
if __name__ ==... | 11 | 16 | 194 | 335 | K, S = list(map(int, input().split()))
counter = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - x - y
if 0 <= z and z <= K:
counter += 1
print(counter)
| def myAnswer(K: int, S: int) -> int:
ans = 0
for x in range(K + 1):
for y in range(K + 1):
z = S - (x + y)
if 0 <= z and z <= K:
ans += 1
return ans
def modelAnswer():
return
def main():
K, S = list(map(int, input().split()))
print((myAnswer(K,... | false | 31.25 | [
"-K, S = list(map(int, input().split()))",
"-counter = 0",
"-for x in range(K + 1):",
"- for y in range(K + 1):",
"- z = S - x - y",
"- if 0 <= z and z <= K:",
"- counter += 1",
"-print(counter)",
"+def myAnswer(K: int, S: int) -> int:",
"+ ans = 0",
"+ for x in... | false | 0.042424 | 0.03641 | 1.16518 | [
"s224452832",
"s640964733"
] |
u699089116 | p03494 | python | s664477960 | s938184607 | 230 | 165 | 39,024 | 38,896 | Accepted | Accepted | 28.26 | n = int(eval(input()))
a = list(map(int, input().split()))
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
while True:
for i in range(n):
if a[i] % 2 == 0:
a[i] = a[i] // 2
else:
break
else:
cnt += 1
continue
break
print(cnt) | 39 | 16 | 650 | 264 | n = int(eval(input()))
a = list(map(int, input().split()))
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-(n**0.5) // 1)) + 1):
if temp % i == 0:
cnt = 0
while temp % i == 0:
cnt += 1
temp //= i
arr.append([i, cn... | n = int(eval(input()))
a = list(map(int, input().split()))
cnt = 0
while True:
for i in range(n):
if a[i] % 2 == 0:
a[i] = a[i] // 2
else:
break
else:
cnt += 1
continue
break
print(cnt)
| false | 58.974359 | [
"-",
"-",
"-def factorization(n):",
"- arr = []",
"- temp = n",
"- for i in range(2, int(-(-(n**0.5) // 1)) + 1):",
"- if temp % i == 0:",
"- cnt = 0",
"- while temp % i == 0:",
"- cnt += 1",
"- temp //= i",
"- arr.... | false | 0.041782 | 0.080463 | 0.51927 | [
"s664477960",
"s938184607"
] |
u530606147 | p02708 | python | s653566170 | s361443347 | 22 | 20 | 9,168 | 9,096 | Accepted | Accepted | 9.09 | n, k = list(map(int, input().split()))
MOD = 10**9 + 7
print(((-2 + k - n) * (-6 - 2 * k + 2 * k**2 - n - k * n - n**2) // 6 % MOD)) | n,k=list(map(int,input().split()))
print(((-2+k-n)*(-6-2*k+2*k**2-n-k*n-n**2)//6%(10**9+7))) | 3 | 2 | 132 | 91 | n, k = list(map(int, input().split()))
MOD = 10**9 + 7
print(((-2 + k - n) * (-6 - 2 * k + 2 * k**2 - n - k * n - n**2) // 6 % MOD))
| n, k = list(map(int, input().split()))
print(
((-2 + k - n) * (-6 - 2 * k + 2 * k**2 - n - k * n - n**2) // 6 % (10**9 + 7))
)
| false | 33.333333 | [
"-MOD = 10**9 + 7",
"-print(((-2 + k - n) * (-6 - 2 * k + 2 * k**2 - n - k * n - n**2) // 6 % MOD))",
"+print(",
"+ ((-2 + k - n) * (-6 - 2 * k + 2 * k**2 - n - k * n - n**2) // 6 % (10**9 + 7))",
"+)"
] | false | 0.034277 | 0.158711 | 0.21597 | [
"s653566170",
"s361443347"
] |
u535803878 | p03078 | python | s552284472 | s906551462 | 588 | 380 | 216,232 | 58,548 | Accepted | Accepted | 35.37 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
x,y,z,K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = [(a[i]+b[j])... | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
import numpy as np
x,y,z,K = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
b = np.array(list(map(int, input().split())),... | 18 | 20 | 570 | 588 | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
x, y, z, K = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab = [(a[i] + b[j]) for ... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
import numpy as np
x, y, z, K = list(map(int, input().split()))
a = np.array(list(map(int, input().split())), dtype=np.int64)
b = np.array(list(map(int, input().split())), dtyp... | false | 10 | [
"+import numpy as np",
"+",
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"-c = list(map(int, input().split()))",
"-ab = [(a[i] + b[j]) for i in range(x) for j in range(y)]",
"-ab.sort(reverse=True)",
"-c.sort(reverse=True)",
"-abk = ab[:K]",
"-ck = c[:K]",
"-l ... | false | 0.038809 | 0.273945 | 0.141667 | [
"s552284472",
"s906551462"
] |
u672475305 | p02726 | python | s203719432 | s862494903 | 1,306 | 1,110 | 139,016 | 70,236 | Accepted | Accepted | 15.01 | from collections import deque
n,x,y = list(map(int,input().split()))
x,y = x-1 ,y-1
g = [[float('inf')]*n for _ in range(n)]
for i in range(n):
que = deque([(i, 0)])
while que:
node, cost = que.popleft()
if g[i][node]!=float('inf'):
continue
else:
g[i][... | from collections import deque
def main():
n,x,y = list(map(int,input().split()))
cnt = [0]*n
for i in range(n):
d = [float('inf')]*n
que = deque([(i, 0)])
while que:
idx, c = que.popleft()
if d[idx]!=float('inf'):
d[idx] = min(d[idx],... | 26 | 29 | 722 | 850 | from collections import deque
n, x, y = list(map(int, input().split()))
x, y = x - 1, y - 1
g = [[float("inf")] * n for _ in range(n)]
for i in range(n):
que = deque([(i, 0)])
while que:
node, cost = que.popleft()
if g[i][node] != float("inf"):
continue
else:
g[i... | from collections import deque
def main():
n, x, y = list(map(int, input().split()))
cnt = [0] * n
for i in range(n):
d = [float("inf")] * n
que = deque([(i, 0)])
while que:
idx, c = que.popleft()
if d[idx] != float("inf"):
d[idx] = min(d[idx]... | false | 10.344828 | [
"-n, x, y = list(map(int, input().split()))",
"-x, y = x - 1, y - 1",
"-g = [[float(\"inf\")] * n for _ in range(n)]",
"-for i in range(n):",
"- que = deque([(i, 0)])",
"- while que:",
"- node, cost = que.popleft()",
"- if g[i][node] != float(\"inf\"):",
"- continue",
... | false | 0.043813 | 0.037447 | 1.169993 | [
"s203719432",
"s862494903"
] |
u308684517 | p03273 | python | s504715730 | s853882870 | 23 | 18 | 3,064 | 3,060 | Accepted | Accepted | 21.74 | h, w = list(map(int, input().split()))
a = []
for i in range(h):
wi = eval(input())
if wi != "."*w:
a.append(wi)
b = []
for j in range(w):
wi2 = ""
for i in range(len(a)):
wi2 += a[i][w-j-1]
if wi2 != "."*len(a):
b.append(wi2)
ans = []
for i in range(len(b[0])):... | h, w = list(map(int, input().split()))
a = []
for i in range(h):
wi = eval(input())
if wi != "."*w:
a.append(wi)
b = list(zip(*[x for x in zip(*a) if "#" in x]))
for i in b:
print(("".join(i))) | 19 | 9 | 401 | 201 | h, w = list(map(int, input().split()))
a = []
for i in range(h):
wi = eval(input())
if wi != "." * w:
a.append(wi)
b = []
for j in range(w):
wi2 = ""
for i in range(len(a)):
wi2 += a[i][w - j - 1]
if wi2 != "." * len(a):
b.append(wi2)
ans = []
for i in range(len(b[0])):
h... | h, w = list(map(int, input().split()))
a = []
for i in range(h):
wi = eval(input())
if wi != "." * w:
a.append(wi)
b = list(zip(*[x for x in zip(*a) if "#" in x]))
for i in b:
print(("".join(i)))
| false | 52.631579 | [
"-b = []",
"-for j in range(w):",
"- wi2 = \"\"",
"- for i in range(len(a)):",
"- wi2 += a[i][w - j - 1]",
"- if wi2 != \".\" * len(a):",
"- b.append(wi2)",
"-ans = []",
"-for i in range(len(b[0])):",
"- hi3 = \"\"",
"- for j in range(len(b)):",
"- hi3 += b[... | false | 0.04095 | 0.037563 | 1.090169 | [
"s504715730",
"s853882870"
] |
u761320129 | p03007 | python | s447704958 | s037451752 | 277 | 177 | 20,992 | 24,596 | Accepted | Accepted | 36.1 | N = int(eval(input()))
A = list(map(int,input().split()))
pos = []
neg = []
zeros = 0
for a in A:
if a > 0:
pos.append(a)
elif a < 0:
neg.append(a)
else:
zeros += 1
pos.sort()
neg.sort()
ope = []
if len(pos) == len(neg) == 0:
print((0))
for i in range... | N = int(eval(input()))
A = list(map(int,input().split()))
A.sort()
from collections import deque
q = deque(A)
mn = q.popleft()
mx = q.pop()
arr = []
for a in q:
if a >= 0:
arr.append((mn, a))
mn -= a
else:
arr.append((mx, a))
mx -= a
arr.append((mx, mn))
print... | 63 | 21 | 1,145 | 356 | N = int(eval(input()))
A = list(map(int, input().split()))
pos = []
neg = []
zeros = 0
for a in A:
if a > 0:
pos.append(a)
elif a < 0:
neg.append(a)
else:
zeros += 1
pos.sort()
neg.sort()
ope = []
if len(pos) == len(neg) == 0:
print((0))
for i in range(N - 1):
print((... | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from collections import deque
q = deque(A)
mn = q.popleft()
mx = q.pop()
arr = []
for a in q:
if a >= 0:
arr.append((mn, a))
mn -= a
else:
arr.append((mx, a))
mx -= a
arr.append((mx, mn))
print((mx - mn))
for a,... | false | 66.666667 | [
"-pos = []",
"-neg = []",
"-zeros = 0",
"-for a in A:",
"- if a > 0:",
"- pos.append(a)",
"- elif a < 0:",
"- neg.append(a)",
"+A.sort()",
"+from collections import deque",
"+",
"+q = deque(A)",
"+mn = q.popleft()",
"+mx = q.pop()",
"+arr = []",
"+for a in q:",
"+... | false | 0.045433 | 0.039056 | 1.16329 | [
"s447704958",
"s037451752"
] |
u588341295 | p02787 | python | s844129563 | s229878786 | 1,081 | 918 | 192,280 | 191,512 | Accepted | Accepted | 15.08 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 36 | 35 | 1,100 | 1,062 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2.777778 | [
"- dp[i][j] = min(dp[i][j], dp[i - 1][j - a] + b)",
"- dp[i][j] = min(dp[i][j], dp[i][j - a] + b)",
"+ dp[i][j] = min(dp[i][j], dp[i][j - a] + b, dp[i - 1][j - a] + b)"
] | false | 0.393771 | 0.37418 | 1.052358 | [
"s844129563",
"s229878786"
] |
u922449550 | p03379 | python | s591842112 | s929992923 | 408 | 280 | 39,588 | 25,472 | Accepted | Accepted | 31.37 | N = int(input())
X = list(map(int, input().split()))
Y = list(enumerate(X))
Y.sort(key=lambda x:x[1])
mid = [Y[N//2-1][1], Y[N//2][1]]
ans = [-1] * N
for i, y in Y:
if y <= mid[0]:
ans[i] = mid[1]
else:
ans[i] = mid[0]
print(*ans, sep='\n')
| N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
m1, m2 = Y[N//2-1], Y[N//2]
for x in X:
if x <= m1:
print(m2)
else:
print(m1) | 13 | 10 | 265 | 166 | N = int(input())
X = list(map(int, input().split()))
Y = list(enumerate(X))
Y.sort(key=lambda x: x[1])
mid = [Y[N // 2 - 1][1], Y[N // 2][1]]
ans = [-1] * N
for i, y in Y:
if y <= mid[0]:
ans[i] = mid[1]
else:
ans[i] = mid[0]
print(*ans, sep="\n")
| N = int(eval(input()))
X = list(map(int, input().split()))
Y = sorted(X)
m1, m2 = Y[N // 2 - 1], Y[N // 2]
for x in X:
if x <= m1:
print(m2)
else:
print(m1)
| false | 23.076923 | [
"-N = int(input())",
"+N = int(eval(input()))",
"-Y = list(enumerate(X))",
"-Y.sort(key=lambda x: x[1])",
"-mid = [Y[N // 2 - 1][1], Y[N // 2][1]]",
"-ans = [-1] * N",
"-for i, y in Y:",
"- if y <= mid[0]:",
"- ans[i] = mid[1]",
"+Y = sorted(X)",
"+m1, m2 = Y[N // 2 - 1], Y[N // 2]",
... | false | 0.030194 | 0.040842 | 0.739293 | [
"s591842112",
"s929992923"
] |
u546285759 | p01131 | python | s312415735 | s308716736 | 60 | 30 | 7,728 | 8,692 | Accepted | Accepted | 50 | d = {"1": [".", ",", "!", "?", " "], "2": ["a", "b", "c"], "3": ["d", "e", "f"],
"4": ["g", "h", "i"], "5": ["j", "k", "l"], "6": ["m", "n", "o"],
"7": ["p", "q", "r", "s"], "8": ["t", "u", "v"], "9": ["w", "x", "y", "z"]}
n = int(eval(input()))
m = [eval(input()) for _ in range(n)]
for line in m:
... | d = {"1": [".", ",", "!", "?", " "], "2": ["a", "b", "c"], "3": ["d", "e", "f"],
"4": ["g", "h", "i"], "5": ["j", "k", "l"], "6": ["m", "n", "o"],
"7": ["p", "q", "r", "s"], "8": ["t", "u", "v"], "9": ["w", "x", "y", "z"]}
n = int(input())
m = [input() for _ in range(n)]
ans = [[d[cs[0]][len(cs) % len(... | 14 | 10 | 500 | 432 | d = {
"1": [".", ",", "!", "?", " "],
"2": ["a", "b", "c"],
"3": ["d", "e", "f"],
"4": ["g", "h", "i"],
"5": ["j", "k", "l"],
"6": ["m", "n", "o"],
"7": ["p", "q", "r", "s"],
"8": ["t", "u", "v"],
"9": ["w", "x", "y", "z"],
}
n = int(eval(input()))
m = [eval(input()) for _ in range(n... | d = {
"1": [".", ",", "!", "?", " "],
"2": ["a", "b", "c"],
"3": ["d", "e", "f"],
"4": ["g", "h", "i"],
"5": ["j", "k", "l"],
"6": ["m", "n", "o"],
"7": ["p", "q", "r", "s"],
"8": ["t", "u", "v"],
"9": ["w", "x", "y", "z"],
}
n = int(input())
m = [input() for _ in range(n)]
ans = [
... | false | 28.571429 | [
"-n = int(eval(input()))",
"-m = [eval(input()) for _ in range(n)]",
"-for line in m:",
"- ans = []",
"- for cs in line.split(\"0\"):",
"- if cs == \"\":",
"- continue",
"- index = len(cs) % len(d[cs[0]]) - 1",
"- ans.append(d[cs[0]][index])",
"- print((\"\... | false | 0.038644 | 0.03955 | 0.977097 | [
"s312415735",
"s308716736"
] |
u588341295 | p03599 | python | s746137719 | s476958924 | 392 | 309 | 108,892 | 107,740 | Accepted | Accepted | 21.17 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 62 | 64 | 1,653 | 1,678 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 3.125 | [
"-# dp[i][j] := 水i、砂糖jの状態を実施可能か",
"+# dp[i][j] := 水i、砂糖jの状態を実現可能か",
"- # 実施可能な状態なら、4つの行動を遷移させる",
"- if i + A <= F:",
"- dp[i + A][j] |= dp[i][j]",
"- if i + B <= F:",
"- dp[i + B][j] |= dp[i][j]",
"- if j + C <= F:",
"- dp[i][j + C] |= dp[... | false | 0.008166 | 0.731362 | 0.011165 | [
"s746137719",
"s476958924"
] |
u313021086 | p02412 | python | s102520871 | s491261002 | 780 | 470 | 5,596 | 5,596 | Accepted | Accepted | 39.74 | n, x = list(map(int, input().split()))
while n != 0 or x != 0:
cnt = 0
i = 1
while i <= n - 2:
j = i + 1
# if i >= x:
# break
while j <= n - 1:
k = j + 1
# if i + j >= x:
# break
while k <= n:
# if i + j + k > x:
# break
if i + j + k == x:
cnt += 1
k += 1
... | n, x = list(map(int, input().split()))
while n != 0 or x != 0:
cnt = 0
i = 1
while i <= n - 2:
j = i + 1
if i >= x:
break
while j <= n - 1:
k = j + 1
if i + j >= x:
break
while k <= n:
if i + j + k > x:
break
if i + j + k == x:
cnt += 1
k += 1
j += 1... | 23 | 23 | 379 | 373 | n, x = list(map(int, input().split()))
while n != 0 or x != 0:
cnt = 0
i = 1
while i <= n - 2:
j = i + 1
# if i >= x:
# break
while j <= n - 1:
k = j + 1
# if i + j >= x:
# break
while k <= n:
# if i +... | n, x = list(map(int, input().split()))
while n != 0 or x != 0:
cnt = 0
i = 1
while i <= n - 2:
j = i + 1
if i >= x:
break
while j <= n - 1:
k = j + 1
if i + j >= x:
break
while k <= n:
if i + j + k > x:
... | false | 0 | [
"- # \tif i >= x:",
"- # \t\tbreak",
"+ if i >= x:",
"+ break",
"- # \t\tif i + j >= x:",
"- # \t\t\tbreak",
"+ if i + j >= x:",
"+ break",
"- # \t\t\tif i + j + k > x:",
"- # \t\t\t\tbrea... | false | 0.041253 | 0.037813 | 1.090961 | [
"s102520871",
"s491261002"
] |
u936985471 | p02850 | python | s721968068 | s500950914 | 970 | 651 | 55,344 | 46,760 | Accepted | Accepted | 32.89 | N=int(eval(input()))
E=[None]*(N-1)
EV=[[] for i in range(N)]
for i in range(N-1):
a,b=list(map(int,input().split()))
a,b=a-1,b-1
E[i]=[a,b]
# 相手, 色, 回答出力順(-1は無視)
EV[a].append([b,-1,i])
EV[b].append([a,-1,-1])
ans=[0]*(N-1)
# visited=[False]*N
stack=[]
# 対象のノード, 親、親の色
stack.append([0,-1,0]... | # ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく
# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す
# グラフ構築の際に、辺の番号を持っておく
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a,b = list(map(int,readline().split()))
G[a-1].append([b-1,i])
G[b-1].append([a-1,i])
... | 43 | 33 | 829 | 691 | N = int(eval(input()))
E = [None] * (N - 1)
EV = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
E[i] = [a, b]
# 相手, 色, 回答出力順(-1は無視)
EV[a].append([b, -1, i])
EV[b].append([a, -1, -1])
ans = [0] * (N - 1)
# visited=[False]*N
stack = []
# 対象... | # ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく
# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す
# グラフ構築の際に、辺の番号を持っておく
import sys
readline = sys.stdin.readline
N = int(readline())
G = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, readline().split()))
G[a - 1].append([b - 1, i])
G[b - 1].append([a - 1, i... | false | 23.255814 | [
"-N = int(eval(input()))",
"-E = [None] * (N - 1)",
"-EV = [[] for i in range(N)]",
"+# ある頂点で、子供に対して順に1,2,3...と辺の色を渡していく",
"+# 親から来た色を持っておき、親から来た色と同色になったときはスキップして次の色を渡す",
"+# グラフ構築の際に、辺の番号を持っておく",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"+G = [[] for i in ra... | false | 0.101001 | 0.043166 | 2.339812 | [
"s721968068",
"s500950914"
] |
u023127434 | p03308 | python | s260894041 | s590073939 | 30 | 27 | 9,104 | 9,096 | Accepted | Accepted | 10 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((a[-1] - a[0])) | n = int(eval(input()))
a = list(map(int, input().split()))
maximum = max(a)
minimum = min(a)
print((maximum - minimum)) | 5 | 5 | 86 | 115 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
print((a[-1] - a[0]))
| n = int(eval(input()))
a = list(map(int, input().split()))
maximum = max(a)
minimum = min(a)
print((maximum - minimum))
| false | 0 | [
"-a.sort()",
"-print((a[-1] - a[0]))",
"+maximum = max(a)",
"+minimum = min(a)",
"+print((maximum - minimum))"
] | false | 0.046068 | 0.045155 | 1.020231 | [
"s260894041",
"s590073939"
] |
u977389981 | p02971 | python | s960699558 | s484902830 | 548 | 374 | 14,920 | 19,012 | Accepted | Accepted | 31.75 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_sorted = sorted(A.copy())
for a in A:
if a == A_sorted[-1]:
print((A_sorted[-2]))
else:
print((A_sorted[-1])) | n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
A2 = sorted(A, reverse = True)
for i in range(n):
if A[i] == A2[0]:
print((A2[1]))
else:
print((A2[0])) | 9 | 9 | 194 | 186 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
A_sorted = sorted(A.copy())
for a in A:
if a == A_sorted[-1]:
print((A_sorted[-2]))
else:
print((A_sorted[-1]))
| n = int(eval(input()))
A = [int(eval(input())) for i in range(n)]
A2 = sorted(A, reverse=True)
for i in range(n):
if A[i] == A2[0]:
print((A2[1]))
else:
print((A2[0]))
| false | 0 | [
"-N = int(eval(input()))",
"-A = [int(eval(input())) for i in range(N)]",
"-A_sorted = sorted(A.copy())",
"-for a in A:",
"- if a == A_sorted[-1]:",
"- print((A_sorted[-2]))",
"+n = int(eval(input()))",
"+A = [int(eval(input())) for i in range(n)]",
"+A2 = sorted(A, reverse=True)",
"+for... | false | 0.038728 | 0.045374 | 0.853531 | [
"s960699558",
"s484902830"
] |
u438621426 | p02897 | python | s214124451 | s856157654 | 183 | 169 | 38,384 | 38,384 | Accepted | Accepted | 7.65 | n=int(eval(input()))
if n%2==0:
print((1/2))
else:
print(((n+1)/2/n)) | N = int(eval(input()))
if N%2 == 0:
odd = N/2
else:
odd = (N-1)/2 + 1
print((odd/N)) | 5 | 7 | 71 | 88 | n = int(eval(input()))
if n % 2 == 0:
print((1 / 2))
else:
print(((n + 1) / 2 / n))
| N = int(eval(input()))
if N % 2 == 0:
odd = N / 2
else:
odd = (N - 1) / 2 + 1
print((odd / N))
| false | 28.571429 | [
"-n = int(eval(input()))",
"-if n % 2 == 0:",
"- print((1 / 2))",
"+N = int(eval(input()))",
"+if N % 2 == 0:",
"+ odd = N / 2",
"- print(((n + 1) / 2 / n))",
"+ odd = (N - 1) / 2 + 1",
"+print((odd / N))"
] | false | 0.033299 | 0.038498 | 0.864948 | [
"s214124451",
"s856157654"
] |
u970197315 | p02837 | python | s897791168 | s310894869 | 225 | 73 | 3,064 | 9,104 | Accepted | Accepted | 67.56 | n=int(eval(input()))
xy=[[] for i in range(n)]
for i in range(n):
a=int(eval(input()))
for j in range(a):
x,y=list(map(int,input().split()))
xy[i].append([x,y])
ans=0
for i in range(1<<n):
cnt=bin(i).count("1")
ok=True
for j in range(n):
if ok==False:break
if i&(1<<j):
... | n=int(eval(input()))
xy=[[] for i in range(n)]
for i in range(n):
a=int(eval(input()))
for j in range(a):
x,y=list(map(int,input().split()))
x-=1
xy[i].append((x,y))
ans=0
for i in range(1<<n):
cnt=bin(i).count("1")
if cnt<=ans:continue
for j in range(n):
if i&(1<<j):
for x... | 25 | 28 | 475 | 497 | n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
xy[i].append([x, y])
ans = 0
for i in range(1 << n):
cnt = bin(i).count("1")
ok = True
for j in range(n):
if ok == False:
... | n = int(eval(input()))
xy = [[] for i in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
x -= 1
xy[i].append((x, y))
ans = 0
for i in range(1 << n):
cnt = bin(i).count("1")
if cnt <= ans:
continue
for j in ... | false | 10.714286 | [
"- xy[i].append([x, y])",
"+ x -= 1",
"+ xy[i].append((x, y))",
"- ok = True",
"+ if cnt <= ans:",
"+ continue",
"- if ok == False:",
"- break",
"- if y == 1 and i & (1 << x - 1) == 0:",
"- ok = False",
"- ... | false | 0.038716 | 0.043137 | 0.897516 | [
"s897791168",
"s310894869"
] |
u504562455 | p02898 | python | s828479017 | s551710611 | 52 | 47 | 11,916 | 11,916 | Accepted | Accepted | 9.62 | N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
cnt = 0
for h in H:
if h >= K:
cnt += 1
print(cnt)
| # N = int(input())
N, K = [int(_) for _ in input().split()]
h = [int(_) for _ in input().split()]
print((len([i for i in h if i >= K])))
| 7 | 5 | 148 | 140 | N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
cnt = 0
for h in H:
if h >= K:
cnt += 1
print(cnt)
| # N = int(input())
N, K = [int(_) for _ in input().split()]
h = [int(_) for _ in input().split()]
print((len([i for i in h if i >= K])))
| false | 28.571429 | [
"-N, K = [int(i) for i in input().split()]",
"-H = [int(i) for i in input().split()]",
"-cnt = 0",
"-for h in H:",
"- if h >= K:",
"- cnt += 1",
"-print(cnt)",
"+# N = int(input())",
"+N, K = [int(_) for _ in input().split()]",
"+h = [int(_) for _ in input().split()]",
"+print((len([i ... | false | 0.107942 | 0.048891 | 2.207834 | [
"s828479017",
"s551710611"
] |
u921168761 | p03836 | python | s578948328 | s545162256 | 20 | 17 | 3,064 | 3,060 | Accepted | Accepted | 15 | sx, sy, tx, ty = list(map(int, input().split()))
ans = ""
for i in range(sx, tx): ans += 'R'
for i in range(sy, ty): ans += 'U'
for i in range(sx, tx): ans += 'L'
for i in range(sy, ty): ans += 'D'
ans += 'D'
for i in range(sx, tx + 1): ans += 'R'
for i in range(sy - 1, ty): ans += 'U'
ans += 'LU'
for i in ra... | sx, sy, tx, ty = list(map(int, input().split()))
dx, dy = tx - sx, ty - sy
ans = ""
ans += 'R' * dx + 'U' * dy
ans += 'L' * dx + 'D' * dy
ans += 'D'
ans += 'R' * (dx + 1) + 'U' * (dy + 1)
ans += 'LU'
ans += 'L' * (dx + 1) + 'D' * (dy + 1)
ans += 'R'
print(ans)
| 14 | 11 | 405 | 265 | sx, sy, tx, ty = list(map(int, input().split()))
ans = ""
for i in range(sx, tx):
ans += "R"
for i in range(sy, ty):
ans += "U"
for i in range(sx, tx):
ans += "L"
for i in range(sy, ty):
ans += "D"
ans += "D"
for i in range(sx, tx + 1):
ans += "R"
for i in range(sy - 1, ty):
ans += "U"
ans += "L... | sx, sy, tx, ty = list(map(int, input().split()))
dx, dy = tx - sx, ty - sy
ans = ""
ans += "R" * dx + "U" * dy
ans += "L" * dx + "D" * dy
ans += "D"
ans += "R" * (dx + 1) + "U" * (dy + 1)
ans += "LU"
ans += "L" * (dx + 1) + "D" * (dy + 1)
ans += "R"
print(ans)
| false | 21.428571 | [
"+dx, dy = tx - sx, ty - sy",
"-for i in range(sx, tx):",
"- ans += \"R\"",
"-for i in range(sy, ty):",
"- ans += \"U\"",
"-for i in range(sx, tx):",
"- ans += \"L\"",
"-for i in range(sy, ty):",
"- ans += \"D\"",
"+ans += \"R\" * dx + \"U\" * dy",
"+ans += \"L\" * dx + \"D\" * dy",
... | false | 0.044774 | 0.04479 | 0.999638 | [
"s578948328",
"s545162256"
] |
u801049006 | p02888 | python | s176084741 | s926273367 | 1,708 | 1,380 | 3,188 | 3,188 | Accepted | Accepted | 19.2 | from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
a = L[i]
for j in range(i+1, N):
b = L[j]
idx = bisect_left(L, a+b)
ans += max(idx - (j+1), 0)
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
k = i
for j in range(i+1, N):
while (k < N and L[k] < L[i]+L[j]):
k += 1
ans += k - (j+1)
print(ans)
| 16 | 13 | 277 | 240 | from bisect import bisect_left
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
a = L[i]
for j in range(i + 1, N):
b = L[j]
idx = bisect_left(L, a + b)
ans += max(idx - (j + 1), 0)
print(ans)
| N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
k = i
for j in range(i + 1, N):
while k < N and L[k] < L[i] + L[j]:
k += 1
ans += k - (j + 1)
print(ans)
| false | 18.75 | [
"-from bisect import bisect_left",
"-",
"- a = L[i]",
"+ k = i",
"- b = L[j]",
"- idx = bisect_left(L, a + b)",
"- ans += max(idx - (j + 1), 0)",
"+ while k < N and L[k] < L[i] + L[j]:",
"+ k += 1",
"+ ans += k - (j + 1)"
] | false | 0.045879 | 0.042973 | 1.067623 | [
"s176084741",
"s926273367"
] |
u645250356 | p03252 | python | s486792892 | s863924179 | 817 | 334 | 3,632 | 103,044 | Accepted | Accepted | 59.12 | import math
s = eval(input())
t = eval(input())
alp_s = []
alp_t = []
num_s = []
num_t = []
for i in range(len(s)):
cnt = 0
for j in alp_s:
if s[i] == j:
num_s[cnt] += 1
cnt += 1
if not s[i] in alp_s:
alp_s.append(s[i])
num_s.append(1)
cnt ... | 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
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
... | 31 | 23 | 567 | 633 | import math
s = eval(input())
t = eval(input())
alp_s = []
alp_t = []
num_s = []
num_t = []
for i in range(len(s)):
cnt = 0
for j in alp_s:
if s[i] == j:
num_s[cnt] += 1
cnt += 1
if not s[i] in alp_s:
alp_s.append(s[i])
num_s.append(1)
cnt = 0
for j in al... | 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
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.read... | false | 25.806452 | [
"-import math",
"+from collections import Counter, defaultdict, deque",
"+from heapq import heappop, heappush, heapify",
"+import sys, bisect, math, itertools, fractions, pprint",
"-s = eval(input())",
"-t = eval(input())",
"-alp_s = []",
"-alp_t = []",
"-num_s = []",
"-num_t = []",
"-for i in r... | false | 0.038485 | 0.038561 | 0.998033 | [
"s486792892",
"s863924179"
] |
u690536347 | p03287 | python | s527656788 | s986382865 | 389 | 101 | 15,912 | 21,200 | Accepted | Accepted | 74.04 | from itertools import accumulate as ac
from math import factorial as fc
from collections import Counter
f=lambda a,b:fc(a)//(fc(a-b)*fc(b)) if a>=b>=0 else 0
n,m=list(map(int,input().split()))
*a,=list(map(int,input().split()))
*aa,=[x%m for x in ac([0]+a)]
d=Counter(aa)
v=sum(f(i,2) for i in list(d.value... | from collections import Counter
N, M = list(map(int, input().split()))
*A, = list(map(int, input().split()))
ac = [0]*(N+1)
for i in range(1, N+1):
ac[i] = (ac[i-1]+A[i-1])%M
c = Counter(ac)
ans = 0
for i in list(c.values()):
ans += i*(i-1)//2
print(ans)
| 13 | 14 | 321 | 261 | from itertools import accumulate as ac
from math import factorial as fc
from collections import Counter
f = lambda a, b: fc(a) // (fc(a - b) * fc(b)) if a >= b >= 0 else 0
n, m = list(map(int, input().split()))
(*a,) = list(map(int, input().split()))
(*aa,) = [x % m for x in ac([0] + a)]
d = Counter(aa)
v = sum(f(i, 2... | from collections import Counter
N, M = list(map(int, input().split()))
(*A,) = list(map(int, input().split()))
ac = [0] * (N + 1)
for i in range(1, N + 1):
ac[i] = (ac[i - 1] + A[i - 1]) % M
c = Counter(ac)
ans = 0
for i in list(c.values()):
ans += i * (i - 1) // 2
print(ans)
| false | 7.142857 | [
"-from itertools import accumulate as ac",
"-from math import factorial as fc",
"-f = lambda a, b: fc(a) // (fc(a - b) * fc(b)) if a >= b >= 0 else 0",
"-n, m = list(map(int, input().split()))",
"-(*a,) = list(map(int, input().split()))",
"-(*aa,) = [x % m for x in ac([0] + a)]",
"-d = Counter(aa)",
"... | false | 0.071335 | 0.044408 | 1.606348 | [
"s527656788",
"s986382865"
] |
u331606500 | p03087 | python | s920925415 | s711054518 | 910 | 295 | 7,684 | 7,996 | Accepted | Accepted | 67.58 | n,q=list(map(int,input().split()))
s=eval(input());a=[0]*2
for i in range(2,n+1):
a+=[a[i-1]+s[i-2:i].count("AC")]
for _ in range(q):
l,r=list(map(int,input().split()))
print((a[r]-a[l])) | import sys
input=sys.stdin.readline
n,q=list(map(int,input().split()))
s=eval(input());a=[0]*2
for i in range(2,n+1):
a+=[a[i-1]+s[i-2:i].count("AC")]
for _ in range(q):
l,r=list(map(int,input().split()))
print((a[r]-a[l])) | 7 | 9 | 176 | 214 | n, q = list(map(int, input().split()))
s = eval(input())
a = [0] * 2
for i in range(2, n + 1):
a += [a[i - 1] + s[i - 2 : i].count("AC")]
for _ in range(q):
l, r = list(map(int, input().split()))
print((a[r] - a[l]))
| import sys
input = sys.stdin.readline
n, q = list(map(int, input().split()))
s = eval(input())
a = [0] * 2
for i in range(2, n + 1):
a += [a[i - 1] + s[i - 2 : i].count("AC")]
for _ in range(q):
l, r = list(map(int, input().split()))
print((a[r] - a[l]))
| false | 22.222222 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.03476 | 0.036106 | 0.962719 | [
"s920925415",
"s711054518"
] |
u392319141 | p03848 | python | s624657288 | s223476957 | 78 | 72 | 14,820 | 14,820 | Accepted | Accepted | 7.69 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
cntA = Counter(A)
if N % 2 == 0:
for i in range(1, N, 2):
if cntA[i] != 2:
print((0))
exit()
cntA[i] = 0
if max(cntA.values()) > 0:
print((... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
cntA = Counter(A)
if len(A) % 2 == 1:
if cntA[0] != 1:
print((0))
exit()
cnt = 1
for i in range(2, N, 2):
if cntA[i] != 2:
print((0))
exit()
cnt... | 32 | 31 | 658 | 592 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
MOD = 10**9 + 7
cntA = Counter(A)
if N % 2 == 0:
for i in range(1, N, 2):
if cntA[i] != 2:
print((0))
exit()
cntA[i] = 0
if max(cntA.values()) > 0:
print((0))
exit(... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
cntA = Counter(A)
if len(A) % 2 == 1:
if cntA[0] != 1:
print((0))
exit()
cnt = 1
for i in range(2, N, 2):
if cntA[i] != 2:
print((0))
exit()
cnt += 2
if cnt... | false | 3.125 | [
"-MOD = 10**9 + 7",
"-if N % 2 == 0:",
"+if len(A) % 2 == 1:",
"+ if cntA[0] != 1:",
"+ print((0))",
"+ exit()",
"+ cnt = 1",
"+ for i in range(2, N, 2):",
"+ if cntA[i] != 2:",
"+ print((0))",
"+ exit()",
"+ cnt += 2",
"+ if cnt ... | false | 0.044814 | 0.040688 | 1.10141 | [
"s624657288",
"s223476957"
] |
u562935282 | p02918 | python | s102241413 | s382841574 | 58 | 45 | 4,340 | 9,292 | Accepted | Accepted | 22.41 | n, k = list(map(int, input().split()))
s = eval(input())
t = tuple([1 if x == 'L' else 0 for x in s])
x = t[0]
region_count = 1
for tt in t:
if tt ^ x == 1:
region_count += 1
x ^= 1
print((n - max(1, region_count - k * 2)))
| # https://drken1215.hatenablog.com/entry/2020/05/16/005300
def main():
from itertools import tee
N, K = list(map(int, input().split()))
S = eval(input())
s1, s2 = tee(S, 2)
next(s2)
cnt = 0
for c1, c2 in zip(s1, s2):
if c1 != c2:
cnt += 1
ans = N ... | 12 | 23 | 248 | 396 | n, k = list(map(int, input().split()))
s = eval(input())
t = tuple([1 if x == "L" else 0 for x in s])
x = t[0]
region_count = 1
for tt in t:
if tt ^ x == 1:
region_count += 1
x ^= 1
print((n - max(1, region_count - k * 2)))
| # https://drken1215.hatenablog.com/entry/2020/05/16/005300
def main():
from itertools import tee
N, K = list(map(int, input().split()))
S = eval(input())
s1, s2 = tee(S, 2)
next(s2)
cnt = 0
for c1, c2 in zip(s1, s2):
if c1 != c2:
cnt += 1
ans = N - 1 - max(cnt - K * ... | false | 47.826087 | [
"-n, k = list(map(int, input().split()))",
"-s = eval(input())",
"-t = tuple([1 if x == \"L\" else 0 for x in s])",
"-x = t[0]",
"-region_count = 1",
"-for tt in t:",
"- if tt ^ x == 1:",
"- region_count += 1",
"- x ^= 1",
"-print((n - max(1, region_count - k * 2)))",
"+# https:... | false | 0.038442 | 0.046836 | 0.820785 | [
"s102241413",
"s382841574"
] |
u352394527 | p00485 | python | s757282823 | s979651464 | 1,140 | 950 | 58,748 | 58,832 | Accepted | Accepted | 16.67 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10 ** 18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
#V, E, r = map(int,input().split())
N, M, K = list(map(int,input().split()))
G = [[] for i in range(N)]
#G[i]...頂点iからの辺list、(行き先、コスト)
... | from heapq import heappop as pop
from heapq import heappush as push
def solve():
INF = 10 ** 18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
N, M, K = list(map(int,input().split()))
G = [[] for i in range(N)]
#G[i]...頂点iからの辺list、(行き先、コスト)
... | 59 | 62 | 1,102 | 1,204 | from heapq import heappop as pop
from heapq import heappush as push
INF = 10**18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
# V, E, r = map(int,input().split())
N, M, K = list(map(int, input().split()))
G = [[] for i in range(N)]
# G[i]...頂点iからの辺list、(行き先、コスト)
d = [... | from heapq import heappop as pop
from heapq import heappush as push
def solve():
INF = 10**18
class edge:
def __init__(self, to, cost):
self.to = to
self.cost = cost
N, M, K = list(map(int, input().split()))
G = [[] for i in range(N)]
# G[i]...頂点iからの辺list、(行き先、コスト... | false | 4.83871 | [
"-INF = 10**18",
"+",
"+def solve():",
"+ INF = 10**18",
"+",
"+ class edge:",
"+ def __init__(self, to, cost):",
"+ self.to = to",
"+ self.cost = cost",
"+",
"+ N, M, K = list(map(int, input().split()))",
"+ G = [[] for i in range(N)]",
"+ # G[i].... | false | 0.048279 | 0.048512 | 0.995202 | [
"s757282823",
"s979651464"
] |
u941438707 | p02844 | python | s927903377 | s221133438 | 511 | 31 | 9,216 | 9,088 | Accepted | Accepted | 93.93 | n=int(eval(input()))
s=eval(input())
ans,a=0,[]
for i in range(n):
if s[i] not in a:
a+=[s[i]]
b=[]
for j in range(i+1,n):
if s[j] not in b:
b+=[s[j]]
c=[]
for k in range(j+1,n):
if s[k] not in c:
... | n=eval(input())
s=eval(input())
ans=0
for i in range(1000):
i=str(i).zfill(3)
a=s.find(i[0])
if a!=-1:
b=s.find(i[1],a+1)
if b!=-1:
if s.find(i[2],b+1)!=-1:ans+=1
print(ans) | 16 | 11 | 383 | 181 | n = int(eval(input()))
s = eval(input())
ans, a = 0, []
for i in range(n):
if s[i] not in a:
a += [s[i]]
b = []
for j in range(i + 1, n):
if s[j] not in b:
b += [s[j]]
c = []
for k in range(j + 1, n):
if s[k] not... | n = eval(input())
s = eval(input())
ans = 0
for i in range(1000):
i = str(i).zfill(3)
a = s.find(i[0])
if a != -1:
b = s.find(i[1], a + 1)
if b != -1:
if s.find(i[2], b + 1) != -1:
ans += 1
print(ans)
| false | 31.25 | [
"-n = int(eval(input()))",
"+n = eval(input())",
"-ans, a = 0, []",
"-for i in range(n):",
"- if s[i] not in a:",
"- a += [s[i]]",
"- b = []",
"- for j in range(i + 1, n):",
"- if s[j] not in b:",
"- b += [s[j]]",
"- c = []",
"- ... | false | 0.195615 | 0.035919 | 5.44601 | [
"s927903377",
"s221133438"
] |
u141610915 | p02763 | python | s211654447 | s613649475 | 959 | 642 | 266,240 | 284,348 | Accepted | Accepted | 33.06 | import sys
input = sys.stdin.readline
N = int(eval(input()))
S = list(eval(input()))[: -1]
Q = int(eval(input()))
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.el = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -=... | import sys
input = sys.stdin.readline
N = int(eval(input()))
S = list([ord(x) - ord("a") for x in list(eval(input()))[: -1]])
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.el = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
... | 49 | 51 | 1,032 | 1,208 | import sys
input = sys.stdin.readline
N = int(eval(input()))
S = list(eval(input()))[:-1]
Q = int(eval(input()))
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.el = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.d... | import sys
input = sys.stdin.readline
N = int(eval(input()))
S = list([ord(x) - ord("a") for x in list(eval(input()))[:-1]])
class BIT:
def __init__(self, n):
self.n = n
self.data = [0] * (n + 1)
self.el = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
... | false | 3.921569 | [
"-S = list(eval(input()))[:-1]",
"-Q = int(eval(input()))",
"+S = list([ord(x) - ord(\"a\") for x in list(eval(input()))[:-1]])",
"+ def lowerbound(self, s):",
"+ x = 0",
"+ y = 0",
"+ for i in range(self.n.bit_length(), -1, -1):",
"+ k = x + (1 << i)",
"+ ... | false | 0.044985 | 0.044165 | 1.018562 | [
"s211654447",
"s613649475"
] |
u094191970 | p03352 | python | s951732353 | s451496918 | 22 | 18 | 2,940 | 2,940 | Accepted | Accepted | 18.18 | x=int(eval(input()))
for i in range(x,-1,-1):
for k in range(int(i**0.5)+1):
for j in range(11):
if k**j>i:
break
if k**j==i:
print(i)
exit() | x=int(eval(input()))
ans=1
for i in range(1,x):
for j in range(2,x):
if i**j>x:
break
ans=max(ans,i**j)
print(ans) | 10 | 9 | 187 | 133 | x = int(eval(input()))
for i in range(x, -1, -1):
for k in range(int(i**0.5) + 1):
for j in range(11):
if k**j > i:
break
if k**j == i:
print(i)
exit()
| x = int(eval(input()))
ans = 1
for i in range(1, x):
for j in range(2, x):
if i**j > x:
break
ans = max(ans, i**j)
print(ans)
| false | 10 | [
"-for i in range(x, -1, -1):",
"- for k in range(int(i**0.5) + 1):",
"- for j in range(11):",
"- if k**j > i:",
"- break",
"- if k**j == i:",
"- print(i)",
"- exit()",
"+ans = 1",
"+for i in range(1, x):",
"+ for j i... | false | 0.045627 | 0.045031 | 1.013251 | [
"s951732353",
"s451496918"
] |
u392319141 | p03854 | python | s298924142 | s544215736 | 41 | 33 | 3,188 | 3,188 | Accepted | Accepted | 19.51 | S = eval(input())
S = S[::-1]
last = ['maerd', 'remaerd', 'esare', 'resare']
length = [5, 7, 5, 6]
index = 0
while index < len(S):
for i, tail in enumerate(last) :
sub = S[index:index + length[i]]
if sub == tail :
index += length[i]
break
else :
pr... | S = input()[::-1]
W = [s[::-1] for s in ('dream', 'dreamer', 'erase', 'eraser')]
def isOk():
now = 0
while now < len(S):
for w in W:
if S[now: now + len(w)] == w:
now += len(w)
break
else:
return False
return True
print(... | 18 | 15 | 364 | 347 | S = eval(input())
S = S[::-1]
last = ["maerd", "remaerd", "esare", "resare"]
length = [5, 7, 5, 6]
index = 0
while index < len(S):
for i, tail in enumerate(last):
sub = S[index : index + length[i]]
if sub == tail:
index += length[i]
break
else:
print("NO")
... | S = input()[::-1]
W = [s[::-1] for s in ("dream", "dreamer", "erase", "eraser")]
def isOk():
now = 0
while now < len(S):
for w in W:
if S[now : now + len(w)] == w:
now += len(w)
break
else:
return False
return True
print(("YES" if i... | false | 16.666667 | [
"-S = eval(input())",
"-S = S[::-1]",
"-last = [\"maerd\", \"remaerd\", \"esare\", \"resare\"]",
"-length = [5, 7, 5, 6]",
"-index = 0",
"-while index < len(S):",
"- for i, tail in enumerate(last):",
"- sub = S[index : index + length[i]]",
"- if sub == tail:",
"- index ... | false | 0.069977 | 0.071705 | 0.975903 | [
"s298924142",
"s544215736"
] |
u078349616 | p02773 | python | s611649553 | s627991840 | 936 | 830 | 45,076 | 32,480 | Accepted | Accepted | 11.32 | from collections import Counter
N = int(eval(input()))
S = [0]*N
for i in range(N):
S[i] = eval(input())
S.sort()
c = Counter(S)
m_num = c.most_common()[0][1]
for s in sorted(list(set(S))):
if c[s] == m_num:
print(s) | from collections import defaultdict
N = int(eval(input()))
sdict = defaultdict(int)
for i in range(N):
sdict[eval(input())] += 1
mx = 0
for key, val in list(sdict.items()):
mx = max(mx, val)
ls = []
for key, val in list(sdict.items()):
if val == mx:
ls.append(key)
ls.sort()
for s in ls:
... | 13 | 19 | 228 | 306 | from collections import Counter
N = int(eval(input()))
S = [0] * N
for i in range(N):
S[i] = eval(input())
S.sort()
c = Counter(S)
m_num = c.most_common()[0][1]
for s in sorted(list(set(S))):
if c[s] == m_num:
print(s)
| from collections import defaultdict
N = int(eval(input()))
sdict = defaultdict(int)
for i in range(N):
sdict[eval(input())] += 1
mx = 0
for key, val in list(sdict.items()):
mx = max(mx, val)
ls = []
for key, val in list(sdict.items()):
if val == mx:
ls.append(key)
ls.sort()
for s in ls:
print(s... | false | 31.578947 | [
"-from collections import Counter",
"+from collections import defaultdict",
"-S = [0] * N",
"+sdict = defaultdict(int)",
"- S[i] = eval(input())",
"-S.sort()",
"-c = Counter(S)",
"-m_num = c.most_common()[0][1]",
"-for s in sorted(list(set(S))):",
"- if c[s] == m_num:",
"- print(s)"... | false | 0.0408 | 0.040174 | 1.015587 | [
"s611649553",
"s627991840"
] |
u223663729 | p03945 | python | s562608362 | s880522270 | 136 | 36 | 12,788 | 3,188 | Accepted | Accepted | 73.53 | import re
s = eval(input())
s = re.sub(r"([BW])\1*(?!\1)", r"\1", s)
print((int(len(s) - 1))) | S = eval(input())
prev = S[0]
cnt = 0
for s in S[1:]:
if prev != s:
cnt += 1
prev = s
print(cnt)
| 7 | 10 | 94 | 118 | import re
s = eval(input())
s = re.sub(r"([BW])\1*(?!\1)", r"\1", s)
print((int(len(s) - 1)))
| S = eval(input())
prev = S[0]
cnt = 0
for s in S[1:]:
if prev != s:
cnt += 1
prev = s
print(cnt)
| false | 30 | [
"-import re",
"-",
"-s = eval(input())",
"-s = re.sub(r\"([BW])\\1*(?!\\1)\", r\"\\1\", s)",
"-print((int(len(s) - 1)))",
"+S = eval(input())",
"+prev = S[0]",
"+cnt = 0",
"+for s in S[1:]:",
"+ if prev != s:",
"+ cnt += 1",
"+ prev = s",
"+print(cnt)"
] | false | 0.083256 | 0.046628 | 1.785533 | [
"s562608362",
"s880522270"
] |
u863370423 | p03844 | python | s785062707 | s356503295 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | # python
my_input = str(eval(input()))
print((str(eval(my_input))))
|
from os import sys
line = sys.stdin.readline().split(" ")
if line[1] == "+" :
print((int(line[0])+int(line[2])))
else:
print((int(line[0])-int(line[2])))
#test test test | 3 | 11 | 62 | 186 | # python
my_input = str(eval(input()))
print((str(eval(my_input))))
| from os import sys
line = sys.stdin.readline().split(" ")
if line[1] == "+":
print((int(line[0]) + int(line[2])))
else:
print((int(line[0]) - int(line[2])))
# test test test
| false | 72.727273 | [
"-# python",
"-my_input = str(eval(input()))",
"-print((str(eval(my_input))))",
"+from os import sys",
"+",
"+line = sys.stdin.readline().split(\" \")",
"+if line[1] == \"+\":",
"+ print((int(line[0]) + int(line[2])))",
"+else:",
"+ print((int(line[0]) - int(line[2])))",
"+# test test test... | false | 0.046893 | 0.047054 | 0.996574 | [
"s785062707",
"s356503295"
] |
u282228874 | p03077 | python | s638543535 | s971574328 | 178 | 17 | 38,640 | 2,940 | Accepted | Accepted | 90.45 | from math import ceil
n = int(eval(input()))
A = [int(eval(input())) for i in range(5)]
print((ceil(n/min(A))+4))
| from math import ceil
n = int(eval(input()))
t = [int(eval(input())) for i in range(5)]
print((4+ceil(n/min(t)))) | 4 | 4 | 103 | 102 | from math import ceil
n = int(eval(input()))
A = [int(eval(input())) for i in range(5)]
print((ceil(n / min(A)) + 4))
| from math import ceil
n = int(eval(input()))
t = [int(eval(input())) for i in range(5)]
print((4 + ceil(n / min(t))))
| false | 0 | [
"-A = [int(eval(input())) for i in range(5)]",
"-print((ceil(n / min(A)) + 4))",
"+t = [int(eval(input())) for i in range(5)]",
"+print((4 + ceil(n / min(t))))"
] | false | 0.119274 | 0.047215 | 2.526184 | [
"s638543535",
"s971574328"
] |
u051422473 | p02713 | python | s090831673 | s546138445 | 1,255 | 554 | 9,092 | 68,248 | Accepted | Accepted | 55.86 | from math import*
r = list(range(1, int(eval(input())) + 1))
print((sum(gcd(gcd(a, b), c) for a in r for b in r for c in r))) | from math import gcd
r = list(range(1, int(eval(input())) + 1))
print((sum(gcd(gcd(a, b), c) for a in r for b in r for c in r))) | 3 | 3 | 113 | 116 | from math import *
r = list(range(1, int(eval(input())) + 1))
print((sum(gcd(gcd(a, b), c) for a in r for b in r for c in r)))
| from math import gcd
r = list(range(1, int(eval(input())) + 1))
print((sum(gcd(gcd(a, b), c) for a in r for b in r for c in r)))
| false | 0 | [
"-from math import *",
"+from math import gcd"
] | false | 0.162857 | 0.17349 | 0.938715 | [
"s090831673",
"s546138445"
] |
u207707177 | p03326 | python | s150319939 | s172001100 | 30 | 27 | 3,700 | 3,316 | Accepted | Accepted | 10 | n,m = [int(i) for i in input().split()]
cakes = []
ranking = [[] for i in range(8)]
ranking2 = []
for i in range(n):
cakes.append(list(map(int,input().split())))
a = 0
for i in range(2):
for j in range(2):
for k in range(2):
for x in range(n):
kirei = cakes[x... | n,m = [int(i) for i in input().split()]
ck = []
for i in range(n):
ck.append(list(map(int,input().split())))
co1=co2=co3=-1
scores = []
maxi = 0
for i in range(2):
co1 *= -1
for j in range(2):
co2 *= -1
for k in range(2):
co3*= -1
scores = []
... | 42 | 25 | 928 | 569 | n, m = [int(i) for i in input().split()]
cakes = []
ranking = [[] for i in range(8)]
ranking2 = []
for i in range(n):
cakes.append(list(map(int, input().split())))
a = 0
for i in range(2):
for j in range(2):
for k in range(2):
for x in range(n):
kirei = cakes[x][0]
... | n, m = [int(i) for i in input().split()]
ck = []
for i in range(n):
ck.append(list(map(int, input().split())))
co1 = co2 = co3 = -1
scores = []
maxi = 0
for i in range(2):
co1 *= -1
for j in range(2):
co2 *= -1
for k in range(2):
co3 *= -1
scores = []
scor... | false | 40.47619 | [
"-cakes = []",
"-ranking = [[] for i in range(8)]",
"-ranking2 = []",
"+ck = []",
"- cakes.append(list(map(int, input().split())))",
"-a = 0",
"+ ck.append(list(map(int, input().split())))",
"+co1 = co2 = co3 = -1",
"+scores = []",
"+maxi = 0",
"+ co1 *= -1",
"+ co2 *= -1",
"... | false | 0.047021 | 0.047505 | 0.989813 | [
"s150319939",
"s172001100"
] |
u546285759 | p00105 | python | s638689428 | s666266486 | 30 | 20 | 7,648 | 5,608 | Accepted | Accepted | 33.33 | d = {}
while True:
try:
word, page = input().split()
page = int(page)
except:
break
d[word] = [page] if word not in d else d[word] + [page]
for word, pages in sorted(d.items()):
print(word)
print((*sorted(pages))) | d = {}
while True:
try:
data = input().split()
except:
break
word = data[0]
number = int(data[1])
if word in d:
d[word].append(number)
else:
d[word] = [number]
for k, v in sorted(list(d.items()), key=lambda x: x[0]):
print(k)
print((*sorted... | 11 | 17 | 265 | 320 | d = {}
while True:
try:
word, page = input().split()
page = int(page)
except:
break
d[word] = [page] if word not in d else d[word] + [page]
for word, pages in sorted(d.items()):
print(word)
print((*sorted(pages)))
| d = {}
while True:
try:
data = input().split()
except:
break
word = data[0]
number = int(data[1])
if word in d:
d[word].append(number)
else:
d[word] = [number]
for k, v in sorted(list(d.items()), key=lambda x: x[0]):
print(k)
print((*sorted(v)))
| false | 35.294118 | [
"- word, page = input().split()",
"- page = int(page)",
"+ data = input().split()",
"- d[word] = [page] if word not in d else d[word] + [page]",
"-for word, pages in sorted(d.items()):",
"- print(word)",
"- print((*sorted(pages)))",
"+ word = data[0]",
"+ number =... | false | 0.041062 | 0.045019 | 0.91211 | [
"s638689428",
"s666266486"
] |
u271934630 | p02995 | python | s035272761 | s362069781 | 164 | 17 | 38,256 | 3,064 | Accepted | Accepted | 89.63 | def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
a, b, c, d = list(map(int, input().split()))
s = b - a + 1
x = b // c - (a - 1) // c
y = b // d - (a - 1) // d
z = b // lcm(c, d) - (a - 1) // lcm(c, d)
print((s - (x + y) + z))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
def gcd(a,b):
while b:
a, b = b, a%b
return a
def lcm(a,b):
return a*b//gcd(a,b)
A, B, C, D = i_l()
... | 18 | 26 | 308 | 474 | def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
a, b, c, d = list(map(int, input().split()))
s = b - a + 1
x = b // c - (a - 1) // c
y = b // d - (a - 1) // d
z = b // lcm(c, d) - (a - 1) // lcm(c, d)
print((s - (x + y) + z))
| import sys
stdin = sys.stdin
sys.setrecursionlimit(10**7)
i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()
def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return a * b // gcd(a, b)
A, B, C, D = i_l()
A -= 1... | false | 30.769231 | [
"+import sys",
"+",
"+stdin = sys.stdin",
"+sys.setrecursionlimit(10**7)",
"+i_i = lambda: int(i_s())",
"+i_l = lambda: list(map(int, stdin.readline().split()))",
"+i_s = lambda: stdin.readline().rstrip()",
"+",
"+",
"- while b != 0:",
"+ while b:",
"-a, b, c, d = list(map(int, input().s... | false | 0.036538 | 0.036348 | 1.005223 | [
"s035272761",
"s362069781"
] |
u133936772 | p02691 | python | s025835393 | s889903577 | 203 | 175 | 41,072 | 41,132 | Accepted | Accepted | 13.79 | n,*l=list(map(int,open(0).read().split()));d,a={},0
for i in range(n):d[i+l[i]]=d.get(i+l[i],0)+1;a+=d.get(i-l[i],0)
print(a) | _,*l=list(map(int,open(0).read().split()));d,a,i={},0,0
for h in l:d[i+h]=d.get(i+h,0)+1;a+=d.get(i-h,0);i+=1
print(a) | 3 | 3 | 121 | 114 | n, *l = list(map(int, open(0).read().split()))
d, a = {}, 0
for i in range(n):
d[i + l[i]] = d.get(i + l[i], 0) + 1
a += d.get(i - l[i], 0)
print(a)
| _, *l = list(map(int, open(0).read().split()))
d, a, i = {}, 0, 0
for h in l:
d[i + h] = d.get(i + h, 0) + 1
a += d.get(i - h, 0)
i += 1
print(a)
| false | 0 | [
"-n, *l = list(map(int, open(0).read().split()))",
"-d, a = {}, 0",
"-for i in range(n):",
"- d[i + l[i]] = d.get(i + l[i], 0) + 1",
"- a += d.get(i - l[i], 0)",
"+_, *l = list(map(int, open(0).read().split()))",
"+d, a, i = {}, 0, 0",
"+for h in l:",
"+ d[i + h] = d.get(i + h, 0) + 1",
"... | false | 0.037074 | 0.039321 | 0.942852 | [
"s025835393",
"s889903577"
] |
u989345508 | p02623 | python | s126121552 | s118742167 | 260 | 235 | 48,620 | 45,844 | Accepted | Accepted | 9.62 | from itertools import accumulate
from bisect import bisect_left,bisect_right
n,m,k=list(map(int,input().split()))
a=[0]+list(accumulate(list(map(int,input().split()))))
b=[0]+list(accumulate(list(map(int,input().split()))))
ans=[0]
for i in range(n+1):
c=bisect_right(b,k-a[i])-1
if c!=-1:
ans.a... | from itertools import accumulate
from bisect import bisect_left,bisect_right
n,m,k=list(map(int,input().split()))
a=list(accumulate(list(map(int,input().split())),initial=0))
b=list(accumulate(list(map(int,input().split())),initial=0))
ans=[0]
for i in range(n+1):
c=bisect_right(b,k-a[i])-1
if c!=-1:
... | 11 | 11 | 329 | 342 | from itertools import accumulate
from bisect import bisect_left, bisect_right
n, m, k = list(map(int, input().split()))
a = [0] + list(accumulate(list(map(int, input().split()))))
b = [0] + list(accumulate(list(map(int, input().split()))))
ans = [0]
for i in range(n + 1):
c = bisect_right(b, k - a[i]) - 1
if c... | from itertools import accumulate
from bisect import bisect_left, bisect_right
n, m, k = list(map(int, input().split()))
a = list(accumulate(list(map(int, input().split())), initial=0))
b = list(accumulate(list(map(int, input().split())), initial=0))
ans = [0]
for i in range(n + 1):
c = bisect_right(b, k - a[i]) - ... | false | 0 | [
"-a = [0] + list(accumulate(list(map(int, input().split()))))",
"-b = [0] + list(accumulate(list(map(int, input().split()))))",
"+a = list(accumulate(list(map(int, input().split())), initial=0))",
"+b = list(accumulate(list(map(int, input().split())), initial=0))"
] | false | 0.045814 | 0.041552 | 1.102565 | [
"s126121552",
"s118742167"
] |
u011062360 | p02773 | python | s728152936 | s838751094 | 853 | 704 | 55,512 | 35,572 | Accepted | Accepted | 17.47 | n = int(eval(input()))
list_S = []
for _ in range(n):
list_S.append(eval(input()))
dic_S = dict()
set_S = set()
for s in list_S:
if s in set_S:
dic_S[s] += 1
else:
dic_S[s] = 1
set_S.add(s)
list_ans = sorted(list(dic_S.items()), key=lambda x:x[1], reverse=True)
a = 0... | from collections import Counter
n = int(eval(input()))
list_S = [eval(input()) for _ in range(n)]
dic_S = Counter(list_S)
m = 0
for i in list(dic_S.values()):
m = max(m, i)
ans = []
for k, v in list(dic_S.items()):
if v == m:
ans.append(k)
ans.sort()
for s in ans:
print(s) | 25 | 14 | 473 | 281 | n = int(eval(input()))
list_S = []
for _ in range(n):
list_S.append(eval(input()))
dic_S = dict()
set_S = set()
for s in list_S:
if s in set_S:
dic_S[s] += 1
else:
dic_S[s] = 1
set_S.add(s)
list_ans = sorted(list(dic_S.items()), key=lambda x: x[1], reverse=True)
a = 0
ans = []
for i ... | from collections import Counter
n = int(eval(input()))
list_S = [eval(input()) for _ in range(n)]
dic_S = Counter(list_S)
m = 0
for i in list(dic_S.values()):
m = max(m, i)
ans = []
for k, v in list(dic_S.items()):
if v == m:
ans.append(k)
ans.sort()
for s in ans:
print(s)
| false | 44 | [
"+from collections import Counter",
"+",
"-list_S = []",
"-for _ in range(n):",
"- list_S.append(eval(input()))",
"-dic_S = dict()",
"-set_S = set()",
"-for s in list_S:",
"- if s in set_S:",
"- dic_S[s] += 1",
"- else:",
"- dic_S[s] = 1",
"- set_S.add(s)",
"-... | false | 0.048344 | 0.046027 | 1.050341 | [
"s728152936",
"s838751094"
] |
u654470292 | p03645 | python | s524581770 | s939287088 | 970 | 214 | 81,648 | 119,292 | Accepted | Accepted | 77.94 | n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
ninoshima=[[0]*(n+1) for i in range(2)]
for i in range(m):
if ab[i][0]==1:
ninoshima[0][ab[i][1]]=1
if ab[i][1]==n:
ninoshima[1][ab[i][0]]=1
for i in range(n+1):
if ninoshima[0][i]==... | import bisect
import copy
import heapq
import math
import 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))
sys.setrecurs... | 18 | 35 | 399 | 753 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
ninoshima = [[0] * (n + 1) for i in range(2)]
for i in range(m):
if ab[i][0] == 1:
ninoshima[0][ab[i][1]] = 1
if ab[i][1] == n:
ninoshima[1][ab[i][0]] = 1
for i in range(n + 1):
if ninoshima[0][i]... | import bisect
import copy
import heapq
import math
import 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))
sys.setrecursionl... | false | 48.571429 | [
"+import bisect",
"+import copy",
"+import heapq",
"+import math",
"+import sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+... | false | 0.143271 | 0.047771 | 2.999154 | [
"s524581770",
"s939287088"
] |
u539123425 | p03495 | python | s440816416 | s691514970 | 238 | 177 | 54,476 | 48,804 | Accepted | Accepted | 25.63 | N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
Ad = {x:0 for x in set(A)}
if len(set(A)) <= K:
print((0))
else:
count = 0
for a in A:
Ad[a] += 1
Ad = sorted(list(Ad.items()), key=lambda x:x[1])
for i in range(len(set(A))-K):
count += Ad[i][1]
... | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
if(len(set(a)) <= k):
print((0))
else:
dic_a = {x:0 for x in set(a)}
for i in a:
dic_a[i] += 1
sum = 0
a = sorted(list(dic_a.values()),reverse=True)
for i in range(k,len(a)):
sum += a[i]
pri... | 14 | 14 | 321 | 313 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
Ad = {x: 0 for x in set(A)}
if len(set(A)) <= K:
print((0))
else:
count = 0
for a in A:
Ad[a] += 1
Ad = sorted(list(Ad.items()), key=lambda x: x[1])
for i in range(len(set(A)) - K):
count += Ad[i][1]
print... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
if len(set(a)) <= k:
print((0))
else:
dic_a = {x: 0 for x in set(a)}
for i in a:
dic_a[i] += 1
sum = 0
a = sorted(list(dic_a.values()), reverse=True)
for i in range(k, len(a)):
sum += a[i]
print(sum)
| false | 0 | [
"-N, K = list(map(int, input().split()))",
"-A = list(map(int, input().split()))",
"-Ad = {x: 0 for x in set(A)}",
"-if len(set(A)) <= K:",
"+n, k = list(map(int, input().split()))",
"+a = list(map(int, input().split()))",
"+if len(set(a)) <= k:",
"- count = 0",
"- for a in A:",
"- Ad... | false | 0.087282 | 0.089652 | 0.973561 | [
"s440816416",
"s691514970"
] |
u753803401 | p03031 | python | s537025934 | s459761235 | 327 | 186 | 68,716 | 39,792 | Accepted | Accepted | 43.12 | def slove():
import sys
import bisect
import collections
import fractions
import heapq
import itertools
input = sys.stdin.readline
n, m = list(map(int, input().rstrip('\n').split()))
ks = [list(map(int, input().rstrip('\n').split())) for _ in range(m)]
p = list(map(int,... | import sys
import itertools
def solve():
input = sys.stdin.readline
mod = 10 ** 9 + 7
n, m = list(map(int, input().rstrip('\n').split()))
ks = [list(map(int, input().rstrip('\n').split())) for _ in range(m)]
p = list(map(int, input().rstrip('\n').split()))
cnt = 0
for v in itert... | 29 | 27 | 786 | 667 | def slove():
import sys
import bisect
import collections
import fractions
import heapq
import itertools
input = sys.stdin.readline
n, m = list(map(int, input().rstrip("\n").split()))
ks = [list(map(int, input().rstrip("\n").split())) for _ in range(m)]
p = list(map(int, input().... | import sys
import itertools
def solve():
input = sys.stdin.readline
mod = 10**9 + 7
n, m = list(map(int, input().rstrip("\n").split()))
ks = [list(map(int, input().rstrip("\n").split())) for _ in range(m)]
p = list(map(int, input().rstrip("\n").split()))
cnt = 0
for v in itertools.product(... | false | 6.896552 | [
"-def slove():",
"- import sys",
"- import bisect",
"- import collections",
"- import fractions",
"- import heapq",
"- import itertools",
"+import sys",
"+import itertools",
"+",
"+def solve():",
"+ mod = 10**9 + 7",
"- a_cnt = 0",
"+ cnt = 0",
"- for j,... | false | 0.040049 | 0.077985 | 0.513549 | [
"s537025934",
"s459761235"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.