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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u107077660 | p03805 | python | s119087111 | s141621999 | 41 | 32 | 3,064 | 3,064 | Accepted | Accepted | 21.95 | N, M = list(map(int, input().split()))
g = [[False]*N for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
g[a-1][b-1] = True
g[b-1][a-1] = True
stack = [[0,[1]+[0]*(N-1)]]
ans = 0
while stack:
cur, passed = stack.pop()
if passed == [1]*N:
ans += 1
else:
for i, j in enum... | N, M = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
ans = 0
passed = [0]
n = 0
s = [[n,passed]]
while s:
n, passed = s.pop()
if len(passed) == N:
ans += 1
else:
for i in g[n]:
if ... | 20 | 20 | 425 | 369 | N, M = list(map(int, input().split()))
g = [[False] * N for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
g[a - 1][b - 1] = True
g[b - 1][a - 1] = True
stack = [[0, [1] + [0] * (N - 1)]]
ans = 0
while stack:
cur, passed = stack.pop()
if passed == [1] * N:
ans += 1
... | N, M = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
ans = 0
passed = [0]
n = 0
s = [[n, passed]]
while s:
n, passed = s.pop()
if len(passed) == N:
ans += 1
else:
... | false | 0 | [
"-g = [[False] * N for _ in range(N)]",
"-for _ in range(M):",
"+g = [[] for i in range(N)]",
"+for i in range(M):",
"- g[a - 1][b - 1] = True",
"- g[b - 1][a - 1] = True",
"-stack = [[0, [1] + [0] * (N - 1)]]",
"+ g[a - 1].append(b - 1)",
"+ g[b - 1].append(a - 1)",
"-while stack:",
... | false | 0.037226 | 0.068764 | 0.541363 | [
"s119087111",
"s141621999"
] |
u017415492 | p02899 | python | s456231542 | s549850651 | 142 | 110 | 21,856 | 13,880 | Accepted | Accepted | 22.54 | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(range(1,n+1))
c = []
data = dict(list(zip(a,b)))
for i in range(1,n+1):
print((data[i]))
| n=int(eval(input()))
d=list(map(int,input().split()))
s=[0]*n
for i in range(n):
s[d[i]-1]=i+1
print((*s)) | 8 | 7 | 154 | 107 | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(range(1, n + 1))
c = []
data = dict(list(zip(a, b)))
for i in range(1, n + 1):
print((data[i]))
| n = int(eval(input()))
d = list(map(int, input().split()))
s = [0] * n
for i in range(n):
s[d[i] - 1] = i + 1
print((*s))
| false | 12.5 | [
"-a = list(map(int, input().split()))",
"-b = list(range(1, n + 1))",
"-c = []",
"-data = dict(list(zip(a, b)))",
"-for i in range(1, n + 1):",
"- print((data[i]))",
"+d = list(map(int, input().split()))",
"+s = [0] * n",
"+for i in range(n):",
"+ s[d[i] - 1] = i + 1",
"+print((*s))"
] | false | 0.04597 | 0.044955 | 1.022587 | [
"s456231542",
"s549850651"
] |
u553987207 | p02912 | python | s852392909 | s043386723 | 1,295 | 136 | 85,584 | 20,332 | Accepted | Accepted | 89.5 | import bisect
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()))
for _ in range(M):
x = A.pop()
y = x // 2
i = bisect.bisect_left(A, y)
A.insert(i, y)
ans = sum(A)
print(ans) | import heapq
N, M = list(map(int, input().split()))
A = [-a for a in map(int, input().split())]
heapq.heapify(A)
for _ in range(M):
x = -heapq.heappop(A)
heapq.heappush(A, -(x // 2))
ans = -sum(A)
print(ans) | 10 | 9 | 219 | 217 | import bisect
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()))
for _ in range(M):
x = A.pop()
y = x // 2
i = bisect.bisect_left(A, y)
A.insert(i, y)
ans = sum(A)
print(ans)
| import heapq
N, M = list(map(int, input().split()))
A = [-a for a in map(int, input().split())]
heapq.heapify(A)
for _ in range(M):
x = -heapq.heappop(A)
heapq.heappush(A, -(x // 2))
ans = -sum(A)
print(ans)
| false | 10 | [
"-import bisect",
"+import heapq",
"-A = sorted(map(int, input().split()))",
"+A = [-a for a in map(int, input().split())]",
"+heapq.heapify(A)",
"- x = A.pop()",
"- y = x // 2",
"- i = bisect.bisect_left(A, y)",
"- A.insert(i, y)",
"-ans = sum(A)",
"+ x = -heapq.heappop(A)",
"+... | false | 0.055915 | 0.041705 | 1.340744 | [
"s852392909",
"s043386723"
] |
u498487134 | p02889 | python | s615354587 | s943039170 | 1,031 | 647 | 56,284 | 78,640 | Accepted | Accepted | 37.25 | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def main():
mod=10**9+7
N,M,L=MI()
inf=10**15
d=[[inf]*N for _ in range(N)]
for i in range(M):
a,b,c=MI()
... | import sys
input = sys.stdin.readline
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
"""
全点対探索 & Nが小さいのでワーシャルフロイド.クエリも多めだし
合計距離から補給の回数をうまく計算するのは難しい,
残燃料を持つのも厳しい.
距離バージョンではなくて補給回数バージョンで新しいグラフとか作りたい
新しいグラフは距離がL以下の全点に対し... | 53 | 65 | 1,164 | 1,271 | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
def main():
mod = 10**9 + 7
N, M, L = MI()
inf = 10**15
d = [[inf] * N for _ in range(N)]
for i in range(M):... | import sys
input = sys.stdin.readline
def I():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
"""
全点対探索 & Nが小さいのでワーシャルフロイド.クエリも多めだし
合計距離から補給の回数をうまく計算するのは難しい,
残燃料を持つのも厳しい.
距離バージョンではなくて補給回数バージョンで新しいグラフとか作りたい
新しいグラフは距離がL以下の全点... | false | 18.461538 | [
"+\"\"\"",
"+全点対探索 & Nが小さいのでワーシャルフロイド.クエリも多めだし",
"+合計距離から補給の回数をうまく計算するのは難しい,",
"+残燃料を持つのも厳しい.",
"+距離バージョンではなくて補給回数バージョンで新しいグラフとか作りたい",
"+新しいグラフは距離がL以下の全点に対してならコスト1の辺を結ぶ.",
"+最初からLあるのでコスト-1",
"+\"\"\"",
"+",
"+",
"+ def warshall_floyd(d):",
"+ # d[i][j]: iからjへの最短距離",
"+ N = l... | false | 0.048072 | 0.045448 | 1.057719 | [
"s615354587",
"s943039170"
] |
u984276646 | p02807 | python | s368615427 | s665041538 | 1,841 | 541 | 14,480 | 14,484 | Accepted | Accepted | 70.61 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e+9 + 7)
p = mod - 2
S = []
while p != 0:
S = [p%2] + S[:]
p //= 2
frac = 1
for i in range(N - 1):
frac *= i+1
frac %= mod
T = 0
for i in range(N - 1):
k = 1
for j in range(len(S)):
if S[j] == 1:
k *= i+1
... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e+9 + 7)
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x
frac = 1
for i in range(N - 1):
frac *= i+1
frac %= mod
T = 0
... | 25 | 20 | 449 | 425 | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
p = mod - 2
S = []
while p != 0:
S = [p % 2] + S[:]
p //= 2
frac = 1
for i in range(N - 1):
frac *= i + 1
frac %= mod
T = 0
for i in range(N - 1):
k = 1
for j in range(len(S)):
if S[j] == 1:
k *= i ... | N = int(eval(input()))
A = list(map(int, input().split()))
mod = int(1e9 + 7)
def inved(a):
x, y, u, v, k, l = 1, 0, 0, 1, a, mod
while l != 0:
x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
k, l = l, k % l
return x
frac = 1
for i in range(N - 1):
frac *= i + 1
frac %= mod... | false | 20 | [
"-p = mod - 2",
"-S = []",
"-while p != 0:",
"- S = [p % 2] + S[:]",
"- p //= 2",
"+",
"+",
"+def inved(a):",
"+ x, y, u, v, k, l = 1, 0, 0, 1, a, mod",
"+ while l != 0:",
"+ x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)",
"+ k, l = l, k % l",
"+ return x... | false | 0.046072 | 0.08587 | 0.536532 | [
"s368615427",
"s665041538"
] |
u254871849 | p02948 | python | s983911394 | s627167645 | 1,968 | 266 | 26,720 | 24,932 | Accepted | Accepted | 86.48 | # 2019-11-16 14:51:41(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
from bisect import insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np
... | import sys
from heapq import heappush, heappop
n, m, *ab = list(map(int, sys.stdin.read().split()))
ab = sorted(zip(*[iter(ab)] * 2))
def main():
res = [0] * m
hq = []
i = 0
for j in range(1, m+1):
while i < n:
a, b = ab[i]
if a <= j:
heapp... | 36 | 27 | 1,026 | 564 | # 2019-11-16 14:51:41(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
from bisect import insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np
# import he... | import sys
from heapq import heappush, heappop
n, m, *ab = list(map(int, sys.stdin.read().split()))
ab = sorted(zip(*[iter(ab)] * 2))
def main():
res = [0] * m
hq = []
i = 0
for j in range(1, m + 1):
while i < n:
a, b = ab[i]
if a <= j:
heappush(hq, -b)... | false | 25 | [
"-# 2019-11-16 14:51:41(JST)",
"+from heapq import heappush, heappop",
"-# import collections",
"-# import math",
"-# from string import ascii_lowercase, ascii_uppercase, digits",
"-from bisect import insort_left as in_l",
"+n, m, *ab = list(map(int, sys.stdin.read().split()))",
"+ab = sorted(zip(*[it... | false | 0.151034 | 0.035691 | 4.231702 | [
"s983911394",
"s627167645"
] |
u344959886 | p02713 | python | s894082868 | s703439307 | 1,229 | 943 | 8,964 | 75,160 | Accepted | Accepted | 23.27 | import math
k = int(eval(input()))
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
s1 = math.gcd(i, j)
for k in range(1, k + 1):
s += math.gcd(k, s1)
print(s)
| import math
from functools import reduce
def gcd_list(numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for k in range(1, k + 1):
s += gcd_list([i, j, k])
print(s)
| 10 | 15 | 205 | 278 | import math
k = int(eval(input()))
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
s1 = math.gcd(i, j)
for k in range(1, k + 1):
s += math.gcd(k, s1)
print(s)
| import math
from functools import reduce
def gcd_list(numbers):
return reduce(math.gcd, numbers)
k = int(eval(input()))
s = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for k in range(1, k + 1):
s += gcd_list([i, j, k])
print(s)
| false | 33.333333 | [
"+from functools import reduce",
"+",
"+",
"+def gcd_list(numbers):",
"+ return reduce(math.gcd, numbers)",
"+",
"- s1 = math.gcd(i, j)",
"- s += math.gcd(k, s1)",
"+ s += gcd_list([i, j, k])"
] | false | 0.103863 | 0.116642 | 0.890448 | [
"s894082868",
"s703439307"
] |
u644907318 | p03665 | python | s920581624 | s794291190 | 163 | 63 | 38,384 | 61,996 | Accepted | Accepted | 61.35 | N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
C = {0:0,1:0}
for i in range(N):
if A[i]%2==0:
C[0] += 1
else:
C[1] += 1
if P==0:
if C[1]==0:
n = 2**C[0]
else:
n = 2**C[0]*2**(C[1]-1)
else:
if C[1]==0:
n = 0
else:
... | N,P = list(map(int,input().split()))
A = list(map(int,input().split()))
n0=0
n1=0
for i in range(N):
if A[i]%2==0:
n0 += 1
n1 = N-n0
if P==0:
if n1==0:
print((2**n0))
else:
print((2**(n1-1)*2**n0))
else:
if n1==0:
print((0))
else:
print((2**(n... | 19 | 18 | 354 | 318 | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
C = {0: 0, 1: 0}
for i in range(N):
if A[i] % 2 == 0:
C[0] += 1
else:
C[1] += 1
if P == 0:
if C[1] == 0:
n = 2 ** C[0]
else:
n = 2 ** C[0] * 2 ** (C[1] - 1)
else:
if C[1] == 0:
n = 0
... | N, P = list(map(int, input().split()))
A = list(map(int, input().split()))
n0 = 0
n1 = 0
for i in range(N):
if A[i] % 2 == 0:
n0 += 1
n1 = N - n0
if P == 0:
if n1 == 0:
print((2**n0))
else:
print((2 ** (n1 - 1) * 2**n0))
else:
if n1 == 0:
print((0))
else:
prin... | false | 5.263158 | [
"-C = {0: 0, 1: 0}",
"+n0 = 0",
"+n1 = 0",
"- C[0] += 1",
"+ n0 += 1",
"+n1 = N - n0",
"+if P == 0:",
"+ if n1 == 0:",
"+ print((2**n0))",
"- C[1] += 1",
"-if P == 0:",
"- if C[1] == 0:",
"- n = 2 ** C[0]",
"+ print((2 ** (n1 - 1) * 2**n0))",... | false | 0.036941 | 0.059578 | 0.620055 | [
"s920581624",
"s794291190"
] |
u130900604 | p03162 | python | s704801990 | s406567268 | 503 | 464 | 26,700 | 26,740 | Accepted | Accepted | 7.75 | n=int(eval(input()))
a=[0]*(n)
b=[0]*(n)
c=[0]*(n)
for _ in range(n):a[_],b[_],c[_]=list(map(int,input().split()))
INF=float("inf")
dpa=[-INF]*n
dpb=[-INF]*n
dpc=[-INF]*n
dpa[0]=a[0]
dpb[0]=b[0]
dpc[0]=c[0]
for i in range(1,n):
dpa[i]=a[i]+max(dpb[i-1],dpc[i-1])
dpb[i]=b[i]+max(dpc[i-1],dpa[i-... | n=int(eval(input()))
a=[0]*(n)
b=[0]*(n)
c=[0]*(n)
for i in range(n):
a[i],b[i],c[i]=list(map(int,input().split()))
INF=float("inf")
dpa=[-INF]*n
dpb=[-INF]*n
dpc=[-INF]*n
dpa[0]=a[0]
dpb[0]=b[0]
dpc[0]=c[0]
for i in range(1,n):
dpa[i]=a[i]+max(dpb[i-1],dpc[i-1])
dpb[i]=b[i]+max(dpc[i-1],... | 23 | 24 | 405 | 411 | n = int(eval(input()))
a = [0] * (n)
b = [0] * (n)
c = [0] * (n)
for _ in range(n):
a[_], b[_], c[_] = list(map(int, input().split()))
INF = float("inf")
dpa = [-INF] * n
dpb = [-INF] * n
dpc = [-INF] * n
dpa[0] = a[0]
dpb[0] = b[0]
dpc[0] = c[0]
for i in range(1, n):
dpa[i] = a[i] + max(dpb[i - 1], dpc[i - 1])... | n = int(eval(input()))
a = [0] * (n)
b = [0] * (n)
c = [0] * (n)
for i in range(n):
a[i], b[i], c[i] = list(map(int, input().split()))
INF = float("inf")
dpa = [-INF] * n
dpb = [-INF] * n
dpc = [-INF] * n
dpa[0] = a[0]
dpb[0] = b[0]
dpc[0] = c[0]
for i in range(1, n):
dpa[i] = a[i] + max(dpb[i - 1], dpc[i - 1])... | false | 4.166667 | [
"-for _ in range(n):",
"- a[_], b[_], c[_] = list(map(int, input().split()))",
"+for i in range(n):",
"+ a[i], b[i], c[i] = list(map(int, input().split()))"
] | false | 0.106233 | 0.040235 | 2.640333 | [
"s704801990",
"s406567268"
] |
u127499732 | p02796 | python | s424631297 | s505083597 | 892 | 555 | 59,160 | 20,872 | Accepted | Accepted | 37.78 | n = int(eval(input()))
l = []
for _ in range(n):
x,y = list(map(int, input().split()))
l.append([x+y,x-y])
l.sort()
temp = l[0][0]
count = n
i = 1
for i in range(1,n):
if temp <= l[i][1]:
temp = l[i][0]
else:
temp = min(temp,l[i][0])
count -= 1
print(count) | n = int(eval(input()))
l = []
for _ in range(n):
x,y = list(map(int, input().split()))
l.append([x+y,x-y])
l=sorted(l)
tmp = l[0][0]
count = n
for p in l[1:]:
if tmp <= p[1]:
tmp = p[0]
else:
tmp = min(tmp,p[0])
count -= 1
print(count) | 17 | 16 | 282 | 261 | n = int(eval(input()))
l = []
for _ in range(n):
x, y = list(map(int, input().split()))
l.append([x + y, x - y])
l.sort()
temp = l[0][0]
count = n
i = 1
for i in range(1, n):
if temp <= l[i][1]:
temp = l[i][0]
else:
temp = min(temp, l[i][0])
count -= 1
print(count)
| n = int(eval(input()))
l = []
for _ in range(n):
x, y = list(map(int, input().split()))
l.append([x + y, x - y])
l = sorted(l)
tmp = l[0][0]
count = n
for p in l[1:]:
if tmp <= p[1]:
tmp = p[0]
else:
tmp = min(tmp, p[0])
count -= 1
print(count)
| false | 5.882353 | [
"-l.sort()",
"-temp = l[0][0]",
"+l = sorted(l)",
"+tmp = l[0][0]",
"-i = 1",
"-for i in range(1, n):",
"- if temp <= l[i][1]:",
"- temp = l[i][0]",
"+for p in l[1:]:",
"+ if tmp <= p[1]:",
"+ tmp = p[0]",
"- temp = min(temp, l[i][0])",
"+ tmp = min(tmp, p[0... | false | 0.17266 | 0.039308 | 4.392482 | [
"s424631297",
"s505083597"
] |
u630511239 | p03457 | python | s744652398 | s035219951 | 369 | 242 | 3,064 | 9,040 | Accepted | Accepted | 34.42 | N = int(eval(input()))
T = 0
X = 0
Y = 0
ans = 'Yes'
for i in range(N):
t, x, y = list(map(int, input().split()))
if abs(X-x)+abs(Y-y)>abs(T-t) or (((X-x)+(Y-y))-(T - t))%2==1:
ans = 'No'
else:
T = t
X = x
Y = y
print(ans) | N = int(eval(input()))
xc, yc, tc = 0, 0, 0
ans = 'Yes'
for i in range(N):
t, x, y = list(map(int, input().split()))
if (t - tc - abs(x-xc) - abs(y-yc)) % 2 == 0 and t - tc - abs(x-xc) - abs(y-yc) >= 0:
xc, yc, tc = x, y, t
else:
ans = 'No'
break
print(ans)
| 15 | 12 | 251 | 277 | N = int(eval(input()))
T = 0
X = 0
Y = 0
ans = "Yes"
for i in range(N):
t, x, y = list(map(int, input().split()))
if abs(X - x) + abs(Y - y) > abs(T - t) or (((X - x) + (Y - y)) - (T - t)) % 2 == 1:
ans = "No"
else:
T = t
X = x
Y = y
print(ans)
| N = int(eval(input()))
xc, yc, tc = 0, 0, 0
ans = "Yes"
for i in range(N):
t, x, y = list(map(int, input().split()))
if (t - tc - abs(x - xc) - abs(y - yc)) % 2 == 0 and t - tc - abs(x - xc) - abs(
y - yc
) >= 0:
xc, yc, tc = x, y, t
else:
ans = "No"
break
print(ans)
| false | 20 | [
"-T = 0",
"-X = 0",
"-Y = 0",
"+xc, yc, tc = 0, 0, 0",
"- if abs(X - x) + abs(Y - y) > abs(T - t) or (((X - x) + (Y - y)) - (T - t)) % 2 == 1:",
"+ if (t - tc - abs(x - xc) - abs(y - yc)) % 2 == 0 and t - tc - abs(x - xc) - abs(",
"+ y - yc",
"+ ) >= 0:",
"+ xc, yc, tc = x, y,... | false | 0.045491 | 0.082399 | 0.552083 | [
"s744652398",
"s035219951"
] |
u754022296 | p04013 | python | s051169178 | s226211722 | 302 | 150 | 68,716 | 12,492 | Accepted | Accepted | 50.33 | n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
dp = [ [[0]*(n*a+1) for j in range(i+1)] for i in range(n+1) ]
for i in range(n+1):
dp[i][0][0] = 1
for i in range(n):
for j in range(i+1):
for k in range(n*a+1):
if X[i] > k:
if i > j:
dp[i+1][j+1][k] =... | import numpy as np
n,a = list(map(int, input().split()))
X = np.array(input().split(), dtype=np.int64)
Y = X-a
U = max(X.max(), a) * n
dp = np.zeros(2*U+1, dtype=np.int64)
dp[U] = 1
for i in range(n):
y = Y[i]
if y >= 0:
dp[y:] = dp[y:] + dp[:2*U+1-y]
else:
dp[:y] = dp[:y] + dp[-y:]
print((... | 20 | 15 | 553 | 321 | n, a = list(map(int, input().split()))
X = list(map(int, input().split()))
dp = [[[0] * (n * a + 1) for j in range(i + 1)] for i in range(n + 1)]
for i in range(n + 1):
dp[i][0][0] = 1
for i in range(n):
for j in range(i + 1):
for k in range(n * a + 1):
if X[i] > k:
if i > j:... | import numpy as np
n, a = list(map(int, input().split()))
X = np.array(input().split(), dtype=np.int64)
Y = X - a
U = max(X.max(), a) * n
dp = np.zeros(2 * U + 1, dtype=np.int64)
dp[U] = 1
for i in range(n):
y = Y[i]
if y >= 0:
dp[y:] = dp[y:] + dp[: 2 * U + 1 - y]
else:
dp[:y] = dp[:y] + d... | false | 25 | [
"+import numpy as np",
"+",
"-X = list(map(int, input().split()))",
"-dp = [[[0] * (n * a + 1) for j in range(i + 1)] for i in range(n + 1)]",
"-for i in range(n + 1):",
"- dp[i][0][0] = 1",
"+X = np.array(input().split(), dtype=np.int64)",
"+Y = X - a",
"+U = max(X.max(), a) * n",
"+dp = np.ze... | false | 0.04015 | 0.174324 | 0.230317 | [
"s051169178",
"s226211722"
] |
u606045429 | p02973 | python | s701316409 | s766462580 | 223 | 88 | 8,600 | 14,092 | Accepted | Accepted | 60.54 | from bisect import bisect
N = int(eval(input()))
A = [-int(eval(input())) for _ in range(N)]
L = [A[0]]
for a in A[1:]:
if a >= L[-1]:
L.append(a)
else:
L[bisect(L, a)] = a
print((len(L))) | from bisect import bisect_right
N, *A = list(map(int, open(0).read().split()))
A.reverse()
dp = [A[0]]
for a in A[1:]:
if dp[-1] <= a:
dp.append(a)
else:
dp[bisect_right(dp, a)] = a
print((len(dp)))
| 10 | 14 | 207 | 232 | from bisect import bisect
N = int(eval(input()))
A = [-int(eval(input())) for _ in range(N)]
L = [A[0]]
for a in A[1:]:
if a >= L[-1]:
L.append(a)
else:
L[bisect(L, a)] = a
print((len(L)))
| from bisect import bisect_right
N, *A = list(map(int, open(0).read().split()))
A.reverse()
dp = [A[0]]
for a in A[1:]:
if dp[-1] <= a:
dp.append(a)
else:
dp[bisect_right(dp, a)] = a
print((len(dp)))
| false | 28.571429 | [
"-from bisect import bisect",
"+from bisect import bisect_right",
"-N = int(eval(input()))",
"-A = [-int(eval(input())) for _ in range(N)]",
"-L = [A[0]]",
"+N, *A = list(map(int, open(0).read().split()))",
"+A.reverse()",
"+dp = [A[0]]",
"- if a >= L[-1]:",
"- L.append(a)",
"+ if d... | false | 0.126387 | 0.035593 | 3.550936 | [
"s701316409",
"s766462580"
] |
u899909022 | p02972 | python | s401780760 | s810103905 | 1,085 | 949 | 12,028 | 10,612 | Accepted | Accepted | 12.53 | N=int(eval(input()))
A=list(map(int,input().split()))
B=[0] * N
ans = []
for i in reversed(list(range(1, N+1))):
a = A[i-1]
for j in range(1, N+1):
tmp = i * j
if tmp > N:
break
a += B[tmp-1]
if a % 2 == 1:
ans.append(i)
B[i-1] = a % 2
print((len... | N=int(eval(input()))
A=list(map(int,input().split()))
ans = []
for i in reversed(list(range(1, N+1))):
a = A[i-1]
for j in range(2, N+1):
tmp = i * j
if tmp > N:
break
a += A[tmp-1]
if a % 2 == 1:
ans.append(i)
A[i-1] = a % 2
print((len(ans)))
fo... | 17 | 16 | 342 | 331 | N = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * N
ans = []
for i in reversed(list(range(1, N + 1))):
a = A[i - 1]
for j in range(1, N + 1):
tmp = i * j
if tmp > N:
break
a += B[tmp - 1]
if a % 2 == 1:
ans.append(i)
B[i - 1] = a % 2
print((... | N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
for i in reversed(list(range(1, N + 1))):
a = A[i - 1]
for j in range(2, N + 1):
tmp = i * j
if tmp > N:
break
a += A[tmp - 1]
if a % 2 == 1:
ans.append(i)
A[i - 1] = a % 2
print((len(ans)))
f... | false | 5.882353 | [
"-B = [0] * N",
"- for j in range(1, N + 1):",
"+ for j in range(2, N + 1):",
"- a += B[tmp - 1]",
"+ a += A[tmp - 1]",
"- B[i - 1] = a % 2",
"+ A[i - 1] = a % 2"
] | false | 0.045876 | 0.047311 | 0.969655 | [
"s401780760",
"s810103905"
] |
u893063840 | p02831 | python | s219212876 | s705664530 | 28 | 17 | 2,940 | 2,940 | Accepted | Accepted | 39.29 | a, b = list(map(int, input().split()))
mx = max(a, b)
gcd = 1
for i in range(1, mx + 1):
if a % i == 0 and b % i == 0:
gcd = i
ans = a * b // gcd
print(ans)
| def gcd(x, y):
if x == 0:
return y
x, y = y % x, x
return gcd(x, y)
a, b = list(map(int, input().split()))
ans = a * b // gcd(a, b)
print(ans)
| 11 | 12 | 176 | 172 | a, b = list(map(int, input().split()))
mx = max(a, b)
gcd = 1
for i in range(1, mx + 1):
if a % i == 0 and b % i == 0:
gcd = i
ans = a * b // gcd
print(ans)
| def gcd(x, y):
if x == 0:
return y
x, y = y % x, x
return gcd(x, y)
a, b = list(map(int, input().split()))
ans = a * b // gcd(a, b)
print(ans)
| false | 8.333333 | [
"+def gcd(x, y):",
"+ if x == 0:",
"+ return y",
"+ x, y = y % x, x",
"+ return gcd(x, y)",
"+",
"+",
"-mx = max(a, b)",
"-gcd = 1",
"-for i in range(1, mx + 1):",
"- if a % i == 0 and b % i == 0:",
"- gcd = i",
"-ans = a * b // gcd",
"+ans = a * b // gcd(a, b)"
] | false | 0.053286 | 0.109624 | 0.486082 | [
"s219212876",
"s705664530"
] |
u142693157 | p02990 | python | s273306691 | s778017108 | 549 | 202 | 3,444 | 3,444 | Accepted | Accepted | 63.21 | import sys
sys.setrecursionlimit(100000)
n, blue = list(map(int, input().split()))
red = n - blue
waru = 10**9+7
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
... | from math import factorial
n, blue = list(map(int, input().split()))
red = n - blue
mod = 10**9+7
def cmb(n, r):
result = factorial(n) // (factorial(n-r)*factorial(r))
return result
for i in range(1, blue+1, 1):
if red + 1 < i:
print((0))
else:
ans = cmb(red+1, i) ... | 40 | 19 | 874 | 376 | import sys
sys.setrecursionlimit(100000)
n, blue = list(map(int, input().split()))
red = n - blue
waru = 10**9 + 7
def cmb(n, r):
if n - r < r:
r = n - r
if r == 0:
return 1
if r == 1:
return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in ran... | from math import factorial
n, blue = list(map(int, input().split()))
red = n - blue
mod = 10**9 + 7
def cmb(n, r):
result = factorial(n) // (factorial(n - r) * factorial(r))
return result
for i in range(1, blue + 1, 1):
if red + 1 < i:
print((0))
else:
ans = cmb(red + 1, i) * cmb(bl... | false | 52.5 | [
"-import sys",
"+from math import factorial",
"-sys.setrecursionlimit(100000)",
"-waru = 10**9 + 7",
"+mod = 10**9 + 7",
"- if n - r < r:",
"- r = n - r",
"- if r == 0:",
"- return 1",
"- if r == 1:",
"- return n",
"- numerator = [n - r + k + 1 for k in range(r... | false | 0.039732 | 0.041767 | 0.951286 | [
"s273306691",
"s778017108"
] |
u014333473 | p03775 | python | s448458817 | s164725199 | 40 | 35 | 9,348 | 9,324 | Accepted | Accepted | 12.5 | n,r=int(eval(input())),1e9
for i in range(1,int(n**.5)+1):
if n%i==0:r=min(r,len(str(n//i)))
print(r) | n,r=int(eval(input())),1e9
print((min([len(str(n//i)) for i in range(1,int(n**.5)+1) if n%i==0]))) | 4 | 2 | 100 | 91 | n, r = int(eval(input())), 1e9
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
r = min(r, len(str(n // i)))
print(r)
| n, r = int(eval(input())), 1e9
print((min([len(str(n // i)) for i in range(1, int(n**0.5) + 1) if n % i == 0])))
| false | 50 | [
"-for i in range(1, int(n**0.5) + 1):",
"- if n % i == 0:",
"- r = min(r, len(str(n // i)))",
"-print(r)",
"+print((min([len(str(n // i)) for i in range(1, int(n**0.5) + 1) if n % i == 0])))"
] | false | 0.040443 | 0.038224 | 1.058028 | [
"s448458817",
"s164725199"
] |
u790710233 | p03283 | python | s359118428 | s671745582 | 1,412 | 911 | 34,160 | 34,192 | Accepted | Accepted | 35.48 | import numpy as np
n, m, q = map(int, input().split())
cnt = [[0]*(n+1)for _ in range(n+1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(
*[tuple(map(int, input().split())) for _ in range(q)]))
ans = S[... | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = [[0]*(n+1)for _ in range(n+1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(
*[tuple(map(int, input().spli... | 15 | 17 | 380 | 420 | import numpy as np
n, m, q = map(int, input().split())
cnt = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[tuple(map(int, input().split())) for _ in range(q)]))
ans = S[R, R] - S[R, L... | import numpy as np
import sys
input = sys.stdin.readline
n, m, q = map(int, input().split())
cnt = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
L, R = map(int, input().split())
cnt[L][R] += 1
S = np.cumsum(cnt, axis=0).cumsum(axis=1)
L, R = map(np.array, zip(*[tuple(map(int, input().split())) for _... | false | 11.764706 | [
"+import sys",
"+input = sys.stdin.readline"
] | false | 0.447094 | 0.501697 | 0.891163 | [
"s359118428",
"s671745582"
] |
u191874006 | p02586 | python | s834871271 | s826466822 | 1,333 | 973 | 433,756 | 358,584 | Accepted | Accepted | 27.01 | #!/usr/bin/env python3
r, c, k = list(map(int, input().split()))
items = [[0] * (c+1) for _ in range(r+1)]
for _ in range(k):
R, C, V = list(map(int, input().split()))
items[R][C] = V
dp0 = [[0] * (c+1) for _ in range(r+1)]
dp1 = [[0] * (c+1) for _ in range(r+1)]
dp2 = [[0] * (c+1) for _ in range(r+1)... | #!/usr/bin/env python3
r, c, k = list(map(int, input().split()))
items = [[0] * (c+1) for _ in range(r+1)]
for _ in range(k):
R, C, V = list(map(int, input().split()))
items[R][C] = V
dp1 = [[0] * (c+1) for _ in range(r+1)]
dp2 = [[0] * (c+1) for _ in range(r+1)]
dp3 = [[0] * (c+1) for _ in range(r+1)... | 21 | 19 | 868 | 672 | #!/usr/bin/env python3
r, c, k = list(map(int, input().split()))
items = [[0] * (c + 1) for _ in range(r + 1)]
for _ in range(k):
R, C, V = list(map(int, input().split()))
items[R][C] = V
dp0 = [[0] * (c + 1) for _ in range(r + 1)]
dp1 = [[0] * (c + 1) for _ in range(r + 1)]
dp2 = [[0] * (c + 1) for _ in range(... | #!/usr/bin/env python3
r, c, k = list(map(int, input().split()))
items = [[0] * (c + 1) for _ in range(r + 1)]
for _ in range(k):
R, C, V = list(map(int, input().split()))
items[R][C] = V
dp1 = [[0] * (c + 1) for _ in range(r + 1)]
dp2 = [[0] * (c + 1) for _ in range(r + 1)]
dp3 = [[0] * (c + 1) for _ in range(... | false | 9.52381 | [
"-dp0 = [[0] * (c + 1) for _ in range(r + 1)]",
"- dp0[i][j] = max(",
"- dp0[i][j - 1], dp0[i - 1][j], dp1[i - 1][j], dp2[i - 1][j], dp3[i - 1][j]",
"- )",
"- dp0[i - 1][j] + items[i][j],",
"- dp0[i][j - 1] + items[i][j],",
"-ans = max(dp0[r][c], dp1[r][c],... | false | 0.034884 | 0.03698 | 0.943302 | [
"s834871271",
"s826466822"
] |
u513081876 | p03457 | python | s045351194 | s032333354 | 456 | 411 | 11,636 | 21,156 | Accepted | Accepted | 9.87 | N = int(eval(input()))
t, x, y = [0]*N, [0]*N, [0]*N
t[0], x[0], y[0] = list(map(int, input().split()))
if t[0] == x[0]+y[0] or ((-x[0]-y[0] + t[0]) > 0 and (-x[0]-y[0] + t[0]) % 2 == 0):
check = True
else:
check = False
for i in range(1, N):
tt, xx, yy = list(map(int, input().split()))
t[i]... | N = int(eval(input()))
txy = [0]*(N+1)
txy[0] = [0, 0, 0]
for i in range(1, N + 1):
txy[i] = [int(i) for i in input().split()]
for i in range(1, N + 1):
dis = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2])
time = txy[i][0] - txy[i-1][0]
if time < dis or (time - dis) % 2 != 0:
... | 21 | 14 | 614 | 370 | N = int(eval(input()))
t, x, y = [0] * N, [0] * N, [0] * N
t[0], x[0], y[0] = list(map(int, input().split()))
if t[0] == x[0] + y[0] or (
(-x[0] - y[0] + t[0]) > 0 and (-x[0] - y[0] + t[0]) % 2 == 0
):
check = True
else:
check = False
for i in range(1, N):
tt, xx, yy = list(map(int, input().split()))
... | N = int(eval(input()))
txy = [0] * (N + 1)
txy[0] = [0, 0, 0]
for i in range(1, N + 1):
txy[i] = [int(i) for i in input().split()]
for i in range(1, N + 1):
dis = abs(txy[i][1] - txy[i - 1][1]) + abs(txy[i][2] - txy[i - 1][2])
time = txy[i][0] - txy[i - 1][0]
if time < dis or (time - dis) % 2 != 0:
... | false | 33.333333 | [
"-t, x, y = [0] * N, [0] * N, [0] * N",
"-t[0], x[0], y[0] = list(map(int, input().split()))",
"-if t[0] == x[0] + y[0] or (",
"- (-x[0] - y[0] + t[0]) > 0 and (-x[0] - y[0] + t[0]) % 2 == 0",
"-):",
"- check = True",
"+txy = [0] * (N + 1)",
"+txy[0] = [0, 0, 0]",
"+for i in range(1, N + 1):",... | false | 0.037291 | 0.037027 | 1.007137 | [
"s045351194",
"s032333354"
] |
u839509562 | p02608 | python | s399531036 | s108904314 | 245 | 74 | 9,372 | 9,228 | Accepted | Accepted | 69.8 | import sys
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
ans = [0 for _ in range(n)]
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
tmp = pow(x, 2) + pow(y, 2) ... | import sys
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
ans = [0 for _ in range(n)]
for x in range(1, 101):
for y in range(x, 101):
for z in range(y, 101):
tmp = pow(x, 2) + pow(y, 2) ... | 30 | 29 | 760 | 716 | import sys
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
ans = [0 for _ in range(n)]
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
tmp = pow(x, 2) + pow(y, 2) + pow(z, 2) +... | import sys
input = sys.stdin.readline
def log(*args):
print(*args, file=sys.stderr)
def main():
n = int(input().rstrip())
ans = [0 for _ in range(n)]
for x in range(1, 101):
for y in range(x, 101):
for z in range(y, 101):
tmp = pow(x, 2) + pow(y, 2) + pow(z, 2) +... | false | 3.333333 | [
"- for y in range(1, 101):",
"- for z in range(1, 101):",
"+ for y in range(x, 101):",
"+ for z in range(y, 101):",
"- # if x == y == z:",
"- # ans[tmp - 1] = 1",
"- # elif x == y or y == z or z == x:",
"- ... | false | 0.061974 | 0.046081 | 1.344913 | [
"s399531036",
"s108904314"
] |
u037430802 | p03111 | python | s001692371 | s740552982 | 589 | 246 | 76,772 | 44,892 | Accepted | Accepted | 58.23 |
N,A,B,C = list(map(int, input().split()))
bamboos = [int(eval(input())) for _ in range(N)]
#print("---", bamboos)
ans = float("inf")
def solve(lst, idx):
global ans
if idx == N:
#print("qqqqq")
for i in range(3):
if len(lst[i]) == 0:
return
... |
N,A,B,C = list(map(int, input().split()))
bamboos = [int(eval(input())) for _ in range(N)]
#print("---", bamboos)
INF = float("inf")
ans = INF
def solve(idx, cnt_merge, a, b, c):
if idx == N:
if min(a,b,c) > 0:
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt_merge-3)
... | 33 | 22 | 869 | 618 | N, A, B, C = list(map(int, input().split()))
bamboos = [int(eval(input())) for _ in range(N)]
# print("---", bamboos)
ans = float("inf")
def solve(lst, idx):
global ans
if idx == N:
# print("qqqqq")
for i in range(3):
if len(lst[i]) == 0:
return
pa = 10 * (l... | N, A, B, C = list(map(int, input().split()))
bamboos = [int(eval(input())) for _ in range(N)]
# print("---", bamboos)
INF = float("inf")
ans = INF
def solve(idx, cnt_merge, a, b, c):
if idx == N:
if min(a, b, c) > 0:
return abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cnt_merge - 3)
el... | false | 33.333333 | [
"-ans = float(\"inf\")",
"+INF = float(\"inf\")",
"+ans = INF",
"-def solve(lst, idx):",
"- global ans",
"+def solve(idx, cnt_merge, a, b, c):",
"- # print(\"qqqqq\")",
"- for i in range(3):",
"- if len(lst[i]) == 0:",
"- return",
"- pa = 10 * (l... | false | 0.139546 | 0.066043 | 2.112951 | [
"s001692371",
"s740552982"
] |
u241159583 | p03403 | python | s631018577 | s755029088 | 228 | 146 | 14,044 | 20,632 | Accepted | Accepted | 35.96 | n = int(eval(input()))
a = [0] +list(map(int, input().split()))+[0]
money = [0]
for i in range(n+1):
money.append(abs(a[i]-a[i+1]))
ans = sum(money)
for i in range(n):
print((ans-sum(money[i+1:i+3])+abs(a[i]-a[i+2]))) | n = int(eval(input()))
A = [0]+ list(map(int, input().split())) + [0]
a = [0]
for i in range(1,n+2):
a.append(abs(A[i-1]-A[i]))
ans = sum(a)
for i in range(1,n+1):
x = ans - a[i] - a[i+1]
x += abs(A[i-1]-A[i+1])
print(x) | 9 | 10 | 222 | 239 | n = int(eval(input()))
a = [0] + list(map(int, input().split())) + [0]
money = [0]
for i in range(n + 1):
money.append(abs(a[i] - a[i + 1]))
ans = sum(money)
for i in range(n):
print((ans - sum(money[i + 1 : i + 3]) + abs(a[i] - a[i + 2])))
| n = int(eval(input()))
A = [0] + list(map(int, input().split())) + [0]
a = [0]
for i in range(1, n + 2):
a.append(abs(A[i - 1] - A[i]))
ans = sum(a)
for i in range(1, n + 1):
x = ans - a[i] - a[i + 1]
x += abs(A[i - 1] - A[i + 1])
print(x)
| false | 10 | [
"-a = [0] + list(map(int, input().split())) + [0]",
"-money = [0]",
"-for i in range(n + 1):",
"- money.append(abs(a[i] - a[i + 1]))",
"-ans = sum(money)",
"-for i in range(n):",
"- print((ans - sum(money[i + 1 : i + 3]) + abs(a[i] - a[i + 2])))",
"+A = [0] + list(map(int, input().split())) + [0... | false | 0.034548 | 0.038674 | 0.893303 | [
"s631018577",
"s755029088"
] |
u114641312 | p03147 | python | s888287593 | s317221159 | 155 | 17 | 12,436 | 2,940 | Accepted | Accepted | 89.03 | # 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)
... | 61 | 32 | 1,616 | 920 | # 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... | false | 47.540984 | [
"-import numpy as np",
"-",
"+# import numpy as np",
"-# ゼロでリストを分割する",
"-# def split_list(st):",
"-# lis = st.split(\"0\")",
"-# lis = [l for l in lis if l != \"\"]",
"-# return lis",
"-def split_list(lis, num=0):",
"- res = []",
"- tmp = []",
"- for i in lis:",
"- ... | false | 0.440471 | 0.037762 | 11.664367 | [
"s888287593",
"s317221159"
] |
u564902833 | p03037 | python | s079963104 | s238533572 | 465 | 428 | 57,468 | 57,468 | Accepted | Accepted | 7.96 | N, M = list(map(int, input().split()))
L, R = (
list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else
((), ())
)
x = 1
y = N
for l, r in zip(L, R):
x = max(l, x)
y = min(r, y)
ans = max(y - x + 1, 0)
print(ans)
| # 入力
N, M = list(map(int, input().split()))
L, R = (
list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else
((), ())
)
ans = max(min(R) - max(L) + 1, 0)
# 出力
print(ans)
| 13 | 11 | 242 | 190 | N, M = list(map(int, input().split()))
L, R = (
list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else ((), ())
)
x = 1
y = N
for l, r in zip(L, R):
x = max(l, x)
y = min(r, y)
ans = max(y - x + 1, 0)
print(ans)
| # 入力
N, M = list(map(int, input().split()))
L, R = (
list(zip(*(list(map(int, input().split())) for _ in range(M)))) if M else ((), ())
)
ans = max(min(R) - max(L) + 1, 0)
# 出力
print(ans)
| false | 15.384615 | [
"+# 入力",
"-x = 1",
"-y = N",
"-for l, r in zip(L, R):",
"- x = max(l, x)",
"- y = min(r, y)",
"-ans = max(y - x + 1, 0)",
"+ans = max(min(R) - max(L) + 1, 0)",
"+# 出力"
] | false | 0.039185 | 0.038254 | 1.024326 | [
"s079963104",
"s238533572"
] |
u493520238 | p02936 | python | s703487188 | s270037042 | 1,617 | 764 | 230,960 | 128,236 | Accepted | Accepted | 52.75 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, q = list(map(int, input().split()))
g = [ [] for _ in range(n) ]
for _ in range(n-1):
a, b = list(map(int, input().split()))
g[a-1].append(b-1)
g[b-1].append(a-1)
pl = [0] * n
for _ in range(q):
p, x = list(map(int, inp... | from collections import deque
def bfs(start, g, vals, n):
visited = [-1]*n
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
added_val = vals[curr_node]
for next_node in g[curr_node]:
if visited[next_node] >= 0: continue
visi... | 29 | 29 | 560 | 738 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, q = list(map(int, input().split()))
g = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = list(map(int, input().split()))
g[a - 1].append(b - 1)
g[b - 1].append(a - 1)
pl = [0] * n
for _ in range(q):
p, x = list(map(int, input().s... | from collections import deque
def bfs(start, g, vals, n):
visited = [-1] * n
q = deque([start])
visited[start] = 0
while q:
curr_node = q.popleft()
added_val = vals[curr_node]
for next_node in g[curr_node]:
if visited[next_node] >= 0:
continue
... | false | 0 | [
"-import sys",
"+from collections import deque",
"-input = sys.stdin.readline",
"-sys.setrecursionlimit(10**6)",
"+",
"+def bfs(start, g, vals, n):",
"+ visited = [-1] * n",
"+ q = deque([start])",
"+ visited[start] = 0",
"+ while q:",
"+ curr_node = q.popleft()",
"+ ... | false | 0.034823 | 0.040953 | 0.850301 | [
"s703487188",
"s270037042"
] |
u277971517 | p03662 | python | s020435900 | s199190283 | 757 | 638 | 74,016 | 60,064 | Accepted | Accepted | 15.72 |
def read_data():
N = int(eval(input()))
Es = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
Es[a - 1].append(b - 1)
Es[b - 1].append(a - 1)
return N, Es
def solve(N, Es):
if N == 2:
return "Snuke"
path = find_pa... | def read_data():
N = int(eval(input()))
Es = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
Es[a - 1].append(b - 1)
Es[b - 1].append(a - 1)
return N, Es
def solve(N, Es):
if N == 2:
return "Snuke"
visited = [0] * ... | 69 | 40 | 1,602 | 943 | def read_data():
N = int(eval(input()))
Es = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
Es[a - 1].append(b - 1)
Es[b - 1].append(a - 1)
return N, Es
def solve(N, Es):
if N == 2:
return "Snuke"
path = find_path(N, 0, N - ... | def read_data():
N = int(eval(input()))
Es = [[] for i in range(N)]
for i in range(N - 1):
a, b = list(map(int, input().split()))
Es[a - 1].append(b - 1)
Es[b - 1].append(a - 1)
return N, Es
def solve(N, Es):
if N == 2:
return "Snuke"
visited = [0] * N
f1 = ... | false | 42.028986 | [
"- path = find_path(N, 0, N - 1, Es)",
"- len_path = len(path)",
"- a = (len_path - 1) // 2",
"- b = a + 1",
"- p1 = path[a]",
"- p2 = path[b]",
"- e1 = count_edges(N, p1, p2, Es)",
"- e2 = N - e1",
"- if e1 > e2:",
"+ visited = [0] * N",
"+ f1 = [0]",
"+ fN... | false | 0.075367 | 0.089042 | 0.846419 | [
"s020435900",
"s199190283"
] |
u838644735 | p02928 | python | s653527116 | s223382026 | 245 | 226 | 42,476 | 41,692 | Accepted | Accepted | 7.76 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
intra, inter = 0, 0
for i in range(N):
ai = A[i]
for j in range(i, N):
aj = A[j]
if ai > aj:
intra += 1
for j in range(i + 1):
aj = A[j]
if ai > aj:
... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
... | 19 | 43 | 429 | 835 | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
mod = 10**9 + 7
intra, inter = 0, 0
for i in range(N):
ai = A[i]
for j in range(i, N):
aj = A[j]
if ai > aj:
intra += 1
for j in range(i + 1):
aj = A[j]
if ai > aj:
inter += 1
a... | N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
class Bit:
def __init__(self, n):
self.size = n
self.tree = [0] * (n + 1)
def sum(self, i):
ret = 0
while i > 0:
ret += self.tree[i]
i -= i & -i
return ret
def add(s... | false | 55.813953 | [
"-mod = 10**9 + 7",
"-intra, inter = 0, 0",
"+",
"+",
"+class Bit:",
"+ def __init__(self, n):",
"+ self.size = n",
"+ self.tree = [0] * (n + 1)",
"+",
"+ def sum(self, i):",
"+ ret = 0",
"+ while i > 0:",
"+ ret += self.tree[i]",
"+ ... | false | 0.044937 | 0.042676 | 1.052978 | [
"s653527116",
"s223382026"
] |
u327466606 | p03169 | python | s828991532 | s277734319 | 1,964 | 565 | 313,864 | 154,504 | Accepted | Accepted | 71.23 | from collections import defaultdict
import sys
from functools import lru_cache
sys.setrecursionlimit(100000)
N = int(eval(input()))
counts = [0,0,0]
for a in map(int,input().split()):
counts[a-1] += 1
A,B,C = counts
# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-... | from collections import defaultdict
N = int(eval(input()))
counts = [0,0,0]
for a in map(int,input().split()):
counts[a-1] += 1
A,B,C = counts
# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-1][j][k])+(j/N)(dp[i+1][j-1][k])+(k/N)(dp[i][j+1][k-1])+(N-i-j-k/N)(dp[i][j]... | 31 | 32 | 933 | 872 | from collections import defaultdict
import sys
from functools import lru_cache
sys.setrecursionlimit(100000)
N = int(eval(input()))
counts = [0, 0, 0]
for a in map(int, input().split()):
counts[a - 1] += 1
A, B, C = counts
# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-1][j][k])... | from collections import defaultdict
N = int(eval(input()))
counts = [0, 0, 0]
for a in map(int, input().split()):
counts[a - 1] += 1
A, B, C = counts
# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-1][j][k])+(j/N)(dp[i+1][j-1][k])+(k/N)(dp[i][j+1][k-1])+(N-i-j-k/N)(dp[i][j][k])+1... | false | 3.125 | [
"-import sys",
"-from functools import lru_cache",
"-sys.setrecursionlimit(100000)",
"-dp = [[[None] * (C + 1) for _ in range(B + C + 1)] for _ in range(A + B + C + 1)]",
"-dp[0][0][0] = 0",
"+dp = [",
"+ [[0] * (A + B + C + 1 - k - j) for j in range(B + C + 1 - k)] for k in range(C + 1)",
"+]",
... | false | 0.044074 | 0.037354 | 1.179897 | [
"s828991532",
"s277734319"
] |
u463950771 | p03000 | python | s800097332 | s015503023 | 19 | 17 | 2,940 | 3,064 | Accepted | Accepted | 10.53 | N,X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = 0
i = 1
while i - 1 < N:
#print("D, X", D, X)
D += L[i-1]
if X < D:
break
i += 1
print(i) | N,X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = [0 for _ in range(N+1)]
ans = 0
for i in range(1, N+1):
D[i] = D[i-1] + L[i-1]
for j in range(0, N+1):
if D[j] <= X:
ans += 1
print(ans) | 12 | 10 | 197 | 233 | N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = 0
i = 1
while i - 1 < N:
# print("D, X", D, X)
D += L[i - 1]
if X < D:
break
i += 1
print(i)
| N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
D = [0 for _ in range(N + 1)]
ans = 0
for i in range(1, N + 1):
D[i] = D[i - 1] + L[i - 1]
for j in range(0, N + 1):
if D[j] <= X:
ans += 1
print(ans)
| false | 16.666667 | [
"-D = 0",
"-i = 1",
"-while i - 1 < N:",
"- # print(\"D, X\", D, X)",
"- D += L[i - 1]",
"- if X < D:",
"- break",
"- i += 1",
"-print(i)",
"+D = [0 for _ in range(N + 1)]",
"+ans = 0",
"+for i in range(1, N + 1):",
"+ D[i] = D[i - 1] + L[i - 1]",
"+for j in range(0, ... | false | 0.037354 | 0.036372 | 1.026997 | [
"s800097332",
"s015503023"
] |
u284854859 | p03013 | python | s771986011 | s527067864 | 609 | 276 | 54,232 | 7,848 | Accepted | Accepted | 54.68 | import bisect
n,m = list(map(int,input().split()))
p = [0]*(n+1)
mod = 10**9+7
a = [int(eval(input())) for i in range(m)]
p[0]=1
for i in range(1,n+1):
k = bisect.bisect_left(a,i)
k2 = bisect.bisect_right(a,i)
if k == k2:
p[i] += p[i-1]
if i >= 2:
p[i] += p[i-2]
p[i] = p[i]%mo... | import bisect
n,m = list(map(int,input().split()))
mod = 10**9+7
a = [int(eval(input())) for i in range(m)]
#dp[i]:i段目に来る場合の数
dp = [0]*(n+1)
dp[0]=1
for i in range(1,n+1):
k = bisect.bisect_left(a,i)
k2 = bisect.bisect_right(a,i)
if k == k2:
dp[i] += dp[i-1]
if i >= 2:
dp[i] += dp[i... | 19 | 18 | 339 | 354 | import bisect
n, m = list(map(int, input().split()))
p = [0] * (n + 1)
mod = 10**9 + 7
a = [int(eval(input())) for i in range(m)]
p[0] = 1
for i in range(1, n + 1):
k = bisect.bisect_left(a, i)
k2 = bisect.bisect_right(a, i)
if k == k2:
p[i] += p[i - 1]
if i >= 2:
p[i] += p[i - ... | import bisect
n, m = list(map(int, input().split()))
mod = 10**9 + 7
a = [int(eval(input())) for i in range(m)]
# dp[i]:i段目に来る場合の数
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):
k = bisect.bisect_left(a, i)
k2 = bisect.bisect_right(a, i)
if k == k2:
dp[i] += dp[i - 1]
if i >= 2:
... | false | 5.263158 | [
"-p = [0] * (n + 1)",
"-p[0] = 1",
"+# dp[i]:i段目に来る場合の数",
"+dp = [0] * (n + 1)",
"+dp[0] = 1",
"- p[i] += p[i - 1]",
"+ dp[i] += dp[i - 1]",
"- p[i] += p[i - 2]",
"- p[i] = p[i] % mod",
"-# print(p)",
"-print((p[-1] % mod))",
"+ dp[i] += dp[i - 2]",
... | false | 0.047884 | 0.047208 | 1.014317 | [
"s771986011",
"s527067864"
] |
u427344224 | p03087 | python | s064408381 | s013375373 | 509 | 438 | 25,228 | 21,472 | Accepted | Accepted | 13.95 | N, Q = list(map(int, input().split()))
S = eval(input())
items = []
for i in range(Q):
items.append(tuple(map(int, input().split())))
from itertools import accumulate
prev = ""
acc = [0] * N
for i, s in enumerate(S):
if s == "C" and prev == "A":
acc[i] = 1
prev = s
acc = list(acc... | N, Q = list(map(int, input().split()))
S = eval(input())
items = []
for i in range(Q):
items.append(tuple(map(int, input().split())))
acc = [0] * N
for i in range(1, N):
if S[i] == "C" and S[i-1] == "A":
acc[i] += 1
from itertools import accumulate
acc = list(accumulate(acc))
for l, r in ... | 24 | 15 | 442 | 345 | N, Q = list(map(int, input().split()))
S = eval(input())
items = []
for i in range(Q):
items.append(tuple(map(int, input().split())))
from itertools import accumulate
prev = ""
acc = [0] * N
for i, s in enumerate(S):
if s == "C" and prev == "A":
acc[i] = 1
prev = s
acc = list(accumulate(acc))
ans =... | N, Q = list(map(int, input().split()))
S = eval(input())
items = []
for i in range(Q):
items.append(tuple(map(int, input().split())))
acc = [0] * N
for i in range(1, N):
if S[i] == "C" and S[i - 1] == "A":
acc[i] += 1
from itertools import accumulate
acc = list(accumulate(acc))
for l, r in items:
p... | false | 37.5 | [
"+acc = [0] * N",
"+for i in range(1, N):",
"+ if S[i] == \"C\" and S[i - 1] == \"A\":",
"+ acc[i] += 1",
"-prev = \"\"",
"-acc = [0] * N",
"-for i, s in enumerate(S):",
"- if s == \"C\" and prev == \"A\":",
"- acc[i] = 1",
"- prev = s",
"-ans = []",
"-for i in range(Q):... | false | 0.037238 | 0.037133 | 1.002814 | [
"s064408381",
"s013375373"
] |
u503294750 | p03211 | python | s779958984 | s868365620 | 31 | 27 | 9,176 | 9,192 | Accepted | Accepted | 12.9 | s=list(map(str,eval(input())))
lst=[]
for i in range(len(s)-2):
total=s[i]+s[i+1]+s[i+2]
ans=abs(753-int(total))
lst.append(ans)
print((min(lst))) | s=list(map(str,eval(input())))
ans=753-111 #最大値
for i in range(len(s)-2):
total=s[i]+s[i+1]+s[i+2]
new=abs(753-int(total))
ans=min(ans,new)
print(ans) | 10 | 10 | 154 | 160 | s = list(map(str, eval(input())))
lst = []
for i in range(len(s) - 2):
total = s[i] + s[i + 1] + s[i + 2]
ans = abs(753 - int(total))
lst.append(ans)
print((min(lst)))
| s = list(map(str, eval(input())))
ans = 753 - 111 # 最大値
for i in range(len(s) - 2):
total = s[i] + s[i + 1] + s[i + 2]
new = abs(753 - int(total))
ans = min(ans, new)
print(ans)
| false | 0 | [
"-lst = []",
"+ans = 753 - 111 # 最大値",
"- ans = abs(753 - int(total))",
"- lst.append(ans)",
"-print((min(lst)))",
"+ new = abs(753 - int(total))",
"+ ans = min(ans, new)",
"+print(ans)"
] | false | 0.045842 | 0.045346 | 1.01094 | [
"s779958984",
"s868365620"
] |
u707498674 | p03240 | python | s387393841 | s941614588 | 1,009 | 238 | 22,232 | 12,436 | Accepted | Accepted | 76.41 | import numpy as np
N = int(eval(input()))
x, y, h = np.array([list(map(int, input().split())) for i in range(N)]).T
"""
x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]
for i in range(N):
x[i], y[i], h[i] = map(int, input().split())
"""
H = 0
Cx = 0
Cy = 0
Flag = True
fo... | import numpy as np
N = int(eval(input()))
"""
x, y, h = np.array([list(map(int, input().split())) for i in range(N)]).T
"""
x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
H = 0
Cx = 0
Cy = 0
Flag = Tr... | 34 | 34 | 805 | 805 | import numpy as np
N = int(eval(input()))
x, y, h = np.array([list(map(int, input().split())) for i in range(N)]).T
"""
x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]
for i in range(N):
x[i], y[i], h[i] = map(int, input().split())
"""
H = 0
Cx = 0
Cy = 0
Flag = True
for i in range(10... | import numpy as np
N = int(eval(input()))
"""
x, y, h = np.array([list(map(int, input().split())) for i in range(N)]).T
"""
x = [0 for i in range(N)]
y = [0 for i in range(N)]
h = [0 for i in range(N)]
for i in range(N):
x[i], y[i], h[i] = list(map(int, input().split()))
H = 0
Cx = 0
Cy = 0
Flag = True
for i in ra... | false | 0 | [
"+\"\"\"",
"- x[i], y[i], h[i] = map(int, input().split())",
"-\"\"\"",
"+ x[i], y[i], h[i] = list(map(int, input().split()))"
] | false | 0.187584 | 0.040155 | 4.67151 | [
"s387393841",
"s941614588"
] |
u700805562 | p02598 | python | s901475777 | s540642796 | 1,363 | 1,194 | 30,896 | 30,768 | Accepted | Accepted | 12.4 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
max_a = 10**9
min_a = 0
while max_a-min_a>1:
count = K
mean_a = (max_a+min_a)//2
for i in range(N):
if a[i]<=mean_a: continue
count -= a[i]//mean_a
if count >= 0:
max_a = mean_a
els... | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
max_a = 10**9
min_a = 0
while max_a-min_a>1:
count = K
mean_a = (max_a+min_a)//2
for i in range(N):
count -= -(-a[i]//mean_a)-1
if count >= 0:
max_a = mean_a
else:
min_a = mean_a
print... | 18 | 16 | 356 | 321 | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
max_a = 10**9
min_a = 0
while max_a - min_a > 1:
count = K
mean_a = (max_a + min_a) // 2
for i in range(N):
if a[i] <= mean_a:
continue
count -= a[i] // mean_a
if count >= 0:
max_a = mean_a
... | N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
max_a = 10**9
min_a = 0
while max_a - min_a > 1:
count = K
mean_a = (max_a + min_a) // 2
for i in range(N):
count -= -(-a[i] // mean_a) - 1
if count >= 0:
max_a = mean_a
else:
min_a = mean_a
print(max_... | false | 11.111111 | [
"- if a[i] <= mean_a:",
"- continue",
"- count -= a[i] // mean_a",
"+ count -= -(-a[i] // mean_a) - 1"
] | false | 0.055287 | 0.03719 | 1.486612 | [
"s901475777",
"s540642796"
] |
u333945892 | p02936 | python | s354914928 | s782847597 | 1,518 | 1,331 | 156,400 | 141,308 | Accepted | Accepted | 12.32 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return li... | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return li... | 40 | 37 | 867 | 791 | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inp... | from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
INF = float("inf")
mod = 10**9 + 7
eps = 10**-7
def inp():
return int(sys.stdin.readline())
def inpl():
return list(map(int, sys.stdin.readline().split()))
def inp... | false | 7.5 | [
"- lines[b].add(a)",
"- visited[x] = True",
"- if not visited[t]:",
"- q.put([t, cnt])",
"+ q.put([t, cnt])"
] | false | 0.040212 | 0.042086 | 0.955461 | [
"s354914928",
"s782847597"
] |
u935184340 | p02257 | python | s597864798 | s539881392 | 90 | 80 | 7,756 | 7,780 | Accepted | Accepted | 11.11 | def composite(d,n,s):
for a in (2,3,5,7):
p = False
if pow(a,d,n) == 1:
p = True
continue
for i in range(s):
if pow(a, 2**i * d, n) == n-1:
p = True
break
return not p
return False
def is_prime(n):
... | def composite(d,n,s):
for a in (2,3,5,7):
p = False
if pow(a,d,n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n-1:
p = True
break
if not p:
return True
return False
def is_prime(n):
... | 32 | 32 | 663 | 689 | def composite(d, n, s):
for a in (2, 3, 5, 7):
p = False
if pow(a, d, n) == 1:
p = True
continue
for i in range(s):
if pow(a, 2**i * d, n) == n - 1:
p = True
break
return not p
return False
def is_prime(n):
... | def composite(d, n, s):
for a in (2, 3, 5, 7):
p = False
if pow(a, d, n) == 1:
continue
for i in range(s):
if pow(a, 2**i * d, n) == n - 1:
p = True
break
if not p:
return True
return False
def is_prime(n):
... | false | 0 | [
"- p = True",
"- return not p",
"+ if not p:",
"+ return True",
"- if n == 2:",
"+ if n in (2, 3, 5, 7):",
"- elif n % 2 == 0:",
"+ elif 0 in (n % 2, n % 3, n % 5, n % 7):"
] | false | 0.048582 | 0.04361 | 1.114021 | [
"s597864798",
"s539881392"
] |
u260216890 | p02559 | python | s920764020 | s287623413 | 1,661 | 814 | 162,452 | 147,388 | Accepted | Accepted | 50.99 | import sys
input = sys.stdin.readline
class segtree:
x_unit=0 # 単位元
x_func=sum # 関数
def __init__(self,n,seq):
self.n=n
self.x=[self.x_unit]*(2*n)
for i,j in enumerate(seq, self.n): # n番目からseqをx配列に移していく
self.x[i] = j
for i in range(self.n-1, 0, -1):
... | import sys
input = sys.stdin.readline
class segtree:
x_unit=0 # 単位元
x_func=lambda self,a:a[0]+a[1] # 関数
def __init__(self,n,seq):
self.n=n
self.x=[self.x_unit]*(2*n)
for i,j in enumerate(seq, self.n): # n番目からseqをx配列に移していく
self.x[i] = j
for i in range... | 45 | 45 | 1,320 | 1,340 | import sys
input = sys.stdin.readline
class segtree:
x_unit = 0 # 単位元
x_func = sum # 関数
def __init__(self, n, seq):
self.n = n
self.x = [self.x_unit] * (2 * n)
for i, j in enumerate(seq, self.n): # n番目からseqをx配列に移していく
self.x[i] = j
for i in range(self.n - 1,... | import sys
input = sys.stdin.readline
class segtree:
x_unit = 0 # 単位元
x_func = lambda self, a: a[0] + a[1] # 関数
def __init__(self, n, seq):
self.n = n
self.x = [self.x_unit] * (2 * n)
for i, j in enumerate(seq, self.n): # n番目からseqをx配列に移していく
self.x[i] = j
fo... | false | 0 | [
"- x_func = sum # 関数",
"+ x_func = lambda self, a: a[0] + a[1] # 関数"
] | false | 0.046556 | 0.046846 | 0.993812 | [
"s920764020",
"s287623413"
] |
u028973125 | p02765 | python | s747995452 | s100340877 | 173 | 28 | 38,384 | 9,160 | Accepted | Accepted | 83.82 | import sys
def solve(N, R):
print((R if N >= 10 else R + 100 * (10 - N)))
if __name__ == '__main__':
N, R = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(N, R) | import sys
N, R = list(map(int, sys.stdin.readline().split()))
print((R if 10 <= N else R + 100 * (10 - N))) | 8 | 4 | 188 | 104 | import sys
def solve(N, R):
print((R if N >= 10 else R + 100 * (10 - N)))
if __name__ == "__main__":
N, R = list(map(int, sys.stdin.readline().strip().split(" ")))
solve(N, R)
| import sys
N, R = list(map(int, sys.stdin.readline().split()))
print((R if 10 <= N else R + 100 * (10 - N)))
| false | 50 | [
"-",
"-def solve(N, R):",
"- print((R if N >= 10 else R + 100 * (10 - N)))",
"-",
"-",
"-if __name__ == \"__main__\":",
"- N, R = list(map(int, sys.stdin.readline().strip().split(\" \")))",
"- solve(N, R)",
"+N, R = list(map(int, sys.stdin.readline().split()))",
"+print((R if 10 <= N else... | false | 0.045884 | 0.008168 | 5.617606 | [
"s747995452",
"s100340877"
] |
u102461423 | p03225 | python | s552821299 | s076082259 | 1,069 | 921 | 34,472 | 27,240 | Accepted | Accepted | 13.84 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
import numpy as np
import itertools
H,W = list(map(int,readline().split()))
S = (np.frombuffer(read(),dtype='S1')==b'#').reshape(H,-1)[:,:W].astype(np.int64)
... | import sys
b=sys.stdin.buffer
import numpy as np
H,W=list(map(int,b.readline().split()));p=min(H,W)+1
S=np.pad((np.frombuffer(b.read(),dtype='S1')==b'#').reshape(H,-1)[:,:W].astype(int),(p,p),'constant')
a=0
for _ in[0]*4:
d=S[p:,p:].copy()
for n in range(H+p):d[n,:W]+=d[n-1,1:W+1]
for n in range(p):a+=(... | 41 | 12 | 972 | 451 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
import numpy as np
import itertools
H, W = list(map(int, readline().split()))
S = (np.frombuffer(read(), dtype="S1") == b"#").reshape(H, -1)[:, :W].astype(np.int64)
# pad_wi... | import sys
b = sys.stdin.buffer
import numpy as np
H, W = list(map(int, b.readline().split()))
p = min(H, W) + 1
S = np.pad(
(np.frombuffer(b.read(), dtype="S1") == b"#").reshape(H, -1)[:, :W].astype(int),
(p, p),
"constant",
)
a = 0
for _ in [0] * 4:
d = S[p:, p:].copy()
for n in range(H + p):
... | false | 70.731707 | [
"-read = sys.stdin.buffer.read",
"-readline = sys.stdin.buffer.readline",
"-readlines = sys.stdin.buffer.readlines",
"-sys.setrecursionlimit(10**7)",
"+b = sys.stdin.buffer",
"-import itertools",
"-H, W = list(map(int, readline().split()))",
"-S = (np.frombuffer(read(), dtype=\"S1\") == b\"#\").reshap... | false | 0.201136 | 0.199502 | 1.008192 | [
"s552821299",
"s076082259"
] |
u272028993 | p04008 | python | s969041329 | s261300107 | 892 | 397 | 153,268 | 108,236 | Accepted | Accepted | 55.49 | import sys
sys.setrecursionlimit(10**7)
def solve(s):
global ans
h=0
for i in ch[s]:
h=max(h,solve(i)+1)
if h==k-1 and a[s]!=0:
ans+=1
a[s]=0
return -1
return h
n,k=list(map(int,input().split()))
a=[int(x)-1 for x in input().split()]
ans=0
ch=[[] fo... | import sys
sys.setrecursionlimit(10 ** 6)
def dfs(now, par):
h = 0
global ans
for child in g[now]:
if child == par: continue
h = max(h, dfs(child, now))
if h == k - 1 and par != 0:
ans += 1
h = -1
return h + 1
n, k = list(map(int, input().split()))
a ... | 28 | 25 | 454 | 501 | import sys
sys.setrecursionlimit(10**7)
def solve(s):
global ans
h = 0
for i in ch[s]:
h = max(h, solve(i) + 1)
if h == k - 1 and a[s] != 0:
ans += 1
a[s] = 0
return -1
return h
n, k = list(map(int, input().split()))
a = [int(x) - 1 for x in input().split()]
ans ... | import sys
sys.setrecursionlimit(10**6)
def dfs(now, par):
h = 0
global ans
for child in g[now]:
if child == par:
continue
h = max(h, dfs(child, now))
if h == k - 1 and par != 0:
ans += 1
h = -1
return h + 1
n, k = list(map(int, input().split()))
a = ... | false | 10.714286 | [
"-sys.setrecursionlimit(10**7)",
"+sys.setrecursionlimit(10**6)",
"-def solve(s):",
"+def dfs(now, par):",
"+ h = 0",
"- h = 0",
"- for i in ch[s]:",
"- h = max(h, solve(i) + 1)",
"- if h == k - 1 and a[s] != 0:",
"+ for child in g[now]:",
"+ if child == par:",
"+ ... | false | 0.042018 | 0.042515 | 0.988299 | [
"s969041329",
"s261300107"
] |
u509150616 | p02596 | python | s014070347 | s366662103 | 184 | 72 | 9,036 | 63,428 | Accepted | Accepted | 60.87 | K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
print((-1))
else:
if K % 7 == 0:
L = 9 * K // 7
else:
L = 9 * K
n = 1
P = 10 % L
while True:
if P == 1:
print(n)
break
n += 1
P = (10 * P) % L | K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
print((-1))
else:
a = 1
b = a % K
i = 1
while True:
if (7*a) % K == 0:
print(i)
break
else:
a += (10*b) % K
b = (10*b) % K
i += 1 | 17 | 15 | 295 | 284 | K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
print((-1))
else:
if K % 7 == 0:
L = 9 * K // 7
else:
L = 9 * K
n = 1
P = 10 % L
while True:
if P == 1:
print(n)
break
n += 1
P = (10 * P) % L
| K = int(eval(input()))
if K % 2 == 0 or K % 5 == 0:
print((-1))
else:
a = 1
b = a % K
i = 1
while True:
if (7 * a) % K == 0:
print(i)
break
else:
a += (10 * b) % K
b = (10 * b) % K
i += 1
| false | 11.764706 | [
"- if K % 7 == 0:",
"- L = 9 * K // 7",
"- else:",
"- L = 9 * K",
"- n = 1",
"- P = 10 % L",
"+ a = 1",
"+ b = a % K",
"+ i = 1",
"- if P == 1:",
"- print(n)",
"+ if (7 * a) % K == 0:",
"+ print(i)",
"- n += 1",
... | false | 0.064261 | 0.323264 | 0.198787 | [
"s014070347",
"s366662103"
] |
u124498235 | p02819 | python | s759181300 | s758120657 | 26 | 17 | 3,060 | 2,940 | Accepted | Accepted | 34.62 | x = int(eval(input()))
flg = 0
def isPrimenum(n):
if n < 2:
return False
if n == 2:
return True
for p in range(2, n):
if n % p == 0:
return False
return True
while flg == 0:
if isPrimenum(x) == True:
flg = 1
break
x += 1
print (x)
| import math
n = int(eval(input()))
def check(s):
if s == 1:
return False
for i in range(2, int(math.sqrt(s)) + 1):
if s%i == 0:
return False
return True
for i in range(n,10**6):
if check(i):
print (i)
exit()
| 17 | 15 | 260 | 233 | x = int(eval(input()))
flg = 0
def isPrimenum(n):
if n < 2:
return False
if n == 2:
return True
for p in range(2, n):
if n % p == 0:
return False
return True
while flg == 0:
if isPrimenum(x) == True:
flg = 1
break
x += 1
print(x)
| import math
n = int(eval(input()))
def check(s):
if s == 1:
return False
for i in range(2, int(math.sqrt(s)) + 1):
if s % i == 0:
return False
return True
for i in range(n, 10**6):
if check(i):
print(i)
exit()
| false | 11.764706 | [
"-x = int(eval(input()))",
"-flg = 0",
"+import math",
"+",
"+n = int(eval(input()))",
"-def isPrimenum(n):",
"- if n < 2:",
"+def check(s):",
"+ if s == 1:",
"- if n == 2:",
"- return True",
"- for p in range(2, n):",
"- if n % p == 0:",
"+ for i in range(2, i... | false | 0.044484 | 0.107659 | 0.413195 | [
"s759181300",
"s758120657"
] |
u762420987 | p02767 | python | s345476956 | s631074267 | 178 | 21 | 38,896 | 3,060 | Accepted | Accepted | 88.2 | N = int(eval(input()))
Xlist = list(map(int, input().split()))
ans = 10**9+7
for i in range(1, 101):
p = 0
for x in Xlist:
p += (x-i)**2
ans = min(ans, p)
print(ans) | N = int(eval(input()))
Xlist = list(map(int, input().split()))
ans = 10**9
for p in range(min(Xlist), max(Xlist)+1):
cost = 0
for x in Xlist:
cost += (x - p)**2
ans = min(ans, cost)
print(ans) | 9 | 9 | 187 | 214 | N = int(eval(input()))
Xlist = list(map(int, input().split()))
ans = 10**9 + 7
for i in range(1, 101):
p = 0
for x in Xlist:
p += (x - i) ** 2
ans = min(ans, p)
print(ans)
| N = int(eval(input()))
Xlist = list(map(int, input().split()))
ans = 10**9
for p in range(min(Xlist), max(Xlist) + 1):
cost = 0
for x in Xlist:
cost += (x - p) ** 2
ans = min(ans, cost)
print(ans)
| false | 0 | [
"-ans = 10**9 + 7",
"-for i in range(1, 101):",
"- p = 0",
"+ans = 10**9",
"+for p in range(min(Xlist), max(Xlist) + 1):",
"+ cost = 0",
"- p += (x - i) ** 2",
"- ans = min(ans, p)",
"+ cost += (x - p) ** 2",
"+ ans = min(ans, cost)"
] | false | 0.038299 | 0.037895 | 1.010662 | [
"s345476956",
"s631074267"
] |
u429029348 | p02842 | python | s537578874 | s942103393 | 38 | 35 | 9,104 | 9,076 | Accepted | Accepted | 7.89 | n=int(eval(input()))
ans=-1
for i in range(1,n+1):
if int(i*1.08)==n:
ans=i
if ans!=-1:
print(ans)
else:
print(":(") | import math
n=int(eval(input()))
for i in range(1,n+1):
if math.floor(i*1.08)==n:
print(i)
break
else:
continue
else:
print(":(")
| 11 | 10 | 132 | 151 | n = int(eval(input()))
ans = -1
for i in range(1, n + 1):
if int(i * 1.08) == n:
ans = i
if ans != -1:
print(ans)
else:
print(":(")
| import math
n = int(eval(input()))
for i in range(1, n + 1):
if math.floor(i * 1.08) == n:
print(i)
break
else:
continue
else:
print(":(")
| false | 9.090909 | [
"+import math",
"+",
"-ans = -1",
"- if int(i * 1.08) == n:",
"- ans = i",
"-if ans != -1:",
"- print(ans)",
"+ if math.floor(i * 1.08) == n:",
"+ print(i)",
"+ break",
"+ else:",
"+ continue"
] | false | 0.093591 | 0.04243 | 2.205792 | [
"s537578874",
"s942103393"
] |
u191874006 | p03044 | python | s395191972 | s799381588 | 837 | 486 | 48,968 | 66,464 | Accepted | Accepted | 41.94 | N = int(eval(input()))
connect_list = [[] for i in range(N)]
for i in range(N-1):
u,v,w = list(map(int,input().split()))
u -= 1
v -= 1
connect_list[u].append([v,w])
connect_list[v].append([u,w])
#print(connect_list)
d = [0]+[-1 for i in range(N-1)]
stack = []
stack.append(0)
while len(... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from co... | 25 | 43 | 598 | 1,016 | N = int(eval(input()))
connect_list = [[] for i in range(N)]
for i in range(N - 1):
u, v, w = list(map(int, input().split()))
u -= 1
v -= 1
connect_list[u].append([v, w])
connect_list[v].append([u, w])
# print(connect_list)
d = [0] + [-1 for i in range(N - 1)]
stack = []
stack.append(0)
while len(st... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections ... | false | 41.860465 | [
"-N = int(eval(input()))",
"-connect_list = [[] for i in range(N)]",
"-for i in range(N - 1):",
"- u, v, w = list(map(int, input().split()))",
"- u -= 1",
"- v -= 1",
"- connect_list[u].append([v, w])",
"- connect_list[v].append([u, w])",
"-# print(connect_list)",
"-d = [0] + [-1 fo... | false | 0.038226 | 0.039374 | 0.970834 | [
"s395191972",
"s799381588"
] |
u389910364 | p03436 | python | s061116651 | s313200676 | 179 | 164 | 12,700 | 13,656 | Accepted | Accepted | 8.38 | import sys
from collections import deque
import numpy as np
sys.setrecursionlimit(10000)
INF = float('inf')
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
S = np.array(S)
# distances[h, w]: (h, w) に行くまでに通る '.' の数
distances = np.empty((H, W), dtype=int)
distances.fil... | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
... | 45 | 57 | 1,217 | 1,223 | import sys
from collections import deque
import numpy as np
sys.setrecursionlimit(10000)
INF = float("inf")
H, W = list(map(int, input().split()))
S = [list(eval(input())) for _ in range(H)]
S = np.array(S)
# distances[h, w]: (h, w) に行くまでに通る '.' の数
distances = np.empty((H, W), dtype=int)
distances.fill(-1)
que = deque... | import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter
import numpy as... | false | 21.052632 | [
"+import bisect",
"+import heapq",
"+import itertools",
"+import math",
"+import os",
"+import re",
"+import string",
"-from collections import deque",
"+from collections import Counter, deque, defaultdict",
"+from copy import deepcopy",
"+from decimal import Decimal",
"+from fractions import ... | false | 0.72879 | 0.102095 | 7.13836 | [
"s061116651",
"s313200676"
] |
u124498235 | p02768 | python | s135865002 | s843249254 | 177 | 142 | 38,512 | 3,064 | Accepted | Accepted | 19.77 | n, a, b = list(map(int, input().split()))
mod = 10**9+7
c = pow(2,n,mod)
def nCr(n, r, mod):
r = min(r, n-r)
numer = denom = 1
for i in range(1, r+1):
numer = numer * (n+1-i) % mod
denom = denom * i % mod
return numer * pow(denom, mod-2, mod) % mod
c -= 1
aa = nCr(n,a,mod)
bb = nCr(n,b,mod)
c -= (a... | n, a, b = list(map(int, input().split()))
mod = 10**9+7
def nCr(N, R, mod):
R = min(R, N-R)
numer = denom = 1
for i in range(1, R+1):
numer = numer * (N+1-i) % mod
denom = denom * i % mod
return numer * pow(denom, mod-2, mod) % mod
ans = pow(2,n,mod)
ans -= 1
ans -= nCr(n,a,mod)
ans %= mod
ans ... | 15 | 18 | 335 | 354 | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
c = pow(2, n, mod)
def nCr(n, r, mod):
r = min(r, n - r)
numer = denom = 1
for i in range(1, r + 1):
numer = numer * (n + 1 - i) % mod
denom = denom * i % mod
return numer * pow(denom, mod - 2, mod) % mod
c -= 1
aa = nCr(n, a,... | n, a, b = list(map(int, input().split()))
mod = 10**9 + 7
def nCr(N, R, mod):
R = min(R, N - R)
numer = denom = 1
for i in range(1, R + 1):
numer = numer * (N + 1 - i) % mod
denom = denom * i % mod
return numer * pow(denom, mod - 2, mod) % mod
ans = pow(2, n, mod)
ans -= 1
ans -= nCr... | false | 16.666667 | [
"-c = pow(2, n, mod)",
"-def nCr(n, r, mod):",
"- r = min(r, n - r)",
"+def nCr(N, R, mod):",
"+ R = min(R, N - R)",
"- for i in range(1, r + 1):",
"- numer = numer * (n + 1 - i) % mod",
"+ for i in range(1, R + 1):",
"+ numer = numer * (N + 1 - i) % mod",
"-c -= 1",
"-... | false | 0.175404 | 0.008325 | 21.070521 | [
"s135865002",
"s843249254"
] |
u760248716 | p03506 | python | s680281242 | s215959890 | 1,929 | 432 | 25,196 | 100,716 | Accepted | Accepted | 77.6 | n,q,*t=list(map(int,open(0).read().split()))
for v,w in zip(t[::2],t[1::2]):
if~-n:
while v!=w:
if v>w:v,w=w,v
w=(w+n-2)//n
print(v) | n,q,*t=list(map(int,open(0).read().split()))
for v,w in zip(t[::2],t[1::2]):
while n>1and v!=w:
if v>w:v,w=w,v
w=(w+n-2)//n
print(v) | 7 | 6 | 142 | 137 | n, q, *t = list(map(int, open(0).read().split()))
for v, w in zip(t[::2], t[1::2]):
if ~-n:
while v != w:
if v > w:
v, w = w, v
w = (w + n - 2) // n
print(v)
| n, q, *t = list(map(int, open(0).read().split()))
for v, w in zip(t[::2], t[1::2]):
while n > 1 and v != w:
if v > w:
v, w = w, v
w = (w + n - 2) // n
print(v)
| false | 14.285714 | [
"- if ~-n:",
"- while v != w:",
"- if v > w:",
"- v, w = w, v",
"- w = (w + n - 2) // n",
"+ while n > 1 and v != w:",
"+ if v > w:",
"+ v, w = w, v",
"+ w = (w + n - 2) // n"
] | false | 0.058238 | 0.038858 | 1.49876 | [
"s680281242",
"s215959890"
] |
u644907318 | p02836 | python | s287377406 | s241495958 | 182 | 68 | 38,384 | 61,800 | Accepted | Accepted | 62.64 | S = input().strip()
n = len(S)
cnt = 0
for i in range(n//2):
if S[i]!=S[-(i+1)]:
cnt += 1
print(cnt) | S = input().strip()
N = len(S)
cnt = 0
for i in range(N//2):
if S[i]!=S[N-1-i]:
cnt += 1
print(cnt) | 7 | 7 | 118 | 117 | S = input().strip()
n = len(S)
cnt = 0
for i in range(n // 2):
if S[i] != S[-(i + 1)]:
cnt += 1
print(cnt)
| S = input().strip()
N = len(S)
cnt = 0
for i in range(N // 2):
if S[i] != S[N - 1 - i]:
cnt += 1
print(cnt)
| false | 0 | [
"-n = len(S)",
"+N = len(S)",
"-for i in range(n // 2):",
"- if S[i] != S[-(i + 1)]:",
"+for i in range(N // 2):",
"+ if S[i] != S[N - 1 - i]:"
] | false | 0.061499 | 0.035033 | 1.755451 | [
"s287377406",
"s241495958"
] |
u352383798 | p02887 | python | s832360728 | s896333756 | 49 | 43 | 3,316 | 3,316 | Accepted | Accepted | 12.24 | N = eval(input())
S = eval(input())
ans = 0
sav = ""
for index in range(int(N)):
if sav == "":
sav = S[index]
ans += 1
elif S[index] != sav:
sav = S[index]
ans += 1
print(ans) | N = eval(input())
S = eval(input())
ans = 1
sav = S[0]
for index in range(1, int(N)):
if S[index] != sav:
sav = S[index]
ans += 1
print(ans) | 14 | 11 | 218 | 160 | N = eval(input())
S = eval(input())
ans = 0
sav = ""
for index in range(int(N)):
if sav == "":
sav = S[index]
ans += 1
elif S[index] != sav:
sav = S[index]
ans += 1
print(ans)
| N = eval(input())
S = eval(input())
ans = 1
sav = S[0]
for index in range(1, int(N)):
if S[index] != sav:
sav = S[index]
ans += 1
print(ans)
| false | 21.428571 | [
"-ans = 0",
"-sav = \"\"",
"-for index in range(int(N)):",
"- if sav == \"\":",
"- sav = S[index]",
"- ans += 1",
"- elif S[index] != sav:",
"+ans = 1",
"+sav = S[0]",
"+for index in range(1, int(N)):",
"+ if S[index] != sav:"
] | false | 0.038899 | 0.038761 | 1.003579 | [
"s832360728",
"s896333756"
] |
u355649707 | p03103 | python | s957248760 | s809186463 | 599 | 442 | 28,644 | 28,652 | Accepted | Accepted | 26.21 | n, m = list(map(int, input().split()))
shops = sorted([list(map(int, input().split())) for i in range(n)])
def main():
cost = 0
got = 0
for shop in shops:
if got + shop[1] <= m:
got += shop[1]
cost += shop[0] * shop[1]
else:
cost += (m - got) * shop[0]
return cost
r... | def main():
n, m = list(map(int, input().split()))
shops = sorted([list(map(int, input().split())) for i in range(n)])
cost = 0
got = 0
for shop in shops:
if got + shop[1] <= m:
got += shop[1]
cost += shop[0] * shop[1]
else:
cost += (m - got) * shop[0]
break
p... | 16 | 18 | 343 | 369 | n, m = list(map(int, input().split()))
shops = sorted([list(map(int, input().split())) for i in range(n)])
def main():
cost = 0
got = 0
for shop in shops:
if got + shop[1] <= m:
got += shop[1]
cost += shop[0] * shop[1]
else:
cost += (m - got) * shop[0]
... | def main():
n, m = list(map(int, input().split()))
shops = sorted([list(map(int, input().split())) for i in range(n)])
cost = 0
got = 0
for shop in shops:
if got + shop[1] <= m:
got += shop[1]
cost += shop[0] * shop[1]
else:
cost += (m - got) * sho... | false | 11.111111 | [
"-n, m = list(map(int, input().split()))",
"-shops = sorted([list(map(int, input().split())) for i in range(n)])",
"-",
"-",
"+ n, m = list(map(int, input().split()))",
"+ shops = sorted([list(map(int, input().split())) for i in range(n)])",
"- return cost",
"- return cost",
"+ ... | false | 0.041694 | 0.043214 | 0.964837 | [
"s957248760",
"s809186463"
] |
u063052907 | p03945 | python | s509695178 | s541684276 | 33 | 19 | 3,956 | 3,188 | Accepted | Accepted | 42.42 | S = eval(input())
N = len(S)
ans = sum([1 for i in range(N-1) if S[i]!=S[i+1]])
print(ans) | S = eval(input())
ans = S.count("WB") + S.count("BW")
print(ans)
| 6 | 5 | 91 | 65 | S = eval(input())
N = len(S)
ans = sum([1 for i in range(N - 1) if S[i] != S[i + 1]])
print(ans)
| S = eval(input())
ans = S.count("WB") + S.count("BW")
print(ans)
| false | 16.666667 | [
"-N = len(S)",
"-ans = sum([1 for i in range(N - 1) if S[i] != S[i + 1]])",
"+ans = S.count(\"WB\") + S.count(\"BW\")"
] | false | 0.081155 | 0.082302 | 0.986063 | [
"s509695178",
"s541684276"
] |
u287500079 | p02823 | python | s635539603 | s017850012 | 297 | 184 | 61,548 | 38,256 | Accepted | Accepted | 38.05 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string... | import sys
def input(): return sys.stdin.readline().strip()
def MAP(): return list(map(int, input().split()))
n, a, b = MAP()
print((abs(a - b) // 2 if not (a - b) % 2 else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1)) | 29 | 6 | 1,119 | 228 | import sys, re, os
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
radians,
acos,
atan,
asin,
log,
log10,
)
from itertools import permutations, combinations, product, accumulate
from operator import it... | import sys
def input():
return sys.stdin.readline().strip()
def MAP():
return list(map(int, input().split()))
n, a, b = MAP()
print(
(
abs(a - b) // 2
if not (a - b) % 2
else abs(a - b) // 2 + min(min(a, b) - 1, n - max(a, b)) + 1
)
)
| false | 79.310345 | [
"-import sys, re, os",
"-from collections import deque, defaultdict, Counter",
"-from math import (",
"- ceil,",
"- sqrt,",
"- hypot,",
"- factorial,",
"- pi,",
"- sin,",
"- cos,",
"- radians,",
"- acos,",
"- atan,",
"- asin,",
"- log,",
"- log10,... | false | 0.044245 | 0.036324 | 1.218083 | [
"s635539603",
"s017850012"
] |
u186838327 | p03352 | python | s065791815 | s459152862 | 166 | 65 | 38,256 | 61,956 | Accepted | Accepted | 60.84 | x = int(eval(input()))
if x == 1:
print((1))
exit()
l = []
l.append(1)
for i in range(2, x+1):
j = 2
while i**j <= x:
l.append(i**j)
j += 1
#print(l)
l.sort()
print((l[-1])) | x = int(eval(input()))
ans = [1]
for i in range(2, 1001):
p = 2
while i**p <= x:
ans.append(i**p)
p += 1
ans.sort(reverse=True)
#print(ans)
print((ans[0]))
| 14 | 10 | 208 | 181 | x = int(eval(input()))
if x == 1:
print((1))
exit()
l = []
l.append(1)
for i in range(2, x + 1):
j = 2
while i**j <= x:
l.append(i**j)
j += 1
# print(l)
l.sort()
print((l[-1]))
| x = int(eval(input()))
ans = [1]
for i in range(2, 1001):
p = 2
while i**p <= x:
ans.append(i**p)
p += 1
ans.sort(reverse=True)
# print(ans)
print((ans[0]))
| false | 28.571429 | [
"-if x == 1:",
"- print((1))",
"- exit()",
"-l = []",
"-l.append(1)",
"-for i in range(2, x + 1):",
"- j = 2",
"- while i**j <= x:",
"- l.append(i**j)",
"- j += 1",
"-# print(l)",
"-l.sort()",
"-print((l[-1]))",
"+ans = [1]",
"+for i in range(2, 1001):",
"+ ... | false | 0.035245 | 0.035069 | 1.005019 | [
"s065791815",
"s459152862"
] |
u569322757 | p03476 | python | s195902145 | s809154261 | 1,171 | 884 | 8,088 | 7,944 | Accepted | Accepted | 24.51 | def get_prime_list(n):
l = [0 for _ in range(n)]
i = 1
while (i < n):
for j in range(2, int((i + 1)**0.5) + 1):
if not (i + 1) % j:
break
else:
l[i] = 1
i += 1
return l
n_max = 10**5
is_prime = get_prime_list(n_max)
is_20... | def erat(n):
l = [0, 0] + [1 for _ in range(n - 1)]
i = 2
while (i < n + 1):
if l[i] == 1:
for j in range(i**2, n + 1, i):
l[j] = 0
i += 1
return l
n_max = 10**5
is_prime = erat(n_max)
is_2017 = [0 for _ in range(n_max + 1)]
for i in range(2,... | 29 | 27 | 643 | 593 | def get_prime_list(n):
l = [0 for _ in range(n)]
i = 1
while i < n:
for j in range(2, int((i + 1) ** 0.5) + 1):
if not (i + 1) % j:
break
else:
l[i] = 1
i += 1
return l
n_max = 10**5
is_prime = get_prime_list(n_max)
is_2017 = [0 for _ in ... | def erat(n):
l = [0, 0] + [1 for _ in range(n - 1)]
i = 2
while i < n + 1:
if l[i] == 1:
for j in range(i**2, n + 1, i):
l[j] = 0
i += 1
return l
n_max = 10**5
is_prime = erat(n_max)
is_2017 = [0 for _ in range(n_max + 1)]
for i in range(2, n_max + 1):
i... | false | 6.896552 | [
"-def get_prime_list(n):",
"- l = [0 for _ in range(n)]",
"- i = 1",
"- while i < n:",
"- for j in range(2, int((i + 1) ** 0.5) + 1):",
"- if not (i + 1) % j:",
"- break",
"- else:",
"- l[i] = 1",
"+def erat(n):",
"+ l = [0, 0] + [1 ... | false | 0.448658 | 0.176348 | 2.544165 | [
"s195902145",
"s809154261"
] |
u638795007 | p03038 | python | s111427101 | s585169921 | 553 | 457 | 24,092 | 35,344 | Accepted | Accepted | 17.36 | from heapq import heappush, heappop
# input
N,M =list(map(int,input().split()))
A = [0]*N
B = [0]*M
C = [0]*M
A = list(map(int, input().split()))
A.sort()
for i in range(M):
B[i],C[i] = list(map(int,input().split()))
def solve():
pairs = list(zip(C, B))
sortedpairs = sorted(pairs, key=... | import heapq
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
ans = []
N, M = LI()
A = LI()
BC = [LI() for _ in range(M)]
A = list([x*(-1) for x in A])
heapq.heapify(A)
BC = sorted(BC, key=lambda x: x[1])[:... | 51 | 34 | 946 | 701 | from heapq import heappush, heappop
# input
N, M = list(map(int, input().split()))
A = [0] * N
B = [0] * M
C = [0] * M
A = list(map(int, input().split()))
A.sort()
for i in range(M):
B[i], C[i] = list(map(int, input().split()))
def solve():
pairs = list(zip(C, B))
sortedpairs = sorted(pairs, key=lambda x... | import heapq
import sys
def I():
return int(sys.stdin.readline())
def LI():
return list(map(int, sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float("inf")
ans = []
N, M = LI()
A = LI()
BC = [LI() for _ in range(M)]
A = list([x * (-1) for x in A])
heapq.heapify(A)
BC = sorted(BC, key=lambda x: x[1]... | false | 33.333333 | [
"-from heapq import heappush, heappop",
"-",
"-# input",
"-N, M = list(map(int, input().split()))",
"-A = [0] * N",
"-B = [0] * M",
"-C = [0] * M",
"-A = list(map(int, input().split()))",
"-A.sort()",
"-for i in range(M):",
"- B[i], C[i] = list(map(int, input().split()))",
"+import heapq",
... | false | 0.044783 | 0.045288 | 0.988861 | [
"s111427101",
"s585169921"
] |
u761529120 | p03862 | python | s149564049 | s857728209 | 115 | 90 | 14,252 | 85,936 | Accepted | Accepted | 21.74 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
sum_a = sum(a)
for i in range(1,N):
if a[i-1] + a[i] > x:
if a[i] > (a[i] + a[i-1]) - x:
# cnt += (a[i] + a[i-1]) - x
a[i] -= (a[i] + a[i-1]) - x
continue
else:
# cn... | def main():
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(1,N):
tmp = A[i] + A[i-1]
if tmp > x:
tmp -= x
cnt += tmp
A[i] = max(0, A[i]-tmp)
print(cnt)
if __name__ == "__main__":
... | 17 | 15 | 422 | 322 | N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
sum_a = sum(a)
for i in range(1, N):
if a[i - 1] + a[i] > x:
if a[i] > (a[i] + a[i - 1]) - x:
# cnt += (a[i] + a[i-1]) - x
a[i] -= (a[i] + a[i - 1]) - x
continue
else:
# cnt += ... | def main():
N, x = list(map(int, input().split()))
A = list(map(int, input().split()))
cnt = 0
for i in range(1, N):
tmp = A[i] + A[i - 1]
if tmp > x:
tmp -= x
cnt += tmp
A[i] = max(0, A[i] - tmp)
print(cnt)
if __name__ == "__main__":
main()
| false | 11.764706 | [
"-N, x = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-sum_a = sum(a)",
"-for i in range(1, N):",
"- if a[i - 1] + a[i] > x:",
"- if a[i] > (a[i] + a[i - 1]) - x:",
"- # cnt += (a[i] + a[i-1]) - x",
"- a[i] -= (a[i] + a[i - 1]) - x",
"- ... | false | 0.049799 | 0.008287 | 6.009551 | [
"s149564049",
"s857728209"
] |
u841568901 | p03796 | python | s897975780 | s056289144 | 230 | 155 | 3,980 | 10,032 | Accepted | Accepted | 32.61 | import math
n = int(eval(input()))
print((math.factorial(n) % (10**9 + 7))) | import math
m = math.factorial(int(eval(input())))
print((m%(10**9+7))) | 3 | 3 | 69 | 65 | import math
n = int(eval(input()))
print((math.factorial(n) % (10**9 + 7)))
| import math
m = math.factorial(int(eval(input())))
print((m % (10**9 + 7)))
| false | 0 | [
"-n = int(eval(input()))",
"-print((math.factorial(n) % (10**9 + 7)))",
"+m = math.factorial(int(eval(input())))",
"+print((m % (10**9 + 7)))"
] | false | 0.246534 | 0.082365 | 2.993199 | [
"s897975780",
"s056289144"
] |
u533713111 | p03109 | python | s450181436 | s657019733 | 31 | 17 | 4,440 | 2,940 | Accepted | Accepted | 45.16 | import datetime
S = eval(input())
s = datetime.datetime.strptime(S,'%Y/%m/%d')
t = datetime.datetime(2019,4,30)
if s <= t:
print('Heisei')
else:
print('TBD') | S = eval(input())
if int(S[5:7]) <= 4:
print('Heisei')
else:
print('TBD') | 8 | 5 | 162 | 75 | import datetime
S = eval(input())
s = datetime.datetime.strptime(S, "%Y/%m/%d")
t = datetime.datetime(2019, 4, 30)
if s <= t:
print("Heisei")
else:
print("TBD")
| S = eval(input())
if int(S[5:7]) <= 4:
print("Heisei")
else:
print("TBD")
| false | 37.5 | [
"-import datetime",
"-",
"-s = datetime.datetime.strptime(S, \"%Y/%m/%d\")",
"-t = datetime.datetime(2019, 4, 30)",
"-if s <= t:",
"+if int(S[5:7]) <= 4:"
] | false | 0.041421 | 0.038899 | 1.064846 | [
"s450181436",
"s657019733"
] |
u888092736 | p02888 | python | s023023079 | s574429594 | 1,293 | 1,001 | 3,316 | 3,188 | Accepted | Accepted | 22.58 | from bisect import bisect_left
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(2, N):
c = L[i]
for j in range(i):
b = L[j]
a_min_idx = bisect_left(L, c - b + 1, 0, j)
ans += j - a_min_idx
print(ans)
| # 34:14
from bisect import bisect_left
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = sum(
j - bisect_left(L, L[i] - L[j] + 1, 0, j) for i in range(2, N) for j in range(i)
)
print(ans)
| 13 | 10 | 275 | 214 | from bisect import bisect_left
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = 0
for i in range(2, N):
c = L[i]
for j in range(i):
b = L[j]
a_min_idx = bisect_left(L, c - b + 1, 0, j)
ans += j - a_min_idx
print(ans)
| # 34:14
from bisect import bisect_left
N = int(eval(input()))
L = sorted(map(int, input().split()))
ans = sum(
j - bisect_left(L, L[i] - L[j] + 1, 0, j) for i in range(2, N) for j in range(i)
)
print(ans)
| false | 23.076923 | [
"+# 34:14",
"-ans = 0",
"-for i in range(2, N):",
"- c = L[i]",
"- for j in range(i):",
"- b = L[j]",
"- a_min_idx = bisect_left(L, c - b + 1, 0, j)",
"- ans += j - a_min_idx",
"+ans = sum(",
"+ j - bisect_left(L, L[i] - L[j] + 1, 0, j) for i in range(2, N) for j in r... | false | 0.037198 | 0.08678 | 0.428647 | [
"s023023079",
"s574429594"
] |
u143212659 | p03073 | python | s537321952 | s167913483 | 47 | 19 | 4,652 | 3,444 | Accepted | Accepted | 59.57 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
S = list(map(int, list(eval(input()))))
result = 0
for i in range(1, len(S)):
if S[i - 1] == S[i]:
if S[i] == 1:
S[i] = 0
else:
S[i] = 1
result += 1
... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
S = eval(input())
n = len(S)
a = "10" * (n // 2) + "1" * (n % 2)
b = "01" * (n // 2) + "0" * (n % 2)
result = min(bin(int(S, 2) ^ int(a, 2)).count("1"),
bin(int(S, 2) ^ int(b, 2)).count("1"))
print(r... | 22 | 20 | 374 | 365 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
S = list(map(int, list(eval(input()))))
result = 0
for i in range(1, len(S)):
if S[i - 1] == S[i]:
if S[i] == 1:
S[i] = 0
else:
S[i] = 1
result += 1
print(result)
if _... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
S = eval(input())
n = len(S)
a = "10" * (n // 2) + "1" * (n % 2)
b = "01" * (n // 2) + "0" * (n % 2)
result = min(
bin(int(S, 2) ^ int(a, 2)).count("1"), bin(int(S, 2) ^ int(b, 2)).count("1")
)
print(result)
if __name__ == ... | false | 9.090909 | [
"- S = list(map(int, list(eval(input()))))",
"- result = 0",
"- for i in range(1, len(S)):",
"- if S[i - 1] == S[i]:",
"- if S[i] == 1:",
"- S[i] = 0",
"- else:",
"- S[i] = 1",
"- result += 1",
"+ S = eval(input())",... | false | 0.042643 | 0.042376 | 1.006291 | [
"s537321952",
"s167913483"
] |
u600402037 | p02983 | python | s402401570 | s908002161 | 1,461 | 1,097 | 2,940 | 3,064 | Accepted | Accepted | 24.91 | L, R = list(map(int,input().split()))
minimum = L * R
for i in range(L, min(R, L+2020)):
for j in range(i+1, min(R+1, i+2021)):
minimum = min(minimum, i * j % 2019)
print(minimum) | import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 2019
L, R = lr()
if (R-L) > 2019 * 2:
R = L + (R-L)%MOD + 2019
answer = 2019
for i in range(L, R):
for j in range(i+1, R+1):
temp = i * j % MOD
if temp <... | 10 | 19 | 220 | 372 | L, R = list(map(int, input().split()))
minimum = L * R
for i in range(L, min(R, L + 2020)):
for j in range(i + 1, min(R + 1, i + 2021)):
minimum = min(minimum, i * j % 2019)
print(minimum)
| import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 2019
L, R = lr()
if (R - L) > 2019 * 2:
R = L + (R - L) % MOD + 2019
answer = 2019
for i in range(L, R):
for j in range(i + 1, R + 1):
temp = i * j % MOD
if temp < answer... | false | 47.368421 | [
"-L, R = list(map(int, input().split()))",
"-minimum = L * R",
"-for i in range(L, min(R, L + 2020)):",
"- for j in range(i + 1, min(R + 1, i + 2021)):",
"- minimum = min(minimum, i * j % 2019)",
"-print(minimum)",
"+import sys",
"+",
"+sr = lambda: sys.stdin.readline().rstrip()",
"+ir =... | false | 0.090184 | 0.074466 | 1.211087 | [
"s402401570",
"s908002161"
] |
u539768961 | p03308 | python | s223118788 | s808824275 | 20 | 18 | 3,316 | 3,188 | Accepted | Accepted | 10 | n, a = int(eval(input())), list(map(int, input().split()))
s = []
for i in range(n):
for p in range(n):
s.append(a[i] - a[p])
print((max(s))) | n, a = int(eval(input())), list(map(int, input().split()))
s = []
for i in range(n):
for p in range(i):
s.append(abs(a[i] - a[p]))
print((max(s))) | 6 | 6 | 144 | 149 | n, a = int(eval(input())), list(map(int, input().split()))
s = []
for i in range(n):
for p in range(n):
s.append(a[i] - a[p])
print((max(s)))
| n, a = int(eval(input())), list(map(int, input().split()))
s = []
for i in range(n):
for p in range(i):
s.append(abs(a[i] - a[p]))
print((max(s)))
| false | 0 | [
"- for p in range(n):",
"- s.append(a[i] - a[p])",
"+ for p in range(i):",
"+ s.append(abs(a[i] - a[p]))"
] | false | 0.038561 | 0.037546 | 1.027049 | [
"s223118788",
"s808824275"
] |
u092387689 | p02684 | python | s166044225 | s925745408 | 211 | 156 | 32,400 | 32,152 | Accepted | Accepted | 26.07 | n,k = list(map(int,input().split()))
mp = list(map(int,input().split()))
save = []
isSaved = [False]*(n+1)
s_queue = [[1,0]]
while(len(s_queue)>0):
i,cnt = s_queue.pop()
if(cnt==k):
break
if(isSaved[i]):
last=mp[i-1]
break
nexti = mp[i-1]
isSaved[i] = True
s... | n,k = list(map(int,input().split()))
A = [int(x)-1 for x in input().split()]
isSearched = [False]*n
isSearched[0] = True
ans = []
def f():
global k
now = 0
nex = A[0]
ans.append(now)
for i in range(k):
now = nex
ans.append(now)
isSearched[now] = True
n... | 31 | 30 | 602 | 606 | n, k = list(map(int, input().split()))
mp = list(map(int, input().split()))
save = []
isSaved = [False] * (n + 1)
s_queue = [[1, 0]]
while len(s_queue) > 0:
i, cnt = s_queue.pop()
if cnt == k:
break
if isSaved[i]:
last = mp[i - 1]
break
nexti = mp[i - 1]
isSaved[i] = True
... | n, k = list(map(int, input().split()))
A = [int(x) - 1 for x in input().split()]
isSearched = [False] * n
isSearched[0] = True
ans = []
def f():
global k
now = 0
nex = A[0]
ans.append(now)
for i in range(k):
now = nex
ans.append(now)
isSearched[now] = True
nex = A[n... | false | 3.225806 | [
"-mp = list(map(int, input().split()))",
"-save = []",
"-isSaved = [False] * (n + 1)",
"-s_queue = [[1, 0]]",
"-while len(s_queue) > 0:",
"- i, cnt = s_queue.pop()",
"- if cnt == k:",
"- break",
"- if isSaved[i]:",
"- last = mp[i - 1]",
"- break",
"- nexti = mp... | false | 0.046997 | 0.156113 | 0.301047 | [
"s166044225",
"s925745408"
] |
u179169725 | p03164 | python | s595843582 | s229072903 | 1,167 | 588 | 197,584 | 106,996 | Accepted | Accepted | 49.61 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int(): return int(read... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints(): return list(map(... | 91 | 72 | 2,030 | 1,720 | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
return int(read())
d... | import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate
def exit(*argv, **kwarg):
print(*argv, **kwarg)
sys.exit()
def mina(*argv, sub=1):
return list(map(lambda x: x - sub, argv))
# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def ints():
return list(map(int, re... | false | 20.879121 | [
"-def a_int():",
"- return int(read())",
"-",
"-",
"-def read_tuple(H):",
"- \"\"\"H is number of rows\"\"\"",
"- ret = []",
"- for _ in range(H):",
"- ret.append(tuple(map(int, read().split())))",
"- return ret",
"+import numpy as np",
"-",
"-def read_matrix(H):",
"-... | false | 0.230051 | 0.230091 | 0.999825 | [
"s595843582",
"s229072903"
] |
u775681539 | p03032 | python | s525906906 | s042664061 | 131 | 46 | 3,316 | 3,188 | Accepted | Accepted | 64.89 | #python3
from collections import deque
from heapq import heappop, heappush
def main():
n, k = list(map(int, input().split()))
vs = [int(i) for i in input().split()]
ans = 0
for l in range(k+1):
for r in range(k-l+1):
dl = k-l-r
q = deque(vs)
hav = [... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heappop, heappush
def main():
N, K = list(map(int, readline().split()))
V = [int(i) for i in readline().split()]
A = V[::-1]
ans = 0
for l in rang... | 31 | 27 | 897 | 772 | # python3
from collections import deque
from heapq import heappop, heappush
def main():
n, k = list(map(int, input().split()))
vs = [int(i) for i in input().split()]
ans = 0
for l in range(k + 1):
for r in range(k - l + 1):
dl = k - l - r
q = deque(vs)
hav =... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from heapq import heapify, heappop, heappush
def main():
N, K = list(map(int, readline().split()))
V = [int(i) for i in readline().split()]
A = V[::-1]
ans = 0
for l in range(K + 1)... | false | 12.903226 | [
"-# python3",
"-from collections import deque",
"-from heapq import heappop, heappush",
"+import sys",
"+",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"+readlines = sys.stdin.buffer.readlines",
"+from heapq import heapify, heappop, heappush",
"- n, k = list(map(in... | false | 0.063329 | 0.036715 | 1.724881 | [
"s525906906",
"s042664061"
] |
u367701763 | p02684 | python | s393056183 | s360040692 | 493 | 317 | 184,652 | 184,604 | Accepted | Accepted | 35.7 |
import sys
input = sys.stdin.readline
class Doubling:
def __init__(self, A, K_max, decrement=True):
"""
:param A: リスト。i から A[i] へと移動する
:param K_max: K_max = 2**(k_max) まで参照する可能性がある
:param decrement: True = A の要素の decrement が必要
"""
N = len(A)
k_ma... | #####################################################################################################
##### ダブリング
#####################################################################################################
"""
全体の要素数がN個あって1回移動した時にどの要素に到達するのか定まっているとき、
「K個先の要素を求めるのに O(K) かかる」ような状況において
前処理:O(N logK) ... | 49 | 71 | 1,463 | 1,949 | import sys
input = sys.stdin.readline
class Doubling:
def __init__(self, A, K_max, decrement=True):
"""
:param A: リスト。i から A[i] へと移動する
:param K_max: K_max = 2**(k_max) まで参照する可能性がある
:param decrement: True = A の要素の decrement が必要
"""
N = len(A)
k_max = K_max.b... | #####################################################################################################
##### ダブリング
#####################################################################################################
"""
全体の要素数がN個あって1回移動した時にどの要素に到達するのか定まっているとき、
「K個先の要素を求めるのに O(K) かかる」ような状況において
前処理:O(N logK) 時間, O(N logK... | false | 30.985915 | [
"+#####################################################################################################",
"+##### ダブリング",
"+#####################################################################################################",
"+\"\"\"",
"+全体の要素数がN個あって1回移動した時にどの要素に到達するのか定まっているとき、",
"+「K個先の要素を求めるのに O(K) か... | false | 0.074823 | 0.074223 | 1.008073 | [
"s393056183",
"s360040692"
] |
u506858457 | p02802 | python | s675438936 | s714158279 | 406 | 202 | 20,376 | 10,456 | Accepted | Accepted | 50.25 | N,M=list(map(int,input().split()))
A=0
PE=0
PRO=[[] for i in range(N)]
for i in range(M):
P,S=input().split()
P=int(P)-1
PRO[P].append(S)
#print(PRO)
for i in range(N):
tmp=0
for j in range(len(PRO[i])):
flag=False
if PRO[i][j]=='AC':
A+=1
flag=True
if PRO[i][j]=='WA':
... | def II(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
ans,pena=0,0
N,M=MI()
P=[0]*N
PENA=[0]*N
for i in range(M):
p,s=input().split()
p=int(p)
p-=1
if s=='AC':
if P[p]==0:
ans+=1
P[p]=1
if PENA[p... | 22 | 21 | 382 | 404 | N, M = list(map(int, input().split()))
A = 0
PE = 0
PRO = [[] for i in range(N)]
for i in range(M):
P, S = input().split()
P = int(P) - 1
PRO[P].append(S)
# print(PRO)
for i in range(N):
tmp = 0
for j in range(len(PRO[i])):
flag = False
if PRO[i][j] == "AC":
A += 1
... | def II():
return int(eval(input()))
def MI():
return list(map(int, input().split()))
def LI():
return list(map(int, input().split()))
ans, pena = 0, 0
N, M = MI()
P = [0] * N
PENA = [0] * N
for i in range(M):
p, s = input().split()
p = int(p)
p -= 1
if s == "AC":
if P[p] == 0:
... | false | 4.545455 | [
"-N, M = list(map(int, input().split()))",
"-A = 0",
"-PE = 0",
"-PRO = [[] for i in range(N)]",
"+def II():",
"+ return int(eval(input()))",
"+",
"+",
"+def MI():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+def LI():",
"+ return list(map(int, input().split()))",
"... | false | 0.055726 | 0.036417 | 1.530227 | [
"s675438936",
"s714158279"
] |
u191874006 | p03167 | python | s525387842 | s657698593 | 323 | 280 | 89,564 | 52,848 | Accepted | Accepted | 13.31 | #!/usr/bin/env python3
#dp7 #Grid 1
import sys
sys.setrecursionlimit(10000000)
def LI(): return list(map(int,sys.stdin.readline().split()))
def LIR(n): return [LI() for _ in range(n)]
mod = 10**9+7
def h():
h,w = LI()
grid = [list(eval(input())) for _ in range(h)]
dp = [[0 for _ in range(w)]... | #!/usr/bin/env python3
#EDPC H
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Coun... | 32 | 41 | 889 | 1,227 | #!/usr/bin/env python3
# dp7 #Grid 1
import sys
sys.setrecursionlimit(10000000)
def LI():
return list(map(int, sys.stdin.readline().split()))
def LIR(n):
return [LI() for _ in range(n)]
mod = 10**9 + 7
def h():
h, w = LI()
grid = [list(eval(input())) for _ in range(h)]
dp = [[0 for _ in ran... | #!/usr/bin/env python3
# EDPC H
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from ... | false | 21.95122 | [
"-# dp7 #Grid 1",
"+# EDPC H",
"+import math",
"+from bisect import bisect_right as br",
"+from bisect import bisect_left as bl",
"-sys.setrecursionlimit(10000000)",
"+sys.setrecursionlimit(1000000000)",
"+from heapq import heappush, heappop, heappushpop",
"+from collections import defaultdict",
"... | false | 0.046035 | 0.045658 | 1.008256 | [
"s525387842",
"s657698593"
] |
u816587940 | p02586 | python | s701043892 | s354394679 | 1,913 | 986 | 431,136 | 427,044 | Accepted | Accepted | 48.46 | import sys
input=sys.stdin.readline
def main():
r,c,k=map(int,input().split())
v=[[0]*c for _ in range(r)]
for _ in range(k):
ri,ci,a=map(int,input().split())
ri-=1
ci-=1
v[ri][ci]=a
dp=[[[0]*c for _ in range(r)] for i in range(4)]
#print(dp)
if v[0][0... | import sys
input=sys.stdin.readline
def main():
r,c,k=map(int,input().split())
v=[0] * (c * r)
for _ in range(k):
ri,ci,a=map(int,input().split())
v[(ri-1)*c + (ci-1)]=a
dp= [0] * (c * r * 4)
#print(dp)
x = c * r
if v[0]>0: dp[x] = v[0]
for i in range(r):
... | 42 | 44 | 1,558 | 1,545 | import sys
input = sys.stdin.readline
def main():
r, c, k = map(int, input().split())
v = [[0] * c for _ in range(r)]
for _ in range(k):
ri, ci, a = map(int, input().split())
ri -= 1
ci -= 1
v[ri][ci] = a
dp = [[[0] * c for _ in range(r)] for i in range(4)]
# print... | import sys
input = sys.stdin.readline
def main():
r, c, k = map(int, input().split())
v = [0] * (c * r)
for _ in range(k):
ri, ci, a = map(int, input().split())
v[(ri - 1) * c + (ci - 1)] = a
dp = [0] * (c * r * 4)
# print(dp)
x = c * r
if v[0] > 0:
dp[x] = v[0]
... | false | 4.545455 | [
"- v = [[0] * c for _ in range(r)]",
"+ v = [0] * (c * r)",
"- ri -= 1",
"- ci -= 1",
"- v[ri][ci] = a",
"- dp = [[[0] * c for _ in range(r)] for i in range(4)]",
"+ v[(ri - 1) * c + (ci - 1)] = a",
"+ dp = [0] * (c * r * 4)",
"- if v[0][0] > 0:",
"- ... | false | 0.046522 | 0.037517 | 1.240034 | [
"s701043892",
"s354394679"
] |
u252828980 | p02899 | python | s203765671 | s356243855 | 327 | 210 | 21,440 | 20,800 | Accepted | Accepted | 35.78 | n = int(input())
#x, y = map(int,input().split())
li = list(map(int, input().split()))
li2 = []
for i in range(n):
li2.append([li[i],i+1])
li2.sort()
for i in range(len(li2)):
print(li2[i][1],end = " ")
| n = int(eval(input()))
L = list(map(int,input().split()))
li = []
for i,j in enumerate(L):
li.append((i+1,j))
li.sort(key = lambda x:x[1])
ans = []
for i in range(n):
ans.append(li[i][0])
print((*ans)) | 11 | 11 | 222 | 212 | n = int(input())
# x, y = map(int,input().split())
li = list(map(int, input().split()))
li2 = []
for i in range(n):
li2.append([li[i], i + 1])
li2.sort()
for i in range(len(li2)):
print(li2[i][1], end=" ")
| n = int(eval(input()))
L = list(map(int, input().split()))
li = []
for i, j in enumerate(L):
li.append((i + 1, j))
li.sort(key=lambda x: x[1])
ans = []
for i in range(n):
ans.append(li[i][0])
print((*ans))
| false | 0 | [
"-n = int(input())",
"-# x, y = map(int,input().split())",
"-li = list(map(int, input().split()))",
"-li2 = []",
"+n = int(eval(input()))",
"+L = list(map(int, input().split()))",
"+li = []",
"+for i, j in enumerate(L):",
"+ li.append((i + 1, j))",
"+li.sort(key=lambda x: x[1])",
"+ans = []",... | false | 0.008157 | 0.082708 | 0.098618 | [
"s203765671",
"s356243855"
] |
u798818115 | p02901 | python | s581700921 | s334539531 | 1,561 | 120 | 3,188 | 75,936 | Accepted | Accepted | 92.31 | # coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
N,M=list(map(int,input().split()))
dp=[10**9]*2**N
dp[0]=0
for _ in range(M):
a,b=list(map(int,input().split()))
c=list(map(int,input().split()))
cl=["0"]*N
for item in c:
cl[item-1]="1"
plus=int(str("".jo... | # coding: utf-8
# Your code here!
#D流用したので文字滅茶苦茶
N,M=list(map(int,input().split()))
dp=[10**10]*2**N
dp[0]=0
for _ in range(M):
a,b=list(map(int,input().split()))
c=list(map(int,input().split()))
can_open=sum([2**(c[i]-1) for i in range(len(c))])
for i in range(len(dp))[::-1]:
... | 25 | 23 | 518 | 476 | # coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
N, M = list(map(int, input().split()))
dp = [10**9] * 2**N
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
cl = ["0"] * N
for item in c:
cl[item - 1] = "1"
plus = int(s... | # coding: utf-8
# Your code here!
# D流用したので文字滅茶苦茶
N, M = list(map(int, input().split()))
dp = [10**10] * 2**N
dp[0] = 0
for _ in range(M):
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
can_open = sum([2 ** (c[i] - 1) for i in range(len(c))])
for i in range(len(dp))[::-1]:
... | false | 8 | [
"-# coding: utf-8",
"-# Your code here!",
"+# D流用したので文字滅茶苦茶",
"-dp = [10**9] * 2**N",
"+dp = [10**10] * 2**N",
"- cl = [\"0\"] * N",
"- for item in c:",
"- cl[item - 1] = \"1\"",
"- plus = int(str(\"\".join(cl)), 2)",
"+ can_open = sum([2 ** (c[i] - 1) for i in range(len(c))])",... | false | 0.042723 | 0.035502 | 1.20339 | [
"s581700921",
"s334539531"
] |
u188827677 | p02756 | python | s884037334 | s437629578 | 532 | 431 | 9,180 | 4,192 | Accepted | Accepted | 18.98 | from collections import deque
s = deque(list(eval(input())))
q = int(eval(input()))
rev = 0
for i in range(q):
tfc = list(input().split())
if tfc[0] == "1":
rev = abs(rev-1)
else:
t,f,c = tfc
if rev:
if f == "1":
s.append(c)
else:
s.appendleft(c)
else:
... | s = eval(input())
q = int(eval(input()))
top = ""
isReverse = False
for i in range(q):
qq = input().split()
if qq[0] == "1":
isReverse = not isReverse
else:
if qq[1] == "1":
if isReverse: s+= qq[2]
else: top += qq[2]
else:
if isReverse: top += qq[2]
else: s+= qq... | 28 | 20 | 512 | 389 | from collections import deque
s = deque(list(eval(input())))
q = int(eval(input()))
rev = 0
for i in range(q):
tfc = list(input().split())
if tfc[0] == "1":
rev = abs(rev - 1)
else:
t, f, c = tfc
if rev:
if f == "1":
s.append(c)
else:
... | s = eval(input())
q = int(eval(input()))
top = ""
isReverse = False
for i in range(q):
qq = input().split()
if qq[0] == "1":
isReverse = not isReverse
else:
if qq[1] == "1":
if isReverse:
s += qq[2]
else:
top += qq[2]
else:
... | false | 28.571429 | [
"-from collections import deque",
"-",
"-s = deque(list(eval(input())))",
"+s = eval(input())",
"-rev = 0",
"+top = \"\"",
"+isReverse = False",
"- tfc = list(input().split())",
"- if tfc[0] == \"1\":",
"- rev = abs(rev - 1)",
"+ qq = input().split()",
"+ if qq[0] == \"1\":"... | false | 0.049333 | 0.049333 | 0.999999 | [
"s884037334",
"s437629578"
] |
u692054751 | p02952 | python | s678648444 | s028388222 | 60 | 48 | 2,940 | 3,864 | Accepted | Accepted | 20 | N = int(eval(input()))
count = 0
for i in range(1,N+1):
s = str(i)
if len(s) % 2 == 1:
count+=1
print(count) | N = int(eval(input()))
print((sum([len(str(i + 1)) % 2 for i in range(N)]))) | 8 | 2 | 122 | 69 | N = int(eval(input()))
count = 0
for i in range(1, N + 1):
s = str(i)
if len(s) % 2 == 1:
count += 1
print(count)
| N = int(eval(input()))
print((sum([len(str(i + 1)) % 2 for i in range(N)])))
| false | 75 | [
"-count = 0",
"-for i in range(1, N + 1):",
"- s = str(i)",
"- if len(s) % 2 == 1:",
"- count += 1",
"-print(count)",
"+print((sum([len(str(i + 1)) % 2 for i in range(N)])))"
] | false | 0.139845 | 0.049058 | 2.850598 | [
"s678648444",
"s028388222"
] |
u596276291 | p03806 | python | s564562379 | s912500393 | 1,183 | 657 | 60,252 | 5,612 | Accepted | Accepted | 44.46 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.se... | 52 | 53 | 1,517 | 1,445 | import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, ... | from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecurs... | false | 1.886792 | [
"-import sys",
"-from math import pi, sqrt, ceil, floor",
"+from math import pi, sqrt",
"-from functools import lru_cache, reduce",
"+from functools import lru_cache",
"+import sys",
"+sys.setrecursionlimit(10000)",
"-sys.setrecursionlimit(10**7)",
"-# 4近傍(右, 下, 左, 上)",
"-dy = [0, -1, 0, 1]",
"-... | false | 0.094814 | 0.210554 | 0.450306 | [
"s564562379",
"s912500393"
] |
u638902622 | p02939 | python | s677689852 | s749891104 | 507 | 273 | 52,276 | 36,760 | Accepted | Accepted | 46.15 | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list([x-1 for x in MII()])
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _... | import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list([x-1 for x in MII()])
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _... | 58 | 57 | 2,018 | 1,904 | import sys
## io ##
def IS():
return sys.stdin.readline().rstrip()
def II():
return int(IS())
def MII():
return list(map(int, IS().split()))
def MIIZ():
return list([x - 1 for x in MII()])
## dp ##
def DD2(d1, d2, init=0):
return [[init] * d2 for _ in range(d1)]
def DD3(d1, d2, d3, init=0... | import sys
## io ##
def IS():
return sys.stdin.readline().rstrip()
def II():
return int(IS())
def MII():
return list(map(int, IS().split()))
def MIIZ():
return list([x - 1 for x in MII()])
## dp ##
def DD2(d1, d2, init=0):
return [[init] * d2 for _ in range(d1)]
def DD3(d1, d2, d3, init=0... | false | 1.724138 | [
"- dp = DD2(n, 4)",
"+ dp = DD2(n, 2)",
"- dp[1][1] = 1",
"+ dp[0][1] = -1",
"- if s[i - 1] != s[i]:",
"- dp[i][0] = max(dp[i - 1][0], dp[i - 1][2]) + 1",
"- if i < n - 1:",
"- dp[i + 1][1] = max(dp[i - 1][0], dp[i - 1][2]) + 1",
"- dp[i][2] = m... | false | 0.0367 | 0.035753 | 1.026465 | [
"s677689852",
"s749891104"
] |
u624475441 | p03838 | python | s895041677 | s684443638 | 21 | 17 | 3,316 | 3,060 | Accepted | Accepted | 19.05 | x, y = list(map(int, input().split()))
if 0 <= x < y or x < y <= 0:
print((y - x))
elif 0 < y < x or y < x < 0:
print((x - y + 2))
else:
print((abs(abs(x) - abs(y)) + 1)) | x, y = list(map(int, input().split()))
if x == -y:
print((1))
elif abs(x) < abs(y):
print((abs(y) - abs(x) + (x < 0) + (y < 0)))
else:
print((abs(x) - abs(y) + (x > 0) + (y > 0))) | 7 | 7 | 176 | 185 | x, y = list(map(int, input().split()))
if 0 <= x < y or x < y <= 0:
print((y - x))
elif 0 < y < x or y < x < 0:
print((x - y + 2))
else:
print((abs(abs(x) - abs(y)) + 1))
| x, y = list(map(int, input().split()))
if x == -y:
print((1))
elif abs(x) < abs(y):
print((abs(y) - abs(x) + (x < 0) + (y < 0)))
else:
print((abs(x) - abs(y) + (x > 0) + (y > 0)))
| false | 0 | [
"-if 0 <= x < y or x < y <= 0:",
"- print((y - x))",
"-elif 0 < y < x or y < x < 0:",
"- print((x - y + 2))",
"+if x == -y:",
"+ print((1))",
"+elif abs(x) < abs(y):",
"+ print((abs(y) - abs(x) + (x < 0) + (y < 0)))",
"- print((abs(abs(x) - abs(y)) + 1))",
"+ print((abs(x) - abs(... | false | 0.07426 | 0.036755 | 2.020413 | [
"s895041677",
"s684443638"
] |
u671446913 | p02882 | python | s607232570 | s879332700 | 23 | 21 | 3,572 | 3,444 | Accepted | Accepted | 8.7 | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
# = int(input())
a, b, x = list(map(int, input().split()))
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
def f(a, b, x):
if a... | #!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
# = input()
# = int(input())
a, b, x = list(map(int, input().split()))
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
def f(a, b, x):
"""
... | 22 | 25 | 503 | 555 | #!/usr/bin/env python3
import collections
import itertools as it
import math
# import numpy as np
# = input()
# = int(input())
a, b, x = list(map(int, input().split()))
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
def f(a, b, x):
if a * a * b / 2 <= x:
... | #!/usr/bin/env python3
import collections
import itertools as it
import math
# import numpy as np
# = input()
# = int(input())
a, b, x = list(map(int, input().split()))
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
#
# c = collections.Counter()
def f(a, b, x):
""" """
if a * a * ... | false | 12 | [
"+ \"\"\" \"\"\"",
"-print((f(a, b, x) * 180 / math.pi))",
"+# print(f(a, b, x) * 180 / math.pi)",
"+print((math.degrees(f(a, b, x))))"
] | false | 0.175459 | 0.119178 | 1.472236 | [
"s607232570",
"s879332700"
] |
u476048753 | p03308 | python | s295393559 | s182514579 | 21 | 19 | 3,188 | 3,060 | Accepted | Accepted | 9.52 | N = int(eval(input()))
num_lists = list(map(int, input().split()))
max_num = max(num_lists)
min_num = min(num_lists)
ans = max_num - min_num
print(ans) | N = int(eval(input()))
num_lists = list(map(int, input().split()))
ans = 0
for i in num_lists:
for j in num_lists:
diff = abs(i - j)
if diff > ans:
ans = diff
print(ans) | 6 | 10 | 150 | 190 | N = int(eval(input()))
num_lists = list(map(int, input().split()))
max_num = max(num_lists)
min_num = min(num_lists)
ans = max_num - min_num
print(ans)
| N = int(eval(input()))
num_lists = list(map(int, input().split()))
ans = 0
for i in num_lists:
for j in num_lists:
diff = abs(i - j)
if diff > ans:
ans = diff
print(ans)
| false | 40 | [
"-max_num = max(num_lists)",
"-min_num = min(num_lists)",
"-ans = max_num - min_num",
"+ans = 0",
"+for i in num_lists:",
"+ for j in num_lists:",
"+ diff = abs(i - j)",
"+ if diff > ans:",
"+ ans = diff"
] | false | 0.041571 | 0.041293 | 1.006733 | [
"s295393559",
"s182514579"
] |
u094999522 | p02886 | python | s807670780 | s373577401 | 30 | 27 | 9,004 | 9,096 | Accepted | Accepted | 10 | #!/usr/bin/env python3
n, *d = list(map(int, open(0).read().split()))
s = sum(d)
print((sum((s - i) * i for i in d)//2))
| n,*d = list(map(int,open(0).read().split()))
print((sum((sum(d)-i)*i for i in d)//2))
| 4 | 2 | 116 | 79 | #!/usr/bin/env python3
n, *d = list(map(int, open(0).read().split()))
s = sum(d)
print((sum((s - i) * i for i in d) // 2))
| n, *d = list(map(int, open(0).read().split()))
print((sum((sum(d) - i) * i for i in d) // 2))
| false | 50 | [
"-#!/usr/bin/env python3",
"-s = sum(d)",
"-print((sum((s - i) * i for i in d) // 2))",
"+print((sum((sum(d) - i) * i for i in d) // 2))"
] | false | 0.036993 | 0.064417 | 0.574274 | [
"s807670780",
"s373577401"
] |
u197615397 | p00496 | python | s637397327 | s037884506 | 3,570 | 2,670 | 8,272 | 8,424 | Accepted | Accepted | 25.21 | def solve():
N, T, S = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0]*N]
dp = [float("-inf")]*(T+1)
dp[0] = 0
for fun, mise_time in a:
for prev_time in range(T-mise_time, -1, -1):
from_fun, to_fun = dp[prev_time], dp[prev_time+mise_tim... | def solve():
N, T, S = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0]*N]
dp = [float("-inf")]*(T+1)
dp[0] = 0
for fun, mise_time in a:
for prev_time, to_fun in zip(list(range(T-mise_time, -1, -1)), dp[::-1]):
new_time = prev_time + mis... | 24 | 23 | 728 | 685 | def solve():
N, T, S = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0] * N]
dp = [float("-inf")] * (T + 1)
dp[0] = 0
for fun, mise_time in a:
for prev_time in range(T - mise_time, -1, -1):
from_fun, to_fun = dp[prev_time], dp[prev_time + mise_ti... | def solve():
N, T, S = list(map(int, input().split()))
a = [tuple(map(int, input().split())) for _ in [0] * N]
dp = [float("-inf")] * (T + 1)
dp[0] = 0
for fun, mise_time in a:
for prev_time, to_fun in zip(list(range(T - mise_time, -1, -1)), dp[::-1]):
new_time = prev_time + mise... | false | 4.166667 | [
"- for prev_time in range(T - mise_time, -1, -1):",
"- from_fun, to_fun = dp[prev_time], dp[prev_time + mise_time]",
"+ for prev_time, to_fun in zip(list(range(T - mise_time, -1, -1)), dp[::-1]):",
"- new_fun = fun + from_fun",
"+ new_fun = fun + dp[prev_time]"... | false | 0.066211 | 0.0081 | 8.173706 | [
"s637397327",
"s037884506"
] |
u119148115 | p03305 | python | s961910541 | s407645348 | 1,947 | 1,033 | 168,572 | 204,672 | Accepted | Accepted | 46.94 | def main():
import collections
import heapq
class Dijkstra:
def __init__(self):
self.e = collections.defaultdict(list)
def add(self, u, v, d): # 無向グラフの場合
self.e[u].append([v, d])
self.e[v].append([u, d])
def delete(self, u, v):
... | import sys
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def main():
import collections
import heapq
class Dijkstra:
def __init__(self):
self.e = collections.defaultdict(list)
def add(self, u, v, d): # 無向グラフの場合
self.e[u].append(... | 71 | 74 | 1,872 | 1,848 | def main():
import collections
import heapq
class Dijkstra:
def __init__(self):
self.e = collections.defaultdict(list)
def add(self, u, v, d): # 無向グラフの場合
self.e[u].append([v, d])
self.e[v].append([u, d])
def delete(self, u, v):
self... | import sys
def MI():
return list(map(int, sys.stdin.readline().rstrip().split()))
def main():
import collections
import heapq
class Dijkstra:
def __init__(self):
self.e = collections.defaultdict(list)
def add(self, u, v, d): # 無向グラフの場合
self.e[u].append([v, ... | false | 4.054054 | [
"+import sys",
"+",
"+",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().rstrip().split()))",
"+",
"+",
"- n, m, s, t = list(map(int, input().split()))",
"- data = [list(map(int, input().split())) for i in range(m)]",
"- G1 = Dijkstra()",
"- G2 = Dijkstra()",
"+ n,... | false | 0.035625 | 0.116192 | 0.306604 | [
"s961910541",
"s407645348"
] |
u883621917 | p02678 | python | s208557178 | s147050467 | 356 | 303 | 93,056 | 93,192 | Accepted | Accepted | 14.89 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n, m = list(map(int, input().split()))
graph = [-1] + [[] for _ in range(n)]
for _ in range(m):
n1, n2 = list(map(int, input().split()))
graph[n1].append(n2)
graph[n2].append(n1)
from collections import deque
def bfs(graph,... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
n, m = list(map(int, input().split()))
graph = [0] + [[] for _ in range(n)]
for _ in range(m):
n1, n2 = list(map(int, input().split()))
graph[n1].append(n2)
graph[n2].append(n1)
from collections import deque
def bfs(graph, ... | 36 | 36 | 801 | 800 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, m = list(map(int, input().split()))
graph = [-1] + [[] for _ in range(n)]
for _ in range(m):
n1, n2 = list(map(int, input().split()))
graph[n1].append(n2)
graph[n2].append(n1)
from collections import deque
def bfs(graph, queue, dist, p... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
n, m = list(map(int, input().split()))
graph = [0] + [[] for _ in range(n)]
for _ in range(m):
n1, n2 = list(map(int, input().split()))
graph[n1].append(n2)
graph[n2].append(n1)
from collections import deque
def bfs(graph, queue, dist, pr... | false | 0 | [
"-graph = [-1] + [[] for _ in range(n)]",
"+graph = [0] + [[] for _ in range(n)]",
"+dist[1] = 0",
"-dist[1] = 0"
] | false | 0.042844 | 0.043704 | 0.980312 | [
"s208557178",
"s147050467"
] |
u555878443 | p02576 | python | s140865333 | s072517758 | 28 | 23 | 9,084 | 9,112 | Accepted | Accepted | 17.86 | import math
n, x, t = list(map(int, input().split()))
c = math.floor(n / x)
if n % x == 0:
print((c * t))
else:
print((c * t + t)) | n, x, t = list(map(int, input().split()))
if n % x == 0:
print((int(n / x * t)))
else:
ans = int((n // x + 1) * t)
print(ans) | 10 | 7 | 140 | 136 | import math
n, x, t = list(map(int, input().split()))
c = math.floor(n / x)
if n % x == 0:
print((c * t))
else:
print((c * t + t))
| n, x, t = list(map(int, input().split()))
if n % x == 0:
print((int(n / x * t)))
else:
ans = int((n // x + 1) * t)
print(ans)
| false | 30 | [
"-import math",
"-",
"-c = math.floor(n / x)",
"- print((c * t))",
"+ print((int(n / x * t)))",
"- print((c * t + t))",
"+ ans = int((n // x + 1) * t)",
"+ print(ans)"
] | false | 0.06565 | 0.138292 | 0.474718 | [
"s140865333",
"s072517758"
] |
u585482323 | p02804 | python | s744394859 | s833145054 | 475 | 428 | 117,484 | 63,432 | Accepted | Accepted | 9.89 | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS... | 57 | 65 | 1,378 | 1,653 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.readline().split()]
def I():
return int(sys.stdin.readline())
def LS():
return [list(... | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI():
return [int(x) for x in sys.stdin.buffer.readline().split()]
def I():
return int(sys.stdin.buffer.readline())
d... | false | 12.307692 | [
"-from itertools import permutations",
"+from itertools import permutations, accumulate",
"- return [int(x) for x in sys.stdin.readline().split()]",
"+ return [int(x) for x in sys.stdin.buffer.readline().split()]",
"- return int(sys.stdin.readline())",
"+ return int(sys.stdin.buffer.readline()... | false | 1.216845 | 0.130168 | 9.348285 | [
"s744394859",
"s833145054"
] |
u644972721 | p03493 | python | s430999664 | s941575011 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = eval(input())
a = int(n[0]) + int(n[1]) + int(n[2])
print(a) | s = list(eval(input()))
print((s.count("1"))) | 3 | 2 | 60 | 38 | n = eval(input())
a = int(n[0]) + int(n[1]) + int(n[2])
print(a)
| s = list(eval(input()))
print((s.count("1")))
| false | 33.333333 | [
"-n = eval(input())",
"-a = int(n[0]) + int(n[1]) + int(n[2])",
"-print(a)",
"+s = list(eval(input()))",
"+print((s.count(\"1\")))"
] | false | 0.076719 | 0.074877 | 1.024601 | [
"s430999664",
"s941575011"
] |
u755585099 | p02818 | python | s200270198 | s040214912 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a,b,k = list(map(int,input().split()))
num = min(a,k)
a -= num
k -= num
print((a,max(b-k,0))) | a, b, k = list(map(int, input().split()))
if a <= k:
k -= a
a = 0
else:
a -= k
k = 0
b = max(0, b - k)
print((a, b)) | 5 | 12 | 89 | 130 | a, b, k = list(map(int, input().split()))
num = min(a, k)
a -= num
k -= num
print((a, max(b - k, 0)))
| a, b, k = list(map(int, input().split()))
if a <= k:
k -= a
a = 0
else:
a -= k
k = 0
b = max(0, b - k)
print((a, b))
| false | 58.333333 | [
"-num = min(a, k)",
"-a -= num",
"-k -= num",
"-print((a, max(b - k, 0)))",
"+if a <= k:",
"+ k -= a",
"+ a = 0",
"+else:",
"+ a -= k",
"+ k = 0",
"+b = max(0, b - k)",
"+print((a, b))"
] | false | 0.045116 | 0.142392 | 0.316841 | [
"s200270198",
"s040214912"
] |
u935558307 | p03557 | python | s403889982 | s909977517 | 489 | 445 | 111,084 | 109,796 | Accepted | Accepted | 9 | from bisect import bisect_left
N = int(eval(input()))
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
"""
まず、前処理として、「Bの祭壇から大きさb以下のパーツを使うとき、Aの祭壇のパーツとの組み合わせはいくつあるか」というのを調べてメモしておく。
次に、Cの祭壇の大きさがcのとき、という風に場合わけして、選べるBの祭壇の大きさを絞って、A,B,Cの組... | from bisect import bisect
N = int(eval(input()))
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
"""
前処理で、中部の祭壇でBi以下のサイズを選べるときの、中段と上段のパーツの組み合わせのパターン数を計算しておく。
"""
BPattern = []
for i in range(N):
b = B[i]
idx = bisect(A... | 31 | 26 | 662 | 546 | from bisect import bisect_left
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
"""
まず、前処理として、「Bの祭壇から大きさb以下のパーツを使うとき、Aの祭壇のパーツとの組み合わせはいくつあるか」というのを調べてメモしておく。
次に、Cの祭壇の大きさがcのとき、という風に場合わけして、選べるBの祭壇の大きさを絞って、A,B,Cの組み合わせの... | from bisect import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
"""
前処理で、中部の祭壇でBi以下のサイズを選べるときの、中段と上段のパーツの組み合わせのパターン数を計算しておく。
"""
BPattern = []
for i in range(N):
b = B[i]
idx = bisect(A, b - 1)
... | false | 16.129032 | [
"-from bisect import bisect_left",
"+from bisect import bisect",
"-まず、前処理として、「Bの祭壇から大きさb以下のパーツを使うとき、Aの祭壇のパーツとの組み合わせはいくつあるか」というのを調べてメモしておく。",
"-次に、Cの祭壇の大きさがcのとき、という風に場合わけして、選べるBの祭壇の大きさを絞って、A,B,Cの組み合わせの数を加算していく。",
"+前処理で、中部の祭壇でBi以下のサイズを選べるときの、中段と上段のパーツの組み合わせのパターン数を計算しておく。",
"-tmpSum = 0",
"-dicB = {}",
... | false | 0.077855 | 0.042213 | 1.844349 | [
"s403889982",
"s909977517"
] |
u562935282 | p03776 | python | s397487075 | s558828275 | 169 | 36 | 38,768 | 5,076 | Accepted | Accepted | 78.7 | def solve() -> 'max(averages), count(max(averages))':
from collections import Counter
from functools import lru_cache
n, a, b = map(int, input().split())
v = tuple(sorted(map(int, input().split()), reverse=True))
def max_ave_x() -> 'max(average),{counts_to_make_max_average}':
ret = -... | def main():
from decimal import Decimal
N, A, B = list(map(int, input().split()))
*v, = list(map(Decimal, input().split()))
v.sort(reverse=True)
max_average = sum(v[:A]) / A
tail = v[A - 1]
contained = [0] * (N + 1)
s = 0
for i, x in enumerate(v, start=1):
i... | 51 | 36 | 1,305 | 769 | def solve() -> "max(averages), count(max(averages))":
from collections import Counter
from functools import lru_cache
n, a, b = map(int, input().split())
v = tuple(sorted(map(int, input().split()), reverse=True))
def max_ave_x() -> "max(average),{counts_to_make_max_average}":
ret = -1
... | def main():
from decimal import Decimal
N, A, B = list(map(int, input().split()))
(*v,) = list(map(Decimal, input().split()))
v.sort(reverse=True)
max_average = sum(v[:A]) / A
tail = v[A - 1]
contained = [0] * (N + 1)
s = 0
for i, x in enumerate(v, start=1):
if x == tail:
... | false | 29.411765 | [
"-def solve() -> \"max(averages), count(max(averages))\":",
"- from collections import Counter",
"- from functools import lru_cache",
"+def main():",
"+ from decimal import Decimal",
"- n, a, b = map(int, input().split())",
"- v = tuple(sorted(map(int, input().split()), reverse=True))",
... | false | 0.036524 | 0.038147 | 0.957453 | [
"s397487075",
"s558828275"
] |
u331105860 | p02695 | python | s246374994 | s100212231 | 308 | 233 | 9,220 | 46,816 | Accepted | Accepted | 24.35 | N, M, Q = list(map(int, input().split()))
G = []
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
G.append([a, b, c, d])
ans = 0
def dfs(s):
global ans
if len(s) == N:
now = 0
for a, b, c, d in G:
if s[b - 1] - s[a - 1] == c:
n... | import numpy as np
import itertools
N, M, Q = list(map(int, input().split()))
G = []
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
G.append([a, b, c, d])
ans = 0
A = np.array(list(itertools.combinations_with_replacement(list(range(1, M + 1)), N)))
n = len(A)
score = np.zeros(n,... | 27 | 19 | 458 | 423 | N, M, Q = list(map(int, input().split()))
G = []
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
G.append([a, b, c, d])
ans = 0
def dfs(s):
global ans
if len(s) == N:
now = 0
for a, b, c, d in G:
if s[b - 1] - s[a - 1] == c:
now += d
... | import numpy as np
import itertools
N, M, Q = list(map(int, input().split()))
G = []
for i in range(Q):
a, b, c, d = list(map(int, input().split()))
G.append([a, b, c, d])
ans = 0
A = np.array(list(itertools.combinations_with_replacement(list(range(1, M + 1)), N)))
n = len(A)
score = np.zeros(n, np.int32)
for ... | false | 29.62963 | [
"+import numpy as np",
"+import itertools",
"+",
"-",
"-",
"-def dfs(s):",
"- global ans",
"- if len(s) == N:",
"- now = 0",
"- for a, b, c, d in G:",
"- if s[b - 1] - s[a - 1] == c:",
"- now += d",
"- ans = max(ans, now)",
"- ret... | false | 0.061929 | 0.296258 | 0.209039 | [
"s246374994",
"s100212231"
] |
u137722467 | p03290 | python | s295723462 | s546339566 | 47 | 23 | 3,188 | 3,064 | Accepted | Accepted | 51.06 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1<<d):
count, score, left = 0, 0, 0
for j in range(d):
if (i >> j) & 1:
score += (j+1)*100*pc[j][0] + pc[j][1]
count += pc[j][0]
else: left =... | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1<<d):
count, score, left = 0, 0, 0
for j in range(d):
if (i >> j) & 1:
score += (j+1)*100*pc[j][0] + pc[j][1]
count += pc[j][0]
else: left =... | 16 | 15 | 486 | 483 | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1 << d):
count, score, left = 0, 0, 0
for j in range(d):
if (i >> j) & 1:
score += (j + 1) * 100 * pc[j][0] + pc[j][1]
count += pc[j][0]
else:
... | d, g = list(map(int, input().split()))
pc = [list(map(int, input().split())) for _ in range(d)]
ans = 1001
for i in range(1 << d):
count, score, left = 0, 0, 0
for j in range(d):
if (i >> j) & 1:
score += (j + 1) * 100 * pc[j][0] + pc[j][1]
count += pc[j][0]
else:
... | false | 6.25 | [
"- for j in range(pc[left][0]):",
"- if score >= g:",
"- break",
"- score += (left + 1) * 100",
"- count += 1",
"+ add = min(-(-max(g - score, 0) // ((left + 1) * 100)), pc[left][0])",
"+ count += add",
"+ score += (left + 1) * 100 * add"
] | false | 0.04879 | 0.080984 | 0.602463 | [
"s295723462",
"s546339566"
] |
u905329882 | p02973 | python | s941649837 | s732285658 | 721 | 443 | 53,720 | 47,708 | Accepted | Accepted | 38.56 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
import bisect
from collections import deque
lis = deque()
for i in range(n):
ind = bisect.bisect_left(lis,a[i])
if ind==0:
lis.appendleft(a[i])
else:
lis[ind-1] = a[i]
print((len(lis)))
| import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
import bisect
from collections import deque
lis = deque()
for i in range(n):
ind = bisect.bisect_left(lis,a[i])
if ind==0:
lis.appendleft(a[i])
... | 17 | 20 | 301 | 365 | n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
import bisect
from collections import deque
lis = deque()
for i in range(n):
ind = bisect.bisect_left(lis, a[i])
if ind == 0:
lis.appendleft(a[i])
else:
lis[ind - 1] = a[i]
print((len(lis)))
| import sys
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
a = []
for i in range(n):
a.append(int(eval(input())))
import bisect
from collections import deque
lis = deque()
for i in range(n):
ind = bisect.bisect_left(lis, a[i])
if ind == 0:
lis.appendleft(a[i])
else:... | false | 15 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline()[:-1]",
"+",
"+"
] | false | 0.051788 | 0.042073 | 1.230902 | [
"s941649837",
"s732285658"
] |
u346812984 | p03380 | python | s268339858 | s055320147 | 132 | 82 | 14,428 | 14,160 | Accepted | Accepted | 37.88 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
M = max(a)
m = M / 2
diff = 10 ** 9
r = None
for i in range(n):
if a[i] == M:
continue
else:
if abs(m - a[i]) < diff:
diff = abs(m - a[i])
r = a[i]
print((M, r))
| import sys
from bisect import bisect_left
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
MAX = max(A)
A = A[:-1]
target... | 17 | 34 | 288 | 655 | n = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
M = max(a)
m = M / 2
diff = 10**9
r = None
for i in range(n):
if a[i] == M:
continue
else:
if abs(m - a[i]) < diff:
diff = abs(m - a[i])
r = a[i]
print((M, r))
| import sys
from bisect import bisect_left
sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7
def input():
return sys.stdin.readline().strip()
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
MAX = max(A)
A = A[:-1]
target = MAX / 2
idx = b... | false | 50 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-a.sort()",
"-M = max(a)",
"-m = M / 2",
"-diff = 10**9",
"-r = None",
"-for i in range(n):",
"- if a[i] == M:",
"- continue",
"+import sys",
"+from bisect import bisect_left",
"+",
"+sys.setrecursionlimit(10**6)... | false | 0.041154 | 0.043141 | 0.95394 | [
"s268339858",
"s055320147"
] |
u848647227 | p03967 | python | s207759942 | s867604988 | 42 | 18 | 3,956 | 3,188 | Accepted | Accepted | 57.14 | ar = list(eval(input()))
g = 0
p = 0
count = 0
for a in ar:
if a == "g":
if g == p:
g += 1
else:
p += 1
count += 1
else:
if g == p:
g += 1
count -= 1
else:
p += 1
print(count) | s = eval(input())
l = len(s)
g = s.count('g')
p = s.count('p')
if g >= p:
print(((g - p) // 2))
else:
print((-(p - g) // 2)) | 18 | 8 | 298 | 129 | ar = list(eval(input()))
g = 0
p = 0
count = 0
for a in ar:
if a == "g":
if g == p:
g += 1
else:
p += 1
count += 1
else:
if g == p:
g += 1
count -= 1
else:
p += 1
print(count)
| s = eval(input())
l = len(s)
g = s.count("g")
p = s.count("p")
if g >= p:
print(((g - p) // 2))
else:
print((-(p - g) // 2))
| false | 55.555556 | [
"-ar = list(eval(input()))",
"-g = 0",
"-p = 0",
"-count = 0",
"-for a in ar:",
"- if a == \"g\":",
"- if g == p:",
"- g += 1",
"- else:",
"- p += 1",
"- count += 1",
"- else:",
"- if g == p:",
"- g += 1",
"- ... | false | 0.032012 | 0.069845 | 0.458328 | [
"s207759942",
"s867604988"
] |
u130900604 | p03311 | python | s392649004 | s506748976 | 195 | 170 | 130,060 | 49,704 | Accepted | Accepted | 12.82 | import statistics
n,*a=list(map(int,open(0).read().split()))
b=[q-i for i,q in enumerate(a,1)]
c=statistics.median(b)
ans=sum(map(abs,[p-c for p in b]))
print((int(ans)))
| from numpy import*
n=int(eval(input()))
a=array(list(map(int,input().split())))
b=a-arange(1,n+1)
c=median(b)
d=abs(b-c).sum()
print((int(d))) | 6 | 7 | 168 | 140 | import statistics
n, *a = list(map(int, open(0).read().split()))
b = [q - i for i, q in enumerate(a, 1)]
c = statistics.median(b)
ans = sum(map(abs, [p - c for p in b]))
print((int(ans)))
| from numpy import *
n = int(eval(input()))
a = array(list(map(int, input().split())))
b = a - arange(1, n + 1)
c = median(b)
d = abs(b - c).sum()
print((int(d)))
| false | 14.285714 | [
"-import statistics",
"+from numpy import *",
"-n, *a = list(map(int, open(0).read().split()))",
"-b = [q - i for i, q in enumerate(a, 1)]",
"-c = statistics.median(b)",
"-ans = sum(map(abs, [p - c for p in b]))",
"-print((int(ans)))",
"+n = int(eval(input()))",
"+a = array(list(map(int, input().spl... | false | 0.131853 | 0.594029 | 0.221964 | [
"s392649004",
"s506748976"
] |
u445624660 | p03660 | python | s093133445 | s703615025 | 634 | 444 | 29,500 | 33,588 | Accepted | Accepted | 29.97 | # [数学、特にグラフ理論の分野における木(き、)とは、連結で閉路を持たないグラフである。]
# なので1->Nは1通り。つまり1->Nの最短経路上にあるマスをつぶすのが先
# で、残ったのを探索できるが、こういう二段構えで実装するのが面倒。
# もうちょっと考えると、1->i とi->Nの距離をみたとき、前者が小さければ先に到達できるので黒で埋められることが分かる
# (進めなくなったら負け、がめんどくさいが、すすめなくなったらパス、とすると、勝敗は変わらないことになる)
# 1とNからスタートして2回BFSすりゃいいか
import sys
from collections import deque
sy... | from collections import deque
import sys
sys.setrecursionlimit(10**8)
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = [int(x) - 1 for x in input().split()]
graph[a].append(b)
graph[b].append(a)
fennec = [10**5 + 10] * n
fennec[0] = 0
snuke = [10**5 + 10] * n
s... | 46 | 37 | 1,254 | 841 | # [数学、特にグラフ理論の分野における木(き、)とは、連結で閉路を持たないグラフである。]
# なので1->Nは1通り。つまり1->Nの最短経路上にあるマスをつぶすのが先
# で、残ったのを探索できるが、こういう二段構えで実装するのが面倒。
# もうちょっと考えると、1->i とi->Nの距離をみたとき、前者が小さければ先に到達できるので黒で埋められることが分かる
# (進めなくなったら負け、がめんどくさいが、すすめなくなったらパス、とすると、勝敗は変わらないことになる)
# 1とNからスタートして2回BFSすりゃいいか
import sys
from collections import deque
sys.setrecurs... | from collections import deque
import sys
sys.setrecursionlimit(10**8)
n = int(eval(input()))
graph = [[] for _ in range(n)]
for _ in range(n - 1):
a, b = [int(x) - 1 for x in input().split()]
graph[a].append(b)
graph[b].append(a)
fennec = [10**5 + 10] * n
fennec[0] = 0
snuke = [10**5 + 10] * n
snuke[n - 1]... | false | 19.565217 | [
"-# [数学、特にグラフ理論の分野における木(き、)とは、連結で閉路を持たないグラフである。]",
"-# なので1->Nは1通り。つまり1->Nの最短経路上にあるマスをつぶすのが先",
"-# で、残ったのを探索できるが、こういう二段構えで実装するのが面倒。",
"-# もうちょっと考えると、1->i とi->Nの距離をみたとき、前者が小さければ先に到達できるので黒で埋められることが分かる",
"-# (進めなくなったら負け、がめんどくさいが、すすめなくなったらパス、とすると、勝敗は変わらないことになる)",
"-# 1とNからスタートして2回BFSすりゃいいか",
"+from collecti... | false | 0.041307 | 0.090659 | 0.455624 | [
"s093133445",
"s703615025"
] |
u978178314 | p03061 | python | s306807251 | s804181328 | 581 | 186 | 14,436 | 14,052 | Accepted | Accepted | 67.99 | from collections import deque
def gcm(a, b):
if a < b:
a = a+b
b=a-b
a = a-b
if b == 0:
return a
else:
r = a%b
return b if r == 0 else gcm(b, r)
N = int(eval(input()))
A = list(map(int, input().split()))
L = deque([0])
for i in range(1, N):
L.append(gcm(L[-1],A[i-1]))
R =... | import sys
sys.setrecursionlimit(10**5)
def GCM(a, b):
if a < b:
a += b
b = a-b
a -= b
if a % b == 0:
return b
else:
return GCM(b, a%b)
N = int(eval(input()))
A = list(map(int, input().split()))
l2r =[]
r2l = []
g = A[0]
for a in A:
g = GCM(g, a)
l2r.append(g)
g = A[-1... | 23 | 30 | 467 | 519 | from collections import deque
def gcm(a, b):
if a < b:
a = a + b
b = a - b
a = a - b
if b == 0:
return a
else:
r = a % b
return b if r == 0 else gcm(b, r)
N = int(eval(input()))
A = list(map(int, input().split()))
L = deque([0])
for i in range(1, N):
L... | import sys
sys.setrecursionlimit(10**5)
def GCM(a, b):
if a < b:
a += b
b = a - b
a -= b
if a % b == 0:
return b
else:
return GCM(b, a % b)
N = int(eval(input()))
A = list(map(int, input().split()))
l2r = []
r2l = []
g = A[0]
for a in A:
g = GCM(g, a)
l2r... | false | 23.333333 | [
"-from collections import deque",
"+import sys",
"+",
"+sys.setrecursionlimit(10**5)",
"-def gcm(a, b):",
"+def GCM(a, b):",
"- a = a + b",
"+ a += b",
"- a = a - b",
"- if b == 0:",
"- return a",
"+ a -= b",
"+ if a % b == 0:",
"+ return b",... | false | 0.054518 | 0.080808 | 0.674666 | [
"s306807251",
"s804181328"
] |
u380772254 | p03722 | python | s426764979 | s526842454 | 1,136 | 306 | 3,568 | 46,440 | Accepted | Accepted | 73.06 | # ABC 061 D
# 有向グラフ各辺のコストを集めて最大化する問題だが、全部符号を変えれば最短経路問題にできる
from math import isinf
class Edge(object):
def __init__(self, src, dst, cost):
self.src = src
self.dst = dst
self.cost = cost
class BellmanFord(object):
def __init__(self, v_len, edges, start):
"""... | import sys
def I(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
# 有向グラフ各辺のコストを集めて最大化する問題だが、全部符号を変えれば最短経路問題にできる
from math import isinf
class Edge(object):
def __in... | 76 | 83 | 2,058 | 2,225 | # ABC 061 D
# 有向グラフ各辺のコストを集めて最大化する問題だが、全部符号を変えれば最短経路問題にできる
from math import isinf
class Edge(object):
def __init__(self, src, dst, cost):
self.src = src
self.dst = dst
self.cost = cost
class BellmanFord(object):
def __init__(self, v_len, edges, start):
"""
隣接行列を使っていない... | import sys
def I():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LMI():
return list(map(int, sys.stdin.readline().split()))
MOD = 10**9 + 7
# 有向グラフ各辺のコストを集めて最大化する問題だが、全部符号を変えれば最短経路問題にできる
from math import isinf
class Edge(object):
def __init... | false | 8.433735 | [
"-# ABC 061 D",
"+import sys",
"+",
"+",
"+def I():",
"+ return int(sys.stdin.readline())",
"+",
"+",
"+def MI():",
"+ return list(map(int, sys.stdin.readline().split()))",
"+",
"+",
"+def LMI():",
"+ return list(map(int, sys.stdin.readline().split()))",
"+",
"+",
"+MOD = 10... | false | 0.04108 | 0.060775 | 0.675934 | [
"s426764979",
"s526842454"
] |
u102461423 | p02972 | python | s121274704 | s302876764 | 343 | 271 | 20,328 | 18,920 | Accepted | Accepted | 20.99 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce
from operator import xor
N = int(readline())
A = [0] + list(map(int,read().split()))
B = [0] * (N+1)
for n in range(N,0,-1):
s = reduce(xor,B[n+n::n],0)
... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce
from operator import xor
N = int(readline())
A = [0] + list(map(int,read().split()))
for n in range(N//2,0,-1):
A[n] = reduce(xor,A[n::n],0)
I = [i for i... | 21 | 19 | 442 | 410 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce
from operator import xor
N = int(readline())
A = [0] + list(map(int, read().split()))
B = [0] * (N + 1)
for n in range(N, 0, -1):
s = reduce(xor, B[n + n :: n], 0)
B... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce
from operator import xor
N = int(readline())
A = [0] + list(map(int, read().split()))
for n in range(N // 2, 0, -1):
A[n] = reduce(xor, A[n::n], 0)
I = [i for i, x in en... | false | 9.52381 | [
"-B = [0] * (N + 1)",
"-for n in range(N, 0, -1):",
"- s = reduce(xor, B[n + n :: n], 0)",
"- B[n] = s ^ A[n]",
"-I = [i for i, x in enumerate(B) if x]",
"+for n in range(N // 2, 0, -1):",
"+ A[n] = reduce(xor, A[n::n], 0)",
"+I = [i for i, x in enumerate(A) if x]"
] | false | 0.037363 | 0.044247 | 0.844417 | [
"s121274704",
"s302876764"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.