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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u761529120 | p03061 | python | s312256646 | s777120528 | 368 | 101 | 89,952 | 86,428 | Accepted | Accepted | 72.55 | import fractions
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
gcd_ans = []
l = [0] * N
r =[0] * N
for i in range(N-1):
l[i+1] = fractions.gcd(l[i],A[i])
r[i+1] = fractions.gcd(r[i],A[N-1-i])
r.reverse()
for i in range(N):
... | from math import gcd
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
R = [0] * (N+1)
L = [0] * (N+1)
for i in range(N):
L[i+1] = gcd(L[i], A[i])
for i in range(N-1,-1,-1):
R[i] = gcd(R[i+1], A[i])
ans = 0
for i in range(N):
a... | 23 | 19 | 402 | 403 | import fractions
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
gcd_ans = []
l = [0] * N
r = [0] * N
for i in range(N - 1):
l[i + 1] = fractions.gcd(l[i], A[i])
r[i + 1] = fractions.gcd(r[i], A[N - 1 - i])
r.reverse()
for i in range(N):
g... | from math import gcd
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
R = [0] * (N + 1)
L = [0] * (N + 1)
for i in range(N):
L[i + 1] = gcd(L[i], A[i])
for i in range(N - 1, -1, -1):
R[i] = gcd(R[i + 1], A[i])
ans = 0
for i in range(N):
ans... | false | 17.391304 | [
"-import fractions",
"+from math import gcd",
"- gcd_ans = []",
"- l = [0] * N",
"- r = [0] * N",
"- for i in range(N - 1):",
"- l[i + 1] = fractions.gcd(l[i], A[i])",
"- r[i + 1] = fractions.gcd(r[i], A[N - 1 - i])",
"- r.reverse()",
"+ R = [0] * (N + 1)",
"+ ... | false | 0.061269 | 0.041534 | 1.475155 | [
"s312256646",
"s777120528"
] |
u473952728 | p03324 | python | s078326178 | s765424615 | 19 | 17 | 3,188 | 3,060 | Accepted | Accepted | 10.53 | from itertools import *
def nth(iterable, n, default=None):
"Returns the nth item or a default value"
return next(islice(iterable, n, None), default)
D, N = list(map(int, input().split()))
delta = 100 ** D
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print((nth(ite, N - 1))) | from itertools import *
d, n = list(map(int, input().split()))
delta = 100 ** d
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print((list(islice(ite, n - 1, n))[0])) | 10 | 5 | 306 | 180 | from itertools import *
def nth(iterable, n, default=None):
"Returns the nth item or a default value"
return next(islice(iterable, n, None), default)
D, N = list(map(int, input().split()))
delta = 100**D
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print((nth(ite, N - 1)))
| from itertools import *
d, n = list(map(int, input().split()))
delta = 100**d
ite = (x for x in count(delta, delta) if x % (delta * 100) != 0)
print((list(islice(ite, n - 1, n))[0]))
| false | 50 | [
"-",
"-def nth(iterable, n, default=None):",
"- \"Returns the nth item or a default value\"",
"- return next(islice(iterable, n, None), default)",
"-",
"-",
"-D, N = list(map(int, input().split()))",
"-delta = 100**D",
"+d, n = list(map(int, input().split()))",
"+delta = 100**d",
"-print((... | false | 0.044128 | 0.140231 | 0.314677 | [
"s078326178",
"s765424615"
] |
u670567845 | p02823 | python | s932413081 | s956572127 | 64 | 28 | 61,936 | 9,040 | Accepted | Accepted | 56.25 | N, A, B = list(map(int, input().split()))
if ((B-A)%2 == 0):
print(((B-A)//2))
else:
print((min([A+(B-A-1)//2 ,N-B+ 1 +(B-A-1)//2]))) | N, A, B = list(map(int,input().split()))
if ((A-B)%2==0):
ans = abs(A-B)//2
elif (N-B <= A-1):
ans = (2*N -A-B+1)//2
elif (N-B > A-1):
ans = (B+A-1)//2
print(ans) | 5 | 8 | 132 | 169 | N, A, B = list(map(int, input().split()))
if (B - A) % 2 == 0:
print(((B - A) // 2))
else:
print((min([A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2])))
| N, A, B = list(map(int, input().split()))
if (A - B) % 2 == 0:
ans = abs(A - B) // 2
elif N - B <= A - 1:
ans = (2 * N - A - B + 1) // 2
elif N - B > A - 1:
ans = (B + A - 1) // 2
print(ans)
| false | 37.5 | [
"-if (B - A) % 2 == 0:",
"- print(((B - A) // 2))",
"-else:",
"- print((min([A + (B - A - 1) // 2, N - B + 1 + (B - A - 1) // 2])))",
"+if (A - B) % 2 == 0:",
"+ ans = abs(A - B) // 2",
"+elif N - B <= A - 1:",
"+ ans = (2 * N - A - B + 1) // 2",
"+elif N - B > A - 1:",
"+ ans = (B ... | false | 0.041276 | 0.035349 | 1.167659 | [
"s932413081",
"s956572127"
] |
u686036872 | p03112 | python | s618177035 | s538396508 | 1,851 | 1,711 | 13,496 | 14,176 | Accepted | Accepted | 7.56 | import bisect
A, B, Q = list(map(int, input().split()))
a=[-float("inf")]
b=[-float("inf")]
for i in range(A):
a.append(int(eval(input())))
for i in range(B):
b.append(int(eval(input())))
a+=[float("inf")]
b+=[float("inf")]
for i in range(Q):
q = int(eval(input()))
x = bisect.bisect_l... | import bisect
A, B, Q = list(map(int, input().split()))
INF=10**18
S=[-INF]+[int(eval(input())) for i in range(A)]+[INF]
T=[-INF]+[int(eval(input())) for i in range(B)]+[INF]
for i in range(Q):
x = int(eval(input()))
s = bisect.bisect_left(S, x)
t = bisect.bisect_left(T, x)
saisyo = float... | 23 | 17 | 559 | 458 | import bisect
A, B, Q = list(map(int, input().split()))
a = [-float("inf")]
b = [-float("inf")]
for i in range(A):
a.append(int(eval(input())))
for i in range(B):
b.append(int(eval(input())))
a += [float("inf")]
b += [float("inf")]
for i in range(Q):
q = int(eval(input()))
x = bisect.bisect_left(a, q)
... | import bisect
A, B, Q = list(map(int, input().split()))
INF = 10**18
S = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for i in range(Q):
x = int(eval(input()))
s = bisect.bisect_left(S, x)
t = bisect.bisect_left(T, x)
saisyo = float... | false | 26.086957 | [
"-a = [-float(\"inf\")]",
"-b = [-float(\"inf\")]",
"-for i in range(A):",
"- a.append(int(eval(input())))",
"-for i in range(B):",
"- b.append(int(eval(input())))",
"-a += [float(\"inf\")]",
"-b += [float(\"inf\")]",
"+INF = 10**18",
"+S = [-INF] + [int(eval(input())) for i in range(A)] + [... | false | 0.090504 | 0.075124 | 1.204723 | [
"s618177035",
"s538396508"
] |
u561231954 | p03163 | python | s263204885 | s902835393 | 513 | 230 | 120,044 | 92,088 | Accepted | Accepted | 55.17 | n,W=list(map(int,input().split()))
items=[list(map(int,input().split())) for i in range(n)]
dp=[[0]*(W+1) for i in range(n+1)]
for i in range(n-1,-1,-1):
for j in range(W+1):
if j<items[i][0]:
dp[i][j]=dp[i+1][j]
else:
dp[i][j]=max(dp[i+1][j],dp[i+1][j-items[i][0]]+items[i][1])
print(... | def main():
import numpy as np
import sys
input=sys.stdin.readline
n,w=list(map(int,input().split()))
items=np.array([list(map(int,input().split())) for _ in range(n)])
dp=np.zeros([n+1,w+1],dtype=np.int64)
for i in range(n):
wi=items[i][0]
vi=items[i][1]
... | 13 | 19 | 330 | 477 | n, W = list(map(int, input().split()))
items = [list(map(int, input().split())) for i in range(n)]
dp = [[0] * (W + 1) for i in range(n + 1)]
for i in range(n - 1, -1, -1):
for j in range(W + 1):
if j < items[i][0]:
dp[i][j] = dp[i + 1][j]
else:
dp[i][j] = max(dp[i + 1][j], d... | def main():
import numpy as np
import sys
input = sys.stdin.readline
n, w = list(map(int, input().split()))
items = np.array([list(map(int, input().split())) for _ in range(n)])
dp = np.zeros([n + 1, w + 1], dtype=np.int64)
for i in range(n):
wi = items[i][0]
vi = items[i][1... | false | 31.578947 | [
"-n, W = list(map(int, input().split()))",
"-items = [list(map(int, input().split())) for i in range(n)]",
"-dp = [[0] * (W + 1) for i in range(n + 1)]",
"-for i in range(n - 1, -1, -1):",
"- for j in range(W + 1):",
"- if j < items[i][0]:",
"- dp[i][j] = dp[i + 1][j]",
"- ... | false | 0.06162 | 0.332037 | 0.185581 | [
"s263204885",
"s902835393"
] |
u844646164 | p02973 | python | s852047695 | s567135415 | 546 | 338 | 56,152 | 49,884 | Accepted | Accepted | 38.1 | import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
b = []
for a in A[::-1]:
idx = bisect.bisect_right(b, a)
if len(b) <= idx:
b.append(a)
else:
b[idx] = a
print((len(b)))
| import bisect
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [float('inf')]*(N+1)
for a in A[::-1]:
idx = bisect.bisect_right(dp, a)
dp[idx] = a
ans = 0
for n in dp:
if n != float('inf'):
ans += 1
print(ans) | 12 | 16 | 212 | 284 | import bisect
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
b = []
for a in A[::-1]:
idx = bisect.bisect_right(b, a)
if len(b) <= idx:
b.append(a)
else:
b[idx] = a
print((len(b)))
| import bisect
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
dp = [float("inf")] * (N + 1)
for a in A[::-1]:
idx = bisect.bisect_right(dp, a)
dp[idx] = a
ans = 0
for n in dp:
if n != float("inf"):
ans += 1
print(ans)
| false | 25 | [
"+import sys",
"+input = sys.stdin.readline",
"-b = []",
"+dp = [float(\"inf\")] * (N + 1)",
"- idx = bisect.bisect_right(b, a)",
"- if len(b) <= idx:",
"- b.append(a)",
"- else:",
"- b[idx] = a",
"-print((len(b)))",
"+ idx = bisect.bisect_right(dp, a)",
"+ dp[idx]... | false | 0.055278 | 0.048634 | 1.136611 | [
"s852047695",
"s567135415"
] |
u992910889 | p03910 | python | s628725262 | s792436634 | 258 | 209 | 44,784 | 41,712 | Accepted | Accepted | 18.99 | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
N = int(eval(input()))
def main(N):
i = 1
ans = 0
while True:
ans += i
if ans >= N:
print(i)
if... | import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()
def resolve():
n=int(eval(input()))
ans=0
i=0
while ans<n:
i+=1
ans+=i
print(i)
rem=n-i
i-=1
if rem!=0:
while i>0:
if rem-i>=0:
... | 35 | 28 | 660 | 437 | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
N = int(eval(input()))
def main(N):
i = 1
ans = 0
while True:
ans += i
if ans >= N:
print(i)
if N - i != 0:
... | import sys
sys.setrecursionlimit(10**5 + 10)
def input():
return sys.stdin.readline().strip()
def resolve():
n = int(eval(input()))
ans = 0
i = 0
while ans < n:
i += 1
ans += i
print(i)
rem = n - i
i -= 1
if rem != 0:
while i > 0:
if rem - i >... | false | 20 | [
"- N = int(eval(input()))",
"-",
"- def main(N):",
"- i = 1",
"- ans = 0",
"- while True:",
"- ans += i",
"- if ans >= N:",
"+ n = int(eval(input()))",
"+ ans = 0",
"+ i = 0",
"+ while ans < n:",
"+ i += 1",
"+ ans ... | false | 0.041953 | 0.115567 | 0.363021 | [
"s628725262",
"s792436634"
] |
u326609687 | p03074 | python | s319292568 | s781586138 | 65 | 49 | 4,460 | 4,468 | Accepted | Accepted | 24.62 | from collections import deque
def nextj(n):
while S[n] == '0':
n += 1
if n == N:
return N
q.appendleft(n)
while S[n] == '1':
n += 1
if n == N:
return N
return n
def init(n):
while S[n] == '1':
n += 1
if n ... | from collections import deque
def calc():
q.appendleft(0)
ans = 0
d = '1'
kc = 0
for i, c in enumerate(S):
if c != d:
d = c
if c == '0':
if kc == K:
ans = max(ans, i - q.pop())
else:
... | 45 | 25 | 755 | 497 | from collections import deque
def nextj(n):
while S[n] == "0":
n += 1
if n == N:
return N
q.appendleft(n)
while S[n] == "1":
n += 1
if n == N:
return N
return n
def init(n):
while S[n] == "1":
n += 1
if n == N:
r... | from collections import deque
def calc():
q.appendleft(0)
ans = 0
d = "1"
kc = 0
for i, c in enumerate(S):
if c != d:
d = c
if c == "0":
if kc == K:
ans = max(ans, i - q.pop())
else:
kc += 1
... | false | 44.444444 | [
"-",
"-",
"-def nextj(n):",
"- while S[n] == \"0\":",
"- n += 1",
"- if n == N:",
"- return N",
"- q.appendleft(n)",
"- while S[n] == \"1\":",
"- n += 1",
"- if n == N:",
"- return N",
"- return n",
"-",
"-",
"-def init(n):"... | false | 0.039282 | 0.04741 | 0.828559 | [
"s319292568",
"s781586138"
] |
u786150969 | p03331 | python | s217027209 | s820784309 | 233 | 129 | 9,500 | 9,232 | Accepted | Accepted | 44.64 | # AGC 025 A - Digits Sum
N = int(eval(input()))
def sum_of(num):
list_b = []
k = 0
while num > 0:
list_b.append(num%10)
num //= 10
for i in range(len(list_b)):
k += list_b[i]
return k
list_a =[]
if N <= 10:
print((str(N)))
if N > 10:
for i in rang... | # AGC 025 A - Digits Sum
N = int(eval(input()))
def sum_of(num):
list_b = []
k = 0
while num > 0:
list_b.append(num%10)
num //= 10
for i in range(len(list_b)):
k += list_b[i]
return k
list_a =[]
if N <= 10:
print((str(N)))
if N > 10:
for i in rang... | 22 | 22 | 425 | 432 | # AGC 025 A - Digits Sum
N = int(eval(input()))
def sum_of(num):
list_b = []
k = 0
while num > 0:
list_b.append(num % 10)
num //= 10
for i in range(len(list_b)):
k += list_b[i]
return k
list_a = []
if N <= 10:
print((str(N)))
if N > 10:
for i in range(2, N - 1):
... | # AGC 025 A - Digits Sum
N = int(eval(input()))
def sum_of(num):
list_b = []
k = 0
while num > 0:
list_b.append(num % 10)
num //= 10
for i in range(len(list_b)):
k += list_b[i]
return k
list_a = []
if N <= 10:
print((str(N)))
if N > 10:
for i in range(2, (N - 1) /... | false | 0 | [
"- for i in range(2, N - 1):",
"+ for i in range(2, (N - 1) // 2 + 1):"
] | false | 0.198389 | 0.122796 | 1.615593 | [
"s217027209",
"s820784309"
] |
u225388820 | p03488 | python | s102525948 | s050345047 | 322 | 278 | 83,780 | 83,512 | Accepted | Accepted | 13.66 | from copy import copy
s = eval(input()) + "T"
n=len(s)
x, y = list(map(int, input().split()))
xy=[[],[]]
sgn = 1
now = n
for i in range(n):
if s[i] == "T":
x -= i
now = i + 1
break
for i in range(now, n):
if s[i] == "T":
xy[sgn].append(i - now)
now = i ... | from copy import copy
s = eval(input())
n=len(s)
x, y = list(map(int, input().split()))
d = [len(v) for v in s.split("T")]
x -= d[0]
a = d[2::2]
b = d[1::2]
def c(d, x):
cur = {0}
for i in d:
nxt = set()
for j in cur:
nxt.add(j + i)
nxt.add(j - i)
... | 40 | 22 | 667 | 398 | from copy import copy
s = eval(input()) + "T"
n = len(s)
x, y = list(map(int, input().split()))
xy = [[], []]
sgn = 1
now = n
for i in range(n):
if s[i] == "T":
x -= i
now = i + 1
break
for i in range(now, n):
if s[i] == "T":
xy[sgn].append(i - now)
now = i + 1
s... | from copy import copy
s = eval(input())
n = len(s)
x, y = list(map(int, input().split()))
d = [len(v) for v in s.split("T")]
x -= d[0]
a = d[2::2]
b = d[1::2]
def c(d, x):
cur = {0}
for i in d:
nxt = set()
for j in cur:
nxt.add(j + i)
nxt.add(j - i)
cur = copy(... | false | 45 | [
"-s = eval(input()) + \"T\"",
"+s = eval(input())",
"-xy = [[], []]",
"-sgn = 1",
"-now = n",
"-for i in range(n):",
"- if s[i] == \"T\":",
"- x -= i",
"- now = i + 1",
"- break",
"-for i in range(now, n):",
"- if s[i] == \"T\":",
"- xy[sgn].append(i - now)"... | false | 0.048093 | 0.085971 | 0.559404 | [
"s102525948",
"s050345047"
] |
u867826040 | p02580 | python | s991951701 | s999325639 | 2,884 | 2,357 | 214,376 | 144,488 | Accepted | Accepted | 18.27 | from random import randint
import numpy as np
from numba import njit
@njit(cache=True)
def f(h,w,m,yp,xp,s):
ypm = yp[:,0].max()
xpm = xp[:,0].max()
yps = yp[yp[:,0] == ypm][:,1]
xps = xp[xp[:,0] == xpm][:,1]
ans = 0
for ypsi in yps:
for xpsi in xps:
a = yp[yp... | #from random import randint
import numpy as np
#@njit
def f(h,w,m,ins):
yp = np.zeros(h,dtype=np.int)
xp = np.zeros(w,dtype=np.int)
#yp[:,1] = np.arange(h)
#xp[:,1] = np.arange(w)
ans = 0
s = set()
for hi,wi in ins:
s.add((hi-1,wi-1))
yp[hi-1] += 1
xp... | 36 | 43 | 817 | 1,096 | from random import randint
import numpy as np
from numba import njit
@njit(cache=True)
def f(h, w, m, yp, xp, s):
ypm = yp[:, 0].max()
xpm = xp[:, 0].max()
yps = yp[yp[:, 0] == ypm][:, 1]
xps = xp[xp[:, 0] == xpm][:, 1]
ans = 0
for ypsi in yps:
for xpsi in xps:
a = yp[ypsi,... | # from random import randint
import numpy as np
# @njit
def f(h, w, m, ins):
yp = np.zeros(h, dtype=np.int)
xp = np.zeros(w, dtype=np.int)
# yp[:,1] = np.arange(h)
# xp[:,1] = np.arange(w)
ans = 0
s = set()
for hi, wi in ins:
s.add((hi - 1, wi - 1))
yp[hi - 1] += 1
x... | false | 16.27907 | [
"-from random import randint",
"+# from random import randint",
"-from numba import njit",
"-",
"-@njit(cache=True)",
"-def f(h, w, m, yp, xp, s):",
"- ypm = yp[:, 0].max()",
"- xpm = xp[:, 0].max()",
"- yps = yp[yp[:, 0] == ypm][:, 1]",
"- xps = xp[xp[:, 0] == xpm][:, 1]",
"+# @njit... | false | 0.473722 | 0.539299 | 0.878402 | [
"s991951701",
"s999325639"
] |
u392319141 | p02709 | python | s851278322 | s279145608 | 155 | 134 | 105,664 | 96,320 | Accepted | Accepted | 13.55 | N = int(eval(input()))
A = [(a, i) for i, a in enumerate(map(int, input().split()), start=1)]
A.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for s, (a, i) in enumerate(A):
for l in range(s + 1):
r = s - l
dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a * (i - (l + 1)))
... | N = int(eval(input()))
A = [(a, i) for i, a in enumerate(map(int, input().split()), start=1)]
A.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for s, (a, i) in enumerate(A):
for l in range(s + 1):
r = s - l
dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a * (i - (l + 1)))
... | 14 | 16 | 427 | 461 | N = int(eval(input()))
A = [(a, i) for i, a in enumerate(map(int, input().split()), start=1)]
A.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for s, (a, i) in enumerate(A):
for l in range(s + 1):
r = s - l
dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a * (i - (l + 1)))
dp[l][r... | N = int(eval(input()))
A = [(a, i) for i, a in enumerate(map(int, input().split()), start=1)]
A.sort(reverse=True)
dp = [[0] * (N + 1) for _ in range(N + 1)]
for s, (a, i) in enumerate(A):
for l in range(s + 1):
r = s - l
dp[l + 1][r] = max(dp[l + 1][r], dp[l][r] + a * (i - (l + 1)))
dp[l][r... | false | 12.5 | [
"-ans = max([max(d) for d in dp])",
"+ans = 0",
"+for i in range(N + 1):",
"+ ans = max(ans, dp[i][N - i])"
] | false | 0.042893 | 0.160083 | 0.267942 | [
"s851278322",
"s279145608"
] |
u325282913 | p03626 | python | s622123482 | s982151276 | 163 | 67 | 38,256 | 61,888 | Accepted | Accepted | 58.9 | MOD = 10**9 + 7
N = int(eval(input()))
S = eval(input())
S2 = eval(input())
check = []
flg = False
for i in range(N-1):
if flg:
check.append(2)
flg = False
continue
if S[i] == S[i+1]:
flg = True
else:
check.append(1)
if flg:
check.append(2)
else:
... | MOD = 10**9 + 7
N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
check = []
index = 0
while index < N:
if S1[index] == S2[index]:
check.append(1)
index += 1
else:
check.append(2)
index += 2
ans = 3 if check[0] == 1 else 6
for i in range(1,len(check)):
... | 26 | 21 | 508 | 413 | MOD = 10**9 + 7
N = int(eval(input()))
S = eval(input())
S2 = eval(input())
check = []
flg = False
for i in range(N - 1):
if flg:
check.append(2)
flg = False
continue
if S[i] == S[i + 1]:
flg = True
else:
check.append(1)
if flg:
check.append(2)
else:
check.app... | MOD = 10**9 + 7
N = int(eval(input()))
S1 = eval(input())
S2 = eval(input())
check = []
index = 0
while index < N:
if S1[index] == S2[index]:
check.append(1)
index += 1
else:
check.append(2)
index += 2
ans = 3 if check[0] == 1 else 6
for i in range(1, len(check)):
if check[i ... | false | 19.230769 | [
"-S = eval(input())",
"+S1 = eval(input())",
"-flg = False",
"-for i in range(N - 1):",
"- if flg:",
"+index = 0",
"+while index < N:",
"+ if S1[index] == S2[index]:",
"+ check.append(1)",
"+ index += 1",
"+ else:",
"- flg = False",
"- continue",
"- ... | false | 0.054262 | 0.035465 | 1.530041 | [
"s622123482",
"s982151276"
] |
u193264896 | p03044 | python | s122294220 | s598985994 | 940 | 409 | 155,824 | 39,144 | Accepted | Accepted | 56.49 | from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
import math
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)
def main... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
tree = [[] for _ in range(N)]
for i in range(N-1):
u, v, w = list(map(int, readline().split()))
u, v ... | 33 | 34 | 751 | 844 | from collections import deque
from collections import Counter
from itertools import product, permutations, combinations
from operator import itemgetter
from heapq import heappop, heappush
import math
import sys
input = sys.stdin.readline
# 文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)
def main():
... | import sys
from collections import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7
def main():
N = int(readline())
tree = [[] for _ in range(N)]
for i in range(N - 1):
u, v, w = list(map(int, readline().split()))
u, v = u - 1, v -... | false | 2.941176 | [
"+import sys",
"-from collections import Counter",
"-from itertools import product, permutations, combinations",
"-from operator import itemgetter",
"-from heapq import heappop, heappush",
"-import math",
"-import sys",
"-input = sys.stdin.readline",
"-# 文字列のときはうまく行かないのでコメントアウトすること",
"-sys.setrecu... | false | 0.044112 | 0.043022 | 1.02535 | [
"s122294220",
"s598985994"
] |
u936985471 | p03141 | python | s603404546 | s428739645 | 527 | 245 | 30,056 | 32,588 | Accepted | Accepted | 53.51 | N=int(eval(input()))
A=[0]*N
B=[0]*N
diff=[0]*N
for i in range(N):
A[i],B[i]=list(map(int,input().split()))
diff[i]=[A[i]+B[i],i]
diff=sorted(diff,key=lambda x:x[0])[::-1]
taka=0
aoki=0
for i in range(len(diff)):
if i%2==0:
taka+=A[diff[i][1]]
else:
aoki+=B[diff[i][1]]
print((taka-a... | import sys
readline = sys.stdin.readline
N = int(readline())
A = [0] * N
B = [0] * N
C = [0] * N
for i in range(N):
A[i],B[i] = list(map(int,readline().split()))
C[i] = (A[i] + B[i], i)
C = sorted(C, key = lambda x:x[0], reverse = True)
ans = 0
for i in range(len(C)):
if i % 2 == 0:
ans +... | 18 | 21 | 311 | 376 | N = int(eval(input()))
A = [0] * N
B = [0] * N
diff = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
diff[i] = [A[i] + B[i], i]
diff = sorted(diff, key=lambda x: x[0])[::-1]
taka = 0
aoki = 0
for i in range(len(diff)):
if i % 2 == 0:
taka += A[diff[i][1]]
else:
a... | import sys
readline = sys.stdin.readline
N = int(readline())
A = [0] * N
B = [0] * N
C = [0] * N
for i in range(N):
A[i], B[i] = list(map(int, readline().split()))
C[i] = (A[i] + B[i], i)
C = sorted(C, key=lambda x: x[0], reverse=True)
ans = 0
for i in range(len(C)):
if i % 2 == 0:
ans += A[C[i][1]... | false | 14.285714 | [
"-N = int(eval(input()))",
"+import sys",
"+",
"+readline = sys.stdin.readline",
"+N = int(readline())",
"-diff = [0] * N",
"+C = [0] * N",
"- A[i], B[i] = list(map(int, input().split()))",
"- diff[i] = [A[i] + B[i], i]",
"-diff = sorted(diff, key=lambda x: x[0])[::-1]",
"-taka = 0",
"-a... | false | 0.036838 | 0.037508 | 0.98214 | [
"s603404546",
"s428739645"
] |
u120691615 | p03456 | python | s995756049 | s307832894 | 23 | 18 | 2,940 | 2,940 | Accepted | Accepted | 21.74 | a,b = list(map(str,input().split()))
x = int(a + b)
ans = "No"
for i in range(x // 2):
if x == i * i:
ans = "Yes"
print(ans) | a,b = list(map(str,input().split()))
x = int(a + b)
if x ** 0.5 == int(x ** 0.5):
print("Yes")
else:
print("No") | 7 | 6 | 136 | 119 | a, b = list(map(str, input().split()))
x = int(a + b)
ans = "No"
for i in range(x // 2):
if x == i * i:
ans = "Yes"
print(ans)
| a, b = list(map(str, input().split()))
x = int(a + b)
if x**0.5 == int(x**0.5):
print("Yes")
else:
print("No")
| false | 14.285714 | [
"-ans = \"No\"",
"-for i in range(x // 2):",
"- if x == i * i:",
"- ans = \"Yes\"",
"-print(ans)",
"+if x**0.5 == int(x**0.5):",
"+ print(\"Yes\")",
"+else:",
"+ print(\"No\")"
] | false | 0.095423 | 0.049071 | 1.944576 | [
"s995756049",
"s307832894"
] |
u392319141 | p03209 | python | s620928313 | s844846709 | 32 | 24 | 3,932 | 3,684 | Accepted | Accepted | 25 | from functools import lru_cache
N, X = list(map(int, input().split()))
@lru_cache(maxsize=None)
def length(level):
if level <= 0:
return 1
return length(level - 1) * 2 + 3
@lru_cache(maxsize=None)
def search(level, right):
if level == 0:
return 1
ret = 0
right -= ... | from functools import lru_cache
N, X = list(map(int, input().split()))
@lru_cache(maxsize=None)
def size(level):
return 1 if level == 0 else size(level - 1) * 2 + 3
@lru_cache(maxsize=None)
def calc(level, N):
if level == 0:
return 1 if N > 0 else 0
N = min(N, size(level))
re... | 30 | 29 | 609 | 567 | from functools import lru_cache
N, X = list(map(int, input().split()))
@lru_cache(maxsize=None)
def length(level):
if level <= 0:
return 1
return length(level - 1) * 2 + 3
@lru_cache(maxsize=None)
def search(level, right):
if level == 0:
return 1
ret = 0
right -= 1
if length... | from functools import lru_cache
N, X = list(map(int, input().split()))
@lru_cache(maxsize=None)
def size(level):
return 1 if level == 0 else size(level - 1) * 2 + 3
@lru_cache(maxsize=None)
def calc(level, N):
if level == 0:
return 1 if N > 0 else 0
N = min(N, size(level))
ret = 0
N -= ... | false | 3.333333 | [
"-def length(level):",
"- if level <= 0:",
"- return 1",
"- return length(level - 1) * 2 + 3",
"+def size(level):",
"+ return 1 if level == 0 else size(level - 1) * 2 + 3",
"-def search(level, right):",
"+def calc(level, N):",
"- return 1",
"+ return 1 if N > 0 else 0... | false | 0.036909 | 0.036861 | 1.001306 | [
"s620928313",
"s844846709"
] |
u046158516 | p02628 | python | s143405525 | s305494938 | 74 | 61 | 62,304 | 62,472 | Accepted | Accepted | 17.57 | n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(k):
ans+=a[i]
print(ans) | n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
p.sort()
ans=0
for i in range(k):
ans+=p[i]
print(ans) | 7 | 7 | 124 | 124 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(k):
ans += a[i]
print(ans)
| n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
ans += p[i]
print(ans)
| false | 0 | [
"-a = list(map(int, input().split()))",
"-a.sort()",
"+p = list(map(int, input().split()))",
"+p.sort()",
"- ans += a[i]",
"+ ans += p[i]"
] | false | 0.046737 | 0.046724 | 1.000278 | [
"s143405525",
"s305494938"
] |
u682730715 | p03062 | python | s998203200 | s772761148 | 266 | 102 | 29,252 | 16,644 | Accepted | Accepted | 61.65 | # coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0 for i in r... | # coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
s = 0
b... | 23 | 29 | 530 | 506 | # coding: UTF-8
import sys
# sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(eval(input()))
a = list(map(int, input().split()))
dp = [[0 for i in range(2)] for i ... | # coding: UTF-8
import sys
# sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0
s = 0
b = []
for i in ra... | false | 20.689655 | [
"-dp = [[0 for i in range(2)] for i in range(n + 1)]",
"-dp[0][1] = float(\"inf\") * -1",
"+count = 0",
"+s = 0",
"+b = []",
"- dp[i + 1][0] = max(dp[i][0] + a[i], dp[i][1] - a[i])",
"- dp[i + 1][1] = max(dp[i][0] - a[i], dp[i][1] + a[i])",
"-print((dp[n][0]))",
"+ count += 1 if a[i] < 0 el... | false | 0.064724 | 0.043326 | 1.493875 | [
"s998203200",
"s772761148"
] |
u001024152 | p03497 | python | s735609592 | s199225878 | 231 | 169 | 41,116 | 32,540 | Accepted | Accepted | 26.84 | from collections import defaultdict
from operator import itemgetter
N,K = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt_d = defaultdict(lambda: 0)
for ai in a:
cnt_d[ai] += 1
cnt_l = sorted(list(cnt_d.items()), key=itemgetter(1))
ans = sum([v for k,v in cnt_l[:-K]])
print(ans)... | from collections import defaultdict
N,K = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt_d = defaultdict(lambda: 0)
for ai in a:
cnt_d[ai] += 1
cnt_v = sorted([v for k,v in list(cnt_d.items())])
print((sum(cnt_v[:-K])))
| 12 | 10 | 309 | 246 | from collections import defaultdict
from operator import itemgetter
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt_d = defaultdict(lambda: 0)
for ai in a:
cnt_d[ai] += 1
cnt_l = sorted(list(cnt_d.items()), key=itemgetter(1))
ans = sum([v for k, v in cnt_l[:-K]])
print(ans)
| from collections import defaultdict
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt_d = defaultdict(lambda: 0)
for ai in a:
cnt_d[ai] += 1
cnt_v = sorted([v for k, v in list(cnt_d.items())])
print((sum(cnt_v[:-K])))
| false | 16.666667 | [
"-from operator import itemgetter",
"-cnt_l = sorted(list(cnt_d.items()), key=itemgetter(1))",
"-ans = sum([v for k, v in cnt_l[:-K]])",
"-print(ans)",
"+cnt_v = sorted([v for k, v in list(cnt_d.items())])",
"+print((sum(cnt_v[:-K])))"
] | false | 0.036067 | 0.07719 | 0.467247 | [
"s735609592",
"s199225878"
] |
u298297089 | p03637 | python | s746438596 | s596075491 | 73 | 63 | 11,480 | 11,096 | Accepted | Accepted | 13.7 | n = int(eval(input()))
zero = 0
two = 0
four = 0
for i in map(int, input().split()):
if i % 4 == 0:
four += 1
elif i % 2 == 0 and i % 4 != 0:
two += 1
else :
zero += 1
flag = True
if zero > four:
flag = False
if zero == four + 1 and two == 0:
flag = True
print(('Yes' if flag ... | n = int(eval(input()))
two = 0
four = 0
for i in map(int, input().split()):
if i % 4 == 0:
four += 1
elif i % 2 == 0:
two += 1
tmp = two * (two > 1)
print(('Yes' if (four * 2 + (four == n // 2) + two * (two > 1)) >= n else 'No'))
| 18 | 12 | 323 | 259 | n = int(eval(input()))
zero = 0
two = 0
four = 0
for i in map(int, input().split()):
if i % 4 == 0:
four += 1
elif i % 2 == 0 and i % 4 != 0:
two += 1
else:
zero += 1
flag = True
if zero > four:
flag = False
if zero == four + 1 and two == 0:
flag = True
print(("Yes" i... | n = int(eval(input()))
two = 0
four = 0
for i in map(int, input().split()):
if i % 4 == 0:
four += 1
elif i % 2 == 0:
two += 1
tmp = two * (two > 1)
print(("Yes" if (four * 2 + (four == n // 2) + two * (two > 1)) >= n else "No"))
| false | 33.333333 | [
"-zero = 0",
"- elif i % 2 == 0 and i % 4 != 0:",
"+ elif i % 2 == 0:",
"- else:",
"- zero += 1",
"-flag = True",
"-if zero > four:",
"- flag = False",
"- if zero == four + 1 and two == 0:",
"- flag = True",
"-print((\"Yes\" if flag else \"No\"))",
"+tmp = two * (t... | false | 0.044849 | 0.03708 | 1.209522 | [
"s746438596",
"s596075491"
] |
u411203878 | p02720 | python | s689097593 | s450616095 | 945 | 110 | 42,864 | 76,692 | Accepted | Accepted | 88.36 | n=int(eval(input()))
query = [1, 2, 3, 4, 5, 6, 7, 8, 9]
if n <= 9:
print(n)
else:
count = 9
while count<=n:
i = query.pop(0)
if i%10-1>=0:
query.append(i*10+(i%10-1))
count += 1
if count == n:
print((i*10+(i%10-1)))
... | from collections import deque
n=int(eval(input()))
if n < 10:
print(n)
else:
check_box = deque([1,2,3,4,5,6,7,8,9])
check_num = 9
while True:
add_num = check_box.popleft()
add_num = str(add_num)
if int(add_num[-1]) - 1 >= 0:
check_box.append(int(add_n... | 30 | 33 | 640 | 951 | n = int(eval(input()))
query = [1, 2, 3, 4, 5, 6, 7, 8, 9]
if n <= 9:
print(n)
else:
count = 9
while count <= n:
i = query.pop(0)
if i % 10 - 1 >= 0:
query.append(i * 10 + (i % 10 - 1))
count += 1
if count == n:
print((i * 10 + (i % 10 - 1)... | from collections import deque
n = int(eval(input()))
if n < 10:
print(n)
else:
check_box = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
check_num = 9
while True:
add_num = check_box.popleft()
add_num = str(add_num)
if int(add_num[-1]) - 1 >= 0:
check_box.append(int(add_num + s... | false | 9.090909 | [
"+from collections import deque",
"+",
"-query = [1, 2, 3, 4, 5, 6, 7, 8, 9]",
"-if n <= 9:",
"+if n < 10:",
"- count = 9",
"- while count <= n:",
"- i = query.pop(0)",
"- if i % 10 - 1 >= 0:",
"- query.append(i * 10 + (i % 10 - 1))",
"- count += 1",
"... | false | 0.079465 | 0.121684 | 0.653045 | [
"s689097593",
"s450616095"
] |
u200228637 | p02627 | python | s481944051 | s174948209 | 28 | 22 | 9,080 | 9,024 | Accepted | Accepted | 21.43 | a = eval(input())
if a.isupper() == False:
print('a')
else:
print('A') | a = eval(input())
if a.islower() == True:
print('a')
else:
print('A')
| 5 | 5 | 72 | 72 | a = eval(input())
if a.isupper() == False:
print("a")
else:
print("A")
| a = eval(input())
if a.islower() == True:
print("a")
else:
print("A")
| false | 0 | [
"-if a.isupper() == False:",
"+if a.islower() == True:"
] | false | 0.038118 | 0.111476 | 0.341939 | [
"s481944051",
"s174948209"
] |
u287132915 | p02695 | python | s689900285 | s902760045 | 1,552 | 744 | 9,136 | 9,228 | Accepted | Accepted | 52.06 | import itertools
n, m, q = list(map(int, input().split()))
kumi = []
for i in range(q):
kumii = list(map(int, input().split()))
kumi.append(kumii)
ans = 0
for a in itertools.combinations_with_replacement(list(range(1, m+1)), n):
temp = 0
for i in range(q):
ai, bi, ci, di = kumi[i]
... | n, m, q = list(map(int, input().split()))
kumi = []
for i in range(q):
kumii = list(map(int, input().split()))
kumi.append(kumii)
ans = 0
a = [0 for i in range(n)]
def dfs(p):
global ans
if p == 0:
for i in range(1, m+1):
a[p] = i
dfs(p+1)
else:
... | 19 | 30 | 433 | 727 | import itertools
n, m, q = list(map(int, input().split()))
kumi = []
for i in range(q):
kumii = list(map(int, input().split()))
kumi.append(kumii)
ans = 0
for a in itertools.combinations_with_replacement(list(range(1, m + 1)), n):
temp = 0
for i in range(q):
ai, bi, ci, di = kumi[i]
ai,... | n, m, q = list(map(int, input().split()))
kumi = []
for i in range(q):
kumii = list(map(int, input().split()))
kumi.append(kumii)
ans = 0
a = [0 for i in range(n)]
def dfs(p):
global ans
if p == 0:
for i in range(1, m + 1):
a[p] = i
dfs(p + 1)
else:
for i in... | false | 36.666667 | [
"-import itertools",
"-",
"-for a in itertools.combinations_with_replacement(list(range(1, m + 1)), n):",
"- temp = 0",
"- for i in range(q):",
"- ai, bi, ci, di = kumi[i]",
"- ai, bi = ai - 1, bi - 1",
"- if a[bi] - a[ai] == ci:",
"- temp += di",
"- ans = ... | false | 0.123799 | 0.04998 | 2.476975 | [
"s689900285",
"s902760045"
] |
u230621983 | p03043 | python | s611534376 | s394664690 | 48 | 42 | 3,060 | 2,940 | Accepted | Accepted | 12.5 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
point = i
cnt = 0
while point <= k-1:
point = point*2
cnt += 1
ans += (1/n) * (1/2)**cnt
print(ans) | n, k = list(map(int, input().split()))
ans = 0
for i in range(1,n+1):
point = i
cnt = 0
while point <= k-1:
point = point*2
cnt += 1
ans += (1/2)**cnt
print((ans/n)) | 10 | 10 | 188 | 182 | n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
point = i
cnt = 0
while point <= k - 1:
point = point * 2
cnt += 1
ans += (1 / n) * (1 / 2) ** cnt
print(ans)
| n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
point = i
cnt = 0
while point <= k - 1:
point = point * 2
cnt += 1
ans += (1 / 2) ** cnt
print((ans / n))
| false | 0 | [
"- ans += (1 / n) * (1 / 2) ** cnt",
"-print(ans)",
"+ ans += (1 / 2) ** cnt",
"+print((ans / n))"
] | false | 0.166668 | 0.134246 | 1.241517 | [
"s611534376",
"s394664690"
] |
u554698951 | p03163 | python | s000068330 | s446341090 | 137 | 120 | 28,540 | 69,720 | Accepted | Accepted | 12.41 | N, W = list(map(int, input().split()))
import numpy as np
dp = np.zeros(W + 1, dtype=int)
for i in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1])) | a = [int(x) for x in input().split()]
weight = a[1]
dp = [0] * weight + [0]
for x in range(a[0]):
b = [int(x) for x in input().split()]
for x in range(weight, b[0] - 1, -1):
dp[x] = max(dp[x], dp[x - b[0]] + b[1])
print((dp[-1]))
| 11 | 8 | 215 | 251 | N, W = list(map(int, input().split()))
import numpy as np
dp = np.zeros(W + 1, dtype=int)
for i in range(N):
w, v = list(map(int, input().split()))
np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])
print((dp[-1]))
| a = [int(x) for x in input().split()]
weight = a[1]
dp = [0] * weight + [0]
for x in range(a[0]):
b = [int(x) for x in input().split()]
for x in range(weight, b[0] - 1, -1):
dp[x] = max(dp[x], dp[x - b[0]] + b[1])
print((dp[-1]))
| false | 27.272727 | [
"-N, W = list(map(int, input().split()))",
"-import numpy as np",
"-",
"-dp = np.zeros(W + 1, dtype=int)",
"-for i in range(N):",
"- w, v = list(map(int, input().split()))",
"- np.maximum(dp[:-w] + v, dp[w:], out=dp[w:])",
"+a = [int(x) for x in input().split()]",
"+weight = a[1]",
"+dp = [0... | false | 0.249053 | 0.049806 | 5.000413 | [
"s000068330",
"s446341090"
] |
u926412290 | p03162 | python | s859265035 | s792939742 | 263 | 235 | 105,996 | 83,460 | Accepted | Accepted | 10.65 | N = int(eval(input()))
event = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
dp[0] = event[0]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i - 1][k] + event[i][j])
print((... | N = int(eval(input()))
dp = [[0, 0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
a = tuple(map(int, input().split()))
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[j])
print((max(dp[N]))) | 12 | 10 | 329 | 285 | N = int(eval(input()))
event = [tuple(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
dp[0] = event[0]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i - 1][k] + event[i][j])
print((max(dp[N - 1]... | N = int(eval(input()))
dp = [[0, 0, 0] for _ in range(N + 1)]
for i in range(1, N + 1):
a = tuple(map(int, input().split()))
for j in range(3):
for k in range(3):
if j != k:
dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[j])
print((max(dp[N])))
| false | 16.666667 | [
"-event = [tuple(map(int, input().split())) for _ in range(N)]",
"-dp = [[0, 0, 0] for _ in range(N)]",
"-dp[0] = event[0]",
"-for i in range(1, N):",
"+dp = [[0, 0, 0] for _ in range(N + 1)]",
"+for i in range(1, N + 1):",
"+ a = tuple(map(int, input().split()))",
"- dp[i][j] = max(... | false | 0.043544 | 0.109472 | 0.39776 | [
"s859265035",
"s792939742"
] |
u580697892 | p03111 | python | s932989955 | s805846705 | 560 | 75 | 3,188 | 3,064 | Accepted | Accepted | 86.61 | # coding: utf-8
def Base_10_to_n(X, n):
X_dumy = X
out = ''
while X_dumy>0:
out = str(X_dumy%n)+out
X_dumy = int(X_dumy/n)
return out
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
for i in range(4**N):
bit... | # coding: utf-8
import sys
sys.setrecursionlimit(10**9)
def Base_10_to_n(X, n):
X_dumy = X
out = ''
while X_dumy>0:
out = str(X_dumy%n)+out
X_dumy = int(X_dumy/n)
return out
N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())... | 31 | 25 | 774 | 666 | # coding: utf-8
def Base_10_to_n(X, n):
X_dumy = X
out = ""
while X_dumy > 0:
out = str(X_dumy % n) + out
X_dumy = int(X_dumy / n)
return out
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
for i in range(4**N):
bits = Base... | # coding: utf-8
import sys
sys.setrecursionlimit(10**9)
def Base_10_to_n(X, n):
X_dumy = X
out = ""
while X_dumy > 0:
out = str(X_dumy % n) + out
X_dumy = int(X_dumy / n)
return out
N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
L.append(int(eval(input())... | false | 19.354839 | [
"+import sys",
"+",
"+sys.setrecursionlimit(10**9)",
"+",
"+",
"-L = [int(eval(input())) for _ in range(N)]",
"-ans = float(\"inf\")",
"-for i in range(4**N):",
"- bits = Base_10_to_n(i, 4).zfill(N)",
"- a, b, c = 0, 0, 0",
"- cost = 0",
"- for j in range(len(bits)):",
"- ... | false | 0.834013 | 0.061893 | 13.475067 | [
"s932989955",
"s805846705"
] |
u070201429 | p03325 | python | s527830958 | s950995748 | 97 | 66 | 73,420 | 9,964 | Accepted | Accepted | 31.96 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 32 == 0:
i //= 32
ans += 5
while i % 2 == 0:
i //= 2
ans += 1
print(ans) | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| 13 | 10 | 209 | 150 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 32 == 0:
i //= 32
ans += 5
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in a:
while i % 2 == 0:
i //= 2
ans += 1
print(ans)
| false | 23.076923 | [
"- while i % 32 == 0:",
"- i //= 32",
"- ans += 5"
] | false | 0.108351 | 0.107657 | 1.006446 | [
"s527830958",
"s950995748"
] |
u840310460 | p03814 | python | s727889795 | s104378079 | 185 | 59 | 47,968 | 11,464 | Accepted | Accepted | 68.11 | S = eval(input())
A_index = [i for i in range(len(S)) if S[i] == "A"]
Z_index = [i for i in range(len(S)) if S[i] == "Z"]
print((len(S[A_index[0] : Z_index[-1] + 1]))) | S = eval(input())
head = [i for i in range(0, len(S)) if S[i]=="A"]
tail = [i for i in range(0, len(S)) if S[i]=="Z"]
print((max(tail)-min(head)+1)) | 4 | 6 | 162 | 147 | S = eval(input())
A_index = [i for i in range(len(S)) if S[i] == "A"]
Z_index = [i for i in range(len(S)) if S[i] == "Z"]
print((len(S[A_index[0] : Z_index[-1] + 1])))
| S = eval(input())
head = [i for i in range(0, len(S)) if S[i] == "A"]
tail = [i for i in range(0, len(S)) if S[i] == "Z"]
print((max(tail) - min(head) + 1))
| false | 33.333333 | [
"-A_index = [i for i in range(len(S)) if S[i] == \"A\"]",
"-Z_index = [i for i in range(len(S)) if S[i] == \"Z\"]",
"-print((len(S[A_index[0] : Z_index[-1] + 1])))",
"+head = [i for i in range(0, len(S)) if S[i] == \"A\"]",
"+tail = [i for i in range(0, len(S)) if S[i] == \"Z\"]",
"+print((max(tail) - min... | false | 0.04608 | 0.037502 | 1.228747 | [
"s727889795",
"s104378079"
] |
u072053884 | p00909 | python | s026135728 | s380944703 | 5,270 | 4,640 | 133,988 | 134,640 | Accepted | Accepted | 11.95 | def solve():
def measurement(a, b, w):
a_root = root[a]
b_root = root[b]
if a_root != b_root:
a_member = member[a_root]
b_member = member[b_root]
offset = w - (weight[b] - weight[a])
if len(a_member) > len(b_member):
a_... | def solve():
def measurement(a, b, w):
a_root = root[a]
b_root = root[b]
if a_root != b_root:
a_member = member[a_root]
b_member = member[b_root]
offset = w - (weight[b] - weight[a])
if len(a_member) > len(b_member):
a_... | 52 | 51 | 1,530 | 1,494 | def solve():
def measurement(a, b, w):
a_root = root[a]
b_root = root[b]
if a_root != b_root:
a_member = member[a_root]
b_member = member[b_root]
offset = w - (weight[b] - weight[a])
if len(a_member) > len(b_member):
a_member.ex... | def solve():
def measurement(a, b, w):
a_root = root[a]
b_root = root[b]
if a_root != b_root:
a_member = member[a_root]
b_member = member[b_root]
offset = w - (weight[b] - weight[a])
if len(a_member) > len(b_member):
a_member.ex... | false | 1.923077 | [
"- def operation(line):",
"- if line[0] == \"!\":",
"- a, b, w = map(int, line[2:].split())",
"- measurement(a, b, w)",
"- else:",
"- a, b = map(int, line[2:].split())",
"- return inquiry(a, b)",
"-",
"+ ans = []",
"- ans = (op... | false | 0.078806 | 0.068734 | 1.146534 | [
"s026135728",
"s380944703"
] |
u638902622 | p02695 | python | s222176597 | s715531219 | 605 | 321 | 9,612 | 9,168 | Accepted | Accepted | 46.94 | 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 main():
n, m, q = MII()
query = [MII() for _ in range(q)]
def calc_point(lst):
sumv ... | 74 | 32 | 2,369 | 753 | 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 main():
n, m, q = MII()
query = [MII() for _ in range(q)]
def calc_point(lst):
... | false | 56.756757 | [
"-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 _ in range(d1)]",
"-",
"-",
"-## math ##",
"-def ... | false | 0.190992 | 0.155249 | 1.230229 | [
"s222176597",
"s715531219"
] |
u562935282 | p02727 | python | s620906002 | s364874721 | 251 | 153 | 23,328 | 29,448 | Accepted | Accepted | 39.04 | x, y, a, b, c = list(map(int, input().split()))
*p, = list(map(int, input().split()))
*q, = list(map(int, input().split()))
*r, = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
pool = p[:x] + q[:y] + r
pool.sort(reverse=True)
pool = pool[:x + y]
ans = sum(pool)
print(ans)
| def main():
X, Y, A, B, C = list(map(int, input().split()))
*P, = list(map(int, input().split()))
*Q, = list(map(int, input().split()))
*R, = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
ans = sum(sorted(P[:X] + Q[:Y] + R, reverse=True)[:X + Y])
p... | 14 | 15 | 292 | 350 | x, y, a, b, c = list(map(int, input().split()))
(*p,) = list(map(int, input().split()))
(*q,) = list(map(int, input().split()))
(*r,) = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
pool = p[:x] + q[:y] + r
pool.sort(reverse=True)
pool = pool[: x + y]
ans = sum(pool)
print(ans)
| def main():
X, Y, A, B, C = list(map(int, input().split()))
(*P,) = list(map(int, input().split()))
(*Q,) = list(map(int, input().split()))
(*R,) = list(map(int, input().split()))
P.sort(reverse=True)
Q.sort(reverse=True)
ans = sum(sorted(P[:X] + Q[:Y] + R, reverse=True)[: X + Y])
print(... | false | 6.666667 | [
"-x, y, a, b, c = list(map(int, input().split()))",
"-(*p,) = list(map(int, input().split()))",
"-(*q,) = list(map(int, input().split()))",
"-(*r,) = list(map(int, input().split()))",
"-p.sort(reverse=True)",
"-q.sort(reverse=True)",
"-pool = p[:x] + q[:y] + r",
"-pool.sort(reverse=True)",
"-pool = ... | false | 0.082385 | 0.048094 | 1.713025 | [
"s620906002",
"s364874721"
] |
u649591440 | p02897 | python | s317053808 | s571095851 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | #question1
N = eval(input())
if int(N) % 2 == 0:
ans = 0.5
elif int(N) == 1:
ans = 1
else:
ans = ((int(N) - 1) /2 + 1) / int(N)
print(ans) | #question1
N = eval(input())
if int(N) % 2 == 0:
ans = 0.5
else:
ans = ((int(N) - 1) /2 + 1) / int(N)
print(ans) | 11 | 9 | 150 | 120 | # question1
N = eval(input())
if int(N) % 2 == 0:
ans = 0.5
elif int(N) == 1:
ans = 1
else:
ans = ((int(N) - 1) / 2 + 1) / int(N)
print(ans)
| # question1
N = eval(input())
if int(N) % 2 == 0:
ans = 0.5
else:
ans = ((int(N) - 1) / 2 + 1) / int(N)
print(ans)
| false | 18.181818 | [
"-elif int(N) == 1:",
"- ans = 1"
] | false | 0.067668 | 0.038933 | 1.738061 | [
"s317053808",
"s571095851"
] |
u952708174 | p03494 | python | s860875358 | s992981453 | 19 | 17 | 3,060 | 3,060 | Accepted | Accepted | 10.53 | def b_shift_only(N, A):
def is_even(lst):
# リストの要素がすべて偶数か?
for x in lst:
if x % 2 == 1:
return False
return True
a = A[:]
count = 0
# 奇数が要素に現れるまで要素を2で割る
while is_even(a):
a = [x // 2 for x in a]
count += 1
return co... | def b_shift_only(N, A):
# Aの全要素についてbitごとorを取った値が
# 何回2で割れるかが解となる
bitwise_or = 0
for a in A:
bitwise_or |= a
ans = 0
while bitwise_or % 2 == 0:
bitwise_or //= 2
ans += 1
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print(... | 18 | 16 | 409 | 333 | def b_shift_only(N, A):
def is_even(lst):
# リストの要素がすべて偶数か?
for x in lst:
if x % 2 == 1:
return False
return True
a = A[:]
count = 0
# 奇数が要素に現れるまで要素を2で割る
while is_even(a):
a = [x // 2 for x in a]
count += 1
return count
N = in... | def b_shift_only(N, A):
# Aの全要素についてbitごとorを取った値が
# 何回2で割れるかが解となる
bitwise_or = 0
for a in A:
bitwise_or |= a
ans = 0
while bitwise_or % 2 == 0:
bitwise_or //= 2
ans += 1
return ans
N = int(eval(input()))
A = [int(i) for i in input().split()]
print((b_shift_only(N, A)... | false | 11.111111 | [
"- def is_even(lst):",
"- # リストの要素がすべて偶数か?",
"- for x in lst:",
"- if x % 2 == 1:",
"- return False",
"- return True",
"-",
"- a = A[:]",
"- count = 0",
"- # 奇数が要素に現れるまで要素を2で割る",
"- while is_even(a):",
"- a = [x // 2 for x in... | false | 0.046593 | 0.045904 | 1.015006 | [
"s860875358",
"s992981453"
] |
u418826171 | p02773 | python | s090402964 | s795144850 | 510 | 447 | 25,248 | 38,904 | Accepted | Accepted | 12.35 | n = int(eval(input()))
S = ['']*n
T = []
for i in range(n):
S[i] = eval(input())
S.sort()
if n == 1:
print((S[0]))
exit()
cnt = 1
mxcnt = 1
for i in range(n-1):
if S[i] == S[i+1]:
cnt += 1
else:
cnt = 1
mxcnt = max(mxcnt,cnt)
cnt = 1
for i in range(n-1):
if... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
num = Counter(s)
mx = max(num.values())
T = []
for n in sorted(num):
if num[n] == mx:
print(n) | 29 | 9 | 478 | 195 | n = int(eval(input()))
S = [""] * n
T = []
for i in range(n):
S[i] = eval(input())
S.sort()
if n == 1:
print((S[0]))
exit()
cnt = 1
mxcnt = 1
for i in range(n - 1):
if S[i] == S[i + 1]:
cnt += 1
else:
cnt = 1
mxcnt = max(mxcnt, cnt)
cnt = 1
for i in range(n - 1):
if S[i] == S... | from collections import Counter
n = int(eval(input()))
s = [eval(input()) for i in range(n)]
num = Counter(s)
mx = max(num.values())
T = []
for n in sorted(num):
if num[n] == mx:
print(n)
| false | 68.965517 | [
"+from collections import Counter",
"+",
"-S = [\"\"] * n",
"+s = [eval(input()) for i in range(n)]",
"+num = Counter(s)",
"+mx = max(num.values())",
"-for i in range(n):",
"- S[i] = eval(input())",
"-S.sort()",
"-if n == 1:",
"- print((S[0]))",
"- exit()",
"-cnt = 1",
"-mxcnt = 1... | false | 0.038582 | 0.046075 | 0.83738 | [
"s090402964",
"s795144850"
] |
u254871849 | p04013 | python | s796553860 | s176401400 | 136 | 24 | 5,604 | 3,572 | Accepted | Accepted | 82.35 | import sys
n, a, *x = list(map(int, sys.stdin.read().split()))
def main():
for i in range(n):
x[i] -= a
x.sort()
res = [[0] * 99*n for _ in range(n+1)]
# res[i][49*n]を中心とする。
res[0][49*n] = 1
for i in range(n):
for j in range(99*n):
res[i+1][j] += res[... | import sys
from collections import defaultdict
n, a, *x = list(map(int, sys.stdin.read().split()))
def main():
for i in range(n):
x[i] -= a
c = defaultdict(int)
c[0] = 1
for i in x:
for val, cnt in tuple(c.items()):
c[val+i] += cnt
ans = c[0] - 1
... | 29 | 20 | 679 | 389 | import sys
n, a, *x = list(map(int, sys.stdin.read().split()))
def main():
for i in range(n):
x[i] -= a
x.sort()
res = [[0] * 99 * n for _ in range(n + 1)]
# res[i][49*n]を中心とする。
res[0][49 * n] = 1
for i in range(n):
for j in range(99 * n):
res[i + 1][j] += res[i][j... | import sys
from collections import defaultdict
n, a, *x = list(map(int, sys.stdin.read().split()))
def main():
for i in range(n):
x[i] -= a
c = defaultdict(int)
c[0] = 1
for i in x:
for val, cnt in tuple(c.items()):
c[val + i] += cnt
ans = c[0] - 1
return ans
if ... | false | 31.034483 | [
"+from collections import defaultdict",
"- x.sort()",
"- res = [[0] * 99 * n for _ in range(n + 1)]",
"- # res[i][49*n]を中心とする。",
"- res[0][49 * n] = 1",
"- for i in range(n):",
"- for j in range(99 * n):",
"- res[i + 1][j] += res[i][j]",
"- cur = x[i]",
... | false | 0.040183 | 0.047394 | 0.847836 | [
"s796553860",
"s176401400"
] |
u753803401 | p03601 | python | s343677808 | s092852630 | 235 | 210 | 41,200 | 39,828 | Accepted | Accepted | 10.64 | def slove():
import sys
input = sys.stdin.readline
a, b, c, d, e, f = list(map(int, input().rstrip('\n').split()))
abcd = 0
cd = 0
md = 0
for ai in range(0, f + 1, a * 100):
for bi in range(0, f + 1, b * 100):
for ci in range(0, f + 1, c):
for di... | def slove():
import sys
input = sys.stdin.readline
a, b, c, d, e, f = list(map(int, input().rstrip('\n').split()))
mt = a * 100
ms = 0
mn = 0
for i in range(0, f + 1, a * 100):
for j in range(0, f - i + 1, b * 100):
for k in range(0, f - i - j + 1, c):
... | 24 | 24 | 849 | 777 | def slove():
import sys
input = sys.stdin.readline
a, b, c, d, e, f = list(map(int, input().rstrip("\n").split()))
abcd = 0
cd = 0
md = 0
for ai in range(0, f + 1, a * 100):
for bi in range(0, f + 1, b * 100):
for ci in range(0, f + 1, c):
for di in range... | def slove():
import sys
input = sys.stdin.readline
a, b, c, d, e, f = list(map(int, input().rstrip("\n").split()))
mt = a * 100
ms = 0
mn = 0
for i in range(0, f + 1, a * 100):
for j in range(0, f - i + 1, b * 100):
for k in range(0, f - i - j + 1, c):
fo... | false | 0 | [
"- abcd = 0",
"- cd = 0",
"- md = 0",
"- for ai in range(0, f + 1, a * 100):",
"- for bi in range(0, f + 1, b * 100):",
"- for ci in range(0, f + 1, c):",
"- for di in range(0, f + 1, d):",
"- if 0 < ai + bi + ci + di <= f:",
"- ... | false | 0.047213 | 0.044398 | 1.06341 | [
"s343677808",
"s092852630"
] |
u577170763 | p02821 | python | s144493667 | s805731507 | 1,083 | 326 | 57,008 | 21,436 | Accepted | Accepted | 69.9 | import sys
from collections import defaultdict
import bisect
import itertools
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
de... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
import numpy as np
def main():... | 52 | 52 | 1,097 | 1,047 | import sys
from collections import defaultdict
import bisect
import itertools
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
def main():
N, ... | import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)
def geta(fn=lambda s: s.decode()):
return list(map(fn, readline().split()))
def gete(fn=lambda s: s.decode()):
return fn(readline().rstrip())
import numpy as np
def main():
N, M = geta(i... | false | 0 | [
"-import bisect",
"-import itertools",
"+import numpy as np",
"+",
"+",
"- A = list(geta(int))",
"+ A = np.array(list(geta(int)))",
"- ret = 0",
"- for a in A:",
"- ret += bisect.bisect_left(A, x - a)",
"- return N * N - ret",
"+ X = np.searchsorted... | false | 0.111578 | 0.232434 | 0.480043 | [
"s144493667",
"s805731507"
] |
u729133443 | p03579 | python | s704009258 | s931048125 | 1,178 | 1,079 | 173,872 | 174,468 | Accepted | Accepted | 8.4 | from networkx import*
n,*t=[t.split()for t in open(0)]
n,m=list(map(int,n))
g=Graph()
g.add_edges_from(t)
try:a,b=list(map(len,bipartite.sets(g)));a*=b
except:a=n*~-n//2
print((a-m)) | from networkx import*
n,*t=list(map(str.split,open(0)))
n,m=list(map(int,n))
g=Graph()
g.add_edges_from(t)
try:a,b=list(map(len,bipartite.sets(g)));a*=b
except:a=n*~-n//2
print((a-m)) | 8 | 8 | 175 | 170 | from networkx import *
n, *t = [t.split() for t in open(0)]
n, m = list(map(int, n))
g = Graph()
g.add_edges_from(t)
try:
a, b = list(map(len, bipartite.sets(g)))
a *= b
except:
a = n * ~-n // 2
print((a - m))
| from networkx import *
n, *t = list(map(str.split, open(0)))
n, m = list(map(int, n))
g = Graph()
g.add_edges_from(t)
try:
a, b = list(map(len, bipartite.sets(g)))
a *= b
except:
a = n * ~-n // 2
print((a - m))
| false | 0 | [
"-n, *t = [t.split() for t in open(0)]",
"+n, *t = list(map(str.split, open(0)))"
] | false | 0.124321 | 0.133687 | 0.929944 | [
"s704009258",
"s931048125"
] |
u968404618 | p02685 | python | s889032459 | s880351267 | 1,292 | 258 | 9,236 | 67,592 | Accepted | Accepted | 80.03 | n, m, k = list(map(int, input().split()))
MOD = 998244353
ans, N, K = 0, 1, 1
for i in range(k+1):
ans += N * pow(K, MOD-2, MOD) * pow(m-1, n-1-i, MOD)
ans %= MOD
N *= n-1-i
N %= MOD
K *= i+1
K %= MOD
ans *= m
ans %= MOD
print(ans) | def main():
## IMPORT MODULE
#import sys
#sys.setrecursionlimit(100000)
#input=lambda :sys.stdin.readline().rstrip()
#f_inf=float("inf")
MOD=998244353
if 'get_ipython' in globals():
## SAMPLE INPUT
n, m, k = 60522, 114575, 7559
else:
##INPUT
#n = input()
n, m... | 15 | 35 | 265 | 616 | n, m, k = list(map(int, input().split()))
MOD = 998244353
ans, N, K = 0, 1, 1
for i in range(k + 1):
ans += N * pow(K, MOD - 2, MOD) * pow(m - 1, n - 1 - i, MOD)
ans %= MOD
N *= n - 1 - i
N %= MOD
K *= i + 1
K %= MOD
ans *= m
ans %= MOD
print(ans)
| def main():
## IMPORT MODULE
# import sys
# sys.setrecursionlimit(100000)
# input=lambda :sys.stdin.readline().rstrip()
# f_inf=float("inf")
MOD = 998244353
if "get_ipython" in globals():
## SAMPLE INPUT
n, m, k = 60522, 114575, 7559
else:
##INPUT
# n = in... | false | 57.142857 | [
"-n, m, k = list(map(int, input().split()))",
"-MOD = 998244353",
"-ans, N, K = 0, 1, 1",
"-for i in range(k + 1):",
"- ans += N * pow(K, MOD - 2, MOD) * pow(m - 1, n - 1 - i, MOD)",
"+def main():",
"+ ## IMPORT MODULE",
"+ # import sys",
"+ # sys.setrecursionlimit(100000)",
"+ # in... | false | 0.115335 | 0.661007 | 0.174483 | [
"s889032459",
"s880351267"
] |
u703528810 | p02695 | python | s263661729 | s467434107 | 1,510 | 999 | 9,280 | 12,600 | Accepted | Accepted | 33.84 | def comb(n,r):
r=min(r,n-r)
c=1
for i in range(r):
c=c*(n-i)/(r-i)
return int(c)
N,M,Q=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(Q)]
npat=comb(N+M,M)
A=[1 for _ in range(N)]
ans=0
for i in range(npat):
temp=0
for j in range(Q):
... | def dfs(A):
if len(A)==N:
temp=0
for j in range(Q):
if A[a[j][1]-1]-A[a[j][0]-1]==a[j][2]:
temp+=a[j][3]
ans.append(temp)
return
else:
if len(A)>0:
m=A[-1]
else:
m=1
for i in range(m,M+1):
... | 34 | 23 | 713 | 513 | def comb(n, r):
r = min(r, n - r)
c = 1
for i in range(r):
c = c * (n - i) / (r - i)
return int(c)
N, M, Q = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(Q)]
npat = comb(N + M, M)
A = [1 for _ in range(N)]
ans = 0
for i in range(npat):
temp = 0
fo... | def dfs(A):
if len(A) == N:
temp = 0
for j in range(Q):
if A[a[j][1] - 1] - A[a[j][0] - 1] == a[j][2]:
temp += a[j][3]
ans.append(temp)
return
else:
if len(A) > 0:
m = A[-1]
else:
m = 1
for i in range(m, ... | false | 32.352941 | [
"-def comb(n, r):",
"- r = min(r, n - r)",
"- c = 1",
"- for i in range(r):",
"- c = c * (n - i) / (r - i)",
"- return int(c)",
"+def dfs(A):",
"+ if len(A) == N:",
"+ temp = 0",
"+ for j in range(Q):",
"+ if A[a[j][1] - 1] - A[a[j][0] - 1] == a[j][... | false | 0.1205 | 0.071268 | 1.690801 | [
"s263661729",
"s467434107"
] |
u947243063 | p03161 | python | s834034142 | s991431268 | 335 | 237 | 85,204 | 84,876 | Accepted | Accepted | 29.25 | #!/usr/bin/env pypy
import sys
inp = sys.stdin.readline
out = print
MAX = 10**9
n, k = map(int, inp().split())
cost = list(map(int, inp().split()))
dp = [MAX] * (n)
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[j] + abs(cost[i] - cost[j]) for j in range(max(0, i - k), i))
out(dp[-1])
| #!/usr/bin/env pypy
import sys
inp = sys.stdin.readline
out = print
MAX = 10**9
n, k = map(int, inp().split())
cost = list(map(int, inp().split()))
dp = [MAX] * (n)
dp[0] = 0
for i in range(1, n):
for j in range(max(0, i-k), i+1):
dp[i] = min(dp[i] ,dp[j] + abs(cost[i] - cost[j])... | 16 | 17 | 311 | 339 | #!/usr/bin/env pypy
import sys
inp = sys.stdin.readline
out = print
MAX = 10**9
n, k = map(int, inp().split())
cost = list(map(int, inp().split()))
dp = [MAX] * (n)
dp[0] = 0
for i in range(1, n):
dp[i] = min(dp[j] + abs(cost[i] - cost[j]) for j in range(max(0, i - k), i))
out(dp[-1])
| #!/usr/bin/env pypy
import sys
inp = sys.stdin.readline
out = print
MAX = 10**9
n, k = map(int, inp().split())
cost = list(map(int, inp().split()))
dp = [MAX] * (n)
dp[0] = 0
for i in range(1, n):
for j in range(max(0, i - k), i + 1):
dp[i] = min(dp[i], dp[j] + abs(cost[i] - cost[j]))
print(dp[-1])
| false | 5.882353 | [
"- dp[i] = min(dp[j] + abs(cost[i] - cost[j]) for j in range(max(0, i - k), i))",
"-out(dp[-1])",
"+ for j in range(max(0, i - k), i + 1):",
"+ dp[i] = min(dp[i], dp[j] + abs(cost[i] - cost[j]))",
"+print(dp[-1])"
] | false | 0.037058 | 0.035303 | 1.049718 | [
"s834034142",
"s991431268"
] |
u498487134 | p02850 | python | s862242593 | s436693318 | 878 | 533 | 95,392 | 116,296 | Accepted | Accepted | 39.29 | N = int(input())
d = {}
E = [[] for _ in range(N)]
for i in range(N-1):
a,b = map(int,input().split())
E[a-1].append(b-1)
E[b-1].append(a-1)
d[(a-1,b-1)]=i
d[(b-1,a-1)]=i
K = 0
ans = [None]*(N-1)
#queueに(node,par)を入れる.
q = [(0,-1)]
while q:
node,p = q.pop()
col = 1... | 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=I()
P=[-1]*N#親から来た辺の色だけ持っておく
C=[0]*(N-1)
adj=[[]for _ in range(N)]
from collec... | 32 | 69 | 605 | 1,320 | N = int(input())
d = {}
E = [[] for _ in range(N)]
for i in range(N - 1):
a, b = map(int, input().split())
E[a - 1].append(b - 1)
E[b - 1].append(a - 1)
d[(a - 1, b - 1)] = i
d[(b - 1, a - 1)] = i
K = 0
ans = [None] * (N - 1)
# queueに(node,par)を入れる.
q = [(0, -1)]
while q:
node, p = q.pop()
c... | 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 = I()
P = [-1] * N # 親から来た辺の色だけ持っておく
C = [0] * (N - 1)
adj = [[] for _ in ran... | false | 53.623188 | [
"-N = int(input())",
"-d = {}",
"-E = [[] for _ in range(N)]",
"-for i in range(N - 1):",
"- a, b = map(int, input().split())",
"- E[a - 1].append(b - 1)",
"- E[b - 1].append(a - 1)",
"- d[(a - 1, b - 1)] = i",
"- d[(b - 1, a - 1)] = i",
"-K = 0",
"-ans = [None] * (N - 1)",
"-# ... | false | 0.0548 | 0.077344 | 0.708528 | [
"s862242593",
"s436693318"
] |
u912237403 | p00096 | python | s871361941 | s859329011 | 170 | 30 | 4,316 | 4,308 | Accepted | Accepted | 82.35 | import sys
n=1001
a=[0]*2001
for i in range(n):
for j in range(n):
a[i+j]+=1
for n in map(int,sys.stdin):
x=0
for i in range(max(0,n-2000),min(n,2000)+1):
x+=a[i]*a[n-i]
print(x) | import sys
n=1001
a=list(range(1,n))
a+=[n]+a[::-1]
for n in map(int,sys.stdin):
x=0
for i in range(max(0,n-2000),min(n,2000)+1):
x+=a[i]*a[n-i]
print(x) | 12 | 9 | 205 | 164 | import sys
n = 1001
a = [0] * 2001
for i in range(n):
for j in range(n):
a[i + j] += 1
for n in map(int, sys.stdin):
x = 0
for i in range(max(0, n - 2000), min(n, 2000) + 1):
x += a[i] * a[n - i]
print(x)
| import sys
n = 1001
a = list(range(1, n))
a += [n] + a[::-1]
for n in map(int, sys.stdin):
x = 0
for i in range(max(0, n - 2000), min(n, 2000) + 1):
x += a[i] * a[n - i]
print(x)
| false | 25 | [
"-a = [0] * 2001",
"-for i in range(n):",
"- for j in range(n):",
"- a[i + j] += 1",
"+a = list(range(1, n))",
"+a += [n] + a[::-1]"
] | false | 0.326481 | 0.118635 | 2.751974 | [
"s871361941",
"s859329011"
] |
u429319815 | p03814 | python | s466382816 | s402505905 | 59 | 18 | 4,840 | 3,512 | Accepted | Accepted | 69.49 | S = list(eval(input()))
count = 0
for i in range(len(S)):
if (S[i] == "A") and (count == 0):
start = i
count = 1
if S[i] == "Z":
end = i
print((end - start + 1))
| s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1)) | 9 | 4 | 194 | 76 | S = list(eval(input()))
count = 0
for i in range(len(S)):
if (S[i] == "A") and (count == 0):
start = i
count = 1
if S[i] == "Z":
end = i
print((end - start + 1))
| s = eval(input())
start = s.find("A")
end = s.rfind("Z")
print((end - start + 1))
| false | 55.555556 | [
"-S = list(eval(input()))",
"-count = 0",
"-for i in range(len(S)):",
"- if (S[i] == \"A\") and (count == 0):",
"- start = i",
"- count = 1",
"- if S[i] == \"Z\":",
"- end = i",
"+s = eval(input())",
"+start = s.find(\"A\")",
"+end = s.rfind(\"Z\")"
] | false | 0.046528 | 0.088645 | 0.524879 | [
"s466382816",
"s402505905"
] |
u645250356 | p02689 | python | s966114684 | s265025597 | 500 | 233 | 100,496 | 100,528 | Accepted | Accepted | 53.4 | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(m... | from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, ... | 28 | 26 | 688 | 638 | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
... | from collections import Counter, defaultdict, deque
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
INF = float("inf")
def inp():
return int(sys.stdin.readline())
def inpl():
return ... | false | 7.142857 | [
"-from heapq import heappop, heappush, heapify",
"+from heapq import heappop, heappush",
"-a = inpl()",
"+h = inpl()",
"-for i in range(m):",
"- z, x = inpl()",
"- g[z - 1].append(x - 1)",
"- g[x - 1].append(z - 1)",
"+for _ in range(m):",
"+ a, b = inpl()",
"+ a, b = a - 1, b - 1... | false | 0.035796 | 0.037717 | 0.949059 | [
"s966114684",
"s265025597"
] |
u790710233 | p03074 | python | s579248851 | s812972651 | 81 | 68 | 3,316 | 8,660 | Accepted | Accepted | 16.05 | n, k = list(map(int, input().split()))
s = eval(input())
prev_R = '1'
for R in range(n):
if (prev_R, s[R]) == ('1', '0'):
k -= 1
if k < 0:
R -= 1
break
prev_R = s[R]
ans = R+1
for L in range(n-1):
if (s[L], s[L+1]) != ('0', '1'):
continue
... | n, k = list(map(int, input().split()))
s = list(eval(input()))
L = [0]
R = []
for i, (a, b) in enumerate(zip(s, s[1:])):
if (a, b) == ('0', '1'):
L.append(i+1)
if (a, b) == ('1', '0'):
R.append(i)
else:
R.append(n-1)
ans = R[0]-L[0]+1
if s[0] == '0':
k -= 1
k = min(... | 22 | 24 | 434 | 410 | n, k = list(map(int, input().split()))
s = eval(input())
prev_R = "1"
for R in range(n):
if (prev_R, s[R]) == ("1", "0"):
k -= 1
if k < 0:
R -= 1
break
prev_R = s[R]
ans = R + 1
for L in range(n - 1):
if (s[L], s[L + 1]) != ("0", "1"):
continue
R += 1
... | n, k = list(map(int, input().split()))
s = list(eval(input()))
L = [0]
R = []
for i, (a, b) in enumerate(zip(s, s[1:])):
if (a, b) == ("0", "1"):
L.append(i + 1)
if (a, b) == ("1", "0"):
R.append(i)
else:
R.append(n - 1)
ans = R[0] - L[0] + 1
if s[0] == "0":
k -= 1
k = min(k, len(R) - 1)... | false | 8.333333 | [
"-s = eval(input())",
"-prev_R = \"1\"",
"-for R in range(n):",
"- if (prev_R, s[R]) == (\"1\", \"0\"):",
"- k -= 1",
"- if k < 0:",
"- R -= 1",
"- break",
"- prev_R = s[R]",
"-ans = R + 1",
"-for L in range(n - 1):",
"- if (s[L], s[L + 1]) != (\"0\... | false | 0.035558 | 0.035279 | 1.007901 | [
"s579248851",
"s812972651"
] |
u631543593 | p02647 | python | s695238474 | s271948350 | 678 | 584 | 172,072 | 171,764 | Accepted | Accepted | 13.86 | import sys
from itertools import accumulate
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
current_arr = A
if K > 41:
print((*([N]*N)))
else:
for _ in range(K):
imos = [0] * N
ruiseki = [0] * (N+1)
for i, ai in enumerate(current_arr):
... | from itertools import accumulate
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
current_arr = A
if K > 41:
print((*([N]*N)))
exit()
for _ in range(K):
imos = [0] * N
ruiseki = [0] * (N+1)
for i, ai in enumerate(current_arr):
imos[max([0, i-ai])]... | 24 | 23 | 615 | 564 | import sys
from itertools import accumulate
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
current_arr = A
if K > 41:
print((*([N] * N)))
else:
for _ in range(K):
imos = [0] * N
ruiseki = [0] * (N + 1)
for i, ai in enumerate(current_arr):
imos... | from itertools import accumulate
N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
current_arr = A
if K > 41:
print((*([N] * N)))
exit()
for _ in range(K):
imos = [0] * N
ruiseki = [0] * (N + 1)
for i, ai in enumerate(current_arr):
imos[max([0, i - ai])] += 1
... | false | 4.166667 | [
"-import sys",
"-else:",
"- for _ in range(K):",
"- imos = [0] * N",
"- ruiseki = [0] * (N + 1)",
"- for i, ai in enumerate(current_arr):",
"- imos[max([0, i - ai])] += 1",
"- if i + ai + 1 < N:",
"- imos[i + ai + 1] -= 1",
"- for... | false | 0.041177 | 0.038347 | 1.073796 | [
"s695238474",
"s271948350"
] |
u573754721 | p02813 | python | s273149727 | s737148234 | 228 | 194 | 46,572 | 46,572 | Accepted | Accepted | 14.91 | from itertools import permutations
n=int(eval(input()))
P=list(map(str,input().split()))
Q=list(map(str,input().split()))
S=sorted(P)
S=list(permutations(S))
A=[]
for i in S:
A.append(int("".join(i)))
A.sort()
for i in range(len(A)):
if A[i]==int("".join(P)):
pp=i
if A[i]==int... | from itertools import permutations
n=int(eval(input()))
P=list(input().split())
Q=list(input().split())
A=[]
for i in list(permutations(P)):
A.append(int("".join(i)))
A.sort()
print((abs(A.index(int("".join(P)))-A.index(int("".join(Q)))))) | 21 | 9 | 360 | 242 | from itertools import permutations
n = int(eval(input()))
P = list(map(str, input().split()))
Q = list(map(str, input().split()))
S = sorted(P)
S = list(permutations(S))
A = []
for i in S:
A.append(int("".join(i)))
A.sort()
for i in range(len(A)):
if A[i] == int("".join(P)):
pp = i
if A[i] == int("... | from itertools import permutations
n = int(eval(input()))
P = list(input().split())
Q = list(input().split())
A = []
for i in list(permutations(P)):
A.append(int("".join(i)))
A.sort()
print((abs(A.index(int("".join(P))) - A.index(int("".join(Q))))))
| false | 57.142857 | [
"-P = list(map(str, input().split()))",
"-Q = list(map(str, input().split()))",
"-S = sorted(P)",
"-S = list(permutations(S))",
"+P = list(input().split())",
"+Q = list(input().split())",
"-for i in S:",
"+for i in list(permutations(P)):",
"-for i in range(len(A)):",
"- if A[i] == int(\"\".join... | false | 0.046348 | 0.052543 | 0.882094 | [
"s273149727",
"s737148234"
] |
u532966492 | p02724 | python | s083105208 | s388625258 | 46 | 19 | 3,060 | 2,940 | Accepted | Accepted | 58.7 | def main():
n = int(eval(input()))
ans = 1000*(n//500)
n %= 500
ans += 5*(n//5)
print(ans)
main()
| def main():
x = int(eval(input()))
cnt = 0
cnt += 1000*(x//500)
x %= 500
cnt += 5*(x//5)
print(cnt)
main()
| 9 | 10 | 122 | 136 | def main():
n = int(eval(input()))
ans = 1000 * (n // 500)
n %= 500
ans += 5 * (n // 5)
print(ans)
main()
| def main():
x = int(eval(input()))
cnt = 0
cnt += 1000 * (x // 500)
x %= 500
cnt += 5 * (x // 5)
print(cnt)
main()
| false | 10 | [
"- n = int(eval(input()))",
"- ans = 1000 * (n // 500)",
"- n %= 500",
"- ans += 5 * (n // 5)",
"- print(ans)",
"+ x = int(eval(input()))",
"+ cnt = 0",
"+ cnt += 1000 * (x // 500)",
"+ x %= 500",
"+ cnt += 5 * (x // 5)",
"+ print(cnt)"
] | false | 0.088002 | 0.044981 | 1.956427 | [
"s083105208",
"s388625258"
] |
u413165887 | p02762 | python | s977565675 | s414391946 | 1,247 | 1,053 | 60,676 | 60,504 | Accepted | Accepted | 15.56 | class UnionFind():
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1]*(n+1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk = [0]*(n+1)
# ノードxのrootノードを見つける
def... |
n, m, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n+1)]
uni = [-1 for i in range(n+1)]
rank = [0 for _ in range(n+1)]
def root(num, pea):
if pea[num] < 0:
return num
... | 70 | 43 | 1,835 | 1,072 | class UnionFind:
# 作りたい要素数nで初期化
# 使用するインスタンス変数の初期化
def __init__(self, n):
self.n = n
# root[x]<0ならそのノードが根かつその値が木の要素数
# rootノードでその木の要素数を記録する
self.root = [-1] * (n + 1)
# 木をくっつける時にアンバランスにならないように調整する
self.rnk = [0] * (n + 1)
# ノードxのrootノードを見つける
def Find_... | n, m, k = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
cd = [list(map(int, input().split())) for _ in range(k)]
con = [1 for _ in range(n + 1)]
uni = [-1 for i in range(n + 1)]
rank = [0 for _ in range(n + 1)]
def root(num, pea):
if pea[num] < 0:
return num
... | false | 38.571429 | [
"-class UnionFind:",
"- # 作りたい要素数nで初期化",
"- # 使用するインスタンス変数の初期化",
"- def __init__(self, n):",
"- self.n = n",
"- # root[x]<0ならそのノードが根かつその値が木の要素数",
"- # rootノードでその木の要素数を記録する",
"- self.root = [-1] * (n + 1)",
"- # 木をくっつける時にアンバランスにならないように調整する",
"- sel... | false | 0.04784 | 0.043018 | 1.11209 | [
"s977565675",
"s414391946"
] |
u002459665 | p02755 | python | s188422925 | s366012298 | 76 | 23 | 3,064 | 2,940 | Accepted | Accepted | 69.74 | A, B = list(map(int, input().split()))
ans = None
for i in range(100000):
a = int(i * 0.08)
b = int(i * 0.1)
if a == A and b == B:
ans = i
break
if ans is None:
print((-1))
else:
print(ans)
| A, B = list(map(int, input().split()))
ans = -1
for yen in range(10000):
a = int(yen * (8/100))
b = int(yen * (10/100))
if A == a and B == b:
ans = yen
break
print(ans) | 15 | 11 | 241 | 208 | A, B = list(map(int, input().split()))
ans = None
for i in range(100000):
a = int(i * 0.08)
b = int(i * 0.1)
if a == A and b == B:
ans = i
break
if ans is None:
print((-1))
else:
print(ans)
| A, B = list(map(int, input().split()))
ans = -1
for yen in range(10000):
a = int(yen * (8 / 100))
b = int(yen * (10 / 100))
if A == a and B == b:
ans = yen
break
print(ans)
| false | 26.666667 | [
"-ans = None",
"-for i in range(100000):",
"- a = int(i * 0.08)",
"- b = int(i * 0.1)",
"- if a == A and b == B:",
"- ans = i",
"+ans = -1",
"+for yen in range(10000):",
"+ a = int(yen * (8 / 100))",
"+ b = int(yen * (10 / 100))",
"+ if A == a and B == b:",
"+ a... | false | 0.199527 | 0.129034 | 1.54632 | [
"s188422925",
"s366012298"
] |
u006657459 | p03837 | python | s481570795 | s383648320 | 515 | 473 | 14,928 | 21,212 | Accepted | Accepted | 8.16 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
N, M = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(M):
ai, bi, ci = list(map(int, input().split()))
a.append(ai-1)
b.append(bi-1)
c.append(ci)
G = csr_matrix((c, (a,... | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
fn = lambda: [int(x) for x in input().split()]
N, M = fn()
data, row_idx, col_idx = [0]*M, [0]*M, [0]*M
for i in range(M):
ai, bi, ci = fn()
row_idx[i] = ai - 1
col_idx[i] = bi - 1
data[i] = ci
G = csr_matrix... | 21 | 22 | 633 | 668 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
N, M = list(map(int, input().split()))
a, b, c = [], [], []
for i in range(M):
ai, bi, ci = list(map(int, input().split()))
a.append(ai - 1)
b.append(bi - 1)
c.append(ci)
G = csr_matrix((c, (a, b)), s... | from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
fn = lambda: [int(x) for x in input().split()]
N, M = fn()
data, row_idx, col_idx = [0] * M, [0] * M, [0] * M
for i in range(M):
ai, bi, ci = fn()
row_idx[i] = ai - 1
col_idx[i] = bi - 1
data[i] = ci
G = csr_matrix((dat... | false | 4.545455 | [
"-import numpy as np",
"-N, M = list(map(int, input().split()))",
"-a, b, c = [], [], []",
"+fn = lambda: [int(x) for x in input().split()]",
"+N, M = fn()",
"+data, row_idx, col_idx = [0] * M, [0] * M, [0] * M",
"- ai, bi, ci = list(map(int, input().split()))",
"- a.append(ai - 1)",
"- b.a... | false | 0.400626 | 0.289252 | 1.385042 | [
"s481570795",
"s383648320"
] |
u648868410 | p03176 | python | s925621081 | s776095179 | 291 | 215 | 146,320 | 115,164 | Accepted | Accepted | 26.12 | # EDPC Q - Flowers
# 重み付きのLISと言って良いような問題
# これは、LISのdpを少し改造すれば解ける
# import numpy as np
## test data
# 4
# 3 1 4 2
# 10 20 30 40
## ans=60
# import bisect
class SegTree:
def __init__(self,size,func,init_val,undef):
self.specSize = size
self.datSize = 1
self.compareFunc = func # suppose to ... |
# EDPC Q - Flowers
# 重み付きのLISと言って良いような問題
# これは、LISのdpを少し改造すれば解ける
# import numpy as np
## test data
# 4
# 3 1 4 2
# 10 20 30 40
## ans=60
# import bisect
class BIT:
def __init__(self,size):
self.N = size
self.bit = [0] * (self.N+1)
def getSum(self,i):
s = 0
while 0 < i:
s +=... | 142 | 76 | 3,492 | 1,259 | # EDPC Q - Flowers
# 重み付きのLISと言って良いような問題
# これは、LISのdpを少し改造すれば解ける
# import numpy as np
## test data
# 4
# 3 1 4 2
# 10 20 30 40
## ans=60
# import bisect
class SegTree:
def __init__(self, size, func, init_val, undef):
self.specSize = size
self.datSize = 1
self.compareFunc = func # suppose to... | # EDPC Q - Flowers
# 重み付きのLISと言って良いような問題
# これは、LISのdpを少し改造すれば解ける
# import numpy as np
## test data
# 4
# 3 1 4 2
# 10 20 30 40
## ans=60
# import bisect
class BIT:
def __init__(self, size):
self.N = size
self.bit = [0] * (self.N + 1)
def getSum(self, i):
s = 0
while 0 < i:
... | false | 46.478873 | [
"-class SegTree:",
"- def __init__(self, size, func, init_val, undef):",
"- self.specSize = size",
"- self.datSize = 1",
"- self.compareFunc = func # suppose to min or max",
"- self.INIT_VAL = init_val # 0 etc",
"- self.UNDEFINED_VAL = undef # 1e18 -1e18 etc",
... | false | 0.046947 | 0.046792 | 1.003315 | [
"s925621081",
"s776095179"
] |
u282228874 | p03086 | python | s423660351 | s006088404 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | S = eval(input())+'Z'
X = 'ATCG'
res = [0]
count = 0
for i in S:
if i in X:
count += 1
else:
res.append(count)
count = 0
print((max(res)))
| S = list(eval(input()))
A = "ATCG"
count = 0
res = [0]
for s in S:
if s in A:
count += 1
res.append(count)
else:
count = 0
print((max(res))) | 11 | 11 | 173 | 150 | S = eval(input()) + "Z"
X = "ATCG"
res = [0]
count = 0
for i in S:
if i in X:
count += 1
else:
res.append(count)
count = 0
print((max(res)))
| S = list(eval(input()))
A = "ATCG"
count = 0
res = [0]
for s in S:
if s in A:
count += 1
res.append(count)
else:
count = 0
print((max(res)))
| false | 0 | [
"-S = eval(input()) + \"Z\"",
"-X = \"ATCG\"",
"+S = list(eval(input()))",
"+A = \"ATCG\"",
"+count = 0",
"-count = 0",
"-for i in S:",
"- if i in X:",
"+for s in S:",
"+ if s in A:",
"+ res.append(count)",
"- res.append(count)"
] | false | 0.061255 | 0.046942 | 1.304908 | [
"s423660351",
"s006088404"
] |
u297574184 | p03141 | python | s429580741 | s813439309 | 816 | 450 | 80,600 | 25,528 | Accepted | Accepted | 44.85 | from heapq import heapify, heappush, heappop
N = int(eval(input()))
As, Bs = [], []
for _ in range(N):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
PQ = [(-A-B, i) for i, (A, B) in enumerate(zip(As, Bs))]
heapify(PQ)
t = 1
hT = hA = 0
while PQ:
H, i = heappop(PQ)
... | N = int(eval(input()))
As, Bs = [], []
for _ in range(N):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
Cs = [(A+B, i) for i, (A, B) in enumerate(zip(As, Bs))]
Cs.sort(reverse=True)
hA = sum([As[i] for C, i in Cs[::2]])
hB = sum([Bs[i] for C, i in Cs[1::2]])
print((hA - hB))... | 23 | 13 | 404 | 307 | from heapq import heapify, heappush, heappop
N = int(eval(input()))
As, Bs = [], []
for _ in range(N):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
PQ = [(-A - B, i) for i, (A, B) in enumerate(zip(As, Bs))]
heapify(PQ)
t = 1
hT = hA = 0
while PQ:
H, i = heappop(PQ)
if t % 2:
... | N = int(eval(input()))
As, Bs = [], []
for _ in range(N):
A, B = list(map(int, input().split()))
As.append(A)
Bs.append(B)
Cs = [(A + B, i) for i, (A, B) in enumerate(zip(As, Bs))]
Cs.sort(reverse=True)
hA = sum([As[i] for C, i in Cs[::2]])
hB = sum([Bs[i] for C, i in Cs[1::2]])
print((hA - hB))
| false | 43.478261 | [
"-from heapq import heapify, heappush, heappop",
"-",
"-PQ = [(-A - B, i) for i, (A, B) in enumerate(zip(As, Bs))]",
"-heapify(PQ)",
"-t = 1",
"-hT = hA = 0",
"-while PQ:",
"- H, i = heappop(PQ)",
"- if t % 2:",
"- hT += As[i]",
"- else:",
"- hA += Bs[i]",
"- t += 1... | false | 0.037057 | 0.035951 | 1.030765 | [
"s429580741",
"s813439309"
] |
u408260374 | p02373 | python | s426917104 | s259590242 | 2,320 | 1,910 | 41,016 | 110,136 | Accepted | Accepted | 17.67 | class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = [0] * len(g), [-1] * len(g), [-1] * len(g), [-1] * len(g)
self.dfs(root)
self.bfs(root)
def dfs(self, root):
stack = [(root, -1)]
sub,... | import sys
if sys.version[0] == '2':
range, input = xrange, raw_input
class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
se... | 59 | 81 | 1,911 | 2,357 | class HeavyLightDecomposition:
def __init__(self, g, root=0):
self.g = g
self.vid, self.head, self.heavy, self.parent = (
[0] * len(g),
[-1] * len(g),
[-1] * len(g),
[-1] * len(g),
)
self.dfs(root)
self.bfs(root)
def dfs(se... | import sys
if sys.version[0] == "2":
range, input = xrange, raw_input
class Edge:
def __init__(self, dst, weight):
self.dst, self.weight = dst, weight
def __lt__(self, e):
return self.weight > e.weight
class Graph:
def __init__(self, V):
self.V = V
self.E = [[] for ... | false | 27.160494 | [
"+import sys",
"+",
"+if sys.version[0] == \"2\":",
"+ range, input = xrange, raw_input",
"+",
"+",
"+class Edge:",
"+ def __init__(self, dst, weight):",
"+ self.dst, self.weight = dst, weight",
"+",
"+ def __lt__(self, e):",
"+ return self.weight > e.weight",
"+",
"... | false | 0.086226 | 0.043248 | 1.993747 | [
"s426917104",
"s259590242"
] |
u411478442 | p02582 | python | s126470232 | s159053115 | 33 | 29 | 8,960 | 8,872 | Accepted | Accepted | 12.12 | s = eval(input())
R_list = s.split('S')
ans = 0
for s in R_list:
if ans < len(s):
ans = len(s)
print(ans) | s = eval(input())
n = 0
ans = 0
for ch in s:
if ch == 'R':
n += 1
else:
if ans < n:
ans = n
n = 0
if ans < n:
ans = n
print(ans) | 10 | 16 | 121 | 166 | s = eval(input())
R_list = s.split("S")
ans = 0
for s in R_list:
if ans < len(s):
ans = len(s)
print(ans)
| s = eval(input())
n = 0
ans = 0
for ch in s:
if ch == "R":
n += 1
else:
if ans < n:
ans = n
n = 0
if ans < n:
ans = n
print(ans)
| false | 37.5 | [
"-R_list = s.split(\"S\")",
"+n = 0",
"-for s in R_list:",
"- if ans < len(s):",
"- ans = len(s)",
"+for ch in s:",
"+ if ch == \"R\":",
"+ n += 1",
"+ else:",
"+ if ans < n:",
"+ ans = n",
"+ n = 0",
"+if ans < n:",
"+ ans = n"
] | false | 0.040006 | 0.079687 | 0.50204 | [
"s126470232",
"s159053115"
] |
u297574184 | p02937 | python | s524272809 | s955727007 | 499 | 120 | 126,452 | 14,700 | Accepted | Accepted | 75.95 | import sys
numChar = 26
ordA = ord('a')
Ss = input().rstrip()
Ts = input().rstrip()
setS, setT = set(Ss), set(Ts)
for T in setT:
if T not in setS:
print((-1))
sys.exit()
def getDistNextss(As, numChar):
lenA = len(As)
poss = [-1] * numChar
for i, A in enumerate(As):
... | from bisect import bisect_left, bisect_right
import sys
def solve():
numChar = 26
ordA = ord('a')
Ss = input().rstrip()
Ts = input().rstrip()
lenS = len(Ss)
Ss = [ord(S)-ordA for S in Ss]
Ts = [ord(T)-ordA for T in Ts]
setS, setT = set(Ss), set(Ts)
for T in setT:
... | 37 | 36 | 758 | 697 | import sys
numChar = 26
ordA = ord("a")
Ss = input().rstrip()
Ts = input().rstrip()
setS, setT = set(Ss), set(Ts)
for T in setT:
if T not in setS:
print((-1))
sys.exit()
def getDistNextss(As, numChar):
lenA = len(As)
poss = [-1] * numChar
for i, A in enumerate(As):
if poss[A] ... | from bisect import bisect_left, bisect_right
import sys
def solve():
numChar = 26
ordA = ord("a")
Ss = input().rstrip()
Ts = input().rstrip()
lenS = len(Ss)
Ss = [ord(S) - ordA for S in Ss]
Ts = [ord(T) - ordA for T in Ts]
setS, setT = set(Ss), set(Ts)
for T in setT:
if T n... | false | 2.702703 | [
"+from bisect import bisect_left, bisect_right",
"-numChar = 26",
"-ordA = ord(\"a\")",
"-Ss = input().rstrip()",
"-Ts = input().rstrip()",
"-setS, setT = set(Ss), set(Ts)",
"-for T in setT:",
"- if T not in setS:",
"- print((-1))",
"- sys.exit()",
"+",
"+def solve():",
"+ ... | false | 0.037371 | 0.035692 | 1.04704 | [
"s524272809",
"s955727007"
] |
u893063840 | p03148 | python | s741183219 | s748498112 | 613 | 453 | 38,136 | 30,800 | Accepted | Accepted | 26.1 | from heapq import heappush, heappop
n, k = list(map(int, input().split()))
td = [list(map(int, input().split())) for _ in range(n)]
td.sort(key=lambda x: x[1], reverse=True)
types = set()
can_remove = []
d_sm = 0
for t, d in td[:k]:
d_sm += d
if t in types:
can_remove.append(d)
else:
types.ad... | n, k = list(map(int, input().split()))
td = [list(map(int, input().split())) for _ in range(n)]
td.sort(key=lambda x: x[1], reverse=True)
types = set()
can_remove = []
d_sm = 0
for t, d in td[:k]:
d_sm += d
if t in types:
can_remove.append(d)
else:
types.add(t)
type_cnt = len(types)
ans = ... | 38 | 32 | 661 | 565 | from heapq import heappush, heappop
n, k = list(map(int, input().split()))
td = [list(map(int, input().split())) for _ in range(n)]
td.sort(key=lambda x: x[1], reverse=True)
types = set()
can_remove = []
d_sm = 0
for t, d in td[:k]:
d_sm += d
if t in types:
can_remove.append(d)
else:
types.... | n, k = list(map(int, input().split()))
td = [list(map(int, input().split())) for _ in range(n)]
td.sort(key=lambda x: x[1], reverse=True)
types = set()
can_remove = []
d_sm = 0
for t, d in td[:k]:
d_sm += d
if t in types:
can_remove.append(d)
else:
types.add(t)
type_cnt = len(types)
ans = d_... | false | 15.789474 | [
"-from heapq import heappush, heappop",
"-",
"-left = []",
"-for t, d in td[k:]:",
"- d = -d",
"- heappush(left, [d, t])",
"+left = td[k:][::-1]",
"- d, t = heappop(left)",
"- d = -d",
"+ t, d = left.pop()"
] | false | 0.03638 | 0.036295 | 1.002349 | [
"s741183219",
"s748498112"
] |
u296518383 | p02573 | python | s045588136 | s970861683 | 513 | 320 | 117,516 | 117,876 | Accepted | Accepted | 37.62 | class UnionFind:
def __init__(self, n):
self.root = [i for i in range(n + 1)]
self.size = [1] * (n + 1)
def find(self, x):
y = self.root[x]
if x == y:
return x
else:
z = self.find(y)
self.root[x] = z
return z
... | from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
... | 40 | 56 | 982 | 1,514 | class UnionFind:
def __init__(self, n):
self.root = [i for i in range(n + 1)]
self.size = [1] * (n + 1)
def find(self, x):
y = self.root[x]
if x == y:
return x
else:
z = self.find(y)
self.root[x] = z
return z
def union... | from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10**7)
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
from itert... | false | 28.571429 | [
"+from sys import stdin, setrecursionlimit",
"+",
"+input = stdin.buffer.readline",
"+setrecursionlimit(10**7)",
"+from heapq import heappush, heappop",
"+from bisect import bisect_left, bisect_right",
"+from collections import deque, defaultdict, Counter",
"+from itertools import combinations, permut... | false | 0.03605 | 0.073655 | 0.489449 | [
"s045588136",
"s970861683"
] |
u811967730 | p02972 | python | s474736282 | s986188238 | 878 | 275 | 14,484 | 14,484 | Accepted | Accepted | 68.68 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
check = [0] * N
for i in reversed(list(range(1, N + 1))):
x = i
total = 0
while x <= N:
total += check[x - 1]
x += i
if total % 2 != A[i - 1]:
check[i - 1] = 1
M = sum(che... | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
check = [0] * N
for i in reversed(list(range(1, N + 1))):
if sum(check[i - 1::i]) % 2 != A[i - 1]:
check[i - 1] = 1
M = sum(check)
ans = deque()
for index, value in enumerate(check):
if value == ... | 26 | 21 | 459 | 382 | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
check = [0] * N
for i in reversed(list(range(1, N + 1))):
x = i
total = 0
while x <= N:
total += check[x - 1]
x += i
if total % 2 != A[i - 1]:
check[i - 1] = 1
M = sum(check)
ans = deque()
f... | from collections import deque
N = int(eval(input()))
A = list(map(int, input().split()))
check = [0] * N
for i in reversed(list(range(1, N + 1))):
if sum(check[i - 1 :: i]) % 2 != A[i - 1]:
check[i - 1] = 1
M = sum(check)
ans = deque()
for index, value in enumerate(check):
if value == 1:
ans.ap... | false | 19.230769 | [
"- x = i",
"- total = 0",
"- while x <= N:",
"- total += check[x - 1]",
"- x += i",
"- if total % 2 != A[i - 1]:",
"+ if sum(check[i - 1 :: i]) % 2 != A[i - 1]:"
] | false | 0.04051 | 0.036629 | 1.105955 | [
"s474736282",
"s986188238"
] |
u495667483 | p03803 | python | s386354059 | s503165155 | 181 | 33 | 38,384 | 9,488 | Accepted | Accepted | 81.77 | A, B = list(map(int,input().split()))
if A == 1:
A = 14
if B == 1:
B = 14
print(('Alice' if A > B else 'Bob' if A < B else 'Draw')) | import sys, math
from functools import lru_cache
from itertools import accumulate
sys.setrecursionlimit(10**9)
MOD = 10**9+7
def input():
return sys.stdin.readline()[:-1]
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def i2(n):
tmp = [list(mi())... | 7 | 32 | 144 | 561 | A, B = list(map(int, input().split()))
if A == 1:
A = 14
if B == 1:
B = 14
print(("Alice" if A > B else "Bob" if A < B else "Draw"))
| import sys, math
from functools import lru_cache
from itertools import accumulate
sys.setrecursionlimit(10**9)
MOD = 10**9 + 7
def input():
return sys.stdin.readline()[:-1]
def mi():
return list(map(int, input().split()))
def ii():
return int(eval(input()))
def i2(n):
tmp = [list(mi()) for i in... | false | 78.125 | [
"-A, B = list(map(int, input().split()))",
"-if A == 1:",
"- A = 14",
"-if B == 1:",
"- B = 14",
"-print((\"Alice\" if A > B else \"Bob\" if A < B else \"Draw\"))",
"+import sys, math",
"+from functools import lru_cache",
"+from itertools import accumulate",
"+",
"+sys.setrecursionlimit(10... | false | 0.072099 | 0.037491 | 1.923073 | [
"s386354059",
"s503165155"
] |
u784022244 | p03043 | python | s033078954 | s519072314 | 210 | 97 | 14,428 | 2,940 | Accepted | Accepted | 53.81 | from math import ceil
import numpy as np
N,K=list(map(int, input().split()))
#サイコロを振る 1以上K未満→コイン K以上ゲーム終了、す抜けのかち
#コイン 表なら2倍 裏なら0 0なったら負け
ans=max( (N-K+1),0) /N
#(K-1)/N
# M*(2**x)>=K M:サイコロの目
# x*log(2)>=log(K/M)
lim=min(K-1,N)
for i in range(1,lim+1):
x=ceil(np.log(K/i)/np.log(2))
ans+=(1/N)*((0.... | from math import ceil, log
N,K=list(map(int, input().split()))
ans=0
for i in range(1,N+1):
n=ceil(log(K/i, 2))
if n>=0:
ans+=(1/(N*2**n))
else:
ans+=1/N
#print(n)
print(ans) | 15 | 12 | 332 | 212 | from math import ceil
import numpy as np
N, K = list(map(int, input().split()))
# サイコロを振る 1以上K未満→コイン K以上ゲーム終了、す抜けのかち
# コイン 表なら2倍 裏なら0 0なったら負け
ans = max((N - K + 1), 0) / N
# (K-1)/N
# M*(2**x)>=K M:サイコロの目
# x*log(2)>=log(K/M)
lim = min(K - 1, N)
for i in range(1, lim + 1):
x = ceil(np.log(K / i) / np.log(2))
a... | from math import ceil, log
N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
n = ceil(log(K / i, 2))
if n >= 0:
ans += 1 / (N * 2**n)
else:
ans += 1 / N
# print(n)
print(ans)
| false | 20 | [
"-from math import ceil",
"-import numpy as np",
"+from math import ceil, log",
"-# サイコロを振る 1以上K未満→コイン K以上ゲーム終了、す抜けのかち",
"-# コイン 表なら2倍 裏なら0 0なったら負け",
"-ans = max((N - K + 1), 0) / N",
"-# (K-1)/N",
"-# M*(2**x)>=K M:サイコロの目",
"-# x*log(2)>=log(K/M)",
"-lim = min(K - 1, N)",
"-for i in range(1, li... | false | 0.229937 | 0.098841 | 2.326329 | [
"s033078954",
"s519072314"
] |
u399616977 | p02899 | python | s088434129 | s313978840 | 306 | 165 | 19,964 | 24,632 | Accepted | Accepted | 46.08 |
n=int(input())
l=[]
tem=list(map(int,input().split()))
for i in range(n):
l.append((tem[i],i+1))
l=sorted(l,key=lambda s: s[0])
for x in range(n):
if x==0:
print(l[x][1],end="")
else:
print(" %d"%l[x][1],end="")
|
n=int(eval(input()))
l=[]
tem=list(map(int,input().split()))
for i in range(n):
l.append((tem[i],i+1))
l=sorted(l,key=lambda s: s[0])
print((" ".join(list([str(x[1]) for x in l]))))
| 12 | 8 | 252 | 190 | n = int(input())
l = []
tem = list(map(int, input().split()))
for i in range(n):
l.append((tem[i], i + 1))
l = sorted(l, key=lambda s: s[0])
for x in range(n):
if x == 0:
print(l[x][1], end="")
else:
print(" %d" % l[x][1], end="")
| n = int(eval(input()))
l = []
tem = list(map(int, input().split()))
for i in range(n):
l.append((tem[i], i + 1))
l = sorted(l, key=lambda s: s[0])
print((" ".join(list([str(x[1]) for x in l]))))
| false | 33.333333 | [
"-n = int(input())",
"+n = int(eval(input()))",
"-for x in range(n):",
"- if x == 0:",
"- print(l[x][1], end=\"\")",
"- else:",
"- print(\" %d\" % l[x][1], end=\"\")",
"+print((\" \".join(list([str(x[1]) for x in l]))))"
] | false | 0.083508 | 0.058444 | 1.428866 | [
"s088434129",
"s313978840"
] |
u046187684 | p02912 | python | s705987191 | s525272210 | 141 | 118 | 15,176 | 14,224 | Accepted | Accepted | 16.31 | from heapq import heappush, heappop
def solve(string):
n, m, *a = list(map(int, string.split()))
h = []
for _a in a:
heappush(h, -_a)
for _ in range(m):
heappush(h, -(-heappop(h) // 2))
return str(-sum(h))
if __name__ == '__main__':
print((solve('\n'.join([eval(... | n,m = list(map(int,input().split()))
arr = list(map(int,input().split()))
l = len(arr)
while m != 0 :
arr.sort(reverse=True)
j = arr[0] // 2
for i in range(l):
if arr[i] > j:
if m != 0:
m -= 1
else:
break
... | 15 | 21 | 329 | 457 | from heapq import heappush, heappop
def solve(string):
n, m, *a = list(map(int, string.split()))
h = []
for _a in a:
heappush(h, -_a)
for _ in range(m):
heappush(h, -(-heappop(h) // 2))
return str(-sum(h))
if __name__ == "__main__":
print((solve("\n".join([eval(input()), eval... | n, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
l = len(arr)
while m != 0:
arr.sort(reverse=True)
j = arr[0] // 2
for i in range(l):
if arr[i] > j:
if m != 0:
m -= 1
else:
break
arr[i] //= 2
else... | false | 28.571429 | [
"-from heapq import heappush, heappop",
"-",
"-",
"-def solve(string):",
"- n, m, *a = list(map(int, string.split()))",
"- h = []",
"- for _a in a:",
"- heappush(h, -_a)",
"- for _ in range(m):",
"- heappush(h, -(-heappop(h) // 2))",
"- return str(-sum(h))",
"-",
... | false | 0.035632 | 0.03687 | 0.96641 | [
"s705987191",
"s525272210"
] |
u496344397 | p03329 | python | s932446566 | s322376840 | 514 | 434 | 6,900 | 6,900 | Accepted | Accepted | 15.56 | N = int(eval(input()))
dp = list(range(N+1))
for amount in range(6, N+1):
unit = 6
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount-unit]+1)
unit *= 6
unit = 9
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount-unit]+1)
unit *= 9
p... | N = int(eval(input()))
dp = list(range(N+1))
def calc(unit_base):
unit = unit_base
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount-unit]+1)
unit *= unit_base
for amount in range(6, N+1):
calc(6)
calc(9)
print((dp[N])) | 16 | 15 | 325 | 272 | N = int(eval(input()))
dp = list(range(N + 1))
for amount in range(6, N + 1):
unit = 6
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount - unit] + 1)
unit *= 6
unit = 9
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount - unit] + 1)
unit *= 9
print((d... | N = int(eval(input()))
dp = list(range(N + 1))
def calc(unit_base):
unit = unit_base
while unit <= amount:
dp[amount] = min(dp[amount], dp[amount - unit] + 1)
unit *= unit_base
for amount in range(6, N + 1):
calc(6)
calc(9)
print((dp[N]))
| false | 6.25 | [
"-for amount in range(6, N + 1):",
"- unit = 6",
"+",
"+",
"+def calc(unit_base):",
"+ unit = unit_base",
"- unit *= 6",
"- unit = 9",
"- while unit <= amount:",
"- dp[amount] = min(dp[amount], dp[amount - unit] + 1)",
"- unit *= 9",
"+ unit *= unit_base... | false | 0.099253 | 0.215109 | 0.461408 | [
"s932446566",
"s322376840"
] |
u729133443 | p02756 | python | s683202293 | s246354903 | 1,465 | 716 | 18,300 | 4,412 | Accepted | Accepted | 51.13 | s,_,*q=open(0)
a='%s'
p=1
for q in q:
try:
q,f,c=q.split()
if(f<'2')^p:a+=c
else:a=c+a
except:p^=1
print(((a%s[:-1])[::p or-1])) | S = str(eval(input()))
Q = int(eval(input()))
head = ""
tail = ""
main = S
status = 0
while Q:
Q -= 1
l = list(map(str,input().split()))
if l[0] == "1":
status = (status+1)%2
else:
letter = l[2]
if l[1] == "1":
if status == 0:
head += letter
else:
t... | 10 | 31 | 151 | 511 | s, _, *q = open(0)
a = "%s"
p = 1
for q in q:
try:
q, f, c = q.split()
if (f < "2") ^ p:
a += c
else:
a = c + a
except:
p ^= 1
print(((a % s[:-1])[:: p or -1]))
| S = str(eval(input()))
Q = int(eval(input()))
head = ""
tail = ""
main = S
status = 0
while Q:
Q -= 1
l = list(map(str, input().split()))
if l[0] == "1":
status = (status + 1) % 2
else:
letter = l[2]
if l[1] == "1":
if status == 0:
head += letter
... | false | 67.741935 | [
"-s, _, *q = open(0)",
"-a = \"%s\"",
"-p = 1",
"-for q in q:",
"- try:",
"- q, f, c = q.split()",
"- if (f < \"2\") ^ p:",
"- a += c",
"+S = str(eval(input()))",
"+Q = int(eval(input()))",
"+head = \"\"",
"+tail = \"\"",
"+main = S",
"+status = 0",
"+while Q:... | false | 0.048129 | 0.045577 | 1.055981 | [
"s683202293",
"s246354903"
] |
u562935282 | p03588 | python | s977026603 | s336052044 | 330 | 289 | 16,604 | 3,060 | Accepted | Accepted | 12.42 | n = int(eval(input()))
M = [tuple(map(int, input().split()))for _ in range(n)]
a, b = -1, -1
for i in range(n):
ta, tb = M[i]
if ta > a:
a = ta
b = tb
print((a + b)) | n = int(eval(input()))
a, b = 0, float('inf')
for i in range(n):
ta, tb = list(map(int, input().split()))
if a < ta:
a = ta
b = tb
print((a + b)) | 9 | 9 | 189 | 166 | n = int(eval(input()))
M = [tuple(map(int, input().split())) for _ in range(n)]
a, b = -1, -1
for i in range(n):
ta, tb = M[i]
if ta > a:
a = ta
b = tb
print((a + b))
| n = int(eval(input()))
a, b = 0, float("inf")
for i in range(n):
ta, tb = list(map(int, input().split()))
if a < ta:
a = ta
b = tb
print((a + b))
| false | 0 | [
"-M = [tuple(map(int, input().split())) for _ in range(n)]",
"-a, b = -1, -1",
"+a, b = 0, float(\"inf\")",
"- ta, tb = M[i]",
"- if ta > a:",
"+ ta, tb = list(map(int, input().split()))",
"+ if a < ta:"
] | false | 0.041189 | 0.038383 | 1.073122 | [
"s977026603",
"s336052044"
] |
u215268883 | p02596 | python | s563180394 | s913663684 | 380 | 174 | 92,764 | 9,028 | Accepted | Accepted | 54.21 | K = int(eval(input()))
dic = {}
x = 0
count = 0
while 1:
x = (x * 10 + 7) % K
count += 1
if x == 0:
print(count)
exit()
if x in dic:
print((-1))
exit()
dic[x] = 1
| K = int(eval(input()))
x = 0
for i in range(K + 5):
x = (x * 10 + 7) % K
if x == 0:
print((i + 1))
exit()
print((-1))
| 14 | 8 | 220 | 139 | K = int(eval(input()))
dic = {}
x = 0
count = 0
while 1:
x = (x * 10 + 7) % K
count += 1
if x == 0:
print(count)
exit()
if x in dic:
print((-1))
exit()
dic[x] = 1
| K = int(eval(input()))
x = 0
for i in range(K + 5):
x = (x * 10 + 7) % K
if x == 0:
print((i + 1))
exit()
print((-1))
| false | 42.857143 | [
"-dic = {}",
"-count = 0",
"-while 1:",
"+for i in range(K + 5):",
"- count += 1",
"- print(count)",
"+ print((i + 1))",
"- if x in dic:",
"- print((-1))",
"- exit()",
"- dic[x] = 1",
"+print((-1))"
] | false | 0.220313 | 0.069924 | 3.150755 | [
"s563180394",
"s913663684"
] |
u075303794 | p02712 | python | s881879336 | s077524062 | 1,183 | 109 | 34,468 | 34,144 | Accepted | Accepted | 90.79 | import numpy as np
N = int(eval(input()))
list_num = np.arange(1, N+1)
for i in list_num:
if i % 3 == 0:
list_num[i-1] = 0
elif i % 5 == 0:
list_num[i-1] = 0
elif i % 15 == 0:
list_num[i-1] = 0
print((list_num.sum())) | import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(read())
ans = np.arange(N+1, dtype=np.int64)
ans[::3] = 0
ans[::5] = 0
print((ans.sum())) | 13 | 14 | 241 | 247 | import numpy as np
N = int(eval(input()))
list_num = np.arange(1, N + 1)
for i in list_num:
if i % 3 == 0:
list_num[i - 1] = 0
elif i % 5 == 0:
list_num[i - 1] = 0
elif i % 15 == 0:
list_num[i - 1] = 0
print((list_num.sum()))
| import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(read())
ans = np.arange(N + 1, dtype=np.int64)
ans[::3] = 0
ans[::5] = 0
print((ans.sum()))
| false | 7.142857 | [
"+import sys",
"-N = int(eval(input()))",
"-list_num = np.arange(1, N + 1)",
"-for i in list_num:",
"- if i % 3 == 0:",
"- list_num[i - 1] = 0",
"- elif i % 5 == 0:",
"- list_num[i - 1] = 0",
"- elif i % 15 == 0:",
"- list_num[i - 1] = 0",
"-print((list_num.sum()))"... | false | 0.682623 | 0.169672 | 4.023201 | [
"s881879336",
"s077524062"
] |
u841623074 | p03805 | python | s991465319 | s569813610 | 298 | 20 | 5,552 | 3,064 | Accepted | Accepted | 93.29 | N,M=list(map(int,input().split()))
import copy
a=[0]*M
b=[0]*M
for i in range(M):
a[i],b[i]=list(map(int,input().split()))
D=[[1]]
def route(D):
E=[]
D1=copy.deepcopy(D)
for j in range(len(D)):
x=D[j][-1]
for i in range(M):
if a[i]==x:
if not b... | def bit_DP(N,Adj):
dp=[[0]*N for i in range(1<<N)]
dp[1][0]=1
for S in range(1<<N):
for v in range(N):
if (S&(1<<v))==0:
continue
sub=S^(1<<v)
for u in range(N):
if (sub&(1<<u)) and (Adj[u][v]):
... | 30 | 25 | 721 | 684 | N, M = list(map(int, input().split()))
import copy
a = [0] * M
b = [0] * M
for i in range(M):
a[i], b[i] = list(map(int, input().split()))
D = [[1]]
def route(D):
E = []
D1 = copy.deepcopy(D)
for j in range(len(D)):
x = D[j][-1]
for i in range(M):
if a[i] == x:
... | def bit_DP(N, Adj):
dp = [[0] * N for i in range(1 << N)]
dp[1][0] = 1
for S in range(1 << N):
for v in range(N):
if (S & (1 << v)) == 0:
continue
sub = S ^ (1 << v)
for u in range(N):
if (sub & (1 << u)) and (Adj[u][v]):
... | false | 16.666667 | [
"-N, M = list(map(int, input().split()))",
"-import copy",
"-",
"-a = [0] * M",
"-b = [0] * M",
"-for i in range(M):",
"- a[i], b[i] = list(map(int, input().split()))",
"-D = [[1]]",
"+def bit_DP(N, Adj):",
"+ dp = [[0] * N for i in range(1 << N)]",
"+ dp[1][0] = 1",
"+ for S in ra... | false | 0.044908 | 0.044949 | 0.999075 | [
"s991465319",
"s569813610"
] |
u367130284 | p03221 | python | s250170186 | s152318588 | 728 | 607 | 72,128 | 45,360 | Accepted | Accepted | 16.62 | from collections import*
import sys
input=sys.stdin.readline
n,m=list(map(int,input().split()))
d=defaultdict(list)
l=[]
for i in range(m):
p,y=list(map(int,input().split()))
l.append([p,y])
d[p].append(y)
for k,v in list(d.items()):
d[k]=list(enumerate(sorted(v)))
d2=defaultdict(int)
f... | #from numpy import*
#from scipy import*
from collections import* #defaultdict Counter deque
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2)
from operator import mul
from bisect import* #bisect_left bisect_right
fro... | 20 | 40 | 435 | 1,053 | from collections import *
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
d = defaultdict(list)
l = []
for i in range(m):
p, y = list(map(int, input().split()))
l.append([p, y])
d[p].append(y)
for k, v in list(d.items()):
d[k] = list(enumerate(sorted(v)))
d2 = defaultdict(i... | # from numpy import*
# from scipy import*
from collections import * # defaultdict Counter deque
from fractions import gcd
from functools import * # reduce
from itertools import * # permutations("AB",repeat=2) combinations("AB",2) product("AB",2)
from operator import mul
from bisect import * # bisect_left bisect_rig... | false | 50 | [
"-from collections import *",
"+# from numpy import*",
"+# from scipy import*",
"+from collections import * # defaultdict Counter deque",
"+from fractions import gcd",
"+from functools import * # reduce",
"+from itertools import * # permutations(\"AB\",repeat=2) combinations(\"AB\",2) product(\"AB\",... | false | 0.049629 | 0.050172 | 0.989184 | [
"s250170186",
"s152318588"
] |
u670180528 | p02852 | python | s437880143 | s181176577 | 155 | 112 | 14,460 | 10,648 | Accepted | Accepted | 27.74 | n,m=list(map(int,input().split()))
su=eval(input())
rev=su[::-1]
if "1"*m in su:
print((-1))
exit()
dist_f_n=[float('inf')]*(n+1)
dist_f_n[0]=0
for i in range(1,m+1):
if rev[i]=="0":
dist_f_n[i]=1
last=i
if i==n:
break
while last<n:
for i in range(last+1,last+m+1):
if rev[i]=="0":
dis... | def main():
n, m = list(map(int, input().split()))
rev = input()[::-1]
ans = []
cur = nxt = 0
while cur < n:
for i in range(cur + 1, cur + m + 1):
if i==n:
nxt = i
break
if rev[i]=="0":
nxt = i
if cur==nxt:
print((-1))
exit()
ans += [str(nxt - cur)]
cur = nxt
print... | 31 | 22 | 536 | 373 | n, m = list(map(int, input().split()))
su = eval(input())
rev = su[::-1]
if "1" * m in su:
print((-1))
exit()
dist_f_n = [float("inf")] * (n + 1)
dist_f_n[0] = 0
for i in range(1, m + 1):
if rev[i] == "0":
dist_f_n[i] = 1
last = i
if i == n:
break
while last < n:
for ... | def main():
n, m = list(map(int, input().split()))
rev = input()[::-1]
ans = []
cur = nxt = 0
while cur < n:
for i in range(cur + 1, cur + m + 1):
if i == n:
nxt = i
break
if rev[i] == "0":
nxt = i
if cur == nxt:... | false | 29.032258 | [
"-n, m = list(map(int, input().split()))",
"-su = eval(input())",
"-rev = su[::-1]",
"-if \"1\" * m in su:",
"- print((-1))",
"- exit()",
"-dist_f_n = [float(\"inf\")] * (n + 1)",
"-dist_f_n[0] = 0",
"-for i in range(1, m + 1):",
"- if rev[i] == \"0\":",
"- dist_f_n[i] = 1",
"-... | false | 0.047712 | 0.119679 | 0.398671 | [
"s437880143",
"s181176577"
] |
u484229314 | p02947 | python | s420585981 | s858161968 | 1,921 | 514 | 74,200 | 23,904 | Accepted | Accepted | 73.24 | def f(x):
return 10 ** (ord(x) - ord('a') + 1)
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
from collections import Counter
N = int(eval(input()))
counter = Counter()
for i in range(N):
counter[sum([f(i) for i in eva... | from collections import Counter
N = int(eval(input()))
counter = Counter()
for i in range(N):
counter[tuple(sorted(eval(input())))] += 1
res = 0
for v in list(counter.values()):
res += v * (v - 1) / 2
print((int(res))) | 22 | 12 | 431 | 220 | def f(x):
return 10 ** (ord(x) - ord("a") + 1)
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
from collections import Counter
N = int(eval(input()))
counter = Counter()
for i in range(N):
counter[sum([f(i) for i in eval(input())])] +=... | from collections import Counter
N = int(eval(input()))
counter = Counter()
for i in range(N):
counter[tuple(sorted(eval(input())))] += 1
res = 0
for v in list(counter.values()):
res += v * (v - 1) / 2
print((int(res)))
| false | 45.454545 | [
"-def f(x):",
"- return 10 ** (ord(x) - ord(\"a\") + 1)",
"-",
"-",
"-import math",
"-",
"-",
"-def combinations_count(n, r):",
"- return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))",
"-",
"-",
"- counter[sum([f(i) for i in eval(input())])] += 1",
"+ counter[... | false | 0.068061 | 0.037596 | 1.810315 | [
"s420585981",
"s858161968"
] |
u296518383 | p02820 | python | s079457998 | s240080852 | 222 | 76 | 44,144 | 4,656 | Accepted | Accepted | 65.77 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
def janken(s):
if s == "r":
return P
if s == "s":
return R
if s == "p":
return S
answer = 0
for i in range(K):
j = 0
flag = 0
while i + K * j < N:
if j == 0:
answer +=... | def win(t):
if t == "g":
return "p"
if t == "c":
return "g"
if t == "p":
return "c"
N, K = list(map(int, input().split()))
G, C, P = list(map(int, input().split()))
T = input().replace("r", "g").replace("s", "c")
point = {"g": G, "c": C, "p": P}
check = [None] * (N + K)
answer = 0
f... | 28 | 23 | 543 | 430 | N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = eval(input())
def janken(s):
if s == "r":
return P
if s == "s":
return R
if s == "p":
return S
answer = 0
for i in range(K):
j = 0
flag = 0
while i + K * j < N:
if j == 0:
... | def win(t):
if t == "g":
return "p"
if t == "c":
return "g"
if t == "p":
return "c"
N, K = list(map(int, input().split()))
G, C, P = list(map(int, input().split()))
T = input().replace("r", "g").replace("s", "c")
point = {"g": G, "c": C, "p": P}
check = [None] * (N + K)
answer = 0
... | false | 17.857143 | [
"-N, K = list(map(int, input().split()))",
"-R, S, P = list(map(int, input().split()))",
"-T = eval(input())",
"+def win(t):",
"+ if t == \"g\":",
"+ return \"p\"",
"+ if t == \"c\":",
"+ return \"g\"",
"+ if t == \"p\":",
"+ return \"c\"",
"-def janken(s):",
"- ... | false | 0.039785 | 0.041112 | 0.967713 | [
"s079457998",
"s240080852"
] |
u357751375 | p03030 | python | s247936165 | s453135430 | 26 | 24 | 9,172 | 9,204 | Accepted | Accepted | 7.69 | n = int(eval(input()))
l = [list(input().split()) for i in range(n)]
s,p = [list(i) for i in zip(*l)]
p = [int(i) for i in p]
z = list(set(s))
z.sort()
m = list(p)
m.sort(reverse = True)
l = []
k = 0
for i in range(len(z)):
l.append(k)
k += 200
o = []
for i in range(n):
w = l[z.index(s[... | n = int(eval(input()))
l = []
for i in range(1,n+1):
s,p = input().split()
t = [s,int(p),i]
l.append(t)
l.sort()
def check(m,i):
z = list(l[m:i])
z.sort(key = lambda x: x[1] , reverse = True)
for j in range(i-m):
print((z[j][2]))
m = 0
for i in range(1,n):
if l[m][0] !=... | 25 | 18 | 436 | 368 | n = int(eval(input()))
l = [list(input().split()) for i in range(n)]
s, p = [list(i) for i in zip(*l)]
p = [int(i) for i in p]
z = list(set(s))
z.sort()
m = list(p)
m.sort(reverse=True)
l = []
k = 0
for i in range(len(z)):
l.append(k)
k += 200
o = []
for i in range(n):
w = l[z.index(s[i])]
w += m.index(... | n = int(eval(input()))
l = []
for i in range(1, n + 1):
s, p = input().split()
t = [s, int(p), i]
l.append(t)
l.sort()
def check(m, i):
z = list(l[m:i])
z.sort(key=lambda x: x[1], reverse=True)
for j in range(i - m):
print((z[j][2]))
m = 0
for i in range(1, n):
if l[m][0] != l[i]... | false | 28 | [
"-l = [list(input().split()) for i in range(n)]",
"-s, p = [list(i) for i in zip(*l)]",
"-p = [int(i) for i in p]",
"-z = list(set(s))",
"-z.sort()",
"-m = list(p)",
"-m.sort(reverse=True)",
"-k = 0",
"-for i in range(len(z)):",
"- l.append(k)",
"- k += 200",
"-o = []",
"-for i in rang... | false | 0.159055 | 0.115359 | 1.378782 | [
"s247936165",
"s453135430"
] |
u936985471 | p02883 | python | s825695518 | s907241868 | 556 | 326 | 37,280 | 53,224 | Accepted | Accepted | 41.37 | import sys
readline = sys.stdin.readline
import numpy as np
N,K = list(map(int,readline().split()))
A = np.array(sorted(list(map(int,readline().split()))))
F = np.array(sorted(list(map(int,readline().split())),reverse = True))
ok = A[-1] * F[0]
ng = -1
def isOk(x):
# 時間がxになるためには、A_iをx/F_i以下まで減らす必要がある... | import sys
readline = sys.stdin.readline
import numpy as np
N,K = list(map(int,readline().split()))
A = np.sort(np.array(readline().split(), dtype = int))
F = np.sort(np.array(readline().split(), dtype = int))[::-1]
# X秒で完食できるか二分探索
ng = -1
ok = F[0] * A[-1]
def isOk(x):
return A.sum() - np.minimum... | 23 | 26 | 479 | 466 | import sys
readline = sys.stdin.readline
import numpy as np
N, K = list(map(int, readline().split()))
A = np.array(sorted(list(map(int, readline().split()))))
F = np.array(sorted(list(map(int, readline().split())), reverse=True))
ok = A[-1] * F[0]
ng = -1
def isOk(x):
# 時間がxになるためには、A_iをx/F_i以下まで減らす必要がある
ret... | import sys
readline = sys.stdin.readline
import numpy as np
N, K = list(map(int, readline().split()))
A = np.sort(np.array(readline().split(), dtype=int))
F = np.sort(np.array(readline().split(), dtype=int))[::-1]
# X秒で完食できるか二分探索
ng = -1
ok = F[0] * A[-1]
def isOk(x):
return A.sum() - np.minimum(A, x // F).sum(... | false | 11.538462 | [
"-A = np.array(sorted(list(map(int, readline().split()))))",
"-F = np.array(sorted(list(map(int, readline().split())), reverse=True))",
"-ok = A[-1] * F[0]",
"+A = np.sort(np.array(readline().split(), dtype=int))",
"+F = np.sort(np.array(readline().split(), dtype=int))[::-1]",
"+# X秒で完食できるか二分探索",
"+ok =... | false | 0.256705 | 0.304122 | 0.844084 | [
"s825695518",
"s907241868"
] |
u261103969 | p02683 | python | s908764784 | s484386510 | 89 | 82 | 68,344 | 68,708 | Accepted | Accepted | 7.87 | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
n, m, x = list(map(int, readline().split()))
c = []
a = []
for i in range(n):
temp = list(map(int, readline().split()))
ctemp = temp[0]
atemp... | def check(learn_total):
for i in range(m):
if learn_total[i] < x:
return False
return True
def calc_price(bit):
price_total = 0 # 値段の合計
learn_total = [0] * m # 理解度
for i in range(n):
if (bit >> i) & 1: # i桁目が0か1か見て、i番目を買うか買わないか判定します
price_to... | 45 | 49 | 908 | 1,246 | import sys
readline = sys.stdin.readline
MOD = 10**9 + 7
INF = float("INF")
sys.setrecursionlimit(10**5)
def main():
n, m, x = list(map(int, readline().split()))
c = []
a = []
for i in range(n):
temp = list(map(int, readline().split()))
ctemp = temp[0]
atemp = temp[1:]
... | def check(learn_total):
for i in range(m):
if learn_total[i] < x:
return False
return True
def calc_price(bit):
price_total = 0 # 値段の合計
learn_total = [0] * m # 理解度
for i in range(n):
if (bit >> i) & 1: # i桁目が0か1か見て、i番目を買うか買わないか判定します
price_total += c[i] #... | false | 8.163265 | [
"-import sys",
"-",
"-readline = sys.stdin.readline",
"-MOD = 10**9 + 7",
"-INF = float(\"INF\")",
"-sys.setrecursionlimit(10**5)",
"+def check(learn_total):",
"+ for i in range(m):",
"+ if learn_total[i] < x:",
"+ return False",
"+ return True",
"-def main():",
"- ... | false | 0.075368 | 0.038548 | 1.955171 | [
"s908764784",
"s484386510"
] |
u218843509 | p02651 | python | s236226419 | s869315012 | 306 | 93 | 70,816 | 68,644 | Accepted | Accepted | 69.61 | import sys
def input():
return sys.stdin.readline()[:-1]
def least_bit_set(x):
return x & (-x)
def delete_zeros_from(values, start):
i = start
for j in range(start, len(values)):
if values[j] != 0:
values[i] = values[j]
i += 1
del values[i:]
def eliminate(values):
values = list(valu... | t = int(eval(input()))
for _ in range(t):
n = int(eval(input()))
a = list(map(int, input().split()))
s = eval(input())
basis = []
ans = 0
for i in range(n-1, -1, -1):
if s[i] == "0":
for b in basis:
a[i] = min(a[i], a[i]^b)
if a[i]:
basis.append(a[i])
else:
for b in basis:
... | 68 | 20 | 1,363 | 376 | import sys
def input():
return sys.stdin.readline()[:-1]
def least_bit_set(x):
return x & (-x)
def delete_zeros_from(values, start):
i = start
for j in range(start, len(values)):
if values[j] != 0:
values[i] = values[j]
i += 1
del values[i:]
def eliminate(valu... | t = int(eval(input()))
for _ in range(t):
n = int(eval(input()))
a = list(map(int, input().split()))
s = eval(input())
basis = []
ans = 0
for i in range(n - 1, -1, -1):
if s[i] == "0":
for b in basis:
a[i] = min(a[i], a[i] ^ b)
if a[i]:
... | false | 70.588235 | [
"-import sys",
"-",
"-",
"-def input():",
"- return sys.stdin.readline()[:-1]",
"-",
"-",
"-def least_bit_set(x):",
"- return x & (-x)",
"-",
"-",
"-def delete_zeros_from(values, start):",
"- i = start",
"- for j in range(start, len(values)):",
"- if values[j] != 0:",
... | false | 0.068441 | 0.037275 | 1.836102 | [
"s236226419",
"s869315012"
] |
u562935282 | p03164 | python | s410511017 | s786038037 | 1,992 | 991 | 321,648 | 311,048 | Accepted | Accepted | 50.25 | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
w, v = [], []
for _ in range(N):
tw, tv = list(map(int, input().split()))
w.append(tw)
v.append(tv)
dp = [[float('inf') for _ in range(sum(v) + 1)] for _ in range(N + 1)]
dp[0][0] = 0
# dp[何番目までの品物で][この価値以下を達成する]:=最... | inf = float('inf')
n, w = list(map(int, input().split()))
wv = tuple(tuple(map(int, input().split())) for _ in range(n))
dp = tuple([inf] * (pow(10, 3) * n + 1) for _ in range(n + 1))
dp[0][0] = 0
for ind, (wi, vi) in enumerate(wv, 1):
for v in range(pow(10, 3) * n + 1):
if vi <= v:
... | 27 | 19 | 633 | 530 | import sys
input = sys.stdin.readline
N, W = list(map(int, input().split()))
w, v = [], []
for _ in range(N):
tw, tv = list(map(int, input().split()))
w.append(tw)
v.append(tv)
dp = [[float("inf") for _ in range(sum(v) + 1)] for _ in range(N + 1)]
dp[0][0] = 0
# dp[何番目までの品物で][この価値以下を達成する]:=最小の重量
for i in r... | inf = float("inf")
n, w = list(map(int, input().split()))
wv = tuple(tuple(map(int, input().split())) for _ in range(n))
dp = tuple([inf] * (pow(10, 3) * n + 1) for _ in range(n + 1))
dp[0][0] = 0
for ind, (wi, vi) in enumerate(wv, 1):
for v in range(pow(10, 3) * n + 1):
if vi <= v:
dp[ind][v] =... | false | 29.62963 | [
"-import sys",
"-",
"-input = sys.stdin.readline",
"-N, W = list(map(int, input().split()))",
"-w, v = [], []",
"-for _ in range(N):",
"- tw, tv = list(map(int, input().split()))",
"- w.append(tw)",
"- v.append(tv)",
"-dp = [[float(\"inf\") for _ in range(sum(v) + 1)] for _ in range(N + 1... | false | 0.036823 | 0.053636 | 0.686538 | [
"s410511017",
"s786038037"
] |
u028973125 | p03575 | python | s228335327 | s583784323 | 204 | 35 | 40,944 | 9,448 | Accepted | Accepted | 82.84 | import sys
class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union... | import sys
from collections import deque
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [[] for _ in range(N)]
edge_set = set()
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
edge_set.add(... | 66 | 35 | 1,607 | 711 | import sys
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
... | import sys
from collections import deque
input = sys.stdin.readline
N, M = list(map(int, input().split()))
edges = [[] for _ in range(N)]
edge_set = set()
for _ in range(M):
a, b = list(map(int, input().split()))
a -= 1
b -= 1
edges[a].append(b)
edges[b].append(a)
edge_set.add((a, b))
ans = 0
f... | false | 46.969697 | [
"+from collections import deque",
"-",
"-class UnionFind:",
"- def __init__(self, n):",
"- self.n = n",
"- self.parents = [-1] * n",
"-",
"- def find(self, x):",
"- if self.parents[x] < 0:",
"- return x",
"- else:",
"- self.parents[x] = s... | false | 0.045697 | 0.007492 | 6.099808 | [
"s228335327",
"s583784323"
] |
u576432509 | p03240 | python | s386652728 | s708564673 | 36 | 31 | 3,064 | 3,064 | Accepted | Accepted | 13.89 | def abs(x1,x2):
if x1>x2:
return x1-x2
else:
return x2-x1
n=int(eval(input()))
x=[]
y=[]
h=[]
for i in range(n):
xi,yi,hi=list(map(int,input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax=h[0]
xhmax=x[0]
yhmax=y[0]
ihmax=0
for i in range(n):... |
cc=0
if cc==0:
n=int(eval(input()))
xyh=[[0]*3 for i in range(n)]
for i in range(n):
xyh[i]=list(map(int,input().split()))
if xyh[i][2]>=1:
px=xyh[i][0]
py=xyh[i][1]
ph=xyh[i][2]
else:
n=4
px=3
py=2
ph=5
xyh=[[0]*3 for ... | 42 | 45 | 774 | 1,083 | def abs(x1, x2):
if x1 > x2:
return x1 - x2
else:
return x2 - x1
n = int(eval(input()))
x = []
y = []
h = []
for i in range(n):
xi, yi, hi = list(map(int, input().split()))
x.append(xi)
y.append(yi)
h.append(hi)
hmax = h[0]
xhmax = x[0]
yhmax = y[0]
ihmax = 0
for i in range(n):... | cc = 0
if cc == 0:
n = int(eval(input()))
xyh = [[0] * 3 for i in range(n)]
for i in range(n):
xyh[i] = list(map(int, input().split()))
if xyh[i][2] >= 1:
px = xyh[i][0]
py = xyh[i][1]
ph = xyh[i][2]
else:
n = 4
px = 3
py = 2
ph = 5
xyh... | false | 6.666667 | [
"-def abs(x1, x2):",
"- if x1 > x2:",
"- return x1 - x2",
"- else:",
"- return x2 - x1",
"-",
"-",
"-n = int(eval(input()))",
"-x = []",
"-y = []",
"-h = []",
"-for i in range(n):",
"- xi, yi, hi = list(map(int, input().split()))",
"- x.append(xi)",
"- y.appe... | false | 0.087494 | 0.057142 | 1.531162 | [
"s386652728",
"s708564673"
] |
u124498235 | p03645 | python | s585646419 | s600133216 | 915 | 614 | 71,128 | 6,312 | Accepted | Accepted | 32.9 | n, m = list(map(int, input().split()))
ab = []
c = []
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1:
ab.append(b)
if b == n:
c.append(a)
if len(set(ab) & set(c)) == 0:
print ("IMPOSSIBLE")
else:
print ("POSSIBLE") | n, m = list(map(int, input().split()))
c = [False for i in range(200001)]
d = [False for i in range(200001)]
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1:
c[b] = True
if b == n:
d[a] = True
for i in range(200001):
if c[i] and d[i]:
print ("POSSIBLE")
exit()
print ("IMPOSS... | 13 | 14 | 244 | 314 | n, m = list(map(int, input().split()))
ab = []
c = []
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1:
ab.append(b)
if b == n:
c.append(a)
if len(set(ab) & set(c)) == 0:
print("IMPOSSIBLE")
else:
print("POSSIBLE")
| n, m = list(map(int, input().split()))
c = [False for i in range(200001)]
d = [False for i in range(200001)]
for i in range(m):
a, b = list(map(int, input().split()))
if a == 1:
c[b] = True
if b == n:
d[a] = True
for i in range(200001):
if c[i] and d[i]:
print("POSSIBLE")
... | false | 7.142857 | [
"-ab = []",
"-c = []",
"+c = [False for i in range(200001)]",
"+d = [False for i in range(200001)]",
"- ab.append(b)",
"+ c[b] = True",
"- c.append(a)",
"-if len(set(ab) & set(c)) == 0:",
"- print(\"IMPOSSIBLE\")",
"-else:",
"- print(\"POSSIBLE\")",
"+ d[a] = ... | false | 0.043973 | 0.069418 | 0.633462 | [
"s585646419",
"s600133216"
] |
u427344224 | p03252 | python | s359452806 | s096642303 | 279 | 121 | 3,632 | 3,632 | Accepted | Accepted | 56.63 | S = eval(input())
T = eval(input())
S_dic = [-1 for _ in range(26)]
T_dic = [-1 for _ in range(26)]
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z"]
for i in range(len(S)):
s = S[i]
... | S = eval(input())
T = eval(input())
S_dic = {}
T_dic = {}
for i in range(len(S)):
s = S[i]
t = T[i]
if s in S_dic:
S_dic[s] += 1
else:
S_dic[s] = 1
if t in T_dic:
T_dic[t] +=1
else:
T_dic[t] = 1
S_dic = sorted(list(S_dic.items()), key= lambd... | 28 | 36 | 618 | 612 | S = eval(input())
T = eval(input())
S_dic = [-1 for _ in range(26)]
T_dic = [-1 for _ in range(26)]
alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
... | S = eval(input())
T = eval(input())
S_dic = {}
T_dic = {}
for i in range(len(S)):
s = S[i]
t = T[i]
if s in S_dic:
S_dic[s] += 1
else:
S_dic[s] = 1
if t in T_dic:
T_dic[t] += 1
else:
T_dic[t] = 1
S_dic = sorted(list(S_dic.items()), key=lambda x: x[1])
T_dic = sort... | false | 22.222222 | [
"-S_dic = [-1 for _ in range(26)]",
"-T_dic = [-1 for _ in range(26)]",
"-alphabet = [",
"- \"a\",",
"- \"b\",",
"- \"c\",",
"- \"d\",",
"- \"e\",",
"- \"f\",",
"- \"g\",",
"- \"h\",",
"- \"i\",",
"- \"j\",",
"- \"k\",",
"- \"l\",",
"- \"m\",",
... | false | 0.037357 | 0.04494 | 0.831271 | [
"s359452806",
"s096642303"
] |
u263830634 | p03680 | python | s436993402 | s489654403 | 245 | 93 | 7,960 | 7,852 | Accepted | Accepted | 62.04 | N = int(eval(input()))
a = []
for _ in range(N):
a += [int(eval(input()))]
lst = [0] * N
flag = True
i = 0
count = 0
while flag:
if lst[i] == 1:
print((-1))
exit()
elif a[i] == 2:
print((count + 1))
exit()
else:
lst[i] = 1
i = a[i] -... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
check = [True] * (N + 1)
count = 0
tmp = 1
while check[tmp]:
count += 1
check[tmp] = False
if A[tmp - 1] == 2:
print (count)
exit()
tmp = A[tmp - 1]
print((-1)) | 22 | 19 | 329 | 305 | N = int(eval(input()))
a = []
for _ in range(N):
a += [int(eval(input()))]
lst = [0] * N
flag = True
i = 0
count = 0
while flag:
if lst[i] == 1:
print((-1))
exit()
elif a[i] == 2:
print((count + 1))
exit()
else:
lst[i] = 1
i = a[i] - 1
count += 1
| import sys
input = sys.stdin.readline
N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
check = [True] * (N + 1)
count = 0
tmp = 1
while check[tmp]:
count += 1
check[tmp] = False
if A[tmp - 1] == 2:
print(count)
exit()
tmp = A[tmp - 1]
print((-1))
| false | 13.636364 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-a = []",
"-for _ in range(N):",
"- a += [int(eval(input()))]",
"-lst = [0] * N",
"-flag = True",
"-i = 0",
"+A = [int(eval(input())) for _ in range(N)]",
"+check = [True] * (N + 1)",
"-while flag:",
"- if lst[i] == 1:",
"- p... | false | 0.062497 | 0.037295 | 1.675758 | [
"s436993402",
"s489654403"
] |
u703812436 | p02712 | python | s995273163 | s896352447 | 189 | 21 | 9,108 | 9,116 | Accepted | Accepted | 88.89 | N = int(eval(input()))
ans = 0
for i in range(N):
if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
ans += i + 1
print(ans) | N = int(eval(input()))
ans = int(N * (N + 1) / 2 - (N // 3) * (N // 3 + 1) / 2 * 3 - (N // 5) * (N // 5 + 1) / 2 * 5 + (N // 15) * (N // 15 + 1) / 2 * 15)
print(ans) | 6 | 3 | 126 | 161 | N = int(eval(input()))
ans = 0
for i in range(N):
if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
ans += i + 1
print(ans)
| N = int(eval(input()))
ans = int(
N * (N + 1) / 2
- (N // 3) * (N // 3 + 1) / 2 * 3
- (N // 5) * (N // 5 + 1) / 2 * 5
+ (N // 15) * (N // 15 + 1) / 2 * 15
)
print(ans)
| false | 50 | [
"-ans = 0",
"-for i in range(N):",
"- if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:",
"- ans += i + 1",
"+ans = int(",
"+ N * (N + 1) / 2",
"+ - (N // 3) * (N // 3 + 1) / 2 * 3",
"+ - (N // 5) * (N // 5 + 1) / 2 * 5",
"+ + (N // 15) * (N // 15 + 1) / 2 * 15",
"+)"
] | false | 0.471239 | 0.037735 | 12.488091 | [
"s995273163",
"s896352447"
] |
u683987726 | p02683 | python | s996170003 | s204665659 | 553 | 87 | 9,068 | 9,096 | Accepted | Accepted | 84.27 | n, m, x = list(map(int, input().split()))
inn = [ list( map(int, input().split() ) ) for _ in range(n) ]
c = [inn[_][0] for _ in range(n) ]
ara = [ inn[_][1:] for _ in range(n)]
ans = 1e9
for mask in range(2**15):
cost = 0
cnt = [0 for _ in range(m)]
for i in range(n):
if ( (1 << i) & mask ) == 0:
... | n, m, x = list(map(int, input().split()))
inn = [ list( map(int, input().split() ) ) for _ in range(n) ]
c = [inn[_][0] for _ in range(n) ]
ara = [ inn[_][1:] for _ in range(n)]
ans = 1e9
for mask in range(2**n):
cost = 0
cnt = [0 for _ in range(m)]
for i in range(n):
if ( (1 << i) & mask ) == 0:
... | 30 | 30 | 527 | 526 | n, m, x = list(map(int, input().split()))
inn = [list(map(int, input().split())) for _ in range(n)]
c = [inn[_][0] for _ in range(n)]
ara = [inn[_][1:] for _ in range(n)]
ans = 1e9
for mask in range(2**15):
cost = 0
cnt = [0 for _ in range(m)]
for i in range(n):
if ((1 << i) & mask) == 0:
... | n, m, x = list(map(int, input().split()))
inn = [list(map(int, input().split())) for _ in range(n)]
c = [inn[_][0] for _ in range(n)]
ara = [inn[_][1:] for _ in range(n)]
ans = 1e9
for mask in range(2**n):
cost = 0
cnt = [0 for _ in range(m)]
for i in range(n):
if ((1 << i) & mask) == 0:
... | false | 0 | [
"-for mask in range(2**15):",
"+for mask in range(2**n):"
] | false | 0.468973 | 0.035614 | 13.168182 | [
"s996170003",
"s204665659"
] |
u553987207 | p03037 | python | s813112549 | s423144273 | 318 | 128 | 3,060 | 8,980 | Accepted | Accepted | 59.75 | N, M = list(map(int, input().split()))
ansl = 1
ansr = N
for _ in range(M):
L, R = list(map(int, input().split()))
ansl = max(ansl, L)
ansr = min(ansr, R)
ans = max(ansr - ansl + 1, 0)
print(ans) | import sys
N, M = list(map(int, input().split()))
ansl = 1
ansr = N
for _ in range(M):
l, r = list(map(int, sys.stdin.readline().split()))
ansl = max(ansl, l)
ansr = min(ansr, r)
ans = max(0, ansr - ansl + 1)
print(ans) | 9 | 10 | 203 | 228 | N, M = list(map(int, input().split()))
ansl = 1
ansr = N
for _ in range(M):
L, R = list(map(int, input().split()))
ansl = max(ansl, L)
ansr = min(ansr, R)
ans = max(ansr - ansl + 1, 0)
print(ans)
| import sys
N, M = list(map(int, input().split()))
ansl = 1
ansr = N
for _ in range(M):
l, r = list(map(int, sys.stdin.readline().split()))
ansl = max(ansl, l)
ansr = min(ansr, r)
ans = max(0, ansr - ansl + 1)
print(ans)
| false | 10 | [
"+import sys",
"+",
"- L, R = list(map(int, input().split()))",
"- ansl = max(ansl, L)",
"- ansr = min(ansr, R)",
"-ans = max(ansr - ansl + 1, 0)",
"+ l, r = list(map(int, sys.stdin.readline().split()))",
"+ ansl = max(ansl, l)",
"+ ansr = min(ansr, r)",
"+ans = max(0, ansr - ans... | false | 0.077719 | 0.078091 | 0.995229 | [
"s813112549",
"s423144273"
] |
u355853184 | p02837 | python | s635805049 | s308846423 | 193 | 174 | 9,156 | 9,184 | Accepted | Accepted | 9.84 | n = int(eval(input()))
a_list = []
person_list = []
syogen_list = []
ans = 0
for i in range(0, n):
w = []
v = []
a = int(eval(input()))
for j in range(0, a):
x,y = list(map(int,input().split()))
w.append(x)
v.append(y)
person_list.append(w)
syogen_list.a... | N = int(eval(input()))
syougen = [ [] for _ in range(N) ]
for i in range(N):
num = int(eval(input()))
for j in range(num):
x, y = list(map(int, input().split()))
syougen[i].append([x, y])
#print(syougen)
ans = 0
for bit in range(1 << N):
break_flag = 0
for i in range(N):
... | 35 | 24 | 857 | 649 | n = int(eval(input()))
a_list = []
person_list = []
syogen_list = []
ans = 0
for i in range(0, n):
w = []
v = []
a = int(eval(input()))
for j in range(0, a):
x, y = list(map(int, input().split()))
w.append(x)
v.append(y)
person_list.append(w)
syogen_list.append(v)
# print... | N = int(eval(input()))
syougen = [[] for _ in range(N)]
for i in range(N):
num = int(eval(input()))
for j in range(num):
x, y = list(map(int, input().split()))
syougen[i].append([x, y])
# print(syougen)
ans = 0
for bit in range(1 << N):
break_flag = 0
for i in range(N):
if (bit >... | false | 31.428571 | [
"-n = int(eval(input()))",
"-a_list = []",
"-person_list = []",
"-syogen_list = []",
"+N = int(eval(input()))",
"+syougen = [[] for _ in range(N)]",
"+for i in range(N):",
"+ num = int(eval(input()))",
"+ for j in range(num):",
"+ x, y = list(map(int, input().split()))",
"+ s... | false | 0.080159 | 0.084908 | 0.944059 | [
"s635805049",
"s308846423"
] |
u046187684 | p03014 | python | s972860892 | s390143316 | 1,588 | 1,314 | 198,128 | 197,872 | Accepted | Accepted | 17.25 | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
hg = []
hi = []
vg = []
vi = []
for _s in s:
gn = 0
_hi = [0] * w
_hg = []
c = 0
for i, __s in enumerate(_s):
if __s == "#":
_hi[i] =... | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
hg = []
hi = []
vg = []
vi = []
for _s in s:
gn = 0
_hi = [0] * w
_hg = []
c = 0
for i, __s in enumerate(_s):
if __s == "#":
_hi[i] =... | 51 | 53 | 1,250 | 1,259 | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
hg = []
hi = []
vg = []
vi = []
for _s in s:
gn = 0
_hi = [0] * w
_hg = []
c = 0
for i, __s in enumerate(_s):
if __s == "#":
_hi[i] = -1
... | def solve(string):
h, w, *s = string.split()
h, w = list(map(int, [h, w]))
hg = []
hi = []
vg = []
vi = []
for _s in s:
gn = 0
_hi = [0] * w
_hg = []
c = 0
for i, __s in enumerate(_s):
if __s == "#":
_hi[i] = -1
... | false | 3.773585 | [
"- ans = max(ans, max([hg[i][hi[i][j]] + vg[j][vi[j][i]] for j in range(w)]))",
"+ for j in range(w):",
"+ ans = max(ans, hg[i][hi[i][j]] + vg[j][vi[j][i]])"
] | false | 0.044138 | 0.044121 | 1.00038 | [
"s972860892",
"s390143316"
] |
u923668099 | p02266 | python | s619511995 | s259149993 | 3,190 | 30 | 8,512 | 8,032 | Accepted | Accepted | 99.06 | """
O(n^2)??????????§£???
"""
danmen = eval(input())
depth = []
tmp_dpt = 0
for line in danmen:
depth.append(tmp_dpt)
if line == "\\":
tmp_dpt -= 1
elif line == "/":
tmp_dpt += 1
# len(depth) = len(danmen) + 1?????¨???
depth.append(tmp_dpt)
# print(depth)
i = 0
L ... |
danmen = eval(input())
down = []
edge = []
pool = []
for (i, line) in enumerate(danmen):
if line == "\\":
down.append(i)
elif down and line == "/":
left = down.pop()
area = i - left
while edge:
if edge[-1] > left:
edge.pop()
... | 54 | 25 | 1,056 | 483 | """
O(n^2)??????????§£???
"""
danmen = eval(input())
depth = []
tmp_dpt = 0
for line in danmen:
depth.append(tmp_dpt)
if line == "\\":
tmp_dpt -= 1
elif line == "/":
tmp_dpt += 1
# len(depth) = len(danmen) + 1?????¨???
depth.append(tmp_dpt)
# print(depth)
i = 0
L = []
while i < len(danmen):
... | danmen = eval(input())
down = []
edge = []
pool = []
for (i, line) in enumerate(danmen):
if line == "\\":
down.append(i)
elif down and line == "/":
left = down.pop()
area = i - left
while edge:
if edge[-1] > left:
edge.pop()
area += poo... | false | 53.703704 | [
"-\"\"\"",
"-O(n^2)??????????§£???",
"-\"\"\"",
"-depth = []",
"-tmp_dpt = 0",
"-for line in danmen:",
"- depth.append(tmp_dpt)",
"+down = []",
"+edge = []",
"+pool = []",
"+for (i, line) in enumerate(danmen):",
"- tmp_dpt -= 1",
"- elif line == \"/\":",
"- tmp_dpt += 1... | false | 0.047636 | 0.051633 | 0.922588 | [
"s619511995",
"s259149993"
] |
u028973125 | p03096 | python | s160247367 | s826925724 | 379 | 147 | 123,736 | 123,160 | Accepted | Accepted | 61.21 | import sys
mod = 10**9 + 7
N = int(sys.stdin.readline())
stones = []
for _ in range(N):
stones.append(int(sys.stdin.readline()))
left = [-1 for _ in range(2*10**5+1)]
dp = [0 for _ in range(N+5)]
dp[0] = 1
for i in range(N):
dp[i+1] = dp[i]
# 同じ色が前回出現した位置
c = stones[i]
if 0 <= lef... | import sys
mod = 10**9 + 7
N = int(sys.stdin.readline())
stones = []
for _ in range(N):
stones.append(int(sys.stdin.readline()))
left = {}
dp = [0 for _ in range(N+5)]
dp[0] = 1
for i in range(N):
dp[i+1] = dp[i]
# 同じ色が前回出現した位置
c = stones[i]
if c in left and 0 <= left[c] < i - 1:
... | 23 | 23 | 428 | 414 | import sys
mod = 10**9 + 7
N = int(sys.stdin.readline())
stones = []
for _ in range(N):
stones.append(int(sys.stdin.readline()))
left = [-1 for _ in range(2 * 10**5 + 1)]
dp = [0 for _ in range(N + 5)]
dp[0] = 1
for i in range(N):
dp[i + 1] = dp[i]
# 同じ色が前回出現した位置
c = stones[i]
if 0 <= left[c] < i -... | import sys
mod = 10**9 + 7
N = int(sys.stdin.readline())
stones = []
for _ in range(N):
stones.append(int(sys.stdin.readline()))
left = {}
dp = [0 for _ in range(N + 5)]
dp[0] = 1
for i in range(N):
dp[i + 1] = dp[i]
# 同じ色が前回出現した位置
c = stones[i]
if c in left and 0 <= left[c] < i - 1:
dp[i +... | false | 0 | [
"-left = [-1 for _ in range(2 * 10**5 + 1)]",
"+left = {}",
"- if 0 <= left[c] < i - 1:",
"+ if c in left and 0 <= left[c] < i - 1:"
] | false | 0.046102 | 0.037223 | 1.238532 | [
"s160247367",
"s826925724"
] |
u094191970 | p02899 | python | s999996253 | s536088320 | 597 | 512 | 23,404 | 23,356 | Accepted | Accepted | 14.24 | import numpy as np
n=int(eval(input()))
a=np.array(list(map(int,input().split())))
l=np.argsort(a)
ans=[i+1 for i in l]
print((*ans)) | import numpy as np
n=int(eval(input()))
a=np.array(list(map(int,input().split())))
l=np.argsort(a)+1
print((*l)) | 6 | 5 | 130 | 108 | import numpy as np
n = int(eval(input()))
a = np.array(list(map(int, input().split())))
l = np.argsort(a)
ans = [i + 1 for i in l]
print((*ans))
| import numpy as np
n = int(eval(input()))
a = np.array(list(map(int, input().split())))
l = np.argsort(a) + 1
print((*l))
| false | 16.666667 | [
"-l = np.argsort(a)",
"-ans = [i + 1 for i in l]",
"-print((*ans))",
"+l = np.argsort(a) + 1",
"+print((*l))"
] | false | 0.217298 | 0.241672 | 0.899146 | [
"s999996253",
"s536088320"
] |
u584174687 | p02901 | python | s306316166 | s060510287 | 1,920 | 326 | 112,088 | 48,344 | Accepted | Accepted | 83.02 | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy, copy
import queue
from collections import deque
def divisor(n): #nの約数を全て求める
... | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy, copy
import queue
from collections import deque
def main():
box_num, kagi... | 125 | 43 | 3,067 | 990 | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10**5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy, copy
import queue
from collections import deque
def divisor(n): # nの約数を全て求める
i = 1
tabl... | from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10**5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy, copy
import queue
from collections import deque
def main():
box_num, kagi_num = list(map(int... | false | 65.6 | [
"-def divisor(n): # nの約数を全て求める",
"- i = 1",
"- table = set()",
"- while i * i <= n:",
"- if n % i == 0:",
"- table.add(i)",
"- table.add(n // i)",
"- i += 1",
"- return table",
"-",
"-",
"-ans = 10**10",
"-",
"-",
"-def check(box_num, kagi... | false | 0.049085 | 0.038192 | 1.285235 | [
"s306316166",
"s060510287"
] |
u389910364 | p03558 | python | s668677685 | s830318365 | 423 | 152 | 10,952 | 9,200 | Accepted | Accepted | 64.07 | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float('inf')
K = int(eval(input()))
# ある数に 1 を足すと各桁の和は 1 増える
# ある数に 10 を掛けると各桁の和は 0 増える
# mod K の世界で同じことやっても同じなので
# このグラフ上で 1 から 0 への最短距離が答え。
distances = [INF for _ in range(K)]
# 01BFS
remains = deque()
remains.append((1,... | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float('inf')
K = int(eval(input()))
# ある数に 1 を足すと各桁の和は 1 増える
# ある数に 10 を掛けると各桁の和は 0 増える
# mod K の世界で同じことやっても同じなので
# このグラフ上で 1 から 0 への最短距離が答え。
distances = [INF for _ in range(K)]
# 01BFS
distances[1] = 1
remains = deque()
... | 26 | 30 | 612 | 705 | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float("inf")
K = int(eval(input()))
# ある数に 1 を足すと各桁の和は 1 増える
# ある数に 10 を掛けると各桁の和は 0 増える
# mod K の世界で同じことやっても同じなので
# このグラフ上で 1 から 0 への最短距離が答え。
distances = [INF for _ in range(K)]
# 01BFS
remains = deque()
remains.append((1, 1))
while distances[... | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float("inf")
K = int(eval(input()))
# ある数に 1 を足すと各桁の和は 1 増える
# ある数に 10 を掛けると各桁の和は 0 増える
# mod K の世界で同じことやっても同じなので
# このグラフ上で 1 から 0 への最短距離が答え。
distances = [INF for _ in range(K)]
# 01BFS
distances[1] = 1
remains = deque()
remains.append((1, 1))... | false | 13.333333 | [
"+distances[1] = 1",
"-while distances[0] == INF:",
"+while True:",
"- distances[mod_k] = d",
"- if distances[(mod_k + 1) % K] == INF:",
"+ if mod_k == 0:",
"+ break",
"+ if d + 1 < distances[(mod_k + 1) % K]:",
"+ distances[(mod_k + 1) % K] = d + 1",
"- if distances[m... | false | 0.101494 | 0.127217 | 0.797802 | [
"s668677685",
"s830318365"
] |
u539367121 | p02713 | python | s568782527 | s049555621 | 1,714 | 934 | 9,012 | 11,668 | Accepted | Accepted | 45.51 | def main():
import math
N = int(eval(input()))
ans=0
for i in range(1,N+1):
for j in range(1, N+1):
for k in range(1, N+1):
t=math.gcd(i,j)
t=math.gcd(t,k)
ans+=t
print(ans)
if __name__=='__main__':
main()
| def main():
import math
N = int(eval(input()))
gcd={}
ans=0
for i in range(1,N+1):
for j in range(1, N+1):
key=i*N+j
gcd[key]=math.gcd(i,j)
for k, i in list(gcd.items()):
for j in range(1, N+1):
key=j*N+i
ans+=gcd[key]
print(ans)
if __name__=='... | 15 | 19 | 276 | 329 | def main():
import math
N = int(eval(input()))
ans = 0
for i in range(1, N + 1):
for j in range(1, N + 1):
for k in range(1, N + 1):
t = math.gcd(i, j)
t = math.gcd(t, k)
ans += t
print(ans)
if __name__ == "__main__":
main()
| def main():
import math
N = int(eval(input()))
gcd = {}
ans = 0
for i in range(1, N + 1):
for j in range(1, N + 1):
key = i * N + j
gcd[key] = math.gcd(i, j)
for k, i in list(gcd.items()):
for j in range(1, N + 1):
key = j * N + i
... | false | 21.052632 | [
"+ gcd = {}",
"- for k in range(1, N + 1):",
"- t = math.gcd(i, j)",
"- t = math.gcd(t, k)",
"- ans += t",
"+ key = i * N + j",
"+ gcd[key] = math.gcd(i, j)",
"+ for k, i in list(gcd.items()):",
"+ for j in ra... | false | 0.151896 | 0.205025 | 0.740865 | [
"s568782527",
"s049555621"
] |
u191874006 | p03324 | python | s240725886 | s749363243 | 153 | 17 | 12,396 | 2,940 | Accepted | Accepted | 88.89 | #!/usr/bin/env python3
import numpy as np
import math
import re
x = eval(input())
x = re.split(" ",x)
D = int(x[0])
N = int(x[1])
if (N==100):
print((100**D*N+100**D))
else:
print((100**D*N))
| #!/usr/bin/env python3
#ABC100 B
D,N = list(map(int,input().split()))
if N == 100:
print((100**D*N+100**D))
else:
print((100**D*N))
| 14 | 9 | 201 | 140 | #!/usr/bin/env python3
import numpy as np
import math
import re
x = eval(input())
x = re.split(" ", x)
D = int(x[0])
N = int(x[1])
if N == 100:
print((100**D * N + 100**D))
else:
print((100**D * N))
| #!/usr/bin/env python3
# ABC100 B
D, N = list(map(int, input().split()))
if N == 100:
print((100**D * N + 100**D))
else:
print((100**D * N))
| false | 35.714286 | [
"-import numpy as np",
"-import math",
"-import re",
"-",
"-x = eval(input())",
"-x = re.split(\" \", x)",
"-D = int(x[0])",
"-N = int(x[1])",
"+# ABC100 B",
"+D, N = list(map(int, input().split()))"
] | false | 0.095264 | 0.037155 | 2.563934 | [
"s240725886",
"s749363243"
] |
u802963389 | p03937 | python | s836243733 | s014679660 | 170 | 18 | 38,256 | 3,060 | Accepted | Accepted | 89.41 | H, W = list(map(int,input().split()))
S = [eval(input()) for _ in range(H)]
endSh = 0
for i in S:
startSh = i.find("#")
if startSh != endSh:
print("Impossible")
exit()
endSh = i.rfind("#")
print("Possible") | h, w = list(map(int, input().split()))
A = [eval(input()) for _ in range(h)]
sp = 0
for line in A:
if line.find("#") != sp:
print("Impossible")
exit()
sp = line.rfind("#")
print("Possible") | 10 | 10 | 217 | 201 | H, W = list(map(int, input().split()))
S = [eval(input()) for _ in range(H)]
endSh = 0
for i in S:
startSh = i.find("#")
if startSh != endSh:
print("Impossible")
exit()
endSh = i.rfind("#")
print("Possible")
| h, w = list(map(int, input().split()))
A = [eval(input()) for _ in range(h)]
sp = 0
for line in A:
if line.find("#") != sp:
print("Impossible")
exit()
sp = line.rfind("#")
print("Possible")
| false | 0 | [
"-H, W = list(map(int, input().split()))",
"-S = [eval(input()) for _ in range(H)]",
"-endSh = 0",
"-for i in S:",
"- startSh = i.find(\"#\")",
"- if startSh != endSh:",
"+h, w = list(map(int, input().split()))",
"+A = [eval(input()) for _ in range(h)]",
"+sp = 0",
"+for line in A:",
"+ ... | false | 0.043713 | 0.042695 | 1.023827 | [
"s836243733",
"s014679660"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.