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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u394721319 | p03072 | python | s613941562 | s691375108 | 170 | 19 | 38,384 | 2,940 | Accepted | Accepted | 88.82 | N = int(eval(input()))
H = [int(i) for i in input().split()]
ans = 1
p = H[0]
for i in range(1,N):
if p <= H[i]:
ans += 1
p = H[i]
print(ans)
| N = int(eval(input()))
H = [int(i) for i in input().split()]
ans = 1
m = H[0]
for i in range(1,N):
if H[i] >= m:
ans += 1
m = H[i]
print(ans)
| 11 | 12 | 168 | 170 | N = int(eval(input()))
H = [int(i) for i in input().split()]
ans = 1
p = H[0]
for i in range(1, N):
if p <= H[i]:
ans += 1
p = H[i]
print(ans)
| N = int(eval(input()))
H = [int(i) for i in input().split()]
ans = 1
m = H[0]
for i in range(1, N):
if H[i] >= m:
ans += 1
m = H[i]
print(ans)
| false | 8.333333 | [
"-p = H[0]",
"+m = H[0]",
"- if p <= H[i]:",
"+ if H[i] >= m:",
"- p = H[i]",
"+ m = H[i]"
] | false | 0.041831 | 0.037667 | 1.110537 | [
"s613941562",
"s691375108"
] |
u732870425 | p02848 | python | s677792886 | s994130982 | 23 | 21 | 3,060 | 3,060 | Accepted | Accepted | 8.7 | N = int(eval(input()))
S = list(eval(input()))
ans = ""
for a in S:
ans += chr((ord(a) + N - ord("A")) % 26 + ord("A"))
print(ans) | N = int(eval(input()))
S = list(eval(input()))
"""
ans = ""
for a in S:
ans += chr((ord(a) + N - ord("A")) % 26 + ord("A"))
"""
ans = ""
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for a in S:
ans += alpha[(alpha.index(a) + N) % 26]
print(ans) | 8 | 14 | 131 | 247 | N = int(eval(input()))
S = list(eval(input()))
ans = ""
for a in S:
ans += chr((ord(a) + N - ord("A")) % 26 + ord("A"))
print(ans)
| N = int(eval(input()))
S = list(eval(input()))
"""
ans = ""
for a in S:
ans += chr((ord(a) + N - ord("A")) % 26 + ord("A"))
"""
ans = ""
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for a in S:
ans += alpha[(alpha.index(a) + N) % 26]
print(ans)
| false | 42.857143 | [
"+\"\"\"",
"+\"\"\"",
"+ans = \"\"",
"+alpha = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",
"+for a in S:",
"+ ans += alpha[(alpha.index(a) + N) % 26]"
] | false | 0.035599 | 0.066473 | 0.535533 | [
"s677792886",
"s994130982"
] |
u414980766 | p02901 | python | s346752615 | s324708235 | 1,925 | 1,477 | 3,188 | 3,188 | Accepted | Accepted | 23.27 | N, M = list(map(int, input().split()))
INF = 10**7
dp = [INF]*2**N
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c_ls = list(map(int, input().split()))
#d = sum((1<< (i - 1)) for i in map(int, input().split()))
d = 0
for c in c_ls:
d += 2**(c - 1)
... | N, M = list(map(int, input().split()))
INF = 10**7
dp = [INF]*2**N
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
d = sum((1<< (i - 1)) for i in map(int, input().split()))
for j in range(2**N):
if dp[j] == INF:
continue
jord = j | d
... | 21 | 19 | 463 | 416 | N, M = list(map(int, input().split()))
INF = 10**7
dp = [INF] * 2**N
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
c_ls = list(map(int, input().split()))
# d = sum((1<< (i - 1)) for i in map(int, input().split()))
d = 0
for c in c_ls:
d += 2 ** (c - 1)
for j in ran... | N, M = list(map(int, input().split()))
INF = 10**7
dp = [INF] * 2**N
dp[0] = 0
for i in range(M):
a, b = list(map(int, input().split()))
d = sum((1 << (i - 1)) for i in map(int, input().split()))
for j in range(2**N):
if dp[j] == INF:
continue
jord = j | d
dp[jord] = min(... | false | 9.52381 | [
"- c_ls = list(map(int, input().split()))",
"- # d = sum((1<< (i - 1)) for i in map(int, input().split()))",
"- d = 0",
"- for c in c_ls:",
"- d += 2 ** (c - 1)",
"+ d = sum((1 << (i - 1)) for i in map(int, input().split()))",
"+ if dp[j] == INF:",
"+ continue"... | false | 0.036978 | 0.042891 | 0.862135 | [
"s346752615",
"s324708235"
] |
u788068140 | p02948 | python | s746313735 | s887009500 | 437 | 341 | 26,072 | 32,736 | Accepted | Accepted | 21.97 | from heapq import heappush, heappop
n, m = list(map(int, input().split()))
jobs = {}
for _ in range(n):
a, b = list(map(int, input().split()))
if a > m:
continue
if a in jobs:
jobs[a].append(b)
else:
jobs[a] = [b]
result = 0
candidates = []
for a in range(1, m + 1):
if a in jobs:
... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def calculate(N,M,arr):
ret = 0
j = 0
res = []
# 1,2,3,4,5
# ↑
# 4,3,2,1
# M = 4
# range(1,5) => 1,2,3,4
for i in range(1,M+1):
# i = 1,2,3
# 比如M=4的话,第三天(最多1天),... | 22 | 52 | 463 | 911 | from heapq import heappush, heappop
n, m = list(map(int, input().split()))
jobs = {}
for _ in range(n):
a, b = list(map(int, input().split()))
if a > m:
continue
if a in jobs:
jobs[a].append(b)
else:
jobs[a] = [b]
result = 0
candidates = []
for a in range(1, m + 1):
if a in ... | from heapq import heappop, heappush
import sys
input = sys.stdin.readline
def calculate(N, M, arr):
ret = 0
j = 0
res = []
# 1,2,3,4,5
# ↑
# 4,3,2,1
# M = 4
# range(1,5) => 1,2,3,4
for i in range(1, M + 1):
# i = 1,2,3
# 比如M=4的话,第三天(最多1天),第二天(最多2天),第一天(最多3天... | false | 57.692308 | [
"-from heapq import heappush, heappop",
"+from heapq import heappop, heappush",
"+import sys",
"-n, m = list(map(int, input().split()))",
"-jobs = {}",
"-for _ in range(n):",
"- a, b = list(map(int, input().split()))",
"- if a > m:",
"- continue",
"- if a in jobs:",
"- job... | false | 0.07921 | 0.03917 | 2.022195 | [
"s746313735",
"s887009500"
] |
u054514819 | p02661 | python | s274225305 | s801792519 | 543 | 201 | 25,412 | 97,044 | Accepted | Accepted | 62.98 | N = int(eval(input()))
left = []
right = []
for _ in range(N):
l, r = list(map(int, input().split()))
left.append(l)
right.append(r)
left.sort()
right.sort()
if N%2==0:
for i, (l, r) in enumerate(zip(left, right), 1):
if i==N//2:
L = l
R = r
if i==N/... | import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = []
Bs = []
for _ in range(N):
A, B = mapint()
As.append(A)
Bs.append(B)
As.sort()
Bs.sort()
if N%2==1:
left = As[N//... | 22 | 23 | 490 | 431 | N = int(eval(input()))
left = []
right = []
for _ in range(N):
l, r = list(map(int, input().split()))
left.append(l)
right.append(r)
left.sort()
right.sort()
if N % 2 == 0:
for i, (l, r) in enumerate(zip(left, right), 1):
if i == N // 2:
L = l
R = r
if i == N // 2... | import sys
def input():
return sys.stdin.readline().strip()
def mapint():
return list(map(int, input().split()))
sys.setrecursionlimit(10**9)
N = int(eval(input()))
As = []
Bs = []
for _ in range(N):
A, B = mapint()
As.append(A)
Bs.append(B)
As.sort()
Bs.sort()
if N % 2 == 1:
left = As[N /... | false | 4.347826 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+",
"+def mapint():",
"+ return list(map(int, input().split()))",
"+",
"+",
"+sys.setrecursionlimit(10**9)",
"-left = []",
"-right = []",
"+As = []",
"+Bs = []",
"- l, r = list(map(int, ... | false | 0.045017 | 0.042924 | 1.04876 | [
"s274225305",
"s801792519"
] |
u110943895 | p03478 | python | s959858180 | s755441162 | 30 | 27 | 2,940 | 2,940 | Accepted | Accepted | 10 | N, A, B = list(map(int, input().split()))
result = 0
for i in range(N+1):
if A<=sum((list(map(int, str(i)))))<=B:
result += i
print(result) | N, A, B = list(map(int, input().split()))
print((sum(i for i in range(1,N+1) if A<=sum(map(int, str(i)))<=B))) | 6 | 2 | 144 | 103 | N, A, B = list(map(int, input().split()))
result = 0
for i in range(N + 1):
if A <= sum((list(map(int, str(i))))) <= B:
result += i
print(result)
| N, A, B = list(map(int, input().split()))
print((sum(i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B)))
| false | 66.666667 | [
"-result = 0",
"-for i in range(N + 1):",
"- if A <= sum((list(map(int, str(i))))) <= B:",
"- result += i",
"-print(result)",
"+print((sum(i for i in range(1, N + 1) if A <= sum(map(int, str(i))) <= B)))"
] | false | 0.038124 | 0.094045 | 0.40538 | [
"s959858180",
"s755441162"
] |
u860829879 | p02845 | python | s049448188 | s161597135 | 229 | 103 | 53,996 | 87,876 | Accepted | Accepted | 55.02 | n=int(eval(input()))
a=list(map(int,input().split()))
col=[0,0,0]
res=1
for ai in a:
cnt=0
for i in range(3):
if col[i]==ai:
if cnt==0:
col[i]=col[i]+1
cnt+=1
res=(res*cnt)%1000000007
print(res)
| n=int(eval(input()))
*a,=list(map(int,input().split()))
cnt=[0,0,0]
ans=1
mod=10**9+7
for aa in a:
tmp=0
for c in cnt:
if aa==c:
tmp+=1
if tmp>0:
for i in range(3):
if cnt[i]==aa:
cnt[i]+=1
break
ans*=... | 20 | 23 | 303 | 339 | n = int(eval(input()))
a = list(map(int, input().split()))
col = [0, 0, 0]
res = 1
for ai in a:
cnt = 0
for i in range(3):
if col[i] == ai:
if cnt == 0:
col[i] = col[i] + 1
cnt += 1
res = (res * cnt) % 1000000007
print(res)
| n = int(eval(input()))
(*a,) = list(map(int, input().split()))
cnt = [0, 0, 0]
ans = 1
mod = 10**9 + 7
for aa in a:
tmp = 0
for c in cnt:
if aa == c:
tmp += 1
if tmp > 0:
for i in range(3):
if cnt[i] == aa:
cnt[i] += 1
break
ans *= ... | false | 13.043478 | [
"-a = list(map(int, input().split()))",
"-col = [0, 0, 0]",
"-res = 1",
"-for ai in a:",
"- cnt = 0",
"- for i in range(3):",
"- if col[i] == ai:",
"- if cnt == 0:",
"- col[i] = col[i] + 1",
"- cnt += 1",
"- res = (res * cnt) % 1000000007",
... | false | 0.132139 | 0.069853 | 1.891672 | [
"s049448188",
"s161597135"
] |
u525065967 | p02694 | python | s004444156 | s754318675 | 23 | 21 | 9,140 | 9,120 | Accepted | Accepted | 8.7 | x = int(eval(input()))
yen = 100
rate = 101 # 1.01*100
year = 0
while yen < x:
yen *= rate
yen //= 100
year += 1
print(year)
| x = int(eval(input()))
yen, year = 100, 0
while yen < x:
yen += yen//100
year += 1
print(year)
| 9 | 6 | 139 | 102 | x = int(eval(input()))
yen = 100
rate = 101 # 1.01*100
year = 0
while yen < x:
yen *= rate
yen //= 100
year += 1
print(year)
| x = int(eval(input()))
yen, year = 100, 0
while yen < x:
yen += yen // 100
year += 1
print(year)
| false | 33.333333 | [
"-yen = 100",
"-rate = 101 # 1.01*100",
"-year = 0",
"+yen, year = 100, 0",
"- yen *= rate",
"- yen //= 100",
"+ yen += yen // 100"
] | false | 0.072745 | 0.073923 | 0.984068 | [
"s004444156",
"s754318675"
] |
u879870653 | p03151 | python | s106223352 | s940089009 | 505 | 438 | 19,024 | 18,620 | Accepted | Accepted | 13.27 | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B) :
ans = -1
else :
debt = []
deposit = []
for i in range(N) :
if L[i] < 0 :
debt.append(-L[i])
elif L[i] >... | N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B) :
ans = -1
else :
debt = []
deposit = []
for i in range(N) :
if L[i] < 0 :
debt.append(-L[i])
eli... | 64 | 36 | 1,612 | 717 | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B):
ans = -1
else:
debt = []
deposit = []
for i in range(N):
if L[i] < 0:
debt.append(-L[i])
elif L[i] > 0:
d... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
L = [A[i] - B[i] for i in range(N)]
ans = 0
if sum(A) < sum(B):
ans = -1
else:
debt = []
deposit = []
for i in range(N):
if L[i] < 0:
debt.append(-L[i])
elif L[i] > 0:
d... | false | 43.75 | [
"- debt = sorted(debt)",
"- debt_duplicated = debt.copy()",
"- deposit_duplicated = deposit.copy()",
"- deposit_trash = []",
"- # print(debt)",
"- # print(deposit)",
"- for i in range(len(debt)):",
"- while True:",
"- if debt[i] == 0:",
"- brea... | false | 0.036441 | 0.036695 | 0.993082 | [
"s106223352",
"s940089009"
] |
u074220993 | p03805 | python | s820029550 | s002111697 | 42 | 35 | 9,096 | 9,156 | Accepted | Accepted | 16.67 | def dfs(parent, connect, passed, N):
cnt = 0
passed.append(parent)
if len(passed) == N:
cnt = 1
for next_ in connect[parent]:
if next_ in passed:
continue
cnt += dfs(next_, connect, passed, N)
passed.pop()
return cnt
N, M = list(map(int, input... | def dfs(parent, connect, passed, N): #深さ優先探索
cnt = 0
passed.append(parent) #通った点をメモ
if len(passed) == N: #全ての点を通過したかの判定
cnt = 1
for next_ in connect[parent]:
if next_ in passed:
continue
cnt += dfs(next_, connect, passed, N) #全ての点を通るまで再帰. 戻り値の和で何通りかカウント
p... | 20 | 20 | 520 | 610 | def dfs(parent, connect, passed, N):
cnt = 0
passed.append(parent)
if len(passed) == N:
cnt = 1
for next_ in connect[parent]:
if next_ in passed:
continue
cnt += dfs(next_, connect, passed, N)
passed.pop()
return cnt
N, M = list(map(int, input().split()))
co... | def dfs(parent, connect, passed, N): # 深さ優先探索
cnt = 0
passed.append(parent) # 通った点をメモ
if len(passed) == N: # 全ての点を通過したかの判定
cnt = 1
for next_ in connect[parent]:
if next_ in passed:
continue
cnt += dfs(next_, connect, passed, N) # 全ての点を通るまで再帰. 戻り値の和で何通りかカウント
pa... | false | 0 | [
"-def dfs(parent, connect, passed, N):",
"+def dfs(parent, connect, passed, N): # 深さ優先探索",
"- passed.append(parent)",
"- if len(passed) == N:",
"+ passed.append(parent) # 通った点をメモ",
"+ if len(passed) == N: # 全ての点を通過したかの判定",
"- cnt += dfs(next_, connect, passed, N)",
"- passed.p... | false | 0.137706 | 0.049168 | 2.800736 | [
"s820029550",
"s002111697"
] |
u047796752 | p02821 | python | s010746568 | s499025953 | 1,655 | 1,007 | 58,204 | 54,432 | Accepted | Accepted | 39.15 | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
cnt = 0
for i in range(N):
idx = bisect_left(A, x-A[i])
cnt += N-idx
return cnt>=M
def binary_search():
l, r = 0, 10**11
while l<=r:
mid = (l+r)//2
... | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
cnt = 0
for Ai in A:
cnt += N-bisect_left(A, x-Ai+1)
return cnt<M
def binary_search():
l, r = 0, 2*max(A)
while l<=r:
m = (l+r)//2
if judge(m):
r ... | 46 | 44 | 762 | 722 | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
cnt = 0
for i in range(N):
idx = bisect_left(A, x - A[i])
cnt += N - idx
return cnt >= M
def binary_search():
l, r = 0, 10**11
while l <= r:
mid = (l + r) // 2
if judge(mid):
l =... | import sys
input = sys.stdin.readline
from bisect import *
def judge(x):
cnt = 0
for Ai in A:
cnt += N - bisect_left(A, x - Ai + 1)
return cnt < M
def binary_search():
l, r = 0, 2 * max(A)
while l <= r:
m = (l + r) // 2
if judge(m):
r = m - 1
else:
... | false | 4.347826 | [
"- for i in range(N):",
"- idx = bisect_left(A, x - A[i])",
"- cnt += N - idx",
"- return cnt >= M",
"+ for Ai in A:",
"+ cnt += N - bisect_left(A, x - Ai + 1)",
"+ return cnt < M",
"- l, r = 0, 10**11",
"+ l, r = 0, 2 * max(A)",
"- mid = (l + r) // 2"... | false | 0.042161 | 0.042136 | 1.000587 | [
"s010746568",
"s499025953"
] |
u446371873 | p02572 | python | s315153623 | s066861096 | 234 | 131 | 31,628 | 31,532 | Accepted | Accepted | 44.02 | N = int(eval(input()))
MOD = 1000000007
A = list(map(int,input().split()))
cum = [0]*(N+1)
for i in range(N):
cum[i+1] = cum[i] + A[i]
cum[i+1] %= MOD
ans = 0
for i in range(N-1):
ans += A[i] * (cum[N] - cum[i+1])
ans %= MOD
print(ans) | N = int(eval(input()))
A = list(map(int,input().split()))
S = 0
S2 = 0
MOD = 1000000007
for i in range(N):
S += A[i]
S2 += A[i]*A[i]
print(((S*S-S2)//2%MOD)) | 15 | 9 | 263 | 161 | N = int(eval(input()))
MOD = 1000000007
A = list(map(int, input().split()))
cum = [0] * (N + 1)
for i in range(N):
cum[i + 1] = cum[i] + A[i]
cum[i + 1] %= MOD
ans = 0
for i in range(N - 1):
ans += A[i] * (cum[N] - cum[i + 1])
ans %= MOD
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
S = 0
S2 = 0
MOD = 1000000007
for i in range(N):
S += A[i]
S2 += A[i] * A[i]
print(((S * S - S2) // 2 % MOD))
| false | 40 | [
"+A = list(map(int, input().split()))",
"+S = 0",
"+S2 = 0",
"-A = list(map(int, input().split()))",
"-cum = [0] * (N + 1)",
"- cum[i + 1] = cum[i] + A[i]",
"- cum[i + 1] %= MOD",
"-ans = 0",
"-for i in range(N - 1):",
"- ans += A[i] * (cum[N] - cum[i + 1])",
"- ans %= MOD",
"-prin... | false | 0.039482 | 0.047414 | 0.832721 | [
"s315153623",
"s066861096"
] |
u970197315 | p02585 | python | s638889220 | s750168452 | 391 | 361 | 74,412 | 74,320 | Accepted | Accepted | 7.67 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -10**18
for i in range(n):
tmp_score = 0
pos = i
# cycle = 0
for l in range(k):
pos = p[pos]-1
tmp_score += c[pos]
ans = max(ans,tmp_score)
... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -10**18
for i in range(n):
tmp_score = 0
pos = i
cycle = 0
for l in range(k):
pos = p[pos]-1
tmp_score += c[pos]
ans = max(ans,tmp_score)
c... | 27 | 27 | 621 | 621 | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -(10**18)
for i in range(n):
tmp_score = 0
pos = i
# cycle = 0
for l in range(k):
pos = p[pos] - 1
tmp_score += c[pos]
ans = max(ans, tmp_score)
# cycle +=... | n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = -(10**18)
for i in range(n):
tmp_score = 0
pos = i
cycle = 0
for l in range(k):
pos = p[pos] - 1
tmp_score += c[pos]
ans = max(ans, tmp_score)
cycle += 1
... | false | 0 | [
"- # cycle = 0",
"+ cycle = 0",
"- # cycle += 1",
"+ cycle += 1",
"- q, r = divmod(k, l + 1)",
"+ q, r = divmod(k, cycle)",
"- r = l + 1",
"+ r = cycle"
] | false | 0.046274 | 0.060579 | 0.763856 | [
"s638889220",
"s750168452"
] |
u481250941 | p02695 | python | s044718372 | s353698144 | 617 | 374 | 23,536 | 23,536 | Accepted | Accepted | 39.38 | #
# abc165 c
#
from itertools import combinations_with_replacement as cwr
import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100000)
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin... | #
# abc165 c
#
import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100000)
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
s... | 82 | 81 | 1,710 | 1,630 | #
# abc165 c
#
from itertools import combinations_with_replacement as cwr
import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100000)
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(... | #
# abc165 c
#
import sys
from io import StringIO
import unittest
sys.setrecursionlimit(100000)
class TestClass(unittest.TestCase):
def assertIO(self, input, output):
stdout, stdin = sys.stdout, sys.stdin
sys.stdout, sys.stdin = StringIO(), StringIO(input)
resolve()
sys.stdout.see... | false | 1.219512 | [
"-from itertools import combinations_with_replacement as cwr",
"- for t in cwr(list(range(1, M + 1)), N):",
"+ for t in T:"
] | false | 0.340735 | 0.154506 | 2.205317 | [
"s044718372",
"s353698144"
] |
u634046173 | p02706 | python | s866050896 | s355862288 | 25 | 22 | 9,812 | 9,868 | Accepted | Accepted | 12 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
d = sum(A)
if N < d:
print((-1))
else:
print((N-d)) | N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
d = sum(As)
if N < d:
print((-1))
else:
print((N-d))
| 9 | 7 | 130 | 133 | N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
d = sum(A)
if N < d:
print((-1))
else:
print((N - d))
| N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
d = sum(As)
if N < d:
print((-1))
else:
print((N - d))
| false | 22.222222 | [
"-A = list(map(int, input().split()))",
"-d = sum(A)",
"+As = list(map(int, input().split()))",
"+d = sum(As)"
] | false | 0.088022 | 0.047068 | 1.870126 | [
"s866050896",
"s355862288"
] |
u562935282 | p03073 | python | s977244611 | s217383828 | 52 | 19 | 3,188 | 3,572 | Accepted | Accepted | 63.46 | s = eval(input())
ans = float('inf')
for init in '01':
t = 0
x = init
for ss in s:
# print(ss, x)
if ss != x:
t += 1
if x == '0':
x = '1'
else:
x = '0'
ans = min(ans, t)
print(ans)
| s = eval(input())
N = len(s)
t_01 = '01' * (N // 2) + ('0' if N % 2 == 1 else '')
t_10 = '10' * (N // 2) + ('1' if N % 2 == 1 else '')
# print(s)
# print(t_01)
# print(t_10)
s_n = int(s, 2)
t_01_n = int(t_01, 2)
t_10_n = int(t_10, 2)
# print(s_n)
# print(t_01_n)
# print(t_10_n)
ans = N
for x in s_... | 16 | 23 | 275 | 399 | s = eval(input())
ans = float("inf")
for init in "01":
t = 0
x = init
for ss in s:
# print(ss, x)
if ss != x:
t += 1
if x == "0":
x = "1"
else:
x = "0"
ans = min(ans, t)
print(ans)
| s = eval(input())
N = len(s)
t_01 = "01" * (N // 2) + ("0" if N % 2 == 1 else "")
t_10 = "10" * (N // 2) + ("1" if N % 2 == 1 else "")
# print(s)
# print(t_01)
# print(t_10)
s_n = int(s, 2)
t_01_n = int(t_01, 2)
t_10_n = int(t_10, 2)
# print(s_n)
# print(t_01_n)
# print(t_10_n)
ans = N
for x in s_n ^ t_01_n, s_n ^ t_10... | false | 30.434783 | [
"-ans = float(\"inf\")",
"-for init in \"01\":",
"- t = 0",
"- x = init",
"- for ss in s:",
"- # print(ss, x)",
"- if ss != x:",
"- t += 1",
"- if x == \"0\":",
"- x = \"1\"",
"- else:",
"- x = \"0\"",
"- ans = min(ans,... | false | 0.036468 | 0.037709 | 0.967096 | [
"s977244611",
"s217383828"
] |
u701644092 | p02819 | python | s977364849 | s503395171 | 51 | 18 | 3,828 | 3,060 | Accepted | Accepted | 64.71 | X = int(eval(input()))
fact = [True] * (10 ** 5 + 1000)
fact[0],fact[1] = False,False
for i in range(2,len(fact)):
if fact[i]:
for j in range(i * 2, len(fact), i):
fact[j] = False
for i in range(X,len(fact)):
if fact[i]:
print(i)
break | X = int(eval(input()))
def checkfact(x):
for i in range(2,int(x ** 0.5) + 1):
if x % i == 0:
return False
return True
while True:
if checkfact(X):
print(X)
break
X += 1 | 13 | 13 | 271 | 202 | X = int(eval(input()))
fact = [True] * (10**5 + 1000)
fact[0], fact[1] = False, False
for i in range(2, len(fact)):
if fact[i]:
for j in range(i * 2, len(fact), i):
fact[j] = False
for i in range(X, len(fact)):
if fact[i]:
print(i)
break
| X = int(eval(input()))
def checkfact(x):
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
return False
return True
while True:
if checkfact(X):
print(X)
break
X += 1
| false | 0 | [
"-fact = [True] * (10**5 + 1000)",
"-fact[0], fact[1] = False, False",
"-for i in range(2, len(fact)):",
"- if fact[i]:",
"- for j in range(i * 2, len(fact), i):",
"- fact[j] = False",
"-for i in range(X, len(fact)):",
"- if fact[i]:",
"- print(i)",
"+",
"+",
"+d... | false | 0.293023 | 0.077912 | 3.760949 | [
"s977364849",
"s503395171"
] |
u764215612 | p02690 | python | s471661437 | s888382608 | 34 | 27 | 9,040 | 9,052 | Accepted | Accepted | 20.59 | x = int(eval(input()))
for i in range(120):
for j in range(-119,129):
if i**5 - j**5 == x:
print((i, j))
exit() | x = int(eval(input()))
for i in range(120):
for j in range(-119, i):
if i**5 - j**5 == x:
print((i, j))
exit() | 6 | 6 | 126 | 125 | x = int(eval(input()))
for i in range(120):
for j in range(-119, 129):
if i**5 - j**5 == x:
print((i, j))
exit()
| x = int(eval(input()))
for i in range(120):
for j in range(-119, i):
if i**5 - j**5 == x:
print((i, j))
exit()
| false | 0 | [
"- for j in range(-119, 129):",
"+ for j in range(-119, i):"
] | false | 0.036603 | 0.033992 | 1.076819 | [
"s471661437",
"s888382608"
] |
u923279197 | p02918 | python | s517430506 | s651198917 | 198 | 177 | 39,792 | 39,408 | Accepted | Accepted | 10.61 | n,k = list(map(int,input().split()))
s = eval(input())
if len(s) == 1:
print((0))
exit()
ans = 0
c = 0
for i in range(1,n):
if s[i] == s[i-1]:
ans += 1
else:
c += 1
if c == 1:
print((n-1))
exit()
t = -1
left = s[0]
q = -1
for i in range(1,n):
if s[i... | n,k = list(map(int,input().split()))
s = eval(input())
ans = 0
for i in range(1,n):
if s[i] == s[i-1]:
ans += 1
print((min(ans + 2*k,n-1))) | 34 | 8 | 478 | 145 | n, k = list(map(int, input().split()))
s = eval(input())
if len(s) == 1:
print((0))
exit()
ans = 0
c = 0
for i in range(1, n):
if s[i] == s[i - 1]:
ans += 1
else:
c += 1
if c == 1:
print((n - 1))
exit()
t = -1
left = s[0]
q = -1
for i in range(1, n):
if s[i] != left:
... | n, k = list(map(int, input().split()))
s = eval(input())
ans = 0
for i in range(1, n):
if s[i] == s[i - 1]:
ans += 1
print((min(ans + 2 * k, n - 1)))
| false | 76.470588 | [
"-if len(s) == 1:",
"- print((0))",
"- exit()",
"-c = 0",
"- else:",
"- c += 1",
"-if c == 1:",
"- print((n - 1))",
"- exit()",
"-t = -1",
"-left = s[0]",
"-q = -1",
"-for i in range(1, n):",
"- if s[i] != left:",
"- t += 1",
"- left = s[i]",
"-... | false | 0.111975 | 0.111976 | 0.999996 | [
"s517430506",
"s651198917"
] |
u669360983 | p02390 | python | s880377299 | s075920501 | 30 | 20 | 6,736 | 4,192 | Accepted | Accepted | 33.33 | s=int(eval(input()))
h=int(s/3600)
m=int(s/60-60*h)
s=int(s-3600*h-60*m)
h,m,s=list(map(str,(h,m,s)))
print((h+':'+m+':'+s)) | s=int(input())
h=s/3600
m=(s-3600*h)/60
print("%d:%d:%d"%(h,m,s-3600*h-60*m)) | 6 | 4 | 115 | 83 | s = int(eval(input()))
h = int(s / 3600)
m = int(s / 60 - 60 * h)
s = int(s - 3600 * h - 60 * m)
h, m, s = list(map(str, (h, m, s)))
print((h + ":" + m + ":" + s))
| s = int(input())
h = s / 3600
m = (s - 3600 * h) / 60
print("%d:%d:%d" % (h, m, s - 3600 * h - 60 * m))
| false | 33.333333 | [
"-s = int(eval(input()))",
"-h = int(s / 3600)",
"-m = int(s / 60 - 60 * h)",
"-s = int(s - 3600 * h - 60 * m)",
"-h, m, s = list(map(str, (h, m, s)))",
"-print((h + \":\" + m + \":\" + s))",
"+s = int(input())",
"+h = s / 3600",
"+m = (s - 3600 * h) / 60",
"+print(\"%d:%d:%d\" % (h, m, s - 3600 *... | false | 0.068457 | 0.066903 | 1.023223 | [
"s880377299",
"s075920501"
] |
u241190159 | p02996 | python | s196809254 | s649906611 | 648 | 476 | 28,764 | 29,468 | Accepted | Accepted | 26.54 | # import bisect
import heapq
# import math
# import queue
import sys
def main():
# 読み込み回数が多い場合
input = sys.stdin.readline
N = int(eval(input()))
# heap queue
h = []
for i in range(N):
A, B = list(map(int, input().split()))
heapq.heappush(h, (B, A))
... | # import bisect
# import heapq
# import math
# import queue
import sys
def main():
# 読み込み回数が多い場合
input = sys.stdin.readline
N = int(eval(input()))
# heap queue
h = []
for i in range(N):
A, B = list(map(int, input().split()))
h.append((B, A))
h.sort()
... | 31 | 31 | 530 | 501 | # import bisect
import heapq
# import math
# import queue
import sys
def main():
# 読み込み回数が多い場合
input = sys.stdin.readline
N = int(eval(input()))
# heap queue
h = []
for i in range(N):
A, B = list(map(int, input().split()))
heapq.heappush(h, (B, A))
time = 0
while len(h... | # import bisect
# import heapq
# import math
# import queue
import sys
def main():
# 読み込み回数が多い場合
input = sys.stdin.readline
N = int(eval(input()))
# heap queue
h = []
for i in range(N):
A, B = list(map(int, input().split()))
h.append((B, A))
h.sort()
time = 0
for B,... | false | 0 | [
"-import heapq",
"-",
"+# import heapq",
"- heapq.heappush(h, (B, A))",
"+ h.append((B, A))",
"+ h.sort()",
"- while len(h) > 0:",
"- B, A = heapq.heappop(h)",
"+ for B, A in h:"
] | false | 0.084069 | 0.063758 | 1.318568 | [
"s196809254",
"s649906611"
] |
u512007680 | p03295 | python | s140133093 | s872093979 | 458 | 381 | 22,108 | 20,388 | Accepted | Accepted | 16.81 | N,M = list(map(int,input().split()))
info = []
for i in range(M):
a,b = list(map(int,input().split()))
info.append([a,b])
info = sorted(info,key = lambda x:x[1])
ok = 0
count = 0
for i in range(M):
if info[i][0] > ok:
count += 1
ok = info[i][1] - 1
print(count) | N,M = list(map(int,input().split()))
info = []
maxa = [0] * (N+1)
for i in range(M):
a,b = list(map(int,input().split()))
info.append([a,b])
if maxa[b] < a:
maxa[b] = a
ok = 0
count = 0
for j in range(1,N+1):
if ok < maxa[j]:
count += 1
ok = j-1
print(count... | 18 | 19 | 299 | 309 | N, M = list(map(int, input().split()))
info = []
for i in range(M):
a, b = list(map(int, input().split()))
info.append([a, b])
info = sorted(info, key=lambda x: x[1])
ok = 0
count = 0
for i in range(M):
if info[i][0] > ok:
count += 1
ok = info[i][1] - 1
print(count)
| N, M = list(map(int, input().split()))
info = []
maxa = [0] * (N + 1)
for i in range(M):
a, b = list(map(int, input().split()))
info.append([a, b])
if maxa[b] < a:
maxa[b] = a
ok = 0
count = 0
for j in range(1, N + 1):
if ok < maxa[j]:
count += 1
ok = j - 1
print(count)
| false | 5.263158 | [
"+maxa = [0] * (N + 1)",
"-info = sorted(info, key=lambda x: x[1])",
"+ if maxa[b] < a:",
"+ maxa[b] = a",
"-for i in range(M):",
"- if info[i][0] > ok:",
"+for j in range(1, N + 1):",
"+ if ok < maxa[j]:",
"- ok = info[i][1] - 1",
"+ ok = j - 1"
] | false | 0.036869 | 0.037113 | 0.99344 | [
"s140133093",
"s872093979"
] |
u652057333 | p03805 | python | s126767887 | s303956188 | 179 | 31 | 40,048 | 3,572 | Accepted | Accepted | 82.68 | from collections import defaultdict
import itertools
n, m = list(map(int, input().split()))
connected_dict = defaultdict(lambda: [])
for i in range(m):
a, b = list(map(int, input().split()))
connected_dict[a].append(b)
connected_dict[b].append(a)
count = 0
for permutation in list(itertools.pe... | # One-stroke Path
import itertools
n, m = list(map(int, input().split()))
ab = {}
for i in range(n+1):
ab[i] = []
for i in range(m):
a, b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
count = 0
for values in list(itertools.permutations(list(range(2, n+1)))):
pre =... | 23 | 22 | 565 | 467 | from collections import defaultdict
import itertools
n, m = list(map(int, input().split()))
connected_dict = defaultdict(lambda: [])
for i in range(m):
a, b = list(map(int, input().split()))
connected_dict[a].append(b)
connected_dict[b].append(a)
count = 0
for permutation in list(itertools.permutations(lis... | # One-stroke Path
import itertools
n, m = list(map(int, input().split()))
ab = {}
for i in range(n + 1):
ab[i] = []
for i in range(m):
a, b = list(map(int, input().split()))
ab[a].append(b)
ab[b].append(a)
count = 0
for values in list(itertools.permutations(list(range(2, n + 1)))):
pre = 1
for ... | false | 4.347826 | [
"-from collections import defaultdict",
"+# One-stroke Path",
"-connected_dict = defaultdict(lambda: [])",
"+ab = {}",
"+for i in range(n + 1):",
"+ ab[i] = []",
"- connected_dict[a].append(b)",
"- connected_dict[b].append(a)",
"+ ab[a].append(b)",
"+ ab[b].append(a)",
"-for permu... | false | 0.03941 | 0.068739 | 0.573336 | [
"s126767887",
"s303956188"
] |
u912237403 | p00008 | python | s322132670 | s853831170 | 30 | 20 | 4,212 | 4,204 | Accepted | Accepted | 33.33 | import sys
def f(a,b):
c=b*9-9
A=list(range(10))
if b==1:x=1 if a in A else 0
else:x=sum([f(a-e,b-1)for e in A if 0<=a-e<=c])
return x
for n in map(int,sys.stdin):print(f(n,4)) | import sys
def f(a,b,c):
if b==1:x=1 if 0<=a<=9 else 0
else:x=sum([f(a-e,b-1,c-9)for e in range(10) if 0<=a-e<=c])
return x
for n in map(int,sys.stdin):print(f(n,4,3*9)) | 8 | 6 | 186 | 179 | import sys
def f(a, b):
c = b * 9 - 9
A = list(range(10))
if b == 1:
x = 1 if a in A else 0
else:
x = sum([f(a - e, b - 1) for e in A if 0 <= a - e <= c])
return x
for n in map(int, sys.stdin):
print(f(n, 4))
| import sys
def f(a, b, c):
if b == 1:
x = 1 if 0 <= a <= 9 else 0
else:
x = sum([f(a - e, b - 1, c - 9) for e in range(10) if 0 <= a - e <= c])
return x
for n in map(int, sys.stdin):
print(f(n, 4, 3 * 9))
| false | 25 | [
"-def f(a, b):",
"- c = b * 9 - 9",
"- A = list(range(10))",
"+def f(a, b, c):",
"- x = 1 if a in A else 0",
"+ x = 1 if 0 <= a <= 9 else 0",
"- x = sum([f(a - e, b - 1) for e in A if 0 <= a - e <= c])",
"+ x = sum([f(a - e, b - 1, c - 9) for e in range(10) if 0 <= a ... | false | 0.054837 | 0.049959 | 1.097641 | [
"s322132670",
"s853831170"
] |
u636845339 | p02578 | python | s820848553 | s754561965 | 169 | 102 | 32,124 | 32,176 | Accepted | Accepted | 39.64 | n=int(eval(input()))
A = list(map(int, input().split()))
l = [0] * len(A)
ans=0
for i in range(n-1):
if A[i]>=A[i+1]:
l[i+1]=A[i]-A[i+1]
A[i+1]=A[i]
else:
l[i+1]=0
ans=ans+l[i+1]
print(ans)
| n=int(eval(input()))
A = list(map(int, input().split()))
l = [0] * len(A)
ans=0
m=A[0]
for i in A:
if m>i:
ans = ans +(m-i)
else:
m=i
print(ans)
| 15 | 16 | 223 | 177 | n = int(eval(input()))
A = list(map(int, input().split()))
l = [0] * len(A)
ans = 0
for i in range(n - 1):
if A[i] >= A[i + 1]:
l[i + 1] = A[i] - A[i + 1]
A[i + 1] = A[i]
else:
l[i + 1] = 0
ans = ans + l[i + 1]
print(ans)
| n = int(eval(input()))
A = list(map(int, input().split()))
l = [0] * len(A)
ans = 0
m = A[0]
for i in A:
if m > i:
ans = ans + (m - i)
else:
m = i
print(ans)
| false | 6.25 | [
"-for i in range(n - 1):",
"- if A[i] >= A[i + 1]:",
"- l[i + 1] = A[i] - A[i + 1]",
"- A[i + 1] = A[i]",
"+m = A[0]",
"+for i in A:",
"+ if m > i:",
"+ ans = ans + (m - i)",
"- l[i + 1] = 0",
"- ans = ans + l[i + 1]",
"+ m = i"
] | false | 0.041287 | 0.036036 | 1.145727 | [
"s820848553",
"s754561965"
] |
u350064373 | p00064 | python | s347126016 | s300037302 | 30 | 20 | 7,832 | 7,832 | Accepted | Accepted | 33.33 | import re
try:
ls = []
result = 0
while True:
ls.append(eval(input()))
except:
for i in ls:
for s in re.findall(r'\d+', i):
result += int(s)
print(result) | import re
try:
ls = []
while True:
ls.append(eval(input()))
except:
result = 0
for i in ls:
for s in re.findall(r'\d+', i):
result += int(s)
print(result) | 11 | 11 | 206 | 206 | import re
try:
ls = []
result = 0
while True:
ls.append(eval(input()))
except:
for i in ls:
for s in re.findall(r"\d+", i):
result += int(s)
print(result)
| import re
try:
ls = []
while True:
ls.append(eval(input()))
except:
result = 0
for i in ls:
for s in re.findall(r"\d+", i):
result += int(s)
print(result)
| false | 0 | [
"- result = 0",
"+ result = 0"
] | false | 0.048863 | 0.048641 | 1.00456 | [
"s347126016",
"s300037302"
] |
u472065247 | p03244 | python | s563619049 | s578872502 | 100 | 88 | 19,040 | 20,524 | Accepted | Accepted | 12 | from collections import Counter
n=int(eval(input()))
l = list(map(int, input().split()))
l0 = l[::2]
l1 = l[1::2]
c0 = Counter(l0)
c1 = Counter(l1)
ll0 = len(l0)
ll1 = len(l1)
c0m = c0.most_common()[:2] + [(0, 0)]
c1m = c1.most_common()[:2] + [(0, 0)]
if c0m[0][0] != c1m[0][0]:
print((ll0 - c0m[0]... | from collections import Counter
n,*l = list(map(int, open(0).read().split()))
c0 = Counter(l[::2]).most_common() + [(0, 0)]
c1 = Counter(l[1::2]).most_common() + [(0, 0)]
if c0[0][0] != c1[0][0]:
print((n - c0[0][1] - c1[0][1]))
else:
print((n - max(c0[1][1] + c1[0][1], c0[0][1] + c1[1][1]))) | 19 | 11 | 426 | 300 | from collections import Counter
n = int(eval(input()))
l = list(map(int, input().split()))
l0 = l[::2]
l1 = l[1::2]
c0 = Counter(l0)
c1 = Counter(l1)
ll0 = len(l0)
ll1 = len(l1)
c0m = c0.most_common()[:2] + [(0, 0)]
c1m = c1.most_common()[:2] + [(0, 0)]
if c0m[0][0] != c1m[0][0]:
print((ll0 - c0m[0][1] + ll1 - c1m... | from collections import Counter
n, *l = list(map(int, open(0).read().split()))
c0 = Counter(l[::2]).most_common() + [(0, 0)]
c1 = Counter(l[1::2]).most_common() + [(0, 0)]
if c0[0][0] != c1[0][0]:
print((n - c0[0][1] - c1[0][1]))
else:
print((n - max(c0[1][1] + c1[0][1], c0[0][1] + c1[1][1])))
| false | 42.105263 | [
"-n = int(eval(input()))",
"-l = list(map(int, input().split()))",
"-l0 = l[::2]",
"-l1 = l[1::2]",
"-c0 = Counter(l0)",
"-c1 = Counter(l1)",
"-ll0 = len(l0)",
"-ll1 = len(l1)",
"-c0m = c0.most_common()[:2] + [(0, 0)]",
"-c1m = c1.most_common()[:2] + [(0, 0)]",
"-if c0m[0][0] != c1m[0][0]:",
"... | false | 0.048761 | 0.150948 | 0.323035 | [
"s563619049",
"s578872502"
] |
u073852194 | p03714 | python | s807743741 | s645115350 | 1,033 | 689 | 122,256 | 122,512 | Accepted | Accepted | 33.3 | import heapq
class Heapq:
def __init__(self, arr, desc=False):
if desc:
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self):
return heapq.heappop(self.hq) * self.sign
def push(self, a):
... | from heapq import heappop, heappush, heapify
N = int(eval(input()))
A = list(map(int, input().split()))
L = A[:N]
heapify(L)
sumL = [sum(A[:N])]
for i in range(N):
x = heappop(L)
if x < A[N + i]:
sumL.append(sumL[-1] - x + A[N + i])
heappush(L, A[N + i])
else:
sumL.... | 46 | 37 | 959 | 768 | import heapq
class Heapq:
def __init__(self, arr, desc=False):
if desc:
arr = [-a for a in arr]
self.sign = -1 if desc else 1
self.hq = arr
heapq.heapify(self.hq)
def pop(self):
return heapq.heappop(self.hq) * self.sign
def push(self, a):
heapq... | from heapq import heappop, heappush, heapify
N = int(eval(input()))
A = list(map(int, input().split()))
L = A[:N]
heapify(L)
sumL = [sum(A[:N])]
for i in range(N):
x = heappop(L)
if x < A[N + i]:
sumL.append(sumL[-1] - x + A[N + i])
heappush(L, A[N + i])
else:
sumL.append(sumL[-1])
... | false | 19.565217 | [
"-import heapq",
"+from heapq import heappop, heappush, heapify",
"-",
"-class Heapq:",
"- def __init__(self, arr, desc=False):",
"- if desc:",
"- arr = [-a for a in arr]",
"- self.sign = -1 if desc else 1",
"- self.hq = arr",
"- heapq.heapify(self.hq)",
... | false | 0.067814 | 0.060549 | 1.119983 | [
"s807743741",
"s645115350"
] |
u802963389 | p03241 | python | s928395238 | s424887679 | 25 | 20 | 3,060 | 3,188 | Accepted | Accepted | 20 | N,M = list(map(int, input().split()))
li = []
for i in range(1, M + 1):
if i * i > M:
break
if M % i == 0:
li.append(i)
li.append(M // i)
ans = 1
li.sort(reverse=True)
for i in li:
if N * i <= M:
ans = i
break
print(ans)
| # D. Partition
# https://atcoder.jp/contests/abc112/tasks/abc112_d
# 約数列挙
def make_divisors(n):
lower_divisors = []
upper_divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.appen... | 20 | 25 | 291 | 550 | N, M = list(map(int, input().split()))
li = []
for i in range(1, M + 1):
if i * i > M:
break
if M % i == 0:
li.append(i)
li.append(M // i)
ans = 1
li.sort(reverse=True)
for i in li:
if N * i <= M:
ans = i
break
print(ans)
| # D. Partition
# https://atcoder.jp/contests/abc112/tasks/abc112_d
# 約数列挙
def make_divisors(n):
lower_divisors = []
upper_divisors = []
for i in range(1, int(n**0.5) + 1):
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
... | false | 20 | [
"-N, M = list(map(int, input().split()))",
"-li = []",
"-for i in range(1, M + 1):",
"- if i * i > M:",
"- break",
"- if M % i == 0:",
"- li.append(i)",
"- li.append(M // i)",
"-ans = 1",
"-li.sort(reverse=True)",
"-for i in li:",
"- if N * i <= M:",
"- a... | false | 0.042448 | 0.038991 | 1.088675 | [
"s928395238",
"s424887679"
] |
u664373116 | p02820 | python | s352511232 | s538474787 | 876 | 99 | 3,636 | 3,444 | Accepted | Accepted | 88.7 | n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=eval(input())
vic=""
ans=0
for i in t:
if i=="r":
vic+="p"
if i=="p":
vic+="s"
if i=="s":
vic+="r"
#print(vic[:k])
for i in vic[:k]:
if i=="r":
ans+=r
elif i=="p":
ans+=... | def sol(score,hand):
if hand=="r":
return score["p"]
elif hand=="p":
return score["s"]
elif hand=="s":
return score["r"]
return 0
n,k=list(map(int,input().split()))
r,s,p=list(map(int,input().split()))
t=eval(input())
win=""
for num,val in enumerate(t):
if num<k ... | 43 | 23 | 807 | 459 | n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
vic = ""
ans = 0
for i in t:
if i == "r":
vic += "p"
if i == "p":
vic += "s"
if i == "s":
vic += "r"
# print(vic[:k])
for i in vic[:k]:
if i == "r":
ans += r
elif i == "... | def sol(score, hand):
if hand == "r":
return score["p"]
elif hand == "p":
return score["s"]
elif hand == "s":
return score["r"]
return 0
n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = eval(input())
win = ""
for num, val in enumerate(t):
... | false | 46.511628 | [
"+def sol(score, hand):",
"+ if hand == \"r\":",
"+ return score[\"p\"]",
"+ elif hand == \"p\":",
"+ return score[\"s\"]",
"+ elif hand == \"s\":",
"+ return score[\"r\"]",
"+ return 0",
"+",
"+",
"-vic = \"\"",
"+win = \"\"",
"+for num, val in enumerate(t):... | false | 0.045096 | 0.037954 | 1.18818 | [
"s352511232",
"s538474787"
] |
u810735437 | p02789 | python | s931155289 | s579719384 | 86 | 17 | 8,008 | 2,940 | Accepted | Accepted | 80.23 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys
N, M = list(map(int, input().split()))
if N == M:
print("Yes")
else:
... | n, m = list(map(int, input().split()))
if n == m:
print ('Yes')
else:
print ('No') | 21 | 5 | 328 | 84 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys
N, M = list(map(int, input().split()))
if N == M:
print("Yes")
else:
print("No")
| n, m = list(map(int, input().split()))
if n == m:
print("Yes")
else:
print("No")
| false | 76.190476 | [
"-#!/usr/bin/env python3",
"-# -*- coding: utf-8 -*-",
"-import array",
"-from bisect import *",
"-from collections import *",
"-import fractions",
"-import heapq",
"-from itertools import *",
"-import math",
"-import random",
"-import re",
"-import string",
"-import sys",
"-",
"-N, M = ... | false | 0.040011 | 0.040312 | 0.992549 | [
"s931155289",
"s579719384"
] |
u254871849 | p04031 | python | s540408192 | s066143347 | 150 | 20 | 12,480 | 2,940 | Accepted | Accepted | 86.67 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
a = I[1:]
def main():
m = int(np.around(np.mean(a)))
ans = np.sum((a - m) ** 2)
return ans
if __name__ == '__main__':
ans = main()
print(ans) | import sys
n, *a = list(map(int, sys.stdin.read().split()))
def main():
x = round(sum(a) / n)
s = 0
for i in range(n):
s += pow(x - a[i], 2)
print(s)
if __name__ == '__main__':
main() | 14 | 13 | 262 | 208 | import sys
import numpy as np
I = np.array(sys.stdin.read().split(), dtype=np.int64)
a = I[1:]
def main():
m = int(np.around(np.mean(a)))
ans = np.sum((a - m) ** 2)
return ans
if __name__ == "__main__":
ans = main()
print(ans)
| import sys
n, *a = list(map(int, sys.stdin.read().split()))
def main():
x = round(sum(a) / n)
s = 0
for i in range(n):
s += pow(x - a[i], 2)
print(s)
if __name__ == "__main__":
main()
| false | 7.142857 | [
"-import numpy as np",
"-I = np.array(sys.stdin.read().split(), dtype=np.int64)",
"-a = I[1:]",
"+n, *a = list(map(int, sys.stdin.read().split()))",
"- m = int(np.around(np.mean(a)))",
"- ans = np.sum((a - m) ** 2)",
"- return ans",
"+ x = round(sum(a) / n)",
"+ s = 0",
"+ for i ... | false | 0.426036 | 0.036632 | 11.630259 | [
"s540408192",
"s066143347"
] |
u848874534 | p03041 | python | s653667602 | s812873152 | 19 | 17 | 3,188 | 2,940 | Accepted | Accepted | 10.53 | import re
pat = r'[0-9]+'
Input_num = eval(input())
Input_cou = eval(input())
num_list = re.findall(pat, Input_num)
num = int(num_list[1])
print((Input_cou[:num-1] + Input_cou[num-1].lower() + Input_cou[num:])) | Input_num = input().split()
Input_cou = eval(input())
num = int(Input_num[1])
print((Input_cou[:num-1] + Input_cou[num-1].lower() + Input_cou[num:])) | 10 | 6 | 208 | 148 | import re
pat = r"[0-9]+"
Input_num = eval(input())
Input_cou = eval(input())
num_list = re.findall(pat, Input_num)
num = int(num_list[1])
print((Input_cou[: num - 1] + Input_cou[num - 1].lower() + Input_cou[num:]))
| Input_num = input().split()
Input_cou = eval(input())
num = int(Input_num[1])
print((Input_cou[: num - 1] + Input_cou[num - 1].lower() + Input_cou[num:]))
| false | 40 | [
"-import re",
"-",
"-pat = r\"[0-9]+\"",
"-Input_num = eval(input())",
"+Input_num = input().split()",
"-num_list = re.findall(pat, Input_num)",
"-num = int(num_list[1])",
"+num = int(Input_num[1])"
] | false | 0.046909 | 0.045533 | 1.030235 | [
"s653667602",
"s812873152"
] |
u831081653 | p03478 | python | s166183943 | s513522317 | 34 | 29 | 3,060 | 3,060 | Accepted | Accepted | 14.71 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
num_str = str(i)
sum = 0
for j in num_str:
sum += int(j)
if a <= sum and sum <= b:
ans += i
print(ans) | n,a,b = list(map(int, input().split()))
# n = int(input())
def get_sum(i):
sum = 0
while i > 0:
sum += (i%10)
i = int(i/10)
return sum
cnt = 0
for i in range(1,n+1):
sum = get_sum(i)
if sum >= a and sum <= b:
cnt += i
print(cnt) | 12 | 17 | 215 | 285 | n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
num_str = str(i)
sum = 0
for j in num_str:
sum += int(j)
if a <= sum and sum <= b:
ans += i
print(ans)
| n, a, b = list(map(int, input().split()))
# n = int(input())
def get_sum(i):
sum = 0
while i > 0:
sum += i % 10
i = int(i / 10)
return sum
cnt = 0
for i in range(1, n + 1):
sum = get_sum(i)
if sum >= a and sum <= b:
cnt += i
print(cnt)
| false | 29.411765 | [
"-ans = 0",
"+# n = int(input())",
"+def get_sum(i):",
"+ sum = 0",
"+ while i > 0:",
"+ sum += i % 10",
"+ i = int(i / 10)",
"+ return sum",
"+",
"+",
"+cnt = 0",
"- num_str = str(i)",
"- sum = 0",
"- for j in num_str:",
"- sum += int(j)",
"- ... | false | 0.086606 | 0.037886 | 2.285953 | [
"s166183943",
"s513522317"
] |
u063596417 | p03494 | python | s064937297 | s992395863 | 73 | 67 | 63,828 | 63,912 | Accepted | Accepted | 8.22 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = -1
isEven = True
while isEven:
list_tmp = []
for an in a:
if an % 2 ==0:
list_tmp.append(an / 2)
else:
isEven = False
break;
a = list_tmp
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
isEven = True
while isEven:
list_tmp = []
for an in a:
if an % 2 ==0:
list_tmp.append(an / 2)
else:
isEven = False
break;
a = list_tmp
ans += 1
print((ans - 1))
| 18 | 18 | 265 | 268 | n = int(eval(input()))
a = list(map(int, input().split()))
ans = -1
isEven = True
while isEven:
list_tmp = []
for an in a:
if an % 2 == 0:
list_tmp.append(an / 2)
else:
isEven = False
break
a = list_tmp
ans += 1
print(ans)
| n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
isEven = True
while isEven:
list_tmp = []
for an in a:
if an % 2 == 0:
list_tmp.append(an / 2)
else:
isEven = False
break
a = list_tmp
ans += 1
print((ans - 1))
| false | 0 | [
"-ans = -1",
"+ans = 0",
"-print(ans)",
"+print((ans - 1))"
] | false | 0.047921 | 0.048229 | 0.993604 | [
"s064937297",
"s992395863"
] |
u609061751 | p03163 | python | s521668197 | s868038177 | 583 | 459 | 120,044 | 119,916 | Accepted | Accepted | 21.27 | import sys
input = sys.stdin.readline
N, W = [int(x) for x in input().split()]
wv = []
for _ in range(N):
wv.append([int(x) for x in input().split()])
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(W + 1):
w, v = wv[i]
if j >= w:
dp[i + ... | import sys
input = sys.stdin.readline
n, W = [int(x) for x in input().split()]
wv = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
w, v = wv[i - 1]
for j in range(W + 1):
if j - w >= 0:
dp[i][j] = max(... | 19 | 17 | 430 | 428 | import sys
input = sys.stdin.readline
N, W = [int(x) for x in input().split()]
wv = []
for _ in range(N):
wv.append([int(x) for x in input().split()])
dp = [[0] * (W + 1) for _ in range(N + 1)]
for i in range(N):
for j in range(W + 1):
w, v = wv[i]
if j >= w:
dp[i + 1][j] = max(dp[i... | import sys
input = sys.stdin.readline
n, W = [int(x) for x in input().split()]
wv = [[int(x) for x in input().split()] for _ in range(n)]
dp = [[0] * (W + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
w, v = wv[i - 1]
for j in range(W + 1):
if j - w >= 0:
dp[i][j] = max(dp[i - 1][j], ... | false | 10.526316 | [
"-N, W = [int(x) for x in input().split()]",
"-wv = []",
"-for _ in range(N):",
"- wv.append([int(x) for x in input().split()])",
"-dp = [[0] * (W + 1) for _ in range(N + 1)]",
"-for i in range(N):",
"+n, W = [int(x) for x in input().split()]",
"+wv = [[int(x) for x in input().split()] for _ in ran... | false | 0.047029 | 0.125129 | 0.375846 | [
"s521668197",
"s868038177"
] |
u678167152 | p02685 | python | s348431708 | s044937807 | 1,296 | 292 | 24,324 | 94,152 | Accepted | Accepted | 77.47 | def combs_mod(n,k,mod):
#nC0からnCkまで
inv = [1]*(k+1)
for i in range(1,k+1):
inv[i] = pow(i,mod-2,mod)
ans = [1]*(k+1)
for i in range(1,k+1):
ans[i] = ans[i-1]*(n+1-i)*inv[i]%mod
return ans
def solve():
ans = 0
mod = 998244353
N, M, K = list(map(int, input().split()))
top = min(... | def combs_mod(n,k,mod):
#nC0からnCkまで
inv = [1]*(k+1)
for i in range(1,k+1):
inv[i] = pow(i,mod-2,mod)
ans = [1]*(k+1)
for i in range(1,k+1):
ans[i] = ans[i-1]*(n+1-i)*inv[i]%mod
return ans
def solve():
ans = 0
mod = 998244353
N, M, K = list(map(int, input().split()))
lis = comb... | 21 | 20 | 468 | 440 | def combs_mod(n, k, mod):
# nC0からnCkまで
inv = [1] * (k + 1)
for i in range(1, k + 1):
inv[i] = pow(i, mod - 2, mod)
ans = [1] * (k + 1)
for i in range(1, k + 1):
ans[i] = ans[i - 1] * (n + 1 - i) * inv[i] % mod
return ans
def solve():
ans = 0
mod = 998244353
N, M, K ... | def combs_mod(n, k, mod):
# nC0からnCkまで
inv = [1] * (k + 1)
for i in range(1, k + 1):
inv[i] = pow(i, mod - 2, mod)
ans = [1] * (k + 1)
for i in range(1, k + 1):
ans[i] = ans[i - 1] * (n + 1 - i) * inv[i] % mod
return ans
def solve():
ans = 0
mod = 998244353
N, M, K ... | false | 4.761905 | [
"- top = min(K, N - 1)",
"- combs = combs_mod(N - 1, top, mod)",
"- for k in range(top + 1):",
"- ans += M * combs[k] * pow(M - 1, N - 1 - k, mod)",
"+ lis = combs_mod(N - 1, K, mod)",
"+ for i in range(K + 1):",
"+ ans += M * lis[i] * pow(M - 1, N - 1 - i, mod)"
] | false | 0.074426 | 0.115393 | 0.64498 | [
"s348431708",
"s044937807"
] |
u312025627 | p03965 | python | s667549620 | s882694577 | 171 | 32 | 39,536 | 3,188 | Accepted | Accepted | 81.29 | def main():
S = eval(input())
ans = 0
g_st = 0
for s in S:
if g_st == 0:
g_st += 1
if s == "p":
ans -= 1
else:
g_st -= 1
if s == "g":
ans += 1
print(ans)
if __name__ == '__main__':
... | def main():
S = eval(input())
ans = 0
for i, s in enumerate(S):
if i & 1:
if s == "g": # パー
ans += 1
else:
if s == "p":
ans -= 1
print(ans)
if __name__ == '__main__':
main()
| 18 | 15 | 321 | 277 | def main():
S = eval(input())
ans = 0
g_st = 0
for s in S:
if g_st == 0:
g_st += 1
if s == "p":
ans -= 1
else:
g_st -= 1
if s == "g":
ans += 1
print(ans)
if __name__ == "__main__":
main()
| def main():
S = eval(input())
ans = 0
for i, s in enumerate(S):
if i & 1:
if s == "g": # パー
ans += 1
else:
if s == "p":
ans -= 1
print(ans)
if __name__ == "__main__":
main()
| false | 16.666667 | [
"- g_st = 0",
"- for s in S:",
"- if g_st == 0:",
"- g_st += 1",
"+ for i, s in enumerate(S):",
"+ if i & 1:",
"+ if s == \"g\": # パー",
"+ ans += 1",
"+ else:",
"- else:",
"- g_st -= 1",
"- if s ==... | false | 0.087382 | 0.035909 | 2.433402 | [
"s667549620",
"s882694577"
] |
u197615397 | p02363 | python | s943930322 | s119063034 | 170 | 150 | 6,220 | 6,236 | Accepted | Accepted | 11.76 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, c1, c3 in zip(list(range(v_count)), matrix[j], matrix[i]):
if c1 > c2+c3:
matrix[j][k] = c2+c3
return mat... | import sys
def warshall_floyd(v_count: int, matrix: list) -> list:
""" ワーシャルフロイド
:param v_count: 頂点数
:param matrix: 隣接行列
"""
for i in range(v_count):
for j, c2 in enumerate(row[i] for row in matrix):
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
... | 28 | 35 | 821 | 984 | import sys
def warshall_floyd(v_count, matrix):
for i in range(v_count):
for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):
for k, c1, c3 in zip(list(range(v_count)), matrix[j], matrix[i]):
if c1 > c2 + c3:
matrix[j][k] = c2 + c3
return matrix... | import sys
def warshall_floyd(v_count: int, matrix: list) -> list:
"""ワーシャルフロイド
:param v_count: 頂点数
:param matrix: 隣接行列
"""
for i in range(v_count):
for j, c2 in enumerate(row[i] for row in matrix):
for k, (c1, c3) in enumerate(zip(matrix[j], matrix[i])):
if c1 ... | false | 20 | [
"-def warshall_floyd(v_count, matrix):",
"+def warshall_floyd(v_count: int, matrix: list) -> list:",
"+ \"\"\"ワーシャルフロイド",
"+ :param v_count: 頂点数",
"+ :param matrix: 隣接行列",
"+ \"\"\"",
"- for j, c2 in enumerate(matrix[j][i] for j in range(v_count)):",
"- for k, c1, c3 in z... | false | 0.036176 | 0.039033 | 0.926811 | [
"s943930322",
"s119063034"
] |
u312025627 | p03567 | python | s628776805 | s540184203 | 166 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.76 | def main():
S = eval(input())
print(("Yes" if 'AC' in S else 'No'))
if __name__ == '__main__':
main() | def main():
S = eval(input())
if S.count("AC"):
print("Yes")
else:
print("No")
if __name__ == '__main__':
main()
| 6 | 10 | 112 | 150 | def main():
S = eval(input())
print(("Yes" if "AC" in S else "No"))
if __name__ == "__main__":
main()
| def main():
S = eval(input())
if S.count("AC"):
print("Yes")
else:
print("No")
if __name__ == "__main__":
main()
| false | 40 | [
"- print((\"Yes\" if \"AC\" in S else \"No\"))",
"+ if S.count(\"AC\"):",
"+ print(\"Yes\")",
"+ else:",
"+ print(\"No\")"
] | false | 0.034868 | 0.035152 | 0.991902 | [
"s628776805",
"s540184203"
] |
u934442292 | p03379 | python | s157570172 | s052491435 | 273 | 231 | 25,220 | 25,572 | Accepted | Accepted | 15.38 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
X = list(map(int, input().split()))
A, B = sorted(X)[N // 2 - 1: N // 2 + 1]
for x in X:
if x <= A:
print(B)
else:
print(A)
if __name__ == "__main__":
main()
| import sys
input = sys.stdin.readline
def main():
N = int(input())
X = list(map(int, input().split()))
A, B = sorted(X)[N // 2 - 1: N // 2 + 1]
ans = [B if x <= A else A for x in X]
print(*ans, sep="\n")
if __name__ == "__main__":
main()
| 19 | 16 | 309 | 283 | import sys
input = sys.stdin.readline
def main():
N = int(eval(input()))
X = list(map(int, input().split()))
A, B = sorted(X)[N // 2 - 1 : N // 2 + 1]
for x in X:
if x <= A:
print(B)
else:
print(A)
if __name__ == "__main__":
main()
| import sys
input = sys.stdin.readline
def main():
N = int(input())
X = list(map(int, input().split()))
A, B = sorted(X)[N // 2 - 1 : N // 2 + 1]
ans = [B if x <= A else A for x in X]
print(*ans, sep="\n")
if __name__ == "__main__":
main()
| false | 15.789474 | [
"- N = int(eval(input()))",
"+ N = int(input())",
"- for x in X:",
"- if x <= A:",
"- print(B)",
"- else:",
"- print(A)",
"+ ans = [B if x <= A else A for x in X]",
"+ print(*ans, sep=\"\\n\")"
] | false | 0.045533 | 0.123392 | 0.369011 | [
"s157570172",
"s052491435"
] |
u729133443 | p02735 | python | s031867888 | s383934055 | 298 | 43 | 53,084 | 3,064 | Accepted | Accepted | 85.57 | from heapq import*
def main():
h,w=list(map(int,input().split()))
s=[eval(input())for _ in range(h)]
g=h*w+1
e=[[]for _ in range(g)]
for i in range(h):
for j in range(w):
for y,x in((i+1,j),(i,j+1)):
if y<h and x<w:
if s[i][j]=='.'and s[y][x]!='.':
e[i*w+j]+=... | h,*s=open(0)
h,w=list(map(int,h.split()))
dp=[[9e9]*w for _ in s]
dp[0][0]=s[0][0]<'.'
for i in range(h*w):
i,j=i//w,i%w
for y,x in((i+1,j),(i,j+1)):
if y<h and x<w:dp[y][x]=min(dp[y][x],dp[i][j]+(s[i][j]=='.'>s[y][x]))
print((dp[-1][-1])) | 29 | 9 | 629 | 247 | from heapq import *
def main():
h, w = list(map(int, input().split()))
s = [eval(input()) for _ in range(h)]
g = h * w + 1
e = [[] for _ in range(g)]
for i in range(h):
for j in range(w):
for y, x in ((i + 1, j), (i, j + 1)):
if y < h and x < w:
... | h, *s = open(0)
h, w = list(map(int, h.split()))
dp = [[9e9] * w for _ in s]
dp[0][0] = s[0][0] < "."
for i in range(h * w):
i, j = i // w, i % w
for y, x in ((i + 1, j), (i, j + 1)):
if y < h and x < w:
dp[y][x] = min(dp[y][x], dp[i][j] + (s[i][j] == "." > s[y][x]))
print((dp[-1][-1]))
| false | 68.965517 | [
"-from heapq import *",
"-",
"-",
"-def main():",
"- h, w = list(map(int, input().split()))",
"- s = [eval(input()) for _ in range(h)]",
"- g = h * w + 1",
"- e = [[] for _ in range(g)]",
"- for i in range(h):",
"- for j in range(w):",
"- for y, x in ((i + 1, j),... | false | 0.034911 | 0.054806 | 0.636996 | [
"s031867888",
"s383934055"
] |
u644907318 | p03779 | python | s702311019 | s411476756 | 184 | 162 | 38,640 | 38,640 | Accepted | Accepted | 11.96 | X = int(eval(input()))
t = 1
while True:
if X<=((t+1)*t)//2:
break
t += 1
print(t)
| X = int(eval(input()))
k = 1
while (k*(k+1))//2<X:
k += 1
print(k) | 7 | 5 | 99 | 68 | X = int(eval(input()))
t = 1
while True:
if X <= ((t + 1) * t) // 2:
break
t += 1
print(t)
| X = int(eval(input()))
k = 1
while (k * (k + 1)) // 2 < X:
k += 1
print(k)
| false | 28.571429 | [
"-t = 1",
"-while True:",
"- if X <= ((t + 1) * t) // 2:",
"- break",
"- t += 1",
"-print(t)",
"+k = 1",
"+while (k * (k + 1)) // 2 < X:",
"+ k += 1",
"+print(k)"
] | false | 0.045395 | 0.035144 | 1.291686 | [
"s702311019",
"s411476756"
] |
u368796742 | p03169 | python | s015083368 | s614828373 | 856 | 594 | 254,600 | 254,344 | Accepted | Accepted | 30.61 |
n = int(eval(input()))
l1 = l2 = l3 = 0
l = [int(i) for i in input().split()]
for i in l:
if i == 1:
l1 += 1
elif i == 2:
l2 += 1
else:
l3 += 1
a = l2+l3
dp = [[[0.0]*(l3+1) for i in range(a+1)] for j in range(n+1)]
for i in range(1,n+1):
for j in range(min(i,a)+... | def main():
import sys
input = sys.stdin.readline
n = int(eval(input()))
l1 = l2 = l3 = 0
for i in map(int,input().split()):
if i == 1:
l1 += 1
elif i == 2:
l2 += 1
else:
l3 += 1
a = l2+l3
dp = [[[0.0]*(l3+1) for ... | 32 | 37 | 729 | 916 | n = int(eval(input()))
l1 = l2 = l3 = 0
l = [int(i) for i in input().split()]
for i in l:
if i == 1:
l1 += 1
elif i == 2:
l2 += 1
else:
l3 += 1
a = l2 + l3
dp = [[[0.0] * (l3 + 1) for i in range(a + 1)] for j in range(n + 1)]
for i in range(1, n + 1):
for j in range(min(i, a) + 1... | def main():
import sys
input = sys.stdin.readline
n = int(eval(input()))
l1 = l2 = l3 = 0
for i in map(int, input().split()):
if i == 1:
l1 += 1
elif i == 2:
l2 += 1
else:
l3 += 1
a = l2 + l3
dp = [[[0.0] * (l3 + 1) for i in range(... | false | 13.513514 | [
"-n = int(eval(input()))",
"-l1 = l2 = l3 = 0",
"-l = [int(i) for i in input().split()]",
"-for i in l:",
"- if i == 1:",
"- l1 += 1",
"- elif i == 2:",
"- l2 += 1",
"- else:",
"- l3 += 1",
"-a = l2 + l3",
"-dp = [[[0.0] * (l3 + 1) for i in range(a + 1)] for j in ... | false | 0.006955 | 0.039976 | 0.173983 | [
"s015083368",
"s614828373"
] |
u562935282 | p03163 | python | s036020913 | s298103466 | 391 | 357 | 122,444 | 119,152 | Accepted | Accepted | 8.7 | n, w = list(map(int, input().split()))
e = tuple(list(map(int, input().split())) for _ in range(n))
wt, vt = list(zip(*e))
dp = tuple([0] * (w + 1) for _ in range(n + 1))
for i in range(n):
dp[i + 1][:wt[i]] = dp[i][:wt[i]]
for j in range(wt[i], w + 1):
dp[i + 1][j] = max(dp[i][j], dp[i][j - ... | def main():
import sys
readline = sys.stdin.readline
n, w = list(map(int, readline().split()))
dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(1, n + 1): # i個目の品物を選ぶかどうか決めた後の価値の総和の最大値,1-indexed
wi, vi = list(map(int, readline().split()))
for j in range(wi):
... | 11 | 23 | 335 | 586 | n, w = list(map(int, input().split()))
e = tuple(list(map(int, input().split())) for _ in range(n))
wt, vt = list(zip(*e))
dp = tuple([0] * (w + 1) for _ in range(n + 1))
for i in range(n):
dp[i + 1][: wt[i]] = dp[i][: wt[i]]
for j in range(wt[i], w + 1):
dp[i + 1][j] = max(dp[i][j], dp[i][j - wt[i]] + ... | def main():
import sys
readline = sys.stdin.readline
n, w = list(map(int, readline().split()))
dp = [[0] * (w + 1) for _ in range(n + 1)]
for i in range(1, n + 1): # i個目の品物を選ぶかどうか決めた後の価値の総和の最大値,1-indexed
wi, vi = list(map(int, readline().split()))
for j in range(wi):
dp... | false | 52.173913 | [
"-n, w = list(map(int, input().split()))",
"-e = tuple(list(map(int, input().split())) for _ in range(n))",
"-wt, vt = list(zip(*e))",
"-dp = tuple([0] * (w + 1) for _ in range(n + 1))",
"-for i in range(n):",
"- dp[i + 1][: wt[i]] = dp[i][: wt[i]]",
"- for j in range(wt[i], w + 1):",
"- ... | false | 0.039329 | 0.041063 | 0.957757 | [
"s036020913",
"s298103466"
] |
u130900604 | p02718 | python | s983917182 | s016435021 | 181 | 17 | 38,492 | 2,940 | Accepted | Accepted | 90.61 | def MI():return list(map(int,input().split()))
def LI():return list(MI())
n,m=MI()
a=LI()
sou=sum(a)
if sum([i*4*m>=sou for i in a])>=m:
print("Yes")
else:
print("No") | n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
s=sum(a)
print(("Yes" if (sum([i*4*m>=s for i in a])>=m) else "No")) | 12 | 4 | 183 | 131 | def MI():
return list(map(int, input().split()))
def LI():
return list(MI())
n, m = MI()
a = LI()
sou = sum(a)
if sum([i * 4 * m >= sou for i in a]) >= m:
print("Yes")
else:
print("No")
| n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
s = sum(a)
print(("Yes" if (sum([i * 4 * m >= s for i in a]) >= m) else "No"))
| false | 66.666667 | [
"-def MI():",
"- return list(map(int, input().split()))",
"-",
"-",
"-def LI():",
"- return list(MI())",
"-",
"-",
"-n, m = MI()",
"-a = LI()",
"-sou = sum(a)",
"-if sum([i * 4 * m >= sou for i in a]) >= m:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+n, m = list(ma... | false | 0.036396 | 0.035291 | 1.031325 | [
"s983917182",
"s016435021"
] |
u323680411 | p03814 | python | s026175623 | s610954171 | 103 | 49 | 3,444 | 3,516 | Accepted | Accepted | 52.43 | from sys import stdin
def main():
s = next_str()
best = 0
cnt = 0
flg = False
for v in s:
if v == 'A':
flg = True
if flg:
cnt += 1
if flg and v == 'Z':
best = cnt
print(best)
def next_int() -> int:
retur... | from sys import stdin
def main():
s = eval(input())
best = 0
cnt = 0
flg = False
for v in s:
if v == 'A':
flg = True
if flg:
cnt += 1
if flg and v == 'Z':
best = cnt
print(best)
def next_int() -> int:
re... | 38 | 38 | 595 | 592 | from sys import stdin
def main():
s = next_str()
best = 0
cnt = 0
flg = False
for v in s:
if v == "A":
flg = True
if flg:
cnt += 1
if flg and v == "Z":
best = cnt
print(best)
def next_int() -> int:
return int(next_str())
def n... | from sys import stdin
def main():
s = eval(input())
best = 0
cnt = 0
flg = False
for v in s:
if v == "A":
flg = True
if flg:
cnt += 1
if flg and v == "Z":
best = cnt
print(best)
def next_int() -> int:
return int(next_str())
de... | false | 0 | [
"- s = next_str()",
"+ s = eval(input())"
] | false | 0.037075 | 0.067267 | 0.551156 | [
"s026175623",
"s610954171"
] |
u906501980 | p02553 | python | s688956261 | s352984752 | 32 | 27 | 9,180 | 9,152 | Accepted | Accepted | 15.62 | def main():
a, b, c, d = list(map(int, input().split()))
if (a <= 0 and b >= 0) or (c <=0 and d >= 0):
print((max(a*c, b*d, 0)))
else:
print((max(a*c, b*d, a*d, b*c)))
if __name__ == "__main__":
main() | def main():
a, b, c, d = list(map(int, input().split()))
if a*b > 0 and c*d > 0 and a*c < 0:
print((max(a*d, b*c)))
else:
print((max(a*c, b*d, 0)))
if __name__ == "__main__":
main() | 9 | 9 | 232 | 212 | def main():
a, b, c, d = list(map(int, input().split()))
if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):
print((max(a * c, b * d, 0)))
else:
print((max(a * c, b * d, a * d, b * c)))
if __name__ == "__main__":
main()
| def main():
a, b, c, d = list(map(int, input().split()))
if a * b > 0 and c * d > 0 and a * c < 0:
print((max(a * d, b * c)))
else:
print((max(a * c, b * d, 0)))
if __name__ == "__main__":
main()
| false | 0 | [
"- if (a <= 0 and b >= 0) or (c <= 0 and d >= 0):",
"+ if a * b > 0 and c * d > 0 and a * c < 0:",
"+ print((max(a * d, b * c)))",
"+ else:",
"- else:",
"- print((max(a * c, b * d, a * d, b * c)))"
] | false | 0.125646 | 0.094447 | 1.330341 | [
"s688956261",
"s352984752"
] |
u281610856 | p03329 | python | s257551121 | s627331932 | 635 | 217 | 7,064 | 44,912 | Accepted | Accepted | 65.83 | n = int(eval(input()))
dp = [i for i in range(n+1)] # dp table 最初は全て1円で払う
for j in range(1, n+1):
power = 1
while power <= j:
dp[j] = min(dp[j], dp[j - power] + 1)
power *= 6
power = 1
while power <= j:
dp[j] = min(dp[j], dp[j - power] + 1)
power *= 9
print((d... | n = int(eval(input()))
dp = [i for i in range(n + 1)]
for i in range(1, n+1):
pow = 6
while i - pow > -1:
dp[i] = min(dp[i], dp[i - pow] + 1)
pow *= 6
pow = 9
while i - pow > -1:
dp[i] = min(dp[i], dp[i - pow] + 1)
pow *= 9
# print(dp)
print((dp[n])) | 12 | 13 | 319 | 302 | n = int(eval(input()))
dp = [i for i in range(n + 1)] # dp table 最初は全て1円で払う
for j in range(1, n + 1):
power = 1
while power <= j:
dp[j] = min(dp[j], dp[j - power] + 1)
power *= 6
power = 1
while power <= j:
dp[j] = min(dp[j], dp[j - power] + 1)
power *= 9
print((dp[n]))
| n = int(eval(input()))
dp = [i for i in range(n + 1)]
for i in range(1, n + 1):
pow = 6
while i - pow > -1:
dp[i] = min(dp[i], dp[i - pow] + 1)
pow *= 6
pow = 9
while i - pow > -1:
dp[i] = min(dp[i], dp[i - pow] + 1)
pow *= 9
# print(dp)
print((dp[n]))
| false | 7.692308 | [
"-dp = [i for i in range(n + 1)] # dp table 最初は全て1円で払う",
"-for j in range(1, n + 1):",
"- power = 1",
"- while power <= j:",
"- dp[j] = min(dp[j], dp[j - power] + 1)",
"- power *= 6",
"- power = 1",
"- while power <= j:",
"- dp[j] = min(dp[j], dp[j - power] + 1)",
... | false | 0.118034 | 0.104602 | 1.12841 | [
"s257551121",
"s627331932"
] |
u814265211 | p03073 | python | s087901088 | s763699326 | 52 | 23 | 9,580 | 4,268 | Accepted | Accepted | 55.77 | raw = eval(input())
s = bin(int(raw, 2))
n = len(raw)
m = bin(int(''.join([str(i%2) for i in range(n)]),2))
a = bin((int(s,2))^int(m,2)).count("1")
b = n-a
print((a if a < b else b)) | s = list(eval(input()))
print((min(s[::2].count('0')+s[1::2].count('1'), s[::2].count('1')+s[1::2].count('0'))))
| 9 | 3 | 186 | 108 | raw = eval(input())
s = bin(int(raw, 2))
n = len(raw)
m = bin(int("".join([str(i % 2) for i in range(n)]), 2))
a = bin((int(s, 2)) ^ int(m, 2)).count("1")
b = n - a
print((a if a < b else b))
| s = list(eval(input()))
print(
(
min(
s[::2].count("0") + s[1::2].count("1"),
s[::2].count("1") + s[1::2].count("0"),
)
)
)
| false | 66.666667 | [
"-raw = eval(input())",
"-s = bin(int(raw, 2))",
"-n = len(raw)",
"-m = bin(int(\"\".join([str(i % 2) for i in range(n)]), 2))",
"-a = bin((int(s, 2)) ^ int(m, 2)).count(\"1\")",
"-b = n - a",
"-print((a if a < b else b))",
"+s = list(eval(input()))",
"+print(",
"+ (",
"+ min(",
"+ ... | false | 0.044549 | 0.084924 | 0.524575 | [
"s087901088",
"s763699326"
] |
u352394527 | p00151 | python | s195071909 | s142473957 | 470 | 430 | 19,292 | 19,296 | Accepted | Accepted | 8.51 | def main():
while True:
n = int(eval(input()))
if n == 0:
break
mp = ["0" + eval(input()) + "0" for _ in range(n)]
mp.insert(0, "0" * (n + 2))
mp.append("0" * (n + 2))
score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)]
max_score = 0
for i in range(1, n + 1)... | def main():
while True:
n = int(eval(input()))
if n == 0:
break
mp = ["0" + eval(input()) + "0" for _ in range(n)]
mp.insert(0, "0" * (n + 2))
mp.append("0" * (n + 2))
score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)]
max_score = 0
for i in ran... | 24 | 24 | 795 | 736 | def main():
while True:
n = int(eval(input()))
if n == 0:
break
mp = ["0" + eval(input()) + "0" for _ in range(n)]
mp.insert(0, "0" * (n + 2))
mp.append("0" * (n + 2))
score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)]
max_score = 0
... | def main():
while True:
n = int(eval(input()))
if n == 0:
break
mp = ["0" + eval(input()) + "0" for _ in range(n)]
mp.insert(0, "0" * (n + 2))
mp.append("0" * (n + 2))
score = [[[0] * 4 for _ in range(n + 2)] for _ in range(n + 2)]
max_score = 0
... | false | 0 | [
"- else:",
"- for k in range(4):",
"- score[i][j][k] = 0"
] | false | 0.035246 | 0.036932 | 0.954331 | [
"s195071909",
"s142473957"
] |
u562016607 | p03557 | python | s190756841 | s413472101 | 455 | 366 | 104,804 | 23,232 | Accepted | Accepted | 19.56 | N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort();C.sort()
M = 0
for i in range(N):
low = 0
high = N - 1
t = (low + high) // 2
if A[N-1] < B[i]:
t = N-1
elif A[0] >= B[i]:
t =... | from bisect import bisect_left,bisect_right
N=int(eval(input()))
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
C.sort()
ans=0
for i in range(N):
ans+=bisect_left(A,B[i])*(N-bisect_right(C,B[i]))
print(ans)
| 41 | 11 | 1,004 | 285 | N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
C.sort()
M = 0
for i in range(N):
low = 0
high = N - 1
t = (low + high) // 2
if A[N - 1] < B[i]:
t = N - 1
elif A[0] >= B[i]:
t = -1
e... | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
C.sort()
ans = 0
for i in range(N):
ans += bisect_left(A, B[i]) * (N - bisect_right(C, B[i]))
print(ans)
| false | 73.170732 | [
"+from bisect import bisect_left, bisect_right",
"+",
"-M = 0",
"+ans = 0",
"- low = 0",
"- high = N - 1",
"- t = (low + high) // 2",
"- if A[N - 1] < B[i]:",
"- t = N - 1",
"- elif A[0] >= B[i]:",
"- t = -1",
"- else:",
"- while low <= high:",
"- ... | false | 0.101601 | 0.115685 | 0.878254 | [
"s190756841",
"s413472101"
] |
u744920373 | p03212 | python | s109243565 | s100386212 | 55 | 42 | 4,464 | 4,332 | Accepted | Accepted | 23.64 | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return list(map(int, sys.stdin.readline().split()))
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): ret... | 39 | 30 | 1,101 | 992 | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | import sys
sys.setrecursionlimit(10**8)
def ii():
return int(sys.stdin.readline())
def mi():
return list(map(int, sys.stdin.readline().split()))
def li():
return list(map(int, sys.stdin.readline().split()))
def li2(N):
return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
de... | false | 23.076923 | [
"-que = deque([33, 35, 37, 53, 55, 57, 73, 75, 77])",
"-ele = [\"3\", \"5\", \"7\"]",
"-ind = 0",
"-while True:",
"- num = que[ind] * 10",
"- que.append(num + 3)",
"- que.append(num + 5)",
"- que.append(num + 7)",
"- if len(str(num)) >= 10:",
"- break",
"- ind += 1",
"... | false | 0.07855 | 0.053495 | 1.468368 | [
"s109243565",
"s100386212"
] |
u608088992 | p03112 | python | s620321109 | s373206817 | 1,490 | 681 | 12,048 | 12,180 | Accepted | Accepted | 54.3 | from bisect import bisect
A, B, Q = list(map(int, input().split()))
S, T =[None] * (A+2), [None] * (B+2)
S[0], T[0] = -10**20, -10**20
for i in range(A):
S[i+1] = int(eval(input()))
for i in range(B):
T[i+1] = int(eval(input()))
S[A+1] = 10**20
T[B+1] = 10**20
lenS, lenT = len(S), len(T)
for _ in r... | import sys
from bisect import bisect
F = sys.stdin
A, B, Q = list(map(int, F.readline().strip("\n").split(" ")))
S, T =[None] * (A+2), [None] * (B+2)
S[0], T[0] = -10**20, -10**20
for i in range(A):
S[i+1] = int(F.readline().strip("\n"))
for i in range(B):
T[i+1] = int(F.readline().strip("\n"))
S[A+1]... | 19 | 21 | 666 | 764 | from bisect import bisect
A, B, Q = list(map(int, input().split()))
S, T = [None] * (A + 2), [None] * (B + 2)
S[0], T[0] = -(10**20), -(10**20)
for i in range(A):
S[i + 1] = int(eval(input()))
for i in range(B):
T[i + 1] = int(eval(input()))
S[A + 1] = 10**20
T[B + 1] = 10**20
lenS, lenT = len(S), len(T)
for _... | import sys
from bisect import bisect
F = sys.stdin
A, B, Q = list(map(int, F.readline().strip("\n").split(" ")))
S, T = [None] * (A + 2), [None] * (B + 2)
S[0], T[0] = -(10**20), -(10**20)
for i in range(A):
S[i + 1] = int(F.readline().strip("\n"))
for i in range(B):
T[i + 1] = int(F.readline().strip("\n"))
S[... | false | 9.52381 | [
"+import sys",
"-A, B, Q = list(map(int, input().split()))",
"+F = sys.stdin",
"+A, B, Q = list(map(int, F.readline().strip(\"\\n\").split(\" \")))",
"- S[i + 1] = int(eval(input()))",
"+ S[i + 1] = int(F.readline().strip(\"\\n\"))",
"- T[i + 1] = int(eval(input()))",
"+ T[i + 1] = int(F.r... | false | 0.061653 | 0.094565 | 0.651965 | [
"s620321109",
"s373206817"
] |
u348805958 | p02763 | python | s008665707 | s042300757 | 875 | 374 | 29,320 | 31,624 | Accepted | Accepted | 57.26 | #!python3
import sys
from bisect import bisect, insort_left
iim = lambda: map(int, input().rstrip().split())
def resolve():
N = int(input())
S = list(input())
Q = int(input())
c0 = ord('a')
S1 = [[] for i in range(26)]
for i, c1 in enumerate(S):
ci = ord(c1) - c0
... | #!python3
import sys
iim = lambda: map(int, input().rstrip().split())
def popcnt2(n):
a = (
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5... | 51 | 104 | 1,116 | 2,857 | #!python3
import sys
from bisect import bisect, insort_left
iim = lambda: map(int, input().rstrip().split())
def resolve():
N = int(input())
S = list(input())
Q = int(input())
c0 = ord("a")
S1 = [[] for i in range(26)]
for i, c1 in enumerate(S):
ci = ord(c1) - c0
S1[ci].append... | #!python3
import sys
iim = lambda: map(int, input().rstrip().split())
def popcnt2(n):
a = (
0,
1,
1,
2,
1,
2,
2,
3,
1,
2,
2,
3,
2,
3,
3,
4,
1,
2,
2,
3,
... | false | 50.961538 | [
"-from bisect import bisect, insort_left",
"+",
"+",
"+def popcnt2(n):",
"+ a = (",
"+ 0,",
"+ 1,",
"+ 1,",
"+ 2,",
"+ 1,",
"+ 2,",
"+ 2,",
"+ 3,",
"+ 1,",
"+ 2,",
"+ 2,",
"+ 3,",
"+ 2,",
... | false | 0.046409 | 0.042448 | 1.0933 | [
"s008665707",
"s042300757"
] |
u074220993 | p03495 | python | s140078811 | s601628599 | 312 | 101 | 32,244 | 34,964 | Accepted | Accepted | 67.63 | import bisect as bs
N, K = (int(x) for x in input().split())
A = sorted([int(x) for x in input().split()])
f = lambda X, x: bs.bisect_right(X,x)-bs.bisect_left(X,x)
cnt = sorted([f(A,a) for a in set(A)],reverse=True)
vrt = len(cnt)
print((sum(cnt[K:]) if vrt > K else 0)) | from collections import Counter
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
unchange = sum(tuple[1] for tuple in Counter(A).most_common(K))
print((N-unchange))
main() | 7 | 10 | 275 | 229 | import bisect as bs
N, K = (int(x) for x in input().split())
A = sorted([int(x) for x in input().split()])
f = lambda X, x: bs.bisect_right(X, x) - bs.bisect_left(X, x)
cnt = sorted([f(A, a) for a in set(A)], reverse=True)
vrt = len(cnt)
print((sum(cnt[K:]) if vrt > K else 0))
| from collections import Counter
def main():
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
unchange = sum(tuple[1] for tuple in Counter(A).most_common(K))
print((N - unchange))
main()
| false | 30 | [
"-import bisect as bs",
"+from collections import Counter",
"-N, K = (int(x) for x in input().split())",
"-A = sorted([int(x) for x in input().split()])",
"-f = lambda X, x: bs.bisect_right(X, x) - bs.bisect_left(X, x)",
"-cnt = sorted([f(A, a) for a in set(A)], reverse=True)",
"-vrt = len(cnt)",
"-pr... | false | 0.137677 | 0.086378 | 1.593899 | [
"s140078811",
"s601628599"
] |
u678167152 | p02630 | python | s913364648 | s360404653 | 340 | 263 | 97,728 | 96,828 | Accepted | Accepted | 22.65 | N = int(input())
A = list(map(int, input().split()))
total = sum(A)
from collections import defaultdict
d = defaultdict(lambda: 0)
for a in A:
d[a] += 1
Q = int(input())
ans = []
for i in range(Q):
x,y = map(int, input().split())
total += y*d[x]-x*d[x]
d[y] += d[x]
d[x] = 0
ans.app... | from collections import Counter
def solve():
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
Q = int(input())
ans = [0]*Q
total = sum(A)
for i in range(Q):
x,y = map(int, input().split())
total += c[x]*(y-x)
c[y] += c[x]
c[x] = 0
ans[i] = total
retur... | 17 | 16 | 356 | 351 | N = int(input())
A = list(map(int, input().split()))
total = sum(A)
from collections import defaultdict
d = defaultdict(lambda: 0)
for a in A:
d[a] += 1
Q = int(input())
ans = []
for i in range(Q):
x, y = map(int, input().split())
total += y * d[x] - x * d[x]
d[y] += d[x]
d[x] = 0
ans.append(to... | from collections import Counter
def solve():
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
Q = int(input())
ans = [0] * Q
total = sum(A)
for i in range(Q):
x, y = map(int, input().split())
total += c[x] * (y - x)
c[y] += c[x]
c[x] = 0
... | false | 5.882353 | [
"-N = int(input())",
"-A = list(map(int, input().split()))",
"-total = sum(A)",
"-from collections import defaultdict",
"+from collections import Counter",
"-d = defaultdict(lambda: 0)",
"-for a in A:",
"- d[a] += 1",
"-Q = int(input())",
"-ans = []",
"-for i in range(Q):",
"- x, y = map... | false | 0.042525 | 0.042386 | 1.00329 | [
"s913364648",
"s360404653"
] |
u363421241 | p02838 | python | s512946403 | s443325023 | 1,650 | 184 | 51,040 | 124,484 | Accepted | Accepted | 88.85 | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9+7
ans = 0
for k in range(60):
x, y = 0, 0
for a in A:
x += 1 & a>>k
tmp = x*(n-x)%mod
tmp *= pow(2, k, mod)
ans += tmp
ans %= mod
print(... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
for k in range(60):
x, y = 0, 0
for a in A:
x += 1 & a >> k
tmp = x * (n - x) % mod
tmp *= 2**k%mod
ans += tmp
ans %= mod
print(ans)
| 20 | 15 | 361 | 260 | def main():
n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
x, y = 0, 0
for a in A:
x += 1 & a >> k
tmp = x * (n - x) % mod
tmp *= pow(2, k, mod)
ans += tmp
ans %= mod
print(ans)
... | n = int(eval(input()))
A = list(map(int, input().split()))
mod = 10**9 + 7
ans = 0
for k in range(60):
x, y = 0, 0
for a in A:
x += 1 & a >> k
tmp = x * (n - x) % mod
tmp *= 2**k % mod
ans += tmp
ans %= mod
print(ans)
| false | 25 | [
"-def main():",
"- n = int(eval(input()))",
"- A = list(map(int, input().split()))",
"- mod = 10**9 + 7",
"- ans = 0",
"- for k in range(60):",
"- x, y = 0, 0",
"- for a in A:",
"- x += 1 & a >> k",
"- tmp = x * (n - x) % mod",
"- tmp *= pow(... | false | 0.135856 | 0.036578 | 3.714133 | [
"s512946403",
"s443325023"
] |
u989306199 | p04013 | python | s101348073 | s666707994 | 1,251 | 86 | 103,308 | 11,600 | Accepted | Accepted | 93.13 |
NMAX = 55
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
dp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]
dp[0][0][0] = 1 # dp[i][s][k]: i個からk個選ぶとき、総和がsのものの個数
for i in range(N): # N-1時点でNが更新されるのでここまでで十分
for s in range(3000):
for k in range(N+1):
... |
NMAX = 55
T = 2500
N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
dp = [[0]*5001 for i in range(NMAX)] # i時点で総和がSになるものの個数
dp[0][T] = 1
for i in range(N):
for s in range(5001):
if s+X[i] > 5001 or dp[i][s] == 0:
continue
dp[i+1][s... | 22 | 19 | 535 | 393 | NMAX = 55
N, A = list(map(int, input().split()))
X = list(map(int, input().split()))
dp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]
dp[0][0][0] = 1 # dp[i][s][k]: i個からk個選ぶとき、総和がsのものの個数
for i in range(N): # N-1時点でNが更新されるのでここまでで十分
for s in range(3000):
for k in range(N + 1):
if dp... | NMAX = 55
T = 2500
N, A = list(map(int, input().split()))
X = list([int(x) - A for x in input().split()])
dp = [[0] * 5001 for i in range(NMAX)] # i時点で総和がSになるものの個数
dp[0][T] = 1
for i in range(N):
for s in range(5001):
if s + X[i] > 5001 or dp[i][s] == 0:
continue
dp[i + 1][s] += dp[i][s... | false | 13.636364 | [
"+T = 2500",
"-X = list(map(int, input().split()))",
"-dp = [[[0] * NMAX for s in range(3000)] for i in range(NMAX)]",
"-dp[0][0][0] = 1 # dp[i][s][k]: i個からk個選ぶとき、総和がsのものの個数",
"-for i in range(N): # N-1時点でNが更新されるのでここまでで十分",
"- for s in range(3000):",
"- for k in range(N + 1):",
"- ... | false | 0.374145 | 0.048797 | 7.667394 | [
"s101348073",
"s666707994"
] |
u815763296 | p02844 | python | s212069032 | s477005157 | 841 | 652 | 84,748 | 9,720 | Accepted | Accepted | 22.47 | N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
for y in range(10):
for z in range(10):
for i in range(N):
if x != int(S[i]):
continue
for j in range(i+1, N):
if y != int(S[j]):
... | from collections import Counter
N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
for y in range(10):
hantei = []
for i in range(N):
if x != int(S[i]):
continue
for j in range(i+1, N):
if y != int(S[j]):
... | 20 | 20 | 594 | 511 | N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
for y in range(10):
for z in range(10):
for i in range(N):
if x != int(S[i]):
continue
for j in range(i + 1, N):
if y != int(S[j]):
... | from collections import Counter
N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
for y in range(10):
hantei = []
for i in range(N):
if x != int(S[i]):
continue
for j in range(i + 1, N):
if y != int(S[j]):
... | false | 0 | [
"+from collections import Counter",
"+",
"- for z in range(10):",
"- for i in range(N):",
"- if x != int(S[i]):",
"+ hantei = []",
"+ for i in range(N):",
"+ if x != int(S[i]):",
"+ continue",
"+ for j in range(i +... | false | 0.047965 | 0.045466 | 1.054967 | [
"s212069032",
"s477005157"
] |
u489959379 | p03835 | python | s541623733 | s093624743 | 1,465 | 279 | 3,060 | 40,940 | Accepted | Accepted | 80.96 | k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
ans += 1
print(ans) | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
k, s = list(map(int, input().split()))
res = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if x + y + z == s and k >= z >= 0:
res... | 8 | 22 | 175 | 385 | k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if 0 <= z <= k:
ans += 1
print(ans)
| import sys
sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
k, s = list(map(int, input().split()))
res = 0
for x in range(k + 1):
for y in range(k + 1):
z = s - x - y
if x + y + z == s and k >= z >= 0:
res += 1
print(res)... | false | 63.636364 | [
"-k, s = list(map(int, input().split()))",
"-ans = 0",
"-for x in range(k + 1):",
"- for y in range(k + 1):",
"- z = s - x - y",
"- if 0 <= z <= k:",
"- ans += 1",
"-print(ans)",
"+import sys",
"+",
"+sys.setrecursionlimit(10**7)",
"+f_inf = float(\"inf\")",
"+mod... | false | 0.041268 | 0.052096 | 0.792159 | [
"s541623733",
"s093624743"
] |
u241159583 | p04033 | python | s972718095 | s110529125 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | a, b = list(map(int, input().split()))
if a > 0 and b > 0: ans = "Positive"
elif a < 0 and b < 0:
if (abs(a-b) + 1) % 2 == 0:
ans = "Positive"
else:
ans = "Negative"
else:
ans = "Zero"
print(ans) | a, b = list(map(int, input().split()))
if a > 0 and b > 0: ans = "Positive"
elif a < 0 and b > 0: ans = "Zero"
else:
if abs(a-b+1) % 2 == 0: ans = "Positive"
else: ans = "Negative"
print(ans) | 10 | 7 | 212 | 195 | a, b = list(map(int, input().split()))
if a > 0 and b > 0:
ans = "Positive"
elif a < 0 and b < 0:
if (abs(a - b) + 1) % 2 == 0:
ans = "Positive"
else:
ans = "Negative"
else:
ans = "Zero"
print(ans)
| a, b = list(map(int, input().split()))
if a > 0 and b > 0:
ans = "Positive"
elif a < 0 and b > 0:
ans = "Zero"
else:
if abs(a - b + 1) % 2 == 0:
ans = "Positive"
else:
ans = "Negative"
print(ans)
| false | 30 | [
"-elif a < 0 and b < 0:",
"- if (abs(a - b) + 1) % 2 == 0:",
"+elif a < 0 and b > 0:",
"+ ans = \"Zero\"",
"+else:",
"+ if abs(a - b + 1) % 2 == 0:",
"-else:",
"- ans = \"Zero\""
] | false | 0.051039 | 0.080495 | 0.634064 | [
"s972718095",
"s110529125"
] |
u691018832 | p02678 | python | s699180353 | s489689567 | 494 | 355 | 34,436 | 40,592 | Accepted | Accepted | 28.14 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def bfs(s):
from collections import deque
check = [-1] * (n + 1)
check[s] = 0
q = deque([s])
while q:
now = q.popleft()
f... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def bfs(s):
from collections import deque
check = [0] * (n + 1)
check[s] = 1
q = deque([s])
while q:
now = q.popleft()
fo... | 30 | 29 | 699 | 696 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
def bfs(s):
from collections import deque
check = [-1] * (n + 1)
check[s] = 0
q = deque([s])
while q:
now = q.popleft()
for next in gra... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**7)
def bfs(s):
from collections import deque
check = [0] * (n + 1)
check[s] = 1
q = deque([s])
while q:
now = q.popleft()
for next in grap... | false | 3.333333 | [
"- check = [-1] * (n + 1)",
"- check[s] = 0",
"+ check = [0] * (n + 1)",
"+ check[s] = 1",
"- if check[next] == -1:",
"- check[next] = now",
"+ if check[next] == 0:",
"+ check[next] = str(now)",
"-for v in bfs(1)[2:]:",
"- print(v)... | false | 0.048671 | 0.044741 | 1.087844 | [
"s699180353",
"s489689567"
] |
u102461423 | p03283 | python | s059578595 | s394327794 | 2,936 | 2,507 | 18,352 | 18,280 | Accepted | Accepted | 14.61 | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N,M,Q = list(map(int,input().split()))
cnt = np.zeros((N+1,N+1),dtype=np.int64)
for _ in range(M):
x,y = list(map(int,input().split()))
cnt[x,y] += 1
cnt = cnt.cumsum(axis=0).cumsum(axis=1)
for _ in range(Q):
p,q = list(map(int,input(... | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N,M,Q = list(map(int,input().split()))
cnt = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
x,y = list(map(int,input().split()))
cnt[x][y] += 1
cnt = np.cumsum(cnt,axis=0).cumsum(axis=1)
for _ in range(Q):
p,q = list(map(int,input... | 20 | 20 | 402 | 403 | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N, M, Q = list(map(int, input().split()))
cnt = np.zeros((N + 1, N + 1), dtype=np.int64)
for _ in range(M):
x, y = list(map(int, input().split()))
cnt[x, y] += 1
cnt = cnt.cumsum(axis=0).cumsum(axis=1)
for _ in range(Q):
p, q = list(map(int, i... | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N, M, Q = list(map(int, input().split()))
cnt = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
cnt[x][y] += 1
cnt = np.cumsum(cnt, axis=0).cumsum(axis=1)
for _ in range(Q):
p, q = list(map(int, ... | false | 0 | [
"-cnt = np.zeros((N + 1, N + 1), dtype=np.int64)",
"+cnt = [[0] * (N + 1) for _ in range(N + 1)]",
"- cnt[x, y] += 1",
"-cnt = cnt.cumsum(axis=0).cumsum(axis=1)",
"+ cnt[x][y] += 1",
"+cnt = np.cumsum(cnt, axis=0).cumsum(axis=1)"
] | false | 0.331507 | 0.769247 | 0.43095 | [
"s059578595",
"s394327794"
] |
u945181840 | p03588 | python | s011281918 | s139220401 | 180 | 71 | 25,940 | 25,940 | Accepted | Accepted | 60.56 | import sys
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = list(sorted(zip(*[iter(AB)] * 2)))
print((sum(AB[-1]))) | import sys
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = max(list(zip(*[iter(AB)] * 2)))
print((sum(AB))) | 6 | 6 | 131 | 118 | import sys
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = list(sorted(zip(*[iter(AB)] * 2)))
print((sum(AB[-1])))
| import sys
read = sys.stdin.read
N, *AB = list(map(int, read().split()))
AB = max(list(zip(*[iter(AB)] * 2)))
print((sum(AB)))
| false | 0 | [
"-AB = list(sorted(zip(*[iter(AB)] * 2)))",
"-print((sum(AB[-1])))",
"+AB = max(list(zip(*[iter(AB)] * 2)))",
"+print((sum(AB)))"
] | false | 0.080953 | 0.043753 | 1.850235 | [
"s011281918",
"s139220401"
] |
u094191970 | p02707 | python | s090782744 | s226802298 | 178 | 157 | 34,040 | 31,096 | Accepted | Accepted | 11.8 | from collections import Counter
n=int(eval(input()))
a=list(map(int,input().split()))
c=Counter(a)
for i in range(1,n+1):
print((c[i])) | from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
n=int(eval(input()))
a=lnii()
ans=[0 for i in range(n)]
for i in a:
i-=1
ans[i]+=1
for i in ans:
print(i) | 9 | 15 | 140 | 242 | from collections import Counter
n = int(eval(input()))
a = list(map(int, input().split()))
c = Counter(a)
for i in range(1, n + 1):
print((c[i]))
| from sys import stdin
nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
n = int(eval(input()))
a = lnii()
ans = [0 for i in range(n)]
for i in a:
i -= 1
ans[i] += 1
for i in ans:
print(i)
| false | 40 | [
"-from collections import Counter",
"+from sys import stdin",
"+nii = lambda: list(map(int, stdin.readline().split()))",
"+lnii = lambda: list(map(int, stdin.readline().split()))",
"-a = list(map(int, input().split()))",
"-c = Counter(a)",
"-for i in range(1, n + 1):",
"- print((c[i]))",
"+a = ln... | false | 0.094286 | 0.044878 | 2.100922 | [
"s090782744",
"s226802298"
] |
u888965338 | p02984 | python | s915742070 | s846845677 | 140 | 126 | 19,144 | 19,644 | Accepted | Accepted | 10 | def mul(inp):
return int(inp * 2)
if __name__ == '__main__':
n = int(eval(input()))
a = list(map(mul, list(map(int, input().split()))))
res = [0] * n
for x in range(0, 1):
res[x] = a[x]
count = 1
for i in range(x + 1, n + x, 2):
mod_i = i % n
... | from functools import reduce
from operator import add
def mul(inp):
return int(inp * 2)
if __name__ == '__main__':
n = int(eval(input()))
a = list(map(mul, list(map(int, input().split()))))
res = [0] * n
minus = reduce(add, [a[i] for i in range(1, n, 2)])
plus = reduce(add, [a[i... | 21 | 18 | 587 | 484 | def mul(inp):
return int(inp * 2)
if __name__ == "__main__":
n = int(eval(input()))
a = list(map(mul, list(map(int, input().split()))))
res = [0] * n
for x in range(0, 1):
res[x] = a[x]
count = 1
for i in range(x + 1, n + x, 2):
mod_i = i % n
res[x] ... | from functools import reduce
from operator import add
def mul(inp):
return int(inp * 2)
if __name__ == "__main__":
n = int(eval(input()))
a = list(map(mul, list(map(int, input().split()))))
res = [0] * n
minus = reduce(add, [a[i] for i in range(1, n, 2)])
plus = reduce(add, [a[i] for i in ra... | false | 14.285714 | [
"+from functools import reduce",
"+from operator import add",
"+",
"+",
"- for x in range(0, 1):",
"- res[x] = a[x]",
"- count = 1",
"- for i in range(x + 1, n + x, 2):",
"- mod_i = i % n",
"- res[x] = res[x] - a[mod_i]",
"- for i in range(x +... | false | 0.034979 | 0.035826 | 0.976352 | [
"s915742070",
"s846845677"
] |
u606045429 | p03018 | python | s852280901 | s171725572 | 49 | 35 | 3,500 | 3,500 | Accepted | Accepted | 28.57 | S = input().replace("BC", "D")
ans = a = 0
for s in S:
if s == "A":
a += 1
elif s == "D":
ans += a
else:
a = 0
print(ans) | def main():
S = input().replace("BC", "D")
ans = a = 0
for s in S:
if s == "A":
a += 1
elif s == "D":
ans += a
else:
a = 0
print(ans)
main() | 12 | 15 | 170 | 233 | S = input().replace("BC", "D")
ans = a = 0
for s in S:
if s == "A":
a += 1
elif s == "D":
ans += a
else:
a = 0
print(ans)
| def main():
S = input().replace("BC", "D")
ans = a = 0
for s in S:
if s == "A":
a += 1
elif s == "D":
ans += a
else:
a = 0
print(ans)
main()
| false | 20 | [
"-S = input().replace(\"BC\", \"D\")",
"-ans = a = 0",
"-for s in S:",
"- if s == \"A\":",
"- a += 1",
"- elif s == \"D\":",
"- ans += a",
"- else:",
"- a = 0",
"-print(ans)",
"+def main():",
"+ S = input().replace(\"BC\", \"D\")",
"+ ans = a = 0",
"+ ... | false | 0.076351 | 0.076965 | 0.992026 | [
"s852280901",
"s171725572"
] |
u896741788 | p03087 | python | s844708148 | s648923219 | 535 | 479 | 18,936 | 11,628 | Accepted | Accepted | 10.47 | n,q=list(map(int,input().split()))
t=eval(input())
a=[0]*n
from collections import defaultdict
tail=defaultdict(int)
for i in range(n-1):
if t[i]=="A"and t[i+1]=="C":
a[i+1]+=1
tail[i]+=1
from itertools import accumulate
a=list(accumulate(a))
for _ in range(q):
l,r=list(map(int,inp... | n,q=list(map(int,input().split()))
t=eval(input())
a=[0]*n
for i in range(n-1):
if t[i]=="A"and t[i+1]=="C":
a[i]=a[i-1]+1
else:a[i]=a[i-1]
for _ in range(q):
l,r=list(map(int,input().split()))
l,r=l-1,r-2
print((a[r]-a[l-1])) | 18 | 11 | 407 | 244 | n, q = list(map(int, input().split()))
t = eval(input())
a = [0] * n
from collections import defaultdict
tail = defaultdict(int)
for i in range(n - 1):
if t[i] == "A" and t[i + 1] == "C":
a[i + 1] += 1
tail[i] += 1
from itertools import accumulate
a = list(accumulate(a))
for _ in range(q):
l, ... | n, q = list(map(int, input().split()))
t = eval(input())
a = [0] * n
for i in range(n - 1):
if t[i] == "A" and t[i + 1] == "C":
a[i] = a[i - 1] + 1
else:
a[i] = a[i - 1]
for _ in range(q):
l, r = list(map(int, input().split()))
l, r = l - 1, r - 2
print((a[r] - a[l - 1]))
| false | 38.888889 | [
"-from collections import defaultdict",
"-",
"-tail = defaultdict(int)",
"- a[i + 1] += 1",
"- tail[i] += 1",
"-from itertools import accumulate",
"-",
"-a = list(accumulate(a))",
"+ a[i] = a[i - 1] + 1",
"+ else:",
"+ a[i] = a[i - 1]",
"- l, r = l - 1, r - 1"... | false | 0.036364 | 0.037647 | 0.965903 | [
"s844708148",
"s648923219"
] |
u620084012 | p03733 | python | s074464206 | s783202661 | 114 | 78 | 26,836 | 25,196 | Accepted | Accepted | 31.58 | N, T = list(map(int,input().split()))
t = list(map(int,input().split()))
ans = 0
s, e = 0, T
for k in range(1,N):
if e < t[k]:
ans += e-s
s = t[k]
e = t[k] + T
else:
e = t[k] + T
ans += e-s
print(ans)
| import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N, T = list(map(int,input().split()))
t = list(map(int,input().split()))
prev = 0
end = 0
ans = 0
for e in t:
if end < e:
ans += end-prev
prev = e
end = e + T
... | 13 | 20 | 247 | 426 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 0
s, e = 0, T
for k in range(1, N):
if e < t[k]:
ans += e - s
s = t[k]
e = t[k] + T
else:
e = t[k] + T
ans += e - s
print(ans)
| import sys
def input():
return sys.stdin.readline()[:-1]
def main():
N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
prev = 0
end = 0
ans = 0
for e in t:
if end < e:
ans += end - prev
prev = e
end = e + T
else... | false | 35 | [
"-N, T = list(map(int, input().split()))",
"-t = list(map(int, input().split()))",
"-ans = 0",
"-s, e = 0, T",
"-for k in range(1, N):",
"- if e < t[k]:",
"- ans += e - s",
"- s = t[k]",
"- e = t[k] + T",
"- else:",
"- e = t[k] + T",
"-ans += e - s",
"-print... | false | 0.046499 | 0.03898 | 1.192891 | [
"s074464206",
"s783202661"
] |
u694649864 | p03160 | python | s068677361 | s968686701 | 271 | 122 | 53,320 | 20,652 | Accepted | Accepted | 54.98 | N = int(eval(input()))
A = list(map(int, input().split()))
#コストの配列 全部無限にしておく
cost = [float("inf") for _ in range(N)]
cost[0] = 0
for i in range(N-1):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(A[i+1] - A[i]))
if(i + 2 < N):
cost[i + 2] = min(cost[i+2], cost[i] + abs(A[i+2] - A[i]))
print((cos... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0;
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(abs(h[i]-h[i-1]) + dp[i-1], abs(h[i] - h[i-2]) + dp[i-2])
print((dp[N-1])) | 10 | 8 | 320 | 219 | N = int(eval(input()))
A = list(map(int, input().split()))
# コストの配列 全部無限にしておく
cost = [float("inf") for _ in range(N)]
cost[0] = 0
for i in range(N - 1):
cost[i + 1] = min(cost[i + 1], cost[i] + abs(A[i + 1] - A[i]))
if i + 2 < N:
cost[i + 2] = min(cost[i + 2], cost[i] + abs(A[i + 2] - A[i]))
print((cost... | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [0] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2])
print((dp[N - 1]))
| false | 20 | [
"-A = list(map(int, input().split()))",
"-# コストの配列 全部無限にしておく",
"-cost = [float(\"inf\") for _ in range(N)]",
"-cost[0] = 0",
"-for i in range(N - 1):",
"- cost[i + 1] = min(cost[i + 1], cost[i] + abs(A[i + 1] - A[i]))",
"- if i + 2 < N:",
"- cost[i + 2] = min(cost[i + 2], cost[i] + abs(A[... | false | 0.03295 | 0.036532 | 0.901933 | [
"s068677361",
"s968686701"
] |
u391731808 | p02972 | python | s882842292 | s103134154 | 1,035 | 879 | 75,356 | 73,832 | Accepted | Accepted | 15.07 | N = int(eval(input()))
*A, = list(map(int,input().split()))
D = [0]*(N+1)
ans = []
for i in range(N,0,-1):
if D[i]%2 != A[i-1]:
ans.append(i)
for j in range(1,int(i**0.5)+1):
if i%j==0:
D[j] += 1
if i//j != j:D[i//j] += 1
print((len(ans)))
prin... | def get_divisor(n):
if n==1:return [1]
a = [1]
b = [n]
for i in range(2,int(n**0.5)+1):
if n%i==0:
a.append(i)
b.append(n//i)
if a[-1]==b[-1]:b.pop()
a.extend(b[::-1])
return a
N = int(eval(input()))
*A, = list(map(int,input().split()))
D = [0]*... | 13 | 23 | 313 | 482 | N = int(eval(input()))
(*A,) = list(map(int, input().split()))
D = [0] * (N + 1)
ans = []
for i in range(N, 0, -1):
if D[i] % 2 != A[i - 1]:
ans.append(i)
for j in range(1, int(i**0.5) + 1):
if i % j == 0:
D[j] += 1
if i // j != j:
D[i ... | def get_divisor(n):
if n == 1:
return [1]
a = [1]
b = [n]
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
a.append(i)
b.append(n // i)
if a[-1] == b[-1]:
b.pop()
a.extend(b[::-1])
return a
N = int(eval(input()))
(*A,) = list(map(int, input... | false | 43.478261 | [
"+def get_divisor(n):",
"+ if n == 1:",
"+ return [1]",
"+ a = [1]",
"+ b = [n]",
"+ for i in range(2, int(n**0.5) + 1):",
"+ if n % i == 0:",
"+ a.append(i)",
"+ b.append(n // i)",
"+ if a[-1] == b[-1]:",
"+ b.pop()",
"+ a.extend(b[... | false | 0.038083 | 0.042489 | 0.896291 | [
"s882842292",
"s103134154"
] |
u389910364 | p03491 | python | s536109238 | s862939324 | 260 | 217 | 37,376 | 34,932 | Accepted | Accepted | 16.54 | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float('inf')
N, L = list(map(int, input().split()))
S = set()
for _ in range(N):
S.add(eval(input()))
# 追加できるのが 01... だけで
# L が 4 とすると
# 01: 次はない
# 010: 011 がある
# 011: 010 がある
# 0100: 011, 0101 がある
# 0101: 011, 0100
#... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353
def make_trie(str_set):
"""
:param collections.Iterable[str] str_set:
:rtype: dict of dict
"""
... | 72 | 74 | 1,387 | 1,551 | import sys
from collections import deque
sys.setrecursionlimit(10000)
INF = float("inf")
N, L = list(map(int, input().split()))
S = set()
for _ in range(N):
S.add(eval(input()))
# 追加できるのが 01... だけで
# L が 4 とすると
# 01: 次はない
# 010: 011 がある
# 011: 010 がある
# 0100: 011, 0101 がある
# 0101: 011, 0100
# 0110: 010, 0111
# 011... | import os
import sys
if os.getenv("LOCAL"):
sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
def make_trie(str_set):
"""
:param collections.Iterable[str] str_set:
:rtype: dict of dict
"""
trie = {}
for s in str_... | false | 2.702703 | [
"+import os",
"-from collections import deque",
"-sys.setrecursionlimit(10000)",
"+if os.getenv(\"LOCAL\"):",
"+ sys.stdin = open(\"_in.txt\", \"r\")",
"+sys.setrecursionlimit(10**9)",
"-N, L = list(map(int, input().split()))",
"-S = set()",
"-for _ in range(N):",
"- S.add(eval(input()))",
... | false | 0.062949 | 0.041265 | 1.525488 | [
"s536109238",
"s862939324"
] |
u077291787 | p03673 | python | s742039415 | s708700793 | 169 | 141 | 25,180 | 24,412 | Accepted | Accepted | 16.57 | # ABC066C - pushpush (ARC077)
def main():
N, *A = list(map(int, open(0).read().split()))
if int(N) & 1:
B = A[::2][::-1] + A[1::2]
else:
B = A[1::2][::-1] + A[::2]
print((*B))
if __name__ == "__main__":
main() | # ABC066C - pushpush (ARC077)
from collections import deque
def main():
N, *A = open(0).read().split()
B, x = deque(), int(N) & 1
for i, a in enumerate(A, start=x):
if i & 1:
B.appendleft(a)
else:
B.append(a)
print((*B))
if __name__ == "__main__... | 12 | 17 | 250 | 332 | # ABC066C - pushpush (ARC077)
def main():
N, *A = list(map(int, open(0).read().split()))
if int(N) & 1:
B = A[::2][::-1] + A[1::2]
else:
B = A[1::2][::-1] + A[::2]
print((*B))
if __name__ == "__main__":
main()
| # ABC066C - pushpush (ARC077)
from collections import deque
def main():
N, *A = open(0).read().split()
B, x = deque(), int(N) & 1
for i, a in enumerate(A, start=x):
if i & 1:
B.appendleft(a)
else:
B.append(a)
print((*B))
if __name__ == "__main__":
main()
| false | 29.411765 | [
"+from collections import deque",
"+",
"+",
"- N, *A = list(map(int, open(0).read().split()))",
"- if int(N) & 1:",
"- B = A[::2][::-1] + A[1::2]",
"- else:",
"- B = A[1::2][::-1] + A[::2]",
"+ N, *A = open(0).read().split()",
"+ B, x = deque(), int(N) & 1",
"+ fo... | false | 0.04859 | 0.033131 | 1.466623 | [
"s742039415",
"s708700793"
] |
u123756661 | p02781 | python | s671986059 | s080442769 | 201 | 181 | 38,384 | 38,384 | Accepted | Accepted | 9.95 | n=int(eval(input()))
k=int(eval(input()))
l=[int(i) for i in "0"+str(n)]
# [0]=n [1]<n
dp=[[[0]*5,[0]*5] for i in "ww"]
dp[0][0][0]=1
for i,j in enumerate(str(n)):
i+=1
for p in range(k+1):
if dp[i%2-1][0][p]:
dp[i%2][0][p+[0,1][l[i]>0]]=1
for q in range(l[i]):
... | n=int(eval(input()))
k=int(eval(input()))
l=[int(i) for i in "0"+str(n)]
# [0]=n [1]<n
dp=[[[0]*5,[0]*5] for i in "ww"]
dp[0][0][0]=1
for i,j in enumerate(str(n),start=1):
for p in range(k+1):
if dp[i%2-1][0][p]:
dp[i%2][0][p+[0,1][l[i]>0]]=1
for q in range(l[i]):
... | 18 | 17 | 571 | 568 | n = int(eval(input()))
k = int(eval(input()))
l = [int(i) for i in "0" + str(n)]
# [0]=n [1]<n
dp = [[[0] * 5, [0] * 5] for i in "ww"]
dp[0][0][0] = 1
for i, j in enumerate(str(n)):
i += 1
for p in range(k + 1):
if dp[i % 2 - 1][0][p]:
dp[i % 2][0][p + [0, 1][l[i] > 0]] = 1
for q... | n = int(eval(input()))
k = int(eval(input()))
l = [int(i) for i in "0" + str(n)]
# [0]=n [1]<n
dp = [[[0] * 5, [0] * 5] for i in "ww"]
dp[0][0][0] = 1
for i, j in enumerate(str(n), start=1):
for p in range(k + 1):
if dp[i % 2 - 1][0][p]:
dp[i % 2][0][p + [0, 1][l[i] > 0]] = 1
for q i... | false | 5.555556 | [
"-for i, j in enumerate(str(n)):",
"- i += 1",
"+for i, j in enumerate(str(n), start=1):"
] | false | 0.047397 | 0.04178 | 1.134433 | [
"s671986059",
"s080442769"
] |
u724687935 | p02839 | python | s825056304 | s261848644 | 1,968 | 675 | 678,024 | 55,516 | Accepted | Accepted | 65.7 | def main():
# import sys
# readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 0
grid = [[0] * W for _ in range(H... | def main():
# import sys
# readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 0
grid = [[0] * W for _ in range(H... | 40 | 46 | 1,230 | 1,349 | def main():
# import sys
# readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 0
grid = [[0] * W for _ in range(H)]
f... | def main():
# import sys
# readline = sys.stdin.readline
# readlines = sys.stdin.readlines
H, W = list(map(int, input().split()))
A = [list(map(int, input().split())) for _ in range(H)]
B = [list(map(int, input().split())) for _ in range(H)]
M = 0
grid = [[0] * W for _ in range(H)]
f... | false | 13.043478 | [
"- L = (H + W) * M",
"- dp = [[[0] * (L + 1) for _ in range(W)] for _ in range(H)]",
"- dp[0][0][grid[0][0]] = 1",
"+ dp = [[0] * W for _ in range(H)]",
"+ dp[0][0] = 1 << grid[0][0]",
"- for k in range(L + 1):",
"- if dp[i][j][k] == 1:",
"- ... | false | 0.038801 | 0.038811 | 0.999734 | [
"s825056304",
"s261848644"
] |
u623231048 | p02679 | python | s057435089 | s788544956 | 498 | 355 | 118,700 | 108,028 | Accepted | Accepted | 28.71 | """
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
mod = 1000000007
ab1 = []
ab2 = []
ab3 = []
ab4 = []
count00 = 0
count01 = 0
count10 = 0
for i in range(n):
if ab[i][0] != 0 and ab[i][1] != 0:
ab1.append(ab[i][0]/ab[i][1])
ab2.append(-ab[i][1]/ab[i][0]... | from math import gcd
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
dict1 = {}
mod = 1000000007
cnt00 = 0
cnt01 = 0
cnt10 = 0
for _ in range(n):
a,b = list(map(int,input().split()))
if a == 0 and b == 0:
cnt00 += 1
... | 147 | 59 | 3,036 | 1,299 | """
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]
mod = 1000000007
ab1 = []
ab2 = []
ab3 = []
ab4 = []
count00 = 0
count01 = 0
count10 = 0
for i in range(n):
if ab[i][0] != 0 and ab[i][1] != 0:
ab1.append(ab[i][0]/ab[i][1])
ab2.append(-ab[i][1]/ab[i][0])
if ab[i][0... | from math import gcd
import sys
input = sys.stdin.readline
def main():
n = int(eval(input()))
dict1 = {}
mod = 1000000007
cnt00 = 0
cnt01 = 0
cnt10 = 0
for _ in range(n):
a, b = list(map(int, input().split()))
if a == 0 and b == 0:
cnt00 += 1
elif a == ... | false | 59.863946 | [
"-\"\"\"",
"-n = int(input())",
"-ab = [list(map(int,input().split())) for _ in range(n)]",
"-mod = 1000000007",
"-ab1 = []",
"-ab2 = []",
"-ab3 = []",
"-ab4 = []",
"-count00 = 0",
"-count01 = 0",
"-count10 = 0",
"-for i in range(n):",
"- if ab[i][0] != 0 and ab[i][1] != 0:",
"- ... | false | 0.142921 | 0.078428 | 1.82232 | [
"s057435089",
"s788544956"
] |
u861141787 | p02683 | python | s550719988 | s209308871 | 88 | 81 | 9,208 | 9,132 | Accepted | Accepted | 7.95 | n, m, x = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
# print(A)
ans = float("inf")
for i in range(2 ** n):
skill = [0] * (m+1)
for j in range(n):
if ((i >> j) & 1):
for k in range(m+1):
skill[k] += ... | n, m, x = list(map(int, input().split()))
A = [[] for _ in range(n)]
C = [0] * n
for i in range(n):
c_as = list(map(int, input().split()))
C[i], A[i] = c_as[0], c_as[1:]
INF = 10 ** 9
ans = INF
for s in range(1<<n):
smart = [0] * m
cost_sum = 0
for i in range(n):
if (s >>... | 30 | 33 | 572 | 623 | n, m, x = list(map(int, input().split()))
A = []
for i in range(n):
A.append(list(map(int, input().split())))
# print(A)
ans = float("inf")
for i in range(2**n):
skill = [0] * (m + 1)
for j in range(n):
if (i >> j) & 1:
for k in range(m + 1):
skill[k] += A[j][k]
# pri... | n, m, x = list(map(int, input().split()))
A = [[] for _ in range(n)]
C = [0] * n
for i in range(n):
c_as = list(map(int, input().split()))
C[i], A[i] = c_as[0], c_as[1:]
INF = 10**9
ans = INF
for s in range(1 << n):
smart = [0] * m
cost_sum = 0
for i in range(n):
if (s >> i) % 2 == 0:
... | false | 9.090909 | [
"-A = []",
"+A = [[] for _ in range(n)]",
"+C = [0] * n",
"- A.append(list(map(int, input().split())))",
"-# print(A)",
"-ans = float(\"inf\")",
"-for i in range(2**n):",
"- skill = [0] * (m + 1)",
"- for j in range(n):",
"- if (i >> j) & 1:",
"- for k in range(m + 1):... | false | 0.049122 | 0.048472 | 1.013427 | [
"s550719988",
"s209308871"
] |
u802234509 | p02792 | python | s920694030 | s862458268 | 565 | 231 | 44,908 | 40,684 | Accepted | Accepted | 59.12 | n = int(eval(input()))
ans=0
for i in range(1,n+1):
a=str(i)[0]
b=str(i)[-1]
for digit in range(1,7):
if digit == 1:
if a==b:
ans+=1
elif b!='0':
mn = int(b+'0'*(digit-2)+a)
mx = int(b+'9'*(digit-2)+a)
if mn>n:
... | n = int(eval(input()))
ans=0
mp=[[0]*10 for _ in range(10)]
for i in range(1,n+1):
a=int(str(i)[0])
b=int(str(i)[-1])
mp[a][b]+=1
for i in range(10):
for j in range(10):
ans+=mp[i][j]*mp[j][i]
print(ans)
| 29 | 18 | 647 | 250 | n = int(eval(input()))
ans = 0
for i in range(1, n + 1):
a = str(i)[0]
b = str(i)[-1]
for digit in range(1, 7):
if digit == 1:
if a == b:
ans += 1
elif b != "0":
mn = int(b + "0" * (digit - 2) + a)
mx = int(b + "9" * (digit - 2) + a)
... | n = int(eval(input()))
ans = 0
mp = [[0] * 10 for _ in range(10)]
for i in range(1, n + 1):
a = int(str(i)[0])
b = int(str(i)[-1])
mp[a][b] += 1
for i in range(10):
for j in range(10):
ans += mp[i][j] * mp[j][i]
print(ans)
| false | 37.931034 | [
"+mp = [[0] * 10 for _ in range(10)]",
"- a = str(i)[0]",
"- b = str(i)[-1]",
"- for digit in range(1, 7):",
"- if digit == 1:",
"- if a == b:",
"- ans += 1",
"- elif b != \"0\":",
"- mn = int(b + \"0\" * (digit - 2) + a)",
"- ... | false | 0.236963 | 0.156947 | 1.509828 | [
"s920694030",
"s862458268"
] |
u002459665 | p02727 | python | s465047671 | s610547495 | 312 | 243 | 23,328 | 23,328 | Accepted | Accepted | 22.12 | 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)
P = P[:X]
Q = Q[:Y]
P.sort()
Q.sort()
R.sort(reverse=True)
p_i = 0
q_i = 0
for ri in R:
if p_i... | 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)
P = P[:X]
Q = Q[:Y]
# P.sort()
# Q.sort()
# R.sort(reverse=True)
S = []
S = P + Q + R
S.sort(reverse=... | 52 | 22 | 1,018 | 378 | 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)
P = P[:X]
Q = Q[:Y]
P.sort()
Q.sort()
R.sort(reverse=True)
p_i = 0
q_i = 0
for ri in R:
if p_i >= len(P) and q_i >= le... | 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)
P = P[:X]
Q = Q[:Y]
# P.sort()
# Q.sort()
# R.sort(reverse=True)
S = []
S = P + Q + R
S.sort(reverse=True)
# print(S)
S2 =... | false | 57.692308 | [
"-P.sort()",
"-Q.sort()",
"-R.sort(reverse=True)",
"-p_i = 0",
"-q_i = 0",
"-for ri in R:",
"- if p_i >= len(P) and q_i >= len(Q):",
"- break",
"- if p_i >= len(P):",
"- if ri >= Q[q_i]:",
"- Q[q_i] = ri",
"- q_i += 1",
"- elif q_i >= len(Q):",
... | false | 0.034496 | 0.036452 | 0.946326 | [
"s465047671",
"s610547495"
] |
u747602774 | p03828 | python | s167424619 | s963322170 | 68 | 28 | 3,064 | 3,316 | Accepted | Accepted | 58.82 | N = int(eval(input()))
if N == 1:
print((1))
exit()
P = 10**9+7
d = {}
for i in range(2,N+1):
k = i
for j in range(2,i):
while i%j == 0:
i = i//j
if j in list(d.keys()):
d[j] += 1
else:
d[j] = 1
if k == i:
... | def prime_factor(n):
ass = []
for i in range(2,int(n**0.5)+1):
while n%i == 0:
ass.append(i)
n = n//i
if n != 1:
ass.append(n)
return ass
n = int(eval(input()))
prime = []
for i in range(2, n+1):
prime = prime + prime_factor(i)
from collec... | 21 | 31 | 387 | 498 | N = int(eval(input()))
if N == 1:
print((1))
exit()
P = 10**9 + 7
d = {}
for i in range(2, N + 1):
k = i
for j in range(2, i):
while i % j == 0:
i = i // j
if j in list(d.keys()):
d[j] += 1
else:
d[j] = 1
if k == i:
... | def prime_factor(n):
ass = []
for i in range(2, int(n**0.5) + 1):
while n % i == 0:
ass.append(i)
n = n // i
if n != 1:
ass.append(n)
return ass
n = int(eval(input()))
prime = []
for i in range(2, n + 1):
prime = prime + prime_factor(i)
from collections impo... | false | 32.258065 | [
"-N = int(eval(input()))",
"-if N == 1:",
"- print((1))",
"- exit()",
"-P = 10**9 + 7",
"-d = {}",
"-for i in range(2, N + 1):",
"- k = i",
"- for j in range(2, i):",
"- while i % j == 0:",
"- i = i // j",
"- if j in list(d.keys()):",
"- ... | false | 0.055032 | 0.044292 | 1.242488 | [
"s167424619",
"s963322170"
] |
u906428167 | p02750 | python | s049947099 | s527802427 | 1,389 | 1,164 | 141,652 | 92,544 | Accepted | Accepted | 16.2 | from bisect import bisect_right
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n, t = list(map(int, input().split()))
shop = []
shop_a0 = []
for i in range(n):
a, b = list(map(int, input().split()))
if a != 0:
shop.append([a, b, a/(b+1)])
else:
shop_... | from bisect import bisect_right
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
n, t = list(map(int, input().split()))
shop = []
shop_a0 = []
for i in range(n):
a, b = list(map(int, input().split()))
if a != 0:
shop.append([a, b, a/(b+1)])
else:
shop_... | 48 | 47 | 995 | 901 | from bisect import bisect_right
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, t = list(map(int, input().split()))
shop = []
shop_a0 = []
for i in range(n):
a, b = list(map(int, input().split()))
if a != 0:
shop.append([a, b, a / (b + 1)])
else:
shop_a0.append(b)
shop... | from bisect import bisect_right
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
n, t = list(map(int, input().split()))
shop = []
shop_a0 = []
for i in range(n):
a, b = list(map(int, input().split()))
if a != 0:
shop.append([a, b, a / (b + 1)])
else:
shop_a0.append(b)
shop... | false | 2.083333 | [
"-dp = [[INF for _ in range(30)] for __ in range(n + 1)]",
"-dp[0][0] = 0",
"+dp = [INF for _ in range(30)]",
"+dp[0] = 0",
"- for j in range(m):",
"- dp[i + 1][j] = min(",
"- dp[i][j], dp[i][j - 1] + 1 + shop[i][0] * (dp[i][j - 1] + 1) + shop[i][1]",
"- )",
"- dp[... | false | 0.05116 | 0.050697 | 1.009131 | [
"s049947099",
"s527802427"
] |
u327532412 | p02659 | python | s634582660 | s395839106 | 22 | 20 | 9,092 | 9,176 | Accepted | Accepted | 9.09 | A, B = input().split()
A = int(A)
B = round(float(B) * 100)
print((A * B // 100))
| A, B = input().split()
A = int(A)
B_int, B_frac = B.split('.')
new_b = int(B_int) * 100 + int(B_frac)
print((A * new_b // 100)) | 4 | 5 | 83 | 129 | A, B = input().split()
A = int(A)
B = round(float(B) * 100)
print((A * B // 100))
| A, B = input().split()
A = int(A)
B_int, B_frac = B.split(".")
new_b = int(B_int) * 100 + int(B_frac)
print((A * new_b // 100))
| false | 20 | [
"-B = round(float(B) * 100)",
"-print((A * B // 100))",
"+B_int, B_frac = B.split(\".\")",
"+new_b = int(B_int) * 100 + int(B_frac)",
"+print((A * new_b // 100))"
] | false | 0.037693 | 0.047707 | 0.790078 | [
"s634582660",
"s395839106"
] |
u723345499 | p02813 | python | s316705130 | s505299590 | 49 | 43 | 3,064 | 3,064 | Accepted | Accepted | 12.24 | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
list_ = list(range(1, n + 1))
for num ,v in enumerate(itertools.permutations(list_, n)):
if p == list(v):
res_p = num + 1
for num ,v in enumerate(itertools.permutations(lis... | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
list_ = list(range(1, n + 1))
for num ,v in enumerate(itertools.permutations(list_, n)):
if p == list(v):
res_p = num + 1
break
for num ,v in enumerate(itertools.permutation... | 19 | 19 | 411 | 429 | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
list_ = list(range(1, n + 1))
for num, v in enumerate(itertools.permutations(list_, n)):
if p == list(v):
res_p = num + 1
for num, v in enumerate(itertools.permutations(list_, n)):
if q == li... | import itertools
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
list_ = list(range(1, n + 1))
for num, v in enumerate(itertools.permutations(list_, n)):
if p == list(v):
res_p = num + 1
break
for num, v in enumerate(itertools.permutations(list_, n)):
... | false | 0 | [
"+ break",
"+ break"
] | false | 0.112811 | 0.043891 | 2.570239 | [
"s316705130",
"s505299590"
] |
u597455618 | p02971 | python | s563109849 | s343725432 | 869 | 538 | 70,360 | 14,112 | Accepted | Accepted | 38.09 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
if a[i] == b[0]:
print((b[1]))
else:
print((b[0])) | def main():
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
main() | 9 | 11 | 169 | 211 | n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = a[:]
b.sort(reverse=True)
for i in range(n):
if a[i] == b[0]:
print((b[1]))
else:
print((b[0]))
| def main():
n = int(eval(input()))
a = [int(eval(input())) for _ in range(n)]
b = sorted(a)
for i in range(n):
if a[i] == b[-1]:
print((b[-2]))
else:
print((b[-1]))
main()
| false | 18.181818 | [
"-n = int(eval(input()))",
"-a = [int(eval(input())) for _ in range(n)]",
"-b = a[:]",
"-b.sort(reverse=True)",
"-for i in range(n):",
"- if a[i] == b[0]:",
"- print((b[1]))",
"- else:",
"- print((b[0]))",
"+def main():",
"+ n = int(eval(input()))",
"+ a = [int(eval(i... | false | 0.038759 | 0.069017 | 0.561588 | [
"s563109849",
"s343725432"
] |
u001024152 | p03111 | python | s281434037 | s917470551 | 324 | 77 | 3,064 | 3,064 | Accepted | Accepted | 76.23 | # 8重for
# N,A,B,C = 5,100,90,80
# L = [98,40,30,21,80]
N,A,B,C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float('inf')
for i1 in range(4):
for i2 in range(4):
for i3 in range(4):
for i4 in range(4):
for i5 in range(4):
... | # DFS
# N,A,B,C = 5,100,90,80
# L = [98,40,30,21,80]
N,A,B,C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float('inf')
def dfs(cur,a,b,c)->int:
if cur==N:
if min(a,b,c)>0: return abs(a-A)+abs(b-B)+abs(c-C)-30
else: return float('inf')
... | 25 | 19 | 1,075 | 573 | # 8重for
# N,A,B,C = 5,100,90,80
# L = [98,40,30,21,80]
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
for i1 in range(4):
for i2 in range(4):
for i3 in range(4):
for i4 in range(4):
for i5 in range(4):
... | # DFS
# N,A,B,C = 5,100,90,80
# L = [98,40,30,21,80]
N, A, B, C = list(map(int, input().split()))
L = [int(eval(input())) for _ in range(N)]
ans = float("inf")
def dfs(cur, a, b, c) -> int:
if cur == N:
if min(a, b, c) > 0:
return abs(a - A) + abs(b - B) + abs(c - C) - 30
else:
... | false | 24 | [
"-# 8重for",
"+# DFS",
"-for i1 in range(4):",
"- for i2 in range(4):",
"- for i3 in range(4):",
"- for i4 in range(4):",
"- for i5 in range(4):",
"- for i6 in range(4):",
"- for i7 in range(4):",
"- ... | false | 0.416535 | 0.067178 | 6.2005 | [
"s281434037",
"s917470551"
] |
u831244171 | p02269 | python | s503175907 | s368159715 | 4,230 | 1,160 | 37,316 | 112,344 | Accepted | Accepted | 72.58 | n = int(eval(input()))
dictionary = {}
for i in range(n):
a = input().split()
if a[0] == "insert":
dictionary[a[1]] = 0
if a[0] == "find":
if a[1] in dictionary:
print("yes")
else:
print("no") | import sys
n = int(eval(input()))
dictionary = {}
k = sys.stdin.readlines()
for j in k:
i = j.split()
if i[0] == "insert":
dictionary[i[1]] = 0
else:
if i[1] in dictionary:
print("yes")
else:
print("no")
| 11 | 17 | 257 | 286 | n = int(eval(input()))
dictionary = {}
for i in range(n):
a = input().split()
if a[0] == "insert":
dictionary[a[1]] = 0
if a[0] == "find":
if a[1] in dictionary:
print("yes")
else:
print("no")
| import sys
n = int(eval(input()))
dictionary = {}
k = sys.stdin.readlines()
for j in k:
i = j.split()
if i[0] == "insert":
dictionary[i[1]] = 0
else:
if i[1] in dictionary:
print("yes")
else:
print("no")
| false | 35.294118 | [
"+import sys",
"+",
"-for i in range(n):",
"- a = input().split()",
"- if a[0] == \"insert\":",
"- dictionary[a[1]] = 0",
"- if a[0] == \"find\":",
"- if a[1] in dictionary:",
"+k = sys.stdin.readlines()",
"+for j in k:",
"+ i = j.split()",
"+ if i[0] == \"insert\"... | false | 0.038024 | 0.037942 | 1.002143 | [
"s503175907",
"s368159715"
] |
u391875425 | p03425 | python | s905503578 | s595002479 | 198 | 180 | 3,884 | 9,776 | Accepted | Accepted | 9.09 | n=int(eval(input()))
s=[]
m=0
a=0
r=0
c=0
h=0
for i in range(n):
b=str(eval(input()))[0]
if b=="M":m+=1
elif b=="A":a+=1
elif b=="R":r+=1
elif b=="C":c+=1
elif b=="H":h+=1
s.append(b)
ans=0
ans+=m*a*r
ans+=m*a*c
ans+=m*a*h
ans+=m*r*c
ans+=m*r*h
ans+=m*c*h
ans+=a*r*c
ans+=a*r*h
... | import itertools
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
caps = ['M', 'A', 'R', 'C', 'H']
a = [0] * 5
ans = 0
for s in S:
if s[0] in caps:
a[caps.index(s[0])] += 1
c = list(itertools.combinations((0, 1, 2, 3, 4), 3))
for i in range(len(c)):
ans += a[c[i][0]] * a[c[i][1]] ... | 29 | 13 | 347 | 332 | n = int(eval(input()))
s = []
m = 0
a = 0
r = 0
c = 0
h = 0
for i in range(n):
b = str(eval(input()))[0]
if b == "M":
m += 1
elif b == "A":
a += 1
elif b == "R":
r += 1
elif b == "C":
c += 1
elif b == "H":
h += 1
s.append(b)
ans = 0
ans += m * a * r
an... | import itertools
N = int(eval(input()))
S = [eval(input()) for _ in range(N)]
caps = ["M", "A", "R", "C", "H"]
a = [0] * 5
ans = 0
for s in S:
if s[0] in caps:
a[caps.index(s[0])] += 1
c = list(itertools.combinations((0, 1, 2, 3, 4), 3))
for i in range(len(c)):
ans += a[c[i][0]] * a[c[i][1]] * a[c[i][2... | false | 55.172414 | [
"-n = int(eval(input()))",
"-s = []",
"-m = 0",
"-a = 0",
"-r = 0",
"-c = 0",
"-h = 0",
"-for i in range(n):",
"- b = str(eval(input()))[0]",
"- if b == \"M\":",
"- m += 1",
"- elif b == \"A\":",
"- a += 1",
"- elif b == \"R\":",
"- r += 1",
"- elif ... | false | 0.047174 | 0.036358 | 1.297485 | [
"s905503578",
"s595002479"
] |
u573970531 | p03078 | python | s260924858 | s280084791 | 1,102 | 759 | 272,408 | 143,844 | Accepted | Accepted | 31.13 | import itertools
x,y,z,k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
del a[min(k,x):]
del b[min(k,y):]
del c[min(k,z):]
ab = [i + j for (i, j... | x,y,z,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
li=[]
for i in a:
for j in b:
li.append(i+j)
li.sort(reverse=True)
ansli=[]
for i in c:
for j in range(min(k,len(li))):
ansli.append(i+li[j])
ansli.sort... | 24 | 19 | 534 | 376 | import itertools
x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
del a[min(k, x) :]
del b[min(k, y) :]
del c[min(k, z) :]
ab = [i + j for (i, j) in lis... | x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
li = []
for i in a:
for j in b:
li.append(i + j)
li.sort(reverse=True)
ansli = []
for i in c:
for j in range(min(k, len(li))):
ansli.append(i +... | false | 20.833333 | [
"-import itertools",
"-",
"-a.sort(reverse=True)",
"-b.sort(reverse=True)",
"-c.sort(reverse=True)",
"-del a[min(k, x) :]",
"-del b[min(k, y) :]",
"-del c[min(k, z) :]",
"-ab = [i + j for (i, j) in list(itertools.product(a, b))]",
"-ab.sort(reverse=True)",
"-del ab[min(k, x * y) :]",
"-abc = [... | false | 0.044359 | 0.094606 | 0.468878 | [
"s260924858",
"s280084791"
] |
u120691615 | p03264 | python | s442808553 | s638574498 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | n = int(eval(input()))
if n % 2 == 0:
ans = int((n // 2) ** 2)
else:
ans = int(n // 2) * (n // 2 + 1)
print(ans) | n = int(eval(input()))
a = (n + 1) // 2
b = n // 2
print((a * b))
| 6 | 4 | 119 | 61 | n = int(eval(input()))
if n % 2 == 0:
ans = int((n // 2) ** 2)
else:
ans = int(n // 2) * (n // 2 + 1)
print(ans)
| n = int(eval(input()))
a = (n + 1) // 2
b = n // 2
print((a * b))
| false | 33.333333 | [
"-if n % 2 == 0:",
"- ans = int((n // 2) ** 2)",
"-else:",
"- ans = int(n // 2) * (n // 2 + 1)",
"-print(ans)",
"+a = (n + 1) // 2",
"+b = n // 2",
"+print((a * b))"
] | false | 0.045157 | 0.043463 | 1.038975 | [
"s442808553",
"s638574498"
] |
u150984829 | p00040 | python | s645177884 | s159316042 | 240 | 30 | 5,600 | 5,600 | Accepted | Accepted | 87.5 | z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
for i in range(1,26,2):
for j in range(26):
if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
for _ in[0]*int(eval(input())):
s=eval(input())
a=''.join(e(c,*f())for c in z)
t=str.maketra... | z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
for i in range(1,26,2):
for j in range(26):
if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
for _ in[0]*int(eval(input())):
s=eval(input())
k=f()
a=''.join(e(c,*k)for c in z)
t=str.m... | 11 | 12 | 340 | 346 | z = "abcdefghijklmnopqrstuvwxyz"
e = lambda x, i, j: z[(z.index(x) * i + j) % 26]
def f():
for i in range(1, 26, 2):
for j in range(26):
if (
"".join(e(c, i, j) for c in "that") in s
or "".join(e(c, i, j) for c in "this") in s
):
retu... | z = "abcdefghijklmnopqrstuvwxyz"
e = lambda x, i, j: z[(z.index(x) * i + j) % 26]
def f():
for i in range(1, 26, 2):
for j in range(26):
if (
"".join(e(c, i, j) for c in "that") in s
or "".join(e(c, i, j) for c in "this") in s
):
retu... | false | 8.333333 | [
"- a = \"\".join(e(c, *f()) for c in z)",
"+ k = f()",
"+ a = \"\".join(e(c, *k) for c in z)"
] | false | 0.042524 | 0.070809 | 0.600541 | [
"s645177884",
"s159316042"
] |
u970197315 | p03457 | python | s281353701 | s335116642 | 580 | 428 | 38,344 | 19,572 | Accepted | Accepted | 26.21 | # ABC086 C - Traveling
import numpy as np
n = int(eval(input()))
l = [list(map(int,input().split())) for _ in range(n)]
if n == 1:
if l[0][0] >= l[0][1]+l[0][2]:
if l[0][0]%2 == (l[0][1]+l[0][2])%2:
pass
else:
print('No')
exit()
else:
... | n=int(eval(input()))
l=[]
for i in range(n):
t,x,y=list(map(int,input().split()))
l.append([t,x,y])
if n==1:
d=l[0][1]+l[0][2]
tt=l[0][0]
if tt%2==1:
if d<=tt and d%2==1:
print('Yes')
exit()
else:
print('No')
exit()
... | 29 | 40 | 645 | 835 | # ABC086 C - Traveling
import numpy as np
n = int(eval(input()))
l = [list(map(int, input().split())) for _ in range(n)]
if n == 1:
if l[0][0] >= l[0][1] + l[0][2]:
if l[0][0] % 2 == (l[0][1] + l[0][2]) % 2:
pass
else:
print("No")
exit()
else:
print("... | n = int(eval(input()))
l = []
for i in range(n):
t, x, y = list(map(int, input().split()))
l.append([t, x, y])
if n == 1:
d = l[0][1] + l[0][2]
tt = l[0][0]
if tt % 2 == 1:
if d <= tt and d % 2 == 1:
print("Yes")
exit()
else:
print("No")
... | false | 27.5 | [
"-# ABC086 C - Traveling",
"-import numpy as np",
"-",
"-l = [list(map(int, input().split())) for _ in range(n)]",
"+l = []",
"+for i in range(n):",
"+ t, x, y = list(map(int, input().split()))",
"+ l.append([t, x, y])",
"- if l[0][0] >= l[0][1] + l[0][2]:",
"- if l[0][0] % 2 == (l... | false | 0.038576 | 0.043998 | 0.876766 | [
"s281353701",
"s335116642"
] |
u493520238 | p02873 | python | s019719731 | s794598658 | 267 | 92 | 23,836 | 85,392 | Accepted | Accepted | 65.54 |
import math
def main():
s = str(eval(input()))
first = s[0]
cnt_l = []
tmp_cnt = 1
prev_s = first
for curr_s in s[1:]:
if prev_s != curr_s:
cnt_l.append(tmp_cnt)
tmp_cnt = 1
else:
tmp_cnt+=1
prev_s = curr_s
cnt_l.a... | s = eval(input())
s += 'a'
cnts = []
prev = s[0]
cnt = 1
for i,si in enumerate(s[1:]):
if prev == si:
cnt += 1
else:
cnts.append(cnt)
cnt = 1
prev = si
ans = 0
c_num = 0
if s[0] == '<':
for i,c in enumerate(cnts):
if i%2 == 0:
ans += c*(c-... | 62 | 44 | 1,521 | 854 | import math
def main():
s = str(eval(input()))
first = s[0]
cnt_l = []
tmp_cnt = 1
prev_s = first
for curr_s in s[1:]:
if prev_s != curr_s:
cnt_l.append(tmp_cnt)
tmp_cnt = 1
else:
tmp_cnt += 1
prev_s = curr_s
cnt_l.append(tmp_cnt)... | s = eval(input())
s += "a"
cnts = []
prev = s[0]
cnt = 1
for i, si in enumerate(s[1:]):
if prev == si:
cnt += 1
else:
cnts.append(cnt)
cnt = 1
prev = si
ans = 0
c_num = 0
if s[0] == "<":
for i, c in enumerate(cnts):
if i % 2 == 0:
ans += c * (c - 1) // 2
... | false | 29.032258 | [
"-import math",
"-",
"-",
"-def main():",
"- s = str(eval(input()))",
"- first = s[0]",
"- cnt_l = []",
"- tmp_cnt = 1",
"- prev_s = first",
"- for curr_s in s[1:]:",
"- if prev_s != curr_s:",
"- cnt_l.append(tmp_cnt)",
"- tmp_cnt = 1",
"+s = ... | false | 0.046342 | 0.037808 | 1.225725 | [
"s019719731",
"s794598658"
] |
u189023301 | p02954 | python | s303195291 | s328095245 | 188 | 133 | 31,328 | 6,400 | Accepted | Accepted | 29.26 | s = eval(input())
n = len(s)
tp = []
rl = [1]
for i in range(1, n):
if s[i] == s[i - 1]:
rl[-1] += 1
elif s[i - 1] == "R" and s[i] == "L":
tp.append((i - 1, i))
rl.append(1)
else:
rl.append(1)
rll = tuple(zip(rl[::2], rl[1::2]))
#print(rll,tp)
inl = []
for ... | s = eval(input())
n = len(s)
chd = [0] * n
cnt = 0
for i in range(n - 1):
if s[i] == "R":
cnt += 1
if s[i + 1] == "L":
chd[i] += (cnt+1)//2
chd[i + 1] += cnt//2
cnt = 0
for i in range(n - 1, 0, -1):
if s[i] == "L":
cnt += 1
if... | 37 | 22 | 853 | 436 | s = eval(input())
n = len(s)
tp = []
rl = [1]
for i in range(1, n):
if s[i] == s[i - 1]:
rl[-1] += 1
elif s[i - 1] == "R" and s[i] == "L":
tp.append((i - 1, i))
rl.append(1)
else:
rl.append(1)
rll = tuple(zip(rl[::2], rl[1::2]))
# print(rll,tp)
inl = []
for i, j in rll:
i... | s = eval(input())
n = len(s)
chd = [0] * n
cnt = 0
for i in range(n - 1):
if s[i] == "R":
cnt += 1
if s[i + 1] == "L":
chd[i] += (cnt + 1) // 2
chd[i + 1] += cnt // 2
cnt = 0
for i in range(n - 1, 0, -1):
if s[i] == "L":
cnt += 1
if s[i - 1] ==... | false | 40.540541 | [
"-tp = []",
"-rl = [1]",
"-for i in range(1, n):",
"- if s[i] == s[i - 1]:",
"- rl[-1] += 1",
"- elif s[i - 1] == \"R\" and s[i] == \"L\":",
"- tp.append((i - 1, i))",
"- rl.append(1)",
"- else:",
"- rl.append(1)",
"-rll = tuple(zip(rl[::2], rl[1::2]))",
"-... | false | 0.036089 | 0.036737 | 0.982364 | [
"s303195291",
"s328095245"
] |
u219417113 | p03546 | python | s521811573 | s571586987 | 198 | 37 | 40,284 | 3,316 | Accepted | Accepted | 81.31 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
wall = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
... | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for h in range(H):
... | 14 | 16 | 415 | 417 | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
wall = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for i in range(H):
for j in... | H, W = list(map(int, input().split()))
C = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]
for k in range(10):
for i in range(10):
for j in range(10):
C[i][j] = min(C[i][j], C[i][k] + C[k][j])
ans = 0
for h in range(H):
for w in ra... | false | 12.5 | [
"-wall = [list(map(int, input().split())) for _ in range(H)]",
"+A = [list(map(int, input().split())) for _ in range(H)]",
"-for i in range(H):",
"- for j in range(W):",
"- if wall[i][j] != -1:",
"- ans += C[wall[i][j]][1]",
"+for h in range(H):",
"+ for w in range(W):",
"+ ... | false | 0.06766 | 0.054041 | 1.252017 | [
"s521811573",
"s571586987"
] |
u698176039 | p03107 | python | s471731518 | s504482146 | 196 | 55 | 3,396 | 3,956 | Accepted | Accepted | 71.94 | S = eval(input())
N=len(S)
S2 = S[0]
count = 0
for i in range(1,N):
S2 += S[i]
while len(S2) > 1 and S2[len(S2)-1] != S2[len(S2)-2] :
S2 = S2[:len(S2)-2]
count += 2
print(count) |
S = list(eval(input()))
N = len(S)
num = [0,0]
for s in S:
num[int(s)] += 1
print((N-(max(num)-min(num)))) | 12 | 8 | 216 | 115 | S = eval(input())
N = len(S)
S2 = S[0]
count = 0
for i in range(1, N):
S2 += S[i]
while len(S2) > 1 and S2[len(S2) - 1] != S2[len(S2) - 2]:
S2 = S2[: len(S2) - 2]
count += 2
print(count)
| S = list(eval(input()))
N = len(S)
num = [0, 0]
for s in S:
num[int(s)] += 1
print((N - (max(num) - min(num))))
| false | 33.333333 | [
"-S = eval(input())",
"+S = list(eval(input()))",
"-S2 = S[0]",
"-count = 0",
"-for i in range(1, N):",
"- S2 += S[i]",
"- while len(S2) > 1 and S2[len(S2) - 1] != S2[len(S2) - 2]:",
"- S2 = S2[: len(S2) - 2]",
"- count += 2",
"-print(count)",
"+num = [0, 0]",
"+for s in S:... | false | 0.052856 | 0.033418 | 1.581658 | [
"s471731518",
"s504482146"
] |
u697696097 | p03964 | python | s907166507 | s606078676 | 46 | 20 | 5,628 | 3,064 | Accepted | Accepted | 56.52 | ### ----------------
### ここから
### ----------------
import sys
from io import StringIO
import unittest
def yn(b):
print(("Yes" if b==1 else "No"))
return
def resolve():
readline=sys.stdin.readline
#a,b,c=map(int, readline().rstrip().split())
#arr=list(map(int, readline().rstrip().... | import sys
def resolve():
readline=sys.stdin.readline
n=int(readline())
a,b=list(map(int, readline().rstrip().split()))
for _ in range(n-1):
x,y=list(map(int, readline().rstrip().split()))
start=max(a//x,b//y)
for z in range(start,start+1000):
if x*z>=a a... | 43 | 21 | 873 | 464 | ### ----------------
### ここから
### ----------------
import sys
from io import StringIO
import unittest
def yn(b):
print(("Yes" if b == 1 else "No"))
return
def resolve():
readline = sys.stdin.readline
# a,b,c=map(int, readline().rstrip().split())
# arr=list(map(int, readline().rstrip().split()))
... | import sys
def resolve():
readline = sys.stdin.readline
n = int(readline())
a, b = list(map(int, readline().rstrip().split()))
for _ in range(n - 1):
x, y = list(map(int, readline().rstrip().split()))
start = max(a // x, b // y)
for z in range(start, start + 1000):
... | false | 51.162791 | [
"-### ここから",
"-from io import StringIO",
"-import unittest",
"-",
"-",
"-def yn(b):",
"- print((\"Yes\" if b == 1 else \"No\"))",
"- return",
"- # a,b,c=map(int, readline().rstrip().split())",
"- # arr=list(map(int, readline().rstrip().split()))",
"- for i in range(n):",
"+ a... | false | 0.053341 | 0.036767 | 1.450781 | [
"s907166507",
"s606078676"
] |
u326609687 | p03096 | python | s914136971 | s255820377 | 614 | 290 | 31,200 | 29,804 | Accepted | Accepted | 52.77 | import sys
from collections import defaultdict
N = int(eval(input()))
C = [0]
for _ in range(N):
c = int(sys.stdin.readline())
if C[-1] == c:
continue
else:
C.append(c)
ans = 1
dic = defaultdict(lambda: 0)
for c in C:
a = dic[c]
dic[c] += ans
ans += a
print(... | import sys
from collections import defaultdict
N = int(eval(input()))
C = [0]
for _ in range(N):
c = int(sys.stdin.readline())
if C[-1] == c:
continue
else:
C.append(c)
ans = 1
dic = defaultdict(lambda: 0)
mod = 10 ** 9 + 7
for c in C:
a = dic[c]
dic[c] += ans
... | 20 | 21 | 334 | 357 | import sys
from collections import defaultdict
N = int(eval(input()))
C = [0]
for _ in range(N):
c = int(sys.stdin.readline())
if C[-1] == c:
continue
else:
C.append(c)
ans = 1
dic = defaultdict(lambda: 0)
for c in C:
a = dic[c]
dic[c] += ans
ans += a
print((ans % (10**9 + 7)))
| import sys
from collections import defaultdict
N = int(eval(input()))
C = [0]
for _ in range(N):
c = int(sys.stdin.readline())
if C[-1] == c:
continue
else:
C.append(c)
ans = 1
dic = defaultdict(lambda: 0)
mod = 10**9 + 7
for c in C:
a = dic[c]
dic[c] += ans
ans = (ans + a) % mo... | false | 4.761905 | [
"+mod = 10**9 + 7",
"- ans += a",
"-print((ans % (10**9 + 7)))",
"+ ans = (ans + a) % mod",
"+print((ans % mod))"
] | false | 0.077981 | 0.045458 | 1.715464 | [
"s914136971",
"s255820377"
] |
u186838327 | p03951 | python | s809673649 | s763721445 | 64 | 28 | 61,800 | 9,128 | Accepted | Accepted | 56.25 | n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(n):
#print(s[i:], t[:n-1-i+1])
if s[i:] == t[:n-1-i+1]:
break
else:
i = n
#pass
ans = i*2+(n-i)
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(1, n):
s_ = s[i:n]
t_ = t[0:n-i]
if s_ == t_:
ans = s[:i]+t
print((len(ans)))
exit()
else:
print((2*n))
| 17 | 17 | 250 | 259 | n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(n):
# print(s[i:], t[:n-1-i+1])
if s[i:] == t[: n - 1 - i + 1]:
break
else:
i = n
# pass
ans = i * 2 + (n - i)
print(ans)
| n = int(eval(input()))
s = str(eval(input()))
t = str(eval(input()))
if s == t:
print(n)
exit()
for i in range(1, n):
s_ = s[i:n]
t_ = t[0 : n - i]
if s_ == t_:
ans = s[:i] + t
print((len(ans)))
exit()
else:
print((2 * n))
| false | 0 | [
"-for i in range(n):",
"- # print(s[i:], t[:n-1-i+1])",
"- if s[i:] == t[: n - 1 - i + 1]:",
"- break",
"+for i in range(1, n):",
"+ s_ = s[i:n]",
"+ t_ = t[0 : n - i]",
"+ if s_ == t_:",
"+ ans = s[:i] + t",
"+ print((len(ans)))",
"+ exit()",
"- i... | false | 0.073778 | 0.036512 | 2.02066 | [
"s809673649",
"s763721445"
] |
u671446913 | p02696 | python | s792841162 | s186695788 | 21 | 18 | 9,160 | 9,128 | Accepted | Accepted | 14.29 | a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
ans = int(a * x / b)
#if a == 1 or b == 1 or b == n:
# print(0)
#else:
print(ans)
| a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
print((int(a * x / b)))
| 9 | 4 | 149 | 80 | a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
ans = int(a * x / b)
# if a == 1 or b == 1 or b == n:
# print(0)
# else:
print(ans)
| a, b, n = list(map(int, input().split()))
x = min(b - 1, n)
print((int(a * x / b)))
| false | 55.555556 | [
"-ans = int(a * x / b)",
"-# if a == 1 or b == 1 or b == n:",
"-# print(0)",
"-# else:",
"-print(ans)",
"+print((int(a * x / b)))"
] | false | 0.008538 | 0.035451 | 0.240838 | [
"s792841162",
"s186695788"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.