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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
u592248346 | p03777 | python | s310157151 | s460244523 | 33 | 30 | 9,044 | 9,032 | Accepted | Accepted | 9.09 | a,b = input().split()
if a=="H":
if b=="H": print("H")
else: print("D")
else:
if b=="H": print("D")
else: print("H")
| a,b = input().split()
if a==b: print("H")
else: print("D") | 7 | 3 | 139 | 60 | a, b = input().split()
if a == "H":
if b == "H":
print("H")
else:
print("D")
else:
if b == "H":
print("D")
else:
print("H")
| a, b = input().split()
if a == b:
print("H")
else:
print("D")
| false | 57.142857 | [
"-if a == \"H\":",
"- if b == \"H\":",
"- print(\"H\")",
"- else:",
"- print(\"D\")",
"+if a == b:",
"+ print(\"H\")",
"- if b == \"H\":",
"- print(\"D\")",
"- else:",
"- print(\"H\")",
"+ print(\"D\")"
] | false | 0.035441 | 0.054693 | 0.647995 | [
"s310157151",
"s460244523"
] |
u706786134 | p02786 | python | s161833963 | s028378791 | 24 | 17 | 3,316 | 2,940 | Accepted | Accepted | 29.17 | h = int(eval(input()))
i = 0
ans = 1
while h:
h = h // 2
i += 1
for _ in range(1, i):
ans = 2 * ans + 1
print(ans)
| import math
h = int(eval(input()))
print((2**(math.floor(math.log2(h))+1)-1))
| 10 | 3 | 131 | 72 | h = int(eval(input()))
i = 0
ans = 1
while h:
h = h // 2
i += 1
for _ in range(1, i):
ans = 2 * ans + 1
print(ans)
| import math
h = int(eval(input()))
print((2 ** (math.floor(math.log2(h)) + 1) - 1))
| false | 70 | [
"+import math",
"+",
"-i = 0",
"-ans = 1",
"-while h:",
"- h = h // 2",
"- i += 1",
"-for _ in range(1, i):",
"- ans = 2 * ans + 1",
"-print(ans)",
"+print((2 ** (math.floor(math.log2(h)) + 1) - 1))"
] | false | 0.071359 | 0.038929 | 1.833024 | [
"s161833963",
"s028378791"
] |
u078932560 | p02803 | python | s828388154 | s118172028 | 446 | 273 | 3,192 | 3,316 | Accepted | Accepted | 38.79 | # from collections import deque
H, W = list(map(int, input().split()))
# dp = [[1000 for _ in range(W)] for _ in range(H)]
S = [['#']*(W+2)] + [['#']+list(eval(input()))+['#'] for h in range(H)] + [['#']*(W+2)]
# S = (H+2, W+2)
# S = [input().split() for h in range(H)]
max_n = 0
for h1 in range(1,H+1):
f... | from collections import deque
H, W = list(map(int, input().split()))
S = [['#']*(W+2)] + [['#']+list(eval(input()))+['#'] for h in range(H)] + [['#']*(W+2)]
max_n = 0
for h1 in range(1,H+1):
for w1 in range(1,W+1):
if S[h1][w1] == '#':
continue
distance = [[-1 for _ in range(W+2)] for _ in r... | 45 | 31 | 1,607 | 1,064 | # from collections import deque
H, W = list(map(int, input().split()))
# dp = [[1000 for _ in range(W)] for _ in range(H)]
S = (
[["#"] * (W + 2)]
+ [["#"] + list(eval(input())) + ["#"] for h in range(H)]
+ [["#"] * (W + 2)]
)
# S = (H+2, W+2)
# S = [input().split() for h in range(H)]
max_n = 0
for h1 in r... | from collections import deque
H, W = list(map(int, input().split()))
S = (
[["#"] * (W + 2)]
+ [["#"] + list(eval(input())) + ["#"] for h in range(H)]
+ [["#"] * (W + 2)]
)
max_n = 0
for h1 in range(1, H + 1):
for w1 in range(1, W + 1):
if S[h1][w1] == "#":
continue
distance... | false | 31.111111 | [
"-# from collections import deque",
"+from collections import deque",
"+",
"-# dp = [[1000 for _ in range(W)] for _ in range(H)]",
"-# S = (H+2, W+2)",
"-# S = [input().split() for h in range(H)]",
"- distance = [[1000 for _ in range(W + 2)] for _ in range(H + 2)]",
"- done_que = [[0 fo... | false | 0.116168 | 0.089138 | 1.303229 | [
"s828388154",
"s118172028"
] |
u020604402 | p03456 | python | s094946570 | s330293846 | 19 | 17 | 3,188 | 3,060 | Accepted | Accepted | 10.53 | x1 , x2 = input().split()
s = int(x1 + x2)
root_s = s ** (1 / 2)
if int(root_s) ** 2 == s:
print("Yes")
else:
print("No")
| x1 , x2 = input().split()
s = int(x1 + x2)
table = []
for i in range(1,1000):
table.append(i * i)
for x in table:
if x == s:
print("Yes")
quit()
print("No")
| 9 | 11 | 140 | 192 | x1, x2 = input().split()
s = int(x1 + x2)
root_s = s ** (1 / 2)
if int(root_s) ** 2 == s:
print("Yes")
else:
print("No")
| x1, x2 = input().split()
s = int(x1 + x2)
table = []
for i in range(1, 1000):
table.append(i * i)
for x in table:
if x == s:
print("Yes")
quit()
print("No")
| false | 18.181818 | [
"-root_s = s ** (1 / 2)",
"-if int(root_s) ** 2 == s:",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+table = []",
"+for i in range(1, 1000):",
"+ table.append(i * i)",
"+for x in table:",
"+ if x == s:",
"+ print(\"Yes\")",
"+ quit()",
"+print(\"No\")"
] | false | 0.046094 | 0.045503 | 1.012991 | [
"s094946570",
"s330293846"
] |
u268793453 | p03175 | python | s306186740 | s564197242 | 1,077 | 961 | 131,744 | 121,888 | Accepted | Accepted | 10.77 | #n == 1でバグるけど2が返ってくるのでヨシ!
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n = int(eval(input()))
X = [[int(i) for i in input().split()] for j in range(n-1)]
p = 10 ** 9 + 7
V = [[] for i in range(n+1)]
for x, y in X:
V[x].append(y)
V[y].append(x)
root = 0
for i, v in enumerate(V):
... | #n == 1でバグるけど2が返ってくるのでヨシ!
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
n = int(eval(input()))
X = [[int(i) for i in input().split()] for j in range(n-1)]
p = 10 ** 9 + 7
V = [[] for i in range(n+1)]
for x, y in X:
V[x].append(y)
V[y].append(x)
w = 0
b = 1
DP = [[0] * 2 for i i... | 38 | 32 | 745 | 646 | # n == 1でバグるけど2が返ってくるのでヨシ!
from sys import setrecursionlimit
setrecursionlimit(10**9)
n = int(eval(input()))
X = [[int(i) for i in input().split()] for j in range(n - 1)]
p = 10**9 + 7
V = [[] for i in range(n + 1)]
for x, y in X:
V[x].append(y)
V[y].append(x)
root = 0
for i, v in enumerate(V):
if len(v) =... | # n == 1でバグるけど2が返ってくるのでヨシ!
from sys import setrecursionlimit
setrecursionlimit(10**9)
n = int(eval(input()))
X = [[int(i) for i in input().split()] for j in range(n - 1)]
p = 10**9 + 7
V = [[] for i in range(n + 1)]
for x, y in X:
V[x].append(y)
V[y].append(x)
w = 0
b = 1
DP = [[0] * 2 for i in range(n + 1)]
... | false | 15.789474 | [
"-root = 0",
"-for i, v in enumerate(V):",
"- if len(v) == 1:",
"- root = i",
"- break",
"-dfs(root)",
"-print((sum(DP[root]) % p))",
"+dfs(1)",
"+print((sum(DP[1]) % p))"
] | false | 0.037522 | 0.036727 | 1.021645 | [
"s306186740",
"s564197242"
] |
u995004106 | p02996 | python | s033181974 | s418971760 | 1,242 | 924 | 88,024 | 53,728 | Accepted | Accepted | 25.6 | N=int(eval(input()))
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(lambda x:x[1])
#print(task)
for i in range(N):
time=time+task[i][0]
if not(time<=task[i][1]):
flag=0
break
if flag==1:
print("Yes")
else:
print("No")
| N=int(eval(input()))
task=[list(map(int,input().split())) for _ in range(N)]
time=0
flag=1
task.sort(key=lambda x:x[1])
#print(task)
for i in range(N):
time=time+task[i][0]
if not(time<=task[i][1]):
flag=0
break
if flag==1:
print("Yes")
else:
print("No") | 15 | 15 | 291 | 294 | N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
time = 0
flag = 1
task.sort(lambda x: x[1])
# print(task)
for i in range(N):
time = time + task[i][0]
if not (time <= task[i][1]):
flag = 0
break
if flag == 1:
print("Yes")
else:
print("No")
| N = int(eval(input()))
task = [list(map(int, input().split())) for _ in range(N)]
time = 0
flag = 1
task.sort(key=lambda x: x[1])
# print(task)
for i in range(N):
time = time + task[i][0]
if not (time <= task[i][1]):
flag = 0
break
if flag == 1:
print("Yes")
else:
print("No")
| false | 0 | [
"-task.sort(lambda x: x[1])",
"+task.sort(key=lambda x: x[1])"
] | false | 0.077272 | 0.041409 | 1.866069 | [
"s033181974",
"s418971760"
] |
u216392490 | p02572 | python | s554416103 | s774015499 | 142 | 125 | 31,596 | 31,680 | Accepted | Accepted | 11.97 | n = int(eval(input()))
mod = int(1e9+7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans+a*t) % mod
t = (t + a) % mod
print(ans)
| n = int(eval(input()))
mod = int(1e9+7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans+a*t) % mod
t += a
print(ans)
| 8 | 8 | 157 | 146 | n = int(eval(input()))
mod = int(1e9 + 7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans + a * t) % mod
t = (t + a) % mod
print(ans)
| n = int(eval(input()))
mod = int(1e9 + 7)
ans, t = 0, 0
for a in list(map(int, input().split())):
ans = (ans + a * t) % mod
t += a
print(ans)
| false | 0 | [
"- t = (t + a) % mod",
"+ t += a"
] | false | 0.043958 | 0.058124 | 0.756281 | [
"s554416103",
"s774015499"
] |
u970308980 | p03244 | python | s221450172 | s987057619 | 147 | 118 | 22,484 | 24,300 | Accepted | Accepted | 19.73 | from collections import defaultdict
N = int(eval(input()))
L = list(map(int, input().split()))
if len(set(L)) == 1:
print((N//2))
exit()
if N == 2:
print((0))
exit()
d_even = defaultdict(int)
d_odd = defaultdict(int)
for i in range(N):
v = L[i]
if i % 2 == 0:
d_ev... | from collections import Counter
N = int(eval(input()))
L = list(map(int, input().split()))
odd = [v for i, v in enumerate(L) if i % 2 == 0]
even = [v for i, v in enumerate(L) if i % 2 == 1]
if len(set(L)) == 1:
print((N//2))
exit()
if N == 2:
print((0))
exit()
c_odd = sorted(list(dict... | 34 | 32 | 672 | 682 | from collections import defaultdict
N = int(eval(input()))
L = list(map(int, input().split()))
if len(set(L)) == 1:
print((N // 2))
exit()
if N == 2:
print((0))
exit()
d_even = defaultdict(int)
d_odd = defaultdict(int)
for i in range(N):
v = L[i]
if i % 2 == 0:
d_even[v] += 1
else:
... | from collections import Counter
N = int(eval(input()))
L = list(map(int, input().split()))
odd = [v for i, v in enumerate(L) if i % 2 == 0]
even = [v for i, v in enumerate(L) if i % 2 == 1]
if len(set(L)) == 1:
print((N // 2))
exit()
if N == 2:
print((0))
exit()
c_odd = sorted(list(dict(Counter(odd)).i... | false | 5.882353 | [
"-from collections import defaultdict",
"+from collections import Counter",
"+odd = [v for i, v in enumerate(L) if i % 2 == 0]",
"+even = [v for i, v in enumerate(L) if i % 2 == 1]",
"-d_even = defaultdict(int)",
"-d_odd = defaultdict(int)",
"-for i in range(N):",
"- v = L[i]",
"- if i % 2 == ... | false | 0.038084 | 0.036453 | 1.044738 | [
"s221450172",
"s987057619"
] |
u095021077 | p02727 | python | s223835048 | s554737632 | 272 | 233 | 23,216 | 23,328 | Accepted | Accepted | 14.34 | X, Y, A, B, C=list(map(int, input().split()))
p=list(map(int, input().split()))
p.sort()
q=list(map(int, input().split()))
q.sort()
r=list(map(int, input().split()))
r.sort(reverse=True)
i=-X
j=-Y
k=0
deru=0
while deru==0 and k<C and (r[k]>p[i] or r[k]>q[j]):
if p[i]>q[j] and j<0:
j+=1
k+=1
... | X, Y, A, B, C=list(map(int, input().split()))
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))
p.sort()
q.sort()
nums=p[-X:]+q[-Y:]+r
nums.sort()
print((sum(nums[-(X+Y):]))) | 44 | 9 | 673 | 226 | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
q = list(map(int, input().split()))
q.sort()
r = list(map(int, input().split()))
r.sort(reverse=True)
i = -X
j = -Y
k = 0
deru = 0
while deru == 0 and k < C and (r[k] > p[i] or r[k] > q[j]):
if p[i] > q[j] and j < 0:
... | X, Y, A, B, C = list(map(int, input().split()))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort()
q.sort()
nums = p[-X:] + q[-Y:] + r
nums.sort()
print((sum(nums[-(X + Y) :])))
| false | 79.545455 | [
"+q = list(map(int, input().split()))",
"+r = list(map(int, input().split()))",
"-q = list(map(int, input().split()))",
"-r = list(map(int, input().split()))",
"-r.sort(reverse=True)",
"-i = -X",
"-j = -Y",
"-k = 0",
"-deru = 0",
"-while deru == 0 and k < C and (r[k] > p[i] or r[k] > q[j]):",
"-... | false | 0.076182 | 0.077131 | 0.987696 | [
"s223835048",
"s554737632"
] |
u754022296 | p02889 | python | s512659935 | s175471488 | 1,485 | 734 | 19,868 | 20,144 | Accepted | Accepted | 50.57 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
n, m, l = list(map(int, input().split()))
F = np.zeros((n, n))
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
F[a, b] = c
F[b, a] = c
csr = csr_matrix(F)
A = floyd_war... | import sys
input = sys.stdin.readline
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
def main():
n, m, l = list(map(int, input().split()))
F = np.zeros((n, n))
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -... | 29 | 37 | 661 | 816 | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
n, m, l = list(map(int, input().split()))
F = np.zeros((n, n))
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
b -= 1
F[a, b] = c
F[b, a] = c
csr = csr_matrix(F)
A = floyd_wars... | import sys
input = sys.stdin.readline
import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix
def main():
n, m, l = list(map(int, input().split()))
F = np.zeros((n, n))
for _ in range(m):
a, b, c = list(map(int, input().split()))
a -= 1
... | false | 21.621622 | [
"+import sys",
"+",
"+input = sys.stdin.readline",
"-n, m, l = list(map(int, input().split()))",
"-F = np.zeros((n, n))",
"-for _ in range(m):",
"- a, b, c = list(map(int, input().split()))",
"- a -= 1",
"- b -= 1",
"- F[a, b] = c",
"- F[b, a] = c",
"-csr = csr_matrix(F)",
"-A... | false | 0.302909 | 0.389082 | 0.778523 | [
"s512659935",
"s175471488"
] |
u970197315 | p02850 | python | s325943485 | s281108229 | 487 | 332 | 18,548 | 23,152 | Accepted | Accepted | 31.83 | # ABC146 D - Coloring Edges on Tree
from collections import deque
n = int(eval(input()))
E = [[] for _ in range(n + 1)]
edge_order = []
for i in range(n-1):
a,b=list(map(int,input().split()))
E[a].append(b)
edge_order.append(b)
# 頂点1からBFS
q = deque([1])
color = [0] * (n+1)
while q:
V... | n=int(eval(input()))
G=[[] for i in range(n+1)]
G_order=[]
for i in range(n-1):
a,b=list(map(int,input().split()))
G[a].append(b)
G_order.append(b)
from collections import deque
q=deque([1])
color=[0]*(n+1)
while q:
cur=q.popleft()
c=1
for nx in G[cur]:
if c==color[cur]:
c+=1
... | 29 | 24 | 529 | 408 | # ABC146 D - Coloring Edges on Tree
from collections import deque
n = int(eval(input()))
E = [[] for _ in range(n + 1)]
edge_order = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
E[a].append(b)
edge_order.append(b)
# 頂点1からBFS
q = deque([1])
color = [0] * (n + 1)
while q:
V = q.poplef... | n = int(eval(input()))
G = [[] for i in range(n + 1)]
G_order = []
for i in range(n - 1):
a, b = list(map(int, input().split()))
G[a].append(b)
G_order.append(b)
from collections import deque
q = deque([1])
color = [0] * (n + 1)
while q:
cur = q.popleft()
c = 1
for nx in G[cur]:
if c ==... | false | 17.241379 | [
"-# ABC146 D - Coloring Edges on Tree",
"+n = int(eval(input()))",
"+G = [[] for i in range(n + 1)]",
"+G_order = []",
"+for i in range(n - 1):",
"+ a, b = list(map(int, input().split()))",
"+ G[a].append(b)",
"+ G_order.append(b)",
"-n = int(eval(input()))",
"-E = [[] for _ in range(n + ... | false | 0.035564 | 0.035051 | 1.014617 | [
"s325943485",
"s281108229"
] |
u711539583 | p02804 | python | s183059958 | s794102120 | 278 | 243 | 64,296 | 14,044 | Accepted | Accepted | 12.59 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
a.sort(reverse = True)
N = n+2
P = mod
inv_t = [0]+[1]
for i in range(2,N):
inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n-k+1, n):
base = (base * item) % mod
for i in range(1,... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
a.sort(reverse = True)
N = n+2
P = mod
inv_t = [0]+[1]
for i in range(2,N):
inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n-k+1, n):
base = (base * item) % mod
for i in range(1,... | 47 | 38 | 942 | 745 | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
a.sort(reverse=True)
N = n + 2
P = mod
inv_t = [0] + [1]
for i in range(2, N):
inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n - k + 1, n):
base = (base * item) % mod
for i in range(1, k):
... | n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
a.sort(reverse=True)
N = n + 2
P = mod
inv_t = [0] + [1]
for i in range(2, N):
inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n - k + 1, n):
base = (base * item) % mod
for i in range(1, k):
... | false | 19.148936 | [
"-ans2 = 0",
"- if ai > 0:",
"- ans += base * ai",
"- ans %= mod",
"- else:",
"- ans2 += abs(base * ai)",
"- ans2 %= mod",
"+ ans += base * ai",
"+ ans %= mod",
"- if ai > 0:",
"- ans2 += base2 * ai",
"- ans2 %= mod",
"- else:",
"... | false | 0.143174 | 0.182541 | 0.78434 | [
"s183059958",
"s794102120"
] |
u977389981 | p03804 | python | s891039433 | s368963418 | 25 | 18 | 3,060 | 3,064 | Accepted | Accepted | 28 | n, m = list(map(int,input().split()))
A = [eval(input()) for _ in range(n)]
B = [eval(input()) for _ in range(m)]
ans = 'No'
for i in range(n - m + 1):
for j in range(n - m + 1):
C = []
for k in range(m):
c = A[i + k][j : j + m]
C.append(c)
if B == C:
... | n, m = list(map(int, input().split()))
A = [eval(input()) for i in range(n)]
B = [eval(input()) for i in range(m)]
ans = 'No'
for i in range(n - m + 1):
C = []
for j in range(n):
C.append(A[j][i : i + m])
for k in range(n - m +1):
if B == C[k : k + m]:
ans = 'Yes'
... | 15 | 15 | 353 | 343 | n, m = list(map(int, input().split()))
A = [eval(input()) for _ in range(n)]
B = [eval(input()) for _ in range(m)]
ans = "No"
for i in range(n - m + 1):
for j in range(n - m + 1):
C = []
for k in range(m):
c = A[i + k][j : j + m]
C.append(c)
if B == C:
ans... | n, m = list(map(int, input().split()))
A = [eval(input()) for i in range(n)]
B = [eval(input()) for i in range(m)]
ans = "No"
for i in range(n - m + 1):
C = []
for j in range(n):
C.append(A[j][i : i + m])
for k in range(n - m + 1):
if B == C[k : k + m]:
ans = "Yes"
br... | false | 0 | [
"-A = [eval(input()) for _ in range(n)]",
"-B = [eval(input()) for _ in range(m)]",
"+A = [eval(input()) for i in range(n)]",
"+B = [eval(input()) for i in range(m)]",
"- for j in range(n - m + 1):",
"- C = []",
"- for k in range(m):",
"- c = A[i + k][j : j + m]",
"- ... | false | 0.08695 | 0.107653 | 0.807692 | [
"s891039433",
"s368963418"
] |
u489959379 | p02912 | python | s692128524 | s363764210 | 200 | 150 | 14,532 | 14,180 | Accepted | Accepted | 25 | import heapq
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
q = []
heapq.heapify(q)
for i in range(n):
heapq.heappush(q, -a[i])
for _ in range(m):
b = heapq.heappop(q) / 2
heapq.heappush(q, math.ceil(b))
print((sum(q) * -1))
| import sys
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list([int(x) * (-1) for x in input().split()])
heapify(A)
for _ in range(m):
... | 16 | 22 | 288 | 463 | import heapq
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
q = []
heapq.heapify(q)
for i in range(n):
heapq.heappush(q, -a[i])
for _ in range(m):
b = heapq.heappop(q) / 2
heapq.heappush(q, math.ceil(b))
print((sum(q) * -1))
| import sys
from heapq import heapify, heappop, heappush
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7
def resolve():
n, m = list(map(int, input().split()))
A = list([int(x) * (-1) for x in input().split()])
heapify(A)
for _ in range(m):
a = (heap... | false | 27.272727 | [
"-import heapq",
"-import math",
"+import sys",
"+from heapq import heapify, heappop, heappush",
"-n, m = list(map(int, input().split()))",
"-a = list(map(int, input().split()))",
"-q = []",
"-heapq.heapify(q)",
"-for i in range(n):",
"- heapq.heappush(q, -a[i])",
"-for _ in range(m):",
"- ... | false | 0.083655 | 0.036835 | 2.271062 | [
"s692128524",
"s363764210"
] |
u434428594 | p00461 | python | s190486881 | s703477259 | 600 | 480 | 26,888 | 9,368 | Accepted | Accepted | 20 | from array import array;
while True:
n = int(input())
if n == 0:
break
m = int(input())
s = input()
cache = array('i', (0 for x in range(m)))
for i in range(len(s) - 2):
if s[i:i+3] == 'IOI':
cache[i + 2] = cache[i] + 1
print(len([x for x in cac... | from array import array;
while True:
n = int(input())
if n == 0:
break
m = int(input())
s = input()
cache = array('i', (0 for x in range(m)))
for i in range(len(s) - 2):
if s[i:i+3] == 'IOI':
cache[i + 2] = cache[i] + 1
print(sum(1 for x in cach... | 16 | 16 | 351 | 346 | from array import array
while True:
n = int(input())
if n == 0:
break
m = int(input())
s = input()
cache = array("i", (0 for x in range(m)))
for i in range(len(s) - 2):
if s[i : i + 3] == "IOI":
cache[i + 2] = cache[i] + 1
print(len([x for x in cache if x >= n]))... | from array import array
while True:
n = int(input())
if n == 0:
break
m = int(input())
s = input()
cache = array("i", (0 for x in range(m)))
for i in range(len(s) - 2):
if s[i : i + 3] == "IOI":
cache[i + 2] = cache[i] + 1
print(sum(1 for x in cache if x >= n))
| false | 0 | [
"- print(len([x for x in cache if x >= n]))",
"+ print(sum(1 for x in cache if x >= n))"
] | false | 0.087271 | 0.086669 | 1.006952 | [
"s190486881",
"s703477259"
] |
u871980676 | p02936 | python | s179561499 | s464038746 | 1,976 | 1,527 | 265,372 | 290,500 | Accepted | Accepted | 22.72 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N,Q = list(map(int,input().split()))
ab = [ tuple(map(int,input().split())) for i in range(N-1) ]
px = [ tuple(map(int,input().split())) for i in range(Q) ]
dic = {}
dic2=[0]*(N+1)
dic3=[0]*N
for i in range(N):
dic[i+1] = []
for i in ... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000)
N,Q = list(map(int,readline().split()))
abpx = list(map(int,read().split()))
ab = iter(abpx[:N+N-2])
px = iter(abpx[N+N-2:])
dic = {}
dic2=[0]*(N+1)
dic3=[0]*N
for i in range(N):
dic[i+1] = []
... | 31 | 29 | 784 | 719 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N, Q = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for i in range(N - 1)]
px = [tuple(map(int, input().split())) for i in range(Q)]
dic = {}
dic2 = [0] * (N + 1)
dic3 = [0] * N
for i in range(N):
dic[i + 1] = []
for i i... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(1000000)
N, Q = list(map(int, readline().split()))
abpx = list(map(int, read().split()))
ab = iter(abpx[: N + N - 2])
px = iter(abpx[N + N - 2 :])
dic = {}
dic2 = [0] * (N + 1)
dic3 = [0] * N
for i in range(N):
dic[i... | false | 6.451613 | [
"-input = sys.stdin.readline",
"+read = sys.stdin.buffer.read",
"+readline = sys.stdin.buffer.readline",
"-N, Q = list(map(int, input().split()))",
"-ab = [tuple(map(int, input().split())) for i in range(N - 1)]",
"-px = [tuple(map(int, input().split())) for i in range(Q)]",
"+N, Q = list(map(int, readl... | false | 0.048376 | 0.007441 | 6.501194 | [
"s179561499",
"s464038746"
] |
u767995501 | p03126 | python | s882933666 | s503433523 | 21 | 18 | 2,940 | 3,060 | Accepted | Accepted | 14.29 | n,m=list(map(int,input().split()))
S=set(range(1,m+1))
for i in range(n):
K,*A=list(map(int,input().split()))
S&=set(A)
print((len(S))) | n, m = list(map(int, input().split()))
l = []
for i in range(n):
a = [int(x) for x in input().split()]
for j in range(1, a[0] + 1):
l.append(a[j])
ans = 0
for i in range(m + 1):
if l.count(i) == n:
ans += 1
print(ans) | 6 | 14 | 134 | 241 | n, m = list(map(int, input().split()))
S = set(range(1, m + 1))
for i in range(n):
K, *A = list(map(int, input().split()))
S &= set(A)
print((len(S)))
| n, m = list(map(int, input().split()))
l = []
for i in range(n):
a = [int(x) for x in input().split()]
for j in range(1, a[0] + 1):
l.append(a[j])
ans = 0
for i in range(m + 1):
if l.count(i) == n:
ans += 1
print(ans)
| false | 57.142857 | [
"-S = set(range(1, m + 1))",
"+l = []",
"- K, *A = list(map(int, input().split()))",
"- S &= set(A)",
"-print((len(S)))",
"+ a = [int(x) for x in input().split()]",
"+ for j in range(1, a[0] + 1):",
"+ l.append(a[j])",
"+ans = 0",
"+for i in range(m + 1):",
"+ if l.count(i)... | false | 0.036218 | 0.036235 | 0.999532 | [
"s882933666",
"s503433523"
] |
u816587940 | p02728 | python | s419968752 | s328198039 | 2,954 | 2,543 | 175,956 | 147,256 | Accepted | Accepted | 13.91 | from fractions import gcd
import sys
sys.setrecursionlimit(4100000)
def os(): return eval(input())
def oi(): return int(eval(input()))
def oli(): return list(map(int, input().split()))
def olai(): return list(map(int, input().split()))
def olas(): return list(input().split())
def mlai(L): return [int(eval(inp... | from fractions import gcd
import sys
sys.setrecursionlimit(4100000)
def os(): return eval(input())
def oi(): return int(eval(input()))
def oli(): return list(map(int, input().split()))
def olai(): return list(map(int, input().split()))
def olas(): return list(input().split())
def mlai(L): return [int(eval(inp... | 106 | 108 | 2,952 | 3,081 | from fractions import gcd
import sys
sys.setrecursionlimit(4100000)
def os():
return eval(input())
def oi():
return int(eval(input()))
def oli():
return list(map(int, input().split()))
def olai():
return list(map(int, input().split()))
def olas():
return list(input().split())
def mlai(L... | from fractions import gcd
import sys
sys.setrecursionlimit(4100000)
def os():
return eval(input())
def oi():
return int(eval(input()))
def oli():
return list(map(int, input().split()))
def olai():
return list(map(int, input().split()))
def olas():
return list(input().split())
def mlai(L... | false | 1.851852 | [
"+# 全方位木dpで扱うクラス",
"+# 零元",
"+zero = T(1, 0)",
"+# 一個遷移した時の変化",
"+# マージ",
"-down_data = [T(-1, -1) for _ in range(200001)]",
"-dat = [T(-1, -1) for _ in range(200001)]",
"+down_data = [zero for _ in range(200001)]",
"+dat = [zero for _ in range(200001)]",
"- if cnt == 0:",
"- down_data... | false | 1.585975 | 0.980912 | 1.616836 | [
"s419968752",
"s328198039"
] |
u562935282 | p03127 | python | s578803989 | s554493313 | 86 | 79 | 14,224 | 14,596 | Accepted | Accepted | 8.14 | def gcd(x, y):
if y == 0: return x
return gcd(y, x % y)
N = int(eval(input()))
a = list(map(int, input().split()))
g = a[0]
for aa in a[1:]:
g = gcd(g, aa)
print(g)
| from functools import reduce
def gcd(a, b):
if b == 0: return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
print((reduce(gcd, a)))
| 12 | 12 | 185 | 184 | def gcd(x, y):
if y == 0:
return x
return gcd(y, x % y)
N = int(eval(input()))
a = list(map(int, input().split()))
g = a[0]
for aa in a[1:]:
g = gcd(g, aa)
print(g)
| from functools import reduce
def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
n = int(eval(input()))
a = list(map(int, input().split()))
print((reduce(gcd, a)))
| false | 0 | [
"-def gcd(x, y):",
"- if y == 0:",
"- return x",
"- return gcd(y, x % y)",
"+from functools import reduce",
"-N = int(eval(input()))",
"+def gcd(a, b):",
"+ if b == 0:",
"+ return a",
"+ return gcd(b, a % b)",
"+",
"+",
"+n = int(eval(input()))",
"-g = a[0]",
"-... | false | 0.059028 | 0.071605 | 0.824351 | [
"s578803989",
"s554493313"
] |
u562935282 | p03074 | python | s736209875 | s813899553 | 259 | 97 | 52,356 | 3,316 | Accepted | Accepted | 62.55 | from bisect import bisect_right
N, K = list(map(int, input().split()))
s = eval(input())
t = []
abs_t = []
cur = s[0]
cnt = 0
for ss in s:
if cur == ss:
cnt += 1
else:
sgn = 1 if cur == '1' else -1
# 逆立ちでないなら-1
t.append(cnt * sgn)
abs_t.append(cnt)
... | N, K = list(map(int, input().split()))
s = eval(input())
l, r = 0, 0
for i in range(K):
while r < N and s[r] == '1': r += 1
while r < N and s[r] == '0': r += 1
# K回直立→逆立ちの反転操作を行う
while r < N and s[r] == '1': r += 1
# 元々逆立ちしている人の右端まで行く
ans = r - l
# 区間の人数をansに代入
while r < N:
while l < r and s[l... | 47 | 28 | 870 | 660 | from bisect import bisect_right
N, K = list(map(int, input().split()))
s = eval(input())
t = []
abs_t = []
cur = s[0]
cnt = 0
for ss in s:
if cur == ss:
cnt += 1
else:
sgn = 1 if cur == "1" else -1
# 逆立ちでないなら-1
t.append(cnt * sgn)
abs_t.append(cnt)
cur = ss
... | N, K = list(map(int, input().split()))
s = eval(input())
l, r = 0, 0
for i in range(K):
while r < N and s[r] == "1":
r += 1
while r < N and s[r] == "0":
r += 1
# K回直立→逆立ちの反転操作を行う
while r < N and s[r] == "1":
r += 1
# 元々逆立ちしている人の右端まで行く
ans = r - l
# 区間の人数をansに代入
while r < N:
while l < r a... | false | 40.425532 | [
"-from bisect import bisect_right",
"-",
"-t = []",
"-abs_t = []",
"-cur = s[0]",
"-cnt = 0",
"-for ss in s:",
"- if cur == ss:",
"- cnt += 1",
"- else:",
"- sgn = 1 if cur == \"1\" else -1",
"- # 逆立ちでないなら-1",
"- t.append(cnt * sgn)",
"- abs_t.appen... | false | 0.041491 | 0.129568 | 0.320222 | [
"s736209875",
"s813899553"
] |
u321035578 | p03627 | python | s555595247 | s143136719 | 133 | 102 | 20,772 | 21,540 | Accepted | Accepted | 23.31 | import collections
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
cnt = collections.Counter(a)
set_a = set(a)
a = []
a = list(set_a)
a.sort(reverse=True)
select = 0
ans = 1
tmp = 0
flg = 0
for i, aa in enumerate(a):
if cnt[aa... | import collections
def main():
n = int(eval(input()))
a = list(map(int,input().split()))
# a.sort(reverse=True)
c = collections.Counter(a)
cl = c.most_common()
# cl.sort(reverse = True)
cnt = 1
lst = []
now = a[0]
ans = 0
for i, cc in enumerate(cl):
if ... | 31 | 30 | 618 | 665 | import collections
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
cnt = collections.Counter(a)
set_a = set(a)
a = []
a = list(set_a)
a.sort(reverse=True)
select = 0
ans = 1
tmp = 0
flg = 0
for i, aa in enumerate(a):
if cnt[aa] >= 4 and fl... | import collections
def main():
n = int(eval(input()))
a = list(map(int, input().split()))
# a.sort(reverse=True)
c = collections.Counter(a)
cl = c.most_common()
# cl.sort(reverse = True)
cnt = 1
lst = []
now = a[0]
ans = 0
for i, cc in enumerate(cl):
if cc[1] >= 4:
... | false | 3.225806 | [
"- cnt = collections.Counter(a)",
"- set_a = set(a)",
"- a = []",
"- a = list(set_a)",
"- a.sort(reverse=True)",
"- select = 0",
"- ans = 1",
"- tmp = 0",
"- flg = 0",
"- for i, aa in enumerate(a):",
"- if cnt[aa] >= 4 and flg == 0:",
"- tmp = aa... | false | 0.040559 | 0.096685 | 0.4195 | [
"s555595247",
"s143136719"
] |
u013956357 | p02813 | python | s258230568 | s429769534 | 112 | 44 | 4,752 | 3,060 | Accepted | Accepted | 60.71 | import itertools
import math
N = int(eval(input()))
P = int(''.join(input().split()))
Q = int(''.join(input().split()))
N_list = []
for i in itertools.permutations(list(range(1,N+1))):
N_list.append(int(''.join([str(x) for x in i])))
pointer1 = 0
pointer2 = 0
for i,x in enumerate(N_list):
if x ... | import itertools
n = int(eval(input()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
a,b = 0,0
for i,x in enumerate(itertools.permutations(list(range(1,n+1)))):
if list(x) == p:
a = i
if list(x) == q:
b = i
print((abs(a-b))) | 21 | 15 | 402 | 291 | import itertools
import math
N = int(eval(input()))
P = int("".join(input().split()))
Q = int("".join(input().split()))
N_list = []
for i in itertools.permutations(list(range(1, N + 1))):
N_list.append(int("".join([str(x) for x in i])))
pointer1 = 0
pointer2 = 0
for i, x in enumerate(N_list):
if x == P:
... | import itertools
n = int(eval(input()))
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
a, b = 0, 0
for i, x in enumerate(itertools.permutations(list(range(1, n + 1)))):
if list(x) == p:
a = i
if list(x) == q:
b = i
print((abs(a - b)))
| false | 28.571429 | [
"-import math",
"-N = int(eval(input()))",
"-P = int(\"\".join(input().split()))",
"-Q = int(\"\".join(input().split()))",
"-N_list = []",
"-for i in itertools.permutations(list(range(1, N + 1))):",
"- N_list.append(int(\"\".join([str(x) for x in i])))",
"-pointer1 = 0",
"-pointer2 = 0",
"-for ... | false | 0.044155 | 0.040154 | 1.099642 | [
"s258230568",
"s429769534"
] |
u730769327 | p03479 | python | s337867150 | s127949669 | 171 | 60 | 38,384 | 61,852 | Accepted | Accepted | 64.91 | x,y=list(map(int,input().split()))
i=1
while True:
x*=2
if x>y:
break
i+=1
print(i) | x,y=list(map(int,input().split()))
a=0
while x<=y:
x*=2
a+=1
print(a) | 8 | 6 | 94 | 72 | x, y = list(map(int, input().split()))
i = 1
while True:
x *= 2
if x > y:
break
i += 1
print(i)
| x, y = list(map(int, input().split()))
a = 0
while x <= y:
x *= 2
a += 1
print(a)
| false | 25 | [
"-i = 1",
"-while True:",
"+a = 0",
"+while x <= y:",
"- if x > y:",
"- break",
"- i += 1",
"-print(i)",
"+ a += 1",
"+print(a)"
] | false | 0.041346 | 0.041374 | 0.999329 | [
"s337867150",
"s127949669"
] |
u654558363 | p02947 | python | s675806667 | s450072120 | 773 | 480 | 18,232 | 18,228 | Accepted | Accepted | 37.9 | from collections import defaultdict
from math import factorial
if __name__ == "__main__":
n = int(eval(input()))
lst = []
count = 0
words = defaultdict(lambda: 0)
for i in range(n):
words[''.join(sorted(eval(input())))] += 1
sum = 0
for word in words:
sum += int(fa... | from collections import defaultdict
if __name__ == "__main__":
n = int(eval(input()))
lst = []
count = 0
words = defaultdict(lambda: 0)
for i in range(n):
words[''.join(sorted(eval(input())))] += 1
sum = 0
for word in words:
sum += int(words[word]*(words[word] - 1... | 13 | 13 | 397 | 329 | from collections import defaultdict
from math import factorial
if __name__ == "__main__":
n = int(eval(input()))
lst = []
count = 0
words = defaultdict(lambda: 0)
for i in range(n):
words["".join(sorted(eval(input())))] += 1
sum = 0
for word in words:
sum += int(
... | from collections import defaultdict
if __name__ == "__main__":
n = int(eval(input()))
lst = []
count = 0
words = defaultdict(lambda: 0)
for i in range(n):
words["".join(sorted(eval(input())))] += 1
sum = 0
for word in words:
sum += int(words[word] * (words[word] - 1) / 2)
... | false | 0 | [
"-from math import factorial",
"- sum += int(",
"- factorial(words[word]) / (factorial(2) * factorial(abs(words[word] - 2)))",
"- )",
"+ sum += int(words[word] * (words[word] - 1) / 2)"
] | false | 0.085445 | 0.072868 | 1.172602 | [
"s675806667",
"s450072120"
] |
u816171517 | p02657 | python | s518064437 | s799527056 | 24 | 21 | 9,148 | 9,032 | Accepted | Accepted | 12.5 | a,b=list(map(int,input().split()))
print((a*b))
| a,b=list(map(float,input().split()))
import math
a=int(math.floor(a))
b=int(math.floor(b*100))
c=math.floor(a*b/100)
print(c)
| 3 | 10 | 43 | 133 | a, b = list(map(int, input().split()))
print((a * b))
| a, b = list(map(float, input().split()))
import math
a = int(math.floor(a))
b = int(math.floor(b * 100))
c = math.floor(a * b / 100)
print(c)
| false | 70 | [
"-a, b = list(map(int, input().split()))",
"-print((a * b))",
"+a, b = list(map(float, input().split()))",
"+import math",
"+",
"+a = int(math.floor(a))",
"+b = int(math.floor(b * 100))",
"+c = math.floor(a * b / 100)",
"+print(c)"
] | false | 0.046936 | 0.040135 | 1.169469 | [
"s518064437",
"s799527056"
] |
u133936772 | p02685 | python | s088786085 | s650052084 | 782 | 447 | 9,192 | 24,948 | Accepted | Accepted | 42.84 | M=998244353
n,m,k=list(map(int,input().split()))
a,c=0,1
for i in range(k+1):
a+=c*m*pow(m-1,n+~i,M)
c=c*(n+~i)*pow(i+1,-1,M)%M
print((a%M)) | M=998244353
n,m,k=list(map(int,input().split()))
p,c=[m],[1]
for i in range(1,n):
p+=[p[-1]*(m-1)%M]
c+=[c[-1]*(n-i)*pow(i,-1,M)%M]
print((sum(p[n-i-1]*c[i] for i in range(k+1))%M)) | 7 | 7 | 142 | 183 | M = 998244353
n, m, k = list(map(int, input().split()))
a, c = 0, 1
for i in range(k + 1):
a += c * m * pow(m - 1, n + ~i, M)
c = c * (n + ~i) * pow(i + 1, -1, M) % M
print((a % M))
| M = 998244353
n, m, k = list(map(int, input().split()))
p, c = [m], [1]
for i in range(1, n):
p += [p[-1] * (m - 1) % M]
c += [c[-1] * (n - i) * pow(i, -1, M) % M]
print((sum(p[n - i - 1] * c[i] for i in range(k + 1)) % M))
| false | 0 | [
"-a, c = 0, 1",
"-for i in range(k + 1):",
"- a += c * m * pow(m - 1, n + ~i, M)",
"- c = c * (n + ~i) * pow(i + 1, -1, M) % M",
"-print((a % M))",
"+p, c = [m], [1]",
"+for i in range(1, n):",
"+ p += [p[-1] * (m - 1) % M]",
"+ c += [c[-1] * (n - i) * pow(i, -1, M) % M]",
"+print((sum... | false | 0.067568 | 0.376557 | 0.179436 | [
"s088786085",
"s650052084"
] |
u782098901 | p03228 | python | s167313973 | s308040910 | 19 | 17 | 3,060 | 2,940 | Accepted | Accepted | 10.53 | A, B, K = list(map(int, input().split()))
for i in range(K):
if A % 2 == 1:
A -= 1
A /= 2
A, B = B + A, A
if K % 2 == 1:
A, B = B, A
print((int(A), int(B))) | A, B, K = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
A, B = A // 2, B + A // 2
else:
A, B = A + B // 2, B // 2
print((int(A), int(B))) | 11 | 9 | 184 | 183 | A, B, K = list(map(int, input().split()))
for i in range(K):
if A % 2 == 1:
A -= 1
A /= 2
A, B = B + A, A
if K % 2 == 1:
A, B = B, A
print((int(A), int(B)))
| A, B, K = list(map(int, input().split()))
for i in range(K):
if i % 2 == 0:
A, B = A // 2, B + A // 2
else:
A, B = A + B // 2, B // 2
print((int(A), int(B)))
| false | 18.181818 | [
"- if A % 2 == 1:",
"- A -= 1",
"- A /= 2",
"- A, B = B + A, A",
"-if K % 2 == 1:",
"- A, B = B, A",
"+ if i % 2 == 0:",
"+ A, B = A // 2, B + A // 2",
"+ else:",
"+ A, B = A + B // 2, B // 2"
] | false | 0.064097 | 0.065532 | 0.978111 | [
"s167313973",
"s308040910"
] |
u729133443 | p03110 | python | s706455609 | s767915879 | 163 | 17 | 38,256 | 2,940 | Accepted | Accepted | 89.57 | print((sum(380000**('B'in s)*float(s[:-4])for s in open(0).readlines()[1:]))) | print((sum(38e4**('B'in s)*float(s[:-4])for s in open(0).readlines()[1:]))) | 1 | 1 | 75 | 73 | print((sum(380000 ** ("B" in s) * float(s[:-4]) for s in open(0).readlines()[1:])))
| print((sum(38e4 ** ("B" in s) * float(s[:-4]) for s in open(0).readlines()[1:])))
| false | 0 | [
"-print((sum(380000 ** (\"B\" in s) * float(s[:-4]) for s in open(0).readlines()[1:])))",
"+print((sum(38e4 ** (\"B\" in s) * float(s[:-4]) for s in open(0).readlines()[1:])))"
] | false | 0.082741 | 0.081374 | 1.016796 | [
"s706455609",
"s767915879"
] |
u401487574 | p03215 | python | s705501308 | s381353276 | 530 | 112 | 110,308 | 117,056 | Accepted | Accepted | 78.87 | ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,k = ma()
A = lma()
bu = []
for i... | ma = lambda :list(map(int,input().split()))
lma = lambda :list(map(int,input().split()))
n,k = ma()
A = lma()
bu = []
for i in range(n):
tmp=0
for j in range(i,n):
tmp+=A[j]
bu.append(tmp)
mb = bin(max(bu))
ans = 0
for i in range(len(mb)-3,-1,-1):
tmp=[]
for b in bu:
... | 39 | 24 | 815 | 453 | ma = lambda: map(int, input().split())
lma = lambda: list(map(int, input().split()))
tma = lambda: tuple(map(int, input().split()))
ni = lambda: int(input())
yn = lambda fl: print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n, k = ma()
A = lma()
bu = []
for i in ran... | ma = lambda: list(map(int, input().split()))
lma = lambda: list(map(int, input().split()))
n, k = ma()
A = lma()
bu = []
for i in range(n):
tmp = 0
for j in range(i, n):
tmp += A[j]
bu.append(tmp)
mb = bin(max(bu))
ans = 0
for i in range(len(mb) - 3, -1, -1):
tmp = []
for b in bu:
... | false | 38.461538 | [
"-ma = lambda: map(int, input().split())",
"+ma = lambda: list(map(int, input().split()))",
"-tma = lambda: tuple(map(int, input().split()))",
"-ni = lambda: int(input())",
"-yn = lambda fl: print(\"Yes\") if fl else print(\"No\")",
"-import collections",
"-import math",
"-import itertools",
"-impor... | false | 0.046645 | 0.080899 | 0.576589 | [
"s705501308",
"s381353276"
] |
u633068244 | p00158 | python | s628008316 | s533035680 | 20 | 10 | 4,192 | 4,196 | Accepted | Accepted | 50 | def collatz(n):
c = 0
while n > 1:
if n%2: n = 3*n+1
else: n /= 2
c += 1
return c
while True:
n = int(input())
if n == 0: break
print(collatz(n)) | def f(n):
c=0
while n>1:
if n%2:n=3*n+1
else:n /= 2
c += 1
print(c)
while 1:
n=eval(input())
if n==0:break
f(n) | 12 | 12 | 173 | 129 | def collatz(n):
c = 0
while n > 1:
if n % 2:
n = 3 * n + 1
else:
n /= 2
c += 1
return c
while True:
n = int(input())
if n == 0:
break
print(collatz(n))
| def f(n):
c = 0
while n > 1:
if n % 2:
n = 3 * n + 1
else:
n /= 2
c += 1
print(c)
while 1:
n = eval(input())
if n == 0:
break
f(n)
| false | 0 | [
"-def collatz(n):",
"+def f(n):",
"- return c",
"+ print(c)",
"-while True:",
"- n = int(input())",
"+while 1:",
"+ n = eval(input())",
"- print(collatz(n))",
"+ f(n)"
] | false | 0.041473 | 0.036891 | 1.124221 | [
"s628008316",
"s533035680"
] |
u077291787 | p02913 | python | s182555950 | s093032935 | 74 | 68 | 6,388 | 3,376 | Accepted | Accepted | 8.11 | # ABC141E - Who Says a Pun?
def main():
N = int(eval(input()))
S = input().rstrip()
ok, ng = 0, N // 2 + 1
while ng - ok > 1:
mid = (ok + ng) // 2
flg, checked = 0, set()
for i in range(N - 2 * mid + 1):
checked.add(S[i : i + mid])
if S[i + mid :... | # ABC141E - Who Says a Pun?
def resolve():
N = int(eval(input()))
S = input().rstrip()
ok, ng = 0, N // 2 + 1
while ng - ok > 1:
mid = (ok + ng) // 2
flg, checked = 0, set()
for i in range(N - 2 * mid + 1):
checked.add(hash(S[i : i + mid]))
if ha... | 22 | 21 | 628 | 614 | # ABC141E - Who Says a Pun?
def main():
N = int(eval(input()))
S = input().rstrip()
ok, ng = 0, N // 2 + 1
while ng - ok > 1:
mid = (ok + ng) // 2
flg, checked = 0, set()
for i in range(N - 2 * mid + 1):
checked.add(S[i : i + mid])
if S[i + mid : i + 2 * m... | # ABC141E - Who Says a Pun?
def resolve():
N = int(eval(input()))
S = input().rstrip()
ok, ng = 0, N // 2 + 1
while ng - ok > 1:
mid = (ok + ng) // 2
flg, checked = 0, set()
for i in range(N - 2 * mid + 1):
checked.add(hash(S[i : i + mid]))
if hash(S[i + m... | false | 4.545455 | [
"-def main():",
"+def resolve():",
"- checked.add(S[i : i + mid])",
"- if S[i + mid : i + 2 * mid] in checked:",
"+ checked.add(hash(S[i : i + mid]))",
"+ if hash(S[i + mid : i + 2 * mid]) in checked:",
"-if __name__ == \"__main__\":",
"- main()",
"+res... | false | 0.03581 | 0.037021 | 0.967285 | [
"s182555950",
"s093032935"
] |
u523087093 | p02601 | python | s349331087 | s338627640 | 37 | 30 | 9,208 | 9,208 | Accepted | Accepted | 18.92 | import itertools
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
targets = [A, B, C]
answer = 'No'
def check(targets):
if targets[1] > targets[0] and targets[2] > targets[1]:
return True
else:
return False
cases = itertools.product([0, 1, 2], repeat=K)
for case in... | import itertools
def check(targets):
if targets[1] > targets[0] and targets[2] > targets[1]:
return True
else:
return False
if __name__ == "__main__":
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
targets = [A, B, C]
answer = 'No'
cases =... | 22 | 25 | 502 | 586 | import itertools
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
targets = [A, B, C]
answer = "No"
def check(targets):
if targets[1] > targets[0] and targets[2] > targets[1]:
return True
else:
return False
cases = itertools.product([0, 1, 2], repeat=K)
for case in cases:
... | import itertools
def check(targets):
if targets[1] > targets[0] and targets[2] > targets[1]:
return True
else:
return False
if __name__ == "__main__":
A, B, C = list(map(int, input().split()))
K = int(eval(input()))
targets = [A, B, C]
answer = "No"
cases = itertools.prod... | false | 12 | [
"-",
"-A, B, C = list(map(int, input().split()))",
"-K = int(eval(input()))",
"-targets = [A, B, C]",
"-answer = \"No\"",
"-cases = itertools.product([0, 1, 2], repeat=K)",
"-for case in cases:",
"- copy_targets = targets.copy()",
"- for i in case:",
"- copy_targets[i] = copy_targets[... | false | 0.045369 | 0.046788 | 0.969665 | [
"s349331087",
"s338627640"
] |
u141610915 | p02744 | python | s394165036 | s503315912 | 409 | 196 | 64,476 | 87,992 | Accepted | Accepted | 52.08 | import sys
input = sys.stdin.readline
N = int(eval(input()))
res = set()
a = ord("a")
def dfs(s, x):
global res
if len(s) == N:
res.add(s)
return
for i in range(x + 1):
dfs(s + chr(a + i), x)
dfs(s + chr(a + x + 1), x + 1)
dfs("a", 0)
res = sorted(res)
for r in res: print(r) | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(eval(input()))
res = set()
a = ord("a")
mx = lambda x: max(list(map(ord, x))) - a
def dfs(s):
if len(s) == N:
res.add("".join(s))
return
for k in range(mx(s) + 2): dfs(s + [chr(k + a)])
dfs(["a"])
for r in sorted(res):... | 17 | 14 | 306 | 323 | import sys
input = sys.stdin.readline
N = int(eval(input()))
res = set()
a = ord("a")
def dfs(s, x):
global res
if len(s) == N:
res.add(s)
return
for i in range(x + 1):
dfs(s + chr(a + i), x)
dfs(s + chr(a + x + 1), x + 1)
dfs("a", 0)
res = sorted(res)
for r in res:
prin... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(eval(input()))
res = set()
a = ord("a")
mx = lambda x: max(list(map(ord, x))) - a
def dfs(s):
if len(s) == N:
res.add("".join(s))
return
for k in range(mx(s) + 2):
dfs(s + [chr(k + a)])
dfs(["a"])
for r in so... | false | 17.647059 | [
"+sys.setrecursionlimit(10**6)",
"+mx = lambda x: max(list(map(ord, x))) - a",
"-def dfs(s, x):",
"- global res",
"+def dfs(s):",
"- res.add(s)",
"+ res.add(\"\".join(s))",
"- for i in range(x + 1):",
"- dfs(s + chr(a + i), x)",
"- dfs(s + chr(a + x + 1), x + 1)",
"... | false | 0.058726 | 0.059405 | 0.988571 | [
"s394165036",
"s503315912"
] |
u923662841 | p02994 | python | s854739418 | s962264262 | 31 | 27 | 9,104 | 9,044 | Accepted | Accepted | 12.9 | N,L = list(map(int, input().split()))
r = [L+i-1 for i in range(1,N+1)]
e = min(r, key=abs)
print((sum(r)-e)) | N,L=list(map(int,input().split()))
taste=list(range(L,L+N))
print((sum(taste)-min(taste,key=abs))) | 4 | 3 | 104 | 86 | N, L = list(map(int, input().split()))
r = [L + i - 1 for i in range(1, N + 1)]
e = min(r, key=abs)
print((sum(r) - e))
| N, L = list(map(int, input().split()))
taste = list(range(L, L + N))
print((sum(taste) - min(taste, key=abs)))
| false | 25 | [
"-r = [L + i - 1 for i in range(1, N + 1)]",
"-e = min(r, key=abs)",
"-print((sum(r) - e))",
"+taste = list(range(L, L + N))",
"+print((sum(taste) - min(taste, key=abs)))"
] | false | 0.099251 | 0.099196 | 1.000557 | [
"s854739418",
"s962264262"
] |
u814265211 | p02719 | python | s961871209 | s571515264 | 31 | 25 | 9,144 | 9,156 | Accepted | Accepted | 19.35 | N, K = list(map(int, input().split()))
print((min(abs(N - (K*(N//K+1))), abs(N - (K*(N//K)))))) | N, K = list(map(int, input().split()))
A = abs(N - (K*(N//K+1)))
B = abs(N - (K*(N//K)))
print((min(A, B)))
| 2 | 4 | 94 | 109 | N, K = list(map(int, input().split()))
print((min(abs(N - (K * (N // K + 1))), abs(N - (K * (N // K))))))
| N, K = list(map(int, input().split()))
A = abs(N - (K * (N // K + 1)))
B = abs(N - (K * (N // K)))
print((min(A, B)))
| false | 50 | [
"-print((min(abs(N - (K * (N // K + 1))), abs(N - (K * (N // K))))))",
"+A = abs(N - (K * (N // K + 1)))",
"+B = abs(N - (K * (N // K)))",
"+print((min(A, B)))"
] | false | 0.108754 | 0.035934 | 3.026475 | [
"s961871209",
"s571515264"
] |
u156815136 | p02608 | python | s379938702 | s544346762 | 871 | 177 | 14,632 | 83,324 | Accepted | Accepted | 79.68 | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counte... | 36 | 38 | 888 | 961 | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | # from statistics import median
# import collections
# aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations, permutations, accumulate # (string,3) 3回
# from collections import deque
from collections import deque, defaultdict, Co... | false | 5.263158 | [
"+# my_round_int = lambda x:np.round((x*2 + 1)//2)",
"+# 四捨五入",
"- return int(input())",
"+ return int(eval(input()))",
"-n = I()",
"-dp = [0] * (500000)",
"+NUM = [0] * 500000",
"- pe = x**2 + y**2 + z**2 + x * y + y * z + z * x",
"- dp[pe] += 1",
"-print(*dp[1 : n + 1... | false | 2.129552 | 2.258148 | 0.943053 | [
"s379938702",
"s544346762"
] |
u073852194 | p03165 | python | s663939049 | s684747522 | 491 | 351 | 120,284 | 147,812 | Accepted | Accepted | 28.51 | def LCS(s,t,restore=False):
dp = [[0 for j in range(len(t)+1)] for i in range(len(s)+1)]
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i+1][j+1] = dp[i][j]+1
else:
dp[i+1][j+1] = max(dp[i+1][j],dp[i][j+1])
if resto... | S = eval(input())
T = eval(input())
dp = [[0 for j in range(len(T) + 1)] for i in range(len(S) + 1)]
for i in range(len(S)):
for j in range(len(T)):
if S[i] == T[j]:
dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1])
else:
dp[i + 1][j + 1] = max(dp[i... | 30 | 28 | 910 | 725 | def LCS(s, t, restore=False):
dp = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]
for i in range(len(s)):
for j in range(len(t)):
if s[i] == t[j]:
dp[i + 1][j + 1] = dp[i][j] + 1
else:
dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])... | S = eval(input())
T = eval(input())
dp = [[0 for j in range(len(T) + 1)] for i in range(len(S) + 1)]
for i in range(len(S)):
for j in range(len(T)):
if S[i] == T[j]:
dp[i + 1][j + 1] = max(dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1])
else:
dp[i + 1][j + 1] = max(dp[i + 1][j], dp... | false | 6.666667 | [
"-def LCS(s, t, restore=False):",
"- dp = [[0 for j in range(len(t) + 1)] for i in range(len(s) + 1)]",
"- for i in range(len(s)):",
"- for j in range(len(t)):",
"- if s[i] == t[j]:",
"- dp[i + 1][j + 1] = dp[i][j] + 1",
"- else:",
"- dp... | false | 0.040826 | 0.032119 | 1.271069 | [
"s663939049",
"s684747522"
] |
u033606236 | p03574 | python | s837569335 | s059563480 | 30 | 27 | 3,064 | 3,064 | Accepted | Accepted | 10 | y, x= list(map(int,input().split()))
bomb = [0 for i in range(y)]
ary = [[0 for i in range(x)]for i in range(y)]
for i in range(y):
bomb[i] = list(eval(input()))
for a in range(y):
for b in range(x):
if bomb[a][b] == "#":
ary[a][b] = "#"
else :
ary[a][b] = 0... | h, w = list(map(int,input().split()))
a = [eval(input()) for _ in range(h)]
for i in range(h):
l =""
for j in range(w):
if a[i][j] == "#":
l += "#"
else:
l+=str(sum([s[max(0,j-1):min(w,j+2)].count("#") for s in a[max(0,i-1):min(h,i+2)]]))
print(l) | 31 | 10 | 855 | 296 | y, x = list(map(int, input().split()))
bomb = [0 for i in range(y)]
ary = [[0 for i in range(x)] for i in range(y)]
for i in range(y):
bomb[i] = list(eval(input()))
for a in range(y):
for b in range(x):
if bomb[a][b] == "#":
ary[a][b] = "#"
else:
ary[a][b] = 0
# この配列を用意する... | h, w = list(map(int, input().split()))
a = [eval(input()) for _ in range(h)]
for i in range(h):
l = ""
for j in range(w):
if a[i][j] == "#":
l += "#"
else:
l += str(
sum(
[
s[max(0, j - 1) : min(w, j + 2)].count(... | false | 67.741935 | [
"-y, x = list(map(int, input().split()))",
"-bomb = [0 for i in range(y)]",
"-ary = [[0 for i in range(x)] for i in range(y)]",
"-for i in range(y):",
"- bomb[i] = list(eval(input()))",
"-for a in range(y):",
"- for b in range(x):",
"- if bomb[a][b] == \"#\":",
"- ary[a][b] =... | false | 0.048836 | 0.048386 | 1.009293 | [
"s837569335",
"s059563480"
] |
u254871849 | p03478 | python | s041190018 | s857614004 | 36 | 32 | 3,060 | 3,060 | Accepted | Accepted | 11.11 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n, a, b = (int(x) for x in sys.stdin.read().split())
total = 0
for i in range(1, n+1):
s = sum(list(int(x) for x in str(i)))
if a <= s <... | import sys
n, a, b = list(map(int, sys.stdin.readline().split()))
def main():
res = 0
for i in range(1, n+1):
s = sum([int(d) for d in str(i)])
if a <= s <= b:
res += i
return res
if __name__ == '__main__':
ans = main()
print(ans) | 20 | 15 | 435 | 293 | import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
def main():
n, a, b = (int(x) for x in sys.stdin.read().split())
total = 0
for i in range(1, n + 1):
s = sum(list(int(x) for x in str(i)))
if a <= s <= b:
... | import sys
n, a, b = list(map(int, sys.stdin.readline().split()))
def main():
res = 0
for i in range(1, n + 1):
s = sum([int(d) for d in str(i)])
if a <= s <= b:
res += i
return res
if __name__ == "__main__":
ans = main()
print(ans)
| false | 25 | [
"-# import collections",
"-# import math",
"-# import string",
"-# import bisect",
"-# import re",
"-# import itertools",
"-# import statistics",
"+n, a, b = list(map(int, sys.stdin.readline().split()))",
"+",
"+",
"- n, a, b = (int(x) for x in sys.stdin.read().split())",
"- total = 0",
... | false | 0.045943 | 0.044887 | 1.023529 | [
"s041190018",
"s857614004"
] |
u259861571 | p03160 | python | s168037726 | s211209224 | 132 | 121 | 13,980 | 20,420 | Accepted | Accepted | 8.33 | n = int(eval(input()))
lst = [int(i) for i in input().split()]
dp = [1e7]*n
dp[0] = 0
dp[1] = abs(lst[1]-lst[0])
for i in range(2, len(lst)):
dp[i] = min(dp[i-1]+abs(lst[i]-lst[i-1]), dp[i-2]+abs(lst[i]-lst[i-2]))
print((dp[-1])) | N = int(eval(input()))
h = list(map(int, input().split()))
dp = [1e7]*N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print((dp[-1]))
| 11 | 11 | 238 | 216 | n = int(eval(input()))
lst = [int(i) for i in input().split()]
dp = [1e7] * n
dp[0] = 0
dp[1] = abs(lst[1] - lst[0])
for i in range(2, len(lst)):
dp[i] = min(
dp[i - 1] + abs(lst[i] - lst[i - 1]), dp[i - 2] + abs(lst[i] - lst[i - 2])
)
print((dp[-1]))
| N = int(eval(input()))
h = list(map(int, input().split()))
dp = [1e7] * N
dp[0] = 0
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print((dp[-1]))
| false | 0 | [
"-n = int(eval(input()))",
"-lst = [int(i) for i in input().split()]",
"-dp = [1e7] * n",
"+N = int(eval(input()))",
"+h = list(map(int, input().split()))",
"+dp = [1e7] * N",
"-dp[1] = abs(lst[1] - lst[0])",
"-for i in range(2, len(lst)):",
"- dp[i] = min(",
"- dp[i - 1] + abs(lst[i] - ... | false | 0.043652 | 0.170287 | 0.256345 | [
"s168037726",
"s211209224"
] |
u475503988 | p02889 | python | s658423927 | s364839551 | 1,951 | 1,677 | 60,120 | 19,908 | Accepted | Accepted | 14.04 | INF = 1001001001
N, M, L = list(map(int, input().split()))
fuel = [[INF] * N for _ in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
fuel[A][B] = C
fuel[B][A] = C
for i in range(N):
fuel[i][i] = 0
for k in range(N):
for i in range(N):
... | from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
INF = 1001001001
N, M, L = list(map(int, input().split()))
fuel = [[INF] * N for _ in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
fuel[A][B] = C
fuel[B][A] = C
for i in range(N)... | 41 | 44 | 924 | 1,112 | INF = 1001001001
N, M, L = list(map(int, input().split()))
fuel = [[INF] * N for _ in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
fuel[A][B] = C
fuel[B][A] = C
for i in range(N):
fuel[i][i] = 0
for k in range(N):
for i in range(N):
for j in ra... | from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
INF = 1001001001
N, M, L = list(map(int, input().split()))
fuel = [[INF] * N for _ in range(N)]
for i in range(M):
A, B, C = list(map(int, input().split()))
A -= 1
B -= 1
fuel[A][B] = C
fuel[B][A] = C
for i in range(N):
fuel[i]... | false | 6.818182 | [
"+from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall",
"+",
"-for k in range(N):",
"- for i in range(N):",
"- for j in range(N):",
"- fuel[i][j] = min(fuel[i][j], fuel[i][k] + fuel[k][j])",
"+fuel = floyd_warshall(csgraph_from_dense(fuel))",
"+# for k in range(N):... | false | 0.044112 | 0.400476 | 0.11015 | [
"s658423927",
"s364839551"
] |
u497046426 | p03145 | python | s233735635 | s441766501 | 19 | 17 | 3,316 | 2,940 | Accepted | Accepted | 10.53 | AB, BC, CA = list(map(int, input().split()))
print((AB * BC//2)) | A, B, C = list(map(int, input().split()))
print((A * B // 2)) | 2 | 2 | 57 | 54 | AB, BC, CA = list(map(int, input().split()))
print((AB * BC // 2))
| A, B, C = list(map(int, input().split()))
print((A * B // 2))
| false | 0 | [
"-AB, BC, CA = list(map(int, input().split()))",
"-print((AB * BC // 2))",
"+A, B, C = list(map(int, input().split()))",
"+print((A * B // 2))"
] | false | 0.065558 | 0.056896 | 1.152248 | [
"s233735635",
"s441766501"
] |
u972591645 | p02582 | python | s792526098 | s263413647 | 38 | 29 | 9,924 | 8,976 | Accepted | Accepted | 23.68 | import re
s = eval(input())
print((max(list(map(len, re.split('S', s)))))) | print((len(max((input().split('S')))))) | 3 | 1 | 62 | 37 | import re
s = eval(input())
print((max(list(map(len, re.split("S", s))))))
| print((len(max((input().split("S"))))))
| false | 66.666667 | [
"-import re",
"-",
"-s = eval(input())",
"-print((max(list(map(len, re.split(\"S\", s))))))",
"+print((len(max((input().split(\"S\"))))))"
] | false | 0.049939 | 0.037244 | 1.340852 | [
"s792526098",
"s263413647"
] |
u630211216 | p02711 | python | s589052248 | s392417799 | 30 | 27 | 9,004 | 9,004 | Accepted | Accepted | 10 | if '7' in eval(input()):
print("Yes")
else:
print("No")
| print(("YNeos"['7' not in eval(input())::2]))
| 4 | 1 | 61 | 38 | if "7" in eval(input()):
print("Yes")
else:
print("No")
| print(("YNeos"["7" not in eval(input()) :: 2]))
| false | 75 | [
"-if \"7\" in eval(input()):",
"- print(\"Yes\")",
"-else:",
"- print(\"No\")",
"+print((\"YNeos\"[\"7\" not in eval(input()) :: 2]))"
] | false | 0.038239 | 0.039371 | 0.971264 | [
"s589052248",
"s392417799"
] |
u232852711 | p03027 | python | s539124905 | s083275210 | 1,556 | 1,340 | 84,716 | 84,972 | Accepted | Accepted | 13.88 | import sys
input = sys.stdin.readline
MOD = 10**6+3
q = int(eval(input()))
fact = [1]*MOD
for i in range(1, MOD):
fact[i] = fact[i-1]*i%MOD
finv = [1]*(MOD-1) + [pow(fact[-1], MOD-2, MOD)]
for i in range(MOD-1, 0, -1):
finv[i-1] = finv[i]*i%MOD
for _ in range(q):
x, d, n = list(map(int, input... | import sys
input = sys.stdin.readline
MOD = 10**6+3
q = int(eval(input()))
fact = [1]*MOD
for i in range(1, MOD):
fact[i] = fact[i-1]*i%MOD
finv = [1]*(MOD-1) + [pow(fact[-1], MOD-2, MOD)]
for i in range(MOD-1, 0, -1):
finv[i-1] = finv[i]*i%MOD
for _ in range(q):
x, d, n = list(map(int, input... | 28 | 26 | 720 | 655 | import sys
input = sys.stdin.readline
MOD = 10**6 + 3
q = int(eval(input()))
fact = [1] * MOD
for i in range(1, MOD):
fact[i] = fact[i - 1] * i % MOD
finv = [1] * (MOD - 1) + [pow(fact[-1], MOD - 2, MOD)]
for i in range(MOD - 1, 0, -1):
finv[i - 1] = finv[i] * i % MOD
for _ in range(q):
x, d, n = list(map(... | import sys
input = sys.stdin.readline
MOD = 10**6 + 3
q = int(eval(input()))
fact = [1] * MOD
for i in range(1, MOD):
fact[i] = fact[i - 1] * i % MOD
finv = [1] * (MOD - 1) + [pow(fact[-1], MOD - 2, MOD)]
for i in range(MOD - 1, 0, -1):
finv[i - 1] = finv[i] * i % MOD
for _ in range(q):
x, d, n = list(map(... | false | 7.142857 | [
"- f = fact[x_div + n - 1]",
"- fi = pow(fact[x_div - 1], MOD - 2, MOD)",
"- ans = f * fi % MOD * pow(d, n, MOD) % MOD",
"+ ans = fact[x_div + n - 1] * finv[x_div - 1] % MOD * pow(d, n, MOD) % MOD"
] | false | 0.822089 | 0.812412 | 1.011912 | [
"s539124905",
"s083275210"
] |
u150984829 | p00040 | python | s892188849 | s478990897 | 160 | 140 | 5,596 | 5,600 | Accepted | Accepted | 12.5 | z='abcdefghijklmnopqrstuvwxyz'
for _ in[0]*int(eval(input())):
e=eval(input())
for i in range(1,26,2):
for j in range(26):
a=''
for c in e:
a+=z[(z.index(c)*i+j)%26]if c in z else c
if'that'in a or'this'in a:print(a);break
| z='abcdefghijklmnopqrstuvwxyz'
for _ in[0]*int(eval(input())):
e=eval(input())
for i in range(1,26,2):
for j in range(26):
a=''.join(z[(z.index(c)*i+j)%26]if c in z else c for c in e)
if'that'in a or'this'in a:print(a);break
| 9 | 7 | 236 | 229 | z = "abcdefghijklmnopqrstuvwxyz"
for _ in [0] * int(eval(input())):
e = eval(input())
for i in range(1, 26, 2):
for j in range(26):
a = ""
for c in e:
a += z[(z.index(c) * i + j) % 26] if c in z else c
if "that" in a or "this" in a:
pri... | z = "abcdefghijklmnopqrstuvwxyz"
for _ in [0] * int(eval(input())):
e = eval(input())
for i in range(1, 26, 2):
for j in range(26):
a = "".join(z[(z.index(c) * i + j) % 26] if c in z else c for c in e)
if "that" in a or "this" in a:
print(a)
break
| false | 22.222222 | [
"- a = \"\"",
"- for c in e:",
"- a += z[(z.index(c) * i + j) % 26] if c in z else c",
"+ a = \"\".join(z[(z.index(c) * i + j) % 26] if c in z else c for c in e)"
] | false | 0.0473 | 0.039934 | 1.184434 | [
"s892188849",
"s478990897"
] |
u285891772 | p03852 | python | s518678145 | s043472361 | 170 | 155 | 14,500 | 13,680 | Accepted | Accepted | 8.82 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii... | 25 | 28 | 908 | 922 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lower... | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lower... | false | 10.714286 | [
"-print((\"vowel\" if c in boin else \"consonant\"))",
"+if c in boin:",
"+ print(\"vowel\")",
"+else:",
"+ print(\"consonant\")"
] | false | 0.036394 | 0.043214 | 0.842193 | [
"s518678145",
"s043472361"
] |
u058781705 | p03281 | python | s040102441 | s621459083 | 171 | 73 | 38,768 | 63,564 | Accepted | Accepted | 57.31 |
import collections
def solve():
N = int(eval(input()))
def GetDivider(num):
cnt = 0
for i in range(1, num+1):
if num % i == 0:
cnt += 1
return cnt
ans = 0
for i in range(1, N+1):
if GetDivider(i) == 8:
... | N = int(eval(input()))
def GetDivider(num):
cnt = 0
for i in range(1, num+1):
if num % i == 0:
cnt += 1
return cnt
ans = 0
for i in range(1, N+1):
if GetDivider(i) == 8:
if i % 2 != 0:
ans += 1
print(ans)
| 29 | 17 | 418 | 275 | import collections
def solve():
N = int(eval(input()))
def GetDivider(num):
cnt = 0
for i in range(1, num + 1):
if num % i == 0:
cnt += 1
return cnt
ans = 0
for i in range(1, N + 1):
if GetDivider(i) == 8:
if i % 2 != 0:
... | N = int(eval(input()))
def GetDivider(num):
cnt = 0
for i in range(1, num + 1):
if num % i == 0:
cnt += 1
return cnt
ans = 0
for i in range(1, N + 1):
if GetDivider(i) == 8:
if i % 2 != 0:
ans += 1
print(ans)
| false | 41.37931 | [
"-import collections",
"+N = int(eval(input()))",
"-def solve():",
"- N = int(eval(input()))",
"-",
"- def GetDivider(num):",
"- cnt = 0",
"- for i in range(1, num + 1):",
"- if num % i == 0:",
"- cnt += 1",
"- return cnt",
"-",
"- ans ... | false | 0.039805 | 0.041406 | 0.961319 | [
"s040102441",
"s621459083"
] |
u426534722 | p02272 | python | s979054770 | s671080542 | 4,330 | 3,870 | 63,760 | 61,656 | Accepted | Accepted | 10.62 | SENTINEL = 2000000000
L = R = [0]
cnt = 0
def merge(A, n, left, mid, right):
L = A[left:mid] + [SENTINEL]
R = A[mid:right] + [SENTINEL]
i = j = 0
global cnt
for k in range(left, right):
cnt += 1
if L[i] <= R[j]:
A[k] = L[i]
i += 1
else:
... | INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = A[left: left + n1] + [INF]
R = A[mid: mid + n2] + [INF]
i = j = 0
for k in range(left, right):
cnt += 1
if L[i] <= R[j]:
A[k] = L[i]
... | 27 | 29 | 673 | 684 | SENTINEL = 2000000000
L = R = [0]
cnt = 0
def merge(A, n, left, mid, right):
L = A[left:mid] + [SENTINEL]
R = A[mid:right] + [SENTINEL]
i = j = 0
global cnt
for k in range(left, right):
cnt += 1
if L[i] <= R[j]:
A[k] = L[i]
i += 1
else:
A... | INF = float("inf")
cnt = 0
def merge(A, left, mid, right):
global cnt
n1 = mid - left
n2 = right - mid
L = A[left : left + n1] + [INF]
R = A[mid : mid + n2] + [INF]
i = j = 0
for k in range(left, right):
cnt += 1
if L[i] <= R[j]:
A[k] = L[i]
i += 1
... | false | 6.896552 | [
"-SENTINEL = 2000000000",
"-L = R = [0]",
"+INF = float(\"inf\")",
"-def merge(A, n, left, mid, right):",
"- L = A[left:mid] + [SENTINEL]",
"- R = A[mid:right] + [SENTINEL]",
"+def merge(A, left, mid, right):",
"+ global cnt",
"+ n1 = mid - left",
"+ n2 = right - mid",
"+ L = A... | false | 0.040776 | 0.038911 | 1.047918 | [
"s979054770",
"s671080542"
] |
u442948527 | p03844 | python | s244666549 | s668950503 | 35 | 30 | 9,108 | 9,088 | Accepted | Accepted | 14.29 | a,o,b=input().split()
a=int(a)
b=int(b)
print(([a+b,a-b][o=="-"])) | print((eval(input()))) | 4 | 1 | 67 | 20 | a, o, b = input().split()
a = int(a)
b = int(b)
print(([a + b, a - b][o == "-"]))
| print((eval(input())))
| false | 75 | [
"-a, o, b = input().split()",
"-a = int(a)",
"-b = int(b)",
"-print(([a + b, a - b][o == \"-\"]))",
"+print((eval(input())))"
] | false | 0.040236 | 0.091138 | 0.441488 | [
"s244666549",
"s668950503"
] |
u981931040 | p03472 | python | s990787067 | s999521317 | 1,844 | 266 | 11,264 | 17,052 | Accepted | Accepted | 85.57 | import math
N , H = list(map(int , input().split()))
slash = []
throw = []
for _ in range(N):
a , b = list(map(int , input().split()))
slash.append(a)
throw.append(b)
count = 0
#print(slash)
slash_max = max(slash)
#print(throw)
throw.sort(reverse = True)
#print(throw)
while H > 0:
#print(... | import math
N, H = list(map(int, input().split()))
a_l = []
b_l = []
for _ in range(N):
a, b = list(map(int, input().split()))
a_l.append(a)
b_l.append(b)
a_l.sort(reverse=True)
b_l.sort(reverse=True)
ans = 0
for i in range(N):
if a_l[0] >= b_l[i]:
break
else:
ans ... | 25 | 23 | 522 | 425 | import math
N, H = list(map(int, input().split()))
slash = []
throw = []
for _ in range(N):
a, b = list(map(int, input().split()))
slash.append(a)
throw.append(b)
count = 0
# print(slash)
slash_max = max(slash)
# print(throw)
throw.sort(reverse=True)
# print(throw)
while H > 0:
# print(H)
if not th... | import math
N, H = list(map(int, input().split()))
a_l = []
b_l = []
for _ in range(N):
a, b = list(map(int, input().split()))
a_l.append(a)
b_l.append(b)
a_l.sort(reverse=True)
b_l.sort(reverse=True)
ans = 0
for i in range(N):
if a_l[0] >= b_l[i]:
break
else:
ans += 1
H = m... | false | 8 | [
"-slash = []",
"-throw = []",
"+a_l = []",
"+b_l = []",
"- slash.append(a)",
"- throw.append(b)",
"-count = 0",
"-# print(slash)",
"-slash_max = max(slash)",
"-# print(throw)",
"-throw.sort(reverse=True)",
"-# print(throw)",
"-while H > 0:",
"- # print(H)",
"- if not throw or... | false | 0.034935 | 0.041814 | 0.835497 | [
"s990787067",
"s999521317"
] |
u353919145 | p03013 | python | s340557651 | s283216465 | 391 | 183 | 460,020 | 4,016 | Accepted | Accepted | 53.2 | line = eval(input())
X, Y = [int(n) for n in line.split()]
broken_steps = set()
for _ in range(Y):
line = eval(input())
broken_steps.add(int(line))
if 1 not in broken_steps:
if 2 not in broken_steps:
stairs = [1, 2]
else:
stairs = [1, 0]
elif 2 not in broken_steps:
st... | fib = [1,1,1,2]
def fibonacci(n):
if n<len(fib):
return fib[n]
x = len(fib)
a = fib[len(fib)-2]
b = fib[len(fib)-1]
while x<=n:
c = b
b = a+b
a = c
x+=1
return b
h = input().split(" ")
n = int(h[0])
a = []
for i in range(n+1):
a.appe... | 25 | 42 | 591 | 671 | line = eval(input())
X, Y = [int(n) for n in line.split()]
broken_steps = set()
for _ in range(Y):
line = eval(input())
broken_steps.add(int(line))
if 1 not in broken_steps:
if 2 not in broken_steps:
stairs = [1, 2]
else:
stairs = [1, 0]
elif 2 not in broken_steps:
stairs = [0, 1]
el... | fib = [1, 1, 1, 2]
def fibonacci(n):
if n < len(fib):
return fib[n]
x = len(fib)
a = fib[len(fib) - 2]
b = fib[len(fib) - 1]
while x <= n:
c = b
b = a + b
a = c
x += 1
return b
h = input().split(" ")
n = int(h[0])
a = []
for i in range(n + 1):
a.ap... | false | 40.47619 | [
"-line = eval(input())",
"-X, Y = [int(n) for n in line.split()]",
"-broken_steps = set()",
"-for _ in range(Y):",
"- line = eval(input())",
"- broken_steps.add(int(line))",
"-if 1 not in broken_steps:",
"- if 2 not in broken_steps:",
"- stairs = [1, 2]",
"+fib = [1, 1, 1, 2]",
"... | false | 0.035696 | 0.03677 | 0.970808 | [
"s340557651",
"s283216465"
] |
u675844759 | p02393 | python | s965282104 | s862571232 | 30 | 20 | 7,588 | 7,656 | Accepted | Accepted | 33.33 | a = [int(i) for i in input().split()]
print((" ".join(map(str,sorted(a))))) | a = [int(i) for i in input().split()]
a.sort()
print((a[0],a[1],a[2])) | 2 | 3 | 74 | 70 | a = [int(i) for i in input().split()]
print((" ".join(map(str, sorted(a)))))
| a = [int(i) for i in input().split()]
a.sort()
print((a[0], a[1], a[2]))
| false | 33.333333 | [
"-print((\" \".join(map(str, sorted(a)))))",
"+a.sort()",
"+print((a[0], a[1], a[2]))"
] | false | 0.081332 | 0.079928 | 1.017565 | [
"s965282104",
"s862571232"
] |
u761320129 | p02608 | python | s435681814 | s910305364 | 635 | 451 | 11,812 | 9,308 | Accepted | Accepted | 28.98 | N = int(eval(input()))
from collections import Counter
c = Counter()
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
n = x*x + y*y + z*z + x*y + y*z + z*x
c[n] += 1
for i in range(1,N+1):
print((c[i])) | N = int(input())
ans = [0]*(N+1)
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
n = x*x + y*y + z*z + x*y + y*z + z*x
if n <= N:
ans[n] += 1
print(*ans[1:], sep='\n')
| 10 | 9 | 263 | 248 | N = int(eval(input()))
from collections import Counter
c = Counter()
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
c[n] += 1
for i in range(1, N + 1):
print((c[i]))
| N = int(input())
ans = [0] * (N + 1)
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
n = x * x + y * y + z * z + x * y + y * z + z * x
if n <= N:
ans[n] += 1
print(*ans[1:], sep="\n")
| false | 10 | [
"-N = int(eval(input()))",
"-from collections import Counter",
"-",
"-c = Counter()",
"+N = int(input())",
"+ans = [0] * (N + 1)",
"- c[n] += 1",
"-for i in range(1, N + 1):",
"- print((c[i]))",
"+ if n <= N:",
"+ ans[n] += 1",
"+print(*ans[1:], sep=\"\\... | false | 1.765622 | 1.091117 | 1.618179 | [
"s435681814",
"s910305364"
] |
u989345508 | p03379 | python | s077108595 | s917291756 | 333 | 307 | 25,472 | 25,220 | Accepted | Accepted | 7.81 | n=int(eval(input()))
x=[int(i) for i in input().split()]
y=sorted(x)
l=y[n//2-1]
m=y[n//2]
for i in range(n):
if x[i]<=l:
print(m)
else:
print(l)
| n=int(eval(input()))
x=list(map(int,input().split()))
y=sorted(x)
k,l=y[n//2-1],y[n//2]
for i in range(n):
if x[i]<=k:
print(l)
else:
print(k) | 10 | 9 | 173 | 168 | n = int(eval(input()))
x = [int(i) for i in input().split()]
y = sorted(x)
l = y[n // 2 - 1]
m = y[n // 2]
for i in range(n):
if x[i] <= l:
print(m)
else:
print(l)
| n = int(eval(input()))
x = list(map(int, input().split()))
y = sorted(x)
k, l = y[n // 2 - 1], y[n // 2]
for i in range(n):
if x[i] <= k:
print(l)
else:
print(k)
| false | 10 | [
"-x = [int(i) for i in input().split()]",
"+x = list(map(int, input().split()))",
"-l = y[n // 2 - 1]",
"-m = y[n // 2]",
"+k, l = y[n // 2 - 1], y[n // 2]",
"- if x[i] <= l:",
"- print(m)",
"+ if x[i] <= k:",
"+ print(l)",
"- print(l)",
"+ print(k)"
] | false | 0.049646 | 0.04977 | 0.997511 | [
"s077108595",
"s917291756"
] |
u541610817 | p03331 | python | s995139940 | s249667414 | 163 | 92 | 3,060 | 3,060 | Accepted | Accepted | 43.56 | N = int(eval(input()))
def SumDigits(num):
sum = 0
while True:
sum += num % 10
num //= 10
if num == 0:
break
return sum
infinity = float('inf')
min = infinity
for x in range(1, N):
if SumDigits(x) + SumDigits(N - x) < min:
min = SumDigits(x)... | N = int(eval(input()))
def SumDigits(num):
sum = 0
while True:
sum += num % 10
num //= 10
if num == 0:
break
return sum
infinity = float('inf')
min = infinity
for x in range(1, N//2 + 1):
#print('============')
#print(x, N - x)
#print(SumDi... | 18 | 21 | 346 | 448 | N = int(eval(input()))
def SumDigits(num):
sum = 0
while True:
sum += num % 10
num //= 10
if num == 0:
break
return sum
infinity = float("inf")
min = infinity
for x in range(1, N):
if SumDigits(x) + SumDigits(N - x) < min:
min = SumDigits(x) + SumDigits(N ... | N = int(eval(input()))
def SumDigits(num):
sum = 0
while True:
sum += num % 10
num //= 10
if num == 0:
break
return sum
infinity = float("inf")
min = infinity
for x in range(1, N // 2 + 1):
# print('============')
# print(x, N - x)
# print(SumDigits(x) + S... | false | 14.285714 | [
"-for x in range(1, N):",
"+for x in range(1, N // 2 + 1):",
"+ # print('============')",
"+ # print(x, N - x)",
"+ # print(SumDigits(x) + SumDigits(N - x))"
] | false | 0.052635 | 0.048801 | 1.07857 | [
"s995139940",
"s249667414"
] |
u627600101 | p02722 | python | s461134496 | s321084004 | 330 | 96 | 20,132 | 9,404 | Accepted | Accepted | 70.91 | N = int(eval(input()))
originalN = 0 +N
if N == 2:
print((1))
exit()
ans = 0
primenum = [2]
count = [0 for _ in range(int(N**0.5)+2)]
for k in range(3, len(count), 2):
if count[k] == 0:
primenum.append(k)
for j in range(k, len(count), k):
count[j] = 1
def factorization(n):
lis ... | N = int(eval(input()))
originalN = 0 +N
if N == 2:
print((1))
exit()
ans = 0
"""
primenum = [2]
count = [0 for _ in range(int(N**0.5)+2)]
for k in range(3, len(count), 2):
if count[k] == 0:
primenum.append(k)
for j in range(k, len(count), k):
count[j] = 1
def factorization(n):
... | 75 | 98 | 1,360 | 1,726 | N = int(eval(input()))
originalN = 0 + N
if N == 2:
print((1))
exit()
ans = 0
primenum = [2]
count = [0 for _ in range(int(N**0.5) + 2)]
for k in range(3, len(count), 2):
if count[k] == 0:
primenum.append(k)
for j in range(k, len(count), k):
count[j] = 1
def factorization(n):
... | N = int(eval(input()))
originalN = 0 + N
if N == 2:
print((1))
exit()
ans = 0
"""
primenum = [2]
count = [0 for _ in range(int(N**0.5)+2)]
for k in range(3, len(count), 2):
if count[k] == 0:
primenum.append(k)
for j in range(k, len(count), k):
count[j] = 1
def factorization(n):
lis = []
k = ... | false | 23.469388 | [
"+\"\"\"",
"-count = [0 for _ in range(int(N**0.5) + 2)]",
"+count = [0 for _ in range(int(N**0.5)+2)]",
"- if count[k] == 0:",
"- primenum.append(k)",
"- for j in range(k, len(count), k):",
"- count[j] = 1",
"+ if count[k] == 0:",
"+ primenum.append(k)",
"+ for ... | false | 0.447758 | 0.071398 | 6.271295 | [
"s461134496",
"s321084004"
] |
u488401358 | p02703 | python | s165593976 | s123780002 | 1,840 | 839 | 241,672 | 158,144 | Accepted | Accepted | 54.4 | class Dijkstra():
""" ダイクストラ法
重み付きグラフにおける単一始点最短路アルゴリズム
* 使用条件
- 負のコストがないこと
- 有向グラフ、無向グラフともにOK
* 計算量はO(E*log(V))
* ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
"""
class Edge():
""" 重み付き有向辺 """
def __init__(self, _to, _cost):
self.to = _t... | class Dijkstra():
""" ダイクストラ法
重み付きグラフにおける単一始点最短路アルゴリズム
* 使用条件
- 負のコストがないこと
- 有向グラフ、無向グラフともにOK
* 計算量はO(E*log(V))
* ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
"""
class Edge():
""" 重み付き有向辺 """
def __init__(self, _to, _cost):
self.to = _t... | 94 | 94 | 2,507 | 2,540 | class Dijkstra:
"""ダイクストラ法
重み付きグラフにおける単一始点最短路アルゴリズム
* 使用条件
- 負のコストがないこと
- 有向グラフ、無向グラフともにOK
* 計算量はO(E*log(V))
* ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
"""
class Edge:
"""重み付き有向辺"""
def __init__(self, _to, _cost):
self.to = _to
self.cost... | class Dijkstra:
"""ダイクストラ法
重み付きグラフにおける単一始点最短路アルゴリズム
* 使用条件
- 負のコストがないこと
- 有向グラフ、無向グラフともにOK
* 計算量はO(E*log(V))
* ベルマンフォード法より高速なので、負のコストがないならばこちらを使うとよい
"""
class Edge:
"""重み付き有向辺"""
def __init__(self, _to, _cost):
self.to = _to
self.cost... | false | 0 | [
"-pro = Dijkstra(N * 5001)",
"+pro = Dijkstra(N * (50 * (N - 1) + 1))",
"- for j in range(a, 5001):",
"+ for j in range(a, 50 * (N - 1) + 1):",
"- for j in range(0, 5000):",
"- to = min(5000, j + c)",
"+ for j in range(0, 50 * (N - 1)):",
"+ to = min(50 * (N - 1), j + c)",
... | false | 0.504174 | 0.087032 | 5.793002 | [
"s165593976",
"s123780002"
] |
u341087021 | p03721 | python | s161677384 | s435788654 | 198 | 175 | 5,744 | 5,740 | Accepted | Accepted | 11.62 | import sys
r = [0]*100000
n,k = [int(x) for x in sys.stdin.readline().split()]
for i in range(n):
a, b = [int(x) for x in sys.stdin.readline().split()]
r[a-1] += b
c = 0
for i,j in enumerate(r):
c += j
if c >= k:
print((i+1))
break | import sys
r = [0]*(100000+1)
n,k = [int(x) for x in sys.stdin.readline().split()]
for i in range(n):
a, b = [int(x) for x in sys.stdin.readline().split()]
r[a] += b
c = 0
for i,j in enumerate(r):
c += j
if c >= k:
print(i)
break | 12 | 12 | 248 | 248 | import sys
r = [0] * 100000
n, k = [int(x) for x in sys.stdin.readline().split()]
for i in range(n):
a, b = [int(x) for x in sys.stdin.readline().split()]
r[a - 1] += b
c = 0
for i, j in enumerate(r):
c += j
if c >= k:
print((i + 1))
break
| import sys
r = [0] * (100000 + 1)
n, k = [int(x) for x in sys.stdin.readline().split()]
for i in range(n):
a, b = [int(x) for x in sys.stdin.readline().split()]
r[a] += b
c = 0
for i, j in enumerate(r):
c += j
if c >= k:
print(i)
break
| false | 0 | [
"-r = [0] * 100000",
"+r = [0] * (100000 + 1)",
"- r[a - 1] += b",
"+ r[a] += b",
"- print((i + 1))",
"+ print(i)"
] | false | 0.049384 | 0.092107 | 0.536165 | [
"s161677384",
"s435788654"
] |
u068727970 | p03805 | python | s543636473 | s937604722 | 98 | 38 | 9,568 | 9,004 | Accepted | Accepted | 61.22 | from collections import deque
import copy
# https://atcoder.jp/contests/abc054/tasks/abc054_c
# n!の全探索が答えというのは知っているが、自分の開放の誤りを見つけるために自分のやり方でといてみる。
N, M = list(map(int, input().split()))
V = [[] for _ in range(N)]
cont = [0 for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
V... | import itertools
N, M = list(map(int, input().split()))
V = [[] for _ in range(N)]
bag = set()
for _ in range(M):
a, b = list(map(int, input().split()))
bag.add(a)
bag.add(b)
V[a-1].append(b)
V[b-1].append(a)
count = 0
for c in itertools.permutations(bag):
if not c[0] == 1:
... | 41 | 24 | 1,041 | 498 | from collections import deque
import copy
# https://atcoder.jp/contests/abc054/tasks/abc054_c
# n!の全探索が答えというのは知っているが、自分の開放の誤りを見つけるために自分のやり方でといてみる。
N, M = list(map(int, input().split()))
V = [[] for _ in range(N)]
cont = [0 for _ in range(N)]
for _ in range(M):
a, b = list(map(int, input().split()))
V[a - 1].ap... | import itertools
N, M = list(map(int, input().split()))
V = [[] for _ in range(N)]
bag = set()
for _ in range(M):
a, b = list(map(int, input().split()))
bag.add(a)
bag.add(b)
V[a - 1].append(b)
V[b - 1].append(a)
count = 0
for c in itertools.permutations(bag):
if not c[0] == 1:
continue... | false | 41.463415 | [
"-from collections import deque",
"-import copy",
"+import itertools",
"-# https://atcoder.jp/contests/abc054/tasks/abc054_c",
"-# n!の全探索が答えというのは知っているが、自分の開放の誤りを見つけるために自分のやり方でといてみる。",
"-cont = [0 for _ in range(N)]",
"+bag = set()",
"- V[a - 1].append([b, copy.deepcopy(cont)])",
"- V[b - 1].ap... | false | 0.04517 | 0.042877 | 1.05349 | [
"s543636473",
"s937604722"
] |
u179169725 | p03078 | python | s018618288 | s938360496 | 584 | 79 | 4,116 | 5,972 | Accepted | Accepted | 86.47 | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_... | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_... | 45 | 47 | 1,125 | 1,142 | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_ints()
A = re... | # ヒープに要素を追加、一番でかいのを取り出すという操作を最大3000回やるやり方
# これもなかなか早い
# ヒープは追加も要素の取り出しもO(log n)で住むので、
# 計算オーダーはO(K log n)で済む(nはヒープの要素数)らしいが
# not in があるのでO(n K log n)では?
# pythonのヒープは使い方に癖があるのでこの機会に習得しよう
import sys
read = sys.stdin.readline
def read_ints():
return list(map(int, read().split()))
X, Y, Z, K = read_ints()
A = re... | false | 4.255319 | [
"-from heapq import heapify, heappop, heappush, heappushpop",
"+from queue import PriorityQueue",
"-heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))",
"+heap = PriorityQueue()",
"+heap.put((-(A[0] + B[0] + C[0]), 0, 0, 0))",
"+considerd = set()",
"- heap_max, i, j, k = heappop(heap)",
"+ heap_ma... | false | 0.042147 | 0.046147 | 0.913335 | [
"s018618288",
"s938360496"
] |
u260980560 | p00009 | python | s626843424 | s735199469 | 820 | 460 | 67,888 | 23,520 | Accepted | Accepted | 43.9 | p = [1]
n = [0,0]
c = 0
for i in range(1,1000000):
p.append(0)
for i in range(2,1000000):
if p[i]==1 :
n.append(c)
continue
c += 1
n.append(c)
for j in range(i*i,1000000,i):
if p[j]==0 : p[j]=1
while True:
try:
nn = int(input())
print(n[nn]... | M = 10**6
p = [0]*(M+60)
sM = M**0.5
for x in range(1, int(sM/2)+1):
v = 4*x*x + 1; y = 8
while v <= M:
if v % 12 != 9: # v % 12 in [1, 5]
p[v] ^= 1
v += y; y += 8
for x in range(1, int(sM/3**0.5)+1, 2):
v = 3*x*x + 4; y = 12
while v <= M:
if v % 12 == 7... | 18 | 42 | 354 | 849 | p = [1]
n = [0, 0]
c = 0
for i in range(1, 1000000):
p.append(0)
for i in range(2, 1000000):
if p[i] == 1:
n.append(c)
continue
c += 1
n.append(c)
for j in range(i * i, 1000000, i):
if p[j] == 0:
p[j] = 1
while True:
try:
nn = int(input())
prin... | M = 10**6
p = [0] * (M + 60)
sM = M**0.5
for x in range(1, int(sM / 2) + 1):
v = 4 * x * x + 1
y = 8
while v <= M:
if v % 12 != 9: # v % 12 in [1, 5]
p[v] ^= 1
v += y
y += 8
for x in range(1, int(sM / 3**0.5) + 1, 2):
v = 3 * x * x + 4
y = 12
while v <= M:
... | false | 57.142857 | [
"-p = [1]",
"-n = [0, 0]",
"-c = 0",
"-for i in range(1, 1000000):",
"- p.append(0)",
"-for i in range(2, 1000000):",
"- if p[i] == 1:",
"- n.append(c)",
"- continue",
"- c += 1",
"- n.append(c)",
"- for j in range(i * i, 1000000, i):",
"- if p[j] == 0:",
... | false | 1.103652 | 0.858862 | 1.285017 | [
"s626843424",
"s735199469"
] |
u057964173 | p03478 | python | s422916227 | s953536382 | 41 | 30 | 3,404 | 3,064 | Accepted | Accepted | 26.83 | import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,a,b=list(map(int, input().split()))
l=[]
for i in range(1,n+1):
cnt=0
for j in range(len(str(i))):
cnt+=int(str(i)[j])
if a<=cnt<=b:
l.append(i)
print((sum(l)))
reso... |
import sys
def input(): return sys.stdin.readline().strip()
def resolve():
n,a,b=list(map(int, input().split()))
ans=0
for i in range(1,n+1):
cnt=0
for j in str(i):
cnt+=int(j)
if a<=cnt<=b:
ans+=i
print(ans)
resolve() | 14 | 15 | 317 | 292 | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n, a, b = list(map(int, input().split()))
l = []
for i in range(1, n + 1):
cnt = 0
for j in range(len(str(i))):
cnt += int(str(i)[j])
if a <= cnt <= b:
l.append(i)
print((su... | import sys
def input():
return sys.stdin.readline().strip()
def resolve():
n, a, b = list(map(int, input().split()))
ans = 0
for i in range(1, n + 1):
cnt = 0
for j in str(i):
cnt += int(j)
if a <= cnt <= b:
ans += i
print(ans)
resolve()
| false | 6.666667 | [
"- l = []",
"+ ans = 0",
"- for j in range(len(str(i))):",
"- cnt += int(str(i)[j])",
"+ for j in str(i):",
"+ cnt += int(j)",
"- l.append(i)",
"- print((sum(l)))",
"+ ans += i",
"+ print(ans)"
] | false | 0.087431 | 0.035532 | 2.460621 | [
"s422916227",
"s953536382"
] |
u505564549 | p02606 | python | s162077089 | s024887382 | 71 | 62 | 61,628 | 61,824 | Accepted | Accepted | 12.68 | import sys
input = sys.stdin.readline
l,r,d=list(map(int,input().split()))
ans = 0
for i in range(l,r+1):
if i%d==0:
ans+=1
print(ans)
| import sys
input = sys.stdin.readline
l,r,d=list(map(int,input().split()))
v1 = l//d
if l%d==0:
v1-=1
v2 = r//d
print((v2-v1))
| 8 | 9 | 148 | 132 | import sys
input = sys.stdin.readline
l, r, d = list(map(int, input().split()))
ans = 0
for i in range(l, r + 1):
if i % d == 0:
ans += 1
print(ans)
| import sys
input = sys.stdin.readline
l, r, d = list(map(int, input().split()))
v1 = l // d
if l % d == 0:
v1 -= 1
v2 = r // d
print((v2 - v1))
| false | 11.111111 | [
"-ans = 0",
"-for i in range(l, r + 1):",
"- if i % d == 0:",
"- ans += 1",
"-print(ans)",
"+v1 = l // d",
"+if l % d == 0:",
"+ v1 -= 1",
"+v2 = r // d",
"+print((v2 - v1))"
] | false | 0.092976 | 0.159166 | 0.584144 | [
"s162077089",
"s024887382"
] |
u588341295 | p03343 | python | s528244883 | s107277058 | 553 | 508 | 53,724 | 52,188 | Accepted | Accepted | 8.14 | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | # -*- coding: utf-8 -*-
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in ... | 49 | 50 | 1,271 | 1,295 | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | # -*- coding: utf-8 -*-
import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [[c] * b for i in range(a)]
def list3d(a, b, c, d):
return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[[e] * d for j in range(c)] for j in rang... | false | 2 | [
"- li.sort()",
"- C += li[: max(m - K + 1, 0)]",
"+ if m - K + 1 >= 1:",
"+ li.sort()",
"+ C += li[: m - K + 1]"
] | false | 0.048589 | 0.066795 | 0.727432 | [
"s528244883",
"s107277058"
] |
u619144316 | p03274 | python | s538877271 | s556253364 | 97 | 87 | 14,660 | 20,108 | Accepted | Accepted | 10.31 | import bisect
N, K = list(map(int,input().split()))
X = list(map(int,input().split()))
s = bisect.bisect_left(X,0)
if 0 in X:
K -= 1
else:
bisect.insort_left(X,0)
N += 1
MIN = 2 * 10**9
for i in range(K+1):
if s - K + i >= 0 and s + i <N:
f = X[s -K+i]
l = X[s+i]
... | def main():
n,k = list(map(int,input().split()))
X = list(map(int,input().split()))
ans = 10**9
for i in range(n-k+1):
t1 = abs(X[i]) + abs(X[i] - X[i+k-1])
t2 = abs(X[i+k-1]) + abs(X[i] - X[i+k-1])
t = min(t1,t2)
ans = min(ans,t)
print(ans)
ma... | 24 | 18 | 471 | 318 | import bisect
N, K = list(map(int, input().split()))
X = list(map(int, input().split()))
s = bisect.bisect_left(X, 0)
if 0 in X:
K -= 1
else:
bisect.insort_left(X, 0)
N += 1
MIN = 2 * 10**9
for i in range(K + 1):
if s - K + i >= 0 and s + i < N:
f = X[s - K + i]
l = X[s + i]
if ... | def main():
n, k = list(map(int, input().split()))
X = list(map(int, input().split()))
ans = 10**9
for i in range(n - k + 1):
t1 = abs(X[i]) + abs(X[i] - X[i + k - 1])
t2 = abs(X[i + k - 1]) + abs(X[i] - X[i + k - 1])
t = min(t1, t2)
ans = min(ans, t)
print(ans)
mai... | false | 25 | [
"-import bisect",
"+def main():",
"+ n, k = list(map(int, input().split()))",
"+ X = list(map(int, input().split()))",
"+ ans = 10**9",
"+ for i in range(n - k + 1):",
"+ t1 = abs(X[i]) + abs(X[i] - X[i + k - 1])",
"+ t2 = abs(X[i + k - 1]) + abs(X[i] - X[i + k - 1])",
"+ ... | false | 0.112348 | 0.048495 | 2.316692 | [
"s538877271",
"s556253364"
] |
u145950990 | p03546 | python | s850743702 | s108547392 | 707 | 201 | 45,532 | 40,412 | Accepted | Accepted | 71.57 | import itertools
import collections
h,w = list(map(int,input().split()))
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]
a = list(itertools.chain.from_iterable(a))
b = collections.Counter(a)
ans = 0
def bfs(x):
if x[-1]==1:
global s
... | h,w = list(map(int,input().split()))
c = [list(map(int,input().split())) for _ in range(10)]
a = [list(map(int,input().split())) for _ in range(h)]
n = 10
for k in range(n):
for i in range(n):
for j in range(n):
c[i][j] = min(c[i][j],c[i][k]+c[k][j])
ans = 0
for i in a:
for j in i:... | 27 | 13 | 633 | 360 | import itertools
import collections
h, w = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]
a = list(itertools.chain.from_iterable(a))
b = collections.Counter(a)
ans = 0
def bfs(x):
if x[-1] == 1:
global s
... | h, w = list(map(int, input().split()))
c = [list(map(int, input().split())) for _ in range(10)]
a = [list(map(int, input().split())) for _ in range(h)]
n = 10
for k in range(n):
for i in range(n):
for j in range(n):
c[i][j] = min(c[i][j], c[i][k] + c[k][j])
ans = 0
for i in a:
for j in i:
... | false | 51.851852 | [
"-import itertools",
"-import collections",
"-",
"-a = list(itertools.chain.from_iterable(a))",
"-b = collections.Counter(a)",
"+n = 10",
"+for k in range(n):",
"+ for i in range(n):",
"+ for j in range(n):",
"+ c[i][j] = min(c[i][j], c[i][k] + c[k][j])",
"-",
"-",
"-def... | false | 0.687838 | 0.038657 | 17.793368 | [
"s850743702",
"s108547392"
] |
u150984829 | p00470 | python | s220924778 | s773980275 | 70 | 60 | 7,832 | 7,832 | Accepted | Accepted | 14.29 | for e in iter(input,'0 0'):
w,h=list(map(int,e.split()))
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b=M[i-1][j][:2]
c,d=M[i][j-1][2:]
M[i][j]=[d,a+b,b,c+d]
print(((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5))
| for e in iter(input,'0 0'):
w,h=list(map(int,e.split()))
M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
for i in range(1,w):
for j in range(1,h):
a,b,c,d=[*M[i-1][j][:2],*M[i][j-1][2:]]
M[i][j]=[d,a+b,b,c+d]
print(((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5))
| 9 | 8 | 272 | 272 | for e in iter(input, "0 0"):
w, h = list(map(int, e.split()))
M = [[[1, 0] * 2 for _ in [0] * h] for _ in [0] * w]
for i in range(1, w):
for j in range(1, h):
a, b = M[i - 1][j][:2]
c, d = M[i][j - 1][2:]
M[i][j] = [d, a + b, b, c + d]
print(((sum(M[w - 2][h -... | for e in iter(input, "0 0"):
w, h = list(map(int, e.split()))
M = [[[1, 0] * 2 for _ in [0] * h] for _ in [0] * w]
for i in range(1, w):
for j in range(1, h):
a, b, c, d = [*M[i - 1][j][:2], *M[i][j - 1][2:]]
M[i][j] = [d, a + b, b, c + d]
print(((sum(M[w - 2][h - 1][:2])... | false | 11.111111 | [
"- a, b = M[i - 1][j][:2]",
"- c, d = M[i][j - 1][2:]",
"+ a, b, c, d = [*M[i - 1][j][:2], *M[i][j - 1][2:]]"
] | false | 0.10303 | 0.043796 | 2.352514 | [
"s220924778",
"s773980275"
] |
u042885182 | p02394 | python | s788431415 | s925843859 | 30 | 20 | 7,664 | 7,660 | Accepted | Accepted | 33.33 | # coding: utf-8
# Here your code !
import math
def func():
try:
line=input().rstrip()
numbers=line.split(" ")
width=float(numbers[0])
height=float(numbers[1])
x=float(numbers[2])
y=float(numbers[3])
r=abs(float(numbers[4]))
... | # coding: utf-8
# Here your code !
import math
def func():
try:
line=input().rstrip()
numbers=line.split(" ")
width=float(numbers[0])
height=float(numbers[1])
x=float(numbers[2])
y=float(numbers[3])
r=abs(float(numbers[4]))
... | 33 | 33 | 723 | 698 | # coding: utf-8
# Here your code !
import math
def func():
try:
line = input().rstrip()
numbers = line.split(" ")
width = float(numbers[0])
height = float(numbers[1])
x = float(numbers[2])
y = float(numbers[3])
r = abs(float(numbers[4]))
except:
... | # coding: utf-8
# Here your code !
import math
def func():
try:
line = input().rstrip()
numbers = line.split(" ")
width = float(numbers[0])
height = float(numbers[1])
x = float(numbers[2])
y = float(numbers[3])
r = abs(float(numbers[4]))
except:
... | false | 0 | [
"- result = wsign * x + r <= wsign * width",
"- result = result and (wsign * x - r >= 0)",
"- result = result and (hsign * y + r <= hsign * height)",
"- result = result and (hsign * y - r >= 0)",
"- if result:",
"- print(\"Yes\")",
"- else:",
"- print(\"No\")",
"+ ... | false | 0.035491 | 0.036291 | 0.977944 | [
"s788431415",
"s925843859"
] |
u644907318 | p03457 | python | s373240206 | s779847528 | 641 | 223 | 60,504 | 90,300 | Accepted | Accepted | 65.21 | def dist(x,y):
return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
X.insert(0,[0,0,0])
flag = 0
for i in range(1,N+1):
dx = dist(X[i][1:],X[i-1][1:])
dt = X[i][0]-X[i-1][0]
if dt>=dx and (dt-dx)%2==0:
continue
else:
... | def dist(x,y):
return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(eval(input()))
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1,x1,y1 = 0,0,0
for i in range(N):
t2,x2,y2 = X[i]
d = dist((x1,y1),(x2,y2))
dt = t2-t1
if dt>=d and (dt-d)%2==0:
t1,x1,y1 = X[i]
else:
... | 18 | 19 | 399 | 399 | def dist(x, y):
return abs(x[0] - y[0]) + abs(x[1] - y[1])
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
X.insert(0, [0, 0, 0])
flag = 0
for i in range(1, N + 1):
dx = dist(X[i][1:], X[i - 1][1:])
dt = X[i][0] - X[i - 1][0]
if dt >= dx and (dt - dx) % 2 == 0:
c... | def dist(x, y):
return abs(x[0] - y[0]) + abs(x[1] - y[1])
N = int(eval(input()))
X = [list(map(int, input().split())) for _ in range(N)]
flag = 0
t1, x1, y1 = 0, 0, 0
for i in range(N):
t2, x2, y2 = X[i]
d = dist((x1, y1), (x2, y2))
dt = t2 - t1
if dt >= d and (dt - d) % 2 == 0:
t1, x1, y... | false | 5.263158 | [
"-X.insert(0, [0, 0, 0])",
"-for i in range(1, N + 1):",
"- dx = dist(X[i][1:], X[i - 1][1:])",
"- dt = X[i][0] - X[i - 1][0]",
"- if dt >= dx and (dt - dx) % 2 == 0:",
"- continue",
"+t1, x1, y1 = 0, 0, 0",
"+for i in range(N):",
"+ t2, x2, y2 = X[i]",
"+ d = dist((x1, y1), ... | false | 0.038799 | 0.066118 | 0.586821 | [
"s373240206",
"s779847528"
] |
u871201743 | p03168 | python | s402512809 | s732317412 | 853 | 338 | 252,424 | 43,868 | Accepted | Accepted | 60.38 | n = int(eval(input()))
probs = [float(c) for c in input().split()]
dp = [[0] * (n+1) for _ in range(n+1)]
dp[0][0] = 1
for coin in range(1, n+1):
for heads in range(n+1):
dp[coin][heads] = dp[coin-1][heads] * (1 - probs[coin-1])
if heads > 0:
dp[coin][heads] += dp[coin-1][heads... | n = int(eval(input()))
probs = [float(c) for c in input().split()]
dp = [0] * (n+1)
dp[0] = 1
for coin in range(n):
for heads in reversed(list(range(n+1))):
dp[heads] = dp[heads] * (1 - probs[coin-1])
if heads > 0:
dp[heads] += dp[heads-1] * probs[coin-1]
ans = 0
for heads ... | 16 | 18 | 411 | 408 | n = int(eval(input()))
probs = [float(c) for c in input().split()]
dp = [[0] * (n + 1) for _ in range(n + 1)]
dp[0][0] = 1
for coin in range(1, n + 1):
for heads in range(n + 1):
dp[coin][heads] = dp[coin - 1][heads] * (1 - probs[coin - 1])
if heads > 0:
dp[coin][heads] += dp[coin - 1][h... | n = int(eval(input()))
probs = [float(c) for c in input().split()]
dp = [0] * (n + 1)
dp[0] = 1
for coin in range(n):
for heads in reversed(list(range(n + 1))):
dp[heads] = dp[heads] * (1 - probs[coin - 1])
if heads > 0:
dp[heads] += dp[heads - 1] * probs[coin - 1]
ans = 0
for heads in r... | false | 11.111111 | [
"-dp = [[0] * (n + 1) for _ in range(n + 1)]",
"-dp[0][0] = 1",
"-for coin in range(1, n + 1):",
"- for heads in range(n + 1):",
"- dp[coin][heads] = dp[coin - 1][heads] * (1 - probs[coin - 1])",
"+dp = [0] * (n + 1)",
"+dp[0] = 1",
"+for coin in range(n):",
"+ for heads in reversed(lis... | false | 0.035874 | 0.063137 | 0.568197 | [
"s402512809",
"s732317412"
] |
u746428948 | p02645 | python | s478431935 | s420305054 | 26 | 23 | 9,092 | 9,020 | Accepted | Accepted | 11.54 | s = eval(input())
print(('{}{}{}'.format(s[0],s[1],s[2]))) | print((input()[0:3])) | 2 | 1 | 51 | 19 | s = eval(input())
print(("{}{}{}".format(s[0], s[1], s[2])))
| print((input()[0:3]))
| false | 50 | [
"-s = eval(input())",
"-print((\"{}{}{}\".format(s[0], s[1], s[2])))",
"+print((input()[0:3]))"
] | false | 0.036744 | 0.033201 | 1.106714 | [
"s478431935",
"s420305054"
] |
u358254559 | p03805 | python | s420136322 | s056940471 | 199 | 179 | 40,432 | 40,432 | Accepted | Accepted | 10.05 | n, m = list(map(int, input().split()))
link = [[] for _ in range(n)]
for i in range(m):
tmp = list(map(int,input().split()))
link[tmp[0]-1].append(tmp[1]-1)
link[tmp[1]-1].append(tmp[0]-1)
lis=[]
for i in range(1,n):
lis.append(i)
ans=0
from itertools import *
for perm in list(permutations(... | n, m = list(map(int, input().split()))
link = [[] for _ in range(n)]
for i in range(m):
tmp = list(map(int,input().split()))
link[tmp[0]-1].append(tmp[1]-1)
link[tmp[1]-1].append(tmp[0]-1)
lis = list(range(1,n))
ans=0
from itertools import *
for perm in list(permutations(lis)):
last=0
ok=... | 23 | 18 | 519 | 451 | n, m = list(map(int, input().split()))
link = [[] for _ in range(n)]
for i in range(m):
tmp = list(map(int, input().split()))
link[tmp[0] - 1].append(tmp[1] - 1)
link[tmp[1] - 1].append(tmp[0] - 1)
lis = []
for i in range(1, n):
lis.append(i)
ans = 0
from itertools import *
for perm in list(permutation... | n, m = list(map(int, input().split()))
link = [[] for _ in range(n)]
for i in range(m):
tmp = list(map(int, input().split()))
link[tmp[0] - 1].append(tmp[1] - 1)
link[tmp[1] - 1].append(tmp[0] - 1)
lis = list(range(1, n))
ans = 0
from itertools import *
for perm in list(permutations(lis)):
last = 0
... | false | 21.73913 | [
"-lis = []",
"-for i in range(1, n):",
"- lis.append(i)",
"+lis = list(range(1, n))",
"- ok = True",
"+ ok = 1",
"- ok = False",
"- break",
"+ ok = 0",
"- if ok:",
"- ans += 1",
"+ ans += ok"
] | false | 0.048664 | 0.107545 | 0.452503 | [
"s420136322",
"s056940471"
] |
u653041271 | p03244 | python | s052569797 | s333232112 | 105 | 96 | 25,656 | 26,672 | Accepted | Accepted | 8.57 | import sys, bisect, math, itertools, string, queue, copy
#import numpy as np
#import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod... | import sys, bisect, math, itertools, string, queue, copy
#import numpy as np
#import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod... | 47 | 33 | 1,418 | 1,155 | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = ... | import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter, defaultdict, deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = ... | false | 29.787234 | [
"-cnt_even = defaultdict(int)",
"-cnt_odd = defaultdict(int)",
"-for i in range(0, n, 2):",
"- cnt_even[a[i]] += 1",
"-for i in range(1, n, 2):",
"- cnt_odd[a[i]] += 1",
"-cnt_even = list(reversed(sorted(list(cnt_even.items()), key=lambda x: x[1])))",
"-cnt_odd = list(reversed(sorted(list(cnt_od... | false | 0.037519 | 0.03533 | 1.061968 | [
"s052569797",
"s333232112"
] |
u790012205 | p03162 | python | s153227596 | s477374528 | 983 | 665 | 47,388 | 50,092 | Accepted | Accepted | 32.35 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j == k:
continue
... | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N + 1)]
dp[0][0] = 0
dp[0][1] = 0
dp[0][2] = 0
for i in range(1, N + 1):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(d... | 17 | 13 | 413 | 372 | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1, N):
for j in range(3):
for k in range(3):
if j == k:
continue
dpp = dp[i ... | N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(N + 1)]
dp[0][0] = 0
dp[0][1] = 0
dp[0][2] = 0
for i in range(1, N + 1):
for j in range(3):
for k in range(3):
if j == k:
continue
dp[i][j] = max(dp[i][j], dp... | false | 23.529412 | [
"-dp = [[0] * 3 for _ in range(N)]",
"-dp[0][0] = abc[0][0]",
"-dp[0][1] = abc[0][1]",
"-dp[0][2] = abc[0][2]",
"-for i in range(1, N):",
"+dp = [[0] * 3 for _ in range(N + 1)]",
"+dp[0][0] = 0",
"+dp[0][1] = 0",
"+dp[0][2] = 0",
"+for i in range(1, N + 1):",
"- dpp = dp[i - 1][j] + a... | false | 0.035312 | 0.041693 | 0.846961 | [
"s153227596",
"s477374528"
] |
u644907318 | p03043 | python | s924007865 | s638908020 | 176 | 88 | 39,024 | 73,868 | Accepted | Accepted | 50 | def f(n):
x = 1
while n*2**x<K:
x += 1
return x
N,K = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
if i<K:
ans += 2**(-f(i))/N
else:
ans += 1/N
print(ans) | def f(n):
k = 0
while n*2**k<K:
k += 1
return k
N,K = list(map(int,input().split()))
if K<=N:
P = (N-K+1)/N
for i in range(1,K):
P += 2**(-f(i))/N
else:
P = 0
for i in range(1,N+1):
P += 2**(-f(i))/N
print(P) | 13 | 15 | 221 | 268 | def f(n):
x = 1
while n * 2**x < K:
x += 1
return x
N, K = list(map(int, input().split()))
ans = 0
for i in range(1, N + 1):
if i < K:
ans += 2 ** (-f(i)) / N
else:
ans += 1 / N
print(ans)
| def f(n):
k = 0
while n * 2**k < K:
k += 1
return k
N, K = list(map(int, input().split()))
if K <= N:
P = (N - K + 1) / N
for i in range(1, K):
P += 2 ** (-f(i)) / N
else:
P = 0
for i in range(1, N + 1):
P += 2 ** (-f(i)) / N
print(P)
| false | 13.333333 | [
"- x = 1",
"- while n * 2**x < K:",
"- x += 1",
"- return x",
"+ k = 0",
"+ while n * 2**k < K:",
"+ k += 1",
"+ return k",
"-ans = 0",
"-for i in range(1, N + 1):",
"- if i < K:",
"- ans += 2 ** (-f(i)) / N",
"- else:",
"- ans += 1 / N",... | false | 0.06365 | 0.035245 | 1.805936 | [
"s924007865",
"s638908020"
] |
u360116509 | p03061 | python | s458132601 | s600086251 | 193 | 176 | 14,436 | 14,432 | Accepted | Accepted | 8.81 | def gcd(a, b):
r = a % b
if r == 0:
return b
return gcd(b, r)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
L = [A[0]]
R = [A[-1]]
for i in range(1, N - 1):
L.append(gcd(L[-1], A[i]))
for j in range(N - 2, 0, -1):
... | def gcd(a, b):
r = a % b
if r == 0:
return b
return gcd(b, r)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
L = [A[0]]
R = [A[-1]]
for i in range(1, N - 1):
L.append(gcd(L[-1], A[i]))
for j in range(N - 2, 0, -1):
R.appe... | 22 | 21 | 492 | 478 | def gcd(a, b):
r = a % b
if r == 0:
return b
return gcd(b, r)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
L = [A[0]]
R = [A[-1]]
for i in range(1, N - 1):
L.append(gcd(L[-1], A[i]))
for j in range(N - 2, 0, -1):
R.appe... | def gcd(a, b):
r = a % b
if r == 0:
return b
return gcd(b, r)
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
L = [A[0]]
R = [A[-1]]
for i in range(1, N - 1):
L.append(gcd(L[-1], A[i]))
for j in range(N - 2, 0, -1):
R.append(gcd(R[-1],... | false | 4.545455 | [
"- A.sort()"
] | false | 0.049751 | 0.047707 | 1.042843 | [
"s458132601",
"s600086251"
] |
u499381410 | p02666 | python | s145512832 | s260520514 | 1,643 | 1,362 | 241,784 | 237,456 | Accepted | Accepted | 17.1 | 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 ceil, floor, cos,... | 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, ... | 144 | 123 | 3,418 | 3,141 | 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 ceil, floor, cos, radians,... | 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 | 14.583333 | [
"-from math import ceil, floor, cos, radians, pi, sin",
"+from math import factorial, ceil, floor, cos, radians, pi, sin",
"-from functools import lru_cache",
"-",
"-",
"-@lru_cache(maxsize=None)",
"-def factorial(n):",
"- if n == 0:",
"- return 1",
"- else:",
"- return (n * ... | false | 0.044015 | 0.116918 | 0.376459 | [
"s145512832",
"s260520514"
] |
u395202850 | p03945 | python | s763928415 | s235170357 | 46 | 38 | 3,188 | 3,188 | Accepted | Accepted | 17.39 | s = eval(input())
cnt = 0
for i in range(len(s)-1):
if s[i] != s[i + 1]:
cnt += 1
print(cnt)
| s = eval(input())
print((sum(s[i] != s[i + 1] for i in range(len(s)-1))))
| 6 | 2 | 104 | 67 | s = eval(input())
cnt = 0
for i in range(len(s) - 1):
if s[i] != s[i + 1]:
cnt += 1
print(cnt)
| s = eval(input())
print((sum(s[i] != s[i + 1] for i in range(len(s) - 1))))
| false | 66.666667 | [
"-cnt = 0",
"-for i in range(len(s) - 1):",
"- if s[i] != s[i + 1]:",
"- cnt += 1",
"-print(cnt)",
"+print((sum(s[i] != s[i + 1] for i in range(len(s) - 1))))"
] | false | 0.044779 | 0.041185 | 1.087248 | [
"s763928415",
"s235170357"
] |
u706695185 | p03212 | python | s082105892 | s867555048 | 106 | 73 | 7,028 | 4,724 | Accepted | Accepted | 31.13 | N = int(eval(input()))
dp = []
def dfs(x):
if len(set(str(x))) == 3:
dp.append(x)
if x < 10**9:
dfs(x*10+3)
dfs(x*10+5)
dfs(x*10+7)
dfs(0)
print((len([item for item in dp if item <= N])))
| from collections import deque
N = int(eval(input()))
q = deque()
q.append(0)
memo = []
while q:
x = q.pop()
if x < 10**9:
if len(set(str(x))) == 3:
memo.append(x)
q.append(10*x+3)
q.append(10*x+5)
q.append(10*x+7)
print((len([num for num in memo if num ... | 14 | 15 | 236 | 321 | N = int(eval(input()))
dp = []
def dfs(x):
if len(set(str(x))) == 3:
dp.append(x)
if x < 10**9:
dfs(x * 10 + 3)
dfs(x * 10 + 5)
dfs(x * 10 + 7)
dfs(0)
print((len([item for item in dp if item <= N])))
| from collections import deque
N = int(eval(input()))
q = deque()
q.append(0)
memo = []
while q:
x = q.pop()
if x < 10**9:
if len(set(str(x))) == 3:
memo.append(x)
q.append(10 * x + 3)
q.append(10 * x + 5)
q.append(10 * x + 7)
print((len([num for num in memo if num <=... | false | 6.666667 | [
"+from collections import deque",
"+",
"-dp = []",
"-",
"-",
"-def dfs(x):",
"- if len(set(str(x))) == 3:",
"- dp.append(x)",
"+q = deque()",
"+q.append(0)",
"+memo = []",
"+while q:",
"+ x = q.pop()",
"- dfs(x * 10 + 3)",
"- dfs(x * 10 + 5)",
"- dfs(x... | false | 0.135942 | 0.369825 | 0.367585 | [
"s082105892",
"s867555048"
] |
u080364835 | p02831 | python | s490323117 | s030865413 | 28 | 23 | 2,940 | 9,064 | Accepted | Accepted | 17.86 | a, b = list(map(int, input().split()))
gcd = 0
for i in range(max(a, b), 0, -1):
if a % i == 0 and b % i == 0:
gcd = i
break
print((a * b // gcd)) | import math
a, b = list(map(int, input().split()))
print(((a*b)//math.gcd(a, b))) | 7 | 4 | 164 | 77 | a, b = list(map(int, input().split()))
gcd = 0
for i in range(max(a, b), 0, -1):
if a % i == 0 and b % i == 0:
gcd = i
break
print((a * b // gcd))
| import math
a, b = list(map(int, input().split()))
print(((a * b) // math.gcd(a, b)))
| false | 42.857143 | [
"+import math",
"+",
"-gcd = 0",
"-for i in range(max(a, b), 0, -1):",
"- if a % i == 0 and b % i == 0:",
"- gcd = i",
"- break",
"-print((a * b // gcd))",
"+print(((a * b) // math.gcd(a, b)))"
] | false | 0.048267 | 0.041899 | 1.151979 | [
"s490323117",
"s030865413"
] |
u558242240 | p03289 | python | s838018541 | s819256257 | 21 | 17 | 3,316 | 2,940 | Accepted | Accepted | 19.05 | s = eval(input())
if s[0] != 'A':
print('WA')
exit()
import collections
cnt = collections.Counter(s[2:-1])
if cnt['C'] != 1:
print('WA')
exit()
s2 = s[1:].replace('C', '')
if not s2.islower():
print('WA')
exit()
print('AC')
| s = eval(input())
if s[0] != 'A':
print('WA')
exit()
if s.count('C', 2, -1) != 1:
print('WA')
exit()
s2 = s[1:].replace('C', '')
if not s2.islower():
print('WA')
exit()
print('AC')
| 20 | 18 | 267 | 222 | s = eval(input())
if s[0] != "A":
print("WA")
exit()
import collections
cnt = collections.Counter(s[2:-1])
if cnt["C"] != 1:
print("WA")
exit()
s2 = s[1:].replace("C", "")
if not s2.islower():
print("WA")
exit()
print("AC")
| s = eval(input())
if s[0] != "A":
print("WA")
exit()
if s.count("C", 2, -1) != 1:
print("WA")
exit()
s2 = s[1:].replace("C", "")
if not s2.islower():
print("WA")
exit()
print("AC")
| false | 10 | [
"-import collections",
"-",
"-cnt = collections.Counter(s[2:-1])",
"-if cnt[\"C\"] != 1:",
"+if s.count(\"C\", 2, -1) != 1:"
] | false | 0.03994 | 0.039856 | 1.00211 | [
"s838018541",
"s819256257"
] |
u970197315 | p02725 | python | s251967014 | s024885298 | 259 | 151 | 26,444 | 32,256 | Accepted | Accepted | 41.7 | # ABC160_C
k,n=list(map(int,input().split()))
a=list(map(int,input().split()))
# mid=(a[0]+a[-1])/2
d=[]
for i in range(n-1):
d.append(a[i+1]-a[i])
# d.append(k-a[-1])
# d=[k-a[-1]]+d
# print(d)
ans=10**10
d=[k-a[-1]+a[0]]+d
d+=[k-a[-1]+a[0]]
# print(d)
for i in range(1,n):
t=min(k-d[i-1],k-d[i... | k,n=list(map(int,input().split()))
a=list(map(int,input().split()))
d=[]
d.append(k-a[-1]+a[0])
for i in range(1,n):
d.append(a[i]-a[i-1])
ans=10**18
for di in d:
t=k-di
ans=min(ans,t)
print(ans) | 19 | 11 | 351 | 205 | # ABC160_C
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
# mid=(a[0]+a[-1])/2
d = []
for i in range(n - 1):
d.append(a[i + 1] - a[i])
# d.append(k-a[-1])
# d=[k-a[-1]]+d
# print(d)
ans = 10**10
d = [k - a[-1] + a[0]] + d
d += [k - a[-1] + a[0]]
# print(d)
for i in range(1, n):
t = m... | k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = []
d.append(k - a[-1] + a[0])
for i in range(1, n):
d.append(a[i] - a[i - 1])
ans = 10**18
for di in d:
t = k - di
ans = min(ans, t)
print(ans)
| false | 42.105263 | [
"-# ABC160_C",
"-# mid=(a[0]+a[-1])/2",
"-for i in range(n - 1):",
"- d.append(a[i + 1] - a[i])",
"-# d.append(k-a[-1])",
"-# d=[k-a[-1]]+d",
"-# print(d)",
"-ans = 10**10",
"-d = [k - a[-1] + a[0]] + d",
"-d += [k - a[-1] + a[0]]",
"-# print(d)",
"+d.append(k - a[-1] + a[0])",
"- t = ... | false | 0.036709 | 0.039023 | 0.94071 | [
"s251967014",
"s024885298"
] |
u133936772 | p03087 | python | s992432619 | s442781029 | 870 | 286 | 6,292 | 6,332 | Accepted | Accepted | 67.13 | f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0]*n
for i in range(1,n):
if s[i-1:i+1] == 'AC':
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | import sys
input = sys.stdin.readline
f = lambda : list(map(int,input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0]*n
for i in range(1,n):
if s[i-1:i+1] == 'AC':
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r-1]-ln[l-1])) | 14 | 16 | 224 | 264 | f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0] * n
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| import sys
input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n, q = f()
s = eval(input())
cnt = 0
ln = [0] * n
for i in range(1, n):
if s[i - 1 : i + 1] == "AC":
cnt += 1
ln[i] = cnt
for _ in range(q):
l, r = f()
print((ln[r - 1] - ln[l - 1]))
| false | 12.5 | [
"+import sys",
"+",
"+input = sys.stdin.readline"
] | false | 0.083702 | 0.037539 | 2.229726 | [
"s992432619",
"s442781029"
] |
u074220993 | p03487 | python | s502024010 | s043878314 | 190 | 66 | 20,592 | 22,452 | Accepted | Accepted | 65.26 | N = eval(input())
A = sorted([int(x) for x in input().split()])
import bisect as bs
ans = 0
f = lambda X, x: bs.bisect_right(X,x) - bs.bisect_left(X,x)
for a in set(A):
cnt = f(A,a)
if cnt < a:
ans += cnt
else:
ans += cnt-a
print(ans) | from collections import Counter
from itertools import starmap
def main():
N = eval(input())
A = list(map(int, input().split()))
count = Counter(A)
remove = lambda x,y: y-x if y >= x else y
ans = sum(starmap(remove, list(count.items())))
print(ans)
main() | 12 | 11 | 267 | 277 | N = eval(input())
A = sorted([int(x) for x in input().split()])
import bisect as bs
ans = 0
f = lambda X, x: bs.bisect_right(X, x) - bs.bisect_left(X, x)
for a in set(A):
cnt = f(A, a)
if cnt < a:
ans += cnt
else:
ans += cnt - a
print(ans)
| from collections import Counter
from itertools import starmap
def main():
N = eval(input())
A = list(map(int, input().split()))
count = Counter(A)
remove = lambda x, y: y - x if y >= x else y
ans = sum(starmap(remove, list(count.items())))
print(ans)
main()
| false | 8.333333 | [
"-N = eval(input())",
"-A = sorted([int(x) for x in input().split()])",
"-import bisect as bs",
"+from collections import Counter",
"+from itertools import starmap",
"-ans = 0",
"-f = lambda X, x: bs.bisect_right(X, x) - bs.bisect_left(X, x)",
"-for a in set(A):",
"- cnt = f(A, a)",
"- if cn... | false | 0.040151 | 0.043178 | 0.929891 | [
"s502024010",
"s043878314"
] |
u960171798 | p03316 | python | s307104563 | s493139484 | 19 | 17 | 2,940 | 2,940 | Accepted | Accepted | 10.53 | N = eval(input())
S = 0
for n in N:
S += int(n)
N = int(N)
print(("Yes" if N%S == 0 else "No"))
| n = eval(input())
N = int(n)
n = list(n)
for i in range(len(n)):
n[i] = int(n[i])
sum_n = sum(n)
if N%sum_n==0:
print("Yes")
else:
print("No")
| 6 | 10 | 95 | 158 | N = eval(input())
S = 0
for n in N:
S += int(n)
N = int(N)
print(("Yes" if N % S == 0 else "No"))
| n = eval(input())
N = int(n)
n = list(n)
for i in range(len(n)):
n[i] = int(n[i])
sum_n = sum(n)
if N % sum_n == 0:
print("Yes")
else:
print("No")
| false | 40 | [
"-N = eval(input())",
"-S = 0",
"-for n in N:",
"- S += int(n)",
"-N = int(N)",
"-print((\"Yes\" if N % S == 0 else \"No\"))",
"+n = eval(input())",
"+N = int(n)",
"+n = list(n)",
"+for i in range(len(n)):",
"+ n[i] = int(n[i])",
"+sum_n = sum(n)",
"+if N % sum_n == 0:",
"+ print(... | false | 0.046198 | 0.0479 | 0.964468 | [
"s307104563",
"s493139484"
] |
u863442865 | p03325 | python | s764362479 | s187601097 | 111 | 89 | 4,148 | 4,148 | Accepted | Accepted | 19.82 | n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while (i % 2==0):
i /= 2
cnt += 1
print(cnt)
| n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while ( i % 2==0):
i //= 2
cnt += 1
print(cnt)
| 8 | 8 | 137 | 139 | n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while i % 2 == 0:
i /= 2
cnt += 1
print(cnt)
| n = int(eval(input()))
ni = list(map(int, input().split()))
cnt = 0
for i in ni:
while i % 2 == 0:
i //= 2
cnt += 1
print(cnt)
| false | 0 | [
"- i /= 2",
"+ i //= 2"
] | false | 0.050182 | 0.069275 | 0.724392 | [
"s764362479",
"s187601097"
] |
u047796752 | p03039 | python | s396391636 | s554316027 | 195 | 96 | 43,632 | 79,728 | Accepted | Accepted | 50.77 | MAX = 2*10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
finv[i] = finv[i-1]*inv[... | MAX = 2*10**5+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
finv[i] = finv[i-1]*inv[... | 38 | 35 | 693 | 679 | MAX = 2 * 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX # fact[i]: i!
inv = [0] * MAX # inv[i]: iの逆元
finv = [0] * MAX # finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] =... | MAX = 2 * 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX # fact[i]: i!
inv = [0] * MAX # inv[i]: iの逆元
finv = [0] * MAX # finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] =... | false | 7.894737 | [
"-for d in range(1, N):",
"- ans += d * (N - d) * M**2",
"+for i in range(1, N):",
"+ ans += i * (N - i) * M * M * C(N * M - 2, K - 2)",
"-for d in range(1, M):",
"- ans += d * (M - d) * N**2",
"+for i in range(1, M):",
"+ ans += i * (M - i) * N * N * C(N * M - 2, K - 2)",
"-ans *= C(N *... | false | 1.076703 | 1.18189 | 0.911001 | [
"s396391636",
"s554316027"
] |
u472065247 | p03798 | python | s659181382 | s486756903 | 176 | 131 | 7,000 | 5,644 | Accepted | Accepted | 25.57 | N = int(input())
s = input()
s += s[0]
l = [0] * (N + 2)
# S: 1, W: 0
for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)):
l[0], l[1] = a0, a1
for i in range(1, N + 1):
if s[i] == 'o': l[i + 1] = not (l[i] ^ l[i - 1])
else: l[i + 1] = l[i] ^ l[i - 1]
if (l[0] == l[-2]) and (l[1] == l[-1]):
... | N = int(eval(input()))
s = eval(input())
s += s[0]
# S: 1, W: 0
for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)):
l = [a0, a1]
for i in range(1, N + 1):
if s[i] == 'o':
a0, a1 = a1, not (a0 ^ a1)
else:
a0, a1 = a1, (a0 ^ a1)
l.append(a1)
if (l[0] == l[-2]) and (l[1] == l[-1... | 18 | 21 | 402 | 409 | N = int(input())
s = input()
s += s[0]
l = [0] * (N + 2)
# S: 1, W: 0
for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)):
l[0], l[1] = a0, a1
for i in range(1, N + 1):
if s[i] == "o":
l[i + 1] = not (l[i] ^ l[i - 1])
else:
l[i + 1] = l[i] ^ l[i - 1]
if (l[0] == l[-2]) and... | N = int(eval(input()))
s = eval(input())
s += s[0]
# S: 1, W: 0
for a0, a1 in ((0, 0), (0, 1), (1, 0), (1, 1)):
l = [a0, a1]
for i in range(1, N + 1):
if s[i] == "o":
a0, a1 = a1, not (a0 ^ a1)
else:
a0, a1 = a1, (a0 ^ a1)
l.append(a1)
if (l[0] == l[-2]) and (... | false | 14.285714 | [
"-N = int(input())",
"-s = input()",
"+N = int(eval(input()))",
"+s = eval(input())",
"-l = [0] * (N + 2)",
"- l[0], l[1] = a0, a1",
"+ l = [a0, a1]",
"- l[i + 1] = not (l[i] ^ l[i - 1])",
"+ a0, a1 = a1, not (a0 ^ a1)",
"- l[i + 1] = l[i] ^ l[i - 1]",
"+ ... | false | 0.084813 | 0.058557 | 1.448377 | [
"s659181382",
"s486756903"
] |
u989345508 | p02691 | python | s805578430 | s091488149 | 283 | 246 | 57,676 | 63,352 | Accepted | Accepted | 13.07 | n=int(eval(input()))
a=list(map(int,input().split()))
c,d=dict(),dict()
for i in range(n):
if i+1-a[i] in c:
c[i+1-a[i]]+=1
else:
c[i+1-a[i]]=1
if i+1+a[i] in d:
d[i+1+a[i]]+=1
else:
d[i+1+a[i]]=1
ans=0
for i in c:
if i in d:
ans+=(c[i]*d[i])
p... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
L = [i + A[i] for i in range(N)]
R = [i - A[i] for i in range(N)]
countL = collections.Counter(L)
countR = collections.Counter(R)
print((sum([countL[n] * countR[n] for n in list(countL.keys())]))) | 17 | 12 | 324 | 275 | n = int(eval(input()))
a = list(map(int, input().split()))
c, d = dict(), dict()
for i in range(n):
if i + 1 - a[i] in c:
c[i + 1 - a[i]] += 1
else:
c[i + 1 - a[i]] = 1
if i + 1 + a[i] in d:
d[i + 1 + a[i]] += 1
else:
d[i + 1 + a[i]] = 1
ans = 0
for i in c:
if i in d:... | import collections
N = int(eval(input()))
A = list(map(int, input().split()))
L = [i + A[i] for i in range(N)]
R = [i - A[i] for i in range(N)]
countL = collections.Counter(L)
countR = collections.Counter(R)
print((sum([countL[n] * countR[n] for n in list(countL.keys())])))
| false | 29.411765 | [
"-n = int(eval(input()))",
"-a = list(map(int, input().split()))",
"-c, d = dict(), dict()",
"-for i in range(n):",
"- if i + 1 - a[i] in c:",
"- c[i + 1 - a[i]] += 1",
"- else:",
"- c[i + 1 - a[i]] = 1",
"- if i + 1 + a[i] in d:",
"- d[i + 1 + a[i]] += 1",
"- el... | false | 0.036057 | 0.036427 | 0.989849 | [
"s805578430",
"s091488149"
] |
u877415670 | p02744 | python | s838440817 | s612839302 | 155 | 109 | 4,412 | 17,376 | Accepted | Accepted | 29.68 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
def bfs(s, cnt, m):
if cnt == N:
print(s)
return
for i in range(97,ord(m)+2):
if chr(i) > m:
bfs(s+chr(i), cnt+1, chr(i))
else:
bfs(s+chr(i), cnt+1, m)
bfs('a',1,'a') | def dfs(cnt, s, now):
if cnt == n:
ans.append(s)
return
for i in range(now+1):
dfs(cnt+1, s+al[i], max(i+1, now))
n = int(eval(input()))
ans = []
al = [chr(i) for i in range(97, 97+26)]
dfs(0, "", 0)
for i in ans:
print(i) | 17 | 13 | 259 | 265 | import sys
sys.setrecursionlimit(10**9)
N = int(eval(input()))
def bfs(s, cnt, m):
if cnt == N:
print(s)
return
for i in range(97, ord(m) + 2):
if chr(i) > m:
bfs(s + chr(i), cnt + 1, chr(i))
else:
bfs(s + chr(i), cnt + 1, m)
bfs("a", 1, "a")
| def dfs(cnt, s, now):
if cnt == n:
ans.append(s)
return
for i in range(now + 1):
dfs(cnt + 1, s + al[i], max(i + 1, now))
n = int(eval(input()))
ans = []
al = [chr(i) for i in range(97, 97 + 26)]
dfs(0, "", 0)
for i in ans:
print(i)
| false | 23.529412 | [
"-import sys",
"-",
"-sys.setrecursionlimit(10**9)",
"-N = int(eval(input()))",
"+def dfs(cnt, s, now):",
"+ if cnt == n:",
"+ ans.append(s)",
"+ return",
"+ for i in range(now + 1):",
"+ dfs(cnt + 1, s + al[i], max(i + 1, now))",
"-def bfs(s, cnt, m):",
"- if cnt... | false | 0.060792 | 0.043869 | 1.385781 | [
"s838440817",
"s612839302"
] |
u225388820 | p02713 | python | s361707784 | s555595454 | 1,870 | 970 | 70,280 | 69,352 | Accepted | Accepted | 48.13 | def gcd(a,b):
while b:
a,b=b,a%b
return a
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for x in range(1,k+1):
ans+=gcd_list([i,j,x])
print(ans) | from math import gcd
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k=int(eval(input()))
ans=0
for i in range(1,k+1):
for j in range(1,k+1):
for x in range(1,k+1):
ans+=gcd_list([i,j,x])
print(ans) | 14 | 11 | 301 | 261 | def gcd(a, b):
while b:
a, b = b, a % b
return a
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for x in range(1, k + 1):
ans += gcd_list([i, j, x])
print... | from math import gcd
from functools import reduce
def gcd_list(numbers):
return reduce(gcd, numbers)
k = int(eval(input()))
ans = 0
for i in range(1, k + 1):
for j in range(1, k + 1):
for x in range(1, k + 1):
ans += gcd_list([i, j, x])
print(ans)
| false | 21.428571 | [
"-def gcd(a, b):",
"- while b:",
"- a, b = b, a % b",
"- return a",
"-",
"-",
"+from math import gcd"
] | false | 0.041971 | 0.107187 | 0.391567 | [
"s361707784",
"s555595454"
] |
u223663729 | p03061 | python | s101333904 | s777088856 | 193 | 80 | 16,144 | 23,412 | Accepted | Accepted | 58.55 | from fractions import gcd
N, *A, = list(map(int, open(0).read().split()))
l = [0]*N
r = [0]*N
# [0,i]のgcd
l[0] = A[0]
for i in range(1, N):
l[i] = gcd(l[i-1],A[i])
# [i,N-1]のgcd
r[N-1] = A[N-1]
for i in range(N-1)[::-1]:
r[i] = gcd(r[i+1],A[i])
m = [0]*N
for i in range(1, N-1):
m[i] = gc... | from itertools import accumulate
from math import gcd
N = int(eval(input()))
*A, = list(map(int, input().split()))
L = list(accumulate(A, gcd))
R = list(accumulate(A[::-1], gcd))[::-1]
ans = max(gcd(l, r) for l, r in zip([0]+L[:-1], R[1:]+[0]))
print(ans)
| 21 | 10 | 376 | 255 | from fractions import gcd
(
N,
*A,
) = list(map(int, open(0).read().split()))
l = [0] * N
r = [0] * N
# [0,i]のgcd
l[0] = A[0]
for i in range(1, N):
l[i] = gcd(l[i - 1], A[i])
# [i,N-1]のgcd
r[N - 1] = A[N - 1]
for i in range(N - 1)[::-1]:
r[i] = gcd(r[i + 1], A[i])
m = [0] * N
for i in range(1, N - 1):
... | from itertools import accumulate
from math import gcd
N = int(eval(input()))
(*A,) = list(map(int, input().split()))
L = list(accumulate(A, gcd))
R = list(accumulate(A[::-1], gcd))[::-1]
ans = max(gcd(l, r) for l, r in zip([0] + L[:-1], R[1:] + [0]))
print(ans)
| false | 52.380952 | [
"-from fractions import gcd",
"+from itertools import accumulate",
"+from math import gcd",
"-(",
"- N,",
"- *A,",
"-) = list(map(int, open(0).read().split()))",
"-l = [0] * N",
"-r = [0] * N",
"-# [0,i]のgcd",
"-l[0] = A[0]",
"-for i in range(1, N):",
"- l[i] = gcd(l[i - 1], A[i])",... | false | 0.05932 | 0.03812 | 1.556133 | [
"s101333904",
"s777088856"
] |
u796942881 | p02772 | python | s293321069 | s886274372 | 21 | 18 | 3,060 | 2,940 | Accepted | Accepted | 14.29 | def main():
N, *A = list(map(int, open(0).read().split()))
print(("DENIED" if sum(
[1 for Ai in A if not Ai % 2 and Ai % 3 and Ai % 5]) else "APPROVED"))
return
main()
| def main():
N, *A = list(map(int, open(0).read().split()))
for Ai in A:
if not Ai % 2 and Ai % 3 and Ai % 5:
print("DENIED")
return
print("APPROVED")
return
main()
| 8 | 11 | 189 | 218 | def main():
N, *A = list(map(int, open(0).read().split()))
print(
(
"DENIED"
if sum([1 for Ai in A if not Ai % 2 and Ai % 3 and Ai % 5])
else "APPROVED"
)
)
return
main()
| def main():
N, *A = list(map(int, open(0).read().split()))
for Ai in A:
if not Ai % 2 and Ai % 3 and Ai % 5:
print("DENIED")
return
print("APPROVED")
return
main()
| false | 27.272727 | [
"- print(",
"- (",
"- \"DENIED\"",
"- if sum([1 for Ai in A if not Ai % 2 and Ai % 3 and Ai % 5])",
"- else \"APPROVED\"",
"- )",
"- )",
"+ for Ai in A:",
"+ if not Ai % 2 and Ai % 3 and Ai % 5:",
"+ print(\"DENIED\")",
"+... | false | 0.045246 | 0.043922 | 1.030166 | [
"s293321069",
"s886274372"
] |
u150984829 | p00040 | python | s121593703 | s262226739 | 40 | 30 | 5,608 | 5,600 | Accepted | Accepted | 25 | z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
for i in range(1,26,2):
for j in range(26):
if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
def g(x,y,s=0,t=1):
q,r=x//y,x%y
return g(y,r,t,s-q*t) if r else t
for _ in[0]*int(eval(input... | z='abcdefghijklmnopqrstuvwxyz'
e=lambda x,i,j:z[(z.index(x)*i+j)%26]
def f():
for i in(1,3,5,7,9,11,15,17,19,21,23,25):
for j in range(26):
if''.join(e(c,i,j)for c in'that')in s or''.join(e(c,i,j)for c in'this')in s:return(i,j)
def g(x,y,s=0,t=1):
q,r=x//y,x%y
return g(y,r,t,s-q*t) if r else t
for _ in... | 14 | 14 | 422 | 440 | z = "abcdefghijklmnopqrstuvwxyz"
e = lambda x, i, j: z[(z.index(x) * i + j) % 26]
def f():
for i in range(1, 26, 2):
for j in range(26):
if (
"".join(e(c, i, j) for c in "that") in s
or "".join(e(c, i, j) for c in "this") in s
):
retu... | z = "abcdefghijklmnopqrstuvwxyz"
e = lambda x, i, j: z[(z.index(x) * i + j) % 26]
def f():
for i in (1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25):
for j in range(26):
if (
"".join(e(c, i, j) for c in "that") in s
or "".join(e(c, i, j) for c in "this") in s
... | false | 0 | [
"- for i in range(1, 26, 2):",
"+ for i in (1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25):"
] | false | 0.035056 | 0.036083 | 0.971539 | [
"s121593703",
"s262226739"
] |
u102461423 | p03283 | python | s682651050 | s980653700 | 1,679 | 615 | 26,252 | 98,212 | Accepted | Accepted | 63.37 | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N,M,Q = list(map(int,input().split()))
cnt = [[0]*(N+1) for _ in range(N+1)]
for _ in range(M):
x,y = list(map(int,input().split()))
cnt[x][y] += 1
# cumsumだけnumpyを使って、添字アクセスするときはlistの方が速い
cnt = np.cumsum(cnt,axis=0).cumsum(axis=1).tolist(... | import numpy as np
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N,M,Q = list(map(int,readline().split()))
lines = readlines()
L,R = np.array([line.split() for line in lines[:M]],np.int32).T
P,Q = np.array([line.split() for line in lines[M:]],np.int32).T
cnt = np.zeros((N+1,N+1),d... | 21 | 19 | 458 | 506 | # count p<=x<=q and p<=y <=q
# 長方形に含まれる格子点の数
import numpy as np
N, M, Q = list(map(int, input().split()))
cnt = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M):
x, y = list(map(int, input().split()))
cnt[x][y] += 1
# cumsumだけnumpyを使って、添字アクセスするときはlistの方が速い
cnt = np.cumsum(cnt, axis=0).cumsum(axis=1).tol... | import numpy as np
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
N, M, Q = list(map(int, readline().split()))
lines = readlines()
L, R = np.array([line.split() for line in lines[:M]], np.int32).T
P, Q = np.array([line.split() for line in lines[M:]], np.int32).T
cnt = np.zeros((N + 1, N + 1),... | false | 9.52381 | [
"-# count p<=x<=q and p<=y <=q",
"-# 長方形に含まれる格子点の数",
"+import sys",
"-N, M, Q = list(map(int, input().split()))",
"-cnt = [[0] * (N + 1) for _ in range(N + 1)]",
"-for _ in range(M):",
"- x, y = list(map(int, input().split()))",
"- cnt[x][y] += 1",
"-# cumsumだけnumpyを使って、添字アクセスするときはlistの方が速い",
... | false | 0.450368 | 0.266438 | 1.69033 | [
"s682651050",
"s980653700"
] |
u858523893 | p03805 | python | s822415184 | s087150706 | 106 | 35 | 3,064 | 3,064 | Accepted | Accepted | 66.98 | N, M = list(map(int, input().split()))
paths = set()
for i in range(M) :
_f, _t = list(map(int, input().split()))
paths.add((_f - 1, _t - 1))
paths.add((_t - 1, _f - 1))
zeromask = "".join(['0' for x in range(N)])
fullmask = "".join(['1' for x in range(N)])
cnt = 0
def do_mask(m, idx) :
... | N, M = list(map(int, input().split()))
a, b = [], []
for i in range(M) :
_a, _b = list(map(int, input().split()))
a.append(_a - 1)
b.append(_b - 1)
zero_mask = "".join(['0' for x in range(N)])
full_mask = "".join(['1' for x in range(N)])
paths_cnt = 0
paths_set = set()
def do_mask(m, i... | 28 | 39 | 651 | 980 | N, M = list(map(int, input().split()))
paths = set()
for i in range(M):
_f, _t = list(map(int, input().split()))
paths.add((_f - 1, _t - 1))
paths.add((_t - 1, _f - 1))
zeromask = "".join(["0" for x in range(N)])
fullmask = "".join(["1" for x in range(N)])
cnt = 0
def do_mask(m, idx):
return m[:idx] +... | N, M = list(map(int, input().split()))
a, b = [], []
for i in range(M):
_a, _b = list(map(int, input().split()))
a.append(_a - 1)
b.append(_b - 1)
zero_mask = "".join(["0" for x in range(N)])
full_mask = "".join(["1" for x in range(N)])
paths_cnt = 0
paths_set = set()
def do_mask(m, idx):
newmask = m[... | false | 28.205128 | [
"-paths = set()",
"+a, b = [], []",
"- _f, _t = list(map(int, input().split()))",
"- paths.add((_f - 1, _t - 1))",
"- paths.add((_t - 1, _f - 1))",
"-zeromask = \"\".join([\"0\" for x in range(N)])",
"-fullmask = \"\".join([\"1\" for x in range(N)])",
"-cnt = 0",
"+ _a, _b = list(map(int... | false | 0.035863 | 0.035743 | 1.003353 | [
"s822415184",
"s087150706"
] |
u813102292 | p03583 | python | s821855509 | s004725006 | 1,933 | 1,179 | 3,064 | 3,064 | Accepted | Accepted | 39.01 | N = int(eval(input()))
w1 = 10**5
w2 = 1
try:
for h in range(1,3501):
for n in range(1,3501):
if (4*h*n-N*(h+n))>0:
w1 = (N*h*n)//(4*h*n-N*(h+n))
w2 = (N*h*n)/(4*h*n-N*(h+n))
if w1==w2 and w1>0:
raise(Exception)
except Except... | def main():
N = int(eval(input()))
w1 = 10**5
w2 = 1
try:
for h in range(1,3501):
for n in range(1,3501):
if (4*h*n-N*(h+n))>0:
w1 = (N*h*n)//(4*h*n-N*(h+n))
w2 = (N*h*n)/(4*h*n-N*(h+n))
if w1==w2 and w... | 13 | 16 | 337 | 442 | N = int(eval(input()))
w1 = 10**5
w2 = 1
try:
for h in range(1, 3501):
for n in range(1, 3501):
if (4 * h * n - N * (h + n)) > 0:
w1 = (N * h * n) // (4 * h * n - N * (h + n))
w2 = (N * h * n) / (4 * h * n - N * (h + n))
if w1 == w2 and w1 > 0:
... | def main():
N = int(eval(input()))
w1 = 10**5
w2 = 1
try:
for h in range(1, 3501):
for n in range(1, 3501):
if (4 * h * n - N * (h + n)) > 0:
w1 = (N * h * n) // (4 * h * n - N * (h + n))
w2 = (N * h * n) / (4 * h * n - N * (h +... | false | 18.75 | [
"-N = int(eval(input()))",
"-w1 = 10**5",
"-w2 = 1",
"-try:",
"- for h in range(1, 3501):",
"- for n in range(1, 3501):",
"- if (4 * h * n - N * (h + n)) > 0:",
"- w1 = (N * h * n) // (4 * h * n - N * (h + n))",
"- w2 = (N * h * n) / (4 * h * n - N ... | false | 0.482844 | 0.466191 | 1.035722 | [
"s821855509",
"s004725006"
] |
u707808519 | p02555 | python | s331220396 | s531786971 | 1,240 | 60 | 127,604 | 9,192 | Accepted | Accepted | 95.16 | MOD = 10**9+7
MAX = 1000010
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i-1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD
finv[i] = finv[i-1] * inv... | MOD = 10**9+7
s = int(eval(input()))
x = s//3
MAX = s+1
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i-1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD
... | 32 | 31 | 615 | 610 | MOD = 10**9 + 7
MAX = 1000010
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i - 1] * inv[i]... | MOD = 10**9 + 7
s = int(eval(input()))
x = s // 3
MAX = s + 1
fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
def COMinit():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
... | false | 3.125 | [
"-MAX = 1000010",
"+s = int(eval(input()))",
"+x = s // 3",
"+MAX = s + 1",
"-s = int(eval(input()))",
"-x = s // 3"
] | false | 1.257313 | 0.040729 | 30.870202 | [
"s331220396",
"s531786971"
] |
u678167152 | p03096 | python | s163902448 | s382209185 | 919 | 291 | 52,120 | 120,760 | Accepted | Accepted | 68.34 | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9+7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = [[-1,-1]]
ends = [-1]
for l in list(d.values()):
for i ... | from collections import defaultdict
def solve():
ans = 0
N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
d = defaultdict(lambda: -1)
dp = [1]*N
d[C[0]] = 0
mod = 10**9+7
for i in range(1,N):
dp[i] = dp[i-1]
if d[C[i]]>-1 and d[C[i]]!=i-1:
dp[i] += dp[d[C[i]]]
... | 28 | 17 | 756 | 377 | from collections import defaultdict
from bisect import *
def solve():
mod = 10**9 + 7
d = defaultdict(lambda: [])
N = int(eval(input()))
for i in range(N):
a = int(eval(input()))
d[a].append(i)
selist = [[-1, -1]]
ends = [-1]
for l in list(d.values()):
for i in rang... | from collections import defaultdict
def solve():
ans = 0
N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
d = defaultdict(lambda: -1)
dp = [1] * N
d[C[0]] = 0
mod = 10**9 + 7
for i in range(1, N):
dp[i] = dp[i - 1]
if d[C[i]] > -1 and d[C[i]] != i - 1:
... | false | 39.285714 | [
"-from bisect import *",
"+ ans = 0",
"+ N = int(eval(input()))",
"+ C = [int(eval(input())) for _ in range(N)]",
"+ d = defaultdict(lambda: -1)",
"+ dp = [1] * N",
"+ d[C[0]] = 0",
"- d = defaultdict(lambda: [])",
"- N = int(eval(input()))",
"- for i in range(N):",
"-... | false | 0.007331 | 0.03578 | 0.204894 | [
"s163902448",
"s382209185"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.