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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u761320129 | p03142 | python | s621439770 | s128492754 | 870 | 283 | 52,068 | 42,412 | Accepted | Accepted | 67.47 | N,M = map(int,input().split())
src = [tuple(map(lambda x:int(x)-1,input().split())) for i in range(N-1+M)]
indeg_n = [0]*N
indeg = [[] for i in range(N)]
outdeg = [[] for i in range(N)]
for a,b in src:
indeg_n[b] += 1
indeg[b].append(a)
outdeg[a].append(b)
root = indeg_n.index(0)
toposo = []
st... | import sys
input = sys.stdin.readline
N,M = map(int,input().split())
AB = [tuple(map(int,input().split())) for i in range(N-1+M)]
es = [[] for _ in range(N)]
indeg = [0] * N
for a,b in AB:
a,b = a-1,b-1
es[a].append(b)
indeg[b] += 1
from collections import deque
q = deque()
for i in range(N)... | 33 | 27 | 742 | 563 | N, M = map(int, input().split())
src = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(N - 1 + M)]
indeg_n = [0] * N
indeg = [[] for i in range(N)]
outdeg = [[] for i in range(N)]
for a, b in src:
indeg_n[b] += 1
indeg[b].append(a)
outdeg[a].append(b)
root = indeg_n.index(0)
toposo = []
st... | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(N - 1 + M)]
es = [[] for _ in range(N)]
indeg = [0] * N
for a, b in AB:
a, b = a - 1, b - 1
es[a].append(b)
indeg[b] += 1
from collections import deque
q = deque()
for i in range(N)... | false | 18.181818 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-src = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(N - 1 + M)]",
"-indeg_n = [0] * N",
"-indeg = [[] for i in range(N)]",
"-outdeg = [[] for i in range(N)]",
"-for a, b in src:",
"- indeg_n[b] += 1",
"- indeg[b].append... | false | 0.169338 | 0.111658 | 1.516579 | [
"s621439770",
"s128492754"
] |
u544034775 | p03048 | python | s544052755 | s436077906 | 1,377 | 760 | 2,940 | 3,064 | Accepted | Accepted | 44.81 | R, G, B, N = (int(i) for i in input().split())
c = 0
for r in range(N//R, -1, -1):
new1 = N - r*R
for g in range(new1//G, -1, -1):
new2 = new1 - g*G
if new2%B == 0:
c +=1
print(c) | def main(R, G, B, N):
arr = [R, G, B]
arr.sort(reverse=True)
R, G, B = arr
c = 0
for r in range(N//R, -1, -1):
new1 = N - r*R
for g in range(new1//G, -1, -1):
if (new1 - g*G)%B == 0:
c +=1
print(c)
R, G, B, N = (int(i) for i in input().... | 11 | 15 | 232 | 346 | R, G, B, N = (int(i) for i in input().split())
c = 0
for r in range(N // R, -1, -1):
new1 = N - r * R
for g in range(new1 // G, -1, -1):
new2 = new1 - g * G
if new2 % B == 0:
c += 1
print(c)
| def main(R, G, B, N):
arr = [R, G, B]
arr.sort(reverse=True)
R, G, B = arr
c = 0
for r in range(N // R, -1, -1):
new1 = N - r * R
for g in range(new1 // G, -1, -1):
if (new1 - g * G) % B == 0:
c += 1
print(c)
R, G, B, N = (int(i) for i in input().spl... | false | 26.666667 | [
"+def main(R, G, B, N):",
"+ arr = [R, G, B]",
"+ arr.sort(reverse=True)",
"+ R, G, B = arr",
"+ c = 0",
"+ for r in range(N // R, -1, -1):",
"+ new1 = N - r * R",
"+ for g in range(new1 // G, -1, -1):",
"+ if (new1 - g * G) % B == 0:",
"+ c +... | false | 0.050596 | 0.08741 | 0.57883 | [
"s544052755",
"s436077906"
] |
u533039576 | p03450 | python | s463279110 | s580370351 | 1,119 | 741 | 41,708 | 41,736 | Accepted | Accepted | 33.78 | from collections import deque
def topological_sort(graph: list, n_v: int) -> list:
# graph[node] = [(cost, to)]
indegree = [0] * n_v # 各頂点の入次数
for i in range(n_v):
for c, v in graph[i]:
indegree[v] += 1
cand = deque([i for i in range(n_v) if indegree[i] == 0])
res = [... | from collections import deque
import sys
input = sys.stdin.readline
def topological_sort(graph: list, n_v: int) -> list:
# graph[node] = [(cost, to)]
indegree = [0] * n_v # 各頂点の入次数
for i in range(n_v):
for c, v in graph[i]:
indegree[v] += 1
cand = deque([i for i in range... | 54 | 54 | 1,186 | 1,213 | from collections import deque
def topological_sort(graph: list, n_v: int) -> list:
# graph[node] = [(cost, to)]
indegree = [0] * n_v # 各頂点の入次数
for i in range(n_v):
for c, v in graph[i]:
indegree[v] += 1
cand = deque([i for i in range(n_v) if indegree[i] == 0])
res = []
whi... | from collections import deque
import sys
input = sys.stdin.readline
def topological_sort(graph: list, n_v: int) -> list:
# graph[node] = [(cost, to)]
indegree = [0] * n_v # 各頂点の入次数
for i in range(n_v):
for c, v in graph[i]:
indegree[v] += 1
cand = deque([i for i in range(n_v) if ... | false | 0 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+ # Not DAG",
"- # print(\"Not DAG\")"
] | false | 0.04189 | 0.039421 | 1.062645 | [
"s463279110",
"s580370351"
] |
u915761101 | p00445 | python | s446241978 | s474145952 | 20 | 10 | 4,320 | 4,412 | Accepted | Accepted | 50 | while 1:
try:
s=input()
joi=0
ioi=0
for i in range(len(s)-2):
if(s[i+1]=="O" and s[i+2]=="I"):
if(s[i]=="J"):
joi+=1
if(s[i]=="I"):
ioi+=1
print(joi)
print(ioi)
except... | import sys
for s in sys.stdin:
joi=0
ioi=0
for i in range(0,len(s)-2):
subs=s[i:i+3]
if subs=="JOI":
joi+=1
elif subs=="IOI":
ioi+=1
print(joi)
print(ioi) | 15 | 15 | 347 | 186 | while 1:
try:
s = input()
joi = 0
ioi = 0
for i in range(len(s) - 2):
if s[i + 1] == "O" and s[i + 2] == "I":
if s[i] == "J":
joi += 1
if s[i] == "I":
ioi += 1
print(joi)
print(ioi)
... | import sys
for s in sys.stdin:
joi = 0
ioi = 0
for i in range(0, len(s) - 2):
subs = s[i : i + 3]
if subs == "JOI":
joi += 1
elif subs == "IOI":
ioi += 1
print(joi)
print(ioi)
| false | 0 | [
"-while 1:",
"- try:",
"- s = input()",
"- joi = 0",
"- ioi = 0",
"- for i in range(len(s) - 2):",
"- if s[i + 1] == \"O\" and s[i + 2] == \"I\":",
"- if s[i] == \"J\":",
"- joi += 1",
"- if s[i] == \"I\":",... | false | 0.05991 | 0.058929 | 1.01665 | [
"s446241978",
"s474145952"
] |
u906501980 | p02707 | python | s052785602 | s690743539 | 128 | 110 | 32,240 | 32,904 | Accepted | Accepted | 14.06 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0]*n
for i in a:
ans[i-1] += 1
for i in ans:
print(i)
if __name__ == "__main__":
main() | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0]*n
for i in a:
ans[i-1] += 1
print(("\n".join(list(map(str, ans)))))
if __name__ == "__main__":
main() | 13 | 10 | 222 | 216 | def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in a:
ans[i - 1] += 1
for i in ans:
print(i)
if __name__ == "__main__":
main()
| def main():
n = int(eval(input()))
a = list(map(int, input().split()))
ans = [0] * n
for i in a:
ans[i - 1] += 1
print(("\n".join(list(map(str, ans)))))
if __name__ == "__main__":
main()
| false | 23.076923 | [
"- for i in ans:",
"- print(i)",
"+ print((\"\\n\".join(list(map(str, ans)))))"
] | false | 0.043156 | 0.036359 | 1.186941 | [
"s052785602",
"s690743539"
] |
u646336881 | p02640 | python | s658027341 | s524398476 | 110 | 96 | 75,252 | 75,332 | Accepted | Accepted | 12.73 | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float('inf')
YES = "Yes" # type: str
NO = "No" # type: str
def solve(X: int, Y: int):
return [NO, YES][2*X <= Y <= 4*X and Y % 2 == 0]
def ma... | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float('inf')
YES = "Yes" # type: str
NO = "No" # type: str
def solve(X: int, Y: int):
return [YES, NO][not (2*X <= Y <= 4*X and Y % 2 == 0)]
... | 32 | 32 | 671 | 677 | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float("inf")
YES = "Yes" # type: str
NO = "No" # type: str
def solve(X: int, Y: int):
return [NO, YES][2 * X <= Y <= 4 * X and Y % 2 == 0]
def main():
sy... | #!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys
INF = float("inf")
YES = "Yes" # type: str
NO = "No" # type: str
def solve(X: int, Y: int):
return [YES, NO][not (2 * X <= Y <= 4 * X and Y % 2 == 0)]
def main():
... | false | 0 | [
"- return [NO, YES][2 * X <= Y <= 4 * X and Y % 2 == 0]",
"+ return [YES, NO][not (2 * X <= Y <= 4 * X and Y % 2 == 0)]"
] | false | 0.071253 | 0.038865 | 1.833349 | [
"s658027341",
"s524398476"
] |
u621935300 | p03722 | python | s745573388 | s616498628 | 1,027 | 117 | 2,936 | 34,024 | Accepted | Accepted | 88.61 | import sys
N,M=list(map(int,input().split()))
a=[]
for i in range(M):
x,y,z=list(map(int,input().split()))
a.append((x,y,-1*z))
#print a
#distance
x=[ float("inf") for _ in range(N+1)]
#Set start point value to zero.
x[1]=0
#Bellman-Ford
for h in range(N):
for fr,to,cost in a:
x[to]=min(x[to... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N,M=list(map(int, sys.stdin.readline().split()))
#edge=[ map(int, sys.stdin.readline().split()) for _ in range(M) ] #辺
al=[ [] for _ in range(N+1) ] #隣接リスト
rev_al=[ [] for _ in range(N+1) ] #戻りを調べる用の隣接リスト
edge=[] #辺の集合
for _ in range(M):
... | 33 | 66 | 519 | 1,325 | import sys
N, M = list(map(int, input().split()))
a = []
for i in range(M):
x, y, z = list(map(int, input().split()))
a.append((x, y, -1 * z))
# print a
# distance
x = [float("inf") for _ in range(N + 1)]
# Set start point value to zero.
x[1] = 0
# Bellman-Ford
for h in range(N):
for fr, to, cost in a:
... | # -*- coding: utf-8 -*-
import sys
from collections import deque
N, M = list(map(int, sys.stdin.readline().split()))
# edge=[ map(int, sys.stdin.readline().split()) for _ in range(M) ] #辺
al = [[] for _ in range(N + 1)] # 隣接リスト
rev_al = [[] for _ in range(N + 1)] # 戻りを調べる用の隣接リスト
edge = [] # 辺の集合
for _ in range(M)... | false | 50 | [
"+# -*- coding: utf-8 -*-",
"+from collections import deque",
"-N, M = list(map(int, input().split()))",
"-a = []",
"-for i in range(M):",
"- x, y, z = list(map(int, input().split()))",
"- a.append((x, y, -1 * z))",
"-# print a",
"-# distance",
"-x = [float(\"inf\") for _ in range(N + 1)]",
... | false | 0.037389 | 0.053597 | 0.697593 | [
"s745573388",
"s616498628"
] |
u185896732 | p03633 | python | s939857962 | s579267662 | 46 | 36 | 5,304 | 5,176 | Accepted | Accepted | 21.74 | from fractions import gcd
def lcm(a,b):
return a*b//gcd(a,b)
n=int(eval(input()))
s=1
for i in range(n):
t=int(eval(input()))
s=lcm(s,t)
print(s) | from fractions import gcd
n=int(eval(input()))
s=1
for i in range(n):
t=int(eval(input()))
s=s*t//gcd(s,t)
print(s) | 9 | 7 | 153 | 117 | from fractions import gcd
def lcm(a, b):
return a * b // gcd(a, b)
n = int(eval(input()))
s = 1
for i in range(n):
t = int(eval(input()))
s = lcm(s, t)
print(s)
| from fractions import gcd
n = int(eval(input()))
s = 1
for i in range(n):
t = int(eval(input()))
s = s * t // gcd(s, t)
print(s)
| false | 22.222222 | [
"-",
"-",
"-def lcm(a, b):",
"- return a * b // gcd(a, b)",
"-",
"- s = lcm(s, t)",
"+ s = s * t // gcd(s, t)"
] | false | 0.112316 | 0.04803 | 2.338445 | [
"s939857962",
"s579267662"
] |
u450956662 | p02983 | python | s873500933 | s793519351 | 740 | 59 | 3,060 | 3,060 | Accepted | Accepted | 92.03 | L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
print((0))
else:
l_ = L % mod
r_ = R % mod
ans = 2019
for i in range(l_, r_):
for j in range(i+1, r_+1):
a = i * j % mod
ans = min(ans, a)
print(ans)
| L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
print((0))
else:
l_ = L % mod
r_ = R % mod
ans = 2019
for i in range(l_, r_):
for j in range(i+1, r_+1):
a = i * j % mod
ans = min(ans, a)
if ans == 0:... | 17 | 21 | 295 | 393 | L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
print((0))
else:
l_ = L % mod
r_ = R % mod
ans = 2019
for i in range(l_, r_):
for j in range(i + 1, r_ + 1):
a = i * j % mod
ans = min(ans, a)
print(ans)
| L, R = list(map(int, input().split()))
mod = 2019
l = L // mod
r = R // mod
if l != r:
print((0))
else:
l_ = L % mod
r_ = R % mod
ans = 2019
for i in range(l_, r_):
for j in range(i + 1, r_ + 1):
a = i * j % mod
ans = min(ans, a)
if ans == 0:
... | false | 19.047619 | [
"+ if ans == 0:",
"+ break",
"+ if ans == 0:",
"+ break"
] | false | 0.181985 | 0.037542 | 4.847554 | [
"s873500933",
"s793519351"
] |
u392319141 | p03283 | python | s763343045 | s469395971 | 1,483 | 1,089 | 77,668 | 19,160 | Accepted | Accepted | 26.57 | import numpy as np
N, M, K = map(int, input().split())
LR = np.zeros(shape=(N + 1, N + 1), dtype=np.int32)
L, R = np.array([input().split() for _ in range(M)], dtype=np.int32).T
np.add.at(LR, (L, R), 1)
np.cumsum(LR, axis=0, out=LR)
np.cumsum(LR, axis=1, out=LR)
ans = []
for _ in range(K):
p, q = m... | N, M, Q = map(int, input().split())
A = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
L, R = map(int, input().split())
A[L][R] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
A[i][j] += A[i][j - 1]
for j in range(1, N + 1):
for i in range(1, N + 1):
A[i]... | 18 | 20 | 440 | 499 | import numpy as np
N, M, K = map(int, input().split())
LR = np.zeros(shape=(N + 1, N + 1), dtype=np.int32)
L, R = np.array([input().split() for _ in range(M)], dtype=np.int32).T
np.add.at(LR, (L, R), 1)
np.cumsum(LR, axis=0, out=LR)
np.cumsum(LR, axis=1, out=LR)
ans = []
for _ in range(K):
p, q = map(int, input().... | N, M, Q = map(int, input().split())
A = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
L, R = map(int, input().split())
A[L][R] += 1
for i in range(1, N + 1):
for j in range(1, N + 1):
A[i][j] += A[i][j - 1]
for j in range(1, N + 1):
for i in range(1, N + 1):
A[i][j] += A[i - 1... | false | 10 | [
"-import numpy as np",
"-",
"-N, M, K = map(int, input().split())",
"-LR = np.zeros(shape=(N + 1, N + 1), dtype=np.int32)",
"-L, R = np.array([input().split() for _ in range(M)], dtype=np.int32).T",
"-np.add.at(LR, (L, R), 1)",
"-np.cumsum(LR, axis=0, out=LR)",
"-np.cumsum(LR, axis=1, out=LR)",
"+N,... | false | 0.391414 | 0.036707 | 10.663127 | [
"s763343045",
"s469395971"
] |
u488127128 | p03680 | python | s196739608 | s702864992 | 93 | 84 | 7,084 | 7,084 | Accepted | Accepted | 9.68 | import sys
input = sys.stdin.readline
n = int(eval(input()))
buttons = [int(eval(input()))-1 for n in range(n)]
light = 0
count = 0
while light != 1:
if buttons[light] == -1:
print((-1))
break
num = light
light = buttons[num]
buttons[num] = -1
count += 1
else:
pr... | import sys
input = sys.stdin.readline
n = int(eval(input()))
buttons = [int(eval(input())) for n in range(n)]
count,light = 1,buttons[0]
while light != 2 and count<n:
count,light = count+1,buttons[light-1]
print((count if count<n else -1)) | 17 | 9 | 316 | 238 | import sys
input = sys.stdin.readline
n = int(eval(input()))
buttons = [int(eval(input())) - 1 for n in range(n)]
light = 0
count = 0
while light != 1:
if buttons[light] == -1:
print((-1))
break
num = light
light = buttons[num]
buttons[num] = -1
count += 1
else:
print(count)
| import sys
input = sys.stdin.readline
n = int(eval(input()))
buttons = [int(eval(input())) for n in range(n)]
count, light = 1, buttons[0]
while light != 2 and count < n:
count, light = count + 1, buttons[light - 1]
print((count if count < n else -1))
| false | 47.058824 | [
"-buttons = [int(eval(input())) - 1 for n in range(n)]",
"-light = 0",
"-count = 0",
"-while light != 1:",
"- if buttons[light] == -1:",
"- print((-1))",
"- break",
"- num = light",
"- light = buttons[num]",
"- buttons[num] = -1",
"- count += 1",
"-else:",
"- ... | false | 0.04941 | 0.070995 | 0.695953 | [
"s196739608",
"s702864992"
] |
u325956328 | p02713 | python | s238981990 | s288509794 | 1,808 | 1,388 | 9,168 | 9,172 | Accepted | Accepted | 23.23 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| from math import gcd
def main():
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
if __name__ == "__main__":
main()
| 11 | 16 | 197 | 282 | from math import gcd
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
| from math import gcd
def main():
K = int(eval(input()))
ans = 0
for a in range(1, K + 1):
for b in range(1, K + 1):
for c in range(1, K + 1):
ans += gcd(gcd(a, b), c)
print(ans)
if __name__ == "__main__":
main()
| false | 31.25 | [
"-K = int(eval(input()))",
"-ans = 0",
"-for a in range(1, K + 1):",
"- for b in range(1, K + 1):",
"- for c in range(1, K + 1):",
"- ans += gcd(gcd(a, b), c)",
"-print(ans)",
"+",
"+def main():",
"+ K = int(eval(input()))",
"+ ans = 0",
"+ for a in range(1, K + 1... | false | 0.032851 | 0.178639 | 0.183896 | [
"s238981990",
"s288509794"
] |
u950708010 | p03602 | python | s210838880 | s207233760 | 1,618 | 871 | 238,892 | 143,940 | Accepted | Accepted | 46.17 |
def solve():
n = int(eval(input()))
a = []
for i in range(n):
tp = list(int(i) for i in input().split())
a.append(tp)
a2 = []
#warshall
for k in range(n):
for i in range(n):
for j in range(n):
if not k in [i,j]:
if a[i][j] > a[i][k] + a[k][j]:
#距離... | import sys
input = sys.stdin.readline
def solve():
n = int(eval(input()))
a = [list(int(i) for i in input().split()) for _ in range(n)]
a2 = []
#warshall
for k in range(n):
for i in range(n):
for j in range(i+1,n):
if not k in [i,j]:
if a[i][j] > a[i][k] + a[k][j]:
... | 28 | 25 | 589 | 585 | def solve():
n = int(eval(input()))
a = []
for i in range(n):
tp = list(int(i) for i in input().split())
a.append(tp)
a2 = []
# warshall
for k in range(n):
for i in range(n):
for j in range(n):
if not k in [i, j]:
if a[i][j]... | import sys
input = sys.stdin.readline
def solve():
n = int(eval(input()))
a = [list(int(i) for i in input().split()) for _ in range(n)]
a2 = []
# warshall
for k in range(n):
for i in range(n):
for j in range(i + 1, n):
if not k in [i, j]:
if... | false | 10.714286 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+",
"- a = []",
"- for i in range(n):",
"- tp = list(int(i) for i in input().split())",
"- a.append(tp)",
"+ a = [list(int(i) for i in input().split()) for _ in range(n)]",
"- for j in range(n):",
"+ ... | false | 0.039871 | 0.038663 | 1.03126 | [
"s210838880",
"s207233760"
] |
u832039789 | p03592 | python | s234933138 | s685511467 | 305 | 265 | 2,940 | 2,940 | Accepted | Accepted | 13.11 | n,m,k = list(map(int,input().split()))
for i in range(n+1):
for j in range(m+1):
if i*(m-j)+(n-i)*j==k:
print('Yes')
exit()
print('No')
| n,m,k = list(map(int,input().split()))
for a in range(n+1):
# a行押す
black = a * m
for b in range(m+1):
# b列押す
res = black + b * (n - 2 * a)
if res == k:
print('Yes')
exit()
print('No')
| 9 | 11 | 176 | 248 | n, m, k = list(map(int, input().split()))
for i in range(n + 1):
for j in range(m + 1):
if i * (m - j) + (n - i) * j == k:
print("Yes")
exit()
print("No")
| n, m, k = list(map(int, input().split()))
for a in range(n + 1):
# a行押す
black = a * m
for b in range(m + 1):
# b列押す
res = black + b * (n - 2 * a)
if res == k:
print("Yes")
exit()
print("No")
| false | 18.181818 | [
"-for i in range(n + 1):",
"- for j in range(m + 1):",
"- if i * (m - j) + (n - i) * j == k:",
"+for a in range(n + 1):",
"+ # a行押す",
"+ black = a * m",
"+ for b in range(m + 1):",
"+ # b列押す",
"+ res = black + b * (n - 2 * a)",
"+ if res == k:"
] | false | 0.042545 | 0.101825 | 0.417826 | [
"s234933138",
"s685511467"
] |
u947883560 | p02642 | python | s522435462 | s991470759 | 449 | 164 | 92,156 | 98,088 | Accepted | Accepted | 63.47 | #!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left
def divisors(n):
ret = set()
for i in range(1, int(n ** 0.5) + 1):
d, m = divmod(n, i)
if m == 0:
ret.add(i)
ret.add(d)
return ret
def main()... | #!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
# 愚直に行うとO(N^2)となる
# エラトステネスの篩を真似ると、NlogNで済む
# 同じ数字が存在している場合は、注意する
table = [False]*(A[-... | 53 | 48 | 1,126 | 1,049 | #!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left
def divisors(n):
ret = set()
for i in range(1, int(n**0.5) + 1):
d, m = divmod(n, i)
if m == 0:
ret.add(i)
ret.add(d)
return ret
def main():
N = int(eval... | #!/usr/bin/env python3
import sys
import math
sys.setrecursionlimit(10**8)
from bisect import bisect_left
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
# 愚直に行うとO(N^2)となる
# エラトステネスの篩を真似ると、NlogNで済む
# 同じ数字が存在している場合は、注意する
table = [False] * (A[-1] + 1)
ans... | false | 9.433962 | [
"-def divisors(n):",
"- ret = set()",
"- for i in range(1, int(n**0.5) + 1):",
"- d, m = divmod(n, i)",
"- if m == 0:",
"- ret.add(i)",
"- ret.add(d)",
"- return ret",
"-",
"-",
"- # 各要素、約数を列挙(sqrt(N))",
"- # 約数がこれまでに存在したかをチェックO(1)*約数の個数",
"... | false | 0.035814 | 0.058384 | 0.613418 | [
"s522435462",
"s991470759"
] |
u738898077 | p02785 | python | s818334393 | s918492007 | 179 | 150 | 26,024 | 26,024 | Accepted | Accepted | 16.2 | n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=1)
ans = 0
for i in range(k,n):
ans += a[i]
print(ans)
| n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort()
print((sum(a[:max(n-k,0)]))) | 7 | 4 | 146 | 104 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=1)
ans = 0
for i in range(k, n):
ans += a[i]
print(ans)
| n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
print((sum(a[: max(n - k, 0)])))
| false | 42.857143 | [
"-a.sort(reverse=1)",
"-ans = 0",
"-for i in range(k, n):",
"- ans += a[i]",
"-print(ans)",
"+a.sort()",
"+print((sum(a[: max(n - k, 0)])))"
] | false | 0.102392 | 0.035961 | 2.847295 | [
"s818334393",
"s918492007"
] |
u935984175 | p03053 | python | s882131278 | s136809530 | 656 | 349 | 152,944 | 141,408 | Accepted | Accepted | 46.8 | from collections import deque
def solve():
H, W = list(map(int, input().split()))
grid = [['' for _ in range(W)] for _ in range(H)]
que = deque()
for i in range(H):
grid[i] = list(eval(input()))
for j in range(W):
if grid[i][j] == '#':
que.append(... | import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline
def solve():
H, W = list(map(int, rl().split()))
grid = [[] for _ in range(H)]
que = deque()
for i in range(H):
grid[i] = list(rl().rstrip())
for j in range(W):
if... | 32 | 34 | 852 | 861 | from collections import deque
def solve():
H, W = list(map(int, input().split()))
grid = [["" for _ in range(W)] for _ in range(H)]
que = deque()
for i in range(H):
grid[i] = list(eval(input()))
for j in range(W):
if grid[i][j] == "#":
que.append([i, j])
... | import sys
from collections import deque
sys.setrecursionlimit(10**7)
rl = sys.stdin.readline
def solve():
H, W = list(map(int, rl().split()))
grid = [[] for _ in range(H)]
que = deque()
for i in range(H):
grid[i] = list(rl().rstrip())
for j in range(W):
if grid[i][j] == "... | false | 5.882353 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+rl = sys.stdin.readline",
"- H, W = list(map(int, input().split()))",
"- grid = [[\"\" for _ in range(W)] for _ in range(H)]",
"+ H, W = list(map(int, rl().split()))",
"+ grid = [[] for _ in range(H)]",
"- grid[i] = list(eval(... | false | 0.046109 | 0.046268 | 0.99656 | [
"s882131278",
"s136809530"
] |
u021019433 | p02866 | python | s902889886 | s902008783 | 225 | 190 | 14,256 | 22,636 | Accepted | Accepted | 15.56 | from itertools import groupby
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
r = 0
if next(a) == 0:
r = p = 1
for i, (k, g) in enumerate(groupby(sorted(a)), 1):
if k != i:
r = 0
break
l = sum(1 for _ in g)
r = r * pow(p, l, ... | from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
r = p = i = 1
while c[i]:
r = r * pow(p, c[i], M) % M
p = c[i]
n -= p
i += 1
print(((r, 0)[n > 1]))
| 16 | 15 | 340 | 299 | from itertools import groupby
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
r = 0
if next(a) == 0:
r = p = 1
for i, (k, g) in enumerate(groupby(sorted(a)), 1):
if k != i:
r = 0
break
l = sum(1 for _ in g)
r = r * pow(p, l, M) % M
... | from collections import Counter
M = 998244353
n = int(eval(input()))
a = list(map(int, input().split()))
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
r = p = i = 1
while c[i]:
r = r * pow(p, c[i], M) % M
p = c[i]
n -= p
i += 1
print(((r, 0)[n > 1]))
| false | 6.25 | [
"-from itertools import groupby",
"+from collections import Counter",
"+x, c = next(a), Counter(a)",
"-if next(a) == 0:",
"- r = p = 1",
"- for i, (k, g) in enumerate(groupby(sorted(a)), 1):",
"- if k != i:",
"- r = 0",
"- break",
"- l = sum(1 for _ in g)"... | false | 0.068143 | 0.065645 | 1.038051 | [
"s902889886",
"s902008783"
] |
u779455925 | p03026 | python | s369183565 | s783275391 | 334 | 307 | 50,904 | 50,648 | Accepted | Accepted | 8.08 | N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N-1)]
C=list(map(int,input().split()))
C.sort(reverse=True)
data=[[] for i in range(N+1)]
num=[-1 for i in range(N+1)]
num[1]=C[0]
for a,b in AB:
data[a].append(b)
data[b].append(a)
sumc=sum(C[1:])
stack=[1]
visited=set()
visi... | from collections import *
N=int(eval(input()))
AB=[list(map(int,input().split())) for i in range(N-1)]
C=list(map(int,input().split()))
C.sort(reverse=True)
data=[[] for i in range(N+1)]
num=[-1 for i in range(N+1)]
num[1]=C[0]
for a,b in AB:
data[a].append(b)
data[b].append(a)
sumc=sum(C[1:])
sta... | 26 | 28 | 589 | 640 | N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N - 1)]
C = list(map(int, input().split()))
C.sort(reverse=True)
data = [[] for i in range(N + 1)]
num = [-1 for i in range(N + 1)]
num[1] = C[0]
for a, b in AB:
data[a].append(b)
data[b].append(a)
sumc = sum(C[1:])
stack = [1]
visited ... | from collections import *
N = int(eval(input()))
AB = [list(map(int, input().split())) for i in range(N - 1)]
C = list(map(int, input().split()))
C.sort(reverse=True)
data = [[] for i in range(N + 1)]
num = [-1 for i in range(N + 1)]
num[1] = C[0]
for a, b in AB:
data[a].append(b)
data[b].append(a)
sumc = sum(... | false | 7.142857 | [
"+from collections import *",
"+",
"+stack = deque(stack)",
"- a = stack.pop()",
"+ a = stack.popleft()"
] | false | 0.143959 | 0.104359 | 1.379458 | [
"s369183565",
"s783275391"
] |
u002459665 | p03625 | python | s036140191 | s872018535 | 122 | 101 | 18,600 | 14,636 | Accepted | Accepted | 17.21 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter()
for ai in A:
c[ai] += 1
more_than_2 = []
for k, v in list(c.items()):
if v >= 4:
more_than_2.append(k)
if v >= 2:
more_than_2.append(k)
if len(more_than_2) < 2:
... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
lines = []
cnt = 1
before = 'XXX'
for ai in A + ['YYY']:
if ai == before:
cnt += 1
else:
if cnt >= 4:
lines.append(before)
lines.... | 24 | 32 | 422 | 561 | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
c = Counter()
for ai in A:
c[ai] += 1
more_than_2 = []
for k, v in list(c.items()):
if v >= 4:
more_than_2.append(k)
if v >= 2:
more_than_2.append(k)
if len(more_than_2) < 2:
print((0))
else:
... | from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
lines = []
cnt = 1
before = "XXX"
for ai in A + ["YYY"]:
if ai == before:
cnt += 1
else:
if cnt >= 4:
lines.append(before)
lines.append(before)
... | false | 25 | [
"-c = Counter()",
"-for ai in A:",
"- c[ai] += 1",
"-more_than_2 = []",
"-for k, v in list(c.items()):",
"- if v >= 4:",
"- more_than_2.append(k)",
"- if v >= 2:",
"- more_than_2.append(k)",
"-if len(more_than_2) < 2:",
"+A.sort(reverse=True)",
"+# print(A)",
"+lines =... | false | 0.114715 | 0.040374 | 2.841297 | [
"s036140191",
"s872018535"
] |
u657913472 | p03662 | python | s225728814 | s967954351 | 1,644 | 1,371 | 194,020 | 190,100 | Accepted | Accepted | 16.61 | from networkx import*
(N,),*t=list(map(str.split,open(0)))
x,y=[shortest_path_length(Graph(t),v)for v in('1',N)]
print(('FSennunkeec'[sum(x[k]>y[k]for k in x)*2>=int(N)::2])) | from networkx import*
N,*t=list(map(str.split,open(0)))
s=shortest_path_length
x=s(G:=Graph(t),'1')
y=s(G,*N)
print(('FSennunkeec'[sum(x[k]>y[k]for k in x)*2>=len(x)::2])) | 4 | 6 | 169 | 168 | from networkx import *
(N,), *t = list(map(str.split, open(0)))
x, y = [shortest_path_length(Graph(t), v) for v in ("1", N)]
print(("FSennunkeec"[sum(x[k] > y[k] for k in x) * 2 >= int(N) :: 2]))
| from networkx import *
N, *t = list(map(str.split, open(0)))
s = shortest_path_length
x = s(G := Graph(t), "1")
y = s(G, *N)
print(("FSennunkeec"[sum(x[k] > y[k] for k in x) * 2 >= len(x) :: 2]))
| false | 33.333333 | [
"-(N,), *t = list(map(str.split, open(0)))",
"-x, y = [shortest_path_length(Graph(t), v) for v in (\"1\", N)]",
"-print((\"FSennunkeec\"[sum(x[k] > y[k] for k in x) * 2 >= int(N) :: 2]))",
"+N, *t = list(map(str.split, open(0)))",
"+s = shortest_path_length",
"+x = s(G := Graph(t), \"1\")",
"+y = s(G, *... | false | 0.049421 | 0.049726 | 0.993868 | [
"s225728814",
"s967954351"
] |
u210827208 | p03006 | python | s317248599 | s518111667 | 37 | 23 | 3,188 | 3,572 | Accepted | Accepted | 37.84 | n=int(eval(input()))
M=[]
for i in range(n):
x,y=list(map(int,input().split()))
M.append([x,y])
M.sort(key=lambda x:(x[0],x[1]))
X=[]
Y=[]
for i in range(n-1):
for j in range(i+1,n):
a=M[i][0]-M[j][0]
b=M[i][1]-M[j][1]
if not [a,b] in Y:
Y.append([a,b])
... | from collections import defaultdict as de
X=de(int)
n=int(eval(input()))
a=sorted([list(map(int,input().split()))for i in range(n)])
for i in range(n):
for j in range(i):
X[(a[i][0]-a[j][0],a[i][1]-a[j][1])]+=1
print((n-max(list(X.values()),default=0))) | 21 | 8 | 445 | 258 | n = int(eval(input()))
M = []
for i in range(n):
x, y = list(map(int, input().split()))
M.append([x, y])
M.sort(key=lambda x: (x[0], x[1]))
X = []
Y = []
for i in range(n - 1):
for j in range(i + 1, n):
a = M[i][0] - M[j][0]
b = M[i][1] - M[j][1]
if not [a, b] in Y:
Y.app... | from collections import defaultdict as de
X = de(int)
n = int(eval(input()))
a = sorted([list(map(int, input().split())) for i in range(n)])
for i in range(n):
for j in range(i):
X[(a[i][0] - a[j][0], a[i][1] - a[j][1])] += 1
print((n - max(list(X.values()), default=0)))
| false | 61.904762 | [
"+from collections import defaultdict as de",
"+",
"+X = de(int)",
"-M = []",
"+a = sorted([list(map(int, input().split())) for i in range(n)])",
"- x, y = list(map(int, input().split()))",
"- M.append([x, y])",
"-M.sort(key=lambda x: (x[0], x[1]))",
"-X = []",
"-Y = []",
"-for i in range(... | false | 0.115581 | 0.047006 | 2.458866 | [
"s317248599",
"s518111667"
] |
u794173881 | p03685 | python | s757393424 | s498106077 | 1,176 | 1,060 | 128,308 | 80,220 | Accepted | Accepted | 9.86 | import random
import sys
input = sys.stdin.readline
class BIT():
"""区間加算、一点取得クエリをそれぞれO(logN)で答える
add: 区間[l, r)にvalを加える
get_val: i番目の値を求める
i, l, rは0-indexed
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while ... | from collections import deque
import sys
input = sys.stdin.readline
class BIT():
"""区間加算、一点取得クエリをそれぞれO(logN)で答える
add: 区間[l, r)にvalを加える
get_val: i番目の値を求める
i, l, rは0-indexed
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):... | 81 | 68 | 1,965 | 1,452 | import random
import sys
input = sys.stdin.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答える
add: 区間[l, r)にvalを加える
get_val: i番目の値を求める
i, l, rは0-indexed
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while i > 0:
... | from collections import deque
import sys
input = sys.stdin.readline
class BIT:
"""区間加算、一点取得クエリをそれぞれO(logN)で答える
add: 区間[l, r)にvalを加える
get_val: i番目の値を求める
i, l, rは0-indexed
"""
def __init__(self, n):
self.n = n
self.bit = [0] * (n + 1)
def _add(self, i, val):
while ... | false | 16.049383 | [
"-import random",
"+from collections import deque",
"-def compress(array):",
"- set_ = set([])",
"- for i in range(len(array)):",
"- a, b = array[i]",
"- set_.add(a)",
"- set_.add(b)",
"- memo = {value: index for index, value in enumerate(sorted(list(set_)))}",
"- ... | false | 0.039548 | 0.058939 | 0.671001 | [
"s757393424",
"s498106077"
] |
u645250356 | p02691 | python | s552412426 | s795596383 | 374 | 271 | 135,940 | 62,624 | Accepted | Accepted | 27.54 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 19 | 19 | 523 | 510 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 0 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush",
"-sa = defaultdict(int)",
"+d = defaultdict(int)",
"- sa[(i + 1) - x] += 1",
"+ d[i + 1 - x] += 1",
"- res += sa[i + 1 + x]",
"+ res += d[i + 1 + x]"
] | false | 0.08017 | 0.0388 | 2.06621 | [
"s552412426",
"s795596383"
] |
u773265208 | p02911 | python | s392256154 | s767916343 | 589 | 268 | 56,664 | 4,708 | Accepted | Accepted | 54.5 | n,k,q = list(map(int,input().split()))
a = []
for _ in range(q):
a.append(int(eval(input())))
b = [0]*n
for i in a:
b[i-1] += 1
for i in range(n):
minus_point = q - b[i]
if k - minus_point > 0:
print('Yes')
else:
print('No') | n,k,q = list(map(int,input().split()))
l = [0 for _ in range(n)]
for _ in range(q):
a = int(eval(input())) - 1
l[a] += 1
for i in range(n):
if q - l[i] >= k:
print('No')
else:
print('Yes')
| 16 | 11 | 239 | 196 | n, k, q = list(map(int, input().split()))
a = []
for _ in range(q):
a.append(int(eval(input())))
b = [0] * n
for i in a:
b[i - 1] += 1
for i in range(n):
minus_point = q - b[i]
if k - minus_point > 0:
print("Yes")
else:
print("No")
| n, k, q = list(map(int, input().split()))
l = [0 for _ in range(n)]
for _ in range(q):
a = int(eval(input())) - 1
l[a] += 1
for i in range(n):
if q - l[i] >= k:
print("No")
else:
print("Yes")
| false | 31.25 | [
"-a = []",
"+l = [0 for _ in range(n)]",
"- a.append(int(eval(input())))",
"-b = [0] * n",
"-for i in a:",
"- b[i - 1] += 1",
"+ a = int(eval(input())) - 1",
"+ l[a] += 1",
"- minus_point = q - b[i]",
"- if k - minus_point > 0:",
"+ if q - l[i] >= k:",
"+ print(\"No... | false | 0.046873 | 0.063852 | 0.734078 | [
"s392256154",
"s767916343"
] |
u780475861 | p02813 | python | s959276590 | s029094051 | 37 | 34 | 8,052 | 8,052 | Accepted | Accepted | 8.11 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import permutations as perm
n = int(readline())
p = tuple(map(int, readline().split()))
q = tuple(map(int, readline().split()))
lst = list(perm(list(range(1, n+1)),n))
lst.sort()
... | from itertools import permutations as perm
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
p = tuple(map(int, readline().split()))
q = tuple(map(int, readline().split()))
p_lst = list(perm(list(range(1, n + 1)), n)) # 排列
pn = qn = 0
for i,j in enumerate(p_lst, 1):
if p == j:
pn ... | 19 | 18 | 456 | 401 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import permutations as perm
n = int(readline())
p = tuple(map(int, readline().split()))
q = tuple(map(int, readline().split()))
lst = list(perm(list(range(1, n + 1)), n))
lst.sort()
pn = ... | from itertools import permutations as perm
import sys
readline = sys.stdin.buffer.readline
n = int(readline())
p = tuple(map(int, readline().split()))
q = tuple(map(int, readline().split()))
p_lst = list(perm(list(range(1, n + 1)), n)) # 排列
pn = qn = 0
for i, j in enumerate(p_lst, 1):
if p == j:
pn = i
... | false | 5.263158 | [
"+from itertools import permutations as perm",
"-read = sys.stdin.buffer.read",
"-readlines = sys.stdin.buffer.readlines",
"-from itertools import permutations as perm",
"-",
"-lst = list(perm(list(range(1, n + 1)), n))",
"-lst.sort()",
"+p_lst = list(perm(list(range(1, n + 1)), n)) # 排列",
"-for i,... | false | 0.081056 | 0.122981 | 0.659093 | [
"s959276590",
"s029094051"
] |
u367701763 | p02900 | python | s691127393 | s168928214 | 89 | 70 | 69,668 | 62,680 | Accepted | Accepted | 21.35 | def divisors(n):
i = 1
table = set()
while i * i <= n:
if not n % i:
table.add(i)
table.add(n//i)
i += 1
return table
def max2(x,y):
return x if x > y else y
def rec(start_set, t):
global res
res = max2(res, t)
next_set = []
... | def prime_factors(n): # 戻り値はiterable type
i = 2
while i * i <= n:
if n % i:
i += 1
else:
n //= i
yield i # whileループを進めるごとにイテレータに値を貯め続ける
if n > 1:
yield n
A, B = list(map(int, input().split()))
data = set(prime_facto... | 37 | 15 | 686 | 367 | def divisors(n):
i = 1
table = set()
while i * i <= n:
if not n % i:
table.add(i)
table.add(n // i)
i += 1
return table
def max2(x, y):
return x if x > y else y
def rec(start_set, t):
global res
res = max2(res, t)
next_set = []
i = start_se... | def prime_factors(n): # 戻り値はiterable type
i = 2
while i * i <= n:
if n % i:
i += 1
else:
n //= i
yield i # whileループを進めるごとにイテレータに値を貯め続ける
if n > 1:
yield n
A, B = list(map(int, input().split()))
data = set(prime_factors(A)) & set(prime_factors(B)... | false | 59.459459 | [
"-def divisors(n):",
"- i = 1",
"- table = set()",
"+def prime_factors(n): # 戻り値はiterable type",
"+ i = 2",
"- if not n % i:",
"- table.add(i)",
"- table.add(n // i)",
"- i += 1",
"- return table",
"+ if n % i:",
"+ i += 1",
... | false | 0.00779 | 0.069379 | 0.112276 | [
"s691127393",
"s168928214"
] |
u367130284 | p03607 | python | s978951385 | s407730439 | 208 | 65 | 16,640 | 18,784 | Accepted | Accepted | 68.75 | from collections import Counter
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
b=Counter(a)
c=[k for k,v in list(b.items()) if v%2==1]
print((len(c))) | from collections import*
n,*a=list(map(int,open(0).read().split()))
print((sum(v%2 for v in list(Counter(a).values())))) | 6 | 3 | 150 | 108 | from collections import Counter
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
b = Counter(a)
c = [k for k, v in list(b.items()) if v % 2 == 1]
print((len(c)))
| from collections import *
n, *a = list(map(int, open(0).read().split()))
print((sum(v % 2 for v in list(Counter(a).values()))))
| false | 50 | [
"-from collections import Counter",
"+from collections import *",
"-n = int(eval(input()))",
"-a = [int(eval(input())) for i in range(n)]",
"-b = Counter(a)",
"-c = [k for k, v in list(b.items()) if v % 2 == 1]",
"-print((len(c)))",
"+n, *a = list(map(int, open(0).read().split()))",
"+print((sum(v %... | false | 0.039293 | 0.046101 | 0.85232 | [
"s978951385",
"s407730439"
] |
u857293613 | p02819 | python | s341654156 | s627972445 | 275 | 30 | 2,940 | 2,940 | Accepted | Accepted | 89.09 | x = int(eval(input()))
while True:
n = 0
for i in range(2, x):
if x % i == 0:
n += 1
if n != 0:
x += 1
else:
break
print(x) | x = int(eval(input()))
while True:
judge = False
for i in range(2, x):
if x % i == 0:
judge = True
break
if judge:
x += 1
else:
break
print(x) | 11 | 12 | 179 | 211 | x = int(eval(input()))
while True:
n = 0
for i in range(2, x):
if x % i == 0:
n += 1
if n != 0:
x += 1
else:
break
print(x)
| x = int(eval(input()))
while True:
judge = False
for i in range(2, x):
if x % i == 0:
judge = True
break
if judge:
x += 1
else:
break
print(x)
| false | 8.333333 | [
"- n = 0",
"+ judge = False",
"- n += 1",
"- if n != 0:",
"+ judge = True",
"+ break",
"+ if judge:"
] | false | 0.160746 | 0.124472 | 1.291422 | [
"s341654156",
"s627972445"
] |
u452913314 | p02912 | python | s891914838 | s869364852 | 183 | 162 | 14,536 | 14,532 | Accepted | Accepted | 11.48 | import heapq as hq
import math
def discount(price):
return math.ceil(price / 2)
N,M = list(map(int,input().split()))
A = list([int(x)* -1 for x in input().split()])
hq.heapify(A)
for _ in range(M):
a = discount(hq.heappop(A))
hq.heappush(A,a)
print((sum(A)* -1)) | import heapq as hq
import math
N,M = list(map(int,input().split()))
A = list([int(x)* -1 for x in input().split()])
hq.heapify(A)
for _ in range(M):
a = math.ceil(hq.heappop(A) / 2)
hq.heappush(A,a)
print((sum(A)* -1)) | 15 | 12 | 288 | 236 | import heapq as hq
import math
def discount(price):
return math.ceil(price / 2)
N, M = list(map(int, input().split()))
A = list([int(x) * -1 for x in input().split()])
hq.heapify(A)
for _ in range(M):
a = discount(hq.heappop(A))
hq.heappush(A, a)
print((sum(A) * -1))
| import heapq as hq
import math
N, M = list(map(int, input().split()))
A = list([int(x) * -1 for x in input().split()])
hq.heapify(A)
for _ in range(M):
a = math.ceil(hq.heappop(A) / 2)
hq.heappush(A, a)
print((sum(A) * -1))
| false | 20 | [
"-",
"-",
"-def discount(price):",
"- return math.ceil(price / 2)",
"-",
"- a = discount(hq.heappop(A))",
"+ a = math.ceil(hq.heappop(A) / 2)"
] | false | 0.04974 | 0.04989 | 0.996995 | [
"s891914838",
"s869364852"
] |
u980322611 | p02837 | python | s725655316 | s164316997 | 341 | 303 | 51,180 | 47,324 | Accepted | Accepted | 11.14 | N = int(eval(input()))
B = [[-1]*N for i in range(N)]
for i in range(N):
tmpA = int(eval(input()))
for j in range(tmpA):
x,y = list(map(int,input().split()))
B[i][x-1] = y
zero1 = [0,1]
import itertools
ans = 0
for i in itertools.product(zero1,repeat=N):
tmpans = sum(i)
... | N = int(eval(input()))
B = [[-1]*N for i in range(N)]
for i in range(N):
tmpA = int(eval(input()))
for j in range(tmpA):
x,y = list(map(int,input().split()))
B[i][x-1] = y
ans = 0
for i in range(1<<N):
tmp = i
tmpans = 0
while tmp!=0:
tmpans += tmp%2
... | 37 | 39 | 934 | 946 | N = int(eval(input()))
B = [[-1] * N for i in range(N)]
for i in range(N):
tmpA = int(eval(input()))
for j in range(tmpA):
x, y = list(map(int, input().split()))
B[i][x - 1] = y
zero1 = [0, 1]
import itertools
ans = 0
for i in itertools.product(zero1, repeat=N):
tmpans = sum(i)
tmpshi =... | N = int(eval(input()))
B = [[-1] * N for i in range(N)]
for i in range(N):
tmpA = int(eval(input()))
for j in range(tmpA):
x, y = list(map(int, input().split()))
B[i][x - 1] = y
ans = 0
for i in range(1 << N):
tmp = i
tmpans = 0
while tmp != 0:
tmpans += tmp % 2
tmp /... | false | 5.128205 | [
"-zero1 = [0, 1]",
"-import itertools",
"-",
"-for i in itertools.product(zero1, repeat=N):",
"- tmpans = sum(i)",
"+for i in range(1 << N):",
"+ tmp = i",
"+ tmpans = 0",
"+ while tmp != 0:",
"+ tmpans += tmp % 2",
"+ tmp //= 2",
"- for j in range(len(i)):",
"+ ... | false | 0.045035 | 0.037293 | 1.207605 | [
"s725655316",
"s164316997"
] |
u298297089 | p03722 | python | s230844833 | s745029288 | 444 | 25 | 3,316 | 3,316 | Accepted | Accepted | 94.37 |
def bellman_ford(edges, start, n):
inf = float('INF')
costs = [inf] * n
predecessors = [-1] * n
costs[start]= 0
for _ in range(n-1):
for e in edges:
u,v,c = e
if costs[v] > costs[u] + c:
costs[v] = costs[u] + c
predecessor... | def bellman_ford(edges, start, n):
inf = float('INF')
costs = [inf] * n
# predecessors = [-1] * n
costs[start]= 0
for e in edges:
u,v,c = e
if costs[v] > costs[u] + c:
costs[v] = costs[u] + c
# predecessors[v] = u
ans = costs[-1]
for u,v... | 27 | 25 | 673 | 629 | def bellman_ford(edges, start, n):
inf = float("INF")
costs = [inf] * n
predecessors = [-1] * n
costs[start] = 0
for _ in range(n - 1):
for e in edges:
u, v, c = e
if costs[v] > costs[u] + c:
costs[v] = costs[u] + c
predecessors[v] = u
... | def bellman_ford(edges, start, n):
inf = float("INF")
costs = [inf] * n
# predecessors = [-1] * n
costs[start] = 0
for e in edges:
u, v, c = e
if costs[v] > costs[u] + c:
costs[v] = costs[u] + c
# predecessors[v] = u
ans = costs[-1]
for u, v, c in edge... | false | 7.407407 | [
"- predecessors = [-1] * n",
"+ # predecessors = [-1] * n",
"- for _ in range(n - 1):",
"- for e in edges:",
"- u, v, c = e",
"- if costs[v] > costs[u] + c:",
"- costs[v] = costs[u] + c",
"- predecessors[v] = u",
"+ for e in edge... | false | 0.036605 | 0.035973 | 1.017583 | [
"s230844833",
"s745029288"
] |
u567380442 | p02386 | python | s142760371 | s908206580 | 220 | 90 | 6,756 | 6,756 | Accepted | Accepted | 59.09 | mask = [[i for i in range(6)], (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)]
mask += [[mask[1][i] for i in mask[1]]]
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(dice1, dice2):
... | mask = [[i for i in range(6)], (1, 5, 2, 3, 0, 4), (2, 1, 5, 0, 4,3),(3, 1, 0, 5, 4, 2), (4, 0, 2, 3, 5, 1)]
mask += [[mask[1][i] for i in mask[1]]]
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(dice1, dice2):
... | 30 | 33 | 845 | 913 | mask = [
[i for i in range(6)],
(1, 5, 2, 3, 0, 4),
(2, 1, 5, 0, 4, 3),
(3, 1, 0, 5, 4, 2),
(4, 0, 2, 3, 5, 1),
]
mask += [[mask[1][i] for i in mask[1]]]
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(... | mask = [
[i for i in range(6)],
(1, 5, 2, 3, 0, 4),
(2, 1, 5, 0, 4, 3),
(3, 1, 0, 5, 4, 2),
(4, 0, 2, 3, 5, 1),
]
mask += [[mask[1][i] for i in mask[1]]]
def set_top(dice, top):
return [dice[i] for i in mask[top]]
def twist(dice):
return [dice[i] for i in (0, 3, 1, 4, 2, 5)]
def equal(... | false | 9.090909 | [
"+ if sorted(dice1) != sorted(dice2):",
"+ return False"
] | false | 0.038358 | 0.045776 | 0.837948 | [
"s142760371",
"s908206580"
] |
u814986259 | p03607 | python | s806618517 | s669843228 | 219 | 120 | 18,148 | 15,460 | Accepted | Accepted | 45.21 | import collections
table=collections.defaultdict(int)
N=int(eval(input()))
for i in range(N):
table[eval(input())]+=1
table=list(table.values())
table=[table[i] for i in range(len(table)) if table[i]%2==1]
print((len(table))) | import sys
import collections
N = int(eval(input()))
input = sys.stdin.readline
d = collections.defaultdict(int)
for i in range(N):
a = int(eval(input()))
d[a] += 1
ans = 0
for x in d:
if d[x] % 2 == 1:
ans += 1
print(ans)
| 8 | 13 | 220 | 243 | import collections
table = collections.defaultdict(int)
N = int(eval(input()))
for i in range(N):
table[eval(input())] += 1
table = list(table.values())
table = [table[i] for i in range(len(table)) if table[i] % 2 == 1]
print((len(table)))
| import sys
import collections
N = int(eval(input()))
input = sys.stdin.readline
d = collections.defaultdict(int)
for i in range(N):
a = int(eval(input()))
d[a] += 1
ans = 0
for x in d:
if d[x] % 2 == 1:
ans += 1
print(ans)
| false | 38.461538 | [
"+import sys",
"-table = collections.defaultdict(int)",
"+input = sys.stdin.readline",
"+d = collections.defaultdict(int)",
"- table[eval(input())] += 1",
"-table = list(table.values())",
"-table = [table[i] for i in range(len(table)) if table[i] % 2 == 1]",
"-print((len(table)))",
"+ a = int(... | false | 0.064624 | 0.046391 | 1.39301 | [
"s806618517",
"s669843228"
] |
u888092736 | p03436 | python | s446517921 | s944784301 | 42 | 37 | 9,636 | 9,540 | Accepted | Accepted | 11.9 | from collections import deque
def bfs(start):
q = deque([[start]])
visited = set()
while q:
path = q.popleft()
i, j = path[-1]
if (i, j) == (H - 1, W - 1):
return path
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
ni, nj = i + di, j +... | from collections import deque
def bfs(start, goal):
q = deque([[start]])
visited = set()
while q:
path = q.popleft()
i, j = path[-1]
if (i, j) == goal:
return path
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
ni, nj = i + di, j + dj
... | 35 | 28 | 900 | 800 | from collections import deque
def bfs(start):
q = deque([[start]])
visited = set()
while q:
path = q.popleft()
i, j = path[-1]
if (i, j) == (H - 1, W - 1):
return path
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
ni, nj = i + di, j + dj
... | from collections import deque
def bfs(start, goal):
q = deque([[start]])
visited = set()
while q:
path = q.popleft()
i, j = path[-1]
if (i, j) == goal:
return path
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
ni, nj = i + di, j + dj
... | false | 20 | [
"-def bfs(start):",
"+def bfs(start, goal):",
"- if (i, j) == (H - 1, W - 1):",
"+ if (i, j) == goal:",
"- if (",
"- 0 <= ni < H",
"- and 0 <= nj < W",
"- and field[ni][nj] != \"#\"",
"- and (ni, nj) not in visited"... | false | 0.04204 | 0.042935 | 0.979171 | [
"s446517921",
"s944784301"
] |
u707124227 | p02732 | python | s117512288 | s270511130 | 487 | 323 | 26,268 | 24,748 | Accepted | Accepted | 33.68 | n=int(eval(input()))
a=list(map(int,input().split()))
a0=[ai for ai in a]
a0.sort()
b=[-1]*(n+1)
base=0
i=0
while i < n:
t=a0[i]
c=1
while i < n-1 and a0[i]==a0[i+1]:
c+=1
i+=1
b[t]=c
base+=c*(c-1)//2
i+=1
for i in range(n):
d=b[a[i]]
print((base-d+1)) | n=int(eval(input()))
a=list(map(int,input().split()))
from collections import Counter
ca=Counter(a)
ans=sum([(v*(v-1))//2 for v in list(ca.values())])
for ai in a:
print((ans-ca[ai]+1)) | 19 | 7 | 310 | 179 | n = int(eval(input()))
a = list(map(int, input().split()))
a0 = [ai for ai in a]
a0.sort()
b = [-1] * (n + 1)
base = 0
i = 0
while i < n:
t = a0[i]
c = 1
while i < n - 1 and a0[i] == a0[i + 1]:
c += 1
i += 1
b[t] = c
base += c * (c - 1) // 2
i += 1
for i in range(n):
d = b[a[... | n = int(eval(input()))
a = list(map(int, input().split()))
from collections import Counter
ca = Counter(a)
ans = sum([(v * (v - 1)) // 2 for v in list(ca.values())])
for ai in a:
print((ans - ca[ai] + 1))
| false | 63.157895 | [
"-a0 = [ai for ai in a]",
"-a0.sort()",
"-b = [-1] * (n + 1)",
"-base = 0",
"-i = 0",
"-while i < n:",
"- t = a0[i]",
"- c = 1",
"- while i < n - 1 and a0[i] == a0[i + 1]:",
"- c += 1",
"- i += 1",
"- b[t] = c",
"- base += c * (c - 1) // 2",
"- i += 1",
"-... | false | 0.044679 | 0.074381 | 0.600677 | [
"s117512288",
"s270511130"
] |
u562935282 | p03324 | python | s891732765 | s574445764 | 315 | 17 | 2,940 | 2,940 | Accepted | Accepted | 94.6 | def func(x):
if(x % 100 != 0):
return 0
else:
return func(x / 100) + 1
if __name__ == '__main__':
d, n = list(map(int, input().split()))
x = 1
cnt = 0
while True:
if func(x) == d:
cnt += 1
if cnt == n:
print(x)
e... | d, n = list(map(int, input().split()))
if n % 100 == 0:
n += 1
print((n * 100 ** d))
| 19 | 4 | 343 | 84 | def func(x):
if x % 100 != 0:
return 0
else:
return func(x / 100) + 1
if __name__ == "__main__":
d, n = list(map(int, input().split()))
x = 1
cnt = 0
while True:
if func(x) == d:
cnt += 1
if cnt == n:
print(x)
exit()
x... | d, n = list(map(int, input().split()))
if n % 100 == 0:
n += 1
print((n * 100**d))
| false | 78.947368 | [
"-def func(x):",
"- if x % 100 != 0:",
"- return 0",
"- else:",
"- return func(x / 100) + 1",
"-",
"-",
"-if __name__ == \"__main__\":",
"- d, n = list(map(int, input().split()))",
"- x = 1",
"- cnt = 0",
"- while True:",
"- if func(x) == d:",
"- ... | false | 0.420144 | 0.034763 | 12.085973 | [
"s891732765",
"s574445764"
] |
u968166680 | p02586 | python | s773872488 | s151050560 | 829 | 536 | 198,404 | 199,388 | Accepted | Accepted | 35.34 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = [[0] * C for _ in range(R)]
for r, c, v in zip(*[iter(RCV)] * 3):
... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = [[0] * C for _ in range(R)]
for r, c, v in zip(*[iter(RCV)] * 3):
... | 38 | 40 | 895 | 945 | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = [[0] * C for _ in range(R)]
for r, c, v in zip(*[iter(RCV)] * 3):
item[r - 1... | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007
def main():
R, C, K, *RCV = list(map(int, read().split()))
item = [[0] * C for _ in range(R)]
for r, c, v in zip(*[iter(RCV)] * 3):
item[r - 1... | false | 5 | [
"+ else:",
"+ break"
] | false | 0.074837 | 0.050402 | 1.484808 | [
"s773872488",
"s151050560"
] |
u114641312 | p03665 | python | s626628104 | s158868473 | 270 | 163 | 20,636 | 13,212 | Accepted | Accepted | 39.63 | # from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
... | # from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
... | 38 | 46 | 1,088 | 1,223 | # from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
import n... | # from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)
import n... | false | 17.391304 | [
"-bins = np.bincount(A, minlength=2)",
"-if bins[1] == 0:",
"- if P == 0:",
"- print((2 ** bins[P]))",
"+if not (1 in A):",
"+ if P == 1:",
"+ print((0))",
"- print((0))",
"+ print((2**N))",
"+even = 1",
"+odd = 1",
"+for i in sorted(A)[::-1][1:]:",
"+ if... | false | 0.326444 | 0.393974 | 0.828592 | [
"s626628104",
"s158868473"
] |
u352623442 | p03608 | python | s947776983 | s214740479 | 662 | 487 | 81,752 | 49,112 | Accepted | Accepted | 26.44 | import itertools
inf = float("inf")
n,m,r = list(map(int,input().split()))
ra = list(map(int,input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
for i in range(m):
a,b,c = list(map(int,input().split()))
dist[a-1][b-1] = c
dist[b-1][a-1] = c
for a in range(n):
for b in range(... | inf = 10**15
import itertools
n,m,r = list(map(int,input().split()))
city = list(map(int,input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
#まず距離を初期化(入力に従う)
for i in range(m):
ak,bk,ck = list(map(int,input().split()))
dist[ak-1][bk-1] =ck
dist[bk-1][ak-1] =ck
for a in r... | 27 | 30 | 668 | 646 | import itertools
inf = float("inf")
n, m, r = list(map(int, input().split()))
ra = list(map(int, input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
for i in range(m):
a, b, c = list(map(int, input().split()))
dist[a - 1][b - 1] = c
dist[b - 1][a - 1] = c
for a in range(n):
for b in ra... | inf = 10**15
import itertools
n, m, r = list(map(int, input().split()))
city = list(map(int, input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
# まず距離を初期化(入力に従う)
for i in range(m):
ak, bk, ck = list(map(int, input().split()))
dist[ak - 1][bk - 1] = ck
dist[bk - 1][ak - 1] = ck
for a in ra... | false | 10 | [
"+inf = 10**15",
"-inf = float(\"inf\")",
"-ra = list(map(int, input().split()))",
"+city = list(map(int, input().split()))",
"+# まず距離を初期化(入力に従う)",
"- a, b, c = list(map(int, input().split()))",
"- dist[a - 1][b - 1] = c",
"- dist[b - 1][a - 1] = c",
"+ ak, bk, ck = list(map(int, input()... | false | 0.03676 | 0.063664 | 0.577407 | [
"s947776983",
"s214740479"
] |
u941407962 | p02846 | python | s416986297 | s796503907 | 166 | 18 | 38,384 | 2,940 | Accepted | Accepted | 89.16 | t,T,a,A,b,B=list(map(int, open(0).read().split()))
x,y=(a-b)*t,(A-B)*T
if x+y==0:
r="infinity"
else:
s,t=divmod(-x, x+y)
r=0 if s<0 else s*2+(1 if t else 0)
print(r) | t,T,a,A,b,B=list(map(int, open(0).read().split()))
x,y=(b-a)*t,(A-B)*T
if y-x==0:
r="infinity"
else:
s,t=divmod(x,y-x)
r=max(0,s*2+(1 if t else 0))
print(r) | 8 | 8 | 169 | 160 | t, T, a, A, b, B = list(map(int, open(0).read().split()))
x, y = (a - b) * t, (A - B) * T
if x + y == 0:
r = "infinity"
else:
s, t = divmod(-x, x + y)
r = 0 if s < 0 else s * 2 + (1 if t else 0)
print(r)
| t, T, a, A, b, B = list(map(int, open(0).read().split()))
x, y = (b - a) * t, (A - B) * T
if y - x == 0:
r = "infinity"
else:
s, t = divmod(x, y - x)
r = max(0, s * 2 + (1 if t else 0))
print(r)
| false | 0 | [
"-x, y = (a - b) * t, (A - B) * T",
"-if x + y == 0:",
"+x, y = (b - a) * t, (A - B) * T",
"+if y - x == 0:",
"- s, t = divmod(-x, x + y)",
"- r = 0 if s < 0 else s * 2 + (1 if t else 0)",
"+ s, t = divmod(x, y - x)",
"+ r = max(0, s * 2 + (1 if t else 0))"
] | false | 0.046417 | 0.043173 | 1.075122 | [
"s416986297",
"s796503907"
] |
u644907318 | p02823 | python | s672526756 | s821255320 | 176 | 64 | 38,384 | 61,604 | Accepted | Accepted | 63.64 | N,A,B = list(map(int,input().split()))
if (max(A,B)-min(A,B))%2==0:
cnt = (max(A,B)-min(A,B))//2
else:
cnt1 = min(max(A,B)-1,N-min(A,B))
cnt2 = min(A,B)+(max(A,B)-min(A,B)-1)//2
cnt3 = N-max(A,B)+1+(max(A,B)-min(A,B)-1)//2
cnt = min(cnt1,cnt2,cnt3)
print(cnt) | N,A,B = list(map(int,input().split()))
if (B-A)%2==0:
print(((B-A)//2))
else:
if (A-1)<=(N-B):
print((A+(B-A-1)//2))
else:
print((N-B+1+(B-A-1)//2)) | 9 | 8 | 281 | 171 | N, A, B = list(map(int, input().split()))
if (max(A, B) - min(A, B)) % 2 == 0:
cnt = (max(A, B) - min(A, B)) // 2
else:
cnt1 = min(max(A, B) - 1, N - min(A, B))
cnt2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2
cnt3 = N - max(A, B) + 1 + (max(A, B) - min(A, B) - 1) // 2
cnt = min(cnt1, cnt2, cnt3)... | N, A, B = list(map(int, input().split()))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
if (A - 1) <= (N - B):
print((A + (B - A - 1) // 2))
else:
print((N - B + 1 + (B - A - 1) // 2))
| false | 11.111111 | [
"-if (max(A, B) - min(A, B)) % 2 == 0:",
"- cnt = (max(A, B) - min(A, B)) // 2",
"+if (B - A) % 2 == 0:",
"+ print(((B - A) // 2))",
"- cnt1 = min(max(A, B) - 1, N - min(A, B))",
"- cnt2 = min(A, B) + (max(A, B) - min(A, B) - 1) // 2",
"- cnt3 = N - max(A, B) + 1 + (max(A, B) - min(A, B) ... | false | 0.03575 | 0.067905 | 0.526468 | [
"s672526756",
"s821255320"
] |
u219197917 | p02599 | python | s423804200 | s578527518 | 1,798 | 1,563 | 239,132 | 220,712 | Accepted | Accepted | 13.07 | from operator import itemgetter
import sys
def read():
return sys.stdin.readline().rstrip()
def add(arr, i, x):
while i < len(arr):
arr[i] += x
i += i & -i
def range_sum(arr, a, b):
s = 0
i = b
while i > 0:
s += arr[i]
i -= i & -i
i = a -... | from operator import itemgetter
import sys
def read():
return sys.stdin.readline().rstrip()
def add(arr, i, x):
while i < len(arr):
arr[i] += x
i += i & -i
def range_sum(arr, a, b):
s = 0
i = b
while i > 0:
s += arr[i]
i -= i & -i
i = a -... | 53 | 57 | 1,126 | 1,217 | from operator import itemgetter
import sys
def read():
return sys.stdin.readline().rstrip()
def add(arr, i, x):
while i < len(arr):
arr[i] += x
i += i & -i
def range_sum(arr, a, b):
s = 0
i = b
while i > 0:
s += arr[i]
i -= i & -i
i = a - 1
while i > 0:
... | from operator import itemgetter
import sys
def read():
return sys.stdin.readline().rstrip()
def add(arr, i, x):
while i < len(arr):
arr[i] += x
i += i & -i
def range_sum(arr, a, b):
s = 0
i = b
while i > 0:
s += arr[i]
i -= i & -i
i = a - 1
while i > 0:
... | false | 7.017544 | [
"- queries = iter(",
"- sorted(",
"- [[i] + [int(j) for j in read().split()] for i in range(q)],",
"- key=itemgetter(2),",
"- )",
"- )",
"+ queries = [(0, 0, 0) for _ in range(q)]",
"+ for i in range(q):",
"+ l, r = map(int, read().split())",
... | false | 0.124654 | 0.037814 | 3.296507 | [
"s423804200",
"s578527518"
] |
u940102677 | p03088 | python | s606377952 | s961796154 | 49 | 43 | 3,064 | 3,064 | Accepted | Accepted | 12.24 | Mod = 10**9+7
p = ["XAGC", "XGAC", "XACG"] + ["AGCX", "GACX", "ACGX"] + ["AGXC", "AXGC"]
q = ["A", "G", "C", "T"]
f = []
for s in p:
for c in q:
f.append(s.replace("X",c))
r = ["AGC", "GAC", "ACG"]
d = {}
e = {}
for x in q:
for y in q:
for z in q:
s = x+y+z
if not s in r:
... | Mod = 10**9+7
f3 = ["AGC", "GAC", "ACG"]
f4 = ["AGAC","AGGC","AGCC","AGTC"] + ["AAGC","AGGC","ACGC","ATGC"]
q = ["A", "G", "C", "T"]
d = {}
e = {}
for x in q:
for y in q:
for z in q:
s = x+y+z
if not s in f3:
d[s] = 1
e[s] = 0
n = int(eval(input()))
for i in ran... | 33 | 28 | 613 | 554 | Mod = 10**9 + 7
p = ["XAGC", "XGAC", "XACG"] + ["AGCX", "GACX", "ACGX"] + ["AGXC", "AXGC"]
q = ["A", "G", "C", "T"]
f = []
for s in p:
for c in q:
f.append(s.replace("X", c))
r = ["AGC", "GAC", "ACG"]
d = {}
e = {}
for x in q:
for y in q:
for z in q:
s = x + y + z
if not ... | Mod = 10**9 + 7
f3 = ["AGC", "GAC", "ACG"]
f4 = ["AGAC", "AGGC", "AGCC", "AGTC"] + ["AAGC", "AGGC", "ACGC", "ATGC"]
q = ["A", "G", "C", "T"]
d = {}
e = {}
for x in q:
for y in q:
for z in q:
s = x + y + z
if not s in f3:
d[s] = 1
e[s] = 0
n = int(eval(... | false | 15.151515 | [
"-p = [\"XAGC\", \"XGAC\", \"XACG\"] + [\"AGCX\", \"GACX\", \"ACGX\"] + [\"AGXC\", \"AXGC\"]",
"+f3 = [\"AGC\", \"GAC\", \"ACG\"]",
"+f4 = [\"AGAC\", \"AGGC\", \"AGCC\", \"AGTC\"] + [\"AAGC\", \"AGGC\", \"ACGC\", \"ATGC\"]",
"-f = []",
"-for s in p:",
"- for c in q:",
"- f.append(s.replace(\"X... | false | 0.159412 | 0.083368 | 1.91216 | [
"s606377952",
"s961796154"
] |
u150984829 | p02258 | python | s717199971 | s199556549 | 120 | 100 | 5,636 | 5,636 | Accepted | Accepted | 16.67 | import sys
def m():
s=1e10;b=-s
eval(input())
for r in map(int,sys.stdin):
if b<r-s:b=r-s
if s>r:s=r
print(b)
if'__main__'==__name__:m()
| import sys
def m():
s=1e10;b=-s
eval(input())
for r in map(int,sys.stdin):
if b<r-s:b=r-s
if s>r:s=r
print(b)
m()
| 9 | 9 | 147 | 124 | import sys
def m():
s = 1e10
b = -s
eval(input())
for r in map(int, sys.stdin):
if b < r - s:
b = r - s
if s > r:
s = r
print(b)
if "__main__" == __name__:
m()
| import sys
def m():
s = 1e10
b = -s
eval(input())
for r in map(int, sys.stdin):
if b < r - s:
b = r - s
if s > r:
s = r
print(b)
m()
| false | 0 | [
"-if \"__main__\" == __name__:",
"- m()",
"+m()"
] | false | 0.035861 | 0.035963 | 0.997183 | [
"s717199971",
"s199556549"
] |
u334712262 | p03700 | python | s672540062 | s796173031 | 1,137 | 184 | 9,960 | 87,360 | Accepted | Accepted | 83.82 |
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
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, combinat... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with... | 116 | 108 | 2,050 | 2,158 | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
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_re... | # -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
combinations,
combinations_wit... | false | 6.896552 | [
"-import sys",
"-from pprint import pprint",
"+from fractions import Fraction",
"-from itertools import combinations, combinations_with_replacement, product, permutations",
"-from operator import add, mul",
"+from itertools import (",
"+ combinations,",
"+ combinations_with_replacement,",
"+ ... | false | 0.040343 | 0.036668 | 1.100217 | [
"s672540062",
"s796173031"
] |
u060793972 | p03607 | python | s724801751 | s089442158 | 218 | 75 | 15,076 | 18,144 | Accepted | Accepted | 65.6 | def ABC073C(d,i):
if i in d:
d[i]= not(d[i])
else:
d[i]=True
return d
n=int(eval(input()))
d=dict()
for i in range(n):
d = ABC073C(d,int(eval(input())))
print((sum(d.values()))) | def ABC073C(d,i):
if i in d:
d[i]= not(d[i])
else:
d[i]=True
return d
n,*a=list(map(int,open(0).read().split()))
d=dict()
for i in a:
d = ABC073C(d,i)
print((sum(d.values()))) | 12 | 12 | 207 | 211 | def ABC073C(d, i):
if i in d:
d[i] = not (d[i])
else:
d[i] = True
return d
n = int(eval(input()))
d = dict()
for i in range(n):
d = ABC073C(d, int(eval(input())))
print((sum(d.values())))
| def ABC073C(d, i):
if i in d:
d[i] = not (d[i])
else:
d[i] = True
return d
n, *a = list(map(int, open(0).read().split()))
d = dict()
for i in a:
d = ABC073C(d, i)
print((sum(d.values())))
| false | 0 | [
"-n = int(eval(input()))",
"+n, *a = list(map(int, open(0).read().split()))",
"-for i in range(n):",
"- d = ABC073C(d, int(eval(input())))",
"+for i in a:",
"+ d = ABC073C(d, i)"
] | false | 0.035945 | 0.091777 | 0.391659 | [
"s724801751",
"s089442158"
] |
u060455496 | p03164 | python | s439062586 | s859314415 | 1,320 | 1,205 | 340,024 | 326,836 | Accepted | Accepted | 8.71 | N,W =list(map(int,input().split()))
weight,value=[],[]
for i in range(N):
w,v = list(map(int,input().split()))
weight.append(w)
value.append(v)
inf = float('inf')
dp = [[inf for _ in range(10**3*N+10)] for _ in range(N+10)]
maxv = sum(value)
#初期化
dp[0][0] =0
for i in range(N):
for sum_v in r... | N,maxW = list(map(int,input().split()))
w,v = [],[]
for i in range(N):
weight,value = list(map(int,input().split()))
w.append(weight)
v.append(value)
maxV=sum(v)
inf = float('inf')
dp = [[inf for _ in range(maxV+1)] for _ in range(N+1)]
dp[0][0] =0
for i in range(N):
for sum_v in range(maxV+1... | 21 | 20 | 597 | 561 | N, W = list(map(int, input().split()))
weight, value = [], []
for i in range(N):
w, v = list(map(int, input().split()))
weight.append(w)
value.append(v)
inf = float("inf")
dp = [[inf for _ in range(10**3 * N + 10)] for _ in range(N + 10)]
maxv = sum(value)
# 初期化
dp[0][0] = 0
for i in range(N):
for sum_v... | N, maxW = list(map(int, input().split()))
w, v = [], []
for i in range(N):
weight, value = list(map(int, input().split()))
w.append(weight)
v.append(value)
maxV = sum(v)
inf = float("inf")
dp = [[inf for _ in range(maxV + 1)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
for sum_v in range(maxV... | false | 4.761905 | [
"-N, W = list(map(int, input().split()))",
"-weight, value = [], []",
"+N, maxW = list(map(int, input().split()))",
"+w, v = [], []",
"- w, v = list(map(int, input().split()))",
"- weight.append(w)",
"- value.append(v)",
"+ weight, value = list(map(int, input().split()))",
"+ w.append... | false | 0.039945 | 0.036086 | 1.106934 | [
"s439062586",
"s859314415"
] |
u794173881 | p02925 | python | s516698370 | s069490656 | 1,862 | 758 | 55,768 | 92,508 | Accepted | Accepted | 59.29 | import time
s_time = time.time()
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
memo = {}
for i in range(n):
memo[i] = 0
cnt = 0
while True:
visited = [False] * n
flag = False
for i in range(n):
if memo[i] == len(a[0]):
continue
... | import sys
sys.setrecursionlimit(2000000)
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
for j in range(len(a[0])):
a[i][j] -= 1
visited = [[-1] *(len(a[0])) for i in range(n)]
memo = [[-1] * (n) for i in range(n)]
for i in range(n):
f... | 39 | 48 | 914 | 1,274 | import time
s_time = time.time()
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
memo = {}
for i in range(n):
memo[i] = 0
cnt = 0
while True:
visited = [False] * n
flag = False
for i in range(n):
if memo[i] == len(a[0]):
continue
if visited[i] ... | import sys
sys.setrecursionlimit(2000000)
n = int(eval(input()))
a = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
for j in range(len(a[0])):
a[i][j] -= 1
visited = [[-1] * (len(a[0])) for i in range(n)]
memo = [[-1] * (n) for i in range(n)]
for i in range(n):
for j in range(le... | false | 18.75 | [
"-import time",
"+import sys",
"-s_time = time.time()",
"+sys.setrecursionlimit(2000000)",
"-memo = {}",
"- memo[i] = 0",
"-cnt = 0",
"-while True:",
"- visited = [False] * n",
"- flag = False",
"- for i in range(n):",
"- if memo[i] == len(a[0]):",
"- continue",... | false | 0.034644 | 0.039177 | 0.884311 | [
"s516698370",
"s069490656"
] |
u562935282 | p02757 | python | s681168789 | s331258348 | 130 | 117 | 5,096 | 5,096 | Accepted | Accepted | 10 | def main():
N, P = list(map(int, input().split()))
S = [int(c) for c in eval(input())]
ret = 0
if P in {2, 5}:
for i, x in enumerate(S, 1):
if x % P == 0:
ret += i
print(ret)
return
else:
curr_num = 0
counter = [0] *... | # 参考にさせていただいたもの
# https://atcoder.jp/contests/abc158/submissions/10620169
# mulをpow(10,桁数,P)ではなく、ループ中に10倍ずつする方法
# counterに収められたある剰余をとる集合の大きさからnC2でペア数を求める方法
def main():
N, P = list(map(int, input().split()))
S = [int(c) for c in eval(input())]
ret = 0
if P in {2, 5}:
for i, x in enum... | 28 | 37 | 634 | 878 | def main():
N, P = list(map(int, input().split()))
S = [int(c) for c in eval(input())]
ret = 0
if P in {2, 5}:
for i, x in enumerate(S, 1):
if x % P == 0:
ret += i
print(ret)
return
else:
curr_num = 0
counter = [0] * P
count... | # 参考にさせていただいたもの
# https://atcoder.jp/contests/abc158/submissions/10620169
# mulをpow(10,桁数,P)ではなく、ループ中に10倍ずつする方法
# counterに収められたある剰余をとる集合の大きさからnC2でペア数を求める方法
def main():
N, P = list(map(int, input().split()))
S = [int(c) for c in eval(input())]
ret = 0
if P in {2, 5}:
for i, x in enumerate(S, 1):
... | false | 24.324324 | [
"+# 参考にさせていただいたもの",
"+# https://atcoder.jp/contests/abc158/submissions/10620169",
"+# mulをpow(10,桁数,P)ではなく、ループ中に10倍ずつする方法",
"+# counterに収められたある剰余をとる集合の大きさからnC2でペア数を求める方法",
"- ret += counter[curr_num]",
"+",
"+ def choose_2(x):",
"+ return x * (x - 1) // 2",
"+",
"+ ... | false | 0.054883 | 0.039299 | 1.396572 | [
"s681168789",
"s331258348"
] |
u125545880 | p03546 | python | s918651840 | s913637830 | 43 | 33 | 3,700 | 3,700 | Accepted | Accepted | 23.26 | import sys
import collections
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
def dfs(n, used, cost):
global c, mincost
for i in range(10):
if i == 1:
if cost + c[n][i] < mincost:
mincost = cost + c[n][i]
continue
if i not in ... | import sys
import collections
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
def main():
H, W = list(map(int, readline().split()))
c = []
for _ in range(10):
c.append(list(map(int, readline().split())))
wall = []
wallcount = collections.Counter([])
for _ in r... | 41 | 35 | 1,076 | 844 | import sys
import collections
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
def dfs(n, used, cost):
global c, mincost
for i in range(10):
if i == 1:
if cost + c[n][i] < mincost:
mincost = cost + c[n][i]
continue
if i not in used and cos... | import sys
import collections
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
def main():
H, W = list(map(int, readline().split()))
c = []
for _ in range(10):
c.append(list(map(int, readline().split())))
wall = []
wallcount = collections.Counter([])
for _ in range(H):
... | false | 14.634146 | [
"-def dfs(n, used, cost):",
"- global c, mincost",
"- for i in range(10):",
"- if i == 1:",
"- if cost + c[n][i] < mincost:",
"- mincost = cost + c[n][i]",
"- continue",
"- if i not in used and cost < mincost:",
"- dfs(i, used +... | false | 0.043212 | 0.043341 | 0.997015 | [
"s918651840",
"s913637830"
] |
u936985471 | p03048 | python | s124444232 | s539069802 | 21 | 19 | 3,060 | 3,060 | Accepted | Accepted | 9.52 | R,G,B,N=list(map(int,input().split()))
dp=[0]*(N+1)
dp[0]=1
for C in (R,G,B):
for i in range(len(dp)-C):
if dp[i]!=-1:
dp[i+C]=dp[i]+dp[i+C]
print((dp[N]))
| R,G,B,N=list(map(int,input().split()))
dp=[0]*(N+1)
dp[0]=1
for C in (R,G,B):
for i in range(len(dp)-C):
dp[i+C]=dp[i]+dp[i+C]
print((dp[N]))
| 8 | 7 | 169 | 146 | R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for C in (R, G, B):
for i in range(len(dp) - C):
if dp[i] != -1:
dp[i + C] = dp[i] + dp[i + C]
print((dp[N]))
| R, G, B, N = list(map(int, input().split()))
dp = [0] * (N + 1)
dp[0] = 1
for C in (R, G, B):
for i in range(len(dp) - C):
dp[i + C] = dp[i] + dp[i + C]
print((dp[N]))
| false | 12.5 | [
"- if dp[i] != -1:",
"- dp[i + C] = dp[i] + dp[i + C]",
"+ dp[i + C] = dp[i] + dp[i + C]"
] | false | 0.122539 | 0.098294 | 1.246653 | [
"s124444232",
"s539069802"
] |
u852690916 | p02762 | python | s261235182 | s911704936 | 1,109 | 1,010 | 13,420 | 13,416 | Accepted | Accepted | 8.93 | def main():
N, M, K=list(map(int, input().split()))
friend_or_block = [0] * N
friends_chain = UnionFindTree(N)
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
friends_chain.unite(a, b)
friend_or_block[a] += 1
friend_or_block[b]... | def main():
N, M, K=list(map(int, input().split()))
friend_or_block = [0] * N
parent = [-1] * N
def root(x):
p, s = parent[x], list()
while p >= 0:
s.append(x)
x, p = p, parent[p]
for c in s: parent[c] = x
return x
def same(x, y)... | 47 | 43 | 1,306 | 1,071 | def main():
N, M, K = list(map(int, input().split()))
friend_or_block = [0] * N
friends_chain = UnionFindTree(N)
for _ in range(M):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
friends_chain.unite(a, b)
friend_or_block[a] += 1
friend_or_block[b] += 1... | def main():
N, M, K = list(map(int, input().split()))
friend_or_block = [0] * N
parent = [-1] * N
def root(x):
p, s = parent[x], list()
while p >= 0:
s.append(x)
x, p = p, parent[p]
for c in s:
parent[c] = x
return x
def same(x, y... | false | 8.510638 | [
"- friends_chain = UnionFindTree(N)",
"+ parent = [-1] * N",
"+",
"+ def root(x):",
"+ p, s = parent[x], list()",
"+ while p >= 0:",
"+ s.append(x)",
"+ x, p = p, parent[p]",
"+ for c in s:",
"+ parent[c] = x",
"+ return x",
... | false | 0.041766 | 0.043824 | 0.953043 | [
"s261235182",
"s911704936"
] |
u562935282 | p03379 | python | s031080338 | s650487765 | 324 | 290 | 26,772 | 26,180 | Accepted | Accepted | 10.49 | n = int(eval(input()))
x = list(map(int, input().split()))
x_sorted = sorted(x)
mL = (n - 1) // 2
mR = mL + 1
anss = []
for i in range(n):
if x[i] <= x_sorted[mL]:
anss.append(x_sorted[mR])
else:
anss.append(x_sorted[mL])
for ans in anss:
print(ans) | def main():
N = int(eval(input()))
*a, = list(map(int, input().split()))
*b, = sorted(a)
h = N // 2
L = b[h - 1]
R = b[h]
for x in a:
if x <= L:
print(R)
else:
print(L)
if __name__ == '__main__':
main()
| 16 | 19 | 289 | 286 | n = int(eval(input()))
x = list(map(int, input().split()))
x_sorted = sorted(x)
mL = (n - 1) // 2
mR = mL + 1
anss = []
for i in range(n):
if x[i] <= x_sorted[mL]:
anss.append(x_sorted[mR])
else:
anss.append(x_sorted[mL])
for ans in anss:
print(ans)
| def main():
N = int(eval(input()))
(*a,) = list(map(int, input().split()))
(*b,) = sorted(a)
h = N // 2
L = b[h - 1]
R = b[h]
for x in a:
if x <= L:
print(R)
else:
print(L)
if __name__ == "__main__":
main()
| false | 15.789474 | [
"-n = int(eval(input()))",
"-x = list(map(int, input().split()))",
"-x_sorted = sorted(x)",
"-mL = (n - 1) // 2",
"-mR = mL + 1",
"-anss = []",
"-for i in range(n):",
"- if x[i] <= x_sorted[mL]:",
"- anss.append(x_sorted[mR])",
"- else:",
"- anss.append(x_sorted[mL])",
"-fo... | false | 0.084745 | 0.086361 | 0.981284 | [
"s031080338",
"s650487765"
] |
u317779196 | p02707 | python | s251069269 | s819363342 | 199 | 149 | 35,464 | 32,148 | Accepted | Accepted | 25.13 | import collections
n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
c = collections.Counter(a)
l = [0]*n
for i,x in list(c.items()):
l[i-1] = x
for i in l:
print(i) | n = int(eval(input()))
a = [int(i) for i in input().split()]
l = [0]*(n+1)
for i in a:
l[i] += 1
for i in l[1:]:
print(i) | 11 | 8 | 196 | 131 | import collections
n = int(eval(input()))
a = [int(i) for i in input().split()]
a.sort()
c = collections.Counter(a)
l = [0] * n
for i, x in list(c.items()):
l[i - 1] = x
for i in l:
print(i)
| n = int(eval(input()))
a = [int(i) for i in input().split()]
l = [0] * (n + 1)
for i in a:
l[i] += 1
for i in l[1:]:
print(i)
| false | 27.272727 | [
"-import collections",
"-",
"-a.sort()",
"-c = collections.Counter(a)",
"-l = [0] * n",
"-for i, x in list(c.items()):",
"- l[i - 1] = x",
"-for i in l:",
"+l = [0] * (n + 1)",
"+for i in a:",
"+ l[i] += 1",
"+for i in l[1:]:"
] | false | 0.041917 | 0.03734 | 1.122576 | [
"s251069269",
"s819363342"
] |
u133936772 | p03425 | python | s768530748 | s766116363 | 217 | 148 | 3,316 | 3,864 | Accepted | Accepted | 31.8 | from collections import *
d=Counter()
for _ in range(int(eval(input()))): d[input()[0]]+=1
import itertools as it
print((sum(d[s]*d[t]*d[r] for s,t,r in it.combinations('MARCH',3)))) | l=[input()[0] for _ in range(int(eval(input())))]
import itertools as it
print((sum(x*y*z for x,y,z in it.combinations([l.count(c) for c in 'MARCH'],3)))) | 5 | 3 | 178 | 148 | from collections import *
d = Counter()
for _ in range(int(eval(input()))):
d[input()[0]] += 1
import itertools as it
print((sum(d[s] * d[t] * d[r] for s, t, r in it.combinations("MARCH", 3))))
| l = [input()[0] for _ in range(int(eval(input())))]
import itertools as it
print((sum(x * y * z for x, y, z in it.combinations([l.count(c) for c in "MARCH"], 3))))
| false | 40 | [
"-from collections import *",
"-",
"-d = Counter()",
"-for _ in range(int(eval(input()))):",
"- d[input()[0]] += 1",
"+l = [input()[0] for _ in range(int(eval(input())))]",
"-print((sum(d[s] * d[t] * d[r] for s, t, r in it.combinations(\"MARCH\", 3))))",
"+print((sum(x * y * z for x, y, z in it.com... | false | 0.036044 | 0.037999 | 0.948537 | [
"s768530748",
"s766116363"
] |
u037430802 | p03700 | python | s923529210 | s758415044 | 1,258 | 1,075 | 7,472 | 50,648 | Accepted | Accepted | 14.55 |
import math
n,a,b = list(map(int, input().split()))
m = [0] * n
for i in range(n):
m[i] = int(eval(input()))
m.sort()
def enough(m,a,b,T):
cnt = 0
for hp in m:
if hp > b*T:
cnt += int(math.ceil((hp - b*T)/(a-b)))
return True if cnt <= T else False
r = 10**10
#r = ... | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)
high = math.ceil(H[0] / B)
low = 0
while high > low+1:
mid = (high+low) // 2
cnt = 0
for i in range(N):
if H[i] - mid*B > 0:
# 残りを減らすのに必要な回数を計上
... | 35 | 25 | 493 | 515 | import math
n, a, b = list(map(int, input().split()))
m = [0] * n
for i in range(n):
m[i] = int(eval(input()))
m.sort()
def enough(m, a, b, T):
cnt = 0
for hp in m:
if hp > b * T:
cnt += int(math.ceil((hp - b * T) / (a - b)))
return True if cnt <= T else False
r = 10**10
# r = 3... | import math
N, A, B = list(map(int, input().split()))
H = [int(eval(input())) for _ in range(N)]
H.sort(reverse=True)
high = math.ceil(H[0] / B)
low = 0
while high > low + 1:
mid = (high + low) // 2
cnt = 0
for i in range(N):
if H[i] - mid * B > 0:
# 残りを減らすのに必要な回数を計上
cnt += ... | false | 28.571429 | [
"-n, a, b = list(map(int, input().split()))",
"-m = [0] * n",
"-for i in range(n):",
"- m[i] = int(eval(input()))",
"-m.sort()",
"-",
"-",
"-def enough(m, a, b, T):",
"+N, A, B = list(map(int, input().split()))",
"+H = [int(eval(input())) for _ in range(N)]",
"+H.sort(reverse=True)",
"+high... | false | 0.048814 | 0.048848 | 0.999305 | [
"s923529210",
"s758415044"
] |
u458388104 | p02802 | python | s384036049 | s284424558 | 587 | 264 | 56,408 | 51,956 | Accepted | Accepted | 55.03 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def resolve():
n, m = list(map(int, input().split()))
first_ac_dic = {}
wa_count_dic = {}
wa_num = 0
for i in range(m):
p, s = input().split()
p = int(p)
if s == "AC":
if p in first_ac_dic:
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline()
def resolve():
n, m = list(map(int, input().split()))
first_ac_dic = {}
wa_count_dic = {}
wa_num = 0
for i in range(m):
p, s = input().split()
p = int(p)
... | 30 | 35 | 616 | 679 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def resolve():
n, m = list(map(int, input().split()))
first_ac_dic = {}
wa_count_dic = {}
wa_num = 0
for i in range(m):
p, s = input().split()
p = int(p)
if s == "AC":
if p in first_ac_dic:
pass
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline()
def resolve():
n, m = list(map(int, input().split()))
first_ac_dic = {}
wa_count_dic = {}
wa_num = 0
for i in range(m):
p, s = input().split()
p = int(p)
if s == "AC":
... | false | 14.285714 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()",
"+",
"+"
] | false | 0.06999 | 0.078317 | 0.893672 | [
"s384036049",
"s284424558"
] |
u723792785 | p02642 | python | s599357698 | s279226377 | 1,256 | 302 | 149,272 | 176,072 | Accepted | Accepted | 75.96 | from collections import Counter
h = int(eval(input()))
if h == 1:
print((1))
exit()
a = list(map(int,input().split()))
t = Counter(a)
b = []
for i, j in t.most_common():
if j == 1:
b.append(i)
bset = set(a)
def sieve(n):
ret = []
divlis = [-1]*(n+1) # 何で割ったかのリスト(初期値は-1)
flag = [True]*(n+1)
... | from collections import Counter
n = int(eval(input()))
a = list(map(int,input().split()))
b = []
for i, j in Counter(a).most_common():
if j == 1:
b.append(i)
aset = set(a)
dp = [0 for _ in range(10**6+1)]
for i in list(aset):
for j in range(i*2, 10**6+1, i):
dp[j] += 1
ans = 0
for i in b:
if dp... | 81 | 19 | 1,428 | 347 | from collections import Counter
h = int(eval(input()))
if h == 1:
print((1))
exit()
a = list(map(int, input().split()))
t = Counter(a)
b = []
for i, j in t.most_common():
if j == 1:
b.append(i)
bset = set(a)
def sieve(n):
ret = []
divlis = [-1] * (n + 1) # 何で割ったかのリスト(初期値は-1)
flag = [... | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for i, j in Counter(a).most_common():
if j == 1:
b.append(i)
aset = set(a)
dp = [0 for _ in range(10**6 + 1)]
for i in list(aset):
for j in range(i * 2, 10**6 + 1, i):
dp[j] += 1
ans = 0
for i in b... | false | 76.54321 | [
"-h = int(eval(input()))",
"-if h == 1:",
"- print((1))",
"- exit()",
"+n = int(eval(input()))",
"-t = Counter(a)",
"-for i, j in t.most_common():",
"+for i, j in Counter(a).most_common():",
"-bset = set(a)",
"-",
"-",
"-def sieve(n):",
"- ret = []",
"- divlis = [-1] * (n + 1) ... | false | 0.065225 | 0.243201 | 0.268193 | [
"s599357698",
"s279226377"
] |
u883621917 | p03160 | python | s356441333 | s313932461 | 705 | 250 | 124,448 | 55,120 | Accepted | Accepted | 64.54 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 10
n = int(eval(input()))
# 貰うDPだと0へのアクセスが、配るDPだとn+1へのアクセスが必要になる
h = [INF] + list(map(int, input().split())) + [INF]
dp = [INF] + [INF] * n + [INF]
dp[1] = 0
def chmin(dp_table, index, value):
if dp_table[index] > value... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
n = int(eval(input()))
h = [INF] + list(map(int, input().split())) + [INF]
dp = [INF] + [INF] * n + [INF]
dp[1] = 0
for i in range(1, n):
dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1] - h[i]))
dp[i+2] = min(dp[i+2], ... | 37 | 16 | 812 | 358 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**10
n = int(eval(input()))
# 貰うDPだと0へのアクセスが、配るDPだとn+1へのアクセスが必要になる
h = [INF] + list(map(int, input().split())) + [INF]
dp = [INF] + [INF] * n + [INF]
dp[1] = 0
def chmin(dp_table, index, value):
if dp_table[index] > value:
dp_tabl... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**20
n = int(eval(input()))
h = [INF] + list(map(int, input().split())) + [INF]
dp = [INF] + [INF] * n + [INF]
dp[1] = 0
for i in range(1, n):
dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]))
dp[i + 2] = min(dp[i + 2], dp[i] + a... | false | 56.756757 | [
"-INF = 10**10",
"+INF = 10**20",
"-# 貰うDPだと0へのアクセスが、配るDPだとn+1へのアクセスが必要になる",
"-",
"-",
"-def chmin(dp_table, index, value):",
"- if dp_table[index] > value:",
"- dp_table[index] = value",
"-",
"-",
"-# 再帰(DFS) (メモ化あり: テーブル使用)",
"-def dfs(i):",
"- if i == 0:",
"- return ... | false | 0.037509 | 0.053138 | 0.705893 | [
"s356441333",
"s313932461"
] |
u638282348 | p03485 | python | s863132114 | s429837630 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
x_rounded_up = int((a + b)/2) + ((a + b)%2)
print(x_rounded_up)
| [print(math.ceil(eval(input().replace(" ", "+")) / 2)) for math in [__import__("math")]]
| 4 | 1 | 101 | 88 | a, b = list(map(int, input().split()))
x_rounded_up = int((a + b) / 2) + ((a + b) % 2)
print(x_rounded_up)
| [print(math.ceil(eval(input().replace(" ", "+")) / 2)) for math in [__import__("math")]]
| false | 75 | [
"-a, b = list(map(int, input().split()))",
"-x_rounded_up = int((a + b) / 2) + ((a + b) % 2)",
"-print(x_rounded_up)",
"+[print(math.ceil(eval(input().replace(\" \", \"+\")) / 2)) for math in [__import__(\"math\")]]"
] | false | 0.042775 | 0.042514 | 1.006143 | [
"s863132114",
"s429837630"
] |
u432780056 | p03673 | python | s707111218 | s276746084 | 80 | 40 | 20,968 | 20,724 | Accepted | Accepted | 50 | from collections import deque
n, l, b = eval(input()), input().split(), deque()
for t in range(n):
b.append(l[t]) if (t + 1) % 2 else b.appendleft(l[t])
print(' '.join(reversed(b)) if n % 2 else ' '.join(b)) | n, l = eval(input()), input().split()
print(' '.join(l[0::2][::-1] + l[1::2]) if len(l) % 2 else ' '.join(l[1::2][::-1] + l[0::2])) | 5 | 2 | 213 | 129 | from collections import deque
n, l, b = eval(input()), input().split(), deque()
for t in range(n):
b.append(l[t]) if (t + 1) % 2 else b.appendleft(l[t])
print(" ".join(reversed(b)) if n % 2 else " ".join(b))
| n, l = eval(input()), input().split()
print(
" ".join(l[0::2][::-1] + l[1::2])
if len(l) % 2
else " ".join(l[1::2][::-1] + l[0::2])
)
| false | 60 | [
"-from collections import deque",
"-",
"-n, l, b = eval(input()), input().split(), deque()",
"-for t in range(n):",
"- b.append(l[t]) if (t + 1) % 2 else b.appendleft(l[t])",
"-print(\" \".join(reversed(b)) if n % 2 else \" \".join(b))",
"+n, l = eval(input()), input().split()",
"+print(",
"+ ... | false | 0.046491 | 0.082184 | 0.565697 | [
"s707111218",
"s276746084"
] |
u953110527 | p03477 | python | s628382811 | s262712443 | 163 | 65 | 38,256 | 61,544 | Accepted | Accepted | 60.12 | a,b,c,d = list(map(int,input().split()))
if a + b > c + d:
print("Left")
elif a + b < c + d:
print("Right")
else:
print("Balanced") | a,b,c,d = list(map(int,input().split()))
e = a+b
f = c+d
if e < f:
print("Right")
elif e > f:
print("Left")
else:
print("Balanced") | 7 | 9 | 143 | 145 | a, b, c, d = list(map(int, input().split()))
if a + b > c + d:
print("Left")
elif a + b < c + d:
print("Right")
else:
print("Balanced")
| a, b, c, d = list(map(int, input().split()))
e = a + b
f = c + d
if e < f:
print("Right")
elif e > f:
print("Left")
else:
print("Balanced")
| false | 22.222222 | [
"-if a + b > c + d:",
"+e = a + b",
"+f = c + d",
"+if e < f:",
"+ print(\"Right\")",
"+elif e > f:",
"-elif a + b < c + d:",
"- print(\"Right\")"
] | false | 0.045517 | 0.037972 | 1.198704 | [
"s628382811",
"s262712443"
] |
u729972685 | p03166 | python | s563513477 | s788452871 | 932 | 854 | 118,092 | 123,056 | Accepted | Accepted | 8.37 | from sys import stdin, setrecursionlimit
# input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = [[] for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
dp = [-1] * (N + 1)
... | from sys import stdin, setrecursionlimit
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = [[] for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
dp = [-1] * (N + 1)
de... | 25 | 25 | 546 | 544 | from sys import stdin, setrecursionlimit
# input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = [[] for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
dp = [-1] * (N + 1)
def lp(x: "int... | from sys import stdin, setrecursionlimit
input = stdin.readline
setrecursionlimit(200000)
N, M = list(map(int, input().split()))
# d = [0] * (N + 1)
adj = [[] for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
adj[x].append(y)
# d[y] += 1
dp = [-1] * (N + 1)
def lp(x: "int")... | false | 0 | [
"-# input = stdin.readline",
"+input = stdin.readline"
] | false | 0.068252 | 0.03682 | 1.853667 | [
"s563513477",
"s788452871"
] |
u129836004 | p03355 | python | s299590080 | s796493608 | 91 | 35 | 3,064 | 4,592 | Accepted | Accepted | 61.54 | s = eval(input())
K = int(eval(input()))
head = [h for h in s]
head = set(head)
head = list(head)
head.sort()
cnt = 0
ans = []
idx = 0
while cnt < K:
for i in range(len(s)):
if s[i] == head[idx]:
for k in range(i+1, min(len(s)+1, i+6)):
ans.append(s[i:k])
... | s = eval(input())
ans = set()
k = int(eval(input()))
for i in range(len(s)):
for j in range(1, k+1):
ans.add(s[i:i+j])
print((sorted(list(ans))[k-1])) | 24 | 7 | 449 | 154 | s = eval(input())
K = int(eval(input()))
head = [h for h in s]
head = set(head)
head = list(head)
head.sort()
cnt = 0
ans = []
idx = 0
while cnt < K:
for i in range(len(s)):
if s[i] == head[idx]:
for k in range(i + 1, min(len(s) + 1, i + 6)):
ans.append(s[i:k])
ans = set(... | s = eval(input())
ans = set()
k = int(eval(input()))
for i in range(len(s)):
for j in range(1, k + 1):
ans.add(s[i : i + j])
print((sorted(list(ans))[k - 1]))
| false | 70.833333 | [
"-K = int(eval(input()))",
"-head = [h for h in s]",
"-head = set(head)",
"-head = list(head)",
"-head.sort()",
"-cnt = 0",
"-ans = []",
"-idx = 0",
"-while cnt < K:",
"- for i in range(len(s)):",
"- if s[i] == head[idx]:",
"- for k in range(i + 1, min(len(s) + 1, i + 6)):... | false | 0.097964 | 0.180393 | 0.543062 | [
"s299590080",
"s796493608"
] |
u068692021 | p02888 | python | s225856873 | s302380087 | 1,453 | 1,272 | 3,188 | 3,188 | Accepted | Accepted | 12.46 | import bisect
N=int(eval(input()))
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
for j in range(i+1,N-1):
# ans+=bisect.bisect_left(L,L[i]+L[j])-j-1
ans+=bisect.bisect_left(L,L[i]+L[j],j)-j-1
print(ans) | import bisect
N=int(eval(input()))
L=sorted(list(map(int,input().split())))
ans=0
for i in range(N-2):
for j in range(i+1,N-1):
ans+=bisect.bisect_left(L,L[i]+L[j])-j-1 # Code 1
# ans+=bisect.bisect_left(L,L[i]+L[j],j)-j-1 # Code 2
print(ans) | 10 | 10 | 238 | 258 | import bisect
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
# ans+=bisect.bisect_left(L,L[i]+L[j])-j-1
ans += bisect.bisect_left(L, L[i] + L[j], j) - j - 1
print(ans)
| import bisect
N = int(eval(input()))
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N - 2):
for j in range(i + 1, N - 1):
ans += bisect.bisect_left(L, L[i] + L[j]) - j - 1 # Code 1
# ans+=bisect.bisect_left(L,L[i]+L[j],j)-j-1 # Code 2
print(ans)
| false | 0 | [
"- # ans+=bisect.bisect_left(L,L[i]+L[j])-j-1",
"- ans += bisect.bisect_left(L, L[i] + L[j], j) - j - 1",
"+ ans += bisect.bisect_left(L, L[i] + L[j]) - j - 1 # Code 1",
"+ # ans+=bisect.bisect_left(L,L[i]+L[j],j)-j-1 # Code 2"
] | false | 0.041481 | 0.042149 | 0.98414 | [
"s225856873",
"s302380087"
] |
u729133443 | p03254 | python | s343157360 | s603064936 | 170 | 17 | 38,716 | 2,940 | Accepted | Accepted | 90 | n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
if sum(a)<x:
a.sort(reverse=True)
else:
a.sort()
c=0
for t in a:
x-=t
if x<0:break
c+=1
if x>0:
print((c-1))
else:
print(c) | n,x,*a=list(map(int,open(0).read().split()))
a.sort()
if sum(a)<x:a=a[::-1]
c=0
for t in a:
x-=t
if x<0:break
c+=1
print((c-(x>0))) | 15 | 9 | 225 | 137 | n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if sum(a) < x:
a.sort(reverse=True)
else:
a.sort()
c = 0
for t in a:
x -= t
if x < 0:
break
c += 1
if x > 0:
print((c - 1))
else:
print(c)
| n, x, *a = list(map(int, open(0).read().split()))
a.sort()
if sum(a) < x:
a = a[::-1]
c = 0
for t in a:
x -= t
if x < 0:
break
c += 1
print((c - (x > 0)))
| false | 40 | [
"-n, x = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"+n, x, *a = list(map(int, open(0).read().split()))",
"+a.sort()",
"- a.sort(reverse=True)",
"-else:",
"- a.sort()",
"+ a = a[::-1]",
"-if x > 0:",
"- print((c - 1))",
"-else:",
"- print(c)",
"+... | false | 0.047507 | 0.100968 | 0.470513 | [
"s343157360",
"s603064936"
] |
u033606236 | p03659 | python | s393022920 | s675895657 | 200 | 171 | 23,800 | 24,832 | Accepted | Accepted | 14.5 | n = int(eval(input()))
a = list(map(int,input().split()))
b = sum(a)
c = 0
ans = float("Inf")
for i in range(n-1):
c += a[i]
b -= a[i]
ans = min(ans,abs(b-c))
print(ans) | n = int(eval(input()))
a = list(map(int,input().split()))
b = sum(a)
c = 0
ans = float("Inf")
for i in range(n-1):
c += a[i]
ans = min(ans,abs(b-2*c))
print(ans) | 10 | 9 | 184 | 171 | n = int(eval(input()))
a = list(map(int, input().split()))
b = sum(a)
c = 0
ans = float("Inf")
for i in range(n - 1):
c += a[i]
b -= a[i]
ans = min(ans, abs(b - c))
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
b = sum(a)
c = 0
ans = float("Inf")
for i in range(n - 1):
c += a[i]
ans = min(ans, abs(b - 2 * c))
print(ans)
| false | 10 | [
"- b -= a[i]",
"- ans = min(ans, abs(b - c))",
"+ ans = min(ans, abs(b - 2 * c))"
] | false | 0.04599 | 0.063673 | 0.722282 | [
"s393022920",
"s675895657"
] |
u994988729 | p03147 | python | s910159759 | s807391212 | 269 | 21 | 18,200 | 3,064 | Accepted | Accepted | 92.19 | import numpy as np
def RunLengthEncoding(S):
res = []
N = len(S)
i = 0
while i < N:
cnt = 1
while i < N - 1 and S[i] == S[i + 1]:
cnt += 1
i += 1
res.append(S[i])
i += 1
return res
N = int(eval(input()))
A = np.array(input... | N = int(eval(input()))
H = [0] + list(map(int, input().split())) + [0]
ans = 0
while any(H):
water = min(h for h in H if h)
cnt = 0
bl = 0
for x, y in zip(H[:-1], H[1:]):
if x < y and x == 0:
bl = 1
elif x > y and y == 0 and bl:
cnt += 1
... | 29 | 20 | 516 | 400 | import numpy as np
def RunLengthEncoding(S):
res = []
N = len(S)
i = 0
while i < N:
cnt = 1
while i < N - 1 and S[i] == S[i + 1]:
cnt += 1
i += 1
res.append(S[i])
i += 1
return res
N = int(eval(input()))
A = np.array(input().split(), dtype=... | N = int(eval(input()))
H = [0] + list(map(int, input().split())) + [0]
ans = 0
while any(H):
water = min(h for h in H if h)
cnt = 0
bl = 0
for x, y in zip(H[:-1], H[1:]):
if x < y and x == 0:
bl = 1
elif x > y and y == 0 and bl:
cnt += 1
bl = 0
ans... | false | 31.034483 | [
"-import numpy as np",
"-",
"-",
"-def RunLengthEncoding(S):",
"- res = []",
"- N = len(S)",
"- i = 0",
"- while i < N:",
"- cnt = 1",
"- while i < N - 1 and S[i] == S[i + 1]:",
"+N = int(eval(input()))",
"+H = [0] + list(map(int, input().split())) + [0]",
"+ans = 0... | false | 0.460153 | 0.055131 | 8.346502 | [
"s910159759",
"s807391212"
] |
u793868662 | p03730 | python | s529663267 | s548813264 | 185 | 26 | 38,384 | 9,112 | Accepted | Accepted | 85.95 | def resolve():
a, b, c = list(map(int, input().split()))
a %= b
for i in range(b):
if a*i %b == c:
print("YES")
exit()
print("NO")
resolve() | def resolve():
a,b,c = map(int, input().split())
a %= b
OK = False
for i in range(b):
if (a * i)%b == c:
OK = True
print("YES") if OK else print("NO")
resolve()
| 9 | 10 | 190 | 210 | def resolve():
a, b, c = list(map(int, input().split()))
a %= b
for i in range(b):
if a * i % b == c:
print("YES")
exit()
print("NO")
resolve()
| def resolve():
a, b, c = map(int, input().split())
a %= b
OK = False
for i in range(b):
if (a * i) % b == c:
OK = True
print("YES") if OK else print("NO")
resolve()
| false | 10 | [
"- a, b, c = list(map(int, input().split()))",
"+ a, b, c = map(int, input().split())",
"+ OK = False",
"- if a * i % b == c:",
"- print(\"YES\")",
"- exit()",
"- print(\"NO\")",
"+ if (a * i) % b == c:",
"+ OK = True",
"+ print(\"YES\"... | false | 0.053724 | 0.038835 | 1.383398 | [
"s529663267",
"s548813264"
] |
u345966487 | p03911 | python | s174947870 | s511187332 | 355 | 319 | 12,728 | 12,620 | Accepted | Accepted | 10.14 | import sys
import collections
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: list(map(int, sys.stdin.readline().split()))
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
def solve():
N, M = nm()
uf = UnionFind(M)
lang_spoken = set()
... | import sys
import collections
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: list(map(int, sys.stdin.readline().split()))
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
def solve():
N, M = nm()
uf = UnionFind(M)
lang_spoken = set()
... | 83 | 83 | 2,203 | 2,196 | import sys
import collections
sys.setrecursionlimit(10**8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: list(map(int, sys.stdin.readline().split()))
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
def solve():
N, M = nm()
uf = UnionFind(M)
lang_spoken = set()
for i in range(... | import sys
import collections
sys.setrecursionlimit(10**8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: list(map(int, sys.stdin.readline().split()))
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
def solve():
N, M = nm()
uf = UnionFind(M)
lang_spoken = set()
for i in range(... | false | 0 | [
"- roots = list(roots)",
"- x = roots[0]",
"- for y in roots[1:]:",
"+ rit = iter(roots)",
"+ x = next(rit)",
"+ for y in rit:"
] | false | 0.042035 | 0.085146 | 0.493679 | [
"s174947870",
"s511187332"
] |
u921168761 | p02614 | python | s405535892 | s844791099 | 86 | 79 | 9,152 | 9,152 | Accepted | Accepted | 8.14 | h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for i in range(2 ** h):
for j in range(2 ** w):
d = [c[x][:] for x in range(h)]
for p in range(h):
if (1 << p) & i:
for q in range(w): d[p][q] = '.'
for q in ... | h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for i in range(2 ** h): # 行の塗り方パターン
for j in range(2 ** w): # 列の塗り方のパターン
d = [c[x][:] for x in range(h)]
for p in range(h):
bit = (1 << p)
if i & bit > 0:
for x in r... | 18 | 27 | 538 | 609 | h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for i in range(2**h):
for j in range(2**w):
d = [c[x][:] for x in range(h)]
for p in range(h):
if (1 << p) & i:
for q in range(w):
d[p][q] = "."
for q... | h, w, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(h)]
ans = 0
for i in range(2**h): # 行の塗り方パターン
for j in range(2**w): # 列の塗り方のパターン
d = [c[x][:] for x in range(h)]
for p in range(h):
bit = 1 << p
if i & bit > 0:
for x in range(... | false | 33.333333 | [
"-for i in range(2**h):",
"- for j in range(2**w):",
"+for i in range(2**h): # 行の塗り方パターン",
"+ for j in range(2**w): # 列の塗り方のパターン",
"- if (1 << p) & i:",
"- for q in range(w):",
"- d[p][q] = \".\"",
"+ bit = 1 << p",
"+ if i &... | false | 0.07716 | 0.041416 | 1.863074 | [
"s405535892",
"s844791099"
] |
u755180064 | p03448 | python | s478352378 | s196020970 | 55 | 43 | 3,060 | 3,060 | Accepted | Accepted | 21.82 | coins = []
for i in range(0, 4):
coins.append(int(eval(input())))
count = 0
for i in range(0, coins[0] + 1):
for j in range(0, coins[1] + 1):
for k in range(0, coins[2] + 1):
ans = 500*i + 100*j + 50*k
if ans == coins[3]:
count += 1
print(count)
| url = "https://atcoder.jp/contests/abc087/tasks/abc087_b"
def main():
coins = [int(eval(input())) for v in range(3)]
che = int(eval(input()))
count = 0
for i in range(0, coins[0] + 1):
for j in range(0, coins[1] + 1):
for k in range(0, coins[2] + 1):
if che ... | 15 | 18 | 286 | 443 | coins = []
for i in range(0, 4):
coins.append(int(eval(input())))
count = 0
for i in range(0, coins[0] + 1):
for j in range(0, coins[1] + 1):
for k in range(0, coins[2] + 1):
ans = 500 * i + 100 * j + 50 * k
if ans == coins[3]:
count += 1
print(count)
| url = "https://atcoder.jp/contests/abc087/tasks/abc087_b"
def main():
coins = [int(eval(input())) for v in range(3)]
che = int(eval(input()))
count = 0
for i in range(0, coins[0] + 1):
for j in range(0, coins[1] + 1):
for k in range(0, coins[2] + 1):
if che == (500 ... | false | 16.666667 | [
"-coins = []",
"-for i in range(0, 4):",
"- coins.append(int(eval(input())))",
"-count = 0",
"-for i in range(0, coins[0] + 1):",
"- for j in range(0, coins[1] + 1):",
"- for k in range(0, coins[2] + 1):",
"- ans = 500 * i + 100 * j + 50 * k",
"- if ans == coins[3]... | false | 0.29711 | 0.087535 | 3.394182 | [
"s478352378",
"s196020970"
] |
u803617136 | p03001 | python | s558365331 | s626757003 | 200 | 18 | 38,384 | 2,940 | Accepted | Accepted | 91 | W, H, x, y = list(map(int, input().split()))
ans = W * H / 2
n = 1 if W == x * 2 and H == y * 2 else 0
print((ans, n))
| w, h, x, y = list(map(int, input().split()))
ans = w * h / 2
n = 1 if w == x * 2 and h == y * 2 else 0
print((ans, n)) | 5 | 4 | 116 | 113 | W, H, x, y = list(map(int, input().split()))
ans = W * H / 2
n = 1 if W == x * 2 and H == y * 2 else 0
print((ans, n))
| w, h, x, y = list(map(int, input().split()))
ans = w * h / 2
n = 1 if w == x * 2 and h == y * 2 else 0
print((ans, n))
| false | 20 | [
"-W, H, x, y = list(map(int, input().split()))",
"-ans = W * H / 2",
"-n = 1 if W == x * 2 and H == y * 2 else 0",
"+w, h, x, y = list(map(int, input().split()))",
"+ans = w * h / 2",
"+n = 1 if w == x * 2 and h == y * 2 else 0"
] | false | 0.058986 | 0.046306 | 1.273821 | [
"s558365331",
"s626757003"
] |
u029000441 | p03575 | python | s113080401 | s303929678 | 63 | 56 | 3,316 | 3,440 | Accepted | Accepted | 11.11 | #dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop,... | #dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop,... | 51 | 54 | 1,357 | 1,516 | # dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heap... | # dpでできないかな?
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heap... | false | 5.555556 | [
"-def dfs(x):",
"+def dfs(x, tree, al):",
"- dfs(i)",
"+ dfs(i, tree, al)",
"-n, m = MI()",
"-lis = [LI() for i in range(m)]",
"-# print(lis)",
"-cou = 0",
"-for i in range(m):",
"- tree = [[] for i in range(n)]",
"- for j in range(m):",
"- if i != j:",
"- ... | false | 0.035809 | 0.039381 | 0.909305 | [
"s113080401",
"s303929678"
] |
u113971909 | p03163 | python | s534998696 | s583795467 | 1,163 | 218 | 170,440 | 14,796 | Accepted | Accepted | 81.26 | #!/usr/bin python3
# -*- coding: utf-8 -*-
import numpy as np
def main():
N, W = list(map(int, input().split()))
dp = [[0] * (W+1) for i in range(N+1)]
dp = np.array(dp)
#dp[i][j] iまでをみてjの重さでの最大価値
for i in range(1,N+1):
w, v = list(map(int, input().split()))
dp[i][:] =... | #!/usr/bin python3
# -*- coding: utf-8 -*-
import numpy as np
def main():
N, W = list(map(int, input().split()))
dp = [0] * (W+1)
dp = np.array(dp)
#dp[i][j] iまでをみてjの重さでの最大価値
for i in range(1,N+1):
w, v = list(map(int, input().split()))
dp[w:W+1] = np.maximum(dp[w:W+1]... | 20 | 19 | 472 | 403 | #!/usr/bin python3
# -*- coding: utf-8 -*-
import numpy as np
def main():
N, W = list(map(int, input().split()))
dp = [[0] * (W + 1) for i in range(N + 1)]
dp = np.array(dp)
# dp[i][j] iまでをみてjの重さでの最大価値
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
dp[i][:] = dp[... | #!/usr/bin python3
# -*- coding: utf-8 -*-
import numpy as np
def main():
N, W = list(map(int, input().split()))
dp = [0] * (W + 1)
dp = np.array(dp)
# dp[i][j] iまでをみてjの重さでの最大価値
for i in range(1, N + 1):
w, v = list(map(int, input().split()))
dp[w : W + 1] = np.maximum(dp[w : W + ... | false | 5 | [
"- dp = [[0] * (W + 1) for i in range(N + 1)]",
"+ dp = [0] * (W + 1)",
"- dp[i][:] = dp[i - 1][:]",
"- dp[i][w : W + 1] = np.maximum(dp[i - 1][w : W + 1], dp[i - 1][: W + 1 - w] + v)",
"+ dp[w : W + 1] = np.maximum(dp[w : W + 1], dp[: W + 1 - w] + v)",
"- print((dp[N][W]))",... | false | 0.160481 | 0.382178 | 0.419913 | [
"s534998696",
"s583795467"
] |
u380524497 | p02850 | python | s857534647 | s132198835 | 406 | 338 | 30,872 | 44,120 | Accepted | Accepted | 16.75 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = [0]*(n-1)
edges = [[]for _ in range(n)]
used = [0]*n
for i in range(n-1):
a, b = list(map(int, input().split()))
edges[a-1].append([b-1, i])
for node in range(n):
unable = used[node]
color = 1
for to, id in edge... | import sys
read = sys.stdin.read
n, *ab = list(map(int, read().split()))
ans = [0]*(n-1)
edges = [[]for _ in range(n)]
used = [0]*n
for i, a, b in zip(list(range(n-1)), *[iter(ab)] * 2):
edges[a-1].append([b-1, i])
for node in range(n):
unable = used[node]
color = 1
for to, id in ed... | 27 | 25 | 498 | 490 | import sys
input = sys.stdin.readline
n = int(eval(input()))
ans = [0] * (n - 1)
edges = [[] for _ in range(n)]
used = [0] * n
for i in range(n - 1):
a, b = list(map(int, input().split()))
edges[a - 1].append([b - 1, i])
for node in range(n):
unable = used[node]
color = 1
for to, id in edges[node]:... | import sys
read = sys.stdin.read
n, *ab = list(map(int, read().split()))
ans = [0] * (n - 1)
edges = [[] for _ in range(n)]
used = [0] * n
for i, a, b in zip(list(range(n - 1)), *[iter(ab)] * 2):
edges[a - 1].append([b - 1, i])
for node in range(n):
unable = used[node]
color = 1
for to, id in edges[nod... | false | 7.407407 | [
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"+read = sys.stdin.read",
"+n, *ab = list(map(int, read().split()))",
"-for i in range(n - 1):",
"- a, b = list(map(int, input().split()))",
"+for i, a, b in zip(list(range(n - 1)), *[iter(ab)] * 2):",
"- ans[id] = color",
"+ ... | false | 0.038188 | 0.104803 | 0.364384 | [
"s857534647",
"s132198835"
] |
u423665486 | p02695 | python | s324812440 | s113865584 | 355 | 246 | 78,240 | 74,140 | Accepted | Accepted | 30.7 | import sys
from io import StringIO
import unittest
sys.setrecursionlimit(10**5)
def search(seq, min_n, max_n, n, req):
ans = 0
if len(seq) == n:
for a, b, c, d in req:
if seq[b-1] - seq[a-1] == c:
ans += d
return ans
else:
for i in range(min_n, max_n+1):
new_seq = seq + [i]
ans =... | def search(v, n, m, seq, scs):
if len(seq) == n:
ans = 0
for r in scs:
if seq[r[1]-1] - seq[r[0]-1] == r[2]:
ans += r[3]
return ans
ans = 0
for i in range(v, m+1):
tmp = search(i, n, m, seq + [i], scs)
ans = max(ans, tmp)
ret... | 24 | 19 | 538 | 508 | import sys
from io import StringIO
import unittest
sys.setrecursionlimit(10**5)
def search(seq, min_n, max_n, n, req):
ans = 0
if len(seq) == n:
for a, b, c, d in req:
if seq[b - 1] - seq[a - 1] == c:
ans += d
return ans
else:
for i in range(min_n, max_... | def search(v, n, m, seq, scs):
if len(seq) == n:
ans = 0
for r in scs:
if seq[r[1] - 1] - seq[r[0] - 1] == r[2]:
ans += r[3]
return ans
ans = 0
for i in range(v, m + 1):
tmp = search(i, n, m, seq + [i], scs)
ans = max(ans, tmp)
return a... | false | 20.833333 | [
"-import sys",
"-from io import StringIO",
"-import unittest",
"-",
"-sys.setrecursionlimit(10**5)",
"-",
"-",
"-def search(seq, min_n, max_n, n, req):",
"+def search(v, n, m, seq, scs):",
"+ if len(seq) == n:",
"+ ans = 0",
"+ for r in scs:",
"+ if seq[r[1] - 1] ... | false | 0.050049 | 0.067105 | 0.74583 | [
"s324812440",
"s113865584"
] |
u251515715 | p02959 | python | s152459007 | s117293277 | 180 | 166 | 18,476 | 18,624 | Accepted | Accepted | 7.78 | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
monster=sum(b)
for i in range(n+1):
if i==0:
k=min(a[0],b[0])
a[0]-=k
b[0]-=k
elif i==n:
k=min(a[i],b[i-1])
a[i]-=k
b[i-1]-=k
else:
k=min(a[i],b[i]+b[i-1])
a[i]-=k
if b[i-1]<k... | n=int(eval(input()))
a=[0]+list(map(int,input().split()))
b=[0]+list(map(int,input().split()))+[0]
monster=sum(b)
for i in range(1,n+2):
k=min(a[i],b[i]+b[i-1])
a[i]-=k
if b[i-1]<k:
b[i]-=k-b[i-1]
b[i-1]=0
else:
b[i-1]-=k
print((monster-sum(b))) | 22 | 13 | 404 | 269 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
monster = sum(b)
for i in range(n + 1):
if i == 0:
k = min(a[0], b[0])
a[0] -= k
b[0] -= k
elif i == n:
k = min(a[i], b[i - 1])
a[i] -= k
b[i - 1] -= k
else:
... | n = int(eval(input()))
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split())) + [0]
monster = sum(b)
for i in range(1, n + 2):
k = min(a[i], b[i] + b[i - 1])
a[i] -= k
if b[i - 1] < k:
b[i] -= k - b[i - 1]
b[i - 1] = 0
else:
b[i - 1] -= k
print((monst... | false | 40.909091 | [
"-a = list(map(int, input().split()))",
"-b = list(map(int, input().split()))",
"+a = [0] + list(map(int, input().split()))",
"+b = [0] + list(map(int, input().split())) + [0]",
"-for i in range(n + 1):",
"- if i == 0:",
"- k = min(a[0], b[0])",
"- a[0] -= k",
"- b[0] -= k",
... | false | 0.036731 | 0.036962 | 0.993775 | [
"s152459007",
"s117293277"
] |
u222668979 | p02691 | python | s074824829 | s183602492 | 206 | 186 | 61,584 | 61,564 | Accepted | Accepted | 9.71 | from collections import Counter
import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
minus = Counter([i-a[i] for i in range(n)])
plus = Counter([i+a[i] for i in range(n)])
cnt = 0
for i in minus:
if i in plus:
cnt += minus[i] * plus[i]
print(cnt)
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
minus = Counter([i - a[i] for i in range(n)])
plus = Counter([i + a[i] for i in range(n)])
cnt = 0
for i in minus:
if i in plus:
cnt += minus[i] * plus[i]
print(cnt)
| 14 | 12 | 312 | 276 | from collections import Counter
import sys
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
minus = Counter([i - a[i] for i in range(n)])
plus = Counter([i + a[i] for i in range(n)])
cnt = 0
for i in minus:
if i in plus:
cnt += minus[i] * plus[i]
print(cnt)
| from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
minus = Counter([i - a[i] for i in range(n)])
plus = Counter([i + a[i] for i in range(n)])
cnt = 0
for i in minus:
if i in plus:
cnt += minus[i] * plus[i]
print(cnt)
| false | 14.285714 | [
"-import sys",
"-input = sys.stdin.readline"
] | false | 0.039199 | 0.039224 | 0.999366 | [
"s074824829",
"s183602492"
] |
u909514237 | p02555 | python | s578305353 | s681314432 | 470 | 29 | 8,936 | 9,060 | Accepted | Accepted | 93.83 | S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S+1)
dp[0] = 1
for i in range(1,S+1):
for j in range(0,(i-3)+1):
dp[i] += dp[j]
dp[i] %= mod
print((dp[S])) | S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S+1)
dp[0] = 1
x = 0
for i in range(1,S+1):
if i-3 >= 0:
x += dp[i-3]
x %= mod
dp[i] = x
print((dp[S])) | 11 | 12 | 176 | 170 | S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S + 1)
dp[0] = 1
for i in range(1, S + 1):
for j in range(0, (i - 3) + 1):
dp[i] += dp[j]
dp[i] %= mod
print((dp[S]))
| S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S + 1)
dp[0] = 1
x = 0
for i in range(1, S + 1):
if i - 3 >= 0:
x += dp[i - 3]
x %= mod
dp[i] = x
print((dp[S]))
| false | 8.333333 | [
"+x = 0",
"- for j in range(0, (i - 3) + 1):",
"- dp[i] += dp[j]",
"- dp[i] %= mod",
"+ if i - 3 >= 0:",
"+ x += dp[i - 3]",
"+ x %= mod",
"+ dp[i] = x"
] | false | 0.252116 | 0.035307 | 7.140641 | [
"s578305353",
"s681314432"
] |
u944325914 | p03087 | python | s525716186 | s138573289 | 559 | 464 | 13,784 | 12,324 | Accepted | Accepted | 16.99 | import bisect
n,q=list(map(int,input().split()))
s=list(eval(input()))
former_list=[]
latter_list=[]
for i in range(n-1):
if s[i]=="A" and s[i+1]=="C":
former_list.append(i+1)
latter_list.append(i+2)
for j in range(q):
l,r=list(map(int,input().split()))
start=bisect.bisect_left(... |
n,q=list(map(int,input().split()))
s=list(eval(input()))
sum=[0]*n
for i in range(n-1):
if s[i]=="A" and s[i+1]=="C":
sum[i+1]=sum[i]+1
else:
sum[i+1]=sum[i]
for j in range(q):
l,r=list(map(int,input().split()))
print((sum[r-1]-sum[l-1])) | 15 | 13 | 382 | 264 | import bisect
n, q = list(map(int, input().split()))
s = list(eval(input()))
former_list = []
latter_list = []
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
former_list.append(i + 1)
latter_list.append(i + 2)
for j in range(q):
l, r = list(map(int, input().split()))
start = bis... | n, q = list(map(int, input().split()))
s = list(eval(input()))
sum = [0] * n
for i in range(n - 1):
if s[i] == "A" and s[i + 1] == "C":
sum[i + 1] = sum[i] + 1
else:
sum[i + 1] = sum[i]
for j in range(q):
l, r = list(map(int, input().split()))
print((sum[r - 1] - sum[l - 1]))
| false | 13.333333 | [
"-import bisect",
"-",
"-former_list = []",
"-latter_list = []",
"+sum = [0] * n",
"- former_list.append(i + 1)",
"- latter_list.append(i + 2)",
"+ sum[i + 1] = sum[i] + 1",
"+ else:",
"+ sum[i + 1] = sum[i]",
"- start = bisect.bisect_left(former_list, l)",
"-... | false | 0.103871 | 0.059811 | 1.736651 | [
"s525716186",
"s138573289"
] |
u033272694 | p02862 | python | s485500240 | s800957911 | 189 | 134 | 38,896 | 4,196 | Accepted | Accepted | 29.1 | from functools import reduce
X,Y = list(map(int,input().split()))
x = (-X+2*Y) /3
y = (2*X-Y) /3
#ans=0のときをどっかで書く。indentめんどいからどうする?
MOD = 10**9+7
if int(x) == x and int(y) == y and x>=0 and y>=0 :
sum1 = int(x+y)
bunbo = min([int(x),int(y)])
n1 = reduce(lambda a,b : (a*b) % MOD ,list(range(sum1,sum1-bun... | from functools import reduce
X,Y = list(map(int,input().split()))
x = (-X+2*Y) /3
y = (2*X-Y) /3
MOD = 10**9+7
def mod_comb(n,m,mod):
def mod_mult(a,b,mod1=mod):
return (a*b) % mod1
n1 = reduce(mod_mult ,list(range(n,n-m,-1)),1)
n2 = reduce(mod_mult ,list(range(m,1,-1)),1)
n2inv = pow(n2,mod-2,m... | 15 | 22 | 456 | 500 | from functools import reduce
X, Y = list(map(int, input().split()))
x = (-X + 2 * Y) / 3
y = (2 * X - Y) / 3
# ans=0のときをどっかで書く。indentめんどいからどうする?
MOD = 10**9 + 7
if int(x) == x and int(y) == y and x >= 0 and y >= 0:
sum1 = int(x + y)
bunbo = min([int(x), int(y)])
n1 = reduce(lambda a, b: (a * b) % MOD, list... | from functools import reduce
X, Y = list(map(int, input().split()))
x = (-X + 2 * Y) / 3
y = (2 * X - Y) / 3
MOD = 10**9 + 7
def mod_comb(n, m, mod):
def mod_mult(a, b, mod1=mod):
return (a * b) % mod1
n1 = reduce(mod_mult, list(range(n, n - m, -1)), 1)
n2 = reduce(mod_mult, list(range(m, 1, -1)... | false | 31.818182 | [
"-# ans=0のときをどっかで書く。indentめんどいからどうする?",
"+",
"+",
"+def mod_comb(n, m, mod):",
"+ def mod_mult(a, b, mod1=mod):",
"+ return (a * b) % mod1",
"+",
"+ n1 = reduce(mod_mult, list(range(n, n - m, -1)), 1)",
"+ n2 = reduce(mod_mult, list(range(m, 1, -1)), 1)",
"+ n2inv = pow(n2, mod ... | false | 0.072294 | 0.118962 | 0.607706 | [
"s485500240",
"s800957911"
] |
u869790980 | p02689 | python | s458915237 | s202208570 | 383 | 154 | 109,976 | 94,056 | Accepted | Accepted | 59.79 | import collections
def f(heights,roads):
adj = collections.defaultdict(list)
count = 0
for u,v in roads:
adj[u].append(v)
adj[v].append(u)
for i,h in enumerate(heights):
u = i + 1
if h > max([heights[v-1] for v in adj[u]] or [-1]): count +=1
return count
n,m = list(map(int, input().split(' '))... | def f(heights,roads):
count, r =0, [True] * len(heights)
for u,v in roads:
if heights[u-1] <= heights[v-1]: r[u-1] = False
if heights[u-1] >= heights[v-1]:r[v-1] = False
for b in r:
count += 1 if b else 0
return count
n,m = list(map(int, input().split(' ')))
print(f(list(map(int,input().split(' '))... | 14 | 11 | 417 | 374 | import collections
def f(heights, roads):
adj = collections.defaultdict(list)
count = 0
for u, v in roads:
adj[u].append(v)
adj[v].append(u)
for i, h in enumerate(heights):
u = i + 1
if h > max([heights[v - 1] for v in adj[u]] or [-1]):
count += 1
return... | def f(heights, roads):
count, r = 0, [True] * len(heights)
for u, v in roads:
if heights[u - 1] <= heights[v - 1]:
r[u - 1] = False
if heights[u - 1] >= heights[v - 1]:
r[v - 1] = False
for b in r:
count += 1 if b else 0
return count
n, m = list(map(int,... | false | 21.428571 | [
"-import collections",
"-",
"-",
"- adj = collections.defaultdict(list)",
"- count = 0",
"+ count, r = 0, [True] * len(heights)",
"- adj[u].append(v)",
"- adj[v].append(u)",
"- for i, h in enumerate(heights):",
"- u = i + 1",
"- if h > max([heights[v - 1] ... | false | 0.134756 | 0.059552 | 2.262806 | [
"s458915237",
"s202208570"
] |
u994988729 | p03588 | python | s086278850 | s427225700 | 298 | 238 | 3,060 | 16,916 | Accepted | Accepted | 20.13 | n = int(eval(input()))
bottom = 10 ** 9+7
person = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if b < bottom:
person = max(person, a)
bottom = b
ans = person + bottom
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N)]
ab.sort()
ans = ab[-1][0] - ab[0][0] + 1
ans += ab[0][0] - 1
ans += ab[-1][1]
print(ans)
| 12 | 10 | 219 | 212 | n = int(eval(input()))
bottom = 10**9 + 7
person = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if b < bottom:
person = max(person, a)
bottom = b
ans = person + bottom
print(ans)
| import sys
input = sys.stdin.readline
N = int(eval(input()))
ab = [tuple(map(int, input().split())) for _ in range(N)]
ab.sort()
ans = ab[-1][0] - ab[0][0] + 1
ans += ab[0][0] - 1
ans += ab[-1][1]
print(ans)
| false | 16.666667 | [
"-n = int(eval(input()))",
"-bottom = 10**9 + 7",
"-person = 0",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- if b < bottom:",
"- person = max(person, a)",
"- bottom = b",
"-ans = person + bottom",
"+import sys",
"+",
"+input = sys.stdin.readline",
... | false | 0.037196 | 0.039274 | 0.947081 | [
"s086278850",
"s427225700"
] |
u458388104 | p02675 | python | s146030501 | s527249943 | 59 | 23 | 61,732 | 8,988 | Accepted | Accepted | 61.02 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline()
def resolve():
n = input().rstrip()
if n[-1] == "3":
print("bon")
elif n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
print("hon")
e... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = input().rstrip()
if n[len(n)-1] == "3":
print("bon")
elif n[len(n)-1] == "0" or n[len(n)-1] == "1" or n[len(n)-1] == "6" or n[len(n)-1] == "8":
print("pon")
else:
print("hon")
| 24 | 12 | 396 | 263 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline()
def resolve():
n = input().rstrip()
if n[-1] == "3":
print("bon")
elif n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
print("hon")
else:
print(... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
n = input().rstrip()
if n[len(n) - 1] == "3":
print("bon")
elif (
n[len(n) - 1] == "0"
or n[len(n) - 1] == "1"
or n[len(n) - 1] == "6"
or n[len(n) - 1] == "8"
):
print("pon")
else:
print("hon")
| false | 50 | [
"-import sys",
"+import math",
"-",
"-def input():",
"- return sys.stdin.readline()",
"-",
"-",
"-def resolve():",
"- n = input().rstrip()",
"- if n[-1] == \"3\":",
"- print(\"bon\")",
"- elif n[-1] == \"2\" or n[-1] == \"4\" or n[-1] == \"5\" or n[-1] == \"7\" or n[-1] == \... | false | 0.070955 | 0.070231 | 1.010317 | [
"s146030501",
"s527249943"
] |
u888092736 | p03862 | python | s687402327 | s574746222 | 102 | 93 | 19,908 | 19,960 | Accepted | Accepted | 8.82 | N, x = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
ans = 0
for i in range(N):
if A[i] + A[i + 1] > x:
tmp = A[i] + A[i + 1] - x
ans += tmp
A[i + 1] -= tmp
print(ans)
| N, x, *A = list(map(int, open(0).read().split()))
ans = 0
for i in range(1, N):
required = (A[i] + A[i - 1]) - x
if required <= 0:
continue
elif required <= A[i]:
A[i] -= required
else:
A[i] = 0
rem = required - A[i]
A[i - 1] -= rem
ans += required... | 9 | 15 | 226 | 329 | N, x = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))
ans = 0
for i in range(N):
if A[i] + A[i + 1] > x:
tmp = A[i] + A[i + 1] - x
ans += tmp
A[i + 1] -= tmp
print(ans)
| N, x, *A = list(map(int, open(0).read().split()))
ans = 0
for i in range(1, N):
required = (A[i] + A[i - 1]) - x
if required <= 0:
continue
elif required <= A[i]:
A[i] -= required
else:
A[i] = 0
rem = required - A[i]
A[i - 1] -= rem
ans += required
print(ans)
| false | 40 | [
"-N, x = list(map(int, input().split()))",
"-A = [0] + list(map(int, input().split()))",
"+N, x, *A = list(map(int, open(0).read().split()))",
"-for i in range(N):",
"- if A[i] + A[i + 1] > x:",
"- tmp = A[i] + A[i + 1] - x",
"- ans += tmp",
"- A[i + 1] -= tmp",
"+for i in ra... | false | 0.046072 | 0.042543 | 1.082945 | [
"s687402327",
"s574746222"
] |
u083960235 | p03555 | python | s357322229 | s557021044 | 38 | 35 | 5,156 | 9,672 | Accepted | Accepted | 7.89 |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_u... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii... | 32 | 26 | 873 | 890 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_upper... | false | 18.75 | [
"-import sys, re",
"+import sys, re, os",
"-from fractions import gcd",
"+from heapq import heapify, heappop, heappush",
"+def S_MAP():",
"+ return list(map(str, input().split()))",
"+",
"+",
"- return list(eval(input()))",
"+ return list(map(str, input().split()))",
"-# def LIST(): ret... | false | 0.041749 | 0.043329 | 0.963541 | [
"s357322229",
"s557021044"
] |
u506910932 | p03545 | python | s880750872 | s648237201 | 173 | 27 | 38,256 | 9,184 | Accepted | Accepted | 84.39 | def dfs(i, now, count):
if count == len(s):
if i == 7:
print(str(s[0]),end="")
for j in range(len(s)-1):
print(now[j+1] + str(s[j+1]), end="")
print('=7')
exit()
else:
dfs(i + s[count], now + '+', count + 1)
dfs(i... | num = eval(input())
for mask in range(1 << 3):
tmp = int(num[0])
ans_str = num[0]
for i in range(3):
if mask >> i & 1 == 1:
tmp += int(num[i + 1])
ans_str += '+' + num[i + 1]
else:
tmp -= int(num[i + 1])
ans_str += '-' + num[i + 1]
... | 16 | 15 | 413 | 379 | def dfs(i, now, count):
if count == len(s):
if i == 7:
print(str(s[0]), end="")
for j in range(len(s) - 1):
print(now[j + 1] + str(s[j + 1]), end="")
print("=7")
exit()
else:
dfs(i + s[count], now + "+", count + 1)
dfs(i - s... | num = eval(input())
for mask in range(1 << 3):
tmp = int(num[0])
ans_str = num[0]
for i in range(3):
if mask >> i & 1 == 1:
tmp += int(num[i + 1])
ans_str += "+" + num[i + 1]
else:
tmp -= int(num[i + 1])
ans_str += "-" + num[i + 1]
if tmp =... | false | 6.25 | [
"-def dfs(i, now, count):",
"- if count == len(s):",
"- if i == 7:",
"- print(str(s[0]), end=\"\")",
"- for j in range(len(s) - 1):",
"- print(now[j + 1] + str(s[j + 1]), end=\"\")",
"- print(\"=7\")",
"- exit()",
"- else:",
"... | false | 0.080085 | 0.006718 | 11.921528 | [
"s880750872",
"s648237201"
] |
u806403461 | p03289 | python | s818963386 | s835157268 | 20 | 18 | 3,188 | 3,064 | Accepted | Accepted | 10 | import re
s = eval(input())
def isAlpha(value):
"""
半角英字チェック
:param value: チェック対象の文字列
:rtype: チェック対象文字列が、全て半角英字の場合 True
"""
return re.fullmatch(r"^A([a-z]+)C([a-z]+)", value) is not None
if isAlpha(s):
print('AC')
else:
print('WA')
| s = eval(input())
def check(w):
if w[0] != 'A':
return False
n = len(w)
count = 0
for a in range(2, n-1):
if w[a] == 'C':
count += 1
if count != 1:
return False
upper = 0
for a in range(0, n):
if w[a] >= 'A' and w[a] <= 'Z':
... | 18 | 27 | 280 | 452 | import re
s = eval(input())
def isAlpha(value):
"""
半角英字チェック
:param value: チェック対象の文字列
:rtype: チェック対象文字列が、全て半角英字の場合 True
"""
return re.fullmatch(r"^A([a-z]+)C([a-z]+)", value) is not None
if isAlpha(s):
print("AC")
else:
print("WA")
| s = eval(input())
def check(w):
if w[0] != "A":
return False
n = len(w)
count = 0
for a in range(2, n - 1):
if w[a] == "C":
count += 1
if count != 1:
return False
upper = 0
for a in range(0, n):
if w[a] >= "A" and w[a] <= "Z":
upper +... | false | 33.333333 | [
"-import re",
"-",
"-def isAlpha(value):",
"- \"\"\"",
"- 半角英字チェック",
"- :param value: チェック対象の文字列",
"- :rtype: チェック対象文字列が、全て半角英字の場合 True",
"- \"\"\"",
"- return re.fullmatch(r\"^A([a-z]+)C([a-z]+)\", value) is not None",
"+def check(w):",
"+ if w[0] != \"A\":",
"+ re... | false | 0.054726 | 0.052119 | 1.050019 | [
"s818963386",
"s835157268"
] |
u554096168 | p03262 | python | s421132938 | s263344503 | 208 | 107 | 95,892 | 16,268 | Accepted | Accepted | 48.56 | import sys
import fractions
sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7
N, X = LIST()
x = LIST()
dx = [abs(i - X) for i in x]
def gcd_all(n):
if len(n) == ... | import sys
import fractions
sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(eval(input()))
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7
N, X = LIST()
x = LIST()
dx = [abs(i - X) for i in x]
ans = dx[0]
for i in range(1, N):... | 23 | 20 | 428 | 366 | import sys
import fractions
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def LIST():
return [int(x) for x in input().split()]
MOD = 10**9 + 7
N, X = LIST()
x = LIST()
dx = [abs(i - X) for i in x]
def gcd_all(n):
if len(n) =... | import sys
import fractions
sys.setrecursionlimit(10**9)
def input():
return sys.stdin.readline().strip()
def INT():
return int(eval(input()))
def LIST():
return [int(x) for x in input().split()]
MOD = 10**9 + 7
N, X = LIST()
x = LIST()
dx = [abs(i - X) for i in x]
ans = dx[0]
for i in range(1, N):... | false | 13.043478 | [
"-",
"-",
"-def gcd_all(n):",
"- if len(n) == 1:",
"- return n[0]",
"- tail = n.pop(-1)",
"- return fractions.gcd(tail, gcd_all(n))",
"-",
"-",
"-print((gcd_all(dx)))",
"+ans = dx[0]",
"+for i in range(1, N):",
"+ ans = fractions.gcd(ans, dx[i])",
"+print(ans)"
] | false | 0.049878 | 0.095653 | 0.521441 | [
"s421132938",
"s263344503"
] |
u621935300 | p02913 | python | s482127468 | s168709943 | 473 | 210 | 229,532 | 74,524 | Accepted | Accepted | 55.6 | # -*- coding: utf-8 -*-
import sys
N=int(sys.stdin.readline().strip())
S=sys.stdin.readline().strip()
S=S[::-1]
dp=[ [ 0 for j in range(N+1) ] for i in range(N+1) ]
for i in range(1,N+1): #iは1-indexed
for j in range(1,i+1):
if S[i-1]==S[j-1]: #Sは0-indexedなので-1
dp[i][j]=max(dp[i][j... | # -*- coding: utf-8 -*-
import sys
N=int(sys.stdin.readline().strip())
S=sys.stdin.readline().strip()
def isok(d): #長さdの文字列で重ならない2つの文字列が存在するかを判定
D={} #出てきた文字列:スタート位置
for i in range(N-d+1):
x=S[i:i+d]
if x not in D: #前に文字列が出てきていない場合
D[x]=i
else: #既に文字列が出てきて... | 20 | 28 | 525 | 634 | # -*- coding: utf-8 -*-
import sys
N = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()
S = S[::-1]
dp = [[0 for j in range(N + 1)] for i in range(N + 1)]
for i in range(1, N + 1): # iは1-indexed
for j in range(1, i + 1):
if S[i - 1] == S[j - 1]: # Sは0-indexedなので-1
dp[i][j] =... | # -*- coding: utf-8 -*-
import sys
N = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()
def isok(d): # 長さdの文字列で重ならない2つの文字列が存在するかを判定
D = {} # 出てきた文字列:スタート位置
for i in range(N - d + 1):
x = S[i : i + d]
if x not in D: # 前に文字列が出てきていない場合
D[x] = i
else: # 既... | false | 28.571429 | [
"-S = S[::-1]",
"-dp = [[0 for j in range(N + 1)] for i in range(N + 1)]",
"-for i in range(1, N + 1): # iは1-indexed",
"- for j in range(1, i + 1):",
"- if S[i - 1] == S[j - 1]: # Sは0-indexedなので-1",
"- dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1)",
"- else:",
"- ... | false | 0.055933 | 0.042206 | 1.325232 | [
"s482127468",
"s168709943"
] |
u046187684 | p03001 | python | s521567513 | s822686796 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | def solve(string):
w, h, x, y = list(map(int, string.split()))
f = 1 if x == w / 2 and y == h / 2 else 0
return str("{} {}".format(w * h / 2, f))
if __name__ == '__main__':
print((solve(eval(input()))))
| def solve(string):
w, h, x, y = list(map(int, string.split()))
f = 1 if 2 * x == w and 2 * y == h else 0
return str("{} {}".format(w * h / 2, f))
if __name__ == '__main__':
print((solve(eval(input()))))
| 8 | 8 | 214 | 214 | def solve(string):
w, h, x, y = list(map(int, string.split()))
f = 1 if x == w / 2 and y == h / 2 else 0
return str("{} {}".format(w * h / 2, f))
if __name__ == "__main__":
print((solve(eval(input()))))
| def solve(string):
w, h, x, y = list(map(int, string.split()))
f = 1 if 2 * x == w and 2 * y == h else 0
return str("{} {}".format(w * h / 2, f))
if __name__ == "__main__":
print((solve(eval(input()))))
| false | 0 | [
"- f = 1 if x == w / 2 and y == h / 2 else 0",
"+ f = 1 if 2 * x == w and 2 * y == h else 0"
] | false | 0.044517 | 0.045458 | 0.979296 | [
"s521567513",
"s822686796"
] |
u285443936 | p03295 | python | s466064199 | s120105261 | 445 | 268 | 17,000 | 24,768 | Accepted | Accepted | 39.78 | N,M = list(map(int, input().split()))
table = []
ans = 1
for i in range(M):
a,b = list(map(int,input().split()))
table.append((a,b))
table.sort()
r = N
for a,b in table:
if r <= a:
ans += 1
r = N
r = min(b,r)
print(ans) | N,M = list(map(int,input().split()))
table = []
for i in range(M):
a,b = list(map(int,input().split()))
a -= 1
b -= 1
table.append((a,b))
table = sorted(table,key=lambda x:x[1])
cur_r = table[0][1]
ans = 1
for i in range(1,M):
l,r = table[i]
if cur_r <= l:
ans += 1
... | 16 | 17 | 242 | 331 | N, M = list(map(int, input().split()))
table = []
ans = 1
for i in range(M):
a, b = list(map(int, input().split()))
table.append((a, b))
table.sort()
r = N
for a, b in table:
if r <= a:
ans += 1
r = N
r = min(b, r)
print(ans)
| N, M = list(map(int, input().split()))
table = []
for i in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
table.append((a, b))
table = sorted(table, key=lambda x: x[1])
cur_r = table[0][1]
ans = 1
for i in range(1, M):
l, r = table[i]
if cur_r <= l:
ans += 1
cur_r... | false | 5.882353 | [
"-ans = 1",
"+ a -= 1",
"+ b -= 1",
"-table.sort()",
"-r = N",
"-for a, b in table:",
"- if r <= a:",
"+table = sorted(table, key=lambda x: x[1])",
"+cur_r = table[0][1]",
"+ans = 1",
"+for i in range(1, M):",
"+ l, r = table[i]",
"+ if cur_r <= l:",
"- r = N",
"- ... | false | 0.089036 | 0.035059 | 2.539578 | [
"s466064199",
"s120105261"
] |
u644907318 | p02912 | python | s993479048 | s805086250 | 242 | 155 | 14,180 | 92,036 | Accepted | Accepted | 35.95 | import heapq
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A = [-A[i] for i in range(N)]
A = sorted(A)
cnt = 0
while cnt<M:
a = heapq.heappop(A)*(-1)
a = a/2
heapq.heappush(A,-a)
cnt += 1
A = [int(-A[i]) for i in range(N)]
print((sum(A))) | import heapq
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
heap = []
for i in range(N):
heapq.heappush(heap,-A[i])
for _ in range(M):
a = heapq.heappop(heap)
a = -a
a = a//2
heapq.heappush(heap,-a)
print((-sum(heap))) | 13 | 12 | 284 | 266 | import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [-A[i] for i in range(N)]
A = sorted(A)
cnt = 0
while cnt < M:
a = heapq.heappop(A) * (-1)
a = a / 2
heapq.heappush(A, -a)
cnt += 1
A = [int(-A[i]) for i in range(N)]
print((sum(A)))
| import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
heap = []
for i in range(N):
heapq.heappush(heap, -A[i])
for _ in range(M):
a = heapq.heappop(heap)
a = -a
a = a // 2
heapq.heappush(heap, -a)
print((-sum(heap)))
| false | 7.692308 | [
"-A = [-A[i] for i in range(N)]",
"-A = sorted(A)",
"-cnt = 0",
"-while cnt < M:",
"- a = heapq.heappop(A) * (-1)",
"- a = a / 2",
"- heapq.heappush(A, -a)",
"- cnt += 1",
"-A = [int(-A[i]) for i in range(N)]",
"-print((sum(A)))",
"+heap = []",
"+for i in range(N):",
"+ heapq.... | false | 0.054469 | 0.094362 | 0.577237 | [
"s993479048",
"s805086250"
] |
u422104747 | p03221 | python | s011549097 | s145347926 | 1,326 | 757 | 125,616 | 95,408 | Accepted | Accepted | 42.91 | s=input().split()
n=int(s[0])
m=int(s[1])
l=[[] for i in range(100000)]
d=[{} for i in range(100000)]
inp=[]
for i in range(m):
s=input().split()
p=int(s[0])
y=int(s[1])
inp.append((p,y))
l[p-1].append(y)
for i in range(100000):
l[i].sort()
for i in range(100000):
cnt=1
f... | s=input().split()
n,m=int(s[0]),int(s[1])
l=[[] for i in range(100001)]
d=[{} for i in range(100001)]
inp=[]
for i in range(m):
s=input().split()
p,y=int(s[0]),int(s[1])
inp.append((p,y))
l[p].append(y)
for i in range(100001):
l[i].sort()
for i in range(100001):
cnt=1
for j in ... | 30 | 19 | 600 | 440 | s = input().split()
n = int(s[0])
m = int(s[1])
l = [[] for i in range(100000)]
d = [{} for i in range(100000)]
inp = []
for i in range(m):
s = input().split()
p = int(s[0])
y = int(s[1])
inp.append((p, y))
l[p - 1].append(y)
for i in range(100000):
l[i].sort()
for i in range(100000):
cnt = ... | s = input().split()
n, m = int(s[0]), int(s[1])
l = [[] for i in range(100001)]
d = [{} for i in range(100001)]
inp = []
for i in range(m):
s = input().split()
p, y = int(s[0]), int(s[1])
inp.append((p, y))
l[p].append(y)
for i in range(100001):
l[i].sort()
for i in range(100001):
cnt = 1
fo... | false | 36.666667 | [
"-n = int(s[0])",
"-m = int(s[1])",
"-l = [[] for i in range(100000)]",
"-d = [{} for i in range(100000)]",
"+n, m = int(s[0]), int(s[1])",
"+l = [[] for i in range(100001)]",
"+d = [{} for i in range(100001)]",
"- p = int(s[0])",
"- y = int(s[1])",
"+ p, y = int(s[0]), int(s[1])",
"- ... | false | 0.234394 | 0.446141 | 0.525381 | [
"s011549097",
"s145347926"
] |
u077291787 | p02959 | python | s296850763 | s298748628 | 115 | 90 | 19,244 | 18,624 | Accepted | Accepted | 21.74 | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = min(a1, b)
cnt2 = min(a2, b - cnt1)
ans += cnt1 + cnt2
... | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = a1 if a1 < b else b
cnt2 = a2 if a2 < b - cnt1 else b - cnt1
... | 17 | 17 | 421 | 446 | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = min(a1, b)
cnt2 = min(a2, b - cnt1)
ans += cnt1 + cnt2
a1 = a2 ... | # ABC135C - City Savers
# greedy algorithm
def main():
n = int(eval(input()))
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
ans, a1 = 0, A[0]
for a2, b in zip(A[1:], B):
cnt1 = a1 if a1 < b else b
cnt2 = a2 if a2 < b - cnt1 else b - cnt1
ans += cnt... | false | 0 | [
"- cnt1 = min(a1, b)",
"- cnt2 = min(a2, b - cnt1)",
"+ cnt1 = a1 if a1 < b else b",
"+ cnt2 = a2 if a2 < b - cnt1 else b - cnt1"
] | false | 0.036808 | 0.055528 | 0.662877 | [
"s296850763",
"s298748628"
] |
u811436126 | p02713 | python | s671911546 | s126256704 | 1,049 | 925 | 69,600 | 74,948 | Accepted | Accepted | 11.82 | import math
from functools import reduce
k = int(eval(input()))
def gcd(a, b, c):
return reduce(math.gcd, [a, b, c])
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += gcd(a, b, c)
print(ans)
| import math
from functools import reduce
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += reduce(math.gcd, [a, b, c])
print(ans)
| 17 | 12 | 278 | 228 | import math
from functools import reduce
k = int(eval(input()))
def gcd(a, b, c):
return reduce(math.gcd, [a, b, c])
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += gcd(a, b, c)
print(ans)
| import math
from functools import reduce
k = int(eval(input()))
ans = 0
for a in range(1, k + 1):
for b in range(1, k + 1):
for c in range(1, k + 1):
ans += reduce(math.gcd, [a, b, c])
print(ans)
| false | 29.411765 | [
"-",
"-",
"-def gcd(a, b, c):",
"- return reduce(math.gcd, [a, b, c])",
"-",
"-",
"- ans += gcd(a, b, c)",
"+ ans += reduce(math.gcd, [a, b, c])"
] | false | 0.046896 | 0.048073 | 0.975506 | [
"s671911546",
"s126256704"
] |
u488401358 | p02567 | python | s189921369 | s600994034 | 500 | 178 | 116,732 | 32,136 | Accepted | Accepted | 64.4 | class SegmentTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
self.range = [(-1,n)] * 2 * self.num
# 配列の値を葉にセ... | mycode = r'''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False, cdivision=True
ctypedef long long LL
# cython: cdivision=True
from libc.stdio cimport scanf
from libcpp.vector cimport vector
ctypedef vector[LL] vec
cdef class SegmentTree():
cdef LL num,n
cdef ... | 94 | 113 | 2,655 | 2,808 | class SegmentTree:
def __init__(self, init_val, segfunc, ide_ele):
n = len(init_val)
self.segfunc = segfunc
self.ide_ele = ide_ele
self.num = 1 << (n - 1).bit_length()
self.tree = [ide_ele] * 2 * self.num
self.range = [(-1, n)] * 2 * self.num
# 配列の値を葉にセット
... | mycode = r"""
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False, cdivision=True
ctypedef long long LL
# cython: cdivision=True
from libc.stdio cimport scanf
from libcpp.vector cimport vector
ctypedef vector[LL] vec
cdef class SegmentTree():
cdef LL num,n
cdef vec tree
... | false | 16.814159 | [
"-class SegmentTree:",
"- def __init__(self, init_val, segfunc, ide_ele):",
"- n = len(init_val)",
"- self.segfunc = segfunc",
"- self.ide_ele = ide_ele",
"- self.num = 1 << (n - 1).bit_length()",
"- self.tree = [ide_ele] * 2 * self.num",
"- self.range = [(... | false | 0.03855 | 0.0462 | 0.834418 | [
"s189921369",
"s600994034"
] |
u422886513 | p03212 | python | s407220195 | s614229182 | 325 | 181 | 23,540 | 13,416 | Accepted | Accepted | 44.31 | import numpy as np
s = eval(input())
n = int(s)
digit = len(s)
all_combinations = []
for i1 in ("3", "5", "7"):
for i2 in ("3", "5", "7"):
for i3 in ("3", "5", "7"):
for i4 in ("3", "5", "7"):
for i5 in ("3", "5", "7"):
for i6 in ("3", "5", "7"... | import numpy as np
from itertools import product
s = eval(input())
n = int(s)
digit = len(s)
selected_num = []
for order in range(3, 10, 1):
for i in product('753', repeat = order):
concat_str = "".join(i)
if(('7' in concat_str) and ('5' in concat_str) and ('3' in concat_str)):
... | 78 | 17 | 2,527 | 444 | import numpy as np
s = eval(input())
n = int(s)
digit = len(s)
all_combinations = []
for i1 in ("3", "5", "7"):
for i2 in ("3", "5", "7"):
for i3 in ("3", "5", "7"):
for i4 in ("3", "5", "7"):
for i5 in ("3", "5", "7"):
for i6 in ("3", "5", "7"):
... | import numpy as np
from itertools import product
s = eval(input())
n = int(s)
digit = len(s)
selected_num = []
for order in range(3, 10, 1):
for i in product("753", repeat=order):
concat_str = "".join(i)
if ("7" in concat_str) and ("5" in concat_str) and ("3" in concat_str):
selected_nu... | false | 78.205128 | [
"+from itertools import product",
"-all_combinations = []",
"-for i1 in (\"3\", \"5\", \"7\"):",
"- for i2 in (\"3\", \"5\", \"7\"):",
"- for i3 in (\"3\", \"5\", \"7\"):",
"- for i4 in (\"3\", \"5\", \"7\"):",
"- for i5 in (\"3\", \"5\", \"7\"):",
"- ... | false | 0.235317 | 0.268818 | 0.875377 | [
"s407220195",
"s614229182"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.