user_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 1
value | submission_id_v0 stringlengths 10 10 | submission_id_v1 stringlengths 10 10 | cpu_time_v0 int64 10 38.3k | cpu_time_v1 int64 0 24.7k | memory_v0 int64 2.57k 1.02M | memory_v1 int64 2.57k 869k | status_v0 stringclasses 1
value | status_v1 stringclasses 1
value | improvement_frac float64 7.51 100 | input stringlengths 20 4.55k | target stringlengths 17 3.34k | code_v0_loc int64 1 148 | code_v1_loc int64 1 184 | code_v0_num_chars int64 13 4.55k | code_v1_num_chars int64 14 3.34k | code_v0_no_empty_lines stringlengths 21 6.88k | code_v1_no_empty_lines stringlengths 20 4.93k | code_same bool 1
class | relative_loc_diff_percent float64 0 79.8 | diff list | diff_only_import_comment bool 1
class | measured_runtime_v0 float64 0.01 4.45 | measured_runtime_v1 float64 0.01 4.31 | runtime_lift float64 0 359 | key list |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u123756661 | p03533 | python | s052438311 | s186822196 | 190 | 172 | 38,384 | 38,256 | Accepted | Accepted | 9.47 | w=["AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR","KIHBARA", "KIHABRA","KIHABAR","AKIHBRA","AKIHBAR","AKIHABR","KIHBRA","KIHBAR","KIHABR","AKIHBR" ,"KIHBR"]
s=eval(input())
ans=0
if s in w: ans=1
print((["NO","YES"][ans]))
| w=[ "AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR","KIHBARA","KIHABRA","KIHABAR","AKIHBRA","AKIHBAR","AKIHABR","KIHBRA","KIHBAR","KIHABR","AKIHBR","KIHBR"]
print((["NO","YES"][eval(input()) in w])) | 5 | 2 | 228 | 199 | w = [
"AKIHABARA",
"KIHABARA",
"AKIHBARA",
"AKIHABRA",
"AKIHABAR",
"KIHBARA",
"KIHABRA",
"KIHABAR",
"AKIHBRA",
"AKIHBAR",
"AKIHABR",
"KIHBRA",
"KIHBAR",
"KIHABR",
"AKIHBR",
"KIHBR",
]
s = eval(input())
ans = 0
if s in w:
ans = 1
print((["NO", "YES"][an... | w = [
"AKIHABARA",
"KIHABARA",
"AKIHBARA",
"AKIHABRA",
"AKIHABAR",
"KIHBARA",
"KIHABRA",
"KIHABAR",
"AKIHBRA",
"AKIHBAR",
"AKIHABR",
"KIHBRA",
"KIHBAR",
"KIHABR",
"AKIHBR",
"KIHBR",
]
print((["NO", "YES"][eval(input()) in w]))
| false | 60 | [
"-s = eval(input())",
"-ans = 0",
"-if s in w:",
"- ans = 1",
"-print(([\"NO\", \"YES\"][ans]))",
"+print(([\"NO\", \"YES\"][eval(input()) in w]))"
] | false | 0.04255 | 0.108758 | 0.391234 | [
"s052438311",
"s186822196"
] |
u768199898 | p02576 | python | s157007359 | s469163816 | 31 | 28 | 9,088 | 9,044 | Accepted | Accepted | 9.68 | N,X,T = list(map(int,input().split()))
if N %X == 0:
print((N//X * T))
else:
print(((N // X + 1)*T)) | N,X,T = list(map(int,input().split()))
num = N//X
mode = N%X
if mode == 0:
print((num * T))
else:
print(((num + 1)*T)) | 5 | 7 | 98 | 123 | N, X, T = list(map(int, input().split()))
if N % X == 0:
print((N // X * T))
else:
print(((N // X + 1) * T))
| N, X, T = list(map(int, input().split()))
num = N // X
mode = N % X
if mode == 0:
print((num * T))
else:
print(((num + 1) * T))
| false | 28.571429 | [
"-if N % X == 0:",
"- print((N // X * T))",
"+num = N // X",
"+mode = N % X",
"+if mode == 0:",
"+ print((num * T))",
"- print(((N // X + 1) * T))",
"+ print(((num + 1) * T))"
] | false | 0.049104 | 0.048425 | 1.014023 | [
"s157007359",
"s469163816"
] |
u761320129 | p03593 | python | s422950993 | s470178868 | 24 | 22 | 3,380 | 3,316 | Accepted | Accepted | 8.33 | H,W = list(map(int,input().split()))
A = [eval(input()) for i in range(H)]
from collections import Counter
ctr = Counter()
for row in A:
ctr.update(row)
if H%2==0 and W%2==0:
print(('Yes' if all(v%4==0 for v in list(ctr.values())) else 'No'))
elif H%2 and W%2:
odd = 0
for k,v in list(ctr.ite... | from collections import Counter
H,W = list(map(int,input().split()))
A = [eval(input()) for i in range(H)]
ctr = Counter()
for row in A:
ctr.update(row)
if H%2==0 and W%2==0:
print(('Yes' if all(v%4==0 for v in list(ctr.values())) else 'No'))
exit()
if H%2 and W%2:
for k,v in list(ctr.item... | 32 | 35 | 783 | 664 | H, W = list(map(int, input().split()))
A = [eval(input()) for i in range(H)]
from collections import Counter
ctr = Counter()
for row in A:
ctr.update(row)
if H % 2 == 0 and W % 2 == 0:
print(("Yes" if all(v % 4 == 0 for v in list(ctr.values())) else "No"))
elif H % 2 and W % 2:
odd = 0
for k, v in list... | from collections import Counter
H, W = list(map(int, input().split()))
A = [eval(input()) for i in range(H)]
ctr = Counter()
for row in A:
ctr.update(row)
if H % 2 == 0 and W % 2 == 0:
print(("Yes" if all(v % 4 == 0 for v in list(ctr.values())) else "No"))
exit()
if H % 2 and W % 2:
for k, v in list(ct... | false | 8.571429 | [
"+from collections import Counter",
"+",
"-from collections import Counter",
"-",
"-elif H % 2 and W % 2:",
"- odd = 0",
"+ exit()",
"+if H % 2 and W % 2:",
"- odd += 1",
"- if odd != 1:",
"+ break",
"+if any(v % 2 for v in list(ctr.values())):",
"+ print(\"... | false | 0.039856 | 0.10557 | 0.377532 | [
"s422950993",
"s470178868"
] |
u351586819 | p03220 | python | s908304110 | s181412062 | 41 | 18 | 3,064 | 3,060 | Accepted | Accepted | 56.1 | N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
AveT = []
diff = []
for i in range(N):
AveT.append(T - H[i]*0.006)
diff.append(abs(AveT[i] - A))
for i in range(N):
if diff[i] == min(diff):
place = i + 1
print(place) | N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
AveT = [T - h*0.006 for h in H]
diff = [abs(Ave_t - A) for Ave_t in AveT]
print((diff.index(min(diff)) + 1)) | 15 | 7 | 281 | 205 | N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
AveT = []
diff = []
for i in range(N):
AveT.append(T - H[i] * 0.006)
diff.append(abs(AveT[i] - A))
for i in range(N):
if diff[i] == min(diff):
place = i + 1
print(place)
| N = int(eval(input()))
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
AveT = [T - h * 0.006 for h in H]
diff = [abs(Ave_t - A) for Ave_t in AveT]
print((diff.index(min(diff)) + 1))
| false | 53.333333 | [
"-AveT = []",
"-diff = []",
"-for i in range(N):",
"- AveT.append(T - H[i] * 0.006)",
"- diff.append(abs(AveT[i] - A))",
"-for i in range(N):",
"- if diff[i] == min(diff):",
"- place = i + 1",
"-print(place)",
"+AveT = [T - h * 0.006 for h in H]",
"+diff = [abs(Ave_t - A) for Ave... | false | 0.098055 | 0.122886 | 0.797934 | [
"s908304110",
"s181412062"
] |
u677121387 | p02627 | python | s597705703 | s746831166 | 29 | 26 | 9,020 | 8,800 | Accepted | Accepted | 10.34 | s = eval(input())
if 0 <= ord(s) - ord("a") <= 25:
print("a")
else:
print("A") | a = eval(input())
print(("A" if a.isupper() else "a")) | 5 | 2 | 84 | 47 | s = eval(input())
if 0 <= ord(s) - ord("a") <= 25:
print("a")
else:
print("A")
| a = eval(input())
print(("A" if a.isupper() else "a"))
| false | 60 | [
"-s = eval(input())",
"-if 0 <= ord(s) - ord(\"a\") <= 25:",
"- print(\"a\")",
"-else:",
"- print(\"A\")",
"+a = eval(input())",
"+print((\"A\" if a.isupper() else \"a\"))"
] | false | 0.037987 | 0.040942 | 0.927816 | [
"s597705703",
"s746831166"
] |
u888092736 | p03162 | python | s931372853 | s895223117 | 1,052 | 955 | 47,328 | 47,324 | Accepted | Accepted | 9.22 | n = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(n)]
# i日目にjを選択した後の幸福度 dp[i][j]
dp = [[0 for j in range(3)] for i in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][k] = max(... | import sys
def input():
return sys.stdin.readline().strip()
n = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(n)]
# i日目にjを選択した後の幸福度 dp[i][j]
dp = [[0 for j in range(3)] for i in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
... | 14 | 21 | 372 | 447 | n = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(n)]
# i日目にjを選択した後の幸福度 dp[i][j]
dp = [[0 for j in range(3)] for i in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i + 1][k] = max(dp[i + 1][k],... | import sys
def input():
return sys.stdin.readline().strip()
n = int(eval(input()))
ABC = [list(map(int, input().split())) for i in range(n)]
# i日目にjを選択した後の幸福度 dp[i][j]
dp = [[0 for j in range(3)] for i in range(n + 1)]
for i in range(n):
for j in range(3):
for k in range(3):
if j == k:
... | false | 33.333333 | [
"+import sys",
"+",
"+",
"+def input():",
"+ return sys.stdin.readline().strip()",
"+",
"+"
] | false | 0.047499 | 0.041085 | 1.156115 | [
"s931372853",
"s895223117"
] |
u078349616 | p03212 | python | s086539921 | s792476006 | 99 | 89 | 2,940 | 3,060 | Accepted | Accepted | 10.1 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
else:
if all(s.count(c) > 0 for c in "753"):
cnt = 1
else:
cnt = 0
for c in "753":
cnt += dfs(s+c)
return cnt
print((dfs("0"))) | N = int(eval(input()))
ans = 0
def dfs(n):
global ans
if n > N:
return
else:
if all(str(n).count(c) > 0 for c in "357"):
ans += 1
dfs(10*n + 3)
dfs(10*n + 5)
dfs(10*n + 7)
dfs(0)
print(ans) | 13 | 16 | 232 | 232 | N = int(eval(input()))
def dfs(s):
if int(s) > N:
return 0
else:
if all(s.count(c) > 0 for c in "753"):
cnt = 1
else:
cnt = 0
for c in "753":
cnt += dfs(s + c)
return cnt
print((dfs("0")))
| N = int(eval(input()))
ans = 0
def dfs(n):
global ans
if n > N:
return
else:
if all(str(n).count(c) > 0 for c in "357"):
ans += 1
dfs(10 * n + 3)
dfs(10 * n + 5)
dfs(10 * n + 7)
dfs(0)
print(ans)
| false | 18.75 | [
"+ans = 0",
"-def dfs(s):",
"- if int(s) > N:",
"- return 0",
"+def dfs(n):",
"+ global ans",
"+ if n > N:",
"+ return",
"- if all(s.count(c) > 0 for c in \"753\"):",
"- cnt = 1",
"- else:",
"- cnt = 0",
"- for c in \"753\":",... | false | 0.051533 | 0.052333 | 0.984697 | [
"s086539921",
"s792476006"
] |
u801049006 | p03161 | python | s654995249 | s203438212 | 2,000 | 456 | 22,736 | 55,008 | Accepted | Accepted | 77.2 | import numpy as np
N, K = list(map(int, input().split()))
h = np.array(list(map(int, input().split())))
dp = np.zeros(N, dtype=int)
for i in range(1, N):
dp[i] = min(dp[max(0,i-K):i]+abs(h[max(0,i-K):i]-h[i]))
print((dp[-1])) | N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
for j in range(1, K+1):
if i - j < 0:
break
else:
step = abs(h[i] - h[i-j])
dp[i] = min(dp[i], dp[i-j]+step)
prin... | 10 | 15 | 233 | 324 | import numpy as np
N, K = list(map(int, input().split()))
h = np.array(list(map(int, input().split())))
dp = np.zeros(N, dtype=int)
for i in range(1, N):
dp[i] = min(dp[max(0, i - K) : i] + abs(h[max(0, i - K) : i] - h[i]))
print((dp[-1]))
| N, K = list(map(int, input().split()))
h = list(map(int, input().split()))
dp = [float("inf")] * N
dp[0] = 0
for i in range(1, N):
for j in range(1, K + 1):
if i - j < 0:
break
else:
step = abs(h[i] - h[i - j])
dp[i] = min(dp[i], dp[i - j] + step)
print((dp[N - 1]... | false | 33.333333 | [
"-import numpy as np",
"-",
"-h = np.array(list(map(int, input().split())))",
"-dp = np.zeros(N, dtype=int)",
"+h = list(map(int, input().split()))",
"+dp = [float(\"inf\")] * N",
"+dp[0] = 0",
"- dp[i] = min(dp[max(0, i - K) : i] + abs(h[max(0, i - K) : i] - h[i]))",
"-print((dp[-1]))",
"+ ... | false | 0.290137 | 0.041626 | 6.970058 | [
"s654995249",
"s203438212"
] |
u347600233 | p02708 | python | s029451154 | s588187802 | 76 | 61 | 9,144 | 9,128 | Accepted | Accepted | 19.74 | n, k = list(map(int, input().split()))
p = 10**9 + 7
cnt = 0
for i in range(k, n + 2):
cnt += (i * (n - (i - 1)) + 1) % p
print((cnt % p)) | n, k = list(map(int, input().split()))
cnt = 0
for i in range(k, n + 2):
cnt += i * (n - i + 1) + 1
print((cnt % (10**9 + 7))) | 6 | 5 | 139 | 126 | n, k = list(map(int, input().split()))
p = 10**9 + 7
cnt = 0
for i in range(k, n + 2):
cnt += (i * (n - (i - 1)) + 1) % p
print((cnt % p))
| n, k = list(map(int, input().split()))
cnt = 0
for i in range(k, n + 2):
cnt += i * (n - i + 1) + 1
print((cnt % (10**9 + 7)))
| false | 16.666667 | [
"-p = 10**9 + 7",
"- cnt += (i * (n - (i - 1)) + 1) % p",
"-print((cnt % p))",
"+ cnt += i * (n - i + 1) + 1",
"+print((cnt % (10**9 + 7)))"
] | false | 0.057435 | 0.089114 | 0.644515 | [
"s029451154",
"s588187802"
] |
u561231954 | p03436 | python | s290481301 | s472660320 | 47 | 25 | 3,948 | 3,316 | Accepted | Accepted | 46.81 | def main():
from queue import Queue
h,w=list(map(int,input().split()))
grid=[list(eval(input())) for i in range(h)]
dx=[-1,0,1,0]
dy=[0,1,0,-1]
q=Queue()
q.put([0,0])
inf=10**5
ans=[[inf]*w for i in range(h)]
ans[0][0]=1
while q.qsize()!=0:
p=q.get()
... | dy = (-1,0,1,0)
dx = (0,1,0,-1)
from collections import deque
def main():
h,w = list(map(int,input().split()))
grid = [eval(input()) for _ in range(h)]
cnt_white = sum(row.count('.') for row in grid)
dist = [[-1] * w for _ in range(h)]
q = deque([(0,0)])
dist[0][0] = 1
whil... | 30 | 29 | 783 | 809 | def main():
from queue import Queue
h, w = list(map(int, input().split()))
grid = [list(eval(input())) for i in range(h)]
dx = [-1, 0, 1, 0]
dy = [0, 1, 0, -1]
q = Queue()
q.put([0, 0])
inf = 10**5
ans = [[inf] * w for i in range(h)]
ans[0][0] = 1
while q.qsize() != 0:
... | dy = (-1, 0, 1, 0)
dx = (0, 1, 0, -1)
from collections import deque
def main():
h, w = list(map(int, input().split()))
grid = [eval(input()) for _ in range(h)]
cnt_white = sum(row.count(".") for row in grid)
dist = [[-1] * w for _ in range(h)]
q = deque([(0, 0)])
dist[0][0] = 1
while q:
... | false | 3.333333 | [
"+dy = (-1, 0, 1, 0)",
"+dx = (0, 1, 0, -1)",
"+from collections import deque",
"+",
"+",
"- from queue import Queue",
"-",
"- grid = [list(eval(input())) for i in range(h)]",
"- dx = [-1, 0, 1, 0]",
"- dy = [0, 1, 0, -1]",
"- q = Queue()",
"- q.put([0, 0])",
"- inf = 10... | false | 0.050729 | 0.038033 | 1.333814 | [
"s290481301",
"s472660320"
] |
u392319141 | p04000 | python | s092362183 | s983232901 | 2,054 | 1,657 | 180,328 | 166,868 | Accepted | Accepted | 19.33 | from itertools import product
from collections import Counter
H, W, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
D = tuple(product((-1, 0, 1), repeat=2))
cnt = Counter()
for a, b in AB:
for h, w in D:
if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:
... | from collections import defaultdict
from itertools import product
H, W, N = map(int, input().split())
cnt = defaultdict(int)
D = tuple(product((-1, 0, 1), repeat=2))
for _ in range(N):
a, b = map(int, input().split())
for dh, dw in D:
h = a + dh
w = b + dw
if 2 <= h <= H - ... | 19 | 20 | 477 | 494 | from itertools import product
from collections import Counter
H, W, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
D = tuple(product((-1, 0, 1), repeat=2))
cnt = Counter()
for a, b in AB:
for h, w in D:
if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:
cnt... | from collections import defaultdict
from itertools import product
H, W, N = map(int, input().split())
cnt = defaultdict(int)
D = tuple(product((-1, 0, 1), repeat=2))
for _ in range(N):
a, b = map(int, input().split())
for dh, dw in D:
h = a + dh
w = b + dw
if 2 <= h <= H - 1 and 2 <= w ... | false | 5 | [
"+from collections import defaultdict",
"-from collections import Counter",
"-AB = [tuple(map(int, input().split())) for _ in range(N)]",
"+cnt = defaultdict(int)",
"-cnt = Counter()",
"-for a, b in AB:",
"- for h, w in D:",
"- if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:",
"- ... | false | 0.047847 | 0.046633 | 1.026018 | [
"s092362183",
"s983232901"
] |
u301624971 | p03607 | python | s074197767 | s651663577 | 226 | 88 | 15,076 | 15,072 | Accepted | Accepted | 61.06 | def myAnswer(N:int,dic:dict) -> int:
ans = 0
for a in list(dic.values()):
if(a % 2 == 1):
ans += 1
return ans
def modelAnswer():
return
def main():
N = int(eval(input()))
dic = {}
for _ in range(N):
a = int(eval(input()))
if(a in list(dic.keys())):
... | import sys
input = sys.stdin.readline
def myAnswer(N:int,dic:dict) -> int:
ans = 0
for a in list(dic.values()):
if(a % 2 == 1):
ans += 1
return ans
def modelAnswer():
return
def main():
N = int(eval(input()))
dic = {}
for _ in range(N):
a = int(eval(input()))
... | 21 | 24 | 405 | 447 | def myAnswer(N: int, dic: dict) -> int:
ans = 0
for a in list(dic.values()):
if a % 2 == 1:
ans += 1
return ans
def modelAnswer():
return
def main():
N = int(eval(input()))
dic = {}
for _ in range(N):
a = int(eval(input()))
if a in list(dic.keys()):
... | import sys
input = sys.stdin.readline
def myAnswer(N: int, dic: dict) -> int:
ans = 0
for a in list(dic.values()):
if a % 2 == 1:
ans += 1
return ans
def modelAnswer():
return
def main():
N = int(eval(input()))
dic = {}
for _ in range(N):
a = int(eval(input... | false | 12.5 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.036582 | 0.035941 | 1.017831 | [
"s074197767",
"s651663577"
] |
u760569096 | p02947 | python | s165153417 | s647212029 | 1,109 | 369 | 23,992 | 22,444 | Accepted | Accepted | 66.73 | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
for _ in range(n):
a = eval(input())
g = [0]*26
for i in a:
g[ord(i)-97]+=1
b = ''
for i in g:
b+=str(i)
d[b]+=1
cnt = 0
for k,v in list(d.items()):
if v > 1:
cnt += v*(v-1)//2
print(cnt) | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
a = eval(input())
b = ''
for i in sorted(a):
b += i
cnt += d[b]
d[b] += 1
print(cnt) | 17 | 12 | 291 | 204 | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
for _ in range(n):
a = eval(input())
g = [0] * 26
for i in a:
g[ord(i) - 97] += 1
b = ""
for i in g:
b += str(i)
d[b] += 1
cnt = 0
for k, v in list(d.items()):
if v > 1:
cnt += v * (v - 1... | from collections import defaultdict
d = defaultdict(int)
n = int(eval(input()))
cnt = 0
for _ in range(n):
a = eval(input())
b = ""
for i in sorted(a):
b += i
cnt += d[b]
d[b] += 1
print(cnt)
| false | 29.411765 | [
"+cnt = 0",
"- g = [0] * 26",
"- for i in a:",
"- g[ord(i) - 97] += 1",
"- for i in g:",
"- b += str(i)",
"+ for i in sorted(a):",
"+ b += i",
"+ cnt += d[b]",
"-cnt = 0",
"-for k, v in list(d.items()):",
"- if v > 1:",
"- cnt += v * (v - 1) // 2... | false | 0.03712 | 0.03758 | 0.987767 | [
"s165153417",
"s647212029"
] |
u994988729 | p03142 | python | s190030830 | s301288739 | 1,484 | 448 | 53,024 | 37,468 | Accepted | Accepted | 69.81 | from collections import deque
import numpy as np
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]
e_from = [[] for _ in range(N+1)]
e_to = [[] for _ in range(N+1)]
for a, b in AB:
e_from[a].append(b)
e_to[b].appe... | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
e_out = [[] for _ in range(N + 1)]
e_in = [[] for _ in range(N + 1)]
for _ in range(N + M - 1):
a, b = map(int, input().split())
e_out[a].append(b)
e_in[b].append(a)
# 1. 入次数が0のやつが親
# 2. 親が決まれば、そのこの入次数を減らす,1に戻る
# 親を決める... | 35 | 35 | 732 | 726 | from collections import deque
import numpy as np
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]
e_from = [[] for _ in range(N + 1)]
e_to = [[] for _ in range(N + 1)]
for a, b in AB:
e_from[a].append(b)
e_to[b].append(a)
a... | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
e_out = [[] for _ in range(N + 1)]
e_in = [[] for _ in range(N + 1)]
for _ in range(N + M - 1):
a, b = map(int, input().split())
e_out[a].append(b)
e_in[b].append(a)
# 1. 入次数が0のやつが親
# 2. 親が決まれば、そのこの入次数を減らす,1に戻る
# 親を決めるよ
for i, e in enum... | false | 0 | [
"-from collections import deque",
"-import numpy as np",
"-AB = [tuple(map(int, input().split())) for _ in range(N + M - 1)]",
"-e_from = [[] for _ in range(N + 1)]",
"-e_to = [[] for _ in range(N + 1)]",
"-for a, b in AB:",
"- e_from[a].append(b)",
"- e_to[b].append(a)",
"-add = np.zeros(N + ... | false | 0.267524 | 0.036269 | 7.376029 | [
"s190030830",
"s301288739"
] |
u696240348 | p03494 | python | s577940316 | s151133935 | 165 | 149 | 38,640 | 12,508 | Accepted | Accepted | 9.7 | def times_divisible(n):
ans = 0
while n%2 ==0:
n/=2
ans +=1
return ans
n= int(eval(input()))
A=[int(a) for a in input().split()]
ans = min(times_divisible(a) for a in A)
print(ans) | import numpy as np
n = eval(input())
a = np.array([int(x) for x in input().split()])
count = 0
x = 0
while x == 0:
if np.all(a%2 ==0):
count+=1
a = a/2
else:
break
print(count) | 10 | 15 | 212 | 219 | def times_divisible(n):
ans = 0
while n % 2 == 0:
n /= 2
ans += 1
return ans
n = int(eval(input()))
A = [int(a) for a in input().split()]
ans = min(times_divisible(a) for a in A)
print(ans)
| import numpy as np
n = eval(input())
a = np.array([int(x) for x in input().split()])
count = 0
x = 0
while x == 0:
if np.all(a % 2 == 0):
count += 1
a = a / 2
else:
break
print(count)
| false | 33.333333 | [
"-def times_divisible(n):",
"- ans = 0",
"- while n % 2 == 0:",
"- n /= 2",
"- ans += 1",
"- return ans",
"+import numpy as np",
"-",
"-n = int(eval(input()))",
"-A = [int(a) for a in input().split()]",
"-ans = min(times_divisible(a) for a in A)",
"-print(ans)",
"+n = ... | false | 0.069188 | 0.715129 | 0.096749 | [
"s577940316",
"s151133935"
] |
u536600145 | p03166 | python | s069696014 | s335113130 | 1,397 | 1,164 | 154,060 | 154,060 | Accepted | Accepted | 16.68 | import sys
sys.setrecursionlimit(10**9)
n , m = list(map(int,input().split()))
g = [[] for i in range(n+1)]
dp = [-1] * (n+1)
for _ in range(m):
v1 , v2 = list(map(int,input().split()))
g[v1].append(v2)
# finding longest path for vertice i
def dfs(i):
if dp[i]!=-1:
return dp... | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**9)
vertices = [[] for i in range(N+1)]
dp = [-1] * (N+1)
for _ in range(M):
fro, to = list(map(int, input().split()))
vertices[fro].append(to)
def dfs(i):
if dp[i] != -1:
return dp[i]
temp ... | 29 | 28 | 531 | 489 | import sys
sys.setrecursionlimit(10**9)
n, m = list(map(int, input().split()))
g = [[] for i in range(n + 1)]
dp = [-1] * (n + 1)
for _ in range(m):
v1, v2 = list(map(int, input().split()))
g[v1].append(v2)
# finding longest path for vertice i
def dfs(i):
if dp[i] != -1:
return dp[i]
temp = 0
... | import sys
N, M = list(map(int, input().split()))
sys.setrecursionlimit(10**9)
vertices = [[] for i in range(N + 1)]
dp = [-1] * (N + 1)
for _ in range(M):
fro, to = list(map(int, input().split()))
vertices[fro].append(to)
def dfs(i):
if dp[i] != -1:
return dp[i]
temp = 0
for vertex in ve... | false | 3.448276 | [
"+N, M = list(map(int, input().split()))",
"-n, m = list(map(int, input().split()))",
"-g = [[] for i in range(n + 1)]",
"-dp = [-1] * (n + 1)",
"-for _ in range(m):",
"- v1, v2 = list(map(int, input().split()))",
"- g[v1].append(v2)",
"-# finding longest path for vertice i",
"+vertices = [[] ... | false | 0.036819 | 0.06415 | 0.573958 | [
"s069696014",
"s335113130"
] |
u416758623 | p03775 | python | s634229894 | s657702920 | 58 | 52 | 9,092 | 9,116 | Accepted | Accepted | 10.34 | import math
n = int(eval(input()))
ans = float('inf')
i = 1
while i <= math.sqrt(n):
if n % i == 0:
a = int(len(str(i)))
b = int(len(str(n // i)))
ans = min(ans,max(a,b))
i += 1
print(ans) | n = int(eval(input()))
i = 1
ans = 0
while i * i <= n:
if n % i == 0:
ans = max(len(str(i)), len(str(n // i)))
i += 1
print(ans) | 11 | 9 | 224 | 147 | import math
n = int(eval(input()))
ans = float("inf")
i = 1
while i <= math.sqrt(n):
if n % i == 0:
a = int(len(str(i)))
b = int(len(str(n // i)))
ans = min(ans, max(a, b))
i += 1
print(ans)
| n = int(eval(input()))
i = 1
ans = 0
while i * i <= n:
if n % i == 0:
ans = max(len(str(i)), len(str(n // i)))
i += 1
print(ans)
| false | 18.181818 | [
"-import math",
"-",
"-ans = float(\"inf\")",
"-while i <= math.sqrt(n):",
"+ans = 0",
"+while i * i <= n:",
"- a = int(len(str(i)))",
"- b = int(len(str(n // i)))",
"- ans = min(ans, max(a, b))",
"+ ans = max(len(str(i)), len(str(n // i)))"
] | false | 0.052308 | 0.047772 | 1.094953 | [
"s634229894",
"s657702920"
] |
u021916304 | p03048 | python | s774247331 | s624055409 | 394 | 19 | 40,812 | 3,064 | Accepted | Accepted | 95.18 | def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
def ism():return list(map(str,input().split()))
def isl():return list(map(str,input().split()))
r,g,b,n = iim()
ans = 0
for i in range(n//r+1):
for j in range(n//g+1):
... | def ii():return int(eval(input()))
def iim():return list(map(int,input().split()))
def iil():return list(map(int,input().split()))
def ism():return list(map(str,input().split()))
def isl():return list(map(str,input().split()))
#pythonだとTLE/pypyだとAC
'''
r,g,b,n = iim()
ans = 0
for i in range(n//r+1):
for... | 15 | 33 | 425 | 782 | def ii():
return int(eval(input()))
def iim():
return list(map(int, input().split()))
def iil():
return list(map(int, input().split()))
def ism():
return list(map(str, input().split()))
def isl():
return list(map(str, input().split()))
r, g, b, n = iim()
ans = 0
for i in range(n // r + 1):... | def ii():
return int(eval(input()))
def iim():
return list(map(int, input().split()))
def iil():
return list(map(int, input().split()))
def ism():
return list(map(str, input().split()))
def isl():
return list(map(str, input().split()))
# pythonだとTLE/pypyだとAC
"""
r,g,b,n = iim()
ans = 0
for... | false | 54.545455 | [
"-r, g, b, n = iim()",
"+# pythonだとTLE/pypyだとAC",
"+\"\"\"",
"+r,g,b,n = iim()",
"-for i in range(n // r + 1):",
"- for j in range(n // g + 1):",
"- num = n - i * r - j * g",
"- if num % b == 0 and num // b >= 0:",
"- # print(i,j,num//b)",
"+for i in range(n/... | false | 0.263897 | 0.036981 | 7.135986 | [
"s774247331",
"s624055409"
] |
u500376440 | p02971 | python | s467500583 | s502851198 | 393 | 303 | 19,052 | 92,972 | Accepted | Accepted | 22.9 | N=int(eval(input()))
A=[int(eval(input())) for i in range(N)]
max_val1=sorted(A)[-1]
max_val2=sorted(A)[-2]
for x in A:
print((max_val2 if x==max_val1 else max_val1))
| N=int(eval(input()))
A=[int(eval(input())) for _ in range(N)]
lmax=[0]*N
rmax=[0]*N
for i in range(1,N):
lmax[i]=max(lmax[i-1],A[i-1])
for i in range(N-2,-1,-1):
rmax[i]=max(rmax[i+1],A[i+1])
for i in range(N):
print((max(lmax[i],rmax[i])))
| 6 | 13 | 160 | 248 | N = int(eval(input()))
A = [int(eval(input())) for i in range(N)]
max_val1 = sorted(A)[-1]
max_val2 = sorted(A)[-2]
for x in A:
print((max_val2 if x == max_val1 else max_val1))
| N = int(eval(input()))
A = [int(eval(input())) for _ in range(N)]
lmax = [0] * N
rmax = [0] * N
for i in range(1, N):
lmax[i] = max(lmax[i - 1], A[i - 1])
for i in range(N - 2, -1, -1):
rmax[i] = max(rmax[i + 1], A[i + 1])
for i in range(N):
print((max(lmax[i], rmax[i])))
| false | 53.846154 | [
"-A = [int(eval(input())) for i in range(N)]",
"-max_val1 = sorted(A)[-1]",
"-max_val2 = sorted(A)[-2]",
"-for x in A:",
"- print((max_val2 if x == max_val1 else max_val1))",
"+A = [int(eval(input())) for _ in range(N)]",
"+lmax = [0] * N",
"+rmax = [0] * N",
"+for i in range(1, N):",
"+ lma... | false | 0.007903 | 0.037879 | 0.208628 | [
"s467500583",
"s502851198"
] |
u885634168 | p02642 | python | s238014064 | s577645304 | 233 | 182 | 217,100 | 195,464 | Accepted | Accepted | 21.89 | N = int(eval(input()))
A = list(map(int,input().split()))
ma = max(A)
Er = [0 for _ in range(ma + 5)]
is_c = [0 for _ in range(ma + 5)]
for i in range(N):
temp = A[i]
if Er[temp] != 2:
a = 0
while(1):
a += 1
tt = a * temp
if tt >= ma + 5:
... | N = int(eval(input()))
A = list(map(int,input().split()))
ma = max(A)
Er = [0 for _ in range(ma + 5)]
for i in range(N):
temp = A[i]
if Er[temp] != 2:
a = 0
while(1):
a += 1
tt = a * temp
if tt >= ma + 5:
break
Er[t... | 27 | 23 | 533 | 432 | N = int(eval(input()))
A = list(map(int, input().split()))
ma = max(A)
Er = [0 for _ in range(ma + 5)]
is_c = [0 for _ in range(ma + 5)]
for i in range(N):
temp = A[i]
if Er[temp] != 2:
a = 0
while 1:
a += 1
tt = a * temp
if tt >= ma + 5:
break... | N = int(eval(input()))
A = list(map(int, input().split()))
ma = max(A)
Er = [0 for _ in range(ma + 5)]
for i in range(N):
temp = A[i]
if Er[temp] != 2:
a = 0
while 1:
a += 1
tt = a * temp
if tt >= ma + 5:
break
Er[tt] += 1
ans = 0
f... | false | 14.814815 | [
"-is_c = [0 for _ in range(ma + 5)]",
"- is_c[temp] += 1",
"- if is_c[temp] == 2:",
"- continue"
] | false | 0.037411 | 0.042908 | 0.871883 | [
"s238014064",
"s577645304"
] |
u367130284 | p03945 | python | s928613099 | s764024882 | 56 | 19 | 15,860 | 3,188 | Accepted | Accepted | 66.07 | from itertools import*;print((len(list(groupby(eval(input()))))-1)) | print((sum(map(input().count,["WB","BW"])))) | 1 | 1 | 59 | 42 | from itertools import *
print((len(list(groupby(eval(input())))) - 1))
| print((sum(map(input().count, ["WB", "BW"]))))
| false | 0 | [
"-from itertools import *",
"-",
"-print((len(list(groupby(eval(input())))) - 1))",
"+print((sum(map(input().count, [\"WB\", \"BW\"]))))"
] | false | 0.038933 | 0.038492 | 1.01146 | [
"s928613099",
"s764024882"
] |
u246401133 | p02627 | python | s352582510 | s041003808 | 30 | 24 | 9,084 | 8,968 | Accepted | Accepted | 20 | alpha = str(eval(input()))
if alpha in "abcdefghijklmnopqrstuvwxyz":
print("a")
else:
print("A") | alpha = eval(input())
print(("a" if alpha.islower() else "A")) | 5 | 2 | 102 | 55 | alpha = str(eval(input()))
if alpha in "abcdefghijklmnopqrstuvwxyz":
print("a")
else:
print("A")
| alpha = eval(input())
print(("a" if alpha.islower() else "A"))
| false | 60 | [
"-alpha = str(eval(input()))",
"-if alpha in \"abcdefghijklmnopqrstuvwxyz\":",
"- print(\"a\")",
"-else:",
"- print(\"A\")",
"+alpha = eval(input())",
"+print((\"a\" if alpha.islower() else \"A\"))"
] | false | 0.035947 | 0.0385 | 0.933685 | [
"s352582510",
"s041003808"
] |
u584174687 | p02996 | python | s010024881 | s051501423 | 1,270 | 646 | 88,024 | 83,164 | Accepted | Accepted | 49.13 |
from collections import defaultdict
def gcd(a, b):
while b:
a, b = b, a % b
return a
#a,bの最小公倍数
def lcm(a, b):
return a * b // gcd (a, b)
def main():
num = int(eval(input()))
data = [list(map(int, input().split())) for i in range(num)]
data.sort(key=lambda x: x[1])
... | from collections import defaultdict
import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
#a,bの最小公倍数
def lcm(a, b):
return a * b // gcd (a, b)
def main():
num = int(eval(input()))
data = [list(map(int, input().split())) for i in range(num)]
... | 33 | 34 | 621 | 659 | from collections import defaultdict
def gcd(a, b):
while b:
a, b = b, a % b
return a
# a,bの最小公倍数
def lcm(a, b):
return a * b // gcd(a, b)
def main():
num = int(eval(input()))
data = [list(map(int, input().split())) for i in range(num)]
data.sort(key=lambda x: x[1])
now_time = 0... | from collections import defaultdict
import sys
input = sys.stdin.readline
def gcd(a, b):
while b:
a, b = b, a % b
return a
# a,bの最小公倍数
def lcm(a, b):
return a * b // gcd(a, b)
def main():
num = int(eval(input()))
data = [list(map(int, input().split())) for i in range(num)]
data.so... | false | 2.941176 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.113223 | 0.110619 | 1.023537 | [
"s010024881",
"s051501423"
] |
u864013199 | p03354 | python | s500404191 | s533142376 | 732 | 564 | 13,812 | 14,516 | Accepted | Accepted | 22.95 | class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
... | import sys
input = sys.stdin.readline
class UnionFind():
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[... | 48 | 51 | 1,140 | 1,182 | class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, n):
self.parent = [-1 for _ in range(n)]
# 正==子: 根の頂点番号 / 負==根: 連結頂点数
def find(self, x):
if self.parent[x] < 0:
return x
else:
self.parent[x] = self.find(self.parent[x])
... | false | 5.882353 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+",
"+"
] | false | 0.037417 | 0.042705 | 0.876183 | [
"s500404191",
"s533142376"
] |
u602773379 | p02612 | python | s596457996 | s293129303 | 32 | 28 | 9,148 | 9,136 | Accepted | Accepted | 12.5 |
n=int(eval(input()))
for i in range(1000,10001,1000):
num=i-n
if num >=0:
print(num)
break | n=int(eval(input()))
for i in range(1000,10001,1000):
if i>=n:
print((i-n))
break | 7 | 5 | 97 | 82 | n = int(eval(input()))
for i in range(1000, 10001, 1000):
num = i - n
if num >= 0:
print(num)
break
| n = int(eval(input()))
for i in range(1000, 10001, 1000):
if i >= n:
print((i - n))
break
| false | 28.571429 | [
"- num = i - n",
"- if num >= 0:",
"- print(num)",
"+ if i >= n:",
"+ print((i - n))"
] | false | 0.086904 | 0.056986 | 1.525009 | [
"s596457996",
"s293129303"
] |
u014333473 | p03997 | python | s240896610 | s928727964 | 25 | 22 | 9,164 | 9,156 | Accepted | Accepted | 12 | n=[int(eval(input())) for _ in range(3)]
print((((n[0]+n[1])*n[2])//2)) | a,b,h=[int(eval(input())) for _ in range(3)];print(((a+b)*h//2)) | 2 | 1 | 64 | 56 | n = [int(eval(input())) for _ in range(3)]
print((((n[0] + n[1]) * n[2]) // 2))
| a, b, h = [int(eval(input())) for _ in range(3)]
print(((a + b) * h // 2))
| false | 50 | [
"-n = [int(eval(input())) for _ in range(3)]",
"-print((((n[0] + n[1]) * n[2]) // 2))",
"+a, b, h = [int(eval(input())) for _ in range(3)]",
"+print(((a + b) * h // 2))"
] | false | 0.03685 | 0.035914 | 1.026047 | [
"s240896610",
"s928727964"
] |
u708255304 | p04001 | python | s603661736 | s357557277 | 26 | 23 | 2,940 | 4,140 | Accepted | Accepted | 11.54 | S = list(eval(input()))
ans = 0
for state in range(1 << len(S)-1):
ans += eval(S[0] + ''.join(('+' if state >> i & 1 else '') + x for i, x in enumerate(S[1:])))
print(ans)
| S = str(eval(input()))
ans = ""
for mask in range(1 << (len(S)-1)):
for i in range(len(S)):
if ((mask >> i) & 1):
ans += str(S[i]) + "+"
else:
ans += str(S[i])
ans += "+"
print((int(eval(ans[:-1]))))
| 7 | 13 | 178 | 255 | S = list(eval(input()))
ans = 0
for state in range(1 << len(S) - 1):
ans += eval(
S[0] + "".join(("+" if state >> i & 1 else "") + x for i, x in enumerate(S[1:]))
)
print(ans)
| S = str(eval(input()))
ans = ""
for mask in range(1 << (len(S) - 1)):
for i in range(len(S)):
if (mask >> i) & 1:
ans += str(S[i]) + "+"
else:
ans += str(S[i])
ans += "+"
print((int(eval(ans[:-1]))))
| false | 46.153846 | [
"-S = list(eval(input()))",
"-ans = 0",
"-for state in range(1 << len(S) - 1):",
"- ans += eval(",
"- S[0] + \"\".join((\"+\" if state >> i & 1 else \"\") + x for i, x in enumerate(S[1:]))",
"- )",
"-print(ans)",
"+S = str(eval(input()))",
"+ans = \"\"",
"+for mask in range(1 << (len(... | false | 0.039509 | 0.037343 | 1.058004 | [
"s603661736",
"s357557277"
] |
u233720439 | p03486 | python | s042454177 | s550685905 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | S = sorted(eval(input()))
T = sorted(eval(input()),reverse=True)
if S<T:
print("Yes")
else:
print("No") | S = sorted(eval(input()))
N = sorted(eval(input()))
N.reverse()
print(("Yes" if S < N else "No")) | 6 | 4 | 104 | 87 | S = sorted(eval(input()))
T = sorted(eval(input()), reverse=True)
if S < T:
print("Yes")
else:
print("No")
| S = sorted(eval(input()))
N = sorted(eval(input()))
N.reverse()
print(("Yes" if S < N else "No"))
| false | 33.333333 | [
"-T = sorted(eval(input()), reverse=True)",
"-if S < T:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+N = sorted(eval(input()))",
"+N.reverse()",
"+print((\"Yes\" if S < N else \"No\"))"
] | false | 0.044401 | 0.047006 | 0.944582 | [
"s042454177",
"s550685905"
] |
u602740328 | p03379 | python | s763050637 | s531863274 | 328 | 211 | 26,356 | 29,204 | Accepted | Accepted | 35.67 | N = int(eval(input()))
X = [int(i) for i in input().split()]
X_sorted = sorted(X)
X_med = X_sorted[N//2-1:N//2+1]
for xi in X: print((X_med[1] if xi<=X_med[0] else X_med[0])) | N = int(eval(input()))
X = [int(i) for i in input().split()]
X_med = sorted(X)[N//2-1:N//2+1]
print(("\n".join(map(str, [X_med[1] if xi<=X_med[0] else X_med[0] for xi in X])))) | 5 | 4 | 170 | 171 | N = int(eval(input()))
X = [int(i) for i in input().split()]
X_sorted = sorted(X)
X_med = X_sorted[N // 2 - 1 : N // 2 + 1]
for xi in X:
print((X_med[1] if xi <= X_med[0] else X_med[0]))
| N = int(eval(input()))
X = [int(i) for i in input().split()]
X_med = sorted(X)[N // 2 - 1 : N // 2 + 1]
print(("\n".join(map(str, [X_med[1] if xi <= X_med[0] else X_med[0] for xi in X]))))
| false | 20 | [
"-X_sorted = sorted(X)",
"-X_med = X_sorted[N // 2 - 1 : N // 2 + 1]",
"-for xi in X:",
"- print((X_med[1] if xi <= X_med[0] else X_med[0]))",
"+X_med = sorted(X)[N // 2 - 1 : N // 2 + 1]",
"+print((\"\\n\".join(map(str, [X_med[1] if xi <= X_med[0] else X_med[0] for xi in X]))))"
] | false | 0.04319 | 0.042313 | 1.020732 | [
"s763050637",
"s531863274"
] |
u150984829 | p00009 | python | s242796837 | s593003529 | 320 | 270 | 13,848 | 9,876 | Accepted | Accepted | 15.62 | import sys
m=166666;a=[[1]*m for _ in[0]*2]
for i in range(m):
if a[0][i]:
k=6*i+5
a[0][i+k::k]=[0]*len(a[0][i+k::k])
a[1][-2-i+k::k]=[0]*len(a[1][-2-i+k::k])
if a[1][i]:
k=6*i+7
a[0][-2-i+k::k]=[0]*len(a[0][-2-i+k::k])
a[1][i+k::k]=[0]*len(a[1][i+k::k])
for e in map(int,sys.stdin):
print(([e... | import sys
m=166666;s=[1]*m;t=[1]*m
for i in range(m):
if s[i]:
k=6*i+5
s[i+k::k]=[0]*len(s[i+k::k])
t[-2-i+k::k]=[0]*len(t[-2-i+k::k])
if t[i]:
k=6*i+7
s[-2-i+k::k]=[0]*len(s[-2-i+k::k])
t[i+k::k]=[0]*len(t[i+k::k])
for e in map(int,sys.stdin):
print(([e-1,sum(s[:(e+1)//6])+sum(t[:(e-1)//6])... | 13 | 13 | 368 | 329 | import sys
m = 166666
a = [[1] * m for _ in [0] * 2]
for i in range(m):
if a[0][i]:
k = 6 * i + 5
a[0][i + k :: k] = [0] * len(a[0][i + k :: k])
a[1][-2 - i + k :: k] = [0] * len(a[1][-2 - i + k :: k])
if a[1][i]:
k = 6 * i + 7
a[0][-2 - i + k :: k] = [0] * len(a[0][-2 -... | import sys
m = 166666
s = [1] * m
t = [1] * m
for i in range(m):
if s[i]:
k = 6 * i + 5
s[i + k :: k] = [0] * len(s[i + k :: k])
t[-2 - i + k :: k] = [0] * len(t[-2 - i + k :: k])
if t[i]:
k = 6 * i + 7
s[-2 - i + k :: k] = [0] * len(s[-2 - i + k :: k])
t[i + k :... | false | 0 | [
"-a = [[1] * m for _ in [0] * 2]",
"+s = [1] * m",
"+t = [1] * m",
"- if a[0][i]:",
"+ if s[i]:",
"- a[0][i + k :: k] = [0] * len(a[0][i + k :: k])",
"- a[1][-2 - i + k :: k] = [0] * len(a[1][-2 - i + k :: k])",
"- if a[1][i]:",
"+ s[i + k :: k] = [0] * len(s[i + k :: k... | false | 0.258252 | 0.244857 | 1.054704 | [
"s242796837",
"s593003529"
] |
u796942881 | p03111 | python | s503219812 | s022467763 | 21 | 19 | 3,064 | 3,064 | Accepted | Accepted | 9.52 | from itertools import combinations
from itertools import permutations
def f(x, lst, rem):
d = abs(x - min(lst))
min_lst = min(lst)
tpl = None
for v in range(len(lst) - rem + 1):
for t in combinations(lst, v + 1):
if abs(x - sum(t)) + 10 * v < d:
d = abs(x... | from itertools import combinations
from itertools import permutations
def f(x, lst, rem):
d = int(1e9+7)
tpl = ()
for v in range(len(lst) - rem + 1):
for t in combinations(lst, v + 1):
if abs(x - sum(t)) + 10 * v < d:
d = abs(x - sum(t)) + 10 * v
... | 37 | 33 | 864 | 762 | from itertools import combinations
from itertools import permutations
def f(x, lst, rem):
d = abs(x - min(lst))
min_lst = min(lst)
tpl = None
for v in range(len(lst) - rem + 1):
for t in combinations(lst, v + 1):
if abs(x - sum(t)) + 10 * v < d:
d = abs(x - sum(t)) ... | from itertools import combinations
from itertools import permutations
def f(x, lst, rem):
d = int(1e9 + 7)
tpl = ()
for v in range(len(lst) - rem + 1):
for t in combinations(lst, v + 1):
if abs(x - sum(t)) + 10 * v < d:
d = abs(x - sum(t)) + 10 * v
tpl =... | false | 10.810811 | [
"- d = abs(x - min(lst))",
"- min_lst = min(lst)",
"- tpl = None",
"+ d = int(1e9 + 7)",
"+ tpl = ()",
"- if tpl is None:",
"- lst.remove(min_lst)",
"- else:",
"- for v in tpl:",
"- lst.remove(v)",
"+ for v in tpl:",
"+ lst.remove(v)"
] | false | 0.090703 | 0.050295 | 1.803415 | [
"s503219812",
"s022467763"
] |
u057109575 | p02791 | python | s413651449 | s764778034 | 255 | 108 | 84,996 | 99,792 | Accepted | Accepted | 57.65 | N, *P = list(map(int, open(0).read().split()))
min_v = 10 ** 6
max_v = 0
ans = 0
for i in range(N):
if P[i] < min_v:
ans += 1
min_v = P[i]
elif P[i] > max_v:
max_v = P[i]
print(ans)
|
N = int(eval(input()))
X = list(map(int, input().split()))
ans = 0
cur = 10 ** 6
for i in range(N):
if X[i] <= cur:
ans += 1
cur = min(cur, X[i])
print(ans)
| 13 | 12 | 230 | 181 | N, *P = list(map(int, open(0).read().split()))
min_v = 10**6
max_v = 0
ans = 0
for i in range(N):
if P[i] < min_v:
ans += 1
min_v = P[i]
elif P[i] > max_v:
max_v = P[i]
print(ans)
| N = int(eval(input()))
X = list(map(int, input().split()))
ans = 0
cur = 10**6
for i in range(N):
if X[i] <= cur:
ans += 1
cur = min(cur, X[i])
print(ans)
| false | 7.692308 | [
"-N, *P = list(map(int, open(0).read().split()))",
"-min_v = 10**6",
"-max_v = 0",
"+N = int(eval(input()))",
"+X = list(map(int, input().split()))",
"+cur = 10**6",
"- if P[i] < min_v:",
"+ if X[i] <= cur:",
"- min_v = P[i]",
"- elif P[i] > max_v:",
"- max_v = P[i]",
"+... | false | 0.042232 | 0.036131 | 1.168853 | [
"s413651449",
"s764778034"
] |
u619458041 | p03037 | python | s288880580 | s834016347 | 154 | 141 | 3,956 | 3,060 | Accepted | Accepted | 8.44 | import sys
from itertools import accumulate
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
acc = [0] * (N+1)
for _ in range(M):
left, right = list(map(int, input().split()))
acc[left-1] += 1
acc[right] -= 1
cnt = 0
for a in ac... | import sys
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
L = 0
R = 10**5 + 1
for _ in range(M):
left, right = list(map(int, input().split()))
L = max(L, left)
R = min(R, right)
return max(R - L + 1, 0)
if __name__ == '__m... | 22 | 17 | 434 | 335 | import sys
from itertools import accumulate
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
acc = [0] * (N + 1)
for _ in range(M):
left, right = list(map(int, input().split()))
acc[left - 1] += 1
acc[right] -= 1
cnt = 0
for a in accumulate(... | import sys
def main():
input = sys.stdin.readline
N, M = list(map(int, input().split()))
L = 0
R = 10**5 + 1
for _ in range(M):
left, right = list(map(int, input().split()))
L = max(L, left)
R = min(R, right)
return max(R - L + 1, 0)
if __name__ == "__main__":
pri... | false | 22.727273 | [
"-from itertools import accumulate",
"- acc = [0] * (N + 1)",
"+ L = 0",
"+ R = 10**5 + 1",
"- acc[left - 1] += 1",
"- acc[right] -= 1",
"- cnt = 0",
"- for a in accumulate(acc):",
"- if a == M:",
"- cnt += 1",
"- return cnt",
"+ L = max... | false | 0.04464 | 0.062246 | 0.717155 | [
"s288880580",
"s834016347"
] |
u353919145 | p02784 | python | s557928286 | s266039868 | 199 | 53 | 52,292 | 10,584 | Accepted | Accepted | 73.37 | h, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
if sum(arr) >= h: print('Yes')
else: print('No') | In1 = input().split()
h = int(In1[0])
n = int(In1[1])
ith = input().split()[0:n]
count = 0
for x in ith:
h -= int(x)
if h <= 0:
break
if h > 0:
print("No")
else:
print("Yes") | 4 | 13 | 122 | 210 | h, n = list(map(int, input().split()))
arr = list(map(int, input().split()))
if sum(arr) >= h:
print("Yes")
else:
print("No")
| In1 = input().split()
h = int(In1[0])
n = int(In1[1])
ith = input().split()[0:n]
count = 0
for x in ith:
h -= int(x)
if h <= 0:
break
if h > 0:
print("No")
else:
print("Yes")
| false | 69.230769 | [
"-h, n = list(map(int, input().split()))",
"-arr = list(map(int, input().split()))",
"-if sum(arr) >= h:",
"+In1 = input().split()",
"+h = int(In1[0])",
"+n = int(In1[1])",
"+ith = input().split()[0:n]",
"+count = 0",
"+for x in ith:",
"+ h -= int(x)",
"+ if h <= 0:",
"+ break",
... | false | 0.036935 | 0.036533 | 1.010988 | [
"s557928286",
"s266039868"
] |
u601592822 | p03448 | python | s971009297 | s818307613 | 83 | 70 | 3,064 | 9,208 | Accepted | Accepted | 15.66 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
def multiple(l,m,n):
ans = 500*l + 100*m + 50*n
return ans
o = 0
p = 0
q = 0
while o <= a:
while p <= b:
while q <= c:
ans_x = multiple(o,p,q)
if x == ans_... | # -*- coding: utf-8 -*-
# 整数の入力
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
i = 0
j = 0
k = 0
cnt = 0
sum = 0
while i <= A:
j = 0
if i>50:
break
while j <= B:
k = 0
if j>50:
break
while k <= C:... | 27 | 34 | 427 | 555 | a = int(eval(input()))
b = int(eval(input()))
c = int(eval(input()))
x = int(eval(input()))
count = 0
def multiple(l, m, n):
ans = 500 * l + 100 * m + 50 * n
return ans
o = 0
p = 0
q = 0
while o <= a:
while p <= b:
while q <= c:
ans_x = multiple(o, p, q)
if x == ans_x:
... | # -*- coding: utf-8 -*-
# 整数の入力
A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
i = 0
j = 0
k = 0
cnt = 0
sum = 0
while i <= A:
j = 0
if i > 50:
break
while j <= B:
k = 0
if j > 50:
break
while k <= C:
if k >... | false | 20.588235 | [
"-a = int(eval(input()))",
"-b = int(eval(input()))",
"-c = int(eval(input()))",
"-x = int(eval(input()))",
"-count = 0",
"-",
"-",
"-def multiple(l, m, n):",
"- ans = 500 * l + 100 * m + 50 * n",
"- return ans",
"-",
"-",
"-o = 0",
"-p = 0",
"-q = 0",
"-while o <= a:",
"- w... | false | 0.240114 | 0.064388 | 3.729195 | [
"s971009297",
"s818307613"
] |
u191874006 | p03072 | python | s386348428 | s148285699 | 170 | 66 | 38,256 | 65,556 | Accepted | Accepted | 61.18 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from... | 29 | 30 | 715 | 727 | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | #!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop, heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collectio... | false | 3.333333 | [
"+ x = h[i]",
"- if h[i] < h[j]:",
"+ if x < h[j]:"
] | false | 0.036484 | 0.037054 | 0.984628 | [
"s386348428",
"s148285699"
] |
u124592621 | p03455 | python | s815297205 | s114670918 | 22 | 18 | 2,940 | 2,940 | Accepted | Accepted | 18.18 | a,b = list(map(int, input().split()))
print(("Even" if (a * b) % 2 == 0 else "Odd")) | a,b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd") | 2 | 5 | 77 | 93 | a, b = list(map(int, input().split()))
print(("Even" if (a * b) % 2 == 0 else "Odd"))
| a, b = list(map(int, input().split()))
if (a * b) % 2 == 0:
print("Even")
else:
print("Odd")
| false | 60 | [
"-print((\"Even\" if (a * b) % 2 == 0 else \"Odd\"))",
"+if (a * b) % 2 == 0:",
"+ print(\"Even\")",
"+else:",
"+ print(\"Odd\")"
] | false | 0.132695 | 0.046129 | 2.876616 | [
"s815297205",
"s114670918"
] |
u042666758 | p03160 | python | s668206132 | s950676021 | 164 | 150 | 12,784 | 12,060 | Accepted | Accepted | 8.54 | N = int(input())
h_str = input()
h = []
for h_i in h_str.split(" "):
h.append(int(h_i))
dp = [10 ** 9 + 1] * N
dp[0] = 0
for i in range(N):
for j in (i + 1, i + 2):
if j < N:
dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N-1])) | N = int(input())
h = list(map(int, input().split()))
dp = [10 ** 9 + 1] * N
dp[0] = 0
for i in range(N):
for j in (i + 1, i + 2):
if j < N:
dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N-1])) | 13 | 10 | 283 | 235 | N = int(input())
h_str = input()
h = []
for h_i in h_str.split(" "):
h.append(int(h_i))
dp = [10**9 + 1] * N
dp[0] = 0
for i in range(N):
for j in (i + 1, i + 2):
if j < N:
dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N - 1]))
| N = int(input())
h = list(map(int, input().split()))
dp = [10**9 + 1] * N
dp[0] = 0
for i in range(N):
for j in (i + 1, i + 2):
if j < N:
dp[j] = min(dp[j], dp[i] + abs(h[j] - h[i]))
print((dp[N - 1]))
| false | 23.076923 | [
"-h_str = input()",
"-h = []",
"-for h_i in h_str.split(\" \"):",
"- h.append(int(h_i))",
"+h = list(map(int, input().split()))"
] | false | 0.047075 | 0.047684 | 0.987228 | [
"s668206132",
"s950676021"
] |
u952656646 | p04001 | python | s392769137 | s175171533 | 32 | 26 | 3,444 | 3,060 | Accepted | Accepted | 18.75 | import copy
S = eval(input())
n = len(S)
ans = 0
for i in range(2**(n-1)):
temp = ""
for s,j in zip(S, list(range(n))):
temp += s
if i>>j & 1:
temp += "+"
ans += eval(temp)
print(ans) | S = eval(input())
ans = 0
for b in range(2**(len(S)-1)):
s = ""
for i in range(len(S)):
s += S[i]
if b >> i & 1:
s += "+"
ans += eval(s)
print(ans) | 12 | 10 | 222 | 190 | import copy
S = eval(input())
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
temp = ""
for s, j in zip(S, list(range(n))):
temp += s
if i >> j & 1:
temp += "+"
ans += eval(temp)
print(ans)
| S = eval(input())
ans = 0
for b in range(2 ** (len(S) - 1)):
s = ""
for i in range(len(S)):
s += S[i]
if b >> i & 1:
s += "+"
ans += eval(s)
print(ans)
| false | 16.666667 | [
"-import copy",
"-",
"-n = len(S)",
"-for i in range(2 ** (n - 1)):",
"- temp = \"\"",
"- for s, j in zip(S, list(range(n))):",
"- temp += s",
"- if i >> j & 1:",
"- temp += \"+\"",
"- ans += eval(temp)",
"+for b in range(2 ** (len(S) - 1)):",
"+ s = \"\"",... | false | 0.046907 | 0.049678 | 0.944208 | [
"s392769137",
"s175171533"
] |
u845573105 | p02615 | python | s982082099 | s106478071 | 158 | 142 | 31,388 | 31,452 | Accepted | Accepted | 10.13 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A = A[::-1]
ans = A[0]
for i in range(N-2):
ans += A[1 + i//2]
print(ans) | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N-1):
ans += A[(i+1)//2]
print(ans) | 8 | 9 | 144 | 144 | N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
A = A[::-1]
ans = A[0]
for i in range(N - 2):
ans += A[1 + i // 2]
print(ans)
| N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(N - 1):
ans += A[(i + 1) // 2]
print(ans)
| false | 11.111111 | [
"-A.sort()",
"-A = A[::-1]",
"-ans = A[0]",
"-for i in range(N - 2):",
"- ans += A[1 + i // 2]",
"+A.sort(reverse=True)",
"+ans = 0",
"+for i in range(N - 1):",
"+ ans += A[(i + 1) // 2]"
] | false | 0.039084 | 0.039449 | 0.990768 | [
"s982082099",
"s106478071"
] |
u150984829 | p02264 | python | s310147176 | s847481603 | 290 | 250 | 20,980 | 20,976 | Accepted | Accepted | 13.79 | import sys
import collections
s=sys.stdin.readlines()
n,q=list(map(int,s[0].split()))
d=collections.deque(e.split()for e in s[1:])
t=0
while d:
k,v=d.popleft()
v=int(v)
if v>q:
v-=q
t+=q
d.append([k,v])
else:
t+=v
print((k,t))
| import sys
from collections import deque
s=sys.stdin.readlines()
n,q=list(map(int,s[0].split()))
d=deque(e.split()for e in s[1:])
t=0
while d:
k,v=d.popleft()
v=int(v)
if v>q:
v-=q
t+=q
d.append([k,v])
else:
t+=v
print((k,t))
| 16 | 16 | 248 | 247 | import sys
import collections
s = sys.stdin.readlines()
n, q = list(map(int, s[0].split()))
d = collections.deque(e.split() for e in s[1:])
t = 0
while d:
k, v = d.popleft()
v = int(v)
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
print((k, t))
| import sys
from collections import deque
s = sys.stdin.readlines()
n, q = list(map(int, s[0].split()))
d = deque(e.split() for e in s[1:])
t = 0
while d:
k, v = d.popleft()
v = int(v)
if v > q:
v -= q
t += q
d.append([k, v])
else:
t += v
print((k, t))
| false | 0 | [
"-import collections",
"+from collections import deque",
"-d = collections.deque(e.split() for e in s[1:])",
"+d = deque(e.split() for e in s[1:])"
] | false | 0.038186 | 0.039432 | 0.9684 | [
"s310147176",
"s847481603"
] |
u499381410 | p04017 | python | s558827638 | s669576091 | 598 | 476 | 72,916 | 126,296 | Accepted | Accepted | 20.4 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, ... | 61 | 60 | 1,681 | 1,603 | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
fro... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, co... | false | 1.639344 | [
"-from math import factorial, ceil, floor",
"+from math import factorial, ceil, floor, cos, radians, pi, sin",
"-INF = 10**20",
"+INF = 10**13",
"-mod = 1000000007",
"+mod = 10**9 + 7",
"-X = LI()",
"+x = LI() + [INF]",
"-log_n = (n - 1).bit_length()",
"-doubling = [[n] * n for _ in range(log_n)]"... | false | 0.079947 | 0.077754 | 1.028205 | [
"s558827638",
"s669576091"
] |
u906769651 | p02784 | python | s618964436 | s888574894 | 54 | 49 | 13,964 | 20,580 | Accepted | Accepted | 9.26 | H,N=input().split()
H=int(H)
N=int(N)
A=list(map(int, input().split()))
count=0
for i in range(N):
count+=A[i]
if count>=H:
print("Yes")
else:
print("No") | # coding: utf-8
# Your code here!
h,a=list(map(int,input().split()))
A=list(map(int,input().split()))
sum_A=sum(A)
if h>sum_A:
print("No")
else:
print("Yes") | 14 | 12 | 176 | 173 | H, N = input().split()
H = int(H)
N = int(N)
A = list(map(int, input().split()))
count = 0
for i in range(N):
count += A[i]
if count >= H:
print("Yes")
else:
print("No")
| # coding: utf-8
# Your code here!
h, a = list(map(int, input().split()))
A = list(map(int, input().split()))
sum_A = sum(A)
if h > sum_A:
print("No")
else:
print("Yes")
| false | 14.285714 | [
"-H, N = input().split()",
"-H = int(H)",
"-N = int(N)",
"+# coding: utf-8",
"+# Your code here!",
"+h, a = list(map(int, input().split()))",
"-count = 0",
"-for i in range(N):",
"- count += A[i]",
"-if count >= H:",
"+sum_A = sum(A)",
"+if h > sum_A:",
"+ print(\"No\")",
"+else:",
... | false | 0.040469 | 0.105712 | 0.382825 | [
"s618964436",
"s888574894"
] |
u906501980 | p03160 | python | s142987373 | s381829651 | 169 | 127 | 18,884 | 13,980 | Accepted | Accepted | 24.85 | n = int(eval(input()))
H = list(map(int, input().split()))
cost = [None]*n
h1 = [None]*(n-1)
h2 = [None]*(n-2)
one_ago = H[1]
two_ago = H[0]
h1[0] = abs(two_ago-one_ago)
for i in range(2, n):
new = H[i]
h1[i-1] = abs(one_ago-new)
h2[i-2] = abs(two_ago-new)
two_ago, one_ago = one_ago, new
c... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [None]*n
dp[0], dp[1] = 0, abs(h[0]-h[1])
for i in range(2, n):
dp[i] = min(dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i]))
print((dp[-1])) | 17 | 7 | 438 | 209 | n = int(eval(input()))
H = list(map(int, input().split()))
cost = [None] * n
h1 = [None] * (n - 1)
h2 = [None] * (n - 2)
one_ago = H[1]
two_ago = H[0]
h1[0] = abs(two_ago - one_ago)
for i in range(2, n):
new = H[i]
h1[i - 1] = abs(one_ago - new)
h2[i - 2] = abs(two_ago - new)
two_ago, one_ago = one_ago,... | n = int(eval(input()))
h = list(map(int, input().split()))
dp = [None] * n
dp[0], dp[1] = 0, abs(h[0] - h[1])
for i in range(2, n):
dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), dp[i - 2] + abs(h[i - 2] - h[i]))
print((dp[-1]))
| false | 58.823529 | [
"-H = list(map(int, input().split()))",
"-cost = [None] * n",
"-h1 = [None] * (n - 1)",
"-h2 = [None] * (n - 2)",
"-one_ago = H[1]",
"-two_ago = H[0]",
"-h1[0] = abs(two_ago - one_ago)",
"+h = list(map(int, input().split()))",
"+dp = [None] * n",
"+dp[0], dp[1] = 0, abs(h[0] - h[1])",
"- new ... | false | 0.102695 | 0.058144 | 1.76621 | [
"s142987373",
"s381829651"
] |
u363259080 | p03086 | python | s494326920 | s434952037 | 186 | 17 | 38,256 | 2,940 | Accepted | Accepted | 90.86 | def check(s,i):
global count
count+=1
if i+1 < len(s):
if s[i+1] == 'A' or s[i+1] == 'C' or s[i+1] =='G' or s[i+1] =='T':
check(s,i+1)
s=eval(input())
count=0
list=[]
for i in range(len(s)):
count=0
if s[i] == 'A' or s[i] == 'C' or s[i] =='G' or s[i] =='T':
chec... | S = eval(input())
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)
| 17 | 8 | 364 | 174 | def check(s, i):
global count
count += 1
if i + 1 < len(s):
if s[i + 1] == "A" or s[i + 1] == "C" or s[i + 1] == "G" or s[i + 1] == "T":
check(s, i + 1)
s = eval(input())
count = 0
list = []
for i in range(len(s)):
count = 0
if s[i] == "A" or s[i] == "C" or s[i] == "G" or s[i] ... | S = eval(input())
N = len(S)
ans = 0
for i in range(N):
for j in range(i, N):
if all("ACGT".count(c) == 1 for c in S[i : j + 1]):
ans = max(ans, j - i + 1)
print(ans)
| false | 52.941176 | [
"-def check(s, i):",
"- global count",
"- count += 1",
"- if i + 1 < len(s):",
"- if s[i + 1] == \"A\" or s[i + 1] == \"C\" or s[i + 1] == \"G\" or s[i + 1] == \"T\":",
"- check(s, i + 1)",
"-",
"-",
"-s = eval(input())",
"-count = 0",
"-list = []",
"-for i in range(... | false | 0.089519 | 0.03717 | 2.408346 | [
"s494326920",
"s434952037"
] |
u517930510 | p02983 | python | s539794292 | s885949139 | 719 | 626 | 75,332 | 59,208 | Accepted | Accepted | 12.93 | l,r = list(map(int, input().split()))
if r-l+1>2019:
print((0))
exit()
L = []
for i in range(l,r):
for j in range(i+1,r+1):
a = i*j
b = a%2019
L.append(b)
print((min(L)))
| l,r = list(map(int, input().split()))
if r-l+1>2019:
print((0))
exit()
L = []
for i in range(l,r):
for j in range(i+1,r+1):
a = i*j
b = a%2019
L.append(b)
if b == 0:
break
print((min(L)))
| 11 | 13 | 189 | 218 | l, r = list(map(int, input().split()))
if r - l + 1 > 2019:
print((0))
exit()
L = []
for i in range(l, r):
for j in range(i + 1, r + 1):
a = i * j
b = a % 2019
L.append(b)
print((min(L)))
| l, r = list(map(int, input().split()))
if r - l + 1 > 2019:
print((0))
exit()
L = []
for i in range(l, r):
for j in range(i + 1, r + 1):
a = i * j
b = a % 2019
L.append(b)
if b == 0:
break
print((min(L)))
| false | 15.384615 | [
"+ if b == 0:",
"+ break"
] | false | 0.046807 | 0.04888 | 0.957585 | [
"s539794292",
"s885949139"
] |
u241159583 | p03733 | python | s673847121 | s811685792 | 219 | 146 | 26,708 | 26,708 | Accepted | Accepted | 33.33 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
t.append(t[-1])
ans = 0
for i in range(1, N+1):
if t[i] - t[i-1] > T:
ans += T
elif t[i] == t[i-1]:
ans += T
elif t[i] - t[i-1] <= T:
ans += t[i] - t[i-1]
print(ans) | n,t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = 0
for i in range(1,n):
if T[i] - T[i-1] < t:
ans += T[i] - T[i-1]
else: ans += t
ans += t
print(ans) | 13 | 9 | 267 | 198 | N, T = list(map(int, input().split()))
t = list(map(int, input().split()))
t.append(t[-1])
ans = 0
for i in range(1, N + 1):
if t[i] - t[i - 1] > T:
ans += T
elif t[i] == t[i - 1]:
ans += T
elif t[i] - t[i - 1] <= T:
ans += t[i] - t[i - 1]
print(ans)
| n, t = list(map(int, input().split()))
T = list(map(int, input().split()))
ans = 0
for i in range(1, n):
if T[i] - T[i - 1] < t:
ans += T[i] - T[i - 1]
else:
ans += t
ans += t
print(ans)
| false | 30.769231 | [
"-N, T = list(map(int, input().split()))",
"-t = list(map(int, input().split()))",
"-t.append(t[-1])",
"+n, t = list(map(int, input().split()))",
"+T = list(map(int, input().split()))",
"-for i in range(1, N + 1):",
"- if t[i] - t[i - 1] > T:",
"- ans += T",
"- elif t[i] == t[i - 1]:",
... | false | 0.043533 | 0.043267 | 1.006162 | [
"s673847121",
"s811685792"
] |
u848535504 | p02731 | python | s706465641 | s760678614 | 28 | 25 | 9,324 | 9,320 | Accepted | Accepted | 10.71 | L = int(eval(input()))
print(((L/3)**3)) | print(((int(eval(input()))/3)**3)) | 3 | 1 | 35 | 26 | L = int(eval(input()))
print(((L / 3) ** 3))
| print(((int(eval(input())) / 3) ** 3))
| false | 66.666667 | [
"-L = int(eval(input()))",
"-print(((L / 3) ** 3))",
"+print(((int(eval(input())) / 3) ** 3))"
] | false | 0.068145 | 0.0379 | 1.798031 | [
"s706465641",
"s760678614"
] |
u141786930 | p03078 | python | s736071005 | s740206280 | 46 | 42 | 5,500 | 5,268 | Accepted | Accepted | 8.7 | # D - Cake 123
import heapq
import itertools
from collections import defaultdict
x, y, z, k = list(map(int, input().split()))
A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(r... | # D - Cake 123
import heapq
import itertools
from collections import defaultdict
x, y, z, k = list(map(int, input().split()))
A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(r... | 83 | 83 | 1,895 | 1,693 | # D - Cake 123
import heapq
import itertools
from collections import defaultdict
x, y, z, k = list(map(int, input().split()))
A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
hq =... | # D - Cake 123
import heapq
import itertools
from collections import defaultdict
x, y, z, k = list(map(int, input().split()))
A = list(int(a) for a in input().split())
B = list(int(b) for b in input().split())
C = list(int(c) for c in input().split())
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
hq =... | false | 0 | [
"-heapq.heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))",
"+heapq.heappush(hq, ((A[0] + B[0] + C[0]) * -1, 0, 0, 0))",
"- val, key = heapq.heappop(hq)",
"+ val, l, m, n = heapq.heappop(hq)",
"- if d[(key[0] + 1, key[1], key[2])] == 0 and key[0] + 1 < x:",
"- heapq.heappush(",
"- ... | false | 0.037958 | 0.037131 | 1.022287 | [
"s736071005",
"s740206280"
] |
u263830634 | p04000 | python | s929603802 | s575620067 | 2,212 | 1,796 | 166,912 | 166,908 | Accepted | Accepted | 18.81 | from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
# print (ans)
tmplst = [-1, 0, 1]
dic = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmpls... | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
# print (ans)
tmplst = [-1, 0, 1]
dic = defaultdict(int)
for _ in range(N):
a, b = map(int, inp... | 25 | 29 | 708 | 855 | from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
# print (ans)
tmplst = [-1, 0, 1]
dic = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split())
a -= 1
b -= 1
for i in tmplst:
if ... | def main():
from collections import defaultdict
import sys
input = sys.stdin.readline
H, W, N = map(int, input().split())
ans = [0] * 10
ans[0] = (H - 2) * (W - 2)
# print (ans)
tmplst = [-1, 0, 1]
dic = defaultdict(int)
for _ in range(N):
a, b = map(int, input().split()... | false | 13.793103 | [
"-from collections import defaultdict",
"-import sys",
"+def main():",
"+ from collections import defaultdict",
"+ import sys",
"-input = sys.stdin.readline",
"-H, W, N = map(int, input().split())",
"-ans = [0] * 10",
"-ans[0] = (H - 2) * (W - 2)",
"-# print (ans)",
"-tmplst = [-1, 0, 1]",... | false | 0.038826 | 0.04557 | 0.852005 | [
"s929603802",
"s575620067"
] |
u024782094 | p02614 | python | s860405125 | s472319259 | 407 | 127 | 74,640 | 79,000 | Accepted | Accepted | 68.8 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,inp... | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return list(map(int,input().split()))
def lmp(): return list(map(int,inp... | 50 | 28 | 1,035 | 670 | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map... | import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input():
return sys.stdin.readline().strip()
def mp():
return list(map(int, input().split()))
def lmp():
return list(map... | false | 44 | [
"-rh = [i for i in range(h)]",
"-rw = [i for i in range(w)]",
"-lh = []",
"-lw = []",
"-for i in range(h):",
"- lh.extend(list(itertools.combinations(rh, i)))",
"-for i in range(w):",
"- lw.extend(list(itertools.combinations(rw, i)))",
"-for x in lh:",
"- for y in lw:",
"- ch = [... | false | 0.042879 | 0.040133 | 1.068432 | [
"s860405125",
"s472319259"
] |
u145231176 | p02662 | python | s786111295 | s721686945 | 418 | 334 | 151,808 | 152,452 | Accepted | Accepted | 20.1 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | 70 | 108 | 1,770 | 2,727 | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | def getN():
return int(eval(input()))
def getNM():
return list(map(int, input().split()))
def getList():
return list(map(int, input().split()))
def getArray(intn):
return [int(eval(input())) for i in range(intn)]
def input():
return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
... | false | 35.185185 | [
"-import heapq",
"-import math",
"+from heapq import heapify, heappop, heappush",
"+from math import sqrt",
"+# 集合[a1, a2...an]内で以下2つの条件を満たす部分集合の組(T, U)はいくつあるか問題",
"+# 1: U ⊆ Tである",
"+# 2: Uがある条件を満たす",
"+# Tの中にUがいくつか含まれる",
"+# ①iが進むごとにTの候補がn倍ずつ増えていく",
"+# ②その後、Uを組むためのカウントを進める",
"+\"\"\" ABC104 D... | false | 0.115766 | 0.045122 | 2.565613 | [
"s786111295",
"s721686945"
] |
u395202850 | p02882 | python | s268341304 | s962832895 | 20 | 17 | 3,316 | 3,060 | Accepted | Accepted | 15 | import math
a, b, x = list(map(int, input().split()))
theta = 0
if x * 2 >= a ** 2 * b:
ans = (2/a) * (b - x / a**2)
else:
ans = (a * b ** 2)/(2 * x)
print((math.degrees(math.atan(ans))))
| import math
a, b, x = list(map(int, input().split()))
print((math.degrees(math.atan(((2/a) * (b - x / a**2)
if x * 2 >= a ** 2 * b else (a * b ** 2)/(2 * x)))))) | 8 | 4 | 195 | 186 | import math
a, b, x = list(map(int, input().split()))
theta = 0
if x * 2 >= a**2 * b:
ans = (2 / a) * (b - x / a**2)
else:
ans = (a * b**2) / (2 * x)
print((math.degrees(math.atan(ans))))
| import math
a, b, x = list(map(int, input().split()))
print(
(
math.degrees(
math.atan(
(
(2 / a) * (b - x / a**2)
if x * 2 >= a**2 * b
else (a * b**2) / (2 * x)
)
)
)
)
)
| false | 50 | [
"-theta = 0",
"-if x * 2 >= a**2 * b:",
"- ans = (2 / a) * (b - x / a**2)",
"-else:",
"- ans = (a * b**2) / (2 * x)",
"-print((math.degrees(math.atan(ans))))",
"+print(",
"+ (",
"+ math.degrees(",
"+ math.atan(",
"+ (",
"+ (2 / a) * ... | false | 0.048105 | 0.047949 | 1.003256 | [
"s268341304",
"s962832895"
] |
u664373116 | p03013 | python | s667109594 | s065984344 | 482 | 200 | 55,640 | 8,180 | Accepted | Accepted | 58.51 |
mod=10**9+7
n,m=list(map(int,input().split()))
a=[int(eval(input())) for _ in range(m)]
fib=[1,1]
c=0
if m>0 and a[0]==1:
fib[1]=0
c+=1
for i in range(2,n+1):
if c<m and a[c]==i:
fib.append(0)
c+=1
else:
fib.append((fib[i-2]+fib[i-1])%mod)
print((fib[n])) | from collections import Counter
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input... | 19 | 37 | 309 | 656 | mod = 10**9 + 7
n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
fib = [1, 1]
c = 0
if m > 0 and a[0] == 1:
fib[1] = 0
c += 1
for i in range(2, n + 1):
if c < m and a[c] == i:
fib.append(0)
c += 1
else:
fib.append((fib[i - 2] + fib[i - 1]) % mod)
... | from collections import Counter
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)
# n=int(input())
# n,m=list(map(int,input().split()))
# a=list(map(int,input().split()))
input_list = lambda: list(map(int, input().split()... | false | 48.648649 | [
"+from collections import Counter",
"+from collections import defaultdict",
"+from collections import deque",
"+import math",
"+import itertools",
"+import heapq",
"+import sys",
"+",
"+sys.setrecursionlimit(10**6)",
"+# n=int(input())",
"+# n,m=list(map(int,input().split()))",
"+# a=list(map(... | false | 0.036891 | 0.043294 | 0.852115 | [
"s667109594",
"s065984344"
] |
u729133443 | p03958 | python | s416801715 | s595974228 | 167 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.82 | k,t,*a=list(map(int,open(0).read().split()));print((max([i+i-k-1for i in a]+[0]))) | k,t,*a=list(map(int,open(0).read().split()));print((max(max(a)*2-sum(a),1)-1)) | 1 | 1 | 74 | 70 | k, t, *a = list(map(int, open(0).read().split()))
print((max([i + i - k - 1 for i in a] + [0])))
| k, t, *a = list(map(int, open(0).read().split()))
print((max(max(a) * 2 - sum(a), 1) - 1))
| false | 0 | [
"-print((max([i + i - k - 1 for i in a] + [0])))",
"+print((max(max(a) * 2 - sum(a), 1) - 1))"
] | false | 0.035313 | 0.037988 | 0.929575 | [
"s416801715",
"s595974228"
] |
u600402037 | p03295 | python | s094425832 | s729971444 | 675 | 413 | 68,584 | 60,380 | Accepted | Accepted | 38.81 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(M)]
AB.sort(key=lambda x: [x[0], x[1]])
cur = 0
answer = 0
for a, b in AB:
if a >= cur:
answer += 1
cur = b
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(M)]
AB.sort(key=lambda x: x[1])
cur = 0
answer = 0
for a, b in AB:
if a >= cur:
answer += 1
cur = b
print(a... | 20 | 18 | 369 | 327 | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(M)]
AB.sort(key=lambda x: [x[0], x[1]])
cur = 0
answer = 0
for a, b in AB:
if a >= cur:
answer += 1
cur = b
if b < cur:
... | # coding: utf-8
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
AB = [lr() for _ in range(M)]
AB.sort(key=lambda x: x[1])
cur = 0
answer = 0
for a, b in AB:
if a >= cur:
answer += 1
cur = b
print(answer)
| false | 10 | [
"-AB.sort(key=lambda x: [x[0], x[1]])",
"+AB.sort(key=lambda x: x[1])",
"- if b < cur:",
"- cur = b"
] | false | 0.041749 | 0.12474 | 0.334687 | [
"s094425832",
"s729971444"
] |
u018679195 | p02819 | python | s675114760 | s217246672 | 25 | 17 | 2,940 | 3,060 | Accepted | Accepted | 32 | x=int(eval(input()))
flag=0
while(1):
flag=0
for i in range(2,int(x/2+1)):
if x%i==0:
flag=1
x+=1
break
if flag==0:
print(x)
break
| n=int(eval(input()))
flag=1
for i in range(n,10*n):
j=2
flag=1
while(j<=int(i**(0.5))):
if(i%j==0):
flag=0
break
j+=1
if(flag==1):
print(i)
break | 12 | 13 | 208 | 193 | x = int(eval(input()))
flag = 0
while 1:
flag = 0
for i in range(2, int(x / 2 + 1)):
if x % i == 0:
flag = 1
x += 1
break
if flag == 0:
print(x)
break
| n = int(eval(input()))
flag = 1
for i in range(n, 10 * n):
j = 2
flag = 1
while j <= int(i ** (0.5)):
if i % j == 0:
flag = 0
break
j += 1
if flag == 1:
print(i)
break
| false | 7.692308 | [
"-x = int(eval(input()))",
"-flag = 0",
"-while 1:",
"- flag = 0",
"- for i in range(2, int(x / 2 + 1)):",
"- if x % i == 0:",
"- flag = 1",
"- x += 1",
"+n = int(eval(input()))",
"+flag = 1",
"+for i in range(n, 10 * n):",
"+ j = 2",
"+ flag = 1",
... | false | 0.065287 | 0.037928 | 1.721334 | [
"s675114760",
"s217246672"
] |
u597374218 | p02951 | python | s661969540 | s255519098 | 30 | 27 | 9,152 | 9,072 | Accepted | Accepted | 10 | A,B,C=list(map(int,input().split()))
print((max(0,C-(A-B)))) | A,B,C=list(map(int,input().split()))
water=C-(A-B)
print((water if water>0 else 0)) | 2 | 3 | 53 | 77 | A, B, C = list(map(int, input().split()))
print((max(0, C - (A - B))))
| A, B, C = list(map(int, input().split()))
water = C - (A - B)
print((water if water > 0 else 0))
| false | 33.333333 | [
"-print((max(0, C - (A - B))))",
"+water = C - (A - B)",
"+print((water if water > 0 else 0))"
] | false | 0.037909 | 0.035229 | 1.076051 | [
"s661969540",
"s255519098"
] |
u133356863 | p02713 | python | s618070519 | s090041939 | 1,357 | 1,177 | 9,180 | 9,180 | Accepted | Accepted | 13.26 | import math
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
ij=math.gcd(i,j)
for k in range(1,k+1):
ans+=math.gcd(ij,k)
print(ans) | from math import gcd
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
ij=gcd(i,j)
for k in range(1,k+1):
ans+=gcd(ij,k)
print(ans) | 9 | 9 | 189 | 188 | import math
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
ij = math.gcd(i, j)
for k in range(1, k + 1):
ans += math.gcd(ij, k)
print(ans)
| from math import gcd
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
ij = gcd(i, j)
for k in range(1, k + 1):
ans += gcd(ij, k)
print(ans)
| false | 0 | [
"-import math",
"+from math import gcd",
"- ij = math.gcd(i, j)",
"+ ij = gcd(i, j)",
"- ans += math.gcd(ij, k)",
"+ ans += gcd(ij, k)"
] | false | 0.201749 | 0.145721 | 1.384489 | [
"s618070519",
"s090041939"
] |
u437351386 | p03241 | python | s700486205 | s236678083 | 1,012 | 67 | 62,900 | 63,860 | Accepted | Accepted | 93.38 | n,m=list(map(int,input().split()))
for i in range(n,10**8):
if m%i==0:
print((m//i))
exit()
print((1))
| n,m=list(map(int,input().split()))
yakusuu=[]
import math
for i in range(1,int(math.sqrt(m)+1)):
if m%i==0:
yakusuu.append(i)
yakusuu.append(m//i)
yakusuu.sort()
for num in yakusuu:
if num>=n:
print((m//num))
exit()
| 8 | 15 | 112 | 252 | n, m = list(map(int, input().split()))
for i in range(n, 10**8):
if m % i == 0:
print((m // i))
exit()
print((1))
| n, m = list(map(int, input().split()))
yakusuu = []
import math
for i in range(1, int(math.sqrt(m) + 1)):
if m % i == 0:
yakusuu.append(i)
yakusuu.append(m // i)
yakusuu.sort()
for num in yakusuu:
if num >= n:
print((m // num))
exit()
| false | 46.666667 | [
"-for i in range(n, 10**8):",
"+yakusuu = []",
"+import math",
"+",
"+for i in range(1, int(math.sqrt(m) + 1)):",
"- print((m // i))",
"+ yakusuu.append(i)",
"+ yakusuu.append(m // i)",
"+yakusuu.sort()",
"+for num in yakusuu:",
"+ if num >= n:",
"+ print((m // n... | false | 0.050612 | 0.039416 | 1.28406 | [
"s700486205",
"s236678083"
] |
u304630225 | p03610 | python | s845564917 | s427985903 | 21 | 17 | 4,268 | 3,192 | Accepted | Accepted | 19.05 | A=list(eval(input()))
print(("".join(A[::2]))) | print((input()[::2])) | 2 | 1 | 39 | 19 | A = list(eval(input()))
print(("".join(A[::2])))
| print((input()[::2]))
| false | 50 | [
"-A = list(eval(input()))",
"-print((\"\".join(A[::2])))",
"+print((input()[::2]))"
] | false | 0.044816 | 0.045064 | 0.994511 | [
"s845564917",
"s427985903"
] |
u273345915 | p02681 | python | s339757803 | s587951567 | 60 | 20 | 61,832 | 8,920 | Accepted | Accepted | 66.67 | def main():
S=eval(input())
T=eval(input())
if S==T[:len(S)]: print('Yes')
else: print('No')
return
if __name__=='__main__':
main() | def main():
S=eval(input())
T=eval(input())
if S==T[:-1]: print('Yes')
else: print('No')
return
if __name__=='__main__':
main() | 9 | 9 | 152 | 148 | def main():
S = eval(input())
T = eval(input())
if S == T[: len(S)]:
print("Yes")
else:
print("No")
return
if __name__ == "__main__":
main()
| def main():
S = eval(input())
T = eval(input())
if S == T[:-1]:
print("Yes")
else:
print("No")
return
if __name__ == "__main__":
main()
| false | 0 | [
"- if S == T[: len(S)]:",
"+ if S == T[:-1]:"
] | false | 0.064567 | 0.035889 | 1.799051 | [
"s339757803",
"s587951567"
] |
u127499732 | p03317 | python | s659522774 | s941755551 | 40 | 18 | 13,940 | 2,940 | Accepted | Accepted | 55 | def main():
n, k, *a = list(map(int, open(0).read().split()))
ans = 1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0)
print(ans)
if __name__ == '__main__':
main()
| def main():
n, k = list(map(int, input().split()))
ans = 1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0)
print(ans)
if __name__ == '__main__':
main()
| 8 | 8 | 182 | 171 | def main():
n, k, *a = list(map(int, open(0).read().split()))
ans = 1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0)
print(ans)
if __name__ == "__main__":
main()
| def main():
n, k = list(map(int, input().split()))
ans = 1 + (n - k) // (k - 1) + ((n - k) % (k - 1) != 0)
print(ans)
if __name__ == "__main__":
main()
| false | 0 | [
"- n, k, *a = list(map(int, open(0).read().split()))",
"+ n, k = list(map(int, input().split()))"
] | false | 0.047727 | 0.088823 | 0.537324 | [
"s659522774",
"s941755551"
] |
u935558307 | p03651 | python | s439364888 | s894757662 | 231 | 92 | 62,576 | 86,360 | Accepted | Accepted | 60.17 | """
KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。
"""
import sys
sys.setrecursionlimit(200000)
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
def gcd(a,b):
return a if b==0 else gcd(b,a%b)
if N ==1:
g = A[0]
else:
g = gcd(A[0],A[1])
for i in range(2,N):
g = gcd(g,A[... | import sys
sys.setrecursionlimit(200000)
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
def gcd(a,b):
return a if b==0 else gcd(b,a%b)
g = A[0]
for i in range(1,N):
g = gcd(g,A[i])
if K > max(A):
print("IMPOSSIBLE")
exit()
if K % g == 0:
print("POSSIBLE")
else:... | 21 | 16 | 402 | 339 | """
KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。
"""
import sys
sys.setrecursionlimit(200000)
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
if N == 1:
g = A[0]
else:
g = gcd(A[0], A[1])
for i in range(2, N):
g = gcd(g, ... | import sys
sys.setrecursionlimit(200000)
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
def gcd(a, b):
return a if b == 0 else gcd(b, a % b)
g = A[0]
for i in range(1, N):
g = gcd(g, A[i])
if K > max(A):
print("IMPOSSIBLE")
exit()
if K % g == 0:
print("POSSIBLE")
els... | false | 23.809524 | [
"-\"\"\"",
"-KがAの最大公約数の倍数であれば実現可能。そうでなければ実現不可能。",
"-\"\"\"",
"-if N == 1:",
"- g = A[0]",
"-else:",
"- g = gcd(A[0], A[1])",
"- for i in range(2, N):",
"- g = gcd(g, A[2])",
"-if K <= max(A) and K % g == 0:",
"+g = A[0]",
"+for i in range(1, N):",
"+ g = gcd(g, A[i])",
"... | false | 0.047521 | 0.04681 | 1.01519 | [
"s439364888",
"s894757662"
] |
u380524497 | p03108 | python | s223206952 | s679345825 | 797 | 385 | 47,584 | 36,024 | Accepted | Accepted | 51.69 | import sys
sys.setrecursionlimit(10**6)
class UnionFind:
def __init__(self, num):
self.parent = list(range(num))
self.size = [1] * num
def get_root(self, node):
root = self.parent[node]
if root == node:
return root
else:
root = sel... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else... | 56 | 60 | 1,365 | 1,727 | import sys
sys.setrecursionlimit(10**6)
class UnionFind:
def __init__(self, num):
self.parent = list(range(num))
self.size = [1] * num
def get_root(self, node):
root = self.parent[node]
if root == node:
return root
else:
root = self.get_root(ro... | import sys
input = sys.stdin.readline
class UnionFind:
def __init__(self, size):
self.parent = [-1] * size
self.rank = [1] * size
self.groups = size
def get_root(self, node):
parent = self.parent[node]
if parent == -1:
root = node
else:
... | false | 6.666667 | [
"-sys.setrecursionlimit(10**6)",
"+input = sys.stdin.readline",
"- def __init__(self, num):",
"- self.parent = list(range(num))",
"- self.size = [1] * num",
"+ def __init__(self, size):",
"+ self.parent = [-1] * size",
"+ self.rank = [1] * size",
"+ self.grou... | false | 0.040974 | 0.037857 | 1.082349 | [
"s223206952",
"s679345825"
] |
u010072501 | p02657 | python | s513086117 | s226529871 | 31 | 26 | 9,104 | 9,064 | Accepted | Accepted | 16.13 | # 169A
# A × B を求めてください
# 1.入力を受け取ること
a, b = list(map(int, input().split()))
# print(a, b)
# 2.受け取った入力値を使って計算
answer = a * b # atcoder でよく見る変数
# 3.計算した結果を出力
print(answer)
| # A - Multiplication 1
# A × B を求める
# A B の入力
a, b = list(map(int, input().split()))
# print(a)
# print(b)
# A × B の計算
answer = a * b
# 結果の表示
print(answer)
| 13 | 13 | 183 | 165 | # 169A
# A × B を求めてください
# 1.入力を受け取ること
a, b = list(map(int, input().split()))
# print(a, b)
# 2.受け取った入力値を使って計算
answer = a * b # atcoder でよく見る変数
# 3.計算した結果を出力
print(answer)
| # A - Multiplication 1
# A × B を求める
# A B の入力
a, b = list(map(int, input().split()))
# print(a)
# print(b)
# A × B の計算
answer = a * b
# 結果の表示
print(answer)
| false | 0 | [
"-# 169A",
"-# A × B を求めてください",
"-# 1.入力を受け取ること",
"+# A - Multiplication 1",
"+# A × B を求める",
"+# A B の入力",
"-# print(a, b)",
"-# 2.受け取った入力値を使って計算",
"-answer = a * b # atcoder でよく見る変数",
"-# 3.計算した結果を出力",
"+# print(a)",
"+# print(b)",
"+# A × B の計算",
"+answer = a * b",
"+# 結果の表示"
] | false | 0.037229 | 0.035863 | 1.038105 | [
"s513086117",
"s226529871"
] |
u759412327 | p03212 | python | s480008346 | s257460726 | 629 | 54 | 9,180 | 12,412 | Accepted | Accepted | 91.41 | from itertools import *
N = int(eval(input()))
ans = 0
for i in product("0357",repeat=10):
j = "".join(i)
if "0" not in str(int(j)) and "3" in j and "5" in j and "7" in j and int(j)<=N:
ans+=1
print(ans) | from itertools import *
N = int(eval(input()))
S = []
ans = 0
for n in range(10):
S+=list(product("357",repeat=n))
for s in S:
if len(set(s))==3 and int("".join(s))<=N:
ans+=1
print(ans) | 10 | 13 | 216 | 203 | from itertools import *
N = int(eval(input()))
ans = 0
for i in product("0357", repeat=10):
j = "".join(i)
if "0" not in str(int(j)) and "3" in j and "5" in j and "7" in j and int(j) <= N:
ans += 1
print(ans)
| from itertools import *
N = int(eval(input()))
S = []
ans = 0
for n in range(10):
S += list(product("357", repeat=n))
for s in S:
if len(set(s)) == 3 and int("".join(s)) <= N:
ans += 1
print(ans)
| false | 23.076923 | [
"+S = []",
"-for i in product(\"0357\", repeat=10):",
"- j = \"\".join(i)",
"- if \"0\" not in str(int(j)) and \"3\" in j and \"5\" in j and \"7\" in j and int(j) <= N:",
"+for n in range(10):",
"+ S += list(product(\"357\", repeat=n))",
"+for s in S:",
"+ if len(set(s)) == 3 and int(\"\".... | false | 1.629201 | 0.066747 | 24.40874 | [
"s480008346",
"s257460726"
] |
u814986259 | p03435 | python | s882998820 | s460526369 | 19 | 17 | 3,192 | 3,064 | Accepted | Accepted | 10.53 | c = [[]]*3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [[0]* 6]*3
for i in range(3):
arr[i][0] = c[i][0] - c[i][1]
arr[i][1] = c[i][0] - c[i][2]
arr[i][2] = c[i][1] - c[i][0]
... | c = [[]]*3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [0]*3
sum = 0
for i in range(3):
arr[0] += c[i][i]
for i in range(3):
if i + 1 < 3:
arr[1] += c[i][i+1]
... | 63 | 34 | 1,516 | 628 | c = [[]] * 3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [[0] * 6] * 3
for i in range(3):
arr[i][0] = c[i][0] - c[i][1]
arr[i][1] = c[i][0] - c[i][2]
arr[i][2] = c[i][1] - c[i][0]
arr[i][3] =... | c = [[]] * 3
for i in range(3):
c[i] = list(map(int, input().split()))
ans = 0
for i in range(3):
ans += sum(c[i])
if ans % 3 == 0:
arr = [0] * 3
sum = 0
for i in range(3):
arr[0] += c[i][i]
for i in range(3):
if i + 1 < 3:
arr[1] += c[i][i + 1]
else:
... | false | 46.031746 | [
"- arr = [[0] * 6] * 3",
"- for i in range(3):",
"- arr[i][0] = c[i][0] - c[i][1]",
"- arr[i][1] = c[i][0] - c[i][2]",
"- arr[i][2] = c[i][1] - c[i][0]",
"- arr[i][3] = c[i][1] - c[i][2]",
"- arr[i][4] = c[i][2] - c[i][0]",
"- arr[i][5] = c[i][2] - c[i][... | false | 0.069772 | 0.064406 | 1.083318 | [
"s882998820",
"s460526369"
] |
u853185302 | p03212 | python | s218335805 | s361349960 | 109 | 62 | 3,064 | 6,260 | Accepted | Accepted | 43.12 | import itertools
def calc_num(S,S_len):
result = 0;
l = [3,5,7];
i = 3;
while i <= S_len:
for v in itertools.product(l,repeat=i):
if int("".join(map(str,v))) <= S and list(set(v) & set(l)) == l:
result = result + 1;
i = i + 1;
return result
S = list(map(int,eval(input())))... | import itertools
n = int(eval(input()))
target = ["7","5","3"]
c = 0
for i in range(1,len(str(n))+1):
for p in list(itertools.product(target,repeat=i)):
if int("".join(list(p))) <= n and len(set(p))==3: c += 1
print(c)
| 17 | 9 | 408 | 231 | import itertools
def calc_num(S, S_len):
result = 0
l = [3, 5, 7]
i = 3
while i <= S_len:
for v in itertools.product(l, repeat=i):
if int("".join(map(str, v))) <= S and list(set(v) & set(l)) == l:
result = result + 1
i = i + 1
return result
S = list(ma... | import itertools
n = int(eval(input()))
target = ["7", "5", "3"]
c = 0
for i in range(1, len(str(n)) + 1):
for p in list(itertools.product(target, repeat=i)):
if int("".join(list(p))) <= n and len(set(p)) == 3:
c += 1
print(c)
| false | 47.058824 | [
"-",
"-def calc_num(S, S_len):",
"- result = 0",
"- l = [3, 5, 7]",
"- i = 3",
"- while i <= S_len:",
"- for v in itertools.product(l, repeat=i):",
"- if int(\"\".join(map(str, v))) <= S and list(set(v) & set(l)) == l:",
"- result = result + 1",
"- ... | false | 0.033332 | 0.054081 | 0.616337 | [
"s218335805",
"s361349960"
] |
u858748695 | p02861 | python | s191653949 | s384452688 | 507 | 280 | 3,064 | 13,848 | Accepted | Accepted | 44.77 | #!/usr/bin/env python3
from itertools import permutations
def f(i, j):
return ((x[i] - x[j])**2 + (y[i] - y[j])**2)**0.5
n = int(eval(input()))
x = [None] * n
y = [None] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
ans = 0
for s in permutations(list(range(n))):
tmp ... | from itertools import permutations
def dfs(p, bit):
res = 0
for k in range(n):
if bit >> k & 1:
continue
d = ((x[k] - x[p]) ** 2 + (y[k] - y[p]) ** 2) ** 0.5
res += d + dfs(k, bit | (1 << k))
return res
n = int(eval(input()))
x = [0] * n
y = [0] * n
fo... | 22 | 35 | 444 | 739 | #!/usr/bin/env python3
from itertools import permutations
def f(i, j):
return ((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2) ** 0.5
n = int(eval(input()))
x = [None] * n
y = [None] * n
for i in range(n):
x[i], y[i] = list(map(int, input().split()))
ans = 0
for s in permutations(list(range(n))):
tmp = 0
f... | from itertools import permutations
def dfs(p, bit):
res = 0
for k in range(n):
if bit >> k & 1:
continue
d = ((x[k] - x[p]) ** 2 + (y[k] - y[p]) ** 2) ** 0.5
res += d + dfs(k, bit | (1 << k))
return res
n = int(eval(input()))
x = [0] * n
y = [0] * n
for i in range(n):... | false | 37.142857 | [
"-#!/usr/bin/env python3",
"-def f(i, j):",
"- return ((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2) ** 0.5",
"+def dfs(p, bit):",
"+ res = 0",
"+ for k in range(n):",
"+ if bit >> k & 1:",
"+ continue",
"+ d = ((x[k] - x[p]) ** 2 + (y[k] - y[p]) ** 2) ** 0.5",
"+ ... | false | 0.084286 | 0.041423 | 2.034755 | [
"s191653949",
"s384452688"
] |
u586662847 | p02678 | python | s412226451 | s309637510 | 784 | 633 | 78,892 | 85,436 | Accepted | Accepted | 19.26 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split()))for i in range(m)]
ans = [0] * n
edge = [[]for _ in range(n)]
for a, b in ab:
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
visited = {0}
stack = [0]
for i in stack:
for j in edge[i]:
if j in visited:
... | def resolve():
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split()))for i in range(m)]
ans = [0] * n
edge = [[]for _ in range(n)]
for a, b in ab:
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
visited = {0}
stack = [0]
for i in stack:... | 18 | 22 | 434 | 556 | n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
ans = [0] * n
edge = [[] for _ in range(n)]
for a, b in ab:
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
visited = {0}
stack = [0]
for i in stack:
for j in edge[i]:
if j in visited:
con... | def resolve():
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
ans = [0] * n
edge = [[] for _ in range(n)]
for a, b in ab:
edge[a - 1].append(b - 1)
edge[b - 1].append(a - 1)
visited = {0}
stack = [0]
for i in stack:
... | false | 18.181818 | [
"-n, m = list(map(int, input().split()))",
"-ab = [list(map(int, input().split())) for i in range(m)]",
"-ans = [0] * n",
"-edge = [[] for _ in range(n)]",
"-for a, b in ab:",
"- edge[a - 1].append(b - 1)",
"- edge[b - 1].append(a - 1)",
"-visited = {0}",
"-stack = [0]",
"-for i in stack:",
... | false | 0.046173 | 0.048387 | 0.954241 | [
"s412226451",
"s309637510"
] |
u601082779 | p03210 | python | s671868953 | s687837314 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | print(("YNEOS"[eval(input())not in'357'::2])) | print(("YNEOS"[eval(input())in'124689'::2])) | 1 | 1 | 37 | 36 | print(("YNEOS"[eval(input()) not in "357" :: 2]))
| print(("YNEOS"[eval(input()) in "124689" :: 2]))
| false | 0 | [
"-print((\"YNEOS\"[eval(input()) not in \"357\" :: 2]))",
"+print((\"YNEOS\"[eval(input()) in \"124689\" :: 2]))"
] | false | 0.033557 | 0.037199 | 0.902103 | [
"s671868953",
"s687837314"
] |
u535803878 | p03283 | python | s100704103 | s288051702 | 2,188 | 553 | 25,764 | 87,004 | Accepted | Accepted | 74.73 | import numpy as np
n, m, q = [int(item) for item in input().split(" ")]
# n, m, q = [int(item) for item in lines[0].split(" ")]
end = np.zeros((m,2),dtype=int)
query = np.zeros((q,2),dtype=int)
for i in range(m):
end[i] = [int(item) for item in input().split(" ")]
# end[i] = [int(item) for item in line... | # ABC105D
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n,m,q = list(map(int, input().split()))
lr = [None] * m
qs = [None] * q
for i in range(m):
lr[i] = tuple([int(x)-1 for x in input().split()])
t... | 25 | 28 | 821 | 668 | import numpy as np
n, m, q = [int(item) for item in input().split(" ")]
# n, m, q = [int(item) for item in lines[0].split(" ")]
end = np.zeros((m, 2), dtype=int)
query = np.zeros((q, 2), dtype=int)
for i in range(m):
end[i] = [int(item) for item in input().split(" ")]
# end[i] = [int(item) for item in lines[1+... | # ABC105D
import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
n, m, q = list(map(int, input().split()))
lr = [None] * m
qs = [None] * q
for i in range(m):
lr[i] = tuple([int(x) - 1 for x in input().split()])
t = [[0] * (n + 1... | false | 10.714286 | [
"-import numpy as np",
"+# ABC105D",
"+import sys",
"-n, m, q = [int(item) for item in input().split(\" \")]",
"-# n, m, q = [int(item) for item in lines[0].split(\" \")]",
"-end = np.zeros((m, 2), dtype=int)",
"-query = np.zeros((q, 2), dtype=int)",
"+input = lambda: sys.stdin.readline().rstrip()",
... | false | 0.92401 | 0.042106 | 21.944702 | [
"s100704103",
"s288051702"
] |
u133936772 | p02691 | python | s584271007 | s025835393 | 267 | 203 | 62,540 | 41,072 | Accepted | Accepted | 23.97 | n,*l=list(map(int,open(0).read().split()))
from collections import*
d=defaultdict(int)
a=0
for i in range(n): d[i+l[i]]+=1; a+=d[i-l[i]]*(i>l[i])
print(a) | n,*l=list(map(int,open(0).read().split()));d,a={},0
for i in range(n):d[i+l[i]]=d.get(i+l[i],0)+1;a+=d.get(i-l[i],0)
print(a) | 6 | 3 | 153 | 121 | n, *l = list(map(int, open(0).read().split()))
from collections import *
d = defaultdict(int)
a = 0
for i in range(n):
d[i + l[i]] += 1
a += d[i - l[i]] * (i > l[i])
print(a)
| n, *l = list(map(int, open(0).read().split()))
d, a = {}, 0
for i in range(n):
d[i + l[i]] = d.get(i + l[i], 0) + 1
a += d.get(i - l[i], 0)
print(a)
| false | 50 | [
"-from collections import *",
"-",
"-d = defaultdict(int)",
"-a = 0",
"+d, a = {}, 0",
"- d[i + l[i]] += 1",
"- a += d[i - l[i]] * (i > l[i])",
"+ d[i + l[i]] = d.get(i + l[i], 0) + 1",
"+ a += d.get(i - l[i], 0)"
] | false | 0.036807 | 0.037074 | 0.99278 | [
"s584271007",
"s025835393"
] |
u401452016 | p02953 | python | s114010045 | s438740319 | 381 | 94 | 23,120 | 15,284 | Accepted | Accepted | 75.33 | import sys
import numpy as np
input = sys.stdin.readline
n = int(eval(input()))
L = np.array(list(map(int, input().split())))
for i in range(n-1, 0, -1):
if L[i]-L[i-1] ==-1:
L[i-1] -=1
if np.all(L ==sorted(L)):
print('Yes')
else:
print('No') | import sys
n, hl = sys.stdin.readlines()
n = int(n)
hl = list(map(int, hl.split()))
for i in range(n-1, 0, -1):
if hl[i] - hl[i-1] ==-1:
hl[i-1]-=1
if hl == sorted(hl):
print('Yes')
else:
print('No') | 15 | 13 | 273 | 233 | import sys
import numpy as np
input = sys.stdin.readline
n = int(eval(input()))
L = np.array(list(map(int, input().split())))
for i in range(n - 1, 0, -1):
if L[i] - L[i - 1] == -1:
L[i - 1] -= 1
if np.all(L == sorted(L)):
print("Yes")
else:
print("No")
| import sys
n, hl = sys.stdin.readlines()
n = int(n)
hl = list(map(int, hl.split()))
for i in range(n - 1, 0, -1):
if hl[i] - hl[i - 1] == -1:
hl[i - 1] -= 1
if hl == sorted(hl):
print("Yes")
else:
print("No")
| false | 13.333333 | [
"-import numpy as np",
"-input = sys.stdin.readline",
"-n = int(eval(input()))",
"-L = np.array(list(map(int, input().split())))",
"+n, hl = sys.stdin.readlines()",
"+n = int(n)",
"+hl = list(map(int, hl.split()))",
"- if L[i] - L[i - 1] == -1:",
"- L[i - 1] -= 1",
"-if np.all(L == sorte... | false | 0.207228 | 0.035068 | 5.909254 | [
"s114010045",
"s438740319"
] |
u622045059 | p03087 | python | s397580213 | s784151351 | 564 | 480 | 31,512 | 30,728 | Accepted | Accepted | 14.89 | N,Q = list(map(int, input().split()))
S = eval(input())
LR = [list([int(x)-1 for x in input().split()]) for _ in range(Q)]
L = [0 for _ in range(N)]
R = [0 for _ in range(N)]
for i in range(1,N):
if S[i-1:i+1] == 'AC':
if i == 0:
L[i] = 1
else:
L[i] = L[i-1] + 1... | N,Q = list(map(int, input().split()))
S = eval(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
c = [0] * (N+1)
for i in range(0, N):
if i+1 < N and S[i] == 'A' and S[i+1] == 'C':
c[i+1] = c[i] + 1
else:
c[i+1] = c[i]
for i in range(Q):
print((c[lr[i][1]-1] - c... | 25 | 14 | 466 | 323 | N, Q = list(map(int, input().split()))
S = eval(input())
LR = [list([int(x) - 1 for x in input().split()]) for _ in range(Q)]
L = [0 for _ in range(N)]
R = [0 for _ in range(N)]
for i in range(1, N):
if S[i - 1 : i + 1] == "AC":
if i == 0:
L[i] = 1
else:
L[i] = L[i - 1] + 1
... | N, Q = list(map(int, input().split()))
S = eval(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
c = [0] * (N + 1)
for i in range(0, N):
if i + 1 < N and S[i] == "A" and S[i + 1] == "C":
c[i + 1] = c[i] + 1
else:
c[i + 1] = c[i]
for i in range(Q):
print((c[lr[i][1] - 1] - c[... | false | 44 | [
"-LR = [list([int(x) - 1 for x in input().split()]) for _ in range(Q)]",
"-L = [0 for _ in range(N)]",
"-R = [0 for _ in range(N)]",
"-for i in range(1, N):",
"- if S[i - 1 : i + 1] == \"AC\":",
"- if i == 0:",
"- L[i] = 1",
"- else:",
"- L[i] = L[i - 1] + 1",
... | false | 0.070675 | 0.069333 | 1.019353 | [
"s397580213",
"s784151351"
] |
u125505541 | p03286 | python | s294187512 | s558297973 | 559 | 471 | 5,916 | 5,948 | Accepted | Accepted | 15.74 | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
for j in range(16):
if (i >> j) & 1:
temp += (-2) ** (2 *j)
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 << 16):
temp2 = 0
for j in range(16):
... | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
x = 1
for j in range(16):
if (i >> j) & 1:
# temp += (-2) ** (2 *j)
temp += x
x *= 4
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 ... | 43 | 49 | 918 | 1,026 | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
for j in range(16):
if (i >> j) & 1:
temp += (-2) ** (2 * j)
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 << 16):
temp2 = 0
for j in range(16):
if (i >> j) & 1:
... | import bisect
n = int(eval(input()))
ps = [0] * (1 << 16)
for i in range(1 << 16):
temp = 0
x = 1
for j in range(16):
if (i >> j) & 1:
# temp += (-2) ** (2 *j)
temp += x
x *= 4
ps[i] = temp
pattern1 = None
pattern2 = None
for i in range(1 << 16):
... | false | 12.244898 | [
"+ x = 1",
"- temp += (-2) ** (2 * j)",
"+ # temp += (-2) ** (2 *j)",
"+ temp += x",
"+ x *= 4",
"+ x = -2",
"- temp2 += (-2) ** (2 * j + 1)",
"+ # temp2 += (-2) ** (2 *j + 1)",
"+ temp2 += x... | false | 0.965742 | 0.689737 | 1.40016 | [
"s294187512",
"s558297973"
] |
u103341055 | p03448 | python | s161304365 | s892406364 | 55 | 31 | 9,128 | 9,172 | Accepted | Accepted | 43.64 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
# これだとダメ
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x ... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
# これだとダメ
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x ... | 26 | 39 | 490 | 704 | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
# これだとダメ
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x == 0:
# ... | A = int(eval(input()))
B = int(eval(input()))
C = int(eval(input()))
X = int(eval(input()))
ans = 0
# これだとダメ
# for a in range(A+1):
# x = X - a*500
# for b in range(B+1):
# x -= b*100
# for c in range(C+1):
# x -= c*50
# print(a,b,c,x)
# if x == 0:
# ... | false | 33.333333 | [
"+# これはOK",
"+# for a in range(A+1):",
"+# for b in range(B+1):",
"+# for c in range(C+1):",
"+# if 500*a+100*b+50*c == X:",
"+# ans += 1",
"+# こう書くとfor文一回省ける",
"- for c in range(C + 1):",
"- if 500 * a + 100 * b + 50 * c == X:",
"+ ... | false | 0.272814 | 0.083692 | 3.259728 | [
"s161304365",
"s892406364"
] |
u604839890 | p03805 | python | s253501400 | s043845834 | 53 | 46 | 14,008 | 13,868 | Accepted | Accepted | 13.21 | import itertools
n, m = list(map(int, input().split()))
h = [[0]*n for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
h[a-1][b-1] = 1
h[b-1][a-1] = 1
ans = 0
x = list(itertools.permutations(list(range(1, n+1))))
for i in range(len(x)):
if x[i][0] == 1:
fo... | import itertools
n, m = list(map(int, input().split()))
g = [[0]*n for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a, b = a-1, b-1
g[a][b] = 1
g[b][a] = 1
a = list(itertools.permutations(list(range(n))))
ans = 0
for i in a:
if i[0] != 0:
break
... | 19 | 21 | 440 | 418 | import itertools
n, m = list(map(int, input().split()))
h = [[0] * n for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
h[a - 1][b - 1] = 1
h[b - 1][a - 1] = 1
ans = 0
x = list(itertools.permutations(list(range(1, n + 1))))
for i in range(len(x)):
if x[i][0] == 1:
for ... | import itertools
n, m = list(map(int, input().split()))
g = [[0] * n for _ in range(n)]
for _ in range(m):
a, b = list(map(int, input().split()))
a, b = a - 1, b - 1
g[a][b] = 1
g[b][a] = 1
a = list(itertools.permutations(list(range(n))))
ans = 0
for i in a:
if i[0] != 0:
break
for j in... | false | 9.52381 | [
"-h = [[0] * n for _ in range(n)]",
"-for i in range(m):",
"+g = [[0] * n for _ in range(n)]",
"+for _ in range(m):",
"- h[a - 1][b - 1] = 1",
"- h[b - 1][a - 1] = 1",
"+ a, b = a - 1, b - 1",
"+ g[a][b] = 1",
"+ g[b][a] = 1",
"+a = list(itertools.permutations(list(range(n))))",
"... | false | 0.173022 | 0.16794 | 1.03026 | [
"s253501400",
"s043845834"
] |
u847467233 | p00099 | python | s884302893 | s018190656 | 2,070 | 1,150 | 122,992 | 27,724 | Accepted | Accepted | 44.44 | # AOJ 0099 Surf Smelt Fishing Contest II
# Python3 2018.6.22 bal4u
import heapq
MAX = 1000000
SFT = 20 # 2**20 = 1048576 > MAX
Q = []
# tbl[0:キー, 1:Magic]
tbl = [[0 for j in range(2)] for i in range(MAX+2)]
n, q = list(map(int, input().split()))
for i in range(q):
id, v = list(map(int, input().split()))
... | # AOJ 0099 Surf Smelt Fishing Contest II
# Python3 2018.6.22 bal4u
import heapq
MAX = 1000000
SFT = 20 # 2**20 = 1048576 > MAX
Q = []
# tbl[0:キー, 1:Magic]
n, q = list(map(int, input().split()))
tbl = [0]*(n+1)
for i in range(q):
id, v = list(map(int, input().split()))
tbl[id] += v
heapq.heappush(Q, (... | 22 | 21 | 544 | 469 | # AOJ 0099 Surf Smelt Fishing Contest II
# Python3 2018.6.22 bal4u
import heapq
MAX = 1000000
SFT = 20 # 2**20 = 1048576 > MAX
Q = []
# tbl[0:キー, 1:Magic]
tbl = [[0 for j in range(2)] for i in range(MAX + 2)]
n, q = list(map(int, input().split()))
for i in range(q):
id, v = list(map(int, input().split()))
tbl... | # AOJ 0099 Surf Smelt Fishing Contest II
# Python3 2018.6.22 bal4u
import heapq
MAX = 1000000
SFT = 20 # 2**20 = 1048576 > MAX
Q = []
# tbl[0:キー, 1:Magic]
n, q = list(map(int, input().split()))
tbl = [0] * (n + 1)
for i in range(q):
id, v = list(map(int, input().split()))
tbl[id] += v
heapq.heappush(Q, ((... | false | 4.545455 | [
"-tbl = [[0 for j in range(2)] for i in range(MAX + 2)]",
"+tbl = [0] * (n + 1)",
"- tbl[id][0] += v",
"- tbl[id][1] += 1",
"- heapq.heappush(Q, ((-tbl[id][0] << SFT) | id, id, tbl[id][1]))",
"+ tbl[id] += v",
"+ heapq.heappush(Q, ((-tbl[id] << SFT) | id, id, tbl[id]))",
"- f, id... | false | 1.45696 | 0.037358 | 39.000402 | [
"s884302893",
"s018190656"
] |
u197300260 | p03495 | python | s030551009 | s867051982 | 145 | 106 | 44,184 | 36,504 | Accepted | Accepted | 26.9 | # Problem: atcoder.jp/contests/abc081/tasks/arc086_a
# Python 1st Try
import sys
# from collections import defaultdict
import collections as col
# import pprint
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().s... | # Problem: https://atcoder.jp/contests/abc081/tasks/arc086_a
# Python 2nd Try
import sys
from collections import Counter
# import heapq,copy
# from collections import deque
def II(): return int(sys.stdin.readline())
def MI(): return list(map(int, sys.stdin.readline().split()))
def LI(): return list(map(int, s... | 40 | 33 | 1,227 | 1,009 | # Problem: atcoder.jp/contests/abc081/tasks/arc086_a
# Python 1st Try
import sys
# from collections import defaultdict
import collections as col
# import pprint
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().... | # Problem: https://atcoder.jp/contests/abc081/tasks/arc086_a
# Python 2nd Try
import sys
from collections import Counter
# import heapq,copy
# from collections import deque
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map... | false | 17.5 | [
"-# Problem: atcoder.jp/contests/abc081/tasks/arc086_a",
"-# Python 1st Try",
"+# Problem: https://atcoder.jp/contests/abc081/tasks/arc086_a",
"+# Python 2nd Try",
"+from collections import Counter",
"-# from collections import defaultdict",
"-import collections as col",
"-",
"-# import pprint",
"... | false | 0.05348 | 0.042039 | 1.272171 | [
"s030551009",
"s867051982"
] |
u941047297 | p03721 | python | s739929591 | s347931168 | 630 | 233 | 55,640 | 21,244 | Accepted | Accepted | 63.02 | from collections import defaultdict
def main():
n, k = list(map(int, input().split()))
d = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
d[a] += b
A = sorted(list(d.items()), key = lambda x: x[0])
count = 0
for a in A:
count += a[1]
... | from collections import defaultdict
def main():
n, k = list(map(int, input().split()))
D = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
D[a] += b
for d in sorted(list(D.items()), key = lambda x: x[0]):
k -= d[1]
if k <= 0:
... | 17 | 15 | 425 | 378 | from collections import defaultdict
def main():
n, k = list(map(int, input().split()))
d = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
d[a] += b
A = sorted(list(d.items()), key=lambda x: x[0])
count = 0
for a in A:
count += a[1]
if... | from collections import defaultdict
def main():
n, k = list(map(int, input().split()))
D = defaultdict(int)
for _ in range(n):
a, b = list(map(int, input().split()))
D[a] += b
for d in sorted(list(D.items()), key=lambda x: x[0]):
k -= d[1]
if k <= 0:
print((... | false | 11.764706 | [
"- d = defaultdict(int)",
"+ D = defaultdict(int)",
"- d[a] += b",
"- A = sorted(list(d.items()), key=lambda x: x[0])",
"- count = 0",
"- for a in A:",
"- count += a[1]",
"- if count >= k:",
"- print((a[0]))",
"- exit()",
"+ D[a] +... | false | 0.057075 | 0.080415 | 0.709753 | [
"s739929591",
"s347931168"
] |
u332906195 | p03137 | python | s842430337 | s749573021 | 119 | 102 | 13,960 | 13,968 | Accepted | Accepted | 14.29 | # -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
diffX = [X[i + 1] - X[i] for i in range(len(X) - 1)]
diffX.sort()
ans = X[-1] - X[0]
for i in range(N - 1):
ans -= diffX[-(i + 1)]
print(ans)
| N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
D = sorted([X[i + 1] - X[i] for i in range(M - 1)])
print((X[-1] - X[0] - sum(D[-(N - 1):]) if N > 1 else X[-1] - X[0]))
| 18 | 4 | 305 | 199 | # -*- coding: utf-8 -*-
N, M = list(map(int, input().split()))
X = list(map(int, input().split()))
X.sort()
if N >= M:
print((0))
exit()
diffX = [X[i + 1] - X[i] for i in range(len(X) - 1)]
diffX.sort()
ans = X[-1] - X[0]
for i in range(N - 1):
ans -= diffX[-(i + 1)]
print(ans)
| N, M = list(map(int, input().split()))
X = sorted(list(map(int, input().split())))
D = sorted([X[i + 1] - X[i] for i in range(M - 1)])
print((X[-1] - X[0] - sum(D[-(N - 1) :]) if N > 1 else X[-1] - X[0]))
| false | 77.777778 | [
"-# -*- coding: utf-8 -*-",
"-X = list(map(int, input().split()))",
"-X.sort()",
"-if N >= M:",
"- print((0))",
"- exit()",
"-diffX = [X[i + 1] - X[i] for i in range(len(X) - 1)]",
"-diffX.sort()",
"-ans = X[-1] - X[0]",
"-for i in range(N - 1):",
"- ans -= diffX[-(i + 1)]",
"-print(a... | false | 0.037176 | 0.036726 | 1.012263 | [
"s842430337",
"s749573021"
] |
u312025627 | p03545 | python | s931096950 | s728204631 | 189 | 17 | 38,332 | 3,064 | Accepted | Accepted | 91.01 | def main():
S = input()
a, b, c, d = (int(i) for i in S)
ans = 0
sign = []
flag = False
#op == 0 : plus, op == 1: minus
for op1 in range(2):
for op2 in range(2):
for op3 in range(2):
ans = 0
sign = []
if op1 == 0... | def main():
S = eval(input())
op = ['+', '-']
def calc(cur):
ret = int(S[0])
for i in range(3):
if cur[i] == "+":
ret += int(S[i+1])
else:
ret -= int(S[i+1])
return ret
for i in range(1 << 3):
cur = []
... | 45 | 26 | 1,176 | 626 | def main():
S = input()
a, b, c, d = (int(i) for i in S)
ans = 0
sign = []
flag = False
# op == 0 : plus, op == 1: minus
for op1 in range(2):
for op2 in range(2):
for op3 in range(2):
ans = 0
sign = []
if op1 == 0:
... | def main():
S = eval(input())
op = ["+", "-"]
def calc(cur):
ret = int(S[0])
for i in range(3):
if cur[i] == "+":
ret += int(S[i + 1])
else:
ret -= int(S[i + 1])
return ret
for i in range(1 << 3):
cur = []
... | false | 42.222222 | [
"- S = input()",
"- a, b, c, d = (int(i) for i in S)",
"- ans = 0",
"- sign = []",
"- flag = False",
"- # op == 0 : plus, op == 1: minus",
"- for op1 in range(2):",
"- for op2 in range(2):",
"- for op3 in range(2):",
"- ans = 0",
"- ... | false | 0.052754 | 0.052136 | 1.011856 | [
"s931096950",
"s728204631"
] |
u654470292 | p02813 | python | s574986672 | s941676817 | 218 | 102 | 46,576 | 80,964 | Accepted | Accepted | 53.21 | import sys
import itertools
def input():
return sys.stdin.readline()[:-1]
n=int(eval(input()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
li=[]
for i in range(n):
li.append(i+1)
a=list(itertools.permutations(li))
tmp=[0,0]
for i in range(len(a)):
if list(a[i])==p:
... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
def celi(a,b):
return -(-a//b)
sys.... | 19 | 34 | 394 | 782 | import sys
import itertools
def input():
return sys.stdin.readline()[:-1]
n = int(eval(input()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
li = []
for i in range(n):
li.append(i + 1)
a = list(itertools.permutations(li))
tmp = [0, 0]
for i in range(len(a)):
if list(a[i]) == ... | import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0] + list(accumulate(lst))
def celi(a, b):
return -(-a // b)
s... | false | 44.117647 | [
"-import sys",
"-import itertools",
"+import bisect, copy, heapq, math, sys",
"+from collections import *",
"+from functools import lru_cache",
"+from itertools import accumulate, combinations, permutations, product",
"+def ruiseki(lst):",
"+ return [0] + list(accumulate(lst))",
"+",
"+",
"+d... | false | 0.038606 | 0.038096 | 1.013392 | [
"s574986672",
"s941676817"
] |
u186838327 | p02837 | python | s421488153 | s434939341 | 285 | 137 | 43,484 | 74,216 | Accepted | Accepted | 51.93 | n = int(eval(input()))
X = [[] for _ in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
x = x-1
X[i].append((x, y))
ans = 0
for i in range(2**n):
cnt = 0
temp = [-1]*n
for j in range(n):
if (... | n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
x -= 1
g[i].append((x, y))
ans = 0
for i in range(2**n):
temp = [-1]*n
for j in range(n):
if (i >> j) & ... | 28 | 28 | 623 | 597 | n = int(eval(input()))
X = [[] for _ in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
x = x - 1
X[i].append((x, y))
ans = 0
for i in range(2**n):
cnt = 0
temp = [-1] * n
for j in range(n):
if (i >> j) & 1... | n = int(eval(input()))
g = [[] for _ in range(n)]
for i in range(n):
a = int(eval(input()))
for j in range(a):
x, y = list(map(int, input().split()))
x -= 1
g[i].append((x, y))
ans = 0
for i in range(2**n):
temp = [-1] * n
for j in range(n):
if (i >> j) & 1:
t... | false | 0 | [
"-X = [[] for _ in range(n)]",
"+g = [[] for _ in range(n)]",
"- x = x - 1",
"- X[i].append((x, y))",
"+ x -= 1",
"+ g[i].append((x, y))",
"- cnt = 0",
"- cnt += 1",
"- if (i >> j) & 1:",
"- for x, y in X[j]:",
"+ if temp[j] == 1... | false | 0.036844 | 0.036306 | 1.014806 | [
"s421488153",
"s434939341"
] |
u271469978 | p03137 | python | s482946345 | s052205963 | 121 | 111 | 13,968 | 13,968 | Accepted | Accepted | 8.26 | n, m = list(map(int, input().split()))
x = sorted(map(int, input().split()))
if n >= m:
print((0))
else:
dif = []
for i in range(m-1):
dif.append(x[i + 1] - x[i])
dif = sorted(dif)
for _ in range(n-1):
dif.pop()
print((sum(dif))) | n, m = list(map(int, input().split()))
x = sorted(map(int, input().split()))
if n >= m:
print((0))
else:
dif = []
for i in range(m-1):
dif.append(x[i + 1] - x[i])
print((sum(dif) if n == 1 else sum(sorted(dif)[:-(n-1)])))
| 12 | 9 | 270 | 244 | n, m = list(map(int, input().split()))
x = sorted(map(int, input().split()))
if n >= m:
print((0))
else:
dif = []
for i in range(m - 1):
dif.append(x[i + 1] - x[i])
dif = sorted(dif)
for _ in range(n - 1):
dif.pop()
print((sum(dif)))
| n, m = list(map(int, input().split()))
x = sorted(map(int, input().split()))
if n >= m:
print((0))
else:
dif = []
for i in range(m - 1):
dif.append(x[i + 1] - x[i])
print((sum(dif) if n == 1 else sum(sorted(dif)[: -(n - 1)])))
| false | 25 | [
"- dif = sorted(dif)",
"- for _ in range(n - 1):",
"- dif.pop()",
"- print((sum(dif)))",
"+ print((sum(dif) if n == 1 else sum(sorted(dif)[: -(n - 1)])))"
] | false | 0.040321 | 0.037169 | 1.084806 | [
"s482946345",
"s052205963"
] |
u312025627 | p02726 | python | s207314245 | s328961649 | 461 | 117 | 80,348 | 74,916 | Accepted | Accepted | 74.62 | def main():
from collections import deque
N, X, Y = (int(i) for i in input().split())
X -= 1
Y -= 1
edge = [[] for _ in range(N)]
for i in range(N-1):
edge[i].append(i+1)
edge[i+1].append(i)
edge[X].append(Y)
edge[Y].append(X)
def bfs(s):
d = [-1... | def main():
N, X, Y = (int(i) for i in input().split())
cnt = [0]*N
for i in range(1, N+1):
for j in range(i+1, N+1):
d = min(abs(i-j), abs(i-X)+1+abs(j-Y), abs(i-X)+abs(X-Y)+abs(j-Y))
cnt[d] += 1
for d in cnt[1:]:
print(d)
if __name__ == '__main__':
... | 39 | 13 | 910 | 332 | def main():
from collections import deque
N, X, Y = (int(i) for i in input().split())
X -= 1
Y -= 1
edge = [[] for _ in range(N)]
for i in range(N - 1):
edge[i].append(i + 1)
edge[i + 1].append(i)
edge[X].append(Y)
edge[Y].append(X)
def bfs(s):
d = [-1 for _... | def main():
N, X, Y = (int(i) for i in input().split())
cnt = [0] * N
for i in range(1, N + 1):
for j in range(i + 1, N + 1):
d = min(
abs(i - j),
abs(i - X) + 1 + abs(j - Y),
abs(i - X) + abs(X - Y) + abs(j - Y),
)
... | false | 66.666667 | [
"- from collections import deque",
"-",
"- X -= 1",
"- Y -= 1",
"- edge = [[] for _ in range(N)]",
"- for i in range(N - 1):",
"- edge[i].append(i + 1)",
"- edge[i + 1].append(i)",
"- edge[X].append(Y)",
"- edge[Y].append(X)",
"-",
"- def bfs(s):",
"- ... | false | 0.036257 | 0.035799 | 1.012802 | [
"s207314245",
"s328961649"
] |
u790710233 | p02927 | python | s886833902 | s578361756 | 23 | 19 | 2,940 | 3,060 | Accepted | Accepted | 17.39 | M, D = list(map(int, input().split()))
ans = 0
for m in range(1, M+1):
for d in range(20, D + 1):
a, b = list(map(int, str(d)))
if b < 2:
continue
elif m == a*b:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
M, D = list(map(int, input().split()))
ans = 0
for d in range(20, D + 1):
for m in range(1, M+1):
a, b = d//10, d % 10
if m == a*b and b >= 2:
ans += 1
print(ans)
| 13 | 16 | 237 | 276 | M, D = list(map(int, input().split()))
ans = 0
for m in range(1, M + 1):
for d in range(20, D + 1):
a, b = list(map(int, str(d)))
if b < 2:
continue
elif m == a * b:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
M, D = list(map(int, input().split()))
ans = 0
for d in range(20, D + 1):
for m in range(1, M + 1):
a, b = d // 10, d % 10
if m == a * b and b >= 2:
ans += 1
print(ans)
| false | 18.75 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"+sys.setrecursionlimit(10**7)",
"-for m in range(1, M + 1):",
"- for d in range(20, D + 1):",
"- a, b = list(map(int, str(d)))",
"- if b < 2:",
"- continue",
"- elif m == a * b:",
"+for d in range(20, D + 1):"... | false | 0.037347 | 0.03736 | 0.999671 | [
"s886833902",
"s578361756"
] |
u641722141 | p02687 | python | s237830948 | s526958458 | 23 | 20 | 9,020 | 8,972 | Accepted | Accepted | 13.04 | s = eval(input())
print(("ABC" if s == "ARC" else "ARC")) | print(("ABC" if eval(input())=="ARC" else "ARC")) | 2 | 1 | 50 | 41 | s = eval(input())
print(("ABC" if s == "ARC" else "ARC"))
| print(("ABC" if eval(input()) == "ARC" else "ARC"))
| false | 50 | [
"-s = eval(input())",
"-print((\"ABC\" if s == \"ARC\" else \"ARC\"))",
"+print((\"ABC\" if eval(input()) == \"ARC\" else \"ARC\"))"
] | false | 0.046648 | 0.008242 | 5.659642 | [
"s237830948",
"s526958458"
] |
u595289165 | p02948 | python | s952656901 | s481089316 | 643 | 318 | 31,676 | 24,044 | Accepted | Accepted | 50.54 | import heapq
n, m = list(map(int, input().split()))
work = [list(map(int, input().split())) for _ in range(n)]
work.sort()
cd = []
heapq.heapify(cd)
cnt = 0
ans = 0
# b, a
# aの条件
for k in range(m+1):
# a = kの仕事をheappush
for i in range(cnt, n):
a, b = work[i]
if a == k:
... | import heapq
n, m = list(map(int, input().split()))
byte = [[] for _ in range(100001)]
for _ in range(n):
a, b = list(map(int, input().split()))
byte[a].append(b)
search = []
day = 1
ans = 0
while day-1 != m:
for b in byte[day]:
heapq.heappush(search, -b)
if not search:
da... | 32 | 24 | 528 | 417 | import heapq
n, m = list(map(int, input().split()))
work = [list(map(int, input().split())) for _ in range(n)]
work.sort()
cd = []
heapq.heapify(cd)
cnt = 0
ans = 0
# b, a
# aの条件
for k in range(m + 1):
# a = kの仕事をheappush
for i in range(cnt, n):
a, b = work[i]
if a == k:
heapq.heapp... | import heapq
n, m = list(map(int, input().split()))
byte = [[] for _ in range(100001)]
for _ in range(n):
a, b = list(map(int, input().split()))
byte[a].append(b)
search = []
day = 1
ans = 0
while day - 1 != m:
for b in byte[day]:
heapq.heappush(search, -b)
if not search:
day += 1
... | false | 25 | [
"-work = [list(map(int, input().split())) for _ in range(n)]",
"-work.sort()",
"-cd = []",
"-heapq.heapify(cd)",
"-cnt = 0",
"+byte = [[] for _ in range(100001)]",
"+for _ in range(n):",
"+ a, b = list(map(int, input().split()))",
"+ byte[a].append(b)",
"+search = []",
"+day = 1",
"-# b,... | false | 0.041369 | 0.098985 | 0.417933 | [
"s952656901",
"s481089316"
] |
u850491413 | p02889 | python | s965956137 | s336735726 | 1,156 | 1,023 | 19,940 | 19,940 | Accepted | Accepted | 11.51 | from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np
import sys
def input():
return sys.stdin.readline().strip()
N, M, L = list(map(int, input().split()))
A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i i... | from scipy.sparse import csr_matrix #pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np
import sys
def input():
return sys.stdin.readline().strip()
N, M, L = list(map(int, input().split()))
A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i i... | 38 | 36 | 901 | 842 | from scipy.sparse import csr_matrix # pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np
import sys
def input():
return sys.stdin.readline().strip()
N, M, L = list(map(int, input().split()))
A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i in range... | from scipy.sparse import csr_matrix # pypyだとエラーになるので、pythonを使うこと
from scipy.sparse.csgraph import shortest_path, floyd_warshall
import numpy as np
import sys
def input():
return sys.stdin.readline().strip()
N, M, L = list(map(int, input().split()))
A = np.zeros(M)
B = np.zeros(M)
C = np.zeros(M)
for i in range... | false | 5.263158 | [
"-for i in range(N):",
"- for j in range(N):",
"- if dist[i, j] <= L:",
"- graph2[i, j] = 1",
"+graph2[dist <= L] = 1",
"-num = shortest_path(graph2, directed=False)",
"+num = floyd_warshall(graph2, directed=False)"
] | false | 0.436671 | 0.52416 | 0.833088 | [
"s965956137",
"s336735726"
] |
u106797249 | p03074 | python | s375633478 | s349382943 | 225 | 61 | 61,552 | 7,924 | Accepted | Accepted | 72.89 | def resolve():
N, K = list(map(int, input().split()))
S = eval(input())
seq = []
cnt = 0
for i in range(len(S)):
if i == N-1 or S[i] != S[i+1]:
seq.append([cnt+1, S[i]])
cnt = 0
else:
cnt += 1
#print(seq)
left = 0
right = 0... | # 累積和による解法
def resolve():
N, K = list(map(int, input().split()))
S = eval(input())
seq = []
cnt = 0
if S[0] != "1":
seq.append(0)
for i in range(len(S)-1):
if S[i] != S[i+1]:
seq.append(cnt+1)
cnt = 0
else:
cnt += 1
se... | 37 | 35 | 947 | 742 | def resolve():
N, K = list(map(int, input().split()))
S = eval(input())
seq = []
cnt = 0
for i in range(len(S)):
if i == N - 1 or S[i] != S[i + 1]:
seq.append([cnt + 1, S[i]])
cnt = 0
else:
cnt += 1
# print(seq)
left = 0
right = 0
m... | # 累積和による解法
def resolve():
N, K = list(map(int, input().split()))
S = eval(input())
seq = []
cnt = 0
if S[0] != "1":
seq.append(0)
for i in range(len(S) - 1):
if S[i] != S[i + 1]:
seq.append(cnt + 1)
cnt = 0
else:
cnt += 1
seq.append... | false | 5.405405 | [
"+# 累積和による解法",
"- for i in range(len(S)):",
"- if i == N - 1 or S[i] != S[i + 1]:",
"- seq.append([cnt + 1, S[i]])",
"+ if S[0] != \"1\":",
"+ seq.append(0)",
"+ for i in range(len(S) - 1):",
"+ if S[i] != S[i + 1]:",
"+ seq.append(cnt + 1)",
"+ ... | false | 0.036532 | 0.033462 | 1.091738 | [
"s375633478",
"s349382943"
] |
u717626627 | p02911 | python | s095769234 | s661768333 | 392 | 258 | 20,116 | 6,596 | Accepted | Accepted | 34.18 | import numpy as np
n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
score = [k - q]*(n+1)
for i in range(q):
score[a[i]] += 1
for i in range(1,n+1):
if score[i] > 0:
print('Yes')
else:
print('No') | n,k,q = list(map(int, input().split()))
score = [k - q]*(n+1)
for _ in range(q):
score[int(eval(input()))] += 1
for i in range(1, n+1):
if score[i] > 0:
print('Yes')
else:
print('No') | 15 | 12 | 252 | 199 | import numpy as np
n, k, q = list(map(int, input().split()))
a = [int(eval(input())) for i in range(q)]
score = [k - q] * (n + 1)
for i in range(q):
score[a[i]] += 1
for i in range(1, n + 1):
if score[i] > 0:
print("Yes")
else:
print("No")
| n, k, q = list(map(int, input().split()))
score = [k - q] * (n + 1)
for _ in range(q):
score[int(eval(input()))] += 1
for i in range(1, n + 1):
if score[i] > 0:
print("Yes")
else:
print("No")
| false | 20 | [
"-import numpy as np",
"-",
"-a = [int(eval(input())) for i in range(q)]",
"-for i in range(q):",
"- score[a[i]] += 1",
"+for _ in range(q):",
"+ score[int(eval(input()))] += 1"
] | false | 0.037486 | 0.038078 | 0.984456 | [
"s095769234",
"s661768333"
] |
u893063840 | p03700 | python | s756997784 | s813200713 | 1,391 | 374 | 7,192 | 17,024 | Accepted | Accepted | 73.11 | from math import ceil
n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(n)]
def f(x):
cnt = 0
for e in h:
cnt += max(0, ceil((e - b * x) / (a - b)))
if cnt > x:
return False
return True
l = 0
r = ceil(max(h) / b)
while r - l > 1:
... | import numpy as np
n, a, b = list(map(int, input().split()))
h = np.array([int(eval(input())) for _ in range(n)], dtype=np.int64)
def f(x):
li = h - b * x
li[li < 0] = 0
cnt = np.ceil(li / (a - b))
ret = cnt.sum() <= x
return ret
l = 0
r = np.ceil(max(h) / b).astype(np.int64)
wh... | 27 | 24 | 404 | 420 | from math import ceil
n, a, b = list(map(int, input().split()))
h = [int(eval(input())) for _ in range(n)]
def f(x):
cnt = 0
for e in h:
cnt += max(0, ceil((e - b * x) / (a - b)))
if cnt > x:
return False
return True
l = 0
r = ceil(max(h) / b)
while r - l > 1:
mid = (l + r) // 2... | import numpy as np
n, a, b = list(map(int, input().split()))
h = np.array([int(eval(input())) for _ in range(n)], dtype=np.int64)
def f(x):
li = h - b * x
li[li < 0] = 0
cnt = np.ceil(li / (a - b))
ret = cnt.sum() <= x
return ret
l = 0
r = np.ceil(max(h) / b).astype(np.int64)
while r - l > 1:
... | false | 11.111111 | [
"-from math import ceil",
"+import numpy as np",
"-h = [int(eval(input())) for _ in range(n)]",
"+h = np.array([int(eval(input())) for _ in range(n)], dtype=np.int64)",
"- cnt = 0",
"- for e in h:",
"- cnt += max(0, ceil((e - b * x) / (a - b)))",
"- if cnt > x:",
"- return Fal... | false | 0.061501 | 0.187408 | 0.328168 | [
"s756997784",
"s813200713"
] |
u556358547 | p02989 | python | s593286335 | s573129025 | 469 | 96 | 81,132 | 80,976 | Accepted | Accepted | 79.53 | #!/usr/bin/env python3
import sys
def solve(N: int, d: "List[int]"):
b = [0] * (10**5 +1)
for i in range(N):
b[d[i]] += 1
t = 0
f = False
ans = 0
for i in range(1, 10 ** 5 + 1):
if not f:
t += b[i]
if t == N / 2:
f = True
... | #!/usr/bin/env python3
import sys
def solve(N: int, d: "List[int]"):
d.sort()
abc = d[int(N/2)-1]
arc = d[int(N/2)]
print((arc-abc))
return
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by us... | 43 | 26 | 1,027 | 681 | #!/usr/bin/env python3
import sys
def solve(N: int, d: "List[int]"):
b = [0] * (10**5 + 1)
for i in range(N):
b[d[i]] += 1
t = 0
f = False
ans = 0
for i in range(1, 10**5 + 1):
if not f:
t += b[i]
if t == N / 2:
f = True
elif ... | #!/usr/bin/env python3
import sys
def solve(N: int, d: "List[int]"):
d.sort()
abc = d[int(N / 2) - 1]
arc = d[int(N / 2)]
print((arc - abc))
return
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using yo... | false | 39.534884 | [
"- b = [0] * (10**5 + 1)",
"- for i in range(N):",
"- b[d[i]] += 1",
"- t = 0",
"- f = False",
"- ans = 0",
"- for i in range(1, 10**5 + 1):",
"- if not f:",
"- t += b[i]",
"- if t == N / 2:",
"- f = True",
"- elif... | false | 0.107501 | 0.037534 | 2.864108 | [
"s593286335",
"s573129025"
] |
u294385082 | p02780 | python | s088823202 | s794954335 | 224 | 120 | 24,804 | 25,148 | Accepted | Accepted | 46.43 | #for内でその都度sumをとるのはまずいらしい
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))
ave = []
ans = 0
tmp = 0
for i in range(n):
ave.append((p[i]+1)/2)
for j in range(n):
tmp += ave[j]
if j >= k:
tmp -= ave[j-k]
ans = max(ans,tmp)
print(ans) | #累積和 都度sum(O(n))を取っていると,O(n^2)になってしまう
import itertools
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
acc = [0] + list(itertools.accumulate([(x+1)/2 for x in p]))
ans = max(acc[i+k]-acc[i] for i in range(n-k+1))
print(ans) | 19 | 9 | 286 | 258 | # for内でその都度sumをとるのはまずいらしい
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
ave = []
ans = 0
tmp = 0
for i in range(n):
ave.append((p[i] + 1) / 2)
for j in range(n):
tmp += ave[j]
if j >= k:
tmp -= ave[j - k]
ans = max(ans, tmp)
print(ans)
| # 累積和 都度sum(O(n))を取っていると,O(n^2)になってしまう
import itertools
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
acc = [0] + list(itertools.accumulate([(x + 1) / 2 for x in p]))
ans = max(acc[i + k] - acc[i] for i in range(n - k + 1))
print(ans)
| false | 52.631579 | [
"-# for内でその都度sumをとるのはまずいらしい",
"+# 累積和 都度sum(O(n))を取っていると,O(n^2)になってしまう",
"+import itertools",
"+",
"-ave = []",
"-ans = 0",
"-tmp = 0",
"-for i in range(n):",
"- ave.append((p[i] + 1) / 2)",
"-for j in range(n):",
"- tmp += ave[j]",
"- if j >= k:",
"- tmp -= ave[j - k]",
"-... | false | 0.037621 | 0.037934 | 0.991754 | [
"s088823202",
"s794954335"
] |
u135116520 | p03103 | python | s162905619 | s879200830 | 489 | 451 | 29,792 | 29,796 | Accepted | Accepted | 7.77 | N,M=list(map(int,input().split()))
k=M
s=0
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A,key=lambda x:x[0])
while k>0:
for i in range(N):
if k>A[i][1]:
s+=A[i][0]*A[i][1]
k=k-A[i][1]
else:
s+=A[i][0]*k
k=0
print(s) | N,M=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(N)]
A=sorted(A,key=lambda x:x[0])
s=0 #本数
t=0 #値段
for i in range(N):
s+=A[i][1]
if M>s:
t+=A[i][0]*A[i][1]
else:
over=s-M
t+=A[i][0]*A[i][1]-A[i][0]*over
break
print(t) | 14 | 14 | 273 | 281 | N, M = list(map(int, input().split()))
k = M
s = 0
A = [list(map(int, input().split())) for i in range(N)]
A = sorted(A, key=lambda x: x[0])
while k > 0:
for i in range(N):
if k > A[i][1]:
s += A[i][0] * A[i][1]
k = k - A[i][1]
else:
s += A[i][0] * k
k... | N, M = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
A = sorted(A, key=lambda x: x[0])
s = 0 # 本数
t = 0 # 値段
for i in range(N):
s += A[i][1]
if M > s:
t += A[i][0] * A[i][1]
else:
over = s - M
t += A[i][0] * A[i][1] - A[i][0] * over
... | false | 0 | [
"-k = M",
"-s = 0",
"-while k > 0:",
"- for i in range(N):",
"- if k > A[i][1]:",
"- s += A[i][0] * A[i][1]",
"- k = k - A[i][1]",
"- else:",
"- s += A[i][0] * k",
"- k = 0",
"-print(s)",
"+s = 0 # 本数",
"+t = 0 # 値段",
"+for i i... | false | 0.039309 | 0.038041 | 1.033343 | [
"s162905619",
"s879200830"
] |
u145950990 | p03244 | python | s164447699 | s720017273 | 253 | 179 | 65,004 | 27,292 | Accepted | Accepted | 29.25 | from collections import Counter
n = int(eval(input()))
v = list(map(int,input().split()))
v1 = Counter(v[::2]).most_common()
v2 = Counter(v[1::2]).most_common()
v1.append((0,0))
v2.append((0,0))
ans = n
if v1[0][0]==v2[0][0]:
ans -= max(v1[0][1]+v2[1][1],v1[1][1]+v2[0][1])
else:
ans -= v1[0][1]+v2[0]... | n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[::2]
a2 = a[1::2]
from collections import Counter
c = Counter(a1)
c1 = []
for i in c:
c1.append([c[i],i])
c1.sort(reverse = True)
c = Counter(a2)
c2 = []
for i in c:
c2.append([c[i],i])
c2.sort(reverse = True)
ans = n
if c1[... | 13 | 31 | 329 | 568 | from collections import Counter
n = int(eval(input()))
v = list(map(int, input().split()))
v1 = Counter(v[::2]).most_common()
v2 = Counter(v[1::2]).most_common()
v1.append((0, 0))
v2.append((0, 0))
ans = n
if v1[0][0] == v2[0][0]:
ans -= max(v1[0][1] + v2[1][1], v1[1][1] + v2[0][1])
else:
ans -= v1[0][1] + v2[... | n = int(eval(input()))
a = list(map(int, input().split()))
a1 = a[::2]
a2 = a[1::2]
from collections import Counter
c = Counter(a1)
c1 = []
for i in c:
c1.append([c[i], i])
c1.sort(reverse=True)
c = Counter(a2)
c2 = []
for i in c:
c2.append([c[i], i])
c2.sort(reverse=True)
ans = n
if c1[0][1] != c2[0][1]:
... | false | 58.064516 | [
"+n = int(eval(input()))",
"+a = list(map(int, input().split()))",
"+a1 = a[::2]",
"+a2 = a[1::2]",
"-n = int(eval(input()))",
"-v = list(map(int, input().split()))",
"-v1 = Counter(v[::2]).most_common()",
"-v2 = Counter(v[1::2]).most_common()",
"-v1.append((0, 0))",
"-v2.append((0, 0))",
"+c = ... | false | 0.054089 | 0.079129 | 0.683552 | [
"s164447699",
"s720017273"
] |
u285891772 | p04043 | python | s144040343 | s466803032 | 43 | 38 | 5,452 | 5,144 | Accepted | Accepted | 11.63 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter,... | 26 | 29 | 951 | 934 | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | import sys, re
from collections import deque, defaultdict, Counter
from math import (
ceil,
sqrt,
hypot,
factorial,
pi,
sin,
cos,
tan,
asin,
acos,
atan,
radians,
degrees,
log2,
)
from itertools import (
accumulate,
permutations,
combinations,
combi... | false | 10.344828 | [
"-if all(x in A for x in [5, 7]) and sum(A) == 17:",
"+A.sort()",
"+if A == [5, 5, 7]:"
] | false | 0.034771 | 0.042414 | 0.819813 | [
"s144040343",
"s466803032"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.